8 gSystem->Load(
"libEGPythia6");
9 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
10 gSystem->Load(
"libRho");
11 gSystem->Load(
"libPid");
12 gSystem->Load(
"libAnalysisTools");
14 gROOT->LoadMacro(
"plothistos.C");
20 double min2=0.13,max2=0.15;
21 double min3=1.,max3=1.5;
25 TList* histolist =
new TList();
34 TH1F *hMompip=
new TH1F(
"momppip",
"P(#pi+);p / GeV/c",bins,min,
max);
35 TH1F *hMompim=
new TH1F(
"momppim",
"P(#pi-);p / GeV/c",bins,min,
max);
36 TH1F *hMomKp=
new TH1F(
"mompkp",
"P(K+);p / GeV/c",bins,min,
max);
37 TH1F *hMomKm=
new TH1F(
"mompkm",
"P(K-);p / GeV/c",bins,min,
max);
38 TH1I *hTFStat=
new TH1I(
"tfstat",
"Track Fit Status Flag",10,-5,5);
40 TH1F *hDpMass=
new TH1F(
"dpmass",
"Mass D+;m / (GeV/c^{2})",bins,0,5);
41 TH1F *hDmMass=
new TH1F(
"dmmass",
"Mass D-;m / (GeV/c^{2})",bins,0,5);
42 TH1F *hBeamMass=
new TH1F(
"beammass",
"Mass Beam;m / (GeV/c^{2})",bins,0,5);
44 TH1F *hVtxX=
new TH1F(
"hvtxx",
"Vertex after fit (D+ and D-);x/cm",bins,-0.2,0.2);
45 TH1F *hVtxY=
new TH1F(
"hvtxy",
"Vertex after fit (D+ and D-);y/cm",bins,-0.2,0.2);
46 TH1F *hVtxZ=
new TH1F(
"hvtxz",
"Vertex after fit (D+ and D-);z/cm",bins,-0.2,0.2);
47 TH1F *hVtxR=
new TH1F(
"hvtxr",
"Vertex after fit (D+ and D-);|r|/cm",bins,0,20);
48 TH1F *hVtxChi2=
new TH1F(
"hvtxchi2",
"Vertex Fit #Chi^{2};#Chi^{2}",bins,0,10);
52 histolist->Add(hMompip);
53 histolist->Add(hMompim);
54 histolist->Add(hMomKp);
55 histolist->Add(hMomKm);
56 histolist->Add(hDpMass);
57 histolist->Add(hDmMass);
58 histolist->Add(hBeamMass);
59 histolist->Add(hTFStat);
60 histolist->Add(hVtxX);
61 histolist->Add(hVtxY);
62 histolist->Add(hVtxZ);
63 histolist->Add(hVtxR);
64 histolist->Add(hVtxChi2);
71 TCandList pionp, pionm, kaonp, kaonm, dplus, dminus ,mctracks, beam;
72 TCandidate *tmpcand=0, *recocand=0, *mccand=0;
75 if (nevts>0 && nevts<evts) evts=nevts;
79 TLorentzVector tmpMom;
80 TVector3
p1,
p2,backboost,vertex;
82 int ievt=0,j=0,mcidx=-1,fitstat=0;
85 TDatabasePDG *pdgDatabase = TRho::Instance()->GetPDG();
93 std::cout<<
" ***** Start the eventloop with "<<evts<<
" events. *****"<<std::endl;
94 while (theAnalysis->
GetEvent() && ievt++<evts)
96 theAnalysis->
FillList(mctracks,
"McTruth");
97 theAnalysis->
FillList(pionp,
"PionLoosePlus");
98 theAnalysis->
FillList(pionm,
"PionLooseMinus");
99 theAnalysis->
FillList(kaonp,
"KaonLoosePlus");
100 theAnalysis->
FillList(kaonm,
"KaonLooseMinus");
101 if(verbose>0)
printf(
"Event %i: TCandList sizes: pionp:%i, pionm:%i, kaonp:%i, kaonm:%i, mctracks:%i\n",ievt,pionp.GetLength(),pionm.GetLength(),kaonp.GetLength(),kaonm.GetLength(),mctracks.GetLength());
103 for (j=0;j<pionp.GetLength();++j) {
104 recocand=pionp.Get(j);
105 if(!recocand) {
if(verbose>0) cout<<
"############## pionp\n#############"<<endl;
continue;}
106 if(verbose>1) std::cout<<
" Pion+: "<<*recocand<<std::endl;
107 fitstat=recocand->GetMicroCandidate().GetFitStatus();
108 hTFStat->Fill(fitstat);
110 pionm.Remove(*recocand);
113 tmpMom=recocand->P4();
115 hMompip->Fill(momentum);
117 for (j=0;j<pionm.GetLength();++j) {
118 recocand=pionm.Get(j);
119 if(!recocand) {
if(verbose>0) cout<<
"############## pionm\n#############"<<endl;
continue;}
120 if(verbose>1) std::cout<<
" Pion-: "<<*recocand<<std::endl;
121 fitstat=recocand->GetMicroCandidate().GetFitStatus();
122 hTFStat->Fill(fitstat);
124 pionm.Remove(*recocand);
127 tmpMom=recocand->P4();
129 hMompim->Fill(momentum);
131 for (j=0;j<kaonp.GetLength();++j) {
132 recocand=kaonp.Get(j);
133 if(!recocand) {
if(verbose>0) cout<<
"############## kaonp\n#############"<<endl;
continue;}
134 if(verbose>1) std::cout<<
" K+: "<<*recocand<<std::endl;
135 fitstat=recocand->GetMicroCandidate().GetFitStatus();
136 hTFStat->Fill(fitstat);
138 kaonp.Remove(*recocand);
141 tmpMom=recocand->P4();
143 hMomKp->Fill(momentum);
145 for (j=0;j<kaonm.GetLength();++j) {
146 recocand=kaonm.Get(j);
147 if(!recocand) {
if(verbose>0) cout<<
"############## kaonm\n#############"<<endl;
continue;}
148 if(verbose>1) std::cout<<
" K-: "<<*recocand<<std::endl;
149 fitstat=recocand->GetMicroCandidate().GetFitStatus();
150 hTFStat->Fill(fitstat);
152 kaonm.Remove(*recocand);
155 tmpMom=recocand->P4();
157 hMomKm->Fill(momentum);
175 dplus.Combine(kaonm,pionp,pionp);
177 for (j=0;j<dplus.GetLength();++j) {
178 recocand=dplus.Get(j);
179 if(!recocand) {
if(verbose>0) cout<<
"############## Combine dplus\n#############"<<endl;
continue;}
180 if(verbose>1) std::cout<<
" recocand->Uid()="<<recocand->Uid()<<std::endl;
181 if(verbose>1) recocand->Print();
188 recocand=fitter.FittedCand(*recocand);
189 if(!recocand) {
if(verbose>0) cout<<
"############## Fit dplus\n#############"<<endl;
continue;}
190 if(verbose>1) std::cout<<
" recocand->Uid()="<<recocand->Uid()<<std::endl;
191 if(verbose>1) recocand->Print();
193 tmpMom=recocand->P4();
196 vertex=recocand->GetPosition();
197 if(verbose>2) std::cout<<
"Vertex of the fit cand is:"<<std::endl;
198 if(verbose>2) vertex.Print();
199 hVtxX->Fill(vertex.X());
200 hVtxY->Fill(vertex.Y());
201 hVtxZ->Fill(vertex.Z());
202 hVtxR->Fill(vertex.Mag());
203 hVtxChi2->Fill(fitter.GlobalChi2());
205 dminus.Combine(kaonp,pionm,pionm);
207 for (j=0;j<dminus.GetLength();++j) {
208 recocand=dminus.Get(j);
209 if(!recocand) {
if(verbose>0) cout<<
"############## Combine dminus\n#############"<<endl;
continue;}
210 if(verbose>1) std::cout<<
" recocand->Uid()="<<recocand->Uid()<<std::endl;
211 if(verbose>1) recocand->Print();
218 recocand=fitter.FittedCand(*recocand);
219 if(!recocand) {
if(verbose>0) cout<<
"############## Fit dminus\n#############"<<endl;
continue;}
220 if(verbose>1) std::cout<<
" recocand->Uid()="<<recocand->Uid()<<std::endl;
221 if(verbose>1) recocand->Print();
223 tmpMom=recocand->P4();
226 vertex=recocand->GetPosition();
227 if(verbose>2) std::cout<<
"Vertex of the fit cand is:"<<std::endl;
228 if(verbose>2) vertex.Print();
229 hVtxX->Fill(vertex.X());
230 hVtxY->Fill(vertex.Y());
231 hVtxZ->Fill(vertex.Z());
232 hVtxR->Fill(vertex.Mag());
233 hVtxChi2->Fill(fitter.GlobalChi2());
236 beam.Combine(dplus,dminus);
237 for (j=0;j<beam.GetLength();++j) {
238 recocand=beam.Get(j);
239 if(!recocand) {
if(verbose>0) cout<<
"############## beam\n#############"<<endl;
continue;}
240 if(verbose>1) std::cout<<
" beam: "<<*recocand<<std::endl;
241 tmpMom=recocand->P4();
242 mass=tmpMom.M(); momentum=tmpMom.P();
theta=tmpMom.Theta();
243 hBeamMass->Fill(mass);
245 if(verbose>0) cout <<
" ----- event done -----"<<endl;
249 TFile* histofile =
new TFile(histoFile.Data(),
"RECREATE");
252 TListIter iter(histolist);
254 while( tmph=(TH1*)iter() ) tmph->Write();
262 TCanvas* can =
new TCanvas();
277 printf(
"RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
284 FairRunAna*
fRun =
new FairRunAna();
285 FairRuntimeDb*
rtdb = fRun->GetRuntimeDb();
287 filename.ReplaceAll(
"_sim.root",
".root");
295 cout<<
"simFile="<<simFile.Data()<<endl;
296 cout<<
"parFile="<<parFile.Data()<<endl;
297 cout<<
"recoFile="<<recoFile.Data()<<endl;
298 cout<<
"trkFile="<<tracksFile.Data()<<endl;
299 fRun->SetInputFile(simFile);
300 fRun->AddFriend(recoFile);
301 fRun->AddFriend(tracksFile);
302 FairParRootFileIo* parIO =
new FairParRootFileIo();
303 parIO->open(parFile.Data());
304 rtdb->setFirstInput(parIO);
305 rtdb->setOutput(parIO);
310 fRun->SetOutputFile(outFile.Data());
311 FairGeane* geane =
new FairGeane();
312 fRun->AddTask(geane);
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
std::string GetParFileName(std::string addon="", bool cut=false)
int anaDMesonsCharged(TString filename="data/dpdm", int nevts=0)
TString InitRun(TString filename)
Bool_t FillList(RhoCandList &l, TString listkey="All", TString pidTcaNames="", int trackHypothesis=-1)
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
std::string GetSimFileName(std::string addon="", bool cut=false)
std::string GetRecoFileName(std::string addon="", bool cut=false)
A simple class which adds the corresponding file extensions to a given base class.
PndAnalysis(TString tname1="", TString tname2="", TString algnamec="PidAlgoIdealCharged", TString algnamen="PidAlgoIdealNeutral")
std::string GetCustomFileName(std::string ext, std::string addon="", bool cut=false)
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
PndFileNameCreator namecreator("../data/Lars/MvdDtsSim.root")
Int_t GetEvent(Int_t n=-1)
plothistos(TString filename="histos.root")