Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-07 23:58:25

0001 #ifndef simcalorimetry_hgcalsimalgos_hgcalscinoisemap
0002 #define simcalorimetry_hgcalsimalgos_hgcalscinoisemap
0003 
0004 #include "SimCalorimetry/HGCalSimAlgos/interface/HGCalRadiationMap.h"
0005 #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h"
0006 #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h"
0007 #include <string>
0008 #include <array>
0009 
0010 /**
0011    @class HGCalSciNoiseMap
0012    @short derives from HGCalRadiation map to parse fluence/dose parameters, provides Sci-specific functions
0013           the algo word (set at configuration level) is used to control which aspects are simulated
0014           bit 1 - ignores the scaling of signal and noise with SIPMAREA
0015           bit 2 - instead of the geometry-based SiPM area (from detId, if available) use the boundaries read from a txt file
0016           bit 3 - ignores the scaling of the signal light yield with the tile area
0017           bit 4 - ignores the scaling of the light yield with the dose
0018           bit 5 - ignores the scaling of the noise with the fluence (=constant noise scenario)
0019           bit 6 - ignores noise
0020           bit 7 - ignore tile type (fallback on CAST)
0021           bit 8 - ignore pedestal subtraction
0022 */
0023 
0024 class HGCalSciNoiseMap : public HGCalRadiationMap {
0025 public:
0026   enum TileType_t { CAST, MOULDED, TILETYPE_N };
0027   enum GainRange_t { GAIN_2, GAIN_4, AUTO, GAINRANGE_N };  //roc gain for 2mm2 and 4mm2
0028   enum NoiseMapAlgoBits_t {
0029     IGNORE_SIPMAREA,
0030     OVERRIDE_SIPMAREA,
0031     IGNORE_TILEAREA,
0032     IGNORE_DOSESCALE,
0033     IGNORE_FLUENCESCALE,
0034     IGNORE_NOISE,
0035     IGNORE_TILETYPE,
0036     IGNORE_AUTO_PEDESTALSUB
0037   };
0038 
0039   struct SiPMonTileCharacteristics {
0040     SiPMonTileCharacteristics() : s(0.), lySF(0.), n(0.), xtalk(0), gain(0), thrADC(0), ntotalPE(0) {}
0041     float s, lySF, n, xtalk;
0042     unsigned short gain, thrADC, ntotalPE;
0043   };
0044 
0045   HGCalSciNoiseMap();
0046   ~HGCalSciNoiseMap(){};
0047 
0048   /**
0049      @short returns the signal scaling and the noise
0050   */
0051   double scaleByTileArea(const HGCScintillatorDetId &, const double);
0052   std::pair<double, GainRange_t> scaleBySipmArea(const HGCScintillatorDetId &, const double, const GainRange_t &);
0053   SiPMonTileCharacteristics scaleByDose(const HGCScintillatorDetId &,
0054                                         const double,
0055                                         const int aimMIPtoADC = 15,
0056                                         const GainRange_t gainPreChoice = GainRange_t::AUTO);
0057 
0058   void setDoseMap(const std::string &, const unsigned int);
0059   void setSipmMap(const std::string &);
0060   void setReferenceDarkCurrent(double idark);
0061   void setReferenceCrossTalk(double xtalk) { refXtalk_ = xtalk; }
0062   void setNpePerMIP(float npePerMIP);
0063   std::array<double, GAINRANGE_N> getLSBPerGain() { return lsbPerGain_; }
0064   std::array<double, GAINRANGE_N> getMaxADCPerGain() { return fscADCPerGain_; }
0065   std::array<double, TILETYPE_N> getNpePerMIP() { return nPEperMIP_; }
0066   float getNPeInSiPM() { return maxSiPMPE_; }
0067   bool ignoreAutoPedestalSubtraction() { return ignoreAutoPedestalSub_; }
0068 
0069 private:
0070   /**
0071      @short parses the radius boundaries for the SiPM area assignment from a custom file
0072    */
0073   std::unordered_map<int, float> readSipmPars(const std::string &);
0074 
0075   //reference signal yields
0076   std::array<double, TILETYPE_N> nPEperMIP_;
0077 
0078   //lsb and fsc per gain
0079   std::array<double, GAINRANGE_N> lsbPerGain_, fscADCPerGain_;
0080 
0081   //size of the reference scintillator tile
0082   const double refEdge_;
0083 
0084   //flags used to disable/override specific SiPM-on-tile operation parameters
0085   bool ignoreSiPMarea_, overrideSiPMarea_, ignoreTileArea_, ignoreDoseScale_, ignoreFluenceScale_, ignoreNoise_,
0086       ignoreTileType_, ignoreAutoPedestalSub_;
0087 
0088   //reference dark current for the noise (mA)
0089   double refDarkCurrent_;
0090 
0091   //reference cross talk parameter (0,1) - if -1 it will be used to ignore effect in the digitization step
0092   double refXtalk_;
0093 
0094   //reference ADC counts for the MIP peak
0095   int aimMIPtoADC_;
0096 
0097   //reference number of pixels (2mm2 SiPM)
0098   float maxSiPMPE_;
0099 
0100   //sipm size boundaries
0101   std::unordered_map<int, float> sipmMap_;
0102 };
0103 
0104 #endif