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
HGCAL trigger updates #21728
HGCAL trigger updates #21728
Changes from 83 commits
0e6fef9
7701c3e
dfec795
a6b93d8
291432e
d413a0b
e9c3287
392d586
69915df
c4c7992
37463b2
548c709
8dd2512
c4e1890
e0d092a
b89fdcd
342a410
f1d2669
d8dc0d5
ad183c8
f803e7a
974eef1
4e5c729
6e1994e
b5cb13b
7947a82
b9be92d
c61cbbc
e0dfea5
3131221
ee456ee
5e8c913
555a966
547cda1
8f53fb1
b2ccbbe
a58b412
f915247
052a859
598e9c2
2cd2cfb
b3fe6ba
7d67ea3
c30af6a
100fe46
332e614
beebddb
fa90bc9
fc9e25e
ed87015
27be0f6
77202c1
48966a8
a88dfc0
fec3b72
3788c15
0c7346c
85bb2b6
7bd4831
dca81c9
19bfef7
9aad5af
bfeeaed
a0a50f5
23ba449
fe3113b
8c0b2cc
25650cd
fa10501
e696e7a
481009f
d361463
1db2895
30aa251
edb5262
5eb1a6c
118cd2e
fa56bdc
88f5e7c
b23167d
35bb0f6
8c67144
4479044
41c05be
76dcdb9
c87a8d9
ca6c0a1
56b783f
f1f0db6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,9 @@ | |
#include "DataFormats/L1THGCal/interface/HGCalMulticluster.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
|
||
#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h" | ||
#include "L1Trigger/L1THGCal/interface/be_algorithms/HGCalShowerShape.h" | ||
|
||
class HGCalMulticlusteringImpl{ | ||
|
||
public: | ||
|
@@ -16,14 +19,38 @@ class HGCalMulticlusteringImpl{ | |
const l1t::HGCalMulticluster & mclu, | ||
double dR ) const; | ||
|
||
void clusterize( const edm::PtrVector<l1t::HGCalCluster> & clustersPtr, | ||
l1t::HGCalMulticlusterBxCollection & multiclusters); | ||
void clusterizeDR( const edm::PtrVector<l1t::HGCalCluster> & clustersPtr, | ||
l1t::HGCalMulticlusterBxCollection & multiclusters, | ||
const HGCalTriggerGeometryBase & triggerGeometry | ||
); | ||
|
||
void clusterizeDBSCAN( const edm::PtrVector<l1t::HGCalCluster> & clustersPtr, | ||
l1t::HGCalMulticlusterBxCollection & multiclusters, | ||
const HGCalTriggerGeometryBase & triggerGeometry | ||
); | ||
|
||
private: | ||
|
||
void findNeighbor( const std::vector<std::pair<unsigned int,double>>& rankedList, | ||
unsigned int searchInd, | ||
const edm::PtrVector<l1t::HGCalCluster> & clustersPtr, | ||
std::vector<unsigned int>& neigbors); | ||
|
||
double dr_; | ||
double ptC3dThreshold_; | ||
double calibSF_; | ||
std::string multiclusterAlgoType_; | ||
double distDbscan_ = 0.005; | ||
unsigned minNDbscan_ = 3; | ||
std::vector<double> layerWeights_; | ||
bool applyLayerWeights_; | ||
|
||
HGCalShowerShape shape_; | ||
|
||
static const int kLayersEE_=28; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the reco algorithms, we prefer to get these values from the geometry/topology classes (rather than hardcoding them). Are those or something similar available for L1T classes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A class HGCalTriggerTools has been added. Now the values are extracted from the geometry and there is no more replicated hardcoding. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excellent, thanks! |
||
static const int kLayersFH_=12; | ||
static const int kLayersBH_=12; | ||
|
||
}; | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#ifndef __L1Trigger_L1THGCal_HGCalShowerShape_h__ | ||
#define __L1Trigger_L1THGCal_HGCalShowerShape_h__ | ||
#include <vector> | ||
#include <cmath> | ||
#include "DataFormats/L1THGCal/interface/HGCalMulticluster.h" | ||
#include "DataFormats/Math/interface/LorentzVector.h" | ||
#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h" | ||
|
||
class HGCalShowerShape{ | ||
|
||
public: | ||
typedef math::XYZTLorentzVector LorentzVector; | ||
|
||
HGCalShowerShape(){} | ||
|
||
~HGCalShowerShape(){} | ||
|
||
int firstLayer(const l1t::HGCalMulticluster& c3d) const; | ||
int lastLayer(const l1t::HGCalMulticluster& c3d) const; | ||
int maxLayer(const l1t::HGCalMulticluster& c3d) const; | ||
int showerLength(const l1t::HGCalMulticluster& c3d) const {return lastLayer(c3d)-firstLayer(c3d)+1; }//in number of layers | ||
// Maximum number of consecutive layers in the cluster | ||
int coreShowerLength(const l1t::HGCalMulticluster& c3d, const HGCalTriggerGeometryBase& triggerGeometry) const; | ||
|
||
float eMax(const l1t::HGCalMulticluster& c3d) const; | ||
|
||
float sigmaZZ(const l1t::HGCalMulticluster& c3d) const; | ||
|
||
float sigmaEtaEtaTot(const l1t::HGCalMulticluster& c3d) const; | ||
float sigmaEtaEtaTot(const l1t::HGCalCluster& c2d) const; | ||
float sigmaEtaEtaMax(const l1t::HGCalMulticluster& c3d) const; | ||
|
||
float sigmaPhiPhiTot(const l1t::HGCalMulticluster& c3d) const; | ||
float sigmaPhiPhiTot(const l1t::HGCalCluster& c2d) const; | ||
float sigmaPhiPhiMax(const l1t::HGCalMulticluster& c3d) const; | ||
|
||
float sigmaRRTot(const l1t::HGCalMulticluster& c3d) const; | ||
float sigmaRRTot(const l1t::HGCalCluster& c2d) const; | ||
float sigmaRRMax(const l1t::HGCalMulticluster& c3d) const; | ||
float sigmaRRMean(const l1t::HGCalMulticluster& c3d, float radius=5.) const; | ||
|
||
private: | ||
|
||
float meanX(const std::vector<pair<float,float> >& energy_X_tc) const; | ||
float sigmaXX(const std::vector<pair<float,float> >& energy_X_tc, const float X_cluster) const; | ||
float sigmaPhiPhi(const std::vector<pair<float,float> >& energy_phi_tc, const float phi_cluster) const; | ||
|
||
static const int kLayersEE_=28; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. repeated hardcoding should definitely be avoided |
||
static const int kLayersFH_=12; | ||
static const int kLayersBH_=12; | ||
int HGC_layer(const uint32_t subdet, const uint32_t layer) const; | ||
|
||
|
||
}; | ||
|
||
|
||
#endif | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,10 @@ class HGCClusterAlgo : public Algorithm<FECODEC> | |
dRC2d, | ||
NNC2d | ||
}; | ||
enum MulticlusterType{ | ||
dRC3d, | ||
DBSCANC3d | ||
}; | ||
|
||
public: | ||
|
||
|
@@ -38,10 +42,10 @@ class HGCClusterAlgo : public Algorithm<FECODEC> | |
multicluster_product_( new l1t::HGCalMulticlusterBxCollection ), | ||
calibration_( conf.getParameterSet("calib_parameters") ), | ||
clustering_( conf.getParameterSet("C2d_parameters") ), | ||
multiclustering_( conf.getParameterSet("C3d_parameters" ) ) | ||
multiclustering_( conf.getParameterSet("C3d_parameters" ) ), | ||
triggercell_threshold_silicon_( conf.getParameter<double>("triggercell_threshold_silicon") ), | ||
triggercell_threshold_scintillator_( conf.getParameter<double>("triggercell_threshold_scintillator") ) | ||
{ | ||
clustering_threshold_silicon_ = conf.getParameterSet("C2d_parameters").getParameter<double>("clustering_threshold_silicon"); | ||
clustering_threshold_scintillator_ = conf.getParameterSet("C2d_parameters").getParameter<double>("clustering_threshold_scintillator"); | ||
std::string type(conf.getParameterSet("C2d_parameters").getParameter<std::string>("clusterType")); | ||
if(type=="dRC2d"){ | ||
clusteringAlgorithmType_ = dRC2d; | ||
|
@@ -52,6 +56,16 @@ class HGCClusterAlgo : public Algorithm<FECODEC> | |
<< "'. Using nearest neighbor NNC2d instead.\n"; | ||
clusteringAlgorithmType_ = NNC2d; | ||
} | ||
std::string typeMulticluster(conf.getParameterSet("C3d_parameters").getParameter<std::string>("type_multicluster")); | ||
if(typeMulticluster=="dRC3d"){ | ||
multiclusteringAlgoType_ = dRC3d; | ||
}else if(typeMulticluster=="DBSCANC3d"){ | ||
multiclusteringAlgoType_ = DBSCANC3d; | ||
}else { | ||
edm::LogWarning("ParameterError") << "Unknown Multiclustering type '" << typeMulticluster | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it would be better to throw an exception in this case? |
||
<< "'. Using Cone Algorithm instead.\n"; | ||
multiclusteringAlgoType_ = dRC3d; | ||
} | ||
|
||
} | ||
|
||
|
@@ -95,8 +109,9 @@ class HGCClusterAlgo : public Algorithm<FECODEC> | |
|
||
/* algorithm type */ | ||
ClusterType clusteringAlgorithmType_; | ||
double clustering_threshold_silicon_; | ||
double clustering_threshold_scintillator_; | ||
double triggercell_threshold_silicon_; | ||
double triggercell_threshold_scintillator_; | ||
MulticlusterType multiclusteringAlgoType_; | ||
}; | ||
|
||
|
||
|
@@ -122,8 +137,8 @@ void HGCClusterAlgo<FECODEC,DATA>::run(const l1t::HGCFETriggerDigiCollection & c | |
{ | ||
l1t::HGCalTriggerCell calibratedtriggercell( triggercell ); | ||
calibration_.calibrateInGeV( calibratedtriggercell); | ||
double clustering_threshold = (triggercell.subdetId()==HGCHEB ? clustering_threshold_scintillator_ : clustering_threshold_silicon_); | ||
if(calibratedtriggercell.mipPt()<clustering_threshold) continue; | ||
double triggercell_threshold = (triggercell.subdetId()==HGCHEB ? triggercell_threshold_scintillator_ : triggercell_threshold_silicon_); | ||
if(calibratedtriggercell.mipPt()<triggercell_threshold) continue; | ||
trgcell_product_->push_back( 0, calibratedtriggercell ); | ||
} | ||
|
||
|
@@ -169,12 +184,24 @@ void HGCClusterAlgo<FECODEC,DATA>::run(const l1t::HGCFETriggerDigiCollection & c | |
clustersPtrs.push_back(ptr); | ||
} | ||
|
||
/* call to multiclustering */ | ||
multiclustering_.clusterize( clustersPtrs, *multicluster_product_ ); | ||
/* call to multiclustering and compute shower shape*/ | ||
switch(multiclusteringAlgoType_){ | ||
case dRC3d : | ||
multiclustering_.clusterizeDR( clustersPtrs, *multicluster_product_, *triggerGeometry_); | ||
break; | ||
case DBSCANC3d: | ||
multiclustering_.clusterizeDBSCAN( clustersPtrs, *multicluster_product_, *triggerGeometry_); | ||
break; | ||
default: | ||
// Should not happen, clustering type checked in constructor | ||
break; | ||
} | ||
|
||
/* retrieve the orphan handle to the multiclusters collection and put the collection in the event */ | ||
multiclustersHandle = evt.put( std::move( multicluster_product_ ), "cluster3D"); | ||
|
||
|
||
|
||
} | ||
|
||
typedef HGCClusterAlgo<HGCalTriggerCellBestChoiceCodec, HGCalTriggerCellBestChoiceCodec::data_type> HGCClusterAlgoBestChoice; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the getters aren't prepended with "get_", the setters can omit the "set_" as well (not too important, but just for consistency)