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

FitShowerEMListModule.cxx

Go to the documentation of this file.
00001 
00002 // $Id: FitShowerEMListModule.cxx,v 1.2 2004/09/29 00:07:29 cbs Exp $
00003 //
00004 // FitShowerEMListModule.cxx
00005 //
00006 // A JobControl Module for filling raw CandFitShowerEMList 
00007 // from CandShowerEMList.
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); // The default result
00090 
00091    MSG("FitShowerEM", Msg::kVerbose) << "FitShowerEMListModule::Reco\n";
00092 
00093    // load configuration 
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    // Find PrimaryCandidateRecord fragment in MOM.
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    // Find CandSliceList fragment in PrimaryCandidateRecord.
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 // void FitShowerEMListModule::Config(const Registry &r)
00155 // {
00156   
00157 //   MSG("FitShowerEM", Msg::kDebug) << "FitShowerEMListModule::Config" << endl;
00158   
00159 //   // Get Singleton instance of AlgFactory.
00160 //   AlgFactory &af = AlgFactory::GetInstance();
00161   
00162 //   AlgHandle alghandle = af.GetAlgHandle("AlgFitShowerEM","default");
00163 //   AlgConfig &algconfig = alghandle.GetAlgConfig();
00164   
00165   
00166 //   Int_t tmpi;
00167 //   Double_t tmpd;
00168 //   const Char_t *tmpc = 0;
00169     
00170 //   algconfig.UnLockValues();
00171 
00172 //   if (r.Get("ListIn",tmpc)) fListIn  = tmpc;
00173 //   if (r.Get("ListOut",tmpc)) fListOut = tmpc;
00174 //   if (r.Get("EnergyStep",tmpd)) algconfig.Set("EnergyStep",tmpd);
00175 //   if (r.Get("UVtxStep",tmpd)) algconfig.Set("UVtxStep",tmpd);
00176 //   if (r.Get("VVtxStep",tmpd)) algconfig.Set("VVtxStep",tmpd);
00177 //   if (r.Get("ZVtxStep",tmpd)) algconfig.Set("ZVtxStep",tmpd);
00178 //   if (r.Get("UAngStep",tmpd)) algconfig.Set("UAngStep",tmpd);
00179 //   if (r.Get("VAngStep",tmpd)) algconfig.Set("VAngStep",tmpd);
00180 //   if (r.Get("EnergyNSteps",tmpi)) algconfig.Set("EnergyNSteps",tmpi);
00181 //   if (r.Get("UVtxNSteps",tmpi)) algconfig.Set("UVtxSteps",tmpi);
00182 //   if (r.Get("VVtxNSteps",tmpi)) algconfig.Set("VVtxSteps",tmpi);
00183 //   if (r.Get("ZVtxNSteps",tmpi)) algconfig.Set("ZVtxSteps",tmpi);
00184 //   if (r.Get("UAngNSteps",tmpi)) algconfig.Set("UAngSteps",tmpi);
00185 //   if (r.Get("VAngNSteps",tmpi)) algconfig.Set("VAngSteps",tmpi);
00186 
00187 //   algconfig.LockValues(); 
00188 // }
00189 

Generated on Mon Feb 15 11:06:43 2010 for loon by  doxygen 1.3.9.1