EventSRListModule Class Reference

#include <EventSRListModule.h>

Inheritance diagram for EventSRListModule:
JobCModule

List of all members.

Public Member Functions

 EventSRListModule ()
 ~EventSRListModule ()
void BeginJob ()
JobCResult Reco (MomNavigator *mom)
JobCResult Ana (const MomNavigator *mom)
void EndJob ()
JobCResult FilterEvent ()
const RegistryDefaultConfig () const

Detailed Description

Definition at line 30 of file EventSRListModule.h.


Constructor & Destructor Documentation

EventSRListModule::EventSRListModule (  ) 

Definition at line 68 of file EventSRListModule.cxx.

00069 {
00070 }

EventSRListModule::~EventSRListModule (  ) 

Definition at line 73 of file EventSRListModule.cxx.

00074 {
00075 }


Member Function Documentation

JobCResult EventSRListModule::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 274 of file EventSRListModule.cxx.

References JobCResult::kPassed.

00275 {
00276 
00277 
00278 
00279 
00280   return JobCResult::kPassed;
00281 
00282 
00283 }

void EventSRListModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 78 of file EventSRListModule.cxx.

00079 {
00080 }

const Registry & EventSRListModule::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 83 of file EventSRListModule.cxx.

References JobCModule::GetName(), and Registry::Set().

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 }

void EventSRListModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 286 of file EventSRListModule.cxx.

00287 {
00288 }

JobCResult EventSRListModule::FilterEvent (  ) 

Definition at line 267 of file EventSRListModule.cxx.

References JobCResult::kPassed.

00268 {
00269   return JobCResult::kPassed;
00270 }

JobCResult EventSRListModule::Reco ( MomNavigator mom  )  [virtual]

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 112 of file EventSRListModule.cxx.

References CandSliceListHandle::DupHandle(), CandClusterListHandle::DupHandle(), CandShowerListHandle::DupHandle(), CandSubShowerSRListHandle::DupHandle(), CandTrackListHandle::DupHandle(), CandRecord::FindCandHandle(), Registry::Get(), AlgFactory::GetAlgHandle(), JobCModule::GetConfig(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), CandHandle::GetName(), AlgHandle::GetName(), CandHandle::GetNDaughters(), RecMinos::GetVldContext(), Calibrator::Instance(), CandHandle::IsEqual(), JobCResult::kAOK, JobCResult::kFailed, Msg::kInfo, JobCResult::kWarning, Msg::kWarning, CandEventList::MakeCandidate(), MAXMSG, MSG, CalScheme::Reset(), CandRecord::SecureCandHandle(), CandContext::SetCandRecord(), CandContext::SetDataIn(), CandHandle::SetName(), and CandHandle::SetTitle().

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 }


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1