#include <PlotAmpVsTDiff.h>
Public Member Functions | |
PlotAmpVsTDiff (char *HistogramDirectoryName, std::string det_name_a, std::string det_name_b) | |
PlotAmpVsTDiff (modules::options *opts) | |
~PlotAmpVsTDiff () | |
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) |
The big kahuna. Overload this in the derived class and it will be called for each event. | |
virtual int | AfterLastEntry (TGlobalData *gData, const TSetupData *setup) |
virtual int | BeforeFirstEntry (TGlobalData *gData, const TSetupData *setup) |
Private Attributes | |
TH2F * | amp_vs_tdiff_plot_coarse |
TH2F * | amp_vs_tdiff_plot_fine |
std::string | fDetNameA |
std::string | fDetNameB |
Definition at line 11 of file PlotAmpVsTDiff.h.
PlotAmpVsTDiff::PlotAmpVsTDiff | ( | char * | HistogramDirectoryName, | |
std::string | det_name_a, | |||
std::string | det_name_b | |||
) |
Definition at line 25 of file PlotAmpVsTDiff.cpp.
References amp_vs_tdiff_plot_coarse, amp_vs_tdiff_plot_fine, BaseModule::dir, fDetNameA, fDetNameB, TSetupData::GetNBits(), and TSetupData::Instance().
00025 : 00026 BaseModule(HistogramDirectoryName){ 00027 00028 fDetNameA = det_name_a; 00029 fDetNameB = det_name_b; 00030 00031 // hAmpVsTDiff 00032 std::string histname = "h" + fDetNameA + "-" + fDetNameB + "_AmpVsTDiff_Coarse"; 00033 std::string histtitle = "Plot of the amplitude vs time difference for the " + fDetNameA + " and " + fDetNameB + " detector"; 00034 int n_bits = TSetupData::Instance()->GetNBits(TSetupData::Instance()->GetBankName(fDetNameB)); 00035 double max_adc_value = std::pow(2, n_bits); 00036 00037 std::string x_axis_title = "Time Difference (" + fDetNameB + " - " + fDetNameA + ") [ns]"; 00038 std::string y_axis_title = "Amplitude of " + fDetNameB + " [ADC Value]"; 00039 00040 amp_vs_tdiff_plot_coarse = new TH2F(histname.c_str(), histtitle.c_str(), 100,-50000,50000, max_adc_value,0,max_adc_value); 00041 amp_vs_tdiff_plot_coarse->GetXaxis()->SetTitle(x_axis_title.c_str()); 00042 amp_vs_tdiff_plot_coarse->GetYaxis()->SetTitle(y_axis_title.c_str()); 00043 00044 histname = "h" + fDetNameA + "-" + fDetNameB + "_AmpVsTDiff_Fine"; 00045 amp_vs_tdiff_plot_fine = new TH2F(histname.c_str(), histtitle.c_str(), 5000,-5000,20000, max_adc_value,0,max_adc_value); 00046 amp_vs_tdiff_plot_fine->GetXaxis()->SetTitle(x_axis_title.c_str()); 00047 amp_vs_tdiff_plot_fine->GetYaxis()->SetTitle(y_axis_title.c_str()); 00048 00049 dir->cd("/"); 00050 }
PlotAmpVsTDiff::PlotAmpVsTDiff | ( | modules::options * | opts | ) |
Definition at line 52 of file PlotAmpVsTDiff.cpp.
References amp_vs_tdiff_plot_coarse, amp_vs_tdiff_plot_fine, BaseModule::dir, fDetNameA, fDetNameB, TSetupData::GetNBits(), modules::options::GetString(), and TSetupData::Instance().
00052 : BaseModule( (opts->GetString("0")).c_str() ) { 00053 00054 fDetNameA = opts->GetString("1"); 00055 fDetNameB = opts->GetString("2"); 00056 00057 // hAmpVsTDiff 00058 std::string histname = "h" + fDetNameA + "-" + fDetNameB + "_AmpVsTDiff_Coarse"; 00059 std::string histtitle = "Plot of the amplitude vs time difference for the " + fDetNameA + " and " + fDetNameB + " detector"; 00060 int n_bits = TSetupData::Instance()->GetNBits(TSetupData::Instance()->GetBankName(fDetNameB)); 00061 double max_adc_value = std::pow(2, n_bits); 00062 00063 std::string x_axis_title = "Time Difference (" + fDetNameB + " - " + fDetNameA + ") [ns]"; 00064 std::string y_axis_title = "Amplitude of " + fDetNameB + " [ADC Value]"; 00065 00066 amp_vs_tdiff_plot_coarse = new TH2F(histname.c_str(), histtitle.c_str(), 100,-50000,50000, max_adc_value,0,max_adc_value); 00067 amp_vs_tdiff_plot_coarse->GetXaxis()->SetTitle(x_axis_title.c_str()); 00068 amp_vs_tdiff_plot_coarse->GetYaxis()->SetTitle(y_axis_title.c_str()); 00069 00070 histname = "h" + fDetNameA + "-" + fDetNameB + "_AmpVsTDiff_Fine"; 00071 amp_vs_tdiff_plot_fine = new TH2F(histname.c_str(), histtitle.c_str(), 5000,-5000,20000, max_adc_value,0,max_adc_value); 00072 amp_vs_tdiff_plot_fine->GetXaxis()->SetTitle(x_axis_title.c_str()); 00073 amp_vs_tdiff_plot_fine->GetYaxis()->SetTitle(y_axis_title.c_str()); 00074 00075 dir->cd("/"); 00076 }
PlotAmpVsTDiff::~PlotAmpVsTDiff | ( | ) |
Definition at line 78 of file PlotAmpVsTDiff.cpp.
virtual int PlotAmpVsTDiff::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 19 of file PlotAmpVsTDiff.h.
virtual int PlotAmpVsTDiff::BeforeFirstEntry | ( | TGlobalData * | gData, | |
const TSetupData * | setup | |||
) | [inline, 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 20 of file PlotAmpVsTDiff.h.
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();};
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 PlotAmpVsTDiff::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 81 of file PlotAmpVsTDiff.cpp.
References amp_vs_tdiff_plot_coarse, amp_vs_tdiff_plot_fine, fDetNameA, fDetNameB, and gAnalysedPulseMap.
00081 { 00082 00083 // Get the detA and detB pulses ready but make sure they exist first 00084 AnalysedPulseList detA_pulses; 00085 AnalysedPulseList detB_pulses; 00086 00087 if (gAnalysedPulseMap.find(fDetNameA) == gAnalysedPulseMap.end()) { 00088 std::cout << fDetNameA << " pulses not found" << std::endl; 00089 } 00090 else { 00091 detA_pulses = gAnalysedPulseMap[fDetNameA]; 00092 } 00093 00094 if (gAnalysedPulseMap.find(fDetNameB) == gAnalysedPulseMap.end()) { 00095 std::cout << fDetNameB << " pulses not found" << std::endl; 00096 } 00097 else { 00098 detB_pulses = gAnalysedPulseMap[fDetNameB]; 00099 } 00100 00101 00102 AnalysedPulseList::iterator currentDetAPulse = detA_pulses.begin(); // want to keep track of how far we are through the detA pulses 00103 00104 // Loop through the detB pulses 00105 for (AnalysedPulseList::iterator detBPulseIter = detB_pulses.begin(); detBPulseIter != detB_pulses.end(); ++detBPulseIter) { 00106 00107 // Loop through the detA pulses 00108 //bool coinc_found = false; 00109 for (AnalysedPulseList::iterator detAPulseIter = currentDetAPulse; detAPulseIter != detA_pulses.end(); ++detAPulseIter) { 00110 00111 double detB_time = (*detBPulseIter)->GetTime(); 00112 double detA_time = (*detAPulseIter)->GetTime(); 00113 double t_diff = detB_time - detA_time; 00114 double detB_amplitude = (*detBPulseIter)->GetAmplitude(); 00115 00116 amp_vs_tdiff_plot_coarse->Fill(t_diff, detB_amplitude); 00117 amp_vs_tdiff_plot_fine->Fill(t_diff, detB_amplitude); 00118 00119 } // end loop through detA pulses 00120 } // end loop through detB pulses 00121 00122 return 0; 00123 }
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;};
TH2F* PlotAmpVsTDiff::amp_vs_tdiff_plot_coarse [private] |
Definition at line 20 of file PlotAmpVsTDiff.h.
Referenced by PlotAmpVsTDiff(), and ProcessEntry().
TH2F* PlotAmpVsTDiff::amp_vs_tdiff_plot_fine [private] |
Definition at line 23 of file PlotAmpVsTDiff.h.
Referenced by PlotAmpVsTDiff(), and ProcessEntry().
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().
std::string PlotAmpVsTDiff::fDetNameA [private] |
Definition at line 26 of file PlotAmpVsTDiff.h.
Referenced by PlotAmpVsTDiff(), and ProcessEntry().
std::string PlotAmpVsTDiff::fDetNameB [private] |
Definition at line 27 of file PlotAmpVsTDiff.h.
Referenced by PlotAmpVsTDiff(), and ProcessEntry().