test
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 Member Functions | Private Attributes
OccupancyPlots Class Reference

#include <myTKAnalyses/DigiInvestigator/src/OccupancyPlots.cc>

Inheritance diagram for OccupancyPlots:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 OccupancyPlots (const edm::ParameterSet &)
 
 ~OccupancyPlots ()
 
- 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
virtual void endJob () override
 
virtual void endRun (const edm::Run &, const edm::EventSetup &) override
 

Private Attributes

TProfile ** m_avemultiplicity
 
TProfile ** m_aveoccupancy
 
TProfile ** m_averadius
 
TProfile ** m_avex
 
TProfile ** m_avey
 
TProfile ** m_avez
 
edm::FileInPath m_fp
 
std::vector< edm::EDGetTokenT
< std::map< unsigned int, int > > > 
m_multiplicityMapTokens
 
TH1F ** m_nchannels_ideal
 
TH1F ** m_nchannels_real
 
std::vector< edm::EDGetTokenT
< std::map< unsigned int, int > > > 
m_occupancyMapTokens
 
RunHistogramManager m_rhm
 
std::map< unsigned int,
DetIdSelector
m_wantedsubdets
 
TProfile ** m_xavedr
 
TProfile ** m_xavedrphi
 
TProfile ** m_xavedz
 
TProfile ** m_yavedr
 
TProfile ** m_yavedrphi
 
TProfile ** m_yavedz
 
TProfile ** m_zavedr
 
TProfile ** m_zavedrphi
 
TProfile ** m_zavedz
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 67 of file OccupancyPlots.cc.

Constructor & Destructor Documentation

OccupancyPlots::OccupancyPlots ( const edm::ParameterSet iConfig)
explicit

Definition at line 123 of file OccupancyPlots.cc.

References GlobalPosition_Frontier_DevDB_cff::tag.

123  :
124  m_multiplicityMapTokens(edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag> >("multiplicityMaps"), [this](edm::InputTag const & tag){return consumes<std::map<unsigned int, int> >(tag);})),
T getParameter(std::string const &) const
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
std::vector< edm::EDGetTokenT< std::map< unsigned int, int > > > m_multiplicityMapTokens
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
OccupancyPlots::~OccupancyPlots ( )

Definition at line 166 of file OccupancyPlots.cc.

167 {
168 
169  // do anything here that needs to be done at desctruction time
170  // (e.g. close files, deallocate resources etc.)
171 
172 }

Member Function Documentation

void OccupancyPlots::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 181 of file OccupancyPlots.cc.

References edm::Event::getByToken(), m_avemultiplicity, m_aveoccupancy, m_multiplicityMapTokens, m_occupancyMapTokens, and VarParsing::mult.

182 {
183  using namespace edm;
184 
185 
186  for(std::vector<edm::EDGetTokenT<std::map<unsigned int, int> > >::const_iterator mapToken = m_multiplicityMapTokens.begin();mapToken!=m_multiplicityMapTokens.end();++mapToken) {
187 
189  iEvent.getByToken(*mapToken,mults);
190 
191  for(std::map<unsigned int,int>::const_iterator mult=mults->begin();mult!=mults->end();mult++) {
192  if(m_avemultiplicity && *m_avemultiplicity) (*m_avemultiplicity)->Fill(mult->first,mult->second);
193  }
194  }
195 
196 
197 
198  for(std::vector<edm::EDGetTokenT<std::map<unsigned int, int> > >::const_iterator mapToken = m_occupancyMapTokens.begin();mapToken!=m_occupancyMapTokens.end();++mapToken) {
199 
201  iEvent.getByToken(*mapToken,occus);
202 
203  for(std::map<unsigned int,int>::const_iterator occu=occus->begin();occu!=occus->end();occu++) {
204  if(m_aveoccupancy && *m_aveoccupancy) (*m_aveoccupancy)->Fill(occu->first,occu->second);
205  }
206  }
207 
208 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
std::vector< edm::EDGetTokenT< std::map< unsigned int, int > > > m_multiplicityMapTokens
TProfile ** m_aveoccupancy
TProfile ** m_avemultiplicity
std::vector< edm::EDGetTokenT< std::map< unsigned int, int > > > m_occupancyMapTokens
void OccupancyPlots::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 213 of file OccupancyPlots.cc.

214 {
215 
216 }
void OccupancyPlots::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 219 of file OccupancyPlots.cc.

References RunHistogramManager::beginRun(), and m_rhm.

219  {
220 
221  m_rhm.beginRun(iRun);
222 
223 }
RunHistogramManager m_rhm
void beginRun(const edm::Run &iRun)
void OccupancyPlots::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 367 of file OccupancyPlots.cc.

367  {
368 }
void OccupancyPlots::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 226 of file OccupancyPlots.cc.

References edm::FileInPath::fullPath(), edm::EventSetup::get(), SiPixelDetInfoFileReader::getAllDetIds(), SiStripDetInfoFileReader::getAllDetIds(), SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), LogDebug, LogTrace, m_averadius, m_avex, m_avey, m_avez, m_fp, m_nchannels_ideal, m_nchannels_real, m_wantedsubdets, m_xavedr, m_xavedrphi, m_xavedz, m_yavedr, m_yavedrphi, m_yavedz, m_zavedr, m_zavedrphi, m_zavedz, cppFunctionSkipper::operator, GeomDetEnumerators::P1PXB, GeomDetEnumerators::P1PXEC, GeomDetEnumerators::P2OTB, GeomDetEnumerators::P2OTEC, GeomDetEnumerators::P2PXEC, PV3DBase< T, PVType, FrameType >::perp(), GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, position, HLT_25ns10e33_v2_cff::quality, matplotRender::reader, EgammaValidation_Wenu_cff::sel, GeomDetEnumerators::TEC, GeomDetEnumerators::TIB, GeomDetEnumerators::TID, GeomDetEnumerators::TOB, DetId::Tracker, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

226  {
227 
228 
229  // edm::ESHandle<GlobalTrackingGeometry> trkgeo;
230  // iSetup.get<GlobalTrackingGeometryRecord>().get("",trkgeo);
232  iSetup.get<TrackerDigiGeometryRecord>().get("",trkgeo);
233 
234  // Test new TrackerGeometry features
235  LogDebug("IsThereTest") << "Test of TrackerGeometry::isThere";
236  LogTrace("IsThereTest") << " is there PixelBarrel: " << trkgeo->isThere(GeomDetEnumerators::PixelBarrel);
237  LogTrace("IsThereTest") << " is there PixelEndcap: " << trkgeo->isThere(GeomDetEnumerators::PixelEndcap);
238  LogTrace("IsThereTest") << " is there P1PXB: " << trkgeo->isThere(GeomDetEnumerators::P1PXB);
239  LogTrace("IsThereTest") << " is there P1PXEC: " << trkgeo->isThere(GeomDetEnumerators::P1PXEC);
240  LogTrace("IsThereTest") << " is there P2PXEC: " << trkgeo->isThere(GeomDetEnumerators::P2PXEC);
241  LogTrace("IsThereTest") << " is there TIB: " << trkgeo->isThere(GeomDetEnumerators::TIB);
242  LogTrace("IsThereTest") << " is there TID: " << trkgeo->isThere(GeomDetEnumerators::TID);
243  LogTrace("IsThereTest") << " is there TOB: " << trkgeo->isThere(GeomDetEnumerators::TOB);
244  LogTrace("IsThereTest") << " is there TEC: " << trkgeo->isThere(GeomDetEnumerators::TEC);
245  LogTrace("IsThereTest") << " is there P2OTB: " << trkgeo->isThere(GeomDetEnumerators::P2OTB);
246  LogTrace("IsThereTest") << " is there P2OTEC: " << trkgeo->isThere(GeomDetEnumerators::P2OTEC);
247 
248 
249  const Local2DPoint center(0.,0.);
250  const Local3DPoint locz(0.,0.,1.);
251  const Local3DPoint locx(1.,0.,0.);
252  const Local3DPoint locy(0.,1.,0.);
253  const GlobalPoint origin(0.,0.,0.);
254 
255  TrackingGeometry::DetIdContainer detunits = trkgeo->detUnitIds();
256 
257  for(TrackingGeometry::DetIdContainer::const_iterator det = detunits.begin(); det!=detunits.end(); ++det) {
258 
259  if(det->det()!=DetId::Tracker) continue;
260 
261  edm::LogInfo("DetIdFromGeometry") << det->rawId();
262 
263  GlobalPoint position = trkgeo->idToDet(*det)->toGlobal(center);
264  GlobalPoint zpos = trkgeo->idToDet(*det)->toGlobal(locz);
265  GlobalPoint xpos = trkgeo->idToDet(*det)->toGlobal(locx);
266  GlobalPoint ypos = trkgeo->idToDet(*det)->toGlobal(locy);
267  GlobalVector posvect = position - origin;
268  GlobalVector dz = zpos - position;
269  GlobalVector dx = xpos - position;
270  GlobalVector dy = ypos - position;
271 
272  double dzdr = posvect.perp()>0 ? (dz.x()*posvect.x()+dz.y()*posvect.y())/posvect.perp() : 0. ;
273  double dxdr = posvect.perp()>0 ? (dx.x()*posvect.x()+dx.y()*posvect.y())/posvect.perp() : 0. ;
274  double dydr = posvect.perp()>0 ? (dy.x()*posvect.x()+dy.y()*posvect.y())/posvect.perp() : 0. ;
275 
276  double dzdrphi = posvect.perp()>0 ? (dz.y()*posvect.x()-dz.x()*posvect.y())/posvect.perp() : 0. ;
277  double dxdrphi = posvect.perp()>0 ? (dx.y()*posvect.x()-dx.x()*posvect.y())/posvect.perp() : 0. ;
278  double dydrphi = posvect.perp()>0 ? (dy.y()*posvect.x()-dy.x()*posvect.y())/posvect.perp() : 0. ;
279 
280  for(std::map<unsigned int,DetIdSelector>::const_iterator sel=m_wantedsubdets.begin();sel!=m_wantedsubdets.end();++sel) {
281 
282  if(sel->second.isSelected(*det)) {
283  edm::LogInfo("SelectedDetId") << sel->first;
284  // average positions
285  if(m_averadius && *m_averadius) (*m_averadius)->Fill(sel->first,position.perp());
286  if(m_avez && *m_avez) (*m_avez)->Fill(sel->first,position.z());
287  if(m_avex && *m_avex) (*m_avex)->Fill(sel->first,position.x());
288  if(m_avey && *m_avey) (*m_avey)->Fill(sel->first,position.y());
289  if(m_zavedr && *m_zavedr) (*m_zavedr)->Fill(sel->first,dzdr);
290  if(m_zavedz && *m_zavedz) (*m_zavedz)->Fill(sel->first,dz.z());
291  if(m_zavedrphi && *m_zavedrphi) (*m_zavedrphi)->Fill(sel->first,dzdrphi);
292  if(m_xavedr && *m_xavedr) (*m_xavedr)->Fill(sel->first,dxdr);
293  if(m_xavedz && *m_xavedz) (*m_xavedz)->Fill(sel->first,dx.z());
294  if(m_xavedrphi && *m_xavedrphi) (*m_xavedrphi)->Fill(sel->first,dxdrphi);
295  if(m_yavedr && *m_yavedr) (*m_yavedr)->Fill(sel->first,dydr);
296  if(m_yavedz && *m_yavedz) (*m_yavedz)->Fill(sel->first,dy.z());
297  if(m_yavedrphi && *m_yavedrphi) (*m_yavedrphi)->Fill(sel->first,dydrphi);
298  }
299  }
300  }
301 
302 
304  iSetup.get<SiStripQualityRcd>().get("",quality);
305 
306 
308 
309  const std::vector<uint32_t>& detids = reader->getAllDetIds();
310 
311  for(std::vector<uint32_t>::const_iterator detid=detids.begin();detid!=detids.end();++detid) {
312 
313  int nchannideal = reader->getNumberOfApvsAndStripLength(*detid).first*128;
314  // int nchannreal = reader->getNumberOfApvsAndStripLength(*detid).first*128;
315  int nchannreal = 0;
316  for(int strip = 0; strip < nchannideal; ++strip) {
317  if(!quality->IsStripBad(*detid,strip)) ++nchannreal;
318  }
319 
320 
321  for(std::map<unsigned int,DetIdSelector>::const_iterator sel=m_wantedsubdets.begin();sel!=m_wantedsubdets.end();++sel) {
322 
323  if(sel->second.isSelected(*detid)) {
324  if(m_nchannels_ideal && *m_nchannels_ideal) (*m_nchannels_ideal)->Fill(sel->first,nchannideal);
325  if(m_nchannels_real && *m_nchannels_real) (*m_nchannels_real)->Fill(sel->first,nchannreal);
326  }
327  }
328 
329  }
330 
331 
333  iSetup.get<SiPixelQualityRcd>().get("",pxlquality);
334 
335 
337 
338  const std::vector<uint32_t>& pxldetids = pxlreader.getAllDetIds();
339 
340  for(std::vector<uint32_t>::const_iterator detid=pxldetids.begin();detid!=pxldetids.end();++detid) {
341 
342  int nchannideal = pxlreader.getDetUnitDimensions(*detid).first*pxlreader.getDetUnitDimensions(*detid).second;
343  int nchannreal = 0;
344  if(!pxlquality->IsModuleBad(*detid)) {
345  nchannreal = pxlreader.getDetUnitDimensions(*detid).first*pxlreader.getDetUnitDimensions(*detid).second;
346  }
347  /*
348  int nchannreal = 0;
349  for(int strip = 0; strip < nchannideal; ++strip) {
350  if(!quality->IsStripBad(*detid,strip)) ++nchannreal;
351  }
352  */
353 
354  for(std::map<unsigned int,DetIdSelector>::const_iterator sel=m_wantedsubdets.begin();sel!=m_wantedsubdets.end();++sel) {
355 
356  if(sel->second.isSelected(*detid)) {
357  if(m_nchannels_ideal && *m_nchannels_ideal) (*m_nchannels_ideal)->Fill(sel->first,nchannideal);
358  if(m_nchannels_real && *m_nchannels_real) (*m_nchannels_real)->Fill(sel->first,nchannreal);
359  }
360  }
361 
362  }
363 
364 }
#define LogDebug(id)
TProfile ** m_zavedrphi
TProfile ** m_xavedz
T perp() const
Definition: PV3DBase.h:72
const std::vector< uint32_t > & getAllDetIds() const
TH1F ** m_nchannels_ideal
T y() const
Definition: PV3DBase.h:63
TProfile ** m_zavedr
TH1F ** m_nchannels_real
std::map< unsigned int, DetIdSelector > m_wantedsubdets
TProfile ** m_avex
TProfile ** m_averadius
T z() const
Definition: PV3DBase.h:64
TProfile ** m_avez
TProfile ** m_xavedr
TProfile ** m_avey
#define LogTrace(id)
TProfile ** m_yavedr
TProfile ** m_yavedz
TProfile ** m_zavedz
const T & get() const
Definition: EventSetup.h:56
TProfile ** m_yavedrphi
edm::FileInPath m_fp
static int position[264][3]
Definition: ReadPGInfo.cc:509
std::string fullPath() const
Definition: FileInPath.cc:184
T x() const
Definition: PV3DBase.h:62
TProfile ** m_xavedrphi
std::vector< DetId > DetIdContainer

Member Data Documentation

TProfile** OccupancyPlots::m_avemultiplicity
private

Definition at line 89 of file OccupancyPlots.cc.

Referenced by analyze().

TProfile** OccupancyPlots::m_aveoccupancy
private

Definition at line 90 of file OccupancyPlots.cc.

Referenced by analyze().

TProfile** OccupancyPlots::m_averadius
private

Definition at line 95 of file OccupancyPlots.cc.

Referenced by endRun().

TProfile** OccupancyPlots::m_avex
private

Definition at line 97 of file OccupancyPlots.cc.

Referenced by endRun().

TProfile** OccupancyPlots::m_avey
private

Definition at line 98 of file OccupancyPlots.cc.

Referenced by endRun().

TProfile** OccupancyPlots::m_avez
private

Definition at line 96 of file OccupancyPlots.cc.

Referenced by endRun().

edm::FileInPath OccupancyPlots::m_fp
private

Definition at line 84 of file OccupancyPlots.cc.

Referenced by endRun().

std::vector<edm::EDGetTokenT<std::map<unsigned int, int> > > OccupancyPlots::m_multiplicityMapTokens
private

Definition at line 82 of file OccupancyPlots.cc.

Referenced by analyze().

TH1F** OccupancyPlots::m_nchannels_ideal
private

Definition at line 92 of file OccupancyPlots.cc.

Referenced by endRun().

TH1F** OccupancyPlots::m_nchannels_real
private

Definition at line 93 of file OccupancyPlots.cc.

Referenced by endRun().

std::vector<edm::EDGetTokenT<std::map<unsigned int, int> > > OccupancyPlots::m_occupancyMapTokens
private

Definition at line 83 of file OccupancyPlots.cc.

Referenced by analyze().

RunHistogramManager OccupancyPlots::m_rhm
private

Definition at line 86 of file OccupancyPlots.cc.

Referenced by beginRun().

std::map<unsigned int,DetIdSelector> OccupancyPlots::m_wantedsubdets
private

Definition at line 87 of file OccupancyPlots.cc.

Referenced by endRun().

TProfile** OccupancyPlots::m_xavedr
private

Definition at line 105 of file OccupancyPlots.cc.

Referenced by endRun().

TProfile** OccupancyPlots::m_xavedrphi
private

Definition at line 107 of file OccupancyPlots.cc.

Referenced by endRun().

TProfile** OccupancyPlots::m_xavedz
private

Definition at line 106 of file OccupancyPlots.cc.

Referenced by endRun().

TProfile** OccupancyPlots::m_yavedr
private

Definition at line 102 of file OccupancyPlots.cc.

Referenced by endRun().

TProfile** OccupancyPlots::m_yavedrphi
private

Definition at line 104 of file OccupancyPlots.cc.

Referenced by endRun().

TProfile** OccupancyPlots::m_yavedz
private

Definition at line 103 of file OccupancyPlots.cc.

Referenced by endRun().

TProfile** OccupancyPlots::m_zavedr
private

Definition at line 99 of file OccupancyPlots.cc.

Referenced by endRun().

TProfile** OccupancyPlots::m_zavedrphi
private

Definition at line 101 of file OccupancyPlots.cc.

Referenced by endRun().

TProfile** OccupancyPlots::m_zavedz
private

Definition at line 100 of file OccupancyPlots.cc.

Referenced by endRun().