15 #include "TTreeHelper.h"
18 void scan_embed_mudst(
20 const TString inputMuDst =
"/star/data06/embed/andrewar/hiroshi/MuDst/*.MuDst.root",
22 const Char_t* production =
"P08ic",
24 const Char_t* date =
"041909",
28 gSystem->Load(
"StarRoot");
32 const float VZCut = 30.;
34 const float NFitCut = 25.;
35 const int NCommCut = 10;
39 const int nchNch = 200;
const float maxNch = 1000;
40 const int nchPt = 80;
const float maxPt = 8.0;
41 const int nchNhits = 50;
const float minNhits = 0.;
const float maxNhits = 50.;
42 const int nchDca = 100;
const float maxDca = 3.;
43 const float maxDedx = 20.;
44 const float NSigmaCut = 2.0;
50 const Char_t* outputFileName = Form(
"../MuDst/%s_MuDst_%s.root", production, date);
51 TString oFile(outputFileName);
54 TString filePathR(inputMuDst);
58 cout <<
" Input MuDst (real data) : " << filePathR.Data() <<endl;
61 THmu.AddFile(filePathR);
63 TH1D* hMultR=
new TH1D(
"hMultR",
"Multiplicity",1000,0,1000);
65 TH1D* nChTotalR =
new TH1D(
"nChTotalR",
"nCharged Distribution", 1200, 0, maxNch);
67 TH2F* dedxR =
new TH2F(
"dedxR",
"de/dx vs P", 400, 0.0, 2., 400, 0., maxDedx);
68 TH1D* hDcax =
new TH1D(
"hDcax",
"Distance of Closest Approach x", 1000, 0, maxDca);
69 TH1D* hDcay =
new TH1D(
"hDcay",
"Distance of Closest Approach y", 1000, 0, maxDca);
70 TH1D* hDcaz =
new TH1D(
"hDcaz",
"Distance of Closest Approach z", 1000, 0, maxDca);
71 TH3D* hDcaR =
new TH3D(
"hDcaR",
"Nch:Pt:Dca",nchNch,0,maxNch,nchPt,0,maxPt,nchDca,0, maxDca);
72 TH3D* hNfitR =
new TH3D(
"hNfitR",
"Nch:Pt:Nhits",nchNch,0,maxNch,nchPt,0,maxPt,nchNhits,minNhits,maxNhits);
75 TH1D* hNSigmaPi =
new TH1D(
"hNSigmaPi",
"Sigma Pion",1000,-5000,5000);
76 TH1D* hNSigmaK =
new TH1D(
"hNSigmaK",
"Sigma Kaon",1000,-5000,5000);
77 TH1D* hNSigmaP =
new TH1D(
"hNSigmaP",
"Sigma Proton",1000,-5000,5000);
80 TH3D* hPtEtaDcaR =
new TH3D(
"hPtEtaDcaR",
"Pt:Eta:Dca", nchPt,0,maxPt,200,-1.8,1.8, nchDca,0, maxDca);
81 TH3D* hPtEtaNfitR =
new TH3D(
"hPtEtaNfitR",
"Pt:Eta:Nfit",nchPt,0,maxPt,200,-1.8,1.8,nchNhits,0,maxNhits);
87 const UShort_t *&nNeg= THmu(
"MuEvent.mRefMultNeg");
88 const UShort_t *&nPos= THmu(
"MuEvent.mRefMultPos");
90 const Float_t *&VXR = THmu(
"MuEvent.mEventSummary.mPrimaryVertexPos.mX1");
91 const Float_t *&VYR = THmu(
"MuEvent.mEventSummary.mPrimaryVertexPos.mX2");
92 const Float_t *&VZR = THmu(
"MuEvent.mEventSummary.mPrimaryVertexPos.mX3");
94 const Int_t &ntrkR = THmu(
"GlobalTracks");
95 const UChar_t *&NFitR = THmu(
"GlobalTracks.mNHitsFit");
96 const Float_t *&dEdxR = THmu(
"GlobalTracks.mdEdx");
97 const Float_t *&PtR = THmu(
"GlobalTracks.mPt");
98 const Float_t *&EtaR = THmu(
"GlobalTracks.mEta");
100 const Float_t *&dcax = THmu(
"GlobalTracks.mDCAGlobal.mX1");
101 const Float_t *&dcay = THmu(
"GlobalTracks.mDCAGlobal.mX2");
102 const Float_t *&dcaz = THmu(
"GlobalTracks.mDCAGlobal.mX3");
103 const Int_t *&vtxid = THmu(
"GlobalTracks.mVertexIndex");
105 const UChar_t *&NHitsR = THmu(
"GlobalTracks.mNHits");
106 const Int_t *&NSigmaPion = THmu(
"GlobalTracks.mNSigmaPion");
107 const Int_t *&NSigmaKaon = THmu(
"GlobalTracks.mNSigmaKaon");
108 const Int_t *&NSigmaProton = THmu(
"GlobalTracks.mNSigmaProton");
126 hMultR->Fill(*nPos + *nNeg);
129 if(fabs(*VZR)> VZCut)
continue;
133 if( evReal % 100 == 0 ){
134 cout << Form(
"MuDst: (Good Event)/(Event number) = %5d/%5d, VZ = %1.4f, Number of primary tracks = %10d",
135 evRealGood, evReal, VZR, (Int_t)ntrkR)
139 for (Int_t itr=0; itr<ntrkR; itr++) {
140 float dca = sqrt(dcax[itr]*dcax[itr]+dcay[itr]*dcay[itr]+dcaz[itr]*dcaz[itr]);
142 if (fabs(EtaR[itr]) > yCut)
continue;
144 float p = PtR[itr]*cosh(EtaR[itr]);
146 hDcax->Fill(dcax[itr]);
147 hDcay->Fill(dcay[itr]);
148 hDcaz->Fill(dcaz[itr]);
150 hNSigmaPi->Fill(NSigmaPion[itr]);
151 hNSigmaK->Fill(NSigmaKaon[itr]);
152 hNSigmaP->Fill(NSigmaProton[itr]);
156 if(NFitR[itr]>= NFitCut && vtxid[itr]==0 && fabs(NSigmaPion[itr]/1000.0) < NSigmaCut)
158 hDcaR->Fill((*nNeg +*nPos), PtR[itr],dca);
159 hPtEtaDcaR->Fill( PtR[itr],EtaR[itr],dca);
164 if (dca < maxDca && NFitR[itr]>=10 && vtxid[itr]==0 && fabs(NSigmaPion[itr]/1000.0) < NSigmaCut)
166 hNfitR ->Fill((*nNeg +*nPos), PtR[itr], NFitR[itr]);
167 hPtEtaNfitR ->Fill(PtR[itr], EtaR[itr], NFitR[itr]);
172 if(dca< maxDca && NFitR[itr]>= NFitCut)
174 dedxR->Fill(p,dEdxR[itr]*1e6);
183 cout<<
"Creating output file .... "<<oFile; flush(cout);
185 TFile *fout=
new TFile(oFile,
"recreate");
197 hPtEtaNfitR->Write();
200 fout->GetList()->Sort();
203 cout<<
" done"<<endl; flush(cout);
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)