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 Attributes
ReduceHcalRecHitCollectionProducer Class Reference
Inheritance diagram for ReduceHcalRecHitCollectionProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ReduceHcalRecHitCollectionProducer (const edm::ParameterSet &)
 
 ~ReduceHcalRecHitCollectionProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

edm::InputTag inputCollection_
 
TrackAssociatorParameters parameters_
 
double ptcut_
 
edm::InputTag recHitsLabel_
 
std::string reducedHitsCollection_
 
TrackDetectorAssociator trackAssociator_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 66 of file ReduceHcalRecHitCollectionProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 93 of file ReduceHcalRecHitCollectionProducer.cc.

References edm::ParameterSet::getParameter(), inputCollection_, TrackAssociatorParameters::loadParameters(), Parameters::parameters, parameters_, ptcut_, recHitsLabel_, reducedHitsCollection_, trackAssociator_, and TrackDetectorAssociator::useDefaultPropagator().

94 {
95  recHitsLabel_ = iConfig.getParameter< edm::InputTag > ("recHitsLabel");
96 
97  reducedHitsCollection_ = iConfig.getParameter<std::string>("reducedHitsCollection");
98 
99  //register your products
100  produces< HBHERecHitCollection > (reducedHitsCollection_) ;
101 
102  inputCollection_ = iConfig.getParameter< edm::InputTag >("inputCollection"); ptcut_= iConfig.getParameter< double >("TrackPt");
103 
104  produces< DetIdCollection >() ;
105  // TrackAssociator parameters
106  edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
107  parameters_.loadParameters( parameters );
109 
110 }
T getParameter(std::string const &) const
dictionary parameters
Definition: Parameters.py:2
void useDefaultPropagator()
use the default propagator
void loadParameters(const edm::ParameterSet &)
ReduceHcalRecHitCollectionProducer::~ReduceHcalRecHitCollectionProducer ( )

Definition at line 113 of file ReduceHcalRecHitCollectionProducer.cc.

114 {
115 
116  // do anything here that needs to be done at desctruction time
117  // (e.g. close files, deallocate resources etc.)
118 
119 }

Member Function Documentation

void ReduceHcalRecHitCollectionProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 128 of file ReduceHcalRecHitCollectionProducer.cc.

References TrackDetectorAssociator::associate(), TrackDetMatchInfo::crossedHcalIds, edm::Event::getByLabel(), TrackDetMatchInfo::hcalRecHits, info, inputCollection_, TrackDetectorAssociator::InsideOut, parameters_, ptcut_, edm::Event::put(), recHitsLabel_, reducedHitsCollection_, and trackAssociator_.

129 {
130  using namespace edm;
131 
132  using namespace std;
133 
134  using reco::TrackCollection;
135 
136  Handle<HBHERecHitCollection> recHitsHandle;
137  iEvent.getByLabel(recHitsLabel_,recHitsHandle);
138  if( !recHitsHandle.isValid() )
139  {
140  edm::LogError("ReduceHcalRecHitCollectionProducer") << "RecHit collection not found";
141  return;
142  }
143 
144  //Create empty output collections
145  std::auto_ptr< HBHERecHitCollection > miniRecHitCollection (new HBHERecHitCollection) ;
146 
147 //loop through tracks.
148  Handle<TrackCollection> tkTracks;
149  iEvent.getByLabel(inputCollection_,tkTracks);
150  std::auto_ptr< DetIdCollection > interestingDetIdCollection( new DetIdCollection() ) ;
151  for(TrackCollection::const_iterator itTrack = tkTracks->begin();
152  itTrack != tkTracks->end();
153  ++itTrack) {
154  if(itTrack->pt()>ptcut_){
155 
157 
158  if(info.crossedHcalIds.size()>0){
159  //loop through hits in the cone
160  for(std::vector<const HBHERecHit*>::const_iterator hit = info.hcalRecHits.begin();
161  hit != info.hcalRecHits.end(); ++hit)
162  {
163  DetId hitid=(*hit)->id();
164  HBHERecHitCollection::const_iterator iRecHit = recHitsHandle->find(hitid);
165  if ( (iRecHit != recHitsHandle->end()) && (miniRecHitCollection->find(hitid) == miniRecHitCollection->end()) )
166  miniRecHitCollection->push_back(*iRecHit);
167  }
168 
169 
170  }
171  }
172  }
173 
174  iEvent.put( miniRecHitCollection,reducedHitsCollection_ );
175 
176 
177 
178 }
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
std::vector< T >::const_iterator const_iterator
std::vector< DetId > crossedHcalIds
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
std::vector< const HBHERecHit * > hcalRecHits
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
Definition: DetId.h:20
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
edm::EDCollection< DetId > DetIdCollection

Member Data Documentation

edm::InputTag ReduceHcalRecHitCollectionProducer::inputCollection_
private
TrackAssociatorParameters ReduceHcalRecHitCollectionProducer::parameters_
private
double ReduceHcalRecHitCollectionProducer::ptcut_
private
edm::InputTag ReduceHcalRecHitCollectionProducer::recHitsLabel_
private
std::string ReduceHcalRecHitCollectionProducer::reducedHitsCollection_
private
TrackDetectorAssociator ReduceHcalRecHitCollectionProducer::trackAssociator_
private