CMS 3D CMS Logo

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

#include <SiPixelRecHitSource.h>

Inheritance diagram for SiPixelRecHitSource:
edm::EDAnalyzer edm::EDConsumerBase

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 ()
 
 SiPixelRecHitSource (const edm::ParameterSet &conf)
 
 ~SiPixelRecHitSource ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

bool bladeOn
 
edm::ParameterSet conf_
 
bool diskOn
 
int eventNo
 
bool firstRun
 
bool isPIB
 
bool ladOn
 
bool layOn
 
bool modOn
 
bool phiOn
 
std::map< uint32_t, int > rechit_count
 
bool reducedSet
 
bool ringOn
 
bool saveFile
 
bool slowDown
 
edm::EDGetTokenT
< SiPixelRecHitCollection
src_
 
DQMStoretheDMBE
 
std::map< uint32_t,
SiPixelRecHitModule * > 
thePixelStructure
 
bool twoDimOn
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: header file for Pixel Monitor Rec Hits

Usage: see description

Definition at line 53 of file SiPixelRecHitSource.h.

Constructor & Destructor Documentation

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

Definition at line 49 of file SiPixelRecHitSource.cc.

References cppFunctionSkipper::operator, and theDMBE.

49  :
50  conf_(iConfig),
51  src_( consumes<SiPixelRecHitCollection>( 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  modOn( conf_.getUntrackedParameter<bool>("modOn",true) ),
56  twoDimOn( conf_.getUntrackedParameter<bool>("twoDimOn",true) ),
57  reducedSet( conf_.getUntrackedParameter<bool>("reducedSet",false) ),
58  ladOn( conf_.getUntrackedParameter<bool>("ladOn",false) ),
59  layOn( conf_.getUntrackedParameter<bool>("layOn",false) ),
60  phiOn( conf_.getUntrackedParameter<bool>("phiOn",false) ),
61  ringOn( conf_.getUntrackedParameter<bool>("ringOn",false) ),
62  bladeOn( conf_.getUntrackedParameter<bool>("bladeOn",false) ),
63  diskOn( conf_.getUntrackedParameter<bool>("diskOn",false) )
64 {
66  LogInfo ("PixelDQM") << "SiPixelRecHitSource::SiPixelRecHitSource: Got DQM BackEnd interface"<<endl;
67 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet conf_
edm::EDGetTokenT< SiPixelRecHitCollection > src_
SiPixelRecHitSource::~SiPixelRecHitSource ( )

Definition at line 70 of file SiPixelRecHitSource.cc.

References thePixelStructure.

71 {
72  // do anything here that needs to be done at desctruction time
73  // (e.g. close files, deallocate resources etc.)
74  LogInfo ("PixelDQM") << "SiPixelRecHitSource::~SiPixelRecHitSource: Destructor"<<endl;
75  std::map<uint32_t,SiPixelRecHitModule*>::iterator struct_iter;
76  for (struct_iter = thePixelStructure.begin() ; struct_iter != thePixelStructure.end() ; struct_iter++){
77  delete struct_iter->second;
78  struct_iter->second = 0;
79  }
80 }
std::map< uint32_t, SiPixelRecHitModule * > thePixelStructure

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 122 of file SiPixelRecHitSource.cc.

References edmNew::DetSet< T >::begin(), bladeOn, diskOn, edmNew::DetSet< T >::end(), eventNo, edm::Event::getByToken(), ladOn, layOn, match(), modOn, phiOn, rechit_count, reducedSet, ringOn, slowDown, mathSSE::sqrt(), src_, thePixelStructure, twoDimOn, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

123 {
124  eventNo++;
125  //cout << eventNo << endl;
126  // get input data
128  //iEvent.getByLabel( src_, recHitColl ); //original
129  iEvent.getByToken( src_, recHitColl );
130 
131  std::map<uint32_t,SiPixelRecHitModule*>::iterator struct_iter;
132  for (struct_iter = thePixelStructure.begin() ; struct_iter != thePixelStructure.end() ; struct_iter++) {
133  uint32_t TheID = (*struct_iter).first;
134 
135  SiPixelRecHitCollection::const_iterator match = recHitColl->find(TheID);
136 
137  // if( pixelrechitRangeIteratorBegin == pixelrechitRangeIteratorEnd) {cout << "oops" << endl;}
138  float rechit_x = 0;
139  float rechit_y = 0;
140  int rechit_count = 0;
141 
142  if (match != recHitColl->end()) {
143  SiPixelRecHitCollection::DetSet pixelrechitRange = *match;
144  SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorBegin = pixelrechitRange.begin();
145  SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorEnd = pixelrechitRange.end();
146  SiPixelRecHitCollection::DetSet::const_iterator pixeliter = pixelrechitRangeIteratorBegin;
147 
148  for ( ; pixeliter != pixelrechitRangeIteratorEnd; pixeliter++)
149  {
150 
151 
152  rechit_count++;
153  //cout << TheID << endl;
154  SiPixelRecHit::ClusterRef const& clust = pixeliter->cluster();
155  int sizeX = (*clust).sizeX();
156  //cout << sizeX << endl;
157  int sizeY = (*clust).sizeY();
158  //cout << sizeY << endl;
159  LocalPoint lp = pixeliter->localPosition();
160  rechit_x = lp.x();
161  rechit_y = lp.y();
162 
163  LocalError lerr = pixeliter->localPositionError();
164  float lerr_x = sqrt(lerr.xx());
165  float lerr_y = sqrt(lerr.yy());
166  //std::cout << "errors " << lerr_x << " " << lerr_y << std::endl;
167  //cout << "hh" << endl;
168  (*struct_iter).second->fill(rechit_x, rechit_y, sizeX, sizeY, lerr_x, lerr_y,
171  //cout << "ii" << endl;
172 
173  }
174  }
175  if(rechit_count > 0) (*struct_iter).second->nfill(rechit_count, modOn, ladOn, layOn, phiOn, bladeOn, diskOn, ringOn);
176 
177  }
178 
179  // slow down...
180  if(slowDown) usleep(10000);
181 
182 }
float xx() const
Definition: LocalError.h:24
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
T y() const
Definition: PV3DBase.h:63
std::map< uint32_t, int > rechit_count
std::map< uint32_t, SiPixelRecHitModule * > thePixelStructure
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:48
edm::EDGetTokenT< SiPixelRecHitCollection > src_
iterator end()
Definition: DetSetNew.h:70
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
T x() const
Definition: PV3DBase.h:62
iterator begin()
Definition: DetSetNew.h:67
void SiPixelRecHitSource::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 83 of file SiPixelRecHitSource.cc.

References firstRun.

83  {
84  firstRun = true;
85 }
void SiPixelRecHitSource::beginRun ( const edm::Run r,
edm::EventSetup const &  iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 88 of file SiPixelRecHitSource.cc.

References bladeOn, bookMEs(), buildStructure(), diskOn, eventNo, firstRun, ladOn, layOn, modOn, phiOn, ringOn, and twoDimOn.

88  {
89 
90  LogInfo ("PixelDQM") << " SiPixelRecHitSource::beginJob - Initialisation ... " << std::endl;
91  LogInfo ("PixelDQM") << "Mod/Lad/Lay/Phi " << modOn << "/" << ladOn << "/"
92  << layOn << "/" << phiOn << std::endl;
93  LogInfo ("PixelDQM") << "Blade/Disk/Ring" << bladeOn << "/" << diskOn << "/"
94  << ringOn << std::endl;
95  LogInfo ("PixelDQM") << "2DIM IS " << twoDimOn << "\n";
96 
97  if(firstRun){
98  eventNo = 0;
99  // Build map
100  buildStructure(iSetup);
101  // Book Monitoring Elements
102  bookMEs();
103  firstRun = false;
104  }
105 }
virtual void buildStructure(edm::EventSetup const &)
void SiPixelRecHitSource::bookMEs ( )
virtual

Create folder tree and book histograms

Definition at line 251 of file SiPixelRecHitSource.cc.

References bladeOn, conf_, diskOn, edm::hlt::Exception, isPIB, ladOn, layOn, LogDebug, modOn, phiOn, reducedSet, ringOn, SiPixelFolderOrganizer::setModuleFolder(), thePixelStructure, and twoDimOn.

Referenced by beginRun().

251  {
252 
253  std::map<uint32_t,SiPixelRecHitModule*>::iterator struct_iter;
254 
255  SiPixelFolderOrganizer theSiPixelFolder;
256 
257  for(struct_iter = thePixelStructure.begin(); struct_iter != thePixelStructure.end(); struct_iter++){
258 
260  if(modOn){
261  if(theSiPixelFolder.setModuleFolder((*struct_iter).first)){
262  (*struct_iter).second->book( conf_,0,twoDimOn, reducedSet);
263  } else {
264  if(!isPIB) throw cms::Exception("LogicError")
265  << "[SiPixelDigiSource::bookMEs] Creation of DQM folder failed";
266  }
267  }
268  if(ladOn){
269  if(theSiPixelFolder.setModuleFolder((*struct_iter).first,1)){
270  (*struct_iter).second->book( conf_,1,twoDimOn, reducedSet);
271  } else {
272  LogDebug ("PixelDQM") << "PROBLEM WITH LADDER-FOLDER\n";
273  }
274  }
275  if(layOn){
276  if(theSiPixelFolder.setModuleFolder((*struct_iter).first,2)){
277  (*struct_iter).second->book( conf_,2,twoDimOn, reducedSet);
278  } else {
279  LogDebug ("PixelDQM") << "PROBLEM WITH LAYER-FOLDER\n";
280  }
281  }
282  if(phiOn){
283  if(theSiPixelFolder.setModuleFolder((*struct_iter).first,3)){
284  (*struct_iter).second->book( conf_,3,twoDimOn, reducedSet);
285  } else {
286  LogDebug ("PixelDQM") << "PROBLEM WITH PHI-FOLDER\n";
287  }
288  }
289  if(bladeOn){
290  if(theSiPixelFolder.setModuleFolder((*struct_iter).first,4)){
291  (*struct_iter).second->book( conf_,4,twoDimOn, reducedSet);
292  } else {
293  LogDebug ("PixelDQM") << "PROBLEM WITH BLADE-FOLDER\n";
294  }
295  }
296  if(diskOn){
297  if(theSiPixelFolder.setModuleFolder((*struct_iter).first,5)){
298  (*struct_iter).second->book( conf_,5,twoDimOn, reducedSet);
299  } else {
300  LogDebug ("PixelDQM") << "PROBLEM WITH DISK-FOLDER\n";
301  }
302  }
303  if(ringOn){
304  if(theSiPixelFolder.setModuleFolder((*struct_iter).first,6)){
305  (*struct_iter).second->book( conf_,6,twoDimOn, reducedSet);
306  } else {
307  LogDebug ("PixelDQM") << "PROBLEM WITH RING-FOLDER\n";
308  }
309  }
310 
311  }
312 
313 }
#define LogDebug(id)
edm::ParameterSet conf_
std::map< uint32_t, SiPixelRecHitModule * > thePixelStructure
bool setModuleFolder(const uint32_t &rawdetid=0, int type=0)
Set folder name for a module or plaquette.
void SiPixelRecHitSource::buildStructure ( edm::EventSetup const &  iSetup)
virtual

Definition at line 187 of file SiPixelRecHitSource.cc.

References PixelEndcapName::bladeName(), PixelEndcapName::diskName(), edm::EventSetup::get(), PixelEndcapName::halfCylinder(), isPIB, LogDebug, PixelEndcapName::pannelName(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, PixelEndcapName::plaquetteName(), DetId::rawId(), AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), and thePixelStructure.

Referenced by beginRun().

187  {
188 
189  LogInfo ("PixelDQM") <<" SiPixelRecHitSource::buildStructure" ;
191  iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
192 
193  LogVerbatim ("PixelDQM") << " *** Geometry node for TrackerGeom is "<<&(*pDD)<<std::endl;
194  LogVerbatim ("PixelDQM") << " *** I have " << pDD->dets().size() <<" detectors"<<std::endl;
195  LogVerbatim ("PixelDQM") << " *** I have " << pDD->detTypes().size() <<" types"<<std::endl;
196 
197  for(TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++){
198 
199  if(dynamic_cast<PixelGeomDetUnit*>((*it))!=0){
200 
201  DetId detId = (*it)->geographicalId();
202  // const GeomDetUnit * geoUnit = pDD->idToDetUnit( detId );
203  //const PixelGeomDetUnit * pixDet = dynamic_cast<const PixelGeomDetUnit*>(geoUnit);
204 
205 
206 
207  // SiPixelRecHitModule *theModule = new SiPixelRecHitModule(id, rechit_x, rechit_y, x_res, y_res, x_pull, y_pull);
208 
209 
210  if((detId.subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel)) ||
211  (detId.subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap))){
212  uint32_t id = detId();
213  SiPixelRecHitModule* theModule = new SiPixelRecHitModule(id);
214  if(detId.subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel)) {
215  if(isPIB) continue;
216  LogDebug ("PixelDQM") << " ---> Adding Barrel Module " << detId.rawId() << endl;
217  thePixelStructure.insert(pair<uint32_t,SiPixelRecHitModule*> (id,theModule));
218 
219  } else if(detId.subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap)) {
220  LogDebug ("PixelDQM") << " ---> Adding Endcap Module " << detId.rawId() << endl;
222  int disk = PixelEndcapName(DetId(id)).diskName();
223  int blade = PixelEndcapName(DetId(id)).bladeName();
224  int panel = PixelEndcapName(DetId(id)).pannelName();
226 
227  char sside[80]; sprintf(sside, "HalfCylinder_%i",side);
228  char sdisk[80]; sprintf(sdisk, "Disk_%i",disk);
229  char sblade[80]; sprintf(sblade, "Blade_%02i",blade);
230  char spanel[80]; sprintf(spanel, "Panel_%i",panel);
231  char smodule[80];sprintf(smodule,"Module_%i",module);
232  std::string side_str = sside;
233  std::string disk_str = sdisk;
234  bool mask = side_str.find("HalfCylinder_1")!=string::npos||
235  side_str.find("HalfCylinder_2")!=string::npos||
236  side_str.find("HalfCylinder_4")!=string::npos||
237  disk_str.find("Disk_2")!=string::npos;
238  if(isPIB && mask) continue;
239 
240  thePixelStructure.insert(pair<uint32_t,SiPixelRecHitModule*> (id,theModule));
241  }
242  }
243  }
244  }
245 
246  LogInfo ("PixelDQM") << " *** Pixel Structure Size " << thePixelStructure.size() << endl;
247 }
#define LogDebug(id)
int plaquetteName() const
plaquetteId (in pannel)
std::map< uint32_t, SiPixelRecHitModule * > thePixelStructure
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int bladeName() const
blade id
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
int pannelName() const
pannel id
int diskName() const
disk id
HalfCylinder halfCylinder() const
Definition: vlib.h:208
void SiPixelRecHitSource::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 108 of file SiPixelRecHitSource.cc.

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

108  {
109 
110 
111  if(saveFile){
112  LogInfo ("PixelDQM") << " SiPixelRecHitSource::endJob - Saving Root File " << std::endl;
114  theDMBE->save( outputFile );
115  }
116 
117 }
T getParameter(std::string const &) const
edm::ParameterSet conf_
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2296

Member Data Documentation

bool SiPixelRecHitSource::bladeOn
private

Definition at line 85 of file SiPixelRecHitSource.h.

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

edm::ParameterSet SiPixelRecHitSource::conf_
private

Definition at line 69 of file SiPixelRecHitSource.h.

Referenced by bookMEs(), and endJob().

bool SiPixelRecHitSource::diskOn
private

Definition at line 85 of file SiPixelRecHitSource.h.

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

int SiPixelRecHitSource::eventNo
private

Definition at line 75 of file SiPixelRecHitSource.h.

Referenced by analyze(), and beginRun().

bool SiPixelRecHitSource::firstRun
private

Definition at line 87 of file SiPixelRecHitSource.h.

Referenced by beginJob(), and beginRun().

bool SiPixelRecHitSource::isPIB
private

Definition at line 73 of file SiPixelRecHitSource.h.

Referenced by bookMEs(), and buildStructure().

bool SiPixelRecHitSource::ladOn
private

Definition at line 83 of file SiPixelRecHitSource.h.

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

bool SiPixelRecHitSource::layOn
private

Definition at line 83 of file SiPixelRecHitSource.h.

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

bool SiPixelRecHitSource::modOn
private

Definition at line 79 of file SiPixelRecHitSource.h.

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

bool SiPixelRecHitSource::phiOn
private

Definition at line 83 of file SiPixelRecHitSource.h.

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

std::map<uint32_t,int> SiPixelRecHitSource::rechit_count
private

Definition at line 78 of file SiPixelRecHitSource.h.

Referenced by analyze().

bool SiPixelRecHitSource::reducedSet
private

Definition at line 81 of file SiPixelRecHitSource.h.

Referenced by analyze(), and bookMEs().

bool SiPixelRecHitSource::ringOn
private

Definition at line 85 of file SiPixelRecHitSource.h.

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

bool SiPixelRecHitSource::saveFile
private

Definition at line 72 of file SiPixelRecHitSource.h.

Referenced by endJob().

bool SiPixelRecHitSource::slowDown
private

Definition at line 74 of file SiPixelRecHitSource.h.

Referenced by analyze().

edm::EDGetTokenT<SiPixelRecHitCollection> SiPixelRecHitSource::src_
private

Definition at line 70 of file SiPixelRecHitSource.h.

Referenced by analyze().

DQMStore* SiPixelRecHitSource::theDMBE
private

Definition at line 76 of file SiPixelRecHitSource.h.

Referenced by endJob(), and SiPixelRecHitSource().

std::map<uint32_t,SiPixelRecHitModule*> SiPixelRecHitSource::thePixelStructure
private

Definition at line 77 of file SiPixelRecHitSource.h.

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

bool SiPixelRecHitSource::twoDimOn
private

Definition at line 80 of file SiPixelRecHitSource.h.

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