93 float ZSthreshold = 0.608;
94 float zeroBinSize = ZSthreshold / 20.;
95 for(
int i=0;
i<20;
i++)
ybins[
i] =
i*zeroBinSize;
96 for(
int i=20;
i<89;
i++)
ybins[
i] = ZSthreshold * (
i-19);
122 for(
int ietindex = 0; ietindex < 34; ietindex++ ) {
123 for(
int iptindex = 0; iptindex < 72; iptindex++ ) {
143 std::vector<double> wsFromDB;
146 int nws = dccs.size();
148 for(std::vector<float>::const_iterator it = dccs[0].
begin(); it != dccs[0].end(); it++) {
149 wsFromDB.push_back(*it);
152 else edm::LogWarning(
"EBSelectiveReadoutTask") <<
"DCC weight set is not exactly 1.";
219 name =
"EBSRT tower event size";
220 EBTowerSize_ =
dqmStore_->
bookProfile2D(name, name, 72, 0, 72, 34, -17, 17, 100, 0, 200,
"s");
224 name =
"EBSRT TT flag mismatch";
229 name =
"EBSRT DCC event size";
232 for (
int i = 0;
i < 36;
i++) {
236 name =
"EBSRT event size vs DCC";
239 for (
int i = 0;
i < 36;
i++) {
243 name =
"EBSRT readout unit with SR forced";
249 name =
"EBSRT full readout SR Flags";
255 name =
"EBSRT full readout SR Flags Number";
259 name =
"EBSRT zero suppression 1 SR Flags";
265 name =
"EBSRT high interest TT Flags";
271 name =
"EBSRT medium interest TT Flags";
277 name =
"EBSRT low interest TT Flags";
283 name =
"EBSRT TT Flags";
287 name =
"EBSRT ZS Flagged Fully Readout";
293 name =
"EBSRT ZS Flagged Fully Readout Number";
297 name =
"EBSRT FR Flagged Dropped Readout";
303 name =
"EBSRT FR Flagged Dropped Readout Number";
307 name =
"EBSRT event size";
311 name =
"EBSRT high interest payload";
315 name =
"EBSRT low interest payload";
319 name =
"EBSRT high interest ZS filter output";
323 name =
"EBSRT low interest ZS filter output";
333 if ( !
init_ )
return;
425 for (
int iDcc = 0; iDcc <
nEBDcc; ++iDcc ) {
437 int nFRO, nCompleteZS, nDroppedFRO;
445 double aLowInterest=0;
446 double aHighInterest=0;
447 double aAnyInterest=0;
459 for (
unsigned int digis=0; digis<ebDigis->size(); ++digis){
464 uint16_t statusCode = 0;
469 anaDigi(ebdf, *ebSrFlags, statusCode);
485 for(
int ietindex = 0; ietindex < 34; ietindex++ ) {
486 for(
int iptindex = 0; iptindex < 72; iptindex++ ) {
488 float xiet = (ietindex < 17) ? ietindex + 0.5 : (16-ietindex) + 0.5;
489 float xipt = iptindex + 0.5;
501 std::map< int, std::vector<short> > towersStatus;
508 towersStatus.insert(std::make_pair(ism, dcchItr->getFEStatus()));
519 int ietindex = (iet>0) ? iet - 1 : 16 +
std::abs(iet);
522 int ipt =
id.iphi() + 2;
523 if ( ipt > 72 ) ipt = ipt - 72;
524 int iptindex = ipt - 1;
533 if( towersStatus[ism].
size() > 0 ) status = (towersStatus[
ism])[itt];
538 if(
nPerRu_[ism-1][itt-1] == 0) {
561 for(
int ietindex = 0; ietindex < 34; ietindex++ ) {
562 for(
int iptindex = 0; iptindex < 72; iptindex++ ) {
566 float xiet = (ietindex < 17) ? ietindex + 0.5 : (16-ietindex) + 0.5;
567 float xipt = iptindex + 0.5;
574 int binet=0, binpt=0;
577 binpt = h2d->GetXaxis()->FindBin(xipt);
578 binet = h2d->GetYaxis()->FindBin(xiet);
591 binpt = h2d->GetXaxis()->FindBin(xipt);
592 binet = h2d->GetYaxis()->FindBin(xiet);
605 binpt = h2d->GetXaxis()->FindBin(xipt);
606 binet = h2d->GetYaxis()->FindBin(xiet);
619 binpt = h2d->GetXaxis()->FindBin(xipt);
620 binet = h2d->GetYaxis()->FindBin(xiet);
634 binpt = h2d->GetXaxis()->FindBin(xipt);
635 binet = h2d->GetYaxis()->FindBin(xiet);
655 for (TPdigi = TPCollection->begin(); TPdigi != TPCollection->end(); ++TPdigi ) {
659 int iet = TPdigi->id().ieta();
660 int ietindex = (iet>0) ? iet - 1 : 16 +
std::abs(iet);
663 int ipt = TPdigi->id().iphi() + 2;
664 if ( ipt > 72 ) ipt = ipt - 72;
665 int iptindex = ipt - 1;
669 if ( (TPdigi->ttFlag() & 0x3) == 0 )
nEvtLowInterest[iptindex][ietindex]++;
673 if ( (TPdigi->ttFlag() & 0x3) == 3 )
nEvtHighInterest[iptindex][ietindex]++;
677 float xiet = (ietindex < 17) ? ietindex + 0.5 : (16-ietindex) + 0.5;
678 float xipt = iptindex + 0.5;
680 if ( ((TPdigi->ttFlag() & 0x3) == 1 || (TPdigi->ttFlag() & 0x3) == 3)
688 for(
int ietindex = 0; ietindex < 34; ietindex++ ) {
689 for(
int iptindex = 0; iptindex < 72; iptindex++ ) {
693 float xiet = (ietindex < 17) ? ietindex + 0.5 : (16-ietindex) + 0.5;
694 float xipt = iptindex + 0.5;
701 int binet=0, binpt=0;
704 binpt = h2d->GetXaxis()->FindBin(xipt);
705 binet = h2d->GetYaxis()->FindBin(xiet);
718 binpt = h2d->GetXaxis()->FindBin(xipt);
719 binet = h2d->GetYaxis()->FindBin(xiet);
732 binpt = h2d->GetXaxis()->FindBin(xipt);
733 binet = h2d->GetYaxis()->FindBin(xiet);
756 int ieta =
id.ieta();
757 int iphi =
id.iphi();
767 int iet = towid.
ieta();
768 int ietindex = (iet>0) ? iet - 1 : 16 +
std::abs(iet);
771 int ipt = towid.
iphi() + 2;
772 if ( ipt > 72 ) ipt = ipt - 72;
773 int iptindex = ipt - 1;
782 if(srf == srFlagColl.
end()){
786 bool highInterest = ((srf->value() & ~
EcalSrFlag::SRF_FORCED_MASK)
815 for(
int idcc=0; idcc<
nECALDcc; idcc++) {
816 for(
int isc=0; isc<
nDccChs; isc++) {
821 for(
int ietindex = 0; ietindex < 34; ietindex++ ) {
822 for(
int iptindex = 0; iptindex < 72; iptindex++ ) {
831 return xtalId.
tower();
839 throw cms::Exception(
"EBSelectiveReadoutTask") <<
"Crystal does not belong to ECAL";
847 throw cms::Exception(
"EBSelectiveReadoutTask") <<
"Not ECAL barrel.";
855 double ruHeaderPayload = 0.;
856 const int nEEDcc = 18;
857 const int firstEbDcc0 = nEEDcc/2;
858 for (
int iDcc0 = firstEbDcc0; iDcc0 < firstEbDcc0 +
nEBDcc; ++iDcc0 ) {
878 return 9+18*iEtaSM+iPhiSM;
885 const std::vector<int>& firWeights,
888 const int nFIRTaps = 6;
890 const std::vector<int>&
w = firWeights;
894 bool gain12saturated =
false;
895 const int gain12 = 0x01;
898 for(
int i = -1;
i < nFIRTaps - 1; ++
i, ++iWeight){
899 int iSample(
i + firstFIRSample);
900 if(iSample>=0 && iSample < frame.
size()){
902 if(sample.
gainId()!=gain12) gain12saturated =
true;
903 LogTrace(
"DccFir") << (iSample>=firstFIRSample?
"+":
"") << sample.
adc()
904 <<
"*(" << w[iWeight] <<
")";
905 acc+=sample.
adc()*w[iWeight];
908 ": Not enough samples in data frame or 'ecalDccZs1stSample' module "
909 "parameter is not valid...";
916 acc = (acc>=0)?(acc >> 8):-(-acc >> 8);
921 LogTrace(
"DccFir") <<
"acc: " << acc <<
"\n"
922 <<
"saturated: " << (gain12saturated?
"yes":
"no") <<
"\n";
925 *saturated = gain12saturated;
934 const int nFIRTaps = 6;
935 std::vector<int> firWeights(nFIRTaps, 0);
936 const static int maxWeight = 0xEFF;
937 for(
unsigned i=0;
i <
std::min((
size_t)nFIRTaps,normalizedWeights.size()); ++
i){
938 firWeights[
i] = lround(normalizedWeights[
i] * (1<<10));
940 firWeights[
i] = firWeights[
i]<0?-maxWeight:maxWeight;
948 bool notNormalized =
false;
950 for(
unsigned i=0;
i < weightsForZsFIR.size(); ++
i){
951 if(weightsForZsFIR[
i] > 1.) notNormalized =
true;
952 if((
int)weightsForZsFIR[
i]!=weightsForZsFIR[
i]) notInt =
true;
954 if(notInt && notNormalized){
956 <<
"weigtsForZsFIR paramater values are not valid: they "
957 <<
"must either be integer and uses the hardware representation "
958 <<
"of the weights or less or equal than 1 and used the normalized "
959 <<
"representation.";
963 firWeights_ = std::vector<int>(weightsForZsFIR.size());
964 for(
unsigned i = 0;
i< weightsForZsFIR.size(); ++
i){
971 log <<
"Input weights for FIR: ";
972 for(
unsigned i = 0;
i < weightsForZsFIR.size(); ++
i){
973 log << weightsForZsFIR[
i] <<
"\t";
977 log <<
"\nActual FIR weights: ";
980 s2 += firWeights_[
i]*firWeights_[
i];
984 log <<
"\nNormalized FIR weights after hw representation rounding: ";
int nEvtLowInterest[72][34]
To store the events with low interest TT.
MonitorElement * EBTTFlags_
edm::InputTag FEDRawDataCollection_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
int nCryTower[72][34]
To store the readout crystals / tower.
MonitorElement * EBMediumInterestTriggerTowerFlagMap_
static const int bytesPerCrystal
Number of bytes per crystal.
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * EBCompleteZSMap_
static std::vector< int > getFIRWeights(const std::vector< double > &normalizedWeights)
MonitorElement * EBTTFMismatch_
MonitorElement * EBDccEventSizeMap_
void endRun(const edm::Run &r, const edm::EventSetup &c)
EndRun.
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
void rmdir(const std::string &fullpath)
MonitorElement * EBLowInterestZsFIR_
static const int ebTtEdge
Number of crystals along an EB TT.
const self & getMap() const
Some "id" conversions.
MonitorElement * EBFullReadoutSRFlagCount_
static std::string sEB(const unsigned ism)
static const int SRF_FORCED_MASK
double getDccOverhead(subdet_t subdet) const
int nEvtHighInterest[72][34]
To store the events with high interest TT.
std::vector< T >::const_iterator const_iterator
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
std::vector< std::vector< float > > dccNormalizedWeights_
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
MonitorElement * EBDroppedFRMap_
EcalTrigTowerDetId readOutUnitOf(const EBDetId &xtalId) const
int gainId() const
get the gainId (2 bits)
int nEvtZSReadout[72][34]
To store the events with ZS1 or ZS2 readout.
edm::InputTag EcalTrigPrimDigiCollection_
int ieta() const
get the tower ieta
int iPhi2cIndex(int iPhi) const
MonitorElement * EBFullReadoutSRFlagMap_
int nEvtAnyInterest[72][34]
To store the events with any interest.
int iphi() const
get the crystal iphi
MonitorElement * EBLowInterestPayload_
void cleanup(void)
Cleanup.
virtual ~EBSelectiveReadoutTask()
Destructor.
int nEvtFullReadout[72][34]
To store the events with full readout.
static int dccZsFIR(const EcalDataFrame &frame, const std::vector< int > &firWeights, int firstFIRSample, bool *saturated=0)
int nEvtZS1Readout[72][34]
To store the events with ZS1 readout.
MonitorElement * EBDccEventSize_
edm::InputTag EBUnsuppressedDigiCollection_
int nEvtDroppedReadoutIfFR[72][34]
To store the events with 0 channels readout when FR is requested.
uint16_t getStatusCode() const
const T & max(const T &a, const T &b)
MonitorElement * EBCompleteZSCount_
void removeElement(const std::string &name)
MonitorElement * EBHighInterestPayload_
std::vector< int > firWeights_
static const int SRF_FULL
static const int nECALDcc
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
const EcalSRSettings * settings_
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
int ieta() const
get the crystal ieta
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
void beginJob(void)
BeginJob.
double getEbEventSize(double nReadXtals) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
int dccPhiIndexOfRU(int i, int j) const
int nEvtCompleteReadoutIfZS[72][34]
To store the events with complete readout when ZS is requested.
void configFirWeights(std::vector< double > weightsForZsFIR)
const_iterator end() const
MonitorElement * EBHighInterestTriggerTowerFlagMap_
edm::InputTag EBSRFlagCollection_
int iphi() const
get the tower iphi
EBSelectiveReadoutTask(const edm::ParameterSet &ps)
Constructor.
int nEvtRUForced[72][34]
To store the events with RU forced.
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
int nEvtMediumInterest[72][34]
To store the events with medium interest TT.
int dccIndex(int i, int j) const
std::vector< Item >::const_iterator const_iterator
static const int nDccChs
maximum number of RUs read by a DCC
T const * product() const
bool ebRuActive_[nEbEta/ebTtEdge][nEbPhi/ebTtEdge]
int nPerRu_[nECALDcc][nDccChs]
MonitorElement * EBLowInterestTriggerTowerFlagMap_
MonitorElement * EBHighInterestZsFIR_
unsigned dccNum(const DetId &xtalId) const
edm::InputTag EBDigiCollection_
iterator find(key_type k)
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
MonitorElement * EBZeroSuppression1SRFlagMap_
const_iterator find(uint32_t rawId) const
MonitorElement * EBDroppedFRCount_
int nEvtAnyReadout[72][34]
To store the events with any readout.
const_iterator end() const
MonitorElement * EBReadoutUnitForcedBitMap_
static EcalSubdetector subDet(const EBDetId &id)
TH2F * getTH2F(void) const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
MonitorElement * EBEventSize_
Detector det() const
get the detector field from this detid
int ism(int ieta, int iphi)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void Reset(void)
reset ME (ie. contents, errors, etc)
int iEta2cIndex(int iEta) const
tuple size
Write out results.
void setCurrentFolder(const std::string &fullpath)
void anaDigi(const EBDataFrame &frame, const EBSrFlagCollection &srFlagColl, uint16_t statusCode)
MonitorElement * EBTowerSize_
static unsigned iTT(const unsigned ism, const EcalSubdetector subdet, const unsigned i1, const unsigned i2)
int adc() const
get the ADC sample (12 bits)
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")