MakeHistograms.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////
2 // This class has been automatically generated on
3 // Fri May 2 15:13:16 2014 by ROOT version 5.34/03
4 // from TTree RawData/Raw Data Display
5 // found on file: duneEVDraw35t_tree_Cosmic_1000evt.root
6 //////////////////////////////////////////////////////////
7 
8 #ifndef MakeHistograms_h
9 #define MakeHistograms_h
10 
11 #include <TROOT.h>
12 #include <TChain.h>
13 #include <TFile.h>
14 #include <TH2.h>
15 
16 // Header file for the classes stored in the TTree if any.
17 #include <vector>
18 
19 // Fixed size dimensions of array or collections stored in the TTree if any.
20 
22 public :
23  TTree *fChain; //!pointer to the analyzed TTree or TChain
24  Int_t fCurrent; //!current Tree number in a TChain
25  UInt_t fEvent;
26 
27  // Declaration of leaf types
28  UInt_t Run;
29  UInt_t SubRun;
30  UInt_t Event;
33  UInt_t Nticks;
34  UInt_t NofUChan;
35  UInt_t NofVChan;
36  UInt_t NofZ0Chan;
37  UInt_t NofZ1Chan;
41 
42  // List of branches
43  TBranch *b_Run; //!
44  TBranch *b_SubRun; //!
45  TBranch *b_Event; //!
46  TBranch *b_ADC; //!
47  TBranch *b_TDC; //!
48  TBranch *b_Nticks; //!
49  TBranch *b_NofUChan; //!
50  TBranch *b_NofVChan; //!
51  TBranch *b_NofZ0Chan; //!
52  TBranch *b_NofZ1Chan; //!
53  TBranch *b_Chan; //!
54  TBranch *b_APA; //!
55  TBranch *b_Plane; //!
56 
57 // MakeHistograms(TTree *tree=0);
58  MakeHistograms(std::string dfname="duneEVDraw35t_tree_Cosmic_1000evt.root");
59  virtual ~MakeHistograms();
60  virtual Int_t Cut(Long64_t entry);
61  virtual Int_t GetEntry(Long64_t entry);
62  virtual Long64_t LoadTree(Long64_t entry);
63  virtual void Init(TTree *tree);
64  virtual void PrintPlots(UInt_t eventnb=1);
65  virtual void HistDef();
66  virtual Bool_t Notify();
67  virtual void Show(Long64_t entry = -1);
68  virtual void Pal1();
69  virtual void Pal2();
70  virtual void PrintHistos();
71  virtual void PrintGraphs(std::vector<TH2I*> h);
72  virtual void DrawUplane();
73  virtual void DrawVplane();
74  virtual void DrawZplane();
75 
76 private :
77  std::vector<TH2I*> fTimeChanU;
78  std::vector<TH2I*> fTimeChanV;
79  std::vector<TH2I*> fTimeChanZ0;
80  std::vector<TH2I*> fTimeChanZ1;
81  TH2I* fChargeSumU;
82  TH2I* fChargeSumV;
83  TH2I* fChargeSumZ;
84  TCanvas* fCanvas;
85 };
86 
87 #endif
88 
89 #ifdef MakeHistograms_cxx
90 //MakeHistograms::MakeHistograms(TTree *tree) : fChain(0)
92 {
93 // if parameter tree is not specified (or zero), connect the file
94 // used to generate this class and read the Tree.
95  TTree *tree=0;
96  if (tree == 0) {
97  TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject(dfname.c_str());
98  if (!f || !f->IsOpen()) {
99  f = new TFile(dfname.c_str());
100  }
101  dfname=dfname+":/rawdraw";
102  TDirectory * dir = (TDirectory*)f->Get(dfname.c_str());
103  dir->GetObject("RawData",tree);
104 
105  }
106 // fCanvas = new TCanvas("Ecanvas","DUNE 35t detector event display",800,600);
107  Init(tree);
108  HistDef();
109 }
110 
112 {
113  if (!fChain) return;
114  delete fChain->GetCurrentFile();
115 }
116 
117 Int_t MakeHistograms::GetEntry(Long64_t entry)
118 {
119 // Read contents of entry.
120  if (!fChain) return 0;
121  return fChain->GetEntry(entry);
122 }
123 Long64_t MakeHistograms::LoadTree(Long64_t entry)
124 {
125 // Set the environment to read one entry
126  if (!fChain) return -5;
127  Long64_t centry = fChain->LoadTree(entry);
128  if (centry < 0) return centry;
129  if (fChain->GetTreeNumber() != fCurrent) {
130  fCurrent = fChain->GetTreeNumber();
131  Notify();
132  }
133  return centry;
134 }
135 
136 void MakeHistograms::Init(TTree *tree)
137 {
138  // The Init() function is called when the selector needs to initialize
139  // a new tree or chain. Typically here the branch addresses and branch
140  // pointers of the tree will be set.
141  // It is normally not necessary to make changes to the generated
142  // code, but the routine can be extended by the user if needed.
143  // Init() will be called many times when running on PROOF
144  // (once per file to be processed).
145 
146  // Set object pointer
147  ADC = 0;
148  TDC = 0;
149  Chan = 0;
150  APA = 0;
151  Plane = 0;
152  // Set branch addresses and branch pointers
153  if (!tree) return;
154  fChain = tree;
155  fCurrent = -1;
156  fChain->SetMakeClass(1);
157 
158  fChain->SetBranchAddress("Run", &Run, &b_Run);
159  fChain->SetBranchAddress("SubRun", &SubRun, &b_SubRun);
160  fChain->SetBranchAddress("Event", &Event, &b_Event);
161  fChain->SetBranchAddress("ADC", &ADC, &b_ADC);
162  fChain->SetBranchAddress("TDC", &TDC, &b_TDC);
163  fChain->SetBranchAddress("Nticks", &Nticks, &b_Nticks);
164  fChain->SetBranchAddress("NofUChan", &NofUChan, &b_NofUChan);
165  fChain->SetBranchAddress("NofVChan", &NofVChan, &b_NofVChan);
166  fChain->SetBranchAddress("NofZ0Chan", &NofZ0Chan, &b_NofZ0Chan);
167  fChain->SetBranchAddress("NofZ1Chan", &NofZ1Chan, &b_NofZ1Chan);
168  fChain->SetBranchAddress("Chan", &Chan, &b_Chan);
169  fChain->SetBranchAddress("APA", &APA, &b_APA);
170  fChain->SetBranchAddress("Plane", &Plane, &b_Plane);
171  Notify();
172 }
173 
174 Bool_t MakeHistograms::Notify()
175 {
176  // The Notify() function is called when a new file is opened. This
177  // can be either for a new TTree in a TChain or when when a new TTree
178  // is started when using PROOF. It is normally not necessary to make changes
179  // to the generated code, but the routine can be extended by the
180  // user if needed. The return value is currently not used.
181 
182  return kTRUE;
183 }
184 
185 void MakeHistograms::Show(Long64_t entry)
186 {
187 // Print contents of entry.
188 // If entry is not specified, print current entry
189  if (!fChain) return;
190  fChain->Show(entry);
191 }
192 Int_t MakeHistograms::Cut(Long64_t entry)
193 {
194 // This function may be called from Loop.
195 // returns 1 if entry is accepted.
196 // returns -1 otherwise.
197  return 1;
198 }
199 #endif // #ifdef MakeHistograms_cxx
TBranch * b_ADC
QList< Entry > entry
virtual void PrintPlots(UInt_t eventnb=1)
TCanvas * fCanvas
vector< vector< int > > * TDC
std::string string
Definition: nybbler.cc:12
vector< unsigned int > * APA
TBranch * b_Plane
UInt_t fEvent
current Tree number in a TChain
virtual Bool_t Notify()
virtual void DrawUplane()
string dir
virtual void DrawZplane()
virtual void DrawVplane()
TBranch * b_NofUChan
virtual void Init(TTree *tree)
Int_t fCurrent
pointer to the analyzed TTree or TChain
vector< unsigned int > * Chan
MakeHistograms(std::string dfname="duneEVDraw35t_tree_Cosmic_1000evt.root")
TBranch * b_APA
TBranch * b_SubRun
std::vector< TH2I * > fTimeChanZ1
virtual Int_t GetEntry(Long64_t entry)
TBranch * b_NofVChan
std::vector< TH2I * > fTimeChanU
TBranch * b_Chan
TBranch * b_Run
virtual void Show(Long64_t entry=-1)
virtual void HistDef()
TBranch * b_TDC
virtual ~MakeHistograms()
vector< unsigned int > * Plane
vector< vector< int > > * ADC
TBranch * b_NofZ0Chan
virtual void PrintHistos()
TBranch * b_Event
virtual void PrintGraphs(std::vector< TH2I * > h)
std::vector< TH2I * > fTimeChanV
virtual Int_t Cut(Long64_t entry)
std::vector< TH2I * > fTimeChanZ0
TBranch * b_NofZ1Chan
virtual void Pal2()
TBranch * b_Nticks
virtual void Pal1()
virtual Long64_t LoadTree(Long64_t entry)
h
training ###############################
Definition: train_cnn.py:186