Anp::SelectAntiNeutrino Class Reference

#include <SelectAntiNeutrino.h>

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

List of all members.

Public Member Functions

 SelectAntiNeutrino ()
virtual ~SelectAntiNeutrino ()
bool Run (Record &record)
bool Run (Event &event, const Record &record, bool pass)
void Config (const Registry &reg)
void End (const DataBlock &block)

Private Member Functions

bool Run1 (Event &event, const Record &record, bool pass)
bool Run2 (Event &event, const Record &record, bool pass)
void AddData (Event &event, const Track &track)

Private Attributes

Handle< AlgEventfCount
bool fAddData
bool fErase
int fAddKey
int fAngKey
int fPidKey
int fSelKey
int fSelect
double fPidCut

Detailed Description

Definition at line 23 of file SelectAntiNeutrino.h.


Constructor & Destructor Documentation

Anp::SelectAntiNeutrino::SelectAntiNeutrino (  ) 

Definition at line 31 of file SelectAntiNeutrino.cxx.

00032    :fCount(new SelectCount()),
00033     fAddData(false),
00034     fErase(false),
00035     fAddKey(5530),
00036     fAngKey(108),
00037     fPidKey(4280),
00038     fSelKey(5524),
00039     fSelect(1),
00040     fPidCut(0.5)
00041 {
00042 }

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

Definition at line 45 of file SelectAntiNeutrino.cxx.

00046 {
00047 }


Member Function Documentation

void Anp::SelectAntiNeutrino::AddData ( Event event,
const Track track 
) [private]

Definition at line 342 of file SelectAntiNeutrino.cxx.

References Anp::Track::Chi2(), Anp::Track::DataAt(), Anp::Track::ErrorQP(), fAddKey, fAngKey, Anp::Track::GetBasic(), Anp::Track::KeyExists(), Anp::Event::KeyExists(), Anp::Track::Ndof(), Anp::Basic::NPlane(), Anp::Track::PassFit(), and Anp::Track::QP().

Referenced by Run1(), and Run2().

00343 {   
00344    //
00345    // check that track passed fitter algorithm
00346    //
00347    if(track.PassFit())
00348    {
00349       event.Add(fAddKey + 0, 1.0);
00350    }
00351 
00352    //
00353    // select mu- tracks and tracks with small error on the fit momentum
00354    //
00355    if(track.ErrorQP() > 0.0)
00356    {
00357       event.Add(fAddKey + 1, track.QP()/track.ErrorQP());
00358    }
00359      
00360    //
00361    // select tracks that are at least 40 steel planes long
00362    //
00363    event.Add(fAddKey + 2, track.GetBasic().NPlane());
00364 
00365    //
00366    // cut on directional charge id
00367    //
00368    if(track.KeyExists(fAngKey))
00369    {
00370       event.Add(fAddKey + 3, track.DataAt(fAngKey));
00371 
00372       if(!event.KeyExists(fAngKey))
00373       {
00374          event.Add(fAngKey, track.DataAt(fAngKey));
00375       }
00376    }
00377      
00378    //
00379    // cut on fit probability
00380    //
00381    event.Add(fAddKey + 4, TMath::Prob(track.Chi2(), int(track.Ndof())));
00382 }

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

Reimplemented from Anp::AlgEvent.

Definition at line 307 of file SelectAntiNeutrino.cxx.

References fAddData, fAddKey, fAngKey, fCount, fErase, fPidCut, fPidKey, fSelect, fSelKey, Registry::Get(), Registry::KeyExists(), and Anp::Read().

00308 {
00309    //
00310    // Configure self
00311    //
00312 
00313    Anp::Read(reg, "SelectAntiNeutrinoAddData", fAddData);
00314    Anp::Read(reg, "SelectAntiNeutrinoErase",   fErase);
00315 
00316    reg.Get("SelectAntiNeutrino",       fSelect);
00317    reg.Get("SelectAntiNeutrinoAddKey", fAddKey);
00318    reg.Get("SelectAntiNeutrinoAngKey", fAngKey);
00319    reg.Get("SelectAntiNeutrinoPidKey", fPidKey);
00320    reg.Get("SelectAntiNeutrinoSelKey", fSelKey);
00321    reg.Get("SelectAntiNeutrinoPidCut", fPidCut);
00322 
00323    assert(std::abs(fPidKey) < SHRT_MAX && "key is out of range");
00324 
00325    if(reg.KeyExists("PrintConfig"))
00326    {
00327       cout << "SelectAntiNeutrino::Config" << endl
00328            << "   AddData = " << fAddData << endl
00329            << "   Erase = " << fErase << endl
00330            << "   AddKey = " << fAddKey << endl
00331            << "   AngKey = " << fAngKey << endl
00332            << "   PidKey = " << fPidKey << endl
00333            << "   SelKey = " << fSelKey << endl
00334            << "   Select = " << fSelect << endl
00335            << "   PidCut = " << fPidCut << endl;
00336    }
00337 
00338    fCount -> Config(reg);
00339 }

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

Reimplemented from Anp::AlgEvent.

Definition at line 385 of file SelectAntiNeutrino.cxx.

References fCount.

00386 {
00387    fCount -> End(block);
00388 }

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

Implements Anp::AlgEvent.

Definition at line 73 of file SelectAntiNeutrino.cxx.

References fSelect, fSelKey, Anp::Event::KeyExists(), Run1(), and Run2().

00074 {
00075    //
00076    // Run \bar{\nu}_{\mu} selection algorithm
00077    //
00078 
00079    bool select = false;
00080    switch(fSelect)
00081    {
00082    case 1: 
00083       select = SelectAntiNeutrino::Run1(event, record, pass);
00084       break;
00085    case 2:
00086       select = SelectAntiNeutrino::Run2(event, record, pass);
00087       break;
00088    default:
00089       cerr << "SelectAntiNeutrino::Run - unknown selection case" << endl;
00090       break;
00091    }
00092 
00093    //
00094    // Event passed this selection - add corresponding key
00095    //
00096    if(select)
00097    {
00098       if(!event.KeyExists(fSelKey))
00099       {
00100          event.Add(fSelKey, +1.0);
00101       }
00102       else
00103       {
00104          cerr << "SelectAntiNeutrino::Run - key already exists: " << fSelKey << endl;
00105       }
00106    }
00107 
00108    return select;
00109 }

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

Implements Anp::AlgSnarl.

Definition at line 50 of file SelectAntiNeutrino.cxx.

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

Referenced by Run1(), and Run2().

00051 {
00052    //
00053    // Run selection for individual events
00054    //
00055 
00056    EventIterator ievent = record.EventBegIterator();   
00057    while(ievent != record.EventEndIterator())
00058    {
00059       if(!SelectAntiNeutrino::Run(*ievent, record, true) && fErase)
00060       {
00061          ievent = record.Erase(ievent);
00062       }
00063       else
00064       {
00065          ++ievent;
00066       }
00067    }
00068 
00069    return true;
00070 }

bool Anp::SelectAntiNeutrino::Run1 ( Event event,
const Record record,
bool  pass 
) [private]

Definition at line 112 of file SelectAntiNeutrino.cxx.

References AddData(), Chi2(), fAddData, fAngKey, fCount, Anp::LongestTrack(), Run(), and Anp::Record::TrackEnd().

Referenced by Run().

00113 {
00114    //
00115    // Run standard anti-neutrino selection
00116    //
00117    if(pass)
00118    {
00119       fCount -> Run(event, record, true);
00120    }
00121    else
00122    {
00123       fCount -> Run(event, record, false);
00124       return false;
00125    }  
00126 
00127    //
00128    // select longest track, with largest number of scintillator planes
00129    //
00130    const TrackIter itrack = Anp::LongestTrack(event, record);   
00131    if(itrack != record.TrackEnd())
00132    {
00133       fCount -> Run(event, record, true);
00134    }
00135    else
00136    {
00137       fCount -> Run(event, record, false);
00138       return false;
00139    }
00140    
00141    //
00142    // fill event data for variables used in a cut
00143    //
00144    if(fAddData) SelectAntiNeutrino::AddData(event, *itrack);
00145 
00146    //
00147    // check that track passed fitter algorithm
00148    //
00149    if(itrack -> PassFit())
00150    {
00151       fCount -> Run(event, record, true);
00152    }
00153    else
00154    {
00155       fCount -> Run(event, record, false);
00156       return false;
00157    }
00158 
00159    //
00160    // select mu- tracks and tracks with small error on the fit momentum
00161    //
00162    if(itrack -> ErrorQP() > 0.0 && itrack -> QP()/itrack -> ErrorQP() > +1.0)
00163    {
00164       fCount -> Run(event, record, true);
00165    }
00166    else
00167    {
00168       fCount -> Run(event, record, false);
00169       return false;
00170    }
00171    
00172    //
00173    // select tracks that are at least 40 scintillator planes long
00174    //
00175    if(itrack -> GetBasic().NPlane() > 39)
00176    {
00177       fCount -> Run(event, record, true);
00178    }
00179    else
00180    {
00181       fCount -> Run(event, record, false);
00182       return false;
00183    }
00184 
00185    //
00186    // cut on directional charge id
00187    //
00188    if(itrack -> KeyExists(fAngKey) && (itrack -> DataAt(fAngKey) < 1.00 || 
00189                                       itrack -> DataAt(fAngKey) > 5.00))
00190    {
00191       fCount -> Run(event, record, true);
00192    }
00193    else
00194    {
00195       fCount -> Run(event, record, false);
00196       return false;
00197    }
00198         
00199    //
00200    // cut on fit probability
00201    //
00202    const double chi2_prob = TMath::Prob(itrack -> Chi2(), int(itrack -> Ndof()));
00203    if(chi2_prob > 0.01)
00204    {
00205       fCount -> Run(event, record, true);
00206    }
00207    else
00208    {
00209       fCount -> Run(event, record, false);
00210       return false;
00211    }
00212 
00213    return true;
00214 }

bool Anp::SelectAntiNeutrino::Run2 ( Event event,
const Record record,
bool  pass 
) [private]

Definition at line 217 of file SelectAntiNeutrino.cxx.

References AddData(), Chi2(), fAddData, fAngKey, fCount, fPidCut, fPidKey, Anp::Event::KeyExists(), Anp::LongestTrack(), Run(), and Anp::Record::TrackEnd().

Referenced by Run().

00218 {
00219    if(pass)
00220    {
00221       fCount -> Run(event, record, true);
00222    }
00223    else
00224    {
00225       fCount -> Run(event, record, false);
00226       return false;
00227    }  
00228 
00229    //
00230    // select longest track, with largest number of scintillator planes
00231    //
00232    const TrackIter itrack = Anp::LongestTrack(event, record);
00233    if(itrack != record.TrackEnd())
00234    {
00235       fCount -> Run(event, record, true);
00236    }
00237    else
00238    {
00239       fCount -> Run(event, record, false);
00240       return false;
00241    }
00242 
00243    // fill event data for variables used in a cut
00244    if(fAddData) SelectAntiNeutrino::AddData(event, *itrack);
00245    
00246    // check that track passed fitter algorithm
00247    if(itrack -> PassFit())
00248    {
00249       fCount -> Run(event, record, true);
00250    }
00251    else
00252    {
00253       fCount -> Run(event, record, false);
00254       return false;
00255    }
00256 
00257    // select mu- tracks and tracks with small error on the fit momentum
00258    if(itrack -> ErrorQP() > 0.0 && itrack -> QP()/itrack -> ErrorQP() > +1.0)
00259    {
00260       fCount -> Run(event, record, true);
00261    }
00262    else
00263    {
00264       fCount -> Run(event, record, false);
00265       return false;
00266    }
00267    
00268    // select tracks that pass kNN muon cut
00269    if(event.KeyExists(fPidKey) && event[fPidKey] > fPidCut)
00270    {
00271       fCount -> Run(event, record, true);
00272    }
00273    else
00274    {
00275       fCount -> Run(event, record, false);
00276       return false;
00277    }
00278 
00279    // cut on directional charge id
00280    if(itrack -> KeyExists(fAngKey) && (itrack -> DataAt(fAngKey) < 1.00 ||
00281                                       itrack -> DataAt(fAngKey) > 5.00))
00282    {
00283       fCount -> Run(event, record, true);
00284    }
00285    else
00286    {
00287       fCount -> Run(event, record, false);
00288       return false;
00289    }       
00290 
00291    // cut on fit probability
00292    const double chi2_prob = TMath::Prob(itrack -> Chi2(), int(itrack -> Ndof()));
00293    if(chi2_prob > 0.01)
00294    {
00295       fCount -> Run(event, record, true);
00296    }
00297    else
00298    {
00299       fCount -> Run(event, record, false);
00300       return false;
00301    }
00302 
00303    return true;
00304 }


Member Data Documentation

Definition at line 49 of file SelectAntiNeutrino.h.

Referenced by Config(), Run1(), and Run2().

Definition at line 51 of file SelectAntiNeutrino.h.

Referenced by AddData(), and Config().

Definition at line 52 of file SelectAntiNeutrino.h.

Referenced by AddData(), Config(), Run1(), and Run2().

Reimplemented from Anp::Base.

Definition at line 47 of file SelectAntiNeutrino.h.

Referenced by Config(), End(), Run1(), and Run2().

Definition at line 50 of file SelectAntiNeutrino.h.

Referenced by Config(), and Run().

Definition at line 56 of file SelectAntiNeutrino.h.

Referenced by Config(), and Run2().

Definition at line 53 of file SelectAntiNeutrino.h.

Referenced by Config(), and Run2().

Definition at line 55 of file SelectAntiNeutrino.h.

Referenced by Config(), and Run().

Definition at line 54 of file SelectAntiNeutrino.h.

Referenced by Config(), and Run().


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

Generated on 3 Oct 2018 for loon by  doxygen 1.6.1