Produces plots either the sample heights or the sample differences for each TPulseIsland. More...
#include <PulseCandidateFinder_InvestigateParameters.h>
Public Member Functions | |
PulseCandidateFinder_InvestigateParameters (modules::options *opts) | |
The constructor. | |
~PulseCandidateFinder_InvestigateParameters () | |
Empty 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 Member Functions | |
virtual int | ProcessEntry (TGlobalData *gData, const TSetupData *gSetup) |
In every event, we loop over all the detectors and create a ParameterHistogram, then we loop over the TPulseIslands and find the candidate pulses with PulseCandidateFinder::FindPulseCandidates(). Finally, we fill the parameter histogram with either the height of all samples, or the differences between consecutive samples. | |
virtual int | BeforeFirstEntry (TGlobalData *gData, const TSetupData *setup) |
Nothing is done before each run. | |
virtual int | AfterLastEntry (TGlobalData *gData, const TSetupData *setup) |
Nothing done at the end of each run. | |
Private Attributes | |
std::map< std::string, TH2D * > | fParameterHistograms |
The map that we store the parameter histograms for each channel. | |
modules::options * | fOpts |
Store the module options so that they can be passed to the PulseCandidateFinder. |
Produces plots either the sample heights or the sample differences for each TPulseIsland.
This module loops over TPulseIslands and sends them to PulseCandidateFinder::FillParameterHistogram() to plot either the height of the sample above pedestals (if the TPulseIsland is on a slow channel) or the difference between samples (if the TPulseIsland is on a fast channel).
The idea is that we can then look at these histograms to determine the values of the parameters for the PulseCandidateFinder
Definition at line 26 of file PulseCandidateFinder_InvestigateParameters.h.
PulseCandidateFinder_InvestigateParameters::PulseCandidateFinder_InvestigateParameters | ( | modules::options * | opts | ) |
The constructor.
[in] | opts | Describe the options this module takes. |
Definition at line 16 of file PulseCandidateFinder_InvestigateParameters.cpp.
00016 : 00017 BaseModule("PulseCandidateFinder_InvestigateParameters",opts), fOpts(opts){ 00018 00019 }
PulseCandidateFinder_InvestigateParameters::~PulseCandidateFinder_InvestigateParameters | ( | ) |
Empty destructor.
Definition at line 21 of file PulseCandidateFinder_InvestigateParameters.cpp.
int PulseCandidateFinder_InvestigateParameters::AfterLastEntry | ( | TGlobalData * | gData, | |
const TSetupData * | setup | |||
) | [private, virtual] |
Nothing done at the end of each run.
[in] | gData | See BaseModule::AfterLastEntry |
[in] | setup | See BaseModule::AfterLastEntry |
Implements BaseModule.
Definition at line 102 of file PulseCandidateFinder_InvestigateParameters.cpp.
References BaseModule::Debug().
00102 { 00103 00104 // Print extra info if we're debugging this module: 00105 if(Debug()){ 00106 cout<<"-----PulseCandidateFinder_InvestigateParameters::AfterLastEntry(): I'm debugging!"<<endl; 00107 } 00108 return 0; 00109 }
int PulseCandidateFinder_InvestigateParameters::BeforeFirstEntry | ( | TGlobalData * | gData, | |
const TSetupData * | setup | |||
) | [private, virtual] |
Nothing is done before each run.
[in] | gData | See BaseModule::BeforeFirstEntry |
[in] | setup | See BaseModule::BeforeFirstEntry |
Implements BaseModule.
Definition at line 27 of file PulseCandidateFinder_InvestigateParameters.cpp.
References BaseModule::Debug().
00027 { 00028 // Print extra info if we're debugging this module: 00029 if(Debug()){ 00030 cout<<"-----PulseCandidateFinder_InvestigateParameters::BeforeFirstEntry(): I'm debugging!"<<endl; 00031 } 00032 00033 return 0; 00034 }
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(), AfterLastEntry(), PlotTPI_PedestalAndNoise::AfterLastEntry(), PlotTDPs::AfterLastEntry(), PlotTDP_TDiff::AfterLastEntry(), IslandLength::AfterLastEntry(), IslandAmplitude::AfterLastEntry(), MakeDetectorPulses::BeforeFirstEntry(), TemplateCreator::BeforeFirstEntry(), 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(), ProcessEntry(), MakeAnalysedPulses::ProcessEntry(), PulseViewer::ProcessEntry(), PlotTDP_TDiff::ProcessEntry(), and TemplateCreator::StartTemplate().
00071 {return fDebug;};
std::string BaseModule::GetAlias | ( | ) | const [inline, inherited] |
Returns a string for the alias of this module. May be empty if no alias was given in the modules file.
Definition at line 63 of file BaseModule.h.
References BaseModule::fAlias.
Referenced by BaseModule::BaseModule().
00063 {return fAlias;};
TDirectory * BaseModule::GetDirectory | ( | const std::string & | name = "" |
) | [protected, inherited] |
Definition at line 77 of file BaseModule.cpp.
References BaseModule::dir, and BaseModule::fDirectory.
00077 { 00078 if(name.empty()) return fDirectory; 00079 TDirectory* dir=fDirectory->GetDirectory(name.c_str()); 00080 if(dir) return dir; 00081 return fDirectory->mkdir(name.c_str()); 00082 }
TDirectory* BaseModule::GetDirectory | ( | ) | const [inline, protected, inherited] |
Get the TDirectory for this module.
Definition at line 74 of file BaseModule.h.
References BaseModule::fDirectory.
Referenced by TemplateCreator::AfterLastEntry(), SavePulses::AfterLastEntry(), TemplateCreator::BeforeFirstEntry(), PlotTDPs::BeforeFirstEntry(), ExportPulse::ExportPulse(), and TemplateCreator::ProcessEntry().
00074 {return fDirectory;}
const char* BaseModule::GetName | ( | ) | const [inline, inherited] |
Get the name of this module as given to the constructor of the base class.
Definition at line 66 of file BaseModule.h.
References BaseModule::fName.
Referenced by SavePulses::BeforeFirstEntry(), PlotTDPs::BeforeFirstEntry(), PlotTDP_TDiff::BeforeFirstEntry(), PlotTAP_Time::ProcessEntry(), 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 PulseCandidateFinder_InvestigateParameters::ProcessEntry | ( | TGlobalData * | gData, | |
const TSetupData * | gSetup | |||
) | [private, virtual] |
In every event, we loop over all the detectors and create a ParameterHistogram, then we loop over the TPulseIslands and find the candidate pulses with PulseCandidateFinder::FindPulseCandidates(). Finally, we fill the parameter histogram with either the height of all samples, or the differences between consecutive samples.
[in] | gData | See BaseModule::ProcessEntry |
[in] | gSetup | See BaseModule::ProcessEntry |
Implements BaseModule.
Definition at line 38 of file PulseCandidateFinder_InvestigateParameters.cpp.
References BaseModule::Debug(), PulseCandidateFinder::FillParameterHistogram(), PulseCandidateFinder::FindPulseCandidates(), fOpts, fParameterHistograms, TGlobalData::fPulseIslandToChannelMap, TSetupData::GetDetectorName(), TSetupData::GetNBits(), PulseCandidateFinder::GetNPulseCandidates(), and TSetupData::Instance().
00038 { 00039 00040 // Prepare a few variables 00041 std::string bankname, detname; 00042 PulseIslandList thePulseIslands; 00043 StringPulseIslandMap::const_iterator it; 00044 00045 // Loop over each detector 00046 for(it = gData->fPulseIslandToChannelMap.begin(); it != gData->fPulseIslandToChannelMap.end(); ++it){ 00047 00048 // Get the bank and detector names for this detector 00049 bankname = it->first; 00050 detname = setup->GetDetectorName(bankname); 00051 00052 // Create the pulse candidate finder for this detector 00053 PulseCandidateFinder* pulse_candidate_finder = new PulseCandidateFinder(detname, fOpts); 00054 00055 // Get the TPIs 00056 thePulseIslands = it->second; 00057 if (thePulseIslands.size() == 0) continue; // no pulses here.. 00058 00059 // Create the histogram that will store all the parameter values that we will look at to determine the best values 00060 if (fParameterHistograms.find(detname) == fParameterHistograms.end()) { 00061 00062 int n_bits = TSetupData::Instance()->GetNBits(bankname); 00063 int max_adc_value = std::pow(2, n_bits); 00064 int min_value = 0; 00065 int max_value = max_adc_value; 00066 int bin_width = 10; 00067 int num_bins = (max_value - min_value) / bin_width; 00068 std::string histname = "fParameterHistogram_" + detname; 00069 TH2D* histogram = new TH2D(histname.c_str(), histname.c_str(), num_bins,min_value,max_value, num_bins,min_value,max_value); 00070 fParameterHistograms[detname] = histogram; 00071 } 00072 00073 // Get the parameter histogram for this detector 00074 TH2D* parameter_histogram = fParameterHistograms[detname]; 00075 00076 // Loop through all the pulses 00077 for (PulseIslandList::iterator pulseIter = thePulseIslands.begin(); pulseIter != thePulseIslands.end(); ++pulseIter) { 00078 00079 // Find the pulse candidates on this TPulseIsland and then fill the parameter histogram 00080 pulse_candidate_finder->FindPulseCandidates(*pulseIter); 00081 pulse_candidate_finder->FillParameterHistogram(parameter_histogram); 00082 00083 // Use to export pulses (NB you will only want to run rootana on a few events to stop the output being large) 00084 int n_pulse_candidates = pulse_candidate_finder->GetNPulseCandidates(); 00085 if (Debug()) { 00086 if (n_pulse_candidates > 0) { 00087 // ExportPulse::Instance()->AddToExportList(detname, pulseIter - thePulseIslands.begin()); 00088 if (n_pulse_candidates > 1) { 00089 std::cout << detname << "(" << bankname << "): Pulse #" << pulseIter - thePulseIslands.begin() << " has " << n_pulse_candidates << " pulse candidates\n"; 00090 } 00091 } 00092 } // end if Debug 00093 } // end loop through pulses 00094 } // end loop through detectors 00095 00096 return 0; 00097 }
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().
Store the module options so that they can be passed to the PulseCandidateFinder.
Definition at line 73 of file PulseCandidateFinder_InvestigateParameters.h.
Referenced by ProcessEntry().
std::map<std::string, TH2D*> PulseCandidateFinder_InvestigateParameters::fParameterHistograms [private] |
The map that we store the parameter histograms for each channel.
Definition at line 69 of file PulseCandidateFinder_InvestigateParameters.h.
Referenced by ProcessEntry().