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

TrackSRListModule.cxx

Go to the documentation of this file.
00001 
00002 // $Id: TrackSRListModule.cxx,v 1.62 2005/06/24 02:54:08 urheim Exp $
00003 //
00004 // TrackSRListModule.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 raw CandTrackSRList from
00010 // CandSliceList.
00011 //
00012 // Author:  R. Lee 2001.02.26
00013 //
00014 // Also see <a href="../../root_crib/index.html">The ROOT Crib</a> and 
00015 // <a href="../CandTrackSR.html"> CandTrackSR Classes</a> (part of
00016 // <a href="../index.html">The MINOS Class User Guide</a>)End_Html
00018 
00019 #include <assert.h>
00020 extern "C" {
00021 #include <unistd.h>    // sysconf
00022 #include <sys/times.h> // times()
00023 }
00024 
00025 #include "Algorithm/AlgConfig.h"
00026 #include "Algorithm/AlgFactory.h"
00027 #include "Algorithm/AlgHandle.h"
00028 #include "Calibrator/Calibrator.h"
00029 #include "CandData/CandHeader.h"
00030 #include "CandData/CandRecord.h"
00031 #include "CandDigit/CandDigitListHandle.h"
00032 #include "CandTrackSR/CandTrackSRListHandle.h"
00033 #include "CandTrackSR/CandTrackSRList.h"
00034 #include "CandTrackSR/CandTrackSRHandle.h"
00035 #include "CandTrackSR/TrackSRListModule.h"
00036 #include "CandTrackSR/TrackClusterSR.h"
00037 #include "Candidate/CandContext.h"
00038 #include "Conventions/Munits.h"
00039 #include "JobControl/JobCModuleRegistry.h"
00040 #include "JobControl/JobCommand.h"
00041 #include "MessageService/MsgService.h"
00042 #include "MinosObjectMap/MomNavigator.h"
00043 #include "RawData/RawDigit.h"
00044 #include "RawData/RawHeader.h"
00045 #include "RawData/RawRecord.h"
00046 #include "RawData/RawChannelId.h"
00047 #include "RawData/RawDaqSnarlHeader.h"
00048 #include "RawData/RawDaqHeaderBlock.h"
00049 #include "RawData/RawDigitDataBlock.h"
00050 #include "RawData/RawVarcErrorInTfBlock.h"
00051 #include "RecoBase/CandSliceHandle.h"
00052 #include "RecoBase/CandSliceListHandle.h"
00053 #include "RecoBase/CandStripHandle.h"
00054 #include "RecoBase/CandStripListHandle.h"
00055 #include "RecoBase/CandTrackHandle.h"
00056 #include "RecoBase/CandTrackListHandle.h"
00057 #include "RecoBase/LinearFit.h"
00058 #include "UgliGeometry/UgliGeomHandle.h"
00059 #include "UgliGeometry/UgliStripHandle.h"
00060 #include "Validity/VldContext.h"
00061 
00062 #include "MINF_Classes/MINFast.h"
00063 #include "REROOT_Classes/REROOT_FluxWgt.h"
00064 #include "REROOT_Classes/REROOT_NeuKin.h"
00065 #include "REROOT_Classes/REROOT_NeuVtx.h"
00066 #include "REROOT_Classes/REROOT_Event.h"
00067 
00068 
00069 ClassImp(TrackSRListModule)
00070 
00071 //......................................................................
00072 CVSID("$Id: TrackSRListModule.cxx,v 1.62 2005/06/24 02:54:08 urheim Exp $");
00073 JOBMODULE(TrackSRListModule, "TrackSRListModule",
00074          "Builds CandTrackSRList from CandSliceList");
00075 
00076 //......................................................................
00077 TrackSRListModule::TrackSRListModule()
00078 {
00079 }
00080 
00081 //......................................................................
00082 TrackSRListModule::~TrackSRListModule() 
00083 {
00084 }
00085 
00086 //......................................................................
00087 void TrackSRListModule::BeginJob() 
00088 {
00089 }
00090 
00091 const Registry &TrackSRListModule::DefaultConfig() const
00092 {
00093 
00094 //
00095 //  Purpose:    Method to return default configuration.
00096 //
00097 //  Arguments:  n/a
00098 //
00099 //  Return:     Registry item containing default configuration.
00100 //
00101 
00102 static Registry def_cfg;
00103   static bool been_here = false;
00104   if(been_here)return def_cfg;
00105   been_here=true;
00106 
00107   string name = this->JobCModule::GetName();
00108   name += ".config.default";
00109   def_cfg.SetName(name.c_str());
00110 
00111   // Set default
00112   def_cfg.Set("TrackListAlgorithm","AlgTrackSRList");
00113   def_cfg.Set("TrackListAlgConfig","default");
00114   def_cfg.Set("ListIn","CandSliceList");
00115   def_cfg.Set("ListOut","CandTrackSRList");
00116   def_cfg.Set("LogLevel","Fatal");
00117   return def_cfg;
00118 }
00119 
00120 //......................................................................
00121 JobCResult TrackSRListModule::Reco(MomNavigator *mom)
00122 {
00123    JobCResult result(JobCResult::kPassed);
00124 // load configuration 
00125   const char* tmps = 0;
00126   const char* alg_name = 0;
00127   const char* alg_config_name = 0;
00128   const char* list_in = 0;
00129   const char* list_out = 0;
00130 
00131   Registry& cfg = this->GetConfig();
00132   if (cfg.Get("TrackListAlgorithm",tmps)) alg_name = tmps;
00133   if (cfg.Get("TrackListAlgConfig",tmps)) alg_config_name = tmps;
00134   if (cfg.Get("ListIn",tmps)) list_in = tmps;
00135   if (cfg.Get("ListOut",tmps)) list_out = tmps;
00136 
00137 // Find PrimaryCandidateRecord fragment in MOM.
00138    CandRecord *candrec = dynamic_cast<CandRecord *>
00139              (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00140    if (candrec == 0) {
00141      MSG("TrackSR", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00142                                                                 << endl;
00143      result.SetWarning().SetFailed();
00144      return result;
00145 
00146    }
00147 
00148 // (Re)Initialize VldContext in StripCalibrator
00149    Calibrator::Instance().Reset(*candrec->GetVldContext());
00150 
00151 // Find CandSliceList fragment in PrimaryCandidateRecord
00152    CandSliceListHandle *cslh = dynamic_cast<CandSliceListHandle *>
00153       (candrec->FindCandHandle("CandSliceListHandle",list_in));
00154 
00155 // Require number of CandSlices to be non-zero.
00156    if (!cslh || cslh->GetNDaughters() < 1) {
00157      MAXMSG("TrackSR", Msg::kInfo,1)
00158                   << "Null CandSlice list.  Bail out of event." << endl;
00159 
00160 //--ju 6/22/05 not an error condition, so don't return error code.
00161 //   result.SetWarning().SetFailed();
00162      result.SetFailed();
00163      return result;
00164    }
00165 
00166    TObjArray cxin;
00167    cxin.Add(cslh);
00168 
00169    AlgFactory &af = AlgFactory::GetInstance();
00170 
00171 // Build a CandTrackSRList containing all CandTrackSRs in Frame.
00172    AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name);
00173    CandContext cx(this, mom);
00174    cx.SetDataIn(&cxin);
00175    cx.SetCandRecord(candrec);
00176 
00177    clock_t dummyt;
00178    struct tms t1;
00179    struct tms t2;
00180    static double ticksPerSecond = sysconf(_SC_CLK_TCK);
00181    dummyt = times(&t1);
00182 
00183    CandTrackSRListHandle csllh = CandTrackSRList::MakeCandidate(adlh, cx);
00184    csllh.SetName(list_out);
00185    csllh.SetTitle(TString("Created by TrackSRListModule from ").
00186                  Append(cslh->GetName()));
00187 
00188    dummyt = times(&t2);
00189    csllh.SetCPUTime((Double_t)(t2.tms_utime+t2.tms_stime-t1.tms_utime-t1.tms_stime)/ticksPerSecond);
00190 
00191    candrec->SecureCandHandle(csllh);
00192    return result;
00193 }

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