CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
uint32_t GetUnitID (const G4Step *aStep) const
 
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 ()
 
virtual ~TotemT1Organization ()
 
- 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)
 

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 30 of file TotemT1Organization.h.

Member Enumeration Documentation

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

Definition at line 36 of file TotemT1Organization.h.

Constructor & Destructor Documentation

TotemT1Organization::TotemT1Organization ( )

Definition at line 27 of file TotemT1Organization.cc.

TotemT1Organization::~TotemT1Organization ( )
virtual

Definition at line 38 of file TotemT1Organization.cc.

38  {
39 }

Member Function Documentation

void TotemT1Organization::_checkDataUpdate ( void  ) const
private

Definition at line 236 of file TotemT1Organization.cc.

References _FromUnitIDToData(), _needUpdateData, and LogDebug.

Referenced by GetCurrentCSC(), GetCurrentDetectorPosition(), GetCurrentLayer(), GetCurrentObjectType(), and GetCurrentPlane().

236  {
237 
238  if (_needUpdateData) {
239 #ifdef SCRIVI
240  LogDebug("ForwardSim") << "Data update needed.";
241 #endif
242  const_cast<TotemT1Organization *>(this)->_FromUnitIDToData();
243  } else {
244 #ifdef SCRIVI
245  LogDebug("ForwardSim") << "Data update not needed.";
246 #endif
247  }
248 }
#define LogDebug(id)
void TotemT1Organization::_checkUnitIDUpdate ( void  ) const
private

Definition at line 223 of file TotemT1Organization.cc.

References _FromDataToUnitID(), _needUpdateUnitID, and LogDebug.

Referenced by GetCurrentUnitID().

223  {
224  if (_needUpdateUnitID) {
225 #ifdef SCRIVI
226  LogDebug("ForwardSim") << "UnitID update needed.";
227 #endif
228  const_cast<TotemT1Organization *>(this)->_FromDataToUnitID();
229  } else {
230 #ifdef SCRIVI
231  LogDebug("ForwardSim") << "UnitID update not needed.";
232 #endif
233  }
234 }
#define LogDebug(id)
void TotemT1Organization::_FromDataToUnitID ( void  )
private

Definition at line 300 of file TotemT1Organization.cc.

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

Referenced by _checkUnitIDUpdate().

300  {
301  int currDP, currPL, currCSC, currLA, currOT;
302 #ifdef SCRIVI
303  LogDebug("ForwardSim") << " CURRENT DETECTOR POSITION (0-3) "
305 #endif
306  switch(_currentDetectorPosition) {
307  case 0:
308  currDP=0;
309  break;
310  case 1:
311  currDP=1;
312  break;
313  case 2:
314  currDP=2;
315  break;
316  case 3:
317  currDP=3;
318  break;
319  case 4:
320  currDP=4;
321  break;
322  default:
324  currDP=0;
325  edm::LogInfo("ForwardSim") << "Invalid _currentDetectorPosition value ("
327  << "). Now is \"Undefined\"";
328  }
329 
330  if (_currentPlane<-1) {
331  edm::LogInfo("ForwardSim") << "Invalid _currentPlane value ("
332  << _currentPlane << "). Now is -1";
333  _currentPlane=-1;
334  }
335  currPL=_currentPlane+1;
336 
337  if (_currentCSC<-1 || _currentCSC>5) {
338  edm::LogInfo("ForwardSim") << "Invalid _currentCSC value (" << _currentCSC
339  << "). Now is -1";
340  _currentCSC=-1;
341  }
342  currCSC=_currentCSC+1;
343 
344  if (_currentLayer<-1) {
345  edm::LogInfo("ForwardSim") << "Invalid _currentLayer value ("
346  << _currentLayer << "). Now is -1";
347  _currentLayer=-1;
348  }
349  currLA=_currentLayer+1;
350 
352 
353  // currDP: 0..2 (3)
354  // currPL: 0..infty
355  // currCSC: 0..6 (7)
356  // currLA: 0..infty
357  // currOT: 0..MaxObjectTypes-1 (MaxObjectTypes)
358 
359  TotemNumberMerger merger;
360  int currPLA(merger.Merge(currPL,currLA));
361 
362  _currentUnitID=currDP*100000+5*(currCSC+7*(currOT+MaxObjectTypes*(currPLA)));
363 #ifdef SCRIVI
364  LogDebug("ForwardSim") << "currDP=" << currDP << ", currPL=" << currPL
365  << ", currCSC=" << currCSC << ", currLA=" << currLA
366  << ", currOT=" << currOT << ", currPLA=" << currPLA
367  << ", _currentUnitID=" << _currentUnitID;
368 #endif
369 
370  _needUpdateUnitID=false;
371 }
#define LogDebug(id)
unsigned long Merge(unsigned long value1, unsigned long value2) const
int FromObjectTypeToInt(ObjectType objectType)
void TotemT1Organization::_FromUnitIDToData ( void  )
private

Definition at line 250 of file TotemT1Organization.cc.

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

Referenced by _checkDataUpdate().

250  {
251 
252  int currDP, currCSC, currOT, currPLA;
253  unsigned long currPL, currLA;
254 
255  // currDP: 0..4 (5)
256  // currPL: 0..infty
257  // currCSC: 0..6 (7)
258  // currLA: 0..infty
259  // currOT: 0..MaxObjectTypes-1 (MaxObjectTypes)
260 
261  currDP = (_currentUnitID/100000) % 5;// 3;
262  currCSC = (_currentUnitID/5)%7;
263  currOT = (_currentUnitID/(5*7))%MaxObjectTypes;
264  currPLA = _currentUnitID/(5*7*MaxObjectTypes);
265 
267  splitter.Split(currPLA,currPL,currLA);
268 
269 #ifdef SCRIVI
270  LogDebug("ForwardSim") << "currDP=" << currDP << ", currPL=" << currPL
271  << ", currCSC=" << currCSC << ", currLA=" << currLA
272  << ", currOT=" << currOT << ", currPLA=" << currPLA
273  << ", _currentUnitID=" << _currentUnitID;
274 #endif
275  _currentPlane=currPL-1;
276  _currentCSC=currCSC-1;
277  _currentLayer=currLA-1;
278  _currentObjectType=static_cast<ObjectType>(currOT);
279 
280  switch(currDP) {
281  case 0:
283  break;
284  case 1:
286  break;
287  case 2:
289  break;
290  case 3:
292  break;
293  case 4:
295  break;
296  }
297  _needUpdateData=false;
298 }
#define LogDebug(id)
void Split(unsigned long source, unsigned long &value1, unsigned long &value2) const
def splitter
Definition: confdb.py:11
int TotemT1Organization::FromObjectTypeToInt ( ObjectType  objectType)

Definition at line 203 of file TotemT1Organization.cc.

References MaxObjectTypes, and query::result.

Referenced by _FromDataToUnitID(), and FromObjectTypeToInt().

203  {
204 
205  int result(static_cast<int>(objectType));
206  if (result<0 || result>=MaxObjectTypes) {
207  result = 0;
208  edm::LogInfo("ForwardSim") << "Invalid ObjectType value (" << objectType
209  << "). Now is \"Undefined\"";
210  }
211  return result;
212 }
tuple result
Definition: query.py:137
int TotemT1Organization::FromObjectTypeToInt ( ObjectType  objectType,
int  layer 
)

Definition at line 214 of file TotemT1Organization.cc.

References FromObjectTypeToInt(), and MaxObjectTypes.

214  {
215  return FromObjectTypeToInt(objectType)+layer*MaxObjectTypes;
216 }
int FromObjectTypeToInt(ObjectType objectType)
int TotemT1Organization::GetCurrentCSC ( void  ) const

Definition at line 149 of file TotemT1Organization.cc.

References _checkDataUpdate(), _currentCSC, and LogDebug.

149  {
150 
152 #ifdef SCRIVI
153  LogDebug("ForwardSim") << "GetCurrentCSC()=" << _currentCSC;
154 #endif
155  return _currentCSC;
156 }
#define LogDebug(id)
void _checkDataUpdate(void) const
int TotemT1Organization::GetCurrentDetectorPosition ( void  ) const

Definition at line 111 of file TotemT1Organization.cc.

References _checkDataUpdate(), _currentDetectorPosition, and LogDebug.

111  {
112 
114 #ifdef SCRIVI
115  LogDebug("ForwardSim") << "GetCurrentDetectorPosition()="
117 #endif
119 }
#define LogDebug(id)
void _checkDataUpdate(void) const
int TotemT1Organization::GetCurrentLayer ( void  ) const

Definition at line 167 of file TotemT1Organization.cc.

References _checkDataUpdate(), _currentLayer, and LogDebug.

167  {
168 
170 #ifdef SCRIVI
171  LogDebug("ForwardSim") << "GetCurrentLayer()=" << _currentLayer;
172 #endif
173  return _currentLayer;
174 }
#define LogDebug(id)
void _checkDataUpdate(void) const
TotemT1Organization::ObjectType TotemT1Organization::GetCurrentObjectType ( void  ) const

Definition at line 185 of file TotemT1Organization.cc.

References _checkDataUpdate(), _currentObjectType, and LogDebug.

185  {
186 
188 #ifdef SCRIVI
189  LogDebug("ForwardSim") << "GetCurrentObjectType()=" << _currentObjectType;
190 #endif
191  return _currentObjectType;
192 }
#define LogDebug(id)
void _checkDataUpdate(void) const
int TotemT1Organization::GetCurrentPlane ( void  ) const

Definition at line 130 of file TotemT1Organization.cc.

References _checkDataUpdate(), _currentPlane, and LogDebug.

130  {
131 
133 
134 #ifdef SCRIVI
135  LogDebug("ForwardSim") << "GetCurrentPlane()=" << _currentPlane;
136 #endif
137  return _currentPlane;
138 }
#define LogDebug(id)
void _checkDataUpdate(void) const
int TotemT1Organization::GetCurrentUnitID ( void  ) const

Definition at line 92 of file TotemT1Organization.cc.

References _checkUnitIDUpdate(), _currentUnitID, and LogDebug.

Referenced by GetUnitID().

92  {
93 
95 #ifdef SCRIVI
96  LogDebug("ForwardSim") << "GetCurrentUnitID()=" << _currentUnitID;
97  << endl;
98 #endif
99  return _currentUnitID;
100 }
#define LogDebug(id)
void _checkUnitIDUpdate(void) const
uint32_t TotemT1Organization::GetUnitID ( const G4Step *  aStep)

Definition at line 50 of file TotemT1Organization.cc.

References _currentCSC, _currentDetectorPosition, _currentLayer, _currentObjectType, _currentPlane, _needUpdateUnitID, GetCurrentUnitID(), LogDebug, and MaxObjectTypes.

Referenced by GetUnitID().

50  {
51 
52  int currLAOT;
53  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
54  G4VPhysicalVolume* physVol;
55  int ii =0;
56  for ( ii = 0; ii < touch->GetHistoryDepth(); ii++ ){
57  physVol = touch->GetVolume(ii);
58 
59 #ifdef SCRIVI
60  LogDebug("ForwardSim") << "physVol=" << physVol->GetName()
61  << ", level=" << ii << ", physVol->GetCopyNo()="
62  << physVol->GetCopyNo();
63 #endif
64 
65  if(physVol->GetName() == "TotemT1" &&
66  physVol->GetCopyNo()==1) _currentDetectorPosition = 1;
67  if(physVol->GetName() == "TotemT1" &&
68  physVol->GetCopyNo()==2) _currentDetectorPosition = 2;
69  }
70 
71  touch = aStep->GetPreStepPoint()->GetTouchable();
72  physVol=touch->GetVolume(0);
73 
74  currLAOT=physVol->GetCopyNo();
75  _currentObjectType=static_cast<ObjectType>(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)) _currentPlane=touch->GetVolume(2)->GetCopyNo();
83  }
84 #ifdef SCRIVI
85  LogDebug("ForwardSim") << "CURRENT CSC "<<_currentCSC << "\n"
86  << "CURRENT PLANE "<<_currentPlane;
87 #endif
88  _needUpdateUnitID=true;
89  return GetCurrentUnitID();
90 }
#define LogDebug(id)
int GetCurrentUnitID(void) const
uint32_t TotemT1Organization::GetUnitID ( const G4Step *  aStep) const
virtual

Implements TotemVDetectorOrganization.

Definition at line 45 of file TotemT1Organization.cc.

References GetUnitID().

45  {
46  return const_cast<TotemT1Organization *>(this)->GetUnitID(aStep);
47 }
uint32_t GetUnitID(const G4Step *aStep)
void TotemT1Organization::SetCurrentCSC ( int  currentCSC)

Definition at line 158 of file TotemT1Organization.cc.

References _currentCSC, _needUpdateUnitID, and LogDebug.

158  {
159 
160 #ifdef SCRIVI
161  LogDebug("ForwardSim") << "_currentCSC=" << currentCSC;
162 #endif
163  _currentCSC=currentCSC;
164  _needUpdateUnitID=true;
165 }
#define LogDebug(id)
void TotemT1Organization::SetCurrentDetectorPosition ( int  currentDetectorPosition)

Definition at line 121 of file TotemT1Organization.cc.

References _currentDetectorPosition, _needUpdateUnitID, and LogDebug.

Referenced by TotemT1NumberingScheme::TotemT1NumberingScheme().

121  {
122 
123 #ifdef SCRIVI
124  LogDebug("ForwardSim") << "_currentDetectorPosition=" << currentDetectorPosition;
125 #endif
126  _currentDetectorPosition=currentDetectorPosition;
127  _needUpdateUnitID=true;
128 }
#define LogDebug(id)
void TotemT1Organization::SetCurrentLayer ( int  currentLayer)

Definition at line 176 of file TotemT1Organization.cc.

References _currentLayer, _needUpdateUnitID, and LogDebug.

176  {
177 
178 #ifdef SCRIVI
179  LogDebug("ForwardSim") << "_currentLayer=" << currentLayer;
180 #endif
181  _currentLayer=currentLayer;
182  _needUpdateUnitID=true;
183 }
#define LogDebug(id)
void TotemT1Organization::SetCurrentObjectType ( ObjectType  currentObjectType)
inline

Definition at line 194 of file TotemT1Organization.cc.

References _currentObjectType, _needUpdateUnitID, and LogDebug.

194  {
195 
196 #ifdef SCRIVI
197  LogDebug("ForwardSim") << "_currentObjectType=" << currentObjectType;
198 #endif
199  _currentObjectType=currentObjectType;
200  _needUpdateUnitID=true;
201 }
#define LogDebug(id)
void TotemT1Organization::SetCurrentPlane ( int  currentPlane)

Definition at line 140 of file TotemT1Organization.cc.

References _currentPlane, _needUpdateUnitID, and LogDebug.

140  {
141 
142 #ifdef SCRIVI
143  LogDebug("ForwardSim") << "_currentPlane=" << currentPlane;
144 #endif
145  _currentPlane=currentPlane;
146  _needUpdateUnitID=true;
147 }
#define LogDebug(id)
void TotemT1Organization::SetCurrentUnitID ( int  currentUnitID)

Definition at line 102 of file TotemT1Organization.cc.

References _currentUnitID, _needUpdateData, and LogDebug.

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

Member Data Documentation

int TotemT1Organization::_currentCSC
private
int TotemT1Organization::_currentDetectorPosition
private
int TotemT1Organization::_currentLayer
private
ObjectType TotemT1Organization::_currentObjectType
private
int TotemT1Organization::_currentPlane
private
int TotemT1Organization::_currentUnitID
private
bool TotemT1Organization::_needUpdateData
private

Definition at line 105 of file TotemT1Organization.h.

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

bool TotemT1Organization::_needUpdateUnitID
private