Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 23:30:38

0001 #ifndef RecoLocalTracker_SiPixelClusterizer_PixelClusterizerBase_H
0002 #define RecoLocalTracker_SiPixelClusterizer_PixelClusterizerBase_H
0003 
0004 #include <vector>
0005 
0006 #include "CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationServiceBase.h"
0007 #include "DataFormats/Common/interface/DetSetVector.h"
0008 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0009 #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
0010 #include "DataFormats/SiPixelDigi/interface/PixelDigi.h"
0011 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0012 
0013 class PixelGeomDetUnit;
0014 
0015 /**
0016  * Abstract interface for Pixel Clusterizers
0017  */
0018 class PixelClusterizerBase {
0019 public:
0020   typedef edm::DetSet<PixelDigi>::const_iterator DigiIterator;
0021   typedef edmNew::DetSet<SiPixelCluster>::const_iterator ClusterIterator;
0022 
0023   struct AccretionCluster {
0024     static constexpr uint16_t MAXSIZE = 256;
0025     uint16_t adc[MAXSIZE];
0026     uint16_t x[MAXSIZE];
0027     uint16_t y[MAXSIZE];
0028     uint16_t xmin = 16000;
0029     uint16_t ymin = 16000;
0030     unsigned int isize = 0;
0031     int charge = 0;
0032 
0033     // stack interface (unsafe ok for use below)
0034     unsigned int curr = 0;
0035     uint16_t top() const { return curr; }
0036     void pop() { ++curr; }
0037     bool empty() { return curr == isize; }
0038 
0039     void clear() {
0040       xmin = 16000;
0041       ymin = 16000;
0042       isize = 0;
0043       charge = 0;
0044       curr = 0;
0045     }
0046 
0047     bool add(SiPixelCluster::PixelPos const& p, uint16_t const iadc) {
0048       if (isize == MAXSIZE)
0049         return false;
0050       xmin = std::min<uint16_t>(xmin, p.row());
0051       ymin = std::min<uint16_t>(ymin, p.col());
0052       adc[isize] = iadc;
0053       x[isize] = p.row();
0054       y[isize++] = p.col();
0055       charge += iadc;
0056       return true;
0057     }
0058   };
0059 
0060   // Virtual destructor, this is a base class.
0061   virtual ~PixelClusterizerBase() {}
0062 
0063   // Build clusters in a DetUnit. Both digi and cluster stored in a DetSet
0064 
0065   virtual void clusterizeDetUnit(const edm::DetSet<PixelDigi>& input,
0066                                  const PixelGeomDetUnit* pixDet,
0067                                  const TrackerTopology* tTopo,
0068                                  const std::vector<short>& badChannels,
0069                                  edmNew::DetSetVector<SiPixelCluster>::FastFiller& output) = 0;
0070 
0071   virtual void clusterizeDetUnit(const edmNew::DetSet<SiPixelCluster>& input,
0072                                  const PixelGeomDetUnit* pixDet,
0073                                  const TrackerTopology* tTopo,
0074                                  const std::vector<short>& badChannels,
0075                                  edmNew::DetSetVector<SiPixelCluster>::FastFiller& output) = 0;
0076 
0077   // Configure gain calibration service
0078   void setSiPixelGainCalibrationService(SiPixelGainCalibrationServiceBase* in) {
0079     theSiPixelGainCalibrationService_ = in;
0080   }
0081 
0082 protected:
0083   SiPixelGainCalibrationServiceBase* theSiPixelGainCalibrationService_;
0084 };
0085 
0086 #endif