CMS 3D CMS Logo

EcalPFRecHitThresholdsMaker.cc
Go to the documentation of this file.
3 
5 
8 
10 
13 
47 
56 
59 
62 
71 
78 
81 
84 
87 
89 
91 
92 #include <vector>
93 
95  : m_timetype(iConfig.getParameter<std::string>("timetype")) {
96  std::string container;
99 
100  m_nsigma = iConfig.getParameter<double>("NSigma");
101 }
102 
104 
107  if (!dbOutput.isAvailable()) {
108  throw cms::Exception("PoolDBOutputService is not available");
109  }
110 
112  evtSetup.get<EcalPedestalsRcd>().get(handle1);
113  const EcalPedestals* ped_db = handle1.product();
114  std::cout << "ped pointer is: " << ped_db << std::endl;
115 
117  evtSetup.get<EcalADCToGeVConstantRcd>().get(handle2);
118  const EcalADCToGeVConstant* adc_db = handle2.product();
119  std::cout << "adc pointer is: " << adc_db << std::endl;
120 
122  evtSetup.get<EcalIntercalibConstantsRcd>().get(handle3);
123  const EcalIntercalibConstants* ical_db = handle3.product();
124  std::cout << "inter pointer is: " << ical_db << std::endl;
125 
127  evtSetup.get<EcalLaserDbRecord>().get(laser);
128 
130 
131  // const EcalIntercalibConstantMap& icalMap = ical_db->getMap();
132 
133  float adc_EB = float(adc_db->getEEValue());
134  float adc_EE = float(adc_db->getEBValue());
135 
136  //edm::Timestamp tsince;
137 
138  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
139  if (iEta == 0)
140  continue;
141  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
142  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
143  if (EBDetId::validDetId(iEta, iPhi)) {
144  EBDetId ebdetid(iEta, iPhi, EBDetId::ETAPHIMODE);
145  EcalPedestals::const_iterator it = ped_db->find(ebdetid.rawId());
146  EcalPedestals::Item aped = (*it);
147 
148  EcalIntercalibConstants::const_iterator itc = ical_db->find(ebdetid.rawId());
149  float calib = (*itc);
150 
151  // get laser coefficient
152  float lasercalib = 1.;
153  lasercalib = laser->getLaserCorrection(ebdetid, evt.time()); // TODO correct time
154 
155  EcalPFRecHitThreshold thresh = aped.rms_x12 * calib * adc_EB * lasercalib * m_nsigma;
156 
157  if (iPhi == 100)
158  std::cout << "Thresh(GeV)=" << thresh << std::endl;
159 
160  pfthresh->insert(std::make_pair(ebdetid.rawId(), thresh));
161  }
162  }
163  }
164 
165  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
166  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
167  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
168  if (EEDetId::validDetId(iX, iY, 1)) {
169  EEDetId eedetid(iX, iY, 1);
170 
171  EcalPedestals::const_iterator it = ped_db->find(eedetid.rawId());
172  EcalPedestals::Item aped = (*it);
173 
174  EcalIntercalibConstants::const_iterator itc = ical_db->find(eedetid.rawId());
175  float calib = (*itc);
176 
177  // get laser coefficient
178  float lasercalib = 1.;
179  lasercalib = laser->getLaserCorrection(eedetid, evt.time()); // TODO correct time
180 
181  EcalPFRecHitThreshold thresh = aped.rms_x12 * calib * adc_EE * lasercalib * m_nsigma;
182  pfthresh->insert(std::make_pair(eedetid.rawId(), thresh));
183  }
184  if (EEDetId::validDetId(iX, iY, -1)) {
185  EEDetId eedetid(iX, iY, -1);
186 
187  EcalPedestals::const_iterator it = ped_db->find(eedetid.rawId());
188  EcalPedestals::Item aped = (*it);
189 
190  EcalIntercalibConstants::const_iterator itc = ical_db->find(eedetid.rawId());
191  float calib = (*itc);
192 
193  // get laser coefficient
194  float lasercalib = 1.;
195  lasercalib = laser->getLaserCorrection(eedetid, evt.time()); // TODO correct time
196 
197  EcalPFRecHitThreshold thresh = aped.rms_x12 * calib * adc_EE * lasercalib * m_nsigma;
198  pfthresh->insert(std::make_pair(eedetid.rawId(), thresh));
199 
200  if (iX == 50)
201  std::cout << "Thresh(GeV)=" << thresh << std::endl;
202  }
203  }
204  }
205 
206  dbOutput->createNewIOV<const EcalPFRecHitThresholds>(
207  pfthresh, dbOutput->beginOfTime(), dbOutput->endOfTime(), "EcalPFRecHitThresholdsRcd");
208 
209  std::cout << "EcalPFRecHitThresholdsMaker wrote it " << std::endl;
210 }
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
EcalIntercalibConstantsMC.h
EcalPedestals.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
ESHandle.h
EcalClusterEnergyCorrectionObjectSpecificParameters.h
EcalIntercalibConstants.h
EcalPFRecHitThresholdsMaker.h
EBDetId
Definition: EBDetId.h:17
EcalLaserAPDPNRatiosRef.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
Alignments.h
EcalLinearCorrectionsRcd.h
EcalLaserAPDPNRatiosRefRcd.h
EcalLinearCorrections.h
EEDetId::IX_MIN
static const int IX_MIN
Definition: EEDetId.h:290
EcalDQMTowerStatus.h
EcalDAQTowerStatusRcd.h
EcalPFRecHitThresholds
EcalPFRecHitThresholdsMap EcalPFRecHitThresholds
Definition: EcalPFRecHitThresholds.h:12
EcalADCToGeVConstant
Definition: EcalADCToGeVConstant.h:13
EcalLaserAlphasRcd.h
EcalTPGCrystalStatusRcd.h
EcalTimeCalibConstants.h
EEDetId::IY_MIN
static const int IY_MIN
Definition: EEDetId.h:294
edm::EventBase::time
edm::Timestamp time() const
Definition: EventBase.h:60
EcalDQMChannelStatusRcd.h
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
EcalWeightXtalGroups.h
EcalClusterEnergyCorrectionParametersRcd.h
EcalTBWeights.h
EcalSamplesCorrelationRcd.h
EcalIntercalibErrors.h
EcalPFRecHitThresholdsMaker::m_nsigma
double m_nsigma
Definition: EcalPFRecHitThresholdsMaker.h:27
EcalSamplesCorrelation.h
EcalPFRecHitThresholds.h
PoolDBOutputService.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
EcalClusterCrackCorrParameters.h
EcalTimeOffsetConstant.h
EcalIntercalibConstantsMCRcd.h
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:116
Service.h
EcalLaserDbService.h
EcalTimeOffsetConstantRcd.h
edm::ESHandle
Definition: DTSurvey.h:22
EcalPFRecHitThreshold
float EcalPFRecHitThreshold
Definition: EcalPFRecHitThresholds.h:10
EcalClusterEnergyUncertaintyParameters.h
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
EBDetId::MAX_IPHI
static const int MAX_IPHI
Definition: EBDetId.h:137
EEDetId::IY_MAX
static const int IY_MAX
Definition: EEDetId.h:302
EcalLaserAPDPNRatiosRcd.h
EcalClusterEnergyCorrectionObjectSpecificParametersRcd.h
EcalLaserDbRecord
Definition: EcalLaserDbRecord.h:19
EEDetId
Definition: EEDetId.h:14
EcalPFRecHitThresholdsMaker::EcalPFRecHitThresholdsMaker
EcalPFRecHitThresholdsMaker(const edm::ParameterSet &iConfig)
Definition: EcalPFRecHitThresholdsMaker.cc:94
calib
Definition: CalibElectron.h:12
EcalADCToGeVConstant.h
EcalSampleMaskRcd.h
EBDetId::ETAPHIMODE
static const int ETAPHIMODE
Definition: EBDetId.h:158
EcalPFRecHitThresholdsMaker::analyze
void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override
Definition: EcalPFRecHitThresholdsMaker.cc:105
EcalDQMTowerStatusRcd.h
EcalClusterEnergyUncertaintyParametersRcd.h
edm::ParameterSet
Definition: ParameterSet.h:47
EcalADCToGeVConstant::getEEValue
float getEEValue() const
Definition: EcalADCToGeVConstant.h:21
Timestamp.h
EcalLaserAlphas.h
Event.h
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
EcalCondObjectContainer::Item
T Item
Definition: EcalCondObjectContainer.h:15
EcalIntercalibErrorsRcd.h
EBAlignmentRcd.h
EcalADCToGeVConstantRcd.h
EEDetId::IX_MAX
static const int IX_MAX
Definition: EEDetId.h:298
EcalPFRecHitThresholdsRcd.h
edm::Service< cond::service::PoolDBOutputService >
edm::EventSetup
Definition: EventSetup.h:58
AlCaHarvesting_cff.record
record
Definition: AlCaHarvesting_cff.py:42
EcalLaserAPDPNRatios.h
EcalGainRatiosRcd.h
get
#define get
EcalDAQTowerStatus.h
EcalTPGTowerStatus.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalGainRatios.h
GOODCOLL_filter_cfg.thresh
thresh
Definition: GOODCOLL_filter_cfg.py:74
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:213
EBDetId::validDetId
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
EcalSampleMask.h
EcalLaserDbRecord.h
EcalDCSTowerStatus.h
EcalClusterEnergyCorrectionParameters.h
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EcalCondObjectContainer::insert
void insert(std::pair< uint32_t, Item > const &a)
Definition: EcalCondObjectContainer.h:38
EEAlignmentRcd.h
Exception
Definition: hltDiff.cc:245
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EcalTPGCrystalStatus.h
EcalTPGTowerStatusRcd.h
EcalClusterLocalContCorrParametersRcd.h
EcalClusterLocalContCorrParameters.h
EEDetId::validDetId
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
L1TowerCalibrationProducer_cfi.iEta
iEta
Definition: L1TowerCalibrationProducer_cfi.py:60
EcalPFRecHitThresholdsMaker::~EcalPFRecHitThresholdsMaker
~EcalPFRecHitThresholdsMaker() override
Definition: EcalPFRecHitThresholdsMaker.cc:103
EcalPedestalsRcd.h
EcalCondObjectContainer::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondObjectContainer.h:19
EcalClusterCrackCorrParametersRcd.h
ParameterSet.h
EcalTimeCalibConstantsRcd.h
EcalPedestalsRcd
Definition: EcalPedestalsRcd.h:5
EcalDCSTowerStatusRcd.h
EcalDQMChannelStatus.h
edm::Event
Definition: Event.h:73
EcalTimeBiasCorrectionsRcd.h
ESAlignmentRcd.h
EcalADCToGeVConstant::getEBValue
float getEBValue() const
Definition: EcalADCToGeVConstant.h:20
EcalIntercalibConstantsRcd
Definition: EcalIntercalibConstantsRcd.h:5
EcalIntercalibConstantsRcd.h
EcalChannelStatus.h
EcalADCToGeVConstantRcd
Definition: EcalADCToGeVConstantRcd.h:5
EcalWeightXtalGroupsRcd.h
EcalTBWeightsRcd.h
EcalTimeBiasCorrections.h
EcalChannelStatusRcd.h
EcalCondDBWriter_cfi.laser
laser
Definition: EcalCondDBWriter_cfi.py:46
EBDetId::MAX_IETA
static const int MAX_IETA
Definition: EBDetId.h:136
EBDetId::MIN_IPHI
static const int MIN_IPHI
Definition: EBDetId.h:135