ATLAS Offline Software
TRTDigCondFakeMap.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "TRTDigCondFakeMap.h"
6 #include "TRTDigSettings.h"
7 #include "TRTDigiHelper.h"
8 
9 // For the Athena-based random numbers.
10 #include "CLHEP/Random/RandFlat.h"
11 #include "CLHEP/Random/RandGaussZiggurat.h"
12 #include "CLHEP/Random/RandomEngine.h"
13 
14 // Units
15 #include "CLHEP/Units/SystemOfUnits.h"
16 
17 //helpers for identifiers and hitids:
18 #include "InDetIdentifier/TRT_ID.h"
19 
20 #include <cmath>
21 #include <cstdlib>
22 #include <utility>
23 
24 //________________________________________________________________________________
26  const InDetDD::TRT_DetectorManager* detmgr,
27  const TRT_ID* trt_id,
28  int UseGasMix,
29  ToolHandle<ITRT_StrawStatusSummaryTool> sumTool
30  )
31 : TRTDigCondBase(digset, detmgr, trt_id, UseGasMix, std::move(sumTool))
32 {
34 }
35 
36 
37 //________________________________________________________________________________
39  const double& strawlength,
40  double& noiselevel,
41  double& relative_noiseamplitude,
42  CLHEP::HepRandomEngine* rndmEngine) {
43 
44  noiselevel = m_average_noiselevel; // Not used here, but returned to caller
45 
46  // 5% relative fluctuation is hard-coded here
47  double relnoiseamp = CLHEP::RandGaussZiggurat::shoot(rndmEngine, 1.00, 0.05 );
48  while (relnoiseamp < 0.10) { relnoiseamp = CLHEP::RandGaussZiggurat::shoot(rndmEngine, 1.00, 0.05 ); }
49 
50  // Anatoli says we need to scale the noise amplitude of Kr,Ar according to LT_(Kr,Ar)/LT_Xe
51  MsgStream* amsg = &(msg());
52  const int statusHT = m_sumTool->getStatusHT(TRT_Identifier);
53  const int strawGasType = TRTDigiHelper::StrawGasType(statusHT,m_UseGasMix, amsg);
54  bool isBar = abs(m_id_helper->barrel_ec(TRT_Identifier))==1;
55  double averagenoiseampforstrawlength = ( ( (800.)/(100*CLHEP::cm) ) * strawlength + 2100.0 ) / 2500.0;
56 
57  if ( isBar ) {
58  averagenoiseampforstrawlength *= ( m_settings->lowThresholdBar(strawGasType)/m_settings->lowThresholdBar(0) );
59  } else {
60  averagenoiseampforstrawlength *= ( m_settings->lowThresholdEC(strawGasType)/m_settings->lowThresholdEC(0) );
61  }
62 
63  relative_noiseamplitude = relnoiseamp * averagenoiseampforstrawlength;
64 }
TRTDigCondFakeMap.h
TRTDigSettings::lowThresholdEC
double lowThresholdEC(int strawGasType) const
TRTDigSettings.h
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
TRTDigCondFakeMap::setStrawStateInfo
void setStrawStateInfo(Identifier &TRT_Identifier, const double &strawlength, double &noiselevel, double &relative_noiseamplitude, CLHEP::HepRandomEngine *rndmEngine)
Get straw state info based on hitid and strawlength.
Definition: TRTDigCondFakeMap.cxx:38
TRTDigSettings::averageNoiseLevel
double averageNoiseLevel() const
Get average noise level.
TRTDigCondBase::m_id_helper
const TRT_ID * m_id_helper
Definition: TRTDigCondBase.h:139
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
TRTDigCondBase::m_settings
const TRTDigSettings * m_settings
Definition: TRTDigCondBase.h:137
TRTDigCondFakeMap::TRTDigCondFakeMap
TRTDigCondFakeMap(const TRTDigSettings *, const InDetDD::TRT_DetectorManager *, const TRT_ID *trt_id, int UseGasMix, ToolHandle< ITRT_StrawStatusSummaryTool > sumTool)
Constructor.
Definition: TRTDigCondFakeMap.cxx:25
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
TRTDigSettings::lowThresholdBar
double lowThresholdBar(int strawGasType) const
Get discriminator setting for low threshold.
TRTDigCondBase::m_sumTool
ToolHandle< ITRT_StrawStatusSummaryTool > m_sumTool
Definition: TRTDigCondBase.h:182
TRTDigiHelper.h
TRT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: TRT_ID.h:866
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
TRTDigCondBase::m_UseGasMix
int m_UseGasMix
Definition: TRTDigCondBase.h:181
TRT_ID
Definition: TRT_ID.h:84
InDetDD::TRT_DetectorManager
The Detector Manager for all TRT Detector elements, it acts as the interface to the detector elements...
Definition: TRT_DetectorManager.h:69
TRTDigCondFakeMap::m_average_noiselevel
float m_average_noiselevel
Average noise level
Definition: TRTDigCondFakeMap.h:35
TRTDigiHelper::StrawGasType
int StrawGasType(int statusHT, int useGasMix, MsgStream *log)
Definition: TRTDigiHelper.cxx:11
TRTDigSettings
Class containing parameters and settings used by TRT digitization.
Definition: TRTDigSettings.h:35
TRTDigCondBase
Communication with CondDB.
Definition: TRTDigCondBase.h:32