CMS 3D CMS Logo

SiPixelHLTSource.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixelMonitorRawData
4 // Class: SiPixelHLTSource
5 //
17 //
18 // Original Author: Andrew York
19 //
20 // Framework
24 // DQM Framework
29 // Geometry
35 // DataFormats
43 //
44 #include <cstdlib>
45 #include <string>
46 
47 using namespace std;
48 using namespace edm;
49 
51  : conf_(iConfig),
52  rawin_(consumes<FEDRawDataCollection>(conf_.getParameter<edm::InputTag>("RawInput"))),
53  errin_(consumes<edm::DetSetVector<SiPixelRawDataError>>(conf_.getParameter<edm::InputTag>("ErrorInput"))),
55  saveFile(conf_.getUntrackedParameter<bool>("saveFile", false)),
56  slowDown(conf_.getUntrackedParameter<bool>("slowDown", false)),
57  dirName_(conf_.getUntrackedParameter<string>("DirName", "Pixel/FEDIntegrity/")) {
58  firstRun = true;
59  LogInfo("PixelDQM") << "SiPixelHLTSource::SiPixelHLTSource: Got DQM BackEnd interface" << endl;
60 }
61 
63  // do anything here that needs to be done at desctruction time
64  // (e.g. close files, deallocate resources etc.)
65  LogInfo("PixelDQM") << "SiPixelHLTSource::~SiPixelHLTSource: Destructor" << endl;
66 }
67 
69  LogInfo("PixelDQM") << " SiPixelHLTSource::beginJob - Initialisation ... " << std::endl;
70 
71  if (firstRun) {
72  eventNo = 0;
73 
74  firstRun = false;
75  }
76 }
77 
79  // Book Monitoring Elements
80  bookMEs(iBooker);
81 }
82 
83 //------------------------------------------------------------------
84 // Method called for every event
85 //------------------------------------------------------------------
87  eventNo++;
89  // get raw input data
91  iEvent.getByToken(rawin_, rawinput);
92  // get error input data
94  iEvent.getByToken(errin_, errorinput);
95  if (!errorinput.isValid())
96  return;
97 
98  int fedId;
99 
100  for (fedId = 0; fedId <= 39; fedId++) {
101  // get event data for this fed
102  const FEDRawData &fedRawData = rawinput->FEDData(fedId);
103  if (fedRawData.size() != 0)
104  (meRawWords_)->Fill(fedId);
105  } // end for
106 
108 
109  for (TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++) {
110  if (GeomDetEnumerators::isTrackerPixel((*it)->subDetector())) {
111  uint32_t detId = (*it)->geographicalId();
112  edm::DetSetVector<SiPixelRawDataError>::const_iterator isearch = errorinput->find(detId);
113  if (isearch != errorinput->end()) {
114  for (di = isearch->data.begin(); di != isearch->data.end(); di++) {
115  fedId = di->getFedId(); // FED the error came from
116  int errorType = di->getType(); // type of error
117  switch (errorType) {
118  case (35):
119  (meNErrors_)->Fill(fedId);
120  break;
121  case (36):
122  (meNErrors_)->Fill(fedId);
123  break;
124  case (37):
125  (meNErrors_)->Fill(fedId);
126  break;
127  case (38):
128  (meNErrors_)->Fill(fedId);
129  break;
130  default:
131  break;
132  }; // end switch
133  } // end for(di
134  } // end if( isearch
135  } // end if( ((*it)->subDetector()
136  } // for(TrackerGeometry
137 
138  edm::DetSetVector<SiPixelRawDataError>::const_iterator isearch = errorinput->find(0xffffffff);
139 
140  if (isearch != errorinput->end()) { // Not at empty iterator
141  for (di = isearch->data.begin(); di != isearch->data.end(); di++) {
142  fedId = di->getFedId(); // FED the error came from
143  int errorType = di->getType(); // type of error
144  switch (errorType) {
145  case (35):
146  (meNErrors_)->Fill(fedId);
147  break;
148  case (36):
149  (meNErrors_)->Fill(fedId);
150  break;
151  case (37):
152  (meNErrors_)->Fill(fedId);
153  break;
154  case (38):
155  (meNErrors_)->Fill(fedId);
156  break;
157  case (39):
158  (meNCRCs_)->Fill(fedId);
159  break;
160  default:
161  break;
162  }; // end switch
163  } // end for(di
164  } // end if( isearch
165  // slow down...
166  if (slowDown)
167  usleep(100000);
168 }
169 
170 //------------------------------------------------------------------
171 // Book MEs
172 //------------------------------------------------------------------
174  iBooker.cd();
175  iBooker.setCurrentFolder(dirName_);
176 
177  std::string rawhid;
178  std::string errhid;
179  // Get collection name and instantiate Histo Id builder
180  edm::InputTag rawin = conf_.getParameter<edm::InputTag>("RawInput");
181  SiPixelHistogramId *RawHistogramId = new SiPixelHistogramId(rawin.label());
182  edm::InputTag errin = conf_.getParameter<edm::InputTag>("ErrorInput");
183  SiPixelHistogramId *ErrorHistogramId = new SiPixelHistogramId(errin.label());
184 
185  // Is a FED sending raw data
186  meRawWords_ = iBooker.book1D("FEDEntries", "Number of raw words", 40, -0.5, 39.5);
187  meRawWords_->setAxisTitle("Number of raw words", 1);
188 
189  // Number of CRC errors
190  meNCRCs_ = iBooker.book1D("FEDFatal", "Number of fatal errors", 40, -0.5, 39.5);
191  meNCRCs_->setAxisTitle("Number of fatal errors", 1);
192 
193  // Number of translation error words
194  meNErrors_ = iBooker.book1D("FEDNonFatal", "Number of non-fatal errors", 40, -0.5, 39.5);
195  meNErrors_->setAxisTitle("Number of non-fatal errors", 1);
196 
197  delete RawHistogramId;
198  delete ErrorHistogramId;
199 }
200 
FEDNumbering.h
edm::DetSetVector
Definition: DetSetVector.h:61
electrons_cff.bool
bool
Definition: electrons_cff.py:366
PixelSubdetector.h
PixelBarrelName.h
MessageLogger.h
funct::false
false
Definition: Factorize.h:29
TrackerGeometry.h
SiPixelHLTSource::meRawWords_
MonitorElement * meRawWords_
Definition: SiPixelHLTSource.h:55
PixelTopology.h
SiPixelRawDataError
Pixel error – collection of errors and error information.
Definition: SiPixelRawDataError.h:19
edm::DetSetVector::end
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
edm::Run
Definition: Run.h:45
SiPixelHLTSource::rawin_
edm::EDGetTokenT< FEDRawDataCollection > rawin_
Definition: SiPixelHLTSource.h:48
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
SiPixelHLTSource::dqmBeginRun
void dqmBeginRun(const edm::Run &, edm::EventSetup const &) override
Definition: SiPixelHLTSource.cc:68
edm
HLT enums.
Definition: AlignableModifier.h:19
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
edm::DetSetVector::begin
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
DQMStore.h
SiPixelHistogramId.h
SiPixelHLTSource::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: SiPixelHLTSource.cc:78
fed_dqm_sourceclient-live_cfg.saveFile
saveFile
Definition: fed_dqm_sourceclient-live_cfg.py:54
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle< FEDRawDataCollection >
FEDRawData
Definition: FEDRawData.h:19
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
MakerMacros.h
l1t_dqm_sourceclient-live_cfg.fedRawData
fedRawData
Definition: l1t_dqm_sourceclient-live_cfg.py:188
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
SiPixelHLTSource.h
edm::ESHandle< TrackerGeometry >
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
SiPixelHLTSource::SiPixelHLTSource
SiPixelHLTSource(const edm::ParameterSet &conf)
Definition: SiPixelHLTSource.cc:50
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
SiPixelHLTSource::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: SiPixelHLTSource.cc:86
SiPixelHLTSource::conf_
edm::ParameterSet conf_
Definition: SiPixelHLTSource.h:47
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackerDigiGeometryRecord.h
SiPixelHLTSource::~SiPixelHLTSource
~SiPixelHLTSource() override
Definition: SiPixelHLTSource.cc:62
SiPixelHistogramId
Definition: SiPixelHistogramId.h:25
edm::ParameterSet
Definition: ParameterSet.h:47
SiPixelHLTSource::meNErrors_
MonitorElement * meNErrors_
Definition: SiPixelHLTSource.h:57
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
SiPixelHLTSource::errin_
edm::EDGetTokenT< edm::DetSetVector< SiPixelRawDataError > > errin_
Definition: SiPixelHLTSource.h:49
GeomDetEnumerators::isTrackerPixel
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
Definition: GeomDetEnumerators.cc:68
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
edm::EventSetup
Definition: EventSetup.h:58
TrackerGeometry::dets
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: TrackerGeometry.h:62
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:88
SiPixelHLTSource::trackerGeomToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeomToken_
Definition: SiPixelHLTSource.h:50
HcalObjRepresent::Fill
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: HcalObjRepresent.h:1053
alignCSCRings.r
r
Definition: alignCSCRings.py:93
fed_dqm_sourceclient-live_cfg.slowDown
slowDown
Definition: fed_dqm_sourceclient-live_cfg.py:55
std
Definition: JetResolutionObject.h:76
SiPixelHLTSource::firstRun
bool firstRun
Definition: SiPixelHLTSource.h:58
DetId.h
PixelGeomDetUnit.h
SiPixelHLTSource::dirName_
std::string dirName_
Definition: SiPixelHLTSource.h:53
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PixelEndcapNameUpgrade.h
GeomDetEnumerators.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
SiPixelHLTSource::eventNo
int eventNo
Definition: SiPixelHLTSource.h:54
SiPixelHLTSource::meNCRCs_
MonitorElement * meNCRCs_
Definition: SiPixelHLTSource.h:56
SiPixelFolderOrganizer.h
SiPixelHLTSource::slowDown
bool slowDown
Definition: SiPixelHLTSource.h:52
SiPixelHLTSource::bookMEs
virtual void bookMEs(DQMStore::IBooker &)
Definition: SiPixelHLTSource.cc:173
PixelBarrelNameUpgrade.h
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
SiPixelHLTSource
Definition: SiPixelHLTSource.h:36
edm::InputTag
Definition: InputTag.h:15
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
PixelEndcapName.h
TrackerGeometry
Definition: TrackerGeometry.h:14
edm::DetSet::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31