CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes

EBSelectiveReadoutTask Class Reference

#include <EBSelectiveReadoutTask.h>

Inheritance diagram for EBSelectiveReadoutTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

 EBSelectiveReadoutTask (const edm::ParameterSet &ps)
 Constructor.
virtual ~EBSelectiveReadoutTask ()
 Destructor.

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze.
void beginJob (void)
 BeginJob.
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun.
void cleanup (void)
 Cleanup.
void endJob (void)
 EndJob.
void endRun (const edm::Run &r, const edm::EventSetup &c)
 EndRun.
void reset (void)
 Reset.
void setup (void)
 Setup.

Protected Attributes

int nCryTower [72][34]
 To store the readout crystals / tower.
int nEvtAnyInterest [72][34]
 To store the events with any interest.
int nEvtAnyReadout [72][34]
 To store the events with any readout.
int nEvtCompleteReadoutIfZS [72][34]
 To store the events with complete readout when ZS is requested.
int nEvtDroppedReadoutIfFR [72][34]
 To store the events with 0 channels readout when FR is requested.
int nEvtFullReadout [72][34]
 To store the events with full readout.
int nEvtHighInterest [72][34]
 To store the events with high interest TT.
int nEvtLowInterest [72][34]
 To store the events with low interest TT.
int nEvtMediumInterest [72][34]
 To store the events with medium interest TT.
int nEvtRUForced [72][34]
 To store the events with RU forced.
int nEvtZS1Readout [72][34]
 To store the events with ZS1 readout.
int nEvtZSReadout [72][34]
 To store the events with ZS1 or ZS2 readout.

Static Protected Attributes

static const int bytesPerCrystal = 24
 Number of bytes per crystal.
static const int ebTtEdge = 5
 Number of crystals along an EB TT.
static const int kByte = 1024
static const int nDccChs = 68
 maximum number of RUs read by a DCC
static const int nEBDcc = 36
static const int nEbEta = 170
 number of crystals along Eta in EB
static const int nEbPhi = 360
 number of crystals along Phi in EB
static const int nEbRus = 36*68
 number of RUs for EB
static const int nECALDcc = 54
static const int nTtEta = 56
 Number of Trigger Towers along Eta.
static const int nTTEta = 34
 Constants.
static const int nTtPhi = 72
 Number of Trigger Towers along Phi.
static const int nTTPhi = 72
static const int scEdge = 5
 Number of crystals along a supercrystal edge.

Private Types

enum  subdet_t { EB, EE }
 

distinguishes barral and endcap of ECAL.

More...

Private Member Functions

void anaDigi (const EBDataFrame &frame, const EBSrFlagCollection &srFlagColl, uint16_t statusCode)
void anaDigiInit ()
int cIndex2iEta (int i) const
int cIndex2iPhi (int i) const
int cIndex2iXY (int iX0) const
void configFirWeights (std::vector< double > weightsForZsFIR)
int dccIndex (int i, int j) const
unsigned dccNum (const DetId &xtalId) const
int dccPhiIndex (int i, int j) const
int dccPhiIndexOfRU (int i, int j) const
int getCrystalCount ()
double getDccEventSize (int iDcc0, double nReadXtals) const
double getDccOverhead (subdet_t subdet) const
double getEbEventSize (double nReadXtals) const
int iEta2cIndex (int iEta) const
int iPhi2cIndex (int iPhi) const
int iXY2cIndex (int iX) const
EcalTrigTowerDetId readOutUnitOf (const EBDetId &xtalId) const

Static Private Member Functions

static int dccZsFIR (const EcalDataFrame &frame, const std::vector< int > &firWeights, int firstFIRSample, bool *saturated=0)
static std::vector< int > getFIRWeights (const std::vector< double > &normalizedWeights)

Private Attributes

DQMStoredqmStore_
MonitorElementEBCompleteZSCount_
MonitorElementEBCompleteZSMap_
MonitorElementEBDccEventSize_
MonitorElementEBDccEventSizeMap_
edm::InputTag EBDigiCollection_
MonitorElementEBDroppedFRCount_
MonitorElementEBDroppedFRMap_
MonitorElementEBEventSize_
MonitorElementEBFullReadoutSRFlagCount_
MonitorElementEBFullReadoutSRFlagMap_
MonitorElementEBHighInterestPayload_
MonitorElementEBHighInterestTriggerTowerFlagMap_
MonitorElementEBHighInterestZsFIR_
MonitorElementEBLowInterestPayload_
MonitorElementEBLowInterestTriggerTowerFlagMap_
MonitorElementEBLowInterestZsFIR_
MonitorElementEBMediumInterestTriggerTowerFlagMap_
MonitorElementEBReadoutUnitForcedBitMap_
bool ebRuActive_ [nEbEta/ebTtEdge][nEbPhi/ebTtEdge]
edm::InputTag EBSRFlagCollection_
MonitorElementEBTowerSize_
MonitorElementEBTTFlags_
MonitorElementEBTTFMismatch_
edm::InputTag EBUnsuppressedDigiCollection_
MonitorElementEBZeroSuppression1SRFlagMap_
edm::InputTag EcalRecHitCollection_
edm::InputTag EcalTrigPrimDigiCollection_
bool enableCleanup_
edm::InputTag FEDRawDataCollection_
int firstFIRSample_
std::vector< int > firWeights_
int ievt_
bool init_
bool mergeRuns_
int nEb_
int nEbHI_
int nEbLI_
int nPerDcc_ [nECALDcc]
int nPerRu_ [nECALDcc][nDccChs]
int nRuPerDcc_ [nECALDcc]
std::string prefixME_
float xbins [37]
float ybins [89]

Detailed Description

Definition at line 21 of file EBSelectiveReadoutTask.h.


Member Enumeration Documentation

distinguishes barral and endcap of ECAL.

Enumerator:
EB 
EE 

Definition at line 130 of file EBSelectiveReadoutTask.h.

{EB, EE};

Constructor & Destructor Documentation

EBSelectiveReadoutTask::EBSelectiveReadoutTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 39 of file EBSelectiveReadoutTask.cc.

References configFirWeights(), dqmStore_, EBCompleteZSCount_, EBCompleteZSMap_, EBDccEventSize_, EBDccEventSizeMap_, EBDigiCollection_, EBDroppedFRCount_, EBDroppedFRMap_, EBEventSize_, EBFullReadoutSRFlagCount_, EBFullReadoutSRFlagMap_, EBHighInterestPayload_, EBHighInterestTriggerTowerFlagMap_, EBHighInterestZsFIR_, EBLowInterestPayload_, EBLowInterestTriggerTowerFlagMap_, EBLowInterestZsFIR_, EBMediumInterestTriggerTowerFlagMap_, EBReadoutUnitForcedBitMap_, EBSRFlagCollection_, EBTowerSize_, EBTTFlags_, EBTTFMismatch_, EBUnsuppressedDigiCollection_, EBZeroSuppression1SRFlagMap_, EcalTrigPrimDigiCollection_, enableCleanup_, FEDRawDataCollection_, firstFIRSample_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, init_, mergeRuns_, cmsCodeRules::cppFunctionSkipper::operator, prefixME_, xbins, and ybins.

                                                                       {

  init_ = false;

  dqmStore_ = edm::Service<DQMStore>().operator->();

  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");

  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);

  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);

  // parameters...
  EBDigiCollection_ = ps.getParameter<edm::InputTag>("EBDigiCollection");
  EBUnsuppressedDigiCollection_ = ps.getParameter<edm::InputTag>("EBUsuppressedDigiCollection");
  EBSRFlagCollection_ = ps.getParameter<edm::InputTag>("EBSRFlagCollection");
  EcalTrigPrimDigiCollection_ = ps.getParameter<edm::InputTag>("EcalTrigPrimDigiCollection");
  FEDRawDataCollection_ = ps.getParameter<edm::InputTag>("FEDRawDataCollection");
  firstFIRSample_ = ps.getParameter<int>("ecalDccZs1stSample");

  configFirWeights(ps.getParameter<std::vector<double> >("dccWeights"));

  // histograms...
  EBTowerSize_ = 0;
  EBTTFMismatch_ = 0;
  EBDccEventSize_ = 0;
  EBDccEventSizeMap_ = 0;
  EBReadoutUnitForcedBitMap_ = 0;
  EBFullReadoutSRFlagMap_ = 0;
  EBFullReadoutSRFlagCount_ = 0;
  EBZeroSuppression1SRFlagMap_ = 0;
  EBHighInterestTriggerTowerFlagMap_ = 0;
  EBMediumInterestTriggerTowerFlagMap_ = 0;
  EBLowInterestTriggerTowerFlagMap_ = 0;
  EBTTFlags_ = 0;
  EBCompleteZSMap_ = 0;
  EBCompleteZSCount_ = 0;
  EBDroppedFRMap_ = 0;
  EBDroppedFRCount_ = 0;
  EBEventSize_ = 0;
  EBHighInterestPayload_ = 0;
  EBLowInterestPayload_ = 0;
  EBHighInterestZsFIR_ = 0;
  EBLowInterestZsFIR_ = 0;

  // initialize variable binning for DCC size...
  float ZSthreshold = 0.608; // kBytes of 1 TT fully readout
  float zeroBinSize = ZSthreshold / 20.;
  for(int i=0; i<20; i++) ybins[i] = i*zeroBinSize;
  for(int i=20; i<89; i++) ybins[i] = ZSthreshold * (i-19);
  for(int i=0; i<=36; i++) xbins[i] = i+1;

}
EBSelectiveReadoutTask::~EBSelectiveReadoutTask ( ) [virtual]

Destructor.

Definition at line 93 of file EBSelectiveReadoutTask.cc.

                                                {

}

Member Function Documentation

void EBSelectiveReadoutTask::anaDigi ( const EBDataFrame frame,
const EBSrFlagCollection srFlagColl,
uint16_t  statusCode 
) [private]

Accumulates statitics for data volume analysis. To be called for each ECAL digi. See anaDigiInit().

Definition at line 720 of file EBSelectiveReadoutTask.cc.

References abs, Reference_intrackfit_cff::barrel, dccNum(), dccZsFIR(), EBHighInterestZsFIR_, EBLowInterestZsFIR_, ebRuActive_, ebTtEdge, EcalBarrel, edm::SortedCollection< T, SORT >::end(), MonitorElement::Fill(), edm::SortedCollection< T, SORT >::find(), firstFIRSample_, firWeights_, EBDataFrame::id(), EcalTrigTowerDetId::ieta(), iEta2cIndex(), EcalTrigTowerDetId::iphi(), iPhi2cIndex(), Numbers::iSM(), ecalpyutils::ism(), Numbers::iTT(), nCryTower, nEb_, nEbHI_, nEbLI_, nPerDcc_, nPerRu_, nRuPerDcc_, readOutUnitOf(), and EcalSrFlag::SRF_FULL.

Referenced by analyze().

                                                                                                                       {

  EBDetId id = frame.id();

  bool barrel = (id.subdetId()==EcalBarrel);

  if(barrel){
    ++nEb_;

    int ieta = id.ieta();
    int iphi = id.iphi();

    int iEta0 = iEta2cIndex(ieta);
    int iPhi0 = iPhi2cIndex(iphi);
    if(!ebRuActive_[iEta0/ebTtEdge][iPhi0/ebTtEdge]){
      ++nRuPerDcc_[dccNum(id)-1];
      ebRuActive_[iEta0/ebTtEdge][iPhi0/ebTtEdge] = true;
    }

    EcalTrigTowerDetId towid = id.tower();
    int iet = towid.ieta();
    int ietindex = (iet>0) ? iet - 1 : 16 + std::abs(iet);
    // phi_tower: change the range from global to SM-local
    // phi==0 is in the middle of a SM
    int ipt = towid.iphi() + 2;
    if ( ipt > 72 ) ipt = ipt - 72;
    int iptindex = ipt - 1;
    
    int ism = Numbers::iSM( id );
    int itt = Numbers::iTT( towid );

    nCryTower[iptindex][ietindex]++;
    
    EBSrFlagCollection::const_iterator srf = srFlagColl.find(readOutUnitOf(id));
    
    if(srf == srFlagColl.end()){
      return;
    }
    
    bool highInterest = ((srf->value() & ~EcalSrFlag::SRF_FORCED_MASK)
                         == EcalSrFlag::SRF_FULL);
    

    int dccZsFIRval = dccZsFIR(frame, firWeights_, firstFIRSample_, 0);

    if(highInterest){
      ++nEbHI_;
      // if(statusCode != 9) EBHighInterestZsFIR_->Fill( dccZsFIRval );
      EBHighInterestZsFIR_->Fill( dccZsFIRval );
    } else{//low interest
      ++nEbLI_;
      // if(statusCode != 9) EBLowInterestZsFIR_->Fill( dccZsFIRval );
      EBLowInterestZsFIR_->Fill( dccZsFIRval );
    }
    ++nPerDcc_[dccNum(id)-1];
    ++nPerRu_[ism-1][itt-1];
  }

}
void EBSelectiveReadoutTask::anaDigiInit ( ) [private]

Initializes statistics accumalator for data volume analysis. To be call at start of each event analysis.

Definition at line 780 of file EBSelectiveReadoutTask.cc.

References ebRuActive_, nCryTower, nDccChs, nEb_, nEbHI_, nEbLI_, nECALDcc, nPerDcc_, nPerRu_, and nRuPerDcc_.

Referenced by analyze().

                                        {
  nEb_ = 0;
  nEbLI_ = 0;
  nEbHI_ = 0;
  bzero(nPerDcc_, sizeof(nPerDcc_));
  bzero(nRuPerDcc_, sizeof(nRuPerDcc_));
  bzero(ebRuActive_, sizeof(ebRuActive_));

  for(int idcc=0; idcc<nECALDcc; idcc++) {
    for(int isc=0; isc<nDccChs; isc++) {
      nPerRu_[idcc][isc] = 0;
    }
  }

  for(int ietindex = 0; ietindex < 34; ietindex++ ) {
    for(int iptindex = 0; iptindex < 72; iptindex++ ) {
      nCryTower[iptindex][ietindex] = 0;
    }
  }

}
void EBSelectiveReadoutTask::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

Analyze.

Implements edm::EDAnalyzer.

Definition at line 389 of file EBSelectiveReadoutTask.cc.

References abs, anaDigi(), anaDigiInit(), bytesPerCrystal, EBCompleteZSCount_, EBCompleteZSMap_, EBDccEventSize_, EBDccEventSizeMap_, EBDigiCollection_, EBDroppedFRCount_, EBDroppedFRMap_, EBEventSize_, EBFullReadoutSRFlagCount_, EBFullReadoutSRFlagMap_, EBHighInterestPayload_, EBHighInterestTriggerTowerFlagMap_, EBLowInterestPayload_, EBLowInterestTriggerTowerFlagMap_, EBMediumInterestTriggerTowerFlagMap_, EBReadoutUnitForcedBitMap_, EBSRFlagCollection_, EBTowerSize_, EBTTFlags_, EBTTFMismatch_, EBZeroSuppression1SRFlagMap_, EcalBarrel, EcalTrigPrimDigiCollection_, error, FEDRawDataCollection_, MonitorElement::Fill(), edm::EventSetup::get(), edm::Event::getByLabel(), getCrystalCount(), getEbEventSize(), EcalCondObjectContainer< T >::getMap(), EcalChannelStatusCode::getStatusCode(), MonitorElement::getTH2F(), EBDataFrame::id(), EcalTrigTowerDetId::ieta(), ievt_, init_, Numbers::iSM(), ecalpyutils::ism(), Numbers::iTT(), kByte, nCryTower, nEb_, nEBDcc, nEbHI_, nEbLI_, nEvtAnyInterest, nEvtAnyReadout, nEvtCompleteReadoutIfZS, nEvtDroppedReadoutIfFR, nEvtFullReadout, nEvtHighInterest, nEvtLowInterest, nEvtMediumInterest, nEvtRUForced, nEvtZS1Readout, nEvtZSReadout, nPerRu_, edm::ESHandle< T >::product(), MonitorElement::setBinContent(), MonitorElement::setBinError(), setup(), findQualityFiles::size, mathSSE::sqrt(), EcalSrFlag::SRF_FORCED_MASK, EcalSrFlag::SRF_FULL, EcalSrFlag::SRF_ZS1, EcalSrFlag::SRF_ZS2, ntuplemaker::status, Numbers::subDet(), and ecalTPGAnalyzer_cfg::TPCollection.

                                                                             {

  if ( ! init_ ) this->setup();

  ievt_++;

  edm::Handle<FEDRawDataCollection> raw;
  if ( e.getByLabel(FEDRawDataCollection_, raw) ) {

    for ( int iDcc = 0; iDcc < nEBDcc; ++iDcc ) {

      EBDccEventSize_->Fill(iDcc+1, ((double)raw->FEDData(610+iDcc).size())/kByte );
      EBDccEventSizeMap_->Fill(iDcc+1, ((double)raw->FEDData(610+iDcc).size())/kByte);

    }

  } else {
    edm::LogWarning("EBSelectiveReadoutTask") << FEDRawDataCollection_ << " not available";
  }

  // Selective Readout Flags
  int nFRO, nCompleteZS, nDroppedFRO;
  nFRO = 0;
  nCompleteZS = 0;
  nDroppedFRO = 0;
  edm::Handle<EBSrFlagCollection> ebSrFlags;
  if ( e.getByLabel(EBSRFlagCollection_,ebSrFlags) ) {

    // Data Volume
    double aLowInterest=0;
    double aHighInterest=0;
    double aAnyInterest=0;

    edm::Handle<EBDigiCollection> ebDigis;
    if ( e.getByLabel(EBDigiCollection_ , ebDigis) ) {

      anaDigiInit();

      // channel status
      edm::ESHandle<EcalChannelStatus> pChannelStatus;
      c.get<EcalChannelStatusRcd>().get(pChannelStatus);
      const EcalChannelStatus* chStatus = pChannelStatus.product();  

      for (unsigned int digis=0; digis<ebDigis->size(); ++digis){
        EBDataFrame ebdf = (*ebDigis)[digis];
        EBDetId id = ebdf.id();
        EcalChannelStatusMap::const_iterator chit;
        chit = chStatus->getMap().find(id.rawId());
        uint16_t statusCode = 0;
        if( chit != chStatus->getMap().end() ) {
          EcalChannelStatusCode ch_code = (*chit);
          statusCode = ch_code.getStatusCode();
        }
        anaDigi(ebdf, *ebSrFlags, statusCode);
      }

      //low interest channels:
      aLowInterest = nEbLI_*bytesPerCrystal/kByte;
      EBLowInterestPayload_->Fill(aLowInterest);

      //low interest channels:
      aHighInterest = nEbHI_*bytesPerCrystal/kByte;
      EBHighInterestPayload_->Fill(aHighInterest);

      //any-interest channels:
      aAnyInterest = getEbEventSize(nEb_)/kByte;
      EBEventSize_->Fill(aAnyInterest);

      //event size by tower:
      for(int ietindex = 0; ietindex < 34; ietindex++ ) {
        for(int iptindex = 0; iptindex < 72; iptindex++ ) {

          float xiet = (ietindex < 17) ? ietindex + 0.5 : (16-ietindex) + 0.5;
          float xipt = iptindex + 0.5;

          double towerSize =  nCryTower[iptindex][ietindex] * bytesPerCrystal;
          EBTowerSize_->Fill(xipt, xiet, towerSize);

        }
      }
    } else {
      edm::LogWarning("EBSelectiveReadoutTask") << EBDigiCollection_ << " not available";
    }

    // initialize dcchs_ to mask disabled towers
    std::map< int, std::vector<short> > towersStatus;
    edm::Handle<EcalRawDataCollection> dcchs;

    if( e.getByLabel(FEDRawDataCollection_, dcchs) ) {
      for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
        if ( Numbers::subDet( *dcchItr ) != EcalBarrel ) continue;
        int ism = Numbers::iSM( *dcchItr, EcalBarrel );
        towersStatus.insert(std::make_pair(ism, dcchItr->getFEStatus()));
      }
    }

    for ( EBSrFlagCollection::const_iterator it = ebSrFlags->begin(); it != ebSrFlags->end(); ++it ) {

      EcalTrigTowerDetId id = it->id();

      if ( Numbers::subDet( id ) != EcalBarrel ) continue;

      int iet = id.ieta();
      int ietindex = (iet>0) ? iet - 1 : 16 + std::abs(iet);
      // phi_tower: change the range from global to SM-local
      // phi==0 is in the middle of a SM
      int ipt = id.iphi() + 2;
      if ( ipt > 72 ) ipt = ipt - 72;
      int iptindex = ipt - 1;
      int ism = Numbers::iSM( id );
      int itt = Numbers::iTT( id );

      nEvtAnyReadout[iptindex][ietindex]++;

      int flag = it->value() & ~EcalSrFlag::SRF_FORCED_MASK;

      int status=0;
      if( towersStatus[ism].size() > 0 ) status = (towersStatus[ism])[itt];

      if(flag == EcalSrFlag::SRF_FULL) {
        nEvtFullReadout[iptindex][ietindex]++;
        nFRO++;
        if(nPerRu_[ism-1][itt-1] == 0) {
          if(status != 1) nEvtDroppedReadoutIfFR[iptindex][ietindex]++;
          nDroppedFRO++;
        }
      }

      if(flag == EcalSrFlag::SRF_ZS1) nEvtZS1Readout[iptindex][ietindex]++;

      if(it->value() & EcalSrFlag::SRF_FORCED_MASK) nEvtRUForced[iptindex][ietindex]++;

      if(flag == EcalSrFlag::SRF_ZS1 || flag == EcalSrFlag::SRF_ZS2) {
        nEvtZSReadout[iptindex][ietindex]++;
        if(nPerRu_[ism-1][itt-1] == getCrystalCount()) {
          if(status != 1) nEvtCompleteReadoutIfZS[iptindex][ietindex]++;
          nCompleteZS++;
        }
      }

    }
  } else {
    edm::LogWarning("EBSelectiveReadoutTask") << EBSRFlagCollection_ << " not available";
  }

  for(int ietindex = 0; ietindex < 34; ietindex++ ) {
    for(int iptindex = 0; iptindex < 72; iptindex++ ) {

      if(nEvtAnyReadout[iptindex][ietindex]) {

        float xiet = (ietindex < 17) ? ietindex + 0.5 : (16-ietindex) + 0.5;
        float xipt = iptindex + 0.5;

        float fraction = float(nEvtFullReadout[iptindex][ietindex]) / float(nEvtAnyReadout[iptindex][ietindex]);
        float error = sqrt(fraction*(1-fraction)/float(nEvtAnyReadout[iptindex][ietindex]));

        TH2F *h2d = EBFullReadoutSRFlagMap_->getTH2F();

        int binet=0, binpt=0;

        if ( h2d ) {
          binpt = h2d->GetXaxis()->FindBin(xipt);
          binet = h2d->GetYaxis()->FindBin(xiet);
        }

        EBFullReadoutSRFlagMap_->setBinContent(binpt, binet, fraction);
        EBFullReadoutSRFlagMap_->setBinError(binpt, binet, error);


        fraction = float(nEvtZS1Readout[iptindex][ietindex]) / float(nEvtAnyReadout[iptindex][ietindex]);
        error = sqrt(fraction*(1-fraction)/float(nEvtAnyReadout[iptindex][ietindex]));

        h2d = EBZeroSuppression1SRFlagMap_->getTH2F();

        if ( h2d ) {
          binpt = h2d->GetXaxis()->FindBin(xipt);
          binet = h2d->GetYaxis()->FindBin(xiet);
        }

        EBZeroSuppression1SRFlagMap_->setBinContent(binpt, binet, fraction);
        EBZeroSuppression1SRFlagMap_->setBinError(binpt, binet, error);


        fraction = float(nEvtRUForced[iptindex][ietindex]) / float(nEvtAnyReadout[iptindex][ietindex]);
        error = sqrt(fraction*(1-fraction)/float(nEvtAnyReadout[iptindex][ietindex]));

        h2d = EBReadoutUnitForcedBitMap_->getTH2F();

        if ( h2d ) {
          binpt = h2d->GetXaxis()->FindBin(xipt);
          binet = h2d->GetYaxis()->FindBin(xiet);
        }

        EBReadoutUnitForcedBitMap_->setBinContent(binpt, binet, fraction);
        EBReadoutUnitForcedBitMap_->setBinError(binpt, binet, error);

        if( nEvtZSReadout[iptindex][ietindex] ) {
          fraction = float(nEvtCompleteReadoutIfZS[iptindex][ietindex]) / float(nEvtZSReadout[iptindex][ietindex]);
          error = sqrt(fraction*(1-fraction)/float(nEvtAnyReadout[iptindex][ietindex]));

          h2d = EBCompleteZSMap_->getTH2F();
          
          if ( h2d ) {
            binpt = h2d->GetXaxis()->FindBin(xipt);
            binet = h2d->GetYaxis()->FindBin(xiet);
          }
          
          EBCompleteZSMap_->setBinContent(binpt, binet, fraction);
          EBCompleteZSMap_->setBinError(binpt, binet, error);
        }

        if( nEvtFullReadout[iptindex][ietindex] ) {
          fraction = float(nEvtDroppedReadoutIfFR[iptindex][ietindex]) / float(nEvtFullReadout[iptindex][ietindex]);
          error = sqrt(fraction*(1-fraction)/float(nEvtAnyReadout[iptindex][ietindex]));
          
          h2d = EBDroppedFRMap_->getTH2F();
          
          if ( h2d ) {
            binpt = h2d->GetXaxis()->FindBin(xipt);
            binet = h2d->GetYaxis()->FindBin(xiet);
          }
          
          EBDroppedFRMap_->setBinContent(binpt, binet, fraction);
          EBDroppedFRMap_->setBinError(binpt, binet, error);
        }
      }

    }
  }

  EBFullReadoutSRFlagCount_->Fill( nFRO );
  EBCompleteZSCount_->Fill( nCompleteZS );
  EBDroppedFRCount_->Fill( nDroppedFRO );

  edm::Handle<EcalTrigPrimDigiCollection> TPCollection;
  if ( e.getByLabel(EcalTrigPrimDigiCollection_, TPCollection) ) {

    // Trigger Primitives
    EcalTrigPrimDigiCollection::const_iterator TPdigi;
    for (TPdigi = TPCollection->begin(); TPdigi != TPCollection->end(); ++TPdigi ) {

      if ( Numbers::subDet( TPdigi->id() ) != EcalBarrel ) continue;

      int iet = TPdigi->id().ieta();
      int ietindex = (iet>0) ? iet - 1 : 16 + std::abs(iet);
      // phi_tower: change the range from global to SM-local
      // phi==0 is in the middle of a SM
      int ipt = TPdigi->id().iphi() + 2;
      if ( ipt > 72 ) ipt = ipt - 72;
      int iptindex = ipt - 1;

      nEvtAnyInterest[iptindex][ietindex]++;

      if ( (TPdigi->ttFlag() & 0x3) == 0 ) nEvtLowInterest[iptindex][ietindex]++;

      if ( (TPdigi->ttFlag() & 0x3) == 1 ) nEvtMediumInterest[iptindex][ietindex]++;

      if ( (TPdigi->ttFlag() & 0x3) == 3 ) nEvtHighInterest[iptindex][ietindex]++;

      EBTTFlags_->Fill( TPdigi->ttFlag() );

      float xiet = (ietindex < 17) ? ietindex + 0.5 : (16-ietindex) + 0.5;
      float xipt = iptindex + 0.5;

      if ( ((TPdigi->ttFlag() & 0x3) == 1 || (TPdigi->ttFlag() & 0x3) == 3)
           && nCryTower[iptindex][ietindex] != 25 ) EBTTFMismatch_->Fill(xipt, xiet);

    }
  } else {
    edm::LogWarning("EBSelectiveReadoutTask") << EcalTrigPrimDigiCollection_ << " not available";
  }

  for(int ietindex = 0; ietindex < 34; ietindex++ ) {
    for(int iptindex = 0; iptindex < 72; iptindex++ ) {

      if(nEvtAnyInterest[iptindex][ietindex]) {

        float xiet = (ietindex < 17) ? ietindex + 0.5 : (16-ietindex) + 0.5;
        float xipt = iptindex + 0.5;

        float fraction = float(nEvtHighInterest[iptindex][ietindex]) / float(nEvtAnyInterest[iptindex][ietindex]);
        float error = sqrt(fraction*(1-fraction)/float(nEvtAnyInterest[iptindex][ietindex]));

        TH2F *h2d = EBHighInterestTriggerTowerFlagMap_->getTH2F();

        int binet=0, binpt=0;

        if ( h2d ) {
          binpt = h2d->GetXaxis()->FindBin(xipt);
          binet = h2d->GetYaxis()->FindBin(xiet);
        }

        EBHighInterestTriggerTowerFlagMap_->setBinContent(binpt, binet, fraction);
        EBHighInterestTriggerTowerFlagMap_->setBinError(binpt, binet, error);


        fraction = float(nEvtMediumInterest[iptindex][ietindex]) / float(nEvtAnyInterest[iptindex][ietindex]);
        error = sqrt(fraction*(1-fraction)/float(nEvtAnyInterest[iptindex][ietindex]));

        h2d = EBMediumInterestTriggerTowerFlagMap_->getTH2F();

        if ( h2d ) {
          binpt = h2d->GetXaxis()->FindBin(xipt);
          binet = h2d->GetYaxis()->FindBin(xiet);
        }

        EBMediumInterestTriggerTowerFlagMap_->setBinContent(binpt, binet, fraction);
        EBMediumInterestTriggerTowerFlagMap_->setBinError(binpt, binet, error);


        fraction = float(nEvtLowInterest[iptindex][ietindex]) / float(nEvtAnyInterest[iptindex][ietindex]);
        error = sqrt(fraction*(1-fraction)/float(nEvtAnyInterest[iptindex][ietindex]));

        h2d = EBLowInterestTriggerTowerFlagMap_->getTH2F();

        if ( h2d ) {
          binpt = h2d->GetXaxis()->FindBin(xipt);
          binet = h2d->GetYaxis()->FindBin(xiet);
        }

        EBLowInterestTriggerTowerFlagMap_->setBinContent(binpt, binet, fraction);
        EBLowInterestTriggerTowerFlagMap_->setBinError(binpt, binet, error);

      }

    }
  }


}
void EBSelectiveReadoutTask::beginJob ( void  ) [protected, virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 97 of file EBSelectiveReadoutTask.cc.

References dqmStore_, ievt_, prefixME_, DQMStore::rmdir(), and DQMStore::setCurrentFolder().

                                          {

  ievt_ = 0;

  if ( dqmStore_ ) {
    dqmStore_->setCurrentFolder(prefixME_ + "/EBSelectiveReadoutTask");
    dqmStore_->rmdir(prefixME_ + "/EBSelectiveReadoutTask");
  }

}
void EBSelectiveReadoutTask::beginRun ( const edm::Run r,
const edm::EventSetup c 
) [protected, virtual]

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 108 of file EBSelectiveReadoutTask.cc.

References Numbers::initGeometry(), mergeRuns_, nEvtAnyInterest, nEvtAnyReadout, nEvtCompleteReadoutIfZS, nEvtDroppedReadoutIfFR, nEvtFullReadout, nEvtHighInterest, nEvtLowInterest, nEvtMediumInterest, nEvtRUForced, nEvtZS1Readout, nEvtZSReadout, and reset().

                                                                             {

  Numbers::initGeometry(c, false);

  if ( ! mergeRuns_ ) this->reset();

  for(int ietindex = 0; ietindex < 34; ietindex++ ) {
    for(int iptindex = 0; iptindex < 72; iptindex++ ) {
      nEvtFullReadout[iptindex][ietindex] = 0;
      nEvtZS1Readout[iptindex][ietindex] = 0;
      nEvtZSReadout[iptindex][ietindex] = 0;
      nEvtCompleteReadoutIfZS[iptindex][ietindex] = 0;
      nEvtDroppedReadoutIfFR[iptindex][ietindex] = 0;
      nEvtRUForced[iptindex][ietindex] = 0;
      nEvtAnyReadout[iptindex][ietindex] = 0;
      nEvtHighInterest[iptindex][ietindex] = 0;
      nEvtMediumInterest[iptindex][ietindex] = 0;
      nEvtLowInterest[iptindex][ietindex] = 0;
      nEvtAnyInterest[iptindex][ietindex] = 0;
    }
  }

}
int EBSelectiveReadoutTask::cIndex2iEta ( int  i) const [inline, private]

converse of iEta2cIndex() method.

Definition at line 184 of file EBSelectiveReadoutTask.h.

                            {
  return (i<85)?i-85:i-84;
}
int EBSelectiveReadoutTask::cIndex2iPhi ( int  i) const [inline, private]

converse of iPhi2cIndex() method.

Definition at line 190 of file EBSelectiveReadoutTask.h.

                             {
  return i+1;
}
int EBSelectiveReadoutTask::cIndex2iXY ( int  iX0) const [inline, private]

converse of iXY2cIndex() method.

Definition at line 178 of file EBSelectiveReadoutTask.h.

                             {
  return iX0+1;
}
void EBSelectiveReadoutTask::cleanup ( void  ) [protected]

Cleanup.

Definition at line 304 of file EBSelectiveReadoutTask.cc.

References dqmStore_, EBCompleteZSCount_, EBCompleteZSMap_, EBDccEventSize_, EBDccEventSizeMap_, EBDroppedFRCount_, EBDroppedFRMap_, EBEventSize_, EBFullReadoutSRFlagCount_, EBFullReadoutSRFlagMap_, EBHighInterestPayload_, EBHighInterestTriggerTowerFlagMap_, EBHighInterestZsFIR_, EBLowInterestPayload_, EBLowInterestTriggerTowerFlagMap_, EBLowInterestZsFIR_, EBMediumInterestTriggerTowerFlagMap_, EBReadoutUnitForcedBitMap_, EBTowerSize_, EBTTFlags_, EBTTFMismatch_, MonitorElement::getName(), init_, prefixME_, DQMStore::removeElement(), and DQMStore::setCurrentFolder().

Referenced by endJob().

                                        {

  if ( ! init_ ) return;

  if ( dqmStore_ ) {

    dqmStore_->setCurrentFolder(prefixME_ + "/EBSelectiveReadoutTask");

    if ( EBTowerSize_ ) dqmStore_->removeElement( EBTowerSize_->getName() );
    EBTowerSize_ = 0;

    if ( EBTTFMismatch_ ) dqmStore_->removeElement( EBTTFMismatch_->getName() );
    EBTTFMismatch_ = 0;

    if ( EBDccEventSize_ ) dqmStore_->removeElement( EBDccEventSize_->getName() );
    EBDccEventSize_ = 0;

    if ( EBDccEventSizeMap_ ) dqmStore_->removeElement( EBDccEventSizeMap_->getName() );
    EBDccEventSizeMap_ = 0;

    if ( EBReadoutUnitForcedBitMap_ ) dqmStore_->removeElement( EBReadoutUnitForcedBitMap_->getName() );
    EBReadoutUnitForcedBitMap_ = 0;

    if ( EBFullReadoutSRFlagMap_ ) dqmStore_->removeElement( EBFullReadoutSRFlagMap_->getName() );
    EBFullReadoutSRFlagMap_ = 0;

    if ( EBFullReadoutSRFlagCount_ ) dqmStore_->removeElement( EBFullReadoutSRFlagCount_->getName() );
    EBFullReadoutSRFlagCount_ = 0;

    if ( EBFullReadoutSRFlagCount_ ) dqmStore_->removeElement( EBFullReadoutSRFlagCount_->getName() );
    EBFullReadoutSRFlagCount_ = 0;

    if ( EBHighInterestTriggerTowerFlagMap_ ) dqmStore_->removeElement( EBHighInterestTriggerTowerFlagMap_->getName() );
    EBHighInterestTriggerTowerFlagMap_ = 0;

    if ( EBMediumInterestTriggerTowerFlagMap_ ) dqmStore_->removeElement( EBMediumInterestTriggerTowerFlagMap_->getName() );
    EBMediumInterestTriggerTowerFlagMap_ = 0;

    if ( EBLowInterestTriggerTowerFlagMap_ ) dqmStore_->removeElement( EBLowInterestTriggerTowerFlagMap_->getName() );
    EBLowInterestTriggerTowerFlagMap_ = 0;

    if ( EBTTFlags_ ) dqmStore_->removeElement( EBTTFlags_->getName() );
    EBTTFlags_ = 0;

    if ( EBCompleteZSMap_ ) dqmStore_->removeElement( EBCompleteZSMap_->getName() );
    EBCompleteZSMap_ = 0;

    if ( EBCompleteZSCount_ ) dqmStore_->removeElement( EBCompleteZSCount_->getName() );
    EBCompleteZSCount_ = 0;

    if ( EBDroppedFRMap_ ) dqmStore_->removeElement( EBDroppedFRMap_->getName() );
    EBDroppedFRMap_ = 0;

    if ( EBDroppedFRCount_ ) dqmStore_->removeElement( EBDroppedFRCount_->getName() );
    EBDroppedFRCount_ = 0;

    if ( EBEventSize_ ) dqmStore_->removeElement( EBEventSize_->getName() );
    EBEventSize_ = 0;

    if ( EBHighInterestPayload_ ) dqmStore_->removeElement( EBHighInterestPayload_->getName() );
    EBHighInterestPayload_ = 0;

    if ( EBLowInterestPayload_ ) dqmStore_->removeElement( EBLowInterestPayload_->getName() );
    EBLowInterestPayload_ = 0;

    if ( EBHighInterestZsFIR_ ) dqmStore_->removeElement( EBHighInterestZsFIR_->getName() );
    EBHighInterestZsFIR_ = 0;

    if ( EBLowInterestZsFIR_ ) dqmStore_->removeElement( EBLowInterestZsFIR_->getName() );
    EBLowInterestZsFIR_ = 0;

  }

  init_ = false;

}
void EBSelectiveReadoutTask::configFirWeights ( std::vector< double >  weightsForZsFIR) [private]

Configure DCC ZS FIR weights. Heuristic is used to determine if input weights are normalized weights or integer weights in the hardware representation.

Parameters:
weightsForZsFIRweights from configuration file

Definition at line 921 of file EBSelectiveReadoutTask.cc.

References Exception, firstFIRSample_, firWeights_, getFIRWeights(), i, funct::log(), indexGen::s2, and mathSSE::sqrt().

Referenced by EBSelectiveReadoutTask().

                                                                         {
  bool notNormalized  = false;
  bool notInt = false;
  for(unsigned i=0; i < weightsForZsFIR.size(); ++i){
    if(weightsForZsFIR[i] > 1.) notNormalized = true;
    if((int)weightsForZsFIR[i]!=weightsForZsFIR[i]) notInt = true;
  }
  if(notInt && notNormalized){
    throw cms::Exception("InvalidParameter")
      << "weigtsForZsFIR paramater values are not valid: they "
      << "must either be integer and uses the hardware representation "
      << "of the weights or less or equal than 1 and used the normalized "
      << "representation.";
  }
  edm::LogInfo log("DccFir");
  if(notNormalized){
    firWeights_ = std::vector<int>(weightsForZsFIR.size());
    for(unsigned i = 0; i< weightsForZsFIR.size(); ++i){
      firWeights_[i] = (int)weightsForZsFIR[i];
    }
  } else{
    firWeights_ = getFIRWeights(weightsForZsFIR);
  }

  log << "Input weights for FIR: ";
  for(unsigned i = 0; i < weightsForZsFIR.size(); ++i){
    log << weightsForZsFIR[i] << "\t";
  }

  double s2 = 0.;
  log << "\nActual FIR weights: ";
  for(unsigned i = 0; i < firWeights_.size(); ++i){
    log << firWeights_[i] << "\t";
    s2 += firWeights_[i]*firWeights_[i];
  }

  s2 = sqrt(s2);
  log << "\nNormalized FIR weights after hw representation rounding: ";
  for(unsigned i = 0; i < firWeights_.size(); ++i){
    log << firWeights_[i] / (double)(1<<10) << "\t";
  }

  log <<"\nFirst FIR sample: " << firstFIRSample_;
}
int EBSelectiveReadoutTask::dccIndex ( int  i,
int  j 
) const [private]

Gets the index of the DCC reading a crystal

Parameters:
iiEta
jiPhi
Returns:
DCC index between 0 and 17

Definition at line 845 of file EBSelectiveReadoutTask.cc.

Referenced by dccNum().

                                                       {
    //a SM is 85 crystal long:
    int iEtaSM = i/85;
    //a SM is 20 crystal wide:
    int iPhiSM = j/20;
    //DCC numbers start at 9 in the barrel and there 18 DCC/SM
    return 9+18*iEtaSM+iPhiSM;
}
unsigned EBSelectiveReadoutTask::dccNum ( const DetId xtalId) const [private]

Retrieve the logical number of the DCC reading a given crystal channel.

Parameters:
xtarIdcrystal channel identifier
Returns:
the DCC logical number starting from 1.

Definition at line 807 of file EBSelectiveReadoutTask.cc.

References dccIndex(), DetId::det(), DetId::Ecal, EcalBarrel, Exception, EBDetId::ieta(), iEta2cIndex(), EBDetId::iphi(), iPhi2cIndex(), j, gen::k, nECALDcc, and DetId::subdetId().

Referenced by anaDigi().

                                                                {
  int j;
  int k;

  if ( xtalId.det()!=DetId::Ecal ) {
    throw cms::Exception("EBSelectiveReadoutTask") << "Crystal does not belong to ECAL";
  }

  if(xtalId.subdetId()==EcalBarrel){
    EBDetId ebDetId(xtalId);
    j = iEta2cIndex(ebDetId.ieta());
    k = iPhi2cIndex(ebDetId.iphi());
  } else {
    throw cms::Exception("EBSelectiveReadoutTask") << "Not ECAL barrel.";
  }
  int iDcc0 = dccIndex(j,k);
  assert(iDcc0>=0 && iDcc0<nECALDcc);
  return iDcc0+1;
}
int EBSelectiveReadoutTask::dccPhiIndex ( int  i,
int  j 
) const [inline, private]

Gets the phi index of the DCC reading a crystal

Parameters:
iiEta
jiPhi
Returns:
DCC phi index between 0 and 17 for EB

Definition at line 235 of file EBSelectiveReadoutTask.h.

References dccPhiIndexOfRU().

                                    {
  return dccPhiIndexOfRU(i/5, j/5);
}
int EBSelectiveReadoutTask::dccPhiIndexOfRU ( int  i,
int  j 
) const [private]

Gets the phi index of the DCC reading a RU (SC or TT)

Parameters:
iiEta
jiPhi
Returns:
DCC phi index between 0 and 17 for EB

Definition at line 839 of file EBSelectiveReadoutTask.cc.

Referenced by dccPhiIndex().

                                                              {
  //iEta=i, iPhi=j
  //phi edge of a SM is 4 TT
  return j/4;
}
int EBSelectiveReadoutTask::dccZsFIR ( const EcalDataFrame frame,
const std::vector< int > &  firWeights,
int  firstFIRSample,
bool *  saturated = 0 
) [static, private]

Emulates the DCC zero suppression FIR filter. If one of the time sample is not in gain 12, numeric_limits<int>::max() is returned.

Parameters:
framedata frame
firWeightsTAP weights
firstFIRSampleindex (starting from 1) of the first time sample to be used in the filter
saturatedif not null, *saturated is set to true if all the time sample are not in gain 12 and set to false otherwise.
Returns:
FIR output or numeric_limits<int>::max().

Definition at line 857 of file EBSelectiveReadoutTask.cc.

References EcalMGPASample::adc(), EcalMGPASample::gainId(), LogTrace, max(), and EcalDataFrame::size().

Referenced by anaDigi().

                                                 {
  const int nFIRTaps = 6;
  //FIR filter weights:
  const std::vector<int>& w = firWeights;

  //accumulator used to compute weighted sum of samples
  int acc = 0;
  bool gain12saturated = false;
  const int gain12 = 0x01;
  const int lastFIRSample = firstFIRSample + nFIRTaps - 1;
  //LogDebug("DccFir") << "DCC FIR operation: ";
  int iWeight = 0;
  for(int iSample=firstFIRSample-1;
      iSample<lastFIRSample; ++iSample, ++iWeight){
    if(iSample>=0 && iSample < frame.size()){
      EcalMGPASample sample(frame[iSample]);
      if(sample.gainId()!=gain12) gain12saturated = true;
      LogTrace("DccFir") << (iSample>=firstFIRSample?"+":"") << sample.adc()
                         << "*(" << w[iWeight] << ")";
      acc+=sample.adc()*w[iWeight];
    } else{
      edm::LogWarning("DccFir") << __FILE__ << ":" << __LINE__ <<
        ": Not enough samples in data frame or 'ecalDccZs1stSample' module "
        "parameter is not valid...";
    }
  }
  LogTrace("DccFir") << "\n";
  //discards the 8 LSBs
  //(shift operator cannot be used on negative numbers because
  // the result depends on compilator implementation)
  acc = (acc>=0)?(acc >> 8):-(-acc >> 8);
  //ZS passed if weighted sum acc above ZS threshold or if
  //one sample has a lower gain than gain 12 (that is gain 12 output
  //is saturated)

  LogTrace("DccFir") << "acc: " << acc << "\n"
                     << "saturated: " << (gain12saturated?"yes":"no") << "\n";

  if(saturated){
    *saturated = gain12saturated;
  }

  return gain12saturated?std::numeric_limits<int>::max():acc;
}
void EBSelectiveReadoutTask::endJob ( void  ) [protected, virtual]

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 381 of file EBSelectiveReadoutTask.cc.

References cleanup(), enableCleanup_, and ievt_.

                                       {

  edm::LogInfo("EBSelectiveReadoutTask") << "analyzed " << ievt_ << " events";

  if ( enableCleanup_ ) this->cleanup();

}
void EBSelectiveReadoutTask::endRun ( const edm::Run r,
const edm::EventSetup c 
) [protected, virtual]

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 132 of file EBSelectiveReadoutTask.cc.

                                                                           {

}
int EBSelectiveReadoutTask::getCrystalCount ( ) [inline, private]

Retrieves number of crystal channel read out by a DCC channel

Parameters:
iDccDCC ID starting from 1
iDccChDCC channel starting from 1
Returns:
crystal count

Definition at line 281 of file EBSelectiveReadoutTask.h.

Referenced by analyze().

{ return 25; }
double EBSelectiveReadoutTask::getDccEventSize ( int  iDcc0,
double  nReadXtals 
) const [inline, private]

Gets the size of an DCC event fragment.

Parameters:
iDcc0the DCC logical number starting from 0.
nReadXtalsnumber of read crystal channels.
Returns:
the DCC event fragment size in bytes.

Definition at line 213 of file EBSelectiveReadoutTask.h.

References bytesPerCrystal, EB, EE, getDccOverhead(), and nRuPerDcc_.

                                                          {
  subdet_t subdet;
  if(iDcc0<9 || iDcc0>=45){
    subdet = EE;
  } else{
    subdet = EB;
  }
  return getDccOverhead(subdet)+nReadXtals*bytesPerCrystal+nRuPerDcc_[iDcc0]*8;
}
double EBSelectiveReadoutTask::getDccOverhead ( subdet_t  subdet) const [inline, private]

Gets the size in bytes fixed-size part of a DCC event fragment.

Returns:
the fixed size in bytes.

Definition at line 203 of file EBSelectiveReadoutTask.h.

References EB.

Referenced by getDccEventSize(), and getEbEventSize().

                                            {
  //  return (subdet==EB?34:25)*8;
  return (subdet==EB?34:52)*8;
}
double EBSelectiveReadoutTask::getEbEventSize ( double  nReadXtals) const [private]

Computes the size of an ECAL barrel event fragment.

Parameters:
nReadXtalsnumber of read crystal channels
Returns:
the event fragment size in bytes

Definition at line 827 of file EBSelectiveReadoutTask.cc.

References bytesPerCrystal, EB, getDccOverhead(), nEBDcc, and nRuPerDcc_.

Referenced by analyze().

                                                                    {
  double ruHeaderPayload = 0.;
  const int nEEDcc = 18;
  const int firstEbDcc0 = nEEDcc/2;
  for (int iDcc0 = firstEbDcc0; iDcc0 < firstEbDcc0 + nEBDcc; ++iDcc0 ) {
    ruHeaderPayload += nRuPerDcc_[iDcc0]*8.;
  }
  return getDccOverhead(EB)*nEBDcc +
         nReadXtals*bytesPerCrystal +
         ruHeaderPayload;
}
std::vector< int > EBSelectiveReadoutTask::getFIRWeights ( const std::vector< double > &  normalizedWeights) [static, private]

Computes the ZS FIR filter weights from the normalized weights.

Parameters:
normalizedWeightsthe normalized weights
Returns:
the computed ZS filter weights.

Definition at line 906 of file EBSelectiveReadoutTask.cc.

References abs, i, and min.

Referenced by configFirWeights().

                                                        {
  const int nFIRTaps = 6;
  std::vector<int> firWeights(nFIRTaps, 0); //default weight: 0;
  const static int maxWeight = 0xEFF; //weights coded on 11+1 signed bits
  for(unsigned i=0; i < std::min((size_t)nFIRTaps,normalizedWeights.size()); ++i){
    firWeights[i] = lround(normalizedWeights[i] * (1<<10));
    if(std::abs(firWeights[i])>maxWeight){//overflow
      firWeights[i] = firWeights[i]<0?-maxWeight:maxWeight;
    }
  }
  return firWeights;
}
int EBSelectiveReadoutTask::iEta2cIndex ( int  iEta) const [inline, private]

Converts a std CMSSW crystal eta index to a c-array index (starting from zero and without hole).

Definition at line 151 of file EBSelectiveReadoutTask.h.

Referenced by anaDigi(), and dccNum().

                               {
  return (iEta<0)?iEta+85:iEta+84;
}
int EBSelectiveReadoutTask::iPhi2cIndex ( int  iPhi) const [inline, private]

Converts a std CMSSW crystal phi index to a c-array index (starting from zero and without hole).

Definition at line 158 of file EBSelectiveReadoutTask.h.

Referenced by anaDigi(), and dccNum().

                               {
  return iPhi-1;
}
int EBSelectiveReadoutTask::iXY2cIndex ( int  iX) const [inline, private]

Converts a std CMSSW crystal x or y index to a c-array index (starting from zero and without hole).

Definition at line 172 of file EBSelectiveReadoutTask.h.

                            {
  return iX-1;
}
EcalTrigTowerDetId EBSelectiveReadoutTask::readOutUnitOf ( const EBDetId xtalId) const [private]

Retrives the readout unit, a trigger tower in the barrel case, and a supercrystal in the endcap case, a given crystal belongs to.

Parameters:
xtalIdidentifier of the crystal
Returns:
identifer of the supercrystal or of the trigger tower.

Definition at line 803 of file EBSelectiveReadoutTask.cc.

References EBDetId::tower().

Referenced by anaDigi().

                                                                {
  return xtalId.tower();
}
void EBSelectiveReadoutTask::reset ( void  ) [protected]

Reset.

Definition at line 136 of file EBSelectiveReadoutTask.cc.

References EBCompleteZSCount_, EBCompleteZSMap_, EBDccEventSize_, EBDccEventSizeMap_, EBDroppedFRCount_, EBDroppedFRMap_, EBEventSize_, EBFullReadoutSRFlagCount_, EBFullReadoutSRFlagMap_, EBHighInterestPayload_, EBHighInterestTriggerTowerFlagMap_, EBHighInterestZsFIR_, EBLowInterestPayload_, EBLowInterestTriggerTowerFlagMap_, EBLowInterestZsFIR_, EBMediumInterestTriggerTowerFlagMap_, EBReadoutUnitForcedBitMap_, EBTowerSize_, EBTTFlags_, EBTTFMismatch_, EBZeroSuppression1SRFlagMap_, and MonitorElement::Reset().

Referenced by beginRun().

void EBSelectiveReadoutTask::setup ( void  ) [protected]

Setup.

Definition at line 182 of file EBSelectiveReadoutTask.cc.

References DQMStore::book1D(), DQMStore::book2D(), DQMStore::bookProfile(), DQMStore::bookProfile2D(), dqmStore_, EBCompleteZSCount_, EBCompleteZSMap_, EBDccEventSize_, EBDccEventSizeMap_, EBDroppedFRCount_, EBDroppedFRMap_, EBEventSize_, EBFullReadoutSRFlagCount_, EBFullReadoutSRFlagMap_, EBHighInterestPayload_, EBHighInterestTriggerTowerFlagMap_, EBHighInterestZsFIR_, EBLowInterestPayload_, EBLowInterestTriggerTowerFlagMap_, EBLowInterestZsFIR_, EBMediumInterestTriggerTowerFlagMap_, EBReadoutUnitForcedBitMap_, EBTowerSize_, EBTTFlags_, EBTTFMismatch_, EBZeroSuppression1SRFlagMap_, trackerHits::histo, i, init_, prefixME_, Numbers::sEB(), MonitorElement::setAxisTitle(), MonitorElement::setBinLabel(), DQMStore::setCurrentFolder(), xbins, and ybins.

Referenced by analyze().

                                       {

  init_ = true;

  char histo[200];

  if ( dqmStore_ ) {

    dqmStore_->setCurrentFolder(prefixME_ + "/EBSelectiveReadoutTask");

    sprintf(histo, "EBSRT tower event size");
    EBTowerSize_ = dqmStore_->bookProfile2D(histo, histo, 72, 0, 72, 34, -17, 17, 100, 0, 200, "s");
    EBTowerSize_->setAxisTitle("jphi", 1);
    EBTowerSize_->setAxisTitle("jeta", 2);

    sprintf(histo, "EBSRT TT flag mismatch");
    EBTTFMismatch_ = dqmStore_->book2D(histo, histo, 72, 0, 72, 34, -17, 17);
    EBTTFMismatch_->setAxisTitle("jphi", 1);
    EBTTFMismatch_->setAxisTitle("jeta", 2);

    sprintf(histo, "EBSRT DCC event size");
    EBDccEventSize_ = dqmStore_->bookProfile(histo, histo, 36, 1, 37, 100, 0., 200., "s");
    EBDccEventSize_->setAxisTitle("event size (kB)", 2);
    for (int i = 0; i < 36; i++) {
      EBDccEventSize_->setBinLabel(i+1, Numbers::sEB(i+1).c_str(), 1);
    }

    sprintf(histo, "EBSRT event size vs DCC");
    EBDccEventSizeMap_ = dqmStore_->book2D(histo, histo, 36, xbins, 88, ybins);
    EBDccEventSizeMap_->setAxisTitle("event size (kB)", 2);
    for (int i = 0; i < 36; i++) {
      EBDccEventSizeMap_->setBinLabel(i+1, Numbers::sEB(i+1).c_str(), 1);
    }

    sprintf(histo, "EBSRT readout unit with SR forced");
    EBReadoutUnitForcedBitMap_ = dqmStore_->book2D(histo, histo, 72, 0, 72, 34, -17, 17);
    EBReadoutUnitForcedBitMap_->setAxisTitle("jphi", 1);
    EBReadoutUnitForcedBitMap_->setAxisTitle("jeta", 2);
    EBReadoutUnitForcedBitMap_->setAxisTitle("rate", 3);

    sprintf(histo, "EBSRT full readout SR Flags");
    EBFullReadoutSRFlagMap_ = dqmStore_->book2D(histo, histo, 72, 0, 72, 34, -17, 17);
    EBFullReadoutSRFlagMap_->setAxisTitle("jphi", 1);
    EBFullReadoutSRFlagMap_->setAxisTitle("jeta", 2);
    EBFullReadoutSRFlagMap_->setAxisTitle("rate", 3);

    sprintf(histo, "EBSRT full readout SR Flags Number");
    EBFullReadoutSRFlagCount_ = dqmStore_->book1D(histo, histo, 200, 0., 200.);
    EBFullReadoutSRFlagCount_->setAxisTitle("Readout Units number", 1);

    sprintf(histo, "EBSRT zero suppression 1 SR Flags");
    EBZeroSuppression1SRFlagMap_ = dqmStore_->book2D(histo, histo, 72, 0, 72, 34, -17, 17);
    EBZeroSuppression1SRFlagMap_->setAxisTitle("jphi", 1);
    EBZeroSuppression1SRFlagMap_->setAxisTitle("jeta", 2);
    EBZeroSuppression1SRFlagMap_->setAxisTitle("rate", 3);

    sprintf(histo, "EBSRT high interest TT Flags");
    EBHighInterestTriggerTowerFlagMap_ = dqmStore_->book2D(histo, histo, 72, 0, 72, 34, -17, 17);
    EBHighInterestTriggerTowerFlagMap_->setAxisTitle("jphi", 1);
    EBHighInterestTriggerTowerFlagMap_->setAxisTitle("jeta", 2);
    EBHighInterestTriggerTowerFlagMap_->setAxisTitle("rate", 3);

    sprintf(histo, "EBSRT medium interest TT Flags");
    EBMediumInterestTriggerTowerFlagMap_ = dqmStore_->book2D(histo, histo, 72, 0, 72, 34, -17, 17);
    EBMediumInterestTriggerTowerFlagMap_->setAxisTitle("jphi", 1);
    EBMediumInterestTriggerTowerFlagMap_->setAxisTitle("jeta", 2);
    EBMediumInterestTriggerTowerFlagMap_->setAxisTitle("rate", 3);

    sprintf(histo, "EBSRT low interest TT Flags");
    EBLowInterestTriggerTowerFlagMap_ = dqmStore_->book2D(histo, histo, 72, 0, 72, 34, -17, 17);
    EBLowInterestTriggerTowerFlagMap_->setAxisTitle("jphi", 1);
    EBLowInterestTriggerTowerFlagMap_->setAxisTitle("jeta", 2);
    EBLowInterestTriggerTowerFlagMap_->setAxisTitle("rate", 3);

    sprintf(histo, "EBSRT TT Flags");
    EBTTFlags_ = dqmStore_->book1D(histo, histo, 8, 0., 8.);
    EBTTFlags_->setAxisTitle("TT Flag value", 1);

    sprintf(histo, "EBSRT ZS Flagged Fully Readout");
    EBCompleteZSMap_ = dqmStore_->book2D(histo, histo, 72, 0, 72, 34, -17, 17);
    EBCompleteZSMap_->setAxisTitle("jphi", 1);
    EBCompleteZSMap_->setAxisTitle("jeta", 2);
    EBCompleteZSMap_->setAxisTitle("rate", 3);

    sprintf(histo, "EBSRT ZS Flagged Fully Readout Number");
    EBCompleteZSCount_ = dqmStore_->book1D(histo, histo, 20, 0., 20.);
    EBCompleteZSCount_->setAxisTitle("Readout Units number", 1);

    sprintf(histo, "EBSRT FR Flagged Dropped Readout");
    EBDroppedFRMap_ = dqmStore_->book2D(histo, histo, 72, 0, 72, 34, -17, 17);
    EBDroppedFRMap_->setAxisTitle("jphi", 1);
    EBDroppedFRMap_->setAxisTitle("jeta", 2);
    EBDroppedFRMap_->setAxisTitle("rate", 3);

    sprintf(histo, "EBSRT FR Flagged Dropped Readout Number");
    EBDroppedFRCount_ = dqmStore_->book1D(histo, histo, 20, 0., 20.);
    EBDroppedFRCount_->setAxisTitle("Readout Units number", 1);

    sprintf(histo, "EBSRT event size");
    EBEventSize_ = dqmStore_->book1D(histo, histo, 100, 0, 200);
    EBEventSize_->setAxisTitle("event size (kB)",1);

    sprintf(histo, "EBSRT high interest payload");
    EBHighInterestPayload_ =  dqmStore_->book1D(histo, histo, 100, 0, 200);
    EBHighInterestPayload_->setAxisTitle("event size (kB)",1);

    sprintf(histo, "EBSRT low interest payload");
    EBLowInterestPayload_ =  dqmStore_->book1D(histo, histo, 100, 0, 200);
    EBLowInterestPayload_->setAxisTitle("event size (kB)",1);

    sprintf(histo, "EBSRT high interest ZS filter output");
    EBHighInterestZsFIR_ = dqmStore_->book1D(histo, histo, 60, -30, 30);
    EBHighInterestZsFIR_->setAxisTitle("ADC counts*4",1);

    sprintf(histo, "EBSRT low interest ZS filter output");
    EBLowInterestZsFIR_ = dqmStore_->book1D(histo, histo, 60, -30, 30);
    EBLowInterestZsFIR_->setAxisTitle("ADC counts*4",1);

  }

}

Member Data Documentation

const int EBSelectiveReadoutTask::bytesPerCrystal = 24 [static, protected]

Number of bytes per crystal.

Definition at line 89 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), getDccEventSize(), and getEbEventSize().

Definition at line 323 of file EBSelectiveReadoutTask.h.

Referenced by beginJob(), cleanup(), EBSelectiveReadoutTask(), and setup().

Definition at line 354 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 353 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 341 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 342 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 331 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and EBSelectiveReadoutTask().

Definition at line 356 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 355 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 357 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 347 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 346 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 358 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 349 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 360 of file EBSelectiveReadoutTask.h.

Referenced by anaDigi(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 359 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 351 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 361 of file EBSelectiveReadoutTask.h.

Referenced by anaDigi(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 350 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 345 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

For book keeping of RU actually read out (not fully zero suppressed)

Definition at line 310 of file EBSelectiveReadoutTask.h.

Referenced by anaDigi(), and anaDigiInit().

Definition at line 334 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and EBSelectiveReadoutTask().

Definition at line 343 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

const int EBSelectiveReadoutTask::ebTtEdge = 5 [static, protected]

Number of crystals along an EB TT.

Definition at line 77 of file EBSelectiveReadoutTask.h.

Referenced by anaDigi().

Definition at line 352 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 344 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 332 of file EBSelectiveReadoutTask.h.

Referenced by EBSelectiveReadoutTask().

Definition at line 348 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), EBSelectiveReadoutTask(), reset(), and setup().

Definition at line 333 of file EBSelectiveReadoutTask.h.

Definition at line 335 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and EBSelectiveReadoutTask().

Definition at line 327 of file EBSelectiveReadoutTask.h.

Referenced by EBSelectiveReadoutTask(), and endJob().

Definition at line 336 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and EBSelectiveReadoutTask().

Time position of the first sample to use in zero suppession FIR filter. Numbering starts at 0.

Definition at line 319 of file EBSelectiveReadoutTask.h.

Referenced by anaDigi(), configFirWeights(), and EBSelectiveReadoutTask().

std::vector<int> EBSelectiveReadoutTask::firWeights_ [private]

Weights to be used for the ZS FIR filter

Definition at line 314 of file EBSelectiveReadoutTask.h.

Referenced by anaDigi(), and configFirWeights().

Definition at line 321 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), beginJob(), and endJob().

Definition at line 363 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), cleanup(), EBSelectiveReadoutTask(), and setup().

const int EBSelectiveReadoutTask::kByte = 1024 [static, protected]

Definition at line 62 of file EBSelectiveReadoutTask.h.

Referenced by analyze().

Definition at line 329 of file EBSelectiveReadoutTask.h.

Referenced by beginRun(), and EBSelectiveReadoutTask().

int EBSelectiveReadoutTask::nCryTower[72][34] [protected]

To store the readout crystals / tower.

Definition at line 92 of file EBSelectiveReadoutTask.h.

Referenced by anaDigi(), anaDigiInit(), and analyze().

const int EBSelectiveReadoutTask::nDccChs = 68 [static, protected]

maximum number of RUs read by a DCC

Definition at line 65 of file EBSelectiveReadoutTask.h.

Referenced by anaDigiInit().

ECAL barrel read channel count

Definition at line 286 of file EBSelectiveReadoutTask.h.

Referenced by anaDigi(), anaDigiInit(), and analyze().

const int EBSelectiveReadoutTask::nEBDcc = 36 [static, protected]

Definition at line 61 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and getEbEventSize().

const int EBSelectiveReadoutTask::nEbEta = 170 [static, protected]

number of crystals along Eta in EB

Definition at line 71 of file EBSelectiveReadoutTask.h.

ECAL barrel high interest read channel count

Definition at line 294 of file EBSelectiveReadoutTask.h.

Referenced by anaDigi(), anaDigiInit(), and analyze().

ECAL barrel low interest read channel count

Definition at line 290 of file EBSelectiveReadoutTask.h.

Referenced by anaDigi(), anaDigiInit(), and analyze().

const int EBSelectiveReadoutTask::nEbPhi = 360 [static, protected]

number of crystals along Phi in EB

Definition at line 74 of file EBSelectiveReadoutTask.h.

const int EBSelectiveReadoutTask::nEbRus = 36*68 [static, protected]

number of RUs for EB

Definition at line 68 of file EBSelectiveReadoutTask.h.

const int EBSelectiveReadoutTask::nECALDcc = 54 [static, protected]

Definition at line 60 of file EBSelectiveReadoutTask.h.

Referenced by anaDigiInit(), and dccNum().

int EBSelectiveReadoutTask::nEvtAnyInterest[72][34] [protected]

To store the events with any interest.

Definition at line 125 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and beginRun().

int EBSelectiveReadoutTask::nEvtAnyReadout[72][34] [protected]

To store the events with any readout.

Definition at line 101 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and beginRun().

To store the events with complete readout when ZS is requested.

Definition at line 110 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and beginRun().

To store the events with 0 channels readout when FR is requested.

Definition at line 113 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and beginRun().

int EBSelectiveReadoutTask::nEvtFullReadout[72][34] [protected]

To store the events with full readout.

Definition at line 95 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and beginRun().

To store the events with high interest TT.

Definition at line 116 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and beginRun().

int EBSelectiveReadoutTask::nEvtLowInterest[72][34] [protected]

To store the events with low interest TT.

Definition at line 122 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and beginRun().

To store the events with medium interest TT.

Definition at line 119 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and beginRun().

int EBSelectiveReadoutTask::nEvtRUForced[72][34] [protected]

To store the events with RU forced.

Definition at line 98 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and beginRun().

int EBSelectiveReadoutTask::nEvtZS1Readout[72][34] [protected]

To store the events with ZS1 readout.

Definition at line 104 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and beginRun().

int EBSelectiveReadoutTask::nEvtZSReadout[72][34] [protected]

To store the events with ZS1 or ZS2 readout.

Definition at line 107 of file EBSelectiveReadoutTask.h.

Referenced by analyze(), and beginRun().

ECAL read channel count for each DCC:

Definition at line 298 of file EBSelectiveReadoutTask.h.

Referenced by anaDigi(), and anaDigiInit().

Number of crystal read for each DCC channel (aka readout unit).

Definition at line 302 of file EBSelectiveReadoutTask.h.

Referenced by anaDigi(), anaDigiInit(), and analyze().

Count for each DCC of RUs with at leat one channel read out:

Definition at line 306 of file EBSelectiveReadoutTask.h.

Referenced by anaDigi(), anaDigiInit(), getDccEventSize(), and getEbEventSize().

const int EBSelectiveReadoutTask::nTtEta = 56 [static, protected]

Number of Trigger Towers along Eta.

Definition at line 83 of file EBSelectiveReadoutTask.h.

const int EBSelectiveReadoutTask::nTTEta = 34 [static, protected]

Constants.

Definition at line 58 of file EBSelectiveReadoutTask.h.

const int EBSelectiveReadoutTask::nTtPhi = 72 [static, protected]

Number of Trigger Towers along Phi.

Definition at line 86 of file EBSelectiveReadoutTask.h.

const int EBSelectiveReadoutTask::nTTPhi = 72 [static, protected]

Definition at line 59 of file EBSelectiveReadoutTask.h.

std::string EBSelectiveReadoutTask::prefixME_ [private]

Definition at line 325 of file EBSelectiveReadoutTask.h.

Referenced by beginJob(), cleanup(), EBSelectiveReadoutTask(), and setup().

const int EBSelectiveReadoutTask::scEdge = 5 [static, protected]

Number of crystals along a supercrystal edge.

Definition at line 80 of file EBSelectiveReadoutTask.h.

float EBSelectiveReadoutTask::xbins[37] [private]

Definition at line 338 of file EBSelectiveReadoutTask.h.

Referenced by EBSelectiveReadoutTask(), and setup().

float EBSelectiveReadoutTask::ybins[89] [private]

Definition at line 339 of file EBSelectiveReadoutTask.h.

Referenced by EBSelectiveReadoutTask(), and setup().