Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Attributes | List of all members
evd::MCTrueView Class Reference

Window containing list of MC particles. More...

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

Inheritance diagram for evd::MCTrueView:
evdb::ObjListCanvas evdb::Printable

Public Types

enum  defs_ {
  kNPart = 10, kPartName = 0, kMother = 1, kTrackId = 2,
  kMomentum = 3, kVtxZ = 4, kNHit = 5, kTime = 6,
  kEDep = 7, kNPanel = 8
}
 

Public Member Functions

 MCTrueView (TGMainFrame *mf)
 
 ~MCTrueView ()
 
const char * Description () const
 
const char * PrintTag () const
 
void Draw (const char *opt="u")
 
void Update ()
 
void UpdateAndDraw ()
 
void LoadEvent ()
 
void SortParticle ()
 
void SortMother ()
 
void SortTrackId ()
 
void SortMomentum ()
 
void SortVtxZ ()
 
void SortNHit ()
 
void SortTime ()
 
void SortEDep ()
 
void HiLite ()
 
void HandleMouseWheel (Event_t *event)
 
virtual void Print (const char *f)
 
void Connect ()
 Make signal/slot connections. More...
 

Static Public Member Functions

static bool CompParticle (const sim::Particle &a, const sim::Particle &b)
 
static bool CompMother (const sim::Particle &a, const sim::Particle &b)
 
static bool CompTrackId (const sim::Particle &a, const sim::Particle &b)
 
static bool CompMomentum (const sim::Particle &a, const sim::Particle &b)
 
static bool CompVtxZ (const sim::Particle &a, const sim::Particle &b)
 
static bool CompNHit (const sim::Particle &a, const sim::Particle &b)
 
static bool CompTime (const sim::Particle &a, const sim::Particle &b)
 
static bool CompEDep (const sim::Particle &a, const sim::Particle &b)
 
static void AddToListOfPrintables (const char *name, evdb::Printable *p)
 
static void RemoveFromListOfPrintables (evdb::Printable *p)
 
static std::map< std::string, evdb::Printable * > & GetPrintables ()
 

Protected Attributes

TGCompositeFrame * fFrame
 Graphics frame. More...
 
TGLayoutHints * fLayout
 Layout hints for frame. More...
 
TRootEmbeddedCanvas * fEmbCanvas
 Embedded canvas. More...
 
TCanvas * fCanvas
 The ROOT drawing canvas. More...
 
unsigned short fXsize
 Size of the canvas;. More...
 
unsigned short fYsize
 Size of the canvas;. More...
 
float fAspectRatio
 fYsize/fXsize More...
 

Private Attributes

int fFirstParticle
 
const sim::ParticlefCheckMap [kNPart]
 
std::vector< intfPartList
 
TGCompositeFrame * fBigFrame
 
TGCompositeFrame * fPartFrame [kNPanel]
 
TGLayoutHints fL1
 
TGLayoutHints fL2
 
TGLayoutHints fL3
 
TGLayoutHints fL4
 
TGLayoutHints fL5
 
TGCheckButton * fDrawCheck [kNPart]
 
TGLabel * fPartLabel [kNPanel][kNPart]
 
TGTextButton * fColumnLabel [kNPanel]
 
TGVScrollBar * fScrollBar
 
TGCompositeFrame * fShowFrame
 
TGCheckButton * fShowPositive
 
TGCheckButton * fShowNegative
 
TGCheckButton * fShowNeutral
 
SimulationDrawerfSim
 
RawDataDrawerfRaw
 
RecoBaseDrawerfReco
 

Detailed Description

Window containing list of MC particles.

Definition at line 35 of file MCTrueView.h.

Member Enumeration Documentation

Enumerator
kNPart 
kPartName 
kMother 
kTrackId 
kMomentum 
kVtxZ 
kNHit 
kTime 
kEDep 
kNPanel 

Definition at line 49 of file MCTrueView.h.

49  {
50  kNPart = 10, // number of particles to list at in the window
51  kPartName = 0,
52  kMother = 1,
53  kTrackId = 2,
54  kMomentum = 3,
55  kVtxZ = 4,
56  kNHit = 5,
57  kTime = 6,
58  kEDep = 7,
59  kNPanel = 8 // number of panels
60  };

Constructor & Destructor Documentation

evd::MCTrueView::MCTrueView ( TGMainFrame *  mf)

Definition at line 55 of file MCTrueView.cxx.

References Draw(), fBigFrame, fColumnLabel, fDrawCheck, fL1, fL2, fL4, fL5, fPartFrame, fPartLabel, fRaw, fReco, fScrollBar, fShowFrame, fShowNegative, fShowNeutral, fShowPositive, fSim, MECModelEnuComparisons::i, calib::j, kNPanel, and kNPart.

55  :
57  fFirstParticle(0),
58  //fCurrEvent(-1),
59  fBigFrame(new TGHorizontalFrame(mf, 40, 20)),
60  fL1(kLHintsLeft|kLHintsTop|kLHintsExpandX, 2, 2, 2, 2),
61  fL2(kLHintsLeft, 4, 4, 4, 4),
62  fL3(kLHintsRight, 4, 4, 4, 4),
63  fL4(kLHintsLeft|kLHintsExpandY, 4, 4, 4, 4),
64  fL5(kLHintsLeft|kLHintsExpandY|kLHintsExpandX, 0, 0, 2, 2),
65  fScrollBar(new TGVScrollBar(fBigFrame, 80, 5)),
66  fShowFrame(new TGHorizontalFrame(mf, 20, 20)),
67  fShowPositive(new TGCheckButton(fShowFrame, "Positives")),
68  fShowNegative(new TGCheckButton(fShowFrame, "Negatives")),
69  fShowNeutral(new TGCheckButton(fShowFrame, "Neutrals")),
70  fSim(0), fRaw(0), fReco(0)
71  {
72  fSim = new SimulationDrawer();
73  fRaw = new RawDataDrawer();
74  fReco = new RecoBaseDrawer();
75 
76  const char* gsPanelTitle[kNPanel] = {
77  "Particle",
78  "Mother",
79  "Track Id",
80  "Momentum (GeV/c)",
81  "Vertex (cm)",
82  "# of hits",
83  "Time of 1st Hit",
84  "Energy Deposited"
85  };
86 
87  const char* gsFuncName[kNPanel] = {
88  "SortParticle()",
89  "SortMother()",
90  "SortTrackId()",
91  "SortMomentum()",
92  "SortVtxZ()",
93  "SortNHit()",
94  "SortTime()",
95  "SortEDep()"
96  };
97 
98 
99  fShowNegative->Connect("Clicked()", "evd::MCTrueView",
100  this, "UpdateAndDraw()");
101  fShowNeutral->Connect("Clicked()", "evd::MCTrueView",
102  this, "UpdateAndDraw()");
103  fShowPositive->Connect("Clicked()", "evd::MCTrueView",
104  this, "UpdateAndDraw()");
105 
106  fShowPositive->SetState(kButtonDown);
107  fShowNegative->SetState(kButtonDown);
108  fShowNeutral->SetState(kButtonDown);
109 
110  fScrollBar->Connect("ProcessedEvent(Event_t*)", "evd::MCTrueView", this,
111  "HandleMouseWheel(Event_t*)");
112 
113  for (int i = 0; i < kNPanel; ++i) {
114  fPartFrame[i] = new TGVerticalFrame(fBigFrame, 20, 20);
115  fColumnLabel[i] = new TGTextButton(fPartFrame[i], gsPanelTitle[i]);
116  fPartFrame[i]->AddFrame(fColumnLabel[i], &fL1);
117  fColumnLabel[i]->Connect("Clicked()", "evd::MCTrueView",
118  this, gsFuncName[i]);
119  }
120 
121  // Build the show by particle type frame
122  fShowFrame->AddFrame(fShowNegative, &fL2);
123  fShowFrame->AddFrame(fShowNeutral, &fL2);
124  fShowFrame->AddFrame(fShowPositive, &fL2);
125 
126  // Layout the main frame
127  mf->AddFrame(fShowFrame, &fL1);
128  mf->AddFrame(fBigFrame, &fL4);
129 
130  fBigFrame->AddFrame(fScrollBar, &fL4);
131  fScrollBar->SetPosition(0);
132  for (int i = 0; i < kNPanel; ++i)
133  fBigFrame->AddFrame(fPartFrame[i], &fL4);
134 
135  // Add dummy check button frames
136  for (int i=0; i<kNPart; ++i) {
137  fDrawCheck[i] = new TGCheckButton(fPartFrame[0], "");
138  fDrawCheck[i]->Resize(120,8);
139  fDrawCheck[i]->Connect("Clicked()","evd::MCTrueView",this, "HiLite()");
140  fPartFrame[0]->AddFrame(fDrawCheck[i], &fL5);
141 
142  for (int j=1; j<kNPanel; ++j) {
143  fPartLabel[j][i] = new TGLabel(fPartFrame[j], "");
144  fPartLabel[j][i]->Resize(30,8);
145  fPartFrame[j]->AddFrame(fPartLabel[j][i], &fL5);
146  }
147  }
148 
149  Draw();
150  }
SimulationDrawer * fSim
Definition: MCTrueView.h:114
TGVScrollBar * fScrollBar
Definition: MCTrueView.h:108
TGCompositeFrame * fBigFrame
Definition: MCTrueView.h:92
TGCompositeFrame * fPartFrame[kNPanel]
Definition: MCTrueView.h:93
TGLayoutHints fL3
Definition: MCTrueView.h:95
TGCheckButton * fShowNegative
Definition: MCTrueView.h:111
TGLayoutHints fL5
Definition: MCTrueView.h:95
TGCompositeFrame * fShowFrame
Definition: MCTrueView.h:109
RecoBaseDrawer * fReco
Definition: MCTrueView.h:116
RawDataDrawer * fRaw
Definition: MCTrueView.h:115
TGLayoutHints fL1
Definition: MCTrueView.h:95
void Draw(const char *opt="u")
Definition: MCTrueView.cxx:265
const double j
Definition: BetheBloch.cxx:29
TGTextButton * fColumnLabel[kNPanel]
Definition: MCTrueView.h:99
TGLabel * fPartLabel[kNPanel][kNPart]
Definition: MCTrueView.h:98
TGLayoutHints fL4
Definition: MCTrueView.h:95
TGCheckButton * fShowPositive
Definition: MCTrueView.h:110
TGCheckButton * fDrawCheck[kNPart]
Definition: MCTrueView.h:97
TGLayoutHints fL2
Definition: MCTrueView.h:95
TGCheckButton * fShowNeutral
Definition: MCTrueView.h:112
evd::MCTrueView::~MCTrueView ( )

Definition at line 154 of file MCTrueView.cxx.

155  {
156 
157  }

Member Function Documentation

void evdb::Printable::AddToListOfPrintables ( const char *  name,
evdb::Printable p 
)
staticinherited

Definition at line 29 of file Printable.cxx.

References om::cerr, and string.

Referenced by evdb::Canvas::Connect(), evdb::ObjListCanvas::Connect(), evdb::Printable::Description(), and evdb::testCanvas1::testCanvas1().

31  {
33 
34  if (gsPrintables[s] == 0) {
35  gsPrintables[s] = p;
36  }
37  else {
38  if (gsPrintables[s] != p) {
39  std::cerr << "Printable: Name " << name << " reused.\n";
40  std::abort();
41  }
42  }
43  }
const XML_Char * name
Definition: expat.h:151
static std::map< std::string, evdb::Printable * > gsPrintables
Definition: Printable.cxx:14
const char * p
Definition: xmltok.h:285
OStream cerr
Definition: OStream.cxx:7
const XML_Char * s
Definition: expat.h:262
enum BeamMode string
bool evd::MCTrueView::CompEDep ( const sim::Particle a,
const sim::Particle b 
)
static

Definition at line 535 of file MCTrueView.cxx.

References simb::MCParticle::TrackId().

Referenced by SortEDep().

536  {
537  return (gsPartEDep[a.TrackId()] < gsPartEDep[b.TrackId()]);
538  }
static std::map< int, float > gsPartEDep
Definition: MCTrueView.cxx:52
int TrackId() const
Definition: MCParticle.h:209
bool evd::MCTrueView::CompMomentum ( const sim::Particle a,
const sim::Particle b 
)
static

Definition at line 412 of file MCTrueView.cxx.

References simb::MCParticle::TrackId().

Referenced by SortMomentum().

413  {
414  return (gsPartMom[a.TrackId()] < gsPartMom[b.TrackId()]);
415  }
static std::map< int, float > gsPartMom
Definition: MCTrueView.cxx:51
int TrackId() const
Definition: MCParticle.h:209
bool evd::MCTrueView::CompMother ( const sim::Particle a,
const sim::Particle b 
)
static

Definition at line 389 of file MCTrueView.cxx.

References simb::MCParticle::Mother().

Referenced by SortMother().

390  {
391  return (a.Mother() < b.Mother());
392  }
int Mother() const
Definition: MCParticle.h:212
bool evd::MCTrueView::CompNHit ( const sim::Particle a,
const sim::Particle b 
)
static

Definition at line 485 of file MCTrueView.cxx.

References simb::MCParticle::TrackId().

Referenced by SortNHit().

486  {
487  return (gsNFLSHit[a.TrackId()] < gsNFLSHit[b.TrackId()]);
488  }
int TrackId() const
Definition: MCParticle.h:209
static std::map< int, int > gsNFLSHit
Definition: MCTrueView.cxx:49
bool evd::MCTrueView::CompParticle ( const sim::Particle a,
const sim::Particle b 
)
static

Definition at line 364 of file MCTrueView.cxx.

References simb::MCParticle::PdgCode().

Referenced by SortParticle().

365  {
366  return (a.PdgCode() < b.PdgCode());
367  }
int PdgCode() const
Definition: MCParticle.h:211
bool evd::MCTrueView::CompTime ( const sim::Particle a,
const sim::Particle b 
)
static

Definition at line 510 of file MCTrueView.cxx.

References simb::MCParticle::TrackId().

Referenced by SortTime().

511  {
512  return (gsPartTime[a.TrackId()] < gsPartTime[b.TrackId()]);
513  }
static std::map< int, float > gsPartTime
Definition: MCTrueView.cxx:53
int TrackId() const
Definition: MCParticle.h:209
bool evd::MCTrueView::CompTrackId ( const sim::Particle a,
const sim::Particle b 
)
static

Definition at line 435 of file MCTrueView.cxx.

References simb::MCParticle::TrackId().

Referenced by SortTrackId().

436  {
437  return (a.TrackId() < b.TrackId());
438  }
int TrackId() const
Definition: MCParticle.h:209
bool evd::MCTrueView::CompVtxZ ( const sim::Particle a,
const sim::Particle b 
)
static

Definition at line 460 of file MCTrueView.cxx.

References simb::MCParticle::Vz().

Referenced by SortVtxZ().

461  {
462  return (a.Vz() < b.Vz());
463  }
double Vz(const int i=0) const
Definition: MCParticle.h:222
void evdb::ObjListCanvas::Connect ( )
inherited

Make signal/slot connections.

Definition at line 69 of file ObjListCanvas.cxx.

References evdb::Printable::AddToListOfPrintables(), and evdb::ObjListCanvas::Description().

Referenced by evdb::ObjListCanvas::Description(), and evdb::ListWindow::ListWindow().

70  {
71  // Make connections for drawing and printing
72  // IoModule::Instance()->Connect("NewEvent()",
73  // "evdb::ObjListCanvas",this,"Draw()");
75  }
virtual const char * Description() const
Definition: ObjListCanvas.h:35
static void AddToListOfPrintables(const char *name, evdb::Printable *p)
Definition: Printable.cxx:29
const char* evd::MCTrueView::Description ( ) const
inlinevirtual

Reimplemented from evdb::ObjListCanvas.

Definition at line 42 of file MCTrueView.h.

42 { return "MC Particle List Viewer"; }
void evd::MCTrueView::Draw ( const char *  opt = "u")
virtual

Implements evdb::ObjListCanvas.

Definition at line 265 of file MCTrueView.cxx.

References evd::Style::ColorFromPDG(), fCheckMap, fDrawCheck, fFirstParticle, fPartLabel, fPartList, MECModelEnuComparisons::i, calib::j, kEDep, kMomentum, kMother, kNHit, kNPanel, kNPart, kTime, kTrackId, kVtxZ, evd::Style::LatexName(), simb::MCParticle::Mother(), npart, simb::MCParticle::P(), simb::MCParticle::PdgCode(), simb::MCParticle::TrackId(), and simb::MCParticle::Vz().

Referenced by HandleMouseWheel(), MCTrueView(), SortEDep(), SortMomentum(), SortMother(), SortNHit(), SortParticle(), SortTime(), SortTrackId(), SortVtxZ(), and UpdateAndDraw().

266  {
267  // const art::Event evt;
268  // if (evt.id().event() != fCurrEvent) {
269  // LoadEvent();
270  // Update();
271  // }
272 
273  evd::Style style;
274 
275  int npart = gsPartList.size();
276 
277  char buff[256];
278 
279  int imin = fFirstParticle;
280  int imax = kNPart;
281 
282  if (imin < 0) imin = 0;
283  if (imin+kNPart > npart)
284  imax = npart;
285 
286  for (int i=0; i<imax; ++i) {
287  sim::Particle& p = gsPartList[imin+i];
288 
289  // look to see if this particle is in list of good tracks
290  if (find(fPartList.begin(),fPartList.end(),p.TrackId()) ==
291  fPartList.end()) continue;
292 
293  fCheckMap[i] = &p;
294 
295  sprintf(buff,"%d: %s",imin+i, Style::LatexName(p.PdgCode()));
296  fDrawCheck[i]->SetText(buff);
297  if (gsHiLite[p.TrackId()])
298  fDrawCheck[i]->SetState(kButtonDown);
299  else
300  fDrawCheck[i]->SetState(kButtonUp);
301 
302  sprintf(buff,"%d",p.Mother());
303  fPartLabel[kMother][i]->SetText(buff);
304 
305  sprintf(buff,"%d",p.TrackId());
306  fPartLabel[kTrackId][i]->SetText(buff);
307 
308  sprintf(buff,"%6.4f",p.P());
309  fPartLabel[kMomentum][i]->SetText(buff);
310 
311  sprintf(buff,"%6.4f",p.Vz());
312  fPartLabel[kVtxZ][i]->SetText(buff);
313 
314  sprintf(buff,"%d",gsNFLSHit[p.TrackId()]);
315  fPartLabel[kNHit][i]->SetText(buff);
316 
317  sprintf(buff,"%6.4g",gsPartTime[p.TrackId()]);
318  fPartLabel[kTime][i]->SetText(buff);
319 
320  sprintf(buff,"%6.4f",gsPartEDep[p.TrackId()]);
321  fPartLabel[kEDep][i]->SetText(buff);
322 
323  unsigned int icolor = style.ColorFromPDG(p.PdgCode());
324 
325  fDrawCheck[i]->ChangeBackground(icolor);
326  fDrawCheck[i]->SetTextColor(0xFFFFFF);
327  for (int j=1; j<kNPanel; ++j) {
328  fPartLabel[j][i]->ChangeBackground(icolor);
329  fPartLabel[j][i]->SetTextColor(0xFFFFFF);
330  }
331  }
332 
333  for (int i=imax; i<kNPart; ++i) {
334  fDrawCheck[i]->SetText("");
335  fDrawCheck[i]->ChangeBackground(0xFFFFFF);
336  for (int j=1; j<kNPanel; ++j) {
337  fPartLabel[j][i]->SetText("");
338  fPartLabel[j][i]->ChangeBackground(0xFFFFFF);
339  }
340  }
341 
342  }
int PdgCode() const
Definition: MCParticle.h:211
static std::map< int, float > gsPartEDep
Definition: MCTrueView.cxx:52
int Mother() const
Definition: MCParticle.h:212
const char * p
Definition: xmltok.h:285
static std::map< int, float > gsPartTime
Definition: MCTrueView.cxx:53
int TrackId() const
Definition: MCParticle.h:209
std::vector< int > fPartList
Definition: MCTrueView.h:89
Int_t npart
Definition: Style.C:7
static std::vector< sim::Particle > gsPartList
Definition: MCTrueView.cxx:47
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
static std::map< int, bool > gsHiLite
Definition: MCTrueView.cxx:50
TGLabel * fPartLabel[kNPanel][kNPart]
Definition: MCTrueView.h:98
static std::map< int, int > gsNFLSHit
Definition: MCTrueView.cxx:49
static const char * LatexName(int pdgcode)
Convert PDG code to a latex string (root-style)
Definition: Style.cxx:16
TGCheckButton * fDrawCheck[kNPart]
Definition: MCTrueView.h:97
double Vz(const int i=0) const
Definition: MCParticle.h:222
const sim::Particle * fCheckMap[kNPart]
Definition: MCTrueView.h:87
std::map< std::string, evdb::Printable * > & evdb::Printable::GetPrintables ( )
staticinherited

Definition at line 61 of file Printable.cxx.

References evdb::gsPrintables.

Referenced by evdb::Printable::Description(), evd::SliceNavigator::postProcessEvent(), evdb::EventDisplay::postProcessEvent(), and evdb::PrintDialog::PrintDialog().

62  {
63  return gsPrintables;
64  }
static std::map< std::string, evdb::Printable * > gsPrintables
Definition: Printable.cxx:14
void evd::MCTrueView::HandleMouseWheel ( Event_t *  event)

Definition at line 542 of file MCTrueView.cxx.

References Draw(), fFirstParticle, and fScrollBar.

543  {
544  if (fFirstParticle != fScrollBar->GetPosition()) {
545  fFirstParticle = fScrollBar->GetPosition();
546  Draw();
547  }
548  }
TGVScrollBar * fScrollBar
Definition: MCTrueView.h:108
void Draw(const char *opt="u")
Definition: MCTrueView.cxx:265
void evd::MCTrueView::HiLite ( )

Definition at line 552 of file MCTrueView.cxx.

References fCheckMap, fDrawCheck, fFirstParticle, fSim, evd::SimulationDrawer::HiLite(), MECModelEnuComparisons::i, kNPart, npart, and simb::MCParticle::TrackId().

553  {
554  int imin = fFirstParticle;
555  int imax = kNPart;
556  int npart = gsPartList.size();
557 
558  if (imin < 0) imin = 0;
559  if (imin+kNPart > npart)
560  imax = npart;
561 
562  for (int i=0; i<imax; ++i) {
563  gsHiLite[fCheckMap[i]->TrackId()] = fDrawCheck[i]->IsDown();
564  fSim->HiLite(fCheckMap[i]->TrackId(), fDrawCheck[i]->IsDown());
565  }
566  // now we want to communicate to other windows to update...
567  // how best to do this?
568 
569  // evdb::IoModule::Instance()->Reload();
570 
571  }
SimulationDrawer * fSim
Definition: MCTrueView.h:114
void HiLite(int trkId, bool hlt=true)
int TrackId() const
Definition: MCParticle.h:209
Int_t npart
Definition: Style.C:7
static std::vector< sim::Particle > gsPartList
Definition: MCTrueView.cxx:47
static std::map< int, bool > gsHiLite
Definition: MCTrueView.cxx:50
TGCheckButton * fDrawCheck[kNPart]
Definition: MCTrueView.h:97
const sim::Particle * fCheckMap[kNPart]
Definition: MCTrueView.h:87
void evd::MCTrueView::LoadEvent ( )

Definition at line 160 of file MCTrueView.cxx.

References sim::ParticleNavigator::begin(), simb::MCParticle::E(), sim::ParticleNavigator::end(), fFirstParticle, fPartList, sim::FLSHit::GetEdep(), sim::FLSHit::GetEntryT(), sim::FLSHit::GetTrackID(), MECModelEnuComparisons::i, makeTrainCVSamples::int, calib::j, cheat::BackTracker::ParticleNavigator(), make_root_from_grid_output::pdg, simb::MCParticle::PdgCode(), std::sqrt(), and simb::MCParticle::TrackId().

161  {
162  fPartList.clear();
163  gsPartList.clear();
164  gsNFLSHit.clear();
165  gsHiLite.clear();
166  gsPartMom.clear();
167  gsPartEDep.clear();
168  gsPartTime.clear();
169 
170  fFirstParticle = 0;
171 
172  // const art::Event evt;
173  // std::vector< std::vector< const simb::MCTruth*> > fMCTruth;
174  // fSim->GetMCTruth(evt,fMCTruth);
175 
176  std::vector< std::vector< const sim::FLSHitList*> > fHitList;
177  // fSim->GetFLSHits(evt,fHitList);
178 
180  const sim::ParticleNavigator& pnav = bt->ParticleNavigator();
181 
182  // loop thru the simulated particles
183  for (sim::ParticleNavigator::const_iterator i = pnav.begin(); i != pnav.end(); ++i) {
184  const sim::Particle* p = (*i).second;
185  int ipdg = p->PdgCode();
186 
187  int q = 0;
188  float mom = 0.;
189  TParticlePDG* pdg = TDatabasePDG::Instance()->GetParticle(ipdg);
190  if (pdg) {
191  q = (int)pdg->Charge();
192  mom = sqrt(p->E()*p->E()-pdg->Mass()*pdg->Mass());
193  }
194 
195  gsCharge[p->TrackId()] = q;
196  gsPartList.push_back(*p);
197  fPartList.push_back(p->TrackId());
198  gsNFLSHit[p->TrackId()] = 0;
199  gsPartMom[p->TrackId()] = mom;
200  gsPartEDep[p->TrackId()] = 0.;
201  gsPartTime[p->TrackId()] = 9.e9;
202 
203  }
204 
205  // now count number of FLS hits per track
206  for (unsigned int iv=0; iv<fHitList.size(); ++iv) {
207  for (unsigned int i=0; i<fHitList[iv].size(); ++i) {
208  for (unsigned int j=0; j<fHitList[iv][i]->fHits.size(); ++j) {
209  const sim::FLSHit& hit = fHitList[iv][i]->fHits[j];
210  for (unsigned int ii=0; ii<gsPartList.size(); ++ii) {
211  if (hit.GetTrackID() == gsPartList[ii].TrackId()) {
212  int id = gsPartList[ii].TrackId();
213  gsNFLSHit[id]++;
214  gsPartEDep[id] += hit.GetEdep();
215  if (hit.GetEntryT() < gsPartTime[id]) gsPartTime[id] = hit.GetEntryT();
216  break;
217  }
218  }
219  }
220  }
221  }
222  // fCurrEvent = evt.id().event();
223 
224  //sim::ParticleTree pt = util::EDMUtils::GetParticleTree(evt);
225 
226  //pt.Print();
227 
228  }
double E(const int i=0) const
Definition: MCParticle.h:232
::xsd::cxx::tree::id< char, ncname > id
Definition: Database.h:165
int PdgCode() const
Definition: MCParticle.h:211
static std::map< int, float > gsPartEDep
Definition: MCTrueView.cxx:52
const sim::ParticleNavigator & ParticleNavigator() const
Get a reference to the ParticleNavigator.
Definition: BackTracker.h:744
const char * p
Definition: xmltok.h:285
T sqrt(T number)
Definition: d0nt_math.hpp:156
static std::map< int, float > gsPartMom
Definition: MCTrueView.cxx:51
list_type::const_iterator const_iterator
A single unit of energy deposition in the liquid scintillator.
Definition: FLSHit.h:19
static std::map< int, int > gsCharge
Definition: MCTrueView.cxx:48
static std::map< int, float > gsPartTime
Definition: MCTrueView.cxx:53
int TrackId() const
Definition: MCParticle.h:209
std::vector< int > fPartList
Definition: MCTrueView.h:89
static std::vector< sim::Particle > gsPartList
Definition: MCTrueView.cxx:47
const double j
Definition: BetheBloch.cxx:29
static std::map< int, bool > gsHiLite
Definition: MCTrueView.cxx:50
float GetEntryT() const
Definition: FLSHit.h:51
static std::map< int, int > gsNFLSHit
Definition: MCTrueView.cxx:49
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
void evdb::ObjListCanvas::Print ( const char *  f)
virtualinherited

Implements evdb::Printable.

Definition at line 89 of file ObjListCanvas.cxx.

Referenced by evdb::ObjListCanvas::Description().

89 { /*fCanvas->Print(f);*/ }
const char* evd::MCTrueView::PrintTag ( ) const
inlinevirtual

Reimplemented from evdb::ObjListCanvas.

Definition at line 43 of file MCTrueView.h.

References Draw(), MECModelEnuComparisons::opt, and Update().

43 { return "mctrue-view"; }
void evdb::Printable::RemoveFromListOfPrintables ( evdb::Printable p)
staticinherited

Definition at line 47 of file Printable.cxx.

Referenced by evdb::Printable::Description(), evdb::Printable::~Printable(), and evdb::testCanvas1::~testCanvas1().

48  {
49  std::map<std::string,Printable*>::iterator itr(gsPrintables.begin());
50  std::map<std::string,Printable*>::iterator itrEnd(gsPrintables.end());
51  for (; itr!=itrEnd; ++itr) {
52  if ( itr->second == p) {
53  gsPrintables.erase(itr);
54  return;
55  }
56  }
57  }
static std::map< std::string, evdb::Printable * > gsPrintables
Definition: Printable.cxx:14
void evd::MCTrueView::SortEDep ( )

Definition at line 517 of file MCTrueView.cxx.

References CompEDep(), and Draw().

518  {
519  static bool fwd = true;
520  if (fwd) {
521  sort(gsPartList.begin(), gsPartList.end(), CompEDep);
522  fwd = false;
523  }
524  else {
525  sort(gsPartList.rbegin(), gsPartList.rend(), CompEDep);
526  fwd = true;
527  }
528 
529  Draw();
530 
531  }
void Draw(const char *opt="u")
Definition: MCTrueView.cxx:265
static std::vector< sim::Particle > gsPartList
Definition: MCTrueView.cxx:47
static bool CompEDep(const sim::Particle &a, const sim::Particle &b)
Definition: MCTrueView.cxx:535
void evd::MCTrueView::SortMomentum ( )

Definition at line 396 of file MCTrueView.cxx.

References CompMomentum(), and Draw().

397  {
398  static bool fwd = true;
399  if (fwd) {
400  sort(gsPartList.begin(), gsPartList.end(), CompMomentum);
401  fwd = false;
402  }
403  else {
404  sort(gsPartList.rbegin(), gsPartList.rend(), CompMomentum);
405  fwd = true;
406  }
407  Draw();
408  }
static bool CompMomentum(const sim::Particle &a, const sim::Particle &b)
Definition: MCTrueView.cxx:412
void Draw(const char *opt="u")
Definition: MCTrueView.cxx:265
static std::vector< sim::Particle > gsPartList
Definition: MCTrueView.cxx:47
void evd::MCTrueView::SortMother ( )

Definition at line 371 of file MCTrueView.cxx.

References CompMother(), and Draw().

372  {
373  static bool fwd = true;
374  if (fwd) {
375  sort(gsPartList.begin(), gsPartList.end(), CompMother);
376  fwd = false;
377  }
378  else {
379  sort(gsPartList.rbegin(), gsPartList.rend(), CompMother);
380  fwd = true;
381  }
382 
383  Draw();
384 
385  }
void Draw(const char *opt="u")
Definition: MCTrueView.cxx:265
static std::vector< sim::Particle > gsPartList
Definition: MCTrueView.cxx:47
static bool CompMother(const sim::Particle &a, const sim::Particle &b)
Definition: MCTrueView.cxx:389
void evd::MCTrueView::SortNHit ( )

Definition at line 467 of file MCTrueView.cxx.

References CompNHit(), and Draw().

468  {
469  static bool fwd = true;
470  if (fwd) {
471  sort(gsPartList.begin(), gsPartList.end(), CompNHit);
472  fwd = false;
473  }
474  else {
475  sort(gsPartList.rbegin(), gsPartList.rend(), CompNHit);
476  fwd = true;
477  }
478 
479  Draw();
480 
481  }
void Draw(const char *opt="u")
Definition: MCTrueView.cxx:265
static bool CompNHit(const sim::Particle &a, const sim::Particle &b)
Definition: MCTrueView.cxx:485
static std::vector< sim::Particle > gsPartList
Definition: MCTrueView.cxx:47
void evd::MCTrueView::SortParticle ( )

Definition at line 346 of file MCTrueView.cxx.

References CompParticle(), and Draw().

347  {
348  static bool fwd = true;
349  if (fwd) {
350  sort(gsPartList.begin(), gsPartList.end(), CompParticle);
351  fwd = false;
352  }
353  else {
354  sort(gsPartList.rbegin(), gsPartList.rend(), CompParticle);
355  fwd = true;
356  }
357 
358  Draw();
359 
360  }
static bool CompParticle(const sim::Particle &a, const sim::Particle &b)
Definition: MCTrueView.cxx:364
void Draw(const char *opt="u")
Definition: MCTrueView.cxx:265
static std::vector< sim::Particle > gsPartList
Definition: MCTrueView.cxx:47
void evd::MCTrueView::SortTime ( )

Definition at line 492 of file MCTrueView.cxx.

References CompTime(), and Draw().

493  {
494  static bool fwd = true;
495  if (fwd) {
496  sort(gsPartList.begin(), gsPartList.end(), CompTime);
497  fwd = false;
498  }
499  else {
500  sort(gsPartList.rbegin(), gsPartList.rend(), CompTime);
501  fwd = true;
502  }
503 
504  Draw();
505 
506  }
static bool CompTime(const sim::Particle &a, const sim::Particle &b)
Definition: MCTrueView.cxx:510
void Draw(const char *opt="u")
Definition: MCTrueView.cxx:265
static std::vector< sim::Particle > gsPartList
Definition: MCTrueView.cxx:47
void evd::MCTrueView::SortTrackId ( )

Definition at line 419 of file MCTrueView.cxx.

References CompTrackId(), and Draw().

420  {
421  static bool fwd = true;
422  if (fwd) {
423  sort(gsPartList.begin(), gsPartList.end(), CompTrackId);
424  fwd = false;
425  }
426  else {
427  sort(gsPartList.rbegin(), gsPartList.rend(), CompTrackId);
428  fwd = true;
429  }
430  Draw();
431  }
void Draw(const char *opt="u")
Definition: MCTrueView.cxx:265
static std::vector< sim::Particle > gsPartList
Definition: MCTrueView.cxx:47
static bool CompTrackId(const sim::Particle &a, const sim::Particle &b)
Definition: MCTrueView.cxx:435
void evd::MCTrueView::SortVtxZ ( )

Definition at line 442 of file MCTrueView.cxx.

References CompVtxZ(), and Draw().

443  {
444  static bool fwd = true;
445  if (fwd) {
446  sort(gsPartList.begin(), gsPartList.end(), CompVtxZ);
447  fwd = false;
448  }
449  else {
450  sort(gsPartList.rbegin(), gsPartList.rend(), CompVtxZ);
451  fwd = true;
452  }
453 
454  Draw();
455 
456  }
void Draw(const char *opt="u")
Definition: MCTrueView.cxx:265
static std::vector< sim::Particle > gsPartList
Definition: MCTrueView.cxx:47
static bool CompVtxZ(const sim::Particle &a, const sim::Particle &b)
Definition: MCTrueView.cxx:460
void evd::MCTrueView::Update ( )

Definition at line 232 of file MCTrueView.cxx.

References fPartList, fScrollBar, fShowNegative, fShowNeutral, fShowPositive, MECModelEnuComparisons::i, kNPart, and simb::MCParticle::TrackId().

Referenced by progbar.ProgressBar::Finish(), progbar.ProgressBar::Start(), and UpdateAndDraw().

233  {
234  fPartList.clear();
235 
236  for (unsigned int i=0; i<gsPartList.size(); ++i) {
238 
239  // check charge information
240  int q = gsCharge[p.TrackId()];
241  if ( (fShowNegative->GetState() == kButtonUp && q<0) ||
242  (fShowPositive->GetState() == kButtonUp && q>0) ||
243  (fShowNeutral->GetState() == kButtonUp && q==0) ) {
244  continue;
245  }
246 
247  fPartList.push_back(p.TrackId());
248  }
249 
250  fScrollBar->SetRange(gsPartList.size(),kNPart);
251  fScrollBar->SetPosition(0);
252 
253  }
TGVScrollBar * fScrollBar
Definition: MCTrueView.h:108
const char * p
Definition: xmltok.h:285
TGCheckButton * fShowNegative
Definition: MCTrueView.h:111
static std::map< int, int > gsCharge
Definition: MCTrueView.cxx:48
int TrackId() const
Definition: MCParticle.h:209
std::vector< int > fPartList
Definition: MCTrueView.h:89
static std::vector< sim::Particle > gsPartList
Definition: MCTrueView.cxx:47
TGCheckButton * fShowPositive
Definition: MCTrueView.h:110
TGCheckButton * fShowNeutral
Definition: MCTrueView.h:112
void evd::MCTrueView::UpdateAndDraw ( )

Definition at line 257 of file MCTrueView.cxx.

References Draw(), and Update().

258  {
259  Update();
260  Draw();
261  }
void Draw(const char *opt="u")
Definition: MCTrueView.cxx:265

Member Data Documentation

float evdb::ObjListCanvas::fAspectRatio
protectedinherited

fYsize/fXsize

Definition at line 48 of file ObjListCanvas.h.

Referenced by evdb::ObjListCanvas::ObjListCanvas().

TGCompositeFrame* evd::MCTrueView::fBigFrame
private

Definition at line 92 of file MCTrueView.h.

Referenced by MCTrueView().

TCanvas* evdb::ObjListCanvas::fCanvas
protectedinherited

The ROOT drawing canvas.

Definition at line 44 of file ObjListCanvas.h.

const sim::Particle* evd::MCTrueView::fCheckMap[kNPart]
private

Definition at line 87 of file MCTrueView.h.

Referenced by Draw(), and HiLite().

TGTextButton* evd::MCTrueView::fColumnLabel[kNPanel]
private

Definition at line 99 of file MCTrueView.h.

Referenced by MCTrueView().

TGCheckButton* evd::MCTrueView::fDrawCheck[kNPart]
private

Definition at line 97 of file MCTrueView.h.

Referenced by Draw(), HiLite(), and MCTrueView().

TRootEmbeddedCanvas* evdb::ObjListCanvas::fEmbCanvas
protectedinherited

Embedded canvas.

Definition at line 43 of file ObjListCanvas.h.

int evd::MCTrueView::fFirstParticle
private

Definition at line 85 of file MCTrueView.h.

Referenced by Draw(), HandleMouseWheel(), HiLite(), and LoadEvent().

TGCompositeFrame* evdb::ObjListCanvas::fFrame
protectedinherited

Graphics frame.

Definition at line 41 of file ObjListCanvas.h.

Referenced by evdb::ObjListCanvas::ObjListCanvas(), and evdb::ObjListCanvas::~ObjListCanvas().

TGLayoutHints evd::MCTrueView::fL1
private

Definition at line 95 of file MCTrueView.h.

Referenced by MCTrueView().

TGLayoutHints evd::MCTrueView::fL2
private

Definition at line 95 of file MCTrueView.h.

Referenced by MCTrueView().

TGLayoutHints evd::MCTrueView::fL3
private

Definition at line 95 of file MCTrueView.h.

TGLayoutHints evd::MCTrueView::fL4
private

Definition at line 95 of file MCTrueView.h.

Referenced by MCTrueView().

TGLayoutHints evd::MCTrueView::fL5
private

Definition at line 95 of file MCTrueView.h.

Referenced by MCTrueView().

TGLayoutHints* evdb::ObjListCanvas::fLayout
protectedinherited

Layout hints for frame.

Definition at line 42 of file ObjListCanvas.h.

Referenced by evdb::ObjListCanvas::ObjListCanvas(), and evdb::ObjListCanvas::~ObjListCanvas().

TGCompositeFrame* evd::MCTrueView::fPartFrame[kNPanel]
private

Definition at line 93 of file MCTrueView.h.

Referenced by MCTrueView().

TGLabel* evd::MCTrueView::fPartLabel[kNPanel][kNPart]
private

Definition at line 98 of file MCTrueView.h.

Referenced by Draw(), and MCTrueView().

std::vector<int> evd::MCTrueView::fPartList
private

Definition at line 89 of file MCTrueView.h.

Referenced by Draw(), LoadEvent(), and Update().

RawDataDrawer* evd::MCTrueView::fRaw
private

Definition at line 115 of file MCTrueView.h.

Referenced by MCTrueView().

RecoBaseDrawer* evd::MCTrueView::fReco
private

Definition at line 116 of file MCTrueView.h.

Referenced by MCTrueView().

TGVScrollBar* evd::MCTrueView::fScrollBar
private

Definition at line 108 of file MCTrueView.h.

Referenced by HandleMouseWheel(), MCTrueView(), and Update().

TGCompositeFrame* evd::MCTrueView::fShowFrame
private

Definition at line 109 of file MCTrueView.h.

Referenced by MCTrueView().

TGCheckButton* evd::MCTrueView::fShowNegative
private

Definition at line 111 of file MCTrueView.h.

Referenced by MCTrueView(), and Update().

TGCheckButton* evd::MCTrueView::fShowNeutral
private

Definition at line 112 of file MCTrueView.h.

Referenced by MCTrueView(), and Update().

TGCheckButton* evd::MCTrueView::fShowPositive
private

Definition at line 110 of file MCTrueView.h.

Referenced by MCTrueView(), and Update().

SimulationDrawer* evd::MCTrueView::fSim
private

Definition at line 114 of file MCTrueView.h.

Referenced by HiLite(), and MCTrueView().

unsigned short evdb::ObjListCanvas::fXsize
protectedinherited

Size of the canvas;.

Definition at line 46 of file ObjListCanvas.h.

Referenced by evdb::ObjListCanvas::ObjListCanvas().

unsigned short evdb::ObjListCanvas::fYsize
protectedinherited

Size of the canvas;.

Definition at line 47 of file ObjListCanvas.h.

Referenced by evdb::ObjListCanvas::ObjListCanvas().


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