Anp::PlotVtx Class Reference

#include <PlotVtx.h>

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

List of all members.

Public Member Functions

 PlotVtx ()
virtual ~PlotVtx ()
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 &)

Private Types

typedef std::map< std::string,
Anp::Handle< Anp::HistVtx > > 
PlotMap

Private Member Functions

bool Fill (const std::string &input, const Vertex &vtx, double weight)
bool Fill (const std::string &input, const Vertex &lhs, const Vertex &rhs, double weight)
Anp::Handle< Anp::HistVtxGetPlot (const std::string &input)

Private Attributes

std::string fDirName
std::string fInput
TDirectory * fDir
bool fInit
bool fPlot2d
bool fPlotDiff
double fCenterX
double fCenterY
PlotMap fMap

Detailed Description

Definition at line 91 of file PlotVtx.h.


Member Typedef Documentation

typedef std::map<std::string, Anp::Handle<Anp::HistVtx> > Anp::PlotVtx::PlotMap [private]

Definition at line 110 of file PlotVtx.h.


Constructor & Destructor Documentation

Anp::PlotVtx::PlotVtx (  ) 

Definition at line 233 of file PlotVtx.cxx.

00234    :fDirName("vertex"),
00235     fInput("all"),
00236     fDir(0),
00237     fInit(false),
00238     fPlot2d(true),
00239     fPlotDiff(false),
00240     fCenterX(1.4885),
00241     fCenterY(0.1397)
00242 {
00243 }

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

Definition at line 246 of file PlotVtx.cxx.

00247 {
00248 }


Member Function Documentation

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

Reimplemented from Anp::AlgEvent.

Definition at line 323 of file PlotVtx.cxx.

References fCenterX, fCenterY, fDirName, fInput, fPlot2d, fPlotDiff, Registry::Get(), Registry::KeyExists(), and Anp::Read().

00324 {
00325    const char *value_char = 0;
00326    if(reg.Get("PlotVtxDirName", value_char) && value_char)
00327    {
00328       fDirName = value_char;
00329    }
00330 
00331    value_char = 0;
00332    if(reg.Get("PlotVtxInput", value_char) && value_char)
00333    {
00334       fInput = value_char;
00335    }
00336    
00337    Anp::Read(reg, "PlotVtx2d",   fPlot2d);
00338    Anp::Read(reg, "PlotVtxDiff", fPlotDiff);
00339 
00340    reg.Get("PlotVtxCenterX", fCenterX);
00341    reg.Get("PlotVtxCenterY", fCenterY);
00342 
00343    if(reg.KeyExists("PrintConfig"))
00344    {
00345       cout << "PlotVtx::Config" << endl
00346            << "   DirName = " << fDirName << endl
00347            << "   Input = " << fInput << endl
00348            << "   Plot2d = " << fPlot2d << endl
00349            << "   PlotDiff = " << fPlotDiff << endl
00350            << "   CenterX = " << fCenterX << endl
00351            << "   CenterY = " << fCenterY << endl;
00352    }
00353 }

void Anp::PlotVtx::End ( const DataBlock  )  [virtual]

Reimplemented from Anp::AlgEvent.

Definition at line 369 of file PlotVtx.cxx.

References fDir, and fMap.

00370 {
00371    fMap.clear();
00372    fDir = 0;
00373 }

bool Anp::PlotVtx::Fill ( const std::string &  input,
const Vertex lhs,
const Vertex rhs,
double  weight 
) [private]
bool Anp::PlotVtx::Fill ( const std::string &  input,
const Vertex vtx,
double  weight 
) [private]

Referenced by Run().

Anp::Handle<Anp::HistVtx> Anp::PlotVtx::GetPlot ( const std::string &  input  )  [private]
bool Anp::PlotVtx::Run ( Event event,
const Record record,
bool  pass 
) [virtual]

Implements Anp::AlgEvent.

Definition at line 291 of file PlotVtx.cxx.

References fDir, Fill(), Anp::Event::GetVtx(), Anp::LongestTrack(), Anp::PrimaryShower(), Anp::Record::ShowerEnd(), Anp::Record::TrackEnd(), and Anp::Event::Weight().

00292 {
00293    //
00294    // Plot event vertex 
00295    //
00296    if(!pass || !fDir) return true;
00297 
00298    PlotVtx::Fill("event", event.GetVtx(), event.Weight());
00299 
00300    const TrackIter  itrack  = Anp::LongestTrack (event, record);
00301    const ShowerIter ishower = Anp::PrimaryShower(event, record);
00302 
00303    if(ishower != record.ShowerEnd())
00304    {
00305       PlotVtx::Fill("event_shower_prm", ishower -> GetVtx(), event.Weight());
00306    }
00307 
00308    if(itrack != record.TrackEnd())
00309    {
00310       PlotVtx::Fill("event_track_beg", itrack -> GetBegVtx(), event.Weight());
00311       PlotVtx::Fill("event_track_end", itrack -> GetEndVtx(), event.Weight());
00312 
00313       if(ishower != record.ShowerEnd())
00314       {
00315          PlotVtx::Fill("event_shower_prm", itrack -> GetEndVtx(), ishower -> GetVtx(), event.Weight());
00316       }
00317    }
00318    
00319    return true;
00320 }

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

Implements Anp::AlgSnarl.

Definition at line 251 of file PlotVtx.cxx.

References Anp::Record::EventBegIterator(), Anp::Record::EventEndIterator(), fDir, Fill(), Anp::Record::FindTruth(), fPlotDiff, Anp::Record::GetHeader(), Anp::Header::IsData(), Anp::Record::TrackBeg(), Anp::Record::TrackEnd(), Anp::Record::TruthBeg(), and Anp::Record::TruthEnd().

00252 {
00253    //
00254    // Plot vertex information for events, tracks and showers
00255    //
00256    if(!fDir) return true;
00257 
00258    for(EventIterator ievent = record.EventBegIterator(); ievent != record.EventEndIterator(); ++ievent)
00259    {      
00260       PlotVtx::Run(*ievent, record, true);
00261    }
00262 
00263    for(TrackIter itrack = record.TrackBeg(); itrack != record.TrackEnd(); ++itrack)
00264    {
00265       PlotVtx::Fill("tracks_beg", itrack -> GetBegVtx(), itrack -> Weight());
00266       PlotVtx::Fill("tracks_end", itrack -> GetEndVtx(), itrack -> Weight());
00267    }
00268    
00269    for(TruthIter itruth = record.TruthBeg(); itruth != record.TruthEnd(); ++itruth)
00270    {
00271       PlotVtx::Fill("truths", itruth -> GetVtx(), itruth -> Weight());
00272    }
00273 
00274    if(fPlotDiff && !record.GetHeader().IsData())
00275    {
00276       for(TrackIter itrack = record.TrackBeg(); itrack != record.TrackEnd(); ++itrack)
00277       {
00278          const TruthIter itruth = record.FindTruth(*itrack);
00279          if(itruth != record.TruthEnd())
00280          {
00281             PlotVtx::Fill("truth_minus_track", itruth->GetVtx(), itrack->Weight());
00282             PlotVtx::Fill("truth_minus_track", itruth->GetVtx(), itrack->GetBegVtx(),itrack->Weight());
00283          }
00284       }
00285    }
00286 
00287    return true;
00288 }

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

Reimplemented from Anp::AlgEvent.

Definition at line 356 of file PlotVtx.cxx.

References fDir, fDirName, fInit, and Anp::GetDir().

00357 {
00358    fInit = false;
00359 
00360    if(!dir)
00361    {
00362       return;
00363    }
00364 
00365    fDir = Anp::GetDir(fDirName, dir);
00366 }


Member Data Documentation

double Anp::PlotVtx::fCenterX [private]

Definition at line 131 of file PlotVtx.h.

Referenced by Config().

double Anp::PlotVtx::fCenterY [private]

Definition at line 132 of file PlotVtx.h.

Referenced by Config().

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

Definition at line 125 of file PlotVtx.h.

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

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

Definition at line 122 of file PlotVtx.h.

Referenced by Config(), and Set().

bool Anp::PlotVtx::fInit [private]

Definition at line 127 of file PlotVtx.h.

Referenced by Set().

std::string Anp::PlotVtx::fInput [private]

Definition at line 123 of file PlotVtx.h.

Referenced by Config().

Definition at line 134 of file PlotVtx.h.

Referenced by End().

bool Anp::PlotVtx::fPlot2d [private]

Definition at line 128 of file PlotVtx.h.

Referenced by Config().

bool Anp::PlotVtx::fPlotDiff [private]

Definition at line 129 of file PlotVtx.h.

Referenced by Config(), and Run().


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

Generated on 15 Jul 2018 for loon by  doxygen 1.6.1