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

Public Member Functions | |
| AltModuleStpPatternRec () | |
| ~AltModuleStpPatternRec () | |
| void | BeginJob () |
| JobCResult | Reco (MomNavigator *mom) |
| const Registry & | DefaultConfig () const |
| void | Config (const Registry &r) |
| void | HandleCommand (JobCommand *command) |
Private Attributes | |
| TString | fListIn |
| TString | fListOut |
|
|
Definition at line 45 of file AltModuleStpPatternRec.cxx. References AlgFactory::GetInstance(), MSG, and AlgFactory::Register(). 00045 : 00046 fListIn("CandSliceSRListHandle"), 00047 fListOut("AltCandStpProbList") 00048 { 00049 MSG("Alt", Msg::kVerbose) << "AltModuleStpPatternRec::Constructor\n"; 00050 00051 //-- Get AlgFactory Instance. 00052 00053 AlgFactory &af = AlgFactory::GetInstance(); 00054 00055 //-- Register Algorithm configuration 00056 00057 af.Register( 00058 "AltAlgStpPatternRec", "default", "libAltReco.so", "AlgConfig"); 00059 af.Register( 00060 "AltAlgStpPatternRecList", "default", "libAltReco.so", "AlgConfig"); 00061 } //____________________________________________________________________________
|
|
|
Definition at line 63 of file AltModuleStpPatternRec.cxx. References MSG. 00064 {
00065 MSG("Alt", Msg::kVerbose) << "AltModuleStpPatternRec::Destructor\n";
00066 }
|
|
|
Implement for notification of begin of job Reimplemented from JobCModule. Definition at line 68 of file AltModuleStpPatternRec.cxx. References MSG. 00069 {
00070 MSG("Alt", Msg::kVerbose) << "AltModuleStpPatternRec::BeginJob\n";
00071 }
|
|
|
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 101 of file AltModuleStpPatternRec.cxx. References fListIn, fListOut, Registry::Get(), AlgHandle::GetAlgConfig(), AlgFactory::GetAlgHandle(), AlgFactory::GetInstance(), Registry::LockValues(), MSG, Registry::Set(), and Registry::UnLockValues(). 00102 {
00103 MSG("Alt", Msg::kDebug) << "AltModuleStpPatternRec::Config" << endl;
00104
00105 //-- Get AlgFactory Instance.
00106 AlgFactory &af = AlgFactory::GetInstance();
00107
00108 //-- Get Algorithm handle and retrieve its config.
00109 AlgHandle alglisthandle = af.GetAlgHandle("AltAlgSliceList","default");
00110 AlgConfig &alglistconfig = alglisthandle.GetAlgConfig();
00111
00112 //-- Set configuration parameters
00113
00114 int tmpi = 0;
00115 const char * tmpc = 0;
00116 double tmpd = 0;
00117
00118 if (r.Get("ListIn",tmpc)) fListIn = tmpc;
00119 if (r.Get("ListOut",tmpc)) fListOut = tmpc;
00120
00121 alglistconfig.UnLockValues();
00122
00123 if (r.Get("int_foo",tmpi)) alglistconfig.Set("int_foo", tmpi);
00124 if (r.Get("dbl_bar",tmpi)) alglistconfig.Set("dbl_bar", tmpd);
00125
00126 alglistconfig.LockValues();
00127 }
|
|
|
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 73 of file AltModuleStpPatternRec.cxx. References AlgHandle::GetAlgConfig(), AlgFactory::GetAlgHandle(), AlgFactory::GetInstance(), JobCModule::GetName(), Registry::LockValues(), MSG, Registry::Set(), and Registry::UnLockValues(). 00074 {
00075 MSG("Alt", Msg::kDebug) << "AltModuleStpPatternRec::DefaultConfig" << endl;
00076
00077 static Registry r;
00078
00079 std::string name = this->JobCModule::GetName();
00080 name += ".config.default";
00081 r.SetName(name.c_str());
00082 r.UnLockValues();
00083 r.LockValues();
00084
00085 //-- Get AlgFactory Instance.
00086 AlgFactory &af = AlgFactory::GetInstance();
00087
00088 //-- Get Algorithm handle and retrieve its config
00089 AlgHandle alglisthandle = af.GetAlgHandle("AltAlgStpPatternRecList","default");
00090 AlgConfig &alglistconfig = alglisthandle.GetAlgConfig();
00091
00092 //-- Set default configuration parameters
00093 alglistconfig.Set("int_foo", 0);
00094 alglistconfig.Set("dbl_bar", 0.0);
00095
00096 //alglistconfig.Print();
00097
00098 return r;
00099 }
|
|
|
Implement to handle a JobCommand Reimplemented from JobCModule. Definition at line 202 of file AltModuleStpPatternRec.cxx. References fListIn, fListOut, MSG, JobCommand::PopCmd(), and JobCommand::PopOpt(). 00203 {
00204 // Process configuration commands
00205 MSG("Alt", Msg::kDebug)
00206 << "AltModuleStpPatternRec::HandleCommand" << endl;
00207
00208 TString cmd = command->PopCmd();
00209 if (cmd == "Set") {
00210 TString opt = command->PopOpt();
00211 if (opt == "ListIn" ) fListIn = command->PopOpt();
00212 else if (opt == "ListOut") fListOut = command->PopOpt();
00213 else {
00214 MSG("Alt", Msg::kWarning)
00215 << "AltModuleStpPatternRec::HandleCommand: Unrecognized option "
00216 << opt << endl;
00217 }
00218 } else {
00219 MSG("Alt", Msg::kWarning)
00220 << "AltModuleStpPatternRec::HandleCommand: Unrecognized command "
00221 << cmd << endl;
00222 }
00223 }
|
|
|
Implement this for read-write access to the MomNavigator Reimplemented from JobCModule. Definition at line 129 of file AltModuleStpPatternRec.cxx. References CandRecord::FindCandHandle(), fListIn, fListOut, AlgFactory::GetAlgHandle(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), CandHandle::GetName(), CandHandle::GetNDaughters(), AltCandStpProbList::MakeCandidate(), MSG, CandRecord::SecureCandHandle(), CandContext::SetCandRecord(), CandContext::SetDataIn(), JobCResult::SetFailed(), CandHandle::SetName(), CandHandle::SetTitle(), and JobCResult::SetWarning(). 00130 {
00131 MSG("Alt", Msg::kVerbose) << "AltModuleStpPatternRec::Reco\n";
00132
00133 JobCResult result(JobCResult::kPassed);
00134
00135 //-- Find PrimaryCandidateRecord fragment in MOM & check it is not null.
00136
00137 CandRecord *cdrec = dynamic_cast<CandRecord *>
00138 (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00139 if (cdrec == 0) {
00140 MSG("Alt", Msg::kWarning)<< "NULL PrimaryCandidateRecord pointer" << endl;
00141 result.SetWarning().SetFailed();
00142 return result;
00143 }
00144
00145 //-- Get a handle to CandSliceList (previous step reconstruction objects).
00146
00147 MSG("Alt", Msg::kDebug)
00148 << "Asking PrimaryCandidateRecord for fListIn: " << fListIn.Data() << endl;
00149
00150 CandSliceListHandle *cslh = dynamic_cast<CandSliceListHandle *>
00151 (cdrec->FindCandHandle(fListIn.Data()));
00152
00153 //-- Require number of CandSlices to be non-zero.
00154
00155 if (!cslh) {
00156 MSG("Alt", Msg::kDebug) << "NULL CandSliceListHandle pointer" << endl;
00157 result.SetFailed();
00158 return result;
00159
00160 } else {
00161 if(cslh->GetNDaughters() < 1) {
00162 MSG("Alt", Msg::kDebug) << "Empty CandSlice list." << endl;
00163 result.SetFailed();
00164 return result;
00165 }
00166 }
00167
00168 //-- Get AlgFactory instance.
00169
00170 AlgFactory &af = AlgFactory::GetInstance();
00171
00172 //-- Build a CandSliceSRList.
00173
00174 AlgHandle adlh = af.GetAlgHandle("AltAlgStpPatternRecList", "default");
00175
00176 //-- Create a candidate context, set data_in and candidate record
00177 CandContext cx(this, mom);
00178 cx.SetDataIn(cslh);
00179 cx.SetCandRecord(cdrec);
00180
00181 //-- Initiate Reco : AltCandStpProbList:MakeCandidate
00182
00183 MSG("Alt", Msg::kDebug)
00184 << "probh = AltCandStpProbList:MakeCandidate(adlh, cx)" << endl;
00185 AltCandStpProbListHandle pbh = AltCandStpProbList::MakeCandidate(adlh, cx);
00186
00187 MSG("Alt", Msg::kDebug)
00188 << "AltCandStpProbListHandle:: set name & title" << endl;
00189 pbh.SetName(fListOut.Data());
00190 pbh.SetTitle(
00191 TString("Brought to life by AltModuleStpPatternRec from candslicelist").
00192 Append(cslh->GetName())
00193 );
00194
00195 //-- Secure the CandHandle in the CandRecord
00196 MSG("Alt", Msg::kDebug) << "candrec->SecureCandHandle(pbh);" << endl;
00197 cdrec->SecureCandHandle(pbh);
00198
00199 return result;
00200 }
|
|
|
Definition at line 40 of file AltModuleStpPatternRec.h. Referenced by Config(), HandleCommand(), and Reco(). |
|
|
Definition at line 41 of file AltModuleStpPatternRec.h. Referenced by Config(), HandleCommand(), and Reco(). |
1.3.9.1