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
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 ()
 
- 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 endJob () override
 

Private Attributes

std::vector< DetIdSelectordetidsels_
 
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 &)
 
- 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 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_(new TkHistoMap("SelectorTest","SelectorTest",-1)),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:130
selection
main part
Definition: corrVsCorr.py:98
void setPalette(int numpalette)
Definition: TrackerMap.h:124
std::vector< DetIdSelector > detidsels_
DetIdSelectorTest::~DetIdSelectorTest ( )

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 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 123 of file DetIdSelectorTest.cc.

References TkHistoMap::add(), detidsels_, TrackerMap::fill_current_val(), personalPlayback::fp, edm::FileInPath::fullPath(), SiPixelDetInfoFileReader::getAllDetIds(), SiStripDetInfoFileReader::getAllDetIds(), cmsHarvester::index, LogDebug, cppFunctionSkipper::operator, matplotRender::reader, tkhisto_, and tkmap_.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 203 of file DetIdSelectorTest.cc.

204 {
205 
206 }
void DetIdSelectorTest::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 210 of file DetIdSelectorTest.cc.

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

210  {
211 
212 
213  // tkhisto_->dumpInTkMap(&tkmap);
214  std::string mapname = "SelectorTest.png";
215  tkmap_.save(true,0,0,mapname,5700,2400);
216 
217  std::string rootmapname = "TKMap_Selectortest.root";
218  tkhisto_->save(rootmapname);
219 }
void save(std::string filename)
Definition: TkHistoMap.cc:57
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().

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().