Anp::PlotEvent Class Reference

#include <PlotEvent.h>

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

List of all members.

Public Member Functions

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

void Plot (const RecoNu &reconu)
TH1 * GetTH1 (const std::string &key, const std::string &name="", const std::string &option="")

Private Attributes

std::string fDirName
std::string fSpcName1
std::string fSpcName2
TDirectory * fDir
bool fPlot
bool fUseQES
int fNMiss
double fEHCut
TH1 * fENeu
TH1 * fENeuSpec1
TH1 * fENeuSpec2
TH1 * fENeuAdd2
TH1 * fENeuExit
TH1 * fENeuBack
TH1 * fENeuSide
TH1 * fENeuStop
TH1 * fENeuZoom
TH1 * fEQES
TH1 * fERES
TH1 * fEHad
TH1 * fEHadZoom
TH1 * fPCur
TH1 * fPLep
TH1 * fPRan
TH1 * fPCurStop
TH1 * fPCurExit
TH1 * fPCurBack
TH1 * fPCurSide
TH1 * fPRanStop
TH1 * fAngN
TH1 * fCosN
TH1 * fRecoY
TH1 * fRecoX
TH1 * fRecoXZoom
TH1 * fRecoQ2
TH1 * fRecoQ2Zoom
TH1 * fRecoW2
TH1 * fRecoW2Zoom
TH1 * fNPass
TH1 * fNSign
TH1 * fNStop
TH1 * fNShower
TH1 * fNTrack
TH1 * fWeight
TH2 * fPLepVsAngN
TH2 * fPLepVsRecoQ2
TH1 * fTrackFracPulseH
TH1 * fTrackFracNStrip

Detailed Description

Definition at line 21 of file PlotEvent.h.


Constructor & Destructor Documentation

Anp::PlotEvent::PlotEvent (  ) 

Definition at line 31 of file PlotEvent.cxx.

00032    :fDirName("event"),
00033     fSpcName1("energy_spec"),
00034     fSpcName2("energy_spec2"),
00035     fDir(0),
00036     fPlot(true),
00037     fUseQES(false),
00038     fNMiss(0),
00039     fEHCut(0.15),
00040     fENeuSpec1(0),
00041     fENeuSpec2(0)
00042 {
00043 }

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

Definition at line 46 of file PlotEvent.cxx.

00047 {
00048 }


Member Function Documentation

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

Reimplemented from Anp::AlgEvent.

Definition at line 174 of file PlotEvent.cxx.

References fDirName, fEHCut, fSpcName1, fSpcName2, fUseQES, Registry::Get(), Registry::KeyExists(), and Anp::Read().

00175 {
00176    //
00177    // Read string configurations
00178    //
00179    Anp::Read(reg, "PlotEventSpecial",  fSpcName1);
00180    Anp::Read(reg, "PlotEventSpecial2", fSpcName2);
00181    Anp::Read(reg, "PlotEventDirName",  fDirName);
00182 
00183    //
00184    // Read other configurations
00185    //
00186    Anp::Read(reg, "PlotEventUseQES", fUseQES);
00187    
00188    reg.Get("PlotEventEHCut", fEHCut);
00189 
00190    if(reg.KeyExists("PrintConfig"))
00191    {
00192       cout << "PlotEvent::Config" << endl
00193            << "   DirName = " << fDirName << endl
00194            << "   SpcName1 = " << fSpcName1 << endl
00195            << "   SpcName2 = " << fSpcName2 << endl
00196            << "   EHCut = " << fEHCut << endl
00197            << "   UseQES = " << fUseQES << endl;
00198    }
00199 }

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

Referenced by Set().

void Anp::PlotEvent::Plot ( const RecoNu reconu  )  [private]

Definition at line 202 of file PlotEvent.cxx.

References Anp::angle(), Anp::RecoNu::CosN(), Anp::RecoNu::EHad(), Anp::RecoNu::ENeu(), Anp::RecoNu::EQES(), Anp::RecoNu::ERES(), Anp::RecoNu::ExitBack(), Anp::RecoNu::ExitSide(), fAngN, fCosN, fDir, fEHad, fEHadZoom, fEHCut, fENeu, fENeuAdd2, fENeuBack, fENeuExit, fENeuSide, fENeuSpec1, fENeuSpec2, fENeuStop, fENeuZoom, fEQES, fERES, fNPass, fNSign, fNStop, fPCur, fPCurBack, fPCurExit, fPCurSide, fPCurStop, fPLep, fPLepVsAngN, fPLepVsRecoQ2, fPlot, fPRan, fPRanStop, fRecoQ2, fRecoQ2Zoom, fRecoW2, fRecoW2Zoom, fRecoX, fRecoXZoom, fRecoY, fWeight, Anp::RecoNu::Pass(), Anp::RecoNu::PCur(), Anp::RecoNu::PLep(), Anp::RecoNu::PRan(), Anp::RecoNu::Q2(), Anp::RecoNu::Sign(), Anp::RecoNu::Stop(), Anp::RecoNu::W2(), Anp::RecoNu::Weight(), Anp::RecoNu::X(), and Anp::RecoNu::Y().

Referenced by Run().

00203 { 
00204    if(!fDir || !fPlot)
00205    {
00206       return;
00207    }
00208 
00209    const float energy = rnu.ENeu();
00210    const float recoq2 = rnu.Q2();
00211    const float recow2 = rnu.W2();
00212    const float reco_y = rnu.Y();
00213    const float weight = rnu.Weight();
00214 
00215    fENeu -> Fill(energy,     weight);
00216    fEQES -> Fill(rnu.EQES(), weight);
00217    fERES -> Fill(rnu.ERES(), weight);
00218    fEHad -> Fill(rnu.EHad(), weight);
00219    fPCur -> Fill(rnu.PCur(), weight);
00220    fPLep -> Fill(rnu.PLep(), weight);
00221    fPRan -> Fill(rnu.PRan(), weight);
00222    fCosN -> Fill(rnu.CosN(), weight);
00223 
00224    if(rnu.EHad() > fEHCut) fENeuAdd2 -> Fill(energy,     weight);
00225    else                    fENeuAdd2 -> Fill(rnu.EQES(), weight);
00226 
00227    fENeuZoom -> Fill(energy,     weight);
00228    fEHadZoom -> Fill(rnu.EHad(), weight);
00229 
00230    if(fENeuSpec1)
00231    {
00232       fENeuSpec1 -> Fill(energy, weight);
00233    }
00234    if(fENeuSpec2)
00235    {
00236       fENeuSpec2 -> Fill(energy, weight);
00237    }
00238 
00239    if(!(rnu.CosN() < -1.0) && !(rnu.CosN() > +1.0))
00240    {
00241       const double angle = std::acos(rnu.CosN());
00242       fAngN       -> Fill(angle, weight);
00243       fPLepVsAngN -> Fill(angle, rnu.PLep(), weight);
00244    }
00245 
00246    if(rnu.Stop())
00247    {
00248       fENeuStop -> Fill(energy,     weight);
00249       fPRanStop -> Fill(rnu.PRan(), weight);
00250       fPCurStop -> Fill(rnu.PCur(), weight);
00251    }
00252    else
00253    {
00254       fENeuExit -> Fill(energy,     weight);
00255       fPCurExit -> Fill(rnu.PCur(), weight);
00256       
00257       if(rnu.ExitBack())
00258       {
00259          fENeuBack -> Fill(energy,     weight);
00260          fPCurBack -> Fill(rnu.PCur(), weight);
00261       }
00262       else if(rnu.ExitSide())
00263       {
00264          fENeuSide -> Fill(energy,     weight);
00265          fPCurSide -> Fill(rnu.PCur(), weight);
00266       }
00267    }
00268 
00269    if(rnu.EHad() > 0.0)
00270    {
00271       const float recox = rnu.X();
00272       fRecoX     -> Fill(recox, weight);
00273       fRecoXZoom -> Fill(recox, weight);
00274    }
00275 
00276    fRecoY      -> Fill(reco_y, weight);
00277    fRecoQ2     -> Fill(recoq2, weight);
00278    fRecoQ2Zoom -> Fill(recoq2, weight);
00279    fRecoW2     -> Fill(recow2, weight);
00280    fRecoW2Zoom -> Fill(recow2, weight);
00281 
00282    fNPass  -> Fill(static_cast<double>(rnu.Pass()), weight);
00283    fNSign  -> Fill(static_cast<double>(rnu.Sign()), weight);
00284    fNStop  -> Fill(static_cast<double>(rnu.Stop()), weight);
00285    fWeight -> Fill(weight);
00286 
00287    fPLepVsRecoQ2 -> Fill(recoq2, rnu.PLep(), weight);
00288 }

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

Implements Anp::AlgEvent.

Definition at line 62 of file PlotEvent.cxx.

References Anp::RecoNu::EHad(), Anp::RecoNu::ELep(), Anp::RecoNu::EQES(), fDir, fEHCut, fNShower, fNTrack, fPlot, fTrackFracNStrip, fTrackFracPulseH, fUseQES, Anp::Event::GetNShowers(), Anp::Event::GetNTracks(), Anp::LongestTrack(), Plot(), Anp::RecoNu::SetEHad(), and Anp::Record::TrackEnd().

00063 { 
00064    if(!fDir || !pass || !fPlot)
00065    {
00066       return true;
00067    }
00068    
00069    RecoNu rnu = event.GetNu();
00070    if(fUseQES && rnu.EHad() < fEHCut)
00071    {
00072       rnu.SetEHad(std::max<double>(0.0, rnu.EQES() - rnu.ELep()));
00073    }
00074 
00075    PlotEvent::Plot(rnu);
00076 
00077    const float weight = event.Weight();
00078 
00079    fNShower -> Fill(event.GetNShowers() + 0.5, weight);
00080    fNTrack  -> Fill(event.GetNTracks()  + 0.5, weight);
00081 
00082    //
00083    // Locally computed variables
00084    //
00085    const TrackIter itrack = Anp::LongestTrack(event, record);
00086    if(itrack != record.TrackEnd())
00087    {
00088       const double sigcor = event.GetBasic().SigCor();
00089       const double nstrip = event.GetBasic().NStrip();
00090 
00091       if(sigcor > 0.0) fTrackFracPulseH -> Fill(itrack -> GetBasic().SigCor()/sigcor, weight);
00092       if(nstrip > 0.0) fTrackFracNStrip -> Fill(itrack -> GetBasic().NStrip()/nstrip, weight);
00093    }
00094 
00095    return true;
00096 }

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

Implements Anp::AlgSnarl.

Definition at line 51 of file PlotEvent.cxx.

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

00052 { 
00053    for(EventIterator event = record.EventBegIterator(); event != record.EventEndIterator(); ++event)
00054    {
00055       PlotEvent::Run(*event, record, true);
00056    }
00057 
00058    return true;
00059 }

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

Reimplemented from Anp::AlgEvent.

Definition at line 99 of file PlotEvent.cxx.

References fAngN, fCosN, fDir, fDirName, fEHad, fEHadZoom, fENeu, fENeuAdd2, fENeuBack, fENeuExit, fENeuSide, fENeuSpec1, fENeuSpec2, fENeuStop, fENeuZoom, fEQES, fERES, fNMiss, fNPass, fNShower, fNSign, fNStop, fNTrack, fPCur, fPCurBack, fPCurExit, fPCurSide, fPCurStop, fPLep, fPLepVsAngN, fPLepVsRecoQ2, fPlot, fPRan, fPRanStop, fRecoQ2, fRecoQ2Zoom, fRecoW2, fRecoW2Zoom, fRecoX, fRecoXZoom, fRecoY, fSpcName1, fSpcName2, fTrackFracNStrip, fTrackFracPulseH, fWeight, Anp::GetDir(), GetTH1(), and Anp::MakeTH2().

00100 {
00101    fPlot = false;
00102 
00103    if(!dir)
00104    {
00105       return;
00106    }
00107    
00108    fDir = Anp::GetDir(fDirName, dir);
00109 
00110    fENeu       = PlotEvent::GetTH1("energy",   "eneu");
00111    fENeuAdd2   = PlotEvent::GetTH1("energy",   "eneu_add2");
00112    fENeuExit   = PlotEvent::GetTH1("energy",   "eneu_exit");
00113    fENeuBack   = PlotEvent::GetTH1("energy",   "eneu_exit_back");
00114    fENeuSide   = PlotEvent::GetTH1("ezoom",    "eneu_exit_side");
00115    fENeuStop   = PlotEvent::GetTH1("ezoom",    "eneu_stop");
00116    fENeuZoom   = PlotEvent::GetTH1("ezoom",    "eneu_zoom");
00117    fEQES       = PlotEvent::GetTH1("ezoom",    "eneu_qes");
00118    fERES       = PlotEvent::GetTH1("ezoom",    "eneu_res");
00119    fEHad       = PlotEvent::GetTH1("ehad",     "ehad");
00120    fEHadZoom   = PlotEvent::GetTH1("ehadz",    "ehadz");
00121    fPCur       = PlotEvent::GetTH1("pcur",     "pcur");
00122    fPLep       = PlotEvent::GetTH1("plep",     "plep");
00123    fPRan       = PlotEvent::GetTH1("pran",     "pran");
00124    fPCurStop   = PlotEvent::GetTH1("pcur",     "pcur_stop");
00125    fPCurExit   = PlotEvent::GetTH1("pcur",     "pcur_exit");
00126    fPCurBack   = PlotEvent::GetTH1("pcur",     "pcur_exit_back");
00127    fPCurSide   = PlotEvent::GetTH1("pcur",     "pcur_exit_side");
00128    fPRanStop   = PlotEvent::GetTH1("pran",     "pran_stop");
00129    fCosN       = PlotEvent::GetTH1("cosn",     "vtx_cosn");
00130    fAngN       = PlotEvent::GetTH1("angn",     "vtx_angn");
00131    fRecoY      = PlotEvent::GetTH1("reco_y",   "reco_y");
00132    fRecoX      = PlotEvent::GetTH1("reco_x",   "reco_x");
00133    fRecoXZoom  = PlotEvent::GetTH1("reco_xz",  "reco_xz");
00134    fRecoQ2     = PlotEvent::GetTH1("reco_q2",  "reco_q2");
00135    fRecoQ2Zoom = PlotEvent::GetTH1("reco_q2z", "reco_q2z");
00136    fRecoW2     = PlotEvent::GetTH1("reco_w2",  "reco_w2");
00137    fRecoW2Zoom = PlotEvent::GetTH1("reco_w2z", "reco_w2z");
00138    fNPass      = PlotEvent::GetTH1("npass");
00139    fNSign      = PlotEvent::GetTH1("nsign");
00140    fNStop      = PlotEvent::GetTH1("nstop");
00141    fNShower    = PlotEvent::GetTH1("nshower");
00142    fNTrack     = PlotEvent::GetTH1("ntrack");
00143    fWeight     = PlotEvent::GetTH1("weight"); 
00144 
00145    if(!fSpcName1.empty())
00146    {
00147       fENeuSpec1 = PlotEvent::GetTH1(fSpcName1, "eneu_spec");
00148    }
00149    if(!fSpcName2.empty())
00150    {
00151       fENeuSpec2 = PlotEvent::GetTH1(fSpcName2, "eneu_spec2");
00152    }
00153 
00154    fPLepVsAngN   = Anp::MakeTH2("event", fDir, "plep_vs_angn");
00155    fPLepVsRecoQ2 = Anp::MakeTH2("event", fDir, "plep_vs_recoq2");
00156 
00157    if(!fPLepVsAngN)   ++fNMiss; 
00158    if(!fPLepVsRecoQ2) ++fNMiss; 
00159 
00160    fTrackFracPulseH = PlotEvent::GetTH1("track_frac_pulseh"); 
00161    fTrackFracNStrip = PlotEvent::GetTH1("track_frac_nstrip"); 
00162    
00163    if(fNMiss == 0)
00164    {
00165       fPlot = true;
00166    }
00167    else
00168    {
00169       cerr << "PlotEvent::Set - missed " << fNMiss << " histograms" << endl;
00170    }
00171 }


Member Data Documentation

TH1* Anp::PlotEvent::fAngN [private]

Definition at line 77 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fCosN [private]

Definition at line 78 of file PlotEvent.h.

Referenced by Plot(), and Set().

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

Definition at line 49 of file PlotEvent.h.

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

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

Definition at line 45 of file PlotEvent.h.

Referenced by Config(), and Set().

TH1* Anp::PlotEvent::fEHad [private]

Definition at line 67 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fEHadZoom [private]

Definition at line 68 of file PlotEvent.h.

Referenced by Plot(), and Set().

double Anp::PlotEvent::fEHCut [private]

Definition at line 54 of file PlotEvent.h.

Referenced by Config(), Plot(), and Run().

TH1* Anp::PlotEvent::fENeu [private]

Definition at line 56 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fENeuAdd2 [private]

Definition at line 59 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fENeuBack [private]

Definition at line 61 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fENeuExit [private]

Definition at line 60 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fENeuSide [private]

Definition at line 62 of file PlotEvent.h.

Referenced by Plot(), and Set().

Definition at line 57 of file PlotEvent.h.

Referenced by Plot(), and Set().

Definition at line 58 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fENeuStop [private]

Definition at line 63 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fENeuZoom [private]

Definition at line 64 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fEQES [private]

Definition at line 65 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fERES [private]

Definition at line 66 of file PlotEvent.h.

Referenced by Plot(), and Set().

int Anp::PlotEvent::fNMiss [private]

Definition at line 53 of file PlotEvent.h.

Referenced by Set().

TH1* Anp::PlotEvent::fNPass [private]

Definition at line 86 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fNShower [private]

Definition at line 89 of file PlotEvent.h.

Referenced by Run(), and Set().

TH1* Anp::PlotEvent::fNSign [private]

Definition at line 87 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fNStop [private]

Definition at line 88 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fNTrack [private]

Definition at line 90 of file PlotEvent.h.

Referenced by Run(), and Set().

TH1* Anp::PlotEvent::fPCur [private]

Definition at line 69 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fPCurBack [private]

Definition at line 74 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fPCurExit [private]

Definition at line 73 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fPCurSide [private]

Definition at line 75 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fPCurStop [private]

Definition at line 72 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fPLep [private]

Definition at line 70 of file PlotEvent.h.

Referenced by Plot(), and Set().

Definition at line 92 of file PlotEvent.h.

Referenced by Plot(), and Set().

Definition at line 93 of file PlotEvent.h.

Referenced by Plot(), and Set().

bool Anp::PlotEvent::fPlot [private]

Definition at line 51 of file PlotEvent.h.

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

TH1* Anp::PlotEvent::fPRan [private]

Definition at line 71 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fPRanStop [private]

Definition at line 76 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fRecoQ2 [private]

Definition at line 82 of file PlotEvent.h.

Referenced by Plot(), and Set().

Definition at line 83 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fRecoW2 [private]

Definition at line 84 of file PlotEvent.h.

Referenced by Plot(), and Set().

Definition at line 85 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fRecoX [private]

Definition at line 80 of file PlotEvent.h.

Referenced by Plot(), and Set().

Definition at line 81 of file PlotEvent.h.

Referenced by Plot(), and Set().

TH1* Anp::PlotEvent::fRecoY [private]

Definition at line 79 of file PlotEvent.h.

Referenced by Plot(), and Set().

std::string Anp::PlotEvent::fSpcName1 [private]

Definition at line 46 of file PlotEvent.h.

Referenced by Config(), and Set().

std::string Anp::PlotEvent::fSpcName2 [private]

Definition at line 47 of file PlotEvent.h.

Referenced by Config(), and Set().

Definition at line 99 of file PlotEvent.h.

Referenced by Run(), and Set().

Definition at line 98 of file PlotEvent.h.

Referenced by Run(), and Set().

bool Anp::PlotEvent::fUseQES [private]

Definition at line 52 of file PlotEvent.h.

Referenced by Config(), and Run().

TH1* Anp::PlotEvent::fWeight [private]

Definition at line 91 of file PlotEvent.h.

Referenced by Plot(), and Set().


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

Generated on 18 Oct 2018 for loon by  doxygen 1.6.1