Anp::FillEnergy Class Reference

#include <FillEnergy.h>

Inheritance diagram for Anp::FillEnergy:
Anp::AlgSnarl Anp::Base

List of all members.

Public Member Functions

 FillEnergy ()
virtual ~FillEnergy ()
bool Run (Record &record)
void Config (const Registry &reg)

Private Member Functions

const VldContext GetVldc (const Header &header) const

Detailed Description

Definition at line 16 of file FillEnergy.h.


Constructor & Destructor Documentation

Anp::FillEnergy::FillEnergy (  ) 

Definition at line 22 of file FillEnergy.cxx.

00023 {
00024 }

Anp::FillEnergy::~FillEnergy (  )  [virtual]

Definition at line 27 of file FillEnergy.cxx.

00028 {
00029 }


Member Function Documentation

void Anp::FillEnergy::Config ( const Registry reg  )  [virtual]

Reimplemented from Anp::AlgSnarl.

Definition at line 100 of file FillEnergy.cxx.

00101 {
00102 }

const VldContext Anp::FillEnergy::GetVldc ( const Header header  )  const [private]

Definition at line 105 of file FillEnergy.cxx.

References Anp::Header::IsData(), Anp::Header::IsFar(), Anp::Header::IsNear(), SimFlag::kData, Detector::kFar, SimFlag::kMC, Detector::kNear, SimFlag::kUnknown, Detector::kUnknown, Anp::Header::NSec(), and Anp::Header::Sec().

Referenced by Run().

00106 {
00107    //
00108    // Convert header to VldContext, should make it a global utility function...
00109    //
00110 
00111    const VldTimeStamp time(header.Sec(), header.NSec());
00112    if(header.IsData())
00113    {
00114       if(header.IsNear())
00115       {
00116          return VldContext(Detector::kNear, SimFlag::kData, time);
00117       }
00118       else if(header.IsFar())
00119       {
00120          return VldContext(Detector::kFar, SimFlag::kData, time);
00121       }
00122    }
00123    else
00124    {
00125       if(header.IsNear())
00126       {
00127          return VldContext(Detector::kNear, SimFlag::kMC, time);
00128       }
00129       else if(header.IsFar())
00130       {
00131          return VldContext(Detector::kFar, SimFlag::kMC, time);
00132       }
00133    }
00134 
00135    return VldContext(Detector::kUnknown, SimFlag::kUnknown, time);
00136 }

bool Anp::FillEnergy::Run ( Record record  )  [virtual]

Implements Anp::AlgSnarl.

Definition at line 32 of file FillEnergy.cxx.

References Anp::Record::EventBegIterator(), Anp::Record::EventEndIterator(), EnergyCorrections::FullyCorrectShowerEnergy(), Anp::Record::GetHeader(), GetVldc(), CandShowerHandle::kCC, Anp::LongestTrack(), Anp::Header::Release(), Anp::RecoNu::SetEHad(), Anp::Record::ShowerBeg(), Anp::Record::ShowerBegIterator(), Anp::Record::ShowerEnd(), Anp::Record::ShowerEndIterator(), and Anp::Record::TrackEnd().

00033 {
00034    //
00035    // Make VldContext
00036    //
00037    const VldContext vldc = GetVldc(record.GetHeader());
00038 
00039    //
00040    // Correct shower energy using latest energy correction function
00041    //
00042    for(ShowerIterator sit = record.ShowerBegIterator(); sit != record.ShowerEndIterator(); ++sit)
00043    {
00044       sit -> SetEnergyCC(FullyCorrectShowerEnergy(sit -> EnergyCC(),
00045                                                   CandShowerHandle::kCC,
00046                                                   vldc,
00047                                                   record.GetHeader().Release()));
00048    }
00049 
00050    //
00051    // Apply latest energy corrections to event's hadronic energy
00052    //
00053    for(EventIterator ievent = record.EventBegIterator(); ievent != record.EventEndIterator(); ++ievent)
00054    {
00055       //
00056       // Event has no showers
00057       //
00058       if(ievent -> GetNShowers() < 1) continue;
00059 
00060       //
00061       // Find longest track
00062       //
00063       TrackIter itrack = LongestTrack(*ievent, record);
00064 
00065       double ehad = 0.0;
00066       for(ShowerIter ishower = record.ShowerBeg(); ishower != record.ShowerEnd(); ++ishower)
00067       {
00068          if(!(ievent -> MatchShower(ishower -> ShowerIndex())))
00069          {
00070             continue;
00071          }
00072 
00073          const float deltaz = ishower -> GetVtx().Z() - ievent -> GetVtx().Z();
00074             
00075          //
00076          // !!!hard coded constants!!!
00077          //
00078          if(itrack == record.TrackEnd())
00079          {
00080             ehad += ishower -> EnergyCC();
00081          }
00082          else if(std::fabs(deltaz) < 0.5 || ishower -> EnergyCC() > 2.0)
00083          {
00084             ehad += ishower -> EnergyCC();
00085          }
00086       }
00087 
00088       //
00089       // Set corrected hadronic energy
00090       //
00091       RecoNu rnu = ievent -> GetNu();
00092       rnu.SetEHad(ehad);
00093       ievent -> SetNu(rnu);
00094    }
00095 
00096    return true;
00097 }


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

Generated on 17 Jun 2018 for loon by  doxygen 1.6.1