10 gSystem->Load(
"../Helper_C.so");
11 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
12 gROOT->LoadMacro(
"../Tools.C");
29 picture.ReplaceAll(
".root",
".ps");
31 TFile*
f =
new TFile(inFile.c_str());
32 TTree*
t=(TTree*)f->Get(
"pndsim");
33 t->AddFriend(
"pndsim",digiFile.c_str());
34 t->AddFriend(
"pndsim",recoFile.c_str());
36 TClonesArray*
mc_array=
new TClonesArray(
"PndSdsMCPoint");
37 t->SetBranchAddress(
"MVDPoint",&mc_array);
40 t->SetBranchAddress(
"MVDPixelDigis",&digiPixel_array);
43 t->SetBranchAddress(
"MVDStripDigis",&digiStrip_array);
46 t->SetBranchAddress(
"MVDStripClusterCand",&stripClust_array);
49 t->SetBranchAddress(
"MVDPixelClusterCand",&pixelClust_array);
52 t->SetBranchAddress(
"MVDHitsStrip",&stripHit_array);
55 t->SetBranchAddress(
"MVDHitsPixel",&pixelHit_array);
58 TGeoManager *
geoMan = (TGeoManager*) gDirectory->Get(
"FAIRGeom");
63 TH2D* hisxymc =
new TH2D(
"xymc",
"MVD MC Points, xy view;x / cm;y / cm",nbins,-rim,rim,nbins,-rim,rim);
64 TH2D* hisrzmc =
new TH2D(
"rzmc",
"MVD MC Points, rz view;z / cm;r/ cm",nbins,-rim,rim,nbins,-rim,rim);
65 TH1D*
hisde =
new TH1D(
"de",
"MVD MC Points, Energyloss;E / GeV;",nbins,0.,0.002);
66 TH2D* hisLocalXYMC =
new TH2D(
"LocalxyMC",
"Local MC Point XY;x_{L} / cm;y_{L} / cm",nbins,-5.,5.,nbins,-5.,5.);
67 TH1D* hisLocalZMC =
new TH1D(
"LocalzMC",
"Local MC Point Z;Z_{L} / cm;",nbins,-5.,5.);
69 TH2D*
hisxy =
new TH2D(
"xy",
"MVD reco Hit, xy view;x / cm;y / cm",nbins,-rim,rim,nbins,-rim,rim);
70 TH2D*
hisrz =
new TH2D(
"rz",
"MVD reco Hit, rz view;z / cm;r/ cm",nbins,-rim,rim,nbins,-rim,rim);
71 TH2D*
hisLocalXY =
new TH2D(
"Localxy",
"MVD Local reco Hit XY;x_{L} / cm;y_{L} / cm",nbins,-5.,5.,nbins,-5.,5.);
72 TH1D* hisrecoeloss =
new TH1D(
"derec",
"MVD reco Hit energy deposit;E / GeV;",nbins,0.,0.002);
74 TH2D* hisnomatchxy =
new TH2D(
"nomatchxy",
"MVD reco Hit nomatch, xy view;x / cm;y / cm",nbins,-rim,rim,nbins,-rim,rim);
75 TH2D* hisnomatchrz =
new TH2D(
"nomatchrz",
"MVD reco Hit nomatch, rz view;z / cm;r/ cm",nbins,-rim,rim,nbins,-rim,rim);
76 TH1D* hisnomatcheloss =
new TH1D(
"denom",
"MVD blind Hit energy deposit;E / GeV;",nbins,0.,0.002);
77 TH2D* hisLocalXYnom =
new TH2D(
"LocalxyMCnom",
"Local nomatch MC Point XY;x_{L} / cm;y_{L} / cm",nbins,-5.,5.,nbins,-5.,5.);
80 TH2D*
hisDiffXY =
new TH2D(
"diffxy",
"",nbins,-0.01,0.01,nbins,-0.04,0.04);
81 hisDiffXY->SetTitle(
"(MC - RECO) Hit coordinates xy view;#Deltax / cm;#Deltay / cm");
82 TH2D*
hisDiffRZ =
new TH2D(
"diffrz",
"",5*nbins,-0.025,0.025,nbins,-0.00,0.04);
83 hisDiffRZ->SetTitle(
"(MC - RECO) Hit coordinates rz view;#Deltaz / cm;#Deltar / cm");
84 TH2D* hisCZ =
new TH2D(
"Cz",
"",nbins,-0.025,0.025,nbins,0.,1000000);
85 hisCZ->SetTitle(
"Charge - zdeviation ;#Deltaz / cm;#Q / e-");
91 TH1D*
hisDiffX =
new TH1D(
"diffx",
"(MC - RECO) Hit coordinate x;#Deltax / cm;",bins,-range,range);
92 TH1D*
hisDiffY =
new TH1D(
"diffy",
"(MC - RECO) Hit coordinate y;#Deltay / cm;",bins,-range,range);
93 TH1D*
hisDiffZ =
new TH1D(
"diffz",
"(MC - RECO) Hit coordinate z;#Deltaz / cm;",bins,-range,range);
94 TH1D* hisDiffM =
new TH1D(
"diffm",
"(MC - RECO) residual;#R / cm;",bins,0.,5.);
97 TH1D* hisDiffTheta =
new TH1D(
"DiffTheta",
"#Theta resolution;#Delta#Theta/mrad;",100,-angmax,angmax);
98 TH1D* hisDiffThetaDisk =
new TH1D(
"DiffThetaDisk",
"",100,-angmax,angmax);
99 TH1D* hisDiffThetaSide =
new TH1D(
"DiffThetaSide",
"",100,-angmax,angmax);
100 TH1D* hisDiffThetaOne =
new TH1D(
"DiffThetaOne" ,
"",100,-angmax,angmax);
101 TH1D* hisDiffThetaMore =
new TH1D(
"DiffThetaMore",
"",100,-angmax,angmax);
103 TH1D* hisDiffPhi =
new TH1D(
"DiffPhi",
"#Phi resolution;#Delta#Phi/mrad;",100,-angmax,angmax);
104 TH1D* hisDiffPhiDisk =
new TH1D(
"DiffPhiDisk",
"",100,-angmax,angmax);
105 TH1D* hisDiffPhiSide =
new TH1D(
"DiffPhiSide",
"",100,-angmax,angmax);
106 TH1D* hisDiffPhiOne =
new TH1D(
"DiffPhiOne" ,
"",100,-angmax,angmax);
107 TH1D* hisDiffPhiMore =
new TH1D(
"DiffPhiMore",
"",100,-angmax,angmax);
109 TH1I* hisClustSize =
new TH1I(
"ClustSize",
"Cluster size",10,0,10);
110 hisClustSize->SetTitle(
"Cluster size;n_{cl};");
111 TH1I* hisClustSizeDisk =
new TH1I(
"ClustSizeDisk",
"Cluster size",10,0,10);
112 TH1I* hisClustSizeSide =
new TH1I(
"ClustSizeSize",
"Cluster size",10,0,10);
113 TH1I* hisClustSizeTop =
new TH1I(
"ClustSizetop",
"Cluster size",10,0,10);
114 TH1I* hisClustSizeBot =
new TH1I(
"ClustSizebot",
"Cluster size",10,0,10);
116 TH1I* hisDigiCounts =
new TH1I(
"DigiCounts",
"Digis used n times in clusters;n;",10,0,10);
117 TH1I* hisPointEff =
new TH1I(
"pointeff",
"Reconstructed Hits per MC Point;n;",10,0,10);
123 for (Int_t j=0; j<nEvents && j<t->GetEntriesFast(); j++)
126 if(verbose) cout<<
"Event No "<<j<<endl;
127 else if (!(j%20)) cout <<
"Event No "<<j<<endl;
128 if(verbose) std::cout<<
"Check sanity of the arrays:"<<std::endl;
130 if(verbose) std::cout<<
"mc_array ok with "<<mc_array->GetEntriesFast()<<
" entries"<<std::endl;
132 else std::cout<<
"*** mc_array broken - check your file! ."<<std::endl;
134 if(verbose) std::cout<<
"digiPixel_array ok with "<<digiStrip_array->GetEntriesFast()<<
" entries"<<std::endl;
136 else std::cout<<
"*** digiPixel_array broken - check your file! ."<<std::endl;
138 if(verbose) std::cout<<
"digiStrip_array ok with "<<digiStrip_array->GetEntriesFast()<<
" entries"<<std::endl;
140 else std::cout<<
"*** digiStrip_array broken - check your file! ."<<std::endl;
141 if(stripClust_array){
142 if(verbose) std::cout<<
"stripClust_array ok with "<<stripClust_array->GetEntriesFast()<<
" entries"<<std::endl;
144 else std::cout<<
"*** stripClust_array broken - check your file! ."<<std::endl;
146 if(verbose) std::cout<<
"stripHit_array ok with "<<stripHit_array->GetEntriesFast()<<
" entries"<<std::endl;
148 else std::cout<<
"*** stripHit_array broken - check your file! ."<<std::endl;
167 std::map<int,std::vector<int> > matchmap;
170 for (Int_t
i=0;
i<stripHit_array->GetEntriesFast();
i++)
173 if(verbose) cout<<
"Hit No "<<
i;
174 if(verbose) cout<<
" | ";
177 fGeoH->
GetPath(hit->GetDetName()).Contains(detFilter))
180 vecs.SetXYZ(hit->GetX(), hit->GetY(), hit->GetZ());
181 hisxy->Fill(vecs.x(),vecs.y());
182 hisrz->Fill(vecs.z(),((vecs.y()>0.)?1.:-1.)*vecs.Perp());
183 hisrecoeloss->Fill(hit->
GetEloss());
184 vecsloc = fGeoH->MasterToLocalId(vecs, hit->GetDetName());
185 hisLocalXY->Fill(vecsloc.x(),vecsloc.y());
188 int topclustid = hit->GetRefIndex();
190 if(verbose) cout<<
"top/bot cluster index "<< topclustid<<
"/"<<botclustid<<
" ";
191 if(verbose) cout<<
" | ";
193 if(verbose) cout<< topclustid<<
" "<<clust<<
" ";
195 if(verbose) cout<<clsize <<
" ";
197 if (hclsize < clsize) cout<<
"Strange cluster sizes - this shall not happen!"<<endl;
200 if(verbose) cout<<
" | "<<botclustid <<
" ";
203 if(verbose) cout<< botcl <<
" "<<bclsize<<
" | ";
205 hisClustSize->Fill(clsize);
206 if(bclsize>0) hisClustSize->Fill(bclsize);
207 hisClustSizeTop->Fill(clsize);
208 if(bclsize>0) hisClustSizeBot->Fill(bclsize);
212 if(verbose) cout<<
"sid="<<sid<<
" | ";
213 if(sid>digiStrip_array->GetEntriesFast()) cout<<
"Exceeding digi array size"<<endl;
215 if(0==astripdigi)cout<<
"no strip digi found"<<endl;
219 if(verbose) cout<<
"#4# | ";
222 if(point->GetDetName()!=hit->GetDetName())
224 cout<<
"-error- Point and hit detector names don't match!"<<endl;
225 cout<<
"point (id) : "<<point->GetDetName()<<endl;
226 cout<<
"hit (id) : "<< hit->GetDetName()<<endl;
227 cout<<
"point (name): "<<fGeoH->
GetPath(point->GetDetName()).Data()<<endl;
228 cout<<
"hit (name): "<<fGeoH->
GetPath( hit->GetDetName()).Data()<<endl;
232 vecmcloc = fGeoH->MasterToLocalId(vecmc, point->GetDetName());
233 vecdiff = vecmcloc - vecsloc;
241 difftheta = vecmc.Theta() - vecs.Theta();
242 diffphi = vecmc.Phi() - vecs.Phi();
244 difftheta = difftheta*1000.*
TMath::Pi()/180.;
247 hisxy->Fill(vecs.x(),vecs.y());
248 if(vecs.y() > 0.) hisrz->Fill(vecs.z(),vecs.Perp());
249 else hisrz->Fill(vecs.z(),-1.*vecs.Perp());
251 hisDiffTheta->Fill(difftheta);
252 hisDiffPhi->Fill(diffphi);
254 hisDiffXY->Fill(vecdiff.x(),vecdiff.y());
255 hisDiffRZ->Fill(vecdiff.z(),vecdiff.Perp());
256 hisDiffX->Fill(vecdiff.x());
257 hisDiffY->Fill(vecdiff.y());
258 hisDiffZ->Fill(vecdiff.z());
259 hisDiffM->Fill(vecdiff.Mag());
261 if(verbose) cout<<endl;
264 matchmap[mcid].push_back(i);
268 for (Int_t i=0; i<mc_array->GetEntriesFast(); i++)
270 if(verbose) cout<<
"Point No "<<i<<endl;
273 hisxymc->Fill(vecmc.x(),vecmc.y());
274 hisrzmc->Fill(vecmc.z(),((vecmc.y()>0.)?1.:-1.)*vecmc.Perp());
275 hisde->Fill(point->GetEnergyLoss());
276 vecmcloc = fGeoH->MasterToLocalId(vecmc, point->GetDetName());
277 hisLocalXYMC->Fill(vecmcloc.x(),vecmcloc.y());
278 hisLocalZMC->Fill(vecmcloc.z());
279 if(fGeoH->
GetPath(point->GetDetName()).Contains(
"Strip"))
281 hisPointEff->Fill(matchmap[i].size());
282 if(matchmap[i].size()==0)
284 hisnomatchxy->Fill(vecmc.x(),vecmc.y());
285 hisnomatchrz->Fill(vecmc.z(),((vecmc.y()>0.)?1.:-1.)*vecmc.Perp());
286 hisnomatcheloss->Fill(point->GetEnergyLoss());
287 hisLocalXYnom->Fill(vecmcloc.x(),vecmcloc.y());
300 TCanvas*
can1 =
new TCanvas(
"MvdTestPlot",
"MCHit view in MVD",0,0,a*pix,
b*pix);
310 mypad->cd(4);gPad->SetLogy();hisde->DrawCopy();
318 mypad->cd(4);gPad->SetLogy();hisrecoeloss->DrawCopy();
325 mypad->cd(3);hisDiffTheta->DrawCopy();
326 mypad->cd(4);hisDiffPhi->DrawCopy();
329 hisClustSize->Draw();
330 hisClustSizeBot->SetLineColor(kRed);
331 hisClustSizeTop->SetLineColor(kBlue);
332 hisClustSizeBot->Draw(
"sames");
333 hisClustSizeTop->Draw(
"sames");
339 mypad->cd(1);gPad->SetLogy();
340 hisDiffM->DrawCopy();
342 hisPointEff->SetFillColor(kBlue+5);
343 hisPointEff->DrawCopy();
353 mypad->cd(4);gPad->SetLogy();
354 hisnomatcheloss->DrawCopy();
356 can1->Print(
"/home/ralfk/Desktop/tempview.ps");
360 TCanvas*
can5 =
new TCanvas(
"MvdTalkPlot5",
"MVD clust",200,200,800,400);
363 hisDiffTheta->DrawCopy();
365 hisDiffPhi->DrawCopy();
366 can5->Print(
"res-clust-thetaphi.png");
368 TCanvas* can6 =
new TCanvas(
"MvdTalkPlot6",
"MVD clust",250,250,400,400);
369 can6->cd();
int off = -3;
370 hisClustSizeTop->SetLineColor(kOrange + off);
371 hisClustSizeBot->SetLineColor(kAzure + off);
372 hisClustSize->DrawCopy(
"");
373 hisClustSizeTop->DrawCopy(
"same");
374 hisClustSizeBot->DrawCopy(
"same");
376 can6->Print(
"res-clust-clsize.png");
378 TCanvas* can7 =
new TCanvas(
"MvdTalkPlot7",
"MVD clust",200,200,800,400);
381 hisPointEff->DrawCopy();
383 Double_t zeros = hisPointEff->GetBinContent(hisPointEff->GetBin(1));
384 Double_t ones = hisPointEff->GetBinContent(hisPointEff->GetBin(2));
386 Double_t multiples = all - zeros - ones;
387 cout <<zeros<<
" zeros, "<<ones<<
" ones, "<<multiples<<
" multiples"<<endl;
388 cout <<zeros/all<<
"% "<<ones/all<<
"% "<<multiples/all<<
"%"<<endl;
389 can7->Print(
"res-clust-efiiciencies.png");
Int_t GetClusterSize() const
Int_t GetNDigiHits() const
Int_t GetIndex(int i=0) const
Class for digitised strip hits.
std::string GetDigiFileName(std::string addon="", bool cut=false)
TVector3 GetPositionOut() const
Double_t GetEloss() const
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.
Int_t GetDigiIndex(Int_t i) const
std::string GetRecoFileName(std::string addon="", bool cut=false)
A simple class which adds the corresponding file extensions to a given base class.
TClonesArray * stripClust_array
TClonesArray * stripHit_array
Int_t GetBotIndex() const
PndFileNameCreator namecreator("../data/Lars/MvdDtsSim.root")
TClonesArray * digiPixel_array
TVector3 GetPosition() 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)
TClonesArray * digiStrip_array
TClonesArray * pixelClust_array
TClonesArray * pixelHit_array