#include <AlgMCDigitList.h>
Inheritance diagram for AlgMCDigitList:
Public Methods | |
AlgMCDigitList () | |
virtual | ~AlgMCDigitList () |
virtual void | RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx) |
virtual void | Trace (const char *c) const |
|
|
|
Definition at line 46 of file AlgMCDigitList.cxx.
00047 { 00048 } |
|
Implements AlgBase. Definition at line 51 of file AlgMCDigitList.cxx. References CandHandle::AddDaughterLink(), PlexSEIdAltLItem::AddToTime(), AlgFactory::GetAlgHandle(), PlexSEIdAltL::GetCurrentItem(), CandContext::GetDataIn(), RawDigitDataBlock::GetDatumIter(), CandHandle::GetDaughterIterator(), AlgFactory::GetInstance(), CandContext::GetMom(), CandDigitHandle::GetPlexSEIdAltL(), RawRecord::GetRawBlockIter(), CandDigitHandle::GetTime(), PlexSEIdAltL::IsValid(), Msg::kDebug, CandDigit::MakeCandidate(), MSG, PlexSEIdAltL::Next(), CandDigitListHandle::SetAbsTime(), CandContext::SetDataIn(), PlexSEIdAltL::SetFirst(), CandDigitHandle::SetRawDigitIndex(), and CandDigitHandle::SetTime().
00053 { 00054 MSG("AlgMCDigitList", Msg::kDebug) 00055 << "Starting AlgMCDigitList::RunAlg()" << endl; 00056 00057 assert(cx.GetDataIn()); 00058 00059 // Iterate over RawDigitDataBlock or CandDigitList daughters. 00060 if (cx.GetDataIn()->InheritsFrom("RawRecord")) { 00061 00062 // Iterate over input RawDigit's to fill input CandDigitList. 00063 00064 // Get Singleton instance of AlgFactory. 00065 MSG("AlgMCDigitList", Msg::kDebug) 00066 << "AlgFactory &af = AlgFactory::GetInstance();" << endl; 00067 AlgFactory &af = AlgFactory::GetInstance(); 00068 00069 // Get an AlgHandle to AlgMCDigit with "default" AlgConfig. 00070 MSG("AlgMCDigitList", Msg::kDebug) 00071 << "AlgHandle ah = af.GetAlgHandle(\"AlgMCDigit\", \"default\");" 00072 << endl; 00073 AlgHandle ah = af.GetAlgHandle("AlgMCDigit", "default"); 00074 00075 MSG("AlgMCDigitList", Msg::kDebug) 00076 << "Create CandContext instance." << endl 00077 << "CandContext cxx(this);" << endl; 00078 CandContext cxx(this, cx.GetMom()); 00079 00080 // Set up to find snarl time offset 00081 Double_t dtoff = 1.e+30; // Large positive number 00082 00083 // Iterate over RawRecord's RawDataBlockList to find RawDigitDataBlock. 00084 RawRecord *rr = (RawRecord *) (cx.GetDataIn()); 00085 TIter rdbit = rr->GetRawBlockIter(); 00086 TObject *tob; 00087 while ((tob = rdbit())) { 00088 if (tob->InheritsFrom("RawDigitDataBlock")) { 00089 RawDigitDataBlock *rdb = (RawDigitDataBlock *) tob; 00090 TIter rdit = rdb->GetDatumIter(); 00091 RawDigit *rd; 00092 Int_t rawdigitindex = -1; 00093 while ((rd = (RawDigit *) rdit())) { 00094 ++rawdigitindex; 00095 00096 MSG("AlgMCDigitList", Msg::kDebug) 00097 << "Set RawDigit object as CandContext input data." << endl 00098 << "cxx.SetDataIn(rd);" << endl; 00099 cxx.SetDataIn(rd); 00100 00101 MSG("AlgMCDigitList", Msg::kDebug) 00102 << "Get handle to CandDigit." << endl 00103 << "cdh = CandDigit::MakeCandidate(ah, cxx);" << endl; 00104 00105 CandDigitHandle cdh = CandDigit::MakeCandidate(ah, cxx); 00106 cdh.SetRawDigitIndex(rawdigitindex); 00107 00108 // Find lowest value for absolute snarl time offset 00109 Double_t dtemp = cdh.GetTime(); 00110 MSG("AlgMCDigitList", Msg::kDebug) 00111 << "Raw CandDigit::GetTime() = " << dtemp << endl; 00112 if (dtemp < dtoff) { 00113 dtoff = dtemp; 00114 MSG("AlgMCDigitList", Msg::kDebug) 00115 << "Reset CandDigitList::fAbsTime to " << dtoff << endl; 00116 } 00117 00118 ch.AddDaughterLink(cdh, kFALSE); // Don't check for dups 00119 } 00120 } 00121 } 00122 00123 // Set absolute time offset in CandDigitList and subtract it from 00124 // relative time in each CandDigit of daughter list. 00125 CandDigitListHandle &cdlh = 00126 dynamic_cast<CandDigitListHandle &>(ch); 00127 cdlh.SetAbsTime(dtoff); 00128 TIter diter = ch.GetDaughterIterator(); 00129 CandDigitHandle *idau; 00130 while ((idau = (CandDigitHandle *) diter())) { 00131 idau->SetTime(idau->GetTime() - dtoff); 00132 00133 // Loop over PlexSEIdAltL entries, subtracting time offset 00134 PlexSEIdAltL &seid = idau->GetPlexSEIdAltL(); 00135 seid.SetFirst(); 00136 while (seid.IsValid()) { 00137 seid.GetCurrentItem().AddToTime(-dtoff); 00138 seid.Next(); 00139 } 00140 00141 } 00142 } 00143 else if (cx.GetDataIn()->InheritsFrom("TCollection")) { 00144 TCollection *cdl = (TCollection *) cx.GetDataIn(); 00145 TIter cdit(cdl); 00146 CandDigitHandle *cdh; 00147 while ((cdh = (CandDigitHandle *) cdit())) { 00148 ch.AddDaughterLink(*cdh, kFALSE); // Don't check for dups 00149 } 00150 } 00151 } |
|
Reimplemented from AlgBase. Definition at line 154 of file AlgMCDigitList.cxx. References c.
00155 { 00156 } |