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

FitTrack3ListModule.cxx

Go to the documentation of this file.
00001 
00002 // $Id: FitTrack3ListModule.cxx,v 1.4 2003/11/10 20:19:42 brebel Exp $
00003 //
00004 // FitTrack3ListModule.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 CandFitTrack3List from CandTrackList.
00010 //
00011 // Author:  R. Lee 2001.03.30
00012 //
00013 // Also see <a href="../../root_crib/index.html">The ROOT Crib</a> and 
00014 // <a href="../CandFitTrack3.html"> CandFitTrack3 Classes</a> (part of
00015 // <a href="../index.html">The MINOS Class User Guide</a>)End_Html
00017 
00018 #include <cassert>
00019 
00020 #include "CandFitTrack3/FitTrack3ListModule.h"
00021 
00022 #include "Algorithm/AlgConfig.h"
00023 #include "Algorithm/AlgFactory.h"
00024 #include "Algorithm/AlgHandle.h"
00025 #include "CandData/CandHeader.h"
00026 #include "CandData/CandRecord.h"
00027 #include "CandDigit/CandDigitListHandle.h"
00028 #include "CandDigit/CandDeMuxDigitListHandle.h"
00029 #include "CandFitTrack3/CandFitTrack3ListHandle.h"
00030 #include "CandFitTrack3/CandFitTrack3List.h"
00031 #include "CandFitTrack3/CandFitTrack3Handle.h"
00032 #include "CandTrackSR/CandTrackSRHandle.h"
00033 #include "Candidate/CandContext.h"
00034 #include "Conventions/Munits.h"
00035 #include "Conventions/StripEnd.h"
00036 #include "DeMux/DmxStatus.h"
00037 #include "JobControl/JobCModuleRegistry.h"
00038 #include "JobControl/JobCommand.h"
00039 #include "MessageService/MsgService.h"
00040 #include "MinosObjectMap/MomNavigator.h"
00041 #include "RawData/RawDigit.h"
00042 #include "RawData/RawHeader.h"
00043 #include "RawData/RawRecord.h"
00044 #include "RawData/RawChannelId.h"
00045 #include "RawData/RawDaqSnarlHeader.h"
00046 #include "RawData/RawDaqHeaderBlock.h"
00047 #include "RawData/RawDigitDataBlock.h"
00048 #include "RawData/RawSnarlHeaderBlock.h"
00049 #include "RawData/RawVarcErrorInTfBlock.h"
00050 #include "RecoBase/CandClusterListHandle.h"
00051 #include "RecoBase/CandFitTrackHandle.h"
00052 #include "RecoBase/CandSliceListHandle.h"
00053 #include "RecoBase/CandSliceHandle.h"
00054 #include "RecoBase/CandStripListHandle.h"
00055 #include "RecoBase/CandStripHandle.h"
00056 #include "RecoBase/CandTrackListHandle.h"
00057 #include "RecoBase/CandTrackHandle.h"
00058 #include "RecoBase/LinearFit.h"
00059 #include "RecoBase/PropagationVelocity.h"
00060 #include "Validity/VldContext.h"
00061 #include "Validity/VldTimeStamp.h"
00062 
00063 #include "MINF_Classes/MINFast.h"
00064 #include "REROOT_Classes/REROOT_FluxWgt.h"
00065 #include "REROOT_Classes/REROOT_NeuKin.h"
00066 #include "REROOT_Classes/REROOT_NeuVtx.h"
00067 #include "REROOT_Classes/REROOT_Event.h"
00068 #include "REROOT_Classes/REROOT_StdHep.h"
00069 
00070 ClassImp(FitTrack3ListModule)
00071 
00072 //......................................................................
00073 CVSID("$Id: FitTrack3ListModule.cxx,v 1.4 2003/11/10 20:19:42 brebel Exp $");
00074 JOBMODULE(FitTrack3ListModule, "FitTrack3ListModule",
00075          "Builds CandFitTrack3List from CandTrackList");
00076 
00077 //......................................................................
00078 FitTrack3ListModule::FitTrack3ListModule() :
00079    fListIn("CandTrackList"),fListOut("CandFitTrack3List")
00080 {
00081   MSG("FitTrack3", Msg::kVerbose) << "FitTrack3ListModule::Constructor\n";
00082 
00083   // Get Singleton instance of AlgFactory.
00084   AlgFactory &af = AlgFactory::GetInstance();
00085 
00086 // Register (Algorithm, configset) by names ("AlgFitTrack3", "default")
00087   af.Register("AlgFitTrack3", "default", "libCandFitTrack3.so", "AlgConfig");
00088 
00089 // Register (Algorithm, configset) by names ("AlgFitTrack3List", "default")
00090   af.Register("AlgFitTrack3List", "default", "libCandFitTrack3.so", "AlgConfig");
00091 
00092 }
00093 
00094 //......................................................................
00095 FitTrack3ListModule::~FitTrack3ListModule() 
00096 {
00097   MSG("FitTrack3", Msg::kVerbose) << "FitTrack3ListModule::Destructor\n";
00098 }
00099 
00100 //......................................................................
00101 void FitTrack3ListModule::BeginJob() 
00102 {
00103   MSG("FitTrack3", Msg::kVerbose) << "FitTrack3ListModule::BeginJob\n";
00104 
00105 }
00106 
00107 //......................................................................
00108 
00109 const Registry &FitTrack3ListModule::DefaultConfig() const
00110 {
00111 //  
00112 //  Purpose:    Method to return default configuration.
00113 //  
00114 //  Arguments:  n/a
00115 //  
00116 //  Return:     Registry item containing default configuration.
00117 //
00118   
00119   MSG("FitTrack3", Msg::kDebug)
00120     << "FitTrack3ListModule::DefaultConfig" << endl;
00121     
00122   static Registry r;
00123   
00124   std::string name = this->JobCModule::GetName();
00125   name += ".config.default";
00126   r.SetName(name.c_str());
00127   r.UnLockValues();
00128   r.LockValues();
00129 
00130 // Get Singleton instance of AlgFactory.
00131   AlgFactory &af = AlgFactory::GetInstance();
00132   
00133   AlgHandle alghandle = af.GetAlgHandle("AlgFitTrack3","default");
00134   AlgConfig &algconfig = alghandle.GetAlgConfig();
00135   
00136   algconfig.Set("MaxIterate",30);
00137 // Max number of iterations before giving up.
00138 
00139 //misalignment error
00140   algconfig.Set("MisalignmentError",2);
00141   return r;
00142 }
00143 
00144 //......................................................................
00145 
00146 void FitTrack3ListModule::Config(const Registry &r)
00147 {
00148 //
00149 //  Purpose:  Configure the module given a registry.
00150 //
00151 //  Arguments:
00152 //    r       in      Registry to use to configure the module.
00153 //
00154 //  Return:   n/a
00155 //
00156 
00157   MSG("FitTrack3", Msg::kDebug) << "FitTrack3ListModule::Config" << endl;
00158   
00159 // Get Singleton instance of AlgFactory.
00160   AlgFactory &af = AlgFactory::GetInstance();
00161   
00162   AlgHandle alghandle = af.GetAlgHandle("AlgFitTrack3","default");
00163   AlgConfig &algconfig = alghandle.GetAlgConfig();
00164   
00165   
00166   Int_t tmpi;
00167   //  Double_t tmpd;
00168   //const Char_t *tmpc = 0;
00169     
00170   if (r.Get("MaxIterate",tmpi)) {
00171     algconfig.UnLockValues();
00172     algconfig.Set("MaxIterate",tmpi);
00173     algconfig.LockValues();
00174   }
00175   if (r.Get("MisalignmentError",tmpi)) {
00176     algconfig.UnLockValues();
00177     algconfig.Set("MisalignmentError",tmpi);
00178     algconfig.LockValues();
00179   }
00180 
00181 }
00182 
00183 //......................................................................
00184 
00185 
00186 JobCResult FitTrack3ListModule::Reco(MomNavigator *mom)
00187 {
00188     JobCResult result(JobCResult::kPassed); // The default result
00189     
00190     MSG("FitTrack3", Msg::kVerbose) << "FitTrack3ListModule::Reco\n";
00191     
00192 // Find PrimaryCandidateRecord fragment in MOM.
00193     CandRecord *candrec = dynamic_cast<CandRecord *>
00194         (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00195     if (candrec == 0) {
00196         MSG("FitTrack3", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00197                                         << endl;
00198         // Return failed with warning result
00199         result.SetWarning().SetFailed();
00200         return result;
00201     }
00202     
00203 // Find CandSliceList fragment in PrimaryCandidateRecord.
00204    MSG("FitTrack3", Msg::kVerbose)
00205       << "CandSliceListHandle *cslh = (CandSliceListHandle *) "
00206       << "candrec->FindCandHandle(\"CandSliceListHandle\", "
00207       << "fListIn.Data());" << endl;
00208    CandSliceListHandle *cslh = dynamic_cast<CandSliceListHandle *>
00209       (candrec->FindCandHandle("CandSliceListHandle"));
00210 
00211 // Require number of CandSlices to be non-zero.
00212    if (!cslh || cslh->GetNDaughters() < 1) {
00213      MSG("FitTrack3", Msg::kDebug)
00214                   << "Null CandSlice list.  Bail out of event." << endl;
00215      result.SetFailed();
00216      return result;
00217    }
00218 
00219    CandTrackListHandle *ctlh = dynamic_cast<CandTrackListHandle *>
00220       (candrec->FindCandHandle("CandTrackListHandle"));
00221 
00222 // Require number of CandTracks to be non-zero.
00223    if (!ctlh || ctlh->GetNDaughters() < 1) {
00224      MSG("FitTrack3", Msg::kDebug)
00225                   << "Null CandTrack list.  Bail out of event." << endl;
00226      result.SetFailed();
00227      return result;
00228    }
00229 
00230    TObjArray cxin;
00231    cxin.Add(cslh);
00232    cxin.Add(ctlh);
00233 
00234 // Get Singleton instance of AlgFactory.
00235    MSG("FitTrack3", Msg::kVerbose)
00236                       << "Get Singleton instance of AlgFactory." << endl
00237                << "AlgFactory &af = AlgFactory::GetInstance();" << endl;
00238    AlgFactory &af = AlgFactory::GetInstance();
00239 
00240 // Build a CandFitTrack3List containing all CandFitTrack3s in Frame.
00241    MSG("FitTrack3", Msg::kVerbose)
00242         << "Ask AlgFactory for Singleton AlgFitTrack3List instance." << endl
00243    << "AlgHandle adlh = af.GetAlgHandle(\"AlgFitTrack3List\", \"default\");"
00244                                                                 << endl;
00245    AlgHandle adlh = af.GetAlgHandle("AlgFitTrack3List", "default");
00246 
00247    MSG("FitTrack3", Msg::kVerbose) << "CandContext cx(this);" << endl;
00248    CandContext cx(this, mom);
00249 
00250    MSG("FitTrack3", Msg::kVerbose) << "cx.SetDataIn(cslh);" << endl;
00251    cx.SetDataIn(&cxin);
00252    cx.SetCandRecord(candrec);
00253 
00254 
00255    MSG("FitTrack3", Msg::kVerbose)
00256             << "ctllh = CandFitTrack3List::MakeCandidate(adlh, cx);" << endl;
00257    CandFitTrack3ListHandle cftlh = CandFitTrack3List::MakeCandidate(adlh, cx);
00258    cftlh.SetName(fListOut.Data());
00259    cftlh.SetTitle(TString("Created by FitTrack3ListModule from ").
00260                  Append(ctlh->GetName()));
00261 
00262 // Give the CandHandle to the CandRecord
00263    MSG("FitTrack3", Msg::kDebug) << "candrec->SecureCandHandle(cftlh);"
00264                                                                 << endl;
00265    candrec->SecureCandHandle(cftlh);
00266 
00267    return result;
00268 }
00269 
00270 //......................................................................
00271 void FitTrack3ListModule::HandleCommand(JobCommand *command) 
00272 {
00273 
00274 // Process configuration commands
00275   MSG("FitTrack3", Msg::kDebug)
00276                        << "FitTrack3ListModule::HandleCommand" << endl;
00277 
00278    TString cmd = command->PopCmd();
00279 //   if (cmd == "Set") {
00280 //     TString opt = command->PopOpt();
00281 //     if      (opt == "ListIn")  fListIn  = command->PopOpt();
00282 //     else if (opt == "ListOut") fListOut = command->PopOpt();
00283 //     else if (opt == "Swimmer") {
00284 //       fSwimID   = command->PopIntOpt(); // 1: SwimObjSR; 2: Swimmer pkg
00285 //       if (fSwimID!=1 && fSwimID!=2)
00286 //      MSG("FitTrack3",Msg::kError) << "Unknown Swimmer '" << endl;
00287 //     }
00288 //     else {
00289 //       MSG("FitTrack3", Msg::kWarning)
00290 //           << "FitTrack3ListModule::HandleCommand: Unrecognized option "
00291 //                                                          << opt << endl;
00292 //     }
00293 //   } else {
00294 //       MSG("FitTrack3", Msg::kWarning)
00295 //          << "FitTrack3ListModule::HandleCommand: Unrecognized command "
00296 //                                                          << cmd << endl;
00297 //   }
00298 
00299 }

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