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

EventSRListModule.cxx

Go to the documentation of this file.
00001 
00002 // $Id: EventSRListModule.cxx,v 1.107 2006/04/06 22:43:31 cbs Exp $
00003 //
00004 // EventSRListModule.cxx
00005 //
00006 // A JobControl Module for filling CandEventSRList from
00007 // CandSliceList, CandTrackList, CandShowerList, CandClusterList
00008 //
00009 // Author:  R. Lee 2001.03.07
00011 
00012 #include <cassert>
00013 #include <cmath>
00014 
00015 #include "TFile.h"
00016 #include "TFolder.h"
00017 
00018 #include "Algorithm/AlgConfig.h"
00019 #include "Algorithm/AlgFactory.h"
00020 #include "Algorithm/AlgHandle.h"
00021 #include "Calibrator/Calibrator.h"
00022 #include "CandData/CandHeader.h"
00023 #include "CandData/CandRecord.h"
00024 #include "RecoBase/CandEventListHandle.h"
00025 #include "RecoBase/CandEventList.h"
00026 #include "RecoBase/CandEventHandle.h"
00027 #include "RecoBase/CandSliceListHandle.h"
00028 #include "RecoBase/CandTrackListHandle.h"
00029 #include "RecoBase/CandShowerListHandle.h"
00030 #include "RecoBase/CandClusterHandle.h"
00031 #include "RecoBase/CandShowerHandle.h"
00032 #include "RecoBase/CandClusterListHandle.h"
00033 #include "CandSubShowerSR/CandSubShowerSRListHandle.h"
00034 #include "CandEventSR/EventSRListModule.h"
00035 #include "Candidate/CandContext.h"
00036 #include "Conventions/StripEnd.h"
00037 #include "DeMux/DmxStatus.h"
00038 #include "JobControl/JobCModuleRegistry.h"
00039 #include "JobControl/JobCommand.h"
00040 #include "MessageService/MsgService.h"
00041 #include "MinosObjectMap/MomNavigator.h"
00042 #include "Plex/PlexHandle.h"
00043 #include "Plex/PlexVetoShieldHack.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/RawSnarlHeaderBlock.h"
00051 #include "RawData/RawVarcErrorInTfBlock.h"
00052 #include "UgliGeometry/UgliGeomHandle.h"
00053 #include "UgliGeometry/UgliStripHandle.h"
00054 #include "Validity/VldContext.h"
00055 #include "Validity/VldTimeStamp.h"
00056 
00057 
00058 
00059 ClassImp(EventSRListModule)
00060 
00061 //......................................................................
00062 CVSID("$Id: EventSRListModule.cxx,v 1.107 2006/04/06 22:43:31 cbs Exp $");
00063 
00064 JOBMODULE(EventSRListModule, "EventSRListModule",
00065          "Builds CandEventList from CandSliceList");
00066 
00067 //......................................................................
00068 EventSRListModule::EventSRListModule()
00069 {
00070 }
00071 
00072 //......................................................................
00073 EventSRListModule::~EventSRListModule()
00074 {
00075 }
00076 
00077 //......................................................................
00078 void EventSRListModule::BeginJob()
00079 {
00080 }
00081 
00082 //______________________________________________________________________
00083 const Registry &EventSRListModule::DefaultConfig() const
00084 {
00085 //  Purpose:    Method to return default configuration.
00086 //
00087 //  Arguments:  n/a
00088 //
00089 //  Return:     Registry item containing default configuration.
00090 //
00091  
00092  static Registry def_cfg;
00093   static bool been_here = false;
00094   if(been_here)return def_cfg;
00095   been_here=true;
00096 
00097   string name = this->JobCModule::GetName();
00098   name += ".config.default";
00099   def_cfg.SetName(name.c_str());
00100 
00101   // Set defaults
00102   def_cfg.Set("EventListAlgorithm","AlgEventSRList");
00103   def_cfg.Set("EventListAlgConfig","default");
00104   def_cfg.Set("ListIn","CandSliceList");
00105   def_cfg.Set("ListOut","CandEventList");
00106   def_cfg.Set("LogLevel","Fatal");
00107   return def_cfg;
00108 }
00109 
00110 
00111 //......................................................................
00112 JobCResult EventSRListModule::Reco(MomNavigator *mom)
00113 {
00114 
00115  // load configuration 
00116   const char* tmps = 0;
00117   const char* alg_name = 0;
00118   const char* alg_config_name = 0;
00119   const char* list_in = 0;
00120 
00121 
00122   const char* list_out = 0;
00123 
00124   Registry& cfg = this->GetConfig();
00125   if (cfg.Get("EventListAlgorithm",tmps)) alg_name = tmps;
00126   if (cfg.Get("EventListAlgConfig",tmps)) alg_config_name = tmps;
00127   if (cfg.Get("ListIn",tmps)) list_in = tmps;
00128   if (cfg.Get("ListOut",tmps)) list_out = tmps;
00129 
00130 // Find PrimaryCandidateRecord fragment in MOM.
00131    CandRecord *candrec = dynamic_cast<CandRecord *>
00132              (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00133    if (candrec == 0) {
00134      MSG("EventSR", Msg::kWarning) << "No PrimaryCandidateRecord in MOM"
00135                                                                 << endl;
00136      return JobCResult::kWarning; // Raise warning flag
00137    }
00138 
00139 
00140 // (Re)Initialize VldContext in Calibrator
00141    Calibrator::Instance().Reset(*candrec->GetVldContext());
00142 
00143 // Find CandSliceList fragment in PrimaryCandidateRecord.
00144    CandSliceListHandle *slicelist0 = 0;     // CandRecord will own this
00145    CandSliceListHandle *slicelist = 0;    // Handle to be owned locally
00146    if ((slicelist0 = dynamic_cast<CandSliceListHandle *>
00147         (candrec->FindCandHandle("CandSliceListHandle",list_in)))) 
00148      slicelist = slicelist0->DupHandle();
00149 
00150 // if fit tracks exist, use those
00151    CandTrackListHandle *tracklist0 = 0;     // CandRecord will own this
00152    CandTrackListHandle *tracklist = 0;    // Handle to be owned locally
00153    if ((tracklist0 = dynamic_cast<CandTrackListHandle *>
00154                   (candrec->FindCandHandle("CandFitTrackListHandle"))))
00155      tracklist = tracklist0->DupHandle();
00156    else if ((tracklist0 = dynamic_cast<CandTrackListHandle *>
00157                      (candrec->FindCandHandle("CandTrackListHandle"))))
00158      tracklist = tracklist0->DupHandle();
00159 
00160    CandShowerListHandle *showerlist0 = 0;   // CandRecord will own this
00161    CandShowerListHandle *showerlist = 0;  // Handle to be owned locally
00162    if ((showerlist0 = dynamic_cast<CandShowerListHandle *>
00163                     (candrec->FindCandHandle("CandShowerListHandle"))))
00164      showerlist = showerlist0->DupHandle();
00165 
00166    CandClusterListHandle *clusterlist0 = 0; // CandRecord will own this
00167    CandClusterListHandle *clusterlist = 0;// Handle to be owned locally
00168    if ((clusterlist0 = dynamic_cast<CandClusterListHandle *>
00169                    (candrec->FindCandHandle("CandClusterListHandle"))))
00170      clusterlist = clusterlist0->DupHandle();
00171    
00172    CandSubShowerSRListHandle *subshowerlist0 = 0; // CandRecord will own this
00173    CandSubShowerSRListHandle *subshowerlist = 0;// Handle to be owned locally
00174    if ((subshowerlist0 = dynamic_cast<CandSubShowerSRListHandle *>
00175                    (candrec->FindCandHandle("CandSubShowerSRListHandle"))))
00176      subshowerlist = subshowerlist0->DupHandle();
00177 
00178    if (!slicelist || slicelist->GetNDaughters() < 1) {
00179      MAXMSG("EventSR",Msg::kInfo,1) <<
00180        "CandSliceList does not exist.\n";
00181 
00182 // Delete owned CandHandles
00183      delete slicelist;
00184      delete tracklist;
00185      delete showerlist;
00186      delete clusterlist;
00187      delete subshowerlist;
00188 
00189 //--ju 6/23/05 this is not an error condition.  
00190 //   return JobCResult::kError;
00191      return JobCResult::kFailed;
00192    }
00193 
00194    TObjArray cxin;
00195  
00196    if (slicelist) cxin.Add(slicelist);
00197    if (tracklist) cxin.Add(tracklist);
00198    if (showerlist)  cxin.Add(showerlist);
00199    if (clusterlist) cxin.Add(clusterlist); 
00200    if (subshowerlist) cxin.Add(subshowerlist); 
00201 
00202 // Build a CandEventSRList containing all CandEventSRs in Frame.
00203    AlgFactory &af = AlgFactory::GetInstance();
00204    AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name);
00205    CandContext cx(this, mom);
00206    cx.SetDataIn(&cxin);
00207    cx.SetCandRecord(candrec);
00208    CandEventListHandle csllh =
00209                                CandEventList::MakeCandidate(adlh, cx);
00210    csllh.SetName(list_out);
00211    csllh.SetTitle(TString("Created by EventSRListModule from ").
00212                  Append(slicelist->GetName()));
00213 
00214 // Give the CandHandle to the CandRecord
00215    candrec->SecureCandHandle(csllh);
00216 
00217 // Secure CandSlice/Track/Shower/Cluster Lists if modified.
00218    if (slicelist && !slicelist->IsEqual(slicelist0)) {      // Is cloned
00219      slicelist->SetName(TString("ModBy:").Append(adlh.GetName()));
00220      slicelist->SetTitle(TString("Created by EventSRListModule from ").
00221                                          Append(slicelist0->GetName()));
00222      candrec->SecureCandHandle(*slicelist);
00223    }
00224 
00225    if (tracklist && !tracklist->IsEqual(tracklist0)) {      // Is cloned
00226      tracklist->SetName(TString("ModBy:").Append(adlh.GetName()));
00227      tracklist->SetTitle(TString("Created by EventSRListModule from ").
00228                                          Append(tracklist0->GetName()));
00229      candrec->SecureCandHandle(*tracklist);
00230    }
00231 
00232    if (showerlist && !showerlist->IsEqual(showerlist0)) {   // Is cloned
00233      showerlist->SetName(TString("ModBy:").Append(adlh.GetName()));
00234      showerlist->SetTitle(TString("Created by EventSRListModule from ").
00235                                         Append(showerlist0->GetName()));
00236      candrec->SecureCandHandle(*showerlist);
00237    }
00238 
00239    if (clusterlist && !clusterlist->IsEqual(clusterlist0)) {// Is cloned
00240      clusterlist->SetName(TString("ModBy:").Append(adlh.GetName()));
00241      clusterlist->SetTitle(TString(
00242                                   "Created by EventSRListModule from ").
00243                                        Append(clusterlist0->GetName()));
00244      candrec->SecureCandHandle(*clusterlist);
00245    }
00246 
00247    if (subshowerlist && !subshowerlist->IsEqual(subshowerlist0)) {// Is cloned
00248      subshowerlist->SetName(TString("ModBy:").Append(adlh.GetName()));
00249      subshowerlist->SetTitle(TString(
00250                                   "Created by EventSRListModule from ").
00251                                        Append(subshowerlist0->GetName()));
00252      candrec->SecureCandHandle(*subshowerlist);
00253    }
00254 
00255 // Delete owned CandHandles
00256    delete slicelist;
00257    delete tracklist;
00258    delete showerlist;
00259    delete clusterlist;
00260    delete subshowerlist;
00261 
00262    return JobCResult::kAOK; // All OK, no decision
00263 }
00264 
00265 //____________________________________________________________________
00266 
00267 JobCResult EventSRListModule::FilterEvent()
00268 {
00269   return JobCResult::kPassed;
00270 }
00271 
00272 //______________________________________________________________________
00273 
00274 JobCResult EventSRListModule::Ana(const MomNavigator * /*mom*/)
00275 {
00276 
00277 
00278 
00279 
00280   return JobCResult::kPassed;
00281 
00282 
00283 }
00284 
00285 //______________________________________________________________________
00286 void EventSRListModule::EndJob()
00287 {
00288 }
00289 

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