00001
00002
00003
00004
00005
00006
00007
00008
00010
00011 #include <cassert>
00012
00013 #include "CandFitShowerEM/FitShowerEMListModule.h"
00014
00015 #include "Algorithm/AlgConfig.h"
00016 #include "Algorithm/AlgFactory.h"
00017 #include "Algorithm/AlgHandle.h"
00018 #include "CandData/CandHeader.h"
00019 #include "CandData/CandRecord.h"
00020 #include "CandFitShowerEM/CandFitShowerEMListHandle.h"
00021 #include "CandFitShowerEM/CandFitShowerEMList.h"
00022 #include "CandFitShowerEM/CandFitShowerEMHandle.h"
00023 #include "CandShowerEM/CandShowerEMList.h"
00024 #include "CandShowerEM/CandShowerEMListHandle.h"
00025 #include "Candidate/CandContext.h"
00026 #include "Conventions/Munits.h"
00027 #include "JobControl/JobCModuleRegistry.h"
00028 #include "JobControl/JobCommand.h"
00029 #include "MessageService/MsgService.h"
00030 #include "MinosObjectMap/MomNavigator.h"
00031 #include "RawData/RawHeader.h"
00032 #include "RawData/RawRecord.h"
00033 #include "RecoBase/CandClusterListHandle.h"
00034 #include "RecoBase/CandSliceListHandle.h"
00035 #include "Validity/VldContext.h"
00036
00037 ClassImp(FitShowerEMListModule)
00038
00039
00040 CVSID("$Id: FitShowerEMListModule.cxx,v 1.2 2004/09/29 00:07:29 cbs Exp $");
00041 JOBMODULE(FitShowerEMListModule, "FitShowerEMListModule",
00042 "Builds CandFitShowerEMList from CandShowerEMList");
00043
00044
00045 FitShowerEMListModule::FitShowerEMListModule()
00046 {
00047
00048 }
00049
00050
00051 FitShowerEMListModule::~FitShowerEMListModule()
00052 {
00053
00054 }
00055
00056
00057 void FitShowerEMListModule::BeginJob()
00058 {
00059
00060 }
00061
00062
00063
00064 const Registry &FitShowerEMListModule::DefaultConfig() const
00065 {
00066
00067 static Registry def_cfg;
00068 static bool been_here = false;
00069 if(been_here) return def_cfg;
00070 been_here=true;
00071
00072 std::string name = this->JobCModule::GetName();
00073 name += ".config.default";
00074 def_cfg.SetName(name.c_str());
00075
00076 def_cfg.Set("FitShowerEMListAlgorithm","AlgFitShowerEMList");
00077 def_cfg.Set("FitShowerEMListAlgConfig","default");
00078 def_cfg.Set("ListIn","CandShowerEMList");
00079 def_cfg.Set("ListOut","CandFitShowerEMList");
00080 def_cfg.Set("LogLevel","Fatal");
00081 return def_cfg;
00082
00083 }
00084
00085
00086 JobCResult FitShowerEMListModule::Reco(MomNavigator *mom)
00087 {
00088
00089 JobCResult result(JobCResult::kPassed);
00090
00091 MSG("FitShowerEM", Msg::kVerbose) << "FitShowerEMListModule::Reco\n";
00092
00093
00094 const char* tmps = 0;
00095 const char* alg_name = 0;
00096 const char* alg_config_name = 0;
00097 const char* list_in = 0;
00098 const char* list_out = 0;
00099
00100 Registry& cfg = this->GetConfig();
00101 if (cfg.Get("FitShowerEMListAlgorithm",tmps)) alg_name = tmps;
00102 if (cfg.Get("FitShowerEMListAlgConfig",tmps)) alg_config_name = tmps;
00103 if (cfg.Get("ListIn",tmps)) list_in = tmps;
00104 if (cfg.Get("ListOut",tmps)) list_out = tmps;
00105
00106
00107 CandRecord *candrec = dynamic_cast<CandRecord *>
00108 (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00109 if (candrec == 0) {
00110 MSG("FitShowerEM", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00111 << endl;
00112 result.SetWarning().SetFailed();
00113 return result;
00114 }
00115
00116
00117 CandSliceListHandle *cslh = dynamic_cast<CandSliceListHandle *>
00118 (candrec->FindCandHandle("CandSliceListHandle"));
00119 if (!cslh || cslh->GetNDaughters() < 1) {
00120 MSG("FitShowerEM", Msg::kDebug)
00121 << "Null CandSlice list. Bail out of event." << endl;
00122 result.SetFailed();
00123 return result;
00124 }
00125
00126 CandShowerEMListHandle *csemlh = dynamic_cast<CandShowerEMListHandle *>
00127 (candrec->FindCandHandle("CandShowerEMListHandle"));
00128 if (!csemlh || csemlh->GetNDaughters() < 1) {
00129 MSG("FitShowerEM", Msg::kDebug)
00130 << "Null CandShowerEM list. Bail out of event." << endl;
00131 return result;
00132 }
00133
00134 TObjArray cxin;
00135 cxin.Add(cslh);
00136 cxin.Add(csemlh);
00137
00138 AlgFactory &af = AlgFactory::GetInstance();
00139 AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name);
00140 CandContext cx(this, mom);
00141 cx.SetDataIn(&cxin);
00142 cx.SetCandRecord(candrec);
00143 CandFitShowerEMListHandle cfsemlh =
00144 CandFitShowerEMList::MakeCandidate(adlh, cx);
00145 cfsemlh.SetName(list_out);
00146 cfsemlh.SetTitle(TString("Created by FitShowerEMListModule from ").
00147 Append(csemlh->GetName()));
00148 candrec->SecureCandHandle(cfsemlh);
00149
00150 return result;
00151 }
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189