ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
InDet::InDetMaterialVeto Class Reference

#include <InDetMaterialVeto.h>

Inheritance diagram for InDet::InDetMaterialVeto:
Collaboration diagram for InDet::InDetMaterialVeto:

Public Member Functions

 InDetMaterialVeto (const BeamPipeDetectorManager *beamPipeMgr, const InDetDD::PixelDetectorManager *pixelManager)
 
std::unique_ptr< TH2DITkPixMaterialMap ()
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

std::unique_ptr< TH2Dm_ITkPixMaterialMap
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Definition at line 29 of file InDetMaterialVeto.h.

Constructor & Destructor Documentation

◆ InDetMaterialVeto()

InDet::InDetMaterialVeto::InDetMaterialVeto ( const BeamPipeDetectorManager beamPipeMgr,
const InDetDD::PixelDetectorManager pixelManager 
)

Definition at line 22 of file InDetMaterialVeto.cxx.

23  :
24  AthMessaging(Gaudi::svcLocator()->service< IMessageSvc >( "MessageSvc" ),"InDetMaterialVeto")
25  {
26 
27  ATH_MSG_DEBUG("Building material rejection map from BeamPipe and PixelDetectorManager");
28 
29  static constexpr int nbins_R = 76;
30  double bins_R[nbins_R+1];
31  for(unsigned int i=0; i<=15; i++) bins_R[i] = 2*i - 1.; // 2 mm bin width below R=29 mm, centered on R=24 mm (beampipe)
32  bins_R[16] = 30.; // 29-30 makes junction with pixel bins, veto IPT R=29.3 mm
33  static constexpr double Rbinwidth_pixel = 6.;
34  for(unsigned int i=1; i<=60; i++) bins_R[i+16] = 30 + Rbinwidth_pixel*i; // 6 mm bin width beyond R=30 mm
35 
36  static constexpr int nbins_Z = 1000;
37  static constexpr double zmax = 3000.;
38  static constexpr double zbinwidth = 2*zmax/nbins_Z;
39 
40  std::string mapName = "ITkMaterialMap";
41  m_ITkPixMaterialMap = std::make_unique<TH2D>(mapName.c_str(),mapName.c_str(),nbins_Z,-zmax,zmax,nbins_R,bins_R); // x-axis = global z coordinates, -3240 mm to +3240 mm, 6 mm bin width / y-axis = global R coordinates, variable bin width
42 
43 
44  // Retrieve the beam pipe radius from the SectionC03 volume
45 
46  double beamPipeRadius = 0.;
47  PVConstLink beamPipeTopVolume = beamPipeMgr->getTreeTop(0);
48  const GeoLogVol* beamPipeLogVolume = beamPipeTopVolume->getLogVol();
49  const GeoTube* beamPipeTube = nullptr;
50 
51  if (beamPipeLogVolume){
52  beamPipeTube = dynamic_cast<const GeoTube*>(beamPipeLogVolume->getShape());
53  if (beamPipeTube){
54 
55  for(unsigned int i=0;i<beamPipeTopVolume->getNChildVols();i++){
56 
57  if(beamPipeTopVolume->getNameOfChildVol(i)=="SectionC03"){
58  PVConstLink childTopVolume = beamPipeTopVolume->getChildVol(i);
59  const GeoLogVol* childLogVolume = childTopVolume->getLogVol();
60  const GeoTube* childTube = nullptr;
61 
62  if (childLogVolume){
63  childTube = dynamic_cast<const GeoTube*>(childLogVolume->getShape());
64  if (childTube){
65  beamPipeRadius = 0.5 * (childTube->getRMax()+childTube->getRMin());
66  }
67  }
68 
69  break; //Exit loop after SectionC03 is found
70  }
71 
72  } // Loop over child volumes
73 
74  }
75  } // if(beamPipeLogVolume)
76 
77  ATH_MSG_DEBUG("BeamPipeRadius used for material rejection="<<beamPipeRadius);
78 
79  // Fill map with beam pipe radius for all z
80  for(double z = -zmax + 0.5*zbinwidth; z<zmax; z+=zbinwidth) m_ITkPixMaterialMap->Fill(z,beamPipeRadius);
81 
82 
83  // Retrieve IPT radius
84  // Labelled as anonymous volume so taken as pixel volume with smallest radius
85 
86  double IPTRadius = -1.;
87 
88  PVConstLink pixelTopVolume = pixelManager->getTreeTop(0);
89 
90  for(unsigned int i=0;i<pixelTopVolume->getNChildVols();i++){
91 
92  PVConstLink childTopVolume = pixelTopVolume->getChildVol(i);
93  const GeoLogVol* childLogVolume = childTopVolume->getLogVol();
94  const GeoTube* childTube = nullptr;
95 
96  if (childLogVolume){
97  childTube = dynamic_cast<const GeoTube*>(childLogVolume->getShape());
98  if (childTube){
99  double radius = 0.5*(childTube->getRMin()+childTube->getRMax());
100  if(IPTRadius<0. || radius<IPTRadius) IPTRadius = radius;
101  }
102  }
103 
104  }
105 
106  ATH_MSG_DEBUG("IPTRadius used for material rejection="<<IPTRadius);
107 
108  // Fill map with IPT radius for all z
109  for(double z = -zmax + 0.5*zbinwidth; z<zmax; z+=zbinwidth) m_ITkPixMaterialMap->Fill(z,IPTRadius);
110 
111 
112  InDetDD::SiDetectorElementCollection::const_iterator iter;
113  for (iter = pixelManager->getDetectorElementBegin(); iter != pixelManager->getDetectorElementEnd(); ++iter) {
114  // get the ID
115  Identifier Pixel_ModuleID = (*iter)->identify();
116  // check the validity
117  if (Pixel_ModuleID.is_valid()) {
118  const InDetDD::SiDetectorElement *module = pixelManager->getDetectorElement(Pixel_ModuleID);
119 
120  //Take into account full module extent
121  InDetDD::DetectorType type = module->design().type();
122 
124  double zMin_mod = module->zMin();
125  double zMax_mod = module->zMax();
126  double rMin_mod = module->rMin();
127  double rMax_mod = module->rMax();
128  if(zMin_mod>0){
129  double alpha = (rMin_mod-rMax_mod)/(zMax_mod-zMin_mod);
130  for(double z=zMin_mod; z<=zMax_mod; z+=zbinwidth){
131  double R = rMax_mod + alpha*(z-zMin_mod);
132  m_ITkPixMaterialMap->Fill(z,R);
133  }
134  }
135  else{
136  double alpha = (rMax_mod-rMin_mod)/(zMax_mod-zMin_mod);
137  for(double z=zMin_mod; z<=zMax_mod; z+=zbinwidth){
138  double R = rMin_mod + alpha*(z-zMin_mod);
139  m_ITkPixMaterialMap->Fill(z,R);
140  }
141  }
142  }
143 
144  else if(type==InDetDD::PixelBarrel){
145  double zMin_mod = module->zMin();
146  double zMax_mod = module->zMax();
147  double R = std::hypot(module->center().x(),module->center().y());
148  for(double z=zMin_mod; z<=zMax_mod; z+=zbinwidth) m_ITkPixMaterialMap->Fill(z,R);
149  }
150 
151  else if(type==InDetDD::PixelEndcap){
152  double rMin_mod = module->rMin();
153  double rMax_mod = module->rMax();
154  double z = module->center().z();
155  for(double R=rMin_mod; R<=rMax_mod; R+=Rbinwidth_pixel) m_ITkPixMaterialMap->Fill(z,R);
156  }
157 
158  }
159  } // end loop over pixel modules
160 
161  }

Member Function Documentation

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ ITkPixMaterialMap()

std::unique_ptr<TH2D> InDet::InDetMaterialVeto::ITkPixMaterialMap ( )
inline

Definition at line 34 of file InDetMaterialVeto.h.

34 { return std::move(m_ITkPixMaterialMap); }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_ITkPixMaterialMap

std::unique_ptr<TH2D> InDet::InDetMaterialVeto::m_ITkPixMaterialMap
private

Definition at line 37 of file InDetMaterialVeto.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
IDTPM::R
float R(const U &p)
Definition: TrackParametersHelper.h:101
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
BeamPipeDetectorManager::getTreeTop
virtual PVConstLink getTreeTop(unsigned int i) const
Definition: BeamPipeDetectorManager.cxx:20
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
Identifier::is_valid
bool is_valid() const
Check if id is in a valid state.
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
InDetDD::PixelInclined
@ PixelInclined
Definition: DetectorDesign.h:46
InDetDD::PixelEndcap
@ PixelEndcap
Definition: DetectorDesign.h:46
python.PyAthena.module
module
Definition: PyAthena.py:134
AthMessaging::AthMessaging
AthMessaging()
Default constructor:
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
InDetDD::DetectorType
DetectorType
Definition: DetectorDesign.h:45
lumiFormat.i
int i
Definition: lumiFormat.py:92
z
#define z
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
PixelAthClusterMonAlgCfg.zmax
zmax
Definition: PixelAthClusterMonAlgCfg.py:176
InDetDD::PixelDetectorManager::getDetectorElementBegin
virtual SiDetectorElementCollection::const_iterator getDetectorElementBegin() const override
Definition: PixelDetectorManager.cxx:110
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
InDet::InDetMaterialVeto::m_ITkPixMaterialMap
std::unique_ptr< TH2D > m_ITkPixMaterialMap
Definition: InDetMaterialVeto.h:37
InDetDD::PixelBarrel
@ PixelBarrel
Definition: DetectorDesign.h:46
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
InDetDD::PixelDetectorManager::getTreeTop
virtual PVConstLink getTreeTop(unsigned int i) const override
Definition: PixelDetectorManager.cxx:71
InDetDD::PixelDetectorManager::getDetectorElementEnd
virtual SiDetectorElementCollection::const_iterator getDetectorElementEnd() const override
Definition: PixelDetectorManager.cxx:115
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
InDetDD::PixelDetectorManager::getDetectorElement
virtual SiDetectorElement * getDetectorElement(const Identifier &id) const override
access to individual elements : via Identifier
Definition: PixelDetectorManager.cxx:80