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

List of all members.

Public Member Functions

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

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
virtual void endJob ()
virtual void endRun (const edm::Run &, const edm::EventSetup &)

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 92 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 110 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 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 125 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 215 of file DetIdSelectorTest.cc.

{

}
void DetIdSelectorTest::beginRun ( const edm::Run iRun,
const edm::EventSetup  
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 204 of file DetIdSelectorTest.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 222 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);

  std::string rootmapname = "TKMap_Selectortest.root";
  tkhisto_->save(rootmapname);
}
void DetIdSelectorTest::endRun ( const edm::Run iRun,
const edm::EventSetup  
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 208 of file DetIdSelectorTest.cc.

{
}

Member Data Documentation

Definition at line 74 of file DetIdSelectorTest.cc.

Referenced by analyze(), and DetIdSelectorTest().

Definition at line 75 of file DetIdSelectorTest.cc.

Referenced by analyze(), and endJob().

Definition at line 76 of file DetIdSelectorTest.cc.

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