AlgCaldetDigitList Class Reference

#include <AlgCaldetDigitList.h>

Inheritance diagram for AlgCaldetDigitList:
AlgBase

List of all members.

Public Member Functions

 AlgCaldetDigitList ()
virtual ~AlgCaldetDigitList ()
virtual void RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx)
virtual void Trace (const char *c) const

Detailed Description

Definition at line 16 of file AlgCaldetDigitList.h.


Constructor & Destructor Documentation

AlgCaldetDigitList::AlgCaldetDigitList (  ) 

Definition at line 41 of file AlgCaldetDigitList.cxx.

00042 {
00043 }

AlgCaldetDigitList::~AlgCaldetDigitList (  )  [virtual]

Definition at line 46 of file AlgCaldetDigitList.cxx.

00047 {
00048 }


Member Function Documentation

void AlgCaldetDigitList::RunAlg ( AlgConfig ac,
CandHandle ch,
CandContext cx 
) [virtual]

Implements AlgBase.

Definition at line 51 of file AlgCaldetDigitList.cxx.

References CandHandle::AddDaughterLink(), CaldetRawDigitWrapper::fDigit, CaldetRawDigitWrapper::fFiducialDigit, Registry::Get(), AlgFactory::GetAlgHandle(), CandContext::GetCandRecord(), RawDigit::GetChannel(), CandContext::GetDataIn(), RawDigitDataBlock::GetDatumIter(), AlgFactory::GetInstance(), CandContext::GetMom(), RawDigitDataBlock::GetNSparsModeCrates(), RawDigitDataBlock::GetNumberOfCrates(), RawDigitDataBlock::GetNumberOfDigits(), RawRecord::GetRawBlockIter(), PlexHandle::GetReadoutType(), RecMinos::GetVldContext(), Msg::kInfo, ReadoutType::kTimingFid, CandDigit::MakeCandidate(), MSG, Munits::nanosecond, CandDigitListHandle::SetAbsTime(), CandDigitListHandle::SetIsSparse(), and CandDigitHandle::SetRawDigitIndex().

00053 {
00054    assert(cx.GetDataIn());
00055    
00056    // Get VldContext
00057    const VldContext &vldc = *(cx.GetCandRecord()->GetVldContext());
00058    
00059    // Iterate over RawDigitDataBlock or CandDigitList daughters.
00060    if (cx.GetDataIn()->InheritsFrom("RawRecord")) {
00061      
00062      PlexHandle ph(vldc);
00063      
00064      // Set up to iterate over input RawDigit's to fill output CandDigitList.
00065      
00066      // Get Singleton instance of AlgFactory.
00067      AlgFactory &af = AlgFactory::GetInstance();
00068      
00069      // Get correct Algorithm by name from AlgFactory
00070      const char *tmpcs = 0;
00071      const char *digitalgorithm = 0;
00072      const char *digitalgconfig = 0;
00073 
00074      if (ac.Get("DigitAlgorithm", tmpcs)) digitalgorithm = tmpcs;
00075      if (ac.Get("DigitAlgConfig", tmpcs)) digitalgconfig = tmpcs;
00076 
00077      // Get an AlgHandle to an Algorithm with requested AlgConfig.
00078      AlgHandle ah = af.GetAlgHandle(digitalgorithm, digitalgconfig);
00079 
00080      CandContext cxx(this, cx.GetMom());
00081 
00082      // Set CandRecord pointer in CandContext.
00083      cxx.SetCandRecord(cx.GetCandRecord());
00084 
00085      Bool_t isSparse = true;              // sparsified unless otherwise
00086 
00087      // Iterate over RawRecord's RawDataBlockList to find RawDigitDataBlock.
00088      RawRecord *rr = (RawRecord *) (cx.GetDataIn());
00089      TIter rdbit = rr->GetRawBlockIter();
00090      TObject *tob;
00091      while ((tob = rdbit())) {
00092        if (tob->InheritsFrom("RawDigitDataBlock")) {
00093          RawDigitDataBlock *rdb = (RawDigitDataBlock *) tob;
00094          TIter rdit = rdb->GetDatumIter();
00095          RawDigit *rd;
00096          Int_t rawdigitindex = -1;
00097 
00098          Int_t ndigits = rdb->GetNumberOfDigits();
00099          Bool_t blkIsSparse = 
00100             ( rdb->GetNumberOfCrates() == rdb->GetNSparsModeCrates());
00101          isSparse &= blkIsSparse;
00102          if (!blkIsSparse) 
00103            MSG("AlgCaldetDigitList", Msg::kInfo) 
00104          << "AlgCaldetDigitList finds RawDigitDataBlock is Unsparsified with " 
00105                                << ndigits << " digits " << endl << endl;
00106 
00107 
00108          // This object will contain our data.
00109          CaldetRawDigitWrapper wrapper;
00110 
00111          // Loop through, looking for a timing fiducial hit.
00112          rdit.Reset();   
00113          rawdigitindex = -1;
00114          while ((rd = (RawDigit *) rdit())) { 
00115            ++rawdigitindex;
00116            
00117            if (ph.GetReadoutType(rd->GetChannel()) == ReadoutType::kTimingFid) {
00118              wrapper.fFiducialDigit = rd;
00119            }
00120          }
00121 
00122          if(wrapper.fFiducialDigit==0) {
00123            MSG("AlgCaldetDigitList",Msg::kInfo)
00124              << "Event has no fiducial digit." << endl;
00125          }
00126 
00127          // Loop through again, getting the actual hits we want.
00128          // skip all non-scint readouts
00129          rdit.Reset();   
00130          rawdigitindex = -1;
00131          while ((rd = (RawDigit *) rdit())) { 
00132            ++rawdigitindex;
00133            
00134            // Make canddigits out of everything.
00135            //if (ph.GetReadoutType(rd->GetChannel()) != 
00136            //    ReadoutType::kScintStrip) continue;
00137 
00138            wrapper.fDigit = rd;
00139 
00140            cxx.SetDataIn(&wrapper);
00141            CandDigitHandle cdh = CandDigit::MakeCandidate(ah, cxx);
00142            cdh.SetRawDigitIndex(rawdigitindex);
00143 
00144            ch.AddDaughterLink(cdh, kFALSE);      // Don't check for dups
00145          }
00146        }
00147      }
00148 
00149      // Set absolute time offset in CandDigitList.
00150      // It's no longer subtracted from CandDigits in AlgDigit.
00151      CandDigitListHandle &cdlh =
00152        dynamic_cast<CandDigitListHandle &>(ch);
00153      cdlh.SetAbsTime(((Double_t) vldc.GetTimeStamp().GetNanoSec()) *
00154                      Munits::nanosecond);
00155      
00156      // Set CandDigitList sparsification flag.
00157      cdlh.SetIsSparse(isSparse);
00158    }
00159    
00160    else if (cx.GetDataIn()->InheritsFrom("TCollection")) {
00161      TCollection *cdl = (TCollection *) cx.GetDataIn();
00162      TIter cdit(cdl);
00163      CandDigitHandle *cdh;
00164      while ((cdh = (CandDigitHandle *) cdit())) {
00165        ch.AddDaughterLink(*cdh, kFALSE);         // Don't check for dups
00166      }
00167    }
00168 }

void AlgCaldetDigitList::Trace ( const char *  c  )  const [virtual]

Reimplemented from AlgBase.

Definition at line 171 of file AlgCaldetDigitList.cxx.

00172 {
00173 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1