CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
26 
27 //
28 // constants, enums and typedefs
29 //
30 
31 //
32 // static data member definitions
33 //
34 
35 //
36 // constructors and destructor
37 //
39 
40 {
41  siPixelProducerLabel_ = iConfig.getParameter<edm::InputTag>("SiPixelProducerLabelTag");
42  createOutputFile_ = iConfig.getUntrackedParameter<bool>("saveFile", false);
43  outputFilename_ = iConfig.getParameter<std::string>("outputFilename");
46 
47  tPixelCalibDigiError = consumes<edm::DetSetVector<SiPixelCalibDigiError> >(siPixelProducerLabel_);
48 
49  trackerGeomToken_ = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>();
50 
51  // std::cout<<"siPixelProducerLabel_ = "<<siPixelProducerLabel_<<std::endl;
52  // std::cout<<"createOutputFile_= "<< createOutputFile_<<std::endl;
53  // std::cout<<"outpuFilename_= "<< outputFilename_<< std::endl;
54 }
55 
57  // do anything here that needs to be done at desctruction time
58  // (e.g. close files, deallocate resources etc.)
59 }
60 
61 //
62 // member functions
63 //
64 
65 // ------------ method called to for each event ------------
67  using namespace edm;
68 
69  static int first(1);
70  if (1 == first) {
71  first = 0;
74  }
75 
77  iEvent.getByToken(tPixelCalibDigiError, thePlaquettes);
78  // iEvent.getByLabel("siPixelCalibDigis", thePlaquettes);
79 
81 
82  for (digiIter = thePlaquettes->begin(); digiIter != thePlaquettes->end(); digiIter++) {
83  uint32_t detId = digiIter->id;
84 
86  //loop over pixel errors pulsed in the current plaquette
87 
88  MonitorElement* temp_;
89 
90  std::map<uint32_t, MonitorElement*>::iterator mapIterator =
92 
93  if (digiIter->begin() != digiIter->end()) {
94  if (mapIterator == SiPixelErrorsDigisToCalibDigis_2DErrorInformation_.end()) {
95  // std::cout << "This is the beginning of an error 2d histo booking: "<<std::endl;
96  setDQMDirectory(detId);
97  temp_ = bookDQMHistoPlaquetteSummary2D(detId, "SiPixelErrorsCalibDigis", "SiPixelErrorsDigisToCalibDigis");
98  SiPixelErrorsDigisToCalibDigis_2DErrorInformation_.insert(std::make_pair(detId, temp_));
99  } else {
100  // std::cout << "This one was already booked."<<std::endl;
101  temp_ = (*mapIterator).second;
102  }
103 
104  for (ipix = digiIter->begin(); ipix != digiIter->end(); ++ipix) {
105  temp_->Fill(ipix->getCol(), ipix->getRow());
106  // std::cout << "detId: " << detId << " " << ipix->getRow() << " " << ipix->getCol() << std::endl;
107  }
108 
109  } // end of the if statement asking if the plaquette in question has any errors in it
110 
111  } // end of the for loop that goes through all plaquettes
112 }
113 
114 // ------------ method called once each job just after ending the event loop ------------
116  if (!outputFilename_.empty() && createOutputFile_) {
117  edm::LogInfo("SiPixelErrorCalibDigis") << "Writing ROOT file to: " << outputFilename_ << std::endl;
118  if (edm::Service<DQMStore>().isAvailable())
120  }
121 }
122 
123 // ------------ helper functions ---------------------------------------------------------
124 
128  int nchX,
129  double lowX,
130  double highX,
131  int nchY,
132  double lowY,
133  double highY) {
134  std::string hid = theHistogramIdWorker_->setHistoId(name, detid);
135  return daqBE_->book2D(hid, title, nchX, lowX, highX, nchY, lowY, highY);
136 }
137 
139  uint32_t detid, std::string name, std::string title) {
140  DetId detId(detid);
141  const TrackerGeometry& theTracker(*geom_);
142  const PixelGeomDetUnit* theGeomDet = dynamic_cast<const PixelGeomDetUnit*>(theTracker.idToDet(detId));
143  int maxcol = theGeomDet->specificTopology().ncolumns();
144  int maxrow = theGeomDet->specificTopology().nrows();
145 
146  std::string hid = theHistogramIdWorker_->setHistoId(name, detid);
147  return daqBE_->book2D(hid, title, maxcol, 0, maxcol, maxrow, 0, maxrow);
148 }
149 
151  daqBE_->setCurrentFolder(dirName);
152  return daqBE_->dirExists(dirName);
153 }
154 
156 
157 // -- define this as a plug-in
iterator end()
Definition: DetSet.h:58
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * bookDQMHistogram2D(uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
virtual int ncolumns() const =0
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
virtual int nrows() const =0
virtual bool dirExists(std::string const &path) const
Definition: DQMStore.cc:730
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
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)
const TrackerGeomDet * idToDet(DetId) const override
std::map< uint32_t, MonitorElement * > SiPixelErrorsDigisToCalibDigis_2DErrorInformation_
iterator begin()
Definition: DetSet.h:57
std::string setHistoId(std::string variable, uint32_t &rawId)
Set Histogram Id.
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeomToken_
Log< level::Info, false > LogInfo
Definition: DetId.h:17
SiPixelErrorsDigisToCalibDigis(const edm::ParameterSet &)
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
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< edm::DetSetVector< SiPixelCalibDigiError > > tPixelCalibDigiError
std::string const & label() const
Definition: InputTag.h:36
list save
Definition: cuy.py:1164
edm::ESHandle< TrackerGeometry > geom_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
collection_type::const_iterator const_iterator
Definition: DetSet.h:31
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102