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

ClusterSRListModule.cxx

Go to the documentation of this file.
00001 
00002 // $Id: ClusterSRListModule.cxx,v 1.25 2005/06/24 02:49:02 urheim Exp $
00003 //
00004 // ClusterSRListModule.cxx
00005 //
00006 // Begin_Html<img src="../../pedestrians.gif" align=center>
00007 // <a href="../source_warning.html">Warning for beginners</a>.<br> 
00008 //
00009 // A JobControl Module for filling CandClusterSRList from CandSliceList
00010 //
00011 // Author:  R. Lee 2001.02.13
00012 //
00013 // Also see <a href="../../root_crib/index.html">The ROOT Crib</a> and 
00014 // <a href="../CandClusterSR.html"> CandClusterSR Classes</a> (part of
00015 // <a href="../index.html">The MINOS Class User Guide</a>)End_Html
00017 
00018 #include <cassert>
00019 
00020 #include "Algorithm/AlgConfig.h"
00021 #include "Algorithm/AlgFactory.h"
00022 #include "Algorithm/AlgHandle.h"
00023 #include "CandData/CandHeader.h"
00024 #include "CandData/CandRecord.h"
00025 #include "RecoBase/CandClusterListHandle.h"
00026 #include "RecoBase/CandClusterList.h"
00027 #include "RecoBase/CandClusterHandle.h"
00028 #include "CandClusterSR/ClusterSRListModule.h"
00029 #include "Candidate/CandContext.h"
00030 #include "Conventions/Munits.h"
00031 #include "JobControl/JobCModuleRegistry.h"
00032 #include "JobControl/JobCommand.h"
00033 #include "MessageService/MsgService.h"
00034 #include "MinosObjectMap/MomNavigator.h"
00035 #include "RecoBase/CandSliceListHandle.h"
00036 #include "RecoBase/CandStripListHandle.h"
00037 #include "Validity/VldContext.h"
00038 
00039 ClassImp(ClusterSRListModule)
00040 
00041 //......................................................................
00042 CVSID("$Id: ClusterSRListModule.cxx,v 1.25 2005/06/24 02:49:02 urheim Exp $");
00043 JOBMODULE(ClusterSRListModule, "ClusterSRListModule",
00044          "Builds CandClusterList from CandSliceList");
00045 
00046 //......................................................................
00047 ClusterSRListModule::ClusterSRListModule()
00048 {
00049 }
00050 
00051 //......................................................................
00052 ClusterSRListModule::~ClusterSRListModule() 
00053 {
00054 }
00055 
00056 //......................................................................
00057 void ClusterSRListModule::BeginJob() 
00058 {
00059 }
00060 
00061 const Registry &ClusterSRListModule::DefaultConfig() const
00062 {
00063 
00064 //
00065 //  Purpose:    Method to return default configuration.
00066 //
00067 //  Arguments:  n/a
00068 //
00069 //  Return:     Registry item containing default configuration.
00070 //
00071 
00072 
00073   static Registry def_cfg;
00074   static bool been_here = false;
00075   if(been_here)return def_cfg;
00076   been_here=true;
00077   string name = this->JobCModule::GetName();
00078   name += ".config.default";
00079   def_cfg.SetName(name.c_str());
00080 
00081   // Set defaults
00082   def_cfg.Set("ClusterListAlgorithm","AlgClusterSRList");
00083   def_cfg.Set("ClusterListAlgConfig","default");
00084   def_cfg.Set("ListIn","CandSliceList");
00085   def_cfg.Set("ListOut","CandClusterList");
00086   def_cfg.Set("LogLevel","Fatal");
00087   return def_cfg;
00088 }
00089 
00090 
00091 //......................................................................
00092 JobCResult ClusterSRListModule::Reco(MomNavigator *mom)
00093 {
00094   JobCResult result(JobCResult::kPassed);
00095   
00096   // load configuration 
00097   const char* tmps = 0;
00098   const char* alg_name = 0;
00099   const char* alg_config_name = 0;
00100   const char* list_in = 0;
00101   const char* list_out = 0;
00102   
00103   Registry& cfg = this->GetConfig();
00104   if (cfg.Get("ClusterListAlgorithm",tmps)) alg_name = tmps;
00105   if (cfg.Get("ClusterListAlgConfig",tmps)) alg_config_name = tmps;
00106   if (cfg.Get("ListIn",tmps)) list_in = tmps;
00107   if (cfg.Get("ListOut",tmps)) list_out = tmps;
00108   
00109   // Find PrimaryCandidateRecord fragment in MOM.
00110   CandRecord *candrec = dynamic_cast<CandRecord *>
00111     (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00112   if (candrec == 0) {
00113     MSG("ClusterSR", Msg::kWarning) << "No PrimaryCandidateRecord in MOM." << endl;
00114     result.SetWarning().SetFailed();                                          
00115     return result; // Flag as error condition
00116   }
00117   
00118   // FindCandHandle does not search inheritance, so for now just access by
00119   // object name
00120   CandSliceListHandle *cslh = dynamic_cast<CandSliceListHandle *>
00121     (candrec->FindCandHandle("CandSliceListHandle",list_in));
00122   
00123   // Require number of CandSlices to be non-zero.
00124   if (!cslh || cslh->GetNDaughters() < 1) {
00125     MAXMSG("ClusterSR", Msg::kInfo,1)
00126       << "Null CandSlice list.  Bail out of event." << endl;
00127 
00128 //--ju 6/23/05 not really an error condition, so keep messages to a minimum
00129 //  result.SetWarning().SetFailed();
00130     result.SetFailed();
00131     return result;
00132   }
00133 
00134    AlgFactory &af = AlgFactory::GetInstance();
00135 
00136 // Build a CandClusterSRList containing all CandClusterSRs in Frame.
00137    AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name);
00138    CandContext cx(this, mom);
00139    cx.SetDataIn(cslh);
00140    cx.SetCandRecord(candrec);
00141 
00142    CandClusterListHandle csllh = CandClusterList::MakeCandidate(adlh, cx);
00143    csllh.SetName(list_out);
00144    csllh.SetTitle(TString("Created by ClusterSRListModule from ").
00145                  Append(cslh->GetName()));
00146    candrec->SecureCandHandle(csllh);
00147 
00148    return result; // no pass/fail decision
00149 }
00150 

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