Skip to content

Commit

Permalink
Merged hgc-tpg-integration-180913 from repository jbsauvan with cms-m…
Browse files Browse the repository at this point in the history
…erge-topic
  • Loading branch information
jbsauvan committed Nov 2, 2018
2 parents 6dd1cfe + c299bbb commit ae55a94
Show file tree
Hide file tree
Showing 94 changed files with 1,659 additions and 3,348 deletions.
6 changes: 3 additions & 3 deletions Configuration/StandardSequences/python/SimL1EmulatorDM_cff.py
Expand Up @@ -15,9 +15,9 @@
#
simHcalTechTrigDigis.ttpDigiCollection = "DMHcalTTPDigis"
#
hgcalTriggerPrimitiveDigiProducer.eeDigis = "mixData:HGCDigisEE"
hgcalTriggerPrimitiveDigiProducer.fhDigis = "mixData:HGCDigisHEfront"
hgcalTriggerPrimitiveDigiProducer.bhDigis = "mixData:HGCDigisHEback"
hgcalVFEProducer.eeDigis = "mixData:HGCDigisEE"
hgcalVFEProducer.fhDigis = "mixData:HGCDigisHEfront"
hgcalVFEProducer.bhDigis = "mixData:HGCDigisHEback"

from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger
if not stage2L1Trigger.isChosen():
Expand Down
59 changes: 59 additions & 0 deletions DataFormats/L1THGCal/interface/HGCalTriggerSums.h
@@ -0,0 +1,59 @@
#ifndef DataFormats_L1TCalorimeter_HGCalTriggerSums_h
#define DataFormats_L1TCalorimeter_HGCalTriggerSums_h


#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
#include "DataFormats/L1Trigger/interface/L1Candidate.h"
#include "DataFormats/L1Trigger/interface/BXVector.h"
#include "DataFormats/ForwardDetId/interface/HGCalDetId.h"

namespace l1t
{

class HGCalTriggerSums;
typedef BXVector<HGCalTriggerSums> HGCalTriggerSumsBxCollection;

class HGCalTriggerSums : public L1Candidate
{

public:

HGCalTriggerSums() {}

HGCalTriggerSums( const LorentzVector& p4,
int pt=0,
int eta=0,
int phi=0,
int qual=0,
uint32_t detid=0);

~HGCalTriggerSums() override;

void setDetId(uint32_t detid) {detid_ = HGCalDetId(detid);}
void setPosition(const GlobalPoint& position) {position_ = position;}

uint32_t detId() const {return detid_.rawId();}
const GlobalPoint& position() const {return position_;}

int zside() const {
return detid_.zside();
}
int layer() const {
return detid_.layer();
}

void setMipPt( double value ) { mipPt_ = value; }
double mipPt() const { return mipPt_; }

private:

HGCalDetId detid_;
GlobalPoint position_;

double mipPt_;

};

}

#endif
20 changes: 20 additions & 0 deletions DataFormats/L1THGCal/src/HGCalTriggerSums.cc
@@ -0,0 +1,20 @@
#include "DataFormats/L1THGCal/interface/HGCalTriggerSums.h"

using namespace l1t;

HGCalTriggerSums::
HGCalTriggerSums( const LorentzVector& p4,
int pt,
int eta,
int phi,
int qual,
uint32_t detid):
L1Candidate(p4, pt, eta, phi, qual),
detid_(detid)
{
}

HGCalTriggerSums::
~HGCalTriggerSums()
{
}
9 changes: 9 additions & 0 deletions DataFormats/L1THGCal/src/classes.h
Expand Up @@ -8,6 +8,7 @@
#include "DataFormats/L1THGCal/interface/HGCalTower.h"
#include "DataFormats/L1THGCal/interface/HGCalTowerMap.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerSums.h"

#include "DataFormats/L1THGCal/interface/ClusterShapes.h"

Expand All @@ -29,17 +30,22 @@ namespace DataFormats {
l1t::HGCalTowerBxCollection hgcalTowerBxColl;
l1t::HGCalTowerMapBxCollection hgcalTowerMapBxColl;
l1t::HGCalTriggerCellBxCollection hgcalTriggerCellBxColl;
l1t::HGCalTriggerSumsBxCollection hgcalTriggerSumsBxColl;
l1t::HGCalClusterBxCollection hgcalClusterBxColl;
l1t::HGCalMulticlusterBxCollection hgcalMulticlusterBxColl;
l1t::HGCalTowerID towerId;

edm::Ptr<l1t::HGCalTriggerCell> hgcalTriggerCellPtr;
edm::Ptr<l1t::HGCalTriggerSums> hgcalTriggerSumsPtr;
edm::Ptr<l1t::HGCalCluster> hgcalClusterPtr;
edm::Ptr<l1t::HGCalTowerMap> hgcalTowerMapPtr;

std::vector<edm::Ptr<l1t::HGCalTriggerCell>> hgcalTriggerCellList;
std::vector<edm::Ptr<l1t::HGCalCluster>> hgcalClusterList;
std::vector<edm::PtrVector<l1t::HGCalTriggerSums>> hgcalTriggerSumsList;
std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>> hgcalTriggerCellMap;
std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>> hgcalClusterMap;

edm::PtrVector<l1t::HGCalTowerMap> hgcalTowerMapList;
std::unordered_map<unsigned short,l1t::HGCalTower> towermap;

Expand All @@ -48,9 +54,12 @@ namespace DataFormats {
edm::Wrapper<l1t::HGCalClusterBxCollection> w_hgcalClusterBxColl;
edm::Wrapper<l1t::HGCalMulticlusterBxCollection> w_hgcalMulticlusterBxColl;
edm::Wrapper<l1t::HGCalTriggerCellBxCollection> w_hgcalTriggerCellBxColl;
edm::Wrapper<l1t::HGCalTriggerSumsBxCollection> w_hgcalTriggerSumsBxColl;

edm::Wrapper<edm::Ptr<l1t::HGCalTriggerCell>> w_hgcalTriggerCellPtr;
edm::Wrapper<edm::Ptr<l1t::HGCalTriggerSums>> w_hgcalTriggerSumsPtr;
edm::Wrapper<edm::PtrVector<l1t::HGCalTriggerCell>> w_hgcalTriggerCellList;
edm::Wrapper<edm::PtrVector<l1t::HGCalTriggerSums>> w_hgcalTriggerSumsList;
edm::Wrapper<edm::Ptr<l1t::HGCalCluster>> w_hgcalClusterPtr;
edm::Wrapper<edm::PtrVector<l1t::HGCalCluster>> w_hgcalClusterList;

Expand Down
15 changes: 15 additions & 0 deletions DataFormats/L1THGCal/src/classes_def.xml
Expand Up @@ -19,6 +19,7 @@
<class name="std::unordered_map<int,l1t::HGCalTower>" />
<class name="l1t::HGCalTowerBxCollection"/>
<class name="edm::Wrapper<l1t::HGCalTowerBxCollection>"/>
<class name="unordered_map<int,l1t::HGCalTower>"/>


<class name="l1t::HGCalTowerMap" />
Expand All @@ -28,6 +29,7 @@
<class name="edm::Wrapper<l1t::HGCalTowerMapBxCollection>"/>

<class name="l1t::HGCalClusterT<l1t::HGCalTriggerCell>" />
<class name="l1t::HGCalClusterT<l1t::HGCalTriggerSums>" />
<class name="l1t::HGCalCluster" ClassVersion="14">
<version ClassVersion="14" checksum="3289642235"/>
<version ClassVersion="13" checksum="3397489079"/>
Expand Down Expand Up @@ -57,19 +59,32 @@
<class name="std::vector<l1t::HGCalTriggerCell>" />
<class name="l1t::HGCalTriggerCellBxCollection"/>
<class name="edm::Wrapper<l1t::HGCalTriggerCellBxCollection>"/>

<class name="l1t::HGCalTriggerSums" ClassVersion="11">
<version ClassVersion="11" checksum="4058188392"/>
</class>
<class name="std::vector<l1t::HGCalTriggerSums>" />
<class name="l1t::HGCalTriggerSumsBxCollection"/>
<class name="edm::Wrapper<l1t::HGCalTriggerSumsBxCollection>"/>


<class name="std::vector<edm::Ptr<l1t::HGCalTriggerCell>>" />
<class name="std::vector<edm::Ptr<l1t::HGCalCluster>>" />
<class name="std::vector<edm::PtrVector<l1t::HGCalTriggerSums>>" />
<class name="std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>" />
<class name="std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>" />
<class name="std::unordered_map<uint32_t, double>" />
<class name="unordered_map<unsigned short,l1t::HGCalTower>" />

<class name="edm::PtrVector<l1t::HGCalTowerMap>" />
<class name="edm::Ptr<l1t::HGCalTriggerCell>" />
<class name="edm::Ptr<l1t::HGCalTriggerSums>" />
<class name="edm::Ptr<l1t::HGCalCluster>" />
<class name="edm::Ptr<l1t::HGCalTowerMap>" />
<class name="edm::Wrapper<edm::Ptr<l1t::HGCalTriggerCell>>"/>
<class name="edm::Wrapper<edm::PtrVector<l1t::HGCalTriggerCell>>"/>
<class name="edm::Wrapper<edm::Ptr<l1t::HGCalTriggerSums>>"/>
<class name="edm::Wrapper<edm::PtrVector<l1t::HGCalTriggerSums>>"/>
<class name="edm::Wrapper<edm::Ptr<l1t::HGCalCluster>>"/>
<class name="edm::Wrapper<edm::PtrVector<l1t::HGCalCluster>>"/>
<class name="edm::Wrapper<edm::Ptr<l1t::HGCalTowerMap>>"/>
Expand Down
10 changes: 5 additions & 5 deletions L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py
Expand Up @@ -117,11 +117,11 @@ def _appendStage2Digis(obj):
# adding HGCal L1 trigger digis
def _appendHGCalDigis(obj):
l1HGCalDigis = [
'keep *_hgcalTriggerPrimitiveDigiProducer_calibratedTriggerCells_*',
'keep *_hgcalTriggerPrimitiveDigiProducer_cluster2D_*',
'keep *_hgcalTriggerPrimitiveDigiProducer_cluster3D_*',
'keep *_hgcalTriggerPrimitiveDigiProducer_towerMap_*',
'keep *_hgcalTriggerPrimitiveDigiProducer_tower_*',
'keep l1tHGCalTriggerCellBXVector_hgcalVFEProducer_*_*',
'keep l1tHGCalTriggerCellBXVector_hgcalConcentratorProducer_*_*',
'keep l1tHGCalTowerBXVector_hgcalTowerProducer_*_*',
'keep l1tHGCalClusterBXVector_hgcalBackEndLayer1Producer_*_*',
'keep l1tHGCalMulticlusterBXVector_hgcalBackEndLayer2Producer_*_*'
]
obj.outputCommands += l1HGCalDigis

Expand Down
29 changes: 29 additions & 0 deletions L1Trigger/L1THGCal/interface/HGCalProcessorBase.h
@@ -0,0 +1,29 @@
#ifndef __L1Trigger_L1THGCal_HGCalProcessorBase_h__
#define __L1Trigger_L1THGCal_HGCalProcessorBase_h__

#include "L1Trigger/L1THGCal/interface/HGCalProcessorBaseT.h"

#include "DataFormats/HGCDigi/interface/HGCDigiCollections.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerSums.h"
#include "DataFormats/L1THGCal/interface/HGCalCluster.h"
#include "DataFormats/L1THGCal/interface/HGCalMulticluster.h"
#include "DataFormats/L1THGCal/interface/HGCalTowerMap.h"
#include "DataFormats/L1THGCal/interface/HGCalTower.h"

typedef HGCalProcessorBaseT<HGCalDigiCollection, l1t::HGCalTriggerCellBxCollection> HGCalVFEProcessorBase;
typedef HGCalProcessorBaseT<edm::Handle<l1t::HGCalTriggerCellBxCollection>, l1t::HGCalTriggerCellBxCollection> HGCalConcentratorProcessorBase;
typedef HGCalProcessorBaseT<edm::Handle<l1t::HGCalTriggerCellBxCollection>, l1t::HGCalClusterBxCollection> HGCalBackendLayer1ProcessorBase;
typedef HGCalProcessorBaseT<edm::Handle<l1t::HGCalClusterBxCollection>, l1t::HGCalMulticlusterBxCollection> HGCalBackendLayer2ProcessorBase;
typedef HGCalProcessorBaseT<edm::Handle<l1t::HGCalTriggerCellBxCollection>, l1t::HGCalTowerMapBxCollection> HGCalTowerMapProcessorBase;
typedef HGCalProcessorBaseT<edm::Handle<l1t::HGCalTowerMapBxCollection>, l1t::HGCalTowerBxCollection> HGCalTowerProcessorBase;

#include "FWCore/PluginManager/interface/PluginFactory.h"
typedef edmplugin::PluginFactory< HGCalVFEProcessorBase* (const edm::ParameterSet&) > HGCalVFEProcessorBaseFactory;
typedef edmplugin::PluginFactory< HGCalConcentratorProcessorBase* (const edm::ParameterSet&) > HGCalConcentratorFactory;
typedef edmplugin::PluginFactory< HGCalBackendLayer1ProcessorBase* (const edm::ParameterSet&) > HGCalBackendLayer1Factory;
typedef edmplugin::PluginFactory< HGCalBackendLayer2ProcessorBase* (const edm::ParameterSet&) > HGCalBackendLayer2Factory;
typedef edmplugin::PluginFactory< HGCalTowerMapProcessorBase* (const edm::ParameterSet&) > HGCalTowerMapFactory;
typedef edmplugin::PluginFactory< HGCalTowerProcessorBase* (const edm::ParameterSet&) > HGCalTowerFactory;

#endif
36 changes: 36 additions & 0 deletions L1Trigger/L1THGCal/interface/HGCalProcessorBaseT.h
@@ -0,0 +1,36 @@
#ifndef __L1Trigger_L1THGCal_HGCalProcessorBaseT_h__
#define __L1Trigger_L1THGCal_HGCalProcessorBaseT_h__

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/Common/interface/Handle.h"

#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h"


template<typename InputCollection, typename OutputCollection> class HGCalProcessorBaseT {

public:
HGCalProcessorBaseT(const edm::ParameterSet& conf) :
geometry_(nullptr),
name_(conf.getParameter<std::string>("ProcessorName"))
{}

virtual ~HGCalProcessorBaseT() {}

const std::string& name() const { return name_; }

void setGeometry(const HGCalTriggerGeometryBase* const geom) { geometry_ = geom;}

virtual void run(const InputCollection& inputColl,
OutputCollection& outColl,
const edm::EventSetup& es) = 0;

protected:
const HGCalTriggerGeometryBase* geometry_;

private:
const std::string name_;

};

#endif
13 changes: 11 additions & 2 deletions L1Trigger/L1THGCal/interface/HGCalTriggerTools.h
Expand Up @@ -15,6 +15,9 @@

#include <array>
#include <cmath>
#include <vector>
#include "DataFormats/L1Trigger/interface/BXVector.h"

#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"

Expand All @@ -30,7 +33,7 @@ namespace edm {
class HGCalTriggerTools {
public:
HGCalTriggerTools() : geom_(nullptr),
eeLayers_(0), fhLayers_(0), bhLayers_(0), totalLayers_(0){}
eeLayers_(0), fhLayers_(0), bhLayers_(0), totalLayers_(0){}
~HGCalTriggerTools() {}

void eventSetup(const edm::EventSetup&);
Expand Down Expand Up @@ -58,7 +61,13 @@ class HGCalTriggerTools {
float getLayerZ(const unsigned& layerWithOffset) const;
float getLayerZ(const int& subdet, const unsigned& layer) const;


template<typename T>
std::vector<T> bxVectorToVector(const BXVector<T>& inputBXVector){
std::vector<T> outputVector;
//loop over collection for a given bx and put the objects into a std::vector
outputVector.insert(outputVector.end(), inputBXVector.begin(0), inputBXVector.end(0));
return outputVector;
}

private:
const HGCalTriggerGeometryBase* geom_;
Expand Down
Expand Up @@ -7,9 +7,9 @@
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h"
#include "L1Trigger/L1THGCal/interface/be_algorithms/HGCalShowerShape.h"
#include "L1Trigger/L1THGCal/interface/backend/HGCalShowerShape.h"
#include "L1Trigger/L1THGCal/interface/HGCalTriggerTools.h"
#include "L1Trigger/L1THGCal/interface/be_algorithms/HGCalTriggerClusterIdentificationBase.h"
#include "L1Trigger/L1THGCal/interface/backend/HGCalTriggerClusterIdentificationBase.h"


class HGCalMulticlusteringImpl{
Expand Down
@@ -0,0 +1,28 @@
#ifndef __L1Trigger_L1THGCal_HGCalConcentratorProcessorSelection_h__
#define __L1Trigger_L1THGCal_HGCalConcentratorProcessorSelection_h__

#include "L1Trigger/L1THGCal/interface/HGCalProcessorBase.h"
#include "L1Trigger/L1THGCal/interface/concentrator/HGCalConcentratorSelectionImpl.h"

#include "L1Trigger/L1THGCal/interface/HGCalTriggerTools.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerSums.h"

class HGCalConcentratorProcessorSelection : public HGCalConcentratorProcessorBase
{

public:
HGCalConcentratorProcessorSelection(const edm::ParameterSet& conf);

void run(const edm::Handle<l1t::HGCalTriggerCellBxCollection>& triggerCellCollInput, l1t::HGCalTriggerCellBxCollection& triggerCellCollOutput, const edm::EventSetup& es) override;

private:
std::string choice_;

HGCalConcentratorSelectionImpl concentratorProcImpl_;

HGCalTriggerTools triggerTools_;

};

#endif
@@ -0,0 +1,52 @@
#ifndef __L1Trigger_L1THGCal_HGCalConcentratorSelectionImpl_h__
#define __L1Trigger_L1THGCal_HGCalConcentratorSelectionImpl_h__

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h"

#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerSums.h"

#include "L1Trigger/L1THGCal/interface/HGCalTriggerTools.h"

#include <array>
#include <vector>

class HGCalConcentratorSelectionImpl
{

public:
HGCalConcentratorSelectionImpl(const edm::ParameterSet& conf);

void bestChoiceSelectImpl(const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput, std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput);
void thresholdSelectImpl(const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput, std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput);

// Retrieve parameters
size_t nCellsInModule() const {return nCellsInModule_;}
double linLSB() const {return linLSB_;}
size_t nData() const {return nData_;}
double adcsaturationBH() const {return adcsaturationBH_;}
uint32_t adcnBitsBH() const {return adcnBitsBH_;}
int TCThreshold_ADC() const {return TCThreshold_ADC_;}
double TCThreshold_fC() const {return TCThreshold_fC_;}
int TCThresholdBH_ADC() const {return TCThresholdBH_ADC_;}
double TCThresholdBH_MIP() const {return TCThresholdBH_MIP_;}

private:
size_t nData_;
size_t nCellsInModule_;
double linLSB_;
double adcsaturationBH_;
uint32_t adcnBitsBH_;
double adcLSBBH_;
int TCThreshold_ADC_;
double TCThreshold_fC_;
int TCThresholdBH_ADC_;
double TCThresholdBH_MIP_;
double triggercell_threshold_silicon_;
double triggercell_threshold_scintillator_;

HGCalTriggerTools triggerTools_;
};

#endif

0 comments on commit ae55a94

Please sign in to comment.