Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:27

0001 #ifndef CondFormats_PPSObjects_CTPPSPixelGainCalibration_h
0002 #define CondFormats_PPSObjects_CTPPSPixelGainCalibration_h
0003 // -*- C++ -*-
0004 //
0005 // Package:    PPSObjects
0006 // Class:      CTPPSPixelGainCalibration
0007 //
0008 /**\class CTPPSPixelGainCalibration CTPPSPixelGainCalibration.h CondFormats/CTPPSRedoutObjects/src/CTPPSPixelGainCalibration.cc
0009 
0010  Description: Gain calibration object for the CTPPS 3D Pixels.  Store gain/pedestal information at pixel granularity
0011 
0012  Implementation:
0013      <Notes on implementation>
0014 */
0015 // Loosely based on SiPixelObjects/SiPixelGainCalibration
0016 // Original Author:  Vincenzo Chiochia
0017 //         Created:  Tue 8 12:31:25 CEST 2007
0018 //         Modified: Evan Friis
0019 // $Id: CTPPSPixelGainCalibration.h,v 1.8 2009/02/10 17:25:42 rougny Exp $
0020 //  Adapted for CTPPS : Clemencia Mora Herrera       November 2016
0021 //
0022 
0023 #include "CondFormats/Serialization/interface/Serializable.h"
0024 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0025 #include <vector>
0026 
0027 class CTPPSPixelGainCalibration {
0028   friend class CTPPSPixelGainCalibrations;
0029 
0030 public:
0031   struct DetRegistry {  //to index the channels in each sensor
0032     uint32_t detid;
0033     uint32_t ibegin;
0034     uint32_t iend;
0035     uint32_t ncols;
0036     uint32_t nrows;
0037     COND_SERIALIZABLE;
0038   };
0039 
0040   // Constructors
0041   CTPPSPixelGainCalibration();
0042   CTPPSPixelGainCalibration(const uint32_t& detId, const uint32_t& sensorSize, const uint32_t& nCols);
0043   CTPPSPixelGainCalibration(float minPed, float maxPed, float minGain, float maxGain);
0044   CTPPSPixelGainCalibration(const uint32_t& detid,
0045                             const std::vector<float>& peds,
0046                             const std::vector<float>& gains,
0047                             float minPed = 0.,
0048                             float maxPed = 255.,
0049                             float minGain = 0.,
0050                             float maxGain = 255.);
0051   ~CTPPSPixelGainCalibration() {}
0052 
0053   void initialize() {}
0054 
0055   void setGainsPeds(const uint32_t& detId, const std::vector<float>& peds, const std::vector<float>& gains);
0056 
0057   double getGainLow() const { return minGain_; }
0058   double getGainHigh() const { return maxGain_; }
0059   double getPedLow() const { return minPed_; }
0060   double getPedHigh() const { return maxPed_; }
0061 
0062   // Set and get public methods
0063 
0064   void setDeadPixel(int ipix) { putData(ipix, -9999., 0.); }   // dead flag is pedestal = -9999.
0065   void setNoisyPixel(int ipix) { putData(ipix, 0., -9999.); }  // noisy flat is gain= -9999.
0066 
0067   void putData(uint32_t ipix, float ped, float gain);
0068 
0069   float getPed(const int& col, const int& row) const;
0070   float getGain(const int& col, const int& row) const;
0071   float getPed(const uint32_t ipix) const { return v_pedestals[ipix]; }
0072   float getGain(const uint32_t ipix) const { return v_gains[ipix]; }
0073   bool isDead(const uint32_t ipix) const { return (v_pedestals[ipix] == -9999.); }
0074   bool isNoisy(const uint32_t ipix) const { return (v_gains[ipix] == -9999.); }
0075   //get information related to indexes
0076   uint32_t getDetId() const { return indexes.detid; }
0077   uint32_t getNCols() const { return indexes.ncols; }
0078   uint32_t getIBegin() const { return indexes.ibegin; }
0079   uint32_t getIEnd() const { return indexes.iend; }
0080   uint32_t getNRows() const { return indexes.nrows; }
0081 
0082 private:
0083   void setIndexes(const uint32_t& detId);
0084   void resetPixData(uint32_t ipix, float ped, float gain);
0085 
0086   std::vector<float> v_pedestals;
0087   std::vector<float> v_gains;
0088   DetRegistry indexes;
0089   // a single detRegistry w/ detID and collection of indices
0090   float minPed_, maxPed_, minGain_, maxGain_;  //not really used yet
0091 
0092   COND_SERIALIZABLE;
0093 };
0094 
0095 #endif