Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:38

0001 #ifndef SiStripApvSimulationParameters_h
0002 #define SiStripApvSimulationParameters_h
0003 
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005 
0006 #include <vector>
0007 #include "CondFormats/PhysicsToolsObjects/interface/Histogram2D.h"
0008 #include "CondFormats/PhysicsToolsObjects/interface/Histogram3D.h"
0009 
0010 namespace CLHEP {
0011   class HepRandomEngine;
0012 }
0013 
0014 /**
0015  * Stores a histogram binned in PU, z and baseline voltage, for every barrel layer of the strip tracker
0016  */
0017 class SiStripApvSimulationParameters {
0018 public:
0019   using layerid = unsigned int;
0020   using LayerParameters = PhysicsTools::Calibration::HistogramF3D;
0021 
0022   SiStripApvSimulationParameters(layerid nTIB, layerid nTOB, layerid nTID, layerid nTEC)
0023       : m_nTIB(nTIB), m_nTOB(nTOB), m_nTID(nTID), m_nTEC(nTEC) {
0024     m_barrelParam.resize(m_nTIB + m_nTOB);
0025     m_barrelParam_xInt.resize(m_nTIB + m_nTOB);
0026     m_endcapParam.resize(m_nTID + m_nTEC);
0027     m_endcapParam_xInt.resize(m_nTID + m_nTEC);
0028   }
0029   SiStripApvSimulationParameters() {}
0030   ~SiStripApvSimulationParameters() {}
0031 
0032   void calculateIntegrals();  // make sure integrals have been calculated
0033 
0034   bool putTIB(layerid layer, const LayerParameters& params) { return putTIB(layer, LayerParameters(params)); }
0035   bool putTIB(layerid layer, LayerParameters&& params);
0036 
0037   bool putTOB(layerid layer, const LayerParameters& params) { return putTOB(layer, LayerParameters(params)); }
0038   bool putTOB(layerid layer, LayerParameters&& params);
0039 
0040   bool putTID(layerid wheel, const LayerParameters& params) { return putTID(wheel, LayerParameters(params)); }
0041   bool putTID(layerid wheel, LayerParameters&& params);
0042 
0043   bool putTEC(layerid wheel, const LayerParameters& params) { return putTEC(wheel, LayerParameters(params)); }
0044   bool putTEC(layerid wheel, LayerParameters&& params);
0045 
0046   const LayerParameters& getTIB(layerid layer) const { return m_barrelParam[layer - 1]; }
0047   const LayerParameters& getTOB(layerid layer) const { return m_barrelParam[m_nTIB + layer - 1]; }
0048   const LayerParameters& getTID(layerid wheel) const { return m_endcapParam[wheel - 1]; }
0049   const LayerParameters& getTEC(layerid wheel) const { return m_endcapParam[m_nTID + wheel - 1]; }
0050 
0051   float sampleTIB(layerid layer, float z, float pu, CLHEP::HepRandomEngine* engine) const {
0052     return sampleBarrel(layer - 1, z, pu, engine);
0053   }
0054   float sampleTOB(layerid layer, float z, float pu, CLHEP::HepRandomEngine* engine) const {
0055     return sampleBarrel(m_nTIB + layer - 1, z, pu, engine);
0056   };
0057   float sampleTID(layerid wheel, float r, float pu, CLHEP::HepRandomEngine* engine) const {
0058     return sampleEndcap(wheel - 1, r, pu, engine);
0059   }
0060   float sampleTEC(layerid wheel, float r, float pu, CLHEP::HepRandomEngine* engine) const {
0061     return sampleEndcap(m_nTID + wheel - 1, r, pu, engine);
0062   }
0063 
0064 private:
0065   layerid m_nTIB, m_nTOB, m_nTID, m_nTEC;
0066   std::vector<PhysicsTools::Calibration::HistogramF3D> m_barrelParam;
0067   std::vector<PhysicsTools::Calibration::HistogramF2D> m_barrelParam_xInt;
0068   std::vector<PhysicsTools::Calibration::HistogramF3D> m_endcapParam;
0069   std::vector<PhysicsTools::Calibration::HistogramF2D> m_endcapParam_xInt;
0070 
0071   float sampleBarrel(layerid layerIdx, float z, float pu, CLHEP::HepRandomEngine* engine) const;
0072   float sampleEndcap(layerid wheelIdx, float r, float pu, CLHEP::HepRandomEngine* engine) const;
0073 
0074   COND_SERIALIZABLE;
0075 };
0076 
0077 #endif