MakeSiliconEvents Class Reference
[Modules]

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

#include <MakeSiliconEvents.h>

Inheritance diagram for MakeSiliconEvents:
BaseModule

List of all members.

Public Member Functions

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

const IDs::sourceGetTDPSource (const std::string &ch)
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 BeforeFirstEntry (TGlobalData *gData, const TSetupData *setup)
virtual int AfterLastEntry (TGlobalData *gData, const TSetupData *setup)

Private Attributes

IDs::source fSourceList [LR::kNum][Ch::kNum]
double fSiWindow

Detailed Description

A one line description of what your module does.

Author:
AuthorName

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 36 of file MakeSiliconEvents.h.


Constructor & Destructor Documentation

MakeSiliconEvents::MakeSiliconEvents ( 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 17 of file MakeSiliconEvents.cpp.

00017                                                         :
00018    BaseModule("MakeSiliconEvents",opts,false),
00019   fSiWindow(opts->GetDouble("si_window",100)){
00020 }

MakeSiliconEvents::~MakeSiliconEvents (  ) 

Is anything done in the destructor?

Definition at line 22 of file MakeSiliconEvents.cpp.

00022                                      {
00023 }


Member Function Documentation

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

Optional method which is called once after the main event loop Can be used to dump a summary or finalise a histogram

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

Implements BaseModule.

Definition at line 69 of file MakeSiliconEvents.cpp.

00069                                                                                {
00070   return 0;
00071 }

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

Optional method which is called once before the main event loop Can be used to parse options and setup histograms.

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

Implements BaseModule.

Definition at line 25 of file MakeSiliconEvents.cpp.

References fSourceList, and GetTDPSource().

00025                                                                                  {
00026   // Get all the sources for the silicon channels
00027   for(int i=0;i<LR::kNum;i++){
00028      for(int ch=0;ch<Ch::kNum;ch++){
00029         fSourceList[i][ch]=GetTDPSource(Form("Si%s%s",LR::str(i),Ch::str(ch)));
00030      }
00031   }
00032   return 0;
00033 }

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

const IDs::source & MakeSiliconEvents::GetTDPSource ( const std::string &  ch  )  [private]

Definition at line 73 of file MakeSiliconEvents.cpp.

References gDetectorPulseMap, IDs::kErrorDetector, and IDs::kErrorSlowFast.

Referenced by BeforeFirstEntry().

00073                                                                     {
00074     IDs::channel chan(ch);
00075     SourceDetPulseMap::const_iterator i_so=gDetectorPulseMap.begin();
00076     while(i_so!=gDetectorPulseMap.end() && !(i_so->first==chan)) ++i_so;
00077     if(i_so==gDetectorPulseMap.end()){
00078         static IDs::source invalid(IDs::kErrorDetector, IDs::kErrorSlowFast, "","");
00079         return invalid;
00080     }
00081     return i_so->first;
00082 }

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

Parameters:
gData Pointer to current map of all TPIs [ WILL CHANGE SHORTLY ]
gSetup Pointer to TSetupData for this run [ WILL CHANGE SHORTLY ]
Returns:
0 on success and non-zero on failure

Implements BaseModule.

Definition at line 35 of file MakeSiliconEvents.cpp.

References TSiliconEvent::AddThin(), TMuonEvent::BeginPulses(), TMuonEvent::EndPulses(), fSiWindow, fSourceList, TDetectorPulse::GetEnergy(), TDetectorPulse::GetTime(), gMuonEvents, TMuonEvent::InsertSiliconEvent(), TDetectorPulse::IsGood(), TDetectorPulse::kFast, TDetectorPulse::kSlow, TSiliconEvent::Reset(), and TSiliconEvent::SetThick().

00035                                                                              {
00036   
00037   // loop over each TME
00038   TSiliconEvent si_hit;
00039   for(MuonEventList::iterator i_tme=gMuonEvents.begin();
00040           i_tme!=gMuonEvents.end(); ++i_tme){
00041     TMuonEvent* tme=*i_tme;
00042     // loop over both Si packages
00043     for(int i_side=0;i_side <2; ++i_side){
00044        // Loop over the thick silicon
00045        for(DetectorPulseList::const_iterator i_Si2=tme->BeginPulses(fSourceList[i_side][Ch::k2]);
00046              i_Si2!=tme->EndPulses(fSourceList[i_side][Ch::k2]); ++i_Si2){
00047            si_hit.Reset();
00048            double thick_time=(*i_Si2)->GetTime();
00049            double E_thick=(*i_Si2)->GetEnergy(TDetectorPulse::kSlow);
00050            si_hit.SetThick(E_thick,thick_time);
00051            for(int i=0; i<4;++i){
00052               for(DetectorPulseList::const_iterator i_thin=tme->BeginPulses(fSourceList[i_side][i]);
00053              i_thin!=tme->EndPulses(fSourceList[i_side][i]); ++i_thin){
00054                  const TDetectorPulse* pulse=*i_thin;
00055                  if(!pulse->IsGood())continue;
00056                  double time=pulse->GetTime(TDetectorPulse::kFast);
00057                  if( time > thick_time +fSiWindow) break;
00058                  if( time < thick_time -fSiWindow) continue;
00059                  si_hit.AddThin(i+1,pulse->GetEnergy(TDetectorPulse::kSlow));
00060               }
00061            }
00062            tme->InsertSiliconEvent((TMuonEvent::LeftRight_t) i_side,si_hit);
00063        }
00064     } // loop over both Si packages
00065   } // loop over each TME
00066   return 0;
00067 }

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

double MakeSiliconEvents::fSiWindow [private]

Definition at line 57 of file MakeSiliconEvents.h.

Referenced by ProcessEntry().

IDs::source MakeSiliconEvents::fSourceList[LR::kNum][Ch::kNum] [private]

Definition at line 56 of file MakeSiliconEvents.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