CMS 3D CMS Logo

Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes

SiPixelErrorsDigisToCalibDigis Class Reference

#include <SiPixelErrors/SiPixelErrorsDigisToCalibDigis/src/SiPixelErrorsDigisToCalibDigis.cc>

Inheritance diagram for SiPixelErrorsDigisToCalibDigis:
edm::EDAnalyzer

List of all members.

Public Member Functions

MonitorElementbookDQMHistogram2D (uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
MonitorElementbookDQMHistoPlaquetteSummary2D (uint32_t detid, std::string name, std::string title)
bool setDQMDirectory (std::string dirName)
bool setDQMDirectory (uint32_t detID)
 SiPixelErrorsDigisToCalibDigis (const edm::ParameterSet &)
 ~SiPixelErrorsDigisToCalibDigis ()

Protected Attributes

edm::ESHandle< TrackerGeometrygeom_

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void endJob ()

Private Attributes

bool createOutputFile_
DQMStoredaqBE_
SiPixelFolderOrganizerfolderMaker_
std::string outputFilename_
std::map< uint32_t,
MonitorElement * > 
SiPixelErrorsDigisToCalibDigis_2DErrorInformation_
edm::InputTag siPixelProducerLabel_
MonitorElementtemp
SiPixelHistogramIdtheHistogramIdWorker_

Detailed Description

class SiPixelErrorsDigisToCalibDigis

Description: Create monitorElements for the Errors in created in the reduction of digis to calibDigis

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 51 of file SiPixelErrorsDigisToCalibDigis.h.


Constructor & Destructor Documentation

SiPixelErrorsDigisToCalibDigis::SiPixelErrorsDigisToCalibDigis ( const edm::ParameterSet iConfig) [explicit]

Definition at line 46 of file SiPixelErrorsDigisToCalibDigis.cc.

References createOutputFile_, daqBE_, folderMaker_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), outputFilename_, and siPixelProducerLabel_.

{

  siPixelProducerLabel_ = iConfig.getParameter<edm::InputTag>("SiPixelProducerLabelTag"); 
  createOutputFile_ = iConfig.getUntrackedParameter<bool>("saveFile",false);
  outputFilename_ = iConfig.getParameter<std::string>("outputFilename");
  daqBE_ = &*edm::Service<DQMStore>();
  folderMaker_ = new SiPixelFolderOrganizer();

//  std::cout<<"siPixelProducerLabel_ = "<<siPixelProducerLabel_<<std::endl;
//  std::cout<<"createOutputFile_= "<< createOutputFile_<<std::endl;
//  std::cout<<"outpuFilename_= "<< outputFilename_<< std::endl;
}
SiPixelErrorsDigisToCalibDigis::~SiPixelErrorsDigisToCalibDigis ( )

Definition at line 62 of file SiPixelErrorsDigisToCalibDigis.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 77 of file SiPixelErrorsDigisToCalibDigis.cc.

References edm::DetSet< T >::begin(), bookDQMHistoPlaquetteSummary2D(), edm::DetSet< T >::end(), MonitorElement::Fill(), first, geom_, edm::EventSetup::get(), edm::Event::getByLabel(), edm::InputTag::label(), setDQMDirectory(), SiPixelErrorsDigisToCalibDigis_2DErrorInformation_, siPixelProducerLabel_, and theHistogramIdWorker_.

{
  using namespace edm;

  static int first(1); 
  if (1 == first) {
    first = 0; 
    iSetup.get<TrackerDigiGeometryRecord>().get( geom_ );
    theHistogramIdWorker_ = new SiPixelHistogramId(siPixelProducerLabel_.label());
  }
  
  Handle<DetSetVector<SiPixelCalibDigiError> > thePlaquettes;
  iEvent.getByLabel(siPixelProducerLabel_, thePlaquettes);
  // iEvent.getByLabel("siPixelCalibDigis", thePlaquettes);
  
  
  DetSetVector<SiPixelCalibDigiError>::const_iterator digiIter;
  
  
  for (digiIter=thePlaquettes->begin(); digiIter!=thePlaquettes->end(); digiIter++)
    {
      uint32_t detId = digiIter->id;
      
      DetSet<SiPixelCalibDigiError>::const_iterator ipix;
      //loop over pixel errors pulsed in the current plaquette

      MonitorElement* temp_;

      std::map<uint32_t, MonitorElement*>::iterator mapIterator =  SiPixelErrorsDigisToCalibDigis_2DErrorInformation_.find(detId);
      
      if (digiIter->begin() != digiIter->end()) {
        if ( mapIterator == SiPixelErrorsDigisToCalibDigis_2DErrorInformation_.end() )
          {
//          std::cout << "This is the beginning of an error 2d histo booking: "<<std::endl;
            setDQMDirectory(detId);
            temp_ = bookDQMHistoPlaquetteSummary2D(detId, "SiPixelErrorsCalibDigis", "SiPixelErrorsDigisToCalibDigis");
            SiPixelErrorsDigisToCalibDigis_2DErrorInformation_.insert( std::make_pair(detId,temp_));
          }
        else
          {
//          std::cout << "This one was already booked."<<std::endl;
            temp_ = (*mapIterator).second;
          }
        
        for(ipix=digiIter->begin(); ipix!=digiIter->end(); ++ipix)
          {
            temp_->Fill(ipix->getCol(), ipix->getRow());
//          std::cout << "detId: " << detId << " " << ipix->getRow() << " " << ipix->getCol() << std::endl;       
          }
        
      } // end of the if statement asking if the plaquette in question has any errors in it    
      
    }// end of the for loop that goes through all plaquettes

}
void SiPixelErrorsDigisToCalibDigis::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 136 of file SiPixelErrorsDigisToCalibDigis.cc.

{

}
MonitorElement * SiPixelErrorsDigisToCalibDigis::bookDQMHistogram2D ( uint32_t  detid,
std::string  name,
std::string  title,
int  nchX,
double  lowX,
double  highX,
int  nchY,
double  lowY,
double  highY 
)

Definition at line 154 of file SiPixelErrorsDigisToCalibDigis.cc.

References DQMStore::book2D(), daqBE_, SiPixelHistogramId::setHistoId(), and theHistogramIdWorker_.

{
  std::string hid = theHistogramIdWorker_->setHistoId(name,detid);
  return daqBE_->book2D(hid, title, nchX, lowX, highX, nchY, lowY, highY);
}
MonitorElement * SiPixelErrorsDigisToCalibDigis::bookDQMHistoPlaquetteSummary2D ( uint32_t  detid,
std::string  name,
std::string  title 
)

Definition at line 160 of file SiPixelErrorsDigisToCalibDigis.cc.

References DQMStore::book2D(), daqBE_, geom_, TrackerGeometry::idToDet(), PixelTopology::ncolumns(), PixelTopology::nrows(), SiPixelHistogramId::setHistoId(), PixelGeomDetUnit::specificTopology(), and theHistogramIdWorker_.

Referenced by analyze().

                                                                                                                            {

  DetId detId(detid);
  const TrackerGeometry &theTracker(*geom_);
  const PixelGeomDetUnit *theGeomDet = dynamic_cast<const PixelGeomDetUnit*> ( theTracker.idToDet(detId) ); 
  int maxcol = theGeomDet->specificTopology().ncolumns();
  int maxrow = theGeomDet->specificTopology().nrows();  

  std::string hid = theHistogramIdWorker_->setHistoId(name,detid);
  return daqBE_->book2D(hid,title,maxcol,0,maxcol,maxrow,0,maxrow);
}
void SiPixelErrorsDigisToCalibDigis::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 143 of file SiPixelErrorsDigisToCalibDigis.cc.

References createOutputFile_, and outputFilename_.

                                       { 

  if (!outputFilename_.empty() && createOutputFile_)
    {
      edm::LogInfo("SiPixelErrorCalibDigis") << "Writing ROOT file to: " << outputFilename_ << std::endl;
      if ( &*edm::Service<DQMStore>()) edm::Service<DQMStore>()->save (outputFilename_);
    }
}
bool SiPixelErrorsDigisToCalibDigis::setDQMDirectory ( uint32_t  detID)
bool SiPixelErrorsDigisToCalibDigis::setDQMDirectory ( std::string  dirName)

Member Data Documentation

Definition at line 80 of file SiPixelErrorsDigisToCalibDigis.h.

Referenced by endJob(), and SiPixelErrorsDigisToCalibDigis().

Definition at line 63 of file SiPixelErrorsDigisToCalibDigis.h.

Referenced by analyze(), and bookDQMHistoPlaquetteSummary2D().

Definition at line 79 of file SiPixelErrorsDigisToCalibDigis.h.

Referenced by endJob(), and SiPixelErrorsDigisToCalibDigis().

Definition at line 83 of file SiPixelErrorsDigisToCalibDigis.h.

Referenced by analyze().

Definition at line 75 of file SiPixelErrorsDigisToCalibDigis.h.

Referenced by analyze(), and SiPixelErrorsDigisToCalibDigis().

Definition at line 85 of file SiPixelErrorsDigisToCalibDigis.h.