Public Member Functions | Private Member Functions | Private Attributes | List of all members
evd::SimulationDrawer Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/EventDisplay/SimulationDrawer.h"

Public Member Functions

 SimulationDrawer ()
 
 ~SimulationDrawer ()
 
void MCTruthShortText (const art::Event &evt, evdb::View2D *view)
 
void MCTruthLongText (const art::Event &evt, evdb::View2D *view)
 
void MCTruthVertices2D (const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
 
void MCTruthVertices3D (const art::Event &evt, evdb::View3D *view)
 
void MCTruthVectors2D (const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
 
void MCTruthVectors3D (const art::Event &evt, evdb::View3D *view)
 
void MCTruthTrajectories2D (const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
 
void MCTruthTrajectories3D (const art::Event &evt, evdb::View3D *view)
 
void FLSHit2D (const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
 
void FLSHit3D (const art::Event &evt, evdb::View3D *xzview)
 
void HiLite (int trkId, bool hlt=true)
 
void GetLimits (const art::Event *evt, double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax, const std::set< geo::OfflineChan > &hmap={})
 
void GetTimeLimits (const art::Event *evt, double &tmin, double &tmax)
 

Private Member Functions

int GetMCTruth (const art::Event &evt, std::vector< simb::MCTruth > &mctruth)
 
int GetFLSHits (const art::Event &evt, const char *which, std::vector< sim::FLSHitList > &flshits)
 
int GetVertexPoints (const art::Event &evt, std::vector< double > &x, std::vector< double > &y, std::vector< double > &z)
 
std::string ShortInteractionSuffix (int iType) const
 
void PrintParticleAndOffspring (std::stringstream &ss, const sim::Particle *part, std::string prefix, int depth) const
 Helper function for MCTruthLongText. More...
 
void MCTruthTrajectoriesAnyD (const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview, evdb::View3D *view3D)
 Helper function for MCTruthTrajectories[2|3]D. More...
 

Private Attributes

std::map< int, bool > fHighlite
 

Detailed Description

Definition at line 28 of file SimulationDrawer.h.

Constructor & Destructor Documentation

evd::SimulationDrawer::SimulationDrawer ( )

Definition at line 56 of file SimulationDrawer.cxx.

57  {
58  }
evd::SimulationDrawer::~SimulationDrawer ( )

Definition at line 62 of file SimulationDrawer.cxx.

63  {
64  }

Member Function Documentation

void evd::SimulationDrawer::FLSHit2D ( const art::Event evt,
evdb::View2D xzview,
evdb::View2D yzview 
)

Definition at line 557 of file SimulationDrawer.cxx.

References evdb::View2D::AddMarker(), evdb::View2D::AddPolyLine(), evdb::View2D::AddPolyMarker(), plot_validation_datamc::c, evd::Style::ColorFromPDG(), evd::SimulationDrawingOptions::fDraw, evd::SimulationDrawingOptions::fFLSHitListModules, evd::SimulationDrawingOptions::fFLSHitStyle, evd::SimulationDrawingOptions::fFLSHitThresh, fHighlite, evd::Style::FromPDG(), sim::FLSHit::GetCellID(), sim::FLSHit::GetEdep(), GetFLSHits(), sim::FLSHit::GetNPoints(), sim::FLSHit::GetPDG(), sim::FLSHit::GetPlaneID(), sim::FLSHit::GetTrackID(), sim::FLSHit::GetX(), sim::FLSHit::GetXAverage(), sim::FLSHit::GetY(), sim::FLSHit::GetYAverage(), sim::FLSHit::GetZ(), sim::FLSHit::GetZAverage(), MECModelEnuComparisons::i, calib::j, evd::SimulationDrawingOptions::kDRAW_HITS, evd::SimulationDrawingOptions::kFLSHIT_AS_LINE, submit_hadd::l, geo::GeometryBase::Plane(), and POTSpillRate::view.

Referenced by evd::TZProjPad::Draw().

560  {
562  if ( (drawopt->fDraw &
564  return;
565  }
566 
568 
569  // Otherwise, unpack and show the FLS hits
570  for (unsigned int imod=0; imod<drawopt->fFLSHitListModules.size(); ++imod) {
571  const char* which = drawopt->fFLSHitListModules[imod].c_str();
572 
573  std::vector<sim::FLSHitList> flshits;
574  this->GetFLSHits(evt, which, flshits);
575 
576  // Indexed by color
577  std::map<int, TPolyMarker*> pms_x, pms_y;
578  evd::Style style;
579 
580  for (unsigned int i=0; i<flshits.size(); ++i) {
581  for (unsigned int j=0; j<flshits[i].fHits.size(); ++j) {
582  const sim::FLSHit& hit = flshits[i].fHits[j];
583  if (hit.GetEdep()<0.001*drawopt->fFLSHitThresh) continue;
584 
585  switch (drawopt->fFLSHitStyle) {
587  for(int view = 0; view < 2; ++view){
588  evdb::View2D* v2d = (view == 0) ? xzview : yzview;
589  if(!v2d) continue;
590 
591  // Dummy styling, overridden in next line
592  TPolyLine& l = v2d->AddPolyLine(hit.GetNPoints(), kBlack, 0, kSolid);
593  style.FromPDG(&l, hit.GetPDG());
594  for(int i = 0; i < hit.GetNPoints(); ++i){
595  double xyzloc[3] = {hit.GetX(i), hit.GetY(i), hit.GetZ(i)};
596  double xyzwor[3];
597  geo->Plane(hit.GetPlaneID())->Cell(hit.GetCellID())->LocalToWorld(xyzloc, xyzwor);
598  l.SetPoint(i, xyzwor[2], xyzwor[view]);
599  }
600  }
601  break;
602  default:
603  double xyzloc[3] = {hit.GetXAverage(), hit.GetYAverage(), hit.GetZAverage()};
604  double xyzwor[3];
605  geo->Plane(hit.GetPlaneID())->Cell(hit.GetCellID())->LocalToWorld(xyzloc, xyzwor);
606 
607  const int c = style.ColorFromPDG(hit.GetPDG());
608  const double sz = 0.5;
609 
610  if(xzview){
611  TPolyMarker* pm = pms_x[c];
612  if(!pm){
613  pm = &xzview->AddPolyMarker(0, c, kFullDotMedium, sz);
614  pms_x[c] = pm;
615  }
616  pm->SetNextPoint(xyzwor[2], xyzwor[0]);
617  }
618  if(yzview){
619  TPolyMarker* pm = pms_y[c];
620  if(!pm){
621  pm = &yzview->AddPolyMarker(0, c, kFullDotMedium, sz);
622  pms_y[c] = pm;
623  }
624  pm->SetNextPoint(xyzwor[2], xyzwor[1]);
625  }
626 
627  if(fHighlite[hit.GetTrackID()]){
628  if(xzview) xzview->AddMarker(xyzwor[2],xyzwor[0],c,kOpenCircle,sz);
629  if(yzview) yzview->AddMarker(xyzwor[2],xyzwor[1],c,kOpenCircle,sz);
630  }
631 
632  } // FLSHit style
633  } // loop on j hits in list
634  } // loop on i hit lists
635  } // loop o imod folders
636 }
int fDraw
Which MC Truth objects to draw.
int GetPlaneID() const
Plane ID.
Definition: FLSHit.h:37
TPolyLine & AddPolyLine(int n, int c, int w, int s)
Definition: View2D.cxx:210
int GetCellID() const
Cell ID.
Definition: FLSHit.h:39
int GetNPoints() const
Number of end points in FLSHit (could be Geant end points)
Definition: FLSHit.h:61
A single unit of energy deposition in the liquid scintillator.
Definition: FLSHit.h:19
int fFLSHitStyle
How to render FLS hits.
const PlaneGeo * Plane(unsigned int i) const
void FromPDG(TAttLine *line, int pdgcode)
Definition: Style.cxx:127
int GetPDG() const
PDG.
Definition: FLSHit.h:43
float GetY(const int ipoint) const
Definition: FLSHit.h:91
float GetXAverage(const int step) const
Get X-average for the step. This is in local coordinates.
Definition: FLSHit.h:76
TPolyMarker & AddPolyMarker(int n, int c, int st, double sz)
Definition: View2D.cxx:157
int ColorFromPDG(int pdgcode)
Definition: Style.cxx:98
const double j
Definition: BetheBloch.cxx:29
float fFLSHitThresh
Threshold to apply to FLS hits (MeV)
int GetTrackID() const
Track ID.
Definition: FLSHit.h:45
float GetZ(const int ipoint) const
Definition: FLSHit.h:92
Definition: structs.h:12
float GetEdep() const
Get total Energy deposited into the cell for the whole FLSHit.
Definition: FLSHit.h:31
std::vector< std::string > fFLSHitListModules
FLSHitLists here.
float GetZAverage(const int step) const
Get Z-average for the step. This is in local coordinates.
Definition: FLSHit.h:80
float GetYAverage(const int step) const
Get Y-average for the step. This is in local coordinates.
Definition: FLSHit.h:78
float GetX(const int ipoint) const
Get a point of the particle in the FLSHit (position, time and energy)
Definition: FLSHit.h:90
Helper for AttenCurve.
Definition: Path.h:10
TMarker & AddMarker(double x, double y, int c, int st, double sz)
Definition: View2D.cxx:124
int GetFLSHits(const art::Event &evt, const char *which, std::vector< sim::FLSHitList > &flshits)
std::map< int, bool > fHighlite
void evd::SimulationDrawer::FLSHit3D ( const art::Event evt,
evdb::View3D xzview 
)

Definition at line 640 of file SimulationDrawer.cxx.

References evdb::View3D::AddPolyMarker3D(), plot_validation_datamc::c, evd::Style::ColorFromPDG(), evd::SimulationDrawingOptions::fDraw, evd::SimulationDrawingOptions::fFLSHitListModules, evd::SimulationDrawingOptions::fFLSHitThresh, fHighlite, sim::FLSHit::GetCellID(), sim::FLSHit::GetEdep(), sim::FLSHit::GetEntryX(), sim::FLSHit::GetEntryY(), sim::FLSHit::GetEntryZ(), sim::FLSHit::GetExitX(), sim::FLSHit::GetExitY(), sim::FLSHit::GetExitZ(), GetFLSHits(), sim::FLSHit::GetPDG(), sim::FLSHit::GetPlaneID(), sim::FLSHit::GetTrackID(), MECModelEnuComparisons::i, calib::j, evd::SimulationDrawingOptions::kDRAW_HITS, and geo::GeometryBase::Plane().

Referenced by evd::Display3DPad::Draw().

642  {
644  if ( (drawopt->fDraw &
646  return;
647  }
648 
650 
651  evd::Style style;
652 
653  // Otherwise, unpack and show the FLS hits
654  for (unsigned int imod=0; imod<drawopt->fFLSHitListModules.size(); ++imod) {
655  const char* which = drawopt->fFLSHitListModules[imod].c_str();
656 
657  std::vector<sim::FLSHitList> flshits;
658  this->GetFLSHits(evt, which, flshits);
659  for (unsigned int i=0; i<flshits.size(); ++i) {
660  for (unsigned int j=0; j<flshits[i].fHits.size(); ++j) {
661  const sim::FLSHit& hit = flshits[i].fHits[j];
662 
663  if (hit.GetEdep()<0.001*drawopt->fFLSHitThresh) continue;
664 
665  double xyzloc[3]; // Local cell xyz coordinates
666  double xyzwor[3]; // World coordinates
667  xyzloc[0] = 0.5*(hit.GetEntryX() + hit.GetExitX());
668  xyzloc[1] = 0.5*(hit.GetEntryY() + hit.GetExitY());
669  xyzloc[2] = 0.5*(hit.GetEntryZ() + hit.GetExitZ());
670 
671  geo->Plane(hit.GetPlaneID())->Cell(hit.GetCellID())->LocalToWorld(xyzloc,xyzwor);
672 
673  int st = 7;
674  int c = style.ColorFromPDG(hit.GetPDG());
675  float sz = 0.5;
676 
677  TPolyMarker3D& p = view->AddPolyMarker3D(1, c, st, sz);
678  p.SetPoint(0, xyzwor[0], xyzwor[1], xyzwor[2]);
679 
680  if (fHighlite[hit.GetTrackID()]) {
681  TPolyMarker3D& p = view->AddPolyMarker3D(1, c, 24, 2*sz);
682  p.SetPoint(0, xyzwor[0], xyzwor[1], xyzwor[2]);
683  }
684 
685  } // loop on j hits in list
686  } // loop on i hit lists
687  } // loop o imod folders
688  }
float GetEntryX() const
Entry point of the particle (position, time and energy)
Definition: FLSHit.h:48
int fDraw
Which MC Truth objects to draw.
int GetPlaneID() const
Plane ID.
Definition: FLSHit.h:37
int GetCellID() const
Cell ID.
Definition: FLSHit.h:39
const char * p
Definition: xmltok.h:285
A single unit of energy deposition in the liquid scintillator.
Definition: FLSHit.h:19
const PlaneGeo * Plane(unsigned int i) const
float GetExitX() const
Exit point of the particle (position, time and energy)
Definition: FLSHit.h:54
int GetPDG() const
PDG.
Definition: FLSHit.h:43
int ColorFromPDG(int pdgcode)
Definition: Style.cxx:98
const double j
Definition: BetheBloch.cxx:29
float fFLSHitThresh
Threshold to apply to FLS hits (MeV)
float GetEntryZ() const
Definition: FLSHit.h:50
int GetTrackID() const
Track ID.
Definition: FLSHit.h:45
Definition: structs.h:12
float GetEdep() const
Get total Energy deposited into the cell for the whole FLSHit.
Definition: FLSHit.h:31
std::vector< std::string > fFLSHitListModules
FLSHitLists here.
float GetExitY() const
Definition: FLSHit.h:55
float GetExitZ() const
Definition: FLSHit.h:56
Helper for AttenCurve.
Definition: Path.h:10
int GetFLSHits(const art::Event &evt, const char *which, std::vector< sim::FLSHitList > &flshits)
std::map< int, bool > fHighlite
float GetEntryY() const
Definition: FLSHit.h:49
int evd::SimulationDrawer::GetFLSHits ( const art::Event evt,
const char *  which,
std::vector< sim::FLSHitList > &  flshits 
)
private

Definition at line 713 of file SimulationDrawer.cxx.

References e, MakeMiniprodValidationCuts::f, art::DataViewImpl::getByLabel(), and APDHVSetting::temp.

Referenced by FLSHit2D(), FLSHit3D(), GetLimits(), and GetTimeLimits().

716  {
717 
718  flshits.clear();
720 
721  try{
722  evt.getByLabel(which, fcol);
723  std::vector<sim::FLSHitList> temp(fcol->size());
724  for(size_t f = 0; f < fcol->size(); ++f){
725  flshits.push_back(fcol->at(f));
726  }
727  }
728  catch(cet::exception& e){
729  writeErrMsg("GetFLSHits", e);
730  }
731 
732  return flshits.size();
733  }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
Float_t e
Definition: plot.C:35
void evd::SimulationDrawer::GetLimits ( const art::Event evt,
double &  xmin,
double &  xmax,
double &  ymin,
double &  ymax,
double &  zmin,
double &  zmax,
const std::set< geo::OfflineChan > &  hmap = {} 
)

Definition at line 840 of file SimulationDrawer.cxx.

References ana::assert(), geo::GeometryBase::CellInfo(), evd::SimulationDrawingOptions::fFLSHitListModules, geom(), sim::FLSHit::GetCellID(), GetFLSHits(), sim::FLSHit::GetPlaneID(), hits(), MECModelEnuComparisons::i, calib::j, geo::kX, geo::kY, and POTSpillRate::view.

Referenced by evd::TZProjPad::AutoZoomTruth().

845  {
846  assert(evt);
847 
849 
851 
852  xmin = +1e10; ymin = +1e10; zmin = +1e10;
853  xmax = -1e10; ymax = -1e10; zmax = -1e10;
854 
855  for(unsigned int imod = 0; imod < drawopt->fFLSHitListModules.size(); ++imod){
856  std::vector<sim::FLSHitList> lists;
857  GetFLSHits(*evt, drawopt->fFLSHitListModules[imod].c_str(), lists);
858 
859  for(unsigned int i = 0; i < lists.size(); ++i){
860  const std::vector<sim::FLSHit>& hits = lists[i].fHits;
861 
862  for(unsigned int j = 0; j < hits.size(); ++j){
863  const sim::FLSHit& hit = hits[j];
864 
865  if(!hmap.empty() &&
866  hmap.find(geo::OfflineChan(hit.GetPlaneID(),
867  hit.GetCellID())) == hmap.end()) continue;
868 
870  double xyz[3];
871  geom->CellInfo(hit.GetPlaneID(), hit.GetCellID(), &view, xyz);
872 
873  if(view == geo::kX && xyz[0] < xmin) xmin = xyz[0];
874  if(view == geo::kX && xyz[0] > xmax) xmax = xyz[0];
875  if(view == geo::kY && xyz[1] < ymin) ymin = xyz[1];
876  if(view == geo::kY && xyz[1] > ymax) ymax = xyz[1];
877  if(xyz[2] < zmin) zmin = xyz[2];
878  if(xyz[2] > zmax) zmax = xyz[2];
879  }
880  }
881  } // end for imod
882  }
std::map< std::string, double > xmax
int GetPlaneID() const
Plane ID.
Definition: FLSHit.h:37
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
int GetCellID() const
Cell ID.
Definition: FLSHit.h:39
Vertical planes which measure X.
Definition: PlaneGeo.h:28
A single unit of energy deposition in the liquid scintillator.
Definition: FLSHit.h:19
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
void CellInfo(unsigned int ip, unsigned int ic, View_t *view=0, double *pos=0, double *dpos=0) const
Double_t ymax
Definition: plot.C:25
void hits()
Definition: readHits.C:15
const double j
Definition: BetheBloch.cxx:29
Definition: structs.h:12
A (plane, cell) pair.
Definition: OfflineChan.h:17
void geom(int which=0)
Definition: geom.C:163
assert(nhit_max >=nhit_nbins)
Double_t ymin
Definition: plot.C:24
std::vector< std::string > fFLSHitListModules
FLSHitLists here.
int GetFLSHits(const art::Event &evt, const char *which, std::vector< sim::FLSHitList > &flshits)
int evd::SimulationDrawer::GetMCTruth ( const art::Event evt,
std::vector< simb::MCTruth > &  mctruth 
)
private

Definition at line 693 of file SimulationDrawer.cxx.

References evd::SimulationDrawingOptions::fMCTruthModules, evd::SliceNavigator::GetProducts(), APDHVSetting::mod, MECModelEnuComparisons::opt, string, and confusionMatrixTree::t.

Referenced by GetVertexPoints(), MCTruthShortText(), MCTruthTrajectoriesAnyD(), MCTruthVectors2D(), and MCTruthVectors3D().

695  {
696  mctruth.clear();
697 
699 
700  for(const std::string& mod: opt->fMCTruthModules){
702  std::vector<const simb::MCTruth*> truths;
703  nav->GetProducts(evt, mod, "", truths);
704 
705  for(const simb::MCTruth* t: truths) mctruth.push_back(*t);
706  }
707 
708  return mctruth.size();
709  }
size_t GetProducts(const art::Event &evt, const std::string &which, const std::string &instance, std::vector< const T * > &prods)
std::vector< std::string > fMCTruthModules
Modules to load the data from.
Event generator information.
Definition: MCTruth.h:32
enum BeamMode string
void evd::SimulationDrawer::GetTimeLimits ( const art::Event evt,
double &  tmin,
double &  tmax 
)

Definition at line 886 of file SimulationDrawer.cxx.

References ana::assert(), evd::SimulationDrawingOptions::fFLSHitListModules, sim::FLSHit::GetEntryT(), sim::FLSHit::GetExitT(), GetFLSHits(), hits(), MECModelEnuComparisons::i, and calib::j.

Referenced by evd::TQPad::Draw().

888  {
889  tmin = FLT_MAX;
890  tmax = -FLT_MAX;
891 
892  assert(evt);
893 
895 
896  for(unsigned int imod = 0; imod < drawopt->fFLSHitListModules.size(); ++imod){
897  std::vector<sim::FLSHitList> lists;
898  GetFLSHits(*evt, drawopt->fFLSHitListModules[imod].c_str(), lists);
899 
900  for(unsigned int i = 0; i < lists.size(); ++i){
901  const std::vector<sim::FLSHit>& hits = lists[i].fHits;
902 
903  for(unsigned int j = 0; j < hits.size(); ++j){
904  const sim::FLSHit& hit = hits[j];
905 
906  if(hit.GetEntryT() < tmin) tmin = hit.GetEntryT();
907  if(hit.GetExitT() > tmax) tmax = hit.GetExitT();
908  }
909  }
910  }
911  }
float GetExitT() const
Definition: FLSHit.h:57
A single unit of energy deposition in the liquid scintillator.
Definition: FLSHit.h:19
void hits()
Definition: readHits.C:15
const double j
Definition: BetheBloch.cxx:29
float GetEntryT() const
Definition: FLSHit.h:51
Definition: structs.h:12
assert(nhit_max >=nhit_nbins)
std::vector< std::string > fFLSHitListModules
FLSHitLists here.
int GetFLSHits(const art::Event &evt, const char *which, std::vector< sim::FLSHitList > &flshits)
int evd::SimulationDrawer::GetVertexPoints ( const art::Event evt,
std::vector< double > &  x,
std::vector< double > &  y,
std::vector< double > &  z 
)
private

Definition at line 737 of file SimulationDrawer.cxx.

References GetMCTruth(), MECModelEnuComparisons::i, calib::j, simb::MCParticle::StatusCode(), simb::MCParticle::Vx(), simb::MCParticle::Vy(), and simb::MCParticle::Vz().

Referenced by MCTruthVertices2D(), and MCTruthVertices3D().

741  {
742  x.clear();
743  y.clear();
744  z.clear();
745  //
746  // The list of vertexs are attached to individual particles. To
747  // get a unique list of vertexs, loop over the particles and keep
748  // only the unique vertex points.
749  //
750  std::vector<simb::MCTruth> mctruth;
751  this->GetMCTruth(evt, mctruth);
752  for (unsigned int i=0; i<mctruth.size(); ++i) {
753  double x0, y0, z0;
754  bool in_list;
755  for (int j=0; j<mctruth[i].NParticles(); ++j) {
756  const simb::MCParticle& p = mctruth[i].GetParticle(j);
757  //
758  // Skip all but incoming and out-going particles
759  //
760  if (!(p.StatusCode()==0 || p.StatusCode()==1)) continue;
761  x0 = p.Vx();
762  y0 = p.Vy();
763  z0 = p.Vz();
764  //
765  // Check if this vertex is already in the list.
766  //
767  in_list = false;
768  for (unsigned int k=0; k<x.size(); ++k) {
769  in_list = ((x0 == x[k]) && (y0 == y[k]) && (z0 == z[k]));
770  if (in_list) break;
771  }
772  if (in_list==false) {
773  x.push_back(x0);
774  y.push_back(y0);
775  z.push_back(z0);
776  }
777  }
778  }
779  return x.size();
780  }
const char * p
Definition: xmltok.h:285
int StatusCode() const
Definition: MCParticle.h:210
const double j
Definition: BetheBloch.cxx:29
z
Definition: test.py:28
double Vx(const int i=0) const
Definition: MCParticle.h:220
int GetMCTruth(const art::Event &evt, std::vector< simb::MCTruth > &mctruth)
double Vz(const int i=0) const
Definition: MCParticle.h:222
double Vy(const int i=0) const
Definition: MCParticle.h:221
void evd::SimulationDrawer::HiLite ( int  trkId,
bool  hlt = true 
)

Definition at line 833 of file SimulationDrawer.cxx.

References fHighlite.

Referenced by evd::MCTrueView::HiLite().

834  {
835  fHighlite[trkId] = dohilite;
836  }
std::map< int, bool > fHighlite
void evd::SimulationDrawer::MCTruthLongText ( const art::Event evt,
evdb::View2D view 
)

Definition at line 307 of file SimulationDrawer.cxx.

References allTimeWatchdog::endl, evd::SimulationDrawingOptions::fText, evd::SimulationDrawingOptions::fTextIncludeDirections, evd::SimulationDrawingOptions::fTextIncludeVertex, evd::SimulationDrawingOptions::kTEXT_LONG, getGoodRuns4SAM::n, sim::ParticleNavigator::NumberOfPrimaries(), cheat::BackTracker::ParticleNavigator(), sim::ParticleNavigator::Primary(), PrintParticleAndOffspring(), and ss.

Referenced by evd::MCBriefPad::Draw().

309  {
311  // Skip drawing if option is turned off
312  if ((drawopt->fText &
314  return;
315  }
316 
318  const sim::ParticleNavigator& pnav = bt->ParticleNavigator();
319 
320  const bool showVtxs = drawopt->fTextIncludeVertex;
321  const bool showDirs = drawopt->fTextIncludeDirections;
322 
323  std::stringstream ss;
324  ss<< "Long MCTruth text ( from sim::Particle )"<< std::endl;
325  ss<<" Particle ( KineticEnergy ) [ Process ] ";
326  if (showVtxs) ss<<" at (Vx, Vy, Vz, T)";
327  if (showDirs) ss<<" with direction (Px, Py, Pz)";
328  ss<<" TrackId"<<std::endl;
329 
330  // loop over all the primary particles
331  for(int n = 0; n < pnav.NumberOfPrimaries(); ++n){
332  ss << "\u2500\u2500";
333  PrintParticleAndOffspring(ss, pnav.Primary(n), " ", 1);
334  }
335  mf::LogVerbatim("SimulationDrawer") << ss.str();
336  }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
const sim::ParticleNavigator & ParticleNavigator() const
Get a reference to the ParticleNavigator.
Definition: BackTracker.h:744
Float_t ss
Definition: plot.C:24
void PrintParticleAndOffspring(std::stringstream &ss, const sim::Particle *part, std::string prefix, int depth) const
Helper function for MCTruthLongText.
const sim::Particle * Primary(const int) const
void evd::SimulationDrawer::MCTruthShortText ( const art::Event evt,
evdb::View2D view 
)

Definition at line 68 of file SimulationDrawer.cxx.

References evdb::View2D::AddLatex(), evd::Style::ColorFromPDG(), colors, evd::SimulationDrawingOptions::fDraw, evdb::Colors::Foreground(), evd::SimulationDrawingOptions::fText, GetMCTruth(), MECModelEnuComparisons::i, calib::j, simb::kCosmicRay, evd::SimulationDrawingOptions::kTEXT_SHORT, latex(), evd::Style::LatexName(), simb::MCParticle::P(), simb::MCParticle::PdgCode(), ShortInteractionSuffix(), simb::MCParticle::StatusCode(), and string.

Referenced by evd::MCBriefPad::Draw().

70  {
72  if ( (drawopt->fText &
74  return;
75  }
76 
78 
79  std::vector<simb::MCTruth> mctruth;
80  this->GetMCTruth(evt, mctruth);
81 
82  // Letting text get too large is a performance problem, and eventually
83  // segfaults (don't know why). Cap at a reasonable size. There's nothing
84  // special about this precise size.
85  const unsigned int mctextmax = 2000;
86  bool cappedtext = false;
87 
88  evd::Style style;
89  std::string mctext;
90  for (unsigned int i = 0; i < mctruth.size(); ++i) {
91  if(i > 0) mctext += ", ";
92 
93  bool firstin = true;
94  bool firstout = true;
95  std::string origin;
96  std::string incoming;
97  std::string outgoing;
98  // Label cosmic rays -- others are pretty obvious
99  if (mctruth[i].Origin()==simb::kCosmicRay) { origin = "c-ray: "; }
100  for (int j=0; j<mctruth[i].NParticles(); ++j) {
101 
102  const simb::MCParticle& p = mctruth[i].GetParticle(j);
103  // Print text in color if there are other MCTruth objects drawn
104  int pcolor = ( drawopt->fDraw == 0 ) ? colors->Foreground(0) : style.ColorFromPDG(p.PdgCode() );
105 
106  const unsigned int bufsize = 1024;
107  char buff[bufsize];
108  if (p.P()>0.05) {
109  snprintf(buff, bufsize, "#color[%d]{%s #scale[0.75]{[%.1f#scale[0.5]{GeV/c}]}}",
110  pcolor,
112  p.P());
113  }
114  else {
115  snprintf(buff, bufsize, "#color[%d]{%s}",
116  pcolor,
118  }
119  if (p.StatusCode()==0) {
120  if(mctext.size() + incoming.size() + 3 + strlen(buff) > mctextmax){
121  cappedtext = true;
122  break;
123  }
124  if (!firstin) incoming += " + ";
125  incoming += buff;
126  firstin = false;
127  }
128  if (p.StatusCode()==1) {
129  if(mctext.size() + outgoing.size() + 3 + strlen(buff) > mctextmax){
130  cappedtext = true;
131  break;
132  }
133  if (!firstout) outgoing += " + ";
134  outgoing += buff;
135  firstout = false;
136  }
137  } // loop on j particles
138  if (origin=="" && incoming=="") {
139  if(mctext.size() + outgoing.size() > mctextmax){
140  cappedtext = true;
141  break;
142  }
143  mctext += outgoing;
144  }
145  else {
146  const int intType = mctruth[i].GetNeutrino().InteractionType();
147  const std::string suffix = ShortInteractionSuffix(intType);
148  const std::string newtext = origin+incoming+" #rightarrow "+outgoing+suffix;
149  if(mctext.size() + newtext.size() > mctextmax){
150  cappedtext = true;
151  break;
152  }
153  mctext += newtext;
154  }
155  if(cappedtext) break; // if capped inside particle loop
156  } // loop on i mctruth objects
157 
158  if(cappedtext){
159  if(mctext.empty()) mctext = "Too many particles"; // shouldn't happen
160  else mctext += "... and more!";
161  }
162 
163  TLatex& latex = view->AddLatex(0.01, 0.055, mctext.c_str());
164  latex.SetTextColor(colors->Foreground(0));
165  latex.SetTextSize(0.15);
166  }
void latex(double x, double y, std::string txt, double ang=0, int align=22, double size=0.042)
int PdgCode() const
Definition: MCParticle.h:211
int fDraw
Which MC Truth objects to draw.
const char * p
Definition: xmltok.h:285
int StatusCode() const
Definition: MCParticle.h:210
int colors[6]
Definition: tools.h:1
double P(const int i=0) const
Definition: MCParticle.h:233
int ColorFromPDG(int pdgcode)
Definition: Style.cxx:98
const double j
Definition: BetheBloch.cxx:29
TLatex & AddLatex(double x, double y, const char *text)
Definition: View2D.cxx:308
int Foreground(int i=0)
int GetMCTruth(const art::Event &evt, std::vector< simb::MCTruth > &mctruth)
std::string ShortInteractionSuffix(int iType) const
static const char * LatexName(int pdgcode)
Convert PDG code to a latex string (root-style)
Definition: Style.cxx:16
Cosmic rays.
Definition: MCTruth.h:24
enum BeamMode string
void evd::SimulationDrawer::MCTruthTrajectories2D ( const art::Event evt,
evdb::View2D xzview,
evdb::View2D yzview 
)

Definition at line 542 of file SimulationDrawer.cxx.

References MCTruthTrajectoriesAnyD().

Referenced by evd::TZProjPad::Draw().

545  {
546  MCTruthTrajectoriesAnyD(evt, xzview, yzview, 0);
547  }
void MCTruthTrajectoriesAnyD(const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview, evdb::View3D *view3D)
Helper function for MCTruthTrajectories[2|3]D.
void evd::SimulationDrawer::MCTruthTrajectories3D ( const art::Event evt,
evdb::View3D view 
)

Definition at line 549 of file SimulationDrawer.cxx.

References MCTruthTrajectoriesAnyD().

Referenced by evd::Display3DPad::Draw().

551  {
552  MCTruthTrajectoriesAnyD(evt, 0, 0, view);
553  }
void MCTruthTrajectoriesAnyD(const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview, evdb::View3D *view3D)
Helper function for MCTruthTrajectories[2|3]D.
void evd::SimulationDrawer::MCTruthTrajectoriesAnyD ( const art::Event evt,
evdb::View2D xzview,
evdb::View2D yzview,
evdb::View3D view3D 
)
private

Helper function for MCTruthTrajectories[2|3]D.

Definition at line 481 of file SimulationDrawer.cxx.

References abs(), evdb::View2D::AddPolyLine(), evdb::View3D::AddPolyLine3D(), sim::ParticleNavigator::begin(), plot_validation_datamc::c, evd::Style::ColorFromPDG(), sim::ParticleNavigator::end(), evd::SimulationDrawingOptions::fDraw, GetMCTruth(), calib::j, evd::SimulationDrawingOptions::kDRAW_GAMMAS, evd::SimulationDrawingOptions::kDRAW_NEUTRALS, evd::SimulationDrawingOptions::kDRAW_TRAJECT, evd::Style::LineStyleFromPDG(), evd::Style::LineWidthFromPDG(), getGoodRuns4SAM::n, simb::MCParticle::NumberTrajectoryPoints(), part, cheat::BackTracker::ParticleNavigator(), make_root_from_grid_output::pdg, simb::MCParticle::PdgCode(), simb::MCParticle::Position(), and w.

Referenced by MCTruthTrajectories2D(), and MCTruthTrajectories3D().

485  {
487  if ( (drawopt->fDraw &
489  return;
490  }
491 
492  // TODO: Seems this call is required for GetParticleList to work properly?
493  std::vector<simb::MCTruth> mctruth;
494  this->GetMCTruth(evt, mctruth);
495 
497  const sim::ParticleNavigator& pnav = bt->ParticleNavigator();
498 
499  evd::Style style;
501  j != pnav.end();
502  ++j) {
503  const sim::Particle part = *((*j).second);
504 
505  const int pdg = part.PdgCode();
506 
507  // Decay neutrinos are just messy
508  if (abs(pdg) == 12 || abs(pdg) == 14 || abs(pdg) == 16) continue;
509 
510  const int N = part.NumberTrajectoryPoints();
511  const int c = style.ColorFromPDG(pdg);
512  const int w = style.LineWidthFromPDG(pdg);
513  const int s = style.LineStyleFromPDG(pdg);
514 
515  // This drawing mode disables neutral particles
516  bool draw_neutrals = (drawopt->fDraw &
518  // if (!draw_neutrals && s!=kSolid) continue;
519  bool draw_gammas = (drawopt->fDraw &
521  if (!draw_neutrals && s==kDotted) continue;
522  if (!draw_gammas && s==kDashed) continue;
523 
524  TPolyLine* xz = xzview ? &xzview->AddPolyLine(N, c, w, s) : 0;
525  TPolyLine* yz = yzview ? &yzview->AddPolyLine(N, c, w, s) : 0;
526  TPolyLine3D* xyz = view3D ? &view3D->AddPolyLine3D(N, c, w, s) : 0;
527 
528  for(int n = 0; n < N; ++n){
529  const TLorentzVector& vec = part.Position(n);
530  if(xz) xz->SetPoint(n, vec.Z(), vec.X());
531  if(yz) yz->SetPoint(n, vec.Z(), vec.Y());
532  if(xyz) xyz->SetPoint(n, vec.X(), vec.Y(), vec.Z());
533  }
534 
535  if(xz) xz->SetBit(kCannotPick);
536  if(yz) yz->SetBit(kCannotPick);
537  if(xyz) xyz->SetBit(kCannotPick);
538  } // end for j
539 
540  }
unsigned int NumberTrajectoryPoints() const
Definition: MCParticle.h:217
const TLorentzVector & Position(const int i=0) const
Definition: MCParticle.h:218
int PdgCode() const
Definition: MCParticle.h:211
int fDraw
Which MC Truth objects to draw.
TPolyLine & AddPolyLine(int n, int c, int w, int s)
Definition: View2D.cxx:210
const sim::ParticleNavigator & ParticleNavigator() const
Get a reference to the ParticleNavigator.
Definition: BackTracker.h:744
list_type::const_iterator const_iterator
void abs(TH1 *hist)
int LineWidthFromPDG(int pdgcode)
Definition: Style.cxx:109
TPolyLine3D & AddPolyLine3D(int n, int c, int w, int s)
Definition: View3D.cxx:105
const XML_Char * s
Definition: expat.h:262
TString part[npart]
Definition: Style.C:32
int ColorFromPDG(int pdgcode)
Definition: Style.cxx:98
const double j
Definition: BetheBloch.cxx:29
Eigen::VectorXd vec
int GetMCTruth(const art::Event &evt, std::vector< simb::MCTruth > &mctruth)
int LineStyleFromPDG(int pdgcode)
Definition: Style.cxx:116
Float_t w
Definition: plot.C:20
void evd::SimulationDrawer::MCTruthVectors2D ( const art::Event evt,
evdb::View2D xzview,
evdb::View2D yzview 
)

Definition at line 391 of file SimulationDrawer.cxx.

References evdb::View2D::AddLine(), evd::SimulationDrawingOptions::fDraw, evd::Style::FromPDG(), GetMCTruth(), MECModelEnuComparisons::i, calib::j, evd::SimulationDrawingOptions::kDRAW_VECTORS, submit_hadd::l, simb::MCParticle::P(), simb::MCParticle::PdgCode(), simb::MCParticle::Px(), simb::MCParticle::Py(), simb::MCParticle::Pz(), r(), simb::MCParticle::StatusCode(), simb::MCParticle::Vx(), simb::MCParticle::Vy(), simb::MCParticle::Vz(), x1, and y1.

Referenced by evd::TZProjPad::Draw().

394  {
396  if ( (drawopt->fDraw &
398  return;
399  }
400 
401  // Unpack and draw the MC vectors
402  std::vector<simb::MCTruth> mctruth;
403  this->GetMCTruth(evt, mctruth);
404 
405  evd::Style style;
406  for (unsigned int i=0; i<mctruth.size(); ++i) {
407  for (int j=0; j<mctruth[i].NParticles(); ++j) {
408  const simb::MCParticle& p = mctruth[i].GetParticle(j);
409 
410  // Skip all but incoming and out-going particles
411  if (!(p.StatusCode()==0 || p.StatusCode()==1)) continue;
412 
413  double r = p.P()*100.0; // Scale length so 1 m = 1 GeV/c
414  if (r<0.1) continue; // Skip very short particles
415  if (p.StatusCode()==0) r = -r; // Flip for incoming particles
416 
417  double x0 = p.Vx();
418  double y0 = p.Vy();
419  double z0 = p.Vz();
420  double x1 = x0 + r * p.Px()/p.P();
421  double y1 = y0 + r * p.Py()/p.P();
422  double z1 = z0 + r * p.Pz()/p.P();
423  if (xzview!=0) {
424  TLine& l = xzview->AddLine(z0, x0, z1, x1);
425  style.FromPDG(&l,p.PdgCode());
426  }
427  if (yzview!=0) {
428  TLine& l = yzview->AddLine(z0, y0, z1, y1);
429  style.FromPDG(&l,p.PdgCode());
430  }
431  } // loop on j particles
432  } // loop on i mctruth objects
433  }
int PdgCode() const
Definition: MCParticle.h:211
double Py(const int i=0) const
Definition: MCParticle.h:230
int fDraw
Which MC Truth objects to draw.
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
TLine & AddLine(double x1, double y1, double x2, double y2)
Definition: View2D.cxx:187
const char * p
Definition: xmltok.h:285
double Px(const int i=0) const
Definition: MCParticle.h:229
int StatusCode() const
Definition: MCParticle.h:210
void FromPDG(TAttLine *line, int pdgcode)
Definition: Style.cxx:127
double P(const int i=0) const
Definition: MCParticle.h:233
const double j
Definition: BetheBloch.cxx:29
double Vx(const int i=0) const
Definition: MCParticle.h:220
int GetMCTruth(const art::Event &evt, std::vector< simb::MCTruth > &mctruth)
double Pz(const int i=0) const
Definition: MCParticle.h:231
double Vz(const int i=0) const
Definition: MCParticle.h:222
TRandom3 r(0)
double Vy(const int i=0) const
Definition: MCParticle.h:221
void evd::SimulationDrawer::MCTruthVectors3D ( const art::Event evt,
evdb::View3D view 
)

Definition at line 437 of file SimulationDrawer.cxx.

References evdb::View3D::AddPolyLine3D(), plot_validation_datamc::c, evd::Style::ColorFromPDG(), evd::SimulationDrawingOptions::fDraw, GetMCTruth(), MECModelEnuComparisons::i, calib::j, evd::SimulationDrawingOptions::kDRAW_VECTORS, submit_hadd::l, evd::Style::LineStyleFromPDG(), evd::Style::LineWidthFromPDG(), simb::MCParticle::P(), simb::MCParticle::PdgCode(), simb::MCParticle::Px(), simb::MCParticle::Py(), simb::MCParticle::Pz(), r(), simb::MCParticle::StatusCode(), simb::MCParticle::Vx(), simb::MCParticle::Vy(), simb::MCParticle::Vz(), w, x1, and y1.

Referenced by evd::Display3DPad::Draw().

439  {
441  if ( (drawopt->fDraw &
443  return;
444  }
445 
446  // Unpack and draw the MC vectors
447  std::vector<simb::MCTruth> mctruth;
448  this->GetMCTruth(evt, mctruth);
449 
450  evd::Style style;
451  for (unsigned int i=0; i<mctruth.size(); ++i) {
452  for (int j=0; j<mctruth[i].NParticles(); ++j) {
453  const simb::MCParticle& p = mctruth[i].GetParticle(j);
454 
455  // Skip all but incoming and out-going particles
456  if (!(p.StatusCode()==0 || p.StatusCode()==1)) continue;
457 
458  double r = p.P()*100.0; // Scale length so 1 m = 1 GeV/c
459  if (r<0.1) continue; // Skip very short particles
460  if (p.StatusCode()==0) r = -r; // Flip for incoming particles
461 
462  double x0 = p.Vx();
463  double y0 = p.Vy();
464  double z0 = p.Vz();
465  double x1 = x0 + r * p.Px()/p.P();
466  double y1 = y0 + r * p.Py()/p.P();
467  double z1 = z0 + r * p.Pz()/p.P();
468 
469  int c = style.ColorFromPDG(p.PdgCode());
470  int s = style.LineStyleFromPDG(p.PdgCode());
471  int w = style.LineWidthFromPDG(p.PdgCode());
472  TPolyLine3D& l = view->AddPolyLine3D(2,c,w,s);
473  l.SetPoint(0, x0, y0, z0);
474  l.SetPoint(1, x1, y1, z1);
475  } // loop on j particles
476  } // loop on i mctruth objects
477  }
int PdgCode() const
Definition: MCParticle.h:211
double Py(const int i=0) const
Definition: MCParticle.h:230
int fDraw
Which MC Truth objects to draw.
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
const char * p
Definition: xmltok.h:285
double Px(const int i=0) const
Definition: MCParticle.h:229
int StatusCode() const
Definition: MCParticle.h:210
int LineWidthFromPDG(int pdgcode)
Definition: Style.cxx:109
TPolyLine3D & AddPolyLine3D(int n, int c, int w, int s)
Definition: View3D.cxx:105
const XML_Char * s
Definition: expat.h:262
double P(const int i=0) const
Definition: MCParticle.h:233
int ColorFromPDG(int pdgcode)
Definition: Style.cxx:98
const double j
Definition: BetheBloch.cxx:29
double Vx(const int i=0) const
Definition: MCParticle.h:220
int GetMCTruth(const art::Event &evt, std::vector< simb::MCTruth > &mctruth)
double Pz(const int i=0) const
Definition: MCParticle.h:231
double Vz(const int i=0) const
Definition: MCParticle.h:222
TRandom3 r(0)
int LineStyleFromPDG(int pdgcode)
Definition: Style.cxx:116
Float_t w
Definition: plot.C:20
double Vy(const int i=0) const
Definition: MCParticle.h:221
void evd::SimulationDrawer::MCTruthVertices2D ( const art::Event evt,
evdb::View2D xzview,
evdb::View2D yzview 
)

Definition at line 340 of file SimulationDrawer.cxx.

References evdb::View2D::AddMarker(), evd::SimulationDrawingOptions::fDraw, GetVertexPoints(), MECModelEnuComparisons::i, evd::SimulationDrawingOptions::kDRAW_VERTEX, kOrange, submit_syst::x, submit_syst::y, and test::z.

Referenced by evd::TZProjPad::Draw().

343  {
345  if ( (drawopt->fDraw &
347  return;
348  }
349  std::vector<double> x;
350  std::vector<double> y;
351  std::vector<double> z;
352  this->GetVertexPoints(evt, x, y, z);
353  unsigned int i;
354  int gold = kOrange-4;
355  int star = 30;
356  double sz = 2.0;
357  for (i=0; i<x.size(); ++i) {
358  if(xzview) xzview->AddMarker(z[i], x[i], gold, star, sz);
359  if(yzview) yzview->AddMarker(z[i], y[i], gold, star, sz);
360  }
361  }
enum BeamMode kOrange
int fDraw
Which MC Truth objects to draw.
int GetVertexPoints(const art::Event &evt, std::vector< double > &x, std::vector< double > &y, std::vector< double > &z)
z
Definition: test.py:28
TMarker & AddMarker(double x, double y, int c, int st, double sz)
Definition: View2D.cxx:124
void evd::SimulationDrawer::MCTruthVertices3D ( const art::Event evt,
evdb::View3D view 
)

Definition at line 365 of file SimulationDrawer.cxx.

References evdb::View3D::AddPolyMarker3D(), evd::SimulationDrawingOptions::fDraw, GetVertexPoints(), MECModelEnuComparisons::i, evd::SimulationDrawingOptions::kDRAW_VERTEX, kOrange, submit_syst::x, submit_syst::y, and test::z.

Referenced by evd::Display3DPad::Draw().

367  {
369  if ( (drawopt->fDraw &
371  return;
372  }
373  std::vector<double> x;
374  std::vector<double> y;
375  std::vector<double> z;
376  this->GetVertexPoints(evt, x, y, z);
377 
378  int gold = kOrange-4;
379  int star = 30;
380  double sz = 2.0;
381  TPolyMarker3D& pm = view->AddPolyMarker3D(x.size(), gold, star, sz);
382 
383  unsigned int i;
384  for (i=0; i<x.size(); ++i) {
385  pm.SetPoint(i, x[i], y[i], z[i]);
386  }
387  }
enum BeamMode kOrange
int fDraw
Which MC Truth objects to draw.
int GetVertexPoints(const art::Event &evt, std::vector< double > &x, std::vector< double > &y, std::vector< double > &z)
z
Definition: test.py:28
TPolyMarker3D & AddPolyMarker3D(int n, int c, int st, double sz)
Definition: View3D.cxx:75
void evd::SimulationDrawer::PrintParticleAndOffspring ( std::stringstream &  ss,
const sim::Particle part,
std::string  prefix,
int  depth 
) const
private

Helper function for MCTruthLongText.

Definition at line 171 of file SimulationDrawer.cxx.

References genie::units::A, simb::MCParticle::Daughter(), e, simb::MCParticle::E(), sim::ParticleNavigator::end(), allTimeWatchdog::endl, sim::ParticleNavigator::find(), evd::SimulationDrawingOptions::fTextDepthLimit, evd::SimulationDrawingOptions::fTextIncludeDirections, evd::SimulationDrawingOptions::fTextIncludeVertex, MECModelEnuComparisons::i, simb::MCParticle::Mass(), getGoodRuns4SAM::n, simb::MCParticle::NumberDaughters(), simb::MCParticle::P(), cheat::BackTracker::ParticleNavigator(), simb::MCParticle::PdgCode(), simb::MCParticle::Process(), simb::MCParticle::Px(), simb::MCParticle::Py(), simb::MCParticle::Pz(), simb::MCParticle::T(), simb::MCParticle::TrackId(), simb::MCParticle::Vx(), simb::MCParticle::Vy(), and simb::MCParticle::Vz().

Referenced by MCTruthLongText().

175  {
177  const int depthLimit = drawopt->fTextDepthLimit;
178  const bool showVtxs = drawopt->fTextIncludeVertex;
179  const bool showDirs = drawopt->fTextIncludeDirections;
180 
182  const sim::ParticleNavigator& pnav = bt->ParticleNavigator();
183 
184  // Find out what the particle is called and print it. Fallback is PDG code
185  const TDatabasePDG* db = TDatabasePDG::Instance();
186  const TParticlePDG* defn = db->GetParticle(part->PdgCode());
187  if(defn){
188  ss << defn->GetName();
189  }
190  else if(part->PdgCode() > 1000000000){
191  const int strange = (part->PdgCode()/10000000)%10;
192  const int element = (part->PdgCode()/10000)%1000;
193  const int A = (part->PdgCode()/10)%1000;
194  const int I = part->PdgCode()%10;
195  switch(element){
196  case 1: ss << "H"; break;
197  case 2: ss << "He"; break;
198  case 3: ss << "Li"; break;
199  case 4: ss << "Be"; break;
200  case 5: ss << "B"; break;
201  case 6: ss << "C"; break;
202  case 7: ss << "N"; break;
203  case 8: ss << "O"; break;
204  case 9: ss << "F"; break;
205  case 10: ss << "Ne"; break;
206  case 11: ss << "Na"; break;
207  case 12: ss << "Mg"; break;
208  case 13: ss << "Al"; break;
209  case 14: ss << "Si"; break;
210  case 15: ss << "P"; break;
211  case 16: ss << "S"; break;
212  case 17: ss << "Cl"; break;
213  case 18: ss << "Ar"; break;
214  case 19: ss << "K"; break;
215  case 20: ss << "Ca"; break;
216  case 21: ss << "Sc"; break;
217  case 22: ss << "Ti"; break;
218  case 23: ss << "V"; break;
219  case 24: ss << "Cr"; break;
220  case 25: ss << "Mn"; break;
221  case 26: ss << "Fe"; break;
222  case 27: ss << "Co"; break;
223  case 49: ss << "In"; break;
224  case 50: ss << "Sn"; break;
225  case 51: ss << "Sb"; break;
226  case 52: ss << "Te"; break;
227  case 53: ss << "I"; break;
228  case 54: ss << "Xe"; break;
229  case 55: ss << "Cs"; break;
230  case 56: ss << "Ba"; break;
231  case 57: ss << "La"; break;
232  default: ss << element << "-";
233  }
234 
235  ss << A;
236 
237  // Excited nuclear state. If it became useful, we could distinguish
238  // between several different ones.
239  if(I != 0) ss << "*";
240 
241  const char* Lambda = "\u039b";
242  for(int i = 0; i < strange; i++) ss << Lambda;
243  }
244  else{
245  // Anti-nuclei will land here, among perhaps some other obscure particles
246  ss << part->PdgCode();
247  }
248 
249  // Print the kinetic energy, and the process that created this particle
250  const double ke = part->E()-part->Mass();
251  char Estr[1024];
252  if(ke > 1)
253  sprintf(Estr, "%.3lf GeV", ke);
254  else if(ke > 1e-3)
255  sprintf(Estr, "%.3lf MeV", 1e3*ke);
256  else
257  sprintf(Estr, "%.3lf keV", 1e6*ke);
258 
259  ss << "\t(" << Estr << ")\t[" << part->Process() << "]";
260  if(showVtxs){
261  ss << " at (" << part->Vx() << ", " << part->Vy() << ", " << part->Vz() << "; " << part->T() << ") ";
262  }
263  if(showDirs){
264  double ptot=part->P();
265  if (showVtxs) ss<<",";
266  if (ptot>1e-6) {
267  ss << " p-hat (" << part->Px()/ptot << ", " << part->Py()/ptot << ", " << part->Pz()/ptot << ") ";
268  } else {
269  ss << " p=0 ";
270  }
271  }
272  ss << "\t" << part->TrackId() << std::endl;
273 
274  // Reached depth limit, shouldn't print daughters
275  if(depth >= depthLimit && depthLimit > 0) return;
276  // Unicode "light" box drawing characters
277  const char* kHoriz = "\u2500";
278  const char* kVert = "\u2502";
279  const char* kCorner = "\u2514";
280  const char* kTee = "\u251c";
281 
282  // Print our daughters too, indented
283  const int N = part->NumberDaughters();
284  for(int n = 0; n < N; ++n){
285  sim::ParticleNavigator::const_iterator childIt = pnav.find(part->Daughter(n));
286 
287  // Should always be there because we created the daughter links ourselves
288  // but better safe than sorry...
289  if(childIt == pnav.end()) continue;
290 
291  if(n == N-1){
292  ss << prefix << kCorner << kHoriz << kHoriz;
293  PrintParticleAndOffspring(ss, childIt->second,
294  prefix+" ", depth+1);
295  }
296  else{
297  ss << prefix << kTee << kHoriz << kHoriz;
298  PrintParticleAndOffspring(ss, childIt->second,
299  prefix+kVert+" ", depth+1);
300  }
301  }
302 
303  }
double E(const int i=0) const
Definition: MCParticle.h:232
int PdgCode() const
Definition: MCParticle.h:211
double Py(const int i=0) const
Definition: MCParticle.h:230
const sim::ParticleNavigator & ParticleNavigator() const
Get a reference to the ParticleNavigator.
Definition: BackTracker.h:744
double Mass() const
Definition: MCParticle.h:238
list_type::const_iterator const_iterator
double Px(const int i=0) const
Definition: MCParticle.h:229
Float_t ss
Definition: plot.C:24
std::string Process() const
Definition: MCParticle.h:214
int NumberDaughters() const
Definition: MCParticle.h:216
int TrackId() const
Definition: MCParticle.h:209
int Daughter(const int i) const
Definition: MCParticle.cxx:112
void PrintParticleAndOffspring(std::stringstream &ss, const sim::Particle *part, std::string prefix, int depth) const
Helper function for MCTruthLongText.
double P(const int i=0) const
Definition: MCParticle.h:233
double T(const int i=0) const
Definition: MCParticle.h:223
const XML_Char * prefix
Definition: expat.h:380
double Vx(const int i=0) const
Definition: MCParticle.h:220
static const double A
Definition: Units.h:82
double Pz(const int i=0) const
Definition: MCParticle.h:231
double Vz(const int i=0) const
Definition: MCParticle.h:222
Float_t e
Definition: plot.C:35
iterator find(const key_type &key)
double Vy(const int i=0) const
Definition: MCParticle.h:221
std::string evd::SimulationDrawer::ShortInteractionSuffix ( int  iType) const
private

Definition at line 784 of file SimulationDrawer.cxx.

References simb::kCCCOH, simb::kCCDIS, simb::kCCQE, simb::kCoh, simb::kDIS, simb::kElectronScattering, simb::kInverseBetaDecay, simb::kNCDIS, simb::kNCQE, simb::kQE, simb::kRes, simb::kResCCNuBarNeutronPiMinus, simb::kResCCNuBarProtonPi0, simb::kResCCNuBarProtonPiMinus, simb::kResCCNuNeutronPi0, simb::kResCCNuNeutronPiPlus, simb::kResCCNuProtonPiPlus, simb::kResNCNuBarNeutronPi0, simb::kResNCNuBarNeutronPiMinus, simb::kResNCNuBarProtonPi0, simb::kResNCNuBarProtonPiPlus, simb::kResNCNuNeutronPi0, simb::kResNCNuNeutronPiMinus, simb::kResNCNuProtonPi0, and simb::kResNCNuProtonPiPlus.

Referenced by MCTruthShortText().

785  {
786  switch(iType){
787  case simb::kQE:
788  case simb::kCCQE:
789  return " (QE)";
790 
791  case simb::kRes:
798  return " (RES)";
799 
800  case simb::kDIS:
801  case simb::kCCDIS:
802  return " (DIS)";
803 
804  case simb::kCoh:
805  case simb::kCCCOH:
806  return " (COH)";
807 
808  case simb::kNCQE:
809  case simb::kNCDIS:
818  return " (NC)";
819 
821  return " (ES)";
822 
824  return " (IBD)";
825 
826  default: // simb::kNuElectronElastic and simb::kInverseMuDecay
827  return "";
828  }
829  }
neutral current quasi-elastic
Definition: MCNeutrino.h:97
resonant charged current, nubar p -> nubar n pi+
Definition: MCNeutrino.h:109
resonant neutral current, nu p -> nu p pi0
Definition: MCNeutrino.h:101
charged current deep inelastic scatter
Definition: MCNeutrino.h:134
resonant charged current, nubar p -> l+ p pi-
Definition: MCNeutrino.h:107
resonant charged current, nubar p -> l+ n pi0
Definition: MCNeutrino.h:106
charged current quasi-elastic
Definition: MCNeutrino.h:96
resonant charged current, nubar p -> nubar p pi0
Definition: MCNeutrino.h:108
resonant charged current, nu n -> l- p pi0
Definition: MCNeutrino.h:99
resonant neutral current, nu n -> nu n pi0
Definition: MCNeutrino.h:103
resonant charged current, nu n -> l- n pi+
Definition: MCNeutrino.h:100
resonant charged current, nubar n -> nubar p pi-
Definition: MCNeutrino.h:111
charged current deep inelastic scatter
Definition: MCNeutrino.h:133
resonant charged current, nu p -> l- p pi+
Definition: MCNeutrino.h:98
charged current coherent pion
Definition: MCNeutrino.h:139
resonant neutral current, nu n -> nu p pi-
Definition: MCNeutrino.h:104
resonant charged current, nubar n -> l+ n pi-
Definition: MCNeutrino.h:105
resonant charged current, nubar n -> nubar n pi0
Definition: MCNeutrino.h:110
resonant neutral current, nu p -> nu p pi+
Definition: MCNeutrino.h:102

Member Data Documentation

std::map<int,bool> evd::SimulationDrawer::fHighlite
private

Definition at line 104 of file SimulationDrawer.h.

Referenced by FLSHit2D(), FLSHit3D(), and HiLite().


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