A one line description of what your module does. More...
#include <SavePulses.h>
Public Member Functions | |
SavePulses (modules::options *opts) | |
Constructor description. If necessary, add a details tag like above. | |
~SavePulses () | |
Is anything done in the destructor? | |
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 Types | |
typedef std::map< IDs::source, TClonesArray * > | SourceToClonesArrayMap |
Private Member Functions | |
virtual int | ProcessEntry (TGlobalData *gData, const TSetupData *gSetup) |
What's calculated for every entry? Don't hesitate to repeat what was said in the class description. | |
virtual int | BeforeFirstEntry (TGlobalData *gData, const TSetupData *setup) |
What needes to be done before each run? Don't hesitate to repeat what was said in the class description. | |
virtual int | AfterLastEntry (TGlobalData *gData, const TSetupData *setup) |
What needs to be done after each run? Don't hesitate to repeat what was said in the class description. | |
Private Attributes | |
TTree * | fTree |
SourceToClonesArrayMap | fArrays |
A one line description of what your module does.
A longer, more descriptive block of text. Specifics like members and methods will be described later. You can add this to other groups instead of rootana_modules or in addition to rootana_modules by adding more of the ingroup tags.
Definition at line 26 of file SavePulses.h.
typedef std::map<IDs::source,TClonesArray*> SavePulses::SourceToClonesArrayMap [private] |
Definition at line 28 of file SavePulses.h.
SavePulses::SavePulses | ( | modules::options * | opts | ) |
Constructor description. If necessary, add a details tag like above.
[in] | opts | Describe the options this module takes. |
Definition at line 22 of file SavePulses.cpp.
References fTree.
00022 : 00023 BaseModule("SavePulses",opts,false){ 00024 fTree=new TTree("TAP_tree","Tree storing all TAPs made in rootana"); 00025 }
SavePulses::~SavePulses | ( | ) |
int SavePulses::AfterLastEntry | ( | TGlobalData * | gData, | |
const TSetupData * | setup | |||
) | [private, virtual] |
What needs to be done after each run? Don't hesitate to repeat what was said in the class description.
Implements BaseModule.
Definition at line 76 of file SavePulses.cpp.
References BaseModule::GetDirectory().
00076 { 00077 FlyWeight<IDs::source,TAnalysedPulse::Tag>::SaveProxyList(GetDirectory(),"TAP_sources"); 00078 return 0; 00079 }
int SavePulses::BeforeFirstEntry | ( | TGlobalData * | gData, | |
const TSetupData * | setup | |||
) | [private, virtual] |
What needes to be done before each run? Don't hesitate to repeat what was said in the class description.
Implements BaseModule.
Definition at line 30 of file SavePulses.cpp.
References fArrays, fTree, gAnalysedPulseMap, BaseModule::GetName(), TAPGeneratorFactory::GetTAPType(), TAPGeneratorFactory::Instance(), modules::navigator::Instance(), and modules::parser::ToCppValid().
00030 { 00031 00032 // Check we're after MakeAnalysedPulses 00033 if(!modules::navigator::Instance()->Before("MakeAnalysedPulses",GetName())){ 00034 cout<<"SavePulses: Error: I need to be run after MakeAnalysedPulses"<<endl; 00035 return 1; 00036 } 00037 00038 // Loop over gAnalysedPulseMap and add a branch for each source 00039 TClonesArray* array; 00040 std::string name; 00041 for (SourceAnalPulseMap::const_iterator i_source = gAnalysedPulseMap.begin(); 00042 i_source != gAnalysedPulseMap.end(); ++i_source) { 00043 std::string tap_type=TAPGeneratorFactory::Instance()->GetTAPType(i_source->first); 00044 array=new TClonesArray(tap_type.c_str()); 00045 fArrays[i_source->first]=array; 00046 name=i_source->first.str(); 00047 modules::parser::ToCppValid(name); 00048 fTree->Branch(name.c_str(), array); 00049 } 00050 00051 return 0; 00052 }
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(), 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 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 SavePulses::ProcessEntry | ( | TGlobalData * | gData, | |
const TSetupData * | gSetup | |||
) | [private, virtual] |
What's calculated for every entry? Don't hesitate to repeat what was said in the class description.
Implements BaseModule.
Definition at line 54 of file SavePulses.cpp.
References fArrays, fTree, and gAnalysedPulseMap.
00054 { 00055 const AnalysedPulseList* pulseList; 00056 TClonesArray* array; 00057 TObject* tap; 00058 for (SourceAnalPulseMap::const_iterator i_source = gAnalysedPulseMap.begin(); 00059 i_source != gAnalysedPulseMap.end(); ++i_source) { 00060 pulseList=&i_source->second; 00061 array=fArrays[i_source->first]; 00062 for (AnalysedPulseList::const_iterator i_pulse = pulseList->begin(); 00063 i_pulse != pulseList->end(); ++i_pulse) { 00064 tap= array->ConstructedAt(i_pulse-pulseList->begin()); 00065 (*i_pulse)->Copy(*tap); 00066 } 00067 } 00068 fTree->Fill(); 00069 for(SourceToClonesArrayMap::iterator i_array=fArrays.begin(); 00070 i_array!=fArrays.end(); ++i_array){ 00071 i_array->second->Clear("C"); 00072 } 00073 return 0; 00074 }
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().
SourceToClonesArrayMap SavePulses::fArrays [private] |
Definition at line 62 of file SavePulses.h.
Referenced by BeforeFirstEntry(), and ProcessEntry().
TTree* SavePulses::fTree [private] |
Definition at line 61 of file SavePulses.h.
Referenced by BeforeFirstEntry(), ProcessEntry(), and SavePulses().