CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
SiPixelRawDataErrorSource Class Reference

#include <SiPixelRawDataErrorSource.h>

Inheritance diagram for SiPixelRawDataErrorSource:
edm::EDAnalyzer

Public Types

typedef edm::DetSet
< SiPixelRawDataError >
::const_iterator 
ErrorIterator
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginRun (const edm::Run &, edm::EventSetup const &)
 
virtual void bookMEs ()
 
virtual void buildStructure (edm::EventSetup const &)
 
virtual void endJob ()
 
 SiPixelRawDataErrorSource (const edm::ParameterSet &conf)
 
 ~SiPixelRawDataErrorSource ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

bool bladeOn
 
MonitorElementbyLumiErrors
 
edm::ParameterSet conf_
 
MonitorElementerrorRate
 
int eventNo
 
bool firstRun
 
bool isPIB
 
bool ladOn
 
bool modOn
 
bool reducedSet
 
bool saveFile
 
bool slowDown
 
edm::InputTag src_
 
DQMStoretheDMBE
 
std::map< uint32_t,
SiPixelRawDataErrorModule * > 
theFEDStructure
 
std::map< uint32_t,
SiPixelRawDataErrorModule * > 
thePixelStructure
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: Produces histograms for error information generated at the raw2digi stage for the pixel tracker.

Usage: Takes a DetSetVector<SiPixelRawDataError> as input, and uses it to populate a folder hierarchy (organized by detId) with histograms containing information about the errors. Uses SiPixelRawDataErrorModule class to book and fill individual folders. Note that this source is different than other DQM sources in the creation of an unphysical detId folder (detId=0xffffffff) to hold information about errors for which there is no detId available (except the dummy detId given to it at raw2digi).

Definition at line 53 of file SiPixelRawDataErrorSource.h.

Member Typedef Documentation

Definition at line 58 of file SiPixelRawDataErrorSource.h.

Constructor & Destructor Documentation

SiPixelRawDataErrorSource::SiPixelRawDataErrorSource ( const edm::ParameterSet conf)
explicit

Definition at line 49 of file SiPixelRawDataErrorSource.cc.

References cmsCodeRules.cppFunctionSkipper::operator, and theDMBE.

49  :
50  conf_(iConfig),
51  src_( conf_.getParameter<edm::InputTag>( "src" ) ),
52  saveFile( conf_.getUntrackedParameter<bool>("saveFile",false) ),
53  isPIB( conf_.getUntrackedParameter<bool>("isPIB",false) ),
54  slowDown( conf_.getUntrackedParameter<bool>("slowDown",false) ),
55  reducedSet( conf_.getUntrackedParameter<bool>("reducedSet",false) ),
56  modOn( conf_.getUntrackedParameter<bool>("modOn",true) ),
57  ladOn( conf_.getUntrackedParameter<bool>("ladOn",false) ),
58  bladeOn( conf_.getUntrackedParameter<bool>("bladeOn",false) )
59 {
61  LogInfo ("PixelDQM") << "SiPixelRawDataErrorSource::SiPixelRawDataErrorSource: Got DQM BackEnd interface"<<endl;
62 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
SiPixelRawDataErrorSource::~SiPixelRawDataErrorSource ( )

Definition at line 65 of file SiPixelRawDataErrorSource.cc.

66 {
67  // do anything here that needs to be done at desctruction time
68  // (e.g. close files, deallocate resources etc.)
69  LogInfo ("PixelDQM") << "SiPixelRawDataErrorSource::~SiPixelRawDataErrorSource: Destructor"<<endl;
70 }

Member Function Documentation

void SiPixelRawDataErrorSource::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 107 of file SiPixelRawDataErrorSource.cc.

References bladeOn, eventNo, MonitorElement::Fill(), DQMStore::get(), MonitorElement::getBinContent(), edm::Event::getByLabel(), collect_tpl::input, edm::HandleBase::isValid(), ladOn, edm::EventBase::luminosityBlock(), modOn, cmsCodeRules.cppFunctionSkipper::operator, MonitorElement::setBinContent(), slowDown, src_, theDMBE, theFEDStructure, and thePixelStructure.

108 {
109  eventNo++;
110  //std::cout<<"Event number: "<<eventNo<<std::endl;
111  // get input data
113  iEvent.getByLabel( src_, input );
114  if (!input.isValid()) return;
115 
116  // Get DQM interface
118 
119  //float iOrbitSec = iEvent.orbitNumber()/11223.;
120  //int bx = iEvent.bunchCrossing();
121  //long long tbx = (long long)iEvent.orbitNumber() * 3564 + bx;
122  int lumiSection = (int)iEvent.luminosityBlock();
123 
124  int nEventBPIXModuleErrors = 0; int nEventFPIXModuleErrors = 0; int nEventBPIXFEDErrors = 0; int nEventFPIXFEDErrors = 0;
125  int nErrors = 0;
126 
127  std::map<uint32_t,SiPixelRawDataErrorModule*>::iterator struct_iter;
128  std::map<uint32_t,SiPixelRawDataErrorModule*>::iterator struct_iter2;
129  for (struct_iter = thePixelStructure.begin() ; struct_iter != thePixelStructure.end() ; struct_iter++) {
130 
131  int numberOfModuleErrors = (*struct_iter).second->fill(*input, modOn, ladOn, bladeOn);
132  if((*struct_iter).first >= 302055684 && (*struct_iter).first <= 302197792 ) nEventBPIXModuleErrors = nEventBPIXModuleErrors + numberOfModuleErrors;
133  if((*struct_iter).first >= 343999748 && (*struct_iter).first <= 352477708 ) nEventFPIXModuleErrors = nEventFPIXModuleErrors + numberOfModuleErrors;
134  nErrors = nErrors + numberOfModuleErrors;
135  }
136  for (struct_iter2 = theFEDStructure.begin() ; struct_iter2 != theFEDStructure.end() ; struct_iter2++) {
137 
138  int numberOfFEDErrors = (*struct_iter2).second->fillFED(*input);
139  if((*struct_iter2).first <= 31) nEventBPIXFEDErrors = nEventBPIXFEDErrors + numberOfFEDErrors; // (*struct_iter2).first >= 0, since (*struct_iter2).first is unsigned
140  if((*struct_iter2).first >= 32 && (*struct_iter2).first <= 39) nEventFPIXFEDErrors = nEventFPIXFEDErrors + numberOfFEDErrors;
141  nErrors = nErrors + numberOfFEDErrors;
142  }
143  MonitorElement* me = theDMBE->get("Pixel/AdditionalPixelErrors/byLumiErrors");
144  if(me){
145  me->setBinContent(0,eventNo);
146  if(nEventBPIXModuleErrors+nEventBPIXFEDErrors>0) me->setBinContent(1,nEventBPIXModuleErrors+nEventBPIXFEDErrors);
147  if(nEventFPIXModuleErrors+nEventFPIXFEDErrors>0) me->setBinContent(2,nEventFPIXModuleErrors+nEventFPIXFEDErrors);
148  }
149 
150  // Rate of errors per lumi section:
151  MonitorElement* me1 = theDMBE->get("Pixel/AdditionalPixelErrors/errorRate");
152  if(me1){
153  int nLumiErrors = int(me1->getBinContent(lumiSection+1)) + nErrors;
154  me1->Fill(lumiSection, nLumiErrors);
155  }
156 
157 
158 
159  // slow down...
160  if(slowDown) usleep(100000);
161 
162 }
void setBinContent(int binx, double content)
set content of bin (1-D)
std::map< uint32_t, SiPixelRawDataErrorModule * > theFEDStructure
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
void Fill(long long x)
std::map< uint32_t, SiPixelRawDataErrorModule * > thePixelStructure
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1270
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
tuple input
Definition: collect_tpl.py:10
double getBinContent(int binx) const
get content of bin (1-D)
void SiPixelRawDataErrorSource::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 73 of file SiPixelRawDataErrorSource.cc.

References firstRun.

73  {
74  firstRun = true;
75 }
void SiPixelRawDataErrorSource::beginRun ( const edm::Run r,
edm::EventSetup const &  iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 77 of file SiPixelRawDataErrorSource.cc.

References bladeOn, bookMEs(), buildStructure(), eventNo, firstRun, ladOn, and modOn.

77  {
78 
79  LogInfo ("PixelDQM") << " SiPixelRawDataErrorSource::beginRun - Initialisation ... " << std::endl;
80  LogInfo ("PixelDQM") << "Mod/Lad/Blade " << modOn << "/" << ladOn << "/" << bladeOn << std::endl;
81 
82  if(firstRun){
83  eventNo = 0;
84  // Build map
85  buildStructure(iSetup);
86  // Book Monitoring Elements
87  bookMEs();
88 
89  firstRun = false;
90  }
91 }
virtual void buildStructure(edm::EventSetup const &)
void SiPixelRawDataErrorSource::bookMEs ( )
virtual

Create folder tree and book histograms

Create folder tree for errors without detId and book histograms

Definition at line 239 of file SiPixelRawDataErrorSource.cc.

References bladeOn, DQMStore::book1D(), byLumiErrors, conf_, errorRate, edm::hlt::Exception, isPIB, ladOn, LogDebug, modOn, cmsCodeRules.cppFunctionSkipper::operator, DQMStore::setCurrentFolder(), SiPixelFolderOrganizer::setFedFolder(), MonitorElement::setLumiFlag(), SiPixelFolderOrganizer::setModuleFolder(), theDMBE, theFEDStructure, thePixelStructure, and indexGen::title.

Referenced by beginRun().

239  {
240 
241  // Get DQM interface
243  theDMBE->setCurrentFolder("Pixel/AdditionalPixelErrors");
244  char title[80]; sprintf(title, "By-LumiSection Error counters");
245  byLumiErrors = theDMBE->book1D("byLumiErrors",title,2,0.,2.);
247  char title1[80]; sprintf(title1, "Errors per LumiSection;LumiSection;NErrors");
248  errorRate = theDMBE->book1D("errorRate",title1,5000,0.,5000.);
249 
250  std::map<uint32_t,SiPixelRawDataErrorModule*>::iterator struct_iter;
251  std::map<uint32_t,SiPixelRawDataErrorModule*>::iterator struct_iter2;
252 
253  SiPixelFolderOrganizer theSiPixelFolder;
254 
255  for(struct_iter = thePixelStructure.begin(); struct_iter != thePixelStructure.end(); struct_iter++){
257 
258  if(modOn){
259  if(theSiPixelFolder.setModuleFolder((*struct_iter).first)) {
260  (*struct_iter).second->book( conf_, 0 );
261  }
262  else {
263  //std::cout<<"PIB! not booking histograms for non-PIB modules!"<<std::endl;
264  if(!isPIB) throw cms::Exception("LogicError")
265  << "[SiPixelRawDataErrorSource::bookMEs] Creation of DQM folder failed";
266  }
267  }
268 
269  if(ladOn){
270  if(theSiPixelFolder.setModuleFolder((*struct_iter).first,1)) {
271  (*struct_iter).second->book( conf_, 1 );
272  }
273  else {
274  LogDebug ("PixelDQM") << "PROBLEM WITH LADDER-FOLDER\n";
275  }
276  }
277 
278  if(bladeOn){
279  if(theSiPixelFolder.setModuleFolder((*struct_iter).first,4)) {
280  (*struct_iter).second->book( conf_, 4 );
281  }
282  else {
283  LogDebug ("PixelDQM") << "PROBLEM WITH BLADE-FOLDER\n";
284  }
285  }
286 
287  }//for loop
288 
289  for(struct_iter2 = theFEDStructure.begin(); struct_iter2 != theFEDStructure.end(); struct_iter2++){
291  if(theSiPixelFolder.setFedFolder((*struct_iter2).first)) {
292  (*struct_iter2).second->bookFED( conf_ );
293  }
294  else {
295  throw cms::Exception("LogicError")
296  << "[SiPixelRawDataErrorSource::bookMEs] Creation of DQM folder failed";
297  }
298 
299  }
300 
301 }
#define LogDebug(id)
std::map< uint32_t, SiPixelRawDataErrorModule * > theFEDStructure
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:519
bool setFedFolder(const uint32_t FedId)
Set folder name for a FED (used in the case of errors without detId)
std::map< uint32_t, SiPixelRawDataErrorModule * > thePixelStructure
void setLumiFlag(void)
this ME is meant to be stored for each luminosity section
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
bool setModuleFolder(const uint32_t &rawdetid=0, int type=0)
Set folder name for a module or plaquette.
void SiPixelRawDataErrorSource::buildStructure ( edm::EventSetup const &  iSetup)
virtual

Definition at line 167 of file SiPixelRawDataErrorSource.cc.

References PixelEndcapName::bladeName(), PixelEndcapName::diskName(), edm::EventSetup::get(), PixelEndcapName::halfCylinder(), isPIB, LogDebug, FEDNumbering::MAXSiPixelFEDID, FEDNumbering::MINSiPixelFEDID, PixelEndcapName::pannelName(), GeomDetEnumerators::PixelBarrel, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, GeomDetEnumerators::PixelEndcap, PixelEndcapName::plaquetteName(), DetId::rawId(), PixelGeomDetUnit::specificTopology(), DetId::subdetId(), theFEDStructure, and thePixelStructure.

Referenced by beginRun().

167  {
168 
169  LogInfo ("PixelDQM") <<" SiPixelRawDataErrorSource::buildStructure" ;
171  iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
172 
173  LogVerbatim ("PixelDQM") << " *** Geometry node for TrackerGeom is "<<&(*pDD)<<std::endl;
174  LogVerbatim ("PixelDQM") << " *** I have " << pDD->dets().size() <<" detectors"<<std::endl;
175  LogVerbatim ("PixelDQM") << " *** I have " << pDD->detTypes().size() <<" types"<<std::endl;
176 
177  for(TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++){
178 
179  if( ((*it)->subDetector()==GeomDetEnumerators::PixelBarrel) || ((*it)->subDetector()==GeomDetEnumerators::PixelEndcap) ){
180  DetId detId = (*it)->geographicalId();
181  const GeomDetUnit * geoUnit = pDD->idToDetUnit( detId );
182  const PixelGeomDetUnit * pixDet = dynamic_cast<const PixelGeomDetUnit*>(geoUnit);
183  int nrows = (pixDet->specificTopology()).nrows();
184  int ncols = (pixDet->specificTopology()).ncolumns();
185 
186  if(detId.subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel)) {
187  if(isPIB) continue;
188  LogDebug ("PixelDQM") << " ---> Adding Barrel Module " << detId.rawId() << endl;
189  uint32_t id = detId();
190  SiPixelRawDataErrorModule* theModule = new SiPixelRawDataErrorModule(id, ncols, nrows);
191  thePixelStructure.insert(pair<uint32_t,SiPixelRawDataErrorModule*> (id,theModule));
192 
193  } else if(detId.subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap)) {
194  LogDebug ("PixelDQM") << " ---> Adding Endcap Module " << detId.rawId() << endl;
195  uint32_t id = detId();
196  SiPixelRawDataErrorModule* theModule = new SiPixelRawDataErrorModule(id, ncols, nrows);
197 
199  int disk = PixelEndcapName(DetId(id)).diskName();
200  int blade = PixelEndcapName(DetId(id)).bladeName();
201  int panel = PixelEndcapName(DetId(id)).pannelName();
203 
204  char sside[80]; sprintf(sside, "HalfCylinder_%i",side);
205  char sdisk[80]; sprintf(sdisk, "Disk_%i",disk);
206  char sblade[80]; sprintf(sblade, "Blade_%02i",blade);
207  char spanel[80]; sprintf(spanel, "Panel_%i",panel);
208  char smodule[80];sprintf(smodule,"Module_%i",module);
209  std::string side_str = sside;
210  std::string disk_str = sdisk;
211  bool mask = side_str.find("HalfCylinder_1")!=string::npos||
212  side_str.find("HalfCylinder_2")!=string::npos||
213  side_str.find("HalfCylinder_4")!=string::npos||
214  disk_str.find("Disk_2")!=string::npos;
215  // clutch to take all of FPIX, but no BPIX:
216  mask = false;
217  if(isPIB && mask) continue;
218 
219  thePixelStructure.insert(pair<uint32_t,SiPixelRawDataErrorModule*> (id,theModule));
220  }
221  }
222  }
223  LogDebug ("PixelDQM") << " ---> Adding Module for Additional Errors " << endl;
225  fedIds.first = 0;
226  fedIds.second = 39;
227  for (int fedId = fedIds.first; fedId <= fedIds.second; fedId++) {
228  //std::cout<<"Adding FED module: "<<fedId<<std::endl;
229  uint32_t id = static_cast<uint32_t> (fedId);
231  theFEDStructure.insert(pair<uint32_t,SiPixelRawDataErrorModule*> (id,theModule));
232  }
233 
234  LogInfo ("PixelDQM") << " *** Pixel Structure Size " << thePixelStructure.size() << endl;
235 }
#define LogDebug(id)
int plaquetteName() const
plaquetteId (in pannel)
std::map< uint32_t, SiPixelRawDataErrorModule * > theFEDStructure
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
int bladeName() const
blade id
std::map< uint32_t, SiPixelRawDataErrorModule * > thePixelStructure
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
int pannelName() const
pannel id
int diskName() const
disk id
HalfCylinder halfCylinder() const
Definition: vlib.h:209
void SiPixelRawDataErrorSource::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 94 of file SiPixelRawDataErrorSource.cc.

References conf_, edm::ParameterSet::getParameter(), download_sqlite_cfg::outputFile, DQMStore::save(), saveFile, and theDMBE.

94  {
95 
96  if(saveFile) {
97  LogInfo ("PixelDQM") << " SiPixelRawDataErrorSource::endJob - Saving Root File " << std::endl;
98  std::string outputFile = conf_.getParameter<std::string>("outputFile");
99  theDMBE->save( outputFile.c_str() );
100  }
101 
102 }
T getParameter(std::string const &) const
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:1883

Member Data Documentation

bool SiPixelRawDataErrorSource::bladeOn
private

Definition at line 77 of file SiPixelRawDataErrorSource.h.

Referenced by analyze(), beginRun(), and bookMEs().

MonitorElement* SiPixelRawDataErrorSource::byLumiErrors
private

Definition at line 83 of file SiPixelRawDataErrorSource.h.

Referenced by bookMEs().

edm::ParameterSet SiPixelRawDataErrorSource::conf_
private

Definition at line 69 of file SiPixelRawDataErrorSource.h.

Referenced by bookMEs(), and endJob().

MonitorElement* SiPixelRawDataErrorSource::errorRate
private

Definition at line 84 of file SiPixelRawDataErrorSource.h.

Referenced by bookMEs().

int SiPixelRawDataErrorSource::eventNo
private

Definition at line 78 of file SiPixelRawDataErrorSource.h.

Referenced by analyze(), and beginRun().

bool SiPixelRawDataErrorSource::firstRun
private

Definition at line 82 of file SiPixelRawDataErrorSource.h.

Referenced by beginJob(), and beginRun().

bool SiPixelRawDataErrorSource::isPIB
private

Definition at line 72 of file SiPixelRawDataErrorSource.h.

Referenced by bookMEs(), and buildStructure().

bool SiPixelRawDataErrorSource::ladOn
private

Definition at line 76 of file SiPixelRawDataErrorSource.h.

Referenced by analyze(), beginRun(), and bookMEs().

bool SiPixelRawDataErrorSource::modOn
private

Definition at line 75 of file SiPixelRawDataErrorSource.h.

Referenced by analyze(), beginRun(), and bookMEs().

bool SiPixelRawDataErrorSource::reducedSet
private

Definition at line 74 of file SiPixelRawDataErrorSource.h.

bool SiPixelRawDataErrorSource::saveFile
private

Definition at line 71 of file SiPixelRawDataErrorSource.h.

Referenced by endJob().

bool SiPixelRawDataErrorSource::slowDown
private

Definition at line 73 of file SiPixelRawDataErrorSource.h.

Referenced by analyze().

edm::InputTag SiPixelRawDataErrorSource::src_
private

Definition at line 70 of file SiPixelRawDataErrorSource.h.

Referenced by analyze().

DQMStore* SiPixelRawDataErrorSource::theDMBE
private

Definition at line 79 of file SiPixelRawDataErrorSource.h.

Referenced by analyze(), bookMEs(), endJob(), and SiPixelRawDataErrorSource().

std::map<uint32_t,SiPixelRawDataErrorModule*> SiPixelRawDataErrorSource::theFEDStructure
private

Definition at line 81 of file SiPixelRawDataErrorSource.h.

Referenced by analyze(), bookMEs(), and buildStructure().

std::map<uint32_t,SiPixelRawDataErrorModule*> SiPixelRawDataErrorSource::thePixelStructure
private

Definition at line 80 of file SiPixelRawDataErrorSource.h.

Referenced by analyze(), bookMEs(), and buildStructure().