#include <PlotTruth.h>
Inheritance diagram for Anp::PlotTruth:

Public Member Functions | |
| PlotTruth () | |
| virtual | ~PlotTruth () |
| bool | Run (Record &record) |
| bool | Run (Event &event, const Record &record, bool pass) |
| void | Set (TDirectory *dir) |
| void | Config (const Registry ®) |
| void | End (const DataBlock &) |
Private Types | |
| typedef std::map< int, Handle< PlotReson > > | PlotMap |
Private Member Functions | |
| void | Plot (const Truth &truth, double weight=1.0) |
| int | CreateHist () |
| TH1 * | GetTH1 (const std::string &key, const std::string &name="") |
| Handle< PlotReson > | GetPlot (int ireson) |
Private Attributes | |
| TDirectory * | fDir |
| std::string | fDirName |
| bool | fPlot |
| bool | fPlotResn |
| int | fNMiss |
| Registry | fConfig |
| PlotMap | fPlotMap |
| TH1 * | fhAction |
| TH1 * | fhFlags |
| TH1 * | fhReson |
| TH1 * | fhTgtE |
| TH1 * | fhTgtP |
| TH1 * | fhNRecoEvent |
| TH1 * | fhNRecoTrack |
| TH1 * | fhEventPur |
| TH1 * | fhEventCom |
| TH1 * | fhTrackPur |
| TH1 * | fhTrackCom |
|
|
Definition at line 44 of file PlotTruth.h. |
|
|
Definition at line 29 of file PlotTruth.cxx. 00030 :fDir(0), 00031 fDirName("truth"), 00032 fPlot(false), 00033 fPlotResn(true), 00034 fNMiss(0) 00035 { 00036 }
|
|
|
Definition at line 39 of file PlotTruth.cxx. 00040 {
00041 }
|
|
|
Reimplemented from Anp::AlgEvent. Definition at line 153 of file PlotTruth.cxx. References fConfig, fDirName, fPlotResn, Registry::Get(), Registry::KeyExists(), Anp::Read(), and reg. Referenced by GetPlot(). 00154 {
00155 fConfig = reg;
00156
00157 const char *value_char = 0;
00158 if(reg.Get("PlotTruthDirName", value_char) && value_char)
00159 {
00160 fDirName = value_char;
00161 }
00162
00163 Anp::Read(reg, "PlotTruthResn", fPlotResn);
00164
00165 if(reg.KeyExists("PrintConfig"))
00166 {
00167 cout << "PlotTruth::Config" << endl
00168 << " DirName = " << fDirName << endl
00169 << " PlotResn = " << fPlotResn << endl;
00170 }
00171 }
|
|
|
|
|
|
Reimplemented from Anp::AlgEvent. Definition at line 174 of file PlotTruth.cxx. 00175 {
00176 }
|
|
|
Definition at line 259 of file PlotTruth.cxx. References Config(), fConfig, fPlotMap, and Anp::GetDir(). 00260 {
00261 if(!fDir)
00262 {
00263 return Handle<PlotReson>(0);
00264 }
00265
00266 PlotMap::iterator pit = fPlotMap.find(ireson);
00267 if(pit == fPlotMap.end())
00268 {
00269 stringstream rname;
00270 if (ireson == 0) rname << "nc";
00271 else if(ireson == 1) rname << "cc_numu";
00272 else if(ireson == 2) rname << "cc_numubar";
00273 else if(ireson > 0) rname << "reson_" << ireson;
00274
00275 TDirectory *dir = Anp::GetDir(rname.str(), fDir);
00276
00277 Handle<PlotReson> plot(new PlotReson(dir));
00278 plot -> Config(fConfig);
00279
00280 pit = fPlotMap.insert(PlotMap::value_type(ireson, plot)).first;
00281 }
00282
00283 return pit -> second;
00284 }
|
|
||||||||||||
|
Definition at line 243 of file PlotTruth.cxx. References fDir, and Anp::SetDir(). 00244 {
00245 TH1 *h = HistMan::Instance().CreateTH1(key, "truth");
00246 if(h)
00247 {
00248 Anp::SetDir(h, fDir, name);
00249 }
00250 else
00251 {
00252 ++fNMiss;
00253 }
00254
00255 return h;
00256 }
|
|
||||||||||||
|
Definition at line 179 of file PlotTruth.cxx. References fDir, fhAction, fhEventCom, fhEventPur, fhFlags, fhNRecoEvent, fhNRecoTrack, fhReson, fhTgtE, fhTgtP, fhTrackCom, fhTrackPur, Anp::Truth::Flags(), Anp::Truth::Interaction(), Anp::Truth::RecoBeg(), Anp::Truth::RecoEnd(), Anp::Truth::Resonance(), Anp::Truth::TgtE(), Anp::Truth::TgtP(), Anp::TruthRecoIter, and Anp::Handle< T >::valid(). Referenced by Run(). 00180 {
00181 if(!fDir || !fPlot)
00182 {
00183 return;
00184 }
00185
00186 fhAction -> Fill(truth.Interaction() + 0.5, weight);
00187 fhFlags -> Fill(truth.Flags() + 0.5, weight);
00188 fhReson -> Fill(truth.Resonance() + 0.5, weight);
00189 fhTgtE -> Fill(truth.TgtE(), weight);
00190 fhTgtP -> Fill(truth.TgtP(), weight);
00191
00192 unsigned int nevent = 0, ntrack = 0;
00193
00194 for(TruthRecoIter ireco = truth.RecoBeg(); ireco != truth.RecoEnd(); ++ireco)
00195 {
00196 if(ireco -> IsEvent())
00197 {
00198 ++nevent;
00199
00200 fhEventPur -> Fill(ireco -> Purity(), weight);
00201 fhEventCom -> Fill(ireco -> ComplAll(), weight);
00202 }
00203 else if(ireco -> IsTrack())
00204 {
00205 ++ntrack;
00206
00207 fhTrackPur -> Fill(ireco -> Purity(), weight);
00208 fhTrackCom -> Fill(ireco -> ComplAll(), weight);
00209 }
00210 else if(!ireco -> IsShower())
00211 {
00212 cerr << "PlotTruth::Plot - unknown reco type" << endl;
00213 }
00214 }
00215
00216 fhNRecoEvent -> Fill(nevent + 0.5, weight);
00217 fhNRecoTrack -> Fill(ntrack + 0.5, weight);
00218
00219 if(truth.Resonance() < 0)
00220 {
00221 cerr << "PlotTruth::Plot - unexpected resonance code: " << truth.Resonance() << endl;
00222 }
00223 else
00224 {
00225 Handle<PlotReson> plot = PlotTruth::GetPlot(-1);
00226 if(plot.valid())
00227 {
00228 plot -> Plot(truth, weight);
00229 }
00230 }
00231
00232 if(fPlotResn)
00233 {
00234 Handle<PlotReson> plot = PlotTruth::GetPlot(truth.Resonance());
00235 if(plot.valid())
00236 {
00237 plot -> Plot(truth, weight);
00238 }
00239 }
00240 }
|
|
||||||||||||||||
|
Implements Anp::AlgEvent. Definition at line 74 of file PlotTruth.cxx. References Anp::Record::FindTruth(), fPlot, Anp::Record::GetHeader(), Anp::Header::IsData(), Plot(), Anp::Record::TruthEnd(), Anp::TruthIter, Anp::Handle< T >::valid(), and Anp::Event::Weight(). 00075 {
00076 //
00077 // Plot truth records that match reconstructed events
00078 //
00079
00080 if(!pass || !fPlot || record.GetHeader().IsData())
00081 {
00082 return true;
00083 }
00084
00085 const TruthIter truth = record.FindTruth(event);
00086 if(truth == record.TruthEnd())
00087 {
00088 return true;
00089 }
00090
00091 PlotTruth::Plot(*truth, event.Weight());
00092
00093 if(truth -> Resonance() < 1)
00094 {
00095 cerr << "PlotTruth::Plot - unexpected resonance code: " << truth -> Resonance() << endl;
00096 return false;
00097 }
00098 else
00099 {
00100 Handle<PlotReson> plot = PlotTruth::GetPlot(-1);
00101 if(plot.valid())
00102 {
00103 plot -> Plot(event, *truth);
00104 }
00105 }
00106
00107 if(fPlotResn)
00108 {
00109 Handle<PlotReson> plot = PlotTruth::GetPlot(truth -> Resonance());
00110 if(plot.valid())
00111 {
00112 plot -> Plot(event, *truth);
00113 }
00114 }
00115
00116 return true;
00117 }
|
|
|
Implements Anp::AlgSnarl. Definition at line 44 of file PlotTruth.cxx. References Anp::Record::EventBegIterator(), Anp::Record::EventEndIterator(), Anp::EventIterator, Plot(), Anp::Record::TruthBegIterator(), Anp::Record::TruthEndIterator(), Anp::TruthIterator, and Anp::Handle< T >::valid(). 00045 {
00046 for(EventIterator ievent = record.EventBegIterator(); ievent != record.EventEndIterator(); ++ievent)
00047 {
00048 PlotTruth::Run(*ievent, record, true);
00049 }
00050
00051 for(TruthIterator itruth = record.TruthBegIterator(); itruth != record.TruthEndIterator(); ++itruth)
00052 {
00053 short ikey = 10;
00054
00055 if (itruth -> IsNC()) ikey = 0;
00056 else if(itruth -> Particle() == Particle::kNuM) ikey = 1;
00057 else if(itruth -> Particle() == Particle::kNuMBar) ikey = 2;
00058 else
00059 {
00060 continue;
00061 }
00062
00063 Handle<PlotReson> plot = PlotTruth::GetPlot(ikey);
00064 if(plot.valid())
00065 {
00066 plot -> Plot(*itruth, itruth -> Weight());
00067 }
00068 }
00069
00070 return true;
00071 }
|
|
|
Reimplemented from Anp::AlgEvent. Definition at line 120 of file PlotTruth.cxx. References fDir, fDirName, fhAction, fhEventCom, fhEventPur, fhFlags, fhNRecoEvent, fhNRecoTrack, fhReson, fhTgtE, fhTgtP, fhTrackCom, fhTrackPur, fNMiss, fPlot, and Anp::GetDir(). 00121 {
00122 if(!dir)
00123 {
00124 return;
00125 }
00126
00127 fDir = Anp::GetDir(fDirName, dir);
00128 fPlot = false;
00129
00130 fhAction = PlotTruth::GetTH1("action");
00131 fhFlags = PlotTruth::GetTH1("flags");
00132 fhReson = PlotTruth::GetTH1("reson");
00133 fhTgtE = PlotTruth::GetTH1("tgte");
00134 fhTgtP = PlotTruth::GetTH1("tgtp");
00135 fhNRecoEvent = PlotTruth::GetTH1("reco_nevent");
00136 fhNRecoTrack = PlotTruth::GetTH1("reco_ntrack");
00137 fhEventPur = PlotTruth::GetTH1("event_pur");
00138 fhEventCom = PlotTruth::GetTH1("event_com");
00139 fhTrackPur = PlotTruth::GetTH1("track_pur");
00140 fhTrackCom = PlotTruth::GetTH1("track_com");
00141
00142 if(fNMiss == 0)
00143 {
00144 fPlot = true;
00145 }
00146 else
00147 {
00148 cerr << "PlotTruth::Set - missed " << fNMiss << " histograms" << endl;
00149 }
00150 }
|
|
|
Definition at line 66 of file PlotTruth.h. |
|
|
Definition at line 58 of file PlotTruth.h. |
|
|
Definition at line 60 of file PlotTruth.h. |
|
|
Definition at line 70 of file PlotTruth.h. |
|
|
Definition at line 80 of file PlotTruth.h. |
|
|
Definition at line 79 of file PlotTruth.h. |
|
|
Definition at line 71 of file PlotTruth.h. |
|
|
Definition at line 76 of file PlotTruth.h. |
|
|
Definition at line 77 of file PlotTruth.h. |
|
|
Definition at line 72 of file PlotTruth.h. |
|
|
Definition at line 73 of file PlotTruth.h. |
|
|
Definition at line 74 of file PlotTruth.h. |
|
|
Definition at line 83 of file PlotTruth.h. |
|
|
Definition at line 82 of file PlotTruth.h. |
|
|
Definition at line 64 of file PlotTruth.h. Referenced by Set(). |
|
|
Definition at line 62 of file PlotTruth.h. |
|
|
Definition at line 68 of file PlotTruth.h. Referenced by GetPlot(). |
|
|
Definition at line 63 of file PlotTruth.h. Referenced by Config(). |
1.3.9.1