CMS 3D CMS Logo

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

List of all members.

Public Member Functions

 DetIdSelectorTest (const edm::ParameterSet &)
 ~DetIdSelectorTest ()

Private Member Functions

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

Private Attributes

std::vector< DetIdSelectordetidsels_
TkHistoMaptkhisto_
TrackerMap tkmap_

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_.

                                                                  :
  detidsels_(), tkhisto_(new TkHistoMap("SelectorTest","SelectorTest",-1)),tkmap_()
{
   //now do what ever initialization is needed

  std::vector<edm::ParameterSet> selconfigs = iConfig.getParameter<std::vector<edm::ParameterSet> >("selections");

  for(std::vector<edm::ParameterSet>::const_iterator selconfig=selconfigs.begin();selconfig!=selconfigs.end();++selconfig) {
    DetIdSelector selection(*selconfig);
    detidsels_.push_back(selection);
  }

  tkmap_.setPalette(1);
  tkmap_.addPixel(true);

}
DetIdSelectorTest::~DetIdSelectorTest ( )

Definition at line 108 of file DetIdSelectorTest.cc.

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

}

Member Function Documentation

void DetIdSelectorTest::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [override, private, virtual]

Implements edm::EDAnalyzer.

Definition at line 123 of file DetIdSelectorTest.cc.

References TkHistoMap::add(), cond::rpcobgas::detid, detidsels_, TrackerMap::fill_current_val(), edm::FileInPath::fullPath(), SiPixelDetInfoFileReader::getAllDetIds(), SiStripDetInfoFileReader::getAllDetIds(), getHLTprescales::index, LogDebug, cppFunctionSkipper::operator, matplotRender::reader, tkhisto_, and tkmap_.

{
   using namespace edm;
   
   {
     SiStripDetInfoFileReader * reader=edm::Service<SiStripDetInfoFileReader>().operator->();
     
     //   SiStripDetInfoFileReader reader(edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"));
     //   SiStripDetInfoFileReader reader;
     
     const std::vector<uint32_t>& detids = reader->getAllDetIds();
     
     for(std::vector<uint32_t>::const_iterator detid=detids.begin();detid!=detids.end();++detid) {
       
       LogDebug("DetID") << *detid;
       int index=0;
       for(std::vector<DetIdSelector>::const_iterator detidsel=detidsels_.begin();detidsel!=detidsels_.end();++detidsel) {
         if(detidsel->isSelected(*detid)) {
           LogDebug("selected") << "Selected by selection " << index;
           unsigned int det = *detid;
           tkhisto_->add(det,index);
           tkmap_.fill_current_val(det,index);
         }
         ++index;
       }
       
     }
   }

   {
     edm::FileInPath fp("CalibTracker/SiPixelESProducers/data/PixelSkimmedGeometry.txt");
     
     SiPixelDetInfoFileReader pxlreader(fp.fullPath());
     const std::vector<uint32_t>& detids = pxlreader.getAllDetIds();
     
     for(std::vector<uint32_t>::const_iterator detid=detids.begin();detid!=detids.end();++detid) {
       
       LogDebug("DetID") << *detid;
       int index=0;
       for(std::vector<DetIdSelector>::const_iterator detidsel=detidsels_.begin();detidsel!=detidsels_.end();++detidsel) {
         if(detidsel->isSelected(*detid)) {
           LogDebug("selected") << "Selected by selection " << index;
           unsigned int det = *detid;
           //      tkhisto_->add(det,index);
           tkmap_.fill_current_val(det,index);
         }
         ++index;
       }
       
     }
   }
    
 
   /*
     edm::ESHandle<TrackerGeometry> pDD;
     iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
     
     for (TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++){
     
     if(dynamic_cast<PixelGeomDetUnit*>((*it))!=0){
     DetId detId = (*it)->geographicalId();
     LogDebug("DetID") << detId.rawId();
     int index=0;
     for(std::vector<DetIdSelector>::const_iterator detidsel=detidsels_.begin();detidsel!=detidsels_.end();++detidsel) {
     if(detidsel->isSelected(detId)) {
     LogDebug("selected") << " Selected by selection " << index;
     //  tkhisto_->add(det,index);
     tkmap_.fill_current_val(detId.rawId(),index);
     }
     ++index;
     }
     
     }
     
     }
   */   
}
void DetIdSelectorTest::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 203 of file DetIdSelectorTest.cc.

{

}
void DetIdSelectorTest::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 210 of file DetIdSelectorTest.cc.

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

                          {


  //  tkhisto_->dumpInTkMap(&tkmap);
  std::string mapname = "SelectorTest.png";
  tkmap_.save(true,0,0,mapname,5700,2400);

  std::string rootmapname = "TKMap_Selectortest.root";
  tkhisto_->save(rootmapname);
}

Member Data Documentation

Definition at line 72 of file DetIdSelectorTest.cc.

Referenced by analyze(), and DetIdSelectorTest().

Definition at line 73 of file DetIdSelectorTest.cc.

Referenced by analyze(), and endJob().

Definition at line 74 of file DetIdSelectorTest.cc.

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