Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CexmcEventAction Class Reference

#include <CexmcEventAction.hh>

Inheritance diagram for CexmcEventAction:
Collaboration diagram for CexmcEventAction:

Public Member Functions

 CexmcEventAction (CexmcPhysicsManager *physicsManager, G4int verbose=0)
 
virtual ~CexmcEventAction ()
 
void BeginOfEventAction (const G4Event *event)
 
void EndOfEventAction (const G4Event *event)
 
void BeamParticleChangeHook (void)
 
void SetVerboseOnCexmcLevel (G4int value)
 
void SetVerboseDrawLevel (G4int value)
 
CexmcChargeExchangeReconstructorGetReconstructor (void)
 
- Public Member Functions inherited from G4UserEventAction
 G4UserEventAction ()
 
virtual ~G4UserEventAction ()
 
virtual void SetEventManager (G4EventManager *value)
 

Static Public Member Functions

static CexmcEnergyDepositStoreMakeEnergyDepositStore (const CexmcEnergyDepositDigitizer *digitizer)
 
static CexmcTrackPointsStoreMakeTrackPointsStore (const CexmcTrackPointsDigitizer *digitizer)
 
static void PrintEnergyDeposit (const CexmcEnergyDepositStore *edStore)
 
static void PrintTrackPoints (const CexmcTrackPointsStore *tpStore)
 
static void PrintProductionModelData (const CexmcAngularRangeList &angularRanges, const CexmcProductionModelData &pmData)
 

Additional Inherited Members

- Protected Attributes inherited from G4UserEventAction
G4EventManagerfpEventManager
 

Detailed Description

Definition at line 61 of file CexmcEventAction.hh.

Constructor & Destructor Documentation

CexmcEventAction::CexmcEventAction ( CexmcPhysicsManager physicsManager,
G4int  verbose = 0 
)
explicit

Definition at line 94 of file CexmcEventAction.cc.

95  :
96  physicsManager( physicsManager ), reconstructor( NULL ), opKinEnergy( 0. ),
97  verbose( verbose ), verboseDraw( 4 ), messenger( NULL )
98 {
99  G4DigiManager * digiManager( G4DigiManager::GetDMpointer() );
100  digiManager->AddNewModule( new CexmcEnergyDepositDigitizer(
102  digiManager->AddNewModule( new CexmcTrackPointsDigitizer(
104  reconstructor = new CexmcChargeExchangeReconstructor(
105  physicsManager->GetProductionModel() );
106  messenger = new CexmcEventActionMessenger( this );
107 }
const G4String CexmcTPDigitizerName("TPDig")
static G4DigiManager * GetDMpointer()
const G4String CexmcEDDigitizerName("EDDig")
virtual CexmcProductionModel * GetProductionModel(void)=0

Here is the call graph for this function:

CexmcEventAction::~CexmcEventAction ( )
virtual

Definition at line 110 of file CexmcEventAction.cc.

111 {
112  delete reconstructor;
113  delete messenger;
114 }

Member Function Documentation

void CexmcEventAction::BeamParticleChangeHook ( void  )

Definition at line 117 of file CexmcEventAction.cc.

118 {
119  reconstructor->SetupBeamParticle();
120 }

Here is the call graph for this function:

Here is the caller graph for this function:

void CexmcEventAction::BeginOfEventAction ( const G4Event event)
virtual

Reimplemented from G4UserEventAction.

Definition at line 123 of file CexmcEventAction.cc.

124 {
125  G4RunManager * runManager( G4RunManager::GetRunManager() );
126  CexmcTrackingAction * trackingAction
127  ( static_cast< CexmcTrackingAction * >(
128  const_cast< G4UserTrackingAction * >(
129  runManager->GetUserTrackingAction() ) ) );
130  trackingAction->BeginOfEventAction();
131 
133 }
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
void ResetNumberOfTriggeredStudiedInteractions(void)

Here is the call graph for this function:

void CexmcEventAction::EndOfEventAction ( const G4Event event)
virtual

Reimplemented from G4UserEventAction.

Definition at line 799 of file CexmcEventAction.cc.

800 {
801  G4DigiManager * digiManager( G4DigiManager::GetDMpointer() );
802  CexmcEnergyDepositDigitizer * energyDepositDigitizer(
803  static_cast< CexmcEnergyDepositDigitizer * >( digiManager->
804  FindDigitizerModule( CexmcEDDigitizerName ) ) );
805  CexmcTrackPointsDigitizer * trackPointsDigitizer(
806  static_cast< CexmcTrackPointsDigitizer * >( digiManager->
807  FindDigitizerModule( CexmcTPDigitizerName ) ) );
808 
809  energyDepositDigitizer->Digitize();
810  trackPointsDigitizer->Digitize();
811 
812  G4bool edDigitizerMonitorHasTriggered(
813  energyDepositDigitizer->MonitorHasTriggered() );
814  G4bool edDigitizerHasTriggered( false );
815 
816  CexmcEventInfo * eventInfo( static_cast< CexmcEventInfo * >(
817  event->GetUserInformation() ) );
818  if ( ! eventInfo || eventInfo->EdTriggerIsOk() )
819  edDigitizerHasTriggered = energyDepositDigitizer->HasTriggered();
820 
821  G4bool tpDigitizerHasTriggered( trackPointsDigitizer->HasTriggered() );
822  G4bool reconstructorHasBasicTrigger( false );
823  G4bool reconstructorHasFullTrigger( false );
824 
826  energyDepositDigitizer ) );
828  trackPointsDigitizer ) );
829 
830  try
831  {
832  CexmcProductionModel * productionModel(
833  physicsManager->GetProductionModel() );
834 
835  if ( ! productionModel )
837 
838  const CexmcAngularRangeList & angularRanges(
839  productionModel->GetAngularRanges() );
840  const CexmcAngularRangeList & triggeredAngularRanges(
841  productionModel->GetTriggeredAngularRanges() );
842  const CexmcProductionModelData & pmData(
843  productionModel->GetProductionModelData() );
844 
845  if ( edDigitizerHasTriggered )
846  {
847  reconstructor->Reconstruct( edStore );
848  reconstructorHasBasicTrigger = reconstructor->HasBasicTrigger();
849  reconstructorHasFullTrigger = reconstructor->HasFullTrigger();
850  }
851 
852  CexmcAngularRangeList triggeredRecAngularRanges;
853 
854  if ( reconstructorHasBasicTrigger )
855  {
856  for ( CexmcAngularRangeList::const_iterator
857  k( angularRanges.begin() ); k != angularRanges.end(); ++k )
858  {
859  G4double cosTheta( reconstructor->GetProductionModelData().
860  outputParticleSCM.cosTheta() );
861  if ( cosTheta <= k->top && cosTheta > k->bottom )
862  triggeredRecAngularRanges.push_back( CexmcAngularRange(
863  k->top, k->bottom, k->index ) );
864  }
865  }
866 
867  CexmcAngularRange angularGap( 0.0, 0.0, 0 );
868  if ( triggeredRecAngularRanges.empty() )
869  {
870  CexmcAngularRangeList angularGaps;
871  GetAngularGaps( angularRanges, angularGaps );
872  for ( CexmcAngularRangeList::const_iterator
873  k( angularGaps.begin() ); k != angularGaps.end(); ++k )
874  {
875  G4double cosTheta( reconstructor->GetProductionModelData().
876  outputParticleSCM.cosTheta() );
877  if ( cosTheta <= k->top && cosTheta > k->bottom )
878  {
879  angularGap = *k;
880  break;
881  }
882  }
883  }
884 
885  UpdateRunHits( triggeredAngularRanges, triggeredRecAngularRanges,
886  tpDigitizerHasTriggered, edDigitizerHasTriggered,
887  edDigitizerMonitorHasTriggered,
888  reconstructorHasFullTrigger, angularGap );
889 
890  if ( verbose > 0 )
891  {
892  G4bool printMessages( verbose > 3 ||
893  ( ( verbose == 1 ) && tpDigitizerHasTriggered ) ||
894  ( ( verbose == 2 ) && edDigitizerHasTriggered ) ||
895  ( ( verbose == 3 ) && ( tpDigitizerHasTriggered ||
896  edDigitizerHasTriggered ) ) );
897  if ( printMessages )
898  {
899  G4cout << "Event " << event->GetEventID() << G4endl;
900  if ( tpDigitizerHasTriggered )
901  {
902  PrintTrackPoints( tpStore );
903  PrintProductionModelData( triggeredAngularRanges, pmData );
904  }
905  if ( reconstructorHasBasicTrigger )
906  PrintReconstructedData( triggeredRecAngularRanges,
907  angularGap );
908  if ( edDigitizerHasTriggered )
909  PrintEnergyDeposit( edStore );
910  }
911  }
912 
913  if ( verboseDraw > 0 )
914  {
915  G4bool drawTrajectories( verboseDraw > 3 ||
916  ( ( verboseDraw == 1 ) && tpDigitizerHasTriggered ) ||
917  ( ( verboseDraw == 2 ) && edDigitizerHasTriggered ) ||
918  ( ( verboseDraw == 3 ) && ( tpDigitizerHasTriggered ||
919  edDigitizerHasTriggered ) ) );
920  if ( drawTrajectories )
921  {
922  DrawTrajectories( event );
923  if ( tpDigitizerHasTriggered )
924  DrawTrackPoints( tpStore );
925  if ( reconstructorHasBasicTrigger )
926  DrawReconstructionData();
927  }
928  }
929 
930 #ifdef CEXMC_USE_PERSISTENCY
931  if ( edDigitizerHasTriggered || tpDigitizerHasTriggered )
932  {
933  SaveEventFast( event, tpDigitizerHasTriggered,
934  edDigitizerHasTriggered,
935  edDigitizerMonitorHasTriggered,
936  pmData.outputParticleSCM.cosTheta() );
937  SaveEvent( event, edDigitizerHasTriggered, edStore, tpStore,
938  pmData );
939  }
940 #endif
941 
942 #ifdef CEXMC_USE_ROOT
943  /* opKinEnergy will be used in several histos */
944  if ( tpStore->targetTPOutputParticle.IsValid() )
945  {
946  opKinEnergy = CexmcGetKinEnergy(
947  tpStore->targetTPOutputParticle.momentumAmp,
948  tpStore->targetTPOutputParticle.particle->GetPDGMass() );
949  }
950 
951  if ( edDigitizerHasTriggered )
952  FillEDTHistos( edStore, triggeredAngularRanges );
953 
954  /* fill TPT histos only when the monitor has triggered because events
955  * when it was missed have less value for us */
956  if ( tpDigitizerHasTriggered && edDigitizerMonitorHasTriggered )
957  FillTPTHistos( tpStore, pmData, triggeredAngularRanges );
958 
959  if ( reconstructorHasBasicTrigger )
960  FillRTHistos( reconstructorHasFullTrigger, edStore, tpStore,
961  pmData, triggeredAngularRanges );
962 #endif
963 
964  G4Event * theEvent( const_cast< G4Event * >( event ) );
965  if ( eventInfo )
966  {
967  delete eventInfo;
968  theEvent->SetUserInformation( NULL );
969  }
970  theEvent->SetUserInformation( new CexmcEventInfo(
971  edDigitizerHasTriggered,
972  tpDigitizerHasTriggered,
973  reconstructorHasFullTrigger ) );
974  }
975  catch ( CexmcException & e )
976  {
977  G4cout << e.what() << G4endl;
978  }
979  catch ( ... )
980  {
981  G4cout << "Unknown exception caught" << G4endl;
982  }
983 
984  delete edStore;
985  delete tpStore;
986 }
const G4String CexmcTPDigitizerName("TPDig")
G4VUserEventInformation * GetUserInformation() const
Definition: G4Event.hh:199
static G4DigiManager * GetDMpointer()
static void PrintProductionModelData(const CexmcAngularRangeList &angularRanges, const CexmcProductionModelData &pmData)
const G4String CexmcEDDigitizerName("EDDig")
G4GLOB_DLL std::ostream G4cout
void Reconstruct(const CexmcEnergyDepositStore *edStore)
bool G4bool
Definition: G4Types.hh:79
G4bool HasBasicTrigger(void) const
static CexmcEnergyDepositStore * MakeEnergyDepositStore(const CexmcEnergyDepositDigitizer *digitizer)
static void PrintTrackPoints(const CexmcTrackPointsStore *tpStore)
static void PrintEnergyDeposit(const CexmcEnergyDepositStore *edStore)
static CexmcTrackPointsStore * MakeTrackPointsStore(const CexmcTrackPointsDigitizer *digitizer)
const char * what(void) const
const CexmcProductionModelData & GetProductionModelData(void) const
std::vector< CexmcAngularRange > CexmcAngularRangeList
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
virtual CexmcProductionModel * GetProductionModel(void)=0
void GetAngularGaps(const CexmcAngularRangeList &src, CexmcAngularRangeList &dst)

Here is the call graph for this function:

CexmcChargeExchangeReconstructor * CexmcEventAction::GetReconstructor ( void  )
inline

Definition at line 177 of file CexmcEventAction.hh.

178 {
179  return reconstructor;
180 }
CexmcEnergyDepositStore * CexmcEventAction::MakeEnergyDepositStore ( const CexmcEnergyDepositDigitizer digitizer)
static

Definition at line 136 of file CexmcEventAction.cc.

138 {
139  G4double monitorED( digitizer->GetMonitorED() );
140  G4double vetoCounterEDLeft( digitizer->GetVetoCounterEDLeft() );
141  G4double vetoCounterEDRight( digitizer->GetVetoCounterEDRight() );
142  G4double calorimeterEDLeft( digitizer->GetCalorimeterEDLeft() );
143  G4double calorimeterEDRight( digitizer->GetCalorimeterEDRight() );
144  G4int calorimeterEDLeftMaxX( digitizer->GetCalorimeterEDLeftMaxX() );
145  G4int calorimeterEDLeftMaxY( digitizer->GetCalorimeterEDLeftMaxY() );
146  G4int calorimeterEDRightMaxX( digitizer->GetCalorimeterEDRightMaxX() );
147  G4int calorimeterEDRightMaxY( digitizer->GetCalorimeterEDRightMaxY() );
148 
150  calorimeterEDLeftCollection(
151  digitizer->GetCalorimeterEDLeftCollection() );
153  calorimeterEDRightCollection(
154  digitizer->GetCalorimeterEDRightCollection() );
155 
156  /* ATTENTION: return object in heap - must be freed by caller! */
157  return new CexmcEnergyDepositStore( monitorED, vetoCounterEDLeft,
158  vetoCounterEDRight, calorimeterEDLeft, calorimeterEDRight,
159  calorimeterEDLeftMaxX, calorimeterEDLeftMaxY,
160  calorimeterEDRightMaxX, calorimeterEDRightMaxY,
161  calorimeterEDLeftCollection, calorimeterEDRightCollection );
162 }
int G4int
Definition: G4Types.hh:78
std::vector< CexmcEnergyDepositCrystalRowCollection > CexmcEnergyDepositCalorimeterCollection
Definition: CexmcCommon.hh:58
const CexmcEnergyDepositCalorimeterCollection & GetCalorimeterEDRightCollection(void) const
const CexmcEnergyDepositCalorimeterCollection & GetCalorimeterEDLeftCollection(void) const
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

CexmcTrackPointsStore * CexmcEventAction::MakeTrackPointsStore ( const CexmcTrackPointsDigitizer digitizer)
static

Definition at line 165 of file CexmcEventAction.cc.

167 {
168  const CexmcTrackPointInfo &
169  monitorTP( digitizer->GetMonitorTP() );
170  const CexmcTrackPointInfo &
171  targetTPBeamParticle(
172  digitizer->GetTargetTPBeamParticle() );
173  const CexmcTrackPointInfo &
174  targetTPOutputParticle(
175  digitizer->GetTargetTPOutputParticle() );
176  const CexmcTrackPointInfo &
177  targetTPNucleusParticle(
178  digitizer->GetTargetTPNucleusParticle() );
179  const CexmcTrackPointInfo &
180  targetTPOutputParticleDecayProductParticle1(
181  digitizer->
182  GetTargetTPOutputParticleDecayProductParticle( 0 ) );
183  const CexmcTrackPointInfo &
184  targetTPOutputParticleDecayProductParticle2(
185  digitizer->
186  GetTargetTPOutputParticleDecayProductParticle( 1 ) );
187  const CexmcTrackPointInfo &
188  vetoCounterTPLeft(
189  digitizer->GetVetoCounterTPLeft() );
190  const CexmcTrackPointInfo &
191  vetoCounterTPRight(
192  digitizer->GetVetoCounterTPRight() );
193  const CexmcTrackPointInfo &
194  calorimeterTPLeft(
195  digitizer->GetCalorimeterTPLeft() );
196  const CexmcTrackPointInfo &
197  calorimeterTPRight(
198  digitizer->GetCalorimeterTPRight() );
199 
200  /* ATTENTION: return object in heap - must be freed by caller! */
201  return new CexmcTrackPointsStore( monitorTP, targetTPBeamParticle,
202  targetTPOutputParticle, targetTPNucleusParticle,
203  targetTPOutputParticleDecayProductParticle1,
204  targetTPOutputParticleDecayProductParticle2,
205  vetoCounterTPLeft, vetoCounterTPRight,
206  calorimeterTPLeft, calorimeterTPRight );
207 }
const CexmcTrackPointInfo & GetVetoCounterTPRight(void) const
const CexmcTrackPointInfo & GetMonitorTP(void) const
const CexmcTrackPointInfo & GetTargetTPNucleusParticle(void) const
const CexmcTrackPointInfo & GetTargetTPBeamParticle(void) const
const CexmcTrackPointInfo & GetCalorimeterTPRight(void) const
const CexmcTrackPointInfo & GetCalorimeterTPLeft(void) const
const CexmcTrackPointInfo & GetTargetTPOutputParticle(void) const
const CexmcTrackPointInfo & GetVetoCounterTPLeft(void) const

Here is the call graph for this function:

Here is the caller graph for this function:

void CexmcEventAction::PrintEnergyDeposit ( const CexmcEnergyDepositStore edStore)
static

Definition at line 210 of file CexmcEventAction.cc.

212 {
213  G4cout << " --- Energy Deposit" << G4endl;
214  G4cout << " monitor : " <<
215  G4BestUnit( edStore->monitorED, "Energy" ) << G4endl;
216  G4cout << " vc (l) : " <<
217  G4BestUnit( edStore->vetoCounterEDLeft, "Energy" ) << G4endl;
218  G4cout << " vc (r) : " <<
219  G4BestUnit( edStore->vetoCounterEDRight, "Energy" ) << G4endl;
220  G4cout << " cal (l) : " <<
221  G4BestUnit( edStore->calorimeterEDLeft, "Energy" );
223  G4cout << " cal (r) : " <<
224  G4BestUnit( edStore->calorimeterEDRight, "Energy" );
226 }
const CexmcEnergyDepositCalorimeterCollection & calorimeterEDLeftCollection
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
const CexmcEnergyDepositCalorimeterCollection & calorimeterEDRightCollection

Here is the caller graph for this function:

void CexmcEventAction::PrintProductionModelData ( const CexmcAngularRangeList angularRanges,
const CexmcProductionModelData pmData 
)
static

Definition at line 259 of file CexmcEventAction.cc.

262 {
263  G4cout << " --- Triggered angular ranges: " << angularRanges;
264  G4cout << " --- Production model data: " << pmData;
265 }
G4GLOB_DLL std::ostream G4cout

Here is the caller graph for this function:

void CexmcEventAction::PrintTrackPoints ( const CexmcTrackPointsStore tpStore)
static

Definition at line 229 of file CexmcEventAction.cc.

231 {
232  if ( ! tpStore )
233  return;
234 
235  G4cout << " --- Track Points" << G4endl;
236  G4cout << " monitor : " << tpStore->monitorTP << G4endl;
237  G4cout << " target : " << tpStore->targetTPBeamParticle << G4endl;
238  G4cout << " : " << tpStore->targetTPOutputParticle << G4endl;
239  G4cout << " : " << tpStore->targetTPNucleusParticle << G4endl;
240  G4cout << " : " <<
242  G4cout << " : " <<
244  G4cout << " vc (l) : " << tpStore->vetoCounterTPLeft << G4endl;
245  G4cout << " vc (r) : " << tpStore->vetoCounterTPRight << G4endl;
246  G4cout << " cal (l) : " << tpStore->calorimeterTPLeft << G4endl;
247  G4cout << " cal (r) : " << tpStore->calorimeterTPRight << G4endl;
248  G4cout << " ---" << G4endl;
249  G4cout << " angle between the " <<
251  " decay products : " <<
253  angle(
255  deg << " deg" << G4endl;
256 }
static G4double angle[DIM]
const G4String & GetParticleName() const
const CexmcTrackPointInfo & targetTPNucleusParticle
G4GLOB_DLL std::ostream G4cout
const CexmcTrackPointInfo & calorimeterTPRight
const CexmcTrackPointInfo & vetoCounterTPRight
const CexmcTrackPointInfo & targetTPOutputParticleDecayProductParticle2
const CexmcTrackPointInfo & vetoCounterTPLeft
#define G4endl
Definition: G4ios.hh:61
const CexmcTrackPointInfo & targetTPOutputParticle
const CexmcTrackPointInfo & calorimeterTPLeft
static constexpr double deg
Definition: G4SIunits.hh:152
const CexmcTrackPointInfo & targetTPBeamParticle
const CexmcTrackPointInfo & monitorTP
G4ThreeVector directionWorld
const CexmcTrackPointInfo & targetTPOutputParticleDecayProductParticle1
const G4ParticleDefinition * particle

Here is the call graph for this function:

Here is the caller graph for this function:

void CexmcEventAction::SetVerboseDrawLevel ( G4int  value)
inline

Definition at line 170 of file CexmcEventAction.hh.

171 {
172  verboseDraw = value;
173 }
const XML_Char int const XML_Char * value
Definition: expat.h:331

Here is the caller graph for this function:

void CexmcEventAction::SetVerboseOnCexmcLevel ( G4int  value)
inline

Definition at line 164 of file CexmcEventAction.hh.

165 {
166  verbose = value;
167 }
const XML_Char int const XML_Char * value
Definition: expat.h:331

Here is the caller graph for this function:


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