CMS 3D CMS Logo

SiPixelErrorsDigisToCalibDigis.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixelErrorsDigisToCalibDigis
4 // Class: SiPixelErrorsDigisToCalibDigis
5 //
13 //
14 // Original Author: Ricardo Vasquez Sierra
15 // Created: Wed Apr 9 12:43:02 CEST 2008
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
23 
24 // user include files
27 
30 
32 
33 //
34 // constants, enums and typedefs
35 //
36 
37 //
38 // static data member definitions
39 //
40 
41 //
42 // constructors and destructor
43 //
45 
46 {
47  siPixelProducerLabel_ = iConfig.getParameter<edm::InputTag>("SiPixelProducerLabelTag");
48  createOutputFile_ = iConfig.getUntrackedParameter<bool>("saveFile", false);
49  outputFilename_ = iConfig.getParameter<std::string>("outputFilename");
52 
53  tPixelCalibDigiError = consumes<edm::DetSetVector<SiPixelCalibDigiError> >(siPixelProducerLabel_);
54 
55  // std::cout<<"siPixelProducerLabel_ = "<<siPixelProducerLabel_<<std::endl;
56  // std::cout<<"createOutputFile_= "<< createOutputFile_<<std::endl;
57  // std::cout<<"outpuFilename_= "<< outputFilename_<< std::endl;
58 }
59 
61  // do anything here that needs to be done at desctruction time
62  // (e.g. close files, deallocate resources etc.)
63 }
64 
65 //
66 // member functions
67 //
68 
69 // ------------ method called to for each event ------------
71  using namespace edm;
72 
73  static int first(1);
74  if (1 == first) {
75  first = 0;
78  }
79 
81  iEvent.getByToken(tPixelCalibDigiError, thePlaquettes);
82  // iEvent.getByLabel("siPixelCalibDigis", thePlaquettes);
83 
85 
86  for (digiIter = thePlaquettes->begin(); digiIter != thePlaquettes->end(); digiIter++) {
87  uint32_t detId = digiIter->id;
88 
90  //loop over pixel errors pulsed in the current plaquette
91 
92  MonitorElement* temp_;
93 
94  std::map<uint32_t, MonitorElement*>::iterator mapIterator =
96 
97  if (digiIter->begin() != digiIter->end()) {
98  if (mapIterator == SiPixelErrorsDigisToCalibDigis_2DErrorInformation_.end()) {
99  // std::cout << "This is the beginning of an error 2d histo booking: "<<std::endl;
100  setDQMDirectory(detId);
101  temp_ = bookDQMHistoPlaquetteSummary2D(detId, "SiPixelErrorsCalibDigis", "SiPixelErrorsDigisToCalibDigis");
102  SiPixelErrorsDigisToCalibDigis_2DErrorInformation_.insert(std::make_pair(detId, temp_));
103  } else {
104  // std::cout << "This one was already booked."<<std::endl;
105  temp_ = (*mapIterator).second;
106  }
107 
108  for (ipix = digiIter->begin(); ipix != digiIter->end(); ++ipix) {
109  temp_->Fill(ipix->getCol(), ipix->getRow());
110  // std::cout << "detId: " << detId << " " << ipix->getRow() << " " << ipix->getCol() << std::endl;
111  }
112 
113  } // end of the if statement asking if the plaquette in question has any errors in it
114 
115  } // end of the for loop that goes through all plaquettes
116 }
117 
118 // ------------ method called once each job just before starting event loop ------------
120 
121 // ------------ method called once each job just after ending the event loop ------------
123  if (!outputFilename_.empty() && createOutputFile_) {
124  edm::LogInfo("SiPixelErrorCalibDigis") << "Writing ROOT file to: " << outputFilename_ << std::endl;
125  if (edm::Service<DQMStore>().isAvailable())
127  }
128 }
129 
130 // ------------ helper functions ---------------------------------------------------------
131 
135  int nchX,
136  double lowX,
137  double highX,
138  int nchY,
139  double lowY,
140  double highY) {
142  return daqBE_->book2D(hid, title, nchX, lowX, highX, nchY, lowY, highY);
143 }
144 
146  uint32_t detid, std::string name, std::string title) {
147  DetId detId(detid);
148  const TrackerGeometry& theTracker(*geom_);
149  const PixelGeomDetUnit* theGeomDet = dynamic_cast<const PixelGeomDetUnit*>(theTracker.idToDet(detId));
150  int maxcol = theGeomDet->specificTopology().ncolumns();
151  int maxrow = theGeomDet->specificTopology().nrows();
152 
154  return daqBE_->book2D(hid, title, maxcol, 0, maxcol, maxrow, 0, maxrow);
155 }
156 
159  return daqBE_->dirExists(dirName);
160 }
161 
163 
164 // -- define this as a plug-in
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
SiPixelErrorsDigisToCalibDigis::theHistogramIdWorker_
SiPixelHistogramId * theHistogramIdWorker_
Definition: SiPixelErrorsDigisToCalibDigis.h:90
SiPixelErrorsDigisToCalibDigis::daqBE_
DQMStore * daqBE_
Definition: SiPixelErrorsDigisToCalibDigis.h:89
edm::DetSetVector::end
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
SiPixelFolderOrganizer::setModuleFolder
bool setModuleFolder(const uint32_t &rawdetid=0, int type=0, bool isUpgrade=false)
Set folder name for a module or plaquette.
Definition: SiPixelFolderOrganizer.cc:27
edm
HLT enums.
Definition: AlignableModifier.h:19
SiPixelErrorsDigisToCalibDigis::outputFilename_
std::string outputFilename_
Definition: SiPixelErrorsDigisToCalibDigis.h:91
edm::DetSetVector::begin
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EDAnalyzer.h
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
dqmdumpme.first
first
Definition: dqmdumpme.py:55
SiPixelErrorsDigisToCalibDigis::~SiPixelErrorsDigisToCalibDigis
~SiPixelErrorsDigisToCalibDigis() override
Definition: SiPixelErrorsDigisToCalibDigis.cc:60
SiPixelErrorsDigisToCalibDigis::setDQMDirectory
bool setDQMDirectory(std::string dirName)
Definition: SiPixelErrorsDigisToCalibDigis.cc:157
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
DetId
Definition: DetId.h:17
MakerMacros.h
SiPixelErrorsDigisToCalibDigis::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: SiPixelErrorsDigisToCalibDigis.cc:70
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
SiPixelErrorsDigisToCalibDigis::SiPixelErrorsDigisToCalibDigis
SiPixelErrorsDigisToCalibDigis(const edm::ParameterSet &)
Definition: SiPixelErrorsDigisToCalibDigis.cc:44
SiPixelErrorsDigisToCalibDigis::createOutputFile_
bool createOutputFile_
Definition: SiPixelErrorsDigisToCalibDigis.h:92
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
SiPixelErrorsDigisToCalibDigis::siPixelProducerLabel_
edm::InputTag siPixelProducerLabel_
Definition: SiPixelErrorsDigisToCalibDigis.h:86
SiPixelHistogramId::setHistoId
std::string setHistoId(std::string variable, uint32_t &rawId)
Set Histogram Id.
Definition: SiPixelHistogramId.cc:29
PixelTopology::ncolumns
virtual int ncolumns() const =0
dqm::implementation::DQMStore::setCurrentFolder
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
SiPixelErrorsDigisToCalibDigis::bookDQMHistoPlaquetteSummary2D
MonitorElement * bookDQMHistoPlaquetteSummary2D(uint32_t detid, std::string name, std::string title)
Definition: SiPixelErrorsDigisToCalibDigis.cc:145
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiPixelHistogramId
Definition: SiPixelHistogramId.h:25
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
SiPixelErrorsDigisToCalibDigis::SiPixelErrorsDigisToCalibDigis_2DErrorInformation_
std::map< uint32_t, MonitorElement * > SiPixelErrorsDigisToCalibDigis_2DErrorInformation_
Definition: SiPixelErrorsDigisToCalibDigis.h:95
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
PixelGeomDetUnit::specificTopology
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Definition: PixelGeomDetUnit.cc:17
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
SiPixelErrorsDigisToCalibDigis.h
get
#define get
SiPixelErrorsDigisToCalibDigis
Definition: SiPixelErrorsDigisToCalibDigis.h:49
Frameworkfwd.h
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
SiPixelFolderOrganizer
Definition: SiPixelFolderOrganizer.h:26
SiPixelErrorsDigisToCalibDigis::beginJob
void beginJob() override
Definition: SiPixelErrorsDigisToCalibDigis.cc:119
TrackerOfflineValidation_Dqm_cff.dirName
dirName
Definition: TrackerOfflineValidation_Dqm_cff.py:55
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiPixelErrorsDigisToCalibDigis::folderMaker_
SiPixelFolderOrganizer * folderMaker_
Definition: SiPixelErrorsDigisToCalibDigis.h:94
ParameterSet.h
SiPixelErrorsDigisToCalibDigis::geom_
edm::ESHandle< TrackerGeometry > geom_
Definition: SiPixelErrorsDigisToCalibDigis.h:74
SiPixelErrorsDigisToCalibDigis::endJob
void endJob() override
Definition: SiPixelErrorsDigisToCalibDigis.cc:122
edm::Event
Definition: Event.h:73
PixelTopology::nrows
virtual int nrows() const =0
SiPixelErrorsDigisToCalibDigis::tPixelCalibDigiError
edm::EDGetTokenT< edm::DetSetVector< SiPixelCalibDigiError > > tPixelCalibDigiError
Definition: SiPixelErrorsDigisToCalibDigis.h:87
edm::InputTag
Definition: InputTag.h:15
dqm::implementation::IGetter::dirExists
virtual bool dirExists(std::string const &path) const
Definition: DQMStore.cc:708
TrackerGeometry
Definition: TrackerGeometry.h:14
SiPixelErrorsDigisToCalibDigis::bookDQMHistogram2D
MonitorElement * bookDQMHistogram2D(uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Definition: SiPixelErrorsDigisToCalibDigis.cc:132
edm::DetSet::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31