#include <ShallowSimhitClustersProducer.h>
Public Member Functions | |
ShallowSimhitClustersProducer (const edm::ParameterSet &) | |
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 | |
std::vector< edm::InputTag > | inputTags |
std::string | Prefix |
edm::InputTag | theClustersLabel |
Definition at line 10 of file ShallowSimhitClustersProducer.h.
ShallowSimhitClustersProducer::ShallowSimhitClustersProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 20 of file ShallowSimhitClustersProducer.cc.
References Prefix.
: inputTags( iConfig.getParameter<std::vector<edm::InputTag> >("InputTags") ), theClustersLabel( iConfig.getParameter<edm::InputTag>("Clusters")), Prefix( iConfig.getParameter<std::string>("Prefix") ) { produces <std::vector<unsigned> > ( Prefix + "hits" ); produces <std::vector<float> > ( Prefix + "strip" ); produces <std::vector<float> > ( Prefix + "localtheta" ); produces <std::vector<float> > ( Prefix + "localphi" ); produces <std::vector<float> > ( Prefix + "localx" ); produces <std::vector<float> > ( Prefix + "localy" ); produces <std::vector<float> > ( Prefix + "localz" ); produces <std::vector<float> > ( Prefix + "momentum" ); produces <std::vector<float> > ( Prefix + "energyloss" ); produces <std::vector<float> > ( Prefix + "time" ); produces <std::vector<int> > ( Prefix + "particle" ); produces <std::vector<unsigned short> > ( Prefix + "process" ); }
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 108 of file ShallowSimhitClustersProducer.cc.
References edmNew::DetSetVector< T >::begin(), edmNew::DetSetVector< T >::end(), and edmNew::DetSetVector< T >::find().
Referenced by produce().
{ shallow::CLUSTERMAP::const_iterator cluster = clustermap.end(); edmNew::DetSetVector<SiStripCluster>::const_iterator clustersDetSet = clusters.find(id); if( clustersDetSet != clusters.end() ) { edmNew::DetSet<SiStripCluster>::const_iterator left, right=clustersDetSet->begin(); while( right != clustersDetSet->end() && strip_ > right->barycenter() ) right++; left = right-1; if(right!=clustersDetSet->end() && right!=clustersDetSet->begin()) { unsigned firstStrip = (right->barycenter()-strip_) < (strip_-left->barycenter()) ? right->firstStrip() : left->firstStrip(); cluster = clustermap.find( std::make_pair( id, firstStrip)); } else if(right != clustersDetSet->begin()) cluster = clustermap.find( std::make_pair( id, left->firstStrip())); else cluster = clustermap.find( std::make_pair( id, right->firstStrip())); } return cluster; }
void ShallowSimhitClustersProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 40 of file ShallowSimhitClustersProducer.cc.
References PSimHit::detUnitId(), shallow::drift(), PSimHit::energyLoss(), edm::EventSetup::get(), edm::Event::getByLabel(), i, inputTags, PSimHit::localPosition(), autoMagneticFieldProducer_cfi::magfield, shallow::make_cluster_map(), match_cluster(), PSimHit::pabs(), PSimHit::particleType(), PSimHit::phiAtEntry(), Prefix, align_tpl::process, PSimHit::processType(), edm::Event::put(), redigi_cff::SiStripLorentzAngle, findQualityFiles::size, StripGeomDetUnit::specificTopology(), strip(), StripTopology::strip(), theClustersLabel, PSimHit::thetaAtEntry(), cond::rpcobgas::time, PSimHit::timeOfFlight(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
{ shallow::CLUSTERMAP clustermap = shallow::make_cluster_map(iEvent,theClustersLabel); int size = clustermap.size(); std::auto_ptr<std::vector<unsigned> > hits ( new std::vector<unsigned> (size, 0) ); std::auto_ptr<std::vector<float> > strip ( new std::vector<float> (size, -100) ); std::auto_ptr<std::vector<float> > localtheta ( new std::vector<float> (size, -100) ); std::auto_ptr<std::vector<float> > localphi ( new std::vector<float> (size, -100) ); std::auto_ptr<std::vector<float> > localx ( new std::vector<float> (size, -100) ); std::auto_ptr<std::vector<float> > localy ( new std::vector<float> (size, -100) ); std::auto_ptr<std::vector<float> > localz ( new std::vector<float> (size, -100) ); std::auto_ptr<std::vector<float> > momentum ( new std::vector<float> (size, 0) ); std::auto_ptr<std::vector<float> > energyloss ( new std::vector<float> (size, -1) ); std::auto_ptr<std::vector<float> > time ( new std::vector<float> (size, -1) ); std::auto_ptr<std::vector<int> > particle ( new std::vector<int> (size,-500) ); std::auto_ptr<std::vector<unsigned short> > process ( new std::vector<unsigned short> (size,0) ); edm::ESHandle<TrackerGeometry> theTrackerGeometry; iSetup.get<TrackerDigiGeometryRecord>().get( theTrackerGeometry ); edm::ESHandle<MagneticField> magfield; iSetup.get<IdealMagneticFieldRecord>().get(magfield); edm::ESHandle<SiStripLorentzAngle> SiStripLorentzAngle; iSetup.get<SiStripLorentzAngleRcd>().get(SiStripLorentzAngle); edm::Handle<edmNew::DetSetVector<SiStripCluster> > clusters; iEvent.getByLabel("siStripClusters", "", clusters); BOOST_FOREACH( const edm::InputTag inputTag, inputTags ) { edm::Handle<std::vector<PSimHit> > simhits; iEvent.getByLabel(inputTag, simhits); BOOST_FOREACH( const PSimHit hit, *simhits ) { const uint32_t id = hit.detUnitId(); const StripGeomDetUnit* theStripDet = dynamic_cast<const StripGeomDetUnit*>( theTrackerGeometry->idToDet( id ) ); const LocalVector drift = shallow::drift(theStripDet, *magfield, *SiStripLorentzAngle); const float driftedstrip_ = theStripDet->specificTopology().strip( hit.localPosition()+0.5*drift ); const float hitstrip_ = theStripDet->specificTopology().strip( hit.localPosition() ); shallow::CLUSTERMAP::const_iterator cluster = match_cluster( id, driftedstrip_, clustermap, *clusters); if(cluster != clustermap.end()) { unsigned i = cluster->second; hits->at(i)+=1; if(hits->at(i) == 1) { strip->at(i) = hitstrip_; localtheta->at(i) = hit.thetaAtEntry(); localphi->at(i) = hit.phiAtEntry(); localx->at(i) = hit.localPosition().x(); localy->at(i) = hit.localPosition().y(); localz->at(i) = hit.localPosition().z(); momentum->at(i) = hit.pabs(); energyloss->at(i) = hit.energyLoss(); time->at(i) = hit.timeOfFlight(); particle->at(i) = hit.particleType(); process->at(i) = hit.processType(); } } } } iEvent.put( hits, Prefix + "hits" ); iEvent.put( strip, Prefix + "strip" ); iEvent.put( localtheta, Prefix + "localtheta" ); iEvent.put( localphi, Prefix + "localphi" ); iEvent.put( localx, Prefix + "localx" ); iEvent.put( localy, Prefix + "localy" ); iEvent.put( localz, Prefix + "localz" ); iEvent.put( momentum, Prefix + "momentum" ); iEvent.put( energyloss, Prefix + "energyloss" ); iEvent.put( time, Prefix + "time" ); iEvent.put( particle, Prefix + "particle" ); iEvent.put( process, Prefix + "process" ); }
std::vector<edm::InputTag> ShallowSimhitClustersProducer::inputTags [private] |
Definition at line 14 of file ShallowSimhitClustersProducer.h.
Referenced by produce().
std::string ShallowSimhitClustersProducer::Prefix [private] |
Definition at line 16 of file ShallowSimhitClustersProducer.h.
Referenced by produce(), and ShallowSimhitClustersProducer().
Definition at line 15 of file ShallowSimhitClustersProducer.h.
Referenced by produce().