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

Anp::PlotShower Class Reference

#include <PlotShower.h>

Inheritance diagram for Anp::PlotShower:

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

Public Member Functions

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

TH1 * GetTH1 (const std::string &key, const std::string &name="")

Private Attributes

std::string fDirName
TDirectory * fDir
bool fPlot
int fNMiss
double fPotBase
TH1 * fEnergyCCCor
TH1 * fEnergyCCDef
TH1 * fCorOverDef
TH1 * fSignalOverPot
TH1 * fEnergyOverPot
TH1 * fNuEHadAll
TH1 * fNuEHad1st
TH1 * fNuEHadPrm
TH1 * fNuEHad1stOverAll
TH1 * fNuEHadPrmOverAll

Constructor & Destructor Documentation

Anp::PlotShower::PlotShower  ) 
 

Definition at line 29 of file PlotShower.cxx.

00030    :fDirName("shower"),
00031     fDir(0),
00032     fPlot(false),
00033     fNMiss(0),
00034     fPotBase(24.2)
00035 {
00036 }

Anp::PlotShower::~PlotShower  )  [virtual]
 

Definition at line 39 of file PlotShower.cxx.

00040 {
00041 }


Member Function Documentation

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

Reimplemented from Anp::AlgEvent.

Definition at line 127 of file PlotShower.cxx.

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

00128 {
00129    //
00130    // Configure self
00131    //
00132 
00133    const char *name = 0;
00134    if(reg.Get("PlotShowerDirName",name) && name)
00135    {
00136       fDirName = name;
00137    }
00138 
00139    reg.Get("PlotShowerPotBase", fPotBase);
00140 
00141    if(reg.KeyExists("PrintConfig"))
00142    {
00143       cout << "PlotShower::Config" << endl
00144            << "   DirName = " << fDirName << endl
00145            << "   PotBase = " << fPotBase << endl;
00146    }
00147 }

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

Definition at line 182 of file PlotShower.cxx.

References fDir, and Anp::SetDir().

00183 {
00184    TH1 *h = HistMan::Instance().CreateTH1(key, "shower");
00185    if(h)
00186    {
00187       Anp::SetDir(h, fDir, name);
00188    }
00189    else
00190    {
00191       ++fNMiss;
00192    }
00193 
00194    return h;
00195 }

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

Implements Anp::AlgEvent.

Definition at line 91 of file PlotShower.cxx.

References Anp::FirstShower(), fNuEHad1st, fNuEHad1stOverAll, fNuEHadAll, fNuEHadPrm, fNuEHadPrmOverAll, fPlot, Anp::Event::GetNShowers(), Anp::Event::MatchShower(), Anp::PrimaryShower(), Anp::Record::ShowerBeg(), Anp::Record::ShowerEnd(), Anp::ShowerIter, and Anp::Event::Weight().

00092 { 
00093    //
00094    // Check for valid state and relevant input data
00095    //
00096    if(!fPlot || !pass || event.GetNShowers() < 1) return true;
00097 
00098    double ehad_all = 0.0, ehad_1st = 0.0, ehad_prm = 0.0;
00099    for(ShowerIter ishower = record.ShowerBeg(); ishower != record.ShowerEnd(); ++ishower)
00100    {
00101       if(event.MatchShower(ishower -> ShowerIndex()))
00102       {
00103          ehad_all += ishower -> EnergyCC();
00104       }
00105    }  
00106 
00107    const ShowerIter ishower_1st = Anp::FirstShower  (event, record);
00108    const ShowerIter ishower_prm = Anp::PrimaryShower(event, record);
00109 
00110    if(ishower_1st != record.ShowerEnd()) ehad_1st = ishower_1st -> EnergyCC();
00111    if(ishower_prm != record.ShowerEnd()) ehad_prm = ishower_prm -> EnergyCC();
00112    
00113    fNuEHadAll  -> Fill(ehad_all, event.Weight());
00114    fNuEHad1st  -> Fill(ehad_1st, event.Weight());
00115    fNuEHadPrm  -> Fill(ehad_prm, event.Weight());
00116 
00117    if(ehad_all > 0.0)
00118    {
00119       fNuEHad1stOverAll -> Fill(ehad_1st/ehad_all, event.Weight());
00120       fNuEHadPrmOverAll -> Fill(ehad_prm/ehad_all, event.Weight());
00121    }
00122 
00123    return true;
00124 }

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

Implements Anp::AlgSnarl.

Definition at line 44 of file PlotShower.cxx.

References Anp::Record::EventBegIterator(), Anp::Record::EventEndIterator(), Anp::EventIterator, fCorOverDef, fEnergyCCCor, fEnergyCCDef, fEnergyOverPot, fPlot, fPotBase, fSignalOverPot, Anp::Record::GetHeader(), Anp::Record::GetNShowers(), Anp::Record::ShowerBeg(), Anp::Record::ShowerEnd(), Anp::ShowerIter, Anp::Header::Tor101(), Anp::Header::TorTgt(), Anp::Header::Tr101D(), and Anp::Header::TrTgtD().

00045 { 
00046    //
00047    // Plot snarl specific showers and event specific showers
00048    //
00049    if(!fPlot || !fDir) return true;
00050 
00051    for(EventIterator event = record.EventBegIterator(); event != record.EventEndIterator(); ++event)
00052    {
00053       PlotShower::Run(*event, record, true);
00054    }
00055 
00056    double energy = 0.0, signal = 0.0;
00057 
00058    for(ShowerIter ishower = record.ShowerBeg(); ishower != record.ShowerEnd(); ++ishower)
00059    {
00060       energy += ishower -> EnergyCC();
00061       signal += ishower -> GetBasic().SigCor();
00062 
00063       fEnergyCCCor -> Fill(ishower -> EnergyCC());
00064       fEnergyCCDef -> Fill(ishower -> EnergyCCDef());
00065       
00066       if(ishower -> EnergyCCDef() > 0.0)
00067       {
00068          fCorOverDef -> Fill(ishower -> EnergyCC()/ishower -> EnergyCCDef());    
00069       }
00070    }
00071 
00072    const Header &header = record.GetHeader();
00073    double protons = -1.0;
00074 
00075    if     (header.TrTgtD() > 0.0) protons = header.TrTgtD();
00076    else if(header.TorTgt() > 0.0) protons = header.TorTgt();
00077    else if(header.Tr101D() > 0.0) protons = header.Tr101D();
00078    else if(header.Tor101() > 0.0) protons = header.Tor101();
00079 
00080    if(record.GetNShowers() > 0 && protons > 0.0 && fPotBase > 0.0)
00081    {
00082       const double factor = fPotBase/protons;
00083       fSignalOverPot -> Fill(signal*factor);
00084       fEnergyOverPot -> Fill(energy*factor);
00085    }
00086 
00087    return true;
00088 }

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

Reimplemented from Anp::AlgEvent.

Definition at line 150 of file PlotShower.cxx.

References fCorOverDef, fDir, fDirName, fEnergyCCCor, fEnergyCCDef, fEnergyOverPot, fNMiss, fNuEHad1st, fNuEHad1stOverAll, fNuEHadAll, fNuEHadPrm, fNuEHadPrmOverAll, fPlot, fSignalOverPot, and Anp::GetDir().

00151 {
00152    //
00153    // Make sure input pointer is valid
00154    //
00155    if(!dir) return;
00156    
00157    fDir = Anp::GetDir(fDirName, dir);
00158    fPlot = false;
00159 
00160    fEnergyCCCor      = PlotShower::GetTH1("energy_cor");
00161    fEnergyCCDef      = PlotShower::GetTH1("energy_def");
00162    fCorOverDef       = PlotShower::GetTH1("energy_cor_over_def");  
00163    fSignalOverPot    = PlotShower::GetTH1("signal_over_pot");
00164    fEnergyOverPot    = PlotShower::GetTH1("energy_over_pot");
00165    fNuEHadAll        = PlotShower::GetTH1("nu_ehad_all");
00166    fNuEHad1st        = PlotShower::GetTH1("nu_ehad_1st");
00167    fNuEHadPrm        = PlotShower::GetTH1("nu_ehad_prm");
00168    fNuEHad1stOverAll = PlotShower::GetTH1("nu_ehad_1st_over_all");
00169    fNuEHadPrmOverAll = PlotShower::GetTH1("nu_ehad_prm_over_all");
00170  
00171    if(fNMiss == 0)
00172    {
00173       fPlot = true;
00174    }
00175    else
00176    {
00177       cerr << "PlotShower::Set - missed " << fNMiss << " histograms" << endl;
00178    }
00179 }


Member Data Documentation

TH1* Anp::PlotShower::fCorOverDef [private]
 

Definition at line 54 of file PlotShower.h.

Referenced by Run(), and Set().

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

Definition at line 45 of file PlotShower.h.

Referenced by GetTH1(), and Set().

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

Definition at line 43 of file PlotShower.h.

Referenced by Config(), and Set().

TH1* Anp::PlotShower::fEnergyCCCor [private]
 

Definition at line 52 of file PlotShower.h.

Referenced by Run(), and Set().

TH1* Anp::PlotShower::fEnergyCCDef [private]
 

Definition at line 53 of file PlotShower.h.

Referenced by Run(), and Set().

TH1* Anp::PlotShower::fEnergyOverPot [private]
 

Definition at line 57 of file PlotShower.h.

Referenced by Run(), and Set().

int Anp::PlotShower::fNMiss [private]
 

Definition at line 48 of file PlotShower.h.

Referenced by Set().

TH1* Anp::PlotShower::fNuEHad1st [private]
 

Definition at line 60 of file PlotShower.h.

Referenced by Run(), and Set().

TH1* Anp::PlotShower::fNuEHad1stOverAll [private]
 

Definition at line 62 of file PlotShower.h.

Referenced by Run(), and Set().

TH1* Anp::PlotShower::fNuEHadAll [private]
 

Definition at line 59 of file PlotShower.h.

Referenced by Run(), and Set().

TH1* Anp::PlotShower::fNuEHadPrm [private]
 

Definition at line 61 of file PlotShower.h.

Referenced by Run(), and Set().

TH1* Anp::PlotShower::fNuEHadPrmOverAll [private]
 

Definition at line 63 of file PlotShower.h.

Referenced by Run(), and Set().

bool Anp::PlotShower::fPlot [private]
 

Definition at line 47 of file PlotShower.h.

Referenced by Run(), and Set().

double Anp::PlotShower::fPotBase [private]
 

Definition at line 50 of file PlotShower.h.

Referenced by Config(), and Run().

TH1* Anp::PlotShower::fSignalOverPot [private]
 

Definition at line 56 of file PlotShower.h.

Referenced by Run(), and Set().


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