![]() |
![]() |
#include <SimG4CMS/FP420/interface/FP420Test.h>
Public Member Functions | |
Fp420AnalysisHistManager (TString managername) | |
TH1F * | GetHisto (const TObjString histname) |
TH1F * | GetHisto (Int_t Number) |
TH2F * | GetHisto2 (const TObjString histname) |
TH2F * | GetHisto2 (Int_t Number) |
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, Int_t nbinsy, Axis_t ylow, Axis_t yup) |
void | HistInit (const char *name, const char *title, Int_t nbinsx, Axis_t xlow, Axis_t xup) |
void | StoreWeights () |
Private Attributes | |
TObjArray * | fHistArray |
TObjArray * | fHistNamesArray |
const char * | fTypeTitle |
Definition at line 65 of file FP420Test.h.
Fp420AnalysisHistManager::Fp420AnalysisHistManager | ( | TString | managername | ) |
Definition at line 148 of file FP420Test.cc.
References BookHistos(), fHistArray, fHistNamesArray, and fTypeTitle.
00149 { 00150 // The Constructor 00151 00152 fTypeTitle=managername; 00153 fHistArray = new TObjArray(); // Array to store histos 00154 fHistNamesArray = new TObjArray(); // Array to store histos's names 00155 00156 TH1::AddDirectory(kFALSE); 00157 BookHistos(); 00158 00159 fHistArray->Compress(); // Removes empty space 00160 fHistNamesArray->Compress(); 00161 00162 // StoreWeights(); // Store the weights 00163 00164 }
Fp420AnalysisHistManager::~Fp420AnalysisHistManager | ( | ) |
Definition at line 167 of file FP420Test.cc.
References fHistArray, and fHistNamesArray.
00168 { 00169 // The Destructor 00170 00171 if(fHistArray){ 00172 fHistArray->Delete(); 00173 delete fHistArray; 00174 } 00175 00176 if(fHistNamesArray){ 00177 fHistNamesArray->Delete(); 00178 delete fHistNamesArray; 00179 } 00180 }
void Fp420AnalysisHistManager::BookHistos | ( | ) | [private] |
Definition at line 183 of file FP420Test.cc.
References HistInit().
Referenced by Fp420AnalysisHistManager().
00184 { 00185 // at Start: (mm) 00186 HistInit("PrimaryEta", "Primary Eta", 100, 9., 12. ); 00187 HistInit("PrimaryPhigrad", "Primary Phigrad", 100, 0.,360. ); 00188 HistInit("PrimaryTh", "Primary Th", 100, 0.,180. ); 00189 HistInit("PrimaryLastpoZ", "Primary Lastpo Z", 100, -90.,12000. ); 00190 HistInit("PrimaryLastpoX", "Primary Lastpo X Z<z4", 100, -30., 30. ); 00191 HistInit("PrimaryLastpoY", "Primary Lastpo Y Z<z4", 100, -30., 30. ); 00192 HistInit("XLastpoNumofpart", "Primary Lastpo X n>10", 100, -30., 30. ); 00193 HistInit("YLastpoNumofpart", "Primary Lastpo Y n>10", 100, -30., 30. ); 00194 HistInit("VtxX", "Vtx X", 100, -50., 50. ); 00195 HistInit("VtxY", "Vtx Y", 100, -50., 50. ); 00196 HistInit("VtxZ", "Vtx Z", 100, -50., 50. ); 00197 // Book the histograms and add them to the array 00198 HistInit("SumEDep", "This is sum Energy deposited", 100, -1, 199.); 00199 HistInit("TrackL", "This is TrackL", 100, 0., 12000.); 00200 HistInit("zHits", "z Hits all events", 20, -200., 8300.); 00201 HistInit("zHitsnoMI", "z Hits no MI", 20, -200., 8300.); 00202 HistInit("zHitsTrLoLe", "z Hits TrLength bigger 8300",20, -200., 8300.); 00203 }
TH1F * Fp420AnalysisHistManager::GetHisto | ( | const TObjString | histname | ) |
Definition at line 291 of file FP420Test.cc.
References fHistNamesArray, GetHisto(), and index.
00292 { 00293 // Get a histogram from the array with name = histname 00294 00295 Int_t index = fHistNamesArray->IndexOf(&histname); 00296 return GetHisto(index); 00297 }
TH1F * Fp420AnalysisHistManager::GetHisto | ( | Int_t | Number | ) |
Definition at line 253 of file FP420Test.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and fHistArray.
Referenced by GetHisto(), and FP420Test::update().
00254 { 00255 // Get a histogram from the array with index = Number 00256 00257 if (Number <= fHistArray->GetLast() && fHistArray->At(Number) != (TObject*)0){ 00258 00259 return (TH1F*)(fHistArray->At(Number)); 00260 00261 }else{ 00262 00263 std::cout << "!!!!!!!!!!!!!!!!!!GetHisto!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; 00264 std::cout << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number << std::endl; 00265 std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; 00266 00267 return (TH1F*)(fHistArray->At(0)); 00268 } 00269 }
TH2F * Fp420AnalysisHistManager::GetHisto2 | ( | const TObjString | histname | ) |
Definition at line 300 of file FP420Test.cc.
References fHistNamesArray, GetHisto2(), and index.
00301 { 00302 // Get a histogram from the array with name = histname 00303 00304 Int_t index = fHistNamesArray->IndexOf(&histname); 00305 return GetHisto2(index); 00306 }
TH2F * Fp420AnalysisHistManager::GetHisto2 | ( | Int_t | Number | ) |
Definition at line 272 of file FP420Test.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and fHistArray.
Referenced by GetHisto2().
00273 { 00274 // Get a histogram from the array with index = Number 00275 00276 if (Number <= fHistArray->GetLast() && fHistArray->At(Number) != (TObject*)0){ 00277 00278 return (TH2F*)(fHistArray->At(Number)); 00279 00280 }else{ 00281 00282 std::cout << "!!!!!!!!!!!!!!!!GetHisto2!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; 00283 std::cout << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number << std::endl; 00284 std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; 00285 00286 return (TH2F*)(fHistArray->At(0)); 00287 } 00288 }
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 238 of file FP420Test.cc.
References fHistArray, fHistNamesArray, and fTypeTitle.
00239 { 00240 // Add histograms and histograms names to the array 00241 00242 char* newtitle = new char[strlen(title)+strlen(fTypeTitle)+5]; 00243 strcpy(newtitle,title); 00244 strcat(newtitle," ("); 00245 strcat(newtitle,fTypeTitle); 00246 strcat(newtitle,") "); 00247 fHistArray->AddLast((new TH2F(name, newtitle, nbinsx, xlow, xup, nbinsy, ylow, yup))); 00248 fHistNamesArray->AddLast(new TObjString(name)); 00249 00250 }
void Fp420AnalysisHistManager::HistInit | ( | const char * | name, | |
const char * | title, | |||
Int_t | nbinsx, | |||
Axis_t | xlow, | |||
Axis_t | xup | |||
) | [private] |
Definition at line 223 of file FP420Test.cc.
References fHistArray, fHistNamesArray, and fTypeTitle.
Referenced by BookHistos().
00224 { 00225 // Add histograms and histograms names to the array 00226 00227 char* newtitle = new char[strlen(title)+strlen(fTypeTitle)+5]; 00228 strcpy(newtitle,title); 00229 strcat(newtitle," ("); 00230 strcat(newtitle,fTypeTitle); 00231 strcat(newtitle,") "); 00232 fHistArray->AddLast((new TH1F(name, newtitle, nbinsx, xlow, xup))); 00233 fHistNamesArray->AddLast(new TObjString(name)); 00234 00235 }
void Fp420AnalysisHistManager::StoreWeights | ( | ) | [private] |
Definition at line 309 of file FP420Test.cc.
References fHistArray, and i.
00310 { 00311 // Add structure to each histogram to store the weights 00312 00313 for(int i = 0; i < fHistArray->GetEntries(); i++){ 00314 ((TH1F*)(fHistArray->At(i)))->Sumw2(); 00315 } 00316 }
void Fp420AnalysisHistManager::WriteToFile | ( | TString | fOutputFile, | |
TString | fRecreateFile | |||
) |
Definition at line 207 of file FP420Test.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), fHistArray, and file.
Referenced by FP420Test::~FP420Test().
00208 { 00209 00210 //Write to file = fOutputFile 00211 00212 std::cout <<"================================================================"<<std::endl; 00213 std::cout <<" Write this Analysis to File "<<fOutputFile<<std::endl; 00214 std::cout <<"================================================================"<<std::endl; 00215 00216 TFile* file = new TFile(fOutputFile, fRecreateFile); 00217 00218 fHistArray->Write(); 00219 file->Close(); 00220 }
TObjArray* Fp420AnalysisHistManager::fHistArray [private] |
Definition at line 87 of file FP420Test.h.
Referenced by Fp420AnalysisHistManager(), GetHisto(), GetHisto2(), HistInit(), StoreWeights(), WriteToFile(), and ~Fp420AnalysisHistManager().
TObjArray* Fp420AnalysisHistManager::fHistNamesArray [private] |
Definition at line 88 of file FP420Test.h.
Referenced by Fp420AnalysisHistManager(), GetHisto(), GetHisto2(), HistInit(), and ~Fp420AnalysisHistManager().
const char* Fp420AnalysisHistManager::fTypeTitle [private] |
Definition at line 86 of file FP420Test.h.
Referenced by Fp420AnalysisHistManager(), and HistInit().