GENIEGenerator
Loading...
Searching...
No Matches
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 <c.andreopoulos \at cern.ch> University of Liverpool
Created:\n November 30, 2007
License:\n Copyright (c) 2003-2025, 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::MCTruthDisplay ( TRootEmbeddedCanvas * ec = 0,
TGTextEdit * gtx = 0 )

Definition at line 38 of file MCTruthDisplay.cxx.

38 :
40fGTxt(gtx)
41{
42
43}
TRootEmbeddedCanvas * fEmbeddedCanvas

References fEmbeddedCanvas, and fGTxt.

◆ ~MCTruthDisplay()

MCTruthDisplay::~MCTruthDisplay ( )

Definition at line 45 of file MCTruthDisplay.cxx.

46{
47
48}

Member Function Documentation

◆ DrawDiagram()

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}
#define pINFO
Definition Messenger.h:62
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
int A(void) const
double Radius(int A, double Ro=constants::kNucRo)

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

◆ PrintEventRecord()

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}

References fGTxt.

Member Data Documentation

◆ fEmbeddedCanvas

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

Definition at line 36 of file MCTruthDisplay.h.

Referenced by DrawDiagram(), and MCTruthDisplay().

◆ fGTxt

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

Definition at line 37 of file MCTruthDisplay.h.

Referenced by MCTruthDisplay(), and PrintEventRecord().


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