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++){
93 unsigned iDCC(rItr->id() - 1);
100 wavelength_[iDCC] = rItr->getEventSettings().wavelength + 1;
105 rtHalf_[iDCC] = rItr->getRtHalf();
109 template<
typename DigiCollection>
113 MESet& meOccupancy(
MEs_.at(
"Occupancy"));
115 MESet& meSignalRate(
MEs_.at(
"SignalRate"));
120 bool largeAmplitude[
nDCC];
121 for(
unsigned iDCC(0); iDCC <
nDCC; ++iDCC){
122 inData[iDCC] =
false;
125 largeAmplitude[iDCC] =
false;
128 for(
typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
129 const DetId& id(digiItr->id());
131 unsigned iDCC(
dccId(
id) - 1);
138 meOccupancy.fill(
id);
156 if(iMax >= 0 && max - min > 3)
157 maxpos[iDCC][iMax] += 1;
162 bool laserOnExpected(
emptyLS_ >= 0);
166 for(
int iDCC(0); iDCC <
nDCC; ++iDCC){
167 if(!inData[iDCC])
continue;
169 if(nReadouts[iDCC] == 0){
175 if(laserOnExpected)
enable_[iDCC] =
false;
177 if(largeAmplitude[iDCC]){
183 if(maxpos[iDCC][
i] > threshold){
193 static_cast<MESetMulti&
>(meSignalRate).use(iME);
196 meSignalRate.
fill(iDCC + 1,
enable_[iDCC] ? 1 : 0);
200 else if(laserOnExpected)
return;
204 for(
typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
205 const DetId& id(digiItr->id());
207 unsigned iDCC(
dccId(
id) - 1);
220 meShape.
fill(
id, iSample + 0.5,
float(dataFrame.
sample(iSample).
adc()));
224 if(pnidA.
null() || pnidB.
null())
continue;
233 MESet& mePNAmplitude(
MEs_.at(
"PNAmplitude"));
236 for(
unsigned iDCC(0); iDCC <
nDCC; ++iDCC)
243 if(digiItr->sample(0).gainId() != 0 && digiItr->sample(0).gainId() != 1)
continue;
247 std::map<uint32_t, float>::iterator ampItr(
pnAmp_.find(
id.rawId()));
248 if(ampItr ==
pnAmp_.end())
continue;
250 unsigned iDCC(
dccId(
id) - 1);
253 for(
int iSample(0); iSample < 4; iSample++)
254 pedestal += digiItr->sample(iSample).adc();
258 for(
int iSample(0); iSample < 50; iSample++){
259 float amp(digiItr->sample(iSample).adc() -
pedestal);
260 if(amp > max) max = amp;
265 static_cast<MESetMulti&
>(mePNAmplitude).use(iME);
268 mePNAmplitude.
fill(
id, max);
270 ampItr->second =
max;
277 MESet& meAmplitude(
MEs_.at(
"Amplitude"));
278 MESet& meAmplitudeSummary(
MEs_.at(
"AmplitudeSummary"));
285 for(
unsigned iDCC(0); iDCC <
nDCC; ++iDCC)
292 const DetId& id(uhitItr->id());
294 unsigned iDCC(
dccId(
id) - 1);
301 static_cast<MESetMulti&
>(meAmplitude).use(iME);
302 static_cast<MESetMulti&
>(meAmplitudeSummary).use(iME);
307 float amp(
max((
double)uhitItr->amplitude(), 0.));
308 float jitter(
max((
double)uhitItr->jitter() + 5.0, 0.));
310 meAmplitude.
fill(
id, amp);
311 meAmplitudeSummary.fill(
id, amp);
312 meTiming.fill(
id, jitter);
318 if(ampItrA ==
pnAmp_.end() && ampItrB ==
pnAmp_.end())
continue;
319 else if(ampItrB ==
pnAmp_.end()) aop = amp / ampItrA->second;
320 else if(ampItrA ==
pnAmp_.end()) aop = amp / ampItrB->second;
321 else aop = amp / (ampItrA->second + ampItrB->second) * 2.;
323 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)