1 #include "../interface/SelectiveReadoutTask.h"
44 useCondDb_ = taskParams.getUntrackedParameter<
bool>(
"useCondDb");
45 iFirstSample_ = taskParams.getUntrackedParameter<
int>(
"DCCZS1stSample");
47 std::vector<double> normWeights(taskParams.getUntrackedParameter<std::vector<double> >(
"ZSFIRWeights", std::vector<double>(0)));
64 vector<vector<float> >
weights(hSr->dccNormalizedWeights_);
65 if(weights.size() == 1){
66 vector<double> normWeights;
67 for(vector<float>::iterator it(weights[0].
begin()); it != weights[0].end(); it++)
68 normWeights.push_back(*it);
72 else edm::LogWarning(
"EcalDQM") <<
"SelectiveReadoutTask: DCC weight set is not exactly 1.";
93 float ebSize(0.), eeSize(0.);
96 for(
unsigned iFED(601); iFED <= 654; iFED++){
111 const std::vector<short> &feStatus(dcchItr->getFEStatus());
112 feStatus_[dcchItr->id() - 1].assign(feStatus.begin(), feStatus.end());
145 uint32_t rawId(_id.
rawId());
146 int dccid(
dccId(_id));
179 map<uint32_t, pair<int, int> > flagAndSizeMap;
180 map<uint32_t, pair<int, int> >::iterator fasItr;
182 int nHighInt(0), nLowInt(0);
186 DetId id(digiItr->id());
188 pair<int, int> *flagAndSize(0);
192 uint32_t rawId(ttid.
rawId());
194 fasItr = flagAndSizeMap.find(rawId);
196 if(fasItr == flagAndSizeMap.end()){
197 flagAndSize = &(flagAndSizeMap[rawId]);
200 if(srItr !=
ebSRFs_->
end()) flagAndSize->first = srItr->value();
201 else flagAndSize->first = -1;
203 flagAndSize = &(fasItr->second);
207 uint32_t rawId(scid.
rawId());
209 fasItr = flagAndSizeMap.find(rawId);
211 if(fasItr == flagAndSizeMap.end()){
212 flagAndSize = &(flagAndSizeMap[rawId]);
215 if(srItr !=
eeSRFs_->
end()) flagAndSize->first = srItr->value();
216 else flagAndSize->first = -1;
218 flagAndSize = &(fasItr->second);
222 if(flagAndSize->first < 0)
continue;
224 flagAndSize->second += 1;
232 bool gain12saturated(
false);
233 const int gain12(0x01);
235 for(
int iWeight(0); iWeight <
nFIRTaps; ++iWeight){
239 if(iSample >= 0 && iSample < frame.
size()){
241 if(sample.
gainId() != gain12){
242 gain12saturated =
true;
247 edm::LogWarning(
"EcalDQM") <<
"SelectiveReadoutTask: Not enough samples in data frame or 'ecalDccZs1stSample' module parameter is not valid";
253 else ZSFIRValue /= (0x1 << 8);
271 float denom(_collection ==
kEBDigi ? 36. : 18.);
281 float nZSFullReadout(0.);
287 fasItr = flagAndSizeMap.find(
id.rawId());
290 if(fasItr != flagAndSizeMap.end()) towerSize = fasItr->second.second *
bytesPerCrystal;
294 if(fasItr == flagAndSizeMap.end() || fasItr->second.first < 0)
continue;
300 nZSFullReadout += 1.;
310 float nFRDropped(0.);
327 throw cms::Exception(
"InvalidConfiguration") <<
"weightsForZsFIR" << std::endl;
329 bool notNormalized(
false), notInt(
false);
330 for(std::vector<double>::const_iterator it(_normWeights.begin()); it != _normWeights.end(); ++it){
331 if(*it > 1.) notNormalized =
true;
332 if((
int)(*it) != *it) notInt =
true;
334 if(notInt && notNormalized){
336 <<
"weigtsForZsFIR paramater values are not valid: they "
337 <<
"must either be integer and uses the hardware representation "
338 <<
"of the weights or less or equal than 1 and used the normalized "
339 <<
"representation.";
349 const unsigned maxWeight(0xEFF);
368 axis.
title =
"event size (kB)";
370 axis.
edges =
new double[79];
371 float fullTTSize(0.608);
372 for(
int i(0);
i <= 10;
i++) axis.
edges[
i] = fullTTSize / 10. *
i;
373 for(
int i(11);
i < 79;
i++) axis.
edges[
i] = fullTTSize * (
i - 10);
375 delete [] axis.
edges;
381 axis.
title =
"event size (kB)";
389 axis.
title =
"number of towers";
398 axis.
title =
"number of towers";
407 axis.
title =
"event size (kB)";
414 axis.
title =
"ADC counts*4";
std::vector< std::pair< Collections, Collections > > dependencies_
static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di)
const EcalElectronicsMapping * getElectronicsMap()
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
const EBSrFlagCollection * ebSRFs_
static const int SRF_FORCED_MASK
std::vector< EcalDCCHeaderBlock >::const_iterator const_iterator
static EcalScDetId unhashIndex(int hi)
const EcalChannelStatus * channelStatus_
unsigned dccId(const DetId &)
const EESrFlagCollection * eeSRFs_
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
const_iterator begin() const
void runOnDigis(const EcalDigiCollection &, Collections)
int gainId() const
get the gainId (2 bits)
std::set< uint32_t > zsFlaggedTowers_
size_t size() const
Lenght of the data buffer in bytes.
SelectiveReadoutTask(const edm::ParameterSet &, const edm::ParameterSet &)
uint32_t rawId() const
get the raw id
unsigned towerId(const DetId &)
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
const T & max(const T &a, const T &b)
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
void runOnEESrFlags(const EESrFlagCollection &)
std::set< uint32_t > frFlaggedTowers_
static const int SRF_FULL
Abs< T >::type abs(const T &t)
void runOnSource(const FEDRawDataCollection &)
static void setMEData(std::vector< MEData > &)
void setFIRWeights_(const std::vector< double > &)
const_iterator end() const
std::vector< MESet * > MEs_
void runOnRawData(const EcalRawDataCollection &)
std::vector< short > feStatus_[54]
const_iterator end() const
void runOnEBSrFlags(const EBSrFlagCollection &)
iterator find(key_type k)
void beginEvent(const edm::Event &, const edm::EventSetup &) override
DEFINE_ECALDQM_WORKER(CertificationClient)
volatile std::atomic< bool > shutdown_flag false
tuple size
Write out results.
const_iterator begin() const
void beginRun(const edm::Run &, const edm::EventSetup &) override
void runOnSrFlag_(const DetId &, int, float &)
int adc() const
get the ADC sample (12 bits)
std::vector< int > ZSFIRWeights_