CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
Fp420AnalysisHistManager Class Reference

#include <FP420Test.h>

Inheritance diagram for Fp420AnalysisHistManager:

Public Member Functions

 Fp420AnalysisHistManager (TString managername)
 
TH1F * GetHisto (Int_t Number)
 
TH1F * GetHisto (const TObjString histname)
 
TH2F * GetHisto2 (Int_t Number)
 
TH2F * GetHisto2 (const TObjString histname)
 
void WriteToFile (TString fOutputFile, TString fRecreateFile)
 
 ~Fp420AnalysisHistManager ()
 

Private Member Functions

void BookHistos ()
 
void HistInit (const char *name, const char *title, Int_t nbinsx, Axis_t xlow, Axis_t xup)
 
void HistInit (const char *name, const char *title, Int_t nbinsx, Axis_t xlow, Axis_t xup, Int_t nbinsy, Axis_t ylow, Axis_t yup)
 
void StoreWeights ()
 

Private Attributes

TObjArray * fHistArray
 
TObjArray * fHistNamesArray
 
const char * fTypeTitle
 

Detailed Description

Definition at line 64 of file FP420Test.h.

Constructor & Destructor Documentation

Fp420AnalysisHistManager::Fp420AnalysisHistManager ( TString  managername)

Definition at line 167 of file FP420Test.cc.

168 {
169  // The Constructor
170 
171  fTypeTitle=managername;
172  fHistArray = new TObjArray(); // Array to store histos
173  fHistNamesArray = new TObjArray(); // Array to store histos's names
174 
175  TH1::AddDirectory(kFALSE);
176  BookHistos();
177 
178  fHistArray->Compress(); // Removes empty space
179  fHistNamesArray->Compress();
180 
181 // StoreWeights(); // Store the weights
182 
183 }
const char * fTypeTitle
Definition: FP420Test.h:85
TObjArray * fHistArray
Definition: FP420Test.h:86
TObjArray * fHistNamesArray
Definition: FP420Test.h:87
Fp420AnalysisHistManager::~Fp420AnalysisHistManager ( )

Definition at line 186 of file FP420Test.cc.

187 {
188  // The Destructor
189 
190  if(fHistArray){
191  fHistArray->Delete();
192  delete fHistArray;
193  }
194 
195  if(fHistNamesArray){
196  fHistNamesArray->Delete();
197  delete fHistNamesArray;
198  }
199 }
TObjArray * fHistArray
Definition: FP420Test.h:86
TObjArray * fHistNamesArray
Definition: FP420Test.h:87

Member Function Documentation

void Fp420AnalysisHistManager::BookHistos ( )
private

Definition at line 202 of file FP420Test.cc.

203 {
204  // at Start: (mm)
205  HistInit("PrimaryEta", "Primary Eta", 100, 9., 12. );
206  HistInit("PrimaryPhigrad", "Primary Phigrad", 100, 0.,360. );
207  HistInit("PrimaryTh", "Primary Th", 100, 0.,180. );
208  HistInit("PrimaryLastpoZ", "Primary Lastpo Z", 100, -200.,430000. );
209  HistInit("PrimaryLastpoX", "Primary Lastpo X Z<z4", 100, -30., 30. );
210  HistInit("PrimaryLastpoY", "Primary Lastpo Y Z<z4", 100, -30., 30. );
211  HistInit("XLastpoNumofpart", "Primary Lastpo X n>10", 100, -30., 30. );
212  HistInit("YLastpoNumofpart", "Primary Lastpo Y n>10", 100, -30., 30. );
213  HistInit("VtxX", "Vtx X", 100, -50., 50. );
214  HistInit("VtxY", "Vtx Y", 100, -50., 50. );
215  HistInit("VtxZ", "Vtx Z", 100, -200.,430000. );
216  // Book the histograms and add them to the array
217  HistInit("SumEDep", "This is sum Energy deposited", 100, -1, 199.);
218  HistInit("TrackL", "This is TrackL", 100, 0., 12000.);
219  HistInit("zHits", "z Hits all events", 100, 400000.,430000. );
220  HistInit("zHitsnoMI", "z Hits no MI", 100, 400000.,430000. );
221  HistInit("zHitsTrLoLe", "z Hits TrLength bigger 8300",100, 400000.,430000. );
222  HistInit("NumberOfHits", "NumberOfHits",100, 0.,300. );
223 }
void HistInit(const char *name, const char *title, Int_t nbinsx, Axis_t xlow, Axis_t xup)
Definition: FP420Test.cc:243
TH1F * Fp420AnalysisHistManager::GetHisto ( Int_t  Number)

Definition at line 273 of file FP420Test.cc.

References gather_cfg::cout.

274 {
275  // Get a histogram from the array with index = Number
276 
277  if (Number <= fHistArray->GetLast() && fHistArray->At(Number) != (TObject*)0){
278 
279  return (TH1F*)(fHistArray->At(Number));
280 
281  }else{
282 
283  std::cout << "!!!!!!!!!!!!!!!!!!GetHisto!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
284  std::cout << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number << std::endl;
285  std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
286 
287  return (TH1F*)(fHistArray->At(0));
288  }
289 }
TObjArray * fHistArray
Definition: FP420Test.h:86
tuple cout
Definition: gather_cfg.py:121
TH1F * Fp420AnalysisHistManager::GetHisto ( const TObjString  histname)

Definition at line 311 of file FP420Test.cc.

References getHLTprescales::index.

312 {
313  // Get a histogram from the array with name = histname
314 
315  Int_t index = fHistNamesArray->IndexOf(&histname);
316  return GetHisto(index);
317 }
TH1F * GetHisto(Int_t Number)
Definition: FP420Test.cc:273
TObjArray * fHistNamesArray
Definition: FP420Test.h:87
TH2F * Fp420AnalysisHistManager::GetHisto2 ( Int_t  Number)

Definition at line 292 of file FP420Test.cc.

References gather_cfg::cout.

293 {
294  // Get a histogram from the array with index = Number
295 
296  if (Number <= fHistArray->GetLast() && fHistArray->At(Number) != (TObject*)0){
297 
298  return (TH2F*)(fHistArray->At(Number));
299 
300  }else{
301 
302  std::cout << "!!!!!!!!!!!!!!!!GetHisto2!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
303  std::cout << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number << std::endl;
304  std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
305 
306  return (TH2F*)(fHistArray->At(0));
307  }
308 }
TObjArray * fHistArray
Definition: FP420Test.h:86
tuple cout
Definition: gather_cfg.py:121
TH2F * Fp420AnalysisHistManager::GetHisto2 ( const TObjString  histname)

Definition at line 320 of file FP420Test.cc.

References getHLTprescales::index.

321 {
322  // Get a histogram from the array with name = histname
323 
324  Int_t index = fHistNamesArray->IndexOf(&histname);
325  return GetHisto2(index);
326 }
TH2F * GetHisto2(Int_t Number)
Definition: FP420Test.cc:292
TObjArray * fHistNamesArray
Definition: FP420Test.h:87
void Fp420AnalysisHistManager::HistInit ( const char *  name,
const char *  title,
Int_t  nbinsx,
Axis_t  xlow,
Axis_t  xup 
)
private

Definition at line 243 of file FP420Test.cc.

244 {
245  // Add histograms and histograms names to the array
246 
247  char* newtitle = new char[strlen(title)+strlen(fTypeTitle)+5];
248  strcpy(newtitle,title);
249  strcat(newtitle," (");
250  strcat(newtitle,fTypeTitle);
251  strcat(newtitle,") ");
252  fHistArray->AddLast((new TH1F(name, newtitle, nbinsx, xlow, xup)));
253  fHistNamesArray->AddLast(new TObjString(name));
254 
255 }
const char * fTypeTitle
Definition: FP420Test.h:85
TObjArray * fHistArray
Definition: FP420Test.h:86
TObjArray * fHistNamesArray
Definition: FP420Test.h:87
void Fp420AnalysisHistManager::HistInit ( const char *  name,
const char *  title,
Int_t  nbinsx,
Axis_t  xlow,
Axis_t  xup,
Int_t  nbinsy,
Axis_t  ylow,
Axis_t  yup 
)
private

Definition at line 258 of file FP420Test.cc.

259 {
260  // Add histograms and histograms names to the array
261 
262  char* newtitle = new char[strlen(title)+strlen(fTypeTitle)+5];
263  strcpy(newtitle,title);
264  strcat(newtitle," (");
265  strcat(newtitle,fTypeTitle);
266  strcat(newtitle,") ");
267  fHistArray->AddLast((new TH2F(name, newtitle, nbinsx, xlow, xup, nbinsy, ylow, yup)));
268  fHistNamesArray->AddLast(new TObjString(name));
269 
270 }
const char * fTypeTitle
Definition: FP420Test.h:85
TObjArray * fHistArray
Definition: FP420Test.h:86
TObjArray * fHistNamesArray
Definition: FP420Test.h:87
void Fp420AnalysisHistManager::StoreWeights ( )
private

Definition at line 329 of file FP420Test.cc.

References i.

330 {
331  // Add structure to each histogram to store the weights
332 
333  for(int i = 0; i < fHistArray->GetEntries(); i++){
334  ((TH1F*)(fHistArray->At(i)))->Sumw2();
335  }
336 }
int i
Definition: DBlmapReader.cc:9
TObjArray * fHistArray
Definition: FP420Test.h:86
void Fp420AnalysisHistManager::WriteToFile ( TString  fOutputFile,
TString  fRecreateFile 
)

Definition at line 227 of file FP420Test.cc.

References gather_cfg::cout, and mergeVDriftHistosByStation::file.

228 {
229 
230  //Write to file = fOutputFile
231 
232  std::cout <<"================================================================"<<std::endl;
233  std::cout <<" Write this Analysis to File "<<fOutputFile<<std::endl;
234  std::cout <<"================================================================"<<std::endl;
235 
236  TFile* file = new TFile(fOutputFile, fRecreateFile);
237 
238  fHistArray->Write();
239  file->Close();
240 }
TObjArray * fHistArray
Definition: FP420Test.h:86
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

TObjArray* Fp420AnalysisHistManager::fHistArray
private

Definition at line 86 of file FP420Test.h.

TObjArray* Fp420AnalysisHistManager::fHistNamesArray
private

Definition at line 87 of file FP420Test.h.

const char* Fp420AnalysisHistManager::fTypeTitle
private

Definition at line 85 of file FP420Test.h.