ParticleFilterModule Class Reference

#include <ParticleFilterModule.h>

Inheritance diagram for ParticleFilterModule:
JobCModule

List of all members.

Public Member Functions

 ParticleFilterModule ()
 ~ParticleFilterModule ()
void BeginJob ()
JobCResult Ana (const MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)
void Help ()

Private Attributes

Int_t fParticleType
Int_t fCutOverlaps
Int_t fCutCerTime
Int_t fCutChi2
Float_t fChi2Limit
Int_t fUseDST

Detailed Description

Definition at line 14 of file ParticleFilterModule.h.


Constructor & Destructor Documentation

ParticleFilterModule::ParticleFilterModule (  ) 

Definition at line 24 of file ParticleFilterModule.cxx.

00025 {
00026 //======================================================================
00027 // Default constructor
00028 //======================================================================
00029 }

ParticleFilterModule::~ParticleFilterModule (  ) 

Definition at line 33 of file ParticleFilterModule.cxx.

00034 {
00035 //======================================================================
00036 // Destructor
00037 //======================================================================
00038 }


Member Function Documentation

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

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 51 of file ParticleFilterModule.cxx.

References bfld::AsString(), UberRecordLite::cpid, UberRecord::cpid, fChi2Limit, fCutCerTime, fCutChi2, fCutOverlaps, fParticleType, fUseDST, MomNavigator::GetFragment(), CandCalDetPIDHandle::GetOLChi2(), CandCalDetPIDHandle::GetPIDType(), CandCalDetPIDHandle::InCERTime(), NtpCalDetPID::inct, Msg::kDebug, JobCResult::kFailed, JobCResult::kPassed, CalDetParticleType::kUnknown, Msg::kWarning, MSG, CandCalDetPIDHandle::NoOverlap(), NtpCalDetPID::nov, NtpCalDetPID::olchi2, and NtpCalDetPID::pid.

00052 {
00053 //======================================================================
00054 // 
00055 //======================================================================
00056    MSG("CalDetDST",Msg::kDebug)<<"In Particle filter mod, ana"<<endl;
00057      JobCResult result=JobCResult::kPassed;
00058      bool got_nada=true;
00059      Int_t ptype = CalDetParticleType::kUnknown;
00060      Bool_t nov = kFALSE;
00061      Bool_t inct = kFALSE;
00062      Float_t olchi2 = 0.;
00063      
00064      if(fUseDST==0){
00065           const CandCalDetPIDHandle* cpidh_ptr= 
00066                DataUtil::GetCandidate<CandCalDetPIDHandle>(mom,
00067                                "CandCalDetPIDHandle");
00068 
00069           ptype=cpidh_ptr->GetPIDType();
00070           nov=cpidh_ptr->NoOverlap();
00071           inct=cpidh_ptr->InCERTime();
00072           olchi2=cpidh_ptr->GetOLChi2();
00073           got_nada=false;
00074      }
00075      else{
00076           const UberRecord* ur=
00077                dynamic_cast<const UberRecord*>(mom->GetFragment("UberRecord"));
00078           if(ur!=0){
00079                ptype=ur->cpid.pid;
00080                nov=ur->cpid.nov;
00081                inct=ur->cpid.inct;
00082                olchi2=ur->cpid.olchi2;
00083                got_nada=false;
00084           }
00085           else{
00086                const UberRecordLite* url=
00087                     dynamic_cast<const UberRecordLite*>
00088                     (mom->GetFragment("UberRecordLite"));
00089                if(url!=0){
00090                     ptype=url->cpid.pid;
00091                     nov=url->cpid.nov;
00092                     inct=url->cpid.inct;
00093                     got_nada=false;
00094                }
00095           }
00096      }
00097 
00098      // fail an event for which I can't find pid information
00099      if(got_nada){
00100           if(fUseDST==0){
00101                MSG("CalDetDST", Msg::kWarning)<<"Could not find a CandCalDetPIDHandle to use in the PID selection.\nI'll fail this event!"<<endl;
00102           }
00103           else{
00104                MSG("CalDetDST", Msg::kWarning)<<"Could not find an UberRecord or UberRecordLite to use in the PID selection.\nI'll fail this event!"<<endl;
00105           }
00106           return JobCResult::kFailed;
00107      }
00108 
00109      // filter based on particle type
00110      if(ptype&fParticleType){
00111           // pass this event
00112           MSG("CalDetDST", Msg::kDebug)
00113                <<"Configured to pass: "
00114                <<CalDetParticleType::AsString(fParticleType)<<"\n"
00115                <<"Passing a: "<<CalDetParticleType::AsString(ptype)<<endl;
00116      }
00117      else{
00118           // fail it
00119           result=JobCResult::kFailed;
00120           MSG("CalDetDST", Msg::kDebug)
00121                <<"Configured to pass: "
00122                <<CalDetParticleType::AsString(fParticleType)<<"\n"
00123                <<"Failing a: "<<CalDetParticleType::AsString(ptype)<<endl;
00124      }
00125 
00126      // filter based on overlap criterion
00127      if(fCutOverlaps){
00128           if(nov){
00129                MSG("CalDetDST", Msg::kDebug)<<"Not an overlap."<<endl;
00130           }
00131           else{
00132                MSG("CalDetDST", Msg::kDebug)<<"An overlap."<<endl;
00133                result=JobCResult::kFailed;
00134           }
00135      }
00136 
00137      if(fCutCerTime){
00138         if(inct){
00139            MSG("CalDetDST", Msg::kDebug)<<"Cerenkov in time."<<endl;
00140         }
00141         else{
00142            MSG("CalDetDST", Msg::kDebug)<<"Cerenkov not in time."<<endl;
00143            result=JobCResult::kFailed;
00144         }
00145      }
00146      
00147      if(fCutChi2){
00148         if(olchi2<fChi2Limit){
00149            MSG("CalDetDST", Msg::kDebug)<<"olchi2 below "<<fChi2Limit<<endl;
00150         }
00151         else{
00152            MSG("CalDetDST", Msg::kDebug)<<"olchi2 above "<<fChi2Limit<<endl;
00153            result=JobCResult::kFailed;
00154         }
00155      } 
00156      
00157      return result;
00158 }

void ParticleFilterModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 42 of file ParticleFilterModule.cxx.

00043 {
00044 //======================================================================
00045 // blah
00046 //======================================================================
00047 }

void ParticleFilterModule::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 192 of file ParticleFilterModule.cxx.

References fChi2Limit, fCutCerTime, fCutChi2, fCutOverlaps, fParticleType, fUseDST, and Registry::Get().

00193 {
00194 //======================================================================
00195 // Configure the module given the Registry r
00196 //======================================================================
00197   int    tmpi;
00198 
00199   if (r.Get("ParticleType",tmpi)) { fParticleType = tmpi; }
00200   if (r.Get("CutOverlaps", tmpi)) { fCutOverlaps = tmpi; }
00201   if (r.Get("CutCerTime", tmpi)) { fCutCerTime = tmpi; }
00202   if (r.Get("CutChi2", tmpi)) {fCutChi2=tmpi;}
00203   if (r.Get("UseDST", tmpi)) { fUseDST = tmpi; }
00204   
00205   double tmpf;
00206   if (r.Get("Chi2Limit",tmpf)) {fChi2Limit = (Float_t)tmpf; }
00207 
00208 }

const Registry & ParticleFilterModule::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 162 of file ParticleFilterModule.cxx.

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

00163 {
00164 //======================================================================
00165 // Supply the default configuration for the module
00166 //======================================================================
00167   static Registry r; // Default configuration for module
00168 
00169   // Set name of config
00170   std::string name = this->GetName();
00171   name += ".config.default";
00172   r.SetName(name.c_str());
00173 
00174   // Set values in configuration
00175   r.UnLockValues();
00176   // by default look for electrons
00177   r.Set("ParticleType", CalDetParticleType::kElectron);
00178 
00179   r.Set("CutOverlaps", 0); // do not cut out overlaps by default
00180   r.Set("CutCerTime", 0); // do not cut out overlaps by default
00181   r.Set("CutChi2",0); //do not cut out chi2 by default
00182   r.Set("Chi2Limit",1.1); //set default limit of chi2 cut at <1.1
00183   r.Set("UseDST", 0); // do not try to use the uberdst by default
00184 
00185   r.LockValues();
00186 
00187   return r;
00188 }

void ParticleFilterModule::Help (  )  [virtual]

Implement to spew some useful help to cout

Reimplemented from JobCModule.

Definition at line 212 of file ParticleFilterModule.cxx.

References Msg::kInfo, and MSG.

00213 {
00214 //======================================================================
00215 // Prints a helpful message.
00216 //======================================================================
00217 
00218      MSG("CalDetDST", Msg::kInfo)
00219           <<"\n************** Help with ParticleFilterModule *****************\n"
00220           <<"ParticleFilterModule::Ana():\n"
00221           <<"===============================================================\n"
00222           <<"Filters events based on the contents of a\n"
00223           <<"CandCalDetPID object.\n"
00224           <<"Example: To select pions and muons do:\n\n"
00225           <<"Registry& r = \n"
00226           <<"jc.Path(\"X\").Mod(\"ParticleFilterModule\").GetConfig();\n"
00227           <<"r.UnlockValues();\n"
00228           <<"r.Set(\"ParticleType\","
00229           <<"CalDetParticleType::kPion|CalDetParticleType::kMuon);\n"
00230           <<"r.LockValues();\n"
00231           <<"jc.Path(\"X\").Mod(\"ParticleFilterModule\").Config(r);\n"
00232           <<"\nThis method will return kFailed if the particle type does\n"
00233           <<"not match the requested type, or in case no CandCalDetPID\n"
00234           <<"object can be found.\n"
00235           <<"===============================================================\n"
00236           <<"\nTakes config parameters:\n"
00237           <<" Int_t \"ParticleType\".\n"
00238           <<" Int_t \"CutOverlaps\". (!=0 to remove overlappers)\n"
00239           <<" Int_t \"CutCerTime\". (!=0 to cut on cer timing)\n"
00240           <<" Int_t \"CutChi2\". (!=0 to cut on chi2)\n"
00241           <<" Float_t \"Chi2Limit\". (Set upper limit on acceptable chi2)\n"
00242           <<" Int_t \"UseDST\". (!=0 to try and use the dst)\n"
00243           <<endl;
00244 
00245 }


Member Data Documentation

Definition at line 41 of file ParticleFilterModule.h.

Referenced by Ana(), and Config().

Definition at line 39 of file ParticleFilterModule.h.

Referenced by Ana(), and Config().

Definition at line 40 of file ParticleFilterModule.h.

Referenced by Ana(), and Config().

Definition at line 38 of file ParticleFilterModule.h.

Referenced by Ana(), and Config().

Definition at line 37 of file ParticleFilterModule.h.

Referenced by Ana(), and Config().

Definition at line 42 of file ParticleFilterModule.h.

Referenced by Ana(), and Config().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1