CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DetIdSelectorTest Class Reference

#include <DPGAnalysis/SiStripTools/plugins/DetIdSelectorTest.cc>

Inheritance diagram for DetIdSelectorTest:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DetIdSelectorTest (const edm::ParameterSet &)
 
 ~DetIdSelectorTest () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

std::vector< DetIdSelectordetidsels_
 
edm::ESGetToken< GeometricDet, IdealGeometryRecordgeomDetToken_
 
edm::ESGetToken< TkDetMap, TrackerTopologyRcdtkDetMapToken_
 
std::unique_ptr< TkHistoMaptkhisto_
 
TrackerMap tkmap_
 

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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: <one line="" class="" summary>="">

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

Definition at line 57 of file DetIdSelectorTest.cc.

Constructor & Destructor Documentation

◆ DetIdSelectorTest()

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

Definition at line 88 of file DetIdSelectorTest.cc.

90  //now do what ever initialization is needed
91 
92  std::vector<edm::ParameterSet> selconfigs = iConfig.getParameter<std::vector<edm::ParameterSet> >("selections");
93 
94  for (std::vector<edm::ParameterSet>::const_iterator selconfig = selconfigs.begin(); selconfig != selconfigs.end();
95  ++selconfig) {
96  DetIdSelector selection(*selconfig);
97  detidsels_.push_back(selection);
98  }
99 
100  tkmap_.setPalette(1);
101  tkmap_.addPixel(true);
102 }

References TrackerMap::addPixel(), detidsels_, edm::ParameterSet::getParameter(), corrVsCorr::selection, TrackerMap::setPalette(), and tkmap_.

◆ ~DetIdSelectorTest()

DetIdSelectorTest::~DetIdSelectorTest ( )
override

Definition at line 104 of file DetIdSelectorTest.cc.

104  {
105  // do anything here that needs to be done at desctruction time
106  // (e.g. close files, deallocate resources etc.)
107 }

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 114 of file DetIdSelectorTest.cc.

114  {
115  using namespace edm;
116 
117  if (!tkhisto_) {
118  tkhisto_ = std::make_unique<TkHistoMap>(&iSetup.getData(tkDetMapToken_), "SelectorTest", "SelectorTest", -1);
119  }
120 
121  {
122  const auto detids = TrackerGeometryUtils::getSiStripDetIds(iSetup.getData(geomDetToken_));
123 
124  for (std::vector<uint32_t>::const_iterator detid = detids.begin(); detid != detids.end(); ++detid) {
125  LogDebug("DetID") << *detid;
126  int index = 0;
127  for (std::vector<DetIdSelector>::const_iterator detidsel = detidsels_.begin(); detidsel != detidsels_.end();
128  ++detidsel) {
129  if (detidsel->isSelected(*detid)) {
130  LogDebug("selected") << "Selected by selection " << index;
131  unsigned int det = *detid;
132  tkhisto_->add(det, index);
134  }
135  ++index;
136  }
137  }
138  }
139 
140  {
141  edm::FileInPath fp("CalibTracker/SiPixelESProducers/data/PixelSkimmedGeometry.txt");
142 
143  SiPixelDetInfoFileReader pxlreader(fp.fullPath());
144  const std::vector<uint32_t>& detids = pxlreader.getAllDetIds();
145 
146  for (std::vector<uint32_t>::const_iterator detid = detids.begin(); detid != detids.end(); ++detid) {
147  LogDebug("DetID") << *detid;
148  int index = 0;
149  for (std::vector<DetIdSelector>::const_iterator detidsel = detidsels_.begin(); detidsel != detidsels_.end();
150  ++detidsel) {
151  if (detidsel->isSelected(*detid)) {
152  LogDebug("selected") << "Selected by selection " << index;
153  unsigned int det = *detid;
154  // tkhisto_->add(det,index);
156  }
157  ++index;
158  }
159  }
160  }
161 
162  /*
163  edm::ESHandle<TrackerGeometry> pDD;
164  iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
165 
166  for (TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++){
167 
168  if(dynamic_cast<PixelGeomDetUnit*>((*it))!=0){
169  DetId detId = (*it)->geographicalId();
170  LogDebug("DetID") << detId.rawId();
171  int index=0;
172  for(std::vector<DetIdSelector>::const_iterator detidsel=detidsels_.begin();detidsel!=detidsels_.end();++detidsel) {
173  if(detidsel->isSelected(detId)) {
174  LogDebug("selected") << " Selected by selection " << index;
175  // tkhisto_->add(det,index);
176  tkmap_.fill_current_val(detId.rawId(),index);
177  }
178  ++index;
179  }
180 
181  }
182 
183  }
184  */
185 }

References detidsels_, TrackerMap::fill_current_val(), personalPlayback::fp, geomDetToken_, SiPixelDetInfoFileReader::getAllDetIds(), edm::EventSetup::getData(), TrackerGeometryUtils::getSiStripDetIds(), LogDebug, tkDetMapToken_, tkhisto_, and tkmap_.

◆ beginJob()

void DetIdSelectorTest::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 188 of file DetIdSelectorTest.cc.

188 {}

◆ endJob()

void DetIdSelectorTest::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 191 of file DetIdSelectorTest.cc.

191  {
192  // tkhisto_->dumpInTkMap(&tkmap);
193  std::string mapname = "SelectorTest.png";
194  tkmap_.save(true, 0, 0, mapname, 5700, 2400);
195 
196  std::string rootmapname = "TKMap_Selectortest.root";
197  tkhisto_->save(rootmapname);
198 }

References TrackerMap::save(), AlCaHLTBitMon_QueryRunRegistry::string, tkhisto_, and tkmap_.

Member Data Documentation

◆ detidsels_

std::vector<DetIdSelector> DetIdSelectorTest::detidsels_
private

Definition at line 69 of file DetIdSelectorTest.cc.

Referenced by analyze(), and DetIdSelectorTest().

◆ geomDetToken_

edm::ESGetToken<GeometricDet, IdealGeometryRecord> DetIdSelectorTest::geomDetToken_
private

Definition at line 74 of file DetIdSelectorTest.cc.

Referenced by analyze().

◆ tkDetMapToken_

edm::ESGetToken<TkDetMap, TrackerTopologyRcd> DetIdSelectorTest::tkDetMapToken_
private

Definition at line 73 of file DetIdSelectorTest.cc.

Referenced by analyze().

◆ tkhisto_

std::unique_ptr<TkHistoMap> DetIdSelectorTest::tkhisto_
private

Definition at line 70 of file DetIdSelectorTest.cc.

Referenced by analyze(), and endJob().

◆ tkmap_

TrackerMap DetIdSelectorTest::tkmap_
private

Definition at line 71 of file DetIdSelectorTest.cc.

Referenced by analyze(), DetIdSelectorTest(), and endJob().

SiPixelDetInfoFileReader::getAllDetIds
const std::vector< uint32_t > & getAllDetIds() const
Definition: SiPixelDetInfoFileReader.cc:85
DetIdSelectorTest::tkhisto_
std::unique_ptr< TkHistoMap > tkhisto_
Definition: DetIdSelectorTest.cc:70
TrackerMap::setPalette
void setPalette(int numpalette)
Definition: TrackerMap.h:155
DetIdSelectorTest::tkmap_
TrackerMap tkmap_
Definition: DetIdSelectorTest.cc:71
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackerMap::fill_current_val
void fill_current_val(int idmod, float current_val)
Definition: TrackerMap.cc:3258
personalPlayback.fp
fp
Definition: personalPlayback.py:523
DetIdSelectorTest::geomDetToken_
edm::ESGetToken< GeometricDet, IdealGeometryRecord > geomDetToken_
Definition: DetIdSelectorTest.cc:74
DetIdSelectorTest::tkDetMapToken_
edm::ESGetToken< TkDetMap, TrackerTopologyRcd > tkDetMapToken_
Definition: DetIdSelectorTest.cc:73
TrackerGeometryUtils::getSiStripDetIds
std::vector< uint32_t > getSiStripDetIds(const GeometricDet &geomDet)
Definition: utils.cc:5
SiPixelDetInfoFileReader
Definition: SiPixelDetInfoFileReader.h:28
edm::FileInPath
Definition: FileInPath.h:64
TrackerMap::addPixel
void addPixel(bool addPixelfl)
Definition: TrackerMap.h:161
corrVsCorr.selection
selection
main part
Definition: corrVsCorr.py:100
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
DetIdSelectorTest::detidsels_
std::vector< DetIdSelector > detidsels_
Definition: DetIdSelectorTest.cc:69
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
TrackerMap::save
void save(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
Definition: TrackerMap.cc:810
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:202
DetIdSelector
Definition: DetIdSelector.h:12