CandEventHandle Class Reference

#include <CandEventHandle.h>

Inheritance diagram for CandEventHandle:
CandRecoHandle CandHandle FarDetEventHandle

List of all members.

Public Member Functions

 CandEventHandle ()
 CandEventHandle (const CandEventHandle &cdh)
 CandEventHandle (CandEvent *cd)
virtual ~CandEventHandle ()
virtual CandEventHandleDupHandle () const
virtual void Trace (const char *c="") const
void SetCandSlice (const CandSliceHandle *slice)
const CandSliceHandleGetCandSlice () const
void AddShower (const CandShowerHandle *)
void AddTrack (const CandTrackHandle *)
void SetPrimaryShower (Double_t MinShwEFract, Double_t MinShwShwDZ)
void SetPrimaryTrack ()
void SetPrimaryShower (const CandShowerHandle *primaryshower)
void SetPrimaryTrack (const CandTrackHandle *primarytrack)
const CandShowerHandleGetShower (Int_t) const
CandShowerHandleGetShowerWritable (Int_t)
const CandTrackHandleGetTrack (Int_t) const
CandShowerHandleGetPrimaryShower () const
CandTrackHandleGetPrimaryTrack () const
Int_t GetPrimaryShowerIndex () const
Int_t GetPrimaryTrackIndex () const
Int_t GetLastShower () const
Int_t GetLastTrack () const
void CompressShower ()
void CompressTrack ()
Bool_t IsContained ()
void SetContained (Bool_t contained)
void SetEnergy (Double_t)
Double_t GetEnergy () const

Static Public Member Functions

static NavKey KeyFromSlice (const CandEventHandle *)

Detailed Description

Definition at line 26 of file CandEventHandle.h.


Constructor & Destructor Documentation

CandEventHandle::CandEventHandle (  ) 

Definition at line 37 of file CandEventHandle.cxx.

Referenced by DupHandle().

00038 {
00039 }

CandEventHandle::CandEventHandle ( const CandEventHandle cdh  ) 

Definition at line 42 of file CandEventHandle.cxx.

00042                                                            :
00043   CandRecoHandle(cdh)
00044 {
00045 }

CandEventHandle::CandEventHandle ( CandEvent cd  ) 

Definition at line 48 of file CandEventHandle.cxx.

00048                                               :
00049   CandRecoHandle(cd)
00050 {
00051 }

CandEventHandle::~CandEventHandle (  )  [virtual]

Definition at line 54 of file CandEventHandle.cxx.

00055 {
00056 }


Member Function Documentation

void CandEventHandle::AddShower ( const CandShowerHandle shower  ) 

Definition at line 397 of file CandEventHandle.cxx.

References CandShowerHandle::DupHandle(), CandHandle::GetCandBase(), and CandHandle::GetOwnedCandBase().

Referenced by AlgEventSSList::CreatePrimaryShower(), AlgEventSRList::CreatePrimaryShower(), and AlgFarDetEvent::SetShowerProperties().

00398 {
00399   const TObjArray &showerlist =
00400                  (dynamic_cast<CandEvent*>(GetCandBase()))->fShowerList;
00401   Bool_t found(0);
00402   for (Int_t i=0; i<=showerlist.GetLast() && !found; i++) {
00403     CandShowerHandle *target =
00404                       dynamic_cast<CandShowerHandle*>(showerlist.At(i));
00405     if (*shower == *target) found = 1;
00406   }
00407   
00408   if (!found)                  // don't want to duplicate object in list
00409     (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fShowerList.
00410                                                Add(shower->DupHandle());
00411   return;
00412 }

void CandEventHandle::AddTrack ( const CandTrackHandle track  ) 

Definition at line 415 of file CandEventHandle.cxx.

References CandTrackHandle::DupHandle(), CandHandle::GetCandBase(), and CandHandle::GetOwnedCandBase().

Referenced by AlgFarDetEvent::SetTrackProperties().

00416 {
00417   const TObjArray &tracklist =
00418                   (dynamic_cast<CandEvent*>(GetCandBase()))->fTrackList;
00419   Bool_t found(0);
00420   for (Int_t i=0; i<=tracklist.GetLast() && !found; i++) {
00421     CandTrackHandle *target =
00422                         dynamic_cast<CandTrackHandle*>(tracklist.At(i));
00423     if (*track == *target) found = 1;
00424   }
00425 
00426   if (!found)                  // don't want to duplicate object in list
00427     (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fTrackList.
00428                                                 Add(track->DupHandle());
00429   return;
00430 }

void CandEventHandle::CompressShower (  ) 

Definition at line 433 of file CandEventHandle.cxx.

References CandHandle::GetOwnedCandBase().

00434 {
00435   dynamic_cast<CandEvent*>(GetOwnedCandBase())->fShowerList.Compress();
00436 }

void CandEventHandle::CompressTrack (  ) 

Definition at line 439 of file CandEventHandle.cxx.

References CandHandle::GetOwnedCandBase().

00440 {
00441   dynamic_cast<CandEvent*>(GetOwnedCandBase())->fTrackList.Compress();
00442 }

CandEventHandle * CandEventHandle::DupHandle (  )  const [virtual]

Reimplemented from CandRecoHandle.

Reimplemented in FarDetEventHandle.

Definition at line 59 of file CandEventHandle.cxx.

References CandEventHandle().

00060 {
00061    return (new CandEventHandle(*this));
00062 }

const CandSliceHandle * CandEventHandle::GetCandSlice (  )  const

Reimplemented from CandRecoHandle.

Definition at line 87 of file CandEventHandle.cxx.

References CandHandle::GetCandBase().

Referenced by AlgEventSSList::CreatePrimaryShower(), AlgEventSRList::CreatePrimaryShower(), KeyFromSlice(), and EVD::UpdateSummary().

00088 {
00089   return dynamic_cast<const CandEvent *>(GetCandBase())->fCandSlice;
00090 }

Double_t CandEventHandle::GetEnergy (  )  const

Definition at line 460 of file CandEventHandle.cxx.

References CandHandle::GetCandBase().

00461 {
00462   return dynamic_cast<const CandEvent*>(GetCandBase())->fEnergy;
00463 }

Int_t CandEventHandle::GetLastShower (  )  const

Definition at line 102 of file CandEventHandle.cxx.

References CandHandle::GetCandBase().

Referenced by GfxShower::BuildDiscreteImp(), GfxShower::BuildRealImp(), AlgReco::Calibrate(), GfxShowerList::Configure(), AlgEventSRList::RunAlg(), AlgEventSSList::RunAlg(), and EVD::UpdateChargeHists().

00103 {
00104   return
00105    dynamic_cast<const CandEvent*>(GetCandBase())->fShowerList.GetLast();
00106 }

Int_t CandEventHandle::GetLastTrack (  )  const

Definition at line 109 of file CandEventHandle.cxx.

References CandHandle::GetCandBase().

Referenced by GfxTrack::BuildDiscreteImp(), GfxTrack::BuildRealImp(), AlgReco::Calibrate(), GfxTrackList::Configure(), and EVD::UpdateChargeHists().

00110 {
00111   return
00112     dynamic_cast<const CandEvent*>(GetCandBase())->fTrackList.GetLast();
00113 }

CandShowerHandle * CandEventHandle::GetPrimaryShower (  )  const

Definition at line 116 of file CandEventHandle.cxx.

References CandHandle::GetCandBase().

Referenced by TruthHelper::EventCompletenessImp(), GetPrimaryShowerIndex(), AlgFarDetEvent::RunAlg(), AlgEventSRList::RunAlg(), and AlgEventSSList::RunAlg().

00117 {
00118   return dynamic_cast<const CandEvent*>(GetCandBase())->fPrimaryShower;
00119 }

Int_t CandEventHandle::GetPrimaryShowerIndex (  )  const

Definition at line 128 of file CandEventHandle.cxx.

References CandHandle::GetCandBase(), and GetPrimaryShower().

00129 {
00130 
00131   if(!GetPrimaryShower()) return -1;
00132   const TObjArray &showerlist =
00133                   (dynamic_cast<const CandEvent*>(GetCandBase()))->fShowerList;
00134   for (Int_t i=0; i<=showerlist.GetLast(); i++) {
00135     CandShowerHandle *shower =
00136       dynamic_cast<CandShowerHandle*>(showerlist.At(i));
00137     CandShowerHandle * primaryshower = GetPrimaryShower();
00138     if (*primaryshower == *shower) {
00139       return i;
00140     }
00141   }
00142   return -1;
00143 }

CandTrackHandle * CandEventHandle::GetPrimaryTrack (  )  const
Int_t CandEventHandle::GetPrimaryTrackIndex (  )  const

Definition at line 146 of file CandEventHandle.cxx.

References CandHandle::GetCandBase(), and GetPrimaryTrack().

00147 {
00148   if(!GetPrimaryTrack()) return -1;
00149   
00150   const TObjArray &tracklist =
00151                   (dynamic_cast<const CandEvent*>(GetCandBase()))->fTrackList;
00152   for (Int_t i=0; i<= tracklist.GetLast(); i++) {
00153     CandTrackHandle *track =
00154       dynamic_cast<CandTrackHandle*>(tracklist.At(i));
00155     CandTrackHandle * primarytrack = GetPrimaryTrack();
00156     if ( *primarytrack == *track) {
00157       return i;
00158     }
00159   }
00160   return -1;
00161 }

const CandShowerHandle * CandEventHandle::GetShower ( Int_t  i  )  const

Definition at line 164 of file CandEventHandle.cxx.

References CandHandle::GetCandBase().

Referenced by GfxShower::BuildDiscreteImp(), GfxShower::BuildRealImp(), AlgReco::Calibrate(), GfxShowerList::Configure(), AlgEventSRList::RunAlg(), AlgEventSSList::RunAlg(), and EVD::UpdateChargeHists().

00165 {
00166   const TObjArray *fShowerList =
00167           &(dynamic_cast<const CandEvent*>(GetCandBase())->fShowerList);
00168   if (i>fShowerList->GetLast()) {
00169     return 0;
00170   }
00171   return dynamic_cast<const CandShowerHandle*>(fShowerList->At(i));
00172 }

CandShowerHandle * CandEventHandle::GetShowerWritable ( Int_t  i  ) 

Definition at line 175 of file CandEventHandle.cxx.

References CandHandle::GetOwnedCandBase().

Referenced by AlgEventSRList::RunAlg(), and AlgEventSSList::RunAlg().

00176 {
00177   const TObjArray *fShowerList =
00178      &(dynamic_cast<const CandEvent*>(GetOwnedCandBase())->fShowerList);
00179   if (i>fShowerList->GetLast()) {
00180     return 0;
00181   }
00182   return dynamic_cast<CandShowerHandle*>(fShowerList->At(i));
00183 }

const CandTrackHandle * CandEventHandle::GetTrack ( Int_t  i  )  const

Definition at line 186 of file CandEventHandle.cxx.

References CandHandle::GetCandBase().

Referenced by GfxTrack::BuildDiscreteImp(), GfxTrack::BuildRealImp(), AlgReco::Calibrate(), GfxTrackList::Configure(), and EVD::UpdateChargeHists().

00187 {
00188   const TObjArray *fTrackList =
00189            &(dynamic_cast<const CandEvent*>(GetCandBase())->fTrackList);
00190   if (i>fTrackList->GetLast()) {
00191     return 0;
00192   }
00193   return dynamic_cast<const CandTrackHandle*>(fTrackList->At(i));
00194 }

Bool_t CandEventHandle::IsContained (  ) 

Definition at line 449 of file CandEventHandle.cxx.

References CandHandle::GetCandBase().

00450 {
00451   return dynamic_cast<CandEvent*>(GetCandBase())->fContained;
00452 }

NavKey CandEventHandle::KeyFromSlice ( const CandEventHandle event  )  [static]

Reimplemented from CandRecoHandle.

Definition at line 92 of file CandEventHandle.cxx.

References GetCandSlice().

00093 {
00094   if (event->GetCandSlice()) {
00095     return static_cast<Int_t>(event->GetCandSlice()->GetUidInt());
00096   }
00097   return 0;
00098 }

void CandEventHandle::SetCandSlice ( const CandSliceHandle slice  ) 

Reimplemented from CandRecoHandle.

Definition at line 77 of file CandEventHandle.cxx.

References CandSliceHandle::DupHandle(), and CandHandle::GetOwnedCandBase().

Referenced by AlgEventSSList::BuildEventFromUnassoc(), AlgEventSRList::BuildEventFromUnassoc(), AlgEventSRList::RunAlg(), and AlgEventSSList::RunAlg().

00078 {
00079   if (slice) {                 // fCandSlice is now an owned CandHandle*
00080     CandSliceHandle *ch = slice->DupHandle();
00081     delete (dynamic_cast<CandEvent *>(GetOwnedCandBase()))->fCandSlice;
00082     dynamic_cast<CandEvent *>(GetOwnedCandBase())->fCandSlice = ch;
00083   }
00084 }

void CandEventHandle::SetContained ( Bool_t  contained  ) 

Definition at line 444 of file CandEventHandle.cxx.

References CandHandle::GetOwnedCandBase().

00445 {
00446   dynamic_cast<CandEvent*>(GetOwnedCandBase())->fContained=contained;
00447 }

void CandEventHandle::SetEnergy ( Double_t  energy  ) 

Definition at line 455 of file CandEventHandle.cxx.

References CandHandle::GetOwnedCandBase().

Referenced by AlgFarDetEvent::RunAlg().

00456 {
00457   dynamic_cast<CandEvent*>(GetOwnedCandBase())->fEnergy = energy;
00458 }

void CandEventHandle::SetPrimaryShower ( const CandShowerHandle primaryshower  ) 

Definition at line 196 of file CandEventHandle.cxx.

References CandShowerHandle::DupHandle(), CandHandle::GetCandBase(), and CandHandle::GetOwnedCandBase().

00196                                                                             {
00197 
00198   const TObjArray &showerlist =
00199                  (dynamic_cast<CandEvent*>(GetCandBase()))->fShowerList;
00200   Bool_t found=0;
00201   Int_t iprimary = -1;
00202   for (Int_t i=0; i<=showerlist.GetLast() && !found; i++) {
00203     CandShowerHandle *shower =
00204       dynamic_cast<CandShowerHandle*>(showerlist.At(i));
00205     if (*primaryshower == *shower) {
00206       found = 1;
00207       iprimary = i;
00208     }
00209   }
00210   if (iprimary>0) {
00211     CandShowerHandle *shower =
00212                dynamic_cast<CandShowerHandle*>(showerlist.At(iprimary));
00213     (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fShowerList.
00214                                       AddAt(showerlist.At(0), iprimary);
00215     (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fShowerList.
00216                                                        AddAt(shower, 0);
00217   }
00218   CandShowerHandle *ch = primaryshower->DupHandle();
00219   delete (dynamic_cast<CandEvent *>
00220           (GetOwnedCandBase()))->fPrimaryShower;
00221   (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fPrimaryShower = ch;
00222 
00223 }

void CandEventHandle::SetPrimaryShower ( Double_t  MinShwEFract,
Double_t  MinShwShwDZ 
)

Definition at line 225 of file CandEventHandle.cxx.

References CandShowerHandle::DupHandle(), CandHandle::GetCandBase(), CandShowerHandle::GetEnergy(), CandHandle::GetOwnedCandBase(), GetPrimaryTrack(), CandRecoHandle::GetVtxZ(), Munits::GeV, Munits::m, and SetPrimaryTrack().

Referenced by AlgEventSSList::BuildEventFromUnassoc(), AlgEventSRList::BuildEventFromUnassoc(), AlgEventSSList::CreatePrimaryShower(), AlgEventSRList::CreatePrimaryShower(), and AlgFarDetEvent::SetShowerProperties().

00226 {
00227 
00228   CandTrackHandle *primarytrack = 0;
00229   if(!GetPrimaryTrack())SetPrimaryTrack();
00230   primarytrack = GetPrimaryTrack();
00231   const TObjArray &showerlist =
00232                  (dynamic_cast<CandEvent*>(GetCandBase()))->fShowerList;
00233 
00234   // find the shower closest to the track vertex, and the shower with highest energy
00235     
00236   CandShowerHandle *closestshower = 0;
00237   CandShowerHandle *largestshower = 0;
00238   CandShowerHandle *primaryshower = 0;
00239   Float_t largestenergy=-1;
00240   Float_t closestenergy=-1;
00241   Float_t dzlargest=0;
00242   Float_t dzclosest=1e6;
00243 
00244 
00245   for (Int_t i=0; i<=showerlist.GetLast(); i++) {
00246     CandShowerHandle *shower =
00247       dynamic_cast<CandShowerHandle*>(showerlist.At(i));
00248     if (!largestshower || shower->GetEnergy()>largestenergy) {
00249       largestenergy = shower->GetEnergy();
00250       largestshower = shower;
00251       if(primarytrack)dzlargest = fabs(shower->GetVtxZ()-primarytrack->GetVtxZ());
00252     }
00253     if(primarytrack){
00254       if(fabs(shower->GetVtxZ()-primarytrack->GetVtxZ())<dzclosest){
00255         dzclosest=fabs(shower->GetVtxZ()-primarytrack->GetVtxZ());
00256         closestshower=shower;
00257         closestenergy=shower->GetEnergy();
00258       }
00259     }
00260   }
00261   // if the largest shower is greater than shwshwdz from the track vertex, 
00262   // and the closest shower has energy greater than minshwEfract
00263   // call the closest shower the primary
00264   float eratio = 1.;
00265   if(largestenergy>0) eratio = closestenergy/largestenergy; 
00266   if(closestshower && (dzlargest-dzclosest)>minShwShwDZ && eratio>minShwEFract){
00267     primaryshower = closestshower;
00268   }
00269   //largest shower is the primary if there is no track
00270   else{
00271     primaryshower = largestshower;
00272   }
00273 
00274   if(primaryshower && primaryshower->GetEnergy()<2*Munits::GeV){
00275     if(primarytrack){
00276       if(fabs(primarytrack->GetVtxZ()-primaryshower->GetVtxZ())>0.5*Munits::m)
00277         primaryshower = 0;
00278     }
00279   }
00280   if(!primaryshower){
00281     delete (dynamic_cast<CandEvent *>
00282             (GetOwnedCandBase()))->fPrimaryShower;
00283     (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fPrimaryShower = 0;
00284     return;
00285   }
00286 
00287   Bool_t found=0;
00288   Int_t iprimary = -1;
00289   for (Int_t i=0; i<=showerlist.GetLast() && !found; i++) {
00290     CandShowerHandle *shower =
00291       dynamic_cast<CandShowerHandle*>(showerlist.At(i));
00292     if (*primaryshower == *shower) {
00293       found = 1;
00294       iprimary = i;
00295     }
00296   }
00297   if (iprimary>0) {
00298     CandShowerHandle *shower =
00299                dynamic_cast<CandShowerHandle*>(showerlist.At(iprimary));
00300     (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fShowerList.
00301                                       AddAt(showerlist.At(0), iprimary);
00302     (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fShowerList.
00303                                                        AddAt(shower, 0);
00304   }
00305   CandShowerHandle *ch = primaryshower->DupHandle();
00306   delete (dynamic_cast<CandEvent *>
00307           (GetOwnedCandBase()))->fPrimaryShower;
00308   (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fPrimaryShower = ch;
00309 
00310 }

void CandEventHandle::SetPrimaryTrack ( const CandTrackHandle primarytrack  ) 

Definition at line 312 of file CandEventHandle.cxx.

References CandTrackHandle::DupHandle(), CandHandle::GetCandBase(), and CandHandle::GetOwnedCandBase().

00312                                                                          {
00313 
00314   const TObjArray &tracklist =
00315                   (dynamic_cast<CandEvent*>(GetCandBase()))->fTrackList;
00316 
00317   Bool_t found(0);
00318   Int_t iprimary=-1;
00319   for (Int_t i=0; i<=tracklist.GetLast() && !found; i++) {
00320     CandTrackHandle *track =
00321                         dynamic_cast<CandTrackHandle*>(tracklist.At(i));
00322     
00323     if (*primarytrack == *track) {
00324       found = 1;
00325       iprimary = i;
00326     }
00327   }
00328 
00329 
00330   if (iprimary>0) {
00331     CandTrackHandle *track =
00332                  dynamic_cast<CandTrackHandle*>(tracklist.At(iprimary));
00333     (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fTrackList.
00334       AddAt(tracklist.At(0), iprimary);
00335     (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fTrackList.
00336       AddAt(track, 0);
00337   }
00338   if (primarytrack) {       // fPrimaryTrack is now an owned CandHandle*
00339     CandTrackHandle *ch = primarytrack->DupHandle();
00340     delete (dynamic_cast<CandEvent *>
00341                                    (GetOwnedCandBase()))->fPrimaryTrack;
00342     (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fPrimaryTrack = ch;
00343   }
00344   else {
00345     delete (dynamic_cast<CandEvent *>
00346                                    (GetOwnedCandBase()))->fPrimaryTrack;
00347     (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fPrimaryTrack = 0;
00348   }
00349 
00350 }

void CandEventHandle::SetPrimaryTrack (  ) 

Definition at line 352 of file CandEventHandle.cxx.

References CandTrackHandle::DupHandle(), CandHandle::GetCandBase(), CandHandle::GetOwnedCandBase(), and CandTrackHandle::GetScore().

Referenced by SetPrimaryShower(), and AlgFarDetEvent::SetTrackProperties().

00353 {
00354 
00355   const TObjArray &tracklist =
00356                   (dynamic_cast<CandEvent*>(GetCandBase()))->fTrackList;
00357 
00358   Double_t bestscore=0;
00359   Bool_t found(0);
00360   Int_t iprimary=-1;
00361   CandTrackHandle *primarytrack=0;
00362 
00363   for (Int_t i=0; i<=tracklist.GetLast() && !found; i++) {
00364     CandTrackHandle *track =
00365                         dynamic_cast<CandTrackHandle*>(tracklist.At(i));
00366     
00367     if (!primarytrack || track->GetScore()>bestscore) {
00368       primarytrack = track;
00369       bestscore=track->GetScore();
00370       found = 1;
00371       iprimary = i;
00372     }
00373   }
00374 
00375   if (iprimary>0) {
00376     CandTrackHandle *track =
00377                  dynamic_cast<CandTrackHandle*>(tracklist.At(iprimary));
00378     (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fTrackList.
00379       AddAt(tracklist.At(0), iprimary);
00380     (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fTrackList.
00381       AddAt(track, 0);
00382   }
00383   if (primarytrack) {       // fPrimaryTrack is now an owned CandHandle*
00384     CandTrackHandle *ch = primarytrack->DupHandle();
00385     delete (dynamic_cast<CandEvent *>
00386                                    (GetOwnedCandBase()))->fPrimaryTrack;
00387     (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fPrimaryTrack = ch;
00388   }
00389   else {
00390     delete (dynamic_cast<CandEvent *>
00391                                    (GetOwnedCandBase()))->fPrimaryTrack;
00392     (dynamic_cast<CandEvent*>(GetOwnedCandBase()))->fPrimaryTrack = 0;
00393   }
00394 }

void CandEventHandle::Trace ( const char *  c = ""  )  const [virtual]

Reimplemented from CandRecoHandle.

Reimplemented in FarDetEventHandle.

Definition at line 66 of file CandEventHandle.cxx.

References Msg::kDebug, and MSG.

00067 {
00068   MSG("Cand", Msg::kDebug)
00069     << "**********Begin CandEventHandle::Trace(\"" << c << "\")" << endl
00070            << "Information from CandEventHandle's CandHandle: " << endl;
00071   CandHandle::Trace(c);
00072   MSG("Cand", Msg::kDebug)
00073      << "**********End CandEventHandle::Trace(\"" << c << "\")" << endl;
00074 }


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1