FairRoot/PandaRoot
PndMvdDigiEventAna.cxx
Go to the documentation of this file.
1 #include "PndMvdDigiEventAna.h"
2 
3 #include "PndSdsMCPoint.h"
4 
5 #include "TVector3.h"
6 #include "TGeoManager.h"
7 #include "TLegend.h"
8 
9 using std::vector;
10 
11 // ClassdImp(PndMvdDigiEventAna)
12 
13 
15 
17 {
18  Init(fileName);
20 
22 }
23 
25 {
26  fClassName = "PndSdsDigiPixel";
27  fBranchName = "MVDPixelDigis";
28 }
29 
31 {
32  for (std::map<TString, TH1*>::const_iterator ki = fHistos.begin(); ki != fHistos.end(); ki++){
33  delete(ki->second);
34  }
35  fHistos.clear();
36 }
37 
39 {
40  fHitArray->Delete();
41  fTree->GetEntry(fActiveEvent);
43  //if (hit->GetDetName().Contains("119_2")){
44  if (fHistos[hit->GetDetName()] == 0){
45  fHistos[hit->GetDetName()] = new TH2I("HitDistribution",hit->GetDetName().Data(), 400,0,400,101,0,100);
46  //fDrawOption[hit->GetDetName()] = "colz";
47  }
48  if (fFeHits[hit->GetDetName()] == 0){
49  fFeHits[hit->GetDetName()] = new std::vector<Int_t>(30,0);
50  fDrawOption[hit->GetDetName()] = "colz";
51  }
52  TH2* tempHisto = (TH2*)(fHistos[hit->GetDetName()]);
53  tempHisto->Fill((Double_t)(hit->GetPixelColumn()+hit->GetFE()*16),(Double_t)(hit->GetPixelRow()));//, (Double_t)(hit->GetCharge()));
54  fFeHits[hit->GetDetName()]->at(hit->GetFE())++;
55  fDigiPixelArray[hit->GetDetName()].push_back(*hit);
56 }
57 
59 {
60 
61  TH1I* hPix1 = new TH1I("hPix1","Hitrate per Module",600,0,600);
62  hPix1->SetLineColor(2);
63  hPix1->GetXaxis()->SetTitle("Module ID");
64  hPix1->GetYaxis()->SetTitle("Hits per second");
65  hPix1->SetStats(kFALSE);
66  TH1I* hPix2 = new TH1I("hPix2","Hitrate per Module",600,0,600);
67  hPix2->SetLineColor(3);
68  hPix2->GetXaxis()->SetTitle("Module ID");
69  hPix2->GetYaxis()->SetTitle("Hits per second");
70  hPix2->SetStats(kFALSE);
71  TH1I* hMPix1 = new TH1I("hMPix1","Hitrate per Module",600,0,600);
72  hMPix1->SetLineColor(4);
73  hMPix1->GetXaxis()->SetTitle("Module ID");
74  hMPix1->GetYaxis()->SetTitle("Hits per second");
75  hMPix1->SetStats(kFALSE);
76  TH1I* hMPix2 = new TH1I("hMPix2","Hitrate per Module",600,0,600);
77  hMPix2->SetLineColor(5);
78  hMPix2->GetXaxis()->SetTitle("Module ID");
79  hMPix2->GetYaxis()->SetTitle("Hits per second");
80  hMPix2->SetStats(kFALSE);
81  TH1I* hSDisk1 = new TH1I("hSDisk1","Hitrate per Module",600,0,600);
82  hSDisk1->SetLineColor(6);
83  hSDisk1->GetXaxis()->SetTitle("Module ID");
84  hSDisk1->GetYaxis()->SetTitle("Hits per second");
85  hSDisk1->SetStats(kFALSE);
86  TH1I* hSDisk2 = new TH1I("hSDisk2","Hitrate per Module",600,0,600);
87  hSDisk2->SetLineColor(7);
88  hSDisk2->GetXaxis()->SetTitle("Module ID");
89  hSDisk2->GetYaxis()->SetTitle("Hits per second");
90  hSDisk2->SetStats(kFALSE);
91  TH1I* hRest = new TH1I("hRest","Hitrate per Module",600,0,600);
92  hRest->SetLineColor(1);
93  hRest->GetXaxis()->SetTitle("Module ID");
94  hRest->GetYaxis()->SetTitle("Hits per second");
95  hRest->SetStats(kFALSE);
96  for (UInt_t i = 0; i < fHistoVector.size(); i++){
97  TString hName= fHistoVector[i]->GetTitle();
98  //std::cout << hName << " " << fGeoH->GetPath(hName.Data()) << std::endl;
99  Int_t weight = 10000000 / fAnaEvents;
100  std::cout << weight << std::endl;
101  if (fGeoH->GetPath(hName.Data()).Contains("MiniPixelDisk_1"))
102  hMPix1->Fill(i, fHistoVector[i]->GetEntries()* weight);
103  else if (fGeoH->GetPath(hName.Data()).Contains("MiniPixelDisk_2")){
104  hMPix2->Fill(i, fHistoVector[i]->GetEntries()* weight);
105  }
106  else if (fGeoH->GetPath(hName.Data()).Contains("PixelDisk_1"))
107  hPix1->Fill(i, fHistoVector[i]->GetEntries()* weight);
108  else if (fGeoH->GetPath(hName.Data()).Contains("PixelDisk_2"))
109  hPix2->Fill(i, fHistoVector[i]->GetEntries()* weight);
110  else if (fGeoH->GetPath(hName.Data()).Contains("StripDiskMedium2_1"))
111  hSDisk1->Fill(i, fHistoVector[i]->GetEntries()* weight);
112  else if (fGeoH->GetPath(hName.Data()).Contains("StripDiskMedium2_2"))
113  hSDisk2->Fill(i, fHistoVector[i]->GetEntries()* weight);
114  else hRest->Fill(i, fHistoVector[i]->GetEntries()* weight);
115  }
116 
117  hMPix1->Draw("");
118  hMPix2->Draw("same");
119 
120  hPix1->Draw("same");
121  hPix2->Draw("same");
122 
123  hSDisk1->Draw("same");
124  hSDisk2->Draw("same");
125 
126  hRest->Draw("same");
127 /* TLegend* leg = new TLegend();
128  leg->AddEntry("hMPix1","Mini pixel disk 1","l");
129  leg->AddEntry("hMPix2","Mini pixel disk 2","l");
130  leg->AddEntry("hPix1","Pixel disk 1","l");
131  leg->AddEntry("hPix2","Pixel disk 2","l");
132  leg->AddEntry("hSDisk1","Combined disk 1","l");
133  leg->AddEntry("hSDisk2","Combined disk 2","l");
134  leg->DrawClone("same");*/
135 }
136 
138 {
139  TH1I* feHisto = new TH1I("feHisto",path.Data(),500,0,10000);
140  vector<Int_t>* fe = fFeHits[path.Data()];
141  for (UInt_t i = 0; i < fe->size(); i++){
142  feHisto->Fill(fe->at(i));
143  }
144  feHisto->Draw("");
145 }
146 
148 {
149  TH1I* feHisto = new TH1I("feHisto","Hits in FE", 500, 0,10000);
150  std::map<TString, std::vector<Int_t>* >::const_iterator ki;
151  for (ki = fFeHits.begin(); ki != fFeHits.end(); ++ki){
152  for (UInt_t i = 0; i< ki->second->size(); i++)
153  feHisto->Fill(ki->second->at(i));
154  }
155  feHisto->Draw("");
156 }
157 
159 {
160 }
161 
162 
Int_t GetPixelRow() const
Int_t i
Definition: run_full.C:25
Int_t GetPixelColumn() const
void SetCanvasColumns(Int_t col)
Int_t GetFE() const
Definition: PndSdsDigi.h:57
TString GetPath(Int_t shortID)
for a given shortID the path is returned
PndGeoHandling * fGeoH
std::map< TString, TH1 * > fHistos
TString fBranchName
virtual void AnaHitNr(Int_t hitNr)
Double_t
virtual void InitHistos()
void DrawSingleModuleFEHisto(TString path)
TClonesArray * fHitArray
std::vector< TH1 * > fHistoVector
static PndGeoHandling * Instance()
std::map< TString, std::vector< PndSdsDigiPixel > > fDigiPixelArray
std::map< TString, TString > fDrawOption
std::map< TString, std::vector< Int_t > * > fFeHits
virtual void InitBranch()
cout<<"will loop over "<< t-> GetEntries()
Definition: root2ascii.C:17
int fe
Definition: anaLmdDigi.C:67
TString fClassName
ClassImp(PndAnaContFact)
Data class to store the digi output of a pixel module.
PndSdsMCPoint * hit
Definition: anasim.C:70
virtual void Init(TString fileName)