6 #include <unordered_map> 18 #define LOGVERB(x) edm::LogVerbatim(x) 19 #define LOGWARN(x) edm::LogWarning(x) 20 #define LOGERR(x) edm::LogError(x) 21 #define LOGDRESSED(x) edm::LogInfo(x) 23 #define LOGVERB(x) LogTrace(x) 24 #define LOGWARN(x) edm::LogWarning(x) 25 #define LOGERR(x) edm::LogError(x) 26 #define LOGDRESSED(x) LogDebug(x) 38 bool isEGamma(
int pdgId)
41 return (pdgId == 11)
or (pdgId == 22);
45 bool isHadron(
int pdgId)
48 return ((pdgId > 100 and pdgId < 900)
or 49 (pdgId > 1000 and pdgId < 9000));
64 const std::vector<bool>& rechitMask,
const std::vector<bool>& seedable,
71 realisticAssociator.
init(
hits.size(), simClusters.size(), numberOfLayers + 1);
73 std::unordered_map < uint32_t, size_t > detIdToIndex(
hits.size());
74 for (uint32_t
i = 0;
i <
hits.size(); ++
i)
76 detIdToIndex[
hits[
i].detId()] =
i;
86 for (
unsigned int ic = 0; ic < simClusters.size(); ++ic)
88 const auto &
sc = simClusters[ic];
90 for (
const auto& hAndF : hitsAndFractions)
92 auto itr = detIdToIndex.find(hAndF.first);
93 if (itr == detIdToIndex.end())
97 auto hitId = itr->second;
100 float associatedEnergy = fraction * ref->energy();
113 unsigned int nClusters = realisticClusters.size();
117 for (
unsigned ic = 0; ic < nClusters; ++ic)
119 float highest_energy = 0.0f;
120 output.emplace_back();
123 float energyCorrection = 1.f;
124 float timeRealisticSC = -99.;
125 if (realisticClusters[ic].isVisible())
127 int pdgId = simClusters[ic].pdgId();
133 unsigned int etabin = std::floor(
137 else if (isHadron(pdgId) and !(isPi0(pdgId)) and !
hadronCalib_.empty())
139 unsigned int etabin = std::floor(
145 std::vector<float> timeHits;
146 const auto& hitsIdsAndFractions = realisticClusters[ic].hitsIdsAndFractions();
147 for (
const auto& idAndF : hitsIdsAndFractions)
154 const float hit_energy =
fraction * ref->energy();
155 if (hit_energy > highest_energy || highest_energy == 0.0)
157 highest_energy = hit_energy;
161 if(ref->time() > -1. ){
163 std::array<float,3> scPosition = realisticClusters[ic].getCenterOfGravity(rhLayer);
164 float distanceSquared =
std::pow((ref->position().x() - scPosition[0]),2) +
std::pow((ref->position().y() - scPosition[1]),2);
float fixSizeHighestDensity(std::vector< float > &t, float deltaT=0.210, float timeWidthBy=0.5)
void insertLayerId(unsigned int layerId, unsigned int hitIndex)
const unsigned int minNHitsforTiming_
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
void buildClusters(const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, const std::vector< bool > &, reco::PFClusterCollection &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double getEnergy(HBHERecHitCollection::const_iterator hit, int useRaw=0, bool debug=false)
void setTime(float time, float timeError=0)
Fraction of a PFRecHit (rechits can be shared between several PFCluster's)
void setEnergy(double energy)
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
const float exclusiveFraction_
static std::string const input
void setSeed(const DetId &id)
reco::PFRecHitRef makeRefhit(const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
hgcal::RecHitTools rhtools_
void init(std::size_t numberOfHits, std::size_t numberOfSimClusters, std::size_t numberOfLayers)
void setCorrectedEnergy(double cenergy)
const float invisibleFraction_
void insertSimClusterIdAndFraction(unsigned int scIdx, float fraction, unsigned int hitIndex, float associatedEnergy)
void computeAssociation(float exclusiveFraction, bool useMCFractionsForExclEnergy, unsigned int fhOffset, unsigned int bhOffset)
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
Abs< T >::type abs(const T &t)
void findAndMergeInvisibleClusters(float invisibleFraction, float exclusiveFraction)
void insertHitPosition(float x, float y, float z, unsigned int hitIndex)
const bool useMCFractionsForExclEnergy_
void update(const edm::EventSetup &) final
edm::EDGetTokenT< SimClusterCollection > simClusterToken_
void insertHitEnergy(float energy, unsigned int hitIndex)
std::vector< double > egammaCalib_
const bool maxDistanceFilter_
void updateEvent(const edm::Event &) final
const std::vector< RealisticCluster > & realisticClusters() const
void findCentersOfGravity()
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
std::vector< double > hadronCalib_
const float maxDforTimingSquared_
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
void filterHitsByDistance(float maxDistance)
edm::Handle< SimClusterCollection > simClusterH_
std::vector< SimCluster > SimClusterCollection
Power< A, B >::type pow(const A &a, const B &b)
std::vector< std::pair< uint32_t, float > > hits_and_fractions() const
Returns list of rechit IDs and fractions for this SimCluster.