CMS 3D CMS Logo

MkFitEventOfHitsProducer.cc
Go to the documentation of this file.
2 
6 
8 
14 
19 
20 // mkFit includes
21 #include "mkFit/HitStructures.h"
22 #include "mkFit/MkStdSeqs.h"
23 #include "LayerNumberConverter.h"
24 
26 public:
27  explicit MkFitEventOfHitsProducer(edm::ParameterSet const& iConfig);
28  ~MkFitEventOfHitsProducer() override = default;
29 
30  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
31 
32 private:
33  void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
34 
35  void fill(const std::vector<const TrackingRecHit*>& hits,
36  mkfit::EventOfHits& eventOfHits,
37  const MkFitGeometry& mkFitGeom) const;
38 
48 };
49 
51  : pixelHitsToken_{consumes(iConfig.getParameter<edm::InputTag>("pixelHits"))},
52  stripHitsToken_{consumes(iConfig.getParameter<edm::InputTag>("stripHits"))},
53  pixelClusterIndexToHitToken_{consumes(iConfig.getParameter<edm::InputTag>("pixelHits"))},
54  stripClusterIndexToHitToken_{consumes(iConfig.getParameter<edm::InputTag>("stripHits"))},
55  mkFitGeomToken_{esConsumes()},
56  putToken_{produces<MkFitEventOfHits>()},
57  useStripStripQualityDB_{iConfig.getParameter<bool>("useStripStripQualityDB")} {
58  if (useStripStripQualityDB_) {
59  qualityToken_ = esConsumes();
60  geomToken_ = esConsumes();
61  }
62 }
63 
66 
67  desc.add("pixelHits", edm::InputTag{"mkFitSiPixelHits"});
68  desc.add("stripHits", edm::InputTag{"mkFitSiStripHits"});
69  desc.add("useStripStripQualityDB", false)->setComment("Use SiStrip quality DB information");
70 
71  descriptions.addWithDefaultLabel(desc);
72 }
73 
75  const auto& pixelHits = iEvent.get(pixelHitsToken_);
76  const auto& stripHits = iEvent.get(stripHitsToken_);
77  const auto& mkFitGeom = iSetup.getData(mkFitGeomToken_);
78 
79  auto eventOfHits = std::make_unique<mkfit::EventOfHits>(mkFitGeom.trackerInfo());
80  mkfit::StdSeq::Cmssw_LoadHits_Begin(*eventOfHits, {&pixelHits.hits(), &stripHits.hits()});
81 
83  std::vector<mkfit::DeadVec> deadvectors(mkFitGeom.layerNumberConverter().nLayers());
84  const auto& siStripQuality = iSetup.getData(qualityToken_);
85  const auto& trackerGeom = iSetup.getData(geomToken_);
86  const auto& badStrips = siStripQuality.getBadComponentList();
87  for (const auto& bs : badStrips) {
88  const auto& surf = trackerGeom.idToDet(DetId(bs.detid))->surface();
89  const DetId detid(bs.detid);
90  bool isBarrel = (mkFitGeom.topology()->side(detid) == static_cast<unsigned>(TrackerDetSide::Barrel));
91  const auto ilay = mkFitGeom.mkFitLayerNumber(detid);
92  deadvectors[ilay].push_back({surf.phiSpan().first,
93  surf.phiSpan().second,
94  (isBarrel ? surf.zSpan().first : surf.rSpan().first),
95  (isBarrel ? surf.zSpan().second : surf.rSpan().second)});
96  }
97  mkfit::StdSeq::LoadDeads(*eventOfHits, deadvectors);
98  }
99 
100  fill(iEvent.get(pixelClusterIndexToHitToken_).hits(), *eventOfHits, mkFitGeom);
101  fill(iEvent.get(stripClusterIndexToHitToken_).hits(), *eventOfHits, mkFitGeom);
102 
103  mkfit::StdSeq::Cmssw_LoadHits_End(*eventOfHits);
104 
106 }
107 
108 void MkFitEventOfHitsProducer::fill(const std::vector<const TrackingRecHit*>& hits,
109  mkfit::EventOfHits& eventOfHits,
110  const MkFitGeometry& mkFitGeom) const {
111  for (int i = 0, end = hits.size(); i < end; ++i) {
112  const auto* hit = hits[i];
113  if (hit != nullptr) {
114  const auto ilay = mkFitGeom.mkFitLayerNumber(hit->geographicalId());
115  eventOfHits[ilay].RegisterHit(i);
116  }
117  }
118 }
119 
edm::StreamID
Definition: StreamID.h:30
mps_fire.i
i
Definition: mps_fire.py:428
MkFitGeometry::mkFitLayerNumber
int mkFitLayerNumber(DetId detId) const
Definition: MkFitGeometry.cc:79
MkFitEventOfHitsProducer::stripHitsToken_
const edm::EDGetTokenT< MkFitHitWrapper > stripHitsToken_
Definition: MkFitEventOfHitsProducer.cc:40
TrackerGeometry.h
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
MkFitEventOfHitsProducer::pixelHitsToken_
const edm::EDGetTokenT< MkFitHitWrapper > pixelHitsToken_
Definition: MkFitEventOfHitsProducer.cc:39
edm::EDGetTokenT< MkFitHitWrapper >
edm::EDPutTokenT< MkFitEventOfHits >
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
MkFitEventOfHitsProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: MkFitEventOfHitsProducer.cc:64
TrackerRecoGeometryRecord.h
MkFitEventOfHitsProducer::MkFitEventOfHitsProducer
MkFitEventOfHitsProducer(edm::ParameterSet const &iConfig)
Definition: MkFitEventOfHitsProducer.cc:50
MkFitEventOfHitsProducer::useStripStripQualityDB_
const bool useStripStripQualityDB_
Definition: MkFitEventOfHitsProducer.cc:47
DetId
Definition: DetId.h:17
MakerMacros.h
cms::cuda::bs
bs
Definition: HistoContainer.h:76
TrackingRecHit.h
TrackerDetSide::Barrel
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MkFitEventOfHits.h
mps_fire.end
end
Definition: mps_fire.py:242
MkFitEventOfHitsProducer::putToken_
const edm::EDPutTokenT< MkFitEventOfHits > putToken_
Definition: MkFitEventOfHitsProducer.cc:46
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
PixelPluginsPhase0_cfi.isBarrel
isBarrel
Definition: PixelPluginsPhase0_cfi.py:17
MkFitGeometry
Definition: MkFitGeometry.h:24
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
MkFitEventOfHitsProducer::~MkFitEventOfHitsProducer
~MkFitEventOfHitsProducer() override=default
MkFitEventOfHitsProducer::mkFitGeomToken_
const edm::ESGetToken< MkFitGeometry, TrackerRecoGeometryRecord > mkFitGeomToken_
Definition: MkFitEventOfHitsProducer.cc:43
MkFitEventOfHitsProducer
Definition: MkFitEventOfHitsProducer.cc:25
MkFitEventOfHitsProducer::produce
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
Definition: MkFitEventOfHitsProducer.cc:74
iEvent
int iEvent
Definition: GenABIO.cc:224
MkFitEventOfHitsProducer::pixelClusterIndexToHitToken_
const edm::EDGetTokenT< MkFitClusterIndexToHit > pixelClusterIndexToHitToken_
Definition: MkFitEventOfHitsProducer.cc:41
TrackerDetSide.h
edm::EventSetup
Definition: EventSetup.h:58
edm::ESGetToken< MkFitGeometry, TrackerRecoGeometryRecord >
InitialStepPreSplitting_cff.eventOfHits
eventOfHits
Definition: InitialStepPreSplitting_cff.py:154
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
MkFitClusterIndexToHit.h
MkFitEventOfHitsProducer::fill
void fill(const std::vector< const TrackingRecHit * > &hits, mkfit::EventOfHits &eventOfHits, const MkFitGeometry &mkFitGeom) const
Definition: MkFitEventOfHitsProducer.cc:108
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
MkFitEventOfHitsProducer::geomToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
Definition: MkFitEventOfHitsProducer.cc:45
SiStripQuality.h
SiStripQualityRcd.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MkFitEventOfHitsProducer::stripClusterIndexToHitToken_
const edm::EDGetTokenT< MkFitClusterIndexToHit > stripClusterIndexToHitToken_
Definition: MkFitEventOfHitsProducer.cc:42
ParameterSet.h
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:159
EDProducer.h
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
MkFitEventOfHitsProducer::qualityToken_
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > qualityToken_
Definition: MkFitEventOfHitsProducer.cc:44
InitialStepPreSplitting_cff.pixelHits
pixelHits
Definition: InitialStepPreSplitting_cff.py:142
edm::InputTag
Definition: InputTag.h:15
hit
Definition: SiStripHitEffFromCalibTree.cc:88
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87
MkFitGeometry.h
MkFitHitWrapper.h