25 #include "TTreeHelper.h"
28 void scan_embed_mc(Int_t
id=9){
39 int nchNch = 200;
float maxNch=1000;
41 int nchPt = 80;
float maxPt = 15.0;
43 int nchNhits= 50;
float minNhits = 0.;
float maxNhits = 50.;
45 int nchDca = 100;
float maxDca = 3.;
51 if (
id == 8) { TString tag =
"PiPlus"; mass2 = 0.019;}
52 if (
id == 9) { TString tag =
"PiMinus"; mass2 = 0.019;}
53 if (
id == 11) { TString tag =
"KPlus"; mass2 = 0.245;}
54 if (
id == 12) { TString tag =
"KMinus"; mass2 = 0.245;}
55 if (
id == 14) { TString tag =
"Proton"; mass2 = 0.880;}
56 if (
id == 15) { TString tag =
"Pbar"; mass2 = 0.880;}
57 if (
id == 50) { TString tag =
"Phi"; mass2 = 1.020;}
58 if (
id == 2) { TString tag =
"Eplus"; mass2 = 0.511;}
64 filePath=
"~/Phi_101/Mini_Mc/*root";
66 cout <<filePath<<endl;
72 oFile=
"~/outputs/Phi/out_scan_embed_mc_"+tag+
"1.root";
82 TH1D* hMult=
new TH1D(
"hMult",
"Multiplicity",1000,0,maxNch);
84 TH1D* nChTotal =
new TH1D(
"nChTotal",
"nCharged Distribution", 1200, 0, maxNch);
85 TH2F* dedx =
new TH2F(
"dedx",
"de/dx vs P", 500, 0.0, maxPt, 400, 0., maxDedx);
86 TH3D* hDca =
new TH3D(
"hDca3",
"Nch:Pt:Dca",nchNch,0,maxNch,nchPt,0,maxPt,nchDca,0, maxDca);
87 TH3D* hNfit =
new TH3D(
"hNfit3",
"Nch:Pt:Nhits",nchNch,0,maxNch,nchPt,0,maxPt,nchNhits,0,maxNhits);
91 TH1D* vz =
new TH1D(
"vz",
"Vertex Z",200,0.-50.,50.0);
92 TH2D* v_xy =
new TH2D(
"vxy",
"Vertez_X_Y", 200, -3.0, 3., 400, -3.0, 3.);
94 TH1D* dvz =
new TH1D(
"dvz",
"Delta Vertex Z MC - Reco",50,0.-5.,5.0);
95 TH1D* dvx =
new TH1D(
"dvx",
"Delat Vertex X MC - Reco",50,0.-5.,5.0);
96 TH1D* dvy =
new TH1D(
"dvy",
"Delta Vertex Y Mc - Reco",50,0.-5.,5.0);
100 TH1D* hPtMc =
new TH1D(
"PtMc",
"Pt_Mc",400,0,20);
101 TH1D* hEtaMc =
new TH1D(
"EtaMc",
"Eta_Mc",200,-1.8,1.8);
102 TH1D* hPhiMc =
new TH1D(
"PhiMc",
"Phi_Mc",200,-5.0,5.0);
107 TH1D* hPtPrMatched =
new TH1D(
"PtPrMatched",
"Pt_Pr",400,0,20);
108 TH1D* hEtaPrMatched =
new TH1D(
"EtaPrMatched",
"EtaPr",200,-1.8,1.8);
109 TH1D* hPhiPrMatched =
new TH1D(
"PhiPrMatched",
"PhiPr",200,-5.0,5.0);
113 TH2D* hPtM_E_Pr =
new TH2D(
"hPtM_E_Pr",title,100,0,10,200,-0.1,0.1);
114 TH2D* hPtM_E_Gl =
new TH2D(
"hPtM_E_Gl",title,100,0,10,200,-0.1,0.1);
118 const Int_t &nch = TH(
"mNUncorrectedPrimaries");
119 const Float_t &VX = TH(
"mVertexX");
120 const Float_t &VY = TH(
"mVertexY");
121 const Float_t &VZ = TH(
"mVertexZ");
123 const Float_t &VXmc = TH(
"mMcVertexX");
124 const Float_t &VYmc = TH(
"mMcVertexY");
125 const Float_t &VZmc = TH(
"mMcVertexZ");
130 const Int_t &ntrk1 = TH (
"mMcTracks");
132 const Float_t *&PtMc = TH(
"mMcTracks.mPtMc");
133 const Float_t *&PzMc = TH(
"mMcTracks.mPzMc");
134 const Float_t *&NHits = TH(
"mMcTracks.mNHitMc");
135 const Float_t *&EtaMc = TH(
"mMcTracks.mEtaMc");
136 const Float_t *&PhiMc = TH(
"mMcTracks.mPhiMc");
143 const Int_t &ntrk = TH(
"mMatchedPairs");
145 const Float_t *&PtPrMatched = TH(
"mMatchedPairs.mPtPr");
146 const Float_t *&PzPrMatched = TH(
"mMatchedPairs.mPzPr");
147 const Float_t *&EtaPrMatched = TH(
"mMatchedPairs.mEtaPr");
148 const Float_t *&PhiPrMatched= TH(
"mMatchedPairs.mPhiPr");
150 const Float_t *&PtMcMatched = TH(
"mMatchedPairs.mPtMc");
151 const Float_t *&PzMcMatched = TH(
"mMatchedPairs.mPzMc");
152 const Float_t *&EtaMcMatched = TH(
"mMatchedPairs.mEtaMc");
153 const Float_t *&PhiMcMatched= TH(
"mMatchedPairs.mPhiMc");
155 const Float_t *&PtGlMatched= TH(
"mMatchedPairs.mPtGl");
156 const Float_t *&PzGlMatched= TH(
"mMatchedPairs.mPzGl");
157 const Float_t *&EtaGlMatched = TH(
"mMatchedPairs.mEtaMGl");
158 const Float_t *&PhiGlMatched = TH(
"mMatchedPairs.mPhiMGl");
161 const Float_t *&dEdx = TH(
"mMatchedPairs.mDedx");
162 const Float_t *&Dca = TH(
"mMatchedPairs.mDcaGl");
163 const Short_t *&NFit = TH(
"mMatchedPairs.mFitPts");
164 const Short_t *&NComm = TH(
"mMatchedPairs.mNCommonHit");
166 const Short_t *&GidMatched = TH(
"mMatchedPairs.mGeantId");
228 if(fabs(VZ)> VZCut)
continue;
231 for (Int_t itr=0; itr<ntrk; itr++)
236 if ( GidMatched[itr]!=11 && GidMatched[itr]!=12)
continue;
238 if (fabs(EtaPrMatched[itr]) > yCut)
continue;
242 float p = sqrt(PtPrMatched[itr]*PtPrMatched[itr]+PzPrMatched[itr]*PzPrMatched[itr]);
245 if (NFit[itr] >= NFitCut && NComm[itr] > NCommCut)
246 hDca->Fill(nch, PtPrMatched[itr],Dca[itr]);
248 if (Dca[itr] < maxDca && (1.*(NFit[itr])/NComm[itr]) < 2.5)
249 hNfit ->Fill(nch, PtPrMatched[itr], NFit[itr]);
251 if( Dca[itr] < maxDca && NFit[itr] >= NFitCut && fabs(EtaPrMatched[itr])< yCut)
252 dedx->Fill(p,dEdx[itr]*1e6);
256 if(NFit[itr] >= NFitCut && NComm[itr] > NCommCut && Dca[itr] < maxDca )
258 v_xy->Fill(VX[itr], VY[itr]);
259 hPtPrMatched->Fill(PtPrMatched[itr]);
260 hEtaPrMatched->Fill(EtaPrMatched[itr]);
261 hPhiPrMatched->Fill(PhiPrMatched[itr]);
267 for (
int itr1=0; itr1 < ntrk1; itr1++)
269 if (fabs(EtaM[itr]) > yCut)
continue;
271 hPtMc->Fill(PtMc[itr1]);
272 hEtaMc->Fill(EtaMc[itr]);
273 hPhiMc->Fill(PhiMc[itr]);
285 THmu.AddFile(filePathR);
288 TH1D* nChTotalR =
new TH1D(
"nChTotalR",
"nCharged Distribution", 1200, 0, 1200);
289 TH2F* dedxR =
new TH2F(
"dedxR",
"de/dx vs P", 500, 0.0, 4., 400, 0., 20);
290 TH1D* hDcax=
new TH1D(
"hDcax",
"Distance of Closest Approach x", 1000, 0, 5);
291 TH1D* hDcay=
new TH1D(
"hDcay",
"Distance of Closest Approach y", 1000, 0, 5);
292 TH1D* hDcaz=
new TH1D(
"hDcaz",
"Distance of Closest Approach z", 1000, 0, 5);
293 TH3D* hDcaR=
new TH3D(
"hDcaR",
"Nch:Pt:Dca",nchNch,0,maxNch,nchPt,0,maxPt,nchDca,0, maxDca);
294 TH3D* hNfitR =
new TH3D(
"hNfitR",
"Nch:Pt:Nhits",nchNch,0,maxNch,nchPt,0,maxPt,nchNhits,minNhits,maxNhits);
295 TH1D* hNSigmaPi=
new TH1D(
"hNSigmaPi",
"Sigma Pion",1000,0,1000);
296 TH1D* hNSigmaK=
new TH1D(
"hNSigmaK",
"Sigma Kaon",1000,0,1000);
297 TH1D* hNSigmaP=
new TH1D(
"hNSigmaP",
"Sigma Proton",1000,0,1000);
300 const UShort_t *&nNeg= THmu(
"MuEvent.mRefMultNeg");
301 const UShort_t *&nPos= THmu(
"MuEvent.mRefMultPos");
303 const Float_t *&VX1 = THmu(
"MuEvent.mEventSummary.mPrimaryVertexPos.mX1");
304 const Float_t *&VY1 = THmu(
"MuEvent.mEventSummary.mPrimaryVertexPos.mX2");
305 const Float_t *&VZ1 = THmu(
"MuEvent.mEventSummary.mPrimaryVertexPos.mX3");
307 const Int_t &ntrk1 = THmu(
"PrimaryTracks");
309 const Float_t *&dEdxR = THmu(
"PrimaryTracks.mdEdx");
310 const Float_t *&Pt1 = THmu(
"PrimaryTracks.mPt");
311 const Float_t *&Eta1 = THmu(
"PrimaryTracks.mEta");
313 const Float_t *&dcax1 = THmu(
"PrimaryTracks.mDCAGlobal.mX1");
314 const Float_t *&dcay1 = THmu(
"PrimaryTracks.mDCAGlobal.mX2");
315 const Float_t *&dcaz1 = THmu(
"PrimaryTracks.mDCAGlobal.mX3");
317 const UChar_t *&NHits1 = THmu(
"PrimaryTracks.mNHits");
318 const Int_t *&NSigmaPion = THmu(
"PrimaryTracks.mNSigmaPion");
319 const Int_t *&NSigmaKaon = THmu(
"PrimaryTracks.mNSigmaKaon");
320 const Int_t *&NSigmaProton = THmu(
"PrimaryTracks.mNSigmaProton");
323 if (
id == 8 ||
id == 9)
324 {
const Int_t *&NSigma = THmu(
"PrimaryTracks.mNSigmaPion"); }
326 if (
id == 11||
id ==12)
327 {
const Int_t *&NSigma = THmu(
"PrimaryTracks.mNSigmaKaon"); }
329 if (
id == 14||
id ==15)
330 {
const Int_t *&NSigma = THmu(
"PrimaryTracks.mNSigmaProton"); }
339 hMult->Fill(*nPos + *nNeg);
341 for (Int_t itr=0; itr<ntrk1; itr++)
347 if(fabs(*VZ1)>25.)
continue;
349 float dca = sqrt(dcax1[itr]*dcax1[itr]+dcay1[itr]*dcay1[itr]+dcaz1[itr]*dcaz1[itr]);
350 float p_r = Pt1[itr]*cosh(Eta1[itr]);
352 hDcax->Fill(dcax1[itr]);
353 hDcay->Fill(dcay1[itr]);
354 hDcaz->Fill(dcaz1[itr]);
356 hNSigmaPi->Fill(NSigmaPion[itr]);
357 hNSigmaK->Fill(NSigmaKaon[itr]);
358 hNSigmaP->Fill(NSigmaProton[itr]);
362 if (fabs(Eta1[itr]) >0.5)
continue;
365 hDcaR->Fill((*nNeg +*nPos), Pt1[itr],dca);
371 hNfitR ->Fill(*nNeg +*nPos, Pt1[itr], NHits1[itr]);
376 if(dca< 3. && NHits1[itr]>= 25 && fabs(Eta1[itr])< 0.5 && NSigma[itr]/1000 < 2.)
377 dedxR->Fill(p_r,dEdxR[itr]*1e6);
383 cout<<
"Creating output file .... "<<oFile; flush(cout);
385 TFile *fout=
new TFile(oFile,
"recreate");
404 hPtPrMatched->Write();
405 hEtaPrMatched->Write();
406 hPhiPrMatched->Write();
413 cout<<
" done"<<endl; flush(cout);
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)