194 const std::vector<CaloParticle>&
caloParticles = *caloParticleHandle;
203 std::map<DetId, const HGCRecHit*> hitmap;
209 for (
unsigned int i = 0;
i < rechitsEE.size(); ++
i) {
210 hitmap[rechitsEE[
i].detid()] = &rechitsEE[
i];
212 for (
unsigned int i = 0;
i < rechitsFH.size(); ++
i) {
213 hitmap[rechitsFH[
i].detid()] = &rechitsFH[
i];
215 for (
unsigned int i = 0;
i < rechitsBH.size(); ++
i) {
216 hitmap[rechitsBH[
i].detid()] = &rechitsBH[
i];
222 for (
unsigned int i = 0;
i < rechitsEE.
size();
i++) {
223 hitmap[rechitsEE[
i].detid()] = &rechitsEE[
i];
230 for (
unsigned int i = 0;
i < rechitsFH.size();
i++) {
231 hitmap[rechitsFH[
i].detid()] = &rechitsFH[
i];
233 for (
unsigned int i = 0;
i < rechitsBH.size();
i++) {
234 hitmap[rechitsBH[
i].detid()] = &rechitsBH[
i];
245 float seedEnergy = 0.;
248 if (it_caloPart.g4Tracks()[0].eventId().event() != 0
or it_caloPart.g4Tracks()[0].eventId().bunchCrossing() != 0) {
249 LogDebug(
"HGCalHitCalibration") <<
"Excluding CaloParticles from event: " 250 << it_caloPart.g4Tracks()[0].eventId().event()
251 <<
" with BX: " << it_caloPart.g4Tracks()[0].eventId().bunchCrossing()
262 for (
const auto& it_sc : simClusterRefVector) {
265 <<
">>> SC.energy(): " << simCluster.
energy() <<
" SC.simEnergy(): " << simCluster.
simEnergy() << std::endl;
266 const std::vector<std::pair<uint32_t, float> >& hits_and_fractions = simCluster.
hits_and_fractions();
269 for (
const auto& it_haf : hits_and_fractions) {
271 DetId hitid = (it_haf.first);
276 fillWithRecHits(hitmap, hitid, hitlayer, it_haf.second, seedDet, seedEnergy);
281 auto sumCalibRecHitCalib_fraction =
284 <<
">>> MC Energy: " << it_caloPart.energy() <<
" reco energy: " << sumCalibRecHitCalib_fraction << std::endl;
289 const auto&
clusters = *hgcalMultiClustersHandle;
290 float total_energy = 0.;
291 float max_dR2 = 0.0025;
296 auto ERatio_a =
a.correctedEnergy() / it_caloPart.energy();
297 auto ERatio_b =
b.correctedEnergy() / it_caloPart.energy();
300 if (dR2_a < max_dR2 && dR2_b < max_dR2)
301 return ERatio_a > ERatio_b;
302 return dR2_a < dR2_b;
305 total_energy =
closest->correctedEnergy();
315 auto closest_fcn = [&](
auto const&
a,
auto const&
b) {
318 auto ERatio_a =
a.energy() / it_caloPart.energy();
319 auto ERatio_b =
b.energy() / it_caloPart.energy();
322 if (dR2_a < max_dR2 && dR2_b < max_dR2)
323 return ERatio_a > ERatio_b;
324 return dR2_a < dR2_b;
327 if (PFElectronHandle.
isValid()) {
328 auto const& ele = (*PFElectronHandle);
329 auto closest = std::min_element(ele.begin(), ele.end(), closest_fcn);
346 if (PFPhotonHandle.
isValid()) {
347 auto const&
photon = (*PFPhotonHandle);
edm::EDGetTokenT< std::vector< CaloParticle > > caloParticles_
static constexpr int scint_
edm::EDGetTokenT< std::vector< reco::Photon > > photons_
std::array< float, layers_ > Energy_layer_calib_fraction_
edm::EDGetTokenT< std::vector< reco::PFCluster > > hgcalMultiClusters_
std::map< int, MonitorElement * > hgcal_EoP_CPene_calib_fraction_
edm::EDGetTokenT< HGCRecHitCollection > recHitsFH_
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
edm::EDGetTokenT< HGCRecHitCollection > recHitsEE_
#define IfLogTrace(cond, cat)
std::map< int, MonitorElement * > hgcal_ele_EoP_CPene_calib_fraction_
int closest(std::vector< int > const &vec, int value)
constexpr Detector det() const
get the detector field from this detid
std::map< int, MonitorElement * > hgcal_photon_EoP_CPene_calib_fraction_
std::vector< std::pair< uint32_t, float > > hits_and_fractions() const
Returns list of rechit IDs and fractions for this SimCluster.
float simEnergy() const
returns the accumulated sim energy in the cluster
edm::EDGetTokenT< HGCRecHitCollection > recHitsBH_
Monte Carlo truth information used for tracking validation.
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
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 fillWithRecHits(std::map< DetId, const HGCRecHit *> &, DetId, unsigned int, float, int &, float &)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
hgcal::RecHitTools recHitTools_
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
edm::EDGetTokenT< std::vector< reco::GsfElectron > > electrons_
std::map< int, MonitorElement * > h_EoP_CPene_calib_fraction_
float energy() const
Energy. Note this is taken from the first SimTrack only.
std::array< float, layers_ > Energy_layer_calib_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_