CMS 3D CMS Logo

ShallowRechitClustersProducer.cc
Go to the documentation of this file.
2 
8 
10 
12  : Suffix(iConfig.getParameter<std::string>("Suffix")),
13  Prefix(iConfig.getParameter<std::string>("Prefix")),
15  clusters_token_(consumes<edmNew::DetSetVector<SiStripCluster>>(iConfig.getParameter<edm::InputTag>("Clusters"))) {
16  std::vector<edm::InputTag> rec_hits_tags = iConfig.getParameter<std::vector<edm::InputTag>>("InputTags");
17  for (const auto& itag : rec_hits_tags) {
18  rec_hits_tokens_.push_back(consumes<SiStripRecHit2DCollection>(itag));
19  }
20 
21  produces<std::vector<float>>(Prefix + "strip" + Suffix);
22  produces<std::vector<float>>(Prefix + "merr" + Suffix);
23  produces<std::vector<float>>(Prefix + "localx" + Suffix);
24  produces<std::vector<float>>(Prefix + "localy" + Suffix);
25  produces<std::vector<float>>(Prefix + "localxerr" + Suffix);
26  produces<std::vector<float>>(Prefix + "localyerr" + Suffix);
27  produces<std::vector<float>>(Prefix + "globalx" + Suffix);
28  produces<std::vector<float>>(Prefix + "globaly" + Suffix);
29  produces<std::vector<float>>(Prefix + "globalz" + Suffix);
30 }
31 
34 
35  int size = clustermap.size();
36  auto strip = std::make_unique<std::vector<float>>(size, -10000);
37  auto merr = std::make_unique<std::vector<float>>(size, -10000);
38  auto localx = std::make_unique<std::vector<float>>(size, -10000);
39  auto localy = std::make_unique<std::vector<float>>(size, -10000);
40  auto localxerr = std::make_unique<std::vector<float>>(size, -1);
41  auto localyerr = std::make_unique<std::vector<float>>(size, -1);
42  auto globalx = std::make_unique<std::vector<float>>(size, -10000);
43  auto globaly = std::make_unique<std::vector<float>>(size, -10000);
44  auto globalz = std::make_unique<std::vector<float>>(size, -10000);
45 
46  edm::ESHandle<TrackerGeometry> theTrackerGeometry = iSetup.getHandle(geomToken_);
47 
48  for (auto recHit_token : rec_hits_tokens_) {
50  iEvent.getByToken(recHit_token, recHits);
51  for (auto const& ds : *recHits) {
52  for (auto const& hit : ds) {
53  shallow::CLUSTERMAP::iterator cluster =
54  clustermap.find(std::make_pair(hit.geographicalId().rawId(), hit.cluster()->firstStrip()));
55  if (cluster != clustermap.end()) {
56  const StripGeomDetUnit* theStripDet =
57  dynamic_cast<const StripGeomDetUnit*>(theTrackerGeometry->idToDet(hit.geographicalId()));
58  unsigned int i = cluster->second;
59  strip->at(i) = theStripDet->specificTopology().strip(hit.localPosition());
60  merr->at(i) = sqrt(
61  theStripDet->specificTopology().measurementError(hit.localPosition(), hit.localPositionError()).uu());
62  localx->at(i) = hit.localPosition().x();
63  localy->at(i) = hit.localPosition().y();
64  localxerr->at(i) = sqrt(hit.localPositionError().xx());
65  localyerr->at(i) = sqrt(hit.localPositionError().yy());
66  globalx->at(i) = theStripDet->toGlobal(hit.localPosition()).x();
67  globaly->at(i) = theStripDet->toGlobal(hit.localPosition()).y();
68  globalz->at(i) = theStripDet->toGlobal(hit.localPosition()).z();
69  } else {
70  throw cms::Exception("cluster not found");
71  }
72  }
73  }
74  }
75 
76  iEvent.put(std::move(strip), Prefix + "strip" + Suffix);
77  iEvent.put(std::move(merr), Prefix + "merr" + Suffix);
78  iEvent.put(std::move(localx), Prefix + "localx" + Suffix);
79  iEvent.put(std::move(localy), Prefix + "localy" + Suffix);
80  iEvent.put(std::move(localxerr), Prefix + "localxerr" + Suffix);
81  iEvent.put(std::move(localyerr), Prefix + "localyerr" + Suffix);
82  iEvent.put(std::move(globalx), Prefix + "globalx" + Suffix);
83  iEvent.put(std::move(globaly), Prefix + "globaly" + Suffix);
84  iEvent.put(std::move(globalz), Prefix + "globalz" + Suffix);
85 }
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:428
ShallowTools.h
StripGeomDetUnit.h
hit::y
double y
Definition: SiStripHitEffFromCalibTree.cc:90
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
ShallowRechitClustersProducer::ShallowRechitClustersProducer
ShallowRechitClustersProducer(const edm::ParameterSet &)
Definition: ShallowRechitClustersProducer.cc:11
DDAxes::x
StripTopology.h
edm::Handle
Definition: AssociativeIterator.h:50
edmNew
Definition: DetSet2RangeMap.h:11
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
ShallowRechitClustersProducer::geomToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
Definition: ShallowRechitClustersProducer.h:20
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDAxes::z
L1TCaloTriggerNtuples_cff.Prefix
Prefix
Definition: L1TCaloTriggerNtuples_cff.py:8
edm::ESHandle< TrackerGeometry >
Topology::measurementError
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
StripTopology::strip
virtual float strip(const LocalPoint &) const =0
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
ShallowRechitClustersProducer::rec_hits_tokens_
std::vector< edm::EDGetTokenT< SiStripRecHit2DCollection > > rec_hits_tokens_
Definition: ShallowRechitClustersProducer.h:22
ShallowRechitClustersProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: ShallowRechitClustersProducer.cc:32
ShallowRechitClustersProducer.h
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
ShallowRechitClustersProducer::Prefix
std::string Prefix
Definition: ShallowRechitClustersProducer.h:19
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
ShallowRechitClustersProducer::Suffix
std::string Suffix
Definition: ShallowRechitClustersProducer.h:18
edm::EventSetup
Definition: EventSetup.h:58
shallow::make_cluster_map
CLUSTERMAP make_cluster_map(const edm::Event &, const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > &)
Definition: ShallowTools.cc:12
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
StripGeomDetUnit::specificTopology
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
Definition: StripGeomDetUnit.cc:17
ParameterSet.h
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
SiStripCluster
Definition: SiStripCluster.h:8
shallow::CLUSTERMAP
std::map< std::pair< uint32_t, uint16_t >, unsigned int > CLUSTERMAP
Definition: ShallowTools.h:21
hit
Definition: SiStripHitEffFromCalibTree.cc:88
ShallowRechitClustersProducer::clusters_token_
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
Definition: ShallowRechitClustersProducer.h:21
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
StripGeomDetUnit
Definition: StripGeomDetUnit.h:15
TrackerGeometry
Definition: TrackerGeometry.h:14