Anp::SelectReson Class Reference

#include <SelectReson.h>

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

List of all members.

Public Member Functions

 SelectReson ()
virtual ~SelectReson ()
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 Types

typedef std::pair< double, double > PassFail
typedef std::map< std::string,
PassFail
CountMap

Private Member Functions

void Print (std::ostream &os=std::cout) const
void Count (const std::string &key, bool pass, double weight)

Private Attributes

int fPidKey
double fPidCut
std::map< std::string, PassFailfCountMap

Detailed Description

Definition at line 21 of file SelectReson.h.


Member Typedef Documentation

typedef std::map<std::string, PassFail> Anp::SelectReson::CountMap [private]

Definition at line 41 of file SelectReson.h.

typedef std::pair<double,double> Anp::SelectReson::PassFail [private]

Definition at line 40 of file SelectReson.h.


Constructor & Destructor Documentation

Anp::SelectReson::SelectReson (  ) 

Definition at line 29 of file SelectReson.cxx.

00030    :fPidKey(4280),
00031     fPidCut(0.3)
00032 {
00033 }

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

Definition at line 36 of file SelectReson.cxx.

00037 {
00038 }


Member Function Documentation

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

Reimplemented from Anp::AlgEvent.

Definition at line 123 of file SelectReson.cxx.

References fPidCut, fPidKey, Registry::Get(), and Registry::KeyExists().

00124 {
00125    //
00126    // Configure self
00127    //
00128 
00129    reg.Get("SelectResonPidKey", fPidKey);
00130    reg.Get("SelectResonPidCut", fPidCut);
00131 
00132    if(reg.KeyExists("PrintConfig"))
00133    {
00134       cout << "SelectReson::Config" << endl
00135            << "   PidKey = " << fPidKey << endl
00136            << "   PidCut = " << fPidCut << endl;      
00137    }
00138 }

void Anp::SelectReson::Count ( const std::string &  key,
bool  pass,
double  weight 
) [private]

Referenced by Run().

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

Reimplemented from Anp::AlgEvent.

Definition at line 146 of file SelectReson.cxx.

References Print().

00147 {
00148    Print();
00149 }

void Anp::SelectReson::Print ( std::ostream &  os = std::cout  )  const [private]

Referenced by End().

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

Implements Anp::AlgEvent.

Definition at line 64 of file SelectReson.cxx.

References Count(), Anp::Record::FindTruth(), fPidCut, fPidKey, Anp::Record::GetHeader(), Anp::Event::GetNTracks(), Anp::GetTrack(), Anp::Header::IsData(), it, Anp::Track::KeyExists(), Anp::Track::Pass(), Anp::Record::TruthBeg(), and Anp::Record::TruthEnd().

00065 {
00066    //
00067    // Select charged current \nu_{\mu} resonance interactions
00068    //
00069    if(!pass) return true;
00070 
00071    if(record.GetHeader().IsData() || record.TruthBeg() == record.TruthEnd())
00072    {
00073       return true;
00074    }
00075 
00076    TruthIter itruth = record.FindTruth(event);
00077    if(itruth == record.TruthEnd())
00078    {
00079       cerr << "SelectReson::Run - failed to find Truth record" << endl;
00080       return false;
00081    }
00082    
00083    string reson;
00084    
00085    if     (itruth -> Resonance() == 1001) reson = "QES";
00086    else if(itruth -> Resonance() == 1002) reson = "RES";
00087    else if(itruth -> Resonance() == 1003) reson = "DIS";
00088    else return true;
00089 
00090    Count(reson, event.GetNTracks() == 2, 1.0);
00091    
00092    const TrackVec tvec = Anp::GetTrack(event, record);
00093 
00094    assert(int(tvec.size()) == event.GetNTracks());
00095 
00096    if(tvec.size() != 2)
00097    {      
00098       return true;
00099    }
00100 
00101    bool good = true;
00102    for(TrackVec::const_iterator it = tvec.begin(); it != tvec.end(); ++it)
00103    {
00104       const Track &track = *(*it);
00105 
00106       if(!track.Pass())
00107       {
00108          good = false;
00109       }
00110 
00111       if(!track.KeyExists(fPidKey) || track[fPidKey] < fPidCut)
00112       {
00113          good = false;
00114       }
00115    }
00116    
00117    Count(reson + " good 2-track", good, 1.0);
00118 
00119    return true;
00120 }

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

Implements Anp::AlgSnarl.

Definition at line 41 of file SelectReson.cxx.

References Anp::Record::Erase(), Anp::Record::EventBegIterator(), and Anp::Record::EventEndIterator().

00042 {
00043    //
00044    // Run over all events and erase events that fail CC \nu_{\mu} selection
00045    //
00046 
00047    EventIterator ievent = record.EventBegIterator();   
00048    while(ievent != record.EventEndIterator())
00049    {
00050       if(!Run(*ievent, record, true))
00051       {
00052          ievent = record.Erase(ievent);
00053       }
00054       else
00055       {
00056          ++ievent;
00057       }
00058    }
00059 
00060    return true;
00061 }

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

Reimplemented from Anp::AlgEvent.

Definition at line 141 of file SelectReson.cxx.

00142 {
00143 }


Member Data Documentation

std::map<std::string, PassFail> Anp::SelectReson::fCountMap [private]

Definition at line 53 of file SelectReson.h.

double Anp::SelectReson::fPidCut [private]

Definition at line 51 of file SelectReson.h.

Referenced by Config(), and Run().

Definition at line 50 of file SelectReson.h.

Referenced by Config(), and Run().


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

Generated on 16 Jan 2018 for loon by  doxygen 1.6.1