6 gROOT->LoadMacro(
"$VMCWORKDIR/gconfig/rootlogon.C");
10 TString directory[5] = {
"production/e/",
"production/mu/",
"production/pi/",
"production/k/",
"production/p/"};
11 TString directory2[5] = {
"production2/e/",
"production2/mu/",
"production2/pi/",
"production2/k/",
"production2/p/"};
13 TString simname =
"points_sttcombi.root";
14 TString diginame =
"digi_sttcombi.root";
15 TString reconame =
"reco_sttcombi.root";
17 TH2F *hdedx_p_e =
new TH2F(
"hdedx_p_e",
"hdedx_p_e", 100, 0., 1.5, 100, 0., 30);
18 TH2F *hdedx_p_mu =
new TH2F(
"hdedx_p_mu",
"hdedx_p_mu", 100, 0., 1.5, 100, 0., 30);
19 TH2F *hdedx_p_pi =
new TH2F(
"hdedx_p_pi",
"hdedx_p_pi", 100, 0., 1.5, 100, 0., 30);
20 TH2F *hdedx_p_k =
new TH2F(
"hdedx_p_k",
"hdedx_p_k", 100, 0., 1.5, 100, 0., 30);
21 TH2F *hdedx_p_p =
new TH2F(
"hdedx_p_p",
"hdedx_p_p", 100, 0., 1.5, 100, 0., 30);
23 hdedx_p_e->SetMarkerColor(2);
24 hdedx_p_mu->SetMarkerColor(4);
25 hdedx_p_pi->SetMarkerColor(3);
26 hdedx_p_k->SetMarkerColor(6);
27 hdedx_p_p->SetMarkerColor(1);
30 TChain *chainsim = NULL, *chaindigi = NULL, *chainreco = NULL, *chaingen = NULL;
32 TClonesArray *mctrackarray = NULL, *mcpointarray = NULL, *hitarray = NULL, *recotrackarray = NULL, *gentrackarray = NULL;
40 TString sn = directory[ifile] + simname;
41 TString dn = directory[ifile] + diginame;
42 TString rn = directory[ifile] + reconame;
44 TString sn2 = directory2[ifile] + simname;
45 TString dn2 = directory2[ifile] + diginame;
46 TString rn2 = directory2[ifile] + reconame;
48 cout <<
"******************" << endl;
49 cout << sn <<
" " << sn2 <<
" " << endl;
50 cout << dn <<
" " << dn2 <<
" " << endl;
51 cout << rn <<
" " << rn2 <<
" " << endl;
56 chainsim =
new TChain(
"pndsim");
60 mcpointarray =
new TClonesArray(
"PndSttPoint");
61 chainsim->SetBranchAddress(
"STTPoint",&mcpointarray);
62 mctrackarray =
new TClonesArray(
"PndMCTrack");
63 chainsim->SetBranchAddress(
"MCTrack",&mctrackarray);
66 chaindigi =
new TChain(
"pndsim");
70 hitarray =
new TClonesArray(
"PndSttHit");
71 chaindigi->SetBranchAddress(
"STTHit",&hitarray);
74 chainreco =
new TChain(
"pndsim");
78 gentrackarray =
new TClonesArray(
"PndTrack");
79 chainreco->SetBranchAddress(
"SttMvdGenTrack",&gentrackarray);
80 recotrackarray =
new TClonesArray(
"PndTrackCand");
81 chainreco->SetBranchAddress(
"SttMvdTrackCand",&recotrackarray);
85 chainsim->GetEntry(
evt);
86 chaindigi->GetEntry(
evt);
87 chainreco->GetEntry(
evt);
89 if(
evt%500 == 0) cout <<
evt << endl;
94 for(
int itrk = 0; itrk < gentrackarray->GetEntriesFast(); itrk++) {
97 gtrk = (
PndTrack*) gentrackarray->At(itrk);
108 if(mcIndex != 0)
continue;
111 if(gtrk->
GetFlag() < 0)
continue;
119 if(momentum.Mag() > 1.2)
continue;
121 std::vector<double> dedx;
124 for(
int ihit = 0; ihit < ctrk->
GetNHits(); ihit++) {
133 Double_t coslam = momentum.Perp() / momentum.Mag();
134 distance = distance / coslam;
136 if (distance != 0) de_dx = hit->
GetDepCharge()/(1000000 * distance);
138 dedx.push_back(de_dx);
144 std::sort(dedx.begin(), dedx.end());
152 Int_t lastpnt = int(floor(dedx.size() * perc));
155 for(
int ihit = 0; ihit < lastpnt; ihit++) sum += dedx[ihit];
158 if(lastpnt > 5 && dedx.size() > 0) {
165 hdedx_p_e->Fill(momentum.Mag(),
mean);
break;
167 hdedx_p_mu->Fill(momentum.Mag(),
mean);
break;
169 hdedx_p_pi->Fill(momentum.Mag(),
mean);
break;
171 hdedx_p_k->Fill(momentum.Mag(),
mean);
break;
173 hdedx_p_p->Fill(momentum.Mag(),
mean);
179 TFile
output(
"dedx_out.root",
"UPDATE");
182 hdedx_p_e->Write();
break;
184 hdedx_p_mu->Write();
break;
186 hdedx_p_pi->Write();
break;
188 hdedx_p_k->Write();
break;
friend F32vec4 sqrt(const F32vec4 &a)
PndTrackCandHit GetSortedHit(UInt_t i)
FairParRootFileIo * output
int dedx_p_chain(int ifile=0)
Double_t GetIsochrone() const
Double_t GetDepCharge() const
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Int_t GetRefIndex() const
FairTrackParP GetParamFirst()