189 const std::vector<CaloParticle>&
caloParticles = *caloParticleHandle;
201 std::map<DetId, const HGCRecHit*> hitmap;
207 const auto& rechitsEE = *recHitHandleEE;
208 const auto& rechitsFH = *recHitHandleFH;
209 const auto& rechitsBH = *recHitHandleBH;
210 for (
unsigned int i = 0;
i < rechitsEE.size(); ++
i) {
211 hitmap[rechitsEE[
i].detid()] = &rechitsEE[
i];
213 for (
unsigned int i = 0;
i < rechitsFH.size(); ++
i) {
214 hitmap[rechitsFH[
i].detid()] = &rechitsFH[
i];
216 for (
unsigned int i = 0;
i < rechitsBH.size(); ++
i) {
217 hitmap[rechitsBH[
i].detid()] = &rechitsBH[
i];
224 for (
unsigned int i = 0;
i < rechitsEE.
size();
i++) {
225 hitmap[rechitsEE[
i].detid()] = &rechitsEE[
i];
232 const auto& rechitsFH = *recHitHandleFH;
233 const auto& rechitsBH = *recHitHandleBH;
234 for (
unsigned int i = 0;
i < rechitsFH.size();
i++) {
235 hitmap[rechitsFH[
i].detid()] = &rechitsFH[
i];
237 for (
unsigned int i = 0;
i < rechitsBH.size();
i++) {
238 hitmap[rechitsBH[
i].detid()] = &rechitsBH[
i];
249 float seedEnergy = 0.;
251 <<
"Number of caloParticles: " << caloParticles.size() << std::endl;
252 for (
const auto& it_caloPart : caloParticles) {
259 for (
const auto& it_sc : simClusterRefVector) {
262 <<
">>> SC.energy(): " << simCluster.
energy()
263 <<
" SC.simEnergy(): " << simCluster.
simEnergy()
265 const std::vector<std::pair<uint32_t, float> >& hits_and_fractions =
269 for (
const auto& it_haf : hits_and_fractions) {
271 DetId hitid = (it_haf.first);
287 <<
">>> MC Energy: " << it_caloPart.energy()
288 <<
" reco energy: " << sumCalibRecHitCalib_fraction
292 it_caloPart.energy());
295 const auto&
clusters = *hgcalMultiClustersHandle;
296 float total_energy = 0.;
297 float max_dR2 = 0.0025;
298 auto closest = std::min_element(
clusters.begin(),
305 auto ERatio_b =
b.correctedEnergy()/it_caloPart.energy();
308 if (dR2_a < max_dR2 && dR2_b < max_dR2)
309 return ERatio_a > ERatio_b;
310 return dR2_a < dR2_b;
314 total_energy = closest->correctedEnergy();
318 it_caloPart.energy());
322 auto closest_fcn = [&](
auto const &
a,
auto const&
b){
325 auto ERatio_a = a.
energy()/it_caloPart.energy();
326 auto ERatio_b =
b.energy()/it_caloPart.energy();
329 if (dR2_a < max_dR2 && dR2_b < max_dR2)
330 return ERatio_a > ERatio_b;
331 return dR2_a < dR2_b;
334 if (PFElectronHandle.
isValid()) {
335 auto const & ele = (*PFElectronHandle);
336 auto closest = std::min_element(ele.begin(),
339 if (closest != ele.end()
340 && closest->superCluster()->seed()->seed().det() ==
DetId::Forward 345 it_caloPart.energy());
351 if (PFPhotonHandle.
isValid()) {
352 auto const &
photon = (*PFPhotonHandle);
353 auto closest = std::min_element(
photon.begin(),
356 if (closest !=
photon.end()
357 && closest->superCluster()->seed()->seed().det() ==
DetId::Forward 362 it_caloPart.energy());
edm::EDGetTokenT< std::vector< CaloParticle > > caloParticles_
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_
double correctedEnergy() const
edm::EDGetTokenT< HGCRecHitCollection > recHitsFH_
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
edm::EDGetTokenT< HGCRecHitCollection > recHitsEE_
std::vector< std::pair< uint32_t, float > > hits_and_fractions() const
Returns list of rechit IDs and fractions for this SimCluster.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::map< int, MonitorElement * > hgcal_ele_EoP_CPene_calib_fraction_
#define IfLogTrace(cond, cat)
std::map< int, MonitorElement * > hgcal_photon_EoP_CPene_calib_fraction_
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
float energy() const
Energy. Note this is taken from the first SimTrack only.
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
double energy() const
cluster energy
hgcal::RecHitTools recHitTools_
float simEnergy() const
returns the accumulated sim energy in the cluster
edm::EDGetTokenT< std::vector< reco::GsfElectron > > electrons_
std::map< int, MonitorElement * > h_EoP_CPene_calib_fraction_
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
void fillWithRecHits(std::map< DetId, const HGCRecHit * > &, DetId, unsigned int, float, int &, float &)
std::array< float, layers_ > Energy_layer_calib_
Detector det() const
get the detector field from this detid