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

Detailed Description

Definition at line 15 of file AlgChopListPerfectMC.h.


Constructor & Destructor Documentation

AlgChopListPerfectMC::AlgChopListPerfectMC (  ) 

A perfect slicer, that cheats by looking at MC truth info

Definition at line 51 of file AlgChopListPerfectMC.cxx.

00052 {
00056 
00057 }

AlgChopListPerfectMC::~AlgChopListPerfectMC (  )  [virtual]

Definition at line 60 of file AlgChopListPerfectMC.cxx.

00061 {
00062 }


Member Function Documentation

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

A perfect slicer, that cheats by looking at MC truth info

Implements AlgBase.

Definition at line 67 of file AlgChopListPerfectMC.cxx.

References digits(), Form(), AlgFactory::GetAlgHandle(), CandContext::GetCandRecord(), CandContext::GetDataIn(), AlgFactory::GetInstance(), Truthifier::GetListOfNeutrinoIndecies(), CandContext::GetMom(), RecMinos::GetVldContext(), Truthifier::Instance(), Truthifier::IsDigitFromNeutrino(), Msg::kError, Detector::kNear, Msg::kWarning, CandDigitList::MakeCandidate(), MSG, CandHandle::SetName(), and CandHandle::SetTitle().

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

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

Reimplemented from AlgBase.

Definition at line 139 of file AlgChopListPerfectMC.cxx.

00140 {
00141 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1