File indexing completed on 2024-04-06 12:30:41
0001 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0002 #include "FWCore/Utilities/interface/Exception.h"
0003 #include "Geometry/CSCGeometry/interface/CSCChamberSpecs.h"
0004 #include "SimMuon/CSCDigitizer/src/CSCConfigurableStripConditions.h"
0005
0006 CSCConfigurableStripConditions::CSCConfigurableStripConditions(const edm::ParameterSet &p)
0007 : theGain(p.getParameter<double>("gain")),
0008 theME11Gain(p.getParameter<double>("me11gain")),
0009 theGainSigma(p.getParameter<double>("ampGainSigma")),
0010 thePedestal(p.getParameter<double>("pedestal")),
0011 thePedestalSigma(p.getParameter<double>("pedestalSigma")),
0012 theCapacitiveCrosstalk(0.0167),
0013 theResistiveCrosstalk(0.02) {
0014 theNoisifiers.resize(9);
0015 makeNoisifier(1, p.getParameter<std::vector<double>>("me11a"));
0016 makeNoisifier(2, p.getParameter<std::vector<double>>("me11"));
0017 makeNoisifier(3, p.getParameter<std::vector<double>>("me12"));
0018 makeNoisifier(4, p.getParameter<std::vector<double>>("me13"));
0019 makeNoisifier(5, p.getParameter<std::vector<double>>("me21"));
0020 makeNoisifier(6, p.getParameter<std::vector<double>>("me22"));
0021 makeNoisifier(7, p.getParameter<std::vector<double>>("me31"));
0022 makeNoisifier(8, p.getParameter<std::vector<double>>("me32"));
0023 makeNoisifier(9, p.getParameter<std::vector<double>>("me31"));
0024 }
0025
0026 CSCConfigurableStripConditions::~CSCConfigurableStripConditions() {
0027 for (int i = 0; i < 9; ++i) {
0028 delete theNoisifiers[i];
0029 }
0030 }
0031
0032 float CSCConfigurableStripConditions::gain(const CSCDetId &detId, int channel) const {
0033 if (detId.station() == 1 && (detId.ring() == 1 || detId.ring() == 4)) {
0034 return theME11Gain;
0035 } else {
0036 return theGain;
0037 }
0038 }
0039
0040 void CSCConfigurableStripConditions::fetchNoisifier(const CSCDetId &detId, int istrip) {
0041
0042 int chamberType = CSCChamberSpecs::whatChamberType(detId.station(), detId.ring());
0043 theNoisifier = theNoisifiers[chamberType - 1];
0044 }
0045
0046 void CSCConfigurableStripConditions::makeNoisifier(int chamberType, const std::vector<double> &correlations) {
0047
0048
0049 if (correlations.size() != 12) {
0050 throw cms::Exception("CSCConfigurableStripConditions")
0051 << "Expect 12 noise correlation coefficients, but got " << correlations.size();
0052 }
0053
0054 CSCCorrelatedNoiseMatrix matrix;
0055 matrix(3, 3) = correlations[0];
0056 matrix(3, 4) = correlations[1];
0057 matrix(4, 4) = correlations[2];
0058 matrix(3, 5) = correlations[3];
0059 matrix(4, 5) = correlations[4];
0060 matrix(5, 5) = correlations[5];
0061 matrix(4, 6) = correlations[6];
0062 matrix(5, 6) = correlations[7];
0063 matrix(6, 6) = correlations[8];
0064 matrix(5, 7) = correlations[9];
0065 matrix(6, 7) = correlations[10];
0066 matrix(7, 7) = correlations[11];
0067
0068
0069
0070 double scaVariance = 2. * thePedestalSigma * thePedestalSigma;
0071 matrix(0, 0) = scaVariance;
0072 matrix(1, 1) = scaVariance;
0073 matrix(2, 2) = scaVariance;
0074 theNoisifiers[chamberType - 1] = new CSCCorrelatedNoisifier(matrix);
0075 }
0076
0077 void CSCConfigurableStripConditions::crosstalk(
0078 const CSCDetId &detId, int channel, double stripLength, bool leftRight, float &capacitive, float &resistive) const {
0079 capacitive = theCapacitiveCrosstalk * stripLength;
0080 resistive = theResistiveCrosstalk;
0081 }