CMS 3D CMS Logo

BscNumberingScheme Class Reference

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

List of all members.

Public Member Functions

 BscNumberingScheme ()
virtual void detectorLevel (const G4Step *, int &, int *, G4String *) const
virtual int detectorLevel (const G4Step *) const
virtual unsigned int getUnitID (const G4Step *aStep) const
virtual ~BscNumberingScheme ()

Static Public Member Functions

static unsigned int packBscIndex (int det, int zside, int station)
static void unpackBscIndex (const unsigned int &idx)


Detailed Description

Definition at line 18 of file BscNumberingScheme.h.


Constructor & Destructor Documentation

BscNumberingScheme::BscNumberingScheme (  ) 

Definition at line 13 of file BscNumberingScheme.cc.

References LogDebug.

00013                                        {
00014   LogDebug("BscSim") << " Creating BscNumberingScheme" ;
00015 }

BscNumberingScheme::~BscNumberingScheme (  )  [virtual]

Definition at line 17 of file BscNumberingScheme.cc.

References LogDebug.

00017                                         {
00018   LogDebug("BscSim") << " Deleting BscNumberingScheme" ;
00019 }


Member Function Documentation

void BscNumberingScheme::detectorLevel ( const G4Step *  aStep,
int level,
int copyno,
G4String *  name 
) const [virtual]

Definition at line 30 of file BscNumberingScheme.cc.

References i.

00031                                                                            {
00032 
00033   //Get name and copy numbers
00034   if (level > 0) {
00035     const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
00036     for (int ii = 0; ii < level; ii++) {
00037       int i      = level - ii - 1;
00038       name[ii]   = touch->GetVolume(i)->GetName();
00039       copyno[ii] = touch->GetReplicaNumber(i);
00040     }
00041   }
00042 }

int BscNumberingScheme::detectorLevel ( const G4Step *  aStep  )  const [virtual]

Definition at line 21 of file BscNumberingScheme.cc.

References level.

Referenced by getUnitID().

00021                                                                {
00022 
00023   //Find number of levels
00024   const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
00025   int level = 0;
00026   if (touch) level = ((touch->GetHistoryDepth())+1);
00027   return level;
00028 }

unsigned int BscNumberingScheme::getUnitID ( const G4Step *  aStep  )  const [virtual]

Definition at line 44 of file BscNumberingScheme.cc.

References detectorLevel(), level, LogDebug, name, and packBscIndex().

Referenced by BscSD::setDetUnitId().

00044                                                                     {
00045 
00046   unsigned intindex=0;
00047   int level = detectorLevel(aStep);
00048 
00049   LogDebug("BscSim") << "BscNumberingScheme number of levels= " << level;
00050 
00051  //  unsigned int intIndex = 0;
00052   if (level > 0) {
00053     int*      copyno = new int[level];
00054     G4String* name   = new G4String[level];
00055     detectorLevel(aStep, level, copyno, name);
00056 
00057     int det   = 0;
00058     int zside   = 0;
00059     int station  = 0;
00060     for (int ich=0; ich  <  level; ich++) {
00061       // new and old set up configurations are possible:
00062       if(name[ich] == "BSC1" ||name[ich] == "BSC2" ) {
00063         zside   = copyno[ich]-1;
00064       } else if(name[ich] == "BSCTrap") {
00065         det   = 0;
00066         station =  2*(copyno[ich]-1);
00067       } else if(name[ich] == "BSCTubs") {
00068         det   = 1;
00069         station =  copyno[ich]-1;
00070       } else if(name[ich] == "BSCTTop") {
00071         ++station;
00072       } else if(name[ich] == "BSC2Pad"){
00073         det   = 2;
00074         station =  copyno[ich]-1;
00075       }
00076 
00077       LogDebug("BscSim") << "BscNumberingScheme  " << "ich=" << ich  <<"copyno"
00078                          << copyno[ich] << "name="  << name[ich];
00079 
00080     }
00081     intindex = packBscIndex (zside,det,  station);
00082     LogDebug("BscSim") << "BscNumberingScheme : det " << det << " zside " 
00083                        << zside << " station " << station 
00084                        << " UnitID 0x" << std::hex << intindex << std::dec;
00085 
00086     for (int ich = 0; ich < level; ich++)
00087       LogDebug("BscSim") <<" name = " << name[ich] <<" copy = " << copyno[ich];
00088     LogDebug("BscSim") << " packed index = 0x" << std::hex << intindex 
00089                        << std::dec;
00090 
00091     delete[] copyno;
00092     delete[] name;
00093   }
00094 
00095   return intindex;
00096   
00097 }

unsigned BscNumberingScheme::packBscIndex ( int  det,
int  zside,
int  station 
) [static]

Definition at line 99 of file BscNumberingScheme.cc.

References LogDebug.

Referenced by getUnitID(), and BscTest::update().

00099                                                                         {
00100   unsigned int idx = 6 << 28; // autre numero que les detecteurs existants 
00101   idx += (zside<<5)&32;       // vaut 0 ou 1 bit 5    
00102   idx += (det<<3)&24;         //bit 3-4    det:0-1-2    2 bits:0-1
00103   idx += (station&7);         //bits 0-2   station:0-7=8-->2**3 =8   3 bits:0-2
00104   LogDebug("BscSim") << "Bsc packing: det " << det 
00105                      << " zside  " << zside << " station " << station  
00106                      << "-> 0x" << std::hex << idx << std::dec;
00107 
00108   //  unpackBscIndex(idx);  
00109   return idx;
00110 }

void BscNumberingScheme::unpackBscIndex ( const unsigned int idx  )  [static]

Definition at line 112 of file BscNumberingScheme.cc.

References LogDebug.

Referenced by BscTest::update().

00112                                                                {
00113   int zside, det, station;
00114   zside  = (idx&32)>>5;
00115   det    = (idx&24)>>3;
00116   station = idx&7;                                           
00117   LogDebug("BscSim") << " Bsc unpacking: 0x " << std::hex << idx << std::dec 
00118                      << " -> det " <<   det  << " zside  " << zside 
00119                      << " station " << station  ;
00120 }


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