Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:21

0001 #ifndef DataFormats_ForwardDetId_FastTimeDetId_H
0002 #define DataFormats_ForwardDetId_FastTimeDetId_H 1
0003 
0004 #include <iosfwd>
0005 #include "DataFormats/DetId/interface/DetId.h"
0006 #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
0007 
0008 class FastTimeDetId : public DetId {
0009 public:
0010   static const int kFastTimeCellZOffset = 10;
0011   static const int kFastTimeCellZMask = 0x3FF;
0012   static const int kFastTimeCellPhiOffset = 0;
0013   static const int kFastTimeCellPhiMask = 0x3FF;
0014   static const int kFastTimeZsideOffset = 20;
0015   static const int kFastTimeZsideMask = 0x1;
0016   static const int kFastTimeTypeOffset = 21;
0017   static const int kFastTimeTypeMask = 0x3;
0018   enum { Subdet = FastTime };
0019   enum { FastTimeUnknown = 0, FastTimeBarrel = 1, FastTimeEndcap = 2 };
0020   /** Create a null cellid*/
0021   FastTimeDetId();
0022   /** Create cellid from raw id (0=invalid tower id) */
0023   FastTimeDetId(uint32_t rawid);
0024   /** Constructor from subdetector, zplus, cell numbers along x and y axes*/
0025   FastTimeDetId(int type, int module_izeta, int module_iphi, int iz);
0026   /** Constructor from a generic cell id */
0027   FastTimeDetId(const DetId& id);
0028   /** Assignment from a generic cell id */
0029   FastTimeDetId& operator=(const DetId& id);
0030 
0031   /** Converter for a geometry cell id */
0032   FastTimeDetId geometryCell() const { return FastTimeDetId(type(), 0, 0, zside()); }
0033 
0034   /// get the subdetector
0035   ForwardSubdetector subdet() const { return FastTime; }
0036 
0037   /// get the type (barrel vs endcap)
0038   int type() const { return (id_ >> kFastTimeTypeOffset) & kFastTimeTypeMask; }
0039 
0040   /// get the absolute value of the cell #'s along x-axis (EC) | z-axis (Barel)
0041   int ieta() const { return (id_ >> kFastTimeCellZOffset) & kFastTimeCellZMask; }
0042   int iz() const { return (id_ >> kFastTimeCellZOffset) & kFastTimeCellZMask; }
0043 
0044   /// get the absolute value of the cell #'s along y-axis (EC) | phi (Barrel)
0045   int iphi() const { return (id_ >> kFastTimeCellPhiOffset) & kFastTimeCellPhiMask; }
0046 
0047   /// get the z-side of the cell (1/-1)
0048   int zside() const { return ((((id_ >> kFastTimeZsideOffset) & kFastTimeZsideMask) > 0) ? 1 : -1); }
0049 
0050   /// consistency check : no bits left => no overhead
0051   bool isFastTime() const { return true; }
0052   bool isForward() const { return true; }
0053 
0054   static const FastTimeDetId Undefined;
0055 };
0056 
0057 std::ostream& operator<<(std::ostream&, const FastTimeDetId& id);
0058 
0059 #endif