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

AlgEventSR.cxx

Go to the documentation of this file.
00001 
00003 // $Id: AlgEventSR.cxx,v 1.29 2007/10/13 23:33:03 musser Exp $
00004 //
00005 // AlgEventSR.cxx
00006 //
00007 // Begin_Html<img src="../../pedestrians.gif" align=center>
00008 // <a href="../source_warning.html">Warning for beginners</a>.<br> 
00009 //
00010 // AlgEventSR is a concrete EventSR Algorithm class.
00011 //
00012 // Author:  R. Lee 2001.03.07
00013 //
00014 // Also see <a href="../../root_crib/index.html">The ROOT Crib</a> and 
00015 // <a href="../CandEventSR.html"> CandEventSR Classes</a> (part of
00016 // <a href="../index.html">The MINOS Class User Guide</a>)End_Html
00018 
00019 #include <cassert>
00020 #include <map>
00021 
00022 #include "Algorithm/AlgFactory.h"
00023 #include "Algorithm/AlgHandle.h"
00024 #include "Algorithm/AlgConfig.h"
00025 #include "Candidate/CandContext.h"
00026 #include "CandEventSR/AlgEventSR.h"
00027 #include "RecoBase/CandEventHandle.h"
00028 #include "CandFitTrackSR/CandFitTrackSRHandle.h"
00029 #include "CandTrackSR/CandTrackSRHandle.h"
00030 #include "CandTrackSR/Track2DSR.h"
00031 #include "MessageService/MsgService.h"
00032 #include "MinosObjectMap/MomNavigator.h"
00033 #include "RecoBase/CandStripHandle.h"
00034 #include "RecoBase/CandSliceHandle.h"
00035 #include "RecoBase/CandShowerHandle.h"
00036 #include "RecoBase/CandTrackHandle.h"
00037 #include "Validity/VldContext.h"
00038 #include "VertexFinder/VertexFinder.h"
00039 #include "Calibrator/Calibrator.h"
00040 #include "DataUtil/PlaneOutline.h"
00041 #include "UgliGeometry/UgliGeomHandle.h"
00042 
00043 ClassImp(AlgEventSR)
00044 
00045 //______________________________________________________________________
00046 CVSID("$Id: AlgEventSR.cxx,v 1.29 2007/10/13 23:33:03 musser Exp $");
00047 
00048 //______________________________________________________________________
00049 AlgEventSR::AlgEventSR()
00050 {
00051 }
00052 
00053 //______________________________________________________________________
00054 AlgEventSR::~AlgEventSR()
00055 {
00056 }
00057 
00058 //______________________________________________________________________
00059 void AlgEventSR::RunAlg(AlgConfig &ac, CandHandle &ch, CandContext &cx)
00060 {
00061 
00062   // get alg parameters
00063   Double_t shwshwdz = ac.GetDouble("ShwShwDz");
00064   Double_t minShwEFract = ac.GetDouble("MinShwEFract");
00065   Double_t isCosmic = ac.GetInt("IsCosmic");
00066 
00067   // check that all is well with inputs
00068 
00069   const CandRecord* candrec = dynamic_cast<CandRecord*>
00070     (cx.GetMom()->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00071   if (candrec==0) {
00072     MSG("EventSR", Msg::kWarning)
00073       << "No PrimaryCandidateRecord in MOM." << endl;
00074   }
00075   assert(candrec);
00076   const VldContext *vldcptr = candrec->GetVldContext();
00077   assert(vldcptr);
00078   assert(ch.InheritsFrom("CandEventHandle"));
00079   CandEventHandle &ceh = dynamic_cast<CandEventHandle &>(ch);
00080   assert(cx.GetDataIn());
00081   assert(cx.GetDataIn()->InheritsFrom("TObjArray"));
00082   const TObjArray *tary =
00083      dynamic_cast<const TObjArray*>(cx.GetDataIn());
00084   assert(tary->GetLast()>=0);
00085 
00086 
00087   // construct daughter strip list, and track and shower lists
00088   for (Int_t i=0; i<=tary->GetLast(); i++) {
00089     TObject *tobj = tary->At(i);
00090     assert(tobj->InheritsFrom("CandRecoHandle"));
00091     CandRecoHandle *recohandle = dynamic_cast<CandRecoHandle*>(tobj);
00092     CandStripHandleItr stripItr(recohandle->GetDaughterIterator());
00093     while (CandStripHandle *strip = stripItr()) {
00094       ceh.AddDaughterLink(*strip);
00095     }
00096     if (tobj->InheritsFrom("CandShowerHandle")) {
00097       CandShowerHandle *showerhandle = dynamic_cast<CandShowerHandle*>(tobj);
00098       ceh.AddShower(showerhandle);
00099     }
00100     if (tobj->InheritsFrom("CandTrackHandle")) {
00101       CandTrackHandle *trackhandle = dynamic_cast<CandTrackHandle*>(tobj);
00102       ceh.AddTrack(trackhandle);
00103     }
00104   }
00105 
00106   ceh.SetPrimaryTrack();
00107   ceh.SetPrimaryShower(minShwEFract,shwshwdz);
00108 
00109   MSG("EventSR", Msg::kVerbose)
00110       << "End Setting Primary Track and Shower" << endl;
00111 
00112   CandTrackHandle * besttrack = ceh.GetPrimaryTrack();
00113   CandShowerHandle * bestshower = ceh.GetPrimaryShower();
00114 
00115   // Use Boehm vertex finder - this is the default vertex for non-cosmic events
00116   VertexFinder Vfinder(&ceh,vldcptr); 
00117   Int_t result = Vfinder.FindVertex();
00118 
00119   if (besttrack) {
00120     ceh.SetVtxU(besttrack->GetVtxU());
00121     ceh.SetVtxV(besttrack->GetVtxV());
00122     ceh.SetVtxZ(besttrack->GetVtxZ());
00123     ceh.SetVtxT(besttrack->GetVtxT());
00124     ceh.SetVtxPlane(besttrack->GetVtxPlane());
00125     ceh.SetEndU(besttrack->GetEndU());
00126     ceh.SetEndV(besttrack->GetEndV());
00127     ceh.SetEndZ(besttrack->GetEndZ());
00128     ceh.SetEndT(besttrack->GetEndT());
00129     ceh.SetEndPlane(besttrack->GetTermPlane());
00130     ceh.SetVtxDirCosU(besttrack->GetVtxDirCosU());
00131     ceh.SetVtxDirCosV(besttrack->GetVtxDirCosV());
00132     ceh.SetVtxDirCosZ(besttrack->GetVtxDirCosZ());
00133     ceh.SetEndDirCosU(besttrack->GetEndDirCosU());
00134     ceh.SetEndDirCosV(besttrack->GetEndDirCosV());
00135     ceh.SetEndDirCosZ(besttrack->GetEndDirCosZ());
00136   }
00137   else if (bestshower) {
00138     ceh.SetVtxU(bestshower->GetVtxU());
00139     ceh.SetVtxV(bestshower->GetVtxV());
00140     ceh.SetVtxZ(bestshower->GetVtxZ());
00141     ceh.SetVtxT(bestshower->GetVtxT());
00142     ceh.SetVtxPlane(bestshower->GetVtxPlane());
00143     ceh.SetEndU(bestshower->GetEndU());
00144     ceh.SetEndV(bestshower->GetEndV());
00145     ceh.SetEndZ(bestshower->GetEndZ());
00146     ceh.SetEndT(bestshower->GetEndT());
00147     ceh.SetEndPlane(bestshower->GetTermPlane());
00148     ceh.SetVtxDirCosU(bestshower->GetVtxDirCosU());
00149     ceh.SetVtxDirCosV(bestshower->GetVtxDirCosV());
00150     ceh.SetVtxDirCosZ(bestshower->GetVtxDirCosZ());
00151     ceh.SetEndDirCosZ(bestshower->GetEndDirCosZ());
00152     ceh.SetEndDirCosU(bestshower->GetEndDirCosU());
00153     ceh.SetEndDirCosV(bestshower->GetEndDirCosV());
00154   }
00155   if(result==1 && !isCosmic){
00156     ceh.SetVtxU(Vfinder.VtxU());
00157     ceh.SetVtxV(Vfinder.VtxV());
00158     ceh.SetVtxZ(Vfinder.VtxZ());
00159     ceh.SetVtxPlane(Vfinder.VtxPlane());
00160   }
00161 
00162   Calibrate(&ceh);
00163   bool contained = true;
00164   // determine whether event is contained.
00165   // set energy
00166   Float_t energy=0;
00167   if(ceh.GetPrimaryTrack()){
00168     energy+=ceh.GetPrimaryTrack()->GetMomentum();
00169     contained = ceh.GetPrimaryTrack()->IsContained();
00170   }
00171   if(ceh.GetPrimaryShower()){
00172     energy+=ceh.GetPrimaryShower()->GetEnergy();
00173     contained &= ceh.GetPrimaryShower()->IsContained();
00174   }
00175   ceh.SetEnergy(energy);
00176   ceh.SetContained(contained);
00177 }
00178 
00179 //______________________________________________________________________
00180 void AlgEventSR::Trace(const char * /* c */) const
00181 {
00182 }

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