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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ShallowRechitClustersProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
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)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, 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 ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 11 of file ShallowRechitClustersProducer.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file ShallowRechitClustersProducer.cc.

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

15  : Suffix ( iConfig.getParameter<std::string>("Suffix") ),
16  Prefix ( iConfig.getParameter<std::string>("Prefix") ),
18 {
19  std::vector<edm::InputTag> rec_hits_tags = iConfig.getParameter<std::vector<edm::InputTag> >("InputTags");
20  for(auto itag : rec_hits_tags) {
21  rec_hits_tokens_.push_back(
22  consumes< SiStripRecHit2DCollection >(itag)
23  );
24  }
25 
26  produces <std::vector<float> > ( Prefix + "strip" + Suffix );
27  produces <std::vector<float> > ( Prefix + "merr" + Suffix );
28  produces <std::vector<float> > ( Prefix + "localx" + Suffix );
29  produces <std::vector<float> > ( Prefix + "localy" + Suffix );
30  produces <std::vector<float> > ( Prefix + "localxerr" + Suffix );
31  produces <std::vector<float> > ( Prefix + "localyerr" + Suffix );
32  produces <std::vector<float> > ( Prefix + "globalx" + Suffix );
33  produces <std::vector<float> > ( Prefix + "globaly" + Suffix );
34  produces <std::vector<float> > ( Prefix + "globalz" + Suffix );
35 }
T getParameter(std::string const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
std::vector< edm::EDGetTokenT< SiStripRecHit2DCollection > > rec_hits_tokens_

Member Function Documentation

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

Definition at line 38 of file ShallowRechitClustersProducer.cc.

References SiStripRecHit2D::cluster(), clusters_token_, Exception, TrackingRecHit::geographicalId(), edm::EventSetup::get(), edm::Event::getByToken(), mps_fire::i, BaseTrackerRecHit::localPosition(), BaseTrackerRecHit::localPositionError(), shallow::make_cluster_map(), Topology::measurementError(), eostools::move(), Prefix, edm::Event::put(), DetId::rawId(), rec_hits_tokens_, findQualityFiles::size, StripGeomDetUnit::specificTopology(), mathSSE::sqrt(), digi_MixPreMix_cfi::strip, StripTopology::strip(), Suffix, GeomDet::toGlobal(), x, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), y, PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), and z.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), HTMLExport.HTMLExportStatic::export(), and ShallowRechitClustersProducer().

38  {
40 
41  int size = clustermap.size();
42  auto strip = std::make_unique <std::vector<float>>(size, -10000 );
43  auto merr = std::make_unique <std::vector<float>>(size, -10000 );
44  auto localx = std::make_unique <std::vector<float>>(size, -10000 );
45  auto localy = std::make_unique <std::vector<float>>(size, -10000 );
46  auto localxerr = std::make_unique <std::vector<float>>(size, -1 );
47  auto localyerr = std::make_unique <std::vector<float>>(size, -1 );
48  auto globalx = std::make_unique <std::vector<float>>(size, -10000 );
49  auto globaly = std::make_unique <std::vector<float>>(size, -10000 );
50  auto globalz = std::make_unique <std::vector<float>>(size, -10000 );
51 
52  edm::ESHandle<TrackerGeometry> theTrackerGeometry; iSetup.get<TrackerDigiGeometryRecord>().get( theTrackerGeometry );
53 
54  for(auto recHit_token : rec_hits_tokens_) {
56  iEvent.getByToken(recHit_token, recHits);
57  BOOST_FOREACH( const SiStripRecHit2DCollection::value_type& ds, *recHits) {
58  BOOST_FOREACH( const SiStripRecHit2D& hit, ds) {
59 
60  shallow::CLUSTERMAP::iterator cluster = clustermap.find( std::make_pair(hit.geographicalId().rawId(), hit.cluster()->firstStrip() ) );
61  if(cluster != clustermap.end() ) {
62  const StripGeomDetUnit* theStripDet = dynamic_cast<const StripGeomDetUnit*>( theTrackerGeometry->idToDet( hit.geographicalId() ) );
63  unsigned int i = cluster->second;
64  strip->at(i) = theStripDet->specificTopology().strip(hit.localPosition());
65  merr->at(i) = sqrt(theStripDet->specificTopology().measurementError(hit.localPosition(), hit.localPositionError()).uu());
66  localx->at(i) = hit.localPosition().x();
67  localy->at(i) = hit.localPosition().y();
68  localxerr->at(i) = sqrt(hit.localPositionError().xx());
69  localyerr->at(i) = sqrt(hit.localPositionError().yy());
70  globalx->at(i) = theStripDet->toGlobal(hit.localPosition()).x();
71  globaly->at(i) = theStripDet->toGlobal(hit.localPosition()).y();
72  globalz->at(i) = theStripDet->toGlobal(hit.localPosition()).z();
73  }
74  else {throw cms::Exception("cluster not found");}
75  }
76  }
77  }
78 
79  iEvent.put(std::move(strip), Prefix + "strip" + Suffix );
80  iEvent.put(std::move(merr), Prefix + "merr" + Suffix );
81  iEvent.put(std::move(localx), Prefix + "localx" + Suffix );
82  iEvent.put(std::move(localy), Prefix + "localy" + Suffix );
83  iEvent.put(std::move(localxerr), Prefix + "localxerr" + Suffix );
84  iEvent.put(std::move(localyerr), Prefix + "localyerr" + Suffix );
85  iEvent.put(std::move(globalx), Prefix + "globalx" + Suffix );
86  iEvent.put(std::move(globaly), Prefix + "globaly" + Suffix );
87  iEvent.put(std::move(globalz), Prefix + "globalz" + Suffix );
88 }
size
Write out results.
float xx() const
Definition: LocalError.h:24
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
T y() const
Definition: PV3DBase.h:63
virtual float strip(const LocalPoint &) const =0
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:18
std::vector< edm::EDGetTokenT< SiStripRecHit2DCollection > > rec_hits_tokens_
ClusterRef cluster() const
virtual LocalPoint localPosition() const final
const T & get() const
Definition: EventSetup.h:56
CLUSTERMAP make_cluster_map(const edm::Event &, const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > &)
Definition: ShallowTools.cc:14
std::map< std::pair< uint32_t, uint16_t >, unsigned int > CLUSTERMAP
Definition: ShallowTools.h:19
DetId geographicalId() const
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
virtual LocalError localPositionError() const final
T x() const
Definition: PV3DBase.h:62
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 17 of file ShallowRechitClustersProducer.h.

Referenced by produce().

std::string ShallowRechitClustersProducer::Prefix
private

Definition at line 16 of file ShallowRechitClustersProducer.h.

Referenced by produce(), and ShallowRechitClustersProducer().

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

Definition at line 18 of file ShallowRechitClustersProducer.h.

Referenced by produce(), and ShallowRechitClustersProducer().

std::string ShallowRechitClustersProducer::Suffix
private

Definition at line 15 of file ShallowRechitClustersProducer.h.

Referenced by produce(), and ShallowRechitClustersProducer().