Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ShowerEMListModule.cxx

Go to the documentation of this file.
00001 
00002 // $Id: ShowerEMListModule.cxx,v 1.5 2010/01/06 18:47:35 rhatcher Exp $
00003 //
00004 // ShowerEMListModule.cxx
00005 //
00006 // A JobControl Module for filling CandShowerEMList from
00007 // CandSliceList and CandCLusterList
00008 //
00010 
00011 #include <cassert>
00012 
00013 #include "Algorithm/AlgConfig.h"
00014 #include "Algorithm/AlgFactory.h"
00015 #include "Algorithm/AlgHandle.h"
00016 #include "Calibrator/Calibrator.h"
00017 #include "CandData/CandHeader.h"
00018 #include "CandData/CandRecord.h"
00019 #include "CandDigit/CandDigitListHandle.h"
00020 #include "CandShowerEM/CandShowerEMListHandle.h"
00021 #include "CandShowerEM/CandShowerEMList.h"
00022 #include "CandShowerEM/CandShowerEMHandle.h"
00023 #include "CandShowerEM/ShowerEMListModule.h"
00024 #include "Candidate/CandContext.h"
00025 #include "Conventions/Munits.h"
00026 #include "JobControl/JobCModuleRegistry.h"
00027 #include "JobControl/JobCommand.h"
00028 #include "MessageService/MsgService.h"
00029 #include "MinosObjectMap/MomNavigator.h"
00030 #include "RawData/RawDigit.h"
00031 #include "RawData/RawHeader.h"
00032 #include "RawData/RawRecord.h"
00033 #include "RawData/RawChannelId.h"
00034 #include "RawData/RawDaqSnarlHeader.h"
00035 #include "RawData/RawDaqHeaderBlock.h"
00036 #include "RawData/RawDigitDataBlock.h"
00037 #include "RawData/RawVarcErrorInTfBlock.h"
00038 #include "RecoBase/CandStripHandle.h"
00039 #include "RecoBase/CandStripListHandle.h"
00040 #include "RecoBase/CandClusterListHandle.h"
00041 #include "RecoBase/CandSliceListHandle.h"
00042 #include "RecoBase/CandShowerListHandle.h"
00043 #include "RecoBase/CandShowerHandle.h"
00044 #include "Validity/VldContext.h"
00045 
00046 ClassImp(ShowerEMListModule)
00047 
00048 //......................................................................
00049 CVSID("$Id: ShowerEMListModule.cxx,v 1.5 2010/01/06 18:47:35 rhatcher Exp $");
00050 JOBMODULE(ShowerEMListModule, "ShowerEMListModule",
00051          "Builds CandShowerEMList from CandSliceList");
00052 
00053 //......................................................................
00054 ShowerEMListModule::ShowerEMListModule()
00055 {
00056 
00057 }
00058 
00059 //......................................................................
00060 ShowerEMListModule::~ShowerEMListModule() 
00061 {
00062 
00063 }
00064 
00065 //......................................................................
00066 void ShowerEMListModule::BeginJob() 
00067 {
00068 
00069 }
00070 
00071 const Registry &ShowerEMListModule::DefaultConfig() const
00072 { 
00073     
00074   static Registry def_cfg;
00075   static bool been_here = false;
00076   if(been_here) return def_cfg;
00077   been_here=true;
00078   
00079   std::string name = this->JobCModule::GetName();
00080   name += ".config.default";
00081   def_cfg.SetName(name.c_str());
00082   
00083   def_cfg.Set("ShowerEMListAlgorithm","AlgShowerEMList");
00084   def_cfg.Set("ShowerEMListAlgConfig","default");
00085   def_cfg.Set("ListIn","CandSliceList");
00086   def_cfg.Set("ClusterListIn","CandClusterList");
00087   def_cfg.Set("ListOut","CandShowerEMList");
00088   def_cfg.Set("LogLevel","Fatal");
00089   return def_cfg;
00090   
00091 }
00092 
00093 //......................................................................
00094 JobCResult ShowerEMListModule::Reco(MomNavigator *mom)
00095 {
00096    JobCResult result(JobCResult::kPassed);
00097 
00098    MSG("ShowerEM", Msg::kVerbose) << "ShowerEMListModule::Reco\n";
00099 
00100    // load configuration 
00101    const char* tmps = 0;
00102    const char* alg_name = 0;
00103    const char* alg_config_name = 0;
00104    const char* list_in = 0;
00105    const char* cluster_list=0;
00106    const char* list_out = 0;
00107 
00108    Registry& cfg = this->GetConfig();
00109    if (cfg.Get("ShowerEMListAlgorithm",tmps)) alg_name = tmps;
00110    if (cfg.Get("ShowerEMListAlgConfig",tmps)) alg_config_name = tmps;
00111    if (cfg.Get("ListIn",tmps)) list_in = tmps;
00112    if (cfg.Get("ClusterListIn",tmps)) cluster_list = tmps;
00113    if (cfg.Get("ListOut",tmps)) list_out = tmps;   
00114 
00115    /*
00116    RawRecord *rr=dynamic_cast<RawRecord *> (mom->GetFragment("RawRecord",0,"DaqSnarl"));
00117    if (rr==0) { result.SetFailed(); return result; }
00118    
00119    const RawDaqSnarlHeader* snarlHdr =
00120      dynamic_cast<const RawDaqSnarlHeader*>(rr->GetRawHeader());
00121    if(snarlHdr){
00122      MSG("ShowerEM", Msg::kInfo) << "ShowerEMListModule::Reco Snarl "
00123                                  << snarlHdr->GetSnarl() << endl;
00124    }
00125    */
00126 
00127    // Find PrimaryCandidateRecord fragment in MOM.
00128    CandRecord *candrec = dynamic_cast<CandRecord *>
00129      (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00130    if (candrec == 0) {
00131      MSG("ShowerEM", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00132                                     << endl;
00133      result.SetWarning().SetFailed();
00134      return result;
00135    }
00136 
00137    //(Re)Initialize VldContext in Calibrator   
00138    Calibrator::Instance().Reset(*candrec->GetVldContext());
00139 
00140    // Find CandSliceList fragment in PrimaryCandidateRecord.
00141    CandSliceListHandle *cslh = dynamic_cast<CandSliceListHandle *>
00142      (candrec->FindCandHandle("CandSliceListHandle")); 
00143    if(!cslh){
00144      MSG("ShowerEM", Msg::kDebug)
00145        << "Null CandSlice list.  Bail out of event." << endl;
00146      result.SetFailed();
00147      return result;
00148    }
00149 
00150    // Find CandClusterList fragment in PrimaryCandidateRecord.   
00151    CandClusterListHandle *cclh = dynamic_cast<CandClusterListHandle *>
00152      (candrec->FindCandHandle("CandClusterListHandle"));
00153    if(!cclh){
00154      MSG("ShowerEM", Msg::kDebug)
00155        << "Null CandCluster list.  Bail out of event." << endl;
00156      return result;
00157    }
00158 
00159    TObjArray cxin;
00160    cxin.Add(cslh);
00161    cxin.Add(cclh);
00162    
00163    AlgFactory &af = AlgFactory::GetInstance();
00164    AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name);
00165    CandContext cx(this, mom);
00166    cx.SetDataIn(&cxin);
00167    cx.SetCandRecord(candrec);
00168    CandShowerEMListHandle csllh = CandShowerEMList::MakeCandidate(adlh, cx);
00169    csllh.SetName(list_out);
00170    csllh.SetTitle(TString("Created by ShowerEMListModule from ").
00171                   Append(cslh->GetName()));
00172    candrec->SecureCandHandle(csllh);
00173 
00174    return result;
00175 }
00176 
00177 //......................................................................
00178 // void ShowerEMListModule::Config(const Registry &r)
00179 // {
00180 
00181 //   MSG("ShowerEM", Msg::kDebug) << "ShowerEMListModule::Config" << endl;
00182     
00183 // // Get Singleton instance of AlgFactory.
00184 //   AlgFactory &af = AlgFactory::GetInstance();
00185     
00186 //   AlgHandle alghandle = af.GetAlgHandle("AlgShowerEM","default");
00187 //   AlgConfig &algconfig = alghandle.GetAlgConfig();
00188     
00189 //   AlgHandle alglisthandle = af.GetAlgHandle("AlgShowerEMList","default");
00190 //   AlgConfig &alglistconfig = alglisthandle.GetAlgConfig();
00191     
00192 //   Int_t tmpi;
00193 //   Double_t tmpd;
00194 //   const Char_t *tmpc = 0;
00195 
00196 //   alglistconfig.UnLockValues();
00197 //   algconfig.UnLockValues();
00198     
00199 //   if (r.Get("ListIn",tmpc)) fListIn  = tmpc;
00200 //   if (r.Get("ListOut",tmpc)) fListOut = tmpc;
00201 
00202 //   if (r.Get("NIter",tmpi)) algconfig.Set("NIter",tmpi);
00203 //   if (r.Get("CutOff",tmpd)) algconfig.Set("CutOff",tmpd);
00204 //   if (r.Get("ShwFrac",tmpd)) algconfig.Set("ShwFrac",tmpd);
00205 //   if (r.Get("MipCut",tmpd)) algconfig.Set("MipCut",tmpd);
00206 //   if (r.Get("RadCut",tmpd)) algconfig.Set("RadCut",tmpd);
00207 //   if (r.Get("MaxBigPlaneSep",tmpi)) algconfig.Set("MaxBigPlaneSep",tmpi);
00208 //   if (r.Get("IsolatedPlaneCut",tmpi)) algconfig.Set("IsolatedPlaneCut",tmpi);
00209 //   if (r.Get("NGapPlanes",tmpi)) algconfig.Set("NGapPlanes",tmpi);
00210 //   if (r.Get("NGapStrips",tmpi)) algconfig.Set("NGapStrips",tmpi);
00211 //   if (r.Get("MaxAvgDev",tmpd)) algconfig.Set("MaxAvgDev",tmpd);
00212 //   if (r.Get("MaxOffFrac",tmpd)) algconfig.Set("MaxOffFrac",tmpd);
00213 //   if (r.Get("AvgDevCutForLargeOutliers",tmpd)) algconfig.Set("AvgDevCutForLargeOutliers",tmpd);
00214 //   if (r.Get("VtxBegPlaneDiffCut",tmpd)) algconfig.Set("VtxBegPlaneDiffCut",tmpd);
00215 //   if (r.Get("VtxPlaneDiffCut",tmpd)) algconfig.Set("VtxPlaneDiffCut",tmpd);
00216 //   if (r.Get("TrkFraCut",tmpd)) algconfig.Set("TrkFraCut",tmpd);
00217 //   if (r.Get("UVDiffCut",tmpd)) algconfig.Set("UVDiffCut",tmpd);
00218 //   if (r.Get("Mip2GeV",tmpd)) algconfig.Set("Mip2Gev",tmpd);
00219 //   if (r.Get("PE2Mip",tmpd)) algconfig.Set("PE2Mip",tmpd);
00220 
00221 //   algconfig.LockValues();
00222 //   alglistconfig.LockValues();
00223 // }
00224 

Generated on Mon Feb 15 11:07:37 2010 for loon by  doxygen 1.3.9.1