66 for(
int i=0;
i<2;
i++) {
89 float ZSthreshold = 0.608;
90 float zeroBinSize = ZSthreshold / 20.;
91 for(
int i=0;
i<20;
i++)
ybins[
i] =
i*zeroBinSize;
92 for(
int i=20;
i<133;
i++)
ybins[
i] = ZSthreshold * (
i-19);
118 for(
int ix = 0; ix < 20; ix++ ) {
119 for(
int iy = 0; iy < 20; iy++ ) {
120 for(
int iz = 0; iz < 2; iz++) {
131 for(
int ix = 0; ix < 100; ix++ ) {
132 for(
int iy = 0; iy < 100; iy++ ) {
133 for(
int iz = 0; iz < 2; iz++) {
147 std::vector<double> wsFromDB;
150 int nws = dccs.size();
152 for(std::vector<float>::const_iterator it = dccs[0].
begin(); it != dccs[0].end(); it++) {
153 wsFromDB.push_back(*it);
156 else edm::LogWarning(
"EESelectiveReadoutTask") <<
"DCC weight set is not exactly 1.";
241 name =
"EESRT tower event size EE -";
242 EETowerSize_[0] =
dqmStore_->
bookProfile2D(name, name, 20, 0., 20., 20, 0., 20., 100, 0., 200.,
"s");
246 name =
"EESRT tower event size EE +";
247 EETowerSize_[1] =
dqmStore_->
bookProfile2D(name, name, 20, 0., 20., 20, 0., 20., 100, 0., 200.,
"s");
251 name =
"EESRT TT flag mismatch EE -";
256 name =
"EESRT TT flag mismatch EE +";
261 name =
"EESRT DCC event size";
264 for (
int i = 0;
i < 18;
i++) {
268 name =
"EESRT event size vs DCC";
271 for (
int i = 0;
i < 18;
i++) {
275 name =
"EESRT readout unit with SR forced EE -";
281 name =
"EESRT readout unit with SR forced EE +";
287 name =
"EESRT full readout SR Flags EE -";
293 name =
"EESRT full readout SR Flags EE +";
299 name =
"EESRT full readout SR Flags Number EE -";
303 name =
"EESRT full readout SR Flags Number EE +";
307 name =
"EESRT zero suppression 1 SR Flags EE -";
313 name =
"EESRT zero suppression 1 SR Flags EE +";
319 name =
"EESRT high interest TT Flags EE -";
325 name =
"EESRT high interest TT Flags EE +";
331 name =
"EESRT medium interest TT Flags EE -";
337 name =
"EESRT medium interest TT Flags EE +";
343 name =
"EESRT low interest TT Flags EE -";
349 name =
"EESRT low interest TT Flags EE +";
355 name =
"EESRT TT Flags EE -";
359 name =
"EESRT TT Flags EE +";
363 name =
"EESRT ZS Flagged Fully Readout EE -";
369 name =
"EESRT ZS Flagged Fully Readout EE +";
375 name =
"EESRT ZS Flagged Fully Readout Number EE -";
379 name =
"EESRT ZS Flagged Fully Readout Number EE +";
383 name =
"EESRT FR Flagged Dropped Readout EE -";
389 name =
"EESRT FR Flagged Dropped Readout EE +";
395 name =
"EESRT FR Flagged Dropped Readout Number EE -";
399 name =
"EESRT FR Flagged Dropped Readout Number EE +";
403 name =
"EESRT event size EE -";
407 name =
"EESRT event size EE +";
411 name =
"EESRT high interest payload EE -";
415 name =
"EESRT high interest payload EE +";
419 name =
"EESRT low interest payload EE -";
423 name =
"EESRT low interest payload EE +";
427 name =
"EESRT high interest ZS filter output EE -";
431 name =
"EESRT high interest ZS filter output EE +";
435 name =
"EESRT low interest ZS filter output EE -";
439 name =
"EESRT low interest ZS filter output EE +";
449 if ( !
init_ )
return;
594 for(
int zside=0; zside<2; zside++) {
596 int firstFedOnSide=EEFirstFED[zside];
598 for (
int iDcc = 0; iDcc < 9; ++iDcc ) {
601 if ( zside == 0 ) ism = iDcc+1;
611 edm::LogWarning(
"EESelectiveReadoutTask") <<
"FEDRawDataCollection not available";
615 int nFRO[2], nCompleteZS[2], nDroppedFRO[2];
616 nFRO[0] = nFRO[1] = 0;
617 nCompleteZS[0] = nCompleteZS[1] = 0;
618 nDroppedFRO[0] = nDroppedFRO[1] = 0;
623 double aLowInterest[2];
624 double aHighInterest[2];
625 double aAnyInterest[2];
644 for (
unsigned int digis=0; digis<eeDigis->size(); ++digis) {
649 uint16_t statusCode = 0;
654 anaDigi(eedf, *eeSrFlags, statusCode);
676 for(
int ix = 0; ix < 20; ix++ ) {
677 for(
int iy = 0; iy < 20; iy++ ) {
678 for(
int iz = 0; iz < 2; iz++) {
683 if ( iz == 0 ) xix = 19 - xix;
695 edm::LogWarning(
"EESelectiveReadoutTask") <<
"EEDigiCollection not available";
699 std::map< int, std::vector<short> > towersStatus;
706 towersStatus.insert(std::make_pair(ism, dcchItr->getFEStatus()));
722 int zside =
id.zside();
724 int iz = ( zside < 0 ) ? 0 : 1;
726 if ( zside < 0 ) ix = 21 - ix;
730 int flag = it->value() & ~
EcalSrFlag::SRF_FORCED_MASK;
733 if( towersStatus[ism].
size() > 0 ) status = (towersStatus[
ism])[isc];
738 if(
nPerRu_[iDcc-1][isc] == 0) {
758 edm::LogWarning(
"EESelectiveReadoutTask") <<
"EESRFlagCollection not available";
761 for(
int ix = 0; ix < 20; ix++ ) {
762 for(
int iy = 0; iy < 20; iy++ ) {
763 for(
int iz = 0; iz < 2; iz++) {
768 if ( iz == 0 ) xix = 19 - xix;
781 binx = h2d->GetXaxis()->FindBin(xix);
782 biny = h2d->GetYaxis()->FindBin(xiy);
795 binx = h2d->GetXaxis()->FindBin(xix);
796 biny = h2d->GetYaxis()->FindBin(xiy);
809 binx = h2d->GetXaxis()->FindBin(xix);
810 biny = h2d->GetYaxis()->FindBin(xiy);
823 binx = h2d->GetXaxis()->FindBin(xix);
824 biny = h2d->GetYaxis()->FindBin(xiy);
838 binx = h2d->GetXaxis()->FindBin(xix);
839 biny = h2d->GetYaxis()->FindBin(xiy);
852 for(
int iz = 0; iz < 2; iz++) {
863 for ( TPdigi = TPCollection->begin(); TPdigi != TPCollection->end(); ++TPdigi ) {
868 int zside = TPdigi->id().zside();
869 int iz = ( zside < 0 ) ? 0 : 1;
875 for (
unsigned int i=0;
i<crystals->size();
i++ ) {
885 if ( ismt >= 1 && ismt <= 9 ) ix = 101 - ix;
889 if ( (TPdigi->ttFlag() & 0x3) == 0 )
nEvtLowInterest[ix-1][iy-1][iz]++;
896 if ( iz == 0 ) xix = 100 - xix;
899 if ( ((TPdigi->ttFlag() & 0x3) == 1 || (TPdigi->ttFlag() & 0x3) == 3)
906 edm::LogWarning(
"EESelectiveReadoutTask") <<
"EcalTrigPrimDigiCollection not available";
909 for(
int ix = 0; ix < 100; ix++ ) {
910 for(
int iy = 0; iy < 100; iy++ ) {
911 for(
int iz = 0; iz < 2; iz++) {
916 if ( iz == 0 ) xix = 99 - xix;
929 binx = h2d->GetXaxis()->FindBin(xix);
930 biny = h2d->GetYaxis()->FindBin(xiy);
943 binx = h2d->GetXaxis()->FindBin(xix);
944 biny = h2d->GetYaxis()->FindBin(xiy);
957 binx = h2d->GetXaxis()->FindBin(xix);
958 biny = h2d->GetYaxis()->FindBin(xiy);
980 if ( ism >= 1 && ism <= 9 ) {
991 int iZ0 =
id.zside()>0?1:0;
1000 if(srf == srFlagColl.
end()){
1004 int ttix = srf->id().ix();
1005 int ttiy = srf->id().iy();
1007 int zside = srf->id().zside();
1009 int ttiz = ( zside < 0 ) ? 0 : 1;
1011 nCrySC[ttix-1][ttiy-1][ttiz]++;
1017 bool highInterest = ((srf->value() & ~
EcalSrFlag::SRF_FORCED_MASK)
1022 if ( ism >= 1 && ism <= 9 ) {
1059 for(
int idcc=0; idcc<
nECALDcc; idcc++) {
1060 for(
int isc=0; isc<
nDccChs; isc++) {
1065 for(
int iz = 0; iz<2; iz++) {
1066 for(
int ix = 0; ix < 20; ix++ ) {
1067 for(
int iy = 0; iy < 20; iy++ ) {
1073 for (
int itcc = 0; itcc < 108; itcc++) {
1074 for (
int itt = 0; itt < 41; itt++)
nCryTT[itcc][itt] = 0;
1081 if (xtalId.
ix() > 40 && xtalId.
ix() < 61 &&
1082 xtalId.
iy() > 40 && xtalId.
iy() < 61) {
1095 throw cms::Exception(
"EESelectiveReadoutTask") <<
"Crystal does not belong to ECAL";
1104 int zside = eeDetId.
zside();
1105 if ( zside < 0 ) iDet = 0;
1108 throw cms::Exception(
"EESelectiveReadoutTask") <<
"Not ECAL endcap.";
1111 assert(iDcc0>=0 && iDcc0<
nECALDcc);
1120 throw cms::Exception(
"EESelectiveReadoutTask") <<
"SuperCrystal does not belong to ECAL";
1128 int zside = scId.
zside();
1129 if ( zside < 0 ) iDet = 0;
1132 throw cms::Exception(
"EESelectiveReadoutTask") <<
"Not ECAL endcap.";
1136 if(iPhi<0) iDcc0 = -1;
1137 else iDcc0 = iPhi+iDet/2*45;
1138 assert(iDcc0>=0 && iDcc0<
nECALDcc);
1143 double ruHeaderPayload = 0.;
1144 const int firstEbDcc0 =
nEEDcc/2;
1145 for (
int iDcc0 = 0; iDcc0 <
nECALDcc; ++iDcc0 ) {
1147 if(iDcc0 == firstEbDcc0) iDcc0 +=
nEBDcc;
1157 return (flag==
' ')?-1:(flag-
'0');
1162 if(iPhi<0)
return -1;
1165 return iPhi+iDet/2*45;
1172 const std::vector<int>& firWeights,
1175 const int nFIRTaps = 6;
1177 const std::vector<int>&
w = firWeights;
1181 bool gain12saturated =
false;
1182 const int gain12 = 0x01;
1185 for(
int i = -1;
i < nFIRTaps - 1; ++
i, ++iWeight){
1186 int iSample(firstFIRSample +
i);
1187 if(iSample>=0 && iSample < frame.
size()){
1189 if(sample.
gainId()!=gain12) gain12saturated =
true;
1190 LogTrace(
"DccFir") << (iSample>=firstFIRSample?
"+":
"") << sample.
adc()
1191 <<
"*(" << w[iWeight] <<
")";
1192 acc+=sample.
adc()*w[iWeight];
1195 ": Not enough samples in data frame or 'ecalDccZs1stSample' module "
1196 "parameter is not valid...";
1203 acc = (acc>=0)?(acc >> 8):-(-acc >> 8);
1208 LogTrace(
"DccFir") <<
"acc: " << acc <<
"\n"
1209 <<
"saturated: " << (gain12saturated?
"yes":
"no") <<
"\n";
1212 *saturated = gain12saturated;
1221 const int nFIRTaps = 6;
1222 std::vector<int> firWeights(nFIRTaps, 0);
1223 const static int maxWeight = 0xEFF;
1224 for(
unsigned i=0;
i <
std::min((
size_t)nFIRTaps,normalizedWeights.size()); ++
i){
1225 firWeights[
i] = lround(normalizedWeights[
i] * (1<<10));
1227 firWeights[
i] = firWeights[
i]<0?-maxWeight:maxWeight;
1235 bool notNormalized =
false;
1236 bool notInt =
false;
1237 for(
unsigned i=0;
i < weightsForZsFIR.size(); ++
i){
1238 if(weightsForZsFIR[
i] > 1.) notNormalized =
true;
1239 if((
int)weightsForZsFIR[
i]!=weightsForZsFIR[
i]) notInt =
true;
1241 if(notInt && notNormalized){
1243 <<
"weigtsForZsFIR paramater values are not valid: they "
1244 <<
"must either be integer and uses the hardware representation "
1245 <<
"of the weights or less or equal than 1 and used the normalized "
1246 <<
"representation.";
1250 firWeights_ = std::vector<int>(weightsForZsFIR.size());
1251 for(
unsigned i = 0;
i< weightsForZsFIR.size(); ++
i){
1258 log <<
"Input weights for FIR: ";
1259 for(
unsigned i = 0;
i < weightsForZsFIR.size(); ++
i){
1260 log << weightsForZsFIR[
i] <<
"\t";
1264 log <<
"\nActual FIR weights: ";
1267 s2 += firWeights_[
i]*firWeights_[
i];
1271 log <<
"\nNormalized FIR weights after hw representation rounding: ";
1280 if(iDcc<1 || iDcc>54) {
1283 }
else if (10 <= iDcc && iDcc <= 45) {
1292 iDccPhi = iDcc - 45;
1294 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 configFirWeights(const std::vector< double > &weightsForZsFIR)
void rmdir(const std::string &fullpath)
MonitorElement * EETowerSize_[2]
edm::EDGetTokenT< EESrFlagCollection > EESRFlagCollection_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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< EcalDCCHeaderBlock >::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
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
Abs< T >::type abs(const T &t)
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]
edm::EDGetTokenT< EcalTrigPrimDigiCollection > EcalTrigPrimDigiCollection_
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) ...
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.
edm::EDGetTokenT< FEDRawDataCollection > FEDRawDataCollection_
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
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_
iterator find(key_type k)
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)
edm::EDGetTokenT< EEDigiCollection > EEDigiCollection_
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")