A one line description of what your module does. More...
#include <PlotTAP_selfCorrelation.h>
Public Member Functions | |
PlotTAP_selfCorrelation (modules::options *opts) | |
Constructor description. If necessary, add a details tag like above. | |
~PlotTAP_selfCorrelation () | |
Is anything done in the destructor? | |
int | ProcessGenericEntry (TGlobalData *gData, const TSetupData *gSetup) |
int | Preprocess (TGlobalData *gData, const TSetupData *gSetup) |
Method called by the main pre-process loop. | |
int | Postprocess (TGlobalData *gData, const TSetupData *gSetup) |
Method called by the main pre-process loop. | |
void | SetAlias (const std::string &alias) |
std::string | GetAlias () const |
const char * | GetName () const |
Get the name of this module as given to the constructor of the base class. | |
Protected Member Functions | |
bool | Debug () const |
TDirectory * | GetDirectory () const |
Get the TDirectory for this module. | |
TDirectory * | GetDirectory (const std::string &name="") |
Protected Attributes | |
TDirectory * | dir |
Private Types | |
typedef std::map< std::string, std::vector< TH2F * > > | HistList |
typedef std::vector< IDs::source > | SourceList |
Private Member Functions | |
virtual int | ProcessEntry (TGlobalData *gData, const TSetupData *gSetup) |
What's calculated for every entry? Don't hesitate to repeat what was said in the class description. | |
virtual int | BeforeFirstEntry (TGlobalData *gData, const TSetupData *setup) |
What needes to be done before each run? Don't hesitate to repeat what was said in the class description. | |
virtual int | AfterLastEntry (TGlobalData *gData, const TSetupData *setup) |
What needs to be done after each run? Don't hesitate to repeat what was said in the class description. | |
void | BookHistograms (const TSetupData *) |
Prepare histograms. | |
bool | PassesCutA (const TAnalysedPulse *tap) const |
bool | PassesMuScCut (const TAnalysedPulse *tap, const AnalysedPulseList &) const |
Private Attributes | |
std::string | fDetNameA |
std::string | fDetNameB |
double | fTimeLow |
double | fTimeHigh |
double | fMinAmpA |
double | fMaxAmpA |
double | fMuScWindow |
HistList | fHists |
SourceList | fDetASources |
SourceList | fDetBSources |
IDs::source | fMuScSource |
A one line description of what your module does.
A longer, more descriptive block of text. Specifics like members and methods will be described later. You can add this to other groups instead of rootana_modules or in addition to rootana_modules by adding more of the ingroup tags.
Definition at line 27 of file PlotTAP_selfCorrelation.h.
typedef std::map<std::string, std::vector<TH2F*> > PlotTAP_selfCorrelation::HistList [private] |
Definition at line 70 of file PlotTAP_selfCorrelation.h.
typedef std::vector<IDs::source> PlotTAP_selfCorrelation::SourceList [private] |
Definition at line 73 of file PlotTAP_selfCorrelation.h.
PlotTAP_selfCorrelation::PlotTAP_selfCorrelation | ( | modules::options * | opts | ) |
Constructor description. If necessary, add a details tag like above.
[in] | opts | Describe the options this module takes. |
Definition at line 17 of file PlotTAP_selfCorrelation.cpp.
00017 : 00018 BaseModule("PlotTAP_selfCorrelation",opts), 00019 fDetNameA(opts->GetString("det1")), fDetNameB(opts->GetString("det2")), 00020 fTimeLow(opts->GetDouble("time_low",-1.e5)), 00021 fTimeHigh(opts->GetDouble("time_high",1.e5)), 00022 fMinAmpA(opts->GetDouble("min_amp",0)), 00023 fMaxAmpA(opts->GetDouble("max_amp",1e20)), 00024 fMuScWindow(opts->GetDouble("musc_window",10)*1e3){ 00025 }
PlotTAP_selfCorrelation::~PlotTAP_selfCorrelation | ( | ) |
Is anything done in the destructor?
Definition at line 27 of file PlotTAP_selfCorrelation.cpp.
int PlotTAP_selfCorrelation::AfterLastEntry | ( | TGlobalData * | gData, | |
const TSetupData * | setup | |||
) | [private, virtual] |
What needs to be done after each run? Don't hesitate to repeat what was said in the class description.
Implements BaseModule.
Definition at line 96 of file PlotTAP_selfCorrelation.cpp.
int PlotTAP_selfCorrelation::BeforeFirstEntry | ( | TGlobalData * | gData, | |
const TSetupData * | setup | |||
) | [private, virtual] |
What needes to be done before each run? Don't hesitate to repeat what was said in the class description.
Implements BaseModule.
Definition at line 30 of file PlotTAP_selfCorrelation.cpp.
References BookHistograms(), fDetASources, fDetBSources, fDetNameA, fDetNameB, fMuScSource, and gAnalysedPulseMap.
00030 { 00031 00032 IDs::channel muSc("muSc"); 00033 for(SourceAnalPulseMap::const_iterator sourceIt = gAnalysedPulseMap.begin(); 00034 sourceIt != gAnalysedPulseMap.end(); sourceIt++) { 00035 00036 // only use the last matching muSc source for now 00037 if( sourceIt->first.matches(muSc)) fMuScSource=sourceIt->first; 00038 00039 if( sourceIt->first.Channel() != fDetNameA) 00040 continue; //check for detector A 00041 00042 for(SourceAnalPulseMap::const_iterator sourceIt2 = gAnalysedPulseMap.begin(); sourceIt2 != gAnalysedPulseMap.end(); ++sourceIt2) 00043 { 00044 if(sourceIt2->first.Channel() != fDetNameB) 00045 continue; //check for detector B 00046 00047 //I should make a vector of the sources for detA and detB 00048 fDetASources.push_back(sourceIt->first); 00049 fDetBSources.push_back(sourceIt2->first); 00050 break; 00051 } 00052 } 00053 00054 BookHistograms(setup); 00055 return 0; 00056 }
void PlotTAP_selfCorrelation::BookHistograms | ( | const TSetupData * | setup | ) | [private] |
Prepare histograms.
Definition at line 100 of file PlotTAP_selfCorrelation.cpp.
References fDetASources, fDetNameA, fDetNameB, fHists, fTimeHigh, fTimeLow, TSetupData::GetBankName(), and TSetupData::GetNBits().
Referenced by BeforeFirstEntry().
00100 { 00101 for (unsigned int i = 0; i < fDetASources.size(); ++i) { 00102 const std::string gen = fDetASources.at(i).Generator().str(); 00103 const int maxAmpA = std::pow(2, setup->GetNBits(setup->GetBankName(fDetNameA))); 00104 const int maxAmpB = std::pow(2, setup->GetNBits(setup->GetBankName(fDetNameB))); 00105 std::vector<TH2F*>& hists = fHists[fDetASources.at(i).str()]; 00106 00107 //ampA plots 00108 std::string histname("hTDiff_AmpA"); 00109 std::string histtitle="Amplitude of " + fDetNameA + " vs time difference with " + fDetNameB 00110 + " detectors with the " + gen + " generator;Time Difference (ns);Amplitude (ADC counts)"; 00111 hists.push_back(new TH2F(histname.c_str(), histtitle.c_str(), 200, fTimeLow, fTimeHigh, 200, 0, maxAmpA)); 00112 00113 //ampB plots 00114 histname = "hTDiff_AmpB"; 00115 histtitle = "Amplitude of " + fDetNameB + " vs time difference with " + fDetNameA 00116 + " detectors with the " + gen + " generator;Time Difference (ns);Amplitude (ADC counts)"; 00117 hists.push_back(new TH2F(histname.c_str(), histtitle.c_str(), 200, fTimeLow, fTimeHigh, 200, 0, maxAmpB)); 00118 00119 //intA plots 00120 histname = "hTDiff_IntA"; 00121 histtitle = "Integral of " + fDetNameA + " vs time difference with " + fDetNameB 00122 + " detectors with the " + gen + " generator;Time Difference (ns);Integral (ADC counts)"; 00123 hists.push_back(new TH2F(histname.c_str(), histtitle.c_str(), 200, fTimeLow, fTimeHigh, 200, 0, 5*maxAmpA)); 00124 00125 //intB plots 00126 histname = "hTDiff_IntB"; 00127 histtitle = "Integral of " + fDetNameB + " vs time difference with " + fDetNameA 00128 + " detectors with the " + gen + " generator;Time Difference (ns);Integral (ADC counts)"; 00129 hists.push_back(new TH2F(histname.c_str(), histtitle.c_str(), 200, fTimeLow, fTimeHigh, 200, 0, 5*maxAmpB)); 00130 00131 } 00132 }
bool BaseModule::Debug | ( | ) | const [inline, protected, inherited] |
Check whether this module was asked to print extra debug information
Definition at line 71 of file BaseModule.h.
References BaseModule::fDebug.
Referenced by MakeAnalysedPulses::AddGenerator(), ExportPulse::AddToExportList(), PulseCandidateFinder_InvestigateParameters::AfterLastEntry(), PlotTPI_PedestalAndNoise::AfterLastEntry(), PlotTDPs::AfterLastEntry(), PlotTDP_TDiff::AfterLastEntry(), IslandLength::AfterLastEntry(), IslandAmplitude::AfterLastEntry(), MakeDetectorPulses::BeforeFirstEntry(), TemplateCreator::BeforeFirstEntry(), PulseCandidateFinder_InvestigateParameters::BeforeFirstEntry(), PlotTPI_PedestalAndNoise::BeforeFirstEntry(), PlotTDPs::BeforeFirstEntry(), PlotTDP_TDiff::BeforeFirstEntry(), IslandLength::BeforeFirstEntry(), IslandAmplitude::BeforeFirstEntry(), PulseViewer::ConsiderDrawing(), MakeAnalysedPulses::MakeAnalysedPulses(), MakeDetectorPulses::MakeGenerator(), ExportPulse::PlotTPI(), MakeDetectorPulses::ProcessEntry(), TemplateCreator::ProcessEntry(), PulseCandidateFinder_InvestigateParameters::ProcessEntry(), MakeAnalysedPulses::ProcessEntry(), PulseViewer::ProcessEntry(), PlotTDP_TDiff::ProcessEntry(), and TemplateCreator::StartTemplate().
00071 {return fDebug;};
std::string BaseModule::GetAlias | ( | ) | const [inline, inherited] |
Returns a string for the alias of this module. May be empty if no alias was given in the modules file.
Definition at line 63 of file BaseModule.h.
References BaseModule::fAlias.
Referenced by BaseModule::BaseModule().
00063 {return fAlias;};
TDirectory * BaseModule::GetDirectory | ( | const std::string & | name = "" |
) | [protected, inherited] |
Definition at line 77 of file BaseModule.cpp.
References BaseModule::dir, and BaseModule::fDirectory.
00077 { 00078 if(name.empty()) return fDirectory; 00079 TDirectory* dir=fDirectory->GetDirectory(name.c_str()); 00080 if(dir) return dir; 00081 return fDirectory->mkdir(name.c_str()); 00082 }
TDirectory* BaseModule::GetDirectory | ( | ) | const [inline, protected, inherited] |
Get the TDirectory for this module.
Definition at line 74 of file BaseModule.h.
References BaseModule::fDirectory.
Referenced by TemplateCreator::AfterLastEntry(), 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();};
bool PlotTAP_selfCorrelation::PassesCutA | ( | const TAnalysedPulse * | tap | ) | const [private] |
Definition at line 86 of file PlotTAP_selfCorrelation.cpp.
References fMaxAmpA, and TAnalysedPulse::GetAmplitude().
Referenced by ProcessEntry().
00086 { 00087 const double amp=tap->GetAmplitude(); 00088 if(amp < fMinAmpA || amp > fMaxAmpA) return false; 00089 return true; 00090 }
bool PlotTAP_selfCorrelation::PassesMuScCut | ( | const TAnalysedPulse * | tap, | |
const AnalysedPulseList & | muScPulseList | |||
) | const [private] |
Definition at line 92 of file PlotTAP_selfCorrelation.cpp.
Referenced by ProcessEntry().
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 PlotTAP_selfCorrelation::ProcessEntry | ( | TGlobalData * | gData, | |
const TSetupData * | gSetup | |||
) | [private, virtual] |
What's calculated for every entry? Don't hesitate to repeat what was said in the class description.
Implements BaseModule.
Definition at line 58 of file PlotTAP_selfCorrelation.cpp.
References fDetASources, fDetBSources, fHists, fMuScSource, gAnalysedPulseMap, PassesCutA(), and PassesMuScCut().
00058 { 00059 const AnalysedPulseList& muScPulseList=gAnalysedPulseMap.at(fMuScSource); 00060 for(unsigned int i = 0; i < fDetASources.size(); ++i) { 00061 const AnalysedPulseList& detAPulses = gAnalysedPulseMap[fDetASources[i]]; 00062 const AnalysedPulseList& detBPulses = gAnalysedPulseMap[fDetBSources[i]]; 00063 const std::vector<TH2F*>& hists = fHists[fDetASources[i].str()]; 00064 00065 for(AnalysedPulseList::const_iterator pulseIt = detAPulses.begin(); 00066 pulseIt != detAPulses.end(); ++pulseIt) { 00067 if(!PassesCutA(*pulseIt)) continue; 00068 if(!PassesMuScCut(*pulseIt, muScPulseList)) continue; 00069 00070 for(AnalysedPulseList::const_iterator pulseIt2 = detBPulses.begin(); 00071 pulseIt2 != detBPulses.end(); ++pulseIt2) { 00072 double tDiff = (*pulseIt)->GetTime() - (*pulseIt2)->GetTime(); 00073 00074 hists[0]->Fill(tDiff, (*pulseIt)->GetAmplitude()); 00075 hists[1]->Fill(tDiff, (*pulseIt2)->GetAmplitude()); 00076 hists[2]->Fill(tDiff, (*pulseIt)->GetIntegral()); 00077 hists[3]->Fill(tDiff, (*pulseIt2)->GetIntegral()); 00078 00079 }//end detBPulse loop 00080 }//end detAPulse loop 00081 }//end sources loop 00082 00083 return 0; 00084 }
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().
Definition at line 74 of file PlotTAP_selfCorrelation.h.
Referenced by BeforeFirstEntry(), BookHistograms(), and ProcessEntry().
Definition at line 74 of file PlotTAP_selfCorrelation.h.
Referenced by BeforeFirstEntry(), and ProcessEntry().
std::string PlotTAP_selfCorrelation::fDetNameA [private] |
Definition at line 65 of file PlotTAP_selfCorrelation.h.
Referenced by BeforeFirstEntry(), and BookHistograms().
std::string PlotTAP_selfCorrelation::fDetNameB [private] |
Definition at line 65 of file PlotTAP_selfCorrelation.h.
Referenced by BeforeFirstEntry(), and BookHistograms().
HistList PlotTAP_selfCorrelation::fHists [private] |
Definition at line 71 of file PlotTAP_selfCorrelation.h.
Referenced by BookHistograms(), and ProcessEntry().
double PlotTAP_selfCorrelation::fMaxAmpA [private] |
Definition at line 67 of file PlotTAP_selfCorrelation.h.
Referenced by PassesCutA().
double PlotTAP_selfCorrelation::fMinAmpA [private] |
Definition at line 67 of file PlotTAP_selfCorrelation.h.
Definition at line 75 of file PlotTAP_selfCorrelation.h.
Referenced by BeforeFirstEntry(), and ProcessEntry().
double PlotTAP_selfCorrelation::fMuScWindow [private] |
Definition at line 68 of file PlotTAP_selfCorrelation.h.
double PlotTAP_selfCorrelation::fTimeHigh [private] |
Definition at line 66 of file PlotTAP_selfCorrelation.h.
Referenced by BookHistograms().
double PlotTAP_selfCorrelation::fTimeLow [private] |
Definition at line 66 of file PlotTAP_selfCorrelation.h.
Referenced by BookHistograms().