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 (const TString &managername)
 
TH1F * GetHisto (Int_t Number)
 
TH1F * GetHisto (const TObjString &histname)
 
TH2F * GetHisto2 (Int_t Number)
 
TH2F * GetHisto2 (const TObjString &histname)
 
void WriteToFile (const TString &fOutputFile, const 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 ( const TString &  managername)

Definition at line 164 of file FP420Test.cc.

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

Definition at line 183 of file FP420Test.cc.

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

Member Function Documentation

void Fp420AnalysisHistManager::BookHistos ( )
private

Definition at line 199 of file FP420Test.cc.

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

Definition at line 270 of file FP420Test.cc.

References gather_cfg::cout.

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

Definition at line 308 of file FP420Test.cc.

References cmsHarvester::index.

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

Definition at line 289 of file FP420Test.cc.

References gather_cfg::cout.

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

Definition at line 317 of file FP420Test.cc.

References cmsHarvester::index.

318 {
319  // Get a histogram from the array with name = histname
320 
321  Int_t index = fHistNamesArray->IndexOf(&histname);
322  return GetHisto2(index);
323 }
TH2F * GetHisto2(Int_t Number)
Definition: FP420Test.cc:289
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 240 of file FP420Test.cc.

241 {
242  // Add histograms and histograms names to the array
243 
244  char* newtitle = new char[strlen(title)+strlen(fTypeTitle)+5];
245  strcpy(newtitle,title);
246  strcat(newtitle," (");
247  strcat(newtitle,fTypeTitle);
248  strcat(newtitle,") ");
249  fHistArray->AddLast((new TH1F(name, newtitle, nbinsx, xlow, xup)));
250  fHistNamesArray->AddLast(new TObjString(name));
251 
252 }
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 255 of file FP420Test.cc.

256 {
257  // Add histograms and histograms names to the array
258 
259  char* newtitle = new char[strlen(title)+strlen(fTypeTitle)+5];
260  strcpy(newtitle,title);
261  strcat(newtitle," (");
262  strcat(newtitle,fTypeTitle);
263  strcat(newtitle,") ");
264  fHistArray->AddLast((new TH2F(name, newtitle, nbinsx, xlow, xup, nbinsy, ylow, yup)));
265  fHistNamesArray->AddLast(new TObjString(name));
266 
267 }
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 326 of file FP420Test.cc.

References i.

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

Definition at line 224 of file FP420Test.cc.

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

225 {
226 
227  //Write to file = fOutputFile
228 
229  std::cout <<"================================================================"<<std::endl;
230  std::cout <<" Write this Analysis to File "<<fOutputFile<<std::endl;
231  std::cout <<"================================================================"<<std::endl;
232 
233  TFile* file = new TFile(fOutputFile, fRecreateFile);
234 
235  fHistArray->Write();
236  file->Close();
237 }
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.