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

SliceSRListModule.cxx

Go to the documentation of this file.
00001 
00002 // $Id: SliceSRListModule.cxx,v 1.16 2005/04/05 21:33:59 bv Exp $
00003 //
00004 // SliceSRListModule.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 CandSliceSRList from 
00010 // CandStripList
00011 //
00012 // Author:  R. Lee 2001.01.19
00013 //
00014 // Also see <a href="../../root_crib/index.html">The ROOT Crib</a> and 
00015 // <a href="../CandSliceSR.html"> CandSliceSR Classes</a> (part of
00016 // <a href="../index.html">The MINOS Class User Guide</a>)End_Html
00018 
00019 #include <cassert>
00020 
00021 #include "CandSliceSR/SliceSRListModule.h"
00022 
00023 #include "Algorithm/AlgConfig.h"
00024 #include "Algorithm/AlgFactory.h"
00025 #include "Algorithm/AlgHandle.h"
00026 #include "CandData/CandHeader.h"
00027 #include "CandData/CandRecord.h"
00028 #include "RecoBase/CandSliceListHandle.h"
00029 #include "RecoBase/CandSliceList.h"
00030 #include "RecoBase/CandSliceHandle.h"
00031 #include "Candidate/CandContext.h"
00032 #include "Conventions/Munits.h"
00033 #include "JobControl/JobCModuleRegistry.h"
00034 #include "JobControl/JobCommand.h"
00035 #include "MessageService/MsgService.h"
00036 #include "MinosObjectMap/MomNavigator.h"
00037 #include "RecoBase/CandStripListHandle.h"
00038 #include "Validity/VldContext.h"
00039 
00040 ClassImp(SliceSRListModule)
00041 
00042 //......................................................................
00043 CVSID("$Id: SliceSRListModule.cxx,v 1.16 2005/04/05 21:33:59 bv Exp $");
00044 JOBMODULE(SliceSRListModule, "SliceSRListModule",
00045          "Builds CandSliceList from CandStripList");
00046 
00047 //......................................................................
00048 SliceSRListModule::SliceSRListModule()
00049 {
00050 }
00051 
00052 //......................................................................
00053 SliceSRListModule::~SliceSRListModule() 
00054 {
00055 }
00056 
00057 //......................................................................
00058 void SliceSRListModule::BeginJob() 
00059 {
00060 }
00061 
00062 const Registry &SliceSRListModule::DefaultConfig() const
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   static Registry def_cfg;
00073   if (def_cfg.Size()) return def_cfg;
00074 
00075   string name = this->JobCModule::GetName();
00076   name += ".config.default";
00077   def_cfg.SetName(name.c_str());
00078 
00079   // Set default
00080   def_cfg.Set("SliceListAlgorithm","AlgSliceSRList");
00081   def_cfg.Set("SliceListAlgConfig","default");
00082   def_cfg.Set("ListIn","CandStripList");
00083   def_cfg.Set("ListOut","CandSliceList");
00084   def_cfg.Set("LogLevel","Fatal");
00085   return def_cfg;
00086 }
00087 
00088 
00089 //......................................................................
00090 JobCResult SliceSRListModule::Reco(MomNavigator *mom)
00091 {
00092   JobCResult result(JobCResult::kPassed);
00093 
00094   // load configuration 
00095   const char* tmps = 0;
00096   const char* alg_name = 0;
00097   const char* alg_config_name = 0;
00098   const char* list_in = 0;
00099   const char* list_out = 0;
00100 
00101   Registry& cfg = this->GetConfig();
00102   if (cfg.Get("SliceListAlgorithm",tmps)) alg_name = tmps;
00103   if (cfg.Get("SliceListAlgConfig",tmps)) alg_config_name = tmps;
00104   if (cfg.Get("ListIn",tmps)) list_in = tmps;
00105   if (cfg.Get("ListOut",tmps)) list_out = tmps;
00106 
00107 // Find PrimaryCandidateRecord fragment in MOM.
00108    CandRecord *candrec = dynamic_cast<CandRecord *>
00109              (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00110    if (candrec == 0) {
00111      MSG("SliceSR", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00112                                                                 << endl;
00113      result.SetWarning().SetFailed();
00114      return result;
00115    }
00116 
00117 // Find CandStripList fragment in PrimaryCandidateRecord.
00118    CandStripListHandle *cslh = dynamic_cast<CandStripListHandle *>
00119       (candrec->FindCandHandle("", list_in));
00120 
00121 // Require number of CandStrips to be non-zero.
00122    if (!cslh || cslh->GetNDaughters() < 1) {
00123      result.SetFailed();
00124      return result;
00125    }
00126 
00127    AlgFactory &af = AlgFactory::GetInstance();
00128 
00129 // Build a CandSliceList containing all CandSlice's in Frame.
00130    AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name);
00131    CandContext cx(this, mom);
00132    cx.SetDataIn(cslh);
00133    cx.SetCandRecord(candrec);
00134    CandSliceListHandle csllh = CandSliceList::MakeCandidate(adlh, cx);
00135    csllh.SetName(list_out);
00136    csllh.SetTitle(TString("Created by SliceListModule from ").
00137                  Append(cslh->GetName()));
00138    candrec->SecureCandHandle(csllh);
00139 
00140    return result;
00141 }
00142 

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