7 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
8 gROOT->LoadMacro(
"../Tools.C");
20 std::string
parfile =
"../data/Lars/MvdDtsParams.root";
22 picture.ReplaceAll(
".root",
".ps");
24 TFile*
f =
new TFile(inFile.c_str());
25 TTree *
t=(TTree *) f->Get(
"pndsim") ;
26 t->AddFriend(
"pndsim",digiFile.c_str());
28 TClonesArray*
mc_array=
new TClonesArray(
"PndSdsMCPoint");
29 t->SetBranchAddress(
"MVDPoint",&mc_array);
32 t->SetBranchAddress(
"MVDStripDigis",&digiStrip_array);
34 TGeoManager *
geoMan = (TGeoManager*) gDirectory->Get(
"FAIRGeom");
36 std::ofstream
Outfile(
"../data/Lars/0999_1001_85.hit",ios_base::app);
37 std::ofstream
Outrealfile(
"../data/Lars/0999_1001_85.real",ios_base::app);
41 TH2D*
hisxy =
new TH2D(
"hisxy",
"",100,-1.1,1.1,100,-1.1,1.1);
42 hisxy->SetTitle(
"MVD MC Point, xy view;x / cm;y / cm");
44 TH2D*
hisrz =
new TH2D(
"hisrz",
"",100,0.,10.,100,-5.,5.);
45 hisrz->SetTitle(
"MVD MC Point, rz view;z / cm;r/ cm");
47 TH1D*
hisde =
new TH1D(
"hisde",
"MVD MC Points, Energyloss",100,0.,0.002);
49 TH1D*
hismom =
new TH1D(
"hismom",
"MVD MC Points, momentum",100,0.,1.5);
53 TH2I*
hisStripTop =
new TH2I(
"hisstriptop",
"Strip Top channel&fe numbers",5,0,4,130,0,130);
55 TH2I*
hisStripBot =
new TH2I(
"hisstripbot",
"Strip Bot channel&fe numbers",5,0,4,130,0,130);
57 TH1I*
hisStripStrip =
new TH1I(
"hisstripstrip",
"Strip numbers",3*128,0,3*128);
59 TH1D*
hisStripCharge =
new TH1D(
"hisstripcharge",
"Strip Charge content",100,0.,1e5);
62 hisStripChargeTop->SetLineColor(kBlue);
65 hisStripChargeBot->SetLineColor(kRed);
75 TFile*
parDB =
new TFile(parfile.c_str());
76 PndMvdStripDigiPar*
par = (PndMvdStripDigiPar*)gROOT->FindObject(
"MVDStripDigiParRect");
82 for (Int_t j=0; j<nEvents && j<t->GetEntriesFast(); j++)
86 if(verbose) cout<<
"Event No "<<j<<endl;
91 for (Int_t
i=0;
i<mc_array->GetEntriesFast();
i++)
93 if(verbose) cout<<
"Point No "<<
i<<endl;
97 mommc.SetXYZ(point->GetPx(),point->GetPy(),point->GetPz());
98 hisxy->Fill(vecmc.x(),vecmc.y());
99 if(vecmc.y() > 0.) hisrz->Fill(vecmc.z(),vecmc.Perp());
100 else hisrz->Fill(vecmc.z(),-1.*vecmc.Perp());
101 hisde->Fill(point->GetEnergyLoss());
102 hismom->Fill(mommc.Mag());
106 Eloss=point->GetEnergyLoss();
107 Outrealfile<<evID<<
" "<<x<<
" "<<y<<
" "<<z<<
" "<<Eloss<<
" "<<point->GetPx()<<
" "<<point->GetPy()<<
" "<<point->GetPz()<<endl;
111 if(0==digiStrip_array->GetEntriesFast())
Outfile<<evID<<
" "<<0<<
" "<<0<<
" "<<0.<<endl;
112 for (Int_t
i=0;
i<digiStrip_array->GetEntriesFast();
i++)
115 fe = stripdigi->
GetFE();
117 int strip = fe * nrFeChannels +
col;
118 hisStripStrip->Fill(strip);
119 hisStripCharge->Fill(stripdigi->
GetCharge());
120 if (strip <= nrStrips)
122 hisStripTop->Fill(fe,col);
123 hisStripChargeTop->Fill(stripdigi->
GetCharge());
125 hisStripBot->Fill(fe,col);
126 hisStripChargeBot->Fill(stripdigi->
GetCharge());
135 TCanvas*
can1 =
new TCanvas(
"MvdTestPlot",
"MCHit view in MVD",0,0,a*400,
b*400);
144 mypad->cd(3);gPad->SetLogy();hisde->DrawCopy();
145 mypad->cd(4);hismom->DrawCopy();
152 mypad->cd(3);hisStripStrip->DrawCopy();
153 mypad->cd(4);hisStripCharge->DrawCopy();
154 hisStripChargeTop->DrawCopy(
"sames");
155 hisStripChargeBot->DrawCopy(
"sames");
174 cout << endl << endl;
175 cout <<
"Macro finished succesfully." << endl;
176 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime <<
" s" << endl;
Class for digitised strip hits.
std::string GetDigiFileName(std::string addon="", bool cut=false)
Double_t GetCharge() const
std::ofstream Outrealfile("../data/Lars/0999_1001_85.real", ios_base::app)
TVector3 GetPositionOut() const
std::string GetSimFileName(std::string addon="", bool cut=false)
std::ofstream Outfile("../data/Lars/0999_1001_85.hit", ios_base::app)
A simple class which adds the corresponding file extensions to a given base class.
PndFileNameCreator namecreator("../data/Lars/MvdDtsSim.root")
TVector3 GetPosition() const
TClonesArray * digiStrip_array