Anp::FillTrack Class Reference

#include <FillTrack.h>

Inheritance diagram for Anp::FillTrack:
Anp::AlgStore Anp::Base

List of all members.

Public Member Functions

 FillTrack ()
virtual ~FillTrack ()
bool Run (Record &record, TObject *ptr=0)
void Config (const Registry &reg)

Private Attributes

bool fCorr
FillBasic fBasic

Detailed Description

Definition at line 18 of file FillTrack.h.


Constructor & Destructor Documentation

Anp::FillTrack::FillTrack (  ) 

Definition at line 30 of file FillTrack.cxx.

00031    :fCorr(true)
00032 {    
00033 }

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

Definition at line 36 of file FillTrack.cxx.

00037 {
00038 }


Member Function Documentation

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

Reimplemented from Anp::AlgStore.

Definition at line 151 of file FillTrack.cxx.

References Anp::FillBasic::Config(), fBasic, fCorr, Registry::KeyExists(), and Anp::Read().

00152 {
00153    //
00154    // Configure self
00155    //
00156    
00157    Anp::Read(reg, "FillTrackCorr", fCorr);
00158 
00159    fBasic.Config(reg);
00160 
00161    if(reg.KeyExists("PrintConfig"))
00162    {
00163       cout << "FillTrack::Config" << endl
00164            << "   Corr = " << fCorr << endl;
00165    }
00166 }

bool Anp::FillTrack::Run ( Record record,
TObject *  ptr = 0 
) [virtual]

Implements Anp::AlgStore.

Definition at line 41 of file FillTrack.cxx.

References Anp::Record::Add(), Anp::Track::fBasic, fBasic, Anp::Track::fBegVtx, fCorr, Anp::Track::fEndVtx, Anp::FillBasic::Fill(), Anp::Track::fit_chi2, Anp::Track::fit_eqp, Anp::Track::fit_ndof, Anp::Track::fit_qp, EnergyCorrections::FullyCorrectMomentumFromRange(), Anp::FillBasic::GetBasic(), Anp::FillBasic::GetBegVtx(), Anp::FillBasic::GetEndVtx(), RecRecordImp< T >::GetVldContext(), Anp::Track::index, Msg::kError, Msg::kWarning, MSG, Anp::Track::p_range, Anp::Track::p_range_def, Anp::Track::pass_fit, Anp::Track::range, NtpSRTrack::range, Anp::Track::stopping, Anp::Track::tracen, and Anp::Track::tracet.

00042 {
00043    //
00044    // Extract data from NtpSRTrack and save to Anp::Track
00045    //
00046 
00047    NtpStRecord *ntprec = dynamic_cast<NtpStRecord *>(ptr);
00048    if(!ntprec)
00049    {
00050       const MomNavigator *mom = dynamic_cast<const MomNavigator *> (ptr);
00051       if(mom)
00052       {
00053          ntprec = dynamic_cast<NtpStRecord *>(mom -> GetFragment("NtpStRecord")); 
00054       }
00055       else
00056       {
00057          MSG("FillAlg", Msg::kError) << "Failed to find MomNavigator pointer" << endl;
00058          return false;
00059       }      
00060    }
00061 
00062    if(!ntprec)
00063    {
00064       MSG("FillAlg", Msg::kError) << "Failed to get NtpStRecord pointer" << endl;
00065       return false;
00066    }
00067 
00068    const TClonesArray *track_array = ntprec -> trk;
00069    if(!track_array)
00070    {
00071       MSG("FillAlg", Msg::kWarning) << "NtpStRecord does not have valid track array." <<endl;
00072       return true;
00073    }
00074    
00075    const VldContext vldc = ntprec -> GetHeader().GetVldContext();
00076    const int ntrack = track_array -> GetEntries();
00077 
00078    for(int i = 0; i < ntrack; ++i)
00079    {
00080       NtpSRTrack *ntptrk  = dynamic_cast<NtpSRTrack *>(track_array -> At(i));
00081       if(!ntptrk)
00082       {
00083          MSG("FillAlg", Msg::kWarning) << "Failed to find NtpSRTrack at index " << i << endl;
00084          continue;
00085       }
00086       
00087       if(ntptrk -> index != i)
00088       {
00089          MSG("FillAlg", Msg::kWarning) << "Mismatched track index" << endl;
00090          continue;
00091       }
00092       
00093       if(!fBasic.Fill(*ntprec, *ntptrk))
00094       {
00095          MSG("FillAlg", Msg::kWarning) << "Failed to fill basic track information" << endl;
00096       }
00097 
00098       //
00099       // Fill variables for PhysicsNtuple/Track.h data class 
00100       //
00101       Track track;
00102 
00103       track.index       = ntptrk -> index;
00104       track.tracen      = ntptrk -> fidend.nplane;
00105       track.tracet      = ntptrk -> fidend.dr;
00106       track.fit_qp      = ntptrk -> momentum.qp;
00107       track.fit_eqp     = ntptrk -> momentum.eqp;
00108       track.fit_chi2    = ntptrk -> fit.chi2;
00109       track.fit_ndof    = ntptrk -> fit.ndof;
00110       track.pass_fit    = ntptrk -> fit.pass;
00111       track.range       = ntptrk -> range;
00112       track.p_range_def = ntptrk -> momentum.range;
00113 
00114       if(fCorr)
00115       {
00116          track.p_range = FullyCorrectMomentumFromRange(ntptrk -> momentum.range,
00117                                                        vldc,
00118                                                        ntprec -> GetRelease());
00119       }
00120       else
00121       {
00122          track.p_range = ntptrk -> momentum.range;
00123       }
00124 
00125       //
00126       // Fill vertex info
00127       //
00128       track.fBasic  = fBasic.GetBasic();
00129       track.fBegVtx = fBasic.GetBegVtx();
00130       track.fEndVtx = fBasic.GetEndVtx();
00131       
00132       //
00133       // Use default containment cut      
00134       //
00135       if(ntptrk -> contained == 1)
00136       {
00137          track.stopping = true;
00138       }
00139       else
00140       {
00141          track.stopping = false;
00142       }     
00143 
00144       record.Add(track);
00145    }
00146 
00147    return true;
00148 }


Member Data Documentation

Definition at line 33 of file FillTrack.h.

Referenced by Config(), and Run().

bool Anp::FillTrack::fCorr [private]

Definition at line 31 of file FillTrack.h.

Referenced by Config(), and Run().


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

Generated on 19 Jan 2018 for loon by  doxygen 1.6.1