CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

PixelEndcapName Class Reference

#include <PixelEndcapName.h>

Inheritance diagram for PixelEndcapName:
PixelModuleName

List of all members.

Public Types

enum  HalfCylinder { mO = 1, mI = 2, pO = 3, pI = 4 }

Public Member Functions

int bladeName () const
 blade id
int diskName () const
 disk id
PXFDetId getDetId ()
 return DetId
HalfCylinder halfCylinder () const
virtual PixelModuleName::ModuleType moduleType () const
 module Type
virtual std::string name () const
 from base class
virtual bool operator== (const PixelModuleName &) const
 check equality of modules from datamemebers
int pannelName () const
 pannel id
 PixelEndcapName (std::string name)
 ctor from name string
 PixelEndcapName (HalfCylinder part=mO, int disk=0, int blade=0, int pannel=0, int plaq=0)
 ctor for defined name
 PixelEndcapName (const DetId &)
 ctor from DetId
int plaquetteName () const
 plaquetteId (in pannel)
virtual ~PixelEndcapName ()

Private Attributes

int theBlade
int theDisk
int thePannel
HalfCylinder thePart
int thePlaquette

Detailed Description

Endcap Module name (as in PixelDatabase) for endcaps

Definition at line 16 of file PixelEndcapName.h.


Member Enumeration Documentation

Enumerator:
mO 
mI 
pO 
pI 

Definition at line 19 of file PixelEndcapName.h.

{ mO = 1, mI = 2 , pO =3 , pI =4 };

Constructor & Destructor Documentation

PixelEndcapName::PixelEndcapName ( const DetId id)

ctor from DetId

Definition at line 11 of file PixelEndcapName.cc.

References PXFDetId::blade(), PXFDetId::disk(), mI, mO, PXFDetId::module(), SurfaceOrientation::outer, PXFDetId::panel(), pI, pO, PXFDetId::side(), theBlade, theDisk, thePannel, thePart, and thePlaquette.

  : PixelModuleName(false)
{
  PXFDetId cmssw_numbering(id);
  int side = cmssw_numbering.side();

  int tmpBlade = cmssw_numbering.blade();
  bool outer = false;
  if (tmpBlade >= 7 && tmpBlade <= 18) {
    outer = true;
    theBlade = tmpBlade-6;
  } else if( tmpBlade <=6 ) { 
    theBlade = 7-tmpBlade; 
  } else if( tmpBlade >= 19) { 
    theBlade = 31-tmpBlade; 
  } 


       if( side == 1 &&  outer ) thePart = mO;
  else if( side == 1 && !outer ) thePart = mI;
  else if( side == 2 &&  outer ) thePart = pO;
  else if( side == 2 && !outer ) thePart = pI;
 

  theDisk = cmssw_numbering.disk();
  thePannel = cmssw_numbering.panel();
  thePlaquette = cmssw_numbering.module();
}
PixelEndcapName::PixelEndcapName ( HalfCylinder  part = mO,
int  disk = 0,
int  blade = 0,
int  pannel = 0,
int  plaq = 0 
) [inline]

ctor for defined name

Definition at line 25 of file PixelEndcapName.h.

    : PixelModuleName(false), 
      thePart(part), theDisk(disk), theBlade(blade), thePannel(pannel), thePlaquette(plaq)
  { }
PixelEndcapName::PixelEndcapName ( std::string  name)

ctor from name string

Definition at line 41 of file PixelEndcapName.cc.

References mI, mO, name(), pI, pO, theBlade, theDisk, thePannel, thePart, and thePlaquette.

  : PixelModuleName(false), thePart(mO), theDisk(0), 
    theBlade(0), thePannel(0), thePlaquette(0) {

  // parse the name string
  // first, check to make sure this is an FPix name, should start with "FPix_"
  // also check to make sure the needed parts are present
  if ( (name.substr(0, 5) != "FPix_") ||
       (name.find("_B") == string::npos) || 
       (name.find("_D") == string::npos) ||
       (name.find("_BLD") == string::npos) || 
       (name.find("_PNL") == string::npos) ||
       (name.find("_PLQ") == string::npos) ) {
    edm::LogError ("BadNameString|SiPixel") 
      << "Bad name string in PixelEndcapName::PixelEndcapName(std::string): "
      << name;
    return;
  }

  // strip off ROC part if it's there
  if (name.find("_ROC") != string::npos)
    name = name.substr(0, name.find("_ROC"));

  // get the half cylinder
  string hcString = name.substr(name.find("_B")+2, name.find("_D")-name.find("_B")-2);
  if (hcString == "mO") thePart = mO;
  else if (hcString == "mI") thePart = mI;
  else if (hcString == "pO") thePart = pO;
  else if (hcString == "pI") thePart = pI;
  else {
    edm::LogError ("BadNameString|SiPixel") 
      << "Unable to determine half cylinder in PixelEndcapName::PixelEndcapName(std::string): "
      << name;
  }

  // get the disk
  string diskString = name.substr(name.find("_D")+2, name.find("_BLD")-name.find("_D")-2);
  if (diskString == "1") theDisk = 1;
  else if (diskString == "2") theDisk = 2;
  else if (diskString == "3") theDisk = 3;
  else {
    edm::LogError ("BadNameString|SiPixel") 
      << "Unable to determine disk number in PixelEndcapName::PixelEndcapName(std::string): "
      << name;
  }

  // get the blade
  string bladeString = name.substr(name.find("_BLD")+4, name.find("_PNL")-name.find("_BLD")-4);
  // since atoi() doesn't report errors, do it the long way
  if (bladeString == "1") theBlade = 1;
  else if (bladeString == "2") theBlade = 2;
  else if (bladeString == "3") theBlade = 3;
  else if (bladeString == "4") theBlade = 4;
  else if (bladeString == "5") theBlade = 5;
  else if (bladeString == "6") theBlade = 6;
  else if (bladeString == "7") theBlade = 7;
  else if (bladeString == "8") theBlade = 8;
  else if (bladeString == "9") theBlade = 9;
  else if (bladeString == "10") theBlade = 10;
  else if (bladeString == "11") theBlade = 11;
  else if (bladeString == "12") theBlade = 12;
  else {
    edm::LogError ("BadNameString|SiPixel") 
      << "Unable to determine blade number in PixelEndcapName::PixelEndcapName(std::string): "
      << name;
  }

  // find the panel
  string panelString = name.substr(name.find("_PNL")+4, name.find("_PLQ")-name.find("_PNL")-4);
  if (panelString == "1") thePannel = 1;
  else if (panelString == "2") thePannel = 2;
  else {
    edm::LogError ("BadNameString|SiPixel") 
      << "Unable to determine panel number in PixelEndcapName::PixelEndcapName(std::string): "
      << name;
  }

  // find the plaquette
  string plaquetteString = name.substr(name.find("_PLQ")+4, name.size()-name.find("_PLQ")-4);
  if (plaquetteString == "1") thePlaquette = 1;
  else if (plaquetteString == "2") thePlaquette = 2;
  else if (plaquetteString == "3") thePlaquette = 3;
  else if (plaquetteString == "4") thePlaquette = 4;
  else {
    edm::LogError ("BadNameString|SiPixel") 
      << "Unable to determine plaquette number in PixelEndcapName::PixelEndcapName(std::string): "
      << name;
  }

} // PixelEndcapName::PixelEndcapName(std::string name)
virtual PixelEndcapName::~PixelEndcapName ( ) [inline, virtual]

Definition at line 33 of file PixelEndcapName.h.

{ }

Member Function Documentation

int PixelEndcapName::bladeName ( ) const [inline]
int PixelEndcapName::diskName ( ) const [inline]
PXFDetId PixelEndcapName::getDetId ( void  )

return DetId

Definition at line 183 of file PixelEndcapName.cc.

References bladeName(), diskName(), halfCylinder(), mI, mO, SurfaceOrientation::outer, pannelName(), pI, plaquetteName(), and pO.

                                   {
  
  uint32_t side = 0;
  uint32_t disk = 0;
  uint32_t blade = 0;
  uint32_t panel = 0;
  uint32_t module = 0;

  // figure out the side
  HalfCylinder hc = halfCylinder();
  if (hc == mO || hc == mI) side = 1;
  else if (hc == pO || hc == pI) side = 2;
  
  // get disk/blade/panel/module numbers from PixelEndcapName object
  disk = static_cast<uint32_t>(diskName());
  uint32_t tmpBlade = static_cast<uint32_t>(bladeName());
  panel = static_cast<uint32_t>(pannelName());
  module = static_cast<uint32_t>(plaquetteName());

  // convert blade numbering to cmssw convention
  bool outer = false;
  outer = (hc == mO) || (hc == pO);
  if (outer) {
    blade = tmpBlade + 6;
  }
  else { // inner
    if (tmpBlade <= 6) blade = 7 - tmpBlade;
    else if (tmpBlade <= 12) blade = 31 - tmpBlade;
  }

  // create and return the DetId
  return PXFDetId(side, disk, blade, panel, module);

} // PXFDetId PixelEndcapName::getDetId()
HalfCylinder PixelEndcapName::halfCylinder ( ) const [inline]
PixelModuleName::ModuleType PixelEndcapName::moduleType ( ) const [virtual]

module Type

Implements PixelModuleName.

Definition at line 132 of file PixelEndcapName.cc.

References pannelName(), plaquetteName(), PixelModuleName::v1x2, PixelModuleName::v1x5, PixelModuleName::v2x3, PixelModuleName::v2x4, and PixelModuleName::v2x5.

Referenced by PixelEndcapLinkMaker::links().

{
  ModuleType type = v1x2;
  if (pannelName() == 1) {
    if (plaquetteName() == 1)      { type = v1x2; }
    else if (plaquetteName() == 2) { type = v2x3; }
    else if (plaquetteName() == 3) { type = v2x4; }
    else if (plaquetteName() == 4) { type = v1x5; }
  }
  else {
    if (plaquetteName() == 1)      { type = v2x3; }
    else if (plaquetteName() == 2) { type = v2x4; }
    else if (plaquetteName() == 3) { type = v2x5; }
  }
  return type;
}
string PixelEndcapName::name ( ) const [virtual]
bool PixelEndcapName::operator== ( const PixelModuleName o) const [virtual]

check equality of modules from datamemebers

Implements PixelModuleName.

Definition at line 149 of file PixelEndcapName.cc.

References PixelModuleName::isBarrel(), connectstrParser::o, theBlade, theDisk, thePannel, thePart, and thePlaquette.

{
  if (!o.isBarrel()) {
    const PixelEndcapName * other = dynamic_cast<const PixelEndcapName *>(&o);
    return (    other 
             && thePart      == other->thePart
             && theDisk      == other->theDisk
             && theBlade     == other->theBlade
             && thePannel    == other->thePannel
             && thePlaquette == other->thePlaquette ); 
  } else return false;
}
int PixelEndcapName::pannelName ( ) const [inline]
int PixelEndcapName::plaquetteName ( ) const [inline]

Member Data Documentation

Definition at line 64 of file PixelEndcapName.h.

Referenced by bladeName(), name(), operator==(), and PixelEndcapName().

int PixelEndcapName::theDisk [private]

Definition at line 64 of file PixelEndcapName.h.

Referenced by diskName(), name(), operator==(), and PixelEndcapName().

Definition at line 64 of file PixelEndcapName.h.

Referenced by name(), operator==(), pannelName(), and PixelEndcapName().

Definition at line 63 of file PixelEndcapName.h.

Referenced by halfCylinder(), name(), operator==(), and PixelEndcapName().

Definition at line 64 of file PixelEndcapName.h.

Referenced by name(), operator==(), PixelEndcapName(), and plaquetteName().