7 gROOT->Macro(
"../Libs.C");
8 gROOT->LoadMacro(
"../Tools.C");
23 picture.ReplaceAll(
".root",
".ps");
25 TFile*
f =
new TFile(inFile.c_str());
26 TTree *
t=(TTree *) f->Get(
"pndsim") ;
27 TClonesArray*
hit_array=
new TClonesArray(
"PndSdsMCPoint");
28 t->SetBranchAddress(
"MVDPoint",&hit_array);
30 TClonesArray*
mc_array=
new TClonesArray(
"PndMCTrack");
31 t->SetBranchAddress(
"MCTrack",&mc_array);
33 TGeoManager *
geoMan = (TGeoManager*) gDirectory->Get(
"FAIRGeom");
37 TH2D*
hisxy =
new TH2D(
"hisxy",
"MVD MC Points, xy view",200,-15.,15.,200,-15.,15.);
38 TH2D*
hisrz =
new TH2D(
"hisrz",
"MVD MC Points, rz view",200,-20.,20.,200,-15.,25.);
39 TH1D*
hisde =
new TH1D(
"hisde",
"MVD MC Points, Energyloss",200,0.,0.002);
42 TH2D*
hisdedx =
new TH2D(
"hisdedx",
"",200,0.,0.4,200,0.,1.0);
43 hisdedx->SetTitle(
"MVD MC Points, dE/dx(P);p/GeV / cm;dE/dx / (GeV/cm)");
47 TH1D*
hismom =
new TH1D(
"hismom",
"MVD MC Points, momentum",100,0.,1.5);
48 TH2D*
hisLocalXY =
new TH2D(
"hisLocalxy",
"",100,-5.,5.,100,-5.,5.);
49 hisLocalXY->SetTitle(
"Local Hit XY;x_{L} / cm;y_{L} / cm");
50 TH1D*
hisLocalZ =
new TH1D(
"localz",
"",100,-0.005, 0.005);
51 hisLocalZ->SetTitle(
"Locel MC Hit Z;z / cm");
63 for (Int_t j=0; j<nEvents && j<t->GetEntriesFast(); j++)
66 if( verbose || 0 == j%1000 ) cout<<
"Event No "<<j<<endl;
67 for (Int_t
i=0;
i<hit_array->GetEntriesFast();
i++)
69 if(verbose) cout<<
"Point No "<<
i<<endl;
77 vecs.SetXYZ(hit->GetX(), hit->GetY(), hit->GetZ());
79 vecP.SetXYZ(hit->GetPx(),hit->GetPy(),hit->GetPz());
81 dE=hit->GetEnergyLoss();
83 Int_t layer = Int_t(10.*vecs->Mag());
84 if(verbose) cout<<vecs.x()<<
"\t"<<vecs.y()<<
"\t"<<vecs.z()<<endl;
86 hisxy->Fill(vecs.x(),vecs.y());
87 hisrz->Fill(vecs.z(),((vecs.y()>0.)?1.:-1.)*vecs.Perp());
94 hisdedx->Fill(p,dEdX);
97 detname = fGeoH->
GetPath( hit->GetDetName());
98 geoMan->cd( detname.Data() );
99 currentTransMat = geoMan->GetCurrentMatrix();
100 tmpMaster[0]=0.5*(veco.x()+vecs.x());
101 tmpMaster[1]=0.5*(veco.y()+vecs.y());
102 tmpMaster[2]=0.5*(veco.z()+vecs.z());
103 currentTransMat->MasterToLocal(tmpMaster,tmpLocal);
104 vecs.SetXYZ(tmpLocal[0],tmpLocal[1],tmpLocal[2]);
105 hisLocalXY->Fill(vecs.x(),vecs.y());
106 hisLocalZ->Fill(vecs.z());
111 TCanvas*
can1 =
new TCanvas(
"can1",
"MCHit view in MVD",0,0,800,800);
125 hisLocalZ->DrawCopy(
"");
127 hismom->DrawCopy(
"");
130 can1->Print(picture.Data());
139 cout << endl << endl;
140 cout <<
"Macro finished succesfully." << endl;
143 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime <<
" s" << endl;
PndFileNameCreator namecreator("../data/mvdStrip.root")
std::string GetSimFileName(std::string addon="", bool cut=false)
TString GetPath(Int_t shortID)
for a given shortID the path is returned
Class to access the naming information of the MVD.
A simple class which adds the corresponding file extensions to a given base class.
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)
TGeoHMatrix * currentTransMat