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

AlgChopListPerfectMC Class Reference

#include <AlgChopListPerfectMC.h>

Inheritance diagram for AlgChopListPerfectMC:

AlgBase List of all members.

Public Member Functions

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

Constructor & Destructor Documentation

AlgChopListPerfectMC::AlgChopListPerfectMC  ) 
 

Definition at line 50 of file AlgChopListPerfectMC.cxx.

00051 {
00055 
00056 }

AlgChopListPerfectMC::~AlgChopListPerfectMC  )  [virtual]
 

Definition at line 59 of file AlgChopListPerfectMC.cxx.

00060 {
00061 }


Member Function Documentation

void AlgChopListPerfectMC::RunAlg AlgConfig ac,
CandHandle ch,
CandContext cx
[virtual]
 

Implements AlgBase.

Definition at line 66 of file AlgChopListPerfectMC.cxx.

References CandHandle::AddDaughterLink(), digits(), RawRecord::FindRawBlock(), Form(), AlgFactory::GetAlgHandle(), CandContext::GetCandRecord(), CandContext::GetDataIn(), VldContext::GetDetector(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), Truthifier::GetListOfNeutrinoIndecies(), CandContext::GetMom(), RecMinos::GetVldContext(), Truthifier::Instance(), Truthifier::IsDigitFromNeutrino(), CandDigitList::MakeCandidate(), MSG, CandContext::SetDataIn(), CandHandle::SetName(), and CandHandle::SetTitle().

00069 {
00073 
00074   assert(candHandle.InheritsFrom("CandChopListHandle"));
00075   CandChopListHandle &sliceList = dynamic_cast<CandChopListHandle &>(candHandle);
00076 
00077    assert(candContext.GetDataIn());
00078    // Check for CandDigitListHandle input
00079    if (!(candContext.GetDataIn()->InheritsFrom("CandDigitListHandle"))) {
00080      MSG("Chop",Msg::kWarning ) << "Data into AlgChopListPerfectMC is not a digit list." << std::endl;
00081    }
00082    
00083    const CandDigitListHandle *cdlh_ptr = 
00084      dynamic_cast<const CandDigitListHandle*>(candContext.GetDataIn());
00085    
00086    const MomNavigator *mom = candContext.GetMom();
00087    RawRecord *rr = dynamic_cast<RawRecord *>(mom->GetFragment("RawRecord"));
00088    if (!rr) {
00089      MSG("Chop", Msg::kWarning) << "No RawRecord in MOM." << endl;
00090      return;
00091    }
00092    const RawDigitDataBlock *rddb = dynamic_cast<const RawDigitDataBlock *>
00093      (rr->FindRawBlock("RawDigitDataBlock"));
00094    if (!rddb) {
00095      MSG("Chop", Msg::kWarning) << "No RawDigitDataBlock in RawRecord." << endl;
00096      return;
00097    }
00098    
00099    // Get setup for the DigitList maker algorithm
00100    AlgFactory &af = AlgFactory::GetInstance();
00101    AlgHandle ah = af.GetAlgHandle("AlgChop","default");
00102    CandContext cxx(this,candContext.GetMom());
00103 
00104    const VldContext &context = *(candContext.GetCandRecord()->GetVldContext());
00105    if(context.GetDetector() != Detector::kNear) 
00106      MSG("Chop",Msg::kError) << "Running the PerfectMC algorithm on FD data is a no-no!" << endl;
00107 
00108    //Calibrator& cal = Calibrator::Instance();
00109    UgliGeomHandle ugli(context);
00110   
00111    // Now do the actual slicing.
00112 
00113    // First, make a nice stl vector of the digits.
00114    DigitVector digits(cdlh_ptr);
00115    UInt_t ndigits = digits.size();
00116    UInt_t nslice = 0;
00117 
00118    const Truthifier& truth = Truthifier::Instance(candContext.GetMom());
00119    std::vector<Int_t> neutrinos = truth.GetListOfNeutrinoIndecies();
00120 
00121    for(UInt_t inu=0; inu < neutrinos.size(); inu++) {
00122      // For each true neutrino in the event, make a slice:
00123      DigitVector slc;
00124 
00125      // Loop through digits and put the relevant ones in.
00126      for(UInt_t idig = 0; idig<ndigits; idig++) {
00127        float frac = truth.IsDigitFromNeutrino(neutrinos[inu],digits[idig]);
00128        if(frac>0.20) // Include the digit if more than 20% of it belongs to this neutrino.
00129          slc.push_back(digits[idig]);
00130      }
00131      if(slc.size()>0) { // there was at least one digit for this neutrino:
00132        // Store the slice.
00133        cxx.SetDataIn(&(slc));
00134        CandDigitListHandle sliceHandle = CandDigitList::MakeCandidate(ah,cxx);
00135        sliceHandle.SetName(Form("Chop %d",nslice++));
00136        sliceHandle.SetTitle(Form("Neutrino %d StdHepIndex %d",inu,neutrinos[inu]));
00137        sliceList.AddDaughterLink(sliceHandle);       
00138      }
00139    }
00140 
00141 }

void AlgChopListPerfectMC::Trace const char *  c  )  const [virtual]
 

Reimplemented from AlgBase.

Definition at line 144 of file AlgChopListPerfectMC.cxx.

00145 {
00146 }


The documentation for this class was generated from the following files:
Generated on Sat Mar 14 22:43:25 2009 for loon by doxygen 1.3.5