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 165 of file FP420Test.cc.

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

Definition at line 184 of file FP420Test.cc.

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

Member Function Documentation

void Fp420AnalysisHistManager::BookHistos ( )
private

Definition at line 200 of file FP420Test.cc.

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

Definition at line 271 of file FP420Test.cc.

References gather_cfg::cout.

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

Definition at line 309 of file FP420Test.cc.

References cmsHarvester::index.

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

Definition at line 290 of file FP420Test.cc.

References gather_cfg::cout.

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

Definition at line 318 of file FP420Test.cc.

References cmsHarvester::index.

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

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

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

References i.

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

Definition at line 225 of file FP420Test.cc.

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

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