00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00018
00019 #include <cassert>
00020
00021 #include "CandSliceSR/SliceSRListModule.h"
00022
00023 #include "Algorithm/AlgConfig.h"
00024 #include "Algorithm/AlgFactory.h"
00025 #include "Algorithm/AlgHandle.h"
00026 #include "CandData/CandHeader.h"
00027 #include "CandData/CandRecord.h"
00028 #include "RecoBase/CandSliceListHandle.h"
00029 #include "RecoBase/CandSliceList.h"
00030 #include "RecoBase/CandSliceHandle.h"
00031 #include "Candidate/CandContext.h"
00032 #include "Conventions/Munits.h"
00033 #include "JobControl/JobCModuleRegistry.h"
00034 #include "JobControl/JobCommand.h"
00035 #include "MessageService/MsgService.h"
00036 #include "MinosObjectMap/MomNavigator.h"
00037 #include "RecoBase/CandStripListHandle.h"
00038 #include "Validity/VldContext.h"
00039
00040 ClassImp(SliceSRListModule)
00041
00042
00043 CVSID("$Id: SliceSRListModule.cxx,v 1.16 2005/04/05 21:33:59 bv Exp $");
00044 JOBMODULE(SliceSRListModule, "SliceSRListModule",
00045 "Builds CandSliceList from CandStripList");
00046
00047
00048 SliceSRListModule::SliceSRListModule()
00049 {
00050 }
00051
00052
00053 SliceSRListModule::~SliceSRListModule()
00054 {
00055 }
00056
00057
00058 void SliceSRListModule::BeginJob()
00059 {
00060 }
00061
00062 const Registry &SliceSRListModule::DefaultConfig() const
00063 {
00064
00065
00066
00067
00068
00069
00070
00071
00072 static Registry def_cfg;
00073 if (def_cfg.Size()) return def_cfg;
00074
00075 string name = this->JobCModule::GetName();
00076 name += ".config.default";
00077 def_cfg.SetName(name.c_str());
00078
00079
00080 def_cfg.Set("SliceListAlgorithm","AlgSliceSRList");
00081 def_cfg.Set("SliceListAlgConfig","default");
00082 def_cfg.Set("ListIn","CandStripList");
00083 def_cfg.Set("ListOut","CandSliceList");
00084 def_cfg.Set("LogLevel","Fatal");
00085 return def_cfg;
00086 }
00087
00088
00089
00090 JobCResult SliceSRListModule::Reco(MomNavigator *mom)
00091 {
00092 JobCResult result(JobCResult::kPassed);
00093
00094
00095 const char* tmps = 0;
00096 const char* alg_name = 0;
00097 const char* alg_config_name = 0;
00098 const char* list_in = 0;
00099 const char* list_out = 0;
00100
00101 Registry& cfg = this->GetConfig();
00102 if (cfg.Get("SliceListAlgorithm",tmps)) alg_name = tmps;
00103 if (cfg.Get("SliceListAlgConfig",tmps)) alg_config_name = tmps;
00104 if (cfg.Get("ListIn",tmps)) list_in = tmps;
00105 if (cfg.Get("ListOut",tmps)) list_out = tmps;
00106
00107
00108 CandRecord *candrec = dynamic_cast<CandRecord *>
00109 (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00110 if (candrec == 0) {
00111 MSG("SliceSR", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00112 << endl;
00113 result.SetWarning().SetFailed();
00114 return result;
00115 }
00116
00117
00118 CandStripListHandle *cslh = dynamic_cast<CandStripListHandle *>
00119 (candrec->FindCandHandle("", list_in));
00120
00121
00122 if (!cslh || cslh->GetNDaughters() < 1) {
00123 result.SetFailed();
00124 return result;
00125 }
00126
00127 AlgFactory &af = AlgFactory::GetInstance();
00128
00129
00130 AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name);
00131 CandContext cx(this, mom);
00132 cx.SetDataIn(cslh);
00133 cx.SetCandRecord(candrec);
00134 CandSliceListHandle csllh = CandSliceList::MakeCandidate(adlh, cx);
00135 csllh.SetName(list_out);
00136 csllh.SetTitle(TString("Created by SliceListModule from ").
00137 Append(cslh->GetName()));
00138 candrec->SecureCandHandle(csllh);
00139
00140 return result;
00141 }
00142