CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

Fp420AnalysisHistManager Class Reference

#include <FP420Test.h>

Inheritance diagram for Fp420AnalysisHistManager:
TNamed

List of all members.

Public Member Functions

 Fp420AnalysisHistManager (TString managername)
TH1F * GetHisto (const TObjString histname)
TH1F * GetHisto (Int_t Number)
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, 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

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.

{
        // The Constructor

        fTypeTitle=managername;
        fHistArray = new TObjArray();      // Array to store histos
        fHistNamesArray = new TObjArray(); // Array to store histos's names

        TH1::AddDirectory(kFALSE);
        BookHistos();

        fHistArray->Compress();            // Removes empty space
        fHistNamesArray->Compress();

//      StoreWeights();                    // Store the weights

}
Fp420AnalysisHistManager::~Fp420AnalysisHistManager ( )

Definition at line 186 of file FP420Test.cc.

{
        // The Destructor

        if(fHistArray){
                fHistArray->Delete();
                delete fHistArray;
        }

        if(fHistNamesArray){
                fHistNamesArray->Delete();
                delete fHistNamesArray;
        }
}

Member Function Documentation

void Fp420AnalysisHistManager::BookHistos ( ) [private]

Definition at line 202 of file FP420Test.cc.

{
  // at Start: (mm)
    HistInit("PrimaryEta", "Primary Eta",   100,   9., 12. );
    HistInit("PrimaryPhigrad", "Primary Phigrad",   100,   0.,360. );
    HistInit("PrimaryTh", "Primary Th",   100,   0.,180. );
    HistInit("PrimaryLastpoZ", "Primary Lastpo Z",   100, -200.,430000. );
    HistInit("PrimaryLastpoX", "Primary Lastpo X Z<z4",   100, -30., 30. );
    HistInit("PrimaryLastpoY", "Primary Lastpo Y Z<z4",   100, -30., 30. );
    HistInit("XLastpoNumofpart", "Primary Lastpo X n>10",   100, -30., 30. );
    HistInit("YLastpoNumofpart", "Primary Lastpo Y n>10",   100, -30., 30. );
    HistInit("VtxX", "Vtx X",   100, -50., 50. );
    HistInit("VtxY", "Vtx Y",   100, -50., 50. );
    HistInit("VtxZ", "Vtx Z",   100, -200.,430000. );
        // Book the histograms and add them to the array
    HistInit("SumEDep", "This is sum Energy deposited",   100,   -1,   199.);
    HistInit("TrackL", "This is TrackL",   100,   0.,   12000.);
    HistInit("zHits", "z Hits all events",                100, 400000.,430000. );
    HistInit("zHitsnoMI", "z Hits no MI",                 100, 400000.,430000. );
    HistInit("zHitsTrLoLe", "z Hits TrLength bigger 8300",100, 400000.,430000. );
    HistInit("NumberOfHits", "NumberOfHits",100, 0.,300. );
}
TH1F * Fp420AnalysisHistManager::GetHisto ( const TObjString  histname)

Definition at line 311 of file FP420Test.cc.

References getHLTprescales::index.

{
        // Get a histogram from the array with name = histname

        Int_t index = fHistNamesArray->IndexOf(&histname);
        return GetHisto(index);
}
TH1F * Fp420AnalysisHistManager::GetHisto ( Int_t  Number)

Definition at line 273 of file FP420Test.cc.

References gather_cfg::cout.

{
        // Get a histogram from the array with index = Number

        if (Number <= fHistArray->GetLast()  && fHistArray->At(Number) != (TObject*)0){

                return (TH1F*)(fHistArray->At(Number));

        }else{

                std::cout << "!!!!!!!!!!!!!!!!!!GetHisto!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
                std::cout << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number << std::endl;
                std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;

                return (TH1F*)(fHistArray->At(0));
        }
}
TH2F * Fp420AnalysisHistManager::GetHisto2 ( const TObjString  histname)

Definition at line 320 of file FP420Test.cc.

References getHLTprescales::index.

{
        // Get a histogram from the array with name = histname

        Int_t index = fHistNamesArray->IndexOf(&histname);
        return GetHisto2(index);
}
TH2F * Fp420AnalysisHistManager::GetHisto2 ( Int_t  Number)

Definition at line 292 of file FP420Test.cc.

References gather_cfg::cout.

{
        // Get a histogram from the array with index = Number

        if (Number <= fHistArray->GetLast()  && fHistArray->At(Number) != (TObject*)0){

                return (TH2F*)(fHistArray->At(Number));

        }else{

                std::cout << "!!!!!!!!!!!!!!!!GetHisto2!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
                std::cout << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number << std::endl;
                std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;

                return (TH2F*)(fHistArray->At(0));
        }
}
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.

{
        // Add histograms and histograms names to the array

        char* newtitle = new char[strlen(title)+strlen(fTypeTitle)+5];
        strcpy(newtitle,title);
        strcat(newtitle," (");
        strcat(newtitle,fTypeTitle);
        strcat(newtitle,") ");
        fHistArray->AddLast((new TH2F(name, newtitle, nbinsx, xlow, xup, nbinsy, ylow, yup)));
        fHistNamesArray->AddLast(new TObjString(name));

}
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.

{
        // Add histograms and histograms names to the array

        char* newtitle = new char[strlen(title)+strlen(fTypeTitle)+5];
        strcpy(newtitle,title);
        strcat(newtitle," (");
        strcat(newtitle,fTypeTitle);
        strcat(newtitle,") ");
        fHistArray->AddLast((new TH1F(name, newtitle, nbinsx, xlow, xup)));
        fHistNamesArray->AddLast(new TObjString(name));

}
void Fp420AnalysisHistManager::StoreWeights ( ) [private]

Definition at line 329 of file FP420Test.cc.

References i.

{
        // Add structure to each histogram to store the weights

        for(int i = 0; i < fHistArray->GetEntries(); i++){
                ((TH1F*)(fHistArray->At(i)))->Sumw2();
        }
}
void Fp420AnalysisHistManager::WriteToFile ( TString  fOutputFile,
TString  fRecreateFile 
)

Definition at line 227 of file FP420Test.cc.

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

{

        //Write to file = fOutputFile

        std::cout <<"================================================================"<<std::endl;
        std::cout <<" Write this Analysis to File "<<fOutputFile<<std::endl;
        std::cout <<"================================================================"<<std::endl;

        TFile* file = new TFile(fOutputFile, fRecreateFile);

        fHistArray->Write();
        file->Close();
}

Member Data Documentation

Definition at line 86 of file FP420Test.h.

Definition at line 87 of file FP420Test.h.

const char* Fp420AnalysisHistManager::fTypeTitle [private]

Definition at line 85 of file FP420Test.h.