From 5cf0b9dd74e052e681b12cb7c1f806d292d5930a Mon Sep 17 00:00:00 2001 From: Gaelle Date: Sun, 9 Jul 2017 19:34:50 +0200 Subject: [PATCH] Update Vcal Calibration (backport 92X) --- .../python/customizeHLTforCMSSW.py | 23 +++++++ .../plugins/PixelClusterizerBase.h | 3 + .../plugins/PixelThresholdClusterizer.cc | 65 +++++++++++++++---- .../plugins/PixelThresholdClusterizer.h | 26 ++++++-- .../plugins/SiPixelClusterProducer.cc | 6 +- .../plugins/SiPixelClusterProducer.h | 3 +- .../python/SiPixelClusterizer_cfi.py | 19 +++++- .../python/SiPixelSimParameters_cfi.py | 7 ++ .../plugins/SiPixelDigitizerAlgorithm.cc | 13 ++-- .../plugins/SiPixelDigitizerAlgorithm.h | 8 ++- 10 files changed, 141 insertions(+), 32 deletions(-) diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index 32dca655b5b2d..9540ac119cd8c 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -173,6 +173,24 @@ def customiseFor19098(process): if hasattr(producer, "infinitesimalPt"): del producer.infinitesimalPt return process +def customiseFor19181_pixel_phase0(process): + for producer in producers_by_type(process, "SiPixelClusterProducer"): + producer.VCaltoElectronGain_L1 = cms.int32(65) + producer.VCaltoElectronOffset_L1 = cms.int32(-414) + producer.ClusterThreshold = cms.int32(4000) + producer.ClusterThreshold_L1 = cms.int32(4000) + return process + +def customiseFor19181_pixel_phase1(process): + for producer in producers_by_type(process, "SiPixelClusterProducer"): + producer.VCaltoElectronGain = cms.int32(47) + producer.VCaltoElectronGain_L1 = cms.int32(50) + producer.VCaltoElectronOffset = cms.int32(-60) + producer.VCaltoElectronOffset_L1 = cms.int32(-670) + producer.ClusterThreshold = cms.int32(4000) + producer.ClusterThreshold_L1 = cms.int32(2000) + return process + # CMSSW version specific customizations def customizeHLTforCMSSW(process, menuType="GRun"): @@ -189,4 +207,9 @@ def customizeHLTforCMSSW(process, menuType="GRun"): process = customiseFor18559(process) process = customiseFor19098(process) + if (menuType == "GRun2016"): + process = customiseFor19181_pixel_phase0(process) + else: + process = customiseFor19181_pixel_phase1(process) + return process diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelClusterizerBase.h b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelClusterizerBase.h index 1c900063750ca..0c15107816754 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelClusterizerBase.h +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelClusterizerBase.h @@ -5,6 +5,7 @@ #include "DataFormats/Common/interface/DetSetVectorNew.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" #include "DataFormats/SiPixelDigi/interface/PixelDigi.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationServiceBase.h" #include @@ -52,11 +53,13 @@ class PixelClusterizerBase { virtual void clusterizeDetUnit( const edm::DetSet & input, const PixelGeomDetUnit * pixDet, + const TrackerTopology* tTopo, const std::vector& badChannels, edmNew::DetSetVector::FastFiller& output) = 0; virtual void clusterizeDetUnit( const edmNew::DetSet & input, const PixelGeomDetUnit * pixDet, + const TrackerTopology* tTopo, const std::vector& badChannels, edmNew::DetSetVector::FastFiller& output) = 0; diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc index 4b5fccb38a908..ca07f2dc02503 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc @@ -27,7 +27,6 @@ #include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" //#include "Geometry/CommonTopologies/RectangularPixelTopology.h" -#include "DataFormats/SiPixelDetId/interface/PXBDetId.h" // STL #include @@ -47,9 +46,12 @@ PixelThresholdClusterizer::PixelThresholdClusterizer // Get thresholds in electrons thePixelThreshold( conf.getParameter("ChannelThreshold") ), theSeedThreshold( conf.getParameter("SeedThreshold") ), - theClusterThreshold( conf.getParameter("ClusterThreshold") ), + theClusterThreshold( conf.getParameter("ClusterThreshold") ), + theClusterThreshold_L1( conf.getParameter("ClusterThreshold_L1") ), theConversionFactor( conf.getParameter("VCaltoElectronGain") ), + theConversionFactor_L1( conf.getParameter("VCaltoElectronGain_L1") ), theOffset( conf.getParameter("VCaltoElectronOffset") ), + theOffset_L1( conf.getParameter("VCaltoElectronOffset_L1") ), theStackADC_( conf.exists("AdcFullScaleStack") ? conf.getParameter("AdcFullScaleStack") : 255 ), theFirstStack_( conf.exists("FirstStackLayer") ? conf.getParameter("FirstStackLayer") : 5 ), theElectronPerADCGain_( conf.exists("ElectronPerADCGain") ? conf.getParameter("ElectronPerADCGain") : 135. ), @@ -63,6 +65,28 @@ PixelThresholdClusterizer::PixelThresholdClusterizer ///////////////////////////////////////////////////////////////////////////// PixelThresholdClusterizer::~PixelThresholdClusterizer() {} + +// Configuration descriptions +void +PixelThresholdClusterizer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + // siPixelClusters + edm::ParameterSetDescription desc; + desc.add("src", edm::InputTag("siPixelDigis")); + desc.add("ChannelThreshold", 1000); + desc.addUntracked("MissCalibrate", true); + desc.add("SplitClusters", false); + desc.add("VCaltoElectronGain", 65); + desc.add("VCaltoElectronGain_L1", 65); + desc.add("VCaltoElectronOffset", -414); + desc.add("VCaltoElectronOffset_L1", -414); + desc.add("payloadType", "Offline"); + desc.add("SeedThreshold", 1000); + desc.add("ClusterThreshold_L1", 4000); + desc.add("ClusterThreshold", 4000); + desc.add("maxNumberOfClusters", -1); + descriptions.add("siPixelClusters", desc); +} + //---------------------------------------------------------------------------- //! Prepare the Clusterizer to work on a particular DetUnit. Re-init the //! size of the panel/plaquette (so update nrows and ncols), @@ -104,6 +128,7 @@ bool PixelThresholdClusterizer::setup(const PixelGeomDetUnit * pixDet) template void PixelThresholdClusterizer::clusterizeDetUnitT( const T & input, const PixelGeomDetUnit * pixDet, + const TrackerTopology* tTopo, const std::vector& badChannels, edmNew::DetSetVector::FastFiller& output) { @@ -119,6 +144,11 @@ void PixelThresholdClusterizer::clusterizeDetUnitT( const T & input, detid_ = input.detId(); + // Set separate cluster threshold for L1 (needed for phase1) + auto clusterThreshold = theClusterThreshold; + layer_ = (DetId(detid_).subdetId()==1) ? tTopo->pxbLayer(detid_) : 0; + if (layer_==1) clusterThreshold = theClusterThreshold_L1; + // Copy PixelDigis to the buffer array; select the seed pixels // on the way, and store them in theSeeds. copy_to_buffer(begin, end); @@ -138,7 +168,7 @@ void PixelThresholdClusterizer::clusterizeDetUnitT( const T & input, // Check if the cluster is above threshold // (TO DO: one is signed, other unsigned, gcc warns...) - if ( cluster.charge() >= theClusterThreshold) + if ( cluster.charge() >= clusterThreshold) { // std::cout << "putting in this cluster " << i << " " << cluster.charge() << " " << cluster.pixelADC().size() << endl; // sort by row (x) @@ -203,16 +233,19 @@ void PixelThresholdClusterizer::copy_to_buffer( DigiIterator begin, DigiIterator int electron[end-begin]; memset(electron, 0, sizeof(electron)); if ( doMissCalibrate ) { - (*theSiPixelGainCalibrationService_).calibrate(detid_,begin,end,theConversionFactor, theOffset,electron); + if (layer_==1) { + (*theSiPixelGainCalibrationService_).calibrate(detid_,begin,end,theConversionFactor_L1, theOffset_L1,electron); + } else { + (*theSiPixelGainCalibrationService_).calibrate(detid_,begin,end,theConversionFactor, theOffset, electron); + } } else { - int layer = (DetId(detid_).subdetId()==1) ? PXBDetId(detid_).layer() : 0; int i=0; for(DigiIterator di = begin; di != end; ++di) { auto adc = di->adc(); const float gain = theElectronPerADCGain_; // default: 1 ADC = 135 electrons const float pedestal = 0.; // electron[i] = int(adc * gain + pedestal); - if (layer>=theFirstStack_) { + if (layer_>=theFirstStack_) { if (theStackADC_==1&&adc==1) { electron[i] = int(255*135); // Arbitrarily use overflow value. } @@ -273,8 +306,6 @@ void PixelThresholdClusterizer::copy_to_buffer( ClusterIterator begin, ClusterIt int PixelThresholdClusterizer::calibrate(int adc, int col, int row) { int electrons = 0; - int layer= 0; - if (DetId(detid_).subdetId()==1){ layer = PXBDetId(detid_).layer();} if ( doMissCalibrate ) { @@ -315,7 +346,11 @@ int PixelThresholdClusterizer::calibrate(int adc, int col, int row) //const float p3 = 113.0; //float vcal = ( atanh( (adc-p3)/p2) + p1)/p0; - electrons = int( vcal * theConversionFactor + theOffset); + if (layer_==1) { + electrons = int( vcal * theConversionFactor_L1 + theOffset_L1); + } else { + electrons = int( vcal * theConversionFactor + theOffset); + } } } else @@ -324,7 +359,7 @@ int PixelThresholdClusterizer::calibrate(int adc, int col, int row) const float gain = theElectronPerADCGain_; // default: 1 ADC = 135 electrons const float pedestal = 0.; // electrons = int(adc * gain + pedestal); - if (layer>=theFirstStack_) { + if (layer_>=theFirstStack_) { if (theStackADC_==1&&adc==1) { electrons = int(255*135); // Arbitrarily use overflow value. @@ -427,6 +462,10 @@ PixelThresholdClusterizer::make_cluster( const SiPixelCluster::PixelPos& pix, if (dead_flag && doSplitClusters) { + // Set separate cluster threshold for L1 (needed for phase1) + auto clusterThreshold = theClusterThreshold; + if (layer_==1) clusterThreshold = theClusterThreshold_L1; + //Set the first cluster equal to the existing cluster. SiPixelCluster first_cluster = cluster; bool have_second_cluster = false; @@ -440,8 +479,8 @@ PixelThresholdClusterizer::make_cluster( const SiPixelCluster::PixelPos& pix, SiPixelCluster second_cluster = make_cluster(deadpix, output); //If both clusters would normally have been found by the clusterizer, put them into output - if ( second_cluster.charge() >= theClusterThreshold && - first_cluster.charge() >= theClusterThreshold ) + if ( second_cluster.charge() >= clusterThreshold && + first_cluster.charge() >= clusterThreshold ) { output.push_back( second_cluster ); have_second_cluster = true; @@ -460,7 +499,7 @@ PixelThresholdClusterizer::make_cluster( const SiPixelCluster::PixelPos& pix, } //Remember to also add the first cluster if we added the second one. - if ( first_cluster.charge() >= theClusterThreshold && have_second_cluster) + if ( first_cluster.charge() >= clusterThreshold && have_second_cluster) { output.push_back( first_cluster ); std::push_heap(output.begin(),output.end(),[](SiPixelCluster const & cl1,SiPixelCluster const & cl2) { return cl1.minPixelRow() < cl2.minPixelRow();}); diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.h b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.h index 4904441edd2aa..e1d263180c0bf 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.h +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.h @@ -50,6 +50,9 @@ // Parameter Set: #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + #include @@ -62,18 +65,23 @@ class dso_hidden PixelThresholdClusterizer final : public PixelClusterizerBase { // Full I/O in DetSet void clusterizeDetUnit( const edm::DetSet & input, const PixelGeomDetUnit * pixDet, + const TrackerTopology* tTopo, const std::vector& badChannels, - edmNew::DetSetVector::FastFiller& output) { clusterizeDetUnitT(input, pixDet, badChannels, output); } + edmNew::DetSetVector::FastFiller& output) { clusterizeDetUnitT(input, pixDet, tTopo, badChannels, output); } void clusterizeDetUnit( const edmNew::DetSet & input, const PixelGeomDetUnit * pixDet, + const TrackerTopology* tTopo, const std::vector& badChannels, - edmNew::DetSetVector::FastFiller& output) { clusterizeDetUnitT(input, pixDet, badChannels, output); } + edmNew::DetSetVector::FastFiller& output) { clusterizeDetUnitT(input, pixDet, tTopo, badChannels, output); } + + static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); private: template void clusterizeDetUnitT( const T & input, const PixelGeomDetUnit * pixDet, + const TrackerTopology* tTopo, const std::vector& badChannels, edmNew::DetSetVector::FastFiller& output); @@ -88,11 +96,14 @@ class dso_hidden PixelThresholdClusterizer final : public PixelClusterizerBase { float theSeedThresholdInNoiseUnits; // Pixel cluster seed in units of noise float theClusterThresholdInNoiseUnits; // Cluster threshold in units of noise - const int thePixelThreshold; // Pixel threshold in electrons - const int theSeedThreshold; // Seed threshold in electrons - const float theClusterThreshold; // Cluster threshold in electrons - const int theConversionFactor; // adc to electron conversion factor - const int theOffset; // adc to electron conversion offset + const int thePixelThreshold; // Pixel threshold in electrons + const int theSeedThreshold; // Seed threshold in electrons + const int theClusterThreshold; // Cluster threshold in electrons + const int theClusterThreshold_L1; // Cluster threshold in electrons for Layer 1 + const int theConversionFactor; // adc to electron conversion factor + const int theConversionFactor_L1; // adc to electron conversion factor for Layer 1 + const int theOffset; // adc to electron conversion offset + const int theOffset_L1; // adc to electron conversion offset for Layer 1 const int theStackADC_; // The maximum ADC count for the stack layers const int theFirstStack_; // The index of the first stack layer @@ -102,6 +113,7 @@ class dso_hidden PixelThresholdClusterizer final : public PixelClusterizerBase { int theNumOfRows; int theNumOfCols; uint32_t detid_; + int layer_; bool dead_flag; const bool doMissCalibrate; // Use calibration or not const bool doSplitClusters; diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.cc b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.cc index ed9c34670fa54..805b94ef8e447 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.cc +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.cc @@ -103,6 +103,10 @@ edm::ESHandle geom; es.get().get( geom ); + edm::ESHandle trackerTopologyHandle; + es.get().get(trackerTopologyHandle); + tTopo_ = trackerTopologyHandle.product(); + // Step B: create the final output collection auto output = std::make_unique< SiPixelClusterCollectionNew>(); //FIXME: put a reserve() here @@ -185,7 +189,7 @@ // Produce clusters for this DetUnit and store them in // a DetSet edmNew::DetSetVector::FastFiller spc(output, DSViter->detId()); - clusterizer_->clusterizeDetUnit(*DSViter, pixDet, badChannels, spc); + clusterizer_->clusterizeDetUnit(*DSViter, pixDet, tTopo_, badChannels, spc); if ( spc.empty() ) { spc.abort(); } else { diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.h b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.h index 298f917fe4b98..43d764abf2a17 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.h +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.h @@ -38,7 +38,7 @@ #include "DataFormats/Common/interface/DetSetVectorNew.h" #include "DataFormats/SiPixelDigi/interface/PixelDigi.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" - +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" @@ -74,6 +74,7 @@ const std::string clusterMode_; // user's choice of the clusterizer PixelClusterizerBase * clusterizer_; // what we got (for now, one ptr to base class) bool readyToCluster_; // needed clusterizers valid => good to go! + const TrackerTopology* tTopo_; // needed to get correct layer number //! Optional limit on the total number of clusters const int32_t maxTotalClusters_; diff --git a/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizer_cfi.py b/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizer_cfi.py index 25ed094e91cc4..c3edb47a2a770 100644 --- a/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizer_cfi.py +++ b/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizer_cfi.py @@ -9,8 +9,10 @@ ChannelThreshold = cms.int32(1000), MissCalibrate = cms.untracked.bool(True), SplitClusters = cms.bool(False), - VCaltoElectronGain = cms.int32(65), - VCaltoElectronOffset = cms.int32(-414), + VCaltoElectronGain = cms.int32(65), + VCaltoElectronGain_L1 = cms.int32(65), + VCaltoElectronOffset = cms.int32(-414), + VCaltoElectronOffset_L1 = cms.int32(-414), # ************************************** # **** payLoadType Options **** # **** HLT - column granularity **** @@ -18,11 +20,22 @@ # ************************************** payloadType = cms.string('Offline'), SeedThreshold = cms.int32(1000), - ClusterThreshold = cms.double(4000.0), + ClusterThreshold = cms.int32(4000), + ClusterThreshold_L1 = cms.int32(4000), # ************************************** maxNumberOfClusters = cms.int32(-1), # -1 means no limit. ) +# phase1 pixel +from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel +phase1Pixel.toModify(siPixelClusters, + VCaltoElectronGain = cms.int32(47), # L2-4: 47 +- 4.7 + VCaltoElectronGain_L1 = cms.int32(50), # L1: 49.6 +- 2.6 + VCaltoElectronOffset = cms.int32(-60), # L2-4: -60 +- 130 + VCaltoElectronOffset_L1 = cms.int32(-670), # L1: -670 +- 220 + ChannelThreshold = cms.int32(250), + ClusterThreshold_L1 = cms.int32(2000) +) # Need these until phase2 pixel templates are used from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker diff --git a/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py b/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py index 1d86c8c3366ea..0a4e888f4f4b7 100644 --- a/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py +++ b/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py @@ -29,6 +29,11 @@ def _modifyPixelDigitizerForPhase1Pixel( digitizer ) : digitizer.BPix_SignalResponse_p1 = cms.double(0.711) digitizer.BPix_SignalResponse_p2 = cms.double(203.) digitizer.BPix_SignalResponse_p3 = cms.double(148.) + # gains and offsets are ints in the Clusterizer, so round to the same value + digitizer.ElectronsPerVcal = cms.double(47) # L2-4: 47 +- 4.7 + digitizer.ElectronsPerVcal_L1 = cms.double(50) # L1: 49.6 +- 2.6 + digitizer.ElectronsPerVcal_Offset = cms.double(-60) # L2-4: -60 +- 130 + digitizer.ElectronsPerVcal_L1_Offset = cms.double(-670) # L1: -670 +- 220 SiPixelSimBlock = cms.PSet( @@ -59,7 +64,9 @@ def _modifyPixelDigitizerForPhase1Pixel( digitizer ) : BPix_SignalResponse_p2 = cms.double(97.4), BPix_SignalResponse_p3 = cms.double(126.5), ElectronsPerVcal = cms.double(65.5), + ElectronsPerVcal_L1 = cms.double(65.5), ElectronsPerVcal_Offset = cms.double(-414.0), + ElectronsPerVcal_L1_Offset = cms.double(-414.0), ElectronPerAdc = cms.double(135.0), TofUpperCut = cms.double(12.5), AdcFullScale = cms.int32(255), diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc index 3502203c48a48..ebbedb62ef8a3 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc @@ -184,6 +184,8 @@ SiPixelDigitizerAlgorithm::SiPixelDigitizerAlgorithm(const edm::ParameterSet& co // electrons to VCAL conversion needed in misscalibrate() electronsPerVCAL(conf.getParameter("ElectronsPerVcal")), electronsPerVCAL_Offset(conf.getParameter("ElectronsPerVcal_Offset")), + electronsPerVCAL_L1(conf.exists("ElectronsPerVcal_L1")?conf.getParameter("ElectronsPerVcal_L1"):electronsPerVCAL), + electronsPerVCAL_L1_Offset(conf.exists("ElectronsPerVcal_L1_Offset")?conf.getParameter("ElectronsPerVcal_L1_Offset"):electronsPerVCAL_Offset), //theTofCut 12.5, cut in particle TOD +/- 12.5ns //theTofCut(conf.getUntrackedParameter("TofCut",12.5)), @@ -1287,7 +1289,7 @@ void SiPixelDigitizerAlgorithm::make_digis(float thePixelThresholdInE, if(doMissCalibrate) { int row = ip.first; // X in row int col = ip.second; // Y is in col - adc = int(missCalibrate(detID, pixdet, col, row, signalInElectrons)); //full misscalib. + adc = int(missCalibrate(detID, tTopo, pixdet, col, row, signalInElectrons)); //full misscalib. } else { // Just do a simple electron->adc conversion adc = int( signalInElectrons / theElectronPerADC ); // calibrate gain } @@ -1662,7 +1664,7 @@ float SiPixelDigitizerAlgorithm::pixel_aging(const PixelAging& aging, //float offset = RandGaussQ::shoot(0.,theOffsetSmearing); //float newAmp = amp * gain + offset; // More complex misscalibration -float SiPixelDigitizerAlgorithm::missCalibrate(uint32_t detID, const PixelGeomDetUnit* pixdet, int col,int row, +float SiPixelDigitizerAlgorithm::missCalibrate(uint32_t detID, const TrackerTopology *tTopo, const PixelGeomDetUnit* pixdet, int col,int row, const float signalInElectrons) const { // Central values //const float p0=0.00352, p1=0.868, p2=112., p3=113.; // pix(0,0,0) @@ -1693,13 +1695,16 @@ float SiPixelDigitizerAlgorithm::missCalibrate(uint32_t detID, const PixelGeomDe throw cms::Exception("NotAPixelGeomDetUnit") << "Not a pixel geomdet unit" << detID; } - // const float electronsPerVCAL = 65.5; // our present VCAL calibration (feb 2009) - // const float electronsPerVCAL_Offset = -414.0; // our present VCAL calibration (feb 2009) float newAmp = 0.; //Modified signal // Convert electrons to VCAL units float signal = (signalInElectrons-electronsPerVCAL_Offset)/electronsPerVCAL; + // New gains/offsets are needed for phase1 L1 + int layer = 0; + if (DetId(detID).subdetId()==1) layer = tTopo->pxbLayer(detID); + if (layer==1) signal = (signalInElectrons-electronsPerVCAL_L1_Offset)/electronsPerVCAL_L1; + // Simulate the analog response with fixed parametrization newAmp = p3 + p2 * tanh(p0*signal - p1); diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h index b1c97f2e2d777..6ee025ad61097 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h @@ -322,8 +322,10 @@ class SiPixelDigitizerAlgorithm { const double theThresholdSmearing_BPix; const double theThresholdSmearing_BPix_L1; - const double electronsPerVCAL; // for electrons - VCAL conversion - const double electronsPerVCAL_Offset; // in misscalibrate() + const float electronsPerVCAL; // for electrons - VCAL conversion + const float electronsPerVCAL_Offset; // in misscalibrate() + const float electronsPerVCAL_L1; // same for Layer 1 + const float electronsPerVCAL_L1_Offset;// same for Layer 1 const float theTofLowerCut; // Cut on the particle TOF const float theTofUpperCut; // Cut on the particle TOF @@ -415,7 +417,7 @@ class SiPixelDigitizerAlgorithm { // access to the gain calibration payloads in the db. Only gets initialized if check_dead_pixels_ is set to true. const std::unique_ptr theSiPixelGainCalibrationService_; - float missCalibrate(uint32_t detID, const PixelGeomDetUnit* pixdet, int col, int row, float amp) const; + float missCalibrate(uint32_t detID, const TrackerTopology *tTopo, const PixelGeomDetUnit* pixdet, int col, int row, float amp) const; LocalVector DriftDirection(const PixelGeomDetUnit* pixdet, const GlobalVector& bfield, const DetId& detId) const;