1 #include "../interface/LaserTask.h"
27 std::vector<int> laserWavelengths(_params.
getUntrackedParameter<std::vector<int> >(
"laserWavelengths"));
31 MESetMulti& amplitude(static_cast<MESetMulti&>(
MEs_.at(
"Amplitude")));
32 unsigned nWL(laserWavelengths.size());
33 for(
unsigned iWL(0); iWL != nWL; ++iWL){
34 int wl(laserWavelengths[iWL]);
35 if(wl <= 0 || wl >= 5)
throw cms::Exception(
"InvalidConfiguration") <<
"Laser Wavelength";
58 for(
unsigned iDCC(0); iDCC <
nDCC; iDCC++){
92 MESet& meCalibStatus(
MEs_.at(
"CalibStatus"));
94 unsigned iDCC(rItr->id() - 1);
101 wavelength_[iDCC] = rItr->getEventSettings().wavelength + 1;
106 rtHalf_[iDCC] = rItr->getRtHalf();
110 LaserStatus[iW] =
false;
112 for(
unsigned iDCC(0); iDCC <
nDCC; iDCC++){
118 LaserStatus[Wavelength::kGreen] =
true;
121 LaserStatus[Wavelength::kBlue] =
true;
124 LaserStatus[Wavelength::kIRed] =
true;
131 meCalibStatus.fill(
double(iWL), LaserStatus[iWL]? 1:0);
135 template<
typename DigiCollection>
139 MESet& meOccupancy(
MEs_.at(
"Occupancy"));
141 MESet& meSignalRate(
MEs_.at(
"SignalRate"));
146 bool largeAmplitude[
nDCC];
147 for(
unsigned iDCC(0); iDCC <
nDCC; ++iDCC){
148 inData[iDCC] =
false;
151 largeAmplitude[iDCC] =
false;
154 for(
typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
155 const DetId& id(digiItr->id());
157 unsigned iDCC(
dccId(
id) - 1);
164 meOccupancy.fill(
id);
182 if(iMax >= 0 && max - min > 3)
183 maxpos[iDCC][iMax] += 1;
188 bool laserOnExpected(
emptyLS_ >= 0);
192 for(
int iDCC(0); iDCC <
nDCC; ++iDCC){
193 if(!inData[iDCC])
continue;
195 if(nReadouts[iDCC] == 0){
201 if(laserOnExpected)
enable_[iDCC] =
false;
203 if(largeAmplitude[iDCC]){
209 if(maxpos[iDCC][
i] > threshold){
219 static_cast<MESetMulti&
>(meSignalRate).use(iME);
222 meSignalRate.
fill(iDCC + 1,
enable_[iDCC] ? 1 : 0);
226 else if(laserOnExpected)
return;
230 for(
typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
231 const DetId& id(digiItr->id());
233 unsigned iDCC(
dccId(
id) - 1);
246 meShape.
fill(
id, iSample + 0.5,
float(dataFrame.
sample(iSample).
adc()));
250 if(pnidA.
null() || pnidB.
null())
continue;
259 MESet& mePNAmplitude(
MEs_.at(
"PNAmplitude"));
262 for(
unsigned iDCC(0); iDCC <
nDCC; ++iDCC)
269 if(digiItr->sample(0).gainId() != 0 && digiItr->sample(0).gainId() != 1)
continue;
273 std::map<uint32_t, float>::iterator ampItr(
pnAmp_.find(
id.rawId()));
274 if(ampItr ==
pnAmp_.end())
continue;
276 unsigned iDCC(
dccId(
id) - 1);
279 for(
int iSample(0); iSample < 4; iSample++)
280 pedestal += digiItr->sample(iSample).adc();
284 for(
int iSample(0); iSample < 50; iSample++){
285 float amp(digiItr->sample(iSample).adc() -
pedestal);
286 if(amp > max) max = amp;
291 static_cast<MESetMulti&
>(mePNAmplitude).use(iME);
294 mePNAmplitude.
fill(
id, max);
296 ampItr->second =
max;
303 MESet& meAmplitude(
MEs_.at(
"Amplitude"));
304 MESet& meAmplitudeSummary(
MEs_.at(
"AmplitudeSummary"));
311 for(
unsigned iDCC(0); iDCC <
nDCC; ++iDCC)
318 const DetId& id(uhitItr->id());
320 unsigned iDCC(
dccId(
id) - 1);
327 static_cast<MESetMulti&
>(meAmplitude).use(iME);
328 static_cast<MESetMulti&
>(meAmplitudeSummary).use(iME);
333 float amp(
max((
double)uhitItr->amplitude(), 0.));
334 float jitter(
max((
double)uhitItr->jitter() + 5.0, 0.));
336 meAmplitude.
fill(
id, amp);
337 meAmplitudeSummary.fill(
id, amp);
338 meTiming.fill(
id, jitter);
344 if(ampItrA ==
pnAmp_.end() && ampItrB ==
pnAmp_.end())
continue;
345 else if(ampItrB ==
pnAmp_.end()) aop = amp / ampItrA->second;
346 else if(ampItrA ==
pnAmp_.end()) aop = amp / ampItrB->second;
347 else aop = amp / (ampItrA->second + ampItrB->second) * 2.;
349 meAOverP.fill(
id, aop);
int adc(sample_type sample)
get the ADC sample (12 bits)
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_ECALDQM_WORKER(TYPE)
void beginRun(edm::Run const &, edm::EventSetup const &) override
std::map< int, unsigned > wlToME_
std::vector< EcalDCCHeaderBlock >::const_iterator const_iterator
EcalMGPASample sample(int i) const
bool filterRunType(short const *) override
std::map< uint32_t, float > pnAmp_
void fill(DetId const &_id, double _xyw=1., double _yw=1., double _w=1.) override
void runOnPnDigis(EcalPnDiodeDigiCollection const &)
void runOnDigis(DigiCollection const &)
void runOnRawData(EcalRawDataCollection const &)
uint32_t rawId() const
get the raw id
std::string to_string(const T &t)
unsigned wavelength_[nDCC]
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
EcalPnDiodeDetId pnForCrystal(DetId const &, char)
unsigned rtHalf(DetId const &)
const_iterator end() const
void setParams(edm::ParameterSet const &) override
bool null() const
is this a null id ?
void runOnUncalibRecHits(EcalUncalibratedRecHitCollection const &)
void addDependencies(DependencySet &) override
void beginEvent(edm::Event const &, edm::EventSetup const &) override
std::map< std::string, std::string > PathReplacements
void push_back(Dependency const &_d)
unsigned dccId(DetId const &)
static const int MAXSAMPLES
unsigned getIndex(PathReplacements const &) const
const_iterator begin() const
int adc() const
get the ADC sample (12 bits)