196 const std::vector<CaloParticle>&
caloParticles = *caloParticleHandle;
208 std::map<DetId, const HGCRecHit*> hitmap;
214 const auto& rechitsEE = *recHitHandleEE;
215 const auto& rechitsFH = *recHitHandleFH;
216 const auto& rechitsBH = *recHitHandleBH;
217 for (
unsigned int i = 0;
i < rechitsEE.size(); ++
i) {
218 hitmap[rechitsEE[
i].detid()] = &rechitsEE[
i];
220 for (
unsigned int i = 0;
i < rechitsFH.size(); ++
i) {
221 hitmap[rechitsFH[
i].detid()] = &rechitsFH[
i];
223 for (
unsigned int i = 0;
i < rechitsBH.size(); ++
i) {
224 hitmap[rechitsBH[
i].detid()] = &rechitsBH[
i];
231 for (
unsigned int i = 0;
i < rechitsEE.
size();
i++) {
232 hitmap[rechitsEE[
i].detid()] = &rechitsEE[
i];
239 const auto& rechitsFH = *recHitHandleFH;
240 const auto& rechitsBH = *recHitHandleBH;
241 for (
unsigned int i = 0;
i < rechitsFH.size();
i++) {
242 hitmap[rechitsFH[
i].detid()] = &rechitsFH[
i];
244 for (
unsigned int i = 0;
i < rechitsBH.size();
i++) {
245 hitmap[rechitsBH[
i].detid()] = &rechitsBH[
i];
256 float seedEnergy = 0.;
258 <<
"Number of caloParticles: " << caloParticles.size() << std::endl;
259 for (
const auto& it_caloPart : caloParticles) {
266 for (
const auto& it_sc : simClusterRefVector) {
269 <<
">>> SC.energy(): " << simCluster.
energy()
270 <<
" SC.simEnergy(): " << simCluster.
simEnergy()
272 const std::vector<std::pair<uint32_t, float> >& hits_and_fractions =
276 for (
const auto& it_haf : hits_and_fractions) {
278 DetId hitid = (it_haf.first);
294 <<
">>> MC Energy: " << it_caloPart.energy()
295 <<
" reco energy: " << sumCalibRecHitCalib_fraction
299 it_caloPart.energy());
302 const auto&
clusters = *hgcalMultiClustersHandle;
303 float total_energy = 0.;
304 float max_dR2 = 0.0025;
305 auto closest = std::min_element(
clusters.begin(),
312 auto ERatio_b =
b.correctedEnergy()/it_caloPart.energy();
315 if (dR2_a < max_dR2 && dR2_b < max_dR2)
316 return ERatio_a > ERatio_b;
317 return dR2_a < dR2_b;
321 total_energy = closest->correctedEnergy();
325 it_caloPart.energy());
329 auto closest_fcn = [&](
auto const &
a,
auto const&
b){
332 auto ERatio_a = a.
energy()/it_caloPart.energy();
333 auto ERatio_b =
b.energy()/it_caloPart.energy();
336 if (dR2_a < max_dR2 && dR2_b < max_dR2)
337 return ERatio_a > ERatio_b;
338 return dR2_a < dR2_b;
341 if (PFElectronHandle.
isValid()) {
342 auto const & ele = (*PFElectronHandle);
343 auto closest = std::min_element(ele.begin(),
346 if (closest != ele.end()
347 && closest->superCluster()->seed()->seed().det() ==
DetId::Forward 352 it_caloPart.energy());
358 if (PFPhotonHandle.
isValid()) {
359 auto const &
photon = (*PFPhotonHandle);
360 auto closest = std::min_element(
photon.begin(),
363 if (closest !=
photon.end()
364 && closest->superCluster()->seed()->seed().det() ==
DetId::Forward 369 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