CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiPixelHLTSource Class Reference

#include <SiPixelHLTSource.h>

Inheritance diagram for SiPixelHLTSource:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void beginRun (const edm::Run &, edm::EventSetup const &)
virtual void bookMEs ()
virtual void endJob ()
 SiPixelHLTSource (const edm::ParameterSet &conf)
 ~SiPixelHLTSource ()

Private Attributes

edm::ParameterSet conf_
std::string dirName_
edm::InputTag errin_
int eventNo
bool firstRun
MonitorElementmeNCRCs_
MonitorElementmeNErrors_
MonitorElementmeRawWords_
edm::ESHandle< TrackerGeometrypDD
edm::InputTag rawin_
bool saveFile
bool slowDown
DQMStoretheDMBE

Detailed Description

Description: Produces histograms for error information generated at the raw2digi stage for the pixel tracker.

Implementation: Takes raw data and error data as input, and uses it to populate three histograms indexed by FED id.

Definition at line 48 of file SiPixelHLTSource.h.


Constructor & Destructor Documentation

SiPixelHLTSource::SiPixelHLTSource ( const edm::ParameterSet conf) [explicit]

Definition at line 48 of file SiPixelHLTSource.cc.

References cmsCodeRules::cppFunctionSkipper::operator, and theDMBE.

                                                                 :
  conf_(iConfig),
  rawin_( conf_.getParameter<edm::InputTag>( "RawInput" ) ),
  errin_( conf_.getParameter<edm::InputTag>( "ErrorInput" ) ),
  saveFile( conf_.getUntrackedParameter<bool>("saveFile",false) ),
  slowDown( conf_.getUntrackedParameter<bool>("slowDown",false) ),
  dirName_( conf_.getUntrackedParameter<std::string>("DirName","Pixel/FEDIntegrity/") )
{
   theDMBE = edm::Service<DQMStore>().operator->();
   LogInfo ("PixelDQM") << "SiPixelHLTSource::SiPixelHLTSource: Got DQM BackEnd interface"<<endl;
}
SiPixelHLTSource::~SiPixelHLTSource ( )

Definition at line 61 of file SiPixelHLTSource.cc.

{
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)
  LogInfo ("PixelDQM") << "SiPixelHLTSource::~SiPixelHLTSource: Destructor"<<endl;
}

Member Function Documentation

void SiPixelHLTSource::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 99 of file SiPixelHLTSource.cc.

References edm::DetSetVector< T >::begin(), edm::DetSetVector< T >::end(), errin_, eventNo, HcalObjRepresent::Fill(), edm::Event::getByLabel(), edm::HandleBase::isValid(), meNCRCs_, meNErrors_, meRawWords_, pDD, GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, rawin_, FEDRawData::size(), and slowDown.

{
  eventNo++;
  // get raw input data
  edm::Handle< FEDRawDataCollection >  rawinput;
  iEvent.getByLabel( rawin_, rawinput );
  // get error input data
  edm::Handle< edm::DetSetVector<SiPixelRawDataError> >  errorinput;
  iEvent.getByLabel( errin_, errorinput );
  if (!errorinput.isValid()) return;

  int fedId;
  
  for(fedId = 0; fedId <= 39; fedId++) {
    //get event data for this fed
    const FEDRawData& fedRawData = rawinput->FEDData( fedId );
    if (fedRawData.size() != 0) (meRawWords_)->Fill(fedId);
  } // end for

  edm::DetSet<SiPixelRawDataError>::const_iterator  di;

  for(TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++){
    if( ((*it)->subDetector()==GeomDetEnumerators::PixelBarrel) || ((*it)->subDetector()==GeomDetEnumerators::PixelEndcap) ){
      uint32_t detId = (*it)->geographicalId();
      edm::DetSetVector<SiPixelRawDataError>::const_iterator isearch = errorinput->find(detId);
      if( isearch != errorinput->end() ) {
        for(di = isearch->data.begin(); di != isearch->data.end(); di++) {
          fedId = di->getFedId();                  // FED the error came from
          int errorType = di->getType();           // type of error
          switch(errorType) {
            case(35) : (meNErrors_)->Fill(fedId); break;
            case(36) : (meNErrors_)->Fill(fedId); break;
            case(37) : (meNErrors_)->Fill(fedId); break;
            case(38) : (meNErrors_)->Fill(fedId); break;
            default : break;
          }; // end switch
        } // end for(di
      } // end if( isearch
    } // end if( ((*it)->subDetector()
  } // for(TrackerGeometry

  edm::DetSetVector<SiPixelRawDataError>::const_iterator isearch = errorinput->find(0xffffffff);

  if( isearch != errorinput->end() ) {  // Not at empty iterator
    for(di = isearch->data.begin(); di != isearch->data.end(); di++) {
      fedId = di->getFedId();                  // FED the error came from
      int errorType = di->getType();           // type of error
      switch(errorType) {
        case(35) : (meNErrors_)->Fill(fedId); break;
        case(36) : (meNErrors_)->Fill(fedId); break;
        case(37) : (meNErrors_)->Fill(fedId); break;
        case(38) : (meNErrors_)->Fill(fedId); break;
        case(39) : (meNCRCs_)->Fill(fedId); break;
        default : break;
      }; // end switch
    } // end for(di
  } // end if( isearch
  // slow down...
  if(slowDown) usleep(100000);

}
void SiPixelHLTSource::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 69 of file SiPixelHLTSource.cc.

References firstRun.

                               {
  firstRun = true;
}
void SiPixelHLTSource::beginRun ( const edm::Run r,
edm::EventSetup const &  iSetup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 73 of file SiPixelHLTSource.cc.

References bookMEs(), eventNo, firstRun, edm::EventSetup::get(), and pDD.

                                                                           {
  LogInfo ("PixelDQM") << " SiPixelHLTSource::beginJob - Initialisation ... " << std::endl;
  iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
  if(firstRun){
    eventNo = 0;
    // Build map
    // Book Monitoring Elements
    bookMEs();
    firstRun = false;
  }
}
void SiPixelHLTSource::bookMEs ( ) [virtual]

Definition at line 164 of file SiPixelHLTSource.cc.

References DQMStore::cd(), conf_, dirName_, edm::ParameterSet::getParameter(), edm::InputTag::label(), meNCRCs_, meNErrors_, meRawWords_, cmsCodeRules::cppFunctionSkipper::operator, MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), and theDMBE.

Referenced by beginRun().

                              {

  theDMBE->cd();
  theDMBE->setCurrentFolder(dirName_);

  std::string rawhid;
  std::string errhid;
  // Get collection name and instantiate Histo Id builder
  edm::InputTag rawin = conf_.getParameter<edm::InputTag>( "RawInput" );
  SiPixelHistogramId* RawHistogramId = new SiPixelHistogramId( rawin.label() );
  edm::InputTag errin = conf_.getParameter<edm::InputTag>( "ErrorInput" );
  SiPixelHistogramId* ErrorHistogramId = new SiPixelHistogramId( errin.label() );
  // Get DQM interface
  DQMStore* theDMBE = edm::Service<DQMStore>().operator->();

  // Is a FED sending raw data
  meRawWords_ = theDMBE->book1D("FEDEntries","Number of raw words",40,-0.5,39.5);
  meRawWords_->setAxisTitle("Number of raw words",1);

  // Number of CRC errors
  meNCRCs_ = theDMBE->book1D("FEDFatal","Number of fatal errors",40,-0.5,39.5);
  meNCRCs_->setAxisTitle("Number of fatal errors",1);

  // Number of translation error words
  meNErrors_ = theDMBE->book1D("FEDNonFatal","Number of non-fatal errors",40,-0.5,39.5);
  meNErrors_->setAxisTitle("Number of non-fatal errors",1);

  delete RawHistogramId;
  delete ErrorHistogramId;

}
void SiPixelHLTSource::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 86 of file SiPixelHLTSource.cc.

References conf_, edm::ParameterSet::getParameter(), download_sqlite_cfg::outputFile, DQMStore::save(), saveFile, and theDMBE.

                                 {

  if(saveFile) {
    LogInfo ("PixelDQM") << " SiPixelHLTSource::endJob - Saving Root File " << std::endl;
    std::string outputFile = conf_.getParameter<std::string>("outputFile");
    theDMBE->save( outputFile.c_str() );
  }

}

Member Data Documentation

Definition at line 60 of file SiPixelHLTSource.h.

Referenced by bookMEs(), and endJob().

std::string SiPixelHLTSource::dirName_ [private]

Definition at line 66 of file SiPixelHLTSource.h.

Referenced by bookMEs().

Definition at line 62 of file SiPixelHLTSource.h.

Referenced by analyze().

Definition at line 67 of file SiPixelHLTSource.h.

Referenced by analyze(), and beginRun().

Definition at line 72 of file SiPixelHLTSource.h.

Referenced by beginJob(), and beginRun().

Definition at line 70 of file SiPixelHLTSource.h.

Referenced by analyze(), and bookMEs().

Definition at line 71 of file SiPixelHLTSource.h.

Referenced by analyze(), and bookMEs().

Definition at line 69 of file SiPixelHLTSource.h.

Referenced by analyze(), and bookMEs().

Definition at line 63 of file SiPixelHLTSource.h.

Referenced by analyze(), and beginRun().

Definition at line 61 of file SiPixelHLTSource.h.

Referenced by analyze().

Definition at line 64 of file SiPixelHLTSource.h.

Referenced by endJob().

Definition at line 65 of file SiPixelHLTSource.h.

Referenced by analyze().

Definition at line 68 of file SiPixelHLTSource.h.

Referenced by bookMEs(), endJob(), and SiPixelHLTSource().