Anp::PlotResol Class Reference

#include <PlotResol.h>

Inheritance diagram for Anp::PlotResol:
Anp::Base

List of all members.

Classes

struct  Hist

Public Member Functions

 PlotResol (TDirectory *dir)
virtual ~PlotResol ()
void Plot (const Event &event, const Truth &truth)

Private Types

typedef std::map< int, HistHistMap

Private Member Functions

void FillHist (short key, float rval, float tval)
TH1 * GetTH1 (const std::string &key, const std::string &name="")

Private Attributes

bool fPlot
int fNMiss
TDirectory * fDir
HistMap fHist
TH1 * fhDiffENeu
TH1 * fhDiffEQES
TH1 * fhDiffERES
TH1 * fhDiffELep
TH1 * fhDiffEHad
TH1 * fhReslENeu
TH1 * fhReslEQES
TH1 * fhReslERES
TH1 * fhReslELep
TH1 * fhReslEHad
TH1 * fhDiffQ2
TH1 * fhDiffX
TH1 * fhDiffY
TH1 * fhDiffW2
TH1 * fhReslQ2
TH1 * fhReslX
TH1 * fhReslY
TH1 * fhReslW2

Detailed Description

Definition at line 24 of file PlotResol.h.


Member Typedef Documentation

typedef std::map<int, Hist> Anp::PlotResol::HistMap [private]

Definition at line 43 of file PlotResol.h.


Constructor & Destructor Documentation

Anp::PlotResol::PlotResol ( TDirectory *  dir  )  [explicit]

Definition at line 21 of file PlotResol.cxx.

References fhDiffEHad, fhDiffELep, fhDiffENeu, fhDiffEQES, fhDiffERES, fhDiffQ2, fhDiffW2, fhDiffX, fhDiffY, fhReslEHad, fhReslELep, fhReslENeu, fhReslEQES, fhReslERES, fhReslQ2, fhReslW2, fhReslX, fhReslY, fNMiss, fPlot, and GetTH1().

00022    :fPlot(false),
00023     fNMiss(0),
00024     fDir(dir)
00025 {
00026    if(!dir)
00027    {
00028       return;
00029    }
00030 
00031    fhDiffENeu = PlotResol::GetTH1("diff_eneu");
00032    fhDiffEQES = PlotResol::GetTH1("diff_eqes");
00033    fhDiffERES = PlotResol::GetTH1("diff_eres");
00034    fhDiffELep = PlotResol::GetTH1("diff_elep");
00035    fhDiffEHad = PlotResol::GetTH1("diff_ehad");
00036 
00037    fhReslENeu = PlotResol::GetTH1("resl_eneu");
00038    fhReslEQES = PlotResol::GetTH1("resl_eqes");
00039    fhReslERES = PlotResol::GetTH1("resl_eres");
00040    fhReslELep = PlotResol::GetTH1("resl_elep");
00041    fhReslEHad = PlotResol::GetTH1("resl_ehad");
00042 
00043    fhDiffQ2 = PlotResol::GetTH1("diff_q2");
00044    fhDiffX  = PlotResol::GetTH1("diff_x");
00045    fhDiffY  = PlotResol::GetTH1("diff_y");
00046    fhDiffW2 = PlotResol::GetTH1("diff_w2");
00047    
00048    fhReslQ2 = PlotResol::GetTH1("resl_q2");
00049    fhReslX  = PlotResol::GetTH1("resl_x");
00050    fhReslY  = PlotResol::GetTH1("resl_y");
00051    fhReslW2 = PlotResol::GetTH1("resl_w2");
00052 
00053    if(fNMiss == 0)
00054    {
00055       fPlot = true;
00056    }
00057    else
00058    {
00059        cerr << "PlotResol ctor - missed " << fNMiss << " histograms" << endl;
00060    }
00061 }

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

Definition at line 64 of file PlotResol.cxx.

00065 {
00066 }


Member Function Documentation

void Anp::PlotResol::FillHist ( short  key,
float  rval,
float  tval 
) [private]

Definition at line 126 of file PlotResol.cxx.

References Anp::HistMan::CreateTH1(), fDir, fHist, Anp::PlotResol::Hist::hdiff, Anp::PlotResol::Hist::hresl, Anp::HistMan::Instance(), Munits::second, and Anp::SetDir().

Referenced by Plot().

00127 {
00128    //
00129    // Fill reco - true difference and diff/true histograms
00130    //
00131 
00132    HistMap::iterator hit = fHist.find(key);
00133    if(hit == fHist.end())
00134    {
00135       stringstream dname, rname;
00136       dname << "diff_" << std::setw(5) << std::setfill('0') << key;
00137       rname << "resl_" << std::setw(5) << std::setfill('0') << key;
00138 
00139       Hist hist;
00140 
00141       hist.hdiff = HistMan::Instance().CreateTH1("diff", "resol");
00142       hist.hresl = HistMan::Instance().CreateTH1("resl", "resol");
00143 
00144       Anp::SetDir(hist.hdiff, fDir, dname.str());
00145       Anp::SetDir(hist.hresl, fDir, rname.str());
00146       
00147       hit = fHist.insert(HistMap::value_type(key, hist)).first;
00148    }
00149 
00150    if(hit -> second.hdiff) hit -> second.hdiff -> Fill(rval - tval);
00151 
00152    if(tval > 0.0 || tval < 0.0)
00153    {
00154       if(hit -> second.hresl) hit -> second.hresl -> Fill((rval - tval)/tval);
00155    }
00156 }

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

Referenced by PlotResol().

void Anp::PlotResol::Plot ( const Event event,
const Truth truth 
)

Definition at line 69 of file PlotResol.cxx.

References Anp::Event::DataBeg(), Anp::Truth::EHad(), Anp::RecoNu::EHad(), Anp::RecoNu::ELep(), Anp::Truth::ELep(), Anp::Truth::ENeu(), Anp::RecoNu::ENeu(), Anp::RecoNu::EQES(), Anp::RecoNu::ERES(), fhDiffEHad, fhDiffELep, fhDiffENeu, fhDiffEQES, fhDiffERES, fhDiffQ2, fhDiffW2, fhDiffX, fhDiffY, fhReslEHad, fhReslELep, fhReslENeu, fhReslEQES, fhReslERES, fhReslQ2, fhReslW2, fhReslX, fhReslY, FillHist(), fPlot, Anp::RecoNu::Q2(), Anp::Truth::TrueQ2(), Anp::Truth::TrueW2(), Anp::Truth::TrueX(), Anp::Truth::TrueY(), Anp::RecoNu::W2(), Anp::RecoNu::Weight(), Anp::RecoNu::X(), and Anp::RecoNu::Y().

00070 {
00071    if(!fPlot)
00072    {
00073       return;
00074    }
00075 
00076    const RecoNu &rnu = event.GetNu();
00077 
00078    const double eneu_diff = rnu.ENeu() - truth.ENeu();
00079    const double eqes_diff = rnu.EQES() - truth.ENeu();
00080    const double eres_diff = rnu.ERES() - truth.ENeu();
00081    const double elep_diff = rnu.ELep() - truth.ELep();
00082    const double ehad_diff = rnu.EHad() - truth.EHad();
00083    const double weight    = rnu.Weight();
00084 
00085    fhDiffENeu -> Fill(eneu_diff, weight);
00086    fhDiffEQES -> Fill(eqes_diff, weight);
00087    fhDiffERES -> Fill(eres_diff, weight);
00088    fhDiffELep -> Fill(elep_diff, weight);
00089    fhDiffEHad -> Fill(ehad_diff, weight);
00090 
00091    if(truth.ENeu() > 0.0)
00092    {
00093       fhReslENeu -> Fill(eneu_diff/truth.ENeu(), weight);
00094       fhReslEQES -> Fill(eqes_diff/truth.ENeu(), weight);
00095       fhReslERES -> Fill(eres_diff/truth.ENeu(), weight);
00096    }
00097 
00098    if(truth.ELep() > 0.0) fhReslELep -> Fill(elep_diff/truth.ELep(), weight);
00099    if(truth.EHad() > 0.0) fhReslEHad -> Fill(ehad_diff/truth.EHad(), weight);
00100 
00101    const double diff_q2 = rnu.Q2() + truth.TrueQ2();
00102    const double diff_x  = rnu.X()  - truth.TrueX();
00103    const double diff_y  = rnu.Y()  - truth.TrueY();
00104    const double diff_w2 = rnu.W2() - truth.TrueW2();
00105 
00106    fhDiffQ2 -> Fill(diff_q2, weight);
00107    fhDiffX  -> Fill(diff_x,  weight);
00108    fhDiffY  -> Fill(diff_y,  weight);
00109    fhDiffW2 -> Fill(diff_w2, weight);
00110 
00111    if(truth.TrueQ2() < 0.0) fhReslQ2 -> Fill(-diff_q2/truth.TrueQ2(), weight);
00112    if(truth.TrueX()  > 0.0) fhReslX  -> Fill(+diff_x /truth.TrueX(),  weight);
00113    if(truth.TrueY()  > 0.0) fhReslY  -> Fill(+diff_y /truth.TrueY(),  weight);
00114    if(truth.TrueW2() > 0.0) fhReslW2 -> Fill(+diff_w2/truth.TrueW2(), weight);
00115 
00116    for(DataIter idata = event.DataBeg(); idata != event.DataEnd(); ++idata)
00117    {
00118       if(idata -> Key() > 0 && event.KeyExists(-idata -> Key()))
00119       {
00120          FillHist(idata -> Key(), idata -> Data(), event[-idata -> Key()]);
00121       }
00122    }   
00123 }


Member Data Documentation

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

Definition at line 56 of file PlotResol.h.

Referenced by FillHist().

Definition at line 64 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

Definition at line 63 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

Definition at line 60 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

Definition at line 61 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

Definition at line 62 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

TH1* Anp::PlotResol::fhDiffQ2 [private]

Definition at line 72 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

TH1* Anp::PlotResol::fhDiffW2 [private]

Definition at line 75 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

TH1* Anp::PlotResol::fhDiffX [private]

Definition at line 73 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

TH1* Anp::PlotResol::fhDiffY [private]

Definition at line 74 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

Definition at line 58 of file PlotResol.h.

Referenced by FillHist().

Definition at line 70 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

Definition at line 69 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

Definition at line 66 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

Definition at line 67 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

Definition at line 68 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

TH1* Anp::PlotResol::fhReslQ2 [private]

Definition at line 77 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

TH1* Anp::PlotResol::fhReslW2 [private]

Definition at line 80 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

TH1* Anp::PlotResol::fhReslX [private]

Definition at line 78 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

TH1* Anp::PlotResol::fhReslY [private]

Definition at line 79 of file PlotResol.h.

Referenced by Plot(), and PlotResol().

int Anp::PlotResol::fNMiss [private]

Definition at line 54 of file PlotResol.h.

Referenced by PlotResol().

bool Anp::PlotResol::fPlot [private]

Definition at line 53 of file PlotResol.h.

Referenced by Plot(), and PlotResol().


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

Generated on 3 Oct 2018 for loon by  doxygen 1.6.1