Go to the documentation of this file.00001
00002
00003 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
00004 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
00005
00006 #include "FWCore/Framework/interface/ESHandle.h"
00007
00008 #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
00009 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
00010
00011 #include "SimGeneral/TrackingAnalysis/interface/TrackerPSimHitSelector.h"
00012
00013 #include "SimTracker/Common/interface/SimHitSelectorFromDB.h"
00014
00015
00016 void TrackerPSimHitSelector::select(PSimHitCollection & selection, edm::Event const & event, edm::EventSetup const & setup) const
00017 {
00018
00019 PSimHitCollectionMap::const_iterator pSimHitCollections = pSimHitCollectionMap_.find("tracker");
00020
00021
00022 if (pSimHitCollections == pSimHitCollectionMap_.end()) return;
00023
00024
00025 edm::Handle<CrossingFrame<PSimHit> > cfPSimHits;
00026 std::vector<const CrossingFrame<PSimHit> *> cfPSimHitProductPointers;
00027
00028
00029 for (std::size_t i = 0; i < pSimHitCollections->second.size(); ++i)
00030 {
00031 event.getByLabel("mix", pSimHitCollections->second[i], cfPSimHits);
00032 cfPSimHitProductPointers.push_back(cfPSimHits.product());
00033 }
00034
00035
00036 std::auto_ptr<MixCollection<PSimHit> > pSimHits(new MixCollection<PSimHit>(cfPSimHitProductPointers));
00037
00038
00039 std::map<uint32_t, std::vector<int> > theDetIdList;
00040 edm::ESHandle<SiStripDetCabling> detCabling;
00041 setup.get<SiStripDetCablingRcd>().get( detCabling );
00042 detCabling->addConnected(theDetIdList);
00043
00044
00045 std::vector<std::pair<const PSimHit*,int> > psimhits(SimHitSelectorFromDB().getSimHit(pSimHits, theDetIdList));
00046
00047
00048 for (std::size_t i = 0; i < psimhits.size(); ++i)
00049 selection.push_back( *(const_cast<PSimHit*>(psimhits[i].first)) );
00050 }