Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-22 23:30:59

0001 #ifndef DataFormats_TrackerCommon_PixelBarrelName_H
0002 #define DataFormats_TrackerCommon_PixelBarrelName_H
0003 
0004 /** \class PixelBarrelName
0005  * Module name (as in PixelDatabase) in barrel
0006  */
0007 
0008 #include "DataFormats/SiPixelDetId/interface/PixelModuleName.h"
0009 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
0010 
0011 #include <string>
0012 
0013 class DetId;
0014 class TrackerTopology;
0015 
0016 class PixelBarrelName : public PixelModuleName {
0017 public:
0018   enum Shell { mO = 1, mI = 2, pO = 3, pI = 4 };
0019 
0020   /// ctor from DetId
0021   PixelBarrelName(const DetId&, const TrackerTopology* tt, bool phase = false);
0022 
0023   // do not use, works only for phase0 and old pixel classes
0024   PixelBarrelName(const DetId&, bool phase = false);
0025 
0026   /// ctor for defined name with dummy parameters
0027   PixelBarrelName(Shell shell = mO, int layer = 0, int module = 0, int ladder = 0, bool phase = false)
0028       : PixelModuleName(true), thePart(shell), theLayer(layer), theModule(module), theLadder(ladder), phase1(phase) {}
0029 
0030   /// ctor from name string
0031   PixelBarrelName(std::string name, bool phase = false);
0032 
0033   ~PixelBarrelName() override {}
0034 
0035   inline int convertLadderNumber(int oldLadder);
0036 
0037   /// from base class
0038   std::string name() const override;
0039 
0040   Shell shell() const { return thePart; }
0041 
0042   /// layer id
0043   int layerName() const { return theLayer; }
0044 
0045   /// module id (index in z)
0046   int moduleName() const { return theModule; }
0047 
0048   /// ladder id (index in phi)
0049   int ladderName() const { return theLadder; }
0050 
0051   /// sector id
0052   int sectorName() const;
0053 
0054   /// full or half module
0055   bool isHalfModule() const;
0056 
0057   /// module Type
0058   PixelModuleName::ModuleType moduleType() const override;
0059 
0060   /// return the DetId
0061   PXBDetId getDetId();
0062   DetId getDetId(const TrackerTopology* tt);
0063 
0064   /// check equality of modules from datamemebers
0065   bool operator==(const PixelModuleName&) const override;
0066   bool operator==(const PixelBarrelName& other) const {
0067     return (thePart == other.thePart && theLayer == other.theLayer && theModule == other.theModule &&
0068             theLadder == other.theLadder);
0069   }
0070 
0071 private:
0072   Shell thePart;
0073   int theLayer, theModule, theLadder;
0074   bool phase1;
0075 };
0076 
0077 std::ostream& operator<<(std::ostream& out, const PixelBarrelName::Shell& t);
0078 #endif