15 #include "TTreeHelper.h"
21 const TString inputMiniMc =
"/eliza3/starprod/embedding/P08id/dAu/*/*/*.minimc.root",
23 const Char_t* particle=
"Phi",
24 const Char_t* production =
"P08id",
25 const Int_t eid = 90117,
26 const Char_t* date =
"040709",
30 gSystem->Load(
"StarRoot");
34 const float VZCut = 30.;
36 const float NFitCut = 25.;
37 const int NCommCut = 10;
41 const int nchNch = 200;
const float maxNch = 1000;
42 const int nchPt = 80;
const float maxPt = 8.0;
43 const int nchNhits = 50;
const float minNhits = 0.;
const float maxNhits = 50.;
44 const int nchDca = 100;
const float maxDca = 3.;
45 const float maxDedx = 20.;
46 const float NSigmaCut = 2.0;
49 if (
id == 2) { TString tag =
"Eplus"; mass2 = 0.511; Char_t *Daugther =
"Eplus";}
50 if (
id == 8) { TString tag =
"PiPlus"; mass2 = 0.019; Char_t *Daugther =
"PiPlus";}
51 if (
id == 9) { TString tag =
"PiMinus"; mass2 = 0.019; Char_t *Daugther =
"PiMius";}
52 if (
id == 11) { TString tag =
"KPlus"; mass2 = 0.245; Char_t *Daugther =
"KPlus";}
53 if (
id == 12) { TString tag =
"KMinus"; mass2 = 0.245; Char_t *Daugther =
"KMinus";}
54 if (
id == 14) { TString tag =
"Proton"; mass2 = 0.880; Char_t *Daugther =
"Proton";}
55 if (
id == 15) { TString tag =
"Pbar"; mass2 = 0.880; Char_t *Daugther =
"Pbar";}
56 if (
id == 50) { TString tag =
"Phi"; mass2 = 1.020; }
60 cout <<
"Negative mass2 for pid = " <<
id << endl;
66 TString filePathMc(inputMiniMc);
70 cout <<
"Input MiniMc file : " << filePathMc.Data() <<endl;
71 cout <<
"#---------------------------------------------------------------------------" << endl;
72 cout <<
" Event selection" << endl;
73 cout <<
" |VZ| < " << VZCut << endl;
74 cout <<
"#---------------------------------------------------------------------------" << endl;
75 cout <<
" Track selection (mMatchedPairs)" << endl;
76 cout <<
" For DCA : mMatchedPairs.mFitPts >= " << NFitCut <<
" && mMatchedPairs.mNCommonHit > " << NCommCut << endl;
77 cout <<
" For NFit : mMatchedPairs.mDcaGl < " << maxDca <<
" && mMatchedPairs.mFitPts/mMatchedPairs.mNCommonHit < 2.5 && mMatchedPairs.mFitPts >= 10" << endl;
78 cout <<
" For dE/dx : mMatchedPairs.mDcaGl < " << maxDca <<
" && mMatchedPairs.mFitPts >= " << NFitCut <<
" && |mMatchedPairs.mEtaPr| < " << yCut << endl;
79 cout <<
" For pt, eta, phi : |mMatchedPairs.mDcaGl| < " << maxDca << endl;
80 cout <<
"#---------------------------------------------------------------------------" << endl;
81 cout <<
" Track selection (mGhostPairs)" << endl;
82 cout <<
" For dE/dx : mGhostPairs.mDcaGl < " << maxDca <<
" && mGhostPairs.mFitPts >= " << NFitCut <<
" && |mGhostPairs.mEtaPr| < " << yCut << endl;
83 cout <<
"#---------------------------------------------------------------------------" << endl;
84 cout <<
" Track selection (mMcTracks)" << endl;
85 cout <<
" For pt, eta, phi : |mMatchedPairs.mEtaPr| > " << yCut << endl;
88 const Char_t* outputFileName = Form(
"./%s_%s_%s_mc_%s.root", production, particle, Daugther, date);
89 TString oFile(outputFileName);
92 TH.AddFile(filePathMc);
96 TH1D* hMult=
new TH1D(
"hMult",
"Multiplicity",1000,0,maxNch);
98 TH1D* nChTotal =
new TH1D(
"nChTotal",
"nCharged Distribution", 1200, 0, maxNch);
99 TH2F* dedx =
new TH2F(
"dedx",
"de/dx vs P", 400, 0.0, 2., 400, 0., maxDedx);
100 TH3D* hDca =
new TH3D(
"hDca",
"Nch:Pt:Dca",nchNch,0,maxNch,nchPt,0,maxPt,nchDca,0, maxDca);
101 TH3D* hNfit =
new TH3D(
"hNfit",
"Nch:Pt:Nhits",nchNch,0,maxNch,nchPt,0,maxPt,nchNhits,0,maxNhits);
105 TH1D* vz =
new TH1D(
"vz",
"Vertex Z",200,0.-50.,50.0);
106 TH2D* v_xy =
new TH2D(
"vxy",
"Vertez_X_Y", 200, -3.0, 3., 400, -3.0, 3.);
108 TH1D* dvz =
new TH1D(
"dvz",
"Delta Vertex Z MC - Reco",50,0.-5.,5.0);
109 TH1D* dvx =
new TH1D(
"dvx",
"Delta Vertex X MC - Reco",50,0.-5.,5.0);
110 TH1D* dvy =
new TH1D(
"dvy",
"Delta Vertex Y MC - Reco",50,0.-5.,5.0);
112 TH1D* hPtM =
new TH1D(
"PtM",
"Pt_Pr",400,0,20);
113 TH1D* hEtaM =
new TH1D(
"EtaM",
"EtaPr",200,-1.8,1.8);
114 TH1D* hPhiM =
new TH1D(
"PhiM",
"PhiPr",200,-5.0,5.0);
115 TH1D* hYM =
new TH1D(
"YM",
"YPr",100,-1.5,1.5);
116 TH3D* hPtYPhiM =
new TH3D(
"PtYPhiM",
"Pt:Y:Phi",nchPt,0,maxPt,100,-1.5,1.5,200,-5.0,5.0);
117 TH1D* hFSectM =
new TH1D(
"FSectM",
"First Sector",30,0,30.);
118 TH1D* hLSectM =
new TH1D(
"LSectM",
"Last Sector",30,0,30.);
120 TH1D* hPtMc =
new TH1D(
"PtMc",
"Pt_Mc",400,0,20);
121 TH1D* hEtaMc=
new TH1D(
"EtaMc",
"Eta_Mc",200,-1.8,1.8);
122 TH1D* hYMc=
new TH1D(
"YMc",
"Y_Mc",100,-1.5,1.5);
123 TH1D* hPhiMc=
new TH1D(
"PhiMc",
"Phi_Mc",200,-5.0,5.0);
124 TH3D* hPtYPhiMc =
new TH3D(
"PtYPhiMc",
"Pt:Y:Phi",nchPt,0,maxPt,100,-1.5,1.5,200,-5.0,5.0);
130 TString title = Form(
"ptM-ptMc :ptM ( |vtx|<30, %.1f< |yMc|<%.1f, nFitM>=25, nComm>=10)", 1., 1.);
131 TH2D* hPtM_E =
new TH2D (
"hPtM_E", title.Data(), 50, 0, 10, 50, -0.05, 0.05);
132 TString title = Form(
"YM-YMc :YM ( |vtx|<30, %.1f< |yMc|<%.1f, nFitM>=25, nComm>=10)", 1., 1.);
133 TH2D* hYM_E =
new TH2D (
"hYM_E", title.Data(), 50, -1.2, 1.2, 50, -0.05, 0.05);
134 TString title = Form(
"PhiM-PhiMc :PhiM ( |vtx|<30, %.1f< |yMc|<%.1f, nFitM>=25, nComm>=10)", 1., 1.);
135 TH2D* hPhiM_E =
new TH2D (
"hPhiM_E", title.Data(), 50, -3.2, 3.2, 50, -0.05, 0.05);
138 TH2F* dedxG =
new TH2F(
"dedxG",
"dE/dx vs p", 400,0., 2., 400, 0.,maxDedx);
139 TH3D* hDcaG =
new TH3D(
"hDcaG",
"Nch:Pt:Dca",nchNch,0,maxNch,nchPt,0,maxPt,nchDca,0, maxDca);
140 TH3D* hNfitG =
new TH3D(
"hNfitG",
"Nch:Pt:Nhits",nchNch,0,maxNch,nchPt,0,maxPt,nchNhits,0,maxNhits);
141 TH1D* hPhiG =
new TH1D(
"PhiG",
"PhiG",200,-5.0,5.0);
142 TH1D* hFSectG =
new TH1D(
"FSectG",
"First Sector",30,0,30.);
143 TH1D* hLSectG =
new TH1D(
"LSectG",
"Last Sector",30,0,30.);
147 TH3D* hPtEtaDcaM =
new TH3D(
"hPtEtaDcaM",
"Pt:Eta:DcaM", nchPt,0, maxPt,200,-1.8,1.8, nchDca,0, maxDca);
148 TH3D* hPtEtaDcaG =
new TH3D(
"hPtEtaDcaG",
"Pt:Eta:DcaG", nchPt,0, maxPt,200,-1.8,1.8, nchDca,0, maxDca);
152 TH3D* hPtEtaNfitM =
new TH3D(
"hPtEtaNfitM",
"Pt:Eta:NfitM",nchPt,0,maxPt,200,-1.8,1.8,nchNhits,0,maxNhits);
153 TH3D* hPtEtaNfitG =
new TH3D(
"hPtEtaNfitG",
"Pt:Eta:NfitG",nchPt,0,maxPt,200,-1.8,1.8,nchNhits,0,maxNhits);
154 hPtEtaNfitM->Sumw2();
155 hPtEtaNfitG->Sumw2();
159 const Int_t &nch = TH(
"mNUncorrectedPrimaries");
160 const Float_t &VX = TH(
"mVertexX");
161 const Float_t &VY = TH(
"mVertexY");
162 const Float_t &VZ = TH(
"mVertexZ");
164 const Float_t &VXmc = TH(
"mMcVertexX");
165 const Float_t &VYmc = TH(
"mMcVertexY");
166 const Float_t &VZmc = TH(
"mMcVertexZ");
170 const Int_t &ntrk1 = TH (
"mMcTracks");
172 const Float_t *&PtMc = TH(
"mMcTracks.mPtMc");
173 const Float_t *&PzMc = TH(
"mMcTracks.mPzMc");
174 const Float_t *&NHits = TH(
"mMcTracks.mNHitMc");
175 const Float_t *&EtaMc = TH(
"mMcTracks.mEtaMc");
176 const Float_t *&PhiMc = TH(
"mMcTracks.mPhiMc");
208 const Int_t &ntrk = TH(
"mMatGlobPairs");
210 const Float_t *&PtM = TH(
"mMatGlobPairs.mPtGl");
211 const Float_t *&PzM = TH(
"mMatGlobPairs.mPzGl");
212 const Float_t *&EtaM = TH(
"mMatGlobPairs.mEtaGl");
213 const Float_t *&PhiM = TH(
"mMatGlobPairs.mPhiGl");
215 const Short_t *&FSectM = TH(
"mMatGlobPairs.mFirstSector");
216 const Short_t *&LSectM = TH(
"mMatGlobPairs.mLastSector");
219 const Float_t *&PtMmc= TH(
"mMatGlobPairs.mPtMc");
220 const Float_t *&PzMmc= TH(
"mMatGlobPairs.mPzMc");
221 const Float_t *&EtaMmc = TH(
"mMatGlobPairs.mEtaMc");
222 const Float_t *&PhiMmc = TH(
"mMatGlobPairs.mPhiMc");
224 const Float_t *&dEdx = TH(
"mMatGlobPairs.mDedx");
225 const Float_t *&Dca = TH(
"mMatGlobPairs.mDcaGl");
226 const Short_t *&NFit = TH(
"mMatGlobPairs.mFitPts");
227 const Short_t *&NComm = TH(
"mMatGlobPairs.mNCommonHit");
229 const Short_t *&Gid = TH(
"mMatGlobPairs.mGeantId");
236 const Int_t &ntrkG = TH(
"mGhostPairs");
238 const Float_t *&PtG = TH(
"mGhostPairs.mPtPr");
239 const Float_t *&PzG = TH(
"mGhostPairs.mPzPr");
240 const Float_t *&dEdxG= TH(
"mGhostPairs.mDedx");
241 const Float_t *&DcaG = TH(
"mGhostPairs.mDcaGl");
242 const Float_t *&EtaG = TH(
"mGhostPairs.mEtaPr");
243 const Float_t *&PhiG = TH(
"mGhostPairs.mPhiPr");
244 const Short_t *&NFitG = TH(
"mGhostPairs.mFitPts");
245 const Short_t *&FSectG = TH(
"mGhostPairs.mFirstSector");
246 const Short_t *&LSectG = TH(
"mGhostPairs.mLastSector");
264 if(fabs(VZ)> VZCut)
continue;
269 for (Int_t itr=0; itr<ntrk; itr++)
272 if ( Gid[itr]!=14 && Gid[itr]!=15)
continue;
273 if (fabs(EtaM[itr]) > yCut)
continue;
277 float p = sqrt(PtM[itr]*PtM[itr]+PzM[itr]*PzM[itr]);
279 if (NFit[itr] >= NFitCut && NComm[itr] > NCommCut)
282 hDca->Fill(nch, PtM[itr],Dca[itr]);
283 hPtEtaDcaM ->Fill( PtM[itr], EtaM[itr], Dca[itr]);
289 if (Dca[itr] < maxDca && NFit[itr]>=10)
291 hNfit ->Fill(nch, PtM[itr], NFit[itr]);
292 hPtEtaNfitM ->Fill( PtM[itr], EtaM[itr], NFit[itr]);
297 if( Dca[itr] < maxDca && NFit[itr] >= NFitCut && NComm[itr] > NCommCut)
298 dedx->Fill(p,dEdx[itr]*1e6);
302 if (Dca[itr]<0. || Dca[itr]>maxDca)
continue;
303 if(NFit[itr] >= NFitCut && NComm[itr] > NCommCut )
305 hPtM->Fill(PtM[itr]);
306 hEtaM->Fill(EtaM[itr]);
307 hFSectM->Fill(FSectM[itr]);
308 hLSectM->Fill(LSectM[itr]);
309 Double_t mass0 = 0.13957;
310 Double_t P0 = sqrt(PtM[itr]*PtM[itr]+PzM[itr]*PzM[itr]+mass0*mass0);
311 Double_t P0mc = sqrt(PtMmc[itr]*PtMmc[itr]+PzMmc[itr]*PzMmc[itr]+mass0*mass0);
312 Double_t rap = 0.5*log((P0+PzM[itr])/(P0-PzM[itr]));
313 Double_t rapmc = 0.5*log((P0mc+PzMmc[itr])/(P0mc-PzMmc[itr]));
315 hPhiM->Fill(PhiM[itr]);
316 hPtM_E->Fill(PtM[itr], PtM[itr]-PtMmc[itr]);
317 hYM_E->Fill(rap, rap-rapmc);
318 hPhiM_E->Fill(PhiM[itr], PhiM[itr]-PhiMmc[itr]);
319 hPtYPhiM->Fill(PtM[itr],rap,PhiM[itr]);
326 for (Int_t itrG=0; itrG<ntrkG; itrG++)
328 if (fabs(EtaG[itrG]) > yCut)
continue;
329 float pg = sqrt(PtG[itrG]*PtG[itrG]+PzG[itrG]*PzG[itrG]);
331 if (NFitG[itrG] >= NFitCut)
333 hDcaG ->Fill(nch, PtG[itrG],DcaG[itrG]);
334 hPtEtaDcaG ->Fill(PtG[itr], EtaG[itr], DcaG[itr]);
338 if (DcaG[itrG] < maxDca && NFitG[itrG] >= 10)
340 hNfitG ->Fill(nch, PtG[itrG], NFitG[itrG]);
341 hPtEtaNfitG->Fill( PtG[itr], EtaG[itr], NFitG[itr]);
345 if( DcaG[itrG] < maxDca && NFitG[itrG] >= NFitCut){
346 dedxG->Fill(pg,dEdxG[itrG]*1e6);
347 hPhiG->Fill(PhiG[itrG]);
348 hFSectG->Fill(FSectG[itrG]);
349 hLSectG->Fill(LSectG[itrG]);
355 for (
int itr1=0; itr1 < ntrk1; itr1++)
359 hPtMc->Fill(PtMc[itr1]);
360 hEtaMc->Fill(EtaMc[itr1]);
361 Double_t mass0 = 0.13957;
362 Double_t P0 = sqrt(PtMc[itr1]*PtMc[itr1]+PzMc[itr1]*PzMc[itr1]+mass0*mass0);
363 hYMc->Fill(0.5*log((P0+PzMc[itr1])/(P0-PzMc[itr1])));
364 hPhiMc->Fill(PhiMc[itr1]);
365 hPtYPhiMc->Fill(PtMc[itr1],0.5*log((P0+PzMc[itr1])/(P0-PzMc[itr1])),PhiMc[itr1]);
373 cout<<
"Creating output file .... "<<oFile; flush(cout);
375 TFile *fout=
new TFile(oFile,
"recreate");
393 hPtEtaNfitG->Write();
394 hPtEtaDcaG ->Write();
417 hPtEtaNfitM->
Write();
426 fout->GetList()->Sort();
429 cout<<
" done"<<endl; flush(cout);
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)