CMS 3D CMS Logo

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

#include <ShallowSimhitClustersProducer.h>

Inheritance diagram for ShallowSimhitClustersProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ShallowSimhitClustersProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

shallow::CLUSTERMAP::const_iterator match_cluster (const unsigned &, const float &, const shallow::CLUSTERMAP &, const edmNew::DetSetVector< SiStripCluster > &) const
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
 
std::string Prefix
 
std::string runningmode_
 
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simhits_tokens_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 12 of file ShallowSimhitClustersProducer.h.

Constructor & Destructor Documentation

◆ ShallowSimhitClustersProducer()

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

Definition at line 18 of file ShallowSimhitClustersProducer.cc.

20  Prefix(iConfig.getParameter<std::string>("Prefix")),
21  runningmode_(iConfig.getParameter<std::string>("runningMode")) {
22  std::vector<edm::InputTag> simhits_tags = iConfig.getParameter<std::vector<edm::InputTag>>("InputTags");
23  for (auto itag : simhits_tags) {
24  simhits_tokens_.push_back(consumes<std::vector<PSimHit>>(itag));
25  }
26 
27  produces<std::vector<unsigned>>(Prefix + "hits");
28  produces<std::vector<float>>(Prefix + "strip");
29  produces<std::vector<float>>(Prefix + "localtheta");
30  produces<std::vector<float>>(Prefix + "localphi");
31  produces<std::vector<float>>(Prefix + "localx");
32  produces<std::vector<float>>(Prefix + "localy");
33  produces<std::vector<float>>(Prefix + "localz");
34  produces<std::vector<float>>(Prefix + "momentum");
35  produces<std::vector<float>>(Prefix + "energyloss");
36  produces<std::vector<float>>(Prefix + "time");
37  produces<std::vector<int>>(Prefix + "particle");
38  produces<std::vector<unsigned short>>(Prefix + "process");
39 }

References edm::EDConsumerBase::consumes(), edm::ParameterSet::getParameter(), Prefix, and simhits_tokens_.

Member Function Documentation

◆ match_cluster()

shallow::CLUSTERMAP::const_iterator ShallowSimhitClustersProducer::match_cluster ( const unsigned &  id,
const float &  strip_,
const shallow::CLUSTERMAP clustermap,
const edmNew::DetSetVector< SiStripCluster > &  clusters 
) const
private

Definition at line 113 of file ShallowSimhitClustersProducer.cc.

117  {
118  shallow::CLUSTERMAP::const_iterator cluster = clustermap.end();
120  if (clustersDetSet != clusters.end()) {
121  edmNew::DetSet<SiStripCluster>::const_iterator left, right = clustersDetSet->begin();
122  while (right != clustersDetSet->end() && strip_ > right->barycenter())
123  right++;
124  left = right - 1;
125  if (right != clustersDetSet->end() && right != clustersDetSet->begin()) {
126  unsigned firstStrip =
127  (right->barycenter() - strip_) < (strip_ - left->barycenter()) ? right->firstStrip() : left->firstStrip();
128  cluster = clustermap.find(std::make_pair(id, firstStrip));
129  } else if (right != clustersDetSet->begin())
130  cluster = clustermap.find(std::make_pair(id, left->firstStrip()));
131  else
132  cluster = clustermap.find(std::make_pair(id, right->firstStrip()));
133  }
134  return cluster;
135 }

References edmNew::DetSetVector< T >::begin(), bsc_activity_cfg::clusters, and edmNew::DetSetVector< T >::end().

Referenced by produce().

◆ produce()

void ShallowSimhitClustersProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 41 of file ShallowSimhitClustersProducer.cc.

41  {
43 
44  int size = clustermap.size();
45  auto hits = std::make_unique<std::vector<unsigned>>(size, 0);
46  auto strip = std::make_unique<std::vector<float>>(size, -100);
47  auto localtheta = std::make_unique<std::vector<float>>(size, -100);
48  auto localphi = std::make_unique<std::vector<float>>(size, -100);
49  auto localx = std::make_unique<std::vector<float>>(size, -100);
50  auto localy = std::make_unique<std::vector<float>>(size, -100);
51  auto localz = std::make_unique<std::vector<float>>(size, -100);
52  auto momentum = std::make_unique<std::vector<float>>(size, 0);
53  auto energyloss = std::make_unique<std::vector<float>>(size, -1);
54  auto time = std::make_unique<std::vector<float>>(size, -1);
55  auto particle = std::make_unique<std::vector<int>>(size, -500);
56  auto process = std::make_unique<std::vector<unsigned short>>(size, 0);
57 
58  edm::ESHandle<TrackerGeometry> theTrackerGeometry;
59  iSetup.get<TrackerDigiGeometryRecord>().get(theTrackerGeometry);
65  iEvent.getByLabel("siStripClusters", "", clusters);
66 
67  for (auto& simhit_token : simhits_tokens_) {
69  iEvent.getByToken(simhit_token, simhits);
70  for (auto const& hit : *simhits) {
71  const uint32_t id = hit.detUnitId();
72  const StripGeomDetUnit* theStripDet = dynamic_cast<const StripGeomDetUnit*>(theTrackerGeometry->idToDet(id));
74 
75  const float driftedstrip_ = theStripDet->specificTopology().strip(hit.localPosition() + 0.5 * drift);
76  const float hitstrip_ = theStripDet->specificTopology().strip(hit.localPosition());
77 
78  shallow::CLUSTERMAP::const_iterator cluster = match_cluster(id, driftedstrip_, clustermap, *clusters);
79  if (cluster != clustermap.end()) {
80  unsigned i = cluster->second;
81  hits->at(i) += 1;
82  if (hits->at(i) == 1) {
83  strip->at(i) = hitstrip_;
84  localtheta->at(i) = hit.thetaAtEntry();
85  localphi->at(i) = hit.phiAtEntry();
86  localx->at(i) = hit.localPosition().x();
87  localy->at(i) = hit.localPosition().y();
88  localz->at(i) = hit.localPosition().z();
89  momentum->at(i) = hit.pabs();
90  energyloss->at(i) = hit.energyLoss();
91  time->at(i) = hit.timeOfFlight();
92  particle->at(i) = hit.particleType();
93  process->at(i) = hit.processType();
94  }
95  }
96  }
97  }
98 
99  iEvent.put(std::move(hits), Prefix + "hits");
100  iEvent.put(std::move(strip), Prefix + "strip");
101  iEvent.put(std::move(localtheta), Prefix + "localtheta");
102  iEvent.put(std::move(localphi), Prefix + "localphi");
103  iEvent.put(std::move(localx), Prefix + "localx");
104  iEvent.put(std::move(localy), Prefix + "localy");
105  iEvent.put(std::move(localz), Prefix + "localz");
106  iEvent.put(std::move(momentum), Prefix + "momentum");
107  iEvent.put(std::move(energyloss), Prefix + "energyloss");
108  iEvent.put(std::move(time), Prefix + "time");
109  iEvent.put(std::move(particle), Prefix + "particle");
110  iEvent.put(std::move(process), Prefix + "process");
111 }

References bsc_activity_cfg::clusters, clusters_token_, shallow::drift(), edm::EventSetup::get(), get, hfClusterShapes_cfi::hits, mps_fire::i, iEvent, volumeBasedMagneticField_160812_cfi::magfield, shallow::make_cluster_map(), match_cluster(), eostools::move(), Prefix, LaserDQM_cfg::process, runningmode_, HLTBitAnalyser_cfi::simhits, simhits_tokens_, findQualityFiles::size, StripGeomDetUnit::specificTopology(), digitizers_cfi::strip, StripTopology::strip(), ntuplemaker::time, hit::x, hit::y, and hit::z.

Member Data Documentation

◆ clusters_token_

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

Definition at line 19 of file ShallowSimhitClustersProducer.h.

Referenced by produce().

◆ Prefix

std::string ShallowSimhitClustersProducer::Prefix
private

Definition at line 20 of file ShallowSimhitClustersProducer.h.

Referenced by produce(), and ShallowSimhitClustersProducer().

◆ runningmode_

std::string ShallowSimhitClustersProducer::runningmode_
private

Definition at line 21 of file ShallowSimhitClustersProducer.h.

Referenced by produce().

◆ simhits_tokens_

std::vector<edm::EDGetTokenT<std::vector<PSimHit> > > ShallowSimhitClustersProducer::simhits_tokens_
private

Definition at line 18 of file ShallowSimhitClustersProducer.h.

Referenced by produce(), and ShallowSimhitClustersProducer().

Vector3DBase< float, LocalTag >
mps_fire.i
i
Definition: mps_fire.py:355
ShallowSimhitClustersProducer::simhits_tokens_
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simhits_tokens_
Definition: ShallowSimhitClustersProducer.h:18
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
hit::y
double y
Definition: SiStripHitEffFromCalibTree.cc:90
ShallowSimhitClustersProducer::runningmode_
std::string runningmode_
Definition: ShallowSimhitClustersProducer.h:21
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
ShallowSimhitClustersProducer::match_cluster
shallow::CLUSTERMAP::const_iterator match_cluster(const unsigned &, const float &, const shallow::CLUSTERMAP &, const edmNew::DetSetVector< SiStripCluster > &) const
Definition: ShallowSimhitClustersProducer.cc:113
edmNew::DetSetVector::const_iterator
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetSetVectorNew.h:231
edmNew::DetSetVector::begin
const_iterator begin(bool update=false) const
Definition: DetSetVectorNew.h:572
edm::Handle
Definition: AssociativeIterator.h:50
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
shallow::drift
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:36
SiStripLorentzAngle
Definition: SiStripLorentzAngle.h:26
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
edm::ESHandle< TrackerGeometry >
StripTopology::strip
virtual float strip(const LocalPoint &) const =0
hit::z
double z
Definition: SiStripHitEffFromCalibTree.cc:91
ShallowSimhitClustersProducer::clusters_token_
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
Definition: ShallowSimhitClustersProducer.h:19
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
HLTBitAnalyser_cfi.simhits
simhits
SIM objects.
Definition: HLTBitAnalyser_cfi.py:21
LaserDQM_cfg.process
process
Definition: LaserDQM_cfg.py:3
iEvent
int iEvent
Definition: GenABIO.cc:224
SiStripLorentzAngleRcd
Definition: SiStripCondDataRecords.h:25
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
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
ShallowSimhitClustersProducer::Prefix
std::string Prefix
Definition: ShallowSimhitClustersProducer.h:20
edmNew::DetSetVector::end
const_iterator end(bool update=false) const
Definition: DetSetVectorNew.h:577
StripGeomDetUnit::specificTopology
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
Definition: StripGeomDetUnit.cc:17
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
ntuplemaker.time
time
Definition: ntuplemaker.py:310
volumeBasedMagneticField_160812_cfi.magfield
magfield
Definition: volumeBasedMagneticField_160812_cfi.py:11
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
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
StripGeomDetUnit
Definition: StripGeomDetUnit.h:15
edmNew::DetSet::const_iterator
const data_type * const_iterator
Definition: DetSetNew.h:31