Module to plot pulses meeting a certain criteria. More...
#include <PulseViewer.h>
Public Member Functions | |
PulseViewer (modules::options *opts) | |
~PulseViewer () | |
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 | |
enum | ParameterType { kAmplitude, kTime, kIntegral, kTPILength, kEnergy, kPedestal, kTriggerTime, kEventNo, kIntegralRatio, kIntegralTail, kChi2, kStatus, kWasDouble, kNPeaks, kPeakRank } |
enum | PulseType { kTAP, kIntegralRatioAP, kTemplateFitAP, kTemplateConvolveAP } |
typedef int | TPulseIslandID |
typedef int | TAnalysedPulseID |
typedef int | EventID_t |
typedef std::map < TPulseIslandID, int > | PulseIDList_t |
typedef std::map< EventID_t, PulseIDList_t > | EventPulseIDList_t |
typedef std::map< std::string, ParameterType > | ParameterKeys |
typedef std::map< std::string, PulseType > | PulseKeys |
Private Member Functions | |
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. | |
virtual int | BeforeFirstEntry (TGlobalData *gData, const TSetupData *setup) |
virtual int | AfterLastEntry (TGlobalData *gData, const TSetupData *setup) |
IDs::source | GetSource () const |
Get the channel as a string. | |
int | ConsiderDrawing (const TAnalysedPulseID &id, const TAnalysedPulse *i_pulse) |
double | GetParameterValue (const TAnalysedPulse *pulse, const ParameterType ¶meter) |
Get the value of interest from pulse. | |
double | GetParameterValue (const TIntegralRatioAnalysedPulse *pulse, const ParameterType ¶meter) |
double | GetParameterValue (const TTemplateFitAnalysedPulse *pulse, const ParameterType ¶meter) |
double | GetParameterValue (const TTemplateConvolveAnalysedPulse *pulse, const ParameterType ¶meter) |
int | ParseTriggerString (const std::string &trigger_condition) |
int | CheckPulseType (const std::string &pulse_type) |
bool | TestPulseType (const TAnalysedPulse *pulse_type) |
bool | SummarisePlots () |
Dump a summary of what was done. | |
Private Attributes | |
IDs::source | fSource |
std::string | fRequestedSource |
std::string | fTriggerCondition |
PulseType | fPulseType |
std::string | fRequestedPulseType |
long int | fTotalPlotted |
long int | fMaxToPlot |
long int | fMaxToPlotPerEvent |
bool | fSummarize |
bool | fStopAtMax |
EventPulseIDList_t | fPulsesPlotted |
TFormula * | fFormula |
int | fEvent |
Static Private Attributes | |
static ParameterKeys | fAvailableParams |
static PulseKeys | fAvailablePulseTypes |
Module to plot pulses meeting a certain criteria.
Definition at line 16 of file PulseViewer.h.
typedef int PulseViewer::EventID_t [private] |
Definition at line 19 of file PulseViewer.h.
typedef std::map<EventID_t,PulseIDList_t> PulseViewer::EventPulseIDList_t [private] |
Definition at line 21 of file PulseViewer.h.
typedef std::map<std::string,ParameterType> PulseViewer::ParameterKeys [private] |
Definition at line 92 of file PulseViewer.h.
typedef std::map<TPulseIslandID,int> PulseViewer::PulseIDList_t [private] |
Definition at line 20 of file PulseViewer.h.
typedef std::map<std::string,PulseType> PulseViewer::PulseKeys [private] |
Definition at line 95 of file PulseViewer.h.
typedef int PulseViewer::TAnalysedPulseID [private] |
Definition at line 18 of file PulseViewer.h.
typedef int PulseViewer::TPulseIslandID [private] |
Definition at line 17 of file PulseViewer.h.
enum PulseViewer::ParameterType [private] |
kAmplitude | |
kTime | |
kIntegral | |
kTPILength | |
kEnergy | |
kPedestal | |
kTriggerTime | |
kEventNo | |
kIntegralRatio | |
kIntegralTail | |
kChi2 | |
kStatus | |
kWasDouble | |
kNPeaks | |
kPeakRank |
Definition at line 23 of file PulseViewer.h.
00023 { 00024 kAmplitude, 00025 kTime, 00026 kIntegral, 00027 kTPILength, 00028 kEnergy, 00029 kPedestal, 00030 kTriggerTime, 00031 kEventNo, 00032 kIntegralRatio, 00033 kIntegralTail, 00034 kChi2, 00035 kStatus, 00036 kWasDouble, 00037 kNPeaks, 00038 kPeakRank 00039 };
enum PulseViewer::PulseType [private] |
Definition at line 41 of file PulseViewer.h.
00041 { 00042 kTAP, 00043 kIntegralRatioAP, 00044 kTemplateFitAP, 00045 kTemplateConvolveAP 00046 };
PulseViewer::PulseViewer | ( | modules::options * | opts | ) |
Definition at line 37 of file PulseViewer.cpp.
References IDs::source::Channel(), fMaxToPlot, fMaxToPlotPerEvent, fRequestedPulseType, fRequestedSource, fSource, fStopAtMax, fSummarize, fTriggerCondition, modules::options::GetBool(), modules::options::GetFlag(), modules::options::GetInt(), and modules::options::GetString().
00037 : 00038 BaseModule("PulseViewer",opts),fTotalPlotted(0),fFormula(NULL),fEvent(0){ 00039 fRequestedSource=opts->GetString("source"); 00040 fRequestedPulseType=opts->GetString("pulse_type","TAnalysedPulse"); 00041 fSource.Channel()=fRequestedSource; 00042 fTriggerCondition=opts->GetString("trigger"); 00043 fSummarize=opts->GetFlag("summarize"); 00044 fMaxToPlot=opts->GetInt("max_plots",-1); 00045 fMaxToPlotPerEvent=opts->GetInt("max_plots_event",-1); 00046 fStopAtMax=opts->GetBool("stop_at_max_plots",true); 00047 }
PulseViewer::~PulseViewer | ( | ) |
Definition at line 49 of file PulseViewer.cpp.
References fFormula.
int PulseViewer::AfterLastEntry | ( | TGlobalData * | gData, | |
const TSetupData * | setup | |||
) | [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 290 of file PulseViewer.cpp.
References fPulsesPlotted, fSource, fTotalPlotted, fTriggerCondition, and SummarisePlots().
00290 { 00291 00292 // Print extra info if we're requested to summarize the found pulses 00293 if(SummarisePlots()){ 00294 const std::string prefix=" "; 00295 cout<<"Summary for pulse criteria: ("<<fTriggerCondition <<") on channel "<<fSource<<endl; 00296 if(!fPulsesPlotted.empty()){ 00297 cout<<prefix<<" Event | Pulse IDs drawn (sub_pulse ID)"<<endl; 00298 cout<<prefix<<" ----- | ------------ "<<endl; 00299 for(EventPulseIDList_t::const_iterator i_event=fPulsesPlotted.begin(); 00300 i_event!=fPulsesPlotted.end();i_event++){ 00301 cout<<prefix<<std::setw(6)<< i_event->first<<" | "; 00302 for(PulseIDList_t::const_iterator i_pulse=i_event->second.begin(); 00303 i_pulse!=i_event->second.end();i_pulse++){ 00304 cout<<std::setw(2)<< i_pulse->first <<"("<< i_pulse->second<<")" <<", "; 00305 } 00306 cout<<endl; 00307 } 00308 cout<<prefix<<" ----- | ------------ "<<endl; 00309 } 00310 cout<<prefix<<"Total pulses plotted = "<<fTotalPlotted<<endl; 00311 cout<<"Summary for pulse criteria: ("<<fTriggerCondition <<") on channel "<<fSource<<endl; 00312 00313 } 00314 00315 return 0; 00316 }
int PulseViewer::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 53 of file PulseViewer.cpp.
References IDs::source::Channel(), CheckPulseType(), fAvailableParams, fAvailablePulseTypes, fRequestedPulseType, fRequestedSource, fSource, fTriggerCondition, ExportPulse::Instance(), kAmplitude, kEnergy, kEventNo, kIntegral, kIntegralRatioAP, kPedestal, kTAP, kTemplateConvolveAP, kTemplateFitAP, kTime, kTPILength, kTriggerTime, and ParseTriggerString().
00053 { 00054 00055 // Check we're also running with the ExportPulse module 00056 if(!ExportPulse::Instance()){ 00057 cout<<"PulseViewer: Error: You need to run with ExportPulse to use PulseViewer module"<<std::endl; 00058 return 1; 00059 } 00060 00061 // Check the channel is valid 00062 if(!fSource.Channel().isValid()){ 00063 cout<<"PulseViewer: Error: No detector called '"<<fRequestedSource<<"' exists"<<endl; 00064 return 2; 00065 } 00066 00067 // setup the possible parameters 00068 if(fAvailableParams.empty()){ 00069 fAvailableParams["amplitude"]=kAmplitude; 00070 fAvailableParams["time"]=kTime; 00071 fAvailableParams["TPI_length"]=kTPILength; 00072 fAvailableParams["integral"]=kIntegral; 00073 fAvailableParams["energy"]=kEnergy; 00074 fAvailableParams["pedestal"]=kPedestal; 00075 fAvailableParams["trigger_time"]=kTriggerTime; 00076 fAvailableParams["event_no"]=kEventNo; 00077 } 00078 00079 if(fAvailablePulseTypes.empty()){ 00080 fAvailablePulseTypes["TAnalysedPulse"]=kTAP; 00081 fAvailablePulseTypes["IntegralRatioAP"]=kIntegralRatioAP; 00082 fAvailablePulseTypes["TemplateFitAP"]=kTemplateFitAP; 00083 fAvailablePulseTypes["TemplateConvolveAP"]=kTemplateConvolveAP; 00084 } 00085 00086 int ret_val= CheckPulseType(fRequestedPulseType); 00087 if(ret_val) return ret_val; 00088 00089 // Parse the trigger string 00090 return ParseTriggerString(fTriggerCondition); 00091 }
int PulseViewer::CheckPulseType | ( | const std::string & | pulse_type | ) | [private] |
Definition at line 93 of file PulseViewer.cpp.
References fAvailableParams, fAvailablePulseTypes, fPulseType, kChi2, kIntegralRatio, kIntegralRatioAP, kIntegralTail, kNPeaks, kPeakRank, kStatus, kTAP, kTemplateConvolveAP, kTemplateFitAP, and kWasDouble.
Referenced by BeforeFirstEntry().
00093 { 00094 PulseKeys::const_iterator i_type=fAvailablePulseTypes.find(pulse_type); 00095 if(i_type==fAvailablePulseTypes.end()) { 00096 cout<<"PulseViewer::CheckPulseType: Error: Bad pulse_type: "<<pulse_type<<endl; 00097 for(PulseKeys::const_iterator it=fAvailablePulseTypes.begin(); 00098 it!=fAvailablePulseTypes.end(); it++){ 00099 cout<<" |-"<<it->first<<endl; 00100 } 00101 return 1; 00102 } 00103 fPulseType=i_type->second; 00104 switch(fPulseType){ 00105 case kTAP: break; 00106 case kTemplateConvolveAP: 00107 fAvailableParams["NPeaks"]=kNPeaks; 00108 fAvailableParams["PeakRank"]=kPeakRank; 00109 fAvailableParams["Integral_ratio"]=kIntegralRatio; 00110 break; 00111 case kTemplateFitAP: 00112 fAvailableParams["Chi2"]=kChi2; 00113 fAvailableParams["Status"]=kStatus; 00114 fAvailableParams["Integral_ratio"]=kIntegralRatio; 00115 fAvailableParams["Double_fitted"]=kWasDouble; 00116 break; 00117 case kIntegralRatioAP: 00118 fAvailableParams["Integral_ratio"]=kIntegralRatio; 00119 fAvailableParams["Integral_tail"]=kIntegralTail; 00120 break; 00121 } 00122 return 0; 00123 }
int PulseViewer::ConsiderDrawing | ( | const TAnalysedPulseID & | id, | |
const TAnalysedPulse * | i_pulse | |||
) | [private] |
Ask ExportPulse to draw this pulse if it matches the trigger criteria
Definition at line 253 of file PulseViewer.cpp.
References ExportPulse::AddToExportList(), BaseModule::Debug(), EventNavigator::EntryNo(), fAvailableParams, fFormula, fPulsesPlotted, fPulseType, fTotalPlotted, fTriggerCondition, GetVals, ExportPulse::Instance(), EventNavigator::Instance(), kIntegralRatioAP, kTAP, kTemplateConvolveAP, and kTemplateFitAP.
Referenced by ProcessEntry().
00253 { 00254 // Check pulse passes trigger condition 00255 double vals[fAvailableParams.size()]; 00256 switch (fPulseType){ 00257 case kTAP: GetVals(vals,pulse); break; 00258 case kTemplateConvolveAP: if(true){ 00259 const TTemplateConvolveAnalysedPulse* tc_pulse =static_cast<const TTemplateConvolveAnalysedPulse*>(pulse); 00260 GetVals(vals,tc_pulse); 00261 } break; 00262 case kTemplateFitAP: if(true){ 00263 const TTemplateFitAnalysedPulse* tf_pulse =static_cast<const TTemplateFitAnalysedPulse*>(pulse); 00264 GetVals(vals,tf_pulse); 00265 } break; 00266 case kIntegralRatioAP: if(true){ 00267 const TIntegralRatioAnalysedPulse* ir_pulse =static_cast<const TIntegralRatioAnalysedPulse*>(pulse); 00268 GetVals(vals,ir_pulse); 00269 } break; 00270 } 00271 fFormula->SetParameters(vals); 00272 double value=fFormula->Eval(0); 00273 if(!value) return 0; 00274 if(Debug()){ 00275 cout<<"PulseViewer: Event: "<<EventNavigator::Instance().EntryNo() 00276 <<" Plotting pulse "<<id<<" [ "<<fTriggerCondition<<" => "<<fFormula->GetExpFormula("P")<<" ]"<<endl; 00277 } 00278 00279 // If it does, ask ExportPulse to draw it 00280 // We're safe to assume Instance will return becuase we test it's 00281 // existence in BeforeFirstEntry 00282 if(fPulsesPlotted[EventNavigator::Instance().EntryNo()].count(id)==0){ 00283 ExportPulse::Instance()->AddToExportList(pulse); 00284 fTotalPlotted++; 00285 } 00286 fPulsesPlotted[EventNavigator::Instance().EntryNo()][id]++; 00287 return 0; 00288 }
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(), ConsiderDrawing(), MakeAnalysedPulses::MakeAnalysedPulses(), MakeDetectorPulses::MakeGenerator(), ExportPulse::PlotTPI(), MakeDetectorPulses::ProcessEntry(), TemplateCreator::ProcessEntry(), PulseCandidateFinder_InvestigateParameters::ProcessEntry(), MakeAnalysedPulses::ProcessEntry(), 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();};
double PulseViewer::GetParameterValue | ( | const TTemplateConvolveAnalysedPulse * | pulse, | |
const ParameterType & | parameter | |||
) | [private] |
Definition at line 242 of file PulseViewer.cpp.
References TTemplateConvolveAnalysedPulse::GetIntegralRatio(), TTemplateConvolveAnalysedPulse::GetNPeaks(), GetParameterValue(), TTemplateConvolveAnalysedPulse::GetPeakRank(), kIntegralRatio, kNPeaks, and kPeakRank.
00242 { 00243 double retVal=0; 00244 switch (parameter){ 00245 case kIntegralRatio: retVal=pulse->GetIntegralRatio(); break; 00246 case kNPeaks: retVal=pulse->GetNPeaks(); break; 00247 case kPeakRank: retVal=pulse->GetPeakRank(); break; 00248 default: retVal=GetParameterValue( static_cast<const TAnalysedPulse*>(pulse),parameter); 00249 } 00250 return retVal; 00251 }
double PulseViewer::GetParameterValue | ( | const TTemplateFitAnalysedPulse * | pulse, | |
const ParameterType & | parameter | |||
) | [private] |
Definition at line 230 of file PulseViewer.cpp.
References TTemplateFitAnalysedPulse::GetChi2(), TTemplateFitAnalysedPulse::GetFitStatus(), TTemplateFitAnalysedPulse::GetIntegralRatio(), GetParameterValue(), kChi2, kIntegralRatio, kStatus, kWasDouble, and TTemplateFitAnalysedPulse::WasFirstOfDouble().
00230 { 00231 double retVal=0; 00232 switch (parameter){ 00233 case kIntegralRatio: retVal=pulse->GetIntegralRatio(); break; 00234 case kChi2: retVal=pulse->GetChi2(); break; 00235 case kStatus: retVal=pulse->GetFitStatus(); break; 00236 case kWasDouble: retVal=pulse->WasFirstOfDouble(); break; 00237 default: retVal=GetParameterValue( static_cast<const TAnalysedPulse*>(pulse),parameter); 00238 } 00239 return retVal; 00240 }
double PulseViewer::GetParameterValue | ( | const TIntegralRatioAnalysedPulse * | pulse, | |
const ParameterType & | parameter | |||
) | [private] |
Definition at line 220 of file PulseViewer.cpp.
References TIntegralRatioAnalysedPulse::GetIntegralRatio(), TIntegralRatioAnalysedPulse::GetIntegralSmall(), GetParameterValue(), kIntegralRatio, and kIntegralTail.
00220 { 00221 double retVal=0; 00222 switch (parameter){ 00223 case kIntegralTail: retVal=pulse->GetIntegralSmall(); break; 00224 case kIntegralRatio: retVal=pulse->GetIntegralRatio(); break; 00225 default: retVal=GetParameterValue( static_cast<const TAnalysedPulse*>(pulse),parameter); 00226 } 00227 return retVal; 00228 }
double PulseViewer::GetParameterValue | ( | const TAnalysedPulse * | pulse, | |
const ParameterType & | parameter | |||
) | [private] |
Get the value of interest from pulse.
Definition at line 203 of file PulseViewer.cpp.
References definitions::DefaultValue, fEvent, TAnalysedPulse::GetAmplitude(), TAnalysedPulse::GetEnergy(), TAnalysedPulse::GetIntegral(), TAnalysedPulse::GetPedestal(), TAnalysedPulse::GetTime(), TAnalysedPulse::GetTPILength(), TAnalysedPulse::GetTriggerTime(), kAmplitude, kEnergy, kEventNo, kIntegral, kPedestal, kTime, kTPILength, and kTriggerTime.
Referenced by GetParameterValue().
00203 { 00204 double retVal=0; 00205 switch (parameter){ 00206 case kAmplitude: retVal=pulse->GetAmplitude(); break; 00207 case kTime: retVal=pulse->GetTime(); break; 00208 case kIntegral: retVal=pulse->GetIntegral(); break; 00209 case kTPILength: retVal=pulse->GetTPILength(); break; 00210 case kEnergy: retVal=pulse->GetEnergy(); break; 00211 case kPedestal: retVal=pulse->GetPedestal(); break; 00212 case kTriggerTime: retVal=pulse->GetTriggerTime(); break; 00213 case kEventNo: retVal=fEvent; break; 00214 default: retVal=definitions::DefaultValue; 00215 cout<<"PulseViewer::GetParameterValue: Error: Cannot get param: "<<parameter<<" from a TAnalysedPulse"<<endl; 00216 } 00217 return retVal; 00218 }
IDs::source PulseViewer::GetSource | ( | ) | const [inline, private] |
Get the channel as a string.
Definition at line 58 of file PulseViewer.h.
References fSource.
Referenced by ProcessEntry().
00058 {return fSource;};
int PulseViewer::ParseTriggerString | ( | const std::string & | trigger_condition | ) | [private] |
Parse a trigger condition and set up the values needed to handle it
Definition at line 125 of file PulseViewer.cpp.
References fAvailableParams, fFormula, fTriggerCondition, and modules::parser::ReplaceWords().
Referenced by BeforeFirstEntry().
00125 { 00126 std::string expression =fTriggerCondition; 00127 for(ParameterKeys::const_iterator i_key=fAvailableParams.begin(); 00128 i_key!=fAvailableParams.end();i_key++){ 00129 modules::parser::ReplaceWords(expression,i_key->first,Form("[%d]",i_key->second)); 00130 } 00131 00132 fFormula=new TFormula("PulseViewerTrigger",expression.c_str()); 00133 int ret= fFormula->Compile(); 00134 if(ret){ 00135 cout<<"Error: Bad trigger expression: '"<<fTriggerCondition<<"'"<<endl; 00136 cout<<" Only use parameters from"<<endl; 00137 for(ParameterKeys::const_iterator it=fAvailableParams.begin(); 00138 it!=fAvailableParams.end(); 00139 it++){ 00140 cout<<" |-"<<it->first<<endl; 00141 } 00142 } 00143 return ret; 00144 }
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 PulseViewer::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 146 of file PulseViewer.cpp.
References ConsiderDrawing(), BaseModule::Debug(), fEvent, fMaxToPlot, fStopAtMax, fTotalPlotted, gAnalysedPulseMap, GetSource(), and TestPulseType().
00146 { 00147 // Have we drawn the number of pulses we were meant to? 00148 if(fMaxToPlot>0 && fTotalPlotted>=fMaxToPlot){ 00149 if(fStopAtMax){ 00150 cout<<"PulseViewer::ProcessEntry: "<<fTotalPlotted<<" pulses have already been drawn which " 00151 <<"is greater than the limit of "<<fMaxToPlot<<" so I'm stopping execution.\n"; 00152 //cout<<"You can probably ignore any of the immediate errors that follow this."<<endl; 00153 return 1; 00154 } 00155 return 0; 00156 } 00157 00158 // Get the TAPs for this channel 00159 AnalysedPulseList* allTAPs=NULL; 00160 for(SourceAnalPulseMap::iterator i_source=gAnalysedPulseMap.begin(); 00161 i_source!=gAnalysedPulseMap.end(); ++i_source){ 00162 if(i_source->first.matches(GetSource())){ 00163 allTAPs=&i_source->second; 00164 break; 00165 } 00166 } 00167 00168 if(!allTAPs){ 00169 cout<<"Problem getting TAP list for "<<GetSource()<<endl; 00170 return 1; 00171 }else if(allTAPs->empty() ){ 00172 if(Debug()) cout<<"List of TAPS for '"<< GetSource()<<"' was empty "<<endl; 00173 return 0; 00174 } 00175 00176 // Check each TAP against trigger 00177 int retVal=0; 00178 for(AnalysedPulseList::iterator i_pulse=allTAPs->begin(); 00179 i_pulse!=allTAPs->end() && retVal==0; 00180 i_pulse++){ 00181 if(fEvent==0){ 00182 retVal=TestPulseType(*i_pulse); 00183 } 00184 retVal=ConsiderDrawing((*i_pulse)->GetParentID() ,*i_pulse); 00185 } 00186 if(retVal!=0) return retVal; 00187 00188 fEvent++; 00189 00190 return 0; 00191 }
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;};
bool PulseViewer::SummarisePlots | ( | ) | [inline, private] |
Dump a summary of what was done.
Definition at line 77 of file PulseViewer.h.
References fSummarize.
Referenced by AfterLastEntry().
00077 {return fSummarize;};
bool PulseViewer::TestPulseType | ( | const TAnalysedPulse * | pulse_type | ) | [private] |
Definition at line 193 of file PulseViewer.cpp.
References fPulseType, kIntegralRatioAP, kTAP, kTemplateConvolveAP, and kTemplateFitAP.
Referenced by ProcessEntry().
00193 { 00194 switch(fPulseType){ 00195 case kTAP: return false; 00196 case kIntegralRatioAP: return dynamic_cast<const TIntegralRatioAnalysedPulse*>(pulse); 00197 case kTemplateFitAP: return dynamic_cast<const TTemplateFitAnalysedPulse*>(pulse); 00198 case kTemplateConvolveAP: return dynamic_cast<const TTemplateConvolveAnalysedPulse*>(pulse); 00199 } 00200 return false; 00201 }
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().
PulseViewer::ParameterKeys PulseViewer::fAvailableParams [static, private] |
Definition at line 93 of file PulseViewer.h.
Referenced by BeforeFirstEntry(), CheckPulseType(), ConsiderDrawing(), and ParseTriggerString().
PulseViewer::PulseKeys PulseViewer::fAvailablePulseTypes [static, private] |
Definition at line 96 of file PulseViewer.h.
Referenced by BeforeFirstEntry(), and CheckPulseType().
int PulseViewer::fEvent [private] |
Definition at line 90 of file PulseViewer.h.
Referenced by GetParameterValue(), and ProcessEntry().
TFormula* PulseViewer::fFormula [private] |
Definition at line 89 of file PulseViewer.h.
Referenced by ConsiderDrawing(), ParseTriggerString(), and ~PulseViewer().
long int PulseViewer::fMaxToPlot [private] |
Definition at line 86 of file PulseViewer.h.
Referenced by ProcessEntry(), and PulseViewer().
long int PulseViewer::fMaxToPlotPerEvent [private] |
Definition at line 86 of file PulseViewer.h.
Referenced by PulseViewer().
Definition at line 88 of file PulseViewer.h.
Referenced by AfterLastEntry(), and ConsiderDrawing().
PulseType PulseViewer::fPulseType [private] |
Definition at line 83 of file PulseViewer.h.
Referenced by CheckPulseType(), ConsiderDrawing(), and TestPulseType().
std::string PulseViewer::fRequestedPulseType [private] |
Definition at line 84 of file PulseViewer.h.
Referenced by BeforeFirstEntry(), and PulseViewer().
std::string PulseViewer::fRequestedSource [private] |
Definition at line 81 of file PulseViewer.h.
Referenced by BeforeFirstEntry(), and PulseViewer().
IDs::source PulseViewer::fSource [private] |
Definition at line 77 of file PulseViewer.h.
Referenced by AfterLastEntry(), BeforeFirstEntry(), GetSource(), and PulseViewer().
bool PulseViewer::fStopAtMax [private] |
Definition at line 87 of file PulseViewer.h.
Referenced by ProcessEntry(), and PulseViewer().
bool PulseViewer::fSummarize [private] |
Definition at line 87 of file PulseViewer.h.
Referenced by PulseViewer(), and SummarisePlots().
long int PulseViewer::fTotalPlotted [private] |
Definition at line 85 of file PulseViewer.h.
Referenced by AfterLastEntry(), ConsiderDrawing(), and ProcessEntry().
std::string PulseViewer::fTriggerCondition [private] |
Definition at line 82 of file PulseViewer.h.
Referenced by AfterLastEntry(), BeforeFirstEntry(), ConsiderDrawing(), ParseTriggerString(), and PulseViewer().