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 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 //
  2 // ********************************************************************
  3 // * License and Disclaimer                                           *
  4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.                             *
 10 // *                                                                  *
 11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                                                  *
 18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // ********************************************************************
 25 //
 26 /*
 27  * =============================================================================
 28  *
 29  *       Filename:  CexmcEnergyDepositDigitizer.hh
 30  *
 31  *    Description:  digitizes of energy deposit in a single event
 32  *
 33  *        Version:  1.0
 34  *        Created:  23.11.2009 14:14:47
 35  *       Revision:  none
 36  *       Compiler:  gcc
 37  *
 38  *         Author:  Alexey Radkov (), 
 39  *        Company:  PNPI
 40  *
 41  * =============================================================================
 42  */
 43 
 44 #ifndef CEXMC_ENERGY_DEPOSIT_DIGITIZER_HH
 45 #define CEXMC_ENERGY_DEPOSIT_DIGITIZER_HH
 46 
 47 #include <iosfwd>
 48 #include <G4VDigitizerModule.hh>
 49 #include <G4SystemOfUnits.hh>
 50 #include "CexmcEnergyDepositStore.hh"
 51 #include "CexmcSimpleRangeWithValue.hh"
 52 #include "CexmcException.hh"
 53 #include "CexmcCommon.hh"
 54 
 55 class  G4String;
 56 class  CexmcEnergyDepositDigitizerMessenger;
 57 
 58 
 59 class  CexmcEnergyDepositDigitizer : public G4VDigitizerModule
 60 {
 61     public:
 62         explicit CexmcEnergyDepositDigitizer( const G4String &  name );
 63 
 64         ~CexmcEnergyDepositDigitizer();
 65 
 66     public:
 67         void      Digitize( void );
 68 
 69     public:
 70         G4double  GetMonitorED( void ) const;
 71 
 72         G4double  GetVetoCounterEDLeft( void ) const;
 73 
 74         G4double  GetVetoCounterEDRight( void ) const;
 75 
 76         G4double  GetCalorimeterEDLeft( void ) const;
 77 
 78         G4double  GetCalorimeterEDRight( void ) const;
 79 
 80         G4int     GetCalorimeterEDLeftMaxX( void ) const;
 81 
 82         G4int     GetCalorimeterEDLeftMaxY( void ) const;
 83 
 84         G4int     GetCalorimeterEDRightMaxX( void ) const;
 85 
 86         G4int     GetCalorimeterEDRightMaxY( void ) const;
 87 
 88         const CexmcEnergyDepositCalorimeterCollection &
 89                                 GetCalorimeterEDLeftCollection( void ) const;
 90 
 91         const CexmcEnergyDepositCalorimeterCollection &
 92                                 GetCalorimeterEDRightCollection( void ) const;
 93 
 94     public:
 95         G4bool    MonitorHasTriggered( void ) const;
 96 
 97         G4bool    HasTriggered( void ) const;
 98 
 99     public:
100         void      SetMonitorThreshold( G4double  value,
101                                        G4bool  fromMessenger = true );
102 
103         void      SetVetoCounterLeftThreshold( G4double  value,
104                                                G4bool  fromMessenger = true );
105 
106         void      SetVetoCounterRightThreshold( G4double  value,
107                                                 G4bool  fromMessenger = true );
108 
109         void      SetVetoCountersThreshold( G4double  value );
110 
111         void      SetCalorimeterLeftThreshold( G4double  value,
112                                                G4bool  fromMessenger = true );
113 
114         void      SetCalorimeterRightThreshold( G4double  value,
115                                                 G4bool  fromMessenger = true );
116 
117         void      SetCalorimetersThreshold( G4double  value );
118 
119         void      SetCalorimeterTriggerAlgorithm(
120                                     CexmcCalorimeterTriggerAlgorithm  value,
121                                     G4bool  fromMessenger = true );
122 
123         void      SetOuterCrystalsVetoAlgorithm(
124                                     CexmcOuterCrystalsVetoAlgorithm  value,
125                                     G4bool  fromMessenger = true );
126 
127         void      SetOuterCrystalsVetoFraction( G4double  value,
128                                                 G4bool  fromMessenger = true );
129 
130         void      ApplyFiniteCrystalResolution( G4bool  value,
131                                                 G4bool  fromMessenger = true );
132 
133         void      AddCrystalResolutionRange( G4double  bottom, G4double  top,
134                                              G4double  value,
135                                              G4bool  fromMessenger = true );
136 
137         void      ClearCrystalResolutionData( G4bool  fromMessenger = true );
138 
139         void      SetCrystalResolutionData(
140                             const CexmcEnergyRangeWithDoubleValueList &  data );
141 
142         G4double  GetMonitorThreshold( void ) const;
143 
144         G4double  GetVetoCounterLeftThreshold( void ) const;
145 
146         G4double  GetVetoCounterRightThreshold( void ) const;
147 
148         G4double  GetCalorimeterLeftThreshold( void ) const;
149 
150         G4double  GetCalorimeterRightThreshold( void ) const;
151 
152         CexmcCalorimeterTriggerAlgorithm
153                   GetCalorimeterTriggerAlgorithm( void ) const;
154 
155         CexmcOuterCrystalsVetoAlgorithm
156                   GetOuterCrystalsVetoAlgorithm( void ) const;
157 
158         G4double  GetOuterCrystalsVetoFraction( void ) const;
159 
160         G4bool    IsFiniteCrystalResolutionApplied( void ) const;
161 
162         const CexmcEnergyRangeWithDoubleValueList &
163                   GetCrystalResolutionData( void ) const;
164 
165     public:
166         G4bool    IsOuterCrystal( G4int  column, G4int  row ) const;
167 
168     private:
169         void      InitializeData( void );
170 
171     private:
172         G4double                                 monitorED;
173 
174         G4double                                 vetoCounterEDLeft;
175 
176         G4double                                 vetoCounterEDRight;
177 
178         CexmcEnergyDepositCalorimeterCollection  calorimeterEDLeftCollection;
179 
180         CexmcEnergyDepositCalorimeterCollection  calorimeterEDRightCollection;
181 
182         G4double                                 calorimeterEDLeft;
183 
184         G4double                                 calorimeterEDRight;
185 
186         G4int                                    calorimeterEDLeftMaxX;
187 
188         G4int                                    calorimeterEDLeftMaxY;
189 
190         G4int                                    calorimeterEDRightMaxX;
191 
192         G4int                                    calorimeterEDRightMaxY;
193 
194         G4bool                                   monitorHasTriggered;
195 
196         G4bool                                   hasTriggered;
197 
198     private:
199         G4double                                 monitorEDThreshold;
200 
201         G4double                                 vetoCounterEDLeftThreshold;
202 
203         G4double                                 vetoCounterEDRightThreshold;
204 
205         G4double                                 calorimeterEDLeftThreshold;
206 
207         G4double                                 calorimeterEDRightThreshold;
208 
209         CexmcCalorimeterTriggerAlgorithm         calorimeterTriggerAlgorithm;
210 
211         CexmcOuterCrystalsVetoAlgorithm          outerCrystalsVetoAlgorithm;
212 
213         G4double                                 outerCrystalsVetoFraction;
214 
215         G4double                                 monitorEDThresholdRef;
216 
217         G4double                                 vetoCounterEDLeftThresholdRef;
218 
219         G4double                                 vetoCounterEDRightThresholdRef;
220 
221         G4double                                 calorimeterEDLeftThresholdRef;
222 
223         G4double                                 calorimeterEDRightThresholdRef;
224 
225         CexmcCalorimeterTriggerAlgorithm         calorimeterTriggerAlgorithmRef;
226 
227         CexmcOuterCrystalsVetoAlgorithm          outerCrystalsVetoAlgorithmRef;
228 
229         G4double                                 outerCrystalsVetoFractionRef;
230 
231     private:
232         G4int                                    nCrystalsInColumn;
233 
234         G4int                                    nCrystalsInRow;
235 
236     private:
237         G4bool                                   applyFiniteCrystalResolution;
238 
239         CexmcEnergyRangeWithDoubleValueList      crystalResolutionData;
240 
241     private:
242         CexmcEnergyDepositDigitizerMessenger *   messenger;
243 };
244 
245 
246 inline G4double  CexmcEnergyDepositDigitizer::GetMonitorED( void ) const
247 {
248     return monitorED;
249 }
250 
251 
252 inline G4double  CexmcEnergyDepositDigitizer::GetVetoCounterEDLeft( void ) const
253 {
254     return vetoCounterEDLeft;
255 }
256 
257 
258 inline G4double  CexmcEnergyDepositDigitizer::GetVetoCounterEDRight( void )
259                                                                         const
260 {
261     return vetoCounterEDRight;
262 }
263 
264 
265 inline G4double  CexmcEnergyDepositDigitizer::GetCalorimeterEDLeft( void ) const
266 {
267     return calorimeterEDLeft;
268 }
269 
270 
271 inline G4double  CexmcEnergyDepositDigitizer::GetCalorimeterEDRight( void )
272                                                                         const
273 {
274     return calorimeterEDRight;
275 }
276 
277 
278 inline G4int  CexmcEnergyDepositDigitizer::GetCalorimeterEDLeftMaxX( void )
279                                                                         const
280 {
281     return calorimeterEDLeftMaxX;
282 }
283 
284 
285 inline G4int  CexmcEnergyDepositDigitizer::GetCalorimeterEDLeftMaxY( void )
286                                                                         const
287 {
288     return calorimeterEDLeftMaxY;
289 }
290 
291 
292 inline G4int  CexmcEnergyDepositDigitizer::GetCalorimeterEDRightMaxX( void )
293                                                                         const
294 {
295     return calorimeterEDRightMaxX;
296 }
297 
298 
299 inline G4int  CexmcEnergyDepositDigitizer::GetCalorimeterEDRightMaxY( void )
300                                                                         const
301 {
302     return calorimeterEDRightMaxY;
303 }
304 
305 
306 inline const CexmcEnergyDepositCalorimeterCollection &
307     CexmcEnergyDepositDigitizer::GetCalorimeterEDLeftCollection( void ) const
308 {
309     return calorimeterEDLeftCollection;
310 }
311 
312 
313 inline const CexmcEnergyDepositCalorimeterCollection &
314     CexmcEnergyDepositDigitizer::GetCalorimeterEDRightCollection( void ) const
315 {
316     return calorimeterEDRightCollection;
317 }
318 
319 
320 inline G4bool  CexmcEnergyDepositDigitizer::MonitorHasTriggered( void ) const
321 {
322     return monitorHasTriggered;
323 }
324 
325 
326 inline G4bool  CexmcEnergyDepositDigitizer::HasTriggered( void ) const
327 {
328     return hasTriggered;
329 }
330 
331 
332 inline void  CexmcEnergyDepositDigitizer::SetMonitorThreshold(
333                                       G4double  value, G4bool  fromMessenger )
334 {
335     if ( fromMessenger )
336         ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
337                                        value < monitorEDThresholdRef );
338     else
339         monitorEDThresholdRef = value;
340 
341     monitorEDThreshold = value;
342 }
343 
344 
345 inline void  CexmcEnergyDepositDigitizer::SetVetoCounterLeftThreshold(
346                                       G4double  value, G4bool  fromMessenger )
347 {
348     if ( fromMessenger )
349         ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
350                                        value > vetoCounterEDLeftThresholdRef );
351     else
352         vetoCounterEDLeftThresholdRef = value;
353 
354     vetoCounterEDLeftThreshold = value;
355 }
356 
357 
358 inline void  CexmcEnergyDepositDigitizer::SetVetoCounterRightThreshold(
359                                       G4double  value, G4bool  fromMessenger )
360 {
361     if ( fromMessenger )
362         ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
363                                        value > vetoCounterEDRightThresholdRef );
364     else
365         vetoCounterEDRightThresholdRef = value;
366 
367     vetoCounterEDRightThreshold = value;
368 }
369 
370 
371 inline void  CexmcEnergyDepositDigitizer::SetVetoCountersThreshold(
372                                                             G4double  value )
373 {
374     ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
375                                    value > vetoCounterEDLeftThresholdRef ||
376                                    value > vetoCounterEDRightThresholdRef );
377 
378     vetoCounterEDLeftThreshold = value;
379     vetoCounterEDRightThreshold = value;
380 }
381 
382 
383 inline void  CexmcEnergyDepositDigitizer::SetCalorimeterLeftThreshold(
384                                       G4double  value, G4bool  fromMessenger )
385 {
386     if ( fromMessenger )
387         ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
388                                        value < calorimeterEDLeftThresholdRef );
389     else
390         calorimeterEDLeftThresholdRef = value;
391 
392     calorimeterEDLeftThreshold = value;
393 }
394 
395 
396 inline void  CexmcEnergyDepositDigitizer::SetCalorimeterRightThreshold(
397                                       G4double  value, G4bool  fromMessenger )
398 {
399     if ( fromMessenger )
400         ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
401                                        value < calorimeterEDRightThresholdRef );
402     else
403         calorimeterEDRightThresholdRef = value;
404 
405     calorimeterEDRightThreshold = value;
406 }
407 
408 
409 inline void  CexmcEnergyDepositDigitizer::SetCalorimetersThreshold(
410                                                             G4double  value )
411 {
412     ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
413                                    value < calorimeterEDLeftThresholdRef ||
414                                    value < calorimeterEDRightThresholdRef );
415 
416     calorimeterEDLeftThreshold = value;
417     calorimeterEDRightThreshold = value;
418 }
419 
420 
421 inline void  CexmcEnergyDepositDigitizer::SetCalorimeterTriggerAlgorithm(
422                 CexmcCalorimeterTriggerAlgorithm  value, G4bool  fromMessenger )
423 {
424     if ( fromMessenger )
425         ThrowExceptionIfProjectIsRead( CexmcBadCalorimeterTriggerAlgorithm,
426             ! ( calorimeterTriggerAlgorithmRef ==
427                                        CexmcAllCrystalsMakeEDTriggerThreshold ||
428                 value == calorimeterTriggerAlgorithmRef ) );
429     else
430         calorimeterTriggerAlgorithmRef = value;
431 
432     calorimeterTriggerAlgorithm = value;
433 }
434 
435 
436 inline void  CexmcEnergyDepositDigitizer::SetOuterCrystalsVetoAlgorithm(
437                 CexmcOuterCrystalsVetoAlgorithm  value, G4bool  fromMessenger )
438 {
439     if ( fromMessenger )
440         ThrowExceptionIfProjectIsRead( CexmcBadOCVetoAlgorithm,
441             ! ( outerCrystalsVetoAlgorithmRef == CexmcNoOuterCrystalsVeto ||
442                 value == outerCrystalsVetoAlgorithmRef ) );
443     else
444         outerCrystalsVetoAlgorithmRef = value;
445 
446     outerCrystalsVetoAlgorithm = value;
447 }
448 
449 
450 inline void  CexmcEnergyDepositDigitizer::SetOuterCrystalsVetoFraction(
451                                       G4double  value, G4bool  fromMessenger )
452 {
453     if ( fromMessenger )
454         ThrowExceptionIfProjectIsRead( CexmcBadOCVetoFraction,
455                                        value > outerCrystalsVetoFractionRef );
456     else
457         outerCrystalsVetoFractionRef = value;
458 
459     outerCrystalsVetoFraction = value;
460 }
461 
462 
463 inline void  CexmcEnergyDepositDigitizer::ApplyFiniteCrystalResolution(
464                                       G4bool  value, G4bool  fromMessenger )
465 {
466     if ( fromMessenger )
467         ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
468 
469     applyFiniteCrystalResolution = value;
470 }
471 
472 
473 inline void  CexmcEnergyDepositDigitizer::AddCrystalResolutionRange(
474                                       G4double  bottom, G4double  top,
475                                       G4double  value, G4bool  fromMessenger )
476 {
477     if ( fromMessenger )
478         ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
479 
480     /* range boundaries are given in GeV */
481     crystalResolutionData.push_back( CexmcEnergyRangeWithDoubleValue(
482                                             bottom * GeV, top * GeV, value ) );
483 }
484 
485 
486 inline void  CexmcEnergyDepositDigitizer::ClearCrystalResolutionData(
487                                                 G4bool  fromMessenger )
488 {
489     if ( fromMessenger )
490         ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
491 
492     crystalResolutionData.clear();
493 }
494 
495 
496 inline void  CexmcEnergyDepositDigitizer::SetCrystalResolutionData(
497                             const CexmcEnergyRangeWithDoubleValueList &  data )
498 {
499     ClearCrystalResolutionData( false );
500     crystalResolutionData = data;
501 }
502 
503 
504 inline G4bool  CexmcEnergyDepositDigitizer::IsOuterCrystal( G4int  column,
505                                                             G4int  row ) const
506 {
507     return column == 0 || column == nCrystalsInRow - 1 ||
508            row == 0 || row == nCrystalsInColumn - 1;
509 }
510 
511 
512 inline G4double  CexmcEnergyDepositDigitizer::GetMonitorThreshold( void ) const
513 {
514     return monitorEDThreshold;
515 }
516 
517 
518 inline G4double  CexmcEnergyDepositDigitizer::GetVetoCounterLeftThreshold(
519                                                                     void ) const
520 {
521     return vetoCounterEDLeftThreshold;
522 }
523 
524 
525 inline G4double  CexmcEnergyDepositDigitizer::GetVetoCounterRightThreshold(
526                                                                     void ) const
527 {
528     return vetoCounterEDRightThreshold;
529 }
530 
531 
532 inline G4double  CexmcEnergyDepositDigitizer::GetCalorimeterLeftThreshold(
533                                                                     void ) const
534 {
535     return calorimeterEDLeftThreshold;
536 }
537 
538 
539 inline G4double  CexmcEnergyDepositDigitizer::GetCalorimeterRightThreshold(
540                                                                     void ) const
541 {
542     return calorimeterEDRightThreshold;
543 }
544 
545 
546 inline  CexmcCalorimeterTriggerAlgorithm
547                 CexmcEnergyDepositDigitizer::GetCalorimeterTriggerAlgorithm(
548                                                                     void ) const
549 {
550     return calorimeterTriggerAlgorithm;
551 }
552 
553 
554 inline  CexmcOuterCrystalsVetoAlgorithm
555                 CexmcEnergyDepositDigitizer::GetOuterCrystalsVetoAlgorithm(
556                                                                     void ) const
557 {
558     return outerCrystalsVetoAlgorithm;
559 }
560 
561 
562 inline G4double  CexmcEnergyDepositDigitizer::GetOuterCrystalsVetoFraction(
563                                                                     void ) const
564 {
565     return outerCrystalsVetoFraction;
566 }
567 
568 
569 inline G4bool  CexmcEnergyDepositDigitizer::IsFiniteCrystalResolutionApplied(
570                                                                     void ) const
571 {
572     return applyFiniteCrystalResolution;
573 }
574 
575 
576 inline const CexmcEnergyRangeWithDoubleValueList &
577             CexmcEnergyDepositDigitizer::GetCrystalResolutionData( void ) const
578 {
579     return crystalResolutionData;
580 }
581 
582 
583 std::ostream &  operator<<( std::ostream &  out,
584                 const CexmcEnergyDepositCalorimeterCollection &  edCollection );
585 
586 
587 #endif
588 
589