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

Public Member Functions | |
| PlotFlux () | |
| virtual | ~PlotFlux () |
| 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 &) |
| void | Plot (const FluxInfo &flux, double weight=1.0) |
Private Types | |
| typedef std::map< Particle::Particle_t, Anp::Handle< Anp::HistFlux > > | PlotMap |
Private Member Functions | |
| Handle< HistFlux > | GetPlot (const Particle::Particle_t particle) |
Private Attributes | |
| TDirectory * | fDir |
| std::string | fDirName |
| bool | fUseImp |
| bool | fUsePDG |
| int | fDetector |
| PlotMap | fMap |
|
|
Definition at line 97 of file PlotFlux.h. |
|
|
Definition at line 161 of file PlotFlux.cxx. 00162 :fDir(0), 00163 fDirName("flux"), 00164 fUseImp(false), 00165 fUsePDG(true), 00166 fDetector(0) 00167 { 00168 }
|
|
|
Definition at line 171 of file PlotFlux.cxx. 00172 {
00173 }
|
|
|
Reimplemented from Anp::AlgEvent. Definition at line 221 of file PlotFlux.cxx. References fDetector, fDirName, fUseImp, fUsePDG, Registry::Get(), Registry::KeyExists(), Anp::Read(), and reg. 00222 {
00223 const char *value_char = 0;
00224 if(reg.Get("PlotFluxDirName", value_char) && value_char)
00225 {
00226 fDirName = value_char;
00227 }
00228
00229 const char *value_detc = 0;
00230 if(reg.Get("PlotFluxDetector", value_detc) && value_detc)
00231 {
00232 if (std::strcmp(value_detc, "near") == 0) fDetector = 1;
00233 else if(std::strcmp(value_detc, "far") == 0) fDetector = 2;
00234 }
00235
00236 Anp::Read(reg, "PlotFluxUseImp", fUseImp);
00237 Anp::Read(reg, "PlotFluxUsePDG", fUsePDG);
00238
00239 if(reg.KeyExists("PrintConfig"))
00240 {
00241 cout << "PlotFlux::Config" << endl
00242 << " DirName = " << fDirName << endl
00243 << " UseImp = " << fUseImp << endl
00244 << " UsePDG = " << fUsePDG << endl
00245 << " Detector = " << fDetector;
00246 if(value_detc) cout << " = " << value_detc << endl;
00247 else cout << endl;
00248 }
00249 }
|
|
|
Reimplemented from Anp::AlgEvent. Definition at line 252 of file PlotFlux.cxx. 00253 {
00254 }
|
|
|
Definition at line 296 of file PlotFlux.cxx. References fDetector, fDir, fMap, fUseImp, and Anp::GetDir(). 00297 {
00298 if(!fDir)
00299 {
00300 return Handle<HistFlux>(0);
00301 }
00302
00303 PlotMap::iterator pit = fMap.find(particle);
00304 if(pit == fMap.end())
00305 {
00306 TDirectory *dir = fDir;
00307 if(particle != Particle::kAll)
00308 {
00309 Anp::Lock<Anp::Mutex> lock(Anp::GetMainMutex());
00310 dir = Anp::GetDir("dir_" + Particle::Name(particle), fDir);
00311 }
00312
00313 Handle<HistFlux> plot(new HistFlux());
00314 plot -> Make(dir);
00315 plot -> fUseImp = fUseImp;
00316 plot -> fDetector = fDetector;
00317
00318 pit = fMap.insert(PlotMap::value_type(particle, plot)).first;
00319 }
00320
00321 return pit -> second;
00322 }
|
|
||||||||||||
|
Definition at line 257 of file PlotFlux.cxx. References Particle::GeantParticle(), Particle::PDGParticle(), Anp::FluxInfo::tptype, and Anp::Handle< T >::valid(). 00258 {
00259 if(!fDir)
00260 {
00261 return;
00262 }
00263
00264 Handle<HistFlux> plot_all = PlotFlux::GetPlot(Particle::kAll);
00265 if(plot_all.valid())
00266 {
00267 plot_all -> Fill(flux, weight);
00268 }
00269
00270 Particle::Particle_t particle = Particle::kUnknown;
00271
00272 if(fUsePDG)
00273 {
00274 particle = Particle::PDGParticle(flux.tptype);
00275 }
00276 else
00277 {
00278 particle = Particle::GeantParticle(flux.tptype);
00279 }
00280
00281 if(particle == Particle::kPiPlus ||
00282 particle == Particle::kPiMinus ||
00283 particle == Particle::kKPlus ||
00284 particle == Particle::kKMinus ||
00285 particle == Particle::kProton)
00286 {
00287 Handle<HistFlux> plot_cur = PlotFlux::GetPlot(particle);
00288 if(plot_cur.valid())
00289 {
00290 plot_cur -> Fill(flux, weight);
00291 }
00292 }
00293 }
|
|
||||||||||||||||
|
Implements Anp::AlgEvent. Definition at line 187 of file PlotFlux.cxx. References Anp::Record::FindTruth(), Anp::Record::GetHeader(), Anp::Header::IsData(), Anp::Record::TruthEnd(), Anp::TruthIter, and Anp::Event::Weight(). 00188 {
00189 //
00190 // Plot truth records that match reconstructed events
00191 //
00192
00193 if(!pass || record.GetHeader().IsData())
00194 {
00195 return true;
00196 }
00197
00198 const TruthIter truth = record.FindTruth(event);
00199 if(truth == record.TruthEnd())
00200 {
00201 return true;
00202 }
00203
00204 PlotFlux::Plot(truth -> Flux(), event.Weight());
00205
00206 return true;
00207 }
|
|
|
Implements Anp::AlgSnarl. Definition at line 176 of file PlotFlux.cxx. References Anp::Record::TruthBeg(), Anp::Record::TruthEnd(), and Anp::TruthIter. 00177 {
00178 for(TruthIter itruth = record.TruthBeg(); itruth != record.TruthEnd(); ++itruth)
00179 {
00180 PlotFlux::Plot(itruth -> Flux(), itruth -> Weight());
00181 }
00182
00183 return true;
00184 }
|
|
|
Reimplemented from Anp::AlgEvent. Definition at line 210 of file PlotFlux.cxx. References fDir, fDirName, and Anp::GetDir(). 00211 {
00212 if(!dir)
00213 {
00214 return;
00215 }
00216
00217 fDir = Anp::GetDir(fDirName, dir);
00218 }
|
|
|
Definition at line 111 of file PlotFlux.h. |
|
|
Definition at line 105 of file PlotFlux.h. |
|
|
Definition at line 107 of file PlotFlux.h. |
|
|
Definition at line 113 of file PlotFlux.h. Referenced by GetPlot(). |
|
|
Definition at line 109 of file PlotFlux.h. |
|
|
Definition at line 110 of file PlotFlux.h. Referenced by Config(). |
1.3.9.1