CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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 &)
 

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
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 12 of file ShallowSimhitClustersProducer.h.

Constructor & Destructor Documentation

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

Definition at line 19 of file ShallowSimhitClustersProducer.cc.

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

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

Member Function Documentation

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 116 of file ShallowSimhitClustersProducer.cc.

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

Referenced by produce().

116  {
117  shallow::CLUSTERMAP::const_iterator cluster = clustermap.end();
118  edmNew::DetSetVector<SiStripCluster>::const_iterator clustersDetSet = clusters.find(id);
119  if( clustersDetSet != clusters.end() ) {
120  edmNew::DetSet<SiStripCluster>::const_iterator left, right=clustersDetSet->begin();
121  while( right != clustersDetSet->end() && strip_ > right->barycenter() )
122  right++;
123  left = right-1;
124  if(right!=clustersDetSet->end() && right!=clustersDetSet->begin()) {
125  unsigned firstStrip = (right->barycenter()-strip_) < (strip_-left->barycenter()) ? right->firstStrip() : left->firstStrip();
126  cluster = clustermap.find( std::make_pair( id, firstStrip));
127  }
128  else if(right != clustersDetSet->begin())
129  cluster = clustermap.find( std::make_pair( id, left->firstStrip()));
130  else
131  cluster = clustermap.find( std::make_pair( id, right->firstStrip()));
132  }
133  return cluster;
134 }
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
data_type const * const_iterator
Definition: DetSetNew.h:30
const_iterator find(id_type i, bool update=false) const
const_iterator begin(bool update=false) const
void ShallowSimhitClustersProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 46 of file ShallowSimhitClustersProducer.cc.

References HLT_25ns10e33_v2_cff::clusters, clusters_token_, PSimHit::detUnitId(), shallow::drift(), PSimHit::energyLoss(), edm::EventSetup::get(), edm::Event::getByLabel(), edm::Event::getByToken(), i, PSimHit::localPosition(), HLT_ES_cff::magfield, shallow::make_cluster_map(), match_cluster(), PSimHit::pabs(), PSimHit::particleType(), PSimHit::phiAtEntry(), Prefix, LaserDQM_cfg::process, PSimHit::processType(), edm::Event::put(), runningmode_, simhits_tokens_, redigi_cff::SiStripLorentzAngle, findQualityFiles::size, StripGeomDetUnit::specificTopology(), StripTopology::strip(), PSimHit::thetaAtEntry(), PSimHit::timeOfFlight(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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

46  {
48 
49  int size = clustermap.size();
50  std::auto_ptr<std::vector<unsigned> > hits ( new std::vector<unsigned> (size, 0) );
51  std::auto_ptr<std::vector<float> > strip ( new std::vector<float> (size, -100) );
52  std::auto_ptr<std::vector<float> > localtheta ( new std::vector<float> (size, -100) );
53  std::auto_ptr<std::vector<float> > localphi ( new std::vector<float> (size, -100) );
54  std::auto_ptr<std::vector<float> > localx ( new std::vector<float> (size, -100) );
55  std::auto_ptr<std::vector<float> > localy ( new std::vector<float> (size, -100) );
56  std::auto_ptr<std::vector<float> > localz ( new std::vector<float> (size, -100) );
57  std::auto_ptr<std::vector<float> > momentum ( new std::vector<float> (size, 0) );
58  std::auto_ptr<std::vector<float> > energyloss ( new std::vector<float> (size, -1) );
59  std::auto_ptr<std::vector<float> > time ( new std::vector<float> (size, -1) );
60  std::auto_ptr<std::vector<int> > particle ( new std::vector<int> (size,-500) );
61  std::auto_ptr<std::vector<unsigned short> > process ( new std::vector<unsigned short> (size,0) );
62 
63  edm::ESHandle<TrackerGeometry> theTrackerGeometry; iSetup.get<TrackerDigiGeometryRecord>().get( theTrackerGeometry );
66  edm::Handle<edmNew::DetSetVector<SiStripCluster> > clusters; iEvent.getByLabel("siStripClusters", "", clusters);
67 
68  for(auto& simhit_token : simhits_tokens_) {
70  iEvent.getByToken(simhit_token, simhits);
71  BOOST_FOREACH( const PSimHit hit, *simhits ) {
72 
73  const uint32_t id = hit.detUnitId();
74  const StripGeomDetUnit* theStripDet = dynamic_cast<const StripGeomDetUnit*>( theTrackerGeometry->idToDet( id ) );
75  const LocalVector drift = shallow::drift(theStripDet, *magfield, *SiStripLorentzAngle);
76 
77  const float driftedstrip_ = theStripDet->specificTopology().strip( hit.localPosition()+0.5*drift );
78  const float hitstrip_ = theStripDet->specificTopology().strip( hit.localPosition() );
79 
80  shallow::CLUSTERMAP::const_iterator cluster = match_cluster( id, driftedstrip_, clustermap, *clusters);
81  if(cluster != clustermap.end()) {
82  unsigned i = cluster->second;
83  hits->at(i)+=1;
84  if(hits->at(i) == 1) {
85  strip->at(i) = hitstrip_;
86  localtheta->at(i) = hit.thetaAtEntry();
87  localphi->at(i) = hit.phiAtEntry();
88  localx->at(i) = hit.localPosition().x();
89  localy->at(i) = hit.localPosition().y();
90  localz->at(i) = hit.localPosition().z();
91  momentum->at(i) = hit.pabs();
92  energyloss->at(i) = hit.energyLoss();
93  time->at(i) = hit.timeOfFlight();
94  particle->at(i) = hit.particleType();
95  process->at(i) = hit.processType();
96  }
97  }
98  }
99  }
100 
101  iEvent.put( hits, Prefix + "hits" );
102  iEvent.put( strip, Prefix + "strip" );
103  iEvent.put( localtheta, Prefix + "localtheta" );
104  iEvent.put( localphi, Prefix + "localphi" );
105  iEvent.put( localx, Prefix + "localx" );
106  iEvent.put( localy, Prefix + "localy" );
107  iEvent.put( localz, Prefix + "localz" );
108  iEvent.put( momentum, Prefix + "momentum" );
109  iEvent.put( energyloss, Prefix + "energyloss" );
110  iEvent.put( time, Prefix + "time" );
111  iEvent.put( particle, Prefix + "particle" );
112  iEvent.put( process, Prefix + "process" );
113 }
int i
Definition: DBlmapReader.cc:9
tuple SiStripLorentzAngle
Definition: redigi_cff.py:15
shallow::CLUSTERMAP::const_iterator match_cluster(const unsigned &, const float &, const shallow::CLUSTERMAP &, const edmNew::DetSetVector< SiStripCluster > &) const
Geom::Theta< float > thetaAtEntry() const
fast and more accurate access to momentumAtEntry().theta()
Definition: PSimHit.h:57
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:38
tuple magfield
Definition: HLT_ES_cff.py:2311
T y() const
Definition: PV3DBase.h:63
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
virtual float strip(const LocalPoint &) const =0
float timeOfFlight() const
Definition: PSimHit.h:69
Local3DPoint localPosition() const
Definition: PSimHit.h:44
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
T z() const
Definition: PV3DBase.h:64
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:63
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
const T & get() const
Definition: EventSetup.h:56
unsigned short processType() const
Definition: PSimHit.h:118
CLUSTERMAP make_cluster_map(const edm::Event &, const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > &)
Definition: ShallowTools.cc:14
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:75
int particleType() const
Definition: PSimHit.h:85
std::map< std::pair< uint32_t, uint16_t >, unsigned int > CLUSTERMAP
Definition: ShallowTools.h:19
Geom::Phi< float > phiAtEntry() const
fast and more accurate access to momentumAtEntry().phi()
Definition: PSimHit.h:60
tuple process
Definition: LaserDQM_cfg.py:3
T x() const
Definition: PV3DBase.h:62
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simhits_tokens_
tuple size
Write out results.
unsigned int detUnitId() const
Definition: PSimHit.h:93

Member Data Documentation

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

Definition at line 18 of file ShallowSimhitClustersProducer.h.

Referenced by produce().

std::string ShallowSimhitClustersProducer::Prefix
private

Definition at line 19 of file ShallowSimhitClustersProducer.h.

Referenced by produce(), and ShallowSimhitClustersProducer().

std::string ShallowSimhitClustersProducer::runningmode_
private

Definition at line 20 of file ShallowSimhitClustersProducer.h.

Referenced by produce().

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

Definition at line 17 of file ShallowSimhitClustersProducer.h.

Referenced by produce(), and ShallowSimhitClustersProducer().