29 #include "StHiSpectra.h"
32 const char* border =
"*************************************************";
36 StHiSpectra::StHiSpectra(
const char* inputDir,
37 const char* outRootName,
43 mEfficiencyString =
""; mEfficiencyFileName = f;
49 StHiSpectra::~StHiSpectra()
60 StHiSpectra::initMore()
66 TString fName =
"fEfficiency";
68 if(mEfficiencyFileName==
""){
69 cout <<
"no efficiency file set " << endl;
72 file=
new TFile(mEfficiencyFileName.Data());
73 if(!file ||!file->IsOpen()){
74 cout <<
"Cannot find efficiency file : " << mEfficiencyFileName << endl;
77 mEfficiencyMap = (TF2*)file->Get(fName.Data());
82 cout <<
"Cannot find efficency function : " << fName.Data() <<endl;
83 cout <<
"WARNING-USING DUMMY EFFIENCY" << endl;
84 mEfficiencyMap =
new TF2(
"fEfficiency",
"1");
88 cout <<
"\tefficiency file : " << mEfficiencyFileName << endl;
89 cout <<
"\tefficiency fcn title : " << mEfficiencyMap->GetTitle() << endl;
110 StHiSpectra::initHistograms()
112 cout <<
"StHiSpectra::initHistograms()" << endl;
125 nFlowCentBin,flowCentMin,flowCentMax);
127 h1Centrality =
new TH1D(
"h1Centrality",
"centrality",
128 nFlowCentBin,flowCentMin,flowCentMax);
130 h1VertexZ =
new TH1D(
"h1VertexZ",
"vertex z",
131 nVertexZEvtBin,vertexZEvtMin,vertexZEvtMax);
138 h1VertexZThin =
new TH1D(
"h1VertexZThin",
"vertex z",
139 nVertexZEvtThinBin,vertexZEvtMin,vertexZEvtMax);
146 cout <<
"using bins" << endl;
147 for(
int iBin=0; iBin<2; iBin++){
148 varBin[iBin].ptBinsAry =
new TArrayD;
149 initPtAry(varBin[iBin].ptBinsAry,iBin);
150 int nBin = varBin[iBin].ptBinsAry->GetSize()-1;
151 varBin[iBin].nPtBinAry = nBin;;
152 cout <<
"Bin " << iBin <<
" : " << endl;
153 for(
int i=0; i<nBin; i++){
154 cout << varBin[iBin].ptBinsAry->At(i) <<
", ";
156 cout << varBin[iBin].ptBinsAry->At(nBin) << endl;
160 TString sPM[2] = {
"Plus",
"Minus"};
165 h1NEvent =
new TH1D(
"h1NEvent",
"h1NEvent",1,1,2);
169 h1EtaCut =
new TH1D(
"h1EtaCut",
"h1EtaCut",2,0,2);
176 =
new TH2D(
"h2Yield",
"h2Yield",
177 nEtaSmallBin,etaSmallMin,etaSmallMax,
187 for(Int_t iBin=0; iBin<mNVarBin; iBin++){
191 setName(name,
"h1OneOverPt",iBin);
192 varBin[iBin].mean.h1OneOverPt =
193 new TH1D(name,name,varBin[iBin].nPtBinAry,
194 varBin[iBin].ptBinsAry->GetArray());
195 varBin[iBin].mean.h1OneOverPt->Sumw2();
197 setName(name,
"h1WeightedMean",iBin);
198 varBin[iBin].mean.h1WeightedMean =
199 new TH1D(name,name,varBin[iBin].nPtBinAry,
200 varBin[iBin].ptBinsAry->GetArray());
201 varBin[iBin].mean.h1WeightedMean->Sumw2();
207 setName(name,
"h1Raw",iBin);
208 varBin[iBin].spec.h1Raw =
209 new TH1D(name,name,varBin[iBin].nPtBinAry,
210 varBin[iBin].ptBinsAry->GetArray());
211 varBin[iBin].spec.h1Raw->Sumw2();
216 setName(name,
"h1EffCorrected",iBin);
217 varBin[iBin].spec.h1EffCorrected =
218 new TH1D(name,name,varBin[iBin].nPtBinAry,
219 varBin[iBin].ptBinsAry->GetArray());
220 varBin[iBin].spec.h1EffCorrected->Sumw2();
225 setName(name,
"h1Corrected",iBin);
226 varBin[iBin].spec.h1Corrected =
227 new TH1D(name,name,varBin[iBin].nPtBinAry,
228 varBin[iBin].ptBinsAry->GetArray());
229 varBin[iBin].spec.h1Corrected->Sumw2();
234 for(Int_t iCharge=0; iCharge<2; iCharge++){
239 setName(name,
"h1OneOverPt",iBin,sPM[iCharge].Data());
240 varBin[iBin].meanPM[iCharge].h1OneOverPt =
241 new TH1D(name,name,varBin[iBin].nPtBinAry,
242 varBin[iBin].ptBinsAry->GetArray());
243 varBin[iBin].meanPM[iCharge].h1OneOverPt->Sumw2();
245 setName(name,
"h1WeightedMean",iBin,sPM[iCharge].Data());
246 varBin[iBin].meanPM[iCharge].h1WeightedMean =
247 new TH1D(name,name,varBin[iBin].nPtBinAry,
248 varBin[iBin].ptBinsAry->GetArray());
249 varBin[iBin].meanPM[iCharge].h1WeightedMean->Sumw2();
254 setName(name,
"h1Raw",iBin,sPM[iCharge].Data());
255 varBin[iBin].specPM[iCharge].h1Raw =
256 new TH1D(name,name,varBin[iBin].nPtBinAry,
257 varBin[iBin].ptBinsAry->GetArray());
258 varBin[iBin].specPM[iCharge].h1Raw->Sumw2();
263 setName(name,
"h1EffCorrected",iBin,sPM[iCharge].Data());
264 varBin[iBin].specPM[iCharge].h1EffCorrected =
265 new TH1D(name,name,varBin[iBin].nPtBinAry,
266 varBin[iBin].ptBinsAry->GetArray());
267 varBin[iBin].specPM[iCharge].h1EffCorrected->Sumw2();
273 setName(name,
"h1Corrected",iBin,sPM[iCharge].Data());
274 varBin[iBin].specPM[iCharge].h1Corrected =
275 new TH1D(name,name,varBin[iBin].nPtBinAry,
276 varBin[iBin].ptBinsAry->GetArray());
277 varBin[iBin].specPM[iCharge].h1Corrected->Sumw2();
284 setName(name,
"h1RawRatio",iBin);
285 varBin[iBin].h1RawRatio
286 =
new TH1D(name,name,varBin[iBin].nPtBinAry,
287 varBin[iBin].ptBinsAry->GetArray());
288 varBin[iBin].h1RawRatio->Sumw2();
290 setName(name,
"h1CorrectedRatio",iBin);
291 varBin[iBin].h1CorrectedRatio
292 =
new TH1D(name,name,varBin[iBin].nPtBinAry,
293 varBin[iBin].ptBinsAry->GetArray());
294 varBin[iBin].h1CorrectedRatio->Sumw2();
302 StHiSpectra::trackLoop()
305 cout <<
"StHiSpectra::spectraTrackLoop()" << endl;
307 Int_t nTrack = mHiMicroEvent->NTrack();
312 for(Int_t i=0; i<nTrack; i++){
317 if(!CutRc::AcceptTrackHalf(track)) {
319 if(!CutRc::Accept(track))
continue;
322 Float_t ptPr = track->PtPr();
323 Float_t eta = track->EtaPr();
330 Float_t eff = mEfficiencyMap->Eval(eta,ptPr);
332 Float_t weight = (1./eff);
337 h2Yield->Fill(eta,ptPr);
342 if(ptPr>1.5&&ptPr<6){
344 if(mNHiPtTrack%10000==0){
345 cout <<
"pt: " << ptPr <<
" eta: " << eta <<
" eff : " << eff << endl;
352 Int_t iCharge = (track->Charge()>0) ? 0 : 1;
354 for(Int_t iBin=0; iBin<mNVarBin; iBin++){
360 varBin[iBin].spec.h1Raw->Fill(ptPr);
361 varBin[iBin].mean.h1OneOverPt->Fill(ptPr,1./ptPr);
362 varBin[iBin].spec.h1EffCorrected->Fill(ptPr,weight);
363 varBin[iBin].spec.h1Corrected->Fill(ptPr,weight);
372 varBin[iBin].meanPM[iCharge].h1OneOverPt->Fill(ptPr,1./ptPr);
374 varBin[iBin].specPM[iCharge].h1Raw->Fill(ptPr);
375 varBin[iBin].specPM[iCharge].h1EffCorrected->Fill(ptPr,weight);
376 varBin[iBin].specPM[iCharge].h1Corrected->Fill(ptPr,weight);
389 StHiSpectra::fillEventHistograms()
391 h1Centrality->Fill(mHiMicroEvent->Centrality());
393 h1VertexZ->Fill(mHiMicroEvent->VertexZ());
395 h1VertexZThin->Fill(mHiMicroEvent->VertexZ());
397 if(CutRc::AcceptVertexZ(mHiMicroEvent))
412 return CutRc::Accept(event);
420 StHiSpectra::finishHistograms()
422 h1NEvent->SetBinContent(1,mNEventAccepted);
423 h1EtaCut->SetBinContent(1,CutRc::mEta[0]);
424 h1EtaCut->SetBinContent(2,CutRc::mEta[1]);
426 for(Int_t iBin=0; iBin<mNVarBin; iBin++){
428 varBin[iBin].mean.h1WeightedMean->Divide(varBin[iBin].spec.h1Raw,varBin[iBin].mean.h1OneOverPt);
430 for(Int_t iCharge=0; iCharge<2; iCharge++){
432 varBin[iBin].meanPM[iCharge].h1WeightedMean->Divide(varBin[iBin].specPM[iCharge].h1Raw,varBin[iBin].meanPM[iCharge].h1OneOverPt);
TH1D * h1CentralityCut
just look at centrality stuff
TH1D * h1EtaCut
of events for the centrality class