#include <ExportPulse.h>
Classes | |
struct | PulseInfo_t |
Public Member Functions | |
ExportPulse (modules::options *opts) | |
~ExportPulse () | |
void | AddToExportList (const std::string &channel, TPulseIslandID pulse_id) |
Log a request to draw a given TPI. | |
void | AddToExportList (const TAnalysedPulse *pulse) |
Add TAP to draw. Also draws the TAPs parent TPI. | |
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. | |
Static Public Member Functions | |
static ExportPulse * | Instance () |
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 int | TPulseIslandID |
typedef int | EventID_t |
typedef std::set< TPulseIslandID > | PulseIDList_t |
typedef std::map< std::string, PulseIDList_t > | ChannelPulseIDs_t |
typedef std::map< EventID_t, PulseIDList_t > | EventPulseIDList_t |
typedef std::map< std::string, EventPulseIDList_t > | EventChannelPulseIDs_t |
typedef std::set< const TAnalysedPulse * > | TAPList_t |
typedef std::map< std::string, TAPList_t > | ChannelTAPs_t |
Private Member Functions | |
virtual int | BeforeFirstEntry (TGlobalData *gData, const TSetupData *setup) |
virtual int | ProcessEntry (TGlobalData *gData, const TSetupData *gSetup) |
Plot all pulses that we were asked to draw for this event. | |
virtual int | AfterLastEntry (TGlobalData *gData, const TSetupData *setup) |
int | DrawTPIs () |
Draw all TPIs requested for this event. | |
int | DrawTAPs () |
Draw all TAPs requested for this event. | |
int | PlotTPI (const TPulseIsland *pulse, const PulseInfo_t &info) |
Plot a single TPI. | |
TH1F * | MakeHistTPI (const TPulseIsland *pulse, const std::string &name, int shift=0, int samples=0) const |
int | PlotTAP (const TAnalysedPulse *pulse, const PulseInfo_t &info) const |
Plot a single TAP. | |
PulseIslandList * | GetTPIsFromDetector (std::string bank="") |
Get a pointer to the list of TPIs for a given detector. | |
void | SetCurrentPulseID (const TPulseIslandID &id) |
void | SetCurrentEventNumber (const Long64_t &num) |
void | SetCurrentDetectorName (const std::string &detector) |
Long64_t | GetCurrentEventNumber () const |
std::string | GetCurrentBankName () const |
Long64_t | GetTotalNumberOfEvents () const |
void | ClearPulsesToExport () |
void | AddToConfigRequestList (EventID_t event_id, const std::string &detector, TPulseIslandID pulse_id) |
bool | ParseEventRequest (std::string input, std::vector< EventID_t > &event_list) |
void | ShowGuidance () |
bool | ParsePulseRequest (std::string input, std::vector< EventID_t > &list) |
bool | ParseRequest (std::string input, std::vector< EventID_t > &list, const std::string &type, Long64_t lower_limit, Long64_t upper_limit) |
void | LoadPulsesRequestedByConfig () |
Private Attributes | |
bool | fGuidanceShown |
Long64_t | fTotalEvents |
double | fClockTick |
double | fTimeShift |
ChannelPulseIDs_t | fTPIsToPlot |
ChannelTAPs_t | fTAPsToPlot |
EventChannelPulseIDs_t | fRequestedByConfig |
PulseInfo_t | fPulseInfo |
const TSetupData * | fSetup |
modules::options * | fOptions |
bool | fUsePCF |
PulseCandidateFinder * | fPulseFinder |
PulseIslandList | fSubPulses |
TDirectory * | fTPIDirectory |
TDirectory * | fTAPDirectory |
TGlobalData * | fGlobalData |
Class to handle drawing of a given pulse.
Definition at line 24 of file ExportPulse.h.
typedef std::map<std::string,PulseIDList_t> ExportPulse::ChannelPulseIDs_t [private] |
Definition at line 28 of file ExportPulse.h.
typedef std::map<std::string,TAPList_t> ExportPulse::ChannelTAPs_t [private] |
Definition at line 32 of file ExportPulse.h.
typedef std::map<std::string,EventPulseIDList_t> ExportPulse::EventChannelPulseIDs_t [private] |
Definition at line 30 of file ExportPulse.h.
typedef int ExportPulse::EventID_t [private] |
Definition at line 26 of file ExportPulse.h.
typedef std::map<EventID_t,PulseIDList_t> ExportPulse::EventPulseIDList_t [private] |
Definition at line 29 of file ExportPulse.h.
typedef std::set<TPulseIslandID> ExportPulse::PulseIDList_t [private] |
Definition at line 27 of file ExportPulse.h.
typedef std::set<const TAnalysedPulse*> ExportPulse::TAPList_t [private] |
Definition at line 31 of file ExportPulse.h.
typedef int ExportPulse::TPulseIslandID [private] |
Definition at line 25 of file ExportPulse.h.
ExportPulse::ExportPulse | ( | modules::options * | opts | ) |
Definition at line 34 of file ExportPulse.cpp.
References ExportPulse::PulseInfo_t::bankname, ExportPulse::PulseInfo_t::detname, ExportPulse::PulseInfo_t::event, fPulseFinder, fPulseInfo, fTAPDirectory, fTPIDirectory, fUsePCF, BaseModule::GetDirectory(), modules::options::GetFlag(), and ExportPulse::PulseInfo_t::pulseID.
00035 : BaseModule("ExportPulse",opts),fGuidanceShown(false) 00036 , fSetup(NULL), fOptions(opts), fPulseFinder(NULL) 00037 { 00038 fPulseInfo.pulseID=-1; 00039 fPulseInfo.event=-1; 00040 fPulseInfo.bankname=""; 00041 fPulseInfo.detname=""; 00042 00043 fUsePCF=opts->GetFlag("run_pulse_finder"); 00044 if(fUsePCF){ 00045 fPulseFinder=new PulseCandidateFinder(); 00046 } 00047 00048 fTPIDirectory=GetDirectory("TPIs"); 00049 fTAPDirectory=GetDirectory("TAPs"); 00050 }
ExportPulse::~ExportPulse | ( | ) |
Definition at line 54 of file ExportPulse.cpp.
void ExportPulse::AddToConfigRequestList | ( | EventID_t | event_id, | |
const std::string & | detector, | |||
TPulseIslandID | pulse_id | |||
) | [inline, private] |
Definition at line 156 of file ExportPulse.h.
References fRequestedByConfig.
Referenced by BeforeFirstEntry().
00156 { 00157 fRequestedByConfig[detector][event_id].insert(pulse_id); 00158 }
void ExportPulse::AddToExportList | ( | const TAnalysedPulse * | pulse | ) | [inline] |
Add TAP to draw. Also draws the TAPs parent TPI.
channel | Name of channel that produced this pulse | |
pulse | Pulse to be drawn |
Definition at line 149 of file ExportPulse.h.
References AddToExportList(), IDs::source::Channel(), BaseModule::Debug(), fTAPsToPlot, TAnalysedPulse::GetParentID(), and TAnalysedPulse::GetSource().
00149 { 00150 std::string channel=pulse->GetSource().Channel().str(); 00151 if(Debug()) std::cout<<"ExportPulse: Asked to draw a TAP for "<<channel<<std::endl; 00152 fTAPsToPlot[channel].insert(pulse); 00153 AddToExportList(channel,pulse->GetParentID()); 00154 }
void ExportPulse::AddToExportList | ( | const std::string & | channel, | |
TPulseIslandID | pulse_id | |||
) | [inline] |
Log a request to draw a given TPI.
channel | Name of channel to draw TPI from | |
pulse_id | TPI location in list |
Definition at line 145 of file ExportPulse.h.
References fTPIsToPlot.
Referenced by AddToExportList(), PulseViewer::ConsiderDrawing(), LoadPulsesRequestedByConfig(), and GaussFitAPGenerator::ProcessPulses().
00145 { 00146 fTPIsToPlot[detector].insert(pulse_id); 00147 }
virtual int ExportPulse::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 84 of file ExportPulse.h.
int ExportPulse::BeforeFirstEntry | ( | TGlobalData * | gData, | |
const TSetupData * | setup | |||
) | [private, virtual] |
ExportPulse uses this method to process the config file for any specifically requested pulses
Implements BaseModule.
Definition at line 59 of file ExportPulse.cpp.
References AddToConfigRequestList(), modules::parser::Constructor_t::before, modules::options::begin(), modules::options::end(), fOptions, fSetup, fTotalEvents, TSetupData::GetBankName(), modules::options::GetVectorStringsByDelimiter(), modules::parser::Constructor_t::inside, Instance(), modules::parser::ParseConstructor(), ParseEventRequest(), ParsePulseRequest(), and ShowGuidance().
00059 { 00060 fSetup=setup; 00061 if(!fSetup){ 00062 cout<<"Error: TSetupData passed to ExportPulse is NULL..."<<endl; 00063 return 1 ; 00064 } 00065 fTotalEvents = EventNavigator::Instance().GetInputNEntries(); 00066 00068 if(fOptions){ 00069 int num=0; 00070 std::vector<std::string> currentList; 00071 std::vector<EventID_t> event_list; 00072 std::vector<TPulseIslandID> pulse_list; 00073 modules::parser::Constructor_t event_pulse_request; 00074 std::string error_type; 00075 // Loop over all options 00076 for(modules::options::OptionsList_t::const_iterator i_opt = fOptions->begin(); 00077 i_opt != fOptions->end(); i_opt++){ 00078 // Continue if option is not "all" and not one of the detector names: 00079 if( i_opt->first != "all" && fSetup->GetBankName(i_opt->first)=="") continue; 00080 00081 // Break the list into items 00082 currentList.clear(); 00083 event_list.clear(); 00084 pulse_list.clear(); 00085 num=fOptions->GetVectorStringsByDelimiter(i_opt->first,currentList); 00086 if(num<=0) continue; // no options were actually specified 00087 00088 for(std::vector<std::string>::iterator i_request=currentList.begin(); 00089 i_request!=currentList.end(); 00090 i_request++){ 00091 event_pulse_request=modules::parser::ParseConstructor(*i_request,'(',')'); 00092 // Check things look healthy 00093 if(event_pulse_request.before=="" )error_type="event"; 00094 else if( event_pulse_request.inside=="")error_type="pulse"; 00095 else if( !ParseEventRequest(event_pulse_request.before, event_list)) error_type="event"; 00096 else if( !ParsePulseRequest(event_pulse_request.inside,pulse_list)) error_type="pulse"; 00097 if(error_type != ""){ 00098 cout<<"Skipping badly formatted "<<error_type<<" specification: "<<*i_request<<endl; 00099 cout<<"event="<<event_pulse_request.before<<", pulse="<<event_pulse_request.inside<<endl; 00100 ShowGuidance(); 00101 continue; 00102 } 00103 // Everything is ok so add this request to the list 00104 for(std::vector<EventID_t>::const_iterator i_event=event_list.begin(); 00105 i_event!=event_list.end(); 00106 i_event++){ 00107 for(std::vector<TPulseIslandID>::const_iterator i_pulse=pulse_list.begin(); 00108 i_pulse!=pulse_list.end(); i_pulse++){ 00109 AddToConfigRequestList(*i_event,i_opt->first,*i_pulse); 00110 } 00111 } 00112 } 00113 } 00114 } 00115 return 0; 00116 }
void ExportPulse::ClearPulsesToExport | ( | ) | [private] |
Definition at line 381 of file ExportPulse.cpp.
References fTAPsToPlot, and fTPIsToPlot.
Referenced by ProcessEntry().
00381 { 00382 ChannelPulseIDs_t::iterator i_channel; 00383 for (i_channel=fTPIsToPlot.begin();i_channel!=fTPIsToPlot.end();i_channel++){ 00384 i_channel->second.clear(); 00385 } 00386 fTPIsToPlot.clear(); 00387 fTAPsToPlot.clear(); 00388 }
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(), 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(), PlotTPI(), MakeDetectorPulses::ProcessEntry(), TemplateCreator::ProcessEntry(), PulseCandidateFinder_InvestigateParameters::ProcessEntry(), MakeAnalysedPulses::ProcessEntry(), PulseViewer::ProcessEntry(), PlotTDP_TDiff::ProcessEntry(), and TemplateCreator::StartTemplate().
00071 {return fDebug;};
int ExportPulse::DrawTAPs | ( | ) | [private] |
Draw all TAPs requested for this event.
Definition at line 142 of file ExportPulse.cpp.
References fPulseInfo, fTAPsToPlot, PlotTAP(), SetCurrentDetectorName(), and SetCurrentPulseID().
Referenced by ProcessEntry().
00142 { 00143 // Initialise variables that would be used in the loops 00144 const TAPList_t* requestedPulses; 00145 00146 // Loop over channel that we've been requested to draw a pulse from 00147 for(ChannelTAPs_t::const_iterator i_detector=fTAPsToPlot.begin(); 00148 i_detector!=fTAPsToPlot.end(); 00149 i_detector++){ 00150 SetCurrentDetectorName(i_detector->first); 00151 00152 // Get the pulse list for this channel 00153 requestedPulses=&(i_detector->second); 00154 00155 // Loop over every requested pulse for that channel 00156 for(TAPList_t::const_iterator i_pulse=requestedPulses->begin(); 00157 i_pulse!=requestedPulses->end(); 00158 i_pulse++){ 00159 00160 SetCurrentPulseID((*i_pulse)->GetParentID()); 00161 // Draw the pulse 00162 PlotTAP(*i_pulse,fPulseInfo); 00163 00164 } 00165 } 00166 return 0; 00167 }
int ExportPulse::DrawTPIs | ( | ) | [private] |
Draw all TPIs requested for this event.
Definition at line 171 of file ExportPulse.cpp.
References fPulseInfo, fTPIsToPlot, GetTPIsFromDetector(), PlotTPI(), SetCurrentDetectorName(), and SetCurrentPulseID().
Referenced by ProcessEntry().
00171 { 00172 // Initialise variables that would be used in the loops 00173 TPulseIsland* pulse; 00174 const PulseIDList_t* requestedPulses; 00175 PulseIslandList* pulseList; 00176 00177 // Loop over channel that we've been requested to draw a pulse from 00178 for(ChannelPulseIDs_t::const_iterator i_detector=fTPIsToPlot.begin(); 00179 i_detector!=fTPIsToPlot.end(); 00180 i_detector++){ 00181 SetCurrentDetectorName(i_detector->first); 00182 00183 // Get the pulse list for this channel 00184 requestedPulses=&(i_detector->second); 00185 pulseList=GetTPIsFromDetector(); 00186 00187 // Loop over every requested pulse for that channel 00188 for(PulseIDList_t::const_iterator i_pulseID=requestedPulses->begin(); 00189 i_pulseID!=requestedPulses->end(); 00190 i_pulseID++){ 00191 // Update the pulse info struct 00192 SetCurrentPulseID(*i_pulseID); 00193 00194 // Get the current requested TPI for this channel 00195 try{ 00196 pulse=pulseList->at(*i_pulseID); 00197 } 00198 catch(const std::out_of_range& oor){ 00199 cout<<"Skipping out of range pulse: "<<*i_pulseID<<" on detector '"<<i_detector->first<<endl; 00200 continue; 00201 } 00202 00203 // Draw the pulse 00204 PlotTPI(pulse,fPulseInfo); 00205 } 00206 } 00207 return 0; 00208 }
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;};
std::string ExportPulse::GetCurrentBankName | ( | ) | const [inline, private] |
Definition at line 107 of file ExportPulse.h.
References ExportPulse::PulseInfo_t::bankname, and fPulseInfo.
Referenced by GetTPIsFromDetector().
00107 {return fPulseInfo.bankname;};
Long64_t ExportPulse::GetCurrentEventNumber | ( | ) | const [inline, private] |
Definition at line 106 of file ExportPulse.h.
References ExportPulse::PulseInfo_t::event, and fPulseInfo.
Referenced by LoadPulsesRequestedByConfig().
00106 {return fPulseInfo.event;};
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(), 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();};
Long64_t ExportPulse::GetTotalNumberOfEvents | ( | ) | const [inline, private] |
Definition at line 108 of file ExportPulse.h.
References fTotalEvents.
Referenced by ParseEventRequest(), and ParsePulseRequest().
00108 {return fTotalEvents;};
PulseIslandList * ExportPulse::GetTPIsFromDetector | ( | std::string | bank = "" |
) | [private] |
Get a pointer to the list of TPIs for a given detector.
Definition at line 302 of file ExportPulse.cpp.
References fGlobalData, TGlobalData::fPulseIslandToChannelMap, and GetCurrentBankName().
Referenced by DrawTPIs().
00302 { 00303 if(bank=="") bank=this->GetCurrentBankName(); 00304 return &fGlobalData->fPulseIslandToChannelMap[bank]; 00305 }
ExportPulse * ExportPulse::Instance | ( | ) | [inline, static] |
Static method to get the instance of ExportPulse.
if(ExportPulse::Instance()){ // now we know it's safe, you can do something with this module ExportPulse::Instance()->AddToExportList(channel,0); }
Definition at line 141 of file ExportPulse.h.
Referenced by PulseViewer::BeforeFirstEntry(), BeforeFirstEntry(), PulseViewer::ConsiderDrawing(), GaussFitAPGenerator::ProcessPulses(), and SetCurrentDetectorName().
00141 { 00142 return modules::navigator::Instance()->GetModule<ExportPulse>("ExportPulse"); 00143 }
void ExportPulse::LoadPulsesRequestedByConfig | ( | ) | [private] |
Definition at line 361 of file ExportPulse.cpp.
References AddToExportList(), fRequestedByConfig, and GetCurrentEventNumber().
Referenced by ProcessEntry().
00361 { 00362 // 7) In Process entry, invoke a method to check if there were requested or a pulse on a channel in this event 00363 // and load them into fTPIsToPlot; 00364 00365 for(EventChannelPulseIDs_t::iterator i_channel=fRequestedByConfig.begin(); 00366 i_channel!=fRequestedByConfig.end(); i_channel++){ 00367 EventPulseIDList_t::iterator i_event=i_channel->second.find(GetCurrentEventNumber()); 00368 if(i_event!=i_channel->second.end()){ 00369 for(PulseIDList_t::const_iterator i_pulse=i_event->second.begin(); 00370 i_pulse!=i_event->second.end(); i_pulse++){ 00371 AddToExportList(i_channel->first,*i_pulse); 00372 } 00373 } 00374 } 00375 00376 // Check if all channels were requested 00377 }
TH1F * ExportPulse::MakeHistTPI | ( | const TPulseIsland * | pulse, | |
const std::string & | name, | |||
int | shift = 0 , |
|||
int | samples = 0 | |||
) | const [private] |
Definition at line 273 of file ExportPulse.cpp.
References TPulseIsland::GetPulseLength(), and TPulseIsland::GetSamples().
Referenced by PlotTPI().
00273 { 00274 00275 size_t num_samples = samples? samples: pulse->GetPulseLength(); 00276 double min=0; 00277 double max= num_samples; 00278 TH1F* hPulse = new TH1F(name.c_str(), name.c_str(), num_samples,min,max); 00279 hPulse->SetDirectory(0); 00280 00281 //double pedestal_error = SetupNavigator::Instance()->GetNoise(IDs::channel(info.detname)); 00282 size_t bin=0; 00283 for ( size_t i=0;i <(size_t)pulse->GetPulseLength(); ++i) { 00284 bin=i+1+shift; 00285 hPulse->SetBinContent(bin, pulse->GetSamples().at(i)); 00286 hPulse->SetBinError(bin, 0);//pedestal_error); 00287 } 00288 return hPulse; 00289 }
bool ExportPulse::ParseEventRequest | ( | std::string | input, | |
std::vector< EventID_t > & | event_list | |||
) | [private] |
Definition at line 322 of file ExportPulse.cpp.
References GetTotalNumberOfEvents(), and ParseRequest().
Referenced by BeforeFirstEntry().
00323 { 00324 return ParseRequest(input,event_list,"event",0, GetTotalNumberOfEvents()); 00325 }
bool ExportPulse::ParsePulseRequest | ( | std::string | input, | |
std::vector< EventID_t > & | list | |||
) | [private] |
Definition at line 329 of file ExportPulse.cpp.
References GetTotalNumberOfEvents(), and ParseRequest().
Referenced by BeforeFirstEntry().
00330 { 00331 return ParseRequest(input,list,"pulse",0, GetTotalNumberOfEvents()); 00332 }
bool ExportPulse::ParseRequest | ( | std::string | input, | |
std::vector< EventID_t > & | list, | |||
const std::string & | type, | |||
Long64_t | lower_limit, | |||
Long64_t | upper_limit | |||
) | [private] |
Definition at line 336 of file ExportPulse.cpp.
References modules::parser::GetNumber(), modules::parser::IsNumber(), and modules::parser::RemoveWhitespace().
Referenced by ParseEventRequest(), and ParsePulseRequest().
00337 { 00338 // Strip all whitespace 00339 modules::parser::RemoveWhitespace(input); 00340 00341 // Check if input string contains a number, 00342 if(modules::parser::IsNumber(input)){ 00343 int event = modules::parser::GetNumber(input); 00344 if (event >=lower_limit && event < upper_limit ){ 00345 list.push_back(event); 00346 } else { 00347 cout<<"Requested "<<type<<", "<<event<<" is out of range."<<endl; 00348 cout<<"Acceptable values are: ["<<lower_limit<<","<<upper_limit<<"[."<<endl; 00349 return false; 00350 } 00351 return true; 00352 } 00353 // Future Ideas: 00354 // Check if input contains a range, 00355 // Check if input contains a random request 00356 return false; 00357 }
int ExportPulse::PlotTAP | ( | const TAnalysedPulse * | pulse, | |
const PulseInfo_t & | info | |||
) | const [private] |
Plot a single TAP.
Definition at line 293 of file ExportPulse.cpp.
References TAnalysedPulse::Draw(), fTPIDirectory, and ExportPulse::PulseInfo_t::MakeTPIName().
Referenced by DrawTAPs().
00293 { 00294 std::string hist=info.MakeTPIName(); 00295 TH1F* tpi_hist=NULL; 00296 fTPIDirectory->GetObject(hist.c_str(),tpi_hist); 00297 pulse->Draw(tpi_hist); 00298 return 0; 00299 }
int ExportPulse::PlotTPI | ( | const TPulseIsland * | pulse, | |
const PulseInfo_t & | info | |||
) | [private] |
Plot a single TPI.
Definition at line 224 of file ExportPulse.cpp.
References ExportPulse::PulseInfo_t::bankname, BaseModule::Debug(), ExportPulse::PulseInfo_t::detname, ExportPulse::PulseInfo_t::event, PulseCandidateFinder::FindPulseCandidates(), fPulseFinder, fSubPulses, fTPIDirectory, fUsePCF, PulseCandidateFinder::GetPulseCandidates(), TPulseIsland::GetPulseLength(), TPulseIsland::GetTimeStamp(), MakeHistTPI(), ExportPulse::PulseInfo_t::MakeTPIName(), and ExportPulse::PulseInfo_t::pulseID.
Referenced by DrawTPIs().
00224 { 00225 00226 std::string hist=info.MakeTPIName(); 00227 00228 std::stringstream title; 00229 title << "Pulse " << info.pulseID; 00230 title << " from event " << info.event; 00231 title << " on detector " << info.detname; 00232 title << " (" << info.bankname<<")"; 00233 00234 // Print some stuff if wanted 00235 if(Debug()){ 00236 cout<<"Plotting "<<title.str()<<"' ["<<hist<<"]"<<endl; 00237 } 00238 00239 TH1F* fullPulse=MakeHistTPI(pulse,hist); 00240 fullPulse->SetDirectory(fTPIDirectory); 00241 fullPulse->SetTitle(title.str().c_str()); 00242 00243 if(fUsePCF){ 00244 // don't save the original 00245 fullPulse->SetDirectory(0); 00246 00247 // make the stack 00248 THStack* stack=new THStack((hist+"_pulse_candidates").c_str(),title.str().c_str()); 00249 stack->Add(fullPulse); 00250 00251 fPulseFinder->FindPulseCandidates(pulse); 00252 fPulseFinder->GetPulseCandidates(fSubPulses); 00253 for(PulseIslandList::const_iterator i_tpi=fSubPulses.begin(); i_tpi!=fSubPulses.end(); ++i_tpi){ 00254 if((*i_tpi)->GetPulseLength() < 14) continue; 00255 00256 int shift=(*i_tpi)->GetTimeStamp()-pulse->GetTimeStamp(); 00257 TH1F* sub_pulse=MakeHistTPI(*i_tpi,"sub_pulse",shift,pulse->GetPulseLength()); 00258 sub_pulse->SetFillColor(kMagenta); 00259 // need to subtract found pulse from full pulse else THStack 00260 // superposes the two regions 00261 fullPulse->Add(sub_pulse,-1); 00262 stack->Add(sub_pulse); 00263 } 00264 00265 // Save the stack 00266 fTPIDirectory->Add(stack); 00267 } 00268 00269 return 0; 00270 }
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 ExportPulse::ProcessEntry | ( | TGlobalData * | gData, | |
const TSetupData * | gSetup | |||
) | [private, virtual] |
Plot all pulses that we were asked to draw for this event.
First loads pulses requested by the config file, then draws all TPIs, then draw all TAPs.
Implements BaseModule.
Definition at line 120 of file ExportPulse.cpp.
References ClearPulsesToExport(), DrawTAPs(), DrawTPIs(), fGlobalData, fTAPDirectory, fTPIDirectory, EventNavigator::Instance(), LoadPulsesRequestedByConfig(), and SetCurrentEventNumber().
00120 { 00121 // To be corrected once Phill finishes the event navigator 00122 fGlobalData=gData; 00123 SetCurrentEventNumber(EventNavigator::Instance().EntryNo()); 00124 00125 // Check if we have any pulses to draw that were requested through the MODULEs file 00126 LoadPulsesRequestedByConfig(); 00127 00128 fTPIDirectory->cd(); 00129 int ret_val=DrawTPIs(); 00130 if(ret_val!=0) return ret_val; 00131 00132 fTAPDirectory->cd(); 00133 ret_val=DrawTAPs(); 00134 if(ret_val!=0) return ret_val; 00135 00136 ClearPulsesToExport(); 00137 return 0; 00138 }
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;};
void ExportPulse::SetCurrentDetectorName | ( | const std::string & | detector | ) | [inline, private] |
Definition at line 160 of file ExportPulse.h.
References ExportPulse::PulseInfo_t::bankname, ExportPulse::PulseInfo_t::detname, fClockTick, fPulseFinder, fPulseInfo, fSetup, fTimeShift, TSetupData::GetBankName(), Instance(), and PulseCandidateFinder::SetChannel().
Referenced by DrawTAPs(), and DrawTPIs().
00160 { 00161 fPulseInfo.detname=detector; 00162 fPulseInfo.bankname=fSetup->GetBankName(detector); 00163 fClockTick = TSetupData::Instance()->GetClockTick(fPulseInfo.bankname); 00164 fTimeShift = TSetupData::Instance()->GetTimeShift(fPulseInfo.bankname); 00165 if(fPulseFinder) fPulseFinder->SetChannel(detector); 00166 }
void ExportPulse::SetCurrentEventNumber | ( | const Long64_t & | num | ) | [inline, private] |
Definition at line 103 of file ExportPulse.h.
References ExportPulse::PulseInfo_t::event, and fPulseInfo.
Referenced by ProcessEntry().
00103 {fPulseInfo.event=num;};
void ExportPulse::SetCurrentPulseID | ( | const TPulseIslandID & | id | ) | [inline, private] |
Definition at line 102 of file ExportPulse.h.
References fPulseInfo, and ExportPulse::PulseInfo_t::pulseID.
Referenced by DrawTAPs(), and DrawTPIs().
00102 {fPulseInfo.pulseID=id;};
void ExportPulse::ShowGuidance | ( | ) | [private] |
Definition at line 309 of file ExportPulse.cpp.
References fGuidanceShown.
Referenced by BeforeFirstEntry().
00310 { 00311 // Only show guidance once 00312 if(fGuidanceShown) return; 00313 fGuidanceShown=true; 00314 cout<<"Requests to draw a pulse should be formatted as event(pulse),"<<endl; 00315 cout<<" where event and pulse are the numbers of each event and pulse you wish to draw"<<endl; 00316 //", a range (specified by A-Z, where A and Z are the first and last value of the range)," 00317 //" or a number of random events to select (specified by ~N where N is the number of events)"; 00318 }
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().
double ExportPulse::fClockTick [private] |
Definition at line 123 of file ExportPulse.h.
Referenced by SetCurrentDetectorName().
TGlobalData* ExportPulse::fGlobalData [private] |
Definition at line 137 of file ExportPulse.h.
Referenced by GetTPIsFromDetector(), and ProcessEntry().
bool ExportPulse::fGuidanceShown [private] |
Definition at line 121 of file ExportPulse.h.
Referenced by ShowGuidance().
modules::options* ExportPulse::fOptions [private] |
Definition at line 130 of file ExportPulse.h.
Referenced by BeforeFirstEntry().
PulseCandidateFinder* ExportPulse::fPulseFinder [private] |
Definition at line 132 of file ExportPulse.h.
Referenced by ExportPulse(), PlotTPI(), and SetCurrentDetectorName().
PulseInfo_t ExportPulse::fPulseInfo [private] |
Definition at line 128 of file ExportPulse.h.
Referenced by DrawTAPs(), DrawTPIs(), ExportPulse(), GetCurrentBankName(), GetCurrentEventNumber(), SetCurrentDetectorName(), SetCurrentEventNumber(), and SetCurrentPulseID().
Definition at line 127 of file ExportPulse.h.
Referenced by AddToConfigRequestList(), and LoadPulsesRequestedByConfig().
const TSetupData* ExportPulse::fSetup [private] |
Reimplemented from BaseModule.
Definition at line 129 of file ExportPulse.h.
Referenced by BeforeFirstEntry(), and SetCurrentDetectorName().
PulseIslandList ExportPulse::fSubPulses [private] |
Definition at line 133 of file ExportPulse.h.
Referenced by PlotTPI().
TDirectory* ExportPulse::fTAPDirectory [private] |
Definition at line 135 of file ExportPulse.h.
Referenced by ExportPulse(), and ProcessEntry().
ChannelTAPs_t ExportPulse::fTAPsToPlot [private] |
Definition at line 126 of file ExportPulse.h.
Referenced by AddToExportList(), ClearPulsesToExport(), and DrawTAPs().
double ExportPulse::fTimeShift [private] |
Definition at line 124 of file ExportPulse.h.
Referenced by SetCurrentDetectorName().
Long64_t ExportPulse::fTotalEvents [private] |
Definition at line 122 of file ExportPulse.h.
Referenced by BeforeFirstEntry(), and GetTotalNumberOfEvents().
TDirectory* ExportPulse::fTPIDirectory [private] |
Definition at line 134 of file ExportPulse.h.
Referenced by ExportPulse(), PlotTAP(), PlotTPI(), and ProcessEntry().
ChannelPulseIDs_t ExportPulse::fTPIsToPlot [private] |
Definition at line 125 of file ExportPulse.h.
Referenced by AddToExportList(), ClearPulsesToExport(), and DrawTPIs().
bool ExportPulse::fUsePCF [private] |
Definition at line 131 of file ExportPulse.h.
Referenced by ExportPulse(), and PlotTPI().