#include <AlgMCDigitList.h>
Inheritance diagram for AlgMCDigitList:

Public Member Functions | |
| AlgMCDigitList () | |
| virtual | ~AlgMCDigitList () |
| virtual void | RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx) |
| virtual void | Trace (const char *c) const |
|
|
Definition at line 39 of file AlgMCDigitList.cxx. 00040 {
00041 }
|
|
|
Definition at line 44 of file AlgMCDigitList.cxx. 00045 {
00046 }
|
|
||||||||||||||||
|
Implements AlgBase. Definition at line 49 of file AlgMCDigitList.cxx. References CandHandle::AddDaughterLink(), Registry::Get(), AlgFactory::GetAlgHandle(), CandContext::GetCandRecord(), CandContext::GetDataIn(), RawDigitDataBlock::GetDatumIter(), AlgFactory::GetInstance(), CandContext::GetMom(), VldTimeStamp::GetNanoSec(), RawRecord::GetRawBlockIter(), VldContext::GetTimeStamp(), RecMinos::GetVldContext(), CandDigit::MakeCandidate(), MSG, CandDigitListHandle::SetAbsTime(), and CandDigitHandle::SetRawDigitIndex(). 00051 {
00052 MSG("AlgMCDigitList", Msg::kDebug)
00053 << "Starting AlgMCDigitList::RunAlg()" << endl;
00054
00055 assert(cx.GetDataIn());
00056
00057 // Get VldContext
00058 const VldContext &vldc = *(cx.GetCandRecord()->GetVldContext());
00059
00060 // Iterate over RawDigitDataBlock or CandDigitList daughters.
00061 if (cx.GetDataIn()->InheritsFrom("RawRecord")) {
00062
00063 // Set up to iterate over input RawDigit's to fill output CandDigitList.
00064
00065 // Get Singleton instance of AlgFactory.
00066 MSG("AlgMCDigitList", Msg::kDebug)
00067 << "AlgFactory &af = AlgFactory::GetInstance();" << endl;
00068 AlgFactory &af = AlgFactory::GetInstance();
00069
00070 // Get correct Algorithm by name from AlgFactory
00071 const char *tmpcs = 0;
00072 const char *mcdigitalgorithm = 0;
00073 const char *mcdigitalgconfig = 0;
00074
00075 if (ac.Get("MCDigitAlgorithm", tmpcs)) mcdigitalgorithm = tmpcs;
00076 if (ac.Get("MCDigitAlgConfig", tmpcs)) mcdigitalgconfig = tmpcs;
00077
00078 // Get an AlgHandle to an Algorithm with requested AlgConfig.
00079 MSG("AlgMCDigitList", Msg::kDebug)
00080 << "AlgHandle ah = af.GetAlgHandle("
00081 << mcdigitalgorithm << ", "
00082 << mcdigitalgconfig << ");" << endl;
00083 AlgHandle ah = af.GetAlgHandle(mcdigitalgorithm, mcdigitalgconfig);
00084
00085 MSG("AlgMCDigitList", Msg::kDebug)
00086 << "Create CandContext instance." << endl
00087 << "CandContext cxx(this);" << endl;
00088 CandContext cxx(this, cx.GetMom());
00089
00090 // Set CandRecord pointer in CandContext.
00091 MSG("AlgMCDigitList", Msg::kDebug)
00092 << "Set CandRecord pointer in CandContext." << endl;
00093 cxx.SetCandRecord(cx.GetCandRecord());
00094
00095 // Iterate over RawRecord's RawDataBlockList to find RawDigitDataBlock.
00096 RawRecord *rr = (RawRecord *) (cx.GetDataIn());
00097 TIter rdbit = rr->GetRawBlockIter();
00098 TObject *tob;
00099 while ((tob = rdbit())) {
00100 if (tob->InheritsFrom("RawDigitDataBlock")) {
00101 RawDigitDataBlock *rdb = (RawDigitDataBlock *) tob;
00102 TIter rdit = rdb->GetDatumIter();
00103 RawDigit *rd;
00104 Int_t rawdigitindex = -1;
00105 while ((rd = (RawDigit *) rdit())) {
00106 ++rawdigitindex;
00107
00108 MSG("AlgMCDigitList", Msg::kDebug)
00109 << "Set RawDigit object as CandContext input data." << endl
00110 << "cxx.SetDataIn(rd);" << endl;
00111 cxx.SetDataIn(rd);
00112
00113 MSG("AlgMCDigitList", Msg::kDebug)
00114 << "Get handle to CandDigit." << endl
00115 << "cdh = CandDigit::MakeCandidate(ah, cxx);" << endl;
00116
00117 CandDigitHandle cdh = CandDigit::MakeCandidate(ah, cxx);
00118 cdh.SetRawDigitIndex(rawdigitindex);
00119
00120 ch.AddDaughterLink(cdh, kFALSE); // Don't check for dups
00121 }
00122 }
00123 }
00124
00125 // Set absolute time offset in CandDigitList.
00126 // It's no longer subtracted from CandDigits in AlgDigit.
00127 CandDigitListHandle &cdlh =
00128 dynamic_cast<CandDigitListHandle &>(ch);
00129 cdlh.SetAbsTime(((Double_t) vldc.GetTimeStamp().GetNanoSec()) *
00130 Munits::nanosecond);
00131 }
00132
00133 else if (cx.GetDataIn()->InheritsFrom("TCollection")) {
00134 TCollection *cdl = (TCollection *) cx.GetDataIn();
00135 TIter cdit(cdl);
00136 CandDigitHandle *cdh;
00137 while ((cdh = (CandDigitHandle *) cdit())) {
00138 ch.AddDaughterLink(*cdh, kFALSE); // Don't check for dups
00139 }
00140 }
00141 }
|
|
|
Reimplemented from AlgBase. Definition at line 144 of file AlgMCDigitList.cxx. 00145 {
00146 }
|
1.3.9.1