#include <myTKAnalyses/DigiInvestigator/src/OccupancyPlots.cc>
Public Member Functions | |
OccupancyPlots (const edm::ParameterSet &) | |
~OccupancyPlots () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) override |
virtual void | beginJob () |
virtual void | beginRun (const edm::Run &, const edm::EventSetup &) override |
virtual void | endJob () |
virtual void | endRun (const edm::Run &, const edm::EventSetup &) override |
Private Attributes | |
TProfile ** | m_avemultiplicity |
TProfile ** | m_aveoccupancy |
TProfile ** | m_averadius |
TProfile ** | m_avez |
edm::FileInPath | m_fp |
std::vector< edm::InputTag > | m_multiplicityMaps |
TH1F ** | m_nchannels_ideal |
TH1F ** | m_nchannels_real |
std::vector< edm::InputTag > | m_occupancyMaps |
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 |
Description: <one line="" class="" summary>="">
Implementation: <Notes on="" implementation>="">
Definition at line 66 of file OccupancyPlots.cc.
OccupancyPlots::OccupancyPlots | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 120 of file OccupancyPlots.cc.
References edm::ParameterSet::getParameter(), m_avemultiplicity, m_aveoccupancy, m_averadius, m_avez, m_nchannels_ideal, m_nchannels_real, m_rhm, m_wantedsubdets, m_xavedr, m_xavedrphi, m_xavedz, m_yavedr, m_yavedrphi, m_yavedz, m_zavedr, m_zavedrphi, m_zavedz, RunHistogramManager::makeTH1F(), and RunHistogramManager::makeTProfile().
: m_multiplicityMaps(iConfig.getParameter<std::vector<edm::InputTag> >("multiplicityMaps")), m_occupancyMaps(iConfig.getParameter<std::vector<edm::InputTag> >("occupancyMaps")), m_fp(iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiPixelESProducers/data/PixelSkimmedGeometry.txt"))), m_rhm(), m_wantedsubdets() { //now do what ever initialization is needed m_avemultiplicity = m_rhm.makeTProfile("avemult","Average Multiplicty",6000,0.5,6000.5); m_aveoccupancy = m_rhm.makeTProfile("aveoccu","Average Occupancy",6000,0.5,6000.5); m_nchannels_ideal = m_rhm.makeTH1F("nchannels_ideal","Number of channels (ideal)",6000,0.5,6000.5); m_nchannels_real = m_rhm.makeTH1F("nchannels_real","Number of channels (real)",6000,0.5,6000.5); m_averadius = m_rhm.makeTProfile("averadius","Average Module Radius",6000,0.5,6000.5); m_avez = m_rhm.makeTProfile("avez","Average Module z coordinate",6000,0.5,6000.5); m_zavedr = m_rhm.makeTProfile("zavedr","Average z unit vector dr",6000,0.5,6000.5); m_zavedz = m_rhm.makeTProfile("zavedz","Average z unit vector dz",6000,0.5,6000.5); m_zavedrphi = m_rhm.makeTProfile("zavedrphi","Average z unit vector drphi",6000,0.5,6000.5); m_xavedr = m_rhm.makeTProfile("xavedr","Average x unit vector dr",6000,0.5,6000.5); m_xavedz = m_rhm.makeTProfile("xavedz","Average x unit vctor dz",6000,0.5,6000.5); m_xavedrphi = m_rhm.makeTProfile("xavedrphi","Average Module x unit vector drphi",6000,0.5,6000.5); m_yavedr = m_rhm.makeTProfile("yavedr","Average y unit vector dr",6000,0.5,6000.5); m_yavedz = m_rhm.makeTProfile("yavedz","Average y unit vector dz",6000,0.5,6000.5); m_yavedrphi = m_rhm.makeTProfile("yavedrphi","Average y unit vector drphi",6000,0.5,6000.5); std::vector<edm::ParameterSet> wantedsubdets_ps = iConfig.getParameter<std::vector<edm::ParameterSet> >("wantedSubDets"); for(std::vector<edm::ParameterSet>::const_iterator wsdps = wantedsubdets_ps.begin();wsdps!=wantedsubdets_ps.end();++wsdps) { unsigned int detsel = wsdps->getParameter<unsigned int>("detSelection"); std::vector<std::string> selstr = wsdps->getUntrackedParameter<std::vector<std::string> >("selection"); m_wantedsubdets[detsel]=DetIdSelector(selstr); } }
OccupancyPlots::~OccupancyPlots | ( | ) |
Definition at line 161 of file OccupancyPlots.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
void OccupancyPlots::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [override, private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 176 of file OccupancyPlots.cc.
References edm::Event::getByLabel(), m_avemultiplicity, m_aveoccupancy, m_multiplicityMaps, m_occupancyMaps, Association::map, and VarParsing::mult.
{ using namespace edm; for(std::vector<edm::InputTag>::const_iterator map = m_multiplicityMaps.begin();map!=m_multiplicityMaps.end();++map) { Handle<std::map<unsigned int, int> > mults; iEvent.getByLabel(*map,mults); for(std::map<unsigned int,int>::const_iterator mult=mults->begin();mult!=mults->end();mult++) { if(m_avemultiplicity && *m_avemultiplicity) (*m_avemultiplicity)->Fill(mult->first,mult->second); } } for(std::vector<edm::InputTag>::const_iterator map = m_occupancyMaps.begin();map!=m_occupancyMaps.end();++map) { Handle<std::map<unsigned int, int> > occus; iEvent.getByLabel(*map,occus); for(std::map<unsigned int,int>::const_iterator occu=occus->begin();occu!=occus->end();occu++) { if(m_aveoccupancy && *m_aveoccupancy) (*m_aveoccupancy)->Fill(occu->first,occu->second); } } }
void OccupancyPlots::beginJob | ( | void | ) | [private, virtual] |
void OccupancyPlots::beginRun | ( | const edm::Run & | iRun, |
const edm::EventSetup & | iSetup | ||
) | [override, private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 214 of file OccupancyPlots.cc.
References RunHistogramManager::beginRun(), and m_rhm.
void OccupancyPlots::endJob | ( | void | ) | [private, virtual] |
void OccupancyPlots::endRun | ( | const edm::Run & | iRun, |
const edm::EventSetup & | iSetup | ||
) | [override, private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 221 of file OccupancyPlots.cc.
References cond::rpcobgas::detid, edm::FileInPath::fullPath(), edm::EventSetup::get(), SiPixelDetInfoFileReader::getAllDetIds(), SiStripDetInfoFileReader::getAllDetIds(), SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), m_averadius, 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, PV3DBase< T, PVType, FrameType >::perp(), position, matplotRender::reader, EgammaValidation_Wenu_cff::sel, strip(), align::Tracker, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
{ // edm::ESHandle<GlobalTrackingGeometry> trkgeo; // iSetup.get<GlobalTrackingGeometryRecord>().get("",trkgeo); edm::ESHandle<TrackerGeometry> trkgeo; iSetup.get<TrackerDigiGeometryRecord>().get("",trkgeo); const Local2DPoint center(0.,0.); const Local3DPoint locz(0.,0.,1.); const Local3DPoint locx(1.,0.,0.); const Local3DPoint locy(0.,1.,0.); const GlobalPoint origin(0.,0.,0.); TrackingGeometry::DetIdContainer detunits = trkgeo->detUnitIds(); for(TrackingGeometry::DetIdContainer::const_iterator det = detunits.begin(); det!=detunits.end(); ++det) { if(det->det()!=DetId::Tracker) continue; edm::LogInfo("DetIdFromGeometry") << det->rawId(); GlobalPoint position = trkgeo->idToDet(*det)->toGlobal(center); GlobalPoint zpos = trkgeo->idToDet(*det)->toGlobal(locz); GlobalPoint xpos = trkgeo->idToDet(*det)->toGlobal(locx); GlobalPoint ypos = trkgeo->idToDet(*det)->toGlobal(locy); GlobalVector posvect = position - origin; GlobalVector dz = zpos - position; GlobalVector dx = xpos - position; GlobalVector dy = ypos - position; double dzdr = posvect.perp()>0 ? (dz.x()*posvect.x()+dz.y()*posvect.y())/posvect.perp() : 0. ; double dxdr = posvect.perp()>0 ? (dx.x()*posvect.x()+dx.y()*posvect.y())/posvect.perp() : 0. ; double dydr = posvect.perp()>0 ? (dy.x()*posvect.x()+dy.y()*posvect.y())/posvect.perp() : 0. ; double dzdrphi = posvect.perp()>0 ? (dz.y()*posvect.x()-dz.x()*posvect.y())/posvect.perp() : 0. ; double dxdrphi = posvect.perp()>0 ? (dx.y()*posvect.x()-dx.x()*posvect.y())/posvect.perp() : 0. ; double dydrphi = posvect.perp()>0 ? (dy.y()*posvect.x()-dy.x()*posvect.y())/posvect.perp() : 0. ; for(std::map<unsigned int,DetIdSelector>::const_iterator sel=m_wantedsubdets.begin();sel!=m_wantedsubdets.end();++sel) { if(sel->second.isSelected(*det)) { edm::LogInfo("SelectedDetId") << sel->first; // average positions if(m_averadius && *m_averadius) (*m_averadius)->Fill(sel->first,position.perp()); if(m_avez && *m_avez) (*m_avez)->Fill(sel->first,position.z()); if(m_zavedr && *m_zavedr) (*m_zavedr)->Fill(sel->first,dzdr); if(m_zavedz && *m_zavedz) (*m_zavedz)->Fill(sel->first,dz.z()); if(m_zavedrphi && *m_zavedrphi) (*m_zavedrphi)->Fill(sel->first,dzdrphi); if(m_xavedr && *m_xavedr) (*m_xavedr)->Fill(sel->first,dxdr); if(m_xavedz && *m_xavedz) (*m_xavedz)->Fill(sel->first,dx.z()); if(m_xavedrphi && *m_xavedrphi) (*m_xavedrphi)->Fill(sel->first,dxdrphi); if(m_yavedr && *m_yavedr) (*m_yavedr)->Fill(sel->first,dydr); if(m_yavedz && *m_yavedz) (*m_yavedz)->Fill(sel->first,dy.z()); if(m_yavedrphi && *m_yavedrphi) (*m_yavedrphi)->Fill(sel->first,dydrphi); } } } edm::ESHandle<SiStripQuality> quality; iSetup.get<SiStripQualityRcd>().get("",quality); SiStripDetInfoFileReader * reader=edm::Service<SiStripDetInfoFileReader>().operator->(); const std::vector<uint32_t>& detids = reader->getAllDetIds(); for(std::vector<uint32_t>::const_iterator detid=detids.begin();detid!=detids.end();++detid) { int nchannideal = reader->getNumberOfApvsAndStripLength(*detid).first*128; // int nchannreal = reader->getNumberOfApvsAndStripLength(*detid).first*128; int nchannreal = 0; for(int strip = 0; strip < nchannideal; ++strip) { if(!quality->IsStripBad(*detid,strip)) ++nchannreal; } for(std::map<unsigned int,DetIdSelector>::const_iterator sel=m_wantedsubdets.begin();sel!=m_wantedsubdets.end();++sel) { if(sel->second.isSelected(*detid)) { if(m_nchannels_ideal && *m_nchannels_ideal) (*m_nchannels_ideal)->Fill(sel->first,nchannideal); if(m_nchannels_real && *m_nchannels_real) (*m_nchannels_real)->Fill(sel->first,nchannreal); } } } edm::ESHandle<SiPixelQuality> pxlquality; iSetup.get<SiPixelQualityRcd>().get("",pxlquality); SiPixelDetInfoFileReader pxlreader(m_fp.fullPath()); const std::vector<uint32_t>& pxldetids = pxlreader.getAllDetIds(); for(std::vector<uint32_t>::const_iterator detid=pxldetids.begin();detid!=pxldetids.end();++detid) { int nchannideal = pxlreader.getDetUnitDimensions(*detid).first*pxlreader.getDetUnitDimensions(*detid).second; int nchannreal = 0; if(!pxlquality->IsModuleBad(*detid)) { nchannreal = pxlreader.getDetUnitDimensions(*detid).first*pxlreader.getDetUnitDimensions(*detid).second; } /* int nchannreal = 0; for(int strip = 0; strip < nchannideal; ++strip) { if(!quality->IsStripBad(*detid,strip)) ++nchannreal; } */ for(std::map<unsigned int,DetIdSelector>::const_iterator sel=m_wantedsubdets.begin();sel!=m_wantedsubdets.end();++sel) { if(sel->second.isSelected(*detid)) { if(m_nchannels_ideal && *m_nchannels_ideal) (*m_nchannels_ideal)->Fill(sel->first,nchannideal); if(m_nchannels_real && *m_nchannels_real) (*m_nchannels_real)->Fill(sel->first,nchannreal); } } } }
TProfile** OccupancyPlots::m_avemultiplicity [private] |
Definition at line 88 of file OccupancyPlots.cc.
Referenced by analyze(), and OccupancyPlots().
TProfile** OccupancyPlots::m_aveoccupancy [private] |
Definition at line 89 of file OccupancyPlots.cc.
Referenced by analyze(), and OccupancyPlots().
TProfile** OccupancyPlots::m_averadius [private] |
Definition at line 94 of file OccupancyPlots.cc.
Referenced by endRun(), and OccupancyPlots().
TProfile** OccupancyPlots::m_avez [private] |
Definition at line 95 of file OccupancyPlots.cc.
Referenced by endRun(), and OccupancyPlots().
edm::FileInPath OccupancyPlots::m_fp [private] |
Definition at line 83 of file OccupancyPlots.cc.
Referenced by endRun().
std::vector<edm::InputTag> OccupancyPlots::m_multiplicityMaps [private] |
Definition at line 81 of file OccupancyPlots.cc.
Referenced by analyze().
TH1F** OccupancyPlots::m_nchannels_ideal [private] |
Definition at line 91 of file OccupancyPlots.cc.
Referenced by endRun(), and OccupancyPlots().
TH1F** OccupancyPlots::m_nchannels_real [private] |
Definition at line 92 of file OccupancyPlots.cc.
Referenced by endRun(), and OccupancyPlots().
std::vector<edm::InputTag> OccupancyPlots::m_occupancyMaps [private] |
Definition at line 82 of file OccupancyPlots.cc.
Referenced by analyze().
RunHistogramManager OccupancyPlots::m_rhm [private] |
Definition at line 85 of file OccupancyPlots.cc.
Referenced by beginRun(), and OccupancyPlots().
std::map<unsigned int,DetIdSelector> OccupancyPlots::m_wantedsubdets [private] |
Definition at line 86 of file OccupancyPlots.cc.
Referenced by endRun(), and OccupancyPlots().
TProfile** OccupancyPlots::m_xavedr [private] |
Definition at line 102 of file OccupancyPlots.cc.
Referenced by endRun(), and OccupancyPlots().
TProfile** OccupancyPlots::m_xavedrphi [private] |
Definition at line 104 of file OccupancyPlots.cc.
Referenced by endRun(), and OccupancyPlots().
TProfile** OccupancyPlots::m_xavedz [private] |
Definition at line 103 of file OccupancyPlots.cc.
Referenced by endRun(), and OccupancyPlots().
TProfile** OccupancyPlots::m_yavedr [private] |
Definition at line 99 of file OccupancyPlots.cc.
Referenced by endRun(), and OccupancyPlots().
TProfile** OccupancyPlots::m_yavedrphi [private] |
Definition at line 101 of file OccupancyPlots.cc.
Referenced by endRun(), and OccupancyPlots().
TProfile** OccupancyPlots::m_yavedz [private] |
Definition at line 100 of file OccupancyPlots.cc.
Referenced by endRun(), and OccupancyPlots().
TProfile** OccupancyPlots::m_zavedr [private] |
Definition at line 96 of file OccupancyPlots.cc.
Referenced by endRun(), and OccupancyPlots().
TProfile** OccupancyPlots::m_zavedrphi [private] |
Definition at line 98 of file OccupancyPlots.cc.
Referenced by endRun(), and OccupancyPlots().
TProfile** OccupancyPlots::m_zavedz [private] |
Definition at line 97 of file OccupancyPlots.cc.
Referenced by endRun(), and OccupancyPlots().