71 for(
int i=0;
i<2;
i++) {
94 float ZSthreshold = 0.608;
95 float zeroBinSize = ZSthreshold / 20.;
96 for(
int i=0;
i<20;
i++)
ybins[
i] =
i*zeroBinSize;
97 for(
int i=20;
i<133;
i++)
ybins[
i] = ZSthreshold * (
i-19);
123 for(
int ix = 0; ix < 20; ix++ ) {
124 for(
int iy = 0; iy < 20; iy++ ) {
125 for(
int iz = 0; iz < 2; iz++) {
136 for(
int ix = 0; ix < 100; ix++ ) {
137 for(
int iy = 0; iy < 100; iy++ ) {
138 for(
int iz = 0; iz < 2; iz++) {
152 std::vector<double> wsFromDB;
155 int nws = dccs.size();
157 for(std::vector<float>::const_iterator it = dccs[0].
begin(); it != dccs[0].end(); it++) {
158 wsFromDB.push_back(*it);
161 else edm::LogWarning(
"EESelectiveReadoutTask") <<
"DCC weight set is not exactly 1.";
246 name =
"EESRT tower event size EE -";
247 EETowerSize_[0] =
dqmStore_->
bookProfile2D(name, name, 20, 0., 20., 20, 0., 20., 100, 0., 200.,
"s");
251 name =
"EESRT tower event size EE +";
252 EETowerSize_[1] =
dqmStore_->
bookProfile2D(name, name, 20, 0., 20., 20, 0., 20., 100, 0., 200.,
"s");
256 name =
"EESRT TT flag mismatch EE -";
261 name =
"EESRT TT flag mismatch EE +";
266 name =
"EESRT DCC event size";
269 for (
int i = 0;
i < 18;
i++) {
273 name =
"EESRT event size vs DCC";
276 for (
int i = 0;
i < 18;
i++) {
280 name =
"EESRT readout unit with SR forced EE -";
286 name =
"EESRT readout unit with SR forced EE +";
292 name =
"EESRT full readout SR Flags EE -";
298 name =
"EESRT full readout SR Flags EE +";
304 name =
"EESRT full readout SR Flags Number EE -";
308 name =
"EESRT full readout SR Flags Number EE +";
312 name =
"EESRT zero suppression 1 SR Flags EE -";
318 name =
"EESRT zero suppression 1 SR Flags EE +";
324 name =
"EESRT high interest TT Flags EE -";
330 name =
"EESRT high interest TT Flags EE +";
336 name =
"EESRT medium interest TT Flags EE -";
342 name =
"EESRT medium interest TT Flags EE +";
348 name =
"EESRT low interest TT Flags EE -";
354 name =
"EESRT low interest TT Flags EE +";
360 name =
"EESRT TT Flags EE -";
364 name =
"EESRT TT Flags EE +";
368 name =
"EESRT ZS Flagged Fully Readout EE -";
374 name =
"EESRT ZS Flagged Fully Readout EE +";
380 name =
"EESRT ZS Flagged Fully Readout Number EE -";
384 name =
"EESRT ZS Flagged Fully Readout Number EE +";
388 name =
"EESRT FR Flagged Dropped Readout EE -";
394 name =
"EESRT FR Flagged Dropped Readout EE +";
400 name =
"EESRT FR Flagged Dropped Readout Number EE -";
404 name =
"EESRT FR Flagged Dropped Readout Number EE +";
408 name =
"EESRT event size EE -";
412 name =
"EESRT event size EE +";
416 name =
"EESRT high interest payload EE -";
420 name =
"EESRT high interest payload EE +";
424 name =
"EESRT low interest payload EE -";
428 name =
"EESRT low interest payload EE +";
432 name =
"EESRT high interest ZS filter output EE -";
436 name =
"EESRT high interest ZS filter output EE +";
440 name =
"EESRT low interest ZS filter output EE -";
444 name =
"EESRT low interest ZS filter output EE +";
454 if ( !
init_ )
return;
599 for(
int zside=0; zside<2; zside++) {
601 int firstFedOnSide=EEFirstFED[zside];
603 for (
int iDcc = 0; iDcc < 9; ++iDcc ) {
606 if ( zside == 0 ) ism = iDcc+1;
620 int nFRO[2], nCompleteZS[2], nDroppedFRO[2];
621 nFRO[0] = nFRO[1] = 0;
622 nCompleteZS[0] = nCompleteZS[1] = 0;
623 nDroppedFRO[0] = nDroppedFRO[1] = 0;
628 double aLowInterest[2];
629 double aHighInterest[2];
630 double aAnyInterest[2];
649 for (
unsigned int digis=0; digis<eeDigis->size(); ++digis) {
654 uint16_t statusCode = 0;
659 anaDigi(eedf, *eeSrFlags, statusCode);
681 for(
int ix = 0; ix < 20; ix++ ) {
682 for(
int iy = 0; iy < 20; iy++ ) {
683 for(
int iz = 0; iz < 2; iz++) {
688 if ( iz == 0 ) xix = 19 - xix;
704 std::map< int, std::vector<short> > towersStatus;
711 towersStatus.insert(std::make_pair(ism, dcchItr->getFEStatus()));
727 int zside =
id.zside();
729 int iz = ( zside < 0 ) ? 0 : 1;
731 if ( zside < 0 ) ix = 21 - ix;
738 if( towersStatus[ism].
size() > 0 ) status = (towersStatus[
ism])[isc];
743 if(
nPerRu_[iDcc-1][isc] == 0) {
766 for(
int ix = 0; ix < 20; ix++ ) {
767 for(
int iy = 0; iy < 20; iy++ ) {
768 for(
int iz = 0; iz < 2; iz++) {
773 if ( iz == 0 ) xix = 19 - xix;
786 binx = h2d->GetXaxis()->FindBin(xix);
787 biny = h2d->GetYaxis()->FindBin(xiy);
800 binx = h2d->GetXaxis()->FindBin(xix);
801 biny = h2d->GetYaxis()->FindBin(xiy);
814 binx = h2d->GetXaxis()->FindBin(xix);
815 biny = h2d->GetYaxis()->FindBin(xiy);
828 binx = h2d->GetXaxis()->FindBin(xix);
829 biny = h2d->GetYaxis()->FindBin(xiy);
843 binx = h2d->GetXaxis()->FindBin(xix);
844 biny = h2d->GetYaxis()->FindBin(xiy);
857 for(
int iz = 0; iz < 2; iz++) {
868 for ( TPdigi = TPCollection->begin(); TPdigi != TPCollection->end(); ++TPdigi ) {
873 int zside = TPdigi->id().zside();
874 int iz = ( zside < 0 ) ? 0 : 1;
880 for (
unsigned int i=0;
i<crystals->size();
i++ ) {
890 if ( ismt >= 1 && ismt <= 9 ) ix = 101 - ix;
894 if ( (TPdigi->ttFlag() & 0x3) == 0 )
nEvtLowInterest[ix-1][iy-1][iz]++;
901 if ( iz == 0 ) xix = 100 - xix;
904 if ( ((TPdigi->ttFlag() & 0x3) == 1 || (TPdigi->ttFlag() & 0x3) == 3)
914 for(
int ix = 0; ix < 100; ix++ ) {
915 for(
int iy = 0; iy < 100; iy++ ) {
916 for(
int iz = 0; iz < 2; iz++) {
921 if ( iz == 0 ) xix = 99 - xix;
934 binx = h2d->GetXaxis()->FindBin(xix);
935 biny = h2d->GetYaxis()->FindBin(xiy);
948 binx = h2d->GetXaxis()->FindBin(xix);
949 biny = h2d->GetYaxis()->FindBin(xiy);
962 binx = h2d->GetXaxis()->FindBin(xix);
963 biny = h2d->GetYaxis()->FindBin(xiy);
985 if ( ism >= 1 && ism <= 9 ) {
996 int iZ0 =
id.zside()>0?1:0;
1005 if(srf == srFlagColl.
end()){
1009 int ttix = srf->id().ix();
1010 int ttiy = srf->id().iy();
1012 int zside = srf->id().zside();
1014 int ttiz = ( zside < 0 ) ? 0 : 1;
1016 nCrySC[ttix-1][ttiy-1][ttiz]++;
1022 bool highInterest = ((srf->value() & ~
EcalSrFlag::SRF_FORCED_MASK)
1027 if ( ism >= 1 && ism <= 9 ) {
1064 for(
int idcc=0; idcc<
nECALDcc; idcc++) {
1065 for(
int isc=0; isc<
nDccChs; isc++) {
1070 for(
int iz = 0; iz<2; iz++) {
1071 for(
int ix = 0; ix < 20; ix++ ) {
1072 for(
int iy = 0; iy < 20; iy++ ) {
1078 for (
int itcc = 0; itcc < 108; itcc++) {
1079 for (
int itt = 0; itt < 41; itt++)
nCryTT[itcc][itt] = 0;
1086 if (xtalId.
ix() > 40 && xtalId.
ix() < 61 &&
1087 xtalId.
iy() > 40 && xtalId.
iy() < 61) {
1100 throw cms::Exception(
"EESelectiveReadoutTask") <<
"Crystal does not belong to ECAL";
1109 int zside = eeDetId.
zside();
1110 if ( zside < 0 ) iDet = 0;
1113 throw cms::Exception(
"EESelectiveReadoutTask") <<
"Not ECAL endcap.";
1116 assert(iDcc0>=0 && iDcc0<
nECALDcc);
1125 throw cms::Exception(
"EESelectiveReadoutTask") <<
"SuperCrystal does not belong to ECAL";
1133 int zside = scId.
zside();
1134 if ( zside < 0 ) iDet = 0;
1137 throw cms::Exception(
"EESelectiveReadoutTask") <<
"Not ECAL endcap.";
1141 if(iPhi<0) iDcc0 = -1;
1142 else iDcc0 = iPhi+iDet/2*45;
1143 assert(iDcc0>=0 && iDcc0<
nECALDcc);
1148 double ruHeaderPayload = 0.;
1149 const int firstEbDcc0 =
nEEDcc/2;
1150 for (
int iDcc0 = 0; iDcc0 <
nECALDcc; ++iDcc0 ) {
1152 if(iDcc0 == firstEbDcc0) iDcc0 +=
nEBDcc;
1162 return (flag==
' ')?-1:(flag-
'0');
1167 if(iPhi<0)
return -1;
1170 return iPhi+iDet/2*45;
1177 const std::vector<int>& firWeights,
1180 const int nFIRTaps = 6;
1182 const std::vector<int>&
w = firWeights;
1186 bool gain12saturated =
false;
1187 const int gain12 = 0x01;
1190 for(
int i = -1;
i < nFIRTaps - 1; ++
i, ++iWeight){
1191 int iSample(firstFIRSample +
i);
1192 if(iSample>=0 && iSample < frame.
size()){
1194 if(sample.
gainId()!=gain12) gain12saturated =
true;
1195 LogTrace(
"DccFir") << (iSample>=firstFIRSample?
"+":
"") << sample.
adc()
1196 <<
"*(" << w[iWeight] <<
")";
1197 acc+=sample.
adc()*w[iWeight];
1200 ": Not enough samples in data frame or 'ecalDccZs1stSample' module "
1201 "parameter is not valid...";
1208 acc = (acc>=0)?(acc >> 8):-(-acc >> 8);
1213 LogTrace(
"DccFir") <<
"acc: " << acc <<
"\n"
1214 <<
"saturated: " << (gain12saturated?
"yes":
"no") <<
"\n";
1217 *saturated = gain12saturated;
1226 const int nFIRTaps = 6;
1227 std::vector<int> firWeights(nFIRTaps, 0);
1228 const static int maxWeight = 0xEFF;
1229 for(
unsigned i=0;
i <
std::min((
size_t)nFIRTaps,normalizedWeights.size()); ++
i){
1230 firWeights[
i] = lround(normalizedWeights[
i] * (1<<10));
1232 firWeights[
i] = firWeights[
i]<0?-maxWeight:maxWeight;
1240 bool notNormalized =
false;
1241 bool notInt =
false;
1242 for(
unsigned i=0;
i < weightsForZsFIR.size(); ++
i){
1243 if(weightsForZsFIR[
i] > 1.) notNormalized =
true;
1244 if((
int)weightsForZsFIR[
i]!=weightsForZsFIR[
i]) notInt =
true;
1246 if(notInt && notNormalized){
1248 <<
"weigtsForZsFIR paramater values are not valid: they "
1249 <<
"must either be integer and uses the hardware representation "
1250 <<
"of the weights or less or equal than 1 and used the normalized "
1251 <<
"representation.";
1255 firWeights_ = std::vector<int>(weightsForZsFIR.size());
1256 for(
unsigned i = 0;
i< weightsForZsFIR.size(); ++
i){
1263 log <<
"Input weights for FIR: ";
1264 for(
unsigned i = 0;
i < weightsForZsFIR.size(); ++
i){
1265 log << weightsForZsFIR[
i] <<
"\t";
1269 log <<
"\nActual FIR weights: ";
1272 s2 += firWeights_[
i]*firWeights_[
i];
1276 log <<
"\nNormalized FIR weights after hw representation rounding: ";
1285 if(iDcc<1 || iDcc>54) {
1288 }
else if (10 <= iDcc && iDcc <= 45) {
1297 iDccPhi = iDcc - 45;
1299 switch(iDccPhi*100+iDccCh){
int nEvtFullReadout[20][20][2]
To store the events with full readout.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
static std::string sEE(const unsigned ism)
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * EEFullReadoutSRFlagCount_[2]
EESelectiveReadoutTask(const edm::ParameterSet &ps)
Constructor.
MonitorElement * EEReadoutUnitForcedBitMap_[2]
double getDccOverhead(subdet_t subdet) const
MonitorElement * EELowInterestZsFIR_[2]
MonitorElement * EEDroppedFRCount_[2]
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
void rmdir(const std::string &fullpath)
MonitorElement * EETowerSize_[2]
void configFirWeights(std::vector< double > weightsForZsFIR)
const self & getMap() const
Some "id" conversions.
static const int SRF_FORCED_MASK
static const int nECALDcc
Constants.
int nEvtZSReadout[20][20][2]
To store the events with ZS1 or ZS2 readout.
std::vector< T >::const_iterator const_iterator
int getCrystalCount(int iDcc, int iDccCh)
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_
MonitorElement * EEZeroSuppression1SRFlagMap_[2]
MonitorElement * EEHighInterestZsFIR_[2]
int nEvtAnyInterest[100][100][2]
To store the events with any interest.
int nEvtDroppedReadoutIfFR[20][20][2]
To store the events with 0 channels readout when FR is requested.
int gainId() const
get the gainId (2 bits)
static const int nDccChs
maximum number of RUs read by a DCC
virtual ~EESelectiveReadoutTask()
Destructor.
MonitorElement * EECompleteZSMap_[2]
int nEvtCompleteReadoutIfZS[20][20][2]
To store the events with complete readout when ZS is requested.
static const char endcapDccMap[401]
MonitorElement * EETTFMismatch_[2]
int nPerRu_[nECALDcc][nDccChs]
MonitorElement * EEEventSize_[2]
int nEvtLowInterest[100][100][2]
To store the events with low interest TT.
int dccIndex(int iDet, int i, int j) const
void cleanup(void)
Cleanup.
static std::vector< DetId > * crystals(const EcalTrigTowerDetId &id)
MonitorElement * EEHighInterestPayload_[2]
MonitorElement * EEHighInterestTriggerTowerFlagMap_[2]
uint16_t getStatusCode() const
double getEeEventSize(double nReadXtals) const
edm::InputTag FEDRawDataCollection_
MonitorElement * EEDccEventSize_
int iXY2cIndex(int iX) const
static unsigned iTCC(const unsigned ism, const EcalSubdetector subdet, const unsigned i1, const unsigned i2)
const T & max(const T &a, const T &b)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
static unsigned iSC(const EcalScDetId &id)
void removeElement(const std::string &name)
static const int SRF_FULL
edm::InputTag EcalTrigPrimDigiCollection_
MonitorElement * EEDccEventSizeMap_
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
bool eeRuActive_[nEndcaps][nEeX/scEdge][nEeY/scEdge]
std::string getName(Reflex::Type &cc)
void anaDigi(const EEDataFrame &frame, const EESrFlagCollection &srFlagColl, uint16_t statusCode)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
void endRun(const edm::Run &r, const edm::EventSetup &c)
EndRun.
int nEvtRUForced[20][20][2]
To store the events with RU forced.
const_iterator end() const
MonitorElement * EETTFlags_[2]
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
int dccPhiIndexOfRU(int i, int j) const
std::vector< Item >::const_iterator const_iterator
T const * product() const
edm::InputTag EEDigiCollection_
unsigned dccNum(const DetId &xtalId) const
int nEvtMediumInterest[100][100][2]
To store the events with medium interest TT.
void beginJob(void)
BeginJob.
int nEvtZS1Readout[20][20][2]
To store the events with ZS1 readout.
int nEvtHighInterest[100][100][2]
To store the events with high interest TT.
int nCrySC[20][20][2]
To store the readout crystals / SC.
const EcalSRSettings * settings_
unsigned dccNumOfRU(const EcalScDetId &scId) const
std::vector< int > firWeights_
edm::InputTag EEUnsuppressedDigiCollection_
iterator find(key_type k)
edm::InputTag EESRFlagCollection_
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
MonitorElement * EECompleteZSCount_[2]
const_iterator find(uint32_t rawId) const
MonitorElement * EEDroppedFRMap_[2]
const_iterator end() const
static std::vector< int > getFIRWeights(const std::vector< double > &normalizedWeights)
static const EcalScDetId getEcalScDetId(const EEDetId &id)
int nEvtAnyReadout[20][20][2]
To store the events with any readout.
MonitorElement * EELowInterestPayload_[2]
static EcalSubdetector subDet(const EBDetId &id)
const EcalScDetId readOutUnitOf(const EEDetId &xtalId) const
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.
Detector det() const
get the detector field from this detid
MonitorElement * EELowInterestTriggerTowerFlagMap_[2]
static const int scEdge
Number of crystals along a supercrystal edge.
int ism(int ieta, int iphi)
int dccPhiIndex(int i, int j) const
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)
static const int bytesPerCrystal
Number of bytes per crystal.
MonitorElement * EEMediumInterestTriggerTowerFlagMap_[2]
tuple size
Write out results.
static int dccZsFIR(const EcalDataFrame &frame, const std::vector< int > &firWeights, int firstFIRSample, bool *saturated=0)
void setCurrentFolder(const std::string &fullpath)
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 * EEFullReadoutSRFlagMap_[2]
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")