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;
76  iSetup.get<TrackerDigiGeometryRecord>().get(geom_);
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) {
141  std::string hid = theHistogramIdWorker_->setHistoId(name, detid);
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 
153  std::string hid = theHistogramIdWorker_->setHistoId(name, detid);
154  return daqBE_->book2D(hid, title, maxcol, 0, maxcol, maxrow, 0, maxrow);
155 }
156 
158  daqBE_->setCurrentFolder(dirName);
159  return daqBE_->dirExists(dirName);
160 }
161 
163 
164 // -- define this as a plug-in
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual int nrows() const =0
MonitorElement * book2D(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1178
MonitorElement * bookDQMHistogram2D(uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool setModuleFolder(const uint32_t &rawdetid=0, int type=0, bool isUpgrade=false)
Set folder name for a module or plaquette.
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * bookDQMHistoPlaquetteSummary2D(uint32_t detid, std::string name, std::string title)
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
std::map< uint32_t, MonitorElement * > SiPixelErrorsDigisToCalibDigis_2DErrorInformation_
std::string setHistoId(std::string variable, uint32_t &rawId)
Set Histogram Id.
Definition: DetId.h:17
SiPixelErrorsDigisToCalibDigis(const edm::ParameterSet &)
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
edm::EDGetTokenT< edm::DetSetVector< SiPixelCalibDigiError > > tPixelCalibDigiError
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:639
std::string const & label() const
Definition: InputTag.h:36
HLT enums.
virtual int ncolumns() const =0
T get() const
Definition: EventSetup.h:73
const TrackerGeomDet * idToDet(DetId) const override
edm::ESHandle< TrackerGeometry > geom_
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
collection_type::const_iterator const_iterator
Definition: DetSet.h:32
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
save
Definition: cuy.py:1165
bool dirExists(std::string const &path) const
true if directory exists
Definition: DQMStore.cc:698