CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ShallowRechitClustersProducer Class Reference

#include <ShallowRechitClustersProducer.h>

Inheritance diagram for ShallowRechitClustersProducer:
edm::stream::EDProducer<>

Public Member Functions

 ShallowRechitClustersProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 

Private Attributes

const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordgeomToken_
 
std::string Prefix
 
std::vector< edm::EDGetTokenT< SiStripRecHit2DCollection > > rec_hits_tokens_
 
std::string Suffix
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 13 of file ShallowRechitClustersProducer.h.

Constructor & Destructor Documentation

◆ ShallowRechitClustersProducer()

ShallowRechitClustersProducer::ShallowRechitClustersProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 11 of file ShallowRechitClustersProducer.cc.

References edm::ParameterSet::getParameter(), Prefix, rec_hits_tokens_, and Suffix.

12  : Suffix(iConfig.getParameter<std::string>("Suffix")),
13  Prefix(iConfig.getParameter<std::string>("Prefix")),
14  geomToken_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()),
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 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
std::vector< edm::EDGetTokenT< SiStripRecHit2DCollection > > rec_hits_tokens_

Member Function Documentation

◆ produce()

void ShallowRechitClustersProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 32 of file ShallowRechitClustersProducer.cc.

References clusters_token_, Exception, geomToken_, edm::EventSetup::getHandle(), mps_fire::i, iEvent, shallow::make_cluster_map(), Topology::measurementError(), eostools::move(), Prefix, rec_hits_tokens_, FastTrackerRecHitMaskProducer_cfi::recHits, findQualityFiles::size, StripGeomDetUnit::specificTopology(), mathSSE::sqrt(), StripTopology::strip(), nano_mu_digi_cff::strip, Suffix, GeomDet::toGlobal(), x, hit::x, y, hit::y, and z.

32  {
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 }
size
Write out results.
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
virtual float strip(const LocalPoint &) const =0
int iEvent
Definition: GenABIO.cc:224
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
std::vector< edm::EDGetTokenT< SiStripRecHit2DCollection > > rec_hits_tokens_
T sqrt(T t)
Definition: SSEVec.h:19
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
CLUSTERMAP make_cluster_map(const edm::Event &, const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > &)
Definition: ShallowTools.cc:12
std::map< std::pair< uint32_t, uint16_t >, unsigned int > CLUSTERMAP
Definition: ShallowTools.h:21
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ clusters_token_

const edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > ShallowRechitClustersProducer::clusters_token_
private

Definition at line 21 of file ShallowRechitClustersProducer.h.

Referenced by produce().

◆ geomToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> ShallowRechitClustersProducer::geomToken_
private

Definition at line 20 of file ShallowRechitClustersProducer.h.

Referenced by produce().

◆ Prefix

std::string ShallowRechitClustersProducer::Prefix
private

Definition at line 19 of file ShallowRechitClustersProducer.h.

Referenced by produce(), and ShallowRechitClustersProducer().

◆ rec_hits_tokens_

std::vector<edm::EDGetTokenT<SiStripRecHit2DCollection> > ShallowRechitClustersProducer::rec_hits_tokens_
private

Definition at line 22 of file ShallowRechitClustersProducer.h.

Referenced by produce(), and ShallowRechitClustersProducer().

◆ Suffix

std::string ShallowRechitClustersProducer::Suffix
private

Definition at line 18 of file ShallowRechitClustersProducer.h.

Referenced by produce(), and ShallowRechitClustersProducer().