CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

EEHltTask Class Reference

#include <EEHltTask.h>

Inheritance diagram for EEHltTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

 EEHltTask (const edm::ParameterSet &ps)
 Constructor.
virtual ~EEHltTask ()
 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 EEDetId &id)
void reset (void)
 Reset.
void setup (void)
 Setup.
EcalSubdetector subDet (const EEDetId &id)
EcalSubdetector subDet (const EcalElectronicsId &id)

Private Attributes

DQMStoredqmStore_
edm::InputTag EcalElectronicsIdCollection1_
edm::InputTag EcalElectronicsIdCollection2_
edm::InputTag EcalElectronicsIdCollection3_
edm::InputTag EcalElectronicsIdCollection4_
edm::InputTag EcalElectronicsIdCollection5_
edm::InputTag EcalElectronicsIdCollection6_
edm::InputTag EEDetIdCollection0_
edm::InputTag EEDetIdCollection1_
edm::InputTag EEDetIdCollection2_
edm::InputTag EEDetIdCollection3_
edm::InputTag EEDetIdCollection4_
bool enableCleanup_
edm::InputTag FEDRawDataCollection_
std::string folderName_
int ievt_
bool init_
bool initGeometry_
const EcalElectronicsMappingmap
MonitorElementmeEEFedsIntegrityErrors_
MonitorElementmeEEFedsOccupancy_
MonitorElementmeEEFedsSizeErrors_
bool mergeRuns_
std::string prefixME_

Detailed Description

Definition at line 28 of file EEHltTask.h.


Constructor & Destructor Documentation

EEHltTask::EEHltTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 32 of file EEHltTask.cc.

References dqmStore_, EcalElectronicsIdCollection1_, EcalElectronicsIdCollection2_, EcalElectronicsIdCollection3_, EcalElectronicsIdCollection4_, EcalElectronicsIdCollection5_, EcalElectronicsIdCollection6_, EEDetIdCollection0_, EEDetIdCollection1_, EEDetIdCollection2_, EEDetIdCollection3_, enableCleanup_, FEDRawDataCollection_, folderName_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), init_, initGeometry_, map, meEEFedsIntegrityErrors_, meEEFedsOccupancy_, meEEFedsSizeErrors_, mergeRuns_, cmsCodeRules::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);

  EEDetIdCollection0_ =  ps.getParameter<edm::InputTag>("EEDetIdCollection0");
  EEDetIdCollection1_ =  ps.getParameter<edm::InputTag>("EEDetIdCollection1");
  EEDetIdCollection2_ =  ps.getParameter<edm::InputTag>("EEDetIdCollection2");
  EEDetIdCollection3_ =  ps.getParameter<edm::InputTag>("EEDetIdCollection3");
  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");

  meEEFedsOccupancy_ = 0;
  meEEFedsSizeErrors_ = 0;
  meEEFedsIntegrityErrors_ = 0;

  map = 0;

}
EEHltTask::~EEHltTask ( ) [virtual]

Destructor.

Definition at line 68 of file EEHltTask.cc.

                     {

}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 155 of file EEHltTask.cc.

References FEDRawData::data(), EcalElectronicsIdCollection1_, EcalElectronicsIdCollection2_, EcalElectronicsIdCollection3_, EcalElectronicsIdCollection4_, EcalElectronicsIdCollection5_, EcalElectronicsIdCollection6_, EcalEndcap, EEDetIdCollection0_, EEDetIdCollection1_, EEDetIdCollection2_, EEDetIdCollection3_, FEDRawDataCollection_, MonitorElement::Fill(), edm::Event::getByLabel(), i, ievt_, init_, iSM(), ecalpyutils::ism(), meEEFedsIntegrityErrors_, meEEFedsOccupancy_, meEEFedsSizeErrors_, setup(), FEDRawData::size(), and subDet().

                                                                {

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

  ievt_++;

  // ECAL endcap FEDs
  int EEFirstFED[2];
  EEFirstFED[0] = 601; // EE-
  EEFirstFED[1] = 646; // EE+

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

  edm::Handle<EEDetIdCollection> ids0;

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

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

      int ism = iSM( *idItr );

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

    }

  } else {

//    edm::LogWarning("EEHltTask") << EEDetIdCollection0_ << " not available";

  }

  edm::Handle<FEDRawDataCollection> allFedRawData;

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

    for(int zside=0; zside<2; zside++) {

      int firstFedOnSide=EEFirstFED[zside];

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

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

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

        if ( length > 0 ) {

          if ( meEEFedsOccupancy_ ) meEEFedsOccupancy_->Fill( firstFedOnSide + 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("EEHltTask") << FEDRawDataCollection_ << " not available";
  }


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

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

      int fednumber = ( ism < 10 ) ? 600 + ism : 636 + ism;

      if ( meEEFedsSizeErrors_ ) meEEFedsSizeErrors_->Fill( fednumber );

    }

  }


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

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

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

      int ism = iSM( *idItr );
      int fednumber = ( ism < 10 ) ? 600 + ism : 636 + ism;

      if ( ism > -1 ) meEEFedsIntegrityErrors_->Fill( fednumber, 1./850.);

    }

  } else {

    edm::LogWarning("EEHltTask") << EEDetIdCollection1_ << " not available";

  }

  edm::Handle<EEDetIdCollection> ids2;

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

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

      int ism = iSM( *idItr );
      int fednumber = ( ism < 10 ) ? 600 + ism : 636 + ism;

      if ( ism > -1 ) meEEFedsIntegrityErrors_->Fill( fednumber, 1./850.);

    }

  } else {

    edm::LogWarning("EEHltTask") << EEDetIdCollection2_ << " not available";

  }

  edm::Handle<EEDetIdCollection> ids3;

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

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

      int ism = iSM( *idItr );
      int fednumber = ( ism < 10 ) ? 600 + ism : 636 + ism;

      if ( ism > -1 ) meEEFedsIntegrityErrors_->Fill( fednumber, 1./850.);

    }

  } else {

    edm::LogWarning("EEHltTask") << EEDetIdCollection3_ << " 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 ) != EcalEndcap ) continue;

      int ism = iSM( *idItr );
      int fednumber = ( ism < 10 ) ? 600 + ism : 636 + ism;

      if ( ism > -1 ) meEEFedsIntegrityErrors_->Fill( fednumber, 1./34.);

    }

  } else {

    edm::LogWarning("EEHltTask") << 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 ) != EcalEndcap ) continue;

      int ism = iSM( *idItr );
      int fednumber = ( ism < 10 ) ? 600 + ism : 636 + ism;

      if ( ism > -1 ) meEEFedsIntegrityErrors_->Fill( fednumber, 1./850.);

    }

  } else {

    edm::LogWarning("EEHltTask") << 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 ) != EcalEndcap ) continue;

      int ism = iSM( *idItr );
      int fednumber = ( ism < 10 ) ? 600 + ism : 636 + ism;

      if ( ism > -1 ) meEEFedsIntegrityErrors_->Fill( fednumber, 1./34.);

    }

  } else {

    edm::LogWarning("EEHltTask") << 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 ) != EcalEndcap ) continue;

      int ism = iSM( *idItr );
      int fednumber = ( ism < 10 ) ? 600 + ism : 636 + ism;

      if ( ism > -1 ) meEEFedsIntegrityErrors_->Fill( fednumber, 1./850.);

    }

  } else {

    edm::LogWarning("EEHltTask") << 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 ) != EcalEndcap ) continue;

      int ism = iSM( *idItr );
      int fednumber = ( ism < 10 ) ? 600 + ism : 636 + ism;

      if ( ism > -1 ) meEEFedsIntegrityErrors_->Fill( fednumber, 1./850.);

    }

  } else {

    edm::LogWarning("EEHltTask") << 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 ) != EcalEndcap ) continue;

      int ism = iSM( *idItr );
      int fednumber = ( ism < 10 ) ? 600 + ism : 636 + ism;

      if ( ism > -1 ) meEEFedsIntegrityErrors_->Fill( fednumber, 1./850.);

    }

  } else {

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

  }

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 72 of file EEHltTask.cc.

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

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 83 of file EEHltTask.cc.

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

                                                                {

  initGeometry(c);

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

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

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 147 of file EEHltTask.cc.

References cleanup(), enableCleanup_, and ievt_.

                          {

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

  if ( enableCleanup_ ) this->cleanup();

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

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 91 of file EEHltTask.cc.

                                                              {

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

Definition at line 423 of file EEHltTask.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("EEHltTask") << "EcalElectronicsMapping not available";

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

Definition at line 455 of file EEHltTask.cc.

                                                {

  int idcc = id.dccId();

  // EE-
  if( idcc >=  1 && idcc <=  9 ) return( idcc );

  // EE+
  if( idcc >= 46 && idcc <= 54 ) return( idcc - 45 + 9 );

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

}
int EEHltTask::iSM ( const EEDetId id) [protected]

Definition at line 437 of file EEHltTask.cc.

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

Referenced by analyze().

                                      {

  if( ! map ) return -1;

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

  // EE-
  if( idcc >=  1 && idcc <=  9 ) return( idcc );

  // EE+
  if( idcc >= 46 && idcc <= 54 ) return( idcc - 45 + 9 );

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

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

Setup.

Definition at line 103 of file EEHltTask.cc.

References DQMStore::book1D(), dqmStore_, folderName_, init_, meEEFedsIntegrityErrors_, meEEFedsOccupancy_, meEEFedsSizeErrors_, mergeVDriftHistosByStation::name, prefixME_, and DQMStore::setCurrentFolder().

Referenced by analyze().

                         {

  init_ = true;

  std::string name;

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

    name = "FEDEntries";
    meEEFedsOccupancy_ = dqmStore_->book1D(name, name, 54, 601, 655);

    name = "FEDFatal";
    meEEFedsSizeErrors_ = dqmStore_->book1D(name, name, 54, 601, 655);

    name = "FEDNonFatal";
    meEEFedsIntegrityErrors_ = dqmStore_->book1D(name, name, 54, 601, 655);

  }

}
EcalSubdetector EEHltTask::subDet ( const EEDetId id) [inline, protected]

Definition at line 66 of file EEHltTask.h.

Referenced by analyze().

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

Definition at line 68 of file EEHltTask.h.

{ return( id.subdet() ); }

Member Data Documentation

Definition at line 78 of file EEHltTask.h.

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

Definition at line 92 of file EEHltTask.h.

Referenced by analyze(), and EEHltTask().

Definition at line 93 of file EEHltTask.h.

Referenced by analyze(), and EEHltTask().

Definition at line 94 of file EEHltTask.h.

Referenced by analyze(), and EEHltTask().

Definition at line 95 of file EEHltTask.h.

Referenced by analyze(), and EEHltTask().

Definition at line 96 of file EEHltTask.h.

Referenced by analyze(), and EEHltTask().

Definition at line 97 of file EEHltTask.h.

Referenced by analyze(), and EEHltTask().

Definition at line 87 of file EEHltTask.h.

Referenced by analyze(), and EEHltTask().

Definition at line 88 of file EEHltTask.h.

Referenced by analyze(), and EEHltTask().

Definition at line 89 of file EEHltTask.h.

Referenced by analyze(), and EEHltTask().

Definition at line 90 of file EEHltTask.h.

Referenced by analyze(), and EEHltTask().

Definition at line 91 of file EEHltTask.h.

bool EEHltTask::enableCleanup_ [private]

Definition at line 83 of file EEHltTask.h.

Referenced by EEHltTask(), and endJob().

Definition at line 98 of file EEHltTask.h.

Referenced by analyze(), and EEHltTask().

std::string EEHltTask::folderName_ [private]

Definition at line 81 of file EEHltTask.h.

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

int EEHltTask::ievt_ [private]

Definition at line 76 of file EEHltTask.h.

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

bool EEHltTask::init_ [private]

Definition at line 104 of file EEHltTask.h.

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

bool EEHltTask::initGeometry_ [private]

Definition at line 105 of file EEHltTask.h.

Referenced by EEHltTask(), and initGeometry().

Definition at line 107 of file EEHltTask.h.

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

Definition at line 102 of file EEHltTask.h.

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

Definition at line 100 of file EEHltTask.h.

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

Definition at line 101 of file EEHltTask.h.

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

bool EEHltTask::mergeRuns_ [private]

Definition at line 85 of file EEHltTask.h.

Referenced by beginRun(), and EEHltTask().

std::string EEHltTask::prefixME_ [private]

Definition at line 80 of file EEHltTask.h.

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