00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00017
00018 #include <cassert>
00019
00020 #include "CandFitTrack3/FitTrack3ListModule.h"
00021
00022 #include "Algorithm/AlgConfig.h"
00023 #include "Algorithm/AlgFactory.h"
00024 #include "Algorithm/AlgHandle.h"
00025 #include "CandData/CandHeader.h"
00026 #include "CandData/CandRecord.h"
00027 #include "CandDigit/CandDigitListHandle.h"
00028 #include "CandDigit/CandDeMuxDigitListHandle.h"
00029 #include "CandFitTrack3/CandFitTrack3ListHandle.h"
00030 #include "CandFitTrack3/CandFitTrack3List.h"
00031 #include "CandFitTrack3/CandFitTrack3Handle.h"
00032 #include "CandTrackSR/CandTrackSRHandle.h"
00033 #include "Candidate/CandContext.h"
00034 #include "Conventions/Munits.h"
00035 #include "Conventions/StripEnd.h"
00036 #include "DeMux/DmxStatus.h"
00037 #include "JobControl/JobCModuleRegistry.h"
00038 #include "JobControl/JobCommand.h"
00039 #include "MessageService/MsgService.h"
00040 #include "MinosObjectMap/MomNavigator.h"
00041 #include "RawData/RawDigit.h"
00042 #include "RawData/RawHeader.h"
00043 #include "RawData/RawRecord.h"
00044 #include "RawData/RawChannelId.h"
00045 #include "RawData/RawDaqSnarlHeader.h"
00046 #include "RawData/RawDaqHeaderBlock.h"
00047 #include "RawData/RawDigitDataBlock.h"
00048 #include "RawData/RawSnarlHeaderBlock.h"
00049 #include "RawData/RawVarcErrorInTfBlock.h"
00050 #include "RecoBase/CandClusterListHandle.h"
00051 #include "RecoBase/CandFitTrackHandle.h"
00052 #include "RecoBase/CandSliceListHandle.h"
00053 #include "RecoBase/CandSliceHandle.h"
00054 #include "RecoBase/CandStripListHandle.h"
00055 #include "RecoBase/CandStripHandle.h"
00056 #include "RecoBase/CandTrackListHandle.h"
00057 #include "RecoBase/CandTrackHandle.h"
00058 #include "RecoBase/LinearFit.h"
00059 #include "RecoBase/PropagationVelocity.h"
00060 #include "Validity/VldContext.h"
00061 #include "Validity/VldTimeStamp.h"
00062
00063 #include "MINF_Classes/MINFast.h"
00064 #include "REROOT_Classes/REROOT_FluxWgt.h"
00065 #include "REROOT_Classes/REROOT_NeuKin.h"
00066 #include "REROOT_Classes/REROOT_NeuVtx.h"
00067 #include "REROOT_Classes/REROOT_Event.h"
00068 #include "REROOT_Classes/REROOT_StdHep.h"
00069
00070 ClassImp(FitTrack3ListModule)
00071
00072
00073 CVSID("$Id: FitTrack3ListModule.cxx,v 1.4 2003/11/10 20:19:42 brebel Exp $");
00074 JOBMODULE(FitTrack3ListModule, "FitTrack3ListModule",
00075 "Builds CandFitTrack3List from CandTrackList");
00076
00077
00078 FitTrack3ListModule::FitTrack3ListModule() :
00079 fListIn("CandTrackList"),fListOut("CandFitTrack3List")
00080 {
00081 MSG("FitTrack3", Msg::kVerbose) << "FitTrack3ListModule::Constructor\n";
00082
00083
00084 AlgFactory &af = AlgFactory::GetInstance();
00085
00086
00087 af.Register("AlgFitTrack3", "default", "libCandFitTrack3.so", "AlgConfig");
00088
00089
00090 af.Register("AlgFitTrack3List", "default", "libCandFitTrack3.so", "AlgConfig");
00091
00092 }
00093
00094
00095 FitTrack3ListModule::~FitTrack3ListModule()
00096 {
00097 MSG("FitTrack3", Msg::kVerbose) << "FitTrack3ListModule::Destructor\n";
00098 }
00099
00100
00101 void FitTrack3ListModule::BeginJob()
00102 {
00103 MSG("FitTrack3", Msg::kVerbose) << "FitTrack3ListModule::BeginJob\n";
00104
00105 }
00106
00107
00108
00109 const Registry &FitTrack3ListModule::DefaultConfig() const
00110 {
00111
00112
00113
00114
00115
00116
00117
00118
00119 MSG("FitTrack3", Msg::kDebug)
00120 << "FitTrack3ListModule::DefaultConfig" << endl;
00121
00122 static Registry r;
00123
00124 std::string name = this->JobCModule::GetName();
00125 name += ".config.default";
00126 r.SetName(name.c_str());
00127 r.UnLockValues();
00128 r.LockValues();
00129
00130
00131 AlgFactory &af = AlgFactory::GetInstance();
00132
00133 AlgHandle alghandle = af.GetAlgHandle("AlgFitTrack3","default");
00134 AlgConfig &algconfig = alghandle.GetAlgConfig();
00135
00136 algconfig.Set("MaxIterate",30);
00137
00138
00139
00140 algconfig.Set("MisalignmentError",2);
00141 return r;
00142 }
00143
00144
00145
00146 void FitTrack3ListModule::Config(const Registry &r)
00147 {
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157 MSG("FitTrack3", Msg::kDebug) << "FitTrack3ListModule::Config" << endl;
00158
00159
00160 AlgFactory &af = AlgFactory::GetInstance();
00161
00162 AlgHandle alghandle = af.GetAlgHandle("AlgFitTrack3","default");
00163 AlgConfig &algconfig = alghandle.GetAlgConfig();
00164
00165
00166 Int_t tmpi;
00167
00168
00169
00170 if (r.Get("MaxIterate",tmpi)) {
00171 algconfig.UnLockValues();
00172 algconfig.Set("MaxIterate",tmpi);
00173 algconfig.LockValues();
00174 }
00175 if (r.Get("MisalignmentError",tmpi)) {
00176 algconfig.UnLockValues();
00177 algconfig.Set("MisalignmentError",tmpi);
00178 algconfig.LockValues();
00179 }
00180
00181 }
00182
00183
00184
00185
00186 JobCResult FitTrack3ListModule::Reco(MomNavigator *mom)
00187 {
00188 JobCResult result(JobCResult::kPassed);
00189
00190 MSG("FitTrack3", Msg::kVerbose) << "FitTrack3ListModule::Reco\n";
00191
00192
00193 CandRecord *candrec = dynamic_cast<CandRecord *>
00194 (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00195 if (candrec == 0) {
00196 MSG("FitTrack3", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00197 << endl;
00198
00199 result.SetWarning().SetFailed();
00200 return result;
00201 }
00202
00203
00204 MSG("FitTrack3", Msg::kVerbose)
00205 << "CandSliceListHandle *cslh = (CandSliceListHandle *) "
00206 << "candrec->FindCandHandle(\"CandSliceListHandle\", "
00207 << "fListIn.Data());" << endl;
00208 CandSliceListHandle *cslh = dynamic_cast<CandSliceListHandle *>
00209 (candrec->FindCandHandle("CandSliceListHandle"));
00210
00211
00212 if (!cslh || cslh->GetNDaughters() < 1) {
00213 MSG("FitTrack3", Msg::kDebug)
00214 << "Null CandSlice list. Bail out of event." << endl;
00215 result.SetFailed();
00216 return result;
00217 }
00218
00219 CandTrackListHandle *ctlh = dynamic_cast<CandTrackListHandle *>
00220 (candrec->FindCandHandle("CandTrackListHandle"));
00221
00222
00223 if (!ctlh || ctlh->GetNDaughters() < 1) {
00224 MSG("FitTrack3", Msg::kDebug)
00225 << "Null CandTrack list. Bail out of event." << endl;
00226 result.SetFailed();
00227 return result;
00228 }
00229
00230 TObjArray cxin;
00231 cxin.Add(cslh);
00232 cxin.Add(ctlh);
00233
00234
00235 MSG("FitTrack3", Msg::kVerbose)
00236 << "Get Singleton instance of AlgFactory." << endl
00237 << "AlgFactory &af = AlgFactory::GetInstance();" << endl;
00238 AlgFactory &af = AlgFactory::GetInstance();
00239
00240
00241 MSG("FitTrack3", Msg::kVerbose)
00242 << "Ask AlgFactory for Singleton AlgFitTrack3List instance." << endl
00243 << "AlgHandle adlh = af.GetAlgHandle(\"AlgFitTrack3List\", \"default\");"
00244 << endl;
00245 AlgHandle adlh = af.GetAlgHandle("AlgFitTrack3List", "default");
00246
00247 MSG("FitTrack3", Msg::kVerbose) << "CandContext cx(this);" << endl;
00248 CandContext cx(this, mom);
00249
00250 MSG("FitTrack3", Msg::kVerbose) << "cx.SetDataIn(cslh);" << endl;
00251 cx.SetDataIn(&cxin);
00252 cx.SetCandRecord(candrec);
00253
00254
00255 MSG("FitTrack3", Msg::kVerbose)
00256 << "ctllh = CandFitTrack3List::MakeCandidate(adlh, cx);" << endl;
00257 CandFitTrack3ListHandle cftlh = CandFitTrack3List::MakeCandidate(adlh, cx);
00258 cftlh.SetName(fListOut.Data());
00259 cftlh.SetTitle(TString("Created by FitTrack3ListModule from ").
00260 Append(ctlh->GetName()));
00261
00262
00263 MSG("FitTrack3", Msg::kDebug) << "candrec->SecureCandHandle(cftlh);"
00264 << endl;
00265 candrec->SecureCandHandle(cftlh);
00266
00267 return result;
00268 }
00269
00270
00271 void FitTrack3ListModule::HandleCommand(JobCommand *command)
00272 {
00273
00274
00275 MSG("FitTrack3", Msg::kDebug)
00276 << "FitTrack3ListModule::HandleCommand" << endl;
00277
00278 TString cmd = command->PopCmd();
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299 }