Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate modules used by the HLT menu to multithreading (Reco) (75x) #10966

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 19 additions & 33 deletions RecoLocalCalo/EcalRecProducers/plugins/EcalRecalibRecHitProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,26 @@



EcalRecalibRecHitProducer::EcalRecalibRecHitProducer(const edm::ParameterSet& ps) {

EBRecHitCollection_ = ps.getParameter<edm::InputTag>("EBRecHitCollection");
EERecHitCollection_ = ps.getParameter<edm::InputTag>("EERecHitCollection");
EBRecHitToken_ = consumes<EBRecHitCollection>(EBRecHitCollection_);
EERecHitToken_ = consumes<EBRecHitCollection>(EERecHitCollection_);
EBRecalibRecHitCollection_ = ps.getParameter<std::string>("EBRecalibRecHitCollection");
EERecalibRecHitCollection_ = ps.getParameter<std::string>("EERecalibRecHitCollection");
doEnergyScale_ = ps.getParameter<bool>("doEnergyScale");
doIntercalib_ = ps.getParameter<bool>("doIntercalib");
doLaserCorrections_ = ps.getParameter<bool>("doLaserCorrections");

doEnergyScaleInverse_ = ps.getParameter<bool>("doEnergyScaleInverse");
doIntercalibInverse_ = ps.getParameter<bool>("doIntercalibInverse");
doLaserCorrectionsInverse_ = ps.getParameter<bool>("doLaserCorrectionsInverse");

EBalgo_ = new EcalRecHitSimpleAlgo();
EEalgo_ = new EcalRecHitSimpleAlgo();

EcalRecalibRecHitProducer::EcalRecalibRecHitProducer(const edm::ParameterSet& ps) :
EBRecHitCollection_( ps.getParameter<edm::InputTag>("EBRecHitCollection") ),
EERecHitCollection_( ps.getParameter<edm::InputTag>("EERecHitCollection") ),
EBRecHitToken_( (not EBRecHitCollection_.label().empty()) ? consumes<EBRecHitCollection>(EBRecHitCollection_) : edm::EDGetTokenT<EBRecHitCollection>() ),
EERecHitToken_( (not EERecHitCollection_.label().empty()) ? consumes<EERecHitCollection>(EERecHitCollection_) : edm::EDGetTokenT<EERecHitCollection>() ),
EBRecalibRecHitCollection_( ps.getParameter<std::string>("EBRecalibRecHitCollection") ),
EERecalibRecHitCollection_( ps.getParameter<std::string>("EERecalibRecHitCollection") ),
doEnergyScale_( ps.getParameter<bool>("doEnergyScale") ),
doIntercalib_( ps.getParameter<bool>("doIntercalib") ),
doLaserCorrections_( ps.getParameter<bool>("doLaserCorrections") ),

doEnergyScaleInverse_( ps.getParameter<bool>("doEnergyScaleInverse") ),
doIntercalibInverse_( ps.getParameter<bool>("doIntercalibInverse") ),
doLaserCorrectionsInverse_( ps.getParameter<bool>("doLaserCorrectionsInverse") )
{
produces< EBRecHitCollection >(EBRecalibRecHitCollection_);
produces< EERecHitCollection >(EERecalibRecHitCollection_);
}

EcalRecalibRecHitProducer::~EcalRecalibRecHitProducer() {

if (EBalgo_) delete EBalgo_;
if (EEalgo_) delete EEalgo_;

}

void EcalRecalibRecHitProducer::produce(edm::Event& evt, const edm::EventSetup& es)
void EcalRecalibRecHitProducer::produce(edm::StreamID sid, edm::Event& evt, const edm::EventSetup& es) const
{
using namespace edm;
Handle< EBRecHitCollection > pEBRecHits;
Expand All @@ -70,11 +59,11 @@ void EcalRecalibRecHitProducer::produce(edm::Event& evt, const edm::EventSetup&
const EBRecHitCollection* EBRecHits = 0;
const EERecHitCollection* EERecHits = 0;

if ( EBRecHitCollection_.label() != "" ) {
if (not EBRecHitCollection_.label().empty()) {
evt.getByToken( EBRecHitToken_, pEBRecHits);
EBRecHits = pEBRecHits.product(); // get a ptr to the product
}
if ( EERecHitCollection_.label() != "" ) {
if (not EERecHitCollection_.label().empty()) {
evt.getByToken( EERecHitToken_, pEERecHits);
EERecHits = pEERecHits.product(); // get a ptr to the product
}
Expand Down Expand Up @@ -174,17 +163,14 @@ void EcalRecalibRecHitProducer::produce(edm::Event& evt, const edm::EventSetup&
lasercalib = pLaser->getLaserCorrection( EEDetId(it->id()), evt.time() );
}

// make the rechit and put in the output collection
// must implement op= for EcalRecHit
//EcalRecHit aHit( EEalgo_->makeRecHit(*it, icalconst * lasercalib) );

if(doIntercalibInverse_){
icalconst = 1.0/icalconst;
}
if (doLaserCorrectionsInverse_){
lasercalib = 1.0/lasercalib;
}

// make the rechit and put in the output collection
EcalRecHit aHit( (*it).id(), (*it).energy() * agc_ee * icalconst * lasercalib, (*it).time() );
EERecalibRecHits->push_back( aHit );
}
Expand Down
37 changes: 16 additions & 21 deletions RecoLocalCalo/EcalRecProducers/plugins/EcalRecalibRecHitProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
**/

#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
Expand All @@ -17,31 +17,26 @@



class EcalRecalibRecHitProducer : public edm::EDProducer {
class EcalRecalibRecHitProducer : public edm::global::EDProducer<> {

public:
explicit EcalRecalibRecHitProducer(const edm::ParameterSet& ps);
~EcalRecalibRecHitProducer();
virtual void produce(edm::Event& evt, const edm::EventSetup& es);
virtual void produce(edm::StreamID sid, edm::Event& evt, const edm::EventSetup& es) const override;

private:

edm::InputTag EBRecHitCollection_;
edm::InputTag EERecHitCollection_;
edm::EDGetTokenT<EBRecHitCollection> EBRecHitToken_;
edm::EDGetTokenT<EERecHitCollection> EERecHitToken_;
const edm::InputTag EBRecHitCollection_;
const edm::InputTag EERecHitCollection_;
const edm::EDGetTokenT<EBRecHitCollection> EBRecHitToken_;
const edm::EDGetTokenT<EERecHitCollection> EERecHitToken_;

std::string EBRecalibRecHitCollection_; // secondary name to be given to EB collection of hits
std::string EERecalibRecHitCollection_; // secondary name to be given to EE collection of hits

bool doEnergyScale_;
bool doIntercalib_;
bool doLaserCorrections_;
bool doEnergyScaleInverse_;
bool doIntercalibInverse_;
bool doLaserCorrectionsInverse_;

EcalRecHitAbsAlgo* EBalgo_;
EcalRecHitAbsAlgo* EEalgo_;
const std::string EBRecalibRecHitCollection_; // secondary name to be given to EB collection of hits
const std::string EERecalibRecHitCollection_; // secondary name to be given to EE collection of hits

const bool doEnergyScale_;
const bool doIntercalib_;
const bool doLaserCorrections_;
const bool doEnergyScaleInverse_;
const bool doIntercalibInverse_;
const bool doLaserCorrectionsInverse_;
};
#endif