Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Anp::PlotBasic Class Reference

#include <PlotBasic.h>

Inheritance diagram for Anp::PlotBasic:

Anp::AlgEvent Anp::AlgSnarl Anp::Base Anp::Base List of all members.

Public Member Functions

 PlotBasic ()
virtual ~PlotBasic ()
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::HistBasic > > 
PlotMap

Private Member Functions

bool Fill (const std::string &input, const Basic &basic, double weight)

Private Attributes

std::string fDirName
std::string fInput
TDirectory * fDir
PlotMap fMap

Member Typedef Documentation

typedef std::map<std::string, Anp::Handle<Anp::HistBasic> > Anp::PlotBasic::PlotMap [private]
 

Definition at line 91 of file PlotBasic.h.


Constructor & Destructor Documentation

Anp::PlotBasic::PlotBasic  ) 
 

Definition at line 156 of file PlotBasic.cxx.

00157    :fDirName("basic"),
00158     fInput("all"),
00159     fDir(0)
00160 {
00161 }

Anp::PlotBasic::~PlotBasic  )  [virtual]
 

Definition at line 164 of file PlotBasic.cxx.

00165 {
00166 }


Member Function Documentation

void Anp::PlotBasic::Config const Registry reg  )  [virtual]
 

Reimplemented from Anp::AlgEvent.

Definition at line 222 of file PlotBasic.cxx.

References fDirName, fInput, Registry::Get(), Registry::KeyExists(), and reg.

00223 {
00224    const char *value_char = 0;
00225    if(reg.Get("PlotBasicDirName", value_char) && value_char)
00226    {
00227       fDirName = value_char;
00228    }
00229 
00230    value_char = 0;
00231    if(reg.Get("PlotBasicInput", value_char) && value_char)
00232    {
00233       fInput = value_char;
00234    }
00235 
00236    if(reg.KeyExists("PrintConfig"))
00237    {
00238       cout << "PlotBasic::Config" << endl
00239            << "   DirName = " << fDirName << endl
00240            << "   Input = " << fInput << endl;
00241    }
00242 }

void Anp::PlotBasic::End const DataBlock  )  [virtual]
 

Reimplemented from Anp::AlgEvent.

Definition at line 251 of file PlotBasic.cxx.

References fDir, and fMap.

00252 {
00253    fMap.clear();
00254    fDir = 0;
00255 }

bool Anp::PlotBasic::Fill const std::string &  input,
const Basic basic,
double  weight
[private]
 

Definition at line 258 of file PlotBasic.cxx.

References fDir, fInput, fMap, Anp::GetDir(), and Anp::Handle< T >::release().

Referenced by Run().

00259 {
00260    //
00261    // Handle "all" differently to break recursive chain
00262    //
00263    if(fInput != "all" && fInput != input)
00264    {
00265       return false;
00266    }
00267 
00268    PlotMap::iterator hit = fMap.find(input);
00269    if(hit == fMap.end())
00270    {
00271       Handle<HistBasic> hist(new HistBasic());
00272       TDirectory *dir = Anp::GetDir(input, fDir);
00273 
00274       //
00275       // Attempt to create histograms
00276       //
00277       if(!(hist -> Make(dir)))
00278       {
00279          hist.release();
00280       }
00281 
00282       hit = fMap.insert(PlotMap::value_type(input, hist)).first;
00283    }
00284    
00285    if((hit -> second).valid())
00286    {
00287       return (hit -> second) -> Fill(basic, weight);
00288    }
00289 
00290    return false;
00291 }

bool Anp::PlotBasic::Run Event event,
const Record record,
bool  pass
[virtual]
 

Implements Anp::AlgEvent.

Definition at line 191 of file PlotBasic.cxx.

References Anp::FirstShower(), Anp::Event::GetBasic(), Anp::LongestTrack(), Anp::PrimaryShower(), Anp::Record::ShowerEnd(), Anp::ShowerIter, Anp::Record::TrackEnd(), Anp::TrackIter, and Anp::Event::Weight().

00192 {
00193    if(!pass)
00194    {
00195       return true;
00196    }
00197 
00198    PlotBasic::Fill("event", event.GetBasic(), event.Weight());
00199 
00200    const TrackIter itrack = Anp::LongestTrack(event, record);
00201    if(itrack != record.TrackEnd())
00202    {
00203       PlotBasic::Fill("event_track", itrack -> GetBasic(), event.Weight());
00204    }   
00205 
00206    const ShowerIter ishower_1st = Anp::FirstShower(event, record);
00207    if(ishower_1st != record.ShowerEnd())
00208    {
00209       PlotBasic::Fill("event_shower_1st", ishower_1st -> GetBasic(), event.Weight());
00210    }
00211    
00212    const ShowerIter ishower_prm = Anp::PrimaryShower(event, record);
00213    if(ishower_prm != record.ShowerEnd())
00214    {
00215       PlotBasic::Fill("event_shower_prm", ishower_prm -> GetBasic(), event.Weight());
00216    } 
00217 
00218    return true;
00219 }

bool Anp::PlotBasic::Run Record record  )  [virtual]
 

Implements Anp::AlgSnarl.

Definition at line 169 of file PlotBasic.cxx.

References Anp::Record::EventBegIterator(), Anp::Record::EventEndIterator(), Anp::EventIterator, Fill(), Anp::Record::ShowerBeg(), Anp::Record::ShowerEnd(), Anp::ShowerIter, Anp::Record::TrackBeg(), Anp::Record::TrackEnd(), and Anp::TrackIter.

00170 {
00171 
00172    for(EventIterator ievent = record.EventBegIterator(); ievent != record.EventEndIterator(); ++ievent)
00173    {      
00174       PlotBasic::Run(*ievent, record, true);
00175    }
00176 
00177    for(TrackIter itrack = record.TrackBeg(); itrack != record.TrackEnd(); ++itrack)
00178    {
00179       Fill("tracks", itrack -> GetBasic(), itrack -> Weight());
00180    }
00181 
00182    for(ShowerIter ishower = record.ShowerBeg(); ishower != record.ShowerEnd(); ++ishower)
00183    {
00184       Fill("showers", ishower -> GetBasic(), ishower -> Weight());
00185    }
00186 
00187    return true;
00188 }

void Anp::PlotBasic::Set TDirectory *  dir  )  [virtual]
 

Reimplemented from Anp::AlgEvent.

Definition at line 245 of file PlotBasic.cxx.

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

00246 {
00247    fDir = Anp::GetDir(fDirName, dir); 
00248 }


Member Data Documentation

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

Definition at line 98 of file PlotBasic.h.

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

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

Definition at line 95 of file PlotBasic.h.

Referenced by Config(), and Set().

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

Definition at line 96 of file PlotBasic.h.

Referenced by Config(), and Fill().

PlotMap Anp::PlotBasic::fMap [private]
 

Definition at line 100 of file PlotBasic.h.

Referenced by End(), and Fill().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:10:32 2010 for loon by  doxygen 1.3.9.1