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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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_
 
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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, ESInputTag const &tag)
 
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 58 of file DetIdSelectorTest.cc.

Constructor & Destructor Documentation

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

Definition at line 90 of file DetIdSelectorTest.cc.

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

90  :
91  detidsels_(), tkhisto_(nullptr), tkmap_()
92 {
93  //now do what ever initialization is needed
94 
95  std::vector<edm::ParameterSet> selconfigs = iConfig.getParameter<std::vector<edm::ParameterSet> >("selections");
96 
97  for(std::vector<edm::ParameterSet>::const_iterator selconfig=selconfigs.begin();selconfig!=selconfigs.end();++selconfig) {
98  DetIdSelector selection(*selconfig);
99  detidsels_.push_back(selection);
100  }
101 
102  tkmap_.setPalette(1);
103  tkmap_.addPixel(true);
104 
105 }
T getParameter(std::string const &) const
void addPixel(bool addPixelfl)
Definition: TrackerMap.h:135
selection
main part
Definition: corrVsCorr.py:99
std::unique_ptr< TkHistoMap > tkhisto_
void setPalette(int numpalette)
Definition: TrackerMap.h:129
std::vector< DetIdSelector > detidsels_
DetIdSelectorTest::~DetIdSelectorTest ( )
override

Definition at line 108 of file DetIdSelectorTest.cc.

109 {
110 
111  // do anything here that needs to be done at desctruction time
112  // (e.g. close files, deallocate resources etc.)
113 
114 }

Member Function Documentation

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

Definition at line 123 of file DetIdSelectorTest.cc.

References detidsels_, TrackerMap::fill_current_val(), edm::FileInPath::fullPath(), edm::EventSetup::get(), SiPixelDetInfoFileReader::getAllDetIds(), SiStripDetInfoFileReader::getAllDetIds(), LogDebug, Utilities::operator, edm::ESHandle< T >::product(), matplotRender::reader, tkhisto_, and tkmap_.

124 {
125  using namespace edm;
126 
127  if ( ! tkhisto_ ) {
128  edm::ESHandle<TkDetMap> tkDetMapHandle;
129  iSetup.get<TrackerTopologyRcd>().get(tkDetMapHandle);
130  tkhisto_ = std::make_unique<TkHistoMap>(tkDetMapHandle.product(), "SelectorTest","SelectorTest",-1);
131  }
132 
133  {
135 
136  // SiStripDetInfoFileReader reader(edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"));
137  // SiStripDetInfoFileReader reader;
138 
139  const std::vector<uint32_t>& detids = reader->getAllDetIds();
140 
141  for(std::vector<uint32_t>::const_iterator detid=detids.begin();detid!=detids.end();++detid) {
142 
143  LogDebug("DetID") << *detid;
144  int index=0;
145  for(std::vector<DetIdSelector>::const_iterator detidsel=detidsels_.begin();detidsel!=detidsels_.end();++detidsel) {
146  if(detidsel->isSelected(*detid)) {
147  LogDebug("selected") << "Selected by selection " << index;
148  unsigned int det = *detid;
149  tkhisto_->add(det,index);
150  tkmap_.fill_current_val(det,index);
151  }
152  ++index;
153  }
154 
155  }
156  }
157 
158  {
159  edm::FileInPath fp("CalibTracker/SiPixelESProducers/data/PixelSkimmedGeometry.txt");
160 
161  SiPixelDetInfoFileReader pxlreader(fp.fullPath());
162  const std::vector<uint32_t>& detids = pxlreader.getAllDetIds();
163 
164  for(std::vector<uint32_t>::const_iterator detid=detids.begin();detid!=detids.end();++detid) {
165 
166  LogDebug("DetID") << *detid;
167  int index=0;
168  for(std::vector<DetIdSelector>::const_iterator detidsel=detidsels_.begin();detidsel!=detidsels_.end();++detidsel) {
169  if(detidsel->isSelected(*detid)) {
170  LogDebug("selected") << "Selected by selection " << index;
171  unsigned int det = *detid;
172  // tkhisto_->add(det,index);
173  tkmap_.fill_current_val(det,index);
174  }
175  ++index;
176  }
177 
178  }
179  }
180 
181 
182  /*
183  edm::ESHandle<TrackerGeometry> pDD;
184  iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
185 
186  for (TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++){
187 
188  if(dynamic_cast<PixelGeomDetUnit*>((*it))!=0){
189  DetId detId = (*it)->geographicalId();
190  LogDebug("DetID") << detId.rawId();
191  int index=0;
192  for(std::vector<DetIdSelector>::const_iterator detidsel=detidsels_.begin();detidsel!=detidsels_.end();++detidsel) {
193  if(detidsel->isSelected(detId)) {
194  LogDebug("selected") << " Selected by selection " << index;
195  // tkhisto_->add(det,index);
196  tkmap_.fill_current_val(detId.rawId(),index);
197  }
198  ++index;
199  }
200 
201  }
202 
203  }
204  */
205 }
#define LogDebug(id)
const std::vector< uint32_t > & getAllDetIds() const
std::unique_ptr< TkHistoMap > tkhisto_
std::vector< DetIdSelector > detidsels_
HLT enums.
T get() const
Definition: EventSetup.h:68
void fill_current_val(int idmod, float current_val)
Definition: TrackerMap.cc:2759
T const * product() const
Definition: ESHandle.h:84
void DetIdSelectorTest::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 209 of file DetIdSelectorTest.cc.

210 {
211 
212 }
void DetIdSelectorTest::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 216 of file DetIdSelectorTest.cc.

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

216  {
217 
218 
219  // tkhisto_->dumpInTkMap(&tkmap);
220  std::string mapname = "SelectorTest.png";
221  tkmap_.save(true,0,0,mapname,5700,2400);
222 
223  std::string rootmapname = "TKMap_Selectortest.root";
224  tkhisto_->save(rootmapname);
225 }
std::unique_ptr< TkHistoMap > tkhisto_
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:699

Member Data Documentation

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

Definition at line 72 of file DetIdSelectorTest.cc.

Referenced by analyze(), and DetIdSelectorTest().

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

Definition at line 73 of file DetIdSelectorTest.cc.

Referenced by analyze(), and endJob().

TrackerMap DetIdSelectorTest::tkmap_
private

Definition at line 74 of file DetIdSelectorTest.cc.

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