CMS 3D CMS Logo

TotemT1Organization Class Reference

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

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

Inheritance diagram for TotemT1Organization:

TotemVDetectorOrganization TotemT1NumberingScheme

List of all members.

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 layer)
int FromObjectTypeToInt (ObjectType objectType)
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
uint32_t GetUnitID (const G4Step *aStep)
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 ()

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

enum TotemT1Organization::ObjectType

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.

00036                    {
00037    Undefined=0,
00038    Upper=1,
00039    Lower=2,
00040    InternalUpper=3,
00041    InternalLower=4,
00042    Frame1=5,
00043    Frame2Left=6,
00044    Frame2Right=7,
00045    Frame3Left=8,
00046    Frame3Right=9,
00047    Frame4Left=10,
00048    Frame4Right=11,
00049    Frame5=12,
00050    Triangle6Left=13,
00051    Triangle6Right=14,
00052    MaxObjectTypes=15
00053   };


Constructor & Destructor Documentation

TotemT1Organization::TotemT1Organization (  ) 

Definition at line 27 of file TotemT1Organization.cc.

00027                                            :  _needUpdateUnitID(false),
00028                                                 _needUpdateData(false),
00029                                                 _currentUnitID(-1),
00030                                                 _currentPlane(-1),
00031                                                 _currentCSC(-1),
00032                                                 _currentLayer(-1),
00033                                                 _currentObjectType(Undefined) {
00034 
00035   edm::LogInfo("ForwardSim") << "Creating TotemT1Organization";
00036 }

TotemT1Organization::~TotemT1Organization (  )  [virtual]

Definition at line 38 of file TotemT1Organization.cc.

00038                                             {
00039 }


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().

00236                                                        {
00237 
00238   if (_needUpdateData) {
00239 #ifdef SCRIVI
00240     LogDebug("ForwardSim") << "Data update needed.";
00241 #endif
00242     const_cast<TotemT1Organization *>(this)->_FromUnitIDToData();
00243   } else {
00244 #ifdef SCRIVI
00245     LogDebug("ForwardSim") << "Data update not needed.";
00246 #endif
00247   }
00248 }

void TotemT1Organization::_checkUnitIDUpdate ( void   )  const [private]

Definition at line 223 of file TotemT1Organization.cc.

References _FromDataToUnitID(), _needUpdateUnitID, and LogDebug.

Referenced by GetCurrentUnitID().

00223                                                          {
00224   if (_needUpdateUnitID) {
00225 #ifdef SCRIVI
00226     LogDebug("ForwardSim") << "UnitID update needed.";
00227 #endif
00228     const_cast<TotemT1Organization *>(this)->_FromDataToUnitID();
00229   } else {
00230 #ifdef SCRIVI
00231     LogDebug("ForwardSim") << "UnitID update not needed.";
00232 #endif
00233   }
00234 }

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().

00300                                                   {
00301   int currDP, currPL, currCSC, currLA, currOT;
00302 #ifdef SCRIVI
00303   LogDebug("ForwardSim") << " CURRENT DETECTOR POSITION (0-3) " 
00304                          <<_currentDetectorPosition;
00305 #endif
00306   switch(_currentDetectorPosition)  {
00307   case 0:
00308     currDP=0;
00309     break;
00310   case 1:
00311     currDP=1;
00312     break;
00313   case 2:
00314     currDP=2;
00315     break;
00316   case 3:
00317     currDP=3;
00318     break;
00319   case 4:
00320     currDP=4;
00321     break;
00322   default:
00323     _currentDetectorPosition=0;
00324     currDP=0;
00325     edm::LogInfo("ForwardSim") << "Invalid _currentDetectorPosition value (" 
00326                                << _currentDetectorPosition
00327                                << "). Now is \"Undefined\"";
00328   }
00329  
00330   if (_currentPlane<-1) {
00331     edm::LogInfo("ForwardSim") << "Invalid _currentPlane value (" 
00332                                << _currentPlane << "). Now is -1";
00333     _currentPlane=-1;
00334   }
00335   currPL=_currentPlane+1;
00336   
00337   if (_currentCSC<-1 || _currentCSC>5)  {
00338     edm::LogInfo("ForwardSim") << "Invalid _currentCSC value (" << _currentCSC
00339                                << "). Now is -1";
00340     _currentCSC=-1;
00341   }
00342   currCSC=_currentCSC+1;
00343   
00344   if (_currentLayer<-1)  {
00345     edm::LogInfo("ForwardSim") << "Invalid _currentLayer value (" 
00346                                << _currentLayer << "). Now is -1";
00347     _currentLayer=-1;
00348   }
00349   currLA=_currentLayer+1;
00350  
00351   currOT=FromObjectTypeToInt(_currentObjectType);
00352  
00353   // currDP:  0..2 (3)
00354   // currPL:  0..infty
00355   // currCSC: 0..6 (7)
00356   // currLA:  0..infty
00357   // currOT:  0..MaxObjectTypes-1 (MaxObjectTypes)
00358 
00359   TotemNumberMerger merger;
00360   int currPLA(merger.Merge(currPL,currLA));
00361  
00362   _currentUnitID=currDP*100000+5*(currCSC+7*(currOT+MaxObjectTypes*(currPLA)));
00363 #ifdef SCRIVI
00364   LogDebug("ForwardSim") << "currDP=" << currDP << ", currPL=" << currPL  
00365                          << ", currCSC=" << currCSC << ", currLA=" << currLA  
00366                          << ", currOT=" << currOT << ", currPLA=" << currPLA  
00367                          << ", _currentUnitID=" << _currentUnitID;
00368 #endif
00369  
00370   _needUpdateUnitID=false;
00371 }

void TotemT1Organization::_FromUnitIDToData ( void   )  [private]

Definition at line 250 of file TotemT1Organization.cc.

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

Referenced by _checkDataUpdate().

00250                                                   {
00251 
00252   int currDP, currCSC, currOT, currPLA;
00253   unsigned long currPL, currLA;
00254  
00255   // currDP:  0..4 (5)
00256   // currPL:  0..infty
00257   // currCSC: 0..6 (7)
00258   // currLA:  0..infty
00259   // currOT:  0..MaxObjectTypes-1 (MaxObjectTypes)
00260 
00261   currDP  = (_currentUnitID/100000) % 5;// 3;
00262   currCSC = (_currentUnitID/5)%7;
00263   currOT  = (_currentUnitID/(5*7))%MaxObjectTypes;
00264   currPLA =  _currentUnitID/(5*7*MaxObjectTypes);
00265  
00266   TotemNumberMerger splitter;
00267   splitter.Split(currPLA,currPL,currLA);
00268  
00269 #ifdef SCRIVI
00270   LogDebug("ForwardSim") << "currDP=" << currDP << ", currPL=" << currPL  
00271                          << ", currCSC=" << currCSC << ", currLA=" << currLA  
00272                          << ", currOT=" << currOT << ", currPLA=" << currPLA  
00273                          << ", _currentUnitID=" << _currentUnitID;
00274 #endif
00275   _currentPlane=currPL-1;
00276   _currentCSC=currCSC-1;
00277   _currentLayer=currLA-1;
00278   _currentObjectType=static_cast<ObjectType>(currOT);
00279 
00280   switch(currDP) {
00281   case 0: 
00282     _currentDetectorPosition=0;
00283     break;
00284   case 1: 
00285     _currentDetectorPosition=1;
00286     break;
00287   case 2: 
00288     _currentDetectorPosition=2;
00289     break;
00290   case 3:
00291     _currentDetectorPosition=3;
00292     break;
00293   case 4:
00294     _currentDetectorPosition=4;
00295     break;
00296   } 
00297   _needUpdateData=false;
00298 }

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

Definition at line 214 of file TotemT1Organization.cc.

References FromObjectTypeToInt(), and MaxObjectTypes.

00214                                                                                {
00215   return FromObjectTypeToInt(objectType)+layer*MaxObjectTypes;
00216 }

int TotemT1Organization::FromObjectTypeToInt ( ObjectType  objectType  ) 

Definition at line 203 of file TotemT1Organization.cc.

References MaxObjectTypes, and HLT_VtxMuL3::result.

Referenced by _FromDataToUnitID(), and FromObjectTypeToInt().

00203                                                                     {
00204 
00205   int result(static_cast<int>(objectType));
00206   if (result<0 || result>=MaxObjectTypes) {
00207     result = 0;
00208     edm::LogInfo("ForwardSim") << "Invalid ObjectType value (" << objectType
00209                                << "). Now is \"Undefined\"";
00210   }
00211   return result;
00212 }

int TotemT1Organization::GetCurrentCSC ( void   )  const

Definition at line 149 of file TotemT1Organization.cc.

References _checkDataUpdate(), _currentCSC, and LogDebug.

00149                                                    {
00150 
00151   _checkDataUpdate();
00152 #ifdef SCRIVI
00153   LogDebug("ForwardSim") << "GetCurrentCSC()=" << _currentCSC;
00154 #endif 
00155  return _currentCSC;
00156 }

int TotemT1Organization::GetCurrentDetectorPosition ( void   )  const

Definition at line 111 of file TotemT1Organization.cc.

References _checkDataUpdate(), _currentDetectorPosition, and LogDebug.

00111                                                                  {
00112 
00113   _checkDataUpdate();
00114 #ifdef SCRIVI
00115   LogDebug("ForwardSim") << "GetCurrentDetectorPosition()=" 
00116                          << _currentDetectorPosition;
00117 #endif
00118  return _currentDetectorPosition;
00119 }

int TotemT1Organization::GetCurrentLayer ( void   )  const

Definition at line 167 of file TotemT1Organization.cc.

References _checkDataUpdate(), _currentLayer, and LogDebug.

00167                                                      {
00168 
00169   _checkDataUpdate();
00170 #ifdef SCRIVI
00171   LogDebug("ForwardSim") << "GetCurrentLayer()=" << _currentLayer;
00172 #endif
00173   return _currentLayer;
00174 }

TotemT1Organization::ObjectType TotemT1Organization::GetCurrentObjectType ( void   )  const

Definition at line 185 of file TotemT1Organization.cc.

References _checkDataUpdate(), _currentObjectType, and LogDebug.

00185                                                                                      {
00186   
00187  _checkDataUpdate();
00188 #ifdef SCRIVI
00189  LogDebug("ForwardSim") << "GetCurrentObjectType()=" << _currentObjectType;
00190 #endif
00191  return _currentObjectType;
00192 }

int TotemT1Organization::GetCurrentPlane ( void   )  const

Definition at line 130 of file TotemT1Organization.cc.

References _checkDataUpdate(), _currentPlane, and LogDebug.

00130                                                      {
00131 
00132   _checkDataUpdate();
00133 
00134 #ifdef SCRIVI
00135   LogDebug("ForwardSim") << "GetCurrentPlane()=" << _currentPlane;
00136 #endif
00137  return _currentPlane;
00138 }

int TotemT1Organization::GetCurrentUnitID ( void   )  const

Definition at line 92 of file TotemT1Organization.cc.

References _checkUnitIDUpdate(), _currentUnitID, lat::endl(), and LogDebug.

Referenced by GetUnitID().

00092                                                       {
00093 
00094   _checkUnitIDUpdate();
00095 #ifdef SCRIVI
00096  LogDebug("ForwardSim") << "GetCurrentUnitID()=" << _currentUnitID;
00097                                              << endl;
00098 #endif
00099  return _currentUnitID;
00100 }

uint32_t TotemT1Organization::GetUnitID ( const G4Step *  aStep  )  const [virtual]

Implements TotemVDetectorOrganization.

Definition at line 45 of file TotemT1Organization.cc.

References GetUnitID().

00045                                                                    {
00046   return const_cast<TotemT1Organization *>(this)->GetUnitID(aStep);
00047 }

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().

00050                                                              {
00051 
00052   int currLAOT;
00053   const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
00054   G4VPhysicalVolume* physVol;
00055   int ii =0;
00056   for ( ii = 0; ii < touch->GetHistoryDepth(); ii++ ){
00057     physVol = touch->GetVolume(ii);
00058 
00059 #ifdef SCRIVI
00060     LogDebug("ForwardSim") << "physVol=" << physVol->GetName()
00061                            << ", level=" << ii  << ", physVol->GetCopyNo()=" 
00062                            << physVol->GetCopyNo();
00063 #endif
00064 
00065     if(physVol->GetName() == "TotemT1" && 
00066        physVol->GetCopyNo()==1) _currentDetectorPosition = 1;
00067     if(physVol->GetName() == "TotemT1" && 
00068        physVol->GetCopyNo()==2) _currentDetectorPosition = 2;
00069   }
00070 
00071   touch = aStep->GetPreStepPoint()->GetTouchable();
00072   physVol=touch->GetVolume(0);
00073  
00074   currLAOT=physVol->GetCopyNo();
00075   _currentObjectType=static_cast<ObjectType>(currLAOT%MaxObjectTypes);
00076   _currentLayer=currLAOT/MaxObjectTypes;
00077   _currentPlane=-1;
00078   _currentCSC=-1;
00079 
00080   if (touch->GetVolume(1)) {
00081     _currentCSC=touch->GetVolume(1)->GetCopyNo();
00082     if (touch->GetVolume(2)) _currentPlane=touch->GetVolume(2)->GetCopyNo();
00083   }
00084 #ifdef SCRIVI
00085   LogDebug("ForwardSim") << "CURRENT CSC "<<_currentCSC << "\n"
00086                          << "CURRENT PLANE "<<_currentPlane;
00087 #endif
00088   _needUpdateUnitID=true;
00089   return GetCurrentUnitID();
00090 }

void TotemT1Organization::SetCurrentCSC ( int  currentCSC  ) 

Definition at line 158 of file TotemT1Organization.cc.

References _currentCSC, _needUpdateUnitID, and LogDebug.

00158                                                         {
00159 
00160 #ifdef SCRIVI
00161   LogDebug("ForwardSim") << "_currentCSC=" << currentCSC;
00162 #endif
00163   _currentCSC=currentCSC;
00164   _needUpdateUnitID=true; 
00165 }

void TotemT1Organization::SetCurrentDetectorPosition ( int  currentDetectorPosition  ) 

Definition at line 121 of file TotemT1Organization.cc.

References _currentDetectorPosition, _needUpdateUnitID, and LogDebug.

Referenced by TotemT1NumberingScheme::TotemT1NumberingScheme().

00121                                                                                   {
00122 
00123 #ifdef SCRIVI
00124   LogDebug("ForwardSim") << "_currentDetectorPosition=" << currentDetectorPosition;
00125 #endif
00126   _currentDetectorPosition=currentDetectorPosition;
00127   _needUpdateUnitID=true;
00128 }

void TotemT1Organization::SetCurrentLayer ( int  currentLayer  ) 

Definition at line 176 of file TotemT1Organization.cc.

References _currentLayer, _needUpdateUnitID, and LogDebug.

00176                                                             {
00177 
00178 #ifdef SCRIVI
00179   LogDebug("ForwardSim") << "_currentLayer=" << currentLayer;
00180 #endif
00181   _currentLayer=currentLayer;
00182   _needUpdateUnitID=true;
00183 }

void TotemT1Organization::SetCurrentObjectType ( ObjectType  currentObjectType  )  [inline]

Definition at line 194 of file TotemT1Organization.cc.

References _currentObjectType, _needUpdateUnitID, and LogDebug.

00194                                                                             {
00195 
00196 #ifdef SCRIVI
00197   LogDebug("ForwardSim") << "_currentObjectType=" << currentObjectType;
00198 #endif
00199   _currentObjectType=currentObjectType;
00200   _needUpdateUnitID=true;
00201 }

void TotemT1Organization::SetCurrentPlane ( int  currentPlane  ) 

Definition at line 140 of file TotemT1Organization.cc.

References _currentPlane, _needUpdateUnitID, and LogDebug.

00140                                                             {
00141 
00142 #ifdef SCRIVI
00143   LogDebug("ForwardSim") << "_currentPlane=" << currentPlane;
00144 #endif
00145   _currentPlane=currentPlane;
00146   _needUpdateUnitID=true;
00147 }

void TotemT1Organization::SetCurrentUnitID ( int  currentUnitID  ) 

Definition at line 102 of file TotemT1Organization.cc.

References _currentUnitID, _needUpdateData, and LogDebug.

00102                                                               {
00103 
00104 #ifdef SCRIVI
00105   LogDebug("ForwardSim") << "_currentUnitID=" << currentUnitID;
00106 #endif
00107   _currentUnitID=currentUnitID;
00108   _needUpdateData=true;
00109 }


Member Data Documentation

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().

ObjectType TotemT1Organization::_currentObjectType [private]

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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:33:50 2009 for CMSSW by  doxygen 1.5.4