CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
TotemT1Organization Class Reference

#include <SimG4CMS/Forward/interface/TotemT1Organization.h>

Inheritance diagram for TotemT1Organization:
TotemVDetectorOrganization TotemT1NumberingScheme

Public Types

enum  ObjectType {
  Undefined = 0, Upper = 1, Lower = 2, InternalUpper = 3,
  InternalLower = 4, Frame1 = 5, Frame2Left = 6, Frame2Right = 7,
  Frame3Left = 8, Frame3Right = 9, Frame4Left = 10, Frame4Right = 11,
  Frame5 = 12, Triangle6Left = 13, Triangle6Right = 14, MaxObjectTypes = 15
}
 

Public Member Functions

int fromObjectTypeToInt (ObjectType objectType)
 
int fromObjectTypeToInt (ObjectType objectType, int layer)
 
int getCurrentCSC (void) const
 
int getCurrentDetectorPosition (void) const
 
int getCurrentLayer (void) const
 
ObjectType getCurrentObjectType (void) const
 
int getCurrentPlane (void) const
 
int getCurrentUnitID (void) const
 
uint32_t getUnitID (const G4Step *aStep) const override
 
void setCurrentCSC (int currentCSC)
 
void setCurrentDetectorPosition (int currentDetectorPosition)
 
void setCurrentLayer (int currentLayer)
 
void setCurrentObjectType (ObjectType currentObjectType)
 
void setCurrentPlane (int currentPlane)
 
void setCurrentUnitID (int currentUnitID)
 
 TotemT1Organization ()
 
 ~TotemT1Organization () override
 
- Public Member Functions inherited from TotemVDetectorOrganization
 TotemVDetectorOrganization ()
 
virtual ~TotemVDetectorOrganization ()
 

Private Member Functions

void _checkDataUpdate (void) const
 
void _checkUnitIDUpdate (void) const
 
void _FromDataToUnitID (void)
 
void _FromUnitIDToData (void)
 
uint32_t getUnitID (const G4Step *aStep)
 

Private Attributes

int _currentCSC
 
int _currentDetectorPosition
 
int _currentLayer
 
ObjectType _currentObjectType
 
int _currentPlane
 
int _currentUnitID
 
bool _needUpdateData
 
bool _needUpdateUnitID
 

Detailed Description

Description: This class manages the UnitID that labels TotemT1 sensitive volumes

Usage: Used in TotemSD to get unique ID of sensitive detector element

Definition at line 28 of file TotemT1Organization.h.

Member Enumeration Documentation

◆ ObjectType

Enumerator
Undefined 
Upper 
Lower 
InternalUpper 
InternalLower 
Frame1 
Frame2Left 
Frame2Right 
Frame3Left 
Frame3Right 
Frame4Left 
Frame4Right 
Frame5 
Triangle6Left 
Triangle6Right 
MaxObjectTypes 

Definition at line 32 of file TotemT1Organization.h.

Constructor & Destructor Documentation

◆ TotemT1Organization()

TotemT1Organization::TotemT1Organization ( )

Definition at line 28 of file TotemT1Organization.cc.

29  : _needUpdateUnitID(false),
30  _needUpdateData(false),
31  _currentUnitID(-1),
32  _currentPlane(-1),
33  _currentCSC(-1),
34  _currentLayer(-1),
36  edm::LogVerbatim("ForwardSim") << "Creating TotemT1Organization";
37 }
Log< level::Info, true > LogVerbatim

◆ ~TotemT1Organization()

TotemT1Organization::~TotemT1Organization ( )
override

Definition at line 39 of file TotemT1Organization.cc.

39 {}

Member Function Documentation

◆ _checkDataUpdate()

void TotemT1Organization::_checkDataUpdate ( void  ) const
private

Definition at line 221 of file TotemT1Organization.cc.

References _FromUnitIDToData(), _needUpdateData, and LogDebug.

Referenced by getCurrentCSC(), getCurrentDetectorPosition(), getCurrentLayer(), getCurrentObjectType(), and getCurrentPlane().

221  {
222  if (_needUpdateData) {
223 #ifdef SCRIVI
224  LogDebug("ForwardSim") << "Data update needed.";
225 #endif
226  const_cast<TotemT1Organization*>(this)->_FromUnitIDToData();
227  } else {
228 #ifdef SCRIVI
229  LogDebug("ForwardSim") << "Data update not needed.";
230 #endif
231  }
232 }
#define LogDebug(id)

◆ _checkUnitIDUpdate()

void TotemT1Organization::_checkUnitIDUpdate ( void  ) const
private

Definition at line 208 of file TotemT1Organization.cc.

References _FromDataToUnitID(), _needUpdateUnitID, and LogDebug.

Referenced by getCurrentUnitID().

208  {
209  if (_needUpdateUnitID) {
210 #ifdef SCRIVI
211  LogDebug("ForwardSim") << "UnitID update needed.";
212 #endif
213  const_cast<TotemT1Organization*>(this)->_FromDataToUnitID();
214  } else {
215 #ifdef SCRIVI
216  LogDebug("ForwardSim") << "UnitID update not needed.";
217 #endif
218  }
219 }
#define LogDebug(id)

◆ _FromDataToUnitID()

void TotemT1Organization::_FromDataToUnitID ( void  )
private

Definition at line 282 of file TotemT1Organization.cc.

References _currentCSC, _currentDetectorPosition, _currentLayer, _currentObjectType, _currentPlane, _currentUnitID, _needUpdateUnitID, fromObjectTypeToInt(), LogDebug, MaxObjectTypes, and TotemNumberMerger::Merge().

Referenced by _checkUnitIDUpdate().

282  {
283  int currDP, currPL, currCSC, currLA, currOT;
284 #ifdef SCRIVI
285  LogDebug("ForwardSim") << " CURRENT DETECTOR POSITION (0-3) " << _currentDetectorPosition;
286 #endif
287  switch (_currentDetectorPosition) {
288  case 0:
289  currDP = 0;
290  break;
291  case 1:
292  currDP = 1;
293  break;
294  case 2:
295  currDP = 2;
296  break;
297  case 3:
298  currDP = 3;
299  break;
300  case 4:
301  currDP = 4;
302  break;
303  default:
305  currDP = 0;
306  edm::LogVerbatim("ForwardSim") << "Invalid _currentDetectorPosition value (" << _currentDetectorPosition
307  << "). Now is \"Undefined\"";
308  }
309 
310  if (_currentPlane < -1) {
311  edm::LogVerbatim("ForwardSim") << "Invalid _currentPlane value (" << _currentPlane << "). Now is -1";
312  _currentPlane = -1;
313  }
314  currPL = _currentPlane + 1;
315 
316  if (_currentCSC < -1 || _currentCSC > 5) {
317  edm::LogVerbatim("ForwardSim") << "Invalid _currentCSC value (" << _currentCSC << "). Now is -1";
318  _currentCSC = -1;
319  }
320  currCSC = _currentCSC + 1;
321 
322  if (_currentLayer < -1) {
323  edm::LogVerbatim("ForwardSim") << "Invalid _currentLayer value (" << _currentLayer << "). Now is -1";
324  _currentLayer = -1;
325  }
326  currLA = _currentLayer + 1;
327 
329 
330  // currDP: 0..2 (3)
331  // currPL: 0..infty
332  // currCSC: 0..6 (7)
333  // currLA: 0..infty
334  // currOT: 0..MaxObjectTypes-1 (MaxObjectTypes)
335 
336  TotemNumberMerger merger;
337  int currPLA(merger.Merge(currPL, currLA));
338 
339  _currentUnitID = currDP * 100000 + 5 * (currCSC + 7 * (currOT + MaxObjectTypes * (currPLA)));
340 #ifdef SCRIVI
341  LogDebug("ForwardSim") << "currDP=" << currDP << ", currPL=" << currPL << ", currCSC=" << currCSC
342  << ", currLA=" << currLA << ", currOT=" << currOT << ", currPLA=" << currPLA
343  << ", _currentUnitID=" << _currentUnitID;
344 #endif
345 
346  _needUpdateUnitID = false;
347 }
Log< level::Info, true > LogVerbatim
unsigned long Merge(unsigned long value1, unsigned long value2) const
int fromObjectTypeToInt(ObjectType objectType)
#define LogDebug(id)

◆ _FromUnitIDToData()

void TotemT1Organization::_FromUnitIDToData ( void  )
private

Definition at line 234 of file TotemT1Organization.cc.

References _currentCSC, _currentDetectorPosition, _currentLayer, _currentObjectType, _currentPlane, _currentUnitID, _needUpdateData, LogDebug, MaxObjectTypes, and confdb::splitter().

Referenced by _checkDataUpdate().

234  {
235  int currDP, currCSC, currOT, currPLA;
236  unsigned long currPL, currLA;
237 
238  // currDP: 0..4 (5)
239  // currPL: 0..infty
240  // currCSC: 0..6 (7)
241  // currLA: 0..infty
242  // currOT: 0..MaxObjectTypes-1 (MaxObjectTypes)
243 
244  currDP = (_currentUnitID / 100000) % 5; // 3;
245  currCSC = (_currentUnitID / 5) % 7;
246  currOT = (_currentUnitID / (5 * 7)) % MaxObjectTypes;
247  currPLA = _currentUnitID / (5 * 7 * MaxObjectTypes);
248 
250  splitter.Split(currPLA, currPL, currLA);
251 
252 #ifdef SCRIVI
253  LogDebug("ForwardSim") << "currDP=" << currDP << ", currPL=" << currPL << ", currCSC=" << currCSC
254  << ", currLA=" << currLA << ", currOT=" << currOT << ", currPLA=" << currPLA
255  << ", _currentUnitID=" << _currentUnitID;
256 #endif
257  _currentPlane = currPL - 1;
258  _currentCSC = currCSC - 1;
259  _currentLayer = currLA - 1;
260  _currentObjectType = static_cast<ObjectType>(currOT);
261 
262  switch (currDP) {
263  case 0:
265  break;
266  case 1:
268  break;
269  case 2:
271  break;
272  case 3:
274  break;
275  case 4:
277  break;
278  }
279  _needUpdateData = false;
280 }
def splitter(iterator, n)
Definition: confdb.py:11
#define LogDebug(id)

◆ fromObjectTypeToInt() [1/2]

int TotemT1Organization::fromObjectTypeToInt ( ObjectType  objectType)

Definition at line 191 of file TotemT1Organization.cc.

References MaxObjectTypes, and mps_fire::result.

Referenced by _FromDataToUnitID(), and fromObjectTypeToInt().

191  {
192  int result(static_cast<int>(objectType));
193  if (result < 0 || result >= MaxObjectTypes) {
194  result = 0;
195  edm::LogVerbatim("ForwardSim") << "Invalid ObjectType value (" << objectType << "). Now is \"Undefined\"";
196  }
197  return result;
198 }
Log< level::Info, true > LogVerbatim

◆ fromObjectTypeToInt() [2/2]

int TotemT1Organization::fromObjectTypeToInt ( ObjectType  objectType,
int  layer 
)

Definition at line 200 of file TotemT1Organization.cc.

References fromObjectTypeToInt(), pixelTopology::layer, and MaxObjectTypes.

200  {
201  return fromObjectTypeToInt(objectType) + layer * MaxObjectTypes;
202 }
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
int fromObjectTypeToInt(ObjectType objectType)

◆ getCurrentCSC()

int TotemT1Organization::getCurrentCSC ( void  ) const

Definition at line 143 of file TotemT1Organization.cc.

References _checkDataUpdate(), _currentCSC, and LogDebug.

143  {
145 #ifdef SCRIVI
146  LogDebug("ForwardSim") << "getCurrentCSC()=" << _currentCSC;
147 #endif
148  return _currentCSC;
149 }
void _checkDataUpdate(void) const
#define LogDebug(id)

◆ getCurrentDetectorPosition()

int TotemT1Organization::getCurrentDetectorPosition ( void  ) const

Definition at line 110 of file TotemT1Organization.cc.

References _checkDataUpdate(), _currentDetectorPosition, and LogDebug.

110  {
112 #ifdef SCRIVI
113  LogDebug("ForwardSim") << "getCurrentDetectorPosition()=" << _currentDetectorPosition;
114 #endif
116 }
void _checkDataUpdate(void) const
#define LogDebug(id)

◆ getCurrentLayer()

int TotemT1Organization::getCurrentLayer ( void  ) const

Definition at line 159 of file TotemT1Organization.cc.

References _checkDataUpdate(), _currentLayer, and LogDebug.

159  {
161 #ifdef SCRIVI
162  LogDebug("ForwardSim") << "getCurrentLayer()=" << _currentLayer;
163 #endif
164  return _currentLayer;
165 }
void _checkDataUpdate(void) const
#define LogDebug(id)

◆ getCurrentObjectType()

TotemT1Organization::ObjectType TotemT1Organization::getCurrentObjectType ( void  ) const

Definition at line 175 of file TotemT1Organization.cc.

References _checkDataUpdate(), _currentObjectType, and LogDebug.

175  {
177 #ifdef SCRIVI
178  LogDebug("ForwardSim") << "getCurrentObjectType()=" << _currentObjectType;
179 #endif
180  return _currentObjectType;
181 }
void _checkDataUpdate(void) const
#define LogDebug(id)

◆ getCurrentPlane()

int TotemT1Organization::getCurrentPlane ( void  ) const

Definition at line 126 of file TotemT1Organization.cc.

References _checkDataUpdate(), _currentPlane, and LogDebug.

126  {
128 
129 #ifdef SCRIVI
130  LogDebug("ForwardSim") << "getCurrentPlane()=" << _currentPlane;
131 #endif
132  return _currentPlane;
133 }
void _checkDataUpdate(void) const
#define LogDebug(id)

◆ getCurrentUnitID()

int TotemT1Organization::getCurrentUnitID ( void  ) const

Definition at line 93 of file TotemT1Organization.cc.

References _checkUnitIDUpdate(), _currentUnitID, and LogDebug.

Referenced by getUnitID().

93  {
95 #ifdef SCRIVI
96  LogDebug("ForwardSim") << "getCurrentUnitID()=" << _currentUnitID;
97  << endl;
98 #endif
99  return _currentUnitID;
100 }
void _checkUnitIDUpdate(void) const
#define LogDebug(id)

◆ getUnitID() [1/2]

uint32_t TotemT1Organization::getUnitID ( const G4Step *  aStep) const
overridevirtual

Implements TotemVDetectorOrganization.

Definition at line 45 of file TotemT1Organization.cc.

45  {
46  return const_cast<TotemT1Organization*>(this)->getUnitID(aStep);
47 }
uint32_t getUnitID(const G4Step *aStep) const override

◆ getUnitID() [2/2]

uint32_t TotemT1Organization::getUnitID ( const G4Step *  aStep)
private

Definition at line 49 of file TotemT1Organization.cc.

References _currentCSC, _currentDetectorPosition, _currentLayer, _currentObjectType, _currentPlane, _needUpdateUnitID, getCurrentUnitID(), ForwardName::getName(), cuy::ii, LogDebug, MaxObjectTypes, and AlCaHLTBitMon_QueryRunRegistry::string.

49  {
50  int currLAOT;
51  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
52  G4VPhysicalVolume* physVol;
53  int ii = 0;
54  for (ii = 0; ii < touch->GetHistoryDepth(); ii++) {
55  physVol = touch->GetVolume(ii);
56 
57 #ifdef SCRIVI
58  LogDebug("ForwardSim") << "physVol=" << physVol->GetName() << ", level=" << ii
59  << ", physVol->GetCopyNo()=" << physVol->GetCopyNo();
60 #endif
61 
62  std::string dName = ForwardName::getName(physVol->GetName());
63  if (dName == "TotemT1") {
64  if (physVol->GetCopyNo() == 1)
66  else if (physVol->GetCopyNo() == 2)
68  }
69  }
70 
71  touch = aStep->GetPreStepPoint()->GetTouchable();
72  physVol = touch->GetVolume(0);
73 
74  currLAOT = physVol->GetCopyNo();
75  _currentObjectType = static_cast<ObjectType>(currLAOT % MaxObjectTypes);
76  _currentLayer = currLAOT / MaxObjectTypes;
77  _currentPlane = -1;
78  _currentCSC = -1;
79 
80  if (touch->GetVolume(1)) {
81  _currentCSC = touch->GetVolume(1)->GetCopyNo();
82  if (touch->GetVolume(2))
83  _currentPlane = touch->GetVolume(2)->GetCopyNo();
84  }
85 #ifdef SCRIVI
86  LogDebug("ForwardSim") << "CURRENT CSC " << _currentCSC << "\n"
87  << "CURRENT PLANE " << _currentPlane;
88 #endif
89  _needUpdateUnitID = true;
90  return getCurrentUnitID();
91 }
int getCurrentUnitID(void) const
ii
Definition: cuy.py:589
std::string getName(const G4String &)
Definition: ForwardName.cc:3
#define LogDebug(id)

◆ setCurrentCSC()

void TotemT1Organization::setCurrentCSC ( int  currentCSC)

Definition at line 151 of file TotemT1Organization.cc.

References _currentCSC, _needUpdateUnitID, and LogDebug.

151  {
152 #ifdef SCRIVI
153  LogDebug("ForwardSim") << "_currentCSC=" << currentCSC;
154 #endif
155  _currentCSC = currentCSC;
156  _needUpdateUnitID = true;
157 }
#define LogDebug(id)

◆ setCurrentDetectorPosition()

void TotemT1Organization::setCurrentDetectorPosition ( int  currentDetectorPosition)

Definition at line 118 of file TotemT1Organization.cc.

References _currentDetectorPosition, _needUpdateUnitID, and LogDebug.

Referenced by TotemT1NumberingScheme::TotemT1NumberingScheme().

118  {
119 #ifdef SCRIVI
120  LogDebug("ForwardSim") << "_currentDetectorPosition=" << currentDetectorPosition;
121 #endif
122  _currentDetectorPosition = currentDetectorPosition;
123  _needUpdateUnitID = true;
124 }
#define LogDebug(id)

◆ setCurrentLayer()

void TotemT1Organization::setCurrentLayer ( int  currentLayer)

Definition at line 167 of file TotemT1Organization.cc.

References _currentLayer, _needUpdateUnitID, and LogDebug.

167  {
168 #ifdef SCRIVI
169  LogDebug("ForwardSim") << "_currentLayer=" << currentLayer;
170 #endif
171  _currentLayer = currentLayer;
172  _needUpdateUnitID = true;
173 }
#define LogDebug(id)

◆ setCurrentObjectType()

void TotemT1Organization::setCurrentObjectType ( ObjectType  currentObjectType)

Definition at line 183 of file TotemT1Organization.cc.

References _currentObjectType, _needUpdateUnitID, and LogDebug.

183  {
184 #ifdef SCRIVI
185  LogDebug("ForwardSim") << "_currentObjectType=" << currentObjectType;
186 #endif
187  _currentObjectType = currentObjectType;
188  _needUpdateUnitID = true;
189 }
#define LogDebug(id)

◆ setCurrentPlane()

void TotemT1Organization::setCurrentPlane ( int  currentPlane)

Definition at line 135 of file TotemT1Organization.cc.

References _currentPlane, _needUpdateUnitID, and LogDebug.

135  {
136 #ifdef SCRIVI
137  LogDebug("ForwardSim") << "_currentPlane=" << currentPlane;
138 #endif
139  _currentPlane = currentPlane;
140  _needUpdateUnitID = true;
141 }
#define LogDebug(id)

◆ setCurrentUnitID()

void TotemT1Organization::setCurrentUnitID ( int  currentUnitID)

Definition at line 102 of file TotemT1Organization.cc.

References _currentUnitID, _needUpdateData, and LogDebug.

102  {
103 #ifdef SCRIVI
104  LogDebug("ForwardSim") << "_currentUnitID=" << currentUnitID;
105 #endif
106  _currentUnitID = currentUnitID;
107  _needUpdateData = true;
108 }
#define LogDebug(id)

Member Data Documentation

◆ _currentCSC

int TotemT1Organization::_currentCSC
private

◆ _currentDetectorPosition

int TotemT1Organization::_currentDetectorPosition
private

◆ _currentLayer

int TotemT1Organization::_currentLayer
private

◆ _currentObjectType

ObjectType TotemT1Organization::_currentObjectType
private

◆ _currentPlane

int TotemT1Organization::_currentPlane
private

◆ _currentUnitID

int TotemT1Organization::_currentUnitID
private

◆ _needUpdateData

bool TotemT1Organization::_needUpdateData
private

Definition at line 100 of file TotemT1Organization.h.

Referenced by _checkDataUpdate(), _FromUnitIDToData(), and setCurrentUnitID().

◆ _needUpdateUnitID

bool TotemT1Organization::_needUpdateUnitID
private