#include <TrackCamListModule.h>
Inheritance diagram for TrackCamListModule:

Public Member Functions | |
| TrackCamListModule () | |
| ~TrackCamListModule () | |
| void | BeginJob () |
| void | EndJob () |
| JobCResult | Reco (MomNavigator *mom) |
| const Registry & | DefaultConfig () const |
| void | Config (const Registry &r) |
| const char * | GetName () const |
Private Attributes | |
| TString | fListIn |
| TString | fListOut |
| TString | fAlgName |
| TString | fAlgConfig |
Definition at line 14 of file TrackCamListModule.h.
| TrackCamListModule::TrackCamListModule | ( | ) |
Definition at line 46 of file TrackCamListModule.cxx.
References fAlgConfig, fAlgName, and fListIn.
00047 { 00048 fAlgName="AlgTrackCamList"; 00049 fAlgConfig="default"; 00050 00051 fListIn="CandSliceList"; 00052 }
| TrackCamListModule::~TrackCamListModule | ( | ) |
| void TrackCamListModule::BeginJob | ( | ) | [virtual] |
Implement for notification of begin of job
Reimplemented from JobCModule.
Definition at line 64 of file TrackCamListModule.cxx.
References Msg::kDebug, and MSG.
00065 { 00066 MSG("TrackCamListModule", Msg::kDebug) << " Track Finder startup complete " << endl; 00067 }
| void TrackCamListModule::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 190 of file TrackCamListModule.cxx.
References fAlgConfig, fAlgName, fListIn, fListOut, and Registry::Get().
00191 { 00192 //====================================================================== 00193 // Configure the module given the Registry r 00194 //====================================================================== 00195 const char* tmps; 00196 if (r.Get("NameListIn",tmps)) { fListIn = tmps; } 00197 if (r.Get("NameListOut",tmps)) { fListOut = tmps; } 00198 if (r.Get("TrackCamAlgorithm",tmps)) { fAlgName = tmps; } 00199 if (r.Get("TrackListAlgConfig",tmps)) { fAlgConfig = tmps; } 00200 }
| const Registry & TrackCamListModule::DefaultConfig | ( | ) | 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 164 of file TrackCamListModule.cxx.
References GetName(), Registry::LockValues(), Registry::Set(), and Registry::UnLockValues().
00165 { 00166 //====================================================================== 00167 // Supply the default configuration for the module 00168 //====================================================================== 00169 static Registry r; // Default configuration for module 00170 00171 // Set name of config 00172 std::string name = this->GetName(); 00173 name += ".config.default"; 00174 r.SetName(name.c_str()); 00175 00176 // Set values in configuration 00177 r.UnLockValues(); 00178 r.Set("NameListIn","CandSliceList"); 00179 r.Set("NameListOut","CandTrackCamList"); 00180 r.Set("TrackCamAlgorithm","AlgTrackCamList"); 00181 r.Set("TrackListAlgConfig","default"); 00182 r.LockValues(); 00183 00184 return r; 00185 }
| void TrackCamListModule::EndJob | ( | ) | [virtual] |
Implement for notification of end of job
Reimplemented from JobCModule.
Definition at line 72 of file TrackCamListModule.cxx.
| const char * TrackCamListModule::GetName | ( | ) | const |
Returns the canonical name of this module
Reimplemented from JobCModule.
Definition at line 155 of file TrackCamListModule.cxx.
Referenced by DefaultConfig().
| JobCResult TrackCamListModule::Reco | ( | MomNavigator * | mom | ) | [virtual] |
Implement this for read-write access to the MomNavigator
Reimplemented from JobCModule.
Definition at line 79 of file TrackCamListModule.cxx.
References fAlgConfig, fAlgName, CandRecord::FindCandHandle(), fListIn, fListOut, AlgFactory::GetAlgHandle(), CandTrackCamListHandle::GetCPUTime(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), CandHandle::GetNDaughters(), RawRecord::GetRawHeader(), RawDaqHeader::GetRun(), RawDaqSnarlHeader::GetSnarl(), JobCResult::kAOK, Msg::kDebug, JobCResult::kPassed, Msg::kVerbose, Msg::kWarning, CandTrackCamList::MakeCandidate(), MSG, CandRecord::SecureCandHandle(), CandContext::SetCandRecord(), CandTrackCamListHandle::SetCPUTime(), CandContext::SetDataIn(), JobCResult::SetFailed(), CandHandle::SetName(), and CandHandle::SetTitle().
00080 { 00081 JobCResult result(JobCResult::kPassed); 00082 00083 const char* alg_name = 0; 00084 const char* alg_config_name = 0; 00085 00086 // Get CandRecord 00087 CandRecord *candrec = dynamic_cast<CandRecord *> (mom->GetFragment("CandRecord", "PrimaryCandidateRecord")); 00088 if(!candrec) 00089 { 00090 MSG("TrackCamListModule", Msg::kWarning) << " Failed to Find CandRecord " << endl; 00091 return result.SetFailed(); 00092 } 00093 00094 // Get RawRecord, in particular from the DaqSnarl stream 00095 RawRecord *rr = dynamic_cast<RawRecord *>(mom->GetFragment("RawRecord",0,"DaqSnarl")); 00096 if(rr==0){ 00097 MSG("TrackCamListModule", Msg::kWarning) << " Failed to Find RawRecord " << endl; 00098 return result.SetFailed(); 00099 } 00100 00101 // Get RawHeader 00102 else { 00103 const RawDaqSnarlHeader* hdr = dynamic_cast<const RawDaqSnarlHeader*>(rr->GetRawHeader()); 00104 if(hdr){ 00105 MSG("TrackCamListModule", Msg::kDebug) << "TrackCamListModule:Reco Run:Snarl "<<hdr->GetRun()<<":"<< hdr->GetSnarl()<<endl; 00106 } 00107 } 00108 00109 00110 // Get CandSliceListHandle 00111 CandSliceListHandle* slice_list = dynamic_cast<CandSliceListHandle*>(candrec->FindCandHandle("CandSliceListHandle",fListIn.Data())); 00112 if( !slice_list || (slice_list && slice_list->GetNDaughters()<1) ) 00113 { 00114 // Require number of CandSlices to be non-zero. 00115 if(!slice_list) { 00116 MSG("TrackCamListModule", Msg::kWarning) << " Failed to Find " << fListIn.Data() << endl;} 00117 else if(slice_list && slice_list->GetNDaughters()<1) { 00118 MSG("TrackCamListModule", Msg::kDebug) << " No slices found. Empty " << fListIn.Data() << endl;} 00119 00120 //return JobCResult::kPassed; 00121 return JobCResult::kAOK; // Otherwise no further processing of record 00122 } 00123 00124 00125 AlgFactory &af = AlgFactory::GetInstance(); 00126 alg_name=fAlgName.Data(); alg_config_name=fAlgConfig.Data(); 00127 AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name); 00128 00129 CandContext cx(this, mom); 00130 cx.SetCandRecord(candrec); 00131 cx.SetDataIn(slice_list); 00132 00133 clock_t dummyt; 00134 struct tms t1; 00135 struct tms t2; 00136 static double ticksPerSecond = sysconf(_SC_CLK_TCK); 00137 00138 dummyt = times(&t1); 00139 CandTrackCamListHandle ctlh = CandTrackCamList::MakeCandidate(adlh, cx); 00140 dummyt = times(&t2); 00141 ctlh.SetCPUTime((Double_t)(t2.tms_utime+t2.tms_stime-t1.tms_utime-t1.tms_stime)/ticksPerSecond); 00142 00143 MSG("TrackCamListModule", Msg::kVerbose) << "CandTrackCam CPUTime " << ctlh.GetCPUTime() << endl; 00144 00145 ctlh.SetName(fListOut.Data()); 00146 ctlh.SetTitle(TString("Created by TrackCamListModule")); 00147 candrec->SecureCandHandle(ctlh); 00148 00149 return JobCResult::kPassed; // kNoDecision, kFailed, etc. 00150 }
TString TrackCamListModule::fAlgConfig [private] |
Definition at line 38 of file TrackCamListModule.h.
Referenced by Config(), Reco(), and TrackCamListModule().
TString TrackCamListModule::fAlgName [private] |
Definition at line 37 of file TrackCamListModule.h.
Referenced by Config(), Reco(), and TrackCamListModule().
TString TrackCamListModule::fListIn [private] |
Definition at line 35 of file TrackCamListModule.h.
Referenced by Config(), Reco(), and TrackCamListModule().
TString TrackCamListModule::fListOut [private] |
1.4.7