1 #include "../interface/LaserTask.h"
26 std::vector<int> laserWavelengths(_params.
getUntrackedParameter<std::vector<int> >(
"laserWavelengths"));
30 MESetMulti& amplitude(static_cast<MESetMulti&>(
MEs_.at(
"Amplitude")));
31 unsigned nWL(laserWavelengths.size());
32 for(
unsigned iWL(0); iWL != nWL; ++iWL){
33 int wl(laserWavelengths[iWL]);
34 if(wl <= 0 || wl >= 5)
throw cms::Exception(
"InvalidConfiguration") <<
"Laser Wavelength";
55 for(
unsigned iDCC(0); iDCC <
nDCC; iDCC++){
90 unsigned iDCC(rItr->id() - 1);
97 wavelength_[iDCC] = rItr->getEventSettings().wavelength + 1;
102 rtHalf_[iDCC] = rItr->getRtHalf();
106 template<
typename DigiCollection>
110 MESet& meOccupancy(
MEs_.at(
"Occupancy"));
112 MESet& meSignalRate(
MEs_.at(
"SignalRate"));
116 for(
unsigned iDCC(0); iDCC <
nDCC; ++iDCC){
121 for(
typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
122 const DetId& id(digiItr->id());
124 unsigned iDCC(
dccId(
id) - 1);
129 meOccupancy.fill(
id);
146 if(iMax >= 0 && max - min > 3)
147 maxpos[iDCC][iMax] += 1;
152 bool laserOnExpected(
emptyLS_ >= 0);
156 for(
int iDCC(0); iDCC <
nDCC; ++iDCC){
157 if(nReadouts[iDCC] == 0){
163 if(laserOnExpected)
enable_[iDCC] =
false;
166 if(maxpos[iDCC][
i] > threshold){
175 static_cast<MESetMulti&
>(meSignalRate).use(iME);
178 meSignalRate.
fill(iDCC + 1,
enable_[iDCC] ? 1 : 0);
182 else if(laserOnExpected)
return;
186 for(
typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
187 const DetId& id(digiItr->id());
189 unsigned iDCC(
dccId(
id) - 1);
202 meShape.
fill(
id, iSample + 0.5,
float(dataFrame.
sample(iSample).
adc()));
206 if(pnidA.
null() || pnidB.
null())
continue;
215 MESet& mePNAmplitude(
MEs_.at(
"PNAmplitude"));
218 for(
unsigned iDCC(0); iDCC <
nDCC; ++iDCC)
225 if(digiItr->sample(0).gainId() != 0 && digiItr->sample(0).gainId() != 1)
continue;
229 std::map<uint32_t, float>::iterator ampItr(
pnAmp_.find(
id.rawId()));
230 if(ampItr ==
pnAmp_.end())
continue;
232 unsigned iDCC(
dccId(
id) - 1);
235 for(
int iSample(0); iSample < 4; iSample++)
236 pedestal += digiItr->sample(iSample).adc();
240 for(
int iSample(0); iSample < 50; iSample++){
241 float amp(digiItr->sample(iSample).adc() -
pedestal);
242 if(amp > max) max = amp;
247 static_cast<MESetMulti&
>(mePNAmplitude).use(iME);
250 mePNAmplitude.
fill(
id, max);
252 ampItr->second =
max;
259 MESet& meAmplitude(
MEs_.at(
"Amplitude"));
260 MESet& meAmplitudeSummary(
MEs_.at(
"AmplitudeSummary"));
267 for(
unsigned iDCC(0); iDCC <
nDCC; ++iDCC)
274 const DetId& id(uhitItr->id());
276 unsigned iDCC(
dccId(
id) - 1);
283 static_cast<MESetMulti&
>(meAmplitude).use(iME);
284 static_cast<MESetMulti&
>(meAmplitudeSummary).use(iME);
289 float amp(
max((
double)uhitItr->amplitude(), 0.));
290 float jitter(
max((
double)uhitItr->jitter() + 5.0, 0.));
292 meAmplitude.
fill(
id, amp);
293 meAmplitudeSummary.fill(
id, amp);
294 meTiming.fill(
id, jitter);
300 if(ampItrA ==
pnAmp_.end() && ampItrB ==
pnAmp_.end())
continue;
301 else if(ampItrB ==
pnAmp_.end()) aop = amp / ampItrA->second;
302 else if(ampItrA ==
pnAmp_.end()) aop = amp / ampItrB->second;
303 else aop = amp / (ampItrA->second + ampItrB->second) * 2.;
305 meAOverP.fill(
id, aop);
int adc(sample_type sample)
get the ADC sample (12 bits)
T getUntrackedParameter(std::string const &, T const &) const
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 &)
DEFINE_ECALDQM_WORKER(CalibrationSummaryClient)
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]
const T & max(const T &a, const T &b)
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)