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

DeMuxDigitListModule.cxx

Go to the documentation of this file.
00001 
00002 // $Id: DeMuxDigitListModule.cxx,v 1.8 2005/02/01 19:07:28 tagg Exp $
00003 //
00004 // DeMuxDigitListModule.cxx
00005 //
00006 // A JobControl Module for filling CandDeMuxDigitList from CandDigitList
00007 //
00008 // Author:  G. Irwin 9/2002
00010 // JobModule Registry parameters (with default values) are:
00011 //
00012 // "NameListIn" - "canddigitlist"
00013 // "NameListOut" - "canddigitlist"
00014 // "TitleListOut" - "Created by DeMuxDigitListModule from CandDigitList"
00015 // "DeMuxDigitListAlgorithm" - "AlgDeMuxDigitList"
00016 // "DeMuxDigitListAlgConfig" - "default"
00017 // "SwitchPersToTemp" - 1 (means don't write out original CandDigitList)
00019 
00020 #include <cassert>
00021 
00022 #include "Algorithm/AlgFactory.h"
00023 #include "Algorithm/AlgHandle.h"
00024 #include "CandData/CandHeader.h"
00025 #include "CandData/CandRecord.h"
00026 #include "CandDigit/CandDigitListHandle.h"
00027 #include "CandDigit/CandDeMuxDigitListHandle.h"
00028 #include "CandDigit/DeMuxDigitListModule.h"
00029 #include "Candidate/CandContext.h"
00030 #include "JobControl/JobCModuleRegistry.h"
00031 #include "JobControl/JobCommand.h"
00032 #include "MessageService/MsgService.h"
00033 #include "MinosObjectMap/MomNavigator.h"
00034 
00035 ClassImp(DeMuxDigitListModule)
00036 
00037 //......................................................................
00038 CVSID("$Id: DeMuxDigitListModule.cxx,v 1.8 2005/02/01 19:07:28 tagg Exp $");
00039 JOBMODULE(DeMuxDigitListModule, "DeMuxDigitListModule",
00040           "Builds CandDeMuxDigitList from CandDigitList");
00041 
00042 //......................................................................
00043 DeMuxDigitListModule::DeMuxDigitListModule()
00044 {
00045   MSG("Digit", Msg::kVerbose) << "DeMuxDigitListModule::Constructor\n";
00046 }
00047 
00048 //......................................................................
00049 DeMuxDigitListModule::~DeMuxDigitListModule() 
00050 {
00051   MSG("Digit", Msg::kVerbose) << "DeMuxDigitListModule::Destructor\n";
00052 }
00053 
00054 //......................................................................
00055 void DeMuxDigitListModule::BeginJob()
00056 {
00057   MSG("Digit", Msg::kVerbose) << "DeMuxDigitListModule::BeginJob\n";
00058  }
00059 
00060 //......................................................................
00061 void DeMuxDigitListModule::Config(const Registry& /* r */) 
00062 {
00063   MSG("Digit", Msg::kDebug) << "DeMuxDigitListModule::Config" << endl;
00064 }
00065 
00066 //......................................................................
00067 const Registry& DeMuxDigitListModule::DefaultConfig() const 
00068 {
00069   MSG("Digit", Msg::kDebug)
00070     << "DeMuxDigitListModule::DefaultConfig" << endl;
00071 
00072   static Registry r;
00073   
00074   std::string name = this->JobCModule::GetName();
00075   name += ".config.default";
00076   r.SetName(name.c_str());
00077   
00078   r.UnLockValues();
00079   r.Set("NameListIn",  "canddigitlist");
00080   r.Set("NameListOut", "canddigitlist");
00081   r.Set("TitleListOut",
00082                   "Created by DeMuxDigitListModule from CandDigitList");
00083   r.Set("DeMuxDigitListAlgorithm", "AlgDeMuxDigitList");
00084   r.Set("DeMuxDigitListAlgConfig", "default");
00085   r.Set("SwitchPersToTemp", 1);
00086   r.LockValues();
00087 
00088   return r;
00089 }
00090 
00091 //......................................................................
00092 JobCResult DeMuxDigitListModule::Reco(MomNavigator *mom)
00093 {
00094   JobCResult result(JobCResult::kPassed);
00095 
00096   MSG("Digit", Msg::kVerbose) << "DeMuxDigitListModule::Reco" << endl;
00097 
00098 // Cache JobModule Registry values for Reco method
00099   const char *tmps = 0;
00100   Int_t       tmpi = 0;
00101 
00102   const char *namelistin = 0;
00103   const char *namelistout = 0;
00104   const char *titlelistout = 0;
00105   const char *demuxdigitlistalgorithm = 0;
00106   const char *demuxdigitlistalgconfig = 0;
00107   Int_t switchperstotemp = 0;
00108 
00109   Registry &r = GetConfig();     // Get this JobModule's Registry object
00110   if (r.Get("NameListIn",       tmps)) namelistin       = tmps;
00111   if (r.Get("NameListOut",      tmps)) namelistout      = tmps;
00112   if (r.Get("TitleListOut",     tmps)) titlelistout     = tmps;
00113   if (r.Get("DeMuxDigitListAlgorithm", tmps))
00114                                 demuxdigitlistalgorithm = tmps;
00115   if (r.Get("DeMuxDigitListAlgConfig", tmps))
00116                                 demuxdigitlistalgconfig = tmps;
00117   if (r.Get("SwitchPersToTemp", tmpi)) switchperstotemp = tmpi;
00118 
00119 // Find PrimaryCandidateRecord fragment in MOM.
00120   CandRecord *candrec = dynamic_cast<CandRecord *>
00121              (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00122   if (candrec == 0) {
00123     MSG("Digit", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00124                                                                 << endl;
00125     result.SetWarning().SetFailed();
00126     return result;
00127   }
00128 
00129 // Find CandDigitListHandle in CandRecord.
00130   MSG("Digit", Msg::kVerbose)
00131     << "CandDigitListHandle *cdlh = dynamic_cast<CandDigitListHandle *>"
00132     << " (candrec->FindCandHandle(\"CandDigitListHandle\", "
00133     << namelistin << "));" << endl;
00134   
00135   CandDigitListHandle *cdlh = dynamic_cast<CandDigitListHandle *>
00136     (candrec->FindCandHandle("CandDigitListHandle",namelistin));
00137 
00138   if (cdlh == 0) {
00139     MSG("Digit", Msg::kWarning)
00140                 << "No CandDigitListHandle named " << namelistin
00141                                            << " in CandRecord." << endl;
00142     result.SetWarning().SetFailed();
00143     return result;
00144   }
00145 
00146   MSG("Digit", Msg::kDebug) << "CandContext cx(this);" << endl;
00147   CandContext cx(this, mom);
00148 
00149   MSG("Digit", Msg::kDebug) << "cx.SetDataIn(cdlh);" << endl;
00150   cx.SetDataIn(cdlh);
00151 
00152 // Get Singleton instance of AlgFactory.
00153   MSG("Digit", Msg::kDebug)
00154                       << "Get Singleton instance of AlgFactory." << endl
00155                << "AlgFactory &af = AlgFactory::GetInstance();" << endl;
00156   AlgFactory &af = AlgFactory::GetInstance();
00157 
00158 // Build a CandDeMuxDigitList from CandDigitList.
00159   MSG("Digit", Msg::kDebug)
00160    << "Get AlgHandle to DeMuxDigitList Algorithm and AlgConfig." << endl
00161    << "AlgHandle addlh = af.GetAlgHandle(" << demuxdigitlistalgorithm
00162    << ", " << demuxdigitlistalgconfig << ");" << endl;
00163   AlgHandle addlh = af.GetAlgHandle(demuxdigitlistalgorithm,
00164                                     demuxdigitlistalgconfig);
00165 
00166   MSG("Digit", Msg::kDebug)
00167      << "cddlh = CandDeMuxDigitList::MakeCandidate(addlh, cx);" << endl;
00168   CandDeMuxDigitListHandle cddlh =
00169                            CandDeMuxDigitList::MakeCandidate(addlh, cx);
00170   cddlh.SetName(namelistout);
00171   cddlh.SetTitle(titlelistout);
00172 
00173 // Give the CandHandle to the CandRecord
00174   MSG("Digit", Msg::kDebug) << "candrec->SecureCandHandle(cddlh);"
00175                                                                 << endl;
00176   candrec->SecureCandHandle(cddlh);
00177 
00178 // Reassign original CandDigitList from Persistent list to fTemporaries
00179   if (switchperstotemp) candrec->SwitchCandHandlePersToTemp(cdlh);
00180   
00181   return result;
00182 }

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