FairRoot/PandaRoot
PndMvdEventAna.cxx
Go to the documentation of this file.
1 #include "PndMvdEventAna.h"
2 #include "PndSdsMCPoint.h"
3 #include "TVector3.h"
4 #include "TEventList.h"
5 
7 
9 {
10  fActiveEvent = 0;
11  fAnaEvents = 0;
12  fCan = 0;
13  fCancol = 2;
14 }
15 
17 {
18  InitHistos();
19  InitBranch();
20  fFile = new TFile(fileName.Data());
21  fTree = (TTree*)(fFile->Get("pndsim"));
22  fHitArray=new TClonesArray(fClassName.Data());
23  fTree->SetBranchAddress(fBranchName.Data(),&fHitArray);//Branch names
24  fActiveEvent = 0;
25 }
26 
27 
29 {
30  TVector3 vecs;
32 
33  fAnaEvents = 1;
34  InitHistos();
35  ClearHistos();
36  if (Nr > fTree->GetEntriesFast())
37  return;
38 
39  fActiveEvent = Nr;
40  AnaHits();
42  //InitCanvas();
43  //DrawHistos();
44 }
45 
47 {
48  fAnaEvents = 1;
49  if (fActiveEvent + 1 < fTree->GetEntriesFast()){
50  fActiveEvent++;
52  }
53 }
54 
56 {
57  if (fCan != 0) delete(fCan);
58  fCan = new TCanvas("can1","MCHit view in MVD",0,0,1000,1000);
59  std::cout << "InitCanvas fHistos.size() " << fHistos.size() << std::endl;
60  fCan->Divide(fCancol, (Int_t)(((Double_t)(fHistos.size())/fCancol) + 0.5));
61 }
62 
64 {
65  Int_t i = 0;
66  for (std::map<TString, TH1*>::const_iterator ki = fHistos.begin(); ki != fHistos.end(); ki++){
67  i++;
68  fCan->cd(i);
69  std::cout << ki->second << std::endl;
70  ki->second->Draw();//(fDrawOption[ci->second->GetName()]);
71  }
72 }
73 
75 {
76  fHistos[path]->Draw(opt.Data());
77 }
78 
80 {
81  fAnaEvents = count;
82  InitHistos();
83  if (count > fTree->GetEntriesFast())
84  count = fTree->GetEntriesFast();
85  for (Int_t i = 0; i < count; i++)
86  {
87  fActiveEvent = i;
88  AnaHits();
89  }
90  //InitCanvas();
91  //DrawHistos();
92 }
93 
95 {
96  for (Int_t i=0; i<fHitArray->GetEntriesFast(); i++)
97  {
98  AnaHitNr(i);
99  }
100 }
101 
103 {
104  fHistoVector.clear();
105  for (std::map<TString, TH1*>::const_iterator ki = fHistos.begin(); ki != fHistos.end(); ki++){
106  fHistoVector.push_back(ki->second);
107  }
108 }
109 
110 void PndMvdEventAna::DrawVector(Int_t index, TString opt)
111 {
112  fHistoVector[index]->Draw(opt.Data());
113 }
114 
116 {
117  fDrawOption[histoName] = option;
118 }
virtual void InitBranch()=0
void DrawHisto(TString path, TString opt="")
Int_t i
Definition: run_full.C:25
TCanvas * fCan
virtual void ClearHistos()
void SetDrawOption(TString histoName, TString option)
std::map< TString, TH1 * > fHistos
TString fBranchName
TVector3 vecs
Double_t
void DrawVector(Int_t index, TString opt)
TClonesArray * fHitArray
virtual void BeginOfEventAction()
std::vector< TH1 * > fHistoVector
std::map< TString, TString > fDrawOption
virtual void InitHistos()=0
virtual void AnaHitNr(Int_t i)
TString fClassName
void AnaEventNr(Int_t Nr)
ClassImp(PndAnaContFact)
void AnaEvents(Int_t count)
int count
virtual void EndOfEventAction()
virtual void AnaHits()
virtual void Init(TString fileName)