20 #include <boost/range/irange.hpp> 128 if (
quadrant(detid)%2) signed_ladder *= -1;
138 if (
quadrant(detid)<3) signed_module *= -1;
161 if (layer==2) outer = !odd_ladder;
162 else outer = odd_ladder;
164 if (layer==4) outer = odd_ladder;
165 else outer = !odd_ladder;
193 if (
quadrant(detid)<3) signed_disk *= -1;
235 if (
quadrant(detid)%2) signed_blade *= -1;
243 unsigned int fedid = 9999;
274 return std::make_pair(digi->
row(), digi->
column());
280 int row = cluster->
x()-0.5,
col = cluster->
y()-0.5;
281 return std::make_pair(row,
col);
292 return std::make_pair(row, col);
303 nrows = topo->
nrows();
306 return (pixel.first+0.5)/nrows;
324 return (pixel.second+0.5)/
ncols;
339 int rowsperroc = 80, colsperroc = 52;
349 uint64_t pseudo_roc_num =
uint64_t(1<<16) * detid.
rawId() + (1<<8) * (pixel.first/rowsperroc) + pixel.second/colsperroc;
382 return channel(static_cast<const SiPixelRecHit*>(rechit->
hit()));
403 int rowsperroc = 80, colsperroc = 52;
413 uint64_t pseudo_roc_num =
uint64_t(1<<16) * detid.
rawId() + (1<<8) * (pixel.first/rowsperroc) + pixel.second/colsperroc;
414 if (
roc_.count(pseudo_roc_num))
return roc_[pseudo_roc_num];
438 int rocX = pixel.first/rowsperroc, rocY = pixel.second/colsperroc;
441 int v1x8 =
half(detid)==1, v1x2 = (pan==1&&
mod==1), v1x5 = (pan==1&&
mod==4);
442 if (v1x8||v1x2||v1x5) ++rocX;
449 rocY = rocsY-1 - rocY;
452 roc = rocX ? rocY : 2*rocsY-1 - rocY;
454 return roc_[pseudo_roc_num] =
roc;
470 return roc(static_cast<const SiPixelRecHit*>(rechit->
hit()));
480 if (!
isBPix_(detid))
return -9999;
486 if (!
isBPix_(detid))
return -9999;
490 if (!
isBPix_(detid))
return -9999;
504 if (!
isBPix_(detid))
return -9999;
510 if (!
isBPix_(detid))
return -9999;
514 if (!
isBPix_(detid))
return -9999;
528 if (!
isBPix_(detid))
return -9999;
536 if (!
isBPix_(detid))
return -9999;
540 if (!
isBPix_(detid))
return -9999;
554 if (!
isBPix_(detid))
return -9999;
562 if (!
isBPix_(detid))
return -9999;
566 if (!
isBPix_(detid))
return -9999;
587 if (!
isFPix_(detid))
return -9999;
607 ring_coord += coord_shift;
611 if (!
isFPix_(detid))
return -9999;
615 if (!
isFPix_(detid))
return -9999;
624 return ring_coord(static_cast<const SiPixelRecHit*>(rechit->
hit()));
635 if (!
isFPix_(detid))
return -9999;
637 disk_coord += coord_shift;
641 if (!
isFPix_(detid))
return -9999;
645 if (!
isFPix_(detid))
return -9999;
654 return disk_coord(static_cast<const SiPixelRecHit*>(rechit->
hit()));
662 if (!
isFPix_(detid))
return -9999;
665 if (signed_disk_coord<0) coord_shift = -coord_shift;
666 signed_disk_coord += coord_shift;
670 if (!
isFPix_(detid))
return -9999;
674 if (!
isFPix_(detid))
return -9999;
689 if (!
isFPix_(detid))
return -9999;
693 coord_shift = (
ring_coord(detid,pixel) - 1.5 ) / 2.0;
694 disk_ring_coord += coord_shift;
698 if (!
isFPix_(detid))
return -9999;
702 if (!
isFPix_(detid))
return -9999;
718 if (!
isFPix_(detid))
return -9999;
722 coord_shift = (
ring_coord(detid,pixel) - 1.5 ) / 2.0;
724 if (signed_disk_ring_coord<0) coord_shift = -coord_shift;
725 signed_disk_ring_coord += coord_shift;
729 if (!
isFPix_(detid))
return -9999;
733 if (!
isFPix_(detid))
return -9999;
758 if (!
isFPix_(detid))
return -9999;
763 if (
side(detid)==1) coord_shift = -coord_shift;
766 if ((
side(detid)+
panel(detid))%2==0) coord_shift = -coord_shift;
768 blade_coord += coord_shift;
772 if (!
isFPix_(detid))
return -9999;
776 if (!
isFPix_(detid))
return -9999;
785 return blade_coord(static_cast<const SiPixelRecHit*>(rechit->
hit()));
797 if (!
isFPix_(detid))
return -9999;
802 if (
side(detid)==2) coord_shift = -coord_shift;
805 if ((
side(detid)+
panel(detid))%2==1) coord_shift = -coord_shift;
807 signed_blade_coord += coord_shift;
811 if (!
isFPix_(detid))
return -9999;
815 if (!
isFPix_(detid))
return -9999;
834 if (!
isFPix_(detid))
return -9999;
836 float coord_shift = (
blade_coord(detid, pixel) - blade_panel_coord +
panel(detid) - 1.5)/2;
837 blade_panel_coord += coord_shift;
841 if (!
isFPix_(detid))
return -9999;
845 if (!
isFPix_(detid))
return -9999;
865 if (!
isFPix_(detid))
return -9999;
868 signed_blade_panel_coord += coord_shift;
872 if (!
isFPix_(detid))
return -9999;
876 if (!
isFPix_(detid))
return -9999;
895 if (!
isFPix_(detid))
return -9999;
897 float coord_shift = (
signed_blade_coord(detid, pixel) - signed_shifted_blade_panel_coord -
panel(detid) + 1.5)/2;
898 if (
phase_==1&&
ring(detid)==1) signed_shifted_blade_panel_coord *= 1.5;
899 signed_shifted_blade_panel_coord += coord_shift;
903 if (!
isFPix_(detid))
return -9999;
907 if (!
isFPix_(detid))
return -9999;
float ycoord_on_module_(const DetId &, const std::pair< int, int > &)
int sector(const DetId &)
float signed_module_coord(const DetId &, const std::pair< int, int > &)
std::unordered_map< uint32_t, int > panel_
std::unordered_map< uint64_t, unsigned int > channel_
float signed_blade_panel_coord(const DetId &, const std::pair< int, int > &)
virtual std::pair< float, float > pixel(const LocalPoint &p) const =0
virtual int nrows() const =0
int signed_blade(const DetId &)
float disk_ring_coord(const DetId &, const std::pair< int, int > &)
float ring_coord(const DetId &, const std::pair< int, int > &)
std::unordered_map< uint32_t, int > half_
virtual int rowsperroc() const =0
bool isPixel_(const DetId &)
std::unordered_map< uint32_t, int > sector_
int moduleName() const
module id (index in z)
std::unordered_map< uint32_t, int > ladder_
std::unordered_map< uint32_t, int > signed_disk_
void init(edm::EventSetup const &)
unsigned int pxfDisk(const DetId &id) const
float ladder_coord(const DetId &, const std::pair< int, int > &)
int signed_disk(const DetId &)
float disk_coord(const DetId &, const std::pair< int, int > &)
const TrackerTopology * tTopo_
unsigned int pxbLadder(const DetId &id) const
constexpr uint32_t rawId() const
get the raw id
float blade_coord(const DetId &, const std::pair< int, int > &)
unsigned int pxbModule(const DetId &id) const
unsigned int fedid(const DetId &)
int flipped(const DetId &)
int module(const DetId &)
virtual ~SiPixelCoordinates()
bool isBPix_(const DetId &)
std::pair< int, int > pixel_(const PixelDigi *)
int bladeName() const
blade id
std::unordered_map< uint32_t, int > signed_module_
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
std::unordered_map< uint32_t, int > flipped_
std::unordered_map< uint32_t, int > ring_
std::unordered_map< uint32_t, int > outer_
bool isHalfModule() const
full or half module
virtual int colsperroc() const =0
std::unordered_map< uint32_t, int > layer_
std::unordered_map< uint32_t, int > module_
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
int sectorName() const
sector id
int channel(const DetId &, const std::pair< int, int > &)
const SiPixelFedCablingMap * cablingMap_
std::unordered_map< uint32_t, int > signed_blade_
int roc(const DetId &, const std::pair< int, int > &)
std::unordered_map< uint32_t, int > disk_
std::unordered_map< uint32_t, unsigned int > det2fedMap() const final
unsigned int pxfModule(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
virtual TrackingRecHit const * hit() const
int ladderName() const
ladder id (index in phi)
unsigned long long uint64_t
std::unordered_map< uint32_t, int > signed_ladder_
const TrackerGeometry * tGeom_
int signed_module(const DetId &)
int toCabling(sipixelobjects::ElectronicIndex &cabling, const sipixelobjects::DetectorIndex &detector) const
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
std::unordered_map< uint32_t, int > quadrant_
const GeomDetUnit * detUnit() const override
std::unordered_map< uint32_t, int > side_
int quadrant(const DetId &)
std::unordered_map< uint64_t, unsigned int > roc_
float xcoord_on_module_(const DetId &, const std::pair< int, int > &)
Pixel cluster – collection of neighboring pixels above threshold.
virtual int ncolumns() const =0
float signed_disk_coord(const DetId &, const std::pair< int, int > &)
sipixelobjects::PixelROC const * toRoc(int link, int roc) const
bool hasDetUnit(uint32_t radId) const
unsigned int pxfSide(const DetId &id) const
std::vector< unsigned int > fedIds() const
LocalPoint localPosition() const final
std::unordered_map< uint32_t, int > blade_
int ladder(const DetId &)
DetId geographicalId() const
float module_coord(const DetId &, const std::pair< int, int > &)
float signed_shifted_blade_panel_coord(const DetId &, const std::pair< int, int > &)
int ringName() const
ring Id
HalfCylinder halfCylinder() const
T mod(const T &a, const T &b)
float signed_blade_coord(const DetId &, const std::pair< int, int > &)
T const * product() const
float signed_disk_ring_coord(const DetId &, const std::pair< int, int > &)
float blade_panel_coord(const DetId &, const std::pair< int, int > &)
unsigned int pxfPanel(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
float signed_ladder_coord(const DetId &, const std::pair< int, int > &)
int signed_ladder(const DetId &)
std::unordered_map< uint32_t, unsigned int > fedid_
bool isFPix_(const DetId &)
constexpr Detector det() const
get the detector field from this detid