00001 00002 // $Id: AlgStripSR.cxx,v 1.5 2005/01/19 12:29:17 kordosky Exp $ 00003 // 00004 // AlgStripSR.cxx 00005 // 00006 // Begin_Html<img src="../../pedestrians.gif" align=center> 00007 // <a href="../source_warning.html">Warning for beginners</a>.<br> 00008 // 00009 // AlgStripSR is a concrete Strip Algorithm class. 00010 // 00011 // Author: R. Lee 2001.01.23 00012 // 00013 // Also see <a href="../../root_crib/index.html">The ROOT Crib</a> and 00014 // <a href="../CandStripSR.html"> CandStripSR Classes</a> (part of 00015 // <a href="../index.html">The MINOS Class User Guide</a>)End_Html 00017 00018 #include <cassert> 00019 00020 #include "Algorithm/AlgConfig.h" 00021 #include "Algorithm/AlgFactory.h" 00022 #include "Algorithm/AlgHandle.h" 00023 #include "CandData/CandHeader.h" 00024 #include "CandData/CandRecord.h" 00025 #include "CandDigit/CandDigitHandle.h" 00026 #include "Candidate/CandContext.h" 00027 #include "CandStripSR/AlgStripSR.h" 00028 #include "Conventions/CalTimeType.h" 00029 #include "MessageService/MsgService.h" 00030 #include "MinosObjectMap/MomNavigator.h" 00031 #include "RawData/RawHeader.h" 00032 #include "RawData/RawRecord.h" 00033 #include "RecoBase/CandStripHandle.h" 00034 #include "UgliGeometry/UgliGeomHandle.h" 00035 #include "UgliGeometry/UgliStripHandle.h" 00036 #include "Validity/VldContext.h" 00037 00038 ClassImp(AlgStripSR) 00039 00040 //______________________________________________________________________ 00041 AlgStripSR::AlgStripSR() 00042 { 00043 } 00044 00045 //______________________________________________________________________ 00046 AlgStripSR::~AlgStripSR() 00047 { 00048 } 00049 00050 //______________________________________________________________________ 00051 00054 void AlgStripSR::RunAlg(AlgConfig &ac, CandHandle &ch, CandContext &cx) 00055 { 00056 // M. Kordosky: Jan 19, 2005 00057 // without exception handling this is needed 00058 // contrast with pointer case... 00059 assert(ch.InheritsFrom("CandStripHandle")); 00060 CandStripHandle &csh = dynamic_cast<CandStripHandle &>(ch); 00061 00062 // M. Kordosky: Jan 19, 2005 00063 // see comments in loop below regarding InheritsFrom & dynamic_cast<> 00064 // assert(cx.GetDataIn()); 00065 // assert(cx.GetDataIn()->InheritsFrom("TObjArray")); 00066 00067 const TObjArray *tary = 00068 dynamic_cast<const TObjArray*>(cx.GetDataIn()); 00069 assert(tary);// test for cx.GetDataIn() returning null and also a bad cast 00070 00071 CalTimeType::CalTimeType_t caltimetype = (CalTimeType::CalTimeType_t)(ac.GetInt("CalTimeType")); 00072 00073 00074 for (Int_t i=0; i<=tary->GetLast(); i++) { 00075 TObject *tobj = tary->At(i); 00076 00077 // M. Kordosky: Jan 19, 2005... noticed while browsing 00078 // don't do this, it does RTTI twice 00079 // assert(tobj->InheritsFrom("CandDigitHandle")); 00080 // CandDigitHandle *cdh = dynamic_cast<CandDigitHandle*>(tobj); 00081 // instead do this 00082 CandDigitHandle *cdh = dynamic_cast<CandDigitHandle*>(tobj); 00083 assert(cdh); // test for both null tobj pointer and bad cast 00084 // or perhaps this 00085 // assert(tobj->InheritsFrom("CandDigitHandle")); 00086 // CandDigitHandle *cdh = static_cast<CandDigitHandle*>(tobj); 00087 // not sure which option is faster... first doesn't use ROOT's RTTI 00088 00089 csh.AddDaughterLink(*cdh); 00090 if (!i) { 00091 UgliGeomHandle ugh(*cdh->GetVldContext()); 00092 UgliStripHandle ush = 00093 ugh.GetStripHandle(cdh->GetPlexSEIdAltL().GetBestSEId()); 00094 csh.SetBestStripEndId(cdh->GetPlexSEIdAltL().GetBestSEId()); 00095 csh.SetZPos(ugh.GetScintPlnHandle(csh.GetStripEndId(StripEnd::kWhole)).GetZ0()); 00096 csh.SetTPos(ush.GetTPos()); 00097 csh.SetCalTimeType(caltimetype); 00098 } 00099 } 00100 } 00101 00102 //______________________________________________________________________ 00103 void AlgStripSR::Trace(const char * /* c */) const 00104 { 00105 }
1.3.9.1