44 #ifndef CEXMC_HISTO_MANAGER_HH
45 #define CEXMC_HISTO_MANAGER_HH
52 #include <G4String.hh>
58 #ifdef CEXMC_USE_ROOTQT
64 class CexmcHistoManagerMessenger;
69 CexmcMomentumBP_TPT_Histo,
70 CexmcMomentumBP_RT_Histo,
71 CexmcMomentumIP_TPT_Histo,
72 CexmcTPInMonitor_TPT_Histo,
73 CexmcTPInTarget_TPT_Histo,
74 CexmcTPInTarget_RT_Histo,
75 CexmcRecMasses_EDT_Histo,
76 CexmcRecMasses_RT_Histo,
77 CexmcAbsorbedEnergy_EDT_Histo,
78 CexmcAbsorbedEnergy_RT_Histo,
79 CexmcHistoType_ARReal_START,
80 CexmcRecMassOP_ARReal_RT_Histo = CexmcHistoType_ARReal_START,
81 CexmcRecMassNOP_ARReal_RT_Histo,
82 CexmcOPDPAtLeftCalorimeter_ARReal_EDT_Histo,
83 CexmcOPDPAtRightCalorimeter_ARReal_EDT_Histo,
84 CexmcOPDPAtLeftCalorimeter_ARReal_RT_Histo,
85 CexmcOPDPAtRightCalorimeter_ARReal_RT_Histo,
86 CexmcRecOPDPAtLeftCalorimeter_ARReal_EDT_Histo,
87 CexmcRecOPDPAtRightCalorimeter_ARReal_EDT_Histo,
88 CexmcRecOPDPAtLeftCalorimeter_ARReal_RT_Histo,
89 CexmcRecOPDPAtRightCalorimeter_ARReal_RT_Histo,
90 CexmcKinEnAtLeftCalorimeter_ARReal_TPT_Histo,
91 CexmcKinEnAtRightCalorimeter_ARReal_TPT_Histo,
92 CexmcKinEnAtLeftCalorimeter_ARReal_RT_Histo,
93 CexmcKinEnAtRightCalorimeter_ARReal_RT_Histo,
94 CexmcAbsEnInLeftCalorimeter_ARReal_EDT_Histo,
95 CexmcAbsEnInRightCalorimeter_ARReal_EDT_Histo,
96 CexmcAbsEnInLeftCalorimeter_ARReal_RT_Histo,
97 CexmcAbsEnInRightCalorimeter_ARReal_RT_Histo,
98 CexmcMissEnFromLeftCalorimeter_ARReal_RT_Histo,
99 CexmcMissEnFromRightCalorimeter_ARReal_RT_Histo,
100 CexmcKinEnOP_LAB_ARReal_TPT_Histo,
101 CexmcKinEnOP_LAB_ARReal_RT_Histo,
102 CexmcAngleOP_SCM_ARReal_TPT_Histo,
103 CexmcAngleOP_SCM_ARReal_RT_Histo,
104 CexmcRecAngleOP_SCM_ARReal_RT_Histo,
105 CexmcDiffAngleOP_SCM_ARReal_RT_Histo,
106 CexmcOpenAngle_ARReal_TPT_Histo,
107 CexmcOpenAngle_ARReal_RT_Histo,
108 CexmcRecOpenAngle_ARReal_RT_Histo,
109 CexmcDiffOpenAngle_ARReal_RT_Histo,
110 CexmcTPInTarget_ARReal_TPT_Histo,
111 CexmcTPInTarget_ARReal_RT_Histo,
112 CexmcHistoType_ARReal_END = CexmcTPInTarget_ARReal_RT_Histo,
117 class CexmcHistoManager
120 typedef std::vector< TH1 * > CexmcHistoVector;
122 typedef std::map< CexmcHistoType, CexmcHistoVector > CexmcHistosMap;
124 typedef CexmcHistosMap::value_type CexmcHistoPair;
126 struct CexmcHistoAxisData
128 CexmcHistoAxisData() : nBins( 0 ), nBinsMin( 0 ), nBinsMax( 0 )
133 nBins( nBins ), nBinsMin( nBinsMin ), nBinsMax( nBinsMax )
143 typedef std::vector< CexmcHistoAxisData > CexmcHistoAxes;
152 struct CexmcHistoData
155 type( CexmcHistoType_SIZE ), impl( Cexmc_TH1F ),
156 isARHisto( false ), isARRec( false ), triggerType(
CexmcTPT )
159 CexmcHistoData( CexmcHistoType type, CexmcHistoImpl impl,
160 bool isARHisto,
bool isARRec,
163 const CexmcHistoAxes & axes ) :
164 type( type ), impl( impl ), isARHisto( isARHisto ),
165 isARRec( isARRec ), triggerType( triggerType ), name( name ),
166 title( title ), axes( axes )
187 static CexmcHistoManager * Instance(
void );
189 static void Destroy(
void );
194 ~CexmcHistoManager();
203 void Add( CexmcHistoType histoType,
unsigned int index,
206 void Add( CexmcHistoType histoType,
unsigned int index,
G4double x,
209 void Add( CexmcHistoType histoType,
unsigned int index,
G4double x,
212 void Add( CexmcHistoType histoType,
unsigned int index,
G4int binX,
215 void List(
void )
const;
219 #ifdef CEXMC_USE_ROOTQT
220 void Draw(
const G4String & histoName,
221 const G4String & histoDrawOptions =
"" );
225 void AddHistoMenu(
const G4String & handle,
226 const G4String & label =
"Histograms" );
228 void SetDrawOptions1D(
const G4String & value );
230 void SetDrawOptions2D(
const G4String & value );
232 void SetDrawOptions3D(
const G4String & value );
236 void SetVerboseLevel(
G4int value );
238 G4int GetVerboseLevel(
void )
const;
241 void AddHisto(
const CexmcHistoData & data,
244 void CreateHisto( CexmcHistoVector & histoVector,
247 const CexmcHistoAxes & axes );
249 #ifdef CEXMC_USE_ROOTQT
258 TDirectoryFile * outFile;
261 CexmcHistosMap histos;
275 #ifdef CEXMC_USE_ROOTQT
277 TQtWidget * rootCanvas;
279 G4bool areLiveHistogramsEnabled;
281 G4bool isHistoMenuInitialized;
295 CexmcHistoManagerMessenger * messenger;
298 static CexmcHistoManager *
instance;
302 inline void CexmcHistoManager::SetVerboseLevel(
G4int value )
304 verboseLevel = value;
308 inline G4int CexmcHistoManager::GetVerboseLevel(
void )
const
314 inline void CexmcHistoManager::AddHistoMenu(
const G4String & handle,
317 histoMenuHandle = handle;
318 histoMenuLabel = label;
322 inline void CexmcHistoManager::SetDrawOptions1D(
const G4String & value )
324 drawOptions1D = value;
328 inline void CexmcHistoManager::SetDrawOptions2D(
const G4String & value )
330 drawOptions2D = value;
334 inline void CexmcHistoManager::SetDrawOptions3D(
const G4String & value )
336 drawOptions3D = value;
static G4UIterminal * session
std::vector< CexmcAngularRange > CexmcAngularRangeList
static MCTruthManager * instance
G4bool isInitialized()
Check if the generator is initialized.
void Add(G4int Elements, T *To, T *A1, T *A2=NULL)
Add two arrays together.
void Print(G4Element &ele)