DemoNPlaneCut Class Reference

#include <DemoNPlaneCut.h>

Inheritance diagram for DemoNPlaneCut:
JobCModule

List of all members.

Public Member Functions

 DemoNPlaneCut ()
JobCResult Ana (const MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)
int CountPlanes (const CandDigitListHandle *cdlh)

Private Attributes

int fNplaneCut
int fMaxGap
short fPlane [512]

Static Private Attributes

static const int PLANEARRAYSIZE = 512

Detailed Description

Definition at line 9 of file DemoNPlaneCut.h.


Constructor & Destructor Documentation

DemoNPlaneCut::DemoNPlaneCut (  ) 

Definition at line 22 of file DemoNPlaneCut.cxx.

00022                              :
00023   fNplaneCut(15),
00024   fMaxGap(2)
00025 { }


Member Function Documentation

JobCResult DemoNPlaneCut::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 66 of file DemoNPlaneCut.cxx.

References CountPlanes(), fNplaneCut, JobCResult::kFailed, and JobCResult::kPassed.

00067 {
00068 //======================================================================
00069 // Given the object to which the data is attached perform some
00070 // analysis of the data
00071 //======================================================================
00072   // Access to the event is given through handles. In this case I want
00073   // the list of candidate digits
00074   const CandDigitListHandle* canddigit = 
00075     DataUtil::GetCandidate<CandDigitListHandle>(mom,
00076                                                 "CandDigitListHandle", 
00077                                                 "canddigitlist");
00078   
00079   // If the GetDigitList is successful, loop over the elements in the
00080   // list to add up the charge
00081   int nplane = 0;
00082   if (canddigit) nplane = this->CountPlanes(canddigit);
00083   if (nplane >= fNplaneCut) return JobCResult::kPassed;
00084   return JobCResult::kFailed;
00085 }

void DemoNPlaneCut::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 112 of file DemoNPlaneCut.cxx.

References fMaxGap, fNplaneCut, and Registry::Get().

00113 {
00114 //======================================================================
00115 // Configure the module given the registry r
00116 //======================================================================
00117   int    tmpi;
00118   if (r.Get("NplaneCut", tmpi)) { fNplaneCut = tmpi; }
00119   if (r.Get("MaxGap",    tmpi)) { fMaxGap    = tmpi; }
00120 }

int DemoNPlaneCut::CountPlanes ( const CandDigitListHandle cdlh  ) 

Definition at line 29 of file DemoNPlaneCut.cxx.

References fMaxGap, fPlane, PlexSEIdAltL::GetBestSEId(), CandHandle::GetDaughterIterator(), PlexPlaneId::GetPlane(), and PLANEARRAYSIZE.

Referenced by Ana().

00030 {
00031   // The loop is done with a class that iterates over the list
00032   int iPlane = 0;
00033   memset(fPlane, 0, PLANEARRAYSIZE*sizeof(fPlane[0]));
00034   CandDigitHandleItr cdhItr(cdlh->GetDaughterIterator());
00035   for (; cdhItr.IsValid(); cdhItr.Next()) {
00036     const PlexSEIdAltL&   altList = (*cdhItr)->GetPlexSEIdAltL();
00037     const PlexStripEndId& strEnd  = altList.GetBestSEId();
00038     iPlane = strEnd.GetPlane();
00039     if (iPlane>=0 && iPlane<PLANEARRAYSIZE) fPlane[iPlane] = 1;
00040   }
00041   int nPlane    = 0;
00042   int gapSz     = 0;
00043   int nPlaneMax = 0;
00044   for (int i=0; i<PLANEARRAYSIZE; ++i) {
00045     if (fPlane[i]==1) {
00046       // We have a hit on a plane. Increase the plane count and zero
00047       // out the gap counter
00048       ++nPlane;  
00049       gapSz = 0;
00050       if (nPlane > nPlaneMax) nPlaneMax = nPlane;
00051     }
00052     else {
00053 
00054       // No hit on the plane. Increase the gap size. If we reach the
00055       // maximum gap size, start the plane count again
00056 
00057       ++gapSz;
00058       if (gapSz > fMaxGap) nPlane = 0;
00059     }
00060   }
00061   return nPlaneMax;
00062 }

const Registry & DemoNPlaneCut::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 89 of file DemoNPlaneCut.cxx.

References JobCModule::GetName(), Registry::LockValues(), Registry::Set(), and Registry::UnLockValues().

00090 {
00091 //======================================================================
00092 // Create a registry which holds the default configuration and return it
00093 //======================================================================
00094   static Registry r;
00095 
00096   // Set name of config
00097   std::string name = this->GetName();
00098   name += ".config.default";
00099   r.SetName(name.c_str());
00100 
00101   // Set values of config
00102   r.UnLockValues();
00103   r.Set("NplaneCut", 15);
00104   r.Set("MaxGap",    2);
00105   r.LockValues();
00106 
00107   return r;
00108 }


Member Data Documentation

int DemoNPlaneCut::fMaxGap [private]

Definition at line 24 of file DemoNPlaneCut.h.

Referenced by Config(), and CountPlanes().

Definition at line 23 of file DemoNPlaneCut.h.

Referenced by Ana(), and Config().

short DemoNPlaneCut::fPlane[512] [private]

Definition at line 25 of file DemoNPlaneCut.h.

Referenced by CountPlanes().

const int DemoNPlaneCut::PLANEARRAYSIZE = 512 [static, private]

Definition at line 21 of file DemoNPlaneCut.h.

Referenced by CountPlanes().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1