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.

32  {
33  Undefined = 0,
34  Upper = 1,
35  Lower = 2,
36  InternalUpper = 3,
37  InternalLower = 4,
38  Frame1 = 5,
39  Frame2Left = 6,
40  Frame2Right = 7,
41  Frame3Left = 8,
42  Frame3Right = 9,
43  Frame4Left = 10,
44  Frame4Right = 11,
45  Frame5 = 12,
46  Triangle6Left = 13,
47  Triangle6Right = 14,
48  MaxObjectTypes = 15
49  };

Constructor & Destructor Documentation

◆ TotemT1Organization()

TotemT1Organization::TotemT1Organization ( )

Definition at line 27 of file TotemT1Organization.cc.

28  : _needUpdateUnitID(false),
29  _needUpdateData(false),
30  _currentUnitID(-1),
31  _currentPlane(-1),
32  _currentCSC(-1),
33  _currentLayer(-1),
35  edm::LogInfo("ForwardSim") << "Creating TotemT1Organization";
36 }

◆ ~TotemT1Organization()

TotemT1Organization::~TotemT1Organization ( )
override

Definition at line 38 of file TotemT1Organization.cc.

38 {}

Member Function Documentation

◆ _checkDataUpdate()

void TotemT1Organization::_checkDataUpdate ( void  ) const
private

Definition at line 217 of file TotemT1Organization.cc.

217  {
218  if (_needUpdateData) {
219 #ifdef SCRIVI
220  LogDebug("ForwardSim") << "Data update needed.";
221 #endif
222  const_cast<TotemT1Organization*>(this)->_FromUnitIDToData();
223  } else {
224 #ifdef SCRIVI
225  LogDebug("ForwardSim") << "Data update not needed.";
226 #endif
227  }
228 }

References _needUpdateData, and LogDebug.

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

◆ _checkUnitIDUpdate()

void TotemT1Organization::_checkUnitIDUpdate ( void  ) const
private

Definition at line 204 of file TotemT1Organization.cc.

204  {
205  if (_needUpdateUnitID) {
206 #ifdef SCRIVI
207  LogDebug("ForwardSim") << "UnitID update needed.";
208 #endif
209  const_cast<TotemT1Organization*>(this)->_FromDataToUnitID();
210  } else {
211 #ifdef SCRIVI
212  LogDebug("ForwardSim") << "UnitID update not needed.";
213 #endif
214  }
215 }

References _needUpdateUnitID, and LogDebug.

Referenced by getCurrentUnitID().

◆ _FromDataToUnitID()

void TotemT1Organization::_FromDataToUnitID ( void  )
private

Definition at line 278 of file TotemT1Organization.cc.

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

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

◆ _FromUnitIDToData()

void TotemT1Organization::_FromUnitIDToData ( void  )
private

Definition at line 230 of file TotemT1Organization.cc.

230  {
231  int currDP, currCSC, currOT, currPLA;
232  unsigned long currPL, currLA;
233 
234  // currDP: 0..4 (5)
235  // currPL: 0..infty
236  // currCSC: 0..6 (7)
237  // currLA: 0..infty
238  // currOT: 0..MaxObjectTypes-1 (MaxObjectTypes)
239 
240  currDP = (_currentUnitID / 100000) % 5; // 3;
241  currCSC = (_currentUnitID / 5) % 7;
242  currOT = (_currentUnitID / (5 * 7)) % MaxObjectTypes;
243  currPLA = _currentUnitID / (5 * 7 * MaxObjectTypes);
244 
246  splitter.Split(currPLA, currPL, currLA);
247 
248 #ifdef SCRIVI
249  LogDebug("ForwardSim") << "currDP=" << currDP << ", currPL=" << currPL << ", currCSC=" << currCSC
250  << ", currLA=" << currLA << ", currOT=" << currOT << ", currPLA=" << currPLA
251  << ", _currentUnitID=" << _currentUnitID;
252 #endif
253  _currentPlane = currPL - 1;
254  _currentCSC = currCSC - 1;
255  _currentLayer = currLA - 1;
256  _currentObjectType = static_cast<ObjectType>(currOT);
257 
258  switch (currDP) {
259  case 0:
261  break;
262  case 1:
264  break;
265  case 2:
267  break;
268  case 3:
270  break;
271  case 4:
273  break;
274  }
275  _needUpdateData = false;
276 }

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

◆ fromObjectTypeToInt() [1/2]

int TotemT1Organization::fromObjectTypeToInt ( ObjectType  objectType)

Definition at line 187 of file TotemT1Organization.cc.

187  {
188  int result(static_cast<int>(objectType));
189  if (result < 0 || result >= MaxObjectTypes) {
190  result = 0;
191  edm::LogInfo("ForwardSim") << "Invalid ObjectType value (" << objectType << "). Now is \"Undefined\"";
192  }
193  return result;
194 }

References MaxObjectTypes, and mps_fire::result.

Referenced by _FromDataToUnitID(), and fromObjectTypeToInt().

◆ fromObjectTypeToInt() [2/2]

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

Definition at line 196 of file TotemT1Organization.cc.

196  {
197  return fromObjectTypeToInt(objectType) + layer * MaxObjectTypes;
198 }

References fromObjectTypeToInt(), and MaxObjectTypes.

◆ getCurrentCSC()

int TotemT1Organization::getCurrentCSC ( void  ) const

Definition at line 139 of file TotemT1Organization.cc.

139  {
141 #ifdef SCRIVI
142  LogDebug("ForwardSim") << "getCurrentCSC()=" << _currentCSC;
143 #endif
144  return _currentCSC;
145 }

References _checkDataUpdate(), _currentCSC, and LogDebug.

◆ getCurrentDetectorPosition()

int TotemT1Organization::getCurrentDetectorPosition ( void  ) const

Definition at line 106 of file TotemT1Organization.cc.

106  {
108 #ifdef SCRIVI
109  LogDebug("ForwardSim") << "getCurrentDetectorPosition()=" << _currentDetectorPosition;
110 #endif
112 }

References _checkDataUpdate(), _currentDetectorPosition, and LogDebug.

◆ getCurrentLayer()

int TotemT1Organization::getCurrentLayer ( void  ) const

Definition at line 155 of file TotemT1Organization.cc.

155  {
157 #ifdef SCRIVI
158  LogDebug("ForwardSim") << "getCurrentLayer()=" << _currentLayer;
159 #endif
160  return _currentLayer;
161 }

References _checkDataUpdate(), _currentLayer, and LogDebug.

◆ getCurrentObjectType()

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

Definition at line 171 of file TotemT1Organization.cc.

171  {
173 #ifdef SCRIVI
174  LogDebug("ForwardSim") << "getCurrentObjectType()=" << _currentObjectType;
175 #endif
176  return _currentObjectType;
177 }

References _checkDataUpdate(), _currentObjectType, and LogDebug.

◆ getCurrentPlane()

int TotemT1Organization::getCurrentPlane ( void  ) const

Definition at line 122 of file TotemT1Organization.cc.

122  {
124 
125 #ifdef SCRIVI
126  LogDebug("ForwardSim") << "getCurrentPlane()=" << _currentPlane;
127 #endif
128  return _currentPlane;
129 }

References _checkDataUpdate(), _currentPlane, and LogDebug.

◆ getCurrentUnitID()

int TotemT1Organization::getCurrentUnitID ( void  ) const

Definition at line 89 of file TotemT1Organization.cc.

89  {
91 #ifdef SCRIVI
92  LogDebug("ForwardSim") << "getCurrentUnitID()=" << _currentUnitID;
93  << endl;
94 #endif
95  return _currentUnitID;
96 }

References _checkUnitIDUpdate(), _currentUnitID, and LogDebug.

Referenced by getUnitID().

◆ getUnitID() [1/2]

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

Definition at line 48 of file TotemT1Organization.cc.

48  {
49  int currLAOT;
50  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
51  G4VPhysicalVolume* physVol;
52  int ii = 0;
53  for (ii = 0; ii < touch->GetHistoryDepth(); ii++) {
54  physVol = touch->GetVolume(ii);
55 
56 #ifdef SCRIVI
57  LogDebug("ForwardSim") << "physVol=" << physVol->GetName() << ", level=" << ii
58  << ", physVol->GetCopyNo()=" << physVol->GetCopyNo();
59 #endif
60 
61  if (physVol->GetName() == "TotemT1" && physVol->GetCopyNo() == 1)
63  if (physVol->GetName() == "TotemT1" && physVol->GetCopyNo() == 2)
65  }
66 
67  touch = aStep->GetPreStepPoint()->GetTouchable();
68  physVol = touch->GetVolume(0);
69 
70  currLAOT = physVol->GetCopyNo();
71  _currentObjectType = static_cast<ObjectType>(currLAOT % MaxObjectTypes);
72  _currentLayer = currLAOT / MaxObjectTypes;
73  _currentPlane = -1;
74  _currentCSC = -1;
75 
76  if (touch->GetVolume(1)) {
77  _currentCSC = touch->GetVolume(1)->GetCopyNo();
78  if (touch->GetVolume(2))
79  _currentPlane = touch->GetVolume(2)->GetCopyNo();
80  }
81 #ifdef SCRIVI
82  LogDebug("ForwardSim") << "CURRENT CSC " << _currentCSC << "\n"
83  << "CURRENT PLANE " << _currentPlane;
84 #endif
85  _needUpdateUnitID = true;
86  return getCurrentUnitID();
87 }

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

◆ getUnitID() [2/2]

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

Implements TotemVDetectorOrganization.

Definition at line 44 of file TotemT1Organization.cc.

44  {
45  return const_cast<TotemT1Organization*>(this)->getUnitID(aStep);
46 }

◆ setCurrentCSC()

void TotemT1Organization::setCurrentCSC ( int  currentCSC)

Definition at line 147 of file TotemT1Organization.cc.

147  {
148 #ifdef SCRIVI
149  LogDebug("ForwardSim") << "_currentCSC=" << currentCSC;
150 #endif
151  _currentCSC = currentCSC;
152  _needUpdateUnitID = true;
153 }

References _currentCSC, _needUpdateUnitID, and LogDebug.

◆ setCurrentDetectorPosition()

void TotemT1Organization::setCurrentDetectorPosition ( int  currentDetectorPosition)

Definition at line 114 of file TotemT1Organization.cc.

114  {
115 #ifdef SCRIVI
116  LogDebug("ForwardSim") << "_currentDetectorPosition=" << currentDetectorPosition;
117 #endif
118  _currentDetectorPosition = currentDetectorPosition;
119  _needUpdateUnitID = true;
120 }

References _currentDetectorPosition, _needUpdateUnitID, and LogDebug.

Referenced by TotemT1NumberingScheme::TotemT1NumberingScheme().

◆ setCurrentLayer()

void TotemT1Organization::setCurrentLayer ( int  currentLayer)

Definition at line 163 of file TotemT1Organization.cc.

163  {
164 #ifdef SCRIVI
165  LogDebug("ForwardSim") << "_currentLayer=" << currentLayer;
166 #endif
167  _currentLayer = currentLayer;
168  _needUpdateUnitID = true;
169 }

References _currentLayer, _needUpdateUnitID, and LogDebug.

◆ setCurrentObjectType()

void TotemT1Organization::setCurrentObjectType ( ObjectType  currentObjectType)

Definition at line 179 of file TotemT1Organization.cc.

179  {
180 #ifdef SCRIVI
181  LogDebug("ForwardSim") << "_currentObjectType=" << currentObjectType;
182 #endif
183  _currentObjectType = currentObjectType;
184  _needUpdateUnitID = true;
185 }

References _currentObjectType, _needUpdateUnitID, and LogDebug.

◆ setCurrentPlane()

void TotemT1Organization::setCurrentPlane ( int  currentPlane)

Definition at line 131 of file TotemT1Organization.cc.

131  {
132 #ifdef SCRIVI
133  LogDebug("ForwardSim") << "_currentPlane=" << currentPlane;
134 #endif
135  _currentPlane = currentPlane;
136  _needUpdateUnitID = true;
137 }

References _currentPlane, _needUpdateUnitID, and LogDebug.

◆ setCurrentUnitID()

void TotemT1Organization::setCurrentUnitID ( int  currentUnitID)

Definition at line 98 of file TotemT1Organization.cc.

98  {
99 #ifdef SCRIVI
100  LogDebug("ForwardSim") << "_currentUnitID=" << currentUnitID;
101 #endif
102  _currentUnitID = currentUnitID;
103  _needUpdateData = true;
104 }

References _currentUnitID, _needUpdateData, and LogDebug.

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
splitter
Definition: splitter.py:1
TotemT1Organization::InternalLower
Definition: TotemT1Organization.h:37
TotemT1Organization::Frame4Left
Definition: TotemT1Organization.h:43
TotemT1Organization::_needUpdateData
bool _needUpdateData
Definition: TotemT1Organization.h:100
TotemT1Organization::Triangle6Left
Definition: TotemT1Organization.h:46
TotemT1Organization::Upper
Definition: TotemT1Organization.h:34
edm::LogInfo
Definition: MessageLogger.h:254
TotemT1Organization::_currentUnitID
int _currentUnitID
Definition: TotemT1Organization.h:101
TotemT1Organization::Frame3Right
Definition: TotemT1Organization.h:42
TotemT1Organization::Lower
Definition: TotemT1Organization.h:35
TotemT1Organization::_currentDetectorPosition
int _currentDetectorPosition
Definition: TotemT1Organization.h:102
TotemT1Organization::getCurrentUnitID
int getCurrentUnitID(void) const
Definition: TotemT1Organization.cc:89
TotemT1Organization::InternalUpper
Definition: TotemT1Organization.h:36
confdb.splitter
def splitter(iterator, n)
Definition: confdb.py:13
TotemT1Organization::_currentObjectType
ObjectType _currentObjectType
Definition: TotemT1Organization.h:106
TotemT1Organization::Frame5
Definition: TotemT1Organization.h:45
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
TotemT1Organization::Triangle6Right
Definition: TotemT1Organization.h:47
TotemNumberMerger::Merge
unsigned long Merge(unsigned long value1, unsigned long value2) const
Definition: TotemNumberMerger.cc:38
TotemT1Organization::Undefined
Definition: TotemT1Organization.h:33
TotemT1Organization::Frame3Left
Definition: TotemT1Organization.h:41
TotemT1Organization::Frame4Right
Definition: TotemT1Organization.h:44
TotemT1Organization::Frame2Left
Definition: TotemT1Organization.h:39
TotemT1Organization::Frame2Right
Definition: TotemT1Organization.h:40
TotemT1Organization::fromObjectTypeToInt
int fromObjectTypeToInt(ObjectType objectType)
Definition: TotemT1Organization.cc:187
TotemT1Organization::_checkDataUpdate
void _checkDataUpdate(void) const
Definition: TotemT1Organization.cc:217
TotemT1Organization::MaxObjectTypes
Definition: TotemT1Organization.h:48
TotemT1Organization::_needUpdateUnitID
bool _needUpdateUnitID
Definition: TotemT1Organization.h:99
TotemT1Organization::Frame1
Definition: TotemT1Organization.h:38
TotemT1Organization::_checkUnitIDUpdate
void _checkUnitIDUpdate(void) const
Definition: TotemT1Organization.cc:204
TotemT1Organization::_currentCSC
int _currentCSC
Definition: TotemT1Organization.h:104
TotemT1Organization::_currentLayer
int _currentLayer
Definition: TotemT1Organization.h:105
mps_fire.result
result
Definition: mps_fire.py:303
TotemT1Organization::_currentPlane
int _currentPlane
Definition: TotemT1Organization.h:103
cuy.ii
ii
Definition: cuy.py:590
TotemNumberMerger
Definition: TotemNumberMerger.h:28