#include <SimpleHistograms.h>
Public Member Functions | |
SimpleHistograms (const char *HistogramDirectoryName) | |
~SimpleHistograms () | |
int | ProcessGenericEntry (TGlobalData *gData, const TSetupData *gSetup) |
int | Preprocess (TGlobalData *gData, const TSetupData *gSetup) |
Method called by the main pre-process loop. | |
int | Postprocess (TGlobalData *gData, const TSetupData *gSetup) |
Method called by the main pre-process loop. | |
virtual int | BeforeFirstEntry (TGlobalData *gData, const TSetupData *setup)=0 |
virtual int | AfterLastEntry (TGlobalData *gData, const TSetupData *setup)=0 |
void | SetAlias (const std::string &alias) |
std::string | GetAlias () const |
const char * | GetName () const |
Get the name of this module as given to the constructor of the base class. | |
Protected Member Functions | |
bool | Debug () const |
TDirectory * | GetDirectory () const |
Get the TDirectory for this module. | |
TDirectory * | GetDirectory (const std::string &name="") |
Protected Attributes | |
TDirectory * | dir |
Private Member Functions | |
virtual int | ProcessEntry (TGlobalData *gData) |
Definition at line 7 of file SimpleHistograms.h.
SimpleHistograms::SimpleHistograms | ( | const char * | HistogramDirectoryName | ) |
Definition at line 22 of file SimpleHistograms.cpp.
References banks, hBankSize, and hNumberOfNoCoincidences.
00022 : 00023 BaseModule(HistogramDirectoryName){ 00024 00025 // The following are the banks we want to compare in this example 00026 banks.push_back("Nec0"); 00027 banks.push_back("Nfc0"); 00028 banks.push_back("Ngc0"); 00029 banks.push_back("Nhc0"); 00030 banks.push_back("Nae0"); 00031 banks.push_back("Nbe0"); 00032 banks.push_back("Nce0"); 00033 banks.push_back("Nee0"); 00034 // banks.push_back("Nfe0"); 00035 // banks.push_back("Nge0"); 00036 // banks.push_back("Nhe0"); 00037 00038 hBankSize = new TH2F("hBankSize", "Bank size", 00039 1500, -1.5, 1498.5, banks.size(), 0.5, banks.size()+0.5); 00040 00041 for(unsigned int i = 1; i<=banks.size(); ++i) hBankSize->GetYaxis()->SetBinLabel(i, banks.at(i-1).data()); 00042 00043 // Let's compare the number of comparisons. If N is the size of the bank vector, then we need 00044 // (N-1) + (N-2) +... + 1 comparisons 00045 int NrComparisons = banks.size() * (banks.size()-1) / 2; 00046 00047 hNumberOfNoCoincidences = new TH2F("hNumberOfNoCoincidences", "Number of missing coincidences per tree entry", 00048 1000, -1.5, 998.5, NrComparisons, 0.5, NrComparisons+0.5); 00049 }
SimpleHistograms::~SimpleHistograms | ( | ) |
Definition at line 51 of file SimpleHistograms.cpp.
virtual int BaseModule::AfterLastEntry | ( | TGlobalData * | gData, | |
const TSetupData * | setup | |||
) | [pure virtual, inherited] |
Optional method which is called once after the main event loop Can be used to dump a summary or finalise a histogram
Implemented in TME_Al50_EvdE, TME_SiArmTDiff, TMEViewer, IslandAmplitude, IslandLength, FastSlowCompare, GeSpectrum, LoadPulses, PlotIntegralRatios, CalcCoarseTimeOffset, CheckTMEs, ExportPulse, PlotAmpVsMuScTDiff, PlotAmpVsTDiff, PlotTAP_Amplitude, PlotTAP_Energy, PlotTAP_Integral, PlotTAP_selfCorrelation, PlotTAP_TDiff, PlotTAP_Time, PlotTDP_TDiff, PlotTDPs, PlotTME_activeSiRmuStops, PlotTPI_PedestalAndNoise, PulseViewer, SavePulses, MakeAnalysedPulses, PulseCandidateFinder_InvestigateParameters, TemplateCreator, MakeDetectorPulses, MakeMuonEvents, and MakeSiliconEvents.
Referenced by BaseModule::Postprocess().
virtual int BaseModule::BeforeFirstEntry | ( | TGlobalData * | gData, | |
const TSetupData * | setup | |||
) | [pure virtual, inherited] |
Optional method which is called once before the main event loop Can be used to parse options and setup histograms.
Implemented in TME_Al50_EvdE, TME_SiArmTDiff, TMEViewer, IslandAmplitude, IslandLength, FastSlowCompare, GeSpectrum, LoadPulses, PlotIntegralRatios, CalcCoarseTimeOffset, CheckTMEs, ExportPulse, PlotAmpVsMuScTDiff, PlotAmpVsTDiff, PlotTAP_Amplitude, PlotTAP_Energy, PlotTAP_Integral, PlotTAP_selfCorrelation, PlotTAP_TDiff, PlotTAP_Time, PlotTDP_TDiff, PlotTDPs, PlotTME_activeSiRmuStops, PlotTPI_PedestalAndNoise, PulseViewer, SavePulses, MakeAnalysedPulses, PulseCandidateFinder_InvestigateParameters, TemplateCreator, MakeDetectorPulses, MakeMuonEvents, and MakeSiliconEvents.
Referenced by BaseModule::Preprocess().
bool BaseModule::Debug | ( | ) | const [inline, protected, inherited] |
Check whether this module was asked to print extra debug information
Definition at line 71 of file BaseModule.h.
References BaseModule::fDebug.
Referenced by MakeAnalysedPulses::AddGenerator(), ExportPulse::AddToExportList(), PulseCandidateFinder_InvestigateParameters::AfterLastEntry(), PlotTPI_PedestalAndNoise::AfterLastEntry(), PlotTDPs::AfterLastEntry(), PlotTDP_TDiff::AfterLastEntry(), IslandLength::AfterLastEntry(), IslandAmplitude::AfterLastEntry(), MakeDetectorPulses::BeforeFirstEntry(), TemplateCreator::BeforeFirstEntry(), PulseCandidateFinder_InvestigateParameters::BeforeFirstEntry(), PlotTPI_PedestalAndNoise::BeforeFirstEntry(), PlotTDPs::BeforeFirstEntry(), PlotTDP_TDiff::BeforeFirstEntry(), IslandLength::BeforeFirstEntry(), IslandAmplitude::BeforeFirstEntry(), PulseViewer::ConsiderDrawing(), MakeAnalysedPulses::MakeAnalysedPulses(), MakeDetectorPulses::MakeGenerator(), ExportPulse::PlotTPI(), MakeDetectorPulses::ProcessEntry(), TemplateCreator::ProcessEntry(), PulseCandidateFinder_InvestigateParameters::ProcessEntry(), MakeAnalysedPulses::ProcessEntry(), PulseViewer::ProcessEntry(), PlotTDP_TDiff::ProcessEntry(), and TemplateCreator::StartTemplate().
00071 {return fDebug;};
std::string BaseModule::GetAlias | ( | ) | const [inline, inherited] |
Returns a string for the alias of this module. May be empty if no alias was given in the modules file.
Definition at line 63 of file BaseModule.h.
References BaseModule::fAlias.
Referenced by BaseModule::BaseModule().
00063 {return fAlias;};
TDirectory * BaseModule::GetDirectory | ( | const std::string & | name = "" |
) | [protected, inherited] |
Definition at line 77 of file BaseModule.cpp.
References BaseModule::dir, and BaseModule::fDirectory.
00077 { 00078 if(name.empty()) return fDirectory; 00079 TDirectory* dir=fDirectory->GetDirectory(name.c_str()); 00080 if(dir) return dir; 00081 return fDirectory->mkdir(name.c_str()); 00082 }
TDirectory* BaseModule::GetDirectory | ( | ) | const [inline, protected, inherited] |
Get the TDirectory for this module.
Definition at line 74 of file BaseModule.h.
References BaseModule::fDirectory.
Referenced by TemplateCreator::AfterLastEntry(), SavePulses::AfterLastEntry(), TemplateCreator::BeforeFirstEntry(), PlotTDPs::BeforeFirstEntry(), ExportPulse::ExportPulse(), and TemplateCreator::ProcessEntry().
00074 {return fDirectory;}
const char* BaseModule::GetName | ( | ) | const [inline, inherited] |
Get the name of this module as given to the constructor of the base class.
Definition at line 66 of file BaseModule.h.
References BaseModule::fName.
Referenced by SavePulses::BeforeFirstEntry(), PlotTDPs::BeforeFirstEntry(), PlotTDP_TDiff::BeforeFirstEntry(), PlotTAP_Time::ProcessEntry(), PlotTAP_Energy::ProcessEntry(), PlotTAP_Amplitude::ProcessEntry(), and LoopSequence::Run().
00066 {return fName.c_str();};
int BaseModule::Postprocess | ( | TGlobalData * | gData, | |
const TSetupData * | gSetup | |||
) | [inherited] |
Method called by the main pre-process loop.
Does some simple work, then hooks into the derived class through AfterLastEntry.
Definition at line 66 of file BaseModule.cpp.
References BaseModule::AfterLastEntry(), and BaseModule::fDirectory.
Referenced by LoopSequence::Postprocess().
00066 { 00067 // This is called by our main routine and would allow later to split into different 00068 // process routines if we have more than one Tree and hence different tpyes of data input. 00069 00070 if(fDirectory) fDirectory->cd(); 00071 int ret = AfterLastEntry(gData, gSetup); 00072 gDirectory->cd("/"); 00073 00074 return ret; 00075 }
int BaseModule::Preprocess | ( | TGlobalData * | gData, | |
const TSetupData * | gSetup | |||
) | [inherited] |
Method called by the main pre-process loop.
Does some simple work, then hooks into the derived class through BeforeFirstEntry.
Definition at line 55 of file BaseModule.cpp.
References BaseModule::BeforeFirstEntry(), and BaseModule::fDirectory.
Referenced by LoopSequence::Preprocess().
00055 { 00056 // This is called by our main routine and would allow later to split into different 00057 // process routines if we have more than one Tree and hence different tpyes of data input. 00058 00059 if(fDirectory) fDirectory->cd(); 00060 int ret = BeforeFirstEntry(gData, gSetup); 00061 gDirectory->cd("/"); 00062 00063 return ret; 00064 }
int SimpleHistograms::ProcessEntry | ( | TGlobalData * | gData | ) | [private, virtual] |
Definition at line 54 of file SimpleHistograms.cpp.
References banks, TGlobalData::fPulseIslandToChannelMap, hBankSize, hNumberOfNoCoincidences, last, and verbose.
00054 { 00055 typedef StringPulseIslandMap::iterator map_iterator; 00056 00057 vector<TPulseIsland*> islands[banks.size()]; 00058 for(unsigned int b1 = 0; b1 < banks.size(); ++b1){ 00059 string bank = banks.at(b1); 00060 for(map_iterator iter = gData->fPulseIslandToChannelMap.begin(); 00061 iter != gData->fPulseIslandToChannelMap.end(); iter++){ 00062 if(strcmp((iter->first).data(), bank.data()) == 0){ 00063 islands[b1] = iter->second; 00064 } 00065 } 00066 hBankSize->Fill(islands[b1].size(), b1+1); 00067 } 00068 00069 PulseIslandList islands1, islands2; 00070 00071 int count = 1; 00072 00073 for(unsigned int b1 = 0; b1 < banks.size()-1; ++b1){ 00074 for(unsigned int b2 = b1+1; b2 < banks.size(); ++b2){ 00075 char title[100]; 00076 sprintf(title, "%s - %s", banks.at(b1).data(), banks.at(b2).data()); 00077 hNumberOfNoCoincidences->GetYaxis()->SetBinLabel(count, title); 00078 00079 int last = 0; 00080 int NumberOfNoCoincidences = 0; 00081 00082 if(verbose){ 00083 for(unsigned int i = 0; i < islands[b1].size(); ++i){ 00084 std::cout << "i = " << i << ": " << islands[b1][i]->GetTimeStamp() * islands[b1][i]->GetClockTickInNs() << "\n"; 00085 } 00086 for(unsigned int i = 0; i < islands[b2].size(); ++i){ 00087 std::cout << "i = " << i << ": " << islands[b2][i]->GetTimeStamp() * islands[b2][i]->GetClockTickInNs() << "\n"; 00088 } 00089 } 00090 00091 for(unsigned int i = 0; i < islands[b1].size(); ++i){ 00092 double t1 = islands[b1][i]->GetTimeStamp(); // * islands1[i]->GetClockTickInNs(); 00093 bool foundCoincidence = false; 00094 for(unsigned int j = last; j < islands[b2].size(); ++j){ 00095 double t2 = islands[b2][j]->GetTimeStamp(); // * islands2[j]->GetClockTickInNs(); 00096 double tdiff = t2 - t1; 00097 00098 if(tdiff < -200.){ 00099 last = j; 00100 continue; 00101 } 00102 if(tdiff > 200.){ 00103 break; 00104 } 00105 // Found a coincidence 00106 foundCoincidence = true; 00107 } 00108 // Check if we found a coincidence 00109 if(!foundCoincidence){ 00110 ++NumberOfNoCoincidences; 00111 } 00112 } 00113 if(verbose) 00114 printf("Found %d tree entries with no coincidence for banks %s and %s.\n", NumberOfNoCoincidences, 00115 banks.at(b1).data(), banks.at(b2).data()); 00116 hNumberOfNoCoincidences->Fill(NumberOfNoCoincidences, count++); 00117 } 00118 } 00119 00120 return 0; 00121 }
int BaseModule::ProcessGenericEntry | ( | TGlobalData * | gData, | |
const TSetupData * | gSetup | |||
) | [inherited] |
Method called by the main event loop for each entry in the input root tree. Does some simple work, then hooks into the derived class through ProcessEntry.
Definition at line 44 of file BaseModule.cpp.
References BaseModule::fDirectory, and BaseModule::ProcessEntry().
Referenced by LoopSequence::Process().
00044 { 00045 // This is called by our main routine and would allow later to split into different 00046 // process routines if we have more than one Tree and hence different tpyes of data input. 00047 00048 if(fDirectory) fDirectory->cd(); 00049 int ret = ProcessEntry(gData, gSetup); 00050 gDirectory->cd("/"); 00051 00052 return ret; 00053 }
void BaseModule::SetAlias | ( | const std::string & | alias | ) | [inline, inherited] |
Sets the alias for this module, which should be provided in the modules file
Definition at line 59 of file BaseModule.h.
References BaseModule::fAlias.
Referenced by BaseModule::BaseModule().
00059 {fAlias=alias;};
TDirectory* BaseModule::dir [protected, inherited] |
Many modules use 'dir' still which was the old protected pointer to the modules directory. To prevent things being broken so soon, we keep this pointer available, but be warned that it will be removed shortly...
Definition at line 98 of file BaseModule.h.
Referenced by BaseModule::BaseModule(), FastSlowCompare::FastSlowCompare(), GeSpectrum::GeSpectrum(), BaseModule::GetDirectory(), MakeMuonEvents::MakeMuonEvents(), and PlotAmpVsTDiff::PlotAmpVsTDiff().