CheckTMEs Class Reference
[Modules]

Produce various plots that characterise the produced TMuonEvents. More...

#include <CheckTMEs.h>

Inheritance diagram for CheckTMEs:
BaseModule

List of all members.

Public Member Functions

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

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

long int fNullCount
long int fTdpCount
DetectorList fDetectors
TH1F * fTotalPulses
TH2F * fPulsesPerDetector
TH2F * fTDiffPerDetector
TH1F * fFlags

Detailed Description

Produce various plots that characterise the produced TMuonEvents.

Author:
Ben Krikler

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 26 of file CheckTMEs.h.


Member Typedef Documentation

typedef std::vector<IDs::channel> CheckTMEs::DetectorList [private]

Definition at line 60 of file CheckTMEs.h.


Constructor & Destructor Documentation

CheckTMEs::CheckTMEs ( 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 19 of file CheckTMEs.cpp.

00019                                         :
00020    BaseModule("CheckTMEs",opts),fNullCount(0),fTdpCount(0){
00021 }

CheckTMEs::~CheckTMEs (  ) 

Is anything done in the destructor?

Definition at line 23 of file CheckTMEs.cpp.

00023                      {
00024 }


Member Function Documentation

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

Returns:
Non-zero to indicate a problem.

Implements BaseModule.

Definition at line 122 of file CheckTMEs.cpp.

References fNullCount, fTDiffPerDetector, and fTdpCount.

00122                                                                        {
00123   cout<<"CheckTMEs::AfterLastEntry: NULL TDP in TME ("<<++fNullCount<<")"<<endl;
00124   cout<<"CheckTMEs::AfterLastEntry: Total number of TDPs ("<<++fTdpCount<<")"<<endl;
00125                   cout<<"CheckTMEs::AfterLastEntry: Total entries in fTDiffPerDetector: "<<fTDiffPerDetector->GetEntries()<<endl;
00126   return 0;
00127 }

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

Returns:
Non-zero to indicate a problem.

Implements BaseModule.

Definition at line 26 of file CheckTMEs.cpp.

References fDetectors, fFlags, fPulsesPerDetector, fTDiffPerDetector, fTotalPulses, IDs::kGe, IDs::kMuSc, IDs::kMuScA, IDs::kNDet, IDs::kNDet2, IDs::kNotApplicable, IDs::kScGe, IDs::kScL, IDs::kScR, IDs::kScVe, IDs::kSiL1_1, IDs::kSiL1_2, IDs::kSiL1_3, IDs::kSiL1_4, IDs::kSiL2, IDs::kSiR1_1, IDs::kSiR1_2, IDs::kSiR1_3, IDs::kSiR1_4, and IDs::kSiR2.

00026                                                                          {
00027     using namespace IDs;
00028     fDetectors.push_back(IDs::channel (kGe     , kNotApplicable ));
00029     fDetectors.push_back(IDs::channel (kScR    , kNotApplicable ));
00030     fDetectors.push_back(IDs::channel (kScL    , kNotApplicable ));
00031     fDetectors.push_back(IDs::channel (kScVe   , kNotApplicable ));
00032     fDetectors.push_back(IDs::channel (kScGe   , kNotApplicable ));
00033     fDetectors.push_back(IDs::channel (kSiL1_1 , kNotApplicable ));
00034     fDetectors.push_back(IDs::channel (kSiL1_2 , kNotApplicable ));
00035     fDetectors.push_back(IDs::channel (kSiL1_3 , kNotApplicable ));
00036     fDetectors.push_back(IDs::channel (kSiL1_4 , kNotApplicable ));
00037     fDetectors.push_back(IDs::channel (kSiR1_1 , kNotApplicable ));
00038     fDetectors.push_back(IDs::channel (kSiR1_2 , kNotApplicable ));
00039     fDetectors.push_back(IDs::channel (kSiR1_3 , kNotApplicable ));
00040     fDetectors.push_back(IDs::channel (kSiR1_4 , kNotApplicable ));
00041     fDetectors.push_back(IDs::channel (kSiR2   , kNotApplicable ));
00042     fDetectors.push_back(IDs::channel (kSiL2   , kNotApplicable ));
00043     fDetectors.push_back(IDs::channel (kMuSc   , kNotApplicable ));
00044     fDetectors.push_back(IDs::channel (kMuScA  , kNotApplicable ));
00045     fDetectors.push_back(IDs::channel (kNDet   , kNotApplicable ));
00046     fDetectors.push_back(IDs::channel (kNDet2  , kNotApplicable ));
00047 
00048     // Plot the total number of pulses
00049     fTotalPulses=new TH1F("hTotalPulses", "Total number of pulses per TME", 100, 0 ,100);
00050     fTotalPulses->SetXTitle("Number of pulses");
00051 
00052     // Plot the number of pulses per channel
00053     fPulsesPerDetector=new TH2F("hPulsesPerChannel", "Pulses per channel per TME", 
00054             50, 0 ,50,fDetectors.size(),0,fDetectors.size());
00055     fPulsesPerDetector->SetXTitle("Number of pulses");
00056     //fPulsesPerDetector->SetYTitle("Detector");
00057 
00058     fTDiffPerDetector=new TH2F("hTDiffPerChannel", "TDiff to muSc for each channel per TME", 
00059             5000, -1.2e4,1.2e4,fDetectors.size(),0,fDetectors.size());
00060     fTDiffPerDetector->SetXTitle("TDiff to central muon (ns)");
00061 
00062     for(DetectorList::const_iterator i_det=fDetectors.begin();
00063             i_det!=fDetectors.end(); ++i_det){
00064         fPulsesPerDetector->GetYaxis()->SetBinLabel(i_det-fDetectors.begin()+1, i_det->str().c_str());
00065         fTDiffPerDetector->GetYaxis()->SetBinLabel(i_det-fDetectors.begin()+1, i_det->str().c_str());
00066     }
00067     fPulsesPerDetector->SetDrawOption("colz");
00068     fTDiffPerDetector->SetDrawOption("colz");
00069 
00070     // Plot the number of TME flags
00071     fFlags=new TH1F("hFlags", "Number of flagged per TME", 5,0,5);
00072     fFlags->SetYTitle("Number of pulses");
00073     int count=0;
00074     fFlags->GetXaxis()->SetBinLabel(++count,"Healthy");
00075     fFlags->GetXaxis()->SetBinLabel(++count,"Late");
00076     fFlags->GetXaxis()->SetBinLabel(++count,"Early");
00077     fFlags->GetXaxis()->SetBinLabel(++count,"Muon Hit");
00078     fFlags->GetXaxis()->SetBinLabel(++count,"Muon PileUp");
00079 
00080   return 0;
00081 }

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

Returns:
Non-zero to indicate a problem.

Implements BaseModule.

Definition at line 83 of file CheckTMEs.cpp.

References TDetectorPulse::CouldBePaired(), fDetectors, fFlags, fNullCount, fPulsesPerDetector, fTDiffPerDetector, fTdpCount, fTotalPulses, TDetectorPulse::GetTime(), gMuonEvents, and TDetectorPulse::IsPairedPulse().

00083                                                                      {
00084     // Loop over each TME
00085     for(MuonEventList::const_iterator i_tme=gMuonEvents.begin();
00086             i_tme!=gMuonEvents.end(); ++i_tme){
00087         // total pulses
00088         fTotalPulses->Fill((*i_tme)->TotalNumPulses());
00089         for(DetectorList::const_iterator i_det=fDetectors.begin();
00090                 i_det!=fDetectors.end(); ++i_det){
00091             // pulses per channel
00092             int N=0, n;
00093             double tme_time= (*i_tme)->GetTime();
00094             int source_index=(*i_tme)->GetSourceIndex(*i_det);
00095             while(source_index>-1){
00096               const IDs::source& source=(*i_tme)->GetSource(source_index);
00097               n=(*i_tme)->NumPulses(source);
00098               N+=n;
00099               for(int i=0; i<n; ++i){
00100                  const TDetectorPulse* tdp=(*i_tme)->GetPulse(source,i);
00101                  if(tdp && (tdp->IsPairedPulse() || !tdp->CouldBePaired()) )
00102                     fTDiffPerDetector->Fill(tdp->GetTime() - tme_time, i_det - fDetectors.begin());
00103                  else if(!tdp)
00104                     ++fNullCount;
00105                 ++fTdpCount;
00106               }
00107              source_index=(*i_tme)->GetSourceIndex(*i_det,source_index+1);
00108             }
00109             fPulsesPerDetector->Fill(N, i_det - fDetectors.begin());
00110         }
00111         // fill flags hist
00112         if((*i_tme)->HasMuonHit()) fFlags->Fill("Muon Hit",1.);
00113         if((*i_tme)->HasMuonPileup()) fFlags->Fill("Muon PileUp",1.);
00114         //if((*i_tme)->WasEarlyInEvent()) fFlags->Fill("Early",1.);
00115         //else if((*i_tme)->WasLateInEvent()) fFlags->Fill("Late",1.);
00116         //else  
00117             fFlags->Fill("Healthy",1.);
00118     }
00119   return 0;
00120 }

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

Definition at line 61 of file CheckTMEs.h.

Referenced by BeforeFirstEntry(), and ProcessEntry().

TH1F* CheckTMEs::fFlags [private]

Definition at line 66 of file CheckTMEs.h.

Referenced by BeforeFirstEntry(), and ProcessEntry().

long int CheckTMEs::fNullCount [private]

Definition at line 58 of file CheckTMEs.h.

Referenced by AfterLastEntry(), and ProcessEntry().

Definition at line 64 of file CheckTMEs.h.

Referenced by BeforeFirstEntry(), and ProcessEntry().

Definition at line 65 of file CheckTMEs.h.

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

long int CheckTMEs::fTdpCount [private]

Definition at line 58 of file CheckTMEs.h.

Referenced by AfterLastEntry(), and ProcessEntry().

TH1F* CheckTMEs::fTotalPulses [private]

Definition at line 63 of file CheckTMEs.h.

Referenced by BeforeFirstEntry(), and ProcessEntry().


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

Generated on 15 Jun 2016 for AlcapDAQ by  doxygen 1.6.1