Anp::SelectNC Class Reference

#include <SelectNC.h>

Inheritance diagram for Anp::SelectNC:
Anp::AlgEvent Anp::AlgSnarl Anp::Base Anp::Base

List of all members.

Public Member Functions

 SelectNC ()
virtual ~SelectNC ()
bool Run (Record &record)
bool Run (Event &event, const Record &record, bool pass)
void Config (const Registry &reg)
void Set (TDirectory *dir)
void End (const DataBlock &block)

Private Attributes

std::string fDirName
Handle< AlgEventfCount
bool fErase
bool fPrint
int fPidKey
int fNearTKey
int fPlaneKey
int fSpanTKey
int fNShower
double fPidCut
double fNearTCut
double fPlaneCut
double fSpanTCut

Detailed Description

Definition at line 15 of file SelectNC.h.


Constructor & Destructor Documentation

Anp::SelectNC::SelectNC (  ) 

Definition at line 28 of file SelectNC.cxx.

00029    :fDirName(""),
00030     fCount(new SelectCount()),
00031     fErase(true),
00032     fPrint(false),
00033     fPidKey(4280),
00034     fNearTKey(41),
00035     fPlaneKey(4935),
00036     fSpanTKey(4931),
00037     fNShower(1),
00038     fPidCut(0.3),
00039     fNearTCut(50.0),
00040     fPlaneCut(2.5),
00041     fSpanTCut(200.0)
00042 {
00043 }

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

Definition at line 46 of file SelectNC.cxx.

00047 {
00048 }


Member Function Documentation

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

Reimplemented from Anp::AlgEvent.

Definition at line 177 of file SelectNC.cxx.

References fDirName, fErase, fNearTCut, fNearTKey, fNShower, fPidCut, fPidKey, fPlaneCut, fPlaneKey, fPrint, fSpanTCut, fSpanTKey, Registry::Get(), Registry::KeyExists(), and Anp::Read().

00178 {
00179    //
00180    // Configure self
00181    //
00182 
00183    const char *value_char = 0;
00184    if(reg.Get("SelectNCDirName", value_char) && value_char)
00185    {
00186       fDirName = value_char;
00187    }
00188   
00189    Anp::Read(reg, "SelectNCErase", fErase);
00190    Anp::Read(reg, "SelectNCPrint", fPrint);
00191 
00192    reg.Get("SelectNCPidKey",   fPidKey);
00193    reg.Get("SelectNCNearTKey", fNearTKey);
00194    reg.Get("SelectNCPlaneKey", fPlaneKey);
00195    reg.Get("SelectNCSpanTKey", fSpanTKey);
00196    reg.Get("SelectNCNShower",  fNShower);
00197    reg.Get("SelectNCPidCut",   fPidCut);
00198    reg.Get("SelectNCNearTCut", fNearTCut);
00199    reg.Get("SelectNCPlaneCut", fPlaneCut);
00200    reg.Get("SelectNCSpanTCut", fSpanTCut);
00201 
00202    if(reg.KeyExists("PrintConfig"))
00203    {
00204       cout << "SelectNC::Config" << endl
00205            << "   DirName = " << fDirName << endl
00206            << "   Erase = " << fErase << endl
00207            << "   Print = " << fPrint << endl
00208            << "   PidKey = " << fPidKey << endl
00209            << "   NearTKey = " << fNearTKey << endl
00210            << "   PlaneKey = " << fPlaneKey << endl
00211            << "   SpanTKey = " << fSpanTKey << endl
00212            << "   NShower = " << fNShower << endl
00213            << "   PidCut = " << fPidCut << endl
00214            << "   NearTCut = " << fNearTCut << endl
00215            << "   PlaneCut = " << fPlaneCut << endl
00216            << "   SpanTCut = " << fSpanTCut << endl;
00217    }
00218 }

void Anp::SelectNC::End ( const DataBlock block  )  [virtual]

Reimplemented from Anp::AlgEvent.

Definition at line 232 of file SelectNC.cxx.

References fCount.

00233 {
00234    fCount -> End(block);
00235 }

bool Anp::SelectNC::Run ( Event event,
const Record record,
bool  pass 
) [virtual]

Implements Anp::AlgEvent.

Definition at line 79 of file SelectNC.cxx.

References Anp::Event::DataAt(), fCount, fNearTCut, fNearTKey, fNShower, fPidCut, fPidKey, fPlaneCut, fPlaneKey, fSpanTCut, fSpanTKey, Anp::Event::GetNShowers(), Anp::Event::KeyExists(), Anp::LongestTrack(), Anp::Event::MatchShower(), Run(), Anp::Record::ShowerBeg(), Anp::Record::ShowerEnd(), and Anp::Record::TrackEnd().

00080 {
00081    //
00082    // Select neutral current $\nu$ interactions
00083    //
00084    if(!pass) return true; 
00085 
00086    const TrackIter itrack = Anp::LongestTrack(event, record);
00087    if(itrack == record.TrackEnd())
00088    {
00089       fCount -> Run(event, record, true);
00090    }
00091    else
00092    {
00093       if(!(itrack -> KeyExists(fPidKey)) || !(itrack -> DataAt(fPidKey) > fPidCut))
00094       {
00095          fCount -> Run(event, record, true);
00096       }
00097       else
00098       {
00099          fCount -> Run(event, record, false);
00100          return false;
00101       }
00102    }
00103 
00104    if(fNearTKey > 0)
00105    {
00106       if(!(event.KeyExists(fNearTKey)) || !(event.DataAt(fNearTKey) > fNearTCut))
00107       {
00108          fCount -> Run(event, record, false);
00109          return false;
00110       }
00111       else
00112       {
00113          fCount -> Run(event, record, true);
00114       }
00115    }
00116 
00117    if(fPlaneKey > 0)
00118    {
00119       if(!(event.KeyExists(fPlaneKey)) || !(event.DataAt(fPlaneKey) > fPlaneCut))
00120       {
00121          fCount -> Run(event, record, false);
00122          return false;
00123       }
00124       else
00125       {
00126          fCount -> Run(event, record, true);
00127       }
00128    }
00129 
00130    if(fSpanTKey > 0)
00131    {
00132       if(!(event.KeyExists(fSpanTKey)) || !(event.DataAt(fSpanTKey) < fSpanTCut))
00133       {
00134          fCount -> Run(event, record, false);
00135          return false;
00136       }
00137       else
00138       {
00139          fCount -> Run(event, record, true);
00140       }
00141    }
00142 
00143    if(fNShower > 0)
00144    {
00145       if(event.GetNShowers() < fNShower)
00146       {
00147          fCount -> Run(event, record, false);
00148          return false;
00149       }
00150       else
00151       {
00152          fCount -> Run(event, record, true);
00153       }
00154    }
00155 
00156    double ehad = 0.0, plep = 0.0;
00157    for(ShowerIter ishower = record.ShowerBeg(); ishower != record.ShowerEnd(); ++ishower)
00158    {
00159       if(event.MatchShower(ishower -> ShowerIndex()))
00160       {
00161          ehad += ishower -> EnergyCC();
00162       }
00163    }
00164 
00165    if(itrack != record.TrackEnd())
00166    {
00167       plep = itrack -> PRan();
00168    }
00169    
00170    event.GetRecoNu().SetEHad(ehad);
00171    event.GetRecoNu().SetPLep(plep);
00172 
00173    return true;
00174 }

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

Implements Anp::AlgSnarl.

Definition at line 51 of file SelectNC.cxx.

References Anp::CleanRecord(), Anp::Record::Erase(), Anp::Record::EventBeg(), Anp::Record::EventBegIterator(), Anp::Record::EventEnd(), Anp::Record::EventEndIterator(), and fErase.

Referenced by Run().

00052 {
00053    //
00054    // Run over all events and erase events that fail CC \nu_{\mu} selection
00055    //
00056 
00057    EventIterator ievent = record.EventBegIterator();   
00058    while(ievent != record.EventEndIterator())
00059    {
00060       if(!SelectNC::Run(*ievent, record, true) && fErase)
00061       {
00062          ievent = record.Erase(ievent);
00063       }
00064       else
00065       {
00066          ++ievent;
00067       }
00068    }
00069 
00070    //
00071    // Remove tracks and records that do not match selected events
00072    //
00073    if(fErase) Anp::CleanRecord(record.EventBeg(), record.EventEnd(), record);
00074 
00075    return true;
00076 }

void Anp::SelectNC::Set ( TDirectory *  dir  )  [virtual]

Reimplemented from Anp::AlgEvent.

Definition at line 221 of file SelectNC.cxx.

References fCount, fDirName, and Anp::GetDir().

00222 {
00223    if(!dir)
00224    {
00225       return;
00226    }
00227    
00228    fCount -> Set(Anp::GetDir(fDirName, dir));
00229 }


Member Data Documentation

Reimplemented from Anp::Base.

Definition at line 36 of file SelectNC.h.

Referenced by End(), Run(), and Set().

std::string Anp::SelectNC::fDirName [private]

Definition at line 34 of file SelectNC.h.

Referenced by Config(), and Set().

bool Anp::SelectNC::fErase [private]

Definition at line 38 of file SelectNC.h.

Referenced by Config(), and Run().

double Anp::SelectNC::fNearTCut [private]

Definition at line 48 of file SelectNC.h.

Referenced by Config(), and Run().

int Anp::SelectNC::fNearTKey [private]

Definition at line 42 of file SelectNC.h.

Referenced by Config(), and Run().

int Anp::SelectNC::fNShower [private]

Definition at line 45 of file SelectNC.h.

Referenced by Config(), and Run().

double Anp::SelectNC::fPidCut [private]

Definition at line 47 of file SelectNC.h.

Referenced by Config(), and Run().

int Anp::SelectNC::fPidKey [private]

Definition at line 41 of file SelectNC.h.

Referenced by Config(), and Run().

double Anp::SelectNC::fPlaneCut [private]

Definition at line 49 of file SelectNC.h.

Referenced by Config(), and Run().

int Anp::SelectNC::fPlaneKey [private]

Definition at line 43 of file SelectNC.h.

Referenced by Config(), and Run().

bool Anp::SelectNC::fPrint [private]

Definition at line 39 of file SelectNC.h.

Referenced by Config().

double Anp::SelectNC::fSpanTCut [private]

Definition at line 50 of file SelectNC.h.

Referenced by Config(), and Run().

int Anp::SelectNC::fSpanTKey [private]

Definition at line 44 of file SelectNC.h.

Referenced by Config(), and Run().


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

Generated on 25 Apr 2018 for loon by  doxygen 1.6.1