File indexing completed on 2024-04-06 12:30:42
0001 #include "CondFormats/CSCObjects/interface/CSCChannelTranslator.h"
0002 #include "CondFormats/DataRecord/interface/CSCDBCrosstalkRcd.h"
0003 #include "CondFormats/DataRecord/interface/CSCDBGainsRcd.h"
0004 #include "CondFormats/DataRecord/interface/CSCDBNoiseMatrixRcd.h"
0005 #include "CondFormats/DataRecord/interface/CSCDBPedestalsRcd.h"
0006 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0007 #include "FWCore/Utilities/interface/Exception.h"
0008 #include "SimMuon/CSCDigitizer/src/CSCDbStripConditions.h"
0009
0010 CSCDbStripConditions::CSCDbStripConditions(const edm::ParameterSet &pset, edm::ConsumesCollector cc)
0011 : CSCStripConditions(),
0012 theConditions(pset, cc),
0013 theCapacitiveCrosstalk(pset.getParameter<double>("capacativeCrosstalk")),
0014 theResistiveCrosstalkScaling(pset.getParameter<double>("resistiveCrosstalkScaling")),
0015 theGainsConstant(pset.getParameter<double>("gainsConstant")),
0016 doCorrelatedNoise_(pset.getParameter<bool>("doCorrelatedNoise")) {
0017
0018
0019 }
0020
0021 CSCDbStripConditions::~CSCDbStripConditions() {
0022 if (theNoisifier != nullptr)
0023 delete theNoisifier;
0024 }
0025
0026 void CSCDbStripConditions::initializeEvent(const edm::EventSetup &es) { theConditions.initializeEvent(es); }
0027
0028 float CSCDbStripConditions::gain(const CSCDetId &id, int channel) const {
0029 return theConditions.gain(id, channel) * theGainsConstant;
0030 }
0031
0032 float CSCDbStripConditions::pedestal(const CSCDetId &id, int channel) const {
0033 return theConditions.pedestal(id, channel);
0034 }
0035
0036 float CSCDbStripConditions::pedestalSigma(const CSCDetId &id, int channel) const {
0037 return theConditions.pedestalSigma(id, channel);
0038 }
0039
0040 void CSCDbStripConditions::crosstalk(
0041 const CSCDetId &id, int channel, double stripLength, bool leftRight, float &capacitive, float &resistive) const {
0042 resistive = theConditions.crosstalkIntercept(id, channel, leftRight) * theResistiveCrosstalkScaling;
0043 float slope = theConditions.crosstalkSlope(id, channel, leftRight);
0044
0045 float maxSlopeTime = 60.;
0046
0047 float capacitiveFraction = fabs(slope) * maxSlopeTime;
0048
0049 capacitive = theCapacitiveCrosstalk * capacitiveFraction;
0050 }
0051
0052 void CSCDbStripConditions::fetchNoisifier(const CSCDetId &id, int istrip) {
0053 std::vector<float> me(12);
0054 theConditions.noiseMatrixElements(id, istrip, me);
0055
0056 CSCCorrelatedNoiseMatrix matrix;
0057
0058 matrix(2, 2) = me[0];
0059 matrix(3, 3) = me[3];
0060 matrix(4, 4) = me[6];
0061 matrix(5, 5) = me[9];
0062 matrix(6, 6) = me[11];
0063
0064 if (doCorrelatedNoise_) {
0065 matrix(2, 3) = me[1];
0066 matrix(2, 4) = me[2];
0067 matrix(3, 4) = me[4];
0068 matrix(3, 5) = me[5];
0069 matrix(4, 5) = me[7];
0070 matrix(4, 6) = me[8];
0071 matrix(5, 6) = me[10];
0072 }
0073
0074
0075 float sigma = pedestalSigma(id, istrip);
0076
0077
0078
0079
0080
0081
0082 float scaVariance = sigma * sigma;
0083 matrix(0, 0) = matrix(1, 1) = matrix(7, 7) = scaVariance;
0084
0085
0086
0087
0088
0089
0090
0091 if (theNoisifier != nullptr)
0092 delete theNoisifier;
0093 theNoisifier = new CSCCorrelatedNoisifier(matrix);
0094 }
0095
0096 bool CSCDbStripConditions::isInBadChamber(const CSCDetId &id) const { return theConditions.isInBadChamber(id); }