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

FarDetEventModule.cxx

Go to the documentation of this file.
00001 
00002 #include "FarDetEventModule.h"
00003 #include "FarDetEventListHandle.h"
00004 
00005 #include "Algorithm/AlgConfig.h"
00006 #include "Algorithm/AlgFactory.h"
00007 #include "Algorithm/AlgHandle.h"
00008 
00009 #include "MessageService/MsgService.h"  
00010 #include "JobControl/JobCModuleRegistry.h"
00011 #include "JobControl/JobCommand.h"
00012 #include "MinosObjectMap/MomNavigator.h"
00013 
00014 #include "Candidate/CandContext.h"
00015 #include "CandData/CandRecord.h"
00016 #include "CandData/CandHeader.h"
00017 
00018 #include "RecoBase/CandFitTrackListHandle.h"
00019 #include "RecoBase/CandFitTrackHandle.h"
00020 #include "RecoBase/CandTrackListHandle.h"
00021 #include "RecoBase/CandTrackHandle.h"
00022 #include "RecoBase/CandShowerListHandle.h"
00023 #include "RecoBase/CandShowerHandle.h"
00024 #include "RecoBase/CandStripListHandle.h"
00025 #include "RecoBase/CandStripHandle.h"
00026 
00027 #include "TDirectory.h"
00028 
00029 CVSID("$Id: FarDetEventModule.cxx,v 1.3 2006/04/21 16:58:46 chapman Exp $");
00030 
00031 JOBMODULE(FarDetEventModule,"FarDetEventModule","Making CandEvents");
00032 
00033 FarDetEventModule::FarDetEventModule() :
00034   fListInStrp("CandStripListHandle"),
00035   fListInTrk("CandTrackListHandle"),
00036   fListInShw("CandShowerListHandle"),
00037   fListInFit("CandFitTrackListHandle"),
00038   fListOut("FarDetEventListHandle")
00039 {
00040 
00041 }
00042 //===============================================================================================================
00043 FarDetEventModule::~FarDetEventModule()
00044 {
00045 
00046 }
00047 //===============================================================================================================
00048 const Registry& FarDetEventModule::DefaultConfig() const
00049 {
00050   MSG("FarDetEvent",Msg::kDebug) << " *** FarDetEventModule::DefaultConfig( ) *** " << endl;
00051 
00052   static Registry r;
00053   r.SetName("FarDetEventModule.config.default");
00054   r.UnLockValues();
00055   r.Set("ListInStrp",fListInStrp.Data());
00056   r.Set("ListInTrk",fListInTrk.Data());
00057   r.Set("ListInShw",fListInShw.Data());
00058   r.Set("ListInFit",fListInFit.Data());
00059   r.LockValues();
00060 
00061   return r;
00062 }
00063 //===============================================================================================================
00064 void FarDetEventModule::Config(const Registry &r)
00065 {
00066   MSG("FarDetEvent",Msg::kDebug) << " *** FarDetEventModule::Config( ) *** " << endl;
00067 
00068   const char* tmpchar = 0; 
00069   
00070   if(r.Get("ListInStrp",tmpchar)) fListInStrp = tmpchar;
00071   if(r.Get("ListInTrk",tmpchar)) fListInTrk = tmpchar;
00072   if(r.Get("ListInShw",tmpchar)) fListInShw = tmpchar;
00073   if(r.Get("ListInFit",tmpchar)) fListInFit = tmpchar;
00074 
00075   MSG("FarDetEvent",Msg::kDebug) << " configuration: " << endl
00076                                  << "   ListInStrp=" << fListInStrp.Data() << endl
00077                                  << "   ListInTrk=" << fListInTrk.Data() << endl
00078                                  << "   ListInShw=" << fListInShw.Data() << endl
00079                                  << "   ListInFit=" << fListInFit.Data() << endl;
00080   return;
00081 }
00082 //===============================================================================================================
00083 void FarDetEventModule::BeginJob()
00084 {
00085   MSG("FarDetEvent",Msg::kDebug) << " *** FarDetEventModule::BeginJob( ) *** " << endl;
00086 
00087   /*
00088   AlgFactory &af = AlgFactory::GetInstance();
00089   af.Register("AlgFarDetEventList","default","libFarDetEvent.so","AlgConfig");
00090   af.Register("AlgFarDetEvent","default","libFarDetEvent.so","AlgConfig");
00091   */
00092 }
00093 //===============================================================================================================
00094 JobCResult FarDetEventModule::Reco(MomNavigator *mom)
00095 {
00096   MSG("FarDetEvent",Msg::kDebug) << " *** FarDetEventModule::Reco( ) *** " << endl;
00097 
00098   JobCResult result(JobCResult::kPassed);
00099 
00100   CandRecord* candrec = dynamic_cast<CandRecord*>(mom->GetFragment("CandRecord","PrimaryCandidateRecord"));
00101   if( candrec==0 )
00102     {
00103       MSG("FarDetEvent",Msg::kDebug) << "  *** FAILED TO FIND CANDRECORD *** " << endl;
00104       return result.SetFailed();
00105     }
00106 
00107   TObjArray* cxt = new TObjArray(); 
00108 
00109   // Look for CandFitTrackListHandle
00110   CandFitTrackListHandle* fitlist = dynamic_cast<CandFitTrackListHandle*>(candrec->FindCandHandle("CandFitTrackListHandle",fListInFit.Data()));
00111   if( fitlist )
00112     {
00113       MSG("FarDetEvent",Msg::kDebug) << "    ... FOUND " << fListInFit.Data() << endl;
00114     }
00115   else
00116     {
00117       MSG("FarDetEvent",Msg::kWarning) << "    ... FAILED TO FIND " << fListInFit.Data() << endl;
00118     }
00119   cxt->Add(fitlist);  
00120 
00121   // Look for CandTrackListHandle
00122   CandTrackListHandle* trklist = dynamic_cast<CandTrackListHandle*>(candrec->FindCandHandle("CandTrackListHandle",fListInTrk.Data()));
00123   if( trklist )
00124     {
00125       MSG("FarDetEvent",Msg::kDebug) << "    ... FOUND " << fListInTrk.Data() << endl;
00126     }
00127   else
00128     {
00129       MSG("FarDetEvent",Msg::kWarning) << "    ... FAILED TO FIND " << fListInTrk.Data() << endl;
00130     }
00131   cxt->Add(trklist); 
00132 
00133   // Look for CandShowerListHandle
00134   CandShowerListHandle* shwlist = dynamic_cast<CandShowerListHandle*>(candrec->FindCandHandle("CandShowerListHandle",fListInShw.Data()));
00135   if( shwlist )
00136     {
00137       MSG("FarDetEvent",Msg::kDebug) << "    ... FOUND " << fListInShw.Data() << endl;
00138     }
00139   else
00140     {
00141       MSG("FarDetEvent",Msg::kWarning) << "    ... FAILED TO FIND " << fListInShw.Data() << endl;
00142     }
00143   cxt->Add(shwlist);
00144                 
00145   // Look for CandStripListHandle                                             
00146   CandStripListHandle* strplist = dynamic_cast<CandStripListHandle*>(candrec->FindCandHandle("CandStripListHandle",fListInStrp.Data()));
00147   if( strplist )
00148     {
00149       MSG("FarDetEvent",Msg::kDebug) << "    ... FOUND " << fListInStrp.Data() << endl;
00150     }
00151   else
00152     {
00153       MSG("FarDetEvent",Msg::kWarning) << "    ... FAILED TO FIND " << fListInStrp.Data() << endl;
00154     }
00155   cxt->Add(strplist);
00156   
00157   MSG("FarDetEvent",Msg::kDebug) << " MAKING FARDETEVENTLIST " << endl;
00158   AlgFactory &af = AlgFactory::GetInstance();
00159   AlgHandle ah = af.GetAlgHandle("AlgFarDetEventList", "default");
00160 
00161   CandContext cx(this, mom);
00162   cx.SetCandRecord(candrec);
00163   cx.SetDataIn(cxt);
00164   FarDetEventListHandle eventlist = FarDetEventList::MakeCandidate(ah,cx);
00165   eventlist.SetName(fListOut.Data());
00166   eventlist.SetTitle(TString("Created by FarDetEventModule"));
00167 
00168   candrec->SecureCandHandle(eventlist);
00169 
00170   cxt->Clear();
00171   delete cxt;
00172   
00173   return result;
00174 }
00175   
00176 JobCResult FarDetEventModule::Ana(const MomNavigator* /* mom */)
00177 {
00178   MSG("FarDetEvent",Msg::kDebug) << " *** FarDetEventModule::Ana( ) *** " << endl;
00179 
00180   JobCResult result(JobCResult::kPassed);  
00181 
00182   return result;
00183 }
00184 //===============================================================================================================
00185 void FarDetEventModule::HandleCommand(JobCommand *command)
00186 {
00187   TString cmd = command->PopCmd();
00188   if(cmd=="Set"){
00189     TString opt = command->PopOpt();
00190 
00191   }
00192 }
00193 //===============================================================================================================
00194 void FarDetEventModule::EndJob()
00195 {
00196   MSG("FarDetEvent",Msg::kDebug) << " *** FarDetEventModule::EndJob( ) *** " << endl;
00197 
00198   
00199 }
00200 

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