CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

EBHltTask Class Reference

#include <EBHltTask.h>

Inheritance diagram for EBHltTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

 EBHltTask (const edm::ParameterSet &ps)
 Constructor.
virtual ~EBHltTask ()
 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 initGeometry (const edm::EventSetup &setup)
int iSM (const EcalElectronicsId &id)
int iSM (const EBDetId &id)
void reset (void)
 Reset.
void setup (void)
 Setup.
EcalSubdetector subDet (const EBDetId &id)
EcalSubdetector subDet (const EcalElectronicsId &id)

Private Attributes

DQMStoredqmStore_
edm::InputTag EBDetIdCollection0_
edm::InputTag EBDetIdCollection1_
edm::InputTag EBDetIdCollection2_
edm::InputTag EBDetIdCollection3_
edm::InputTag EBDetIdCollection4_
edm::InputTag EcalElectronicsIdCollection1_
edm::InputTag EcalElectronicsIdCollection2_
edm::InputTag EcalElectronicsIdCollection3_
edm::InputTag EcalElectronicsIdCollection4_
edm::InputTag EcalElectronicsIdCollection5_
edm::InputTag EcalElectronicsIdCollection6_
bool enableCleanup_
edm::InputTag FEDRawDataCollection_
std::string folderName_
int ievt_
bool init_
bool initGeometry_
const EcalElectronicsMappingmap
MonitorElementmeEBFedsIntegrityErrors_
MonitorElementmeEBFedsOccupancy_
MonitorElementmeEBFedsSizeErrors_
bool mergeRuns_
std::string prefixME_

Detailed Description

Definition at line 28 of file EBHltTask.h.


Constructor & Destructor Documentation

EBHltTask::EBHltTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 32 of file EBHltTask.cc.

References dqmStore_, EBDetIdCollection0_, EBDetIdCollection1_, EBDetIdCollection2_, EBDetIdCollection3_, EcalElectronicsIdCollection1_, EcalElectronicsIdCollection2_, EcalElectronicsIdCollection3_, EcalElectronicsIdCollection4_, EcalElectronicsIdCollection5_, EcalElectronicsIdCollection6_, enableCleanup_, FEDRawDataCollection_, folderName_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), init_, initGeometry_, map, meEBFedsIntegrityErrors_, meEBFedsOccupancy_, meEBFedsSizeErrors_, mergeRuns_, cppFunctionSkipper::operator, and prefixME_.

                                             {

  init_ = false;

  initGeometry_ = false;

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

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

  folderName_ = ps.getUntrackedParameter<std::string>("folderName", "FEDIntegrity");

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

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

  EBDetIdCollection0_ =  ps.getParameter<edm::InputTag>("EBDetIdCollection0");
  EBDetIdCollection1_ =  ps.getParameter<edm::InputTag>("EBDetIdCollection1");
  EBDetIdCollection2_ =  ps.getParameter<edm::InputTag>("EBDetIdCollection2");
  EBDetIdCollection3_ =  ps.getParameter<edm::InputTag>("EBDetIdCollection3");
  EcalElectronicsIdCollection1_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection1");
  EcalElectronicsIdCollection2_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection2");
  EcalElectronicsIdCollection3_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection3");
  EcalElectronicsIdCollection4_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection4");
  EcalElectronicsIdCollection5_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection5");
  EcalElectronicsIdCollection6_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection6");
  FEDRawDataCollection_ = ps.getParameter<edm::InputTag>("FEDRawDataCollection");

  meEBFedsOccupancy_ = 0;
  meEBFedsSizeErrors_ = 0;
  meEBFedsIntegrityErrors_ = 0;

  map = 0;

}
EBHltTask::~EBHltTask ( ) [virtual]

Destructor.

Definition at line 68 of file EBHltTask.cc.

                     {

}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 155 of file EBHltTask.cc.

References FEDRawData::data(), EBDetIdCollection0_, EBDetIdCollection1_, EBDetIdCollection2_, EBDetIdCollection3_, EcalBarrel, EcalElectronicsIdCollection1_, EcalElectronicsIdCollection2_, EcalElectronicsIdCollection3_, EcalElectronicsIdCollection4_, EcalElectronicsIdCollection5_, EcalElectronicsIdCollection6_, FEDRawDataCollection_, MonitorElement::Fill(), edm::Event::getByLabel(), i, ievt_, init_, iSM(), ecalpyutils::ism(), meEBFedsIntegrityErrors_, meEBFedsOccupancy_, meEBFedsSizeErrors_, setup(), FEDRawData::size(), and subDet().

                                                                {

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

  ievt_++;

  // ECAL barrel FEDs
  int EBFirstFED=610;

  int FedsSizeErrors[36];
  for ( int i=0; i<36; i++ ) FedsSizeErrors[i]=0;

  edm::Handle<EBDetIdCollection> ids0;

  if ( e.getByLabel(EBDetIdCollection0_, ids0) ) {

    for ( EBDetIdCollection::const_iterator idItr = ids0->begin(); idItr != ids0->end(); ++idItr ) {

      int ism = iSM( *idItr );

      if ( ism > -1 ) FedsSizeErrors[ism-1]++;

    }

  } else {

  }

  edm::Handle<FEDRawDataCollection> allFedRawData;

  if ( e.getByLabel(FEDRawDataCollection_, allFedRawData) ) {

    for ( int ism=1; ism<=36; ism++ ) {

      const FEDRawData& fedData = allFedRawData->FEDData( EBFirstFED + ism - 1 );

      int length = fedData.size()/sizeof(uint64_t);

      if ( length > 0 ) {

        if ( meEBFedsOccupancy_ ) meEBFedsOccupancy_->Fill( EBFirstFED + ism - 1 );

        uint64_t * pData = (uint64_t *)(fedData.data());
        uint64_t * fedTrailer = pData + (length - 1);
        bool crcError = (*fedTrailer >> 2 ) & 0x1;

        if (crcError) FedsSizeErrors[ism-1]++;

      }

    }

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


  for( int ism=1; ism<=36; ism++ ) {

    if ( FedsSizeErrors[ism-1] != 0 ) {

      if ( meEBFedsSizeErrors_ ) meEBFedsSizeErrors_->Fill( EBFirstFED + ism - 1 );

    }

  }


  // Integrity errors
  edm::Handle<EBDetIdCollection> ids1;

  if ( e.getByLabel(EBDetIdCollection1_, ids1) ) {

    for ( EBDetIdCollection::const_iterator idItr = ids1->begin(); idItr != ids1->end(); ++idItr ) {

      int ism = iSM( *idItr );

      if( ism > -1 ) meEBFedsIntegrityErrors_->Fill( EBFirstFED + ism - 1, 1./1700.);

    }

  } else {

    edm::LogWarning("EBHltTask") << EBDetIdCollection1_ << " not available";

  }

  edm::Handle<EBDetIdCollection> ids2;

  if ( e.getByLabel(EBDetIdCollection2_, ids2) ) {

    for ( EBDetIdCollection::const_iterator idItr = ids2->begin(); idItr != ids2->end(); ++idItr ) {

      int ism = iSM( *idItr );

      if ( ism > -1 ) meEBFedsIntegrityErrors_->Fill( EBFirstFED + ism - 1, 1./1700.);

    }

  } else {

    edm::LogWarning("EBHltTask") << EBDetIdCollection2_ << " not available";

  }

  edm::Handle<EBDetIdCollection> ids3;

  if ( e.getByLabel(EBDetIdCollection3_, ids3) ) {

    for ( EBDetIdCollection::const_iterator idItr = ids3->begin(); idItr != ids3->end(); ++idItr ) {

      int ism = iSM( *idItr );

      if ( ism > -1 ) meEBFedsIntegrityErrors_->Fill( EBFirstFED + ism - 1, 1./1700.);

    }

  } else {

    edm::LogWarning("EBHltTask") << EBDetIdCollection3_ << " not available";

  }

  edm::Handle<EcalElectronicsIdCollection> ids4;

  if ( e.getByLabel(EcalElectronicsIdCollection1_, ids4) ) {

    for ( EcalElectronicsIdCollection::const_iterator idItr = ids4->begin(); idItr != ids4->end(); ++idItr ) {

      if ( subDet( *idItr ) != EcalBarrel ) continue;

      int ism = iSM( *idItr );

      if ( ism > -1 ) meEBFedsIntegrityErrors_->Fill( EBFirstFED + ism - 1, 1./68.);

    }

  } else {

    edm::LogWarning("EBHltTask") << EcalElectronicsIdCollection1_ << " not available";

  }

  edm::Handle<EcalElectronicsIdCollection> ids5;

  if ( e.getByLabel(EcalElectronicsIdCollection2_, ids5) ) {

    for ( EcalElectronicsIdCollection::const_iterator idItr = ids5->begin(); idItr != ids5->end(); ++idItr ) {

      if ( subDet( *idItr ) != EcalBarrel ) continue;

      int ism = iSM( *idItr );

      if ( ism > -1 ) meEBFedsIntegrityErrors_->Fill( EBFirstFED + ism - 1, 1./1700.);

    }

  } else {

    edm::LogWarning("EBHltTask") << EcalElectronicsIdCollection2_ << " not available";

  }

  edm::Handle<EcalElectronicsIdCollection> ids6;

  if ( e.getByLabel(EcalElectronicsIdCollection3_, ids6) ) {

    for ( EcalElectronicsIdCollection::const_iterator idItr = ids6->begin(); idItr != ids6->end(); ++idItr ) {

      if ( subDet( *idItr ) != EcalBarrel ) continue;

      int ism = iSM( *idItr );

      if ( ism > -1 ) meEBFedsIntegrityErrors_->Fill( EBFirstFED + ism - 1, 1./68.);

    }

  } else {

    edm::LogWarning("EBHltTask") << EcalElectronicsIdCollection3_ << " not available";

  }

  edm::Handle<EcalElectronicsIdCollection> ids7;

  if ( e.getByLabel(EcalElectronicsIdCollection4_, ids7) ) {

    for ( EcalElectronicsIdCollection::const_iterator idItr = ids7->begin(); idItr != ids7->end(); ++idItr ) {

      if ( subDet( *idItr ) != EcalBarrel ) continue;

      int ism = iSM( *idItr );

      if ( ism > -1 ) meEBFedsIntegrityErrors_->Fill( EBFirstFED + ism - 1, 1./1700.);

    }

  } else {

    edm::LogWarning("EBHltTask") << EcalElectronicsIdCollection4_ << " not available";

  }

  edm::Handle<EcalElectronicsIdCollection> ids8;

  if ( e.getByLabel(EcalElectronicsIdCollection5_, ids8) ) {

    for ( EcalElectronicsIdCollection::const_iterator idItr = ids8->begin(); idItr != ids8->end(); ++idItr ) {

      if ( subDet( *idItr ) != EcalBarrel ) continue;

      int ism = iSM( *idItr );

      if ( ism > -1 ) meEBFedsIntegrityErrors_->Fill( EBFirstFED + ism - 1, 1./1700.);

    }

  } else {

    edm::LogWarning("EBHltTask") << EcalElectronicsIdCollection5_ << " not available";

  }

  edm::Handle<EcalElectronicsIdCollection> ids9;

  if ( e.getByLabel(EcalElectronicsIdCollection6_, ids9) ) {

    for ( EcalElectronicsIdCollection::const_iterator idItr = ids9->begin(); idItr != ids9->end(); ++idItr ) {

      if ( subDet( *idItr ) != EcalBarrel ) continue;

      int ism = iSM( *idItr );

      if ( ism > -1 ) meEBFedsIntegrityErrors_->Fill( EBFirstFED + ism - 1, 1./1700.);

    }

  } else {

    edm::LogWarning("EBHltTask") << EcalElectronicsIdCollection6_ << " not available";

  }

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 72 of file EBHltTask.cc.

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

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 83 of file EBHltTask.cc.

References initGeometry(), mergeRuns_, and reset().

                                                                {

  initGeometry(c);

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

}
void EBHltTask::cleanup ( void  ) [protected]
void EBHltTask::endJob ( void  ) [protected, virtual]

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 147 of file EBHltTask.cc.

References cleanup(), enableCleanup_, and ievt_.

                          {

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

  if ( enableCleanup_ ) this->cleanup();

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

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 91 of file EBHltTask.cc.

                                                              {

}
void EBHltTask::initGeometry ( const edm::EventSetup setup) [protected]

Definition at line 402 of file EBHltTask.cc.

References edm::EventSetup::get(), patZpeak::handle, initGeometry_, map, and edm::ESHandle< T >::product().

Referenced by beginRun().

                                                         {

  if( initGeometry_ ) return;

  initGeometry_ = true;

  edm::ESHandle< EcalElectronicsMapping > handle;
  setup.get< EcalMappingRcd >().get(handle);
  map = handle.product();

  if( ! map ) edm::LogWarning("EBHltTask") << "EcalElectronicsMapping not available";

}
int EBHltTask::iSM ( const EcalElectronicsId id) [protected]

Definition at line 431 of file EBHltTask.cc.

                                                {

  int idcc = id.dccId();

  // EB-/EB+
  if( idcc >= 10 && idcc <= 45 ) return( idcc - 9 );

  edm::LogWarning("EBHltTask") << "Wrong DCC id: dcc = " << idcc;
  return -1;

}
int EBHltTask::iSM ( const EBDetId id) [protected]

Definition at line 416 of file EBHltTask.cc.

References EcalElectronicsId::dccId(), EcalElectronicsMapping::getElectronicsId(), and map.

Referenced by analyze().

                                      {

  if( ! map ) return -1;

  EcalElectronicsId eid = map->getElectronicsId(id);
  int idcc = eid.dccId();

  // EB-/EB+
  if( idcc >= 10 && idcc <= 45 ) return( idcc - 9 );

  edm::LogWarning("EBHltTask") << "Wrong DCC id: dcc = " << idcc;
  return -1;

}
void EBHltTask::reset ( void  ) [protected]
void EBHltTask::setup ( void  ) [protected]

Setup.

Definition at line 103 of file EBHltTask.cc.

References DQMStore::book1D(), dqmStore_, folderName_, init_, meEBFedsIntegrityErrors_, meEBFedsOccupancy_, meEBFedsSizeErrors_, mergeVDriftHistosByStation::name, prefixME_, and DQMStore::setCurrentFolder().

Referenced by analyze().

                         {

  init_ = true;

  std::string name;

  if ( dqmStore_ ) {
    dqmStore_->setCurrentFolder(prefixME_ + "/" + folderName_);

    name = "FEDEntries";
    meEBFedsOccupancy_ = dqmStore_->book1D(name, name, 36, 610, 646);

    name = "FEDFatal";
    meEBFedsSizeErrors_ = dqmStore_->book1D(name, name, 36, 610, 646);

    name = "FEDNonFatal";
    meEBFedsIntegrityErrors_ = dqmStore_->book1D(name, name, 36, 610, 646);

  }

}
EcalSubdetector EBHltTask::subDet ( const EBDetId id) [inline, protected]

Definition at line 66 of file EBHltTask.h.

Referenced by analyze().

{ return( id.subdet() ); }
EcalSubdetector EBHltTask::subDet ( const EcalElectronicsId id) [inline, protected]

Definition at line 68 of file EBHltTask.h.

{ return( id.subdet() ); }

Member Data Documentation

Definition at line 78 of file EBHltTask.h.

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

Definition at line 87 of file EBHltTask.h.

Referenced by analyze(), and EBHltTask().

Definition at line 88 of file EBHltTask.h.

Referenced by analyze(), and EBHltTask().

Definition at line 89 of file EBHltTask.h.

Referenced by analyze(), and EBHltTask().

Definition at line 90 of file EBHltTask.h.

Referenced by analyze(), and EBHltTask().

Definition at line 91 of file EBHltTask.h.

Definition at line 92 of file EBHltTask.h.

Referenced by analyze(), and EBHltTask().

Definition at line 93 of file EBHltTask.h.

Referenced by analyze(), and EBHltTask().

Definition at line 94 of file EBHltTask.h.

Referenced by analyze(), and EBHltTask().

Definition at line 95 of file EBHltTask.h.

Referenced by analyze(), and EBHltTask().

Definition at line 96 of file EBHltTask.h.

Referenced by analyze(), and EBHltTask().

Definition at line 97 of file EBHltTask.h.

Referenced by analyze(), and EBHltTask().

bool EBHltTask::enableCleanup_ [private]

Definition at line 83 of file EBHltTask.h.

Referenced by EBHltTask(), and endJob().

Definition at line 98 of file EBHltTask.h.

Referenced by analyze(), and EBHltTask().

std::string EBHltTask::folderName_ [private]

Definition at line 81 of file EBHltTask.h.

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

int EBHltTask::ievt_ [private]

Definition at line 76 of file EBHltTask.h.

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

bool EBHltTask::init_ [private]

Definition at line 104 of file EBHltTask.h.

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

bool EBHltTask::initGeometry_ [private]

Definition at line 105 of file EBHltTask.h.

Referenced by EBHltTask(), and initGeometry().

Definition at line 107 of file EBHltTask.h.

Referenced by EBHltTask(), initGeometry(), and iSM().

Definition at line 102 of file EBHltTask.h.

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

Definition at line 100 of file EBHltTask.h.

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

Definition at line 101 of file EBHltTask.h.

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

bool EBHltTask::mergeRuns_ [private]

Definition at line 85 of file EBHltTask.h.

Referenced by beginRun(), and EBHltTask().

std::string EBHltTask::prefixME_ [private]

Definition at line 80 of file EBHltTask.h.

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