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

Optimizations of the HGCAL L1 trigger #15782

Merged
merged 47 commits into from Sep 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
6f57d25
Merged hgc-tpg-devel-CMSSW_8_1_0_pre6 from repository PFCal-dev
baffioni Jun 15, 2016
72609a1
add -1 to the saturation value
baffioni Jun 21, 2016
b0ef049
association with simhits
baffioni Jun 22, 2016
14a69ea
association with simhits
baffioni Jun 22, 2016
2aa3943
SimDataFormats/CaloTest package added
baffioni Jun 23, 2016
fc18bbf
corrections after comments
baffioni Jun 23, 2016
8cb6384
corrections
baffioni Jun 23, 2016
4c29779
Merge pull request #35 from baffioni/baffioni-smihits-810pre6
jbsauvan Jun 23, 2016
ac3bd4e
Identify trigger cells within modules instead of wafers
jbsauvan Jun 30, 2016
1ff54a8
Merged hgc-tpg-devel-CMSSW_8_1_0_pre6 from repository PFCal-dev
jbsauvan Aug 3, 2016
86d92fa
Update configs to pre9 release
jbsauvan Aug 3, 2016
c257f9f
Merge branch 'hgc-tpg-devel-CMSSW_8_1_0_pre9' into fix-triggercell-sums
jbsauvan Aug 3, 2016
4089647
Merge pull request #36 from jbsauvan/fix-triggercell-sums
jbsauvan Aug 3, 2016
d9b476b
Improve front-end processing time
jbsauvan Aug 23, 2016
c648fc2
Remove virtual keywords
jbsauvan Aug 23, 2016
48f9172
Replace insert with emplace
jbsauvan Aug 23, 2016
1955deb
Replace maps with unordered_maps
jbsauvan Aug 23, 2016
b30b142
Revert back to ordered maps in some cases
jbsauvan Aug 24, 2016
983078e
Merge updates from 81X PR
jbsauvan Aug 24, 2016
872dfa2
Merge pull request #37 from jbsauvan/optimize-frontend
jbsauvan Aug 24, 2016
a14cfba
Merge pull request #38 from jbsauvan/merge-81x-pr-updates
jbsauvan Aug 25, 2016
affdb94
Add new trigger detid
jbsauvan Sep 1, 2016
b68497a
Add lightweight geometry class
jbsauvan Sep 1, 2016
b1530f5
Update module drawing for the lightweight geometry
jbsauvan Sep 1, 2016
fe122f8
Clean code related to lightweight geometry
jbsauvan Sep 2, 2016
1adabae
Add test class for best choice timing study
jbsauvan Sep 2, 2016
dca2e62
Change if/else to switch/case
jbsauvan Sep 2, 2016
3549c64
Make HGCTriggerHexDetId format derive from HGCalDetId
jbsauvan Sep 3, 2016
5a905b7
Add HGCTriggerHexDetId in classes_def
jbsauvan Sep 3, 2016
5eb6347
Add position methods in geometry
jbsauvan Sep 4, 2016
fa4c4ee
Remove getValidIds methods
jbsauvan Sep 5, 2016
65e88d7
Use new geometry interface
jbsauvan Sep 5, 2016
03f8a22
Cleaning
jbsauvan Sep 5, 2016
a6727c0
Change HGCalDetId to HGCTriggerHexDetId
jbsauvan Sep 5, 2016
1a9f31c
Merge pull request #39 from jbsauvan/reduce-geometry-memory
jbsauvan Sep 6, 2016
0a21047
Fix trigger cell sums
jbsauvan Sep 7, 2016
04721ee
Update trigger cell energy truncation
jbsauvan Sep 7, 2016
447cf8c
Fix comment
jbsauvan Sep 7, 2016
8649100
Merge pull request #40 from jbsauvan/change-bit-truncation
jbsauvan Sep 8, 2016
33b9028
Merging hgc-tpg-devel-CMSSW_8_1_0_pre9 in CMSSW_8_1_0_pre11
jbsauvan Sep 8, 2016
3ab2a35
Update geometry config
jbsauvan Sep 8, 2016
972c8ee
Add dictionaries for vectors of L1THGCal objects
jbsauvan Sep 8, 2016
9d840ce
Merged hgc-tpg-devel-CMSSW_8_1_0_pre11 from repository PFCal-dev
jbsauvan Sep 8, 2016
8233c9c
Remove TObject include in HGCTrigger detids
jbsauvan Sep 12, 2016
2c4c1a1
Rename HGCalTriggerGeometryOld to HGCalTriggerGeometryGenericMapping
jbsauvan Sep 12, 2016
16bb497
Use HGCalDetId instead of HGCTriggerHexDetId
jbsauvan Sep 13, 2016
f8b46db
Remove HGCalDetId utilities
jbsauvan Sep 17, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion DataFormats/ForwardDetId/interface/HGCTriggerDetId.h
Expand Up @@ -4,7 +4,6 @@
#include <iosfwd>
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
#include "TObject.h"


class HGCTriggerDetId : public DetId {
Expand Down
1 change: 1 addition & 0 deletions DataFormats/ForwardDetId/interface/HGCalDetId.h
Expand Up @@ -59,6 +59,7 @@ class HGCalDetId : public DetId {
static const HGCalDetId Undefined;
};


std::ostream& operator<<(std::ostream&,const HGCalDetId& id);

#endif
2 changes: 2 additions & 0 deletions DataFormats/ForwardDetId/src/HGCalDetId.cc
Expand Up @@ -63,6 +63,8 @@ bool HGCalDetId::isValid(ForwardSubdetector subdet, int zp, int lay, int waferty
return ok;
}



std::ostream& operator<<(std::ostream& s,const HGCalDetId& id) {
return s << "isHGCal=" << id.isHGCal() << " zpos=" << id.zside()
<< " layer=" << id.layer() << " wafer type=" << id.waferType()
Expand Down
3 changes: 3 additions & 0 deletions DataFormats/L1THGCal/src/classes_def.xml
Expand Up @@ -2,6 +2,7 @@
<class name="l1t::HGCFETriggerDigi" ClassVersion="10">
<version ClassVersion="10" checksum="3197268020"/>
</class>
<class name="std::vector<l1t::HGCFETriggerDigi>"/>
<class name="l1t::HGCFETriggerDigiCollection"/>
<class name="edm::Wrapper<l1t::HGCFETriggerDigiCollection>"/>

Expand All @@ -14,10 +15,12 @@
<class name="edm::Wrapper<l1t::HGCFETriggerDigiPtrVector>"/>

<class name="l1t::HGCalTower" />
<class name="std::vector<l1t::HGCalTower>" />
<class name="l1t::HGCalTowerBxCollection"/>
<class name="edm::Wrapper<l1t::HGCalTowerBxCollection>"/>

<class name="l1t::HGCalCluster" />
<class name="std::vector<l1t::HGCalCluster>" />
<class name="l1t::HGCalClusterBxCollection"/>
<class name="edm::Wrapper<l1t::HGCalClusterBxCollection>"/>

Expand Down
16 changes: 7 additions & 9 deletions L1Trigger/L1THGCal/interface/HGCalTriggerFECodecBase.h
Expand Up @@ -25,8 +25,6 @@

class HGCalTriggerFECodecBase {
public:
typedef HGCalTriggerGeometry::Module Module;

HGCalTriggerFECodecBase(const edm::ParameterSet& conf) :
name_(conf.getParameter<std::string>("CodecName")),
codec_idx_(static_cast<unsigned char>(conf.getParameter<uint32_t>("CodecIndex")))
Expand All @@ -37,13 +35,13 @@ class HGCalTriggerFECodecBase {

const unsigned char getCodecType() const { return codec_idx_; }

// give the FECodec a module + input digis and it sets itself
// give the FECodec the trigger geometry + input digis and it sets itself
// with the approprate data
virtual void setDataPayload(const Module& cell,
virtual void setDataPayload(const HGCalTriggerGeometryBase&,
const HGCEEDigiCollection&,
const HGCHEDigiCollection&,
const HGCHEDigiCollection& ) = 0;
virtual void setDataPayload(const Module& ,
virtual void setDataPayload(const HGCalTriggerGeometryBase& ,
const l1t::HGCFETriggerDigi&) = 0;
virtual void unSetDataPayload() = 0;
// get the set data out for your own enjoyment
Expand Down Expand Up @@ -92,7 +90,7 @@ namespace HGCalTriggerFE {
dataIsSet_ = true;
}

virtual void setDataPayload(const Module& mod,
virtual void setDataPayload(const HGCalTriggerGeometryBase& geom,
const HGCEEDigiCollection& ee,
const HGCHEDigiCollection& fh,
const HGCHEDigiCollection& bh ) override final {
Expand All @@ -101,18 +99,18 @@ namespace HGCalTriggerFE {
<< "Data payload was already set for HGCTriggerFECodec: "
<< this->name() << " overwriting current data!";
}
static_cast<Impl&>(*this).setDataPayloadImpl(mod,ee,fh,bh);
static_cast<Impl&>(*this).setDataPayloadImpl(geom,ee,fh,bh);
dataIsSet_ = true;
}

virtual void setDataPayload(const Module& mod,
virtual void setDataPayload(const HGCalTriggerGeometryBase& geom,
const l1t::HGCFETriggerDigi& digi) override final {
if( dataIsSet_ ) {
edm::LogWarning("HGCalTriggerFECodec|OverwritePayload")
<< "Data payload was already set for HGCTriggerFECodec: "
<< this->name() << " overwriting current data!";
}
static_cast<Impl&>(*this).setDataPayloadImpl(mod,digi);
static_cast<Impl&>(*this).setDataPayloadImpl(geom,digi);
dataIsSet_ = true;
}

Expand Down
208 changes: 53 additions & 155 deletions L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h
Expand Up @@ -13,161 +13,59 @@
#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h"
#include "Geometry/CaloTopology/interface/HGCalTopology.h"

/*******
*
* class: HGCalTriggerGeometryBase
* author: L.Gray (FNAL)
* date: 26 July, 2015
*
* This class is the base class for all HGCal trigger geometry definitions.
* Typically this is just a ganging of cells and nearest-neighbour relationships.
*
* Classes for TriggerCells and Modules are defined. They are containers for
* maps relating modules to modules and trigger cells to trigger cells and
* raw HGC cells.
*
* It is up to the user of the class to define what these mappings are through the
* initialize() function. This function takes the full HGC geometry as input and
* creates all the necessary maps for navigating the trigger system. All of the
* containers for parts of the map are available through protected members of the base
* class.
*
* All unsigned ints used here are DetIds, or will become them once we sort out the
* full nature of the trigger detids.
*******/

class HGCalTriggerGeometryBase;

namespace HGCalTriggerGeometry {
class TriggerCell {
public:
typedef std::unordered_set<unsigned> list_type;

TriggerCell(unsigned tc_id, unsigned mod_id, const GlobalPoint& pos,
const list_type& neighbs, const list_type& comps) :
trigger_cell_id_(tc_id),
module_id_(mod_id),
position_(pos),
neighbours_(neighbs),
components_(comps)
{}
~TriggerCell() {}


unsigned triggerCellId() const { return trigger_cell_id_; }
unsigned moduleId() const { return module_id_; }

bool containsCell(const unsigned cell) const {
return ( components_.find(cell) != components_.end() );
}

const GlobalPoint& position() const { return position_; }

const std::unordered_set<unsigned>& neighbours() const { return neighbours_; }
const std::unordered_set<unsigned>& components() const { return components_; }

private:
unsigned trigger_cell_id_; // the ID of this trigger cell
unsigned module_id_; // module this TC belongs to
GlobalPoint position_;
list_type neighbours_; // neighbouring trigger cells
list_type components_; // contained HGC cells
};

class Module {
public:
typedef std::unordered_set<unsigned> list_type;
typedef std::unordered_multimap<unsigned,unsigned> tc_map_type;

Module(unsigned mod_id, const GlobalPoint& pos,
const list_type& neighbs, const list_type& comps,
const tc_map_type& tc_comps):
module_id_(mod_id),
position_(pos),
neighbours_(neighbs),
components_(comps),
tc_components_(tc_comps)
{}
~Module() {}

unsigned moduleId() const { return module_id_; }

bool containsTriggerCell(const unsigned trig_cell) const {
return ( components_.find(trig_cell) != components_.end() );
}

bool containsCell(const unsigned cell) const {
for( const auto& value : tc_components_ ) {
if( value.second == cell ) return true;
}
return false;
}

const GlobalPoint& position() const { return position_; }

const list_type& neighbours() const { return neighbours_; }
const list_type& components() const { return components_; }

const tc_map_type& triggerCellComponents() const { return tc_components_; }

private:
unsigned module_id_; // module this TC belongs to
GlobalPoint position_;
list_type neighbours_; // neighbouring Modules
list_type components_; // contained HGC trigger cells
tc_map_type tc_components_; // cells contained by trigger cells
};
}

class HGCalTriggerGeometryBase {
public:
struct es_info {
edm::ESHandle<HGCalGeometry> geom_ee, geom_fh, geom_bh;
edm::ESHandle<HGCalTopology> topo_ee, topo_fh, topo_bh;
};

typedef std::unordered_map<unsigned,unsigned> geom_map;
typedef std::unordered_map<unsigned,std::unique_ptr<const HGCalTriggerGeometry::Module> > module_map;
typedef std::unordered_map<unsigned,std::unique_ptr<const HGCalTriggerGeometry::TriggerCell> > trigger_cell_map;

HGCalTriggerGeometryBase(const edm::ParameterSet& conf);
virtual ~HGCalTriggerGeometryBase() {}

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

const std::string& eeSDName() const { return ee_sd_name_; }
const std::string& fhSDName() const { return fh_sd_name_; }
const std::string& bhSDName() const { return bh_sd_name_; }

// non-const access to the geometry class
virtual void initialize( const es_info& ) = 0;
void reset();

// const access to the geometry class
// all of the get*From* functions return nullptr if the thing you
// ask for doesn't exist
const std::unique_ptr<const HGCalTriggerGeometry::TriggerCell>& getTriggerCellFromCell( const unsigned cell_det_id ) const;
const std::unique_ptr<const HGCalTriggerGeometry::Module>& getModuleFromCell( const unsigned cell_det_id ) const;
const std::unique_ptr<const HGCalTriggerGeometry::Module>& getModuleFromTriggerCell( const unsigned trigger_cell_det_id ) const;

const geom_map& cellsToTriggerCellsMap() const { return cells_to_trigger_cells_; }
const geom_map& triggerCellsToModulesMap() const { return trigger_cells_to_modules_; }

const module_map& modules() const { return modules_; }
const trigger_cell_map& triggerCells() const { return trigger_cells_; }

protected:
geom_map cells_to_trigger_cells_;
geom_map trigger_cells_to_modules_;

module_map modules_;
trigger_cell_map trigger_cells_;

private:
const std::string name_;
const std::string ee_sd_name_;
const std::string fh_sd_name_;
const std::string bh_sd_name_;


// Pure virtual trigger geometry class
// Provides the interface to access trigger cell and module mappings
class HGCalTriggerGeometryBase
{
public:
struct es_info
{
edm::ESHandle<HGCalGeometry> geom_ee, geom_fh, geom_bh;
edm::ESHandle<HGCalTopology> topo_ee, topo_fh, topo_bh;
};

typedef std::unordered_map<unsigned,unsigned> geom_map;
typedef std::unordered_set<unsigned> geom_set;
typedef std::set<unsigned> geom_ordered_set;

HGCalTriggerGeometryBase(const edm::ParameterSet& conf);
virtual ~HGCalTriggerGeometryBase() {}

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

const std::string& eeSDName() const { return ee_sd_name_; }
const std::string& fhSDName() const { return fh_sd_name_; }
const std::string& bhSDName() const { return bh_sd_name_; }

// non-const access to the geometry class
virtual void initialize( const es_info& ) = 0;
virtual void reset();

// const access to the geometry class
virtual unsigned getTriggerCellFromCell( const unsigned cell_det_id ) const = 0;
virtual unsigned getModuleFromCell( const unsigned cell_det_id ) const = 0;
virtual unsigned getModuleFromTriggerCell( const unsigned trigger_cell_det_id ) const = 0;

virtual geom_set getCellsFromTriggerCell( const unsigned cell_det_id ) const = 0;
virtual geom_set getCellsFromModule( const unsigned cell_det_id ) const = 0;
virtual geom_set getTriggerCellsFromModule( const unsigned trigger_cell_det_id ) const = 0;

virtual geom_ordered_set getOrderedCellsFromModule( const unsigned cell_det_id ) const = 0;
virtual geom_ordered_set getOrderedTriggerCellsFromModule( const unsigned trigger_cell_det_id ) const = 0;

virtual GlobalPoint getTriggerCellPosition(const unsigned trigger_cell_det_id) const = 0;
virtual GlobalPoint getModulePosition(const unsigned module_det_id) const = 0;


private:
const std::string name_;
const std::string ee_sd_name_;
const std::string fh_sd_name_;
const std::string bh_sd_name_;


};

#include "FWCore/PluginManager/interface/PluginFactory.h"
Expand Down