#include <PlotTAP_Energy.h>
Public Member Functions | |
PlotTAP_Energy (modules::options *opts) | |
~PlotTAP_Energy () | |
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. | |
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 | BeforeFirstEntry (TGlobalData *gData, const TSetupData *gSetup) |
virtual int | AfterLastEntry (TGlobalData *gData, const TSetupData *setup) |
virtual int | ProcessEntry (TGlobalData *gData, const TSetupData *gSetup) |
The big kahuna. Overload this in the derived class and it will be called for each event. | |
Private Attributes | |
std::map< std::string, TH1F * > | fEnergyPlots |
Definition at line 9 of file PlotTAP_Energy.h.
PlotTAP_Energy::PlotTAP_Energy | ( | modules::options * | opts | ) |
Definition at line 26 of file PlotTAP_Energy.cpp.
00026 : 00027 BaseModule("PlotTAP_Energy",opts) { 00028 }
PlotTAP_Energy::~PlotTAP_Energy | ( | ) |
Definition at line 30 of file PlotTAP_Energy.cpp.
virtual int PlotTAP_Energy::AfterLastEntry | ( | TGlobalData * | gData, | |
const TSetupData * | setup | |||
) | [inline, private, virtual] |
Optional method which is called once after the main event loop Can be used to dump a summary or finalise a histogram
Implements BaseModule.
Definition at line 16 of file PlotTAP_Energy.h.
int PlotTAP_Energy::BeforeFirstEntry | ( | TGlobalData * | gData, | |
const TSetupData * | setup | |||
) | [private, virtual] |
Optional method which is called once before the main event loop Can be used to parse options and setup histograms.
Implements BaseModule.
Definition at line 33 of file PlotTAP_Energy.cpp.
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(), 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 PlotTAP_Energy::ProcessEntry | ( | TGlobalData * | gData, | |
const TSetupData * | gSetup | |||
) | [private, virtual] |
The big kahuna. Overload this in the derived class and it will be called for each event.
gData | Pointer to current map of all TPIs [ WILL CHANGE SHORTLY ] | |
gSetup | Pointer to TSetupData for this run [ WILL CHANGE SHORTLY ] |
Implements BaseModule.
Definition at line 37 of file PlotTAP_Energy.cpp.
References fEnergyPlots, gAnalysedPulseMap, SetupNavigator::GetAdcToEnergyConstant(), SetupNavigator::GetAdcToEnergyGain(), TSetupData::GetBankName(), BaseModule::GetName(), TSetupData::GetNBits(), SetupNavigator::GetRunNumber(), and SetupNavigator::Instance().
00037 { 00038 00039 // Loop over each TAP list 00040 for (SourceAnalPulseMap::const_iterator i_det = gAnalysedPulseMap.begin(); 00041 i_det != gAnalysedPulseMap.end(); 00042 i_det++) { 00043 00044 const std::string& detname = i_det->first.str(); 00045 std::string keyname = i_det->first.str() + GetName(); 00046 00047 // Create the histogram if it's not been created yet 00048 if ( fEnergyPlots.find(keyname) == fEnergyPlots.end() ) { 00049 00050 // hEnergy 00051 std::string histname = "h" + detname + "_Energy"; 00052 std::stringstream histtitle; 00053 histtitle<<"Energy of pulses from source " << i_det->first; 00054 histtitle<<" for run "<<SetupNavigator::Instance()->GetRunNumber(); 00055 int n_bits = gSetup->GetNBits(gSetup->GetBankName(i_det->first.Channel().str())); 00056 const double max_adc_value = std::pow(2, n_bits); 00057 double gain = 1; 00058 double offset= 0; 00059 try{ 00060 gain = SetupNavigator::Instance()->GetAdcToEnergyGain( i_det->first.Channel()); 00061 offset= SetupNavigator::Instance()->GetAdcToEnergyConstant(i_det->first.Channel()); 00062 }catch( Except::InvalidDetector& e){}; 00063 TH1F* hEnergy = new TH1F(histname.c_str(), histtitle.str().c_str(), max_adc_value,0,gain*max_adc_value + offset); 00064 hEnergy->GetXaxis()->SetTitle("Energy (KeV)"); 00065 hEnergy->GetYaxis()->SetTitle("Arbitrary Units"); 00066 fEnergyPlots[keyname] = hEnergy; 00067 } 00068 00069 const AnalysedPulseList *pulses = &i_det->second; 00070 //if(Debug() && pulses->empty()) DEBUG_PREFIX<<" no pulses to fill for "<<i_det->first<<std::endl; 00071 00072 for (AnalysedPulseList::const_iterator pulseIter = pulses->begin(); pulseIter != pulses->end(); ++pulseIter) { 00073 double Energy = (*pulseIter)->GetEnergy(); 00074 fEnergyPlots[keyname]->Fill(Energy); 00075 00076 } // end loop through pulses 00077 00078 } // end loop through detectors 00079 return 0; 00080 }
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().
std::map<std::string, TH1F*> PlotTAP_Energy::fEnergyPlots [private] |
Definition at line 19 of file PlotTAP_Energy.h.
Referenced by ProcessEntry().