00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00018
00019 #include <cassert>
00020
00021 #include "Algorithm/AlgConfig.h"
00022 #include "Algorithm/AlgFactory.h"
00023 #include "Algorithm/AlgHandle.h"
00024 #include "Calibrator/Calibrator.h"
00025 #include "CandData/CandHeader.h"
00026 #include "CandData/CandRecord.h"
00027 #include "CandDigit/CandDigitListHandle.h"
00028 #include "RecoBase/CandShowerListHandle.h"
00029 #include "RecoBase/CandShowerList.h"
00030 #include "RecoBase/CandShowerHandle.h"
00031 #include "CandShowerSR/CandShowerSRList.h"
00032 #include "CandShowerSR/CandShowerSRListHandle.h"
00033 #include "CandShowerSR/CandShowerSR.h"
00034 #include "CandShowerSR/CandShowerSRHandle.h"
00035 #include "CandShowerSR/ShowerSRListModule.h"
00036 #include "CandSubShowerSR/CandSubShowerSRListHandle.h"
00037 #include "Candidate/CandContext.h"
00038 #include "Conventions/Munits.h"
00039 #include "JobControl/JobCModuleRegistry.h"
00040 #include "JobControl/JobCommand.h"
00041 #include "MessageService/MsgService.h"
00042 #include "MinosObjectMap/MomNavigator.h"
00043 #include "RawData/RawDigit.h"
00044 #include "RawData/RawHeader.h"
00045 #include "RawData/RawRecord.h"
00046 #include "RawData/RawChannelId.h"
00047 #include "RawData/RawDaqSnarlHeader.h"
00048 #include "RawData/RawDaqHeaderBlock.h"
00049 #include "RawData/RawDigitDataBlock.h"
00050 #include "RawData/RawVarcErrorInTfBlock.h"
00051 #include "RecoBase/CandStripHandle.h"
00052 #include "RecoBase/CandStripListHandle.h"
00053 #include "RecoBase/CandClusterListHandle.h"
00054 #include "RecoBase/CandSliceListHandle.h"
00055 #include "RecoBase/CandShowerListHandle.h"
00056 #include "RecoBase/CandShowerHandle.h"
00057 #include "Validity/VldContext.h"
00058
00059 ClassImp(ShowerSRListModule)
00060
00061
00062 CVSID("$Id: ShowerSRListModule.cxx,v 1.42 2005/06/28 14:13:24 musser Exp $");
00063 JOBMODULE(ShowerSRListModule, "ShowerSRListModule",
00064 "Builds CandShowerList from CandSliceList");
00065
00066
00067 ShowerSRListModule::ShowerSRListModule()
00068 {
00069 }
00070
00071
00072 ShowerSRListModule::~ShowerSRListModule()
00073 {
00074 }
00075
00076
00077 void ShowerSRListModule::BeginJob()
00078 {
00079 }
00080
00081 const Registry &ShowerSRListModule::DefaultConfig() const
00082 {
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 static Registry def_cfg;
00093 static bool been_here = false;
00094 if(been_here)return def_cfg;
00095 been_here=true;
00096
00097 string name = this->JobCModule::GetName();
00098 name += ".config.default";
00099 def_cfg.SetName(name.c_str());
00100
00101
00102 def_cfg.Set("ShowerListAlgorithm","AlgShowerSRList");
00103 def_cfg.Set("ShowerListAlgConfig","default");
00104 def_cfg.Set("ListIn","CandSliceList");
00105 def_cfg.Set("ClusterListIn","CandClusterList");
00106 def_cfg.Set("SubShowerListIn","CandSubShowerSRList");
00107 def_cfg.Set("ListOut","CandShowerList");
00108 def_cfg.Set("LogLevel","Fatal");
00109 return def_cfg;
00110 }
00111
00112
00113 JobCResult ShowerSRListModule::Reco(MomNavigator *mom)
00114 {
00115 JobCResult result(JobCResult::kPassed);
00116
00117
00118 const char* tmps = 0;
00119 const char* alg_name = 0;
00120 const char* alg_config_name = 0;
00121 const char* list_in = 0;
00122 const char* cluster_list=0;
00123 const char* subshower_list=0;
00124 const char* list_out = 0;
00125
00126 Registry& cfg = this->GetConfig();
00127 if (cfg.Get("ShowerListAlgorithm",tmps)) alg_name = tmps;
00128 if (cfg.Get("ShowerListAlgConfig",tmps)) alg_config_name = tmps;
00129 if (cfg.Get("ListIn",tmps)) list_in = tmps;
00130 if (cfg.Get("ClusterListIn",tmps)) cluster_list = tmps;
00131 if (cfg.Get("SubShowerListIn",tmps)) subshower_list = tmps;
00132 if (cfg.Get("ListOut",tmps)) list_out = tmps;
00133
00134
00135 CandRecord *candrec = dynamic_cast<CandRecord *>
00136 (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00137 if (candrec == 0) {
00138 MSG("ShowerSR", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00139 << endl;
00140 result.SetWarning().SetFailed();
00141 return result;
00142 }
00143
00144
00145 Calibrator::Instance().Reset(*candrec->GetVldContext());
00146
00147
00148 CandSliceListHandle *cslh = dynamic_cast<CandSliceListHandle *>
00149 (candrec->FindCandHandle("CandSliceListHandle",list_in));
00150 if(!cslh){
00151 MSG("ShowerSR", Msg::kVerbose)
00152 << "Null CandSlice list. Skip Shower Construction." << endl;
00153 return result;
00154 }
00155
00156 CandClusterListHandle *cclh = dynamic_cast<CandClusterListHandle *>
00157 (candrec->FindCandHandle("CandClusterListHandle",cluster_list));
00158 if(!cclh){
00159 return result;
00160 }
00161
00162 CandSubShowerSRListHandle *sslh = dynamic_cast<CandSubShowerSRListHandle *>
00163 (candrec->FindCandHandle("CandSubShowerSRListHandle",subshower_list));
00164
00165 if(!sslh) {
00166 MSG("ShowerSS", Msg::kDebug)
00167 << "Null CandSubShower list." << endl;
00168 }
00169
00170 TObjArray cxin;
00171 cxin.Add(cslh);
00172 cxin.Add(cclh);
00173 if(sslh) cxin.Add(sslh);
00174
00175 AlgFactory &af = AlgFactory::GetInstance();
00176 AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name);
00177 CandContext cx(this, mom);
00178 cx.SetDataIn(&cxin);
00179 cx.SetCandRecord(candrec);
00180
00181 if(strcmp(alg_name,"AlgShowerSRList")==0) {
00182 CandShowerListHandle csllh = CandShowerList::MakeCandidate(adlh, cx);
00183 csllh.SetName(list_out);
00184 csllh.SetTitle(TString("Created by ShowerSRListModule from ").
00185 Append(cslh->GetName()));
00186 candrec->SecureCandHandle(csllh);
00187 }
00188 else if(strcmp(alg_name,"AlgShowerSSList")==0){
00189 CandShowerSRListHandle cssrlh = CandShowerSRList::MakeCandidate(adlh, cx);
00190 cssrlh.SetName(list_out);
00191 cssrlh.SetTitle(TString("Created by ShowerSRListModule from ").
00192 Append(cslh->GetName()));
00193 candrec->SecureCandHandle(cssrlh);
00194 }
00195
00196 return result;
00197
00198 }
00199
00200
00201