#include <TemplateCreator.h>
Classes | |
struct | ChannelSet |
Public Member Functions | |
TemplateCreator (modules::options *opts) | |
~TemplateCreator () | |
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::vector< ChannelSet > | ChannelList |
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) |
void | AddPulseToTemplate (ChannelSet ¤t, TH1D *&hPulse) |
double | CorrectSampleValue (double old_value, double template_pedestal) |
Corrects a given sample value. | |
TH1D * | CreateRefinedPulseHistogram (const TPulseIsland *pulse, std::string histname, std::string histtitle, bool interpolate) |
Creates a refined histogram for a given TPulseIsland. | |
bool | CheckConvergence (ChannelSet ¤t) |
Checks if the template has converged and that adding a new pulse has not effect on the template Returns: true if converged. | |
int | HasPulseOverflowed (const TPulseIsland *pulse, const std::string &bankname) |
Check if any part of the pulse' waveform has ADC overflow. | |
TH1D * | StartTemplate (int pulseID, const TPulseIsland *pulse, const std::string &detname) |
Init the template using the first valid pulse. | |
Private Attributes | |
int | fRefineFactor |
The factor that we scale the number of bins in the template histogram by. | |
TemplateFitter * | fTemplateFitter |
modules::options * | fOpts |
Store the options for use in ProcessEntry. | |
std::string | fArchiveName |
TemplateArchive * | fTemplateArchive |
bool | fPulseDebug |
If true, then print out all pulses that get added to the templates and also print out certain templates as we go along. | |
bool | fAnalyseAllChannels |
ChannelList | fChannels |
std::vector< std::string > | fRequestedChannels |
bool | fCutIntegralRatio |
double | fIntegralMax |
double | fIntegralMin |
double | fIntegralRatioMax |
double | fIntegralRatioMin |
int | fStartIntegral |
int | fStopIntegral |
int | fStartTail |
Definition at line 17 of file TemplateCreator.h.
typedef std::vector<ChannelSet> TemplateCreator::ChannelList [private] |
Definition at line 33 of file TemplateCreator.h.
TemplateCreator::TemplateCreator | ( | modules::options * | opts | ) |
Definition at line 22 of file TemplateCreator.cpp.
References fAnalyseAllChannels, fArchiveName, fCutIntegralRatio, fIntegralMax, fIntegralMin, fIntegralRatioMax, fIntegralRatioMin, fPulseDebug, fRefineFactor, fRequestedChannels, modules::options::GetBool(), modules::options::GetDouble(), modules::options::GetInt(), modules::options::GetString(), and modules::options::GetVectorStringsByDelimiter().
00022 : 00023 BaseModule("TemplateCreator",opts), fOpts(opts), 00024 fPulseDebug(false), fAnalyseAllChannels(false) 00025 { 00026 fRefineFactor = opts->GetInt("refine_factor", 5); 00027 fPulseDebug = opts->GetBool("pulse_debug", false); 00028 opts->GetVectorStringsByDelimiter("channels",fRequestedChannels); 00029 fArchiveName=opts->GetString("file_name","templates.root"); 00030 if(fRequestedChannels.empty()) fAnalyseAllChannels=true; 00031 00032 // Prepare integral ratio cuts 00033 fCutIntegralRatio=opts->GetBool("use_IR_cut",false); 00034 if(fCutIntegralRatio){ 00035 fIntegralMax=opts->GetDouble("max_integral"); 00036 fIntegralMin=opts->GetDouble("min_integral"); 00037 fIntegralRatioMax=opts->GetDouble("max_ratio"); 00038 fIntegralRatioMin=opts->GetDouble("min_ratio"); 00039 } 00040 00041 }
TemplateCreator::~TemplateCreator | ( | ) |
delete fTemplateArchive; fChannels.clear();
Definition at line 43 of file TemplateCreator.cpp.
void TemplateCreator::AddPulseToTemplate | ( | ChannelSet & | current, | |
TH1D *& | hPulse | |||
) | [private] |
int TemplateCreator::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 272 of file TemplateCreator.cpp.
References fChannels, fTemplateArchive, BaseModule::GetDirectory(), and TemplateArchive::SaveTemplate().
00272 { 00273 00274 // Print to stdout the percentage of successful fit for each channel 00275 for(ChannelList::iterator i_ch=fChannels.begin(); i_ch!=fChannels.end(); ++i_ch){ 00276 00277 if (i_ch->template_pulse->Empty()) { // if there's no template been created for this channel 00278 continue; 00279 } 00280 00281 cout << "TemplateCreator: " << i_ch->detname 00282 << ": " << i_ch->fit_attempts << " fits attempted with " 00283 << i_ch->fit_successes << " successful (" 00284 << ((double)i_ch->fit_successes/(double)i_ch->fit_attempts)*100 << "%)" << endl; 00285 00286 // Normalise the templates 00287 //i_ch->template_pulse->NormaliseToAmplitude(); 00288 i_ch->template_pulse->AddToDirectory(GetDirectory("../"), GetDirectory()); 00289 00290 // Save the template to the file 00291 fTemplateArchive->SaveTemplate(i_ch->template_pulse); 00292 00293 // tidy up 00294 i_ch->Clear(); 00295 } 00296 00297 return 0; 00298 }
int TemplateCreator::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 81 of file TemplateCreator.cpp.
References BaseModule::Debug(), fAnalyseAllChannels, fArchiveName, fChannels, fOpts, TGlobalData::fPulseIslandToChannelMap, fRefineFactor, fRequestedChannels, fTemplateArchive, TSetupData::GetDetectorName(), BaseModule::GetDirectory(), TSetupData::Instance(), and EventNavigator::Instance().
00081 { 00082 00083 // Prepare the template archive 00084 if(fArchiveName==EventNavigator::Instance().GetOutputFileName()){ 00085 fTemplateArchive = new TemplateArchive(GetDirectory()); 00086 } else{ 00087 fTemplateArchive = new TemplateArchive(fArchiveName.c_str(), "RECREATE"); 00088 } 00089 00090 // Set all the converged statuses to false 00091 StringPulseIslandMap::const_iterator it; 00092 for(it = gData->fPulseIslandToChannelMap.begin(); it != gData->fPulseIslandToChannelMap.end(); ++it){ 00093 const std::string bankname = it->first; 00094 const std::string detname = TSetupData::Instance()->GetDetectorName(bankname); 00095 if(!fAnalyseAllChannels && 00096 std::find(fRequestedChannels.begin(), fRequestedChannels.end(), detname) 00097 ==fRequestedChannels.end()) { 00098 continue; 00099 } 00100 if(Debug()) cout<<"TemplateCreator::BeforeFirstEntry: Will make template for '"<<detname<<"'"<<endl; 00101 00102 fChannels.push_back(ChannelSet(detname,bankname,fOpts,fRefineFactor)); 00103 } 00104 return 0; 00105 }
bool TemplateCreator::CheckConvergence | ( | ChannelSet & | current | ) | [private] |
Checks if the template has converged and that adding a new pulse has not effect on the template Returns: true if converged.
double TemplateCreator::CorrectSampleValue | ( | double | old_value, | |
double | template_pedestal | |||
) | [private] |
Corrects a given sample value.
TH1D* TemplateCreator::CreateRefinedPulseHistogram | ( | const TPulseIsland * | pulse, | |
std::string | histname, | |||
std::string | histtitle, | |||
bool | interpolate | |||
) | [inline, private] |
Creates a refined histogram for a given TPulseIsland.
Definition at line 52 of file TemplateCreator.h.
References fRefineFactor, and functions::InterpolatePulse().
Referenced by ProcessEntry(), and StartTemplate().
00052 { 00053 return InterpolatePulse(pulse,histname,histtitle, interpolate, fRefineFactor); 00054 }
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(), 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(), ProcessEntry(), PulseCandidateFinder_InvestigateParameters::ProcessEntry(), MakeAnalysedPulses::ProcessEntry(), PulseViewer::ProcessEntry(), PlotTDP_TDiff::ProcessEntry(), and 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 AfterLastEntry(), SavePulses::AfterLastEntry(), BeforeFirstEntry(), PlotTDPs::BeforeFirstEntry(), ExportPulse::ExportPulse(), and 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 TemplateCreator::HasPulseOverflowed | ( | const TPulseIsland * | pulse, | |
const std::string & | bankname | |||
) | [private] |
Check if any part of the pulse' waveform has ADC overflow.
Definition at line 300 of file TemplateCreator.cpp.
References TSetupData::GetNBits(), and TSetupData::Instance().
Referenced by ProcessEntry().
00300 { 00301 // Get the samples so we can check for digitiser overflow 00302 const std::vector<int>& theSamples = (pulse)->GetSamples(); 00303 int n_samples = theSamples.size(); 00304 00305 // Calculate the maximum ADC value for this digitiser 00306 int n_bits = TSetupData::Instance()->GetNBits(bankname); 00307 double max_adc_value = std::pow(2, n_bits); 00308 00309 for (int i = 0; i < n_samples; ++i) { 00310 int sample_value = theSamples.at(i); 00311 if (sample_value >= max_adc_value-1 && sample_value <= max_adc_value+1) { 00312 return 1; 00313 } 00314 else if (sample_value == 0) { 00315 return -1; 00316 } 00317 } 00318 // no under or overflow 00319 return 0; 00320 }
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 TemplateCreator::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 109 of file TemplateCreator.cpp.
References CreateRefinedPulseHistogram(), BaseModule::Debug(), definitions::DefaultValue, fChannels, fCutIntegralRatio, fPulseDebug, TGlobalData::fPulseIslandToChannelMap, fTemplateFitter, TemplateFitter::GetAmplitudeScaleFactor(), BaseModule::GetDirectory(), TemplateFitter::GetPedestalOffset(), TemplateFitter::GetTimeOffset(), HasPulseOverflowed(), TSetupData::Instance(), and StartTemplate().
00109 { 00110 00111 // Loop over each detector 00112 unsigned no_converged=0; 00113 for(ChannelList::iterator i_ch=fChannels.begin(); i_ch!=fChannels.end(); ++i_ch){ 00114 00115 // See if we already have a converged template for this detector 00116 if (i_ch->template_pulse->HasConverged()) { 00117 no_converged++; 00118 continue; 00119 } 00120 00121 // Get the bank and detector names for this detector 00122 const std::string& bankname = i_ch->bankname; 00123 const std::string& detname = i_ch->detname; 00124 const PulseIslandList& thePulseIslands= gData->fPulseIslandToChannelMap.at(bankname); 00125 fTemplateFitter=i_ch->fitter; 00126 00127 // Get the TPIs 00128 if (thePulseIslands.size() == 0) continue; // no pulses here.. 00129 00130 // Loop through all the pulses 00131 for (PulseIslandList::const_iterator pulseIter = thePulseIslands.begin(); 00132 pulseIter != thePulseIslands.end(); ++pulseIter) { 00133 00134 TPulseIsland* pulse = *pulseIter; 00135 00136 if(i_ch->pulse_finder){ 00137 // First we will see how many candidate pulses there are on the TPI 00138 i_ch->pulse_finder->FindPulseCandidates(pulse); 00139 int n_pulse_candidates = i_ch->pulse_finder->GetNPulseCandidates(); 00140 00141 // only continue if there is one pulse candidate on the TPI 00142 if (n_pulse_candidates != 1) continue; 00143 } 00144 00145 if(fCutIntegralRatio){ 00146 try{ 00147 (*i_ch->integralRatio)(pulse); 00148 }catch(std::out_of_range& e){ 00149 continue; 00150 } 00151 const double& integral=i_ch->integralRatio->GetTotal(); 00152 const double& ratio=i_ch->integralRatio->GetRatio(); 00153 if( fIntegralMax < integral || fIntegralMin > integral 00154 || fIntegralRatioMax < ratio || fIntegralRatioMin > ratio) { 00155 continue; 00156 } 00157 } 00158 00159 // Loop through the samples and check for digitizer overflow 00160 int over_under_flow=HasPulseOverflowed(pulse,i_ch->bankname); 00161 if(over_under_flow!=0){ 00162 if (Debug()) { 00163 cout << "TemplateCreator: Pulse #" << pulseIter - thePulseIslands.begin() << " has "; 00164 if(over_under_flow>0) cout << "overflowed"; 00165 else cout<<"undeflowed"; 00166 cout <<" the digitizer and won't be added to the template" << endl; 00167 } 00168 continue; // skip this pulse 00169 } 00170 00171 // Add the first pulse directly to the template (although we may try and choose a random pulse to start with) 00172 if (i_ch->template_pulse->Empty()) { 00173 // Create the refined pulse waveform 00174 int pulseID=pulseIter- thePulseIslands.begin(); 00175 TH1D* tpl=StartTemplate(pulseID, pulse,i_ch->detname); 00176 if(tpl) i_ch->template_pulse->Initialize(pulseID,tpl,GetDirectory()); 00177 continue; 00178 } 00179 00180 00181 // Create the refined pulse waveform 00182 TH1D* hPulseToFit = CreateRefinedPulseHistogram(pulse, "hPulseToFit", "hPulseToFit", false); 00183 00184 // all the other pulses will be fitted to the template and then added to it 00185 // Get some initial estimates for the fitter 00186 double template_amplitude = i_ch->template_pulse->GetAmplitude(); 00187 double template_time = i_ch->template_pulse->GetTime(); 00188 00189 double pulse_pedestal = hPulseToFit->GetBinContent(1); 00190 double pulse_amplitude = definitions::DefaultValue; 00191 double pulse_time = definitions::DefaultValue; 00192 00193 // now we're dealing with actual pulses since we subtract the template_pedestal in the transformation 00194 double pedestal_offset_estimate = pulse_pedestal; 00195 double amplitude_scale_factor_estimate = definitions::DefaultValue; 00196 double time_offset_estimate = definitions::DefaultValue; 00197 00198 // Define the values to scale and shift things by 00199 if (TSetupData::Instance()->GetTriggerPolarity(bankname) >0) { 00200 pulse_amplitude = (hPulseToFit->GetMaximum() - pulse_pedestal); 00201 pulse_time = hPulseToFit->GetMaximumBin() - 1; 00202 } 00203 else if (TSetupData::Instance()->GetTriggerPolarity(bankname) <0) { 00204 pulse_amplitude = (pulse_pedestal - hPulseToFit->GetMinimum()); 00205 pulse_time = hPulseToFit->GetMinimumBin() - 1; // go from bin numbering (1, n_samples) to clock ticks (0, n_samples-1) 00206 } 00207 amplitude_scale_factor_estimate = pulse_amplitude / template_amplitude; // estimated scale factor 00208 time_offset_estimate = pulse_time - template_time; 00209 00210 i_ch->fitter->SetInitialParameterEstimates(pedestal_offset_estimate, amplitude_scale_factor_estimate, time_offset_estimate); 00211 00212 int fit_status = i_ch->fitter->FitPulseToTemplate(i_ch->template_pulse, hPulseToFit, bankname); 00213 ++i_ch->fit_attempts; 00214 if (fit_status != 0) { 00215 if (Debug()) { 00216 std::cout << "TemplateCreator: Problem with fit (status = " << fit_status << ")" << std::endl; 00217 } 00218 delete hPulseToFit; // delete this here since it is no longer needed 00219 continue; 00220 } 00221 ++i_ch->fit_successes; 00222 00223 if (Debug()) { 00224 cout << "Template Creator: Fitted Parameters: PedOffset = " 00225 << i_ch->fitter->GetPedestalOffset() << ", AmpScaleFactor = " 00226 << i_ch->fitter->GetAmplitudeScaleFactor() << ", TimeOffset = " 00227 << i_ch->fitter->GetTimeOffset() << ", Chi2 = " 00228 << i_ch->fitter->GetChi2() << ", NDoF = " 00229 << i_ch->fitter->GetNDoF() << ", Prob = " 00230 << TMath::Prob(i_ch->fitter->GetChi2(), i_ch->fitter->GetNDoF()) << std::endl << std::endl; 00231 } 00232 00233 if (fPulseDebug) { 00234 // Print out some templates as we go along 00235 if (i_ch->template_pulse->PulsesMerged() <= 10 00236 || ( i_ch->template_pulse->PulsesMerged() <= 100 00237 && i_ch->template_pulse->PulsesMerged()%10 == 0) 00238 || ( i_ch->template_pulse->PulsesMerged()%100 == 0) ) { 00239 std::stringstream newhistname; 00240 newhistname << "hTemplate_" << i_ch->template_pulse->PulsesMerged() << "Pulses_" << detname; 00241 i_ch->template_pulse->Clone(newhistname.str().c_str()); 00242 } 00243 } 00244 00245 // Add the pulse to the template (we'll do correct the sample values there) 00246 i_ch->template_pulse->AddPulse( 00247 fTemplateFitter->GetTimeOffset(), 00248 fTemplateFitter->GetAmplitudeScaleFactor(), 00249 fTemplateFitter->GetPedestalOffset(), 00250 hPulseToFit); 00251 00252 // we keep on adding pulses until adding pulses has no effect on the template 00253 if (i_ch->template_pulse->CheckConverged()) { 00254 cout << "TemplateCreator: " << detname << " template terminated containing " 00255 << i_ch->template_pulse->PulsesMerged() <<" pulses "<< std::endl; 00256 break; // break from the for loop 00257 } 00258 } // end for loop over TPIs 00259 } //end for loop through channels 00260 00261 if(no_converged==fChannels.size()){ 00262 cout<<"All channels converged so end run"<<endl; 00263 return -1; 00264 } 00265 00266 return 0; 00267 }
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;};
TH1D * TemplateCreator::StartTemplate | ( | int | pulseID, | |
const TPulseIsland * | pulse, | |||
const std::string & | detname | |||
) | [private] |
Init the template using the first valid pulse.
Definition at line 322 of file TemplateCreator.cpp.
References CreateRefinedPulseHistogram(), BaseModule::Debug(), TPulseIsland::GetPeakSample(), and TPulseIsland::GetSamples().
Referenced by ProcessEntry().
00322 { 00323 00324 // check this pulse is safely within the waveform 00325 int pulse_length = pulse->GetSamples().size(); 00326 if (pulse->GetPeakSample() >= pulse_length - pulse_length/5.0) { 00327 if (Debug()) { 00328 cout << "TemplateCreator: Pulse #" << pulseID 00329 << " is too close to one end of the island and so won't be used as " 00330 "the first pulse in the template." << endl; 00331 } 00332 return NULL; 00333 } 00334 if (Debug()) { 00335 cout << "TemplateCreator: Adding " << detname << " Pulse #" 00336 << pulseID << " directly to the template" << endl; 00337 } 00338 00339 std::string histname = "hTemplate_" + detname; 00340 std::string histtitle = "Template Histogram for the " + detname + " channel"; 00341 return CreateRefinedPulseHistogram(pulse, histname.c_str(), histtitle.c_str(), true); 00342 }
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().
bool TemplateCreator::fAnalyseAllChannels [private] |
Definition at line 86 of file TemplateCreator.h.
Referenced by BeforeFirstEntry(), and TemplateCreator().
std::string TemplateCreator::fArchiveName [private] |
Definition at line 79 of file TemplateCreator.h.
Referenced by BeforeFirstEntry(), and TemplateCreator().
ChannelList TemplateCreator::fChannels [private] |
Definition at line 87 of file TemplateCreator.h.
Referenced by AfterLastEntry(), BeforeFirstEntry(), and ProcessEntry().
bool TemplateCreator::fCutIntegralRatio [private] |
Definition at line 90 of file TemplateCreator.h.
Referenced by ProcessEntry(), and TemplateCreator().
double TemplateCreator::fIntegralMax [private] |
Definition at line 91 of file TemplateCreator.h.
Referenced by TemplateCreator().
double TemplateCreator::fIntegralMin [private] |
Definition at line 91 of file TemplateCreator.h.
Referenced by TemplateCreator().
double TemplateCreator::fIntegralRatioMax [private] |
Definition at line 92 of file TemplateCreator.h.
Referenced by TemplateCreator().
double TemplateCreator::fIntegralRatioMin [private] |
Definition at line 92 of file TemplateCreator.h.
Referenced by TemplateCreator().
modules::options* TemplateCreator::fOpts [private] |
Store the options for use in ProcessEntry.
Definition at line 77 of file TemplateCreator.h.
Referenced by BeforeFirstEntry().
bool TemplateCreator::fPulseDebug [private] |
If true, then print out all pulses that get added to the templates and also print out certain templates as we go along.
Definition at line 85 of file TemplateCreator.h.
Referenced by ProcessEntry(), and TemplateCreator().
int TemplateCreator::fRefineFactor [private] |
The factor that we scale the number of bins in the template histogram by.
Definition at line 73 of file TemplateCreator.h.
Referenced by BeforeFirstEntry(), CreateRefinedPulseHistogram(), and TemplateCreator().
std::vector<std::string> TemplateCreator::fRequestedChannels [private] |
Definition at line 88 of file TemplateCreator.h.
Referenced by BeforeFirstEntry(), and TemplateCreator().
int TemplateCreator::fStartIntegral [private] |
Definition at line 93 of file TemplateCreator.h.
int TemplateCreator::fStartTail [private] |
Definition at line 93 of file TemplateCreator.h.
int TemplateCreator::fStopIntegral [private] |
Definition at line 93 of file TemplateCreator.h.
TemplateArchive* TemplateCreator::fTemplateArchive [private] |
Definition at line 80 of file TemplateCreator.h.
Referenced by AfterLastEntry(), and BeforeFirstEntry().
TemplateFitter* TemplateCreator::fTemplateFitter [private] |
Definition at line 75 of file TemplateCreator.h.
Referenced by ProcessEntry().