Skip to content

Commit

Permalink
Merge pull request #33062 from Dr15Jones/esConsumesEcalTrigPrimProducer
Browse files Browse the repository at this point in the history
Add esConsumes to EcalTrigPrimProducer
  • Loading branch information
cmsbuild committed Mar 16, 2021
2 parents 824dff7 + 2d30dc6 commit 480e295
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 220 deletions.
17 changes: 4 additions & 13 deletions SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStrip.h
Expand Up @@ -8,8 +8,6 @@
#include <SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFgvbEE.h>

#include "DataFormats/EcalDetId/interface/EcalTriggerElectronicsId.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h"
#include <DataFormats/EcalDigi/interface/EBDataFrame.h>
#include <DataFormats/EcalDigi/interface/EEDataFrame.h>
Expand All @@ -30,12 +28,7 @@ class EcalTPGStripStatus;
class EcalFenixStrip {
public:
// constructor, destructor
EcalFenixStrip(const edm::EventSetup &setup,
const EcalElectronicsMapping *theMapping,
bool debug,
bool famos,
int maxNrSamples,
int nbMaxXtals);
EcalFenixStrip(const EcalElectronicsMapping *theMapping, bool debug, bool famos, int maxNrSamples, int nbMaxXtals);
virtual ~EcalFenixStrip();

private:
Expand Down Expand Up @@ -100,10 +93,8 @@ class EcalFenixStrip {

// main methods
// process method is splitted in 2 parts:
// the first one is templated, the same except input
// the first one is overloaded, the same except input
// the second part is slightly different for barrel/endcap
template <class T>
void process(const edm::EventSetup &, std::vector<const T> &, int nrxtals, std::vector<int> &out);
void process_part2_barrel(uint32_t stripid,
const EcalTPGSlidingWindow *ecaltpgSlidW,
const EcalTPGFineGrainStripEE *ecaltpgFgStripEE);
Expand All @@ -130,7 +121,7 @@ class EcalFenixStrip {

// ========================= implementations
// ==============================================================
void process(const edm::EventSetup &setup, std::vector<EBDataFrame> &samples, int nrXtals, std::vector<int> &out) {
void process(std::vector<EBDataFrame> &samples, int nrXtals, std::vector<int> &out) {
// now call processing
if (samples.empty()) {
std::cout << " Warning: 0 size vector found in EcalFenixStripProcess!!!!!" << std::endl;
Expand All @@ -155,7 +146,7 @@ class EcalFenixStrip {
out = format_out_;
}

void process(const edm::EventSetup &setup, std::vector<EEDataFrame> &samples, int nrXtals, std::vector<int> &out) {
void process(std::vector<EEDataFrame> &samples, int nrXtals, std::vector<int> &out) {
// now call processing
if (samples.empty()) {
std::cout << " Warning: 0 size vector found in EcalFenixStripProcess!!!!!" << std::endl;
Expand Down
16 changes: 3 additions & 13 deletions SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcp.h
Expand Up @@ -13,8 +13,6 @@
#include <DataFormats/EcalDigi/interface/EEDataFrame.h>
#include <DataFormats/EcalDigi/interface/EcalTriggerPrimitiveSample.h>

#include "FWCore/Framework/interface/EventSetup.h"

#include <iostream>
#include <vector>

Expand Down Expand Up @@ -71,25 +69,17 @@ class EcalFenixTcp {
}
// end temporary, for timing tests

EcalFenixTcp(const edm::EventSetup &setup,
bool tcpFormat,
bool debug,
bool famos,
int binOfMax,
int maxNrSamples,
int nbMaxStrips);
EcalFenixTcp(bool tcpFormat, bool debug, bool famos, int binOfMax, int maxNrSamples, int nbMaxStrips);
virtual ~EcalFenixTcp();

void process(const edm::EventSetup &setup,
std::vector<EBDataFrame> &bid, // dummy argument for template call
void process(std::vector<EBDataFrame> &bid, // dummy argument for template call
std::vector<std::vector<int>> &tpframetow,
int nStr,
std::vector<EcalTriggerPrimitiveSample> &tptow,
std::vector<EcalTriggerPrimitiveSample> &tptow2,
bool isInInnerRings,
EcalTrigTowerDetId thisTower);
void process(const edm::EventSetup &setup,
std::vector<EEDataFrame> &bid, // dummy argument for template call
void process(std::vector<EEDataFrame> &bid, // dummy argument for template call
std::vector<std::vector<int>> &tpframetow,
int nStr,
std::vector<EcalTriggerPrimitiveSample> &tptow,
Expand Down
Expand Up @@ -27,8 +27,6 @@
#include "DataFormats/Common/interface/SortedCollection.h"
#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"

#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include <map>
Expand All @@ -46,24 +44,27 @@ class EcalElectronicsMapping;

class EcalTrigPrimFunctionalAlgo {
public:
//Not barrelOnly
EcalTrigPrimFunctionalAlgo(const EcalTrigTowerConstituentsMap *eTTmap,
const CaloSubdetectorGeometry *endcapGeometry,
const EcalElectronicsMapping *theMapping,
int binofmax,
bool tcpFormat,
bool debug,
bool famos);

//barrel only
explicit EcalTrigPrimFunctionalAlgo(
const edm::EventSetup &setup, int binofmax, bool tcpFormat, bool barrelOnly, bool debug, bool famos);
const EcalElectronicsMapping *theMapping, int binofmax, bool tcpFormat, bool debug, bool famos);

virtual ~EcalTrigPrimFunctionalAlgo();

void run(const edm::EventSetup &,
const EBDigiCollection *col,
EcalTrigPrimDigiCollection &result,
EcalTrigPrimDigiCollection &resultTcp);
void run(const edm::EventSetup &,
const EEDigiCollection *col,
EcalTrigPrimDigiCollection &result,
EcalTrigPrimDigiCollection &resultTcp);
void run(const EBDigiCollection *col, EcalTrigPrimDigiCollection &result, EcalTrigPrimDigiCollection &resultTcp);
void run(const EEDigiCollection *col, EcalTrigPrimDigiCollection &result, EcalTrigPrimDigiCollection &resultTcp);
void run_part1_EB(EBDigiCollection const *col);
void run_part1_EE(EEDigiCollection const *col);
template <class Coll>
void run_part2(const edm::EventSetup &,
Coll const *col,
void run_part2(Coll const *col,
std::vector<std::vector<std::pair<int, std::vector<typename Coll::Digi>>>> &towerMap,
EcalTrigPrimDigiCollection &result,
EcalTrigPrimDigiCollection &resultTcp);
Expand Down Expand Up @@ -102,7 +103,7 @@ class EcalTrigPrimFunctionalAlgo {
}

private:
void init(const edm::EventSetup &);
void init();
template <class T>
void initStructures(std::vector<std::vector<std::pair<int, std::vector<T>>>> &towMap);
template <class T>
Expand All @@ -122,11 +123,11 @@ class EcalTrigPrimFunctionalAlgo {
return ind;
}

EcalFenixStrip *estrip_;
EcalFenixTcp *etcp_;
std::unique_ptr<EcalFenixStrip> estrip_;
std::unique_ptr<EcalFenixTcp> etcp_;

edm::ESHandle<EcalTrigTowerConstituentsMap> eTTmap_;
const CaloSubdetectorGeometry *theEndcapGeometry;
const EcalTrigTowerConstituentsMap *eTTmap_ = nullptr;
const CaloSubdetectorGeometry *theEndcapGeometry_ = nullptr;
const EcalElectronicsMapping *theMapping_;

float threshold;
Expand Down Expand Up @@ -165,7 +166,6 @@ class EcalTrigPrimFunctionalAlgo {

template <class Coll>
void EcalTrigPrimFunctionalAlgo::run_part2(
const edm::EventSetup &setup,
Coll const *col,
std::vector<std::vector<std::pair<int, std::vector<typename Coll::Digi>>>> &towerMap,
EcalTrigPrimDigiCollection &result,
Expand Down Expand Up @@ -194,14 +194,14 @@ void EcalTrigPrimFunctionalAlgo::run_part2(
// size; nr of crystals/strip

if ((towerMap[index])[i].first > 0) {
estrip_->process(setup, df, (towerMap[index])[i].first, striptp_[nstr++]);
estrip_->process(df, (towerMap[index])[i].first, striptp_[nstr++]);
}
} // loop over strips in one tower

bool isInInnerRings = false;
if (thisTower.subDet() == EcalEndcap && (thisTower.ietaAbs() == 27 || thisTower.ietaAbs() == 28))
isInInnerRings = true;
etcp_->process(setup, dummy, striptp_, nstr, towtp_, towtp2_, isInInnerRings, thisTower);
etcp_->process(dummy, striptp_, nstr, towtp_, towtp2_, isInInnerRings, thisTower);

// prepare TP-s
// special treatment for 2 inner endcap rings
Expand Down
8 changes: 2 additions & 6 deletions SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixStrip.cc
Expand Up @@ -8,12 +8,8 @@
#include <DataFormats/EcalDigi/interface/EcalTriggerPrimitiveSample.h>

//-------------------------------------------------------------------------------------
EcalFenixStrip::EcalFenixStrip(const edm::EventSetup &setup,
const EcalElectronicsMapping *theMapping,
bool debug,
bool famos,
int maxNrSamples,
int nbMaxXtals)
EcalFenixStrip::EcalFenixStrip(
const EcalElectronicsMapping *theMapping, bool debug, bool famos, int maxNrSamples, int nbMaxXtals)
: theMapping_(theMapping), debug_(debug), famos_(famos), nbMaxXtals_(nbMaxXtals) {
linearizer_.resize(nbMaxXtals_);
for (int i = 0; i < nbMaxXtals_; i++)
Expand Down
14 changes: 3 additions & 11 deletions SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixTcp.cc
Expand Up @@ -11,13 +11,7 @@

#include <vector>
//----------------------------------------------------------------------------------------
EcalFenixTcp::EcalFenixTcp(const edm::EventSetup &setup,
bool tcpFormat,
bool debug,
bool famos,
int binOfMax,
int maxNrSamples,
int nbMaxStrips)
EcalFenixTcp::EcalFenixTcp(bool tcpFormat, bool debug, bool famos, int binOfMax, int maxNrSamples, int nbMaxStrips)
: debug_(debug), nbMaxStrips_(nbMaxStrips) {
bypasslin_.resize(nbMaxStrips_);
for (int i = 0; i < nbMaxStrips_; i++)
Expand Down Expand Up @@ -51,8 +45,7 @@ EcalFenixTcp::~EcalFenixTcp() {
}
//-----------------------------------------------------------------------------------------

void EcalFenixTcp::process(const edm::EventSetup &setup,
std::vector<EBDataFrame> &bid, // dummy argument for template call
void EcalFenixTcp::process(std::vector<EBDataFrame> &bid, // dummy argument for template call
std::vector<std::vector<int>> &tpframetow,
int nStr,
std::vector<EcalTriggerPrimitiveSample> &tptow,
Expand All @@ -77,8 +70,7 @@ void EcalFenixTcp::process(const edm::EventSetup &setup,
}

//-----------------------------------------------------------------------------------------
void EcalFenixTcp::process(const edm::EventSetup &setup,
std::vector<EEDataFrame> &bid, // dummy argument for template call
void EcalFenixTcp::process(std::vector<EEDataFrame> &bid, // dummy argument for template call
std::vector<std::vector<int>> &tpframetow,
int nStr,
std::vector<EcalTriggerPrimitiveSample> &tptow,
Expand Down
67 changes: 37 additions & 30 deletions SimCalorimetry/EcalTrigPrimAlgos/src/EcalTrigPrimFunctionalAlgo.cc
Expand Up @@ -48,11 +48,36 @@ const unsigned int EcalTrigPrimFunctionalAlgo::maxNrTPs_ = 2448; // FIXME??

//----------------------------------------------------------------------

EcalTrigPrimFunctionalAlgo::EcalTrigPrimFunctionalAlgo(const EcalTrigTowerConstituentsMap *eTTmap,
const CaloSubdetectorGeometry *endcapGeometry,
const EcalElectronicsMapping *theMapping,
int binofmax,
bool tcpFormat,
bool debug,
bool famos)
: eTTmap_(eTTmap),
theEndcapGeometry_(endcapGeometry),
theMapping_(theMapping),
binOfMaximum_(binofmax),
tcpFormat_(tcpFormat),
barrelOnly_(true),
debug_(debug),
famos_(famos)

{
if (famos_)
maxNrSamples_ = 1; // get from input??
else
maxNrSamples_ = 10;
this->init();
}

EcalTrigPrimFunctionalAlgo::EcalTrigPrimFunctionalAlgo(
const edm::EventSetup &setup, int binofmax, bool tcpFormat, bool barrelOnly, bool debug, bool famos)
: binOfMaximum_(binofmax),
const EcalElectronicsMapping *theMapping, int binofmax, bool tcpFormat, bool debug, bool famos)
: theMapping_(theMapping),
binOfMaximum_(binofmax),
tcpFormat_(tcpFormat),
barrelOnly_(barrelOnly),
barrelOnly_(true),
debug_(debug),
famos_(famos)

Expand All @@ -61,27 +86,14 @@ EcalTrigPrimFunctionalAlgo::EcalTrigPrimFunctionalAlgo(
maxNrSamples_ = 1; // get from input??
else
maxNrSamples_ = 10;
this->init(setup);
this->init();
}

//----------------------------------------------------------------------
void EcalTrigPrimFunctionalAlgo::init(const edm::EventSetup &setup) {
if (!barrelOnly_) {
edm::ESHandle<CaloGeometry> theGeometry;
edm::ESHandle<CaloSubdetectorGeometry> theEndcapGeometry_handle;
setup.get<CaloGeometryRecord>().get(theGeometry);
setup.get<EcalEndcapGeometryRecord>().get("EcalEndcap", theEndcapGeometry_handle);
theEndcapGeometry = &(*theEndcapGeometry_handle);
setup.get<IdealGeometryRecord>().get(eTTmap_);
}
// endcap mapping
edm::ESHandle<EcalElectronicsMapping> ecalmapping;
setup.get<EcalMappingRcd>().get(ecalmapping);
theMapping_ = ecalmapping.product();

void EcalTrigPrimFunctionalAlgo::init() {
// create main sub algos
estrip_ = new EcalFenixStrip(setup, theMapping_, debug_, famos_, maxNrSamples_, nbMaxXtals_);
etcp_ = new EcalFenixTcp(setup, tcpFormat_, debug_, famos_, binOfMaximum_, maxNrSamples_, nbMaxStrips_);
estrip_ = std::make_unique<EcalFenixStrip>(theMapping_, debug_, famos_, maxNrSamples_, nbMaxXtals_);
etcp_ = std::make_unique<EcalFenixTcp>(tcpFormat_, debug_, famos_, binOfMaximum_, maxNrSamples_, nbMaxStrips_);

// initialise data structures
initStructures(towerMapEB_);
Expand All @@ -93,26 +105,21 @@ void EcalTrigPrimFunctionalAlgo::init(const edm::EventSetup &setup) {
}
//----------------------------------------------------------------------

EcalTrigPrimFunctionalAlgo::~EcalTrigPrimFunctionalAlgo() {
delete estrip_;
delete etcp_;
}
EcalTrigPrimFunctionalAlgo::~EcalTrigPrimFunctionalAlgo() {}
//----------------------------------------------------------------------
void EcalTrigPrimFunctionalAlgo::run(const edm::EventSetup &setup,
EBDigiCollection const *col,
void EcalTrigPrimFunctionalAlgo::run(EBDigiCollection const *col,
EcalTrigPrimDigiCollection &result,
EcalTrigPrimDigiCollection &resultTcp) {
run_part1_EB(col);
run_part2(setup, col, towerMapEB_, result, resultTcp);
run_part2(col, towerMapEB_, result, resultTcp);
}

//----------------------------------------------------------------------
void EcalTrigPrimFunctionalAlgo::run(const edm::EventSetup &setup,
EEDigiCollection const *col,
void EcalTrigPrimFunctionalAlgo::run(EEDigiCollection const *col,
EcalTrigPrimDigiCollection &result,
EcalTrigPrimDigiCollection &resultTcp) {
run_part1_EE(col);
run_part2(setup, col, towerMapEE_, result, resultTcp);
run_part2(col, towerMapEE_, result, resultTcp);
}
//----------------------------------------------------------------------
int EcalTrigPrimFunctionalAlgo::findStripNr(const EBDetId &id) {
Expand Down

0 comments on commit 480e295

Please sign in to comment.