ParticlePIDSaver Class Reference

#include <ParticlePIDSaver.h>

Inheritance diagram for ParticlePIDSaver:
JobCModule

List of all members.

Public Member Functions

 ParticlePIDSaver ()
 ~ParticlePIDSaver ()
void BeginJob ()
void EndJob ()
JobCResult Reco (MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)
void Reset ()

Private Member Functions

int isMatched (NueRecord *nr, PRecord *pr)

Private Attributes

string kPOTTreeName
string kPOTTreeNameIn

Detailed Description

Definition at line 19 of file ParticlePIDSaver.h.


Constructor & Destructor Documentation

ParticlePIDSaver::ParticlePIDSaver (  ) 

(Document me!)

Definition at line 29 of file ParticlePIDSaver.cxx.

00030 {
00031 
00035 }

ParticlePIDSaver::~ParticlePIDSaver (  ) 

(Document me!)

Definition at line 38 of file ParticlePIDSaver.cxx.

00039 {
00043 
00044 }


Member Function Documentation

void ParticlePIDSaver::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

(Document me!)

Reimplemented from JobCModule.

Definition at line 48 of file ParticlePIDSaver.cxx.

00049 {
00053 }

void ParticlePIDSaver::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.

Configure the module given the Registry r

Reimplemented from JobCModule.

Definition at line 209 of file ParticlePIDSaver.cxx.

References Registry::Get(), kPOTTreeName, and kPOTTreeNameIn.

00210 {
00214   
00215     const char* tmps;
00216     if(r.Get("POTTreeName",tmps))kPOTTreeName=tmps;
00217     if(r.Get("POTTreeNameIn",tmps))kPOTTreeNameIn=tmps;
00218 
00219 
00220   
00221 }

const Registry & ParticlePIDSaver::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; }

Supply the default configuration for the module

Reimplemented from JobCModule.

Definition at line 181 of file ParticlePIDSaver.cxx.

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

00182 {
00186   static Registry r; // Default configuration for module
00187 
00188 
00189   std::string name = this->GetName();
00190   name += ".config.default";
00191   r.SetName(name.c_str());
00192 
00193 
00194 
00195 
00196   // Set values in configuration
00197   r.UnLockValues();
00198   r.Set("POTTreeName","");
00199   r.Set("POTTreeNameIn","");
00200 
00201   r.LockValues();
00202 
00203 
00204   return r;
00205 }

void ParticlePIDSaver::EndJob (  )  [virtual]

Implement for notification of end of job

(Document me!)

Reimplemented from JobCModule.

Definition at line 57 of file ParticlePIDSaver.cxx.

References kPOTTreeName, and kPOTTreeNameIn.

00058 {
00062 
00063   if(kPOTTreeName=="")return; //don't want to copy pottree...
00064 
00065 
00066    TFile *fpf = dynamic_cast<TFile *>(gROOT->GetListOfFiles()->FindObject(kPOTTreeName.c_str()));
00067    if(fpf){
00068         printf("got outfile\n");
00069    }
00070 
00071 
00072    TFile *fpi = dynamic_cast<TFile *>(gROOT->GetListOfFiles()->FindObject(kPOTTreeNameIn.c_str()));
00073    if(fpi){
00074         printf("got infile\n");
00075         TTree *pt = (TTree*)fpi->Get("pottree");           
00076         if(pt)
00077         {
00078                 printf("got pottree\n");
00079                 fpf->cd();
00080                 pt->Write();
00081         }
00082    }
00083 
00084 
00085 
00086 
00087 }

int ParticlePIDSaver::isMatched ( NueRecord nr,
PRecord pr 
) [private]

Definition at line 237 of file ParticlePIDSaver.cxx.

References RecCandHeader::GetEvent(), NueHeader::GetEventNo(), RecRecordImp< T >::GetHeader(), NueHeader::GetRun(), RecDataHeader::GetRun(), NueHeader::GetSnarl(), and RecPhysicsHeader::GetSnarl().

Referenced by Reco().

00238 {
00239         int match = 1;
00240         match = match && (nr->GetHeader().GetRun() == pr->GetHeader().GetRun());
00241         match = match && (nr->GetHeader().GetSnarl() == pr->GetHeader().GetSnarl());
00242         match = match && (nr->GetHeader().GetEventNo() == pr->GetHeader().GetEvent());
00243 
00244         return match;
00245 }

JobCResult ParticlePIDSaver::Reco ( MomNavigator mom  )  [virtual]

Implement this for read-write access to the MomNavigator

(Document me!)

Reimplemented from JobCModule.

Definition at line 91 of file ParticlePIDSaver.cxx.

References RecCandHeader::GetEvent(), NueHeader::GetEventNo(), MomNavigator::GetFragmentList(), RecRecordImp< T >::GetHeader(), NueHeader::GetRun(), RecDataHeader::GetRun(), NueHeader::GetSnarl(), RecPhysicsHeader::GetSnarl(), isMatched(), JobCResult::kPassed, Munits::m, Munits::mm, NueRecord::precord, and NueRecord::precordMRCC.

00092 {
00096 
00097 
00098   std::vector<TObject* > nrv = ( mom->GetFragmentList("NueRecord"));
00099   std::vector<TObject* > hft =( mom->GetFragmentList("PRecord","Normal"));
00100   std::vector<TObject* > hftm =( mom->GetFragmentList("PRecord","MRCC"));
00101 
00102 
00103 for(unsigned int s =0;s<hft.size();s++)
00104 {
00105 
00106         PRecord *pr=0;
00107         pr=dynamic_cast<PRecord *>(hft[s]);
00108 
00109         if(!pr)continue;
00110         
00111         NueRecord *nr=0;
00112         if(s<nrv.size())
00113                 nr=dynamic_cast<NueRecord *>(nrv[s]);
00114 
00115 
00116         //make sure we are synced...
00117         int match=0;
00118         if(nr)match=isMatched(nr,pr);
00119         
00120         if(!match)
00121         {
00122                 for(int m=0;m<(int)nrv.size();m++)
00123                 {
00124                         nr=dynamic_cast<NueRecord *>(nrv[m]);
00125                         int mm = isMatched(nr,pr);
00126                         if(mm){
00127                                 match=1;
00128                                 break;
00129                         }
00130                 }
00131         }
00132   
00133         if(!match)continue;//unable to finding matching nue record... probably not passing nue quality cuts
00134 
00135 
00136 /*
00137         if(!match)
00138         {
00139                 printf("unable to match in ParticlePIDSaver!\n");
00140                 exit(1);
00141         }
00142 */      
00143         
00144         (nr->precord) = *pr;
00145 
00146         //is there an mrcc record?
00147         for(unsigned int j=0;j<hftm.size();j++)
00148         {
00149                 PRecord *pr=0;
00150                 pr=dynamic_cast<PRecord *>(hftm[j]);
00151                 if(!pr)continue;
00152 
00153                 //make sure we are synced...
00154                 int match=1;
00155                 match = match && (nr->GetHeader().GetRun() == pr->GetHeader().GetRun());
00156                 match = match && (nr->GetHeader().GetSnarl() == pr->GetHeader().GetSnarl());
00157                 match = match && (nr->GetHeader().GetEventNo() == pr->GetHeader().GetEvent());
00158 
00159                 if(match)
00160                 {
00161 
00162                         (nr->precordMRCC) = *pr;
00163 
00164                 }
00165 
00166         }
00167 
00168 }
00169 
00170 
00171 
00172 
00173 
00174 
00175 
00176   return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00177 }

void ParticlePIDSaver::Reset (  )  [virtual]

Implement to reset oneself

(Document me!)

Reimplemented from JobCModule.

Definition at line 225 of file ParticlePIDSaver.cxx.

00226 {
00230 }


Member Data Documentation

Definition at line 50 of file ParticlePIDSaver.h.

Referenced by Config(), and EndJob().

Definition at line 51 of file ParticlePIDSaver.h.

Referenced by Config(), and EndJob().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1