|
|
Go to the documentation of this file.
20 #include <unordered_map>
31 timeOffset_(conf.getParameter<double>(
"timeOffset")),
49 const std::vector<bool>&,
50 const std::vector<bool>&,
77 #define LOGVERB(x) edm::LogVerbatim(x)
78 #define LOGWARN(x) edm::LogWarning(x)
79 #define LOGERR(x) edm::LogError(x)
80 #define LOGDRESSED(x) edm::LogInfo(x)
82 #define LOGVERB(x) LogTrace(x)
83 #define LOGWARN(x) edm::LogWarning(x)
84 #define LOGERR(x) edm::LogError(x)
85 #define LOGDRESSED(x) LogDebug(x)
90 inline bool isPi0(
int pdgId) {
return pdgId == 111; }
92 inline bool isEGamma(
int pdgId) {
97 inline bool isHadron(
int pdgId) {
108 const std::vector<bool>& rechitMask,
109 const std::vector<bool>& seedable,
118 std::unordered_map<uint32_t, size_t> detIdToIndex(
hits.size());
119 for (uint32_t
i = 0;
i <
hits.size(); ++
i) {
120 detIdToIndex[
hits[
i].detId()] =
i;
129 for (
unsigned int ic = 0; ic < simClusters.size(); ++ic) {
130 const auto& sc = simClusters[ic];
131 const auto& hitsAndFractions = sc.hits_and_fractions();
132 for (
const auto& hAndF : hitsAndFractions) {
133 auto itr = detIdToIndex.find(hAndF.first);
134 if (itr == detIdToIndex.end()) {
137 auto hitId = itr->second;
140 float associatedEnergy =
fraction * ref->energy();
152 unsigned int nClusters = realisticClusters.size();
156 for (
unsigned ic = 0; ic <
nClusters; ++ic) {
157 float highest_energy = 0.0f;
161 float energyCorrection = 1.f;
162 float timeRealisticSC = -99.;
163 if (realisticClusters[ic].isVisible()) {
164 int pdgId = simClusters[ic].pdgId();
169 unsigned int etabin = std::floor(((abseta -
calibMinEta_) * egamma_bin_norm));
171 }
else if (isHadron(
pdgId) and !(isPi0(
pdgId)) and
175 unsigned int etabin = std::floor(((abseta -
calibMinEta_) * hadron_bin_norm));
179 std::vector<float> timeHits;
180 const auto& hitsIdsAndFractions = realisticClusters[ic].hitsIdsAndFractions();
181 for (
const auto& idAndF : hitsIdsAndFractions) {
186 const float hit_energy =
fraction * ref->energy();
187 if (hit_energy > highest_energy || highest_energy == 0.0) {
188 highest_energy = hit_energy;
192 if (ref->time() > -1.) {
194 std::array<float, 3> scPosition = realisticClusters[ic].getCenterOfGravity(rhLayer);
195 float distanceSquared =
196 std::pow((ref->position().x() - scPosition[0]), 2) +
std::pow((ref->position().y() - scPosition[1]), 2);
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
edm::Handle< SimClusterCollection > simClusterH_
const bool maxDistanceFilter_
~RealisticSimClusterMapper() override
void setSeed(const DetId &id)
std::vector< SimCluster > SimClusterCollection
void setTime(float time, float timeError=0)
static const std::string input
void findCentersOfGravity()
std::vector< double > hadronCalib_
Fraction of a PFRecHit (rechits can be shared between several PFCluster's)
void update(const edm::EventSetup &) final
void setCorrectedEnergy(double cenergy)
std::vector< double > egammaCalib_
edm::EDGetTokenT< SimClusterCollection > simClusterToken_
void buildClusters(const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, const std::vector< bool > &, reco::PFClusterCollection &) override
reco::PFRecHitRef makeRefhit(const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
std::pair< float, float > fixSizeHighestDensity(std::vector< float > &time, std::vector< float > weight=std::vector< float >(), unsigned int minNhits=3, float deltaT=0.210, float timeWidthBy=0.5)
void insertLayerId(unsigned int layerId, unsigned int hitIndex)
RealisticSimClusterMapper(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
void insertHitPosition(float x, float y, float z, unsigned int hitIndex)
#define DEFINE_EDM_PLUGIN(factory, type, name)
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
double getEnergy(HBHERecHitCollection::const_iterator hit, int useRaw=0, bool debug=false)
const std::vector< RealisticCluster > & realisticClusters() const
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
void updateEvent(const edm::Event &) final
const unsigned int minNHitsforTiming_
void computeAssociation(float exclusiveFraction, bool useMCFractionsForExclEnergy, unsigned int fhOffset, unsigned int bhOffset)
void init(std::size_t numberOfHits, std::size_t numberOfSimClusters, std::size_t numberOfLayers)
const bool useMCFractionsForExclEnergy_
const float maxDforTimingSquared_
bool getData(T &iHolder) const
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
void setEnergy(double energy)
const float exclusiveFraction_
void insertSimClusterIdAndFraction(unsigned int scIdx, float fraction, unsigned int hitIndex, float associatedEnergy)
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void insertHitEnergy(float energy, unsigned int hitIndex)
void findAndMergeInvisibleClusters(float invisibleFraction, float exclusiveFraction)
Power< A, B >::type pow(const A &a, const B &b)
RealisticSimClusterMapper & operator=(const RealisticSimClusterMapper &)=delete
Abs< T >::type abs(const T &t)
hgcal::RecHitTools rhtools_
const map< TString, int > numberOfLayers(TString Year="2018")
void filterHitsByDistance(float maxDistance)
const float invisibleFraction_