File indexing completed on 2025-01-31 09:21:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #ifndef CEXMC_ENERGY_DEPOSIT_DIGITIZER_HH
0045 #define CEXMC_ENERGY_DEPOSIT_DIGITIZER_HH
0046
0047 #include <iosfwd>
0048 #include <G4VDigitizerModule.hh>
0049 #include <G4SystemOfUnits.hh>
0050 #include "CexmcEnergyDepositStore.hh"
0051 #include "CexmcSimpleRangeWithValue.hh"
0052 #include "CexmcException.hh"
0053 #include "CexmcCommon.hh"
0054
0055 class G4String;
0056 class CexmcEnergyDepositDigitizerMessenger;
0057
0058
0059 class CexmcEnergyDepositDigitizer : public G4VDigitizerModule
0060 {
0061 public:
0062 explicit CexmcEnergyDepositDigitizer( const G4String & name );
0063
0064 ~CexmcEnergyDepositDigitizer();
0065
0066 public:
0067 void Digitize( void );
0068
0069 public:
0070 G4double GetMonitorED( void ) const;
0071
0072 G4double GetVetoCounterEDLeft( void ) const;
0073
0074 G4double GetVetoCounterEDRight( void ) const;
0075
0076 G4double GetCalorimeterEDLeft( void ) const;
0077
0078 G4double GetCalorimeterEDRight( void ) const;
0079
0080 G4int GetCalorimeterEDLeftMaxX( void ) const;
0081
0082 G4int GetCalorimeterEDLeftMaxY( void ) const;
0083
0084 G4int GetCalorimeterEDRightMaxX( void ) const;
0085
0086 G4int GetCalorimeterEDRightMaxY( void ) const;
0087
0088 const CexmcEnergyDepositCalorimeterCollection &
0089 GetCalorimeterEDLeftCollection( void ) const;
0090
0091 const CexmcEnergyDepositCalorimeterCollection &
0092 GetCalorimeterEDRightCollection( void ) const;
0093
0094 public:
0095 G4bool MonitorHasTriggered( void ) const;
0096
0097 G4bool HasTriggered( void ) const;
0098
0099 public:
0100 void SetMonitorThreshold( G4double value,
0101 G4bool fromMessenger = true );
0102
0103 void SetVetoCounterLeftThreshold( G4double value,
0104 G4bool fromMessenger = true );
0105
0106 void SetVetoCounterRightThreshold( G4double value,
0107 G4bool fromMessenger = true );
0108
0109 void SetVetoCountersThreshold( G4double value );
0110
0111 void SetCalorimeterLeftThreshold( G4double value,
0112 G4bool fromMessenger = true );
0113
0114 void SetCalorimeterRightThreshold( G4double value,
0115 G4bool fromMessenger = true );
0116
0117 void SetCalorimetersThreshold( G4double value );
0118
0119 void SetCalorimeterTriggerAlgorithm(
0120 CexmcCalorimeterTriggerAlgorithm value,
0121 G4bool fromMessenger = true );
0122
0123 void SetOuterCrystalsVetoAlgorithm(
0124 CexmcOuterCrystalsVetoAlgorithm value,
0125 G4bool fromMessenger = true );
0126
0127 void SetOuterCrystalsVetoFraction( G4double value,
0128 G4bool fromMessenger = true );
0129
0130 void ApplyFiniteCrystalResolution( G4bool value,
0131 G4bool fromMessenger = true );
0132
0133 void AddCrystalResolutionRange( G4double bottom, G4double top,
0134 G4double value,
0135 G4bool fromMessenger = true );
0136
0137 void ClearCrystalResolutionData( G4bool fromMessenger = true );
0138
0139 void SetCrystalResolutionData(
0140 const CexmcEnergyRangeWithDoubleValueList & data );
0141
0142 G4double GetMonitorThreshold( void ) const;
0143
0144 G4double GetVetoCounterLeftThreshold( void ) const;
0145
0146 G4double GetVetoCounterRightThreshold( void ) const;
0147
0148 G4double GetCalorimeterLeftThreshold( void ) const;
0149
0150 G4double GetCalorimeterRightThreshold( void ) const;
0151
0152 CexmcCalorimeterTriggerAlgorithm
0153 GetCalorimeterTriggerAlgorithm( void ) const;
0154
0155 CexmcOuterCrystalsVetoAlgorithm
0156 GetOuterCrystalsVetoAlgorithm( void ) const;
0157
0158 G4double GetOuterCrystalsVetoFraction( void ) const;
0159
0160 G4bool IsFiniteCrystalResolutionApplied( void ) const;
0161
0162 const CexmcEnergyRangeWithDoubleValueList &
0163 GetCrystalResolutionData( void ) const;
0164
0165 public:
0166 G4bool IsOuterCrystal( G4int column, G4int row ) const;
0167
0168 private:
0169 void InitializeData( void );
0170
0171 private:
0172 G4double monitorED;
0173
0174 G4double vetoCounterEDLeft;
0175
0176 G4double vetoCounterEDRight;
0177
0178 CexmcEnergyDepositCalorimeterCollection calorimeterEDLeftCollection;
0179
0180 CexmcEnergyDepositCalorimeterCollection calorimeterEDRightCollection;
0181
0182 G4double calorimeterEDLeft;
0183
0184 G4double calorimeterEDRight;
0185
0186 G4int calorimeterEDLeftMaxX;
0187
0188 G4int calorimeterEDLeftMaxY;
0189
0190 G4int calorimeterEDRightMaxX;
0191
0192 G4int calorimeterEDRightMaxY;
0193
0194 G4bool monitorHasTriggered;
0195
0196 G4bool hasTriggered;
0197
0198 private:
0199 G4double monitorEDThreshold;
0200
0201 G4double vetoCounterEDLeftThreshold;
0202
0203 G4double vetoCounterEDRightThreshold;
0204
0205 G4double calorimeterEDLeftThreshold;
0206
0207 G4double calorimeterEDRightThreshold;
0208
0209 CexmcCalorimeterTriggerAlgorithm calorimeterTriggerAlgorithm;
0210
0211 CexmcOuterCrystalsVetoAlgorithm outerCrystalsVetoAlgorithm;
0212
0213 G4double outerCrystalsVetoFraction;
0214
0215 G4double monitorEDThresholdRef;
0216
0217 G4double vetoCounterEDLeftThresholdRef;
0218
0219 G4double vetoCounterEDRightThresholdRef;
0220
0221 G4double calorimeterEDLeftThresholdRef;
0222
0223 G4double calorimeterEDRightThresholdRef;
0224
0225 CexmcCalorimeterTriggerAlgorithm calorimeterTriggerAlgorithmRef;
0226
0227 CexmcOuterCrystalsVetoAlgorithm outerCrystalsVetoAlgorithmRef;
0228
0229 G4double outerCrystalsVetoFractionRef;
0230
0231 private:
0232 G4int nCrystalsInColumn;
0233
0234 G4int nCrystalsInRow;
0235
0236 private:
0237 G4bool applyFiniteCrystalResolution;
0238
0239 CexmcEnergyRangeWithDoubleValueList crystalResolutionData;
0240
0241 private:
0242 CexmcEnergyDepositDigitizerMessenger * messenger;
0243 };
0244
0245
0246 inline G4double CexmcEnergyDepositDigitizer::GetMonitorED( void ) const
0247 {
0248 return monitorED;
0249 }
0250
0251
0252 inline G4double CexmcEnergyDepositDigitizer::GetVetoCounterEDLeft( void ) const
0253 {
0254 return vetoCounterEDLeft;
0255 }
0256
0257
0258 inline G4double CexmcEnergyDepositDigitizer::GetVetoCounterEDRight( void )
0259 const
0260 {
0261 return vetoCounterEDRight;
0262 }
0263
0264
0265 inline G4double CexmcEnergyDepositDigitizer::GetCalorimeterEDLeft( void ) const
0266 {
0267 return calorimeterEDLeft;
0268 }
0269
0270
0271 inline G4double CexmcEnergyDepositDigitizer::GetCalorimeterEDRight( void )
0272 const
0273 {
0274 return calorimeterEDRight;
0275 }
0276
0277
0278 inline G4int CexmcEnergyDepositDigitizer::GetCalorimeterEDLeftMaxX( void )
0279 const
0280 {
0281 return calorimeterEDLeftMaxX;
0282 }
0283
0284
0285 inline G4int CexmcEnergyDepositDigitizer::GetCalorimeterEDLeftMaxY( void )
0286 const
0287 {
0288 return calorimeterEDLeftMaxY;
0289 }
0290
0291
0292 inline G4int CexmcEnergyDepositDigitizer::GetCalorimeterEDRightMaxX( void )
0293 const
0294 {
0295 return calorimeterEDRightMaxX;
0296 }
0297
0298
0299 inline G4int CexmcEnergyDepositDigitizer::GetCalorimeterEDRightMaxY( void )
0300 const
0301 {
0302 return calorimeterEDRightMaxY;
0303 }
0304
0305
0306 inline const CexmcEnergyDepositCalorimeterCollection &
0307 CexmcEnergyDepositDigitizer::GetCalorimeterEDLeftCollection( void ) const
0308 {
0309 return calorimeterEDLeftCollection;
0310 }
0311
0312
0313 inline const CexmcEnergyDepositCalorimeterCollection &
0314 CexmcEnergyDepositDigitizer::GetCalorimeterEDRightCollection( void ) const
0315 {
0316 return calorimeterEDRightCollection;
0317 }
0318
0319
0320 inline G4bool CexmcEnergyDepositDigitizer::MonitorHasTriggered( void ) const
0321 {
0322 return monitorHasTriggered;
0323 }
0324
0325
0326 inline G4bool CexmcEnergyDepositDigitizer::HasTriggered( void ) const
0327 {
0328 return hasTriggered;
0329 }
0330
0331
0332 inline void CexmcEnergyDepositDigitizer::SetMonitorThreshold(
0333 G4double value, G4bool fromMessenger )
0334 {
0335 if ( fromMessenger )
0336 ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
0337 value < monitorEDThresholdRef );
0338 else
0339 monitorEDThresholdRef = value;
0340
0341 monitorEDThreshold = value;
0342 }
0343
0344
0345 inline void CexmcEnergyDepositDigitizer::SetVetoCounterLeftThreshold(
0346 G4double value, G4bool fromMessenger )
0347 {
0348 if ( fromMessenger )
0349 ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
0350 value > vetoCounterEDLeftThresholdRef );
0351 else
0352 vetoCounterEDLeftThresholdRef = value;
0353
0354 vetoCounterEDLeftThreshold = value;
0355 }
0356
0357
0358 inline void CexmcEnergyDepositDigitizer::SetVetoCounterRightThreshold(
0359 G4double value, G4bool fromMessenger )
0360 {
0361 if ( fromMessenger )
0362 ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
0363 value > vetoCounterEDRightThresholdRef );
0364 else
0365 vetoCounterEDRightThresholdRef = value;
0366
0367 vetoCounterEDRightThreshold = value;
0368 }
0369
0370
0371 inline void CexmcEnergyDepositDigitizer::SetVetoCountersThreshold(
0372 G4double value )
0373 {
0374 ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
0375 value > vetoCounterEDLeftThresholdRef ||
0376 value > vetoCounterEDRightThresholdRef );
0377
0378 vetoCounterEDLeftThreshold = value;
0379 vetoCounterEDRightThreshold = value;
0380 }
0381
0382
0383 inline void CexmcEnergyDepositDigitizer::SetCalorimeterLeftThreshold(
0384 G4double value, G4bool fromMessenger )
0385 {
0386 if ( fromMessenger )
0387 ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
0388 value < calorimeterEDLeftThresholdRef );
0389 else
0390 calorimeterEDLeftThresholdRef = value;
0391
0392 calorimeterEDLeftThreshold = value;
0393 }
0394
0395
0396 inline void CexmcEnergyDepositDigitizer::SetCalorimeterRightThreshold(
0397 G4double value, G4bool fromMessenger )
0398 {
0399 if ( fromMessenger )
0400 ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
0401 value < calorimeterEDRightThresholdRef );
0402 else
0403 calorimeterEDRightThresholdRef = value;
0404
0405 calorimeterEDRightThreshold = value;
0406 }
0407
0408
0409 inline void CexmcEnergyDepositDigitizer::SetCalorimetersThreshold(
0410 G4double value )
0411 {
0412 ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
0413 value < calorimeterEDLeftThresholdRef ||
0414 value < calorimeterEDRightThresholdRef );
0415
0416 calorimeterEDLeftThreshold = value;
0417 calorimeterEDRightThreshold = value;
0418 }
0419
0420
0421 inline void CexmcEnergyDepositDigitizer::SetCalorimeterTriggerAlgorithm(
0422 CexmcCalorimeterTriggerAlgorithm value, G4bool fromMessenger )
0423 {
0424 if ( fromMessenger )
0425 ThrowExceptionIfProjectIsRead( CexmcBadCalorimeterTriggerAlgorithm,
0426 ! ( calorimeterTriggerAlgorithmRef ==
0427 CexmcAllCrystalsMakeEDTriggerThreshold ||
0428 value == calorimeterTriggerAlgorithmRef ) );
0429 else
0430 calorimeterTriggerAlgorithmRef = value;
0431
0432 calorimeterTriggerAlgorithm = value;
0433 }
0434
0435
0436 inline void CexmcEnergyDepositDigitizer::SetOuterCrystalsVetoAlgorithm(
0437 CexmcOuterCrystalsVetoAlgorithm value, G4bool fromMessenger )
0438 {
0439 if ( fromMessenger )
0440 ThrowExceptionIfProjectIsRead( CexmcBadOCVetoAlgorithm,
0441 ! ( outerCrystalsVetoAlgorithmRef == CexmcNoOuterCrystalsVeto ||
0442 value == outerCrystalsVetoAlgorithmRef ) );
0443 else
0444 outerCrystalsVetoAlgorithmRef = value;
0445
0446 outerCrystalsVetoAlgorithm = value;
0447 }
0448
0449
0450 inline void CexmcEnergyDepositDigitizer::SetOuterCrystalsVetoFraction(
0451 G4double value, G4bool fromMessenger )
0452 {
0453 if ( fromMessenger )
0454 ThrowExceptionIfProjectIsRead( CexmcBadOCVetoFraction,
0455 value > outerCrystalsVetoFractionRef );
0456 else
0457 outerCrystalsVetoFractionRef = value;
0458
0459 outerCrystalsVetoFraction = value;
0460 }
0461
0462
0463 inline void CexmcEnergyDepositDigitizer::ApplyFiniteCrystalResolution(
0464 G4bool value, G4bool fromMessenger )
0465 {
0466 if ( fromMessenger )
0467 ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
0468
0469 applyFiniteCrystalResolution = value;
0470 }
0471
0472
0473 inline void CexmcEnergyDepositDigitizer::AddCrystalResolutionRange(
0474 G4double bottom, G4double top,
0475 G4double value, G4bool fromMessenger )
0476 {
0477 if ( fromMessenger )
0478 ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
0479
0480
0481 crystalResolutionData.push_back( CexmcEnergyRangeWithDoubleValue(
0482 bottom * GeV, top * GeV, value ) );
0483 }
0484
0485
0486 inline void CexmcEnergyDepositDigitizer::ClearCrystalResolutionData(
0487 G4bool fromMessenger )
0488 {
0489 if ( fromMessenger )
0490 ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
0491
0492 crystalResolutionData.clear();
0493 }
0494
0495
0496 inline void CexmcEnergyDepositDigitizer::SetCrystalResolutionData(
0497 const CexmcEnergyRangeWithDoubleValueList & data )
0498 {
0499 ClearCrystalResolutionData( false );
0500 crystalResolutionData = data;
0501 }
0502
0503
0504 inline G4bool CexmcEnergyDepositDigitizer::IsOuterCrystal( G4int column,
0505 G4int row ) const
0506 {
0507 return column == 0 || column == nCrystalsInRow - 1 ||
0508 row == 0 || row == nCrystalsInColumn - 1;
0509 }
0510
0511
0512 inline G4double CexmcEnergyDepositDigitizer::GetMonitorThreshold( void ) const
0513 {
0514 return monitorEDThreshold;
0515 }
0516
0517
0518 inline G4double CexmcEnergyDepositDigitizer::GetVetoCounterLeftThreshold(
0519 void ) const
0520 {
0521 return vetoCounterEDLeftThreshold;
0522 }
0523
0524
0525 inline G4double CexmcEnergyDepositDigitizer::GetVetoCounterRightThreshold(
0526 void ) const
0527 {
0528 return vetoCounterEDRightThreshold;
0529 }
0530
0531
0532 inline G4double CexmcEnergyDepositDigitizer::GetCalorimeterLeftThreshold(
0533 void ) const
0534 {
0535 return calorimeterEDLeftThreshold;
0536 }
0537
0538
0539 inline G4double CexmcEnergyDepositDigitizer::GetCalorimeterRightThreshold(
0540 void ) const
0541 {
0542 return calorimeterEDRightThreshold;
0543 }
0544
0545
0546 inline CexmcCalorimeterTriggerAlgorithm
0547 CexmcEnergyDepositDigitizer::GetCalorimeterTriggerAlgorithm(
0548 void ) const
0549 {
0550 return calorimeterTriggerAlgorithm;
0551 }
0552
0553
0554 inline CexmcOuterCrystalsVetoAlgorithm
0555 CexmcEnergyDepositDigitizer::GetOuterCrystalsVetoAlgorithm(
0556 void ) const
0557 {
0558 return outerCrystalsVetoAlgorithm;
0559 }
0560
0561
0562 inline G4double CexmcEnergyDepositDigitizer::GetOuterCrystalsVetoFraction(
0563 void ) const
0564 {
0565 return outerCrystalsVetoFraction;
0566 }
0567
0568
0569 inline G4bool CexmcEnergyDepositDigitizer::IsFiniteCrystalResolutionApplied(
0570 void ) const
0571 {
0572 return applyFiniteCrystalResolution;
0573 }
0574
0575
0576 inline const CexmcEnergyRangeWithDoubleValueList &
0577 CexmcEnergyDepositDigitizer::GetCrystalResolutionData( void ) const
0578 {
0579 return crystalResolutionData;
0580 }
0581
0582
0583 std::ostream & operator<<( std::ostream & out,
0584 const CexmcEnergyDepositCalorimeterCollection & edCollection );
0585
0586
0587 #endif
0588