Anp::PlotKinem Class Reference

#include <PlotKinem.h>

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

List of all members.

Public Member Functions

 PlotKinem ()
virtual ~PlotKinem ()
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::HistKinem > > 
PlotMap

Private Member Functions

bool Fill (const std::string &input, const RecoNu &rnu, double weight)
short GetBinX (const RecoNu &rnu) const
short GetBinQ2 (const RecoNu &rnu) const
TH2 * GetTH2 (const std::string &key, const std::string &name="")

Private Attributes

std::string fDirName
bool fPlot
int fNMiss
double fEHCut
TDirectory * fDir
PlotMap fMap
TH2 * fXvsQ2
TH2 * fEvsQ2
TH2 * fEvsX

Detailed Description

Definition at line 51 of file PlotKinem.h.


Member Typedef Documentation

typedef std::map<std::string, Anp::Handle<Anp::HistKinem> > Anp::PlotKinem::PlotMap [private]

Definition at line 79 of file PlotKinem.h.


Constructor & Destructor Documentation

Anp::PlotKinem::PlotKinem (  ) 

Definition at line 98 of file PlotKinem.cxx.

00099    :fDirName("kinem"),
00100     fPlot(false),
00101     fNMiss(0),
00102     fEHCut(0.15),
00103     fDir(0)
00104 {
00105 }

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

Definition at line 108 of file PlotKinem.cxx.

00109 {
00110 }


Member Function Documentation

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

Reimplemented from Anp::AlgEvent.

Definition at line 162 of file PlotKinem.cxx.

References fDirName, fEHCut, Registry::Get(), and Registry::KeyExists().

00163 {
00164    const char *value_char = 0;
00165    if(reg.Get("PlotKinemDirName", value_char) && value_char)
00166    {
00167       fDirName = value_char;
00168    }
00169 
00170    reg.Get("PlotKinemEHCut", fEHCut);
00171 
00172    if(reg.KeyExists("PrintConfig"))
00173    {
00174       cout << "PlotKinem::Config" << endl
00175            << "   EHCut = " << fEHCut << endl
00176            << "   DirName = " << fDirName << endl;
00177    }
00178 }

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

Reimplemented from Anp::AlgEvent.

Definition at line 204 of file PlotKinem.cxx.

References fDir, and fMap.

00205 {
00206    fMap.clear();
00207    fDir = 0;
00208 }

bool Anp::PlotKinem::Fill ( const std::string &  input,
const RecoNu rnu,
double  weight 
) [private]

Referenced by Run().

short Anp::PlotKinem::GetBinQ2 ( const RecoNu rnu  )  const [private]

Definition at line 258 of file PlotKinem.cxx.

References Anp::RecoNu::Q2().

Referenced by Run().

00259 {
00260    const double q2 = rnu.Q2();
00261 
00262    if     (q2 < 0.00) return -1;
00263    else if(q2 < 0.30) return  1;
00264    else if(q2 < 0.70) return  2;
00265    else if(q2 < 1.50) return  3;
00266    else if(q2 < 4.00) return  4;
00267 
00268    return 5;
00269 }

short Anp::PlotKinem::GetBinX ( const RecoNu rnu  )  const [private]

Definition at line 244 of file PlotKinem.cxx.

References Anp::RecoNu::X().

Referenced by Run().

00245 {
00246    const double x = rnu.X();
00247 
00248    if     (x < 0.0)  return -1;
00249    else if(x < 0.13) return  1;
00250    else if(x < 0.23) return  2;
00251    else if(x < 0.35) return  3;
00252    else if(x < 0.60) return  4;
00253 
00254    return 5;
00255 }

TH2 * Anp::PlotKinem::GetTH2 ( const std::string &  key,
const std::string &  name = "" 
) [private]

Definition at line 272 of file PlotKinem.cxx.

References Anp::HistMan::CreateTH2(), fDir, fNMiss, Anp::HistMan::Instance(), and Anp::SetDir().

Referenced by Set().

00273 {
00274    TH2 *h = HistMan::Instance().CreateTH2(key, "kinem");
00275    if(h)
00276    {
00277       Anp::SetDir(h, fDir, name);
00278    }
00279    else
00280    {
00281       ++fNMiss;
00282    }
00283 
00284    return h;
00285 }

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

Implements Anp::AlgEvent.

Definition at line 124 of file PlotKinem.cxx.

References Anp::RecoNu::EHad(), Anp::RecoNu::ELep(), Anp::RecoNu::ENeu(), Anp::RecoNu::EQES(), fEHCut, fEvsQ2, fEvsX, Fill(), fPlot, fXvsQ2, GetBinQ2(), GetBinX(), Anp::RecoNu::Q2(), Anp::RecoNu::SetEHad(), Anp::RecoNu::Weight(), and Anp::RecoNu::X().

00125 {
00126    if(!pass || !fPlot)
00127    {
00128       return true;
00129    }
00130    
00131    RecoNu rnu = event.GetNu();
00132    if(rnu.EHad() < fEHCut)
00133    {
00134       rnu.SetEHad(std::max<double>(0.0, rnu.EQES() - rnu.ELep()));
00135    }
00136 
00137    PlotKinem::Fill("all", rnu, rnu.Weight()); 
00138    
00139    fXvsQ2 -> Fill(rnu.Q2(), rnu.X(),    rnu.Weight());
00140    fEvsQ2 -> Fill(rnu.Q2(), rnu.ENeu(), rnu.Weight());
00141    fEvsX  -> Fill(rnu.X(),  rnu.ENeu(), rnu.Weight());
00142 
00143    const short bin_x  = PlotKinem::GetBinX (rnu);
00144    const short bin_q2 = PlotKinem::GetBinQ2(rnu);
00145 
00146    if(bin_x >= 0 && bin_q2 >= 0)
00147    {
00148       stringstream bname, xname, qname;
00149       bname << "bin_xq2_" << bin_x << "_" << bin_q2;
00150       xname << "bin_x_"   << bin_x;
00151       qname << "bin_q2_"  << bin_q2;
00152 
00153       PlotKinem::Fill(bname.str(), rnu, rnu.Weight()); 
00154       PlotKinem::Fill(xname.str(), rnu, rnu.Weight()); 
00155       PlotKinem::Fill(qname.str(), rnu, rnu.Weight()); 
00156    }
00157 
00158    return true;
00159 }

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

Implements Anp::AlgSnarl.

Definition at line 113 of file PlotKinem.cxx.

References Anp::Record::EventBegIterator(), and Anp::Record::EventEndIterator().

00114 {
00115    for(EventIterator ievent = record.EventBegIterator(); ievent != record.EventEndIterator(); ++ievent)
00116    {
00117       PlotKinem::Run(*ievent, record, true);
00118    }
00119 
00120    return true;
00121 }

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

Reimplemented from Anp::AlgEvent.

Definition at line 181 of file PlotKinem.cxx.

References fDir, fDirName, fEvsQ2, fEvsX, fNMiss, fPlot, fXvsQ2, Anp::GetDir(), and GetTH2().

00182 {
00183    fPlot = false;
00184 
00185    if(!dir) return;
00186 
00187    fDir = Anp::GetDir(fDirName, dir);
00188 
00189    fXvsQ2 = PlotKinem::GetTH2("x_vs_q2");
00190    fEvsQ2 = PlotKinem::GetTH2("e_vs_q2");
00191    fEvsX  = PlotKinem::GetTH2("e_vs_x");
00192 
00193    if(fNMiss == 0)
00194    {
00195       fPlot = true;
00196    }
00197    else
00198    {
00199       cerr << "PlotKinem::Make - missed " << fNMiss << " histograms" << endl;
00200    }
00201 }


Member Data Documentation

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

Definition at line 90 of file PlotKinem.h.

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

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

Definition at line 83 of file PlotKinem.h.

Referenced by Config(), and Set().

double Anp::PlotKinem::fEHCut [private]

Definition at line 88 of file PlotKinem.h.

Referenced by Config(), and Run().

TH2* Anp::PlotKinem::fEvsQ2 [private]

Definition at line 95 of file PlotKinem.h.

Referenced by Run(), and Set().

TH2* Anp::PlotKinem::fEvsX [private]

Definition at line 96 of file PlotKinem.h.

Referenced by Run(), and Set().

Definition at line 92 of file PlotKinem.h.

Referenced by End().

int Anp::PlotKinem::fNMiss [private]

Definition at line 86 of file PlotKinem.h.

Referenced by GetTH2(), and Set().

bool Anp::PlotKinem::fPlot [private]

Definition at line 85 of file PlotKinem.h.

Referenced by Run(), and Set().

TH2* Anp::PlotKinem::fXvsQ2 [private]

Definition at line 94 of file PlotKinem.h.

Referenced by Run(), and Set().


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

Generated on 19 Jan 2018 for loon by  doxygen 1.6.1