FastSlowCompare Class Reference
[Modules]

A one line description of what your module does. More...

#include <FastSlowCompare.h>

Inheritance diagram for FastSlowCompare:
BaseModule

List of all members.

Public Member Functions

 FastSlowCompare (modules::options *opts)
 Constructor description. If necessary, add a details tag like above.
 ~FastSlowCompare ()
 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)
 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.

Private Attributes

double fTimeWindowWide
double fTimeWindowTight
std::map< std::string,
std::string > 
fPairs
std::map< std::string, TH1I * > fHist_Time
std::map< std::string, TH1I * > fHist_MoreTime
std::map< std::string, TH1I * > fHist_NPerSlowWide
std::map< std::string, TH1I * > fHist_NPerSlowTight

Detailed Description

A one line description of what your module does.

Author:
John R Quirk

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 31 of file FastSlowCompare.h.


Constructor & Destructor Documentation

FastSlowCompare::FastSlowCompare ( modules::options opts  ) 

Constructor description. If necessary, add a details tag like above.

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

Definition at line 26 of file FastSlowCompare.cpp.

References BaseModule::dir, fHist_MoreTime, fHist_NPerSlowTight, fHist_NPerSlowWide, fHist_Time, and fPairs.

00026                                                     : BaseModule("FastSlowCompare",opts) {
00027   const static std::string title_time("hTime");
00028   const static std::string title_moretime("hMoreTime");
00029   const static std::string title_meantime("hMeanTime");
00030   const static std::string title_nperwide("hNPerSlowWide");
00031   const static std::string title_npertight("hNPerSlowTight");
00032   fPairs[std::string("SiR2-S")] = std::string("SiR2-F");
00033   fPairs[std::string("SiL2-S")] = std::string("SiL2-F");
00034   fPairs[std::string("SiR1-1-S")] = std::string("SiR1-1-F");
00035   fPairs[std::string("SiR1-2-S")] = std::string("SiR1-2-F");
00036   fPairs[std::string("SiR1-3-S")] = std::string("SiR1-3-F");
00037   fPairs[std::string("SiR1-4-S")] = std::string("SiR1-4-F");
00038   fPairs[std::string("SiL1-1-S")] = std::string("SiL1-1-F");
00039   fPairs[std::string("SiL1-2-S")] = std::string("SiL1-2-F");
00040   fPairs[std::string("SiL1-3-S")] = std::string("SiL1-3-F");
00041   fPairs[std::string("SiL1-4-S")] = std::string("SiL1-4-F");
00042   fPairs[std::string("Ge-S")] = std::string("Ge-F");
00043 
00044   TDirectory* par_dir = TDirectory::CurrentDirectory();
00045   dir->cd();
00046   std::map<std::string, std::string>::iterator iPair;
00047   for (iPair = fPairs.begin(); iPair != fPairs.end(); ++iPair) {
00048     fHist_Time[iPair->first] = new TH1I((title_time + iPair->first).c_str(), "Relative Time of Fast", 400, -200., 200.);
00049     fHist_MoreTime[iPair->first] = new TH1I((title_moretime + iPair->first).c_str(), "Relative Time of Fast", 1000, -100000., 100000.);
00050     fHist_NPerSlowWide[iPair->first] = new TH1I((title_nperwide + iPair->first).c_str(), "Number of Fast Pulses within 100us", 10, -0.5, 9.5);
00051     fHist_NPerSlowTight[iPair->first] = new TH1I((title_npertight + iPair->first).c_str(), "Number of Fast Pulses within 400ns", 10, -0.5, 9.5);
00052   }
00053   par_dir->cd();
00054 }

FastSlowCompare::~FastSlowCompare (  ) 

Is anything done in the destructor?

Definition at line 56 of file FastSlowCompare.cpp.

00056                                  {
00057 }


Member Function Documentation

int FastSlowCompare::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.

Parameters:
[in] gData See BaseModule::AfterLastEntry
[in] setup See BaseModule::AfterLastEntry
Returns:
Non-zero to indicate a problem.

Implements BaseModule.

Definition at line 105 of file FastSlowCompare.cpp.

00105                                                                                {
00106   return 0;
00107 }

int FastSlowCompare::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.

Parameters:
[in] gData See BaseModule::BeforeFirstEntry
[in] setup See BaseModule::BeforeFirstEntry
Returns:
Non-zero to indicate a problem.

Implements BaseModule.

Definition at line 62 of file FastSlowCompare.cpp.

00062                                                                                 {
00063   return 0;
00064 }

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

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 FastSlowCompare::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.

Parameters:
[in] gData See BaseModule::ProcessEntry
[in] gSetup See BaseModule::ProcessEntry
Returns:
Non-zero to indicate a problem.

Implements BaseModule.

Definition at line 68 of file FastSlowCompare.cpp.

References fHist_MoreTime, fHist_NPerSlowTight, fHist_NPerSlowWide, fHist_Time, fPairs, TGlobalData::fPulseIslandToChannelMap, TSetupData::GetBankName(), and TPI2Times().

00068                                                                             {
00069   const std::map< std::string, std::vector<TPulseIsland*> >& TPIMap = gData->fPulseIslandToChannelMap;
00070   
00071   std::map<std::string, std::string>::iterator iPair;
00072   for (iPair = fPairs.begin(); iPair != fPairs.end(); ++iPair) {
00073     const std::vector<double> slow_times = TPI2Times(TPIMap.at(setup->GetBankName(iPair->first)));
00074     const std::vector<double> fast_times = TPI2Times(TPIMap.at(setup->GetBankName(iPair->second)));
00075     const std::vector<double>::const_iterator beg_slow = slow_times.begin();
00076     const std::vector<double>::const_iterator beg_fast  = fast_times.begin();
00077     const std::vector<double>::const_iterator end_slow = slow_times.end();
00078     const std::vector<double>::const_iterator end_fast  = fast_times.end();
00079     std::vector<double>::const_iterator slow;
00080     std::vector<double>::const_iterator fast[2];
00081 
00082     for (slow = beg_slow; slow < end_slow; ++slow) {
00083       static std::vector<double>::const_iterator iTime;
00084       fast[0] = std::upper_bound(beg_fast, end_fast, *slow + 100000.);
00085       fast[1] = std::upper_bound(beg_fast, end_fast, *slow - 100000.);
00086       fHist_NPerSlowWide[iPair->first]->Fill(fast[0] - fast[1]);
00087       for(iTime = fast[1]; iTime < fast[0]; ++iTime) {
00088         fHist_Time.at(iPair->first)->Fill(*iTime - *slow);
00089         fHist_MoreTime.at(iPair->first)->Fill(*iTime - *slow);
00090       }
00091       fast[0] = std::lower_bound(beg_fast, end_fast, *slow + 400.);
00092       fast[1] = std::upper_bound(beg_fast, end_fast, *slow - 400.);
00093       fHist_NPerSlowTight[iPair->first]->Fill(fast[0] - fast[1]);
00094     }
00095   }
00096 
00097 
00098   return 0;
00099 }

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(), GeSpectrum::GeSpectrum(), BaseModule::GetDirectory(), MakeMuonEvents::MakeMuonEvents(), and PlotAmpVsTDiff::PlotAmpVsTDiff().

std::map<std::string, TH1I*> FastSlowCompare::fHist_MoreTime [private]

Definition at line 40 of file FastSlowCompare.h.

Referenced by FastSlowCompare(), and ProcessEntry().

std::map<std::string, TH1I*> FastSlowCompare::fHist_NPerSlowTight [private]

Definition at line 42 of file FastSlowCompare.h.

Referenced by FastSlowCompare(), and ProcessEntry().

std::map<std::string, TH1I*> FastSlowCompare::fHist_NPerSlowWide [private]

Definition at line 41 of file FastSlowCompare.h.

Referenced by FastSlowCompare(), and ProcessEntry().

std::map<std::string, TH1I*> FastSlowCompare::fHist_Time [private]

Definition at line 39 of file FastSlowCompare.h.

Referenced by FastSlowCompare(), and ProcessEntry().

std::map<std::string, std::string> FastSlowCompare::fPairs [private]

Definition at line 37 of file FastSlowCompare.h.

Referenced by FastSlowCompare(), and ProcessEntry().

Definition at line 35 of file FastSlowCompare.h.

Definition at line 34 of file FastSlowCompare.h.


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

Generated on 15 Jun 2016 for AlcapDAQ by  doxygen 1.6.1