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