PlotTDP_TDiff Class Reference
[Modules]

This module plots the time difference between TDetectorPulses (TDPs) in two given detectors. More...

#include <PlotTDP_TDiff.h>

Inheritance diagram for PlotTDP_TDiff:
BaseModule

List of all members.

Public Member Functions

 PlotTDP_TDiff (modules::options *opts)
 Constructor.
 ~PlotTDP_TDiff ()
 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 Member Functions

virtual int ProcessEntry (TGlobalData *gData, const TSetupData *gSetup)
 In every entry the time difference between all the TDPs in one detector and all the TDPs in the other detector is calculated and plotted into a histogram.
virtual int BeforeFirstEntry (TGlobalData *gData, const TSetupData *setup)
 Before each run, the DetectorPulseLists for the necessary detectors are stored and the histograms are created.
virtual int AfterLastEntry (TGlobalData *gData, const TSetupData *setup)
 Nothing needs to be done after each run.

Private Attributes

IDs::source fSourceA
 The sources that are requested.
IDs::source fSourceB
DetectorPulseList fDetPulsesA
 The pulse lists for the detector pulses that we want.
DetectorPulseList fDetPulsesB
double fTimeLow
double fTimeHigh
TH1F * fTDiffPlot
 The histogram we fill.

Detailed Description

This module plots the time difference between TDetectorPulses (TDPs) in two given detectors.

Author:
Andrew Edmonds

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 24 of file PlotTDP_TDiff.h.


Constructor & Destructor Documentation

PlotTDP_TDiff::PlotTDP_TDiff ( modules::options opts  ) 

Constructor.

Parameters:
[in] opts Describe the options this module takes.

Definition at line 17 of file PlotTDP_TDiff.cpp.

References fSourceA, fSourceB, and modules::options::GetString().

00017                                                 :
00018    BaseModule("PlotTDP_TDiff",opts),
00019   fTimeLow(opts->GetDouble("time_low",-1.e5)), fTimeHigh(opts->GetDouble("time_high",1.e5)){
00020 
00021   // Do something with opts here.  Has the user specified any
00022   // particular configuration that you want to know?
00023   // For example, perhaps this module wants an axis range:  
00024 
00025   fSourceA = IDs::source(opts->GetString("source_a"));
00026   fSourceB = IDs::source(opts->GetString("source_b"));
00027 }

PlotTDP_TDiff::~PlotTDP_TDiff (  ) 

Is anything done in the destructor?

Definition at line 29 of file PlotTDP_TDiff.cpp.

00029                              {
00030 }


Member Function Documentation

int PlotTDP_TDiff::AfterLastEntry ( TGlobalData gData,
const TSetupData setup 
) [private, virtual]

Nothing needs to be done after each run.

Returns:
Non-zero to indicate a problem.

Implements BaseModule.

Definition at line 100 of file PlotTDP_TDiff.cpp.

References BaseModule::Debug().

00100                                                                            {
00101 
00102   // Print extra info if we're debugging this module:
00103   if(Debug()){
00104      cout<<"-----PlotTDP_TDiff::AfterLastEntry(): I'm debugging!"<<endl;
00105   }
00106 
00107   return 0;
00108 }

int PlotTDP_TDiff::BeforeFirstEntry ( TGlobalData gData,
const TSetupData setup 
) [private, virtual]

Before each run, the DetectorPulseLists for the necessary detectors are stored and the histograms are created.

Returns:
Non-zero to indicate a problem.

Implements BaseModule.

Definition at line 35 of file PlotTDP_TDiff.cpp.

References IDs::source::Channel(), BaseModule::Debug(), fSourceA, fSourceB, fTDiffPlot, fTimeLow, BaseModule::GetName(), modules::navigator::Instance(), IDs::source::str(), and modules::parser::ToCppValid().

00035                                                                              {
00036   // Print extra info if we're debugging this module:
00037   if(Debug()){
00038      cout<<"-----PlotTDP_TDiff::BeforeFirstEntry(): I'm debugging!"<<endl;
00039   }
00040 
00041   if(!modules::navigator::Instance()->Before("MakeDetectorPulses",GetName())){
00042     cout<<"MakeDetectorPulses must be used before PlotTDP_TDiff"<<endl;
00043     return 1;
00044   }
00045 
00046   // Create the histogram
00047   std::string detname_a = fSourceA.Channel().str();
00048   std::string detname_b = fSourceB.Channel().str();
00049 
00050   std::string histogram_name = modules::parser::ToCppValid("h" + fSourceA.str() + "_" + fSourceB.str() + "_TDiff");
00051   std::string histogram_title = "Time Difference between TDP source " + fSourceA.str() + "_" + fSourceB.str();
00052   fTDiffPlot = new TH1F(histogram_name.c_str(), histogram_title.c_str(), 600, fTimeLow, fTimeLow);
00053 
00054   std::string axis_title = "t_{" + detname_a + "} - t_{" + detname_b + "} [ns]";
00055   fTDiffPlot->GetXaxis()->SetTitle(axis_title.c_str());
00056 
00057   return 0;
00058 }

bool BaseModule::Debug (  )  const [inline, protected, inherited]
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]
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(), 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.

Returns:
0 on sucess and non-zero if a problem occurred

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.

Returns:
0 on sucess and non-zero if a problem occurred

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 PlotTDP_TDiff::ProcessEntry ( TGlobalData gData,
const TSetupData gSetup 
) [private, virtual]

In every entry the time difference between all the TDPs in one detector and all the TDPs in the other detector is calculated and plotted into a histogram.

Returns:
Non-zero to indicate a problem.

Implements BaseModule.

Definition at line 62 of file PlotTDP_TDiff.cpp.

References BaseModule::Debug(), fDetPulsesA, fDetPulsesB, fSourceA, fSourceB, fTDiffPlot, and gDetectorPulseMap.

00062                                                                          {
00063 
00064   // Loop over all TDP sources
00065   for(SourceDetPulseMap::const_iterator i_source=gDetectorPulseMap.begin();
00066       i_source!= gDetectorPulseMap.end(); ++i_source){
00067     
00068     //    std::cout << i_source->first << ", " << fSourceA << std::endl;
00069     if ( (i_source->first).matches(fSourceA)) {
00070       fDetPulsesA = i_source->second;
00071       if (Debug()) {
00072         std::cout << "PlotTDP_TDiff: " << fSourceA << " pulses found. (" << fDetPulsesA.size() << " pulses)" << std::endl;;
00073       }
00074     }
00075     else if ((i_source->first).matches(fSourceB)) {
00076       fDetPulsesB = i_source->second;
00077       if (Debug()) {
00078         std::cout << "PlotTDP_TDiff: " << fSourceB << " pulses found. (" << fDetPulsesB.size() << " pulses)" << std::endl;
00079       }
00080     }
00081   }
00082 
00083   // Loop through the TDPs in both channels
00084   for (DetectorPulseList::const_iterator i_det_pulse_a = fDetPulsesA.begin(); i_det_pulse_a != fDetPulsesA.end(); ++i_det_pulse_a) {
00085     for (DetectorPulseList::const_iterator i_det_pulse_b = fDetPulsesB.begin(); i_det_pulse_b != fDetPulsesB.end(); ++i_det_pulse_b) {
00086 
00087       double time_det_pulse_a = (*i_det_pulse_a)->GetTime();
00088       double time_det_pulse_b = (*i_det_pulse_b)->GetTime();
00089       double time_difference = time_det_pulse_a - time_det_pulse_b; // this is the same way as specified in PlotTAP_TDiff to maintain consistency
00090 
00091       fTDiffPlot->Fill(time_difference);
00092     }
00093   }
00094   return 0;
00095 }

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.

Returns:
0 on sucess and non-zero if a problem occurred

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;};


Member Data Documentation

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().

The pulse lists for the detector pulses that we want.

Definition at line 61 of file PlotTDP_TDiff.h.

Referenced by ProcessEntry().

Definition at line 61 of file PlotTDP_TDiff.h.

Referenced by ProcessEntry().

The sources that are requested.

Definition at line 58 of file PlotTDP_TDiff.h.

Referenced by BeforeFirstEntry(), PlotTDP_TDiff(), and ProcessEntry().

Definition at line 58 of file PlotTDP_TDiff.h.

Referenced by BeforeFirstEntry(), PlotTDP_TDiff(), and ProcessEntry().

TH1F* PlotTDP_TDiff::fTDiffPlot [private]

The histogram we fill.

Definition at line 67 of file PlotTDP_TDiff.h.

Referenced by BeforeFirstEntry(), and ProcessEntry().

double PlotTDP_TDiff::fTimeHigh [private]

Definition at line 63 of file PlotTDP_TDiff.h.

double PlotTDP_TDiff::fTimeLow [private]

Definition at line 63 of file PlotTDP_TDiff.h.

Referenced by BeforeFirstEntry().


The documentation for this class was generated from the following files:

Generated on 15 Jun 2016 for AlcapDAQ by  doxygen 1.6.1