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

Display MC truth info. More...

#include "/cvmfs/nova.opensciencegrid.org/externals/genie/v3_00_06_p01/Linux64bit+2.6-2.12-e17-debug/GENIE-Generator/src/Tools/Masterclass/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 <costas.andreopoulos stfc.ac.uk> University of Liverpool & STFC Rutherford Appleton Lab

November 30, 2007

Definition at line 27 of file MCTruthDisplay.h.

Constructor & Destructor Documentation

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

Definition at line 39 of file MCTruthDisplay.cxx.

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

Definition at line 46 of file MCTruthDisplay.cxx.

47 {
48 
49 }

Member Function Documentation

void MCTruthDisplay::DrawDiagram ( EventRecord event)

Definition at line 51 of file MCTruthDisplay.cxx.

References genie::units::A, genie::GHepParticle::A(), fEmbeddedCanvas, LOG, pINFO, R, and genie::utils::nuclear::Radius().

Referenced by genie::masterclass::GNuMcMainFrame::ShowEvent().

52 {
53  if(!fEmbeddedCanvas) return;
54 
55  LOG("MasterClass", pINFO) << "Drawing input event diagram";
56 
57  fEmbeddedCanvas->GetCanvas()->cd();
58  fEmbeddedCanvas->GetCanvas()->Clear();
59 
60  fEmbeddedCanvas->GetCanvas()->Range(0,0,30,30);
61  fEmbeddedCanvas->GetCanvas()->SetFillColor(0);
62  fEmbeddedCanvas->GetCanvas()->SetBorderMode(0);
63 
64  GHepParticle * target = event->TargetNucleus();
65  if(target) {
66  int A = target->A();
67  double R = nuclear::Radius(A);
68  TEllipse grpx_target(0,0,R,R);
69  grpx_target.Draw();
70  fEmbeddedCanvas->GetCanvas()->Update();
71  }
72 
73  GHepParticle * p = 0;
74  TIter event_iter(event);
75  while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) ) {
76 
77 
78  }
79 
80  //
81  // ...
82  //
83 
84  fEmbeddedCanvas->GetCanvas()->Update();
85 }
const XML_Char * target
Definition: expat.h:268
TRootEmbeddedCanvas * fEmbeddedCanvas
const char * p
Definition: xmltok.h:285
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:97
#define R(x)
#define pINFO
Definition: Messenger.h:63
static const double A
Definition: Units.h:82
int A(void) const
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
void MCTruthDisplay::PrintEventRecord ( EventRecord event)

Definition at line 87 of file MCTruthDisplay.cxx.

References fGTxt, hadd_many_files::lines, and string.

Referenced by genie::masterclass::GNuMcMainFrame::ShowEvent().

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

Member Data Documentation

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

Definition at line 34 of file MCTruthDisplay.h.

Referenced by DrawDiagram().

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

Definition at line 35 of file MCTruthDisplay.h.

Referenced by PrintEventRecord().


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