#include <SimG4CMS/Forward/interface/TotemT1Organization.h>
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.
Undefined | |
Upper | |
Lower | |
InternalUpper | |
InternalLower | |
Frame1 | |
Frame2Left | |
Frame2Right | |
Frame3Left | |
Frame3Right | |
Frame4Left | |
Frame4Right | |
Frame5 | |
Triangle6Left | |
Triangle6Right | |
MaxObjectTypes |
Definition at line 36 of file TotemT1Organization.h.
{ 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 };
TotemT1Organization::TotemT1Organization | ( | ) |
Definition at line 27 of file TotemT1Organization.cc.
: _needUpdateUnitID(false), _needUpdateData(false), _currentUnitID(-1), _currentPlane(-1), _currentCSC(-1), _currentLayer(-1), _currentObjectType(Undefined) { edm::LogInfo("ForwardSim") << "Creating TotemT1Organization"; }
TotemT1Organization::~TotemT1Organization | ( | ) | [virtual] |
Definition at line 38 of file TotemT1Organization.cc.
{ }
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().
{ if (_needUpdateData) { #ifdef SCRIVI LogDebug("ForwardSim") << "Data update needed."; #endif const_cast<TotemT1Organization *>(this)->_FromUnitIDToData(); } else { #ifdef SCRIVI LogDebug("ForwardSim") << "Data update not needed."; #endif } }
void TotemT1Organization::_checkUnitIDUpdate | ( | void | ) | const [private] |
Definition at line 223 of file TotemT1Organization.cc.
References _FromDataToUnitID(), _needUpdateUnitID, and LogDebug.
Referenced by GetCurrentUnitID().
{ if (_needUpdateUnitID) { #ifdef SCRIVI LogDebug("ForwardSim") << "UnitID update needed."; #endif const_cast<TotemT1Organization *>(this)->_FromDataToUnitID(); } else { #ifdef SCRIVI LogDebug("ForwardSim") << "UnitID update not needed."; #endif } }
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().
{ int currDP, currPL, currCSC, currLA, currOT; #ifdef SCRIVI LogDebug("ForwardSim") << " CURRENT DETECTOR POSITION (0-3) " <<_currentDetectorPosition; #endif switch(_currentDetectorPosition) { case 0: currDP=0; break; case 1: currDP=1; break; case 2: currDP=2; break; case 3: currDP=3; break; case 4: currDP=4; break; default: _currentDetectorPosition=0; currDP=0; edm::LogInfo("ForwardSim") << "Invalid _currentDetectorPosition value (" << _currentDetectorPosition << "). Now is \"Undefined\""; } if (_currentPlane<-1) { edm::LogInfo("ForwardSim") << "Invalid _currentPlane value (" << _currentPlane << "). Now is -1"; _currentPlane=-1; } currPL=_currentPlane+1; if (_currentCSC<-1 || _currentCSC>5) { edm::LogInfo("ForwardSim") << "Invalid _currentCSC value (" << _currentCSC << "). Now is -1"; _currentCSC=-1; } currCSC=_currentCSC+1; if (_currentLayer<-1) { edm::LogInfo("ForwardSim") << "Invalid _currentLayer value (" << _currentLayer << "). Now is -1"; _currentLayer=-1; } currLA=_currentLayer+1; currOT=FromObjectTypeToInt(_currentObjectType); // currDP: 0..2 (3) // currPL: 0..infty // currCSC: 0..6 (7) // currLA: 0..infty // currOT: 0..MaxObjectTypes-1 (MaxObjectTypes) TotemNumberMerger merger; int currPLA(merger.Merge(currPL,currLA)); _currentUnitID=currDP*100000+5*(currCSC+7*(currOT+MaxObjectTypes*(currPLA))); #ifdef SCRIVI LogDebug("ForwardSim") << "currDP=" << currDP << ", currPL=" << currPL << ", currCSC=" << currCSC << ", currLA=" << currLA << ", currOT=" << currOT << ", currPLA=" << currPLA << ", _currentUnitID=" << _currentUnitID; #endif _needUpdateUnitID=false; }
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().
{ int currDP, currCSC, currOT, currPLA; unsigned long currPL, currLA; // currDP: 0..4 (5) // currPL: 0..infty // currCSC: 0..6 (7) // currLA: 0..infty // currOT: 0..MaxObjectTypes-1 (MaxObjectTypes) currDP = (_currentUnitID/100000) % 5;// 3; currCSC = (_currentUnitID/5)%7; currOT = (_currentUnitID/(5*7))%MaxObjectTypes; currPLA = _currentUnitID/(5*7*MaxObjectTypes); TotemNumberMerger splitter; splitter.Split(currPLA,currPL,currLA); #ifdef SCRIVI LogDebug("ForwardSim") << "currDP=" << currDP << ", currPL=" << currPL << ", currCSC=" << currCSC << ", currLA=" << currLA << ", currOT=" << currOT << ", currPLA=" << currPLA << ", _currentUnitID=" << _currentUnitID; #endif _currentPlane=currPL-1; _currentCSC=currCSC-1; _currentLayer=currLA-1; _currentObjectType=static_cast<ObjectType>(currOT); switch(currDP) { case 0: _currentDetectorPosition=0; break; case 1: _currentDetectorPosition=1; break; case 2: _currentDetectorPosition=2; break; case 3: _currentDetectorPosition=3; break; case 4: _currentDetectorPosition=4; break; } _needUpdateData=false; }
int TotemT1Organization::FromObjectTypeToInt | ( | ObjectType | objectType, |
int | layer | ||
) |
Definition at line 214 of file TotemT1Organization.cc.
References FromObjectTypeToInt(), and MaxObjectTypes.
{ return FromObjectTypeToInt(objectType)+layer*MaxObjectTypes; }
int TotemT1Organization::FromObjectTypeToInt | ( | ObjectType | objectType | ) |
Definition at line 203 of file TotemT1Organization.cc.
References MaxObjectTypes, and query::result.
Referenced by _FromDataToUnitID(), and FromObjectTypeToInt().
{ int result(static_cast<int>(objectType)); if (result<0 || result>=MaxObjectTypes) { result = 0; edm::LogInfo("ForwardSim") << "Invalid ObjectType value (" << objectType << "). Now is \"Undefined\""; } return result; }
int TotemT1Organization::GetCurrentCSC | ( | void | ) | const |
Definition at line 149 of file TotemT1Organization.cc.
References _checkDataUpdate(), _currentCSC, and LogDebug.
{ _checkDataUpdate(); #ifdef SCRIVI LogDebug("ForwardSim") << "GetCurrentCSC()=" << _currentCSC; #endif return _currentCSC; }
int TotemT1Organization::GetCurrentDetectorPosition | ( | void | ) | const |
Definition at line 111 of file TotemT1Organization.cc.
References _checkDataUpdate(), _currentDetectorPosition, and LogDebug.
{ _checkDataUpdate(); #ifdef SCRIVI LogDebug("ForwardSim") << "GetCurrentDetectorPosition()=" << _currentDetectorPosition; #endif return _currentDetectorPosition; }
int TotemT1Organization::GetCurrentLayer | ( | void | ) | const |
Definition at line 167 of file TotemT1Organization.cc.
References _checkDataUpdate(), _currentLayer, and LogDebug.
{ _checkDataUpdate(); #ifdef SCRIVI LogDebug("ForwardSim") << "GetCurrentLayer()=" << _currentLayer; #endif return _currentLayer; }
TotemT1Organization::ObjectType TotemT1Organization::GetCurrentObjectType | ( | void | ) | const |
Definition at line 185 of file TotemT1Organization.cc.
References _checkDataUpdate(), _currentObjectType, and LogDebug.
{ _checkDataUpdate(); #ifdef SCRIVI LogDebug("ForwardSim") << "GetCurrentObjectType()=" << _currentObjectType; #endif return _currentObjectType; }
int TotemT1Organization::GetCurrentPlane | ( | void | ) | const |
Definition at line 130 of file TotemT1Organization.cc.
References _checkDataUpdate(), _currentPlane, and LogDebug.
{ _checkDataUpdate(); #ifdef SCRIVI LogDebug("ForwardSim") << "GetCurrentPlane()=" << _currentPlane; #endif return _currentPlane; }
int TotemT1Organization::GetCurrentUnitID | ( | void | ) | const |
Definition at line 92 of file TotemT1Organization.cc.
References _checkUnitIDUpdate(), _currentUnitID, and LogDebug.
Referenced by GetUnitID().
{ _checkUnitIDUpdate(); #ifdef SCRIVI LogDebug("ForwardSim") << "GetCurrentUnitID()=" << _currentUnitID; << endl; #endif return _currentUnitID; }
uint32_t TotemT1Organization::GetUnitID | ( | const G4Step * | aStep | ) | const [virtual] |
Implements TotemVDetectorOrganization.
Definition at line 45 of file TotemT1Organization.cc.
References GetUnitID().
{ return const_cast<TotemT1Organization *>(this)->GetUnitID(aStep); }
uint32_t TotemT1Organization::GetUnitID | ( | const G4Step * | aStep | ) |
Definition at line 50 of file TotemT1Organization.cc.
References _currentCSC, _currentDetectorPosition, _currentLayer, _currentObjectType, _currentPlane, _needUpdateUnitID, GetCurrentUnitID(), cuy::ii, LogDebug, and MaxObjectTypes.
Referenced by GetUnitID().
{ int currLAOT; const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable(); G4VPhysicalVolume* physVol; int ii =0; for ( ii = 0; ii < touch->GetHistoryDepth(); ii++ ){ physVol = touch->GetVolume(ii); #ifdef SCRIVI LogDebug("ForwardSim") << "physVol=" << physVol->GetName() << ", level=" << ii << ", physVol->GetCopyNo()=" << physVol->GetCopyNo(); #endif if(physVol->GetName() == "TotemT1" && physVol->GetCopyNo()==1) _currentDetectorPosition = 1; if(physVol->GetName() == "TotemT1" && physVol->GetCopyNo()==2) _currentDetectorPosition = 2; } touch = aStep->GetPreStepPoint()->GetTouchable(); physVol=touch->GetVolume(0); currLAOT=physVol->GetCopyNo(); _currentObjectType=static_cast<ObjectType>(currLAOT%MaxObjectTypes); _currentLayer=currLAOT/MaxObjectTypes; _currentPlane=-1; _currentCSC=-1; if (touch->GetVolume(1)) { _currentCSC=touch->GetVolume(1)->GetCopyNo(); if (touch->GetVolume(2)) _currentPlane=touch->GetVolume(2)->GetCopyNo(); } #ifdef SCRIVI LogDebug("ForwardSim") << "CURRENT CSC "<<_currentCSC << "\n" << "CURRENT PLANE "<<_currentPlane; #endif _needUpdateUnitID=true; return GetCurrentUnitID(); }
void TotemT1Organization::SetCurrentCSC | ( | int | currentCSC | ) |
Definition at line 158 of file TotemT1Organization.cc.
References _currentCSC, _needUpdateUnitID, and LogDebug.
{ #ifdef SCRIVI LogDebug("ForwardSim") << "_currentCSC=" << currentCSC; #endif _currentCSC=currentCSC; _needUpdateUnitID=true; }
void TotemT1Organization::SetCurrentDetectorPosition | ( | int | currentDetectorPosition | ) |
Definition at line 121 of file TotemT1Organization.cc.
References _currentDetectorPosition, _needUpdateUnitID, and LogDebug.
Referenced by TotemT1NumberingScheme::TotemT1NumberingScheme().
{ #ifdef SCRIVI LogDebug("ForwardSim") << "_currentDetectorPosition=" << currentDetectorPosition; #endif _currentDetectorPosition=currentDetectorPosition; _needUpdateUnitID=true; }
void TotemT1Organization::SetCurrentLayer | ( | int | currentLayer | ) |
Definition at line 176 of file TotemT1Organization.cc.
References _currentLayer, _needUpdateUnitID, and LogDebug.
{ #ifdef SCRIVI LogDebug("ForwardSim") << "_currentLayer=" << currentLayer; #endif _currentLayer=currentLayer; _needUpdateUnitID=true; }
void TotemT1Organization::SetCurrentObjectType | ( | ObjectType | currentObjectType | ) | [inline] |
Definition at line 194 of file TotemT1Organization.cc.
References _currentObjectType, _needUpdateUnitID, and LogDebug.
{ #ifdef SCRIVI LogDebug("ForwardSim") << "_currentObjectType=" << currentObjectType; #endif _currentObjectType=currentObjectType; _needUpdateUnitID=true; }
void TotemT1Organization::SetCurrentPlane | ( | int | currentPlane | ) |
Definition at line 140 of file TotemT1Organization.cc.
References _currentPlane, _needUpdateUnitID, and LogDebug.
{ #ifdef SCRIVI LogDebug("ForwardSim") << "_currentPlane=" << currentPlane; #endif _currentPlane=currentPlane; _needUpdateUnitID=true; }
void TotemT1Organization::SetCurrentUnitID | ( | int | currentUnitID | ) |
Definition at line 102 of file TotemT1Organization.cc.
References _currentUnitID, _needUpdateData, and LogDebug.
{ #ifdef SCRIVI LogDebug("ForwardSim") << "_currentUnitID=" << currentUnitID; #endif _currentUnitID=currentUnitID; _needUpdateData=true; }
int TotemT1Organization::_currentCSC [private] |
Definition at line 109 of file TotemT1Organization.h.
Referenced by _FromDataToUnitID(), _FromUnitIDToData(), GetCurrentCSC(), GetUnitID(), and SetCurrentCSC().
int TotemT1Organization::_currentDetectorPosition [private] |
Definition at line 107 of file TotemT1Organization.h.
Referenced by _FromDataToUnitID(), _FromUnitIDToData(), GetCurrentDetectorPosition(), GetUnitID(), and SetCurrentDetectorPosition().
int TotemT1Organization::_currentLayer [private] |
Definition at line 110 of file TotemT1Organization.h.
Referenced by _FromDataToUnitID(), _FromUnitIDToData(), GetCurrentLayer(), GetUnitID(), and SetCurrentLayer().
Definition at line 111 of file TotemT1Organization.h.
Referenced by _FromDataToUnitID(), _FromUnitIDToData(), GetCurrentObjectType(), GetUnitID(), and SetCurrentObjectType().
int TotemT1Organization::_currentPlane [private] |
Definition at line 108 of file TotemT1Organization.h.
Referenced by _FromDataToUnitID(), _FromUnitIDToData(), GetCurrentPlane(), GetUnitID(), and SetCurrentPlane().
int TotemT1Organization::_currentUnitID [private] |
Definition at line 106 of file TotemT1Organization.h.
Referenced by _FromDataToUnitID(), _FromUnitIDToData(), GetCurrentUnitID(), and SetCurrentUnitID().
bool TotemT1Organization::_needUpdateData [private] |
Definition at line 105 of file TotemT1Organization.h.
Referenced by _checkDataUpdate(), _FromUnitIDToData(), and SetCurrentUnitID().
bool TotemT1Organization::_needUpdateUnitID [private] |
Definition at line 104 of file TotemT1Organization.h.
Referenced by _checkUnitIDUpdate(), _FromDataToUnitID(), GetUnitID(), SetCurrentCSC(), SetCurrentDetectorPosition(), SetCurrentLayer(), SetCurrentObjectType(), and SetCurrentPlane().