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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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.

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 }

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

Member Function Documentation

◆ produce()

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

Definition at line 32 of file ShallowRechitClustersProducer.cc.

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 }

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(), digitizers_cfi::strip, StripTopology::strip(), Suffix, GeomDet::toGlobal(), x, hit::x, y, hit::y, and z.

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().

DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:428
hit::y
double y
Definition: SiStripHitEffFromCalibTree.cc:90
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
DDAxes::x
edm::Handle
Definition: AssociativeIterator.h:50
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
ShallowRechitClustersProducer::geomToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
Definition: ShallowRechitClustersProducer.h:20
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDAxes::z
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
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
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:148
ShallowRechitClustersProducer::Suffix
std::string Suffix
Definition: ShallowRechitClustersProducer.h:18
edmNew::DetSetVector
Definition: DetSetNew.h:13
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
Exception
Definition: hltDiff.cc:246
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
edm::InputTag
Definition: InputTag.h:15
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