Public Member Functions | Private Attributes | List of all members
genie::masterclass::MCTruthDisplay Class Reference

Display MC truth info. More...

#include <MCTruthDisplay.h>

Public Member Functions

 MCTruthDisplay (TRootEmbeddedCanvas *ec=0, TGTextEdit *gtx=0)
 
 ~MCTruthDisplay ()
 
void DrawDiagram (EventRecord *event)
 
void PrintEventRecord (EventRecord *event)
 

Private Attributes

TRootEmbeddedCanvas * fEmbeddedCanvas
 
TGTextEdit * fGTxt
 

Detailed Description

Display MC truth info.

Author
Costas Andreopoulos <constantinos.andreopoulos cern.ch> University of Liverpool & STFC Rutherford Appleton Laboratory

November 30, 2007

Copyright (c) 2003-2020, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 29 of file MCTruthDisplay.h.

Constructor & Destructor Documentation

MCTruthDisplay::MCTruthDisplay ( TRootEmbeddedCanvas *  ec = 0,
TGTextEdit *  gtx = 0 
)

Definition at line 38 of file MCTruthDisplay.cxx.

38  :
39 fEmbeddedCanvas(ec),
40 fGTxt(gtx)
41 {
42 
43 }
TRootEmbeddedCanvas * fEmbeddedCanvas
MCTruthDisplay::~MCTruthDisplay ( )

Definition at line 45 of file MCTruthDisplay.cxx.

46 {
47 
48 }

Member Function Documentation

void MCTruthDisplay::DrawDiagram ( EventRecord event)

Definition at line 50 of file MCTruthDisplay.cxx.

51 {
52  if(!fEmbeddedCanvas) return;
53 
54  LOG("MasterClass", pINFO) << "Drawing input event diagram";
55 
56  fEmbeddedCanvas->GetCanvas()->cd();
57  fEmbeddedCanvas->GetCanvas()->Clear();
58 
59  fEmbeddedCanvas->GetCanvas()->Range(0,0,30,30);
60  fEmbeddedCanvas->GetCanvas()->SetFillColor(0);
61  fEmbeddedCanvas->GetCanvas()->SetBorderMode(0);
62 
63  GHepParticle * target = event->TargetNucleus();
64  if(target) {
65  int A = target->A();
66  double R = nuclear::Radius(A);
67  TEllipse grpx_target(0,0,R,R);
68  grpx_target.Draw();
69  fEmbeddedCanvas->GetCanvas()->Update();
70  }
71 
72  GHepParticle * p = 0;
73  TIter event_iter(event);
74  while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) ) {
75 
76 
77  }
78 
79  //
80  // ...
81  //
82 
83  fEmbeddedCanvas->GetCanvas()->Update();
84 }
TRootEmbeddedCanvas * fEmbeddedCanvas
double Radius(int A, double Ro=constants::kNucRo)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
p
Definition: test.py:223
#define pINFO
Definition: Messenger.h:62
#define A
Definition: memgrp.cpp:38
int A(void) const
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
void MCTruthDisplay::PrintEventRecord ( EventRecord event)

Definition at line 86 of file MCTruthDisplay.cxx.

87 {
88  if(!fGTxt) return;
89 
90  ostringstream ghep;
91  ghep << *event;
92  string ghepstr = ghep.str(); // GHEP record as a single string
93 
94  // split GHEP string to get 1 line per particle - use '\n' as delimiter
95  vector<string> lines;
96  string delim = string("\n");
97  while(ghepstr.find_first_of(delim) < ghepstr.length()) {
98  lines.push_back(
99  ghepstr.substr(0, ghepstr.find_first_of(delim)) );
100  ghepstr = ghepstr.substr(
101  ghepstr.find_first_of(delim)+1, ghepstr.length());
102  }
103  lines.push_back(ghepstr);
104 
105  // print GHEP entries to TGTextView
106  vector<string>::iterator line_iter;
107  for(line_iter = lines.begin(); line_iter != lines.end(); ++line_iter) {
108  fGTxt->AddLine( line_iter->c_str() );
109  }
110 }
intermediate_table::iterator iterator
string delim()
Definition: fcldump.cxx:40
std::string string
Definition: nybbler.cc:12

Member Data Documentation

TRootEmbeddedCanvas* genie::masterclass::MCTruthDisplay::fEmbeddedCanvas
private

Definition at line 36 of file MCTruthDisplay.h.

TGTextEdit* genie::masterclass::MCTruthDisplay::fGTxt
private

Definition at line 37 of file MCTruthDisplay.h.


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