Skip to content

Commit

Permalink
Merge pull request #3028 from perrotta/fastsimConsumesForHLT
Browse files Browse the repository at this point in the history
Consumes migration -- Declare consumes in HLT related packages in FastSimulation
  • Loading branch information
ktf committed Mar 26, 2014
2 parents bc0ec7a + 6aee529 commit 2d4a980
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
9 changes: 9 additions & 0 deletions FastSimulation/CaloRecHitsProducer/interface/CaloRecHitCopy.h
Expand Up @@ -7,6 +7,9 @@
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"

#include <vector>
#include <string>

Expand All @@ -29,6 +32,12 @@ class CaloRecHitCopy : public edm::EDProducer
std::vector<std::string> theOutputRecHitCollections;
std::vector<unsigned int> theInputRecHitCollectionTypes;
std::vector<bool> theOutputRecHitInstances;
edm::EDGetTokenT<ESRecHitCollection> theESRecHitCollectionToken;
edm::EDGetTokenT<EBRecHitCollection> theEBRecHitCollectionToken;
edm::EDGetTokenT<EERecHitCollection> theEERecHitCollectionToken;
edm::EDGetTokenT<HBHERecHitCollection> theHBHERecHitCollectionToken;
edm::EDGetTokenT<HORecHitCollection> theHORecHitCollectionToken;
edm::EDGetTokenT<HFRecHitCollection> theHFRecHitCollectionToken;

};

Expand Down
20 changes: 12 additions & 8 deletions FastSimulation/CaloRecHitsProducer/src/CaloRecHitCopy.cc
Expand Up @@ -2,8 +2,6 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"

#include "FastSimulation/CaloRecHitsProducer/interface/CaloRecHitCopy.h"

Expand All @@ -30,6 +28,7 @@ CaloRecHitCopy::CaloRecHitCopy(edm::ParameterSet const & p)
case 1:
{
//Preshower
theESRecHitCollectionToken = consumes<ESRecHitCollection>(theInputRecHitCollections[input]);
if ( !theOutputRecHitInstances[input] )
produces<ESRecHitCollection>();
else
Expand All @@ -40,6 +39,7 @@ CaloRecHitCopy::CaloRecHitCopy(edm::ParameterSet const & p)
case 2:
{
//Ecal Barrel
theEBRecHitCollectionToken = consumes<EBRecHitCollection>(theInputRecHitCollections[input]);
if ( !theOutputRecHitInstances[input] )
produces<EBRecHitCollection>();
else
Expand All @@ -50,6 +50,7 @@ CaloRecHitCopy::CaloRecHitCopy(edm::ParameterSet const & p)
case 3:
{
//EcalEndcap
theEERecHitCollectionToken = consumes<EERecHitCollection>(theInputRecHitCollections[input]);
if ( !theOutputRecHitInstances[input] )
produces<EERecHitCollection>();
else
Expand All @@ -60,6 +61,7 @@ CaloRecHitCopy::CaloRecHitCopy(edm::ParameterSet const & p)
case 4:
{
//HCAL
theHBHERecHitCollectionToken = consumes<HBHERecHitCollection>(theInputRecHitCollections[input]);
if ( !theOutputRecHitInstances[input] )
produces<HBHERecHitCollection>();
else
Expand All @@ -70,6 +72,7 @@ CaloRecHitCopy::CaloRecHitCopy(edm::ParameterSet const & p)
case 5:
{
//HO
theHORecHitCollectionToken = consumes<HORecHitCollection>(theInputRecHitCollections[input]);
if ( !theOutputRecHitInstances[input] )
produces<HORecHitCollection>();
else
Expand All @@ -80,6 +83,7 @@ CaloRecHitCopy::CaloRecHitCopy(edm::ParameterSet const & p)
case 6:
{
//HF
theHFRecHitCollectionToken = consumes<HFRecHitCollection>(theInputRecHitCollections[input]);
if ( !theOutputRecHitInstances[input] )
produces<HFRecHitCollection>();
else
Expand Down Expand Up @@ -114,7 +118,7 @@ CaloRecHitCopy::produce(edm::Event & iEvent, const edm::EventSetup & es)
//Preshower
std::auto_ptr< ESRecHitCollection > copiedESRecHitCollection( new ESRecHitCollection );
edm::Handle<ESRecHitCollection> ESRecHits;
iEvent.getByLabel(theInputRecHitCollections[input],ESRecHits);
iEvent.getByToken(theESRecHitCollectionToken,ESRecHits);
ESRecHitCollection::const_iterator itES = ESRecHits->begin();
ESRecHitCollection::const_iterator lastES = ESRecHits->end();
// saves a bit of CPU
Expand All @@ -135,7 +139,7 @@ CaloRecHitCopy::produce(edm::Event & iEvent, const edm::EventSetup & es)
//Ecal Barrel
std::auto_ptr< EBRecHitCollection > copiedEBRecHitCollection( new EBRecHitCollection );
edm::Handle<EBRecHitCollection> EBRecHits;
iEvent.getByLabel(theInputRecHitCollections[input],EBRecHits);
iEvent.getByToken(theEBRecHitCollectionToken,EBRecHits);
EBRecHitCollection::const_iterator itEB = EBRecHits->begin();
EBRecHitCollection::const_iterator lastEB = EBRecHits->end();
//saves a bit of CPU
Expand All @@ -157,7 +161,7 @@ CaloRecHitCopy::produce(edm::Event & iEvent, const edm::EventSetup & es)
//EcalEndcap
std::auto_ptr< EERecHitCollection > copiedEERecHitCollection( new EERecHitCollection );
edm::Handle<EERecHitCollection> EERecHits;
iEvent.getByLabel(theInputRecHitCollections[input],EERecHits);
iEvent.getByToken(theEERecHitCollectionToken,EERecHits);
EERecHitCollection::const_iterator itEE = EERecHits->begin();
EERecHitCollection::const_iterator lastEE = EERecHits->end();
//saves a bit of CPU
Expand All @@ -179,7 +183,7 @@ CaloRecHitCopy::produce(edm::Event & iEvent, const edm::EventSetup & es)
//HCAL
std::auto_ptr< HBHERecHitCollection > copiedHBHERecHitCollection( new HBHERecHitCollection );
edm::Handle<HBHERecHitCollection> HBHERecHits;
iEvent.getByLabel(theInputRecHitCollections[input],HBHERecHits);
iEvent.getByToken(theHBHERecHitCollectionToken,HBHERecHits);
HBHERecHitCollection::const_iterator itHBHE = HBHERecHits->begin();
HBHERecHitCollection::const_iterator lastHBHE = HBHERecHits->end();
//saves a bit of CPU
Expand All @@ -201,7 +205,7 @@ CaloRecHitCopy::produce(edm::Event & iEvent, const edm::EventSetup & es)
//HO
std::auto_ptr< HORecHitCollection > copiedHORecHitCollection( new HORecHitCollection );
edm::Handle<HORecHitCollection> HORecHits;
iEvent.getByLabel(theInputRecHitCollections[input],HORecHits);
iEvent.getByToken(theHORecHitCollectionToken,HORecHits);
HORecHitCollection::const_iterator itHO = HORecHits->begin();
HORecHitCollection::const_iterator lastHO = HORecHits->end();
//saves a bit of CPU
Expand All @@ -223,7 +227,7 @@ CaloRecHitCopy::produce(edm::Event & iEvent, const edm::EventSetup & es)
//HF
std::auto_ptr< HFRecHitCollection > copiedHFRecHitCollection( new HFRecHitCollection );
edm::Handle<HFRecHitCollection> HFRecHits;
iEvent.getByLabel(theInputRecHitCollections[input],HFRecHits);
iEvent.getByToken(theHFRecHitCollectionToken,HFRecHits);
HFRecHitCollection::const_iterator itHF = HFRecHits->begin();
HFRecHitCollection::const_iterator lastHF = HFRecHits->end();
//saves a bit of CPU
Expand Down
4 changes: 2 additions & 2 deletions FastSimulation/Tracking/plugins/PixelTracksProducer.cc
Expand Up @@ -8,7 +8,6 @@
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Common/interface/OwnVector.h"

#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
#include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"

//Pixel Specific stuff
Expand Down Expand Up @@ -57,6 +56,7 @@ PixelTracksProducer::PixelTracksProducer(const edm::ParameterSet& conf) :

// The name of the seed producer
seedProducer = conf.getParameter<edm::InputTag>("SeedProducer");
seedProducerToken = consumes<TrajectorySeedCollection>(seedProducer);

}

Expand Down Expand Up @@ -84,7 +84,7 @@ PixelTracksProducer::produce(edm::Event& e, const edm::EventSetup& es) {
TracksWithRecHits cleanedTracks;

edm::Handle<TrajectorySeedCollection> theSeeds;
e.getByLabel(seedProducer,theSeeds);
e.getByToken(seedProducerToken,theSeeds);

// No seed -> output an empty track collection
if(theSeeds->size() == 0) {
Expand Down
3 changes: 3 additions & 0 deletions FastSimulation/Tracking/plugins/PixelTracksProducer.h
Expand Up @@ -4,6 +4,8 @@
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"

#include <string>

class PixelFitter;
Expand Down Expand Up @@ -33,6 +35,7 @@ class PixelTracksProducer : public edm::EDProducer {
TrackingRegionProducer* theRegionProducer;

edm::InputTag seedProducer;
edm::EDGetTokenT<TrajectorySeedCollection> seedProducerToken;

};
#endif
Expand Down

0 comments on commit 2d4a980

Please sign in to comment.