Anp::PlotTrack Class Reference

#include <PlotTrack.h>

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

List of all members.

Public Member Functions

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

Private Member Functions

void FillTrack (const Track &track, const Record &record, double weight)
void FillResol (const Track &track, const Record &record, double weight)
TH1 * GetTH1 (const std::string &key, const std::string &name="")

Private Attributes

std::string fDirName
TDirectory * fDir
bool fPlot
bool fNMiss
double fEQPCut
double fkNNCut
int fkNNKey
TH1 * fNPass
TH1 * fNStop
TH1 * fPLep
TH1 * fPLepNeg
TH1 * fPLepPos
TH1 * fPCur
TH1 * fPCurNeg
TH1 * fPCurPos
TH1 * fPCurStop
TH1 * fPCurStopNeg
TH1 * fPCurStopPos
TH1 * fPCurExit
TH1 * fPCurExitNeg
TH1 * fPCurExitPos
TH1 * fPRan
TH1 * fPRanStop
TH1 * fPRanNeg
TH1 * fPRanPos
TH1 * fQP
TH1 * fQPoverEQP
TH1 * fEQP
TH1 * fEQPoverQP
TH1 * fNdof
TH1 * fChi2
TH1 * fChi2PerD
TH1 * fChi2Prob
TH1 * fResolPRan
TH1 * fResolPCur
TH1 * fResolPCurAll
TH1 * fResolPCurBad
TH1 * fResolPCurPos
TH1 * fResolPCurNeg

Detailed Description

Definition at line 21 of file PlotTrack.h.


Constructor & Destructor Documentation

Anp::PlotTrack::PlotTrack (  ) 

Definition at line 32 of file PlotTrack.cxx.

00033    :fDirName("track"),
00034     fDir(0),
00035     fPlot(false),
00036     fNMiss(0),
00037     fEQPCut(2.0),
00038     fkNNCut(0.3),
00039     fkNNKey(4280)
00040 {
00041 }

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

Definition at line 44 of file PlotTrack.cxx.

00045 {   
00046 }


Member Function Documentation

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

Reimplemented from Anp::AlgEvent.

Definition at line 78 of file PlotTrack.cxx.

References fDirName, fEQPCut, fkNNCut, fkNNKey, Registry::Get(), and Registry::KeyExists().

00079 {
00080    //
00081    // Configure self
00082    //
00083 
00084    const char *name_char = 0;
00085    if(reg.Get("PlotTrackDirName", name_char) && name_char)
00086    {
00087       fDirName = name_char;
00088    }
00089 
00090    reg.Get("PlotTrackEQPCut", fEQPCut);
00091    reg.Get("PlotTrackkNNCut", fkNNCut);
00092    reg.Get("PlotTrackkNNKey", fkNNKey);
00093 
00094    if(reg.KeyExists("PrintConfig"))
00095    {
00096       cout << "PlotTrack::Config" << endl
00097            << "   DirName = " << fDirName << endl
00098            << "   EQPCut = " << fEQPCut << endl
00099            << "   kNNCut = " << fkNNCut << endl
00100            << "   kNNKey = " << fkNNKey << endl;
00101    }
00102 }

void Anp::PlotTrack::FillResol ( const Track track,
const Record record,
double  weight 
) [private]

Definition at line 222 of file PlotTrack.cxx.

References Anp::Track::ErrorQP(), fDir, fEQPCut, Anp::Record::FindStdHep(), fkNNCut, fkNNKey, fPlot, fResolPCur, fResolPCurAll, fResolPCurBad, fResolPCurNeg, fResolPCurPos, fResolPRan, Anp::Record::GetHeader(), Anp::Header::IsData(), Anp::Track::KeyExists(), Anp::Track::Pass(), Anp::Track::PCur(), Anp::Track::PRan(), Anp::Track::QP(), Anp::Record::StdHepBeg(), Anp::Record::StdHepEnd(), and Anp::Track::Stop().

Referenced by Run().

00223 { 
00224    if(!fDir || !fPlot)
00225    {
00226       return;
00227    }
00228    //
00229    // Plot track momentum resolution
00230    //
00231    if(record.GetHeader().IsData() || record.StdHepBeg() == record.StdHepEnd())
00232    {
00233       return;
00234    }
00235 
00236    const StdHepIter ihep = record.FindStdHep(track);
00237    if(ihep == record.StdHepEnd())
00238    {
00239       return;
00240    }
00241    else if(!(ihep -> P() > 0.0))
00242    {
00243       return;
00244    }
00245 
00246    //
00247    // Select tracks that passed the muon knn selection
00248    //
00249    if(fkNNKey > 0 && (!track.KeyExists(fkNNKey) || track[fkNNKey] < fkNNCut))
00250    {
00251       return;
00252    }
00253 
00254    const double phep = ihep -> P();
00255    const double resol_pcur = (track.PCur()-phep)/phep;
00256    const double resol_pran = (track.PRan()-phep)/phep;
00257 
00258    if(track.Stop())
00259    {
00260       fResolPRan -> Fill(resol_pran, weight);
00261    }
00262 
00263    if(track.Pass())
00264    {
00265       fResolPCur -> Fill(resol_pcur, weight);
00266       
00267       if(track.ErrorQP() > 0.0)
00268       {
00269          if(std::fabs(track.QP())/track.ErrorQP() > fEQPCut)
00270          {
00271             fResolPCurAll -> Fill(resol_pcur, weight);
00272             
00273             if     (track.QP() > 0.0) fResolPCurPos -> Fill(resol_pcur, weight);
00274             else if(track.QP() < 0.0) fResolPCurNeg -> Fill(resol_pcur, weight);
00275          }
00276          else
00277          {
00278             fResolPCurBad -> Fill(resol_pcur, weight);
00279          }
00280       }      
00281    }
00282 }

void Anp::PlotTrack::FillTrack ( const Track track,
const Record record,
double  weight 
) [private]

Definition at line 157 of file PlotTrack.cxx.

References Anp::Track::Chi2(), Anp::Track::ErrorQP(), fChi2, fChi2PerD, fChi2Prob, fDir, fEQP, fEQPoverQP, fkNNCut, fkNNKey, fNdof, fNPass, fNStop, fPCur, fPCurExit, fPCurStop, fPLep, fPlot, fPRan, fPRanStop, fQP, fQPoverEQP, Anp::Track::KeyExists(), Anp::Track::Ndof(), Anp::Track::Pass(), Anp::Track::PCur(), Anp::Track::PRan(), Anp::Track::QP(), and Anp::Track::Stop().

Referenced by Run().

00158 { 
00159    if(!fDir || !fPlot)
00160    {
00161       return;
00162    }
00163  
00164    //
00165    // Select tracks that passed the muon knn selection
00166    //
00167    if(fkNNKey > 0 && (!track.KeyExists(fkNNKey) || track[fkNNKey] < fkNNCut))
00168    {
00169       return;
00170    }
00171 
00172    fNPass -> Fill(static_cast<double>(track.Pass())+0.5, weight);
00173    fNStop -> Fill(static_cast<double>(track.Stop())+0.5, weight);
00174 
00175    if(track.Pass())
00176    {
00177       fQP   -> Fill(track.QP(),      weight);
00178       fEQP  -> Fill(track.ErrorQP(), weight);
00179       fPCur -> Fill(track.PCur(),    weight);
00180       fChi2 -> Fill(track.Chi2(),    weight);
00181       fNdof -> Fill(track.Ndof(),    weight);
00182             
00183       if(std::fabs(track.QP()) > 0.0)
00184       {
00185          fEQPoverQP -> Fill(track.ErrorQP()/track.QP(), weight);        
00186       }
00187 
00188       if(track.Ndof() > 0.0)
00189       {
00190          fChi2PerD -> Fill(track.Chi2()/track.Ndof());
00191          fChi2Prob -> Fill(TMath::Prob(track.Chi2(), static_cast<int>(track.Ndof())), weight);
00192       }
00193 
00194       if(track.Stop())
00195       {
00196          fPCurStop -> Fill(track.PCur(), weight);
00197       }
00198       else
00199       {
00200          fPCurExit -> Fill(track.PCur(), weight);
00201       }
00202 
00203       if(track.ErrorQP() > 0.0)
00204       {
00205          fQPoverEQP -> Fill(track.QP()/track.ErrorQP(), weight);
00206       }
00207    }
00208 
00209    fPRan -> Fill(track.PRan(), weight);
00210    if(track.Stop())
00211    {
00212       fPLep     -> Fill(track.PRan(), weight);   
00213       fPRanStop -> Fill(track.PRan(), weight);
00214    }
00215    else if(track.Pass())
00216    {
00217       fPLep -> Fill(track.PCur(), weight);   
00218    }
00219 }

TH1* Anp::PlotTrack::GetTH1 ( const std::string &  key,
const std::string &  name = "" 
) [private]

Referenced by Set().

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

Implements Anp::AlgEvent.

Definition at line 61 of file PlotTrack.cxx.

References FillResol(), FillTrack(), Anp::LongestTrack(), Anp::Record::TrackEnd(), and Anp::Event::Weight().

00062 {  
00063    if(!pass)
00064    {
00065       return true;
00066    }
00067 
00068    const TrackIter itrack = Anp::LongestTrack(event, record);
00069    if(itrack != record.TrackEnd())
00070    {
00071       PlotTrack::FillTrack(*itrack, record, event.Weight());
00072       PlotTrack::FillResol(*itrack, record, event.Weight());
00073    }
00074 
00075    return true;
00076 }

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

Implements Anp::AlgSnarl.

Definition at line 49 of file PlotTrack.cxx.

References FillResol(), FillTrack(), Anp::Record::TrackBeg(), and Anp::Record::TrackEnd().

00050 { 
00051    for(TrackIter itrack = record.TrackBeg(); itrack != record.TrackEnd(); ++itrack)
00052    {
00053       PlotTrack::FillTrack(*itrack, record, itrack -> Weight());
00054       PlotTrack::FillResol(*itrack, record, itrack -> Weight());
00055    }
00056 
00057    return true;
00058 }

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

Reimplemented from Anp::AlgEvent.

Definition at line 105 of file PlotTrack.cxx.

References fChi2, fChi2PerD, fChi2Prob, fDir, fDirName, fEQP, fEQPoverQP, fNdof, fNMiss, fNPass, fNStop, fPCur, fPCurExit, fPCurNeg, fPCurPos, fPCurStop, fPLep, fPLepNeg, fPLepPos, fPlot, fPRan, fPRanNeg, fPRanPos, fPRanStop, fQP, fQPoverEQP, fResolPCur, fResolPCurAll, fResolPCurBad, fResolPCurNeg, fResolPCurPos, fResolPRan, Anp::GetDir(), and GetTH1().

00106 {
00107    fPlot = false;
00108 
00109    if(!dir)
00110    {
00111       return;
00112    }
00113 
00114    fDir = Anp::GetDir(fDirName, dir);
00115 
00116    fNPass     = PlotTrack::GetTH1("npass");
00117    fNStop     = PlotTrack::GetTH1("nstop");
00118    fPLep      = PlotTrack::GetTH1("plep");
00119    fPLepNeg   = PlotTrack::GetTH1("plep", "plep_neg");
00120    fPLepPos   = PlotTrack::GetTH1("plep", "plep_pos");
00121    fPCur      = PlotTrack::GetTH1("pcur");
00122    fPCurNeg   = PlotTrack::GetTH1("pcur", "pcur_neg");
00123    fPCurPos   = PlotTrack::GetTH1("pcur", "pcur_pos");
00124    fPCurStop  = PlotTrack::GetTH1("pcur_stop");
00125    fPCurExit  = PlotTrack::GetTH1("pcur_exit");
00126    fPRan      = PlotTrack::GetTH1("pran");
00127    fPRanNeg   = PlotTrack::GetTH1("pran", "pran_neg");
00128    fPRanPos   = PlotTrack::GetTH1("pran", "pran_pos");
00129    fPRanStop  = PlotTrack::GetTH1("pran_stop");         
00130    fQP        = PlotTrack::GetTH1("qp");
00131    fQPoverEQP = PlotTrack::GetTH1("qp_over_eqp");
00132    fEQP       = PlotTrack::GetTH1("eqp");
00133    fEQPoverQP = PlotTrack::GetTH1("eqp_over_qp");
00134    fNdof      = PlotTrack::GetTH1("ndof");
00135    fChi2      = PlotTrack::GetTH1("chi2");
00136    fChi2PerD  = PlotTrack::GetTH1("chi2_perd");
00137    fChi2Prob  = PlotTrack::GetTH1("chi2_prob");
00138 
00139    fResolPRan    = PlotTrack::GetTH1("resol_plep", "resol_pran");
00140    fResolPCur    = PlotTrack::GetTH1("resol_plep", "resol_pcur");
00141    fResolPCurAll = PlotTrack::GetTH1("resol_plep", "resol_pcur_all");
00142    fResolPCurBad = PlotTrack::GetTH1("resol_pbad", "resol_pcur_bad");
00143    fResolPCurPos = PlotTrack::GetTH1("resol_plep", "resol_pcur_pos");
00144    fResolPCurNeg = PlotTrack::GetTH1("resol_plep", "resol_pcur_neg");
00145 
00146    if(fNMiss == 0)
00147    {
00148       fPlot = true;
00149    }
00150    else
00151    {
00152       cerr << "PlotTrack::Set - missed " << fNMiss << " histograms" << endl;
00153    }
00154 }


Member Data Documentation

TH1* Anp::PlotTrack::fChi2 [private]

Definition at line 80 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

TH1* Anp::PlotTrack::fChi2PerD [private]

Definition at line 81 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

TH1* Anp::PlotTrack::fChi2Prob [private]

Definition at line 82 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

TDirectory* Anp::PlotTrack::fDir [private]

Definition at line 47 of file PlotTrack.h.

Referenced by FillResol(), FillTrack(), and Set().

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

Definition at line 45 of file PlotTrack.h.

Referenced by Config(), and Set().

TH1* Anp::PlotTrack::fEQP [private]

Definition at line 77 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

double Anp::PlotTrack::fEQPCut [private]

Definition at line 52 of file PlotTrack.h.

Referenced by Config(), and FillResol().

Definition at line 78 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

double Anp::PlotTrack::fkNNCut [private]

Definition at line 53 of file PlotTrack.h.

Referenced by Config(), FillResol(), and FillTrack().

int Anp::PlotTrack::fkNNKey [private]

Definition at line 54 of file PlotTrack.h.

Referenced by Config(), FillResol(), and FillTrack().

TH1* Anp::PlotTrack::fNdof [private]

Definition at line 79 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

bool Anp::PlotTrack::fNMiss [private]

Definition at line 50 of file PlotTrack.h.

Referenced by Set().

TH1* Anp::PlotTrack::fNPass [private]

Definition at line 56 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

TH1* Anp::PlotTrack::fNStop [private]

Definition at line 57 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

TH1* Anp::PlotTrack::fPCur [private]

Definition at line 61 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

TH1* Anp::PlotTrack::fPCurExit [private]

Definition at line 67 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

Definition at line 68 of file PlotTrack.h.

Definition at line 69 of file PlotTrack.h.

TH1* Anp::PlotTrack::fPCurNeg [private]

Definition at line 62 of file PlotTrack.h.

Referenced by Set().

TH1* Anp::PlotTrack::fPCurPos [private]

Definition at line 63 of file PlotTrack.h.

Referenced by Set().

TH1* Anp::PlotTrack::fPCurStop [private]

Definition at line 64 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

Definition at line 65 of file PlotTrack.h.

Definition at line 66 of file PlotTrack.h.

TH1* Anp::PlotTrack::fPLep [private]

Definition at line 58 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

TH1* Anp::PlotTrack::fPLepNeg [private]

Definition at line 59 of file PlotTrack.h.

Referenced by Set().

TH1* Anp::PlotTrack::fPLepPos [private]

Definition at line 60 of file PlotTrack.h.

Referenced by Set().

bool Anp::PlotTrack::fPlot [private]

Definition at line 49 of file PlotTrack.h.

Referenced by FillResol(), FillTrack(), and Set().

TH1* Anp::PlotTrack::fPRan [private]

Definition at line 70 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

TH1* Anp::PlotTrack::fPRanNeg [private]

Definition at line 72 of file PlotTrack.h.

Referenced by Set().

TH1* Anp::PlotTrack::fPRanPos [private]

Definition at line 73 of file PlotTrack.h.

Referenced by Set().

TH1* Anp::PlotTrack::fPRanStop [private]

Definition at line 71 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

TH1* Anp::PlotTrack::fQP [private]

Definition at line 75 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

Definition at line 76 of file PlotTrack.h.

Referenced by FillTrack(), and Set().

Definition at line 85 of file PlotTrack.h.

Referenced by FillResol(), and Set().

Definition at line 86 of file PlotTrack.h.

Referenced by FillResol(), and Set().

Definition at line 87 of file PlotTrack.h.

Referenced by FillResol(), and Set().

Definition at line 89 of file PlotTrack.h.

Referenced by FillResol(), and Set().

Definition at line 88 of file PlotTrack.h.

Referenced by FillResol(), and Set().

Definition at line 84 of file PlotTrack.h.

Referenced by FillResol(), and Set().


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

Generated on 11 Jan 2018 for loon by  doxygen 1.6.1