|
@@ -29,6 +29,14 @@ struct {
|
|
|
Value<float>* sigma_z;
|
|
|
} bs;
|
|
|
|
|
|
+template <typename T>
|
|
|
+struct KinColl {
|
|
|
+ T* pt;
|
|
|
+ T* eta;
|
|
|
+ T* phi;
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
bool in_lum_region(const SimVertex& vertex) {
|
|
|
|
|
|
* sqrt(\simga_x^2 + \sigma_y^2) centered as beamspot position.
|
|
@@ -46,6 +54,11 @@ bool is_good_sim(const SimTrack& sim_track) {
|
|
|
return abs(sim_track.pdgId()) == 11 and in_lum_region(vertex);
|
|
|
};
|
|
|
|
|
|
+bool is_good_fake(const SimTrack& sim_track) {
|
|
|
+ const auto& vertex = sim_vertices[sim_track.parentVtxIdx()];
|
|
|
+ return abs(sim_track.pdgId()) != 11 and sim_track.q() != 0 and in_lum_region(vertex);
|
|
|
+};
|
|
|
+
|
|
|
bool is_good_seed(const Seed& seed, float hoe_cut) {
|
|
|
return seed.isECALDriven() and seed.hoe() < hoe_cut;
|
|
|
}
|
|
@@ -54,18 +67,20 @@ float reco_energy_rel_err(const SimTrack& sim_track, const Seed& seed) {
|
|
|
return (sim_track.pt() - seed.Et()) / sim_track.pt() ;
|
|
|
}
|
|
|
|
|
|
-bool reco_energy_consistent(const SimTrack& sim_track, const Seed& seed, float consistency_cut=0.1) {
|
|
|
- return fabs(reco_energy_rel_err(sim_track, seed)) < consistency_cut;
|
|
|
-}
|
|
|
-
|
|
|
float reco_energy_rel_err(const SimTrack& sim_track, const Track& track) {
|
|
|
return (sim_track.pt() - track.pt()) / sim_track.pt() ;
|
|
|
}
|
|
|
|
|
|
-bool reco_energy_consistent(const SimTrack& sim_track, const Track& track, float consistency_cut=0.1) {
|
|
|
+template<typename TrackOrSeed>
|
|
|
+bool reco_energy_consistent(const SimTrack& sim_track, const TrackOrSeed& track, float consistency_cut=0.1) {
|
|
|
return fabs(reco_energy_rel_err(sim_track, track)) < consistency_cut;
|
|
|
}
|
|
|
|
|
|
+double deltaR(const SimTrack& sim_track, const Track& gsf_track) {
|
|
|
+ return sqrt(pow(sim_track.eta() - gsf_track.eta(), 2.0) +
|
|
|
+ pow(sim_track.phi() - gsf_track.phi(), 2.0));
|
|
|
+}
|
|
|
+
|
|
|
void run(bool silent){
|
|
|
using namespace std;
|
|
|
using namespace fv;
|
|
@@ -76,7 +91,7 @@ void run(bool silent){
|
|
|
register_objects(tds);
|
|
|
|
|
|
|
|
|
- float hoe_cut = the_config->get("hoe_cut").as<float>(999);
|
|
|
+ auto hoe_cut = the_config->get("hoe_cut").as<float>(999);
|
|
|
|
|
|
bs = {
|
|
|
tds.track_branch<float>("bsp_x"),
|
|
@@ -91,7 +106,7 @@ void run(bool silent){
|
|
|
NoMatch = 0,
|
|
|
SeedMatched = 1,
|
|
|
TrackMatched = 2,
|
|
|
- SeedAndTrackMatched = 3
|
|
|
+ SeedAndTrackMatched = 3,
|
|
|
};
|
|
|
|
|
|
std::map<std::tuple<int, int>, ContainerTH2<float>*> residuals_dRz;
|
|
@@ -197,32 +212,31 @@ void run(bool silent){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- auto& seed_eff_v_pt = *tds.register_container<EfficiencyContainer<float>>("seed_eff_v_pt", THParams::lookup("eff_v_pt"));
|
|
|
- auto& seed_eff_v_eta = *tds.register_container<EfficiencyContainer<float>>("seed_eff_v_eta", THParams::lookup("eff_v_eta"));
|
|
|
- auto& seed_eff_v_phi = *tds.register_container<EfficiencyContainer<float>>("seed_eff_v_phi", THParams::lookup("eff_v_phi"));
|
|
|
- auto& seed_eff_v_eta_pt = *tds.register_container<EfficiencyContainer2D<float>>("seed_eff_v_eta_pt", THParams::lookup("eff_v_eta_pt"));
|
|
|
-
|
|
|
- auto& tracking_eff_v_pt = *tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_pt", THParams::lookup("eff_v_pt"));
|
|
|
- auto& tracking_eff_v_eta = *tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_eta", THParams::lookup("eff_v_eta"));
|
|
|
- auto& tracking_eff_v_phi = *tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_phi", THParams::lookup("eff_v_phi"));
|
|
|
- auto& tracking_eff_v_eta_pt = *tds.register_container<EfficiencyContainer2D<float>>("tracking_eff_v_eta_pt", THParams::lookup("eff_v_eta_pt"));
|
|
|
-
|
|
|
- auto& tracking_eff_v_pt2 = *tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_pt2", THParams::lookup("eff_v_pt"));
|
|
|
- auto& tracking_eff_v_eta2 = *tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_eta2", THParams::lookup("eff_v_eta"));
|
|
|
- auto& tracking_eff_v_phi2 = *tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_phi2", THParams::lookup("eff_v_phi"));
|
|
|
-
|
|
|
- auto& seed_pur_v_pt = *tds.register_container<EfficiencyContainer<float>>("seed_pur_v_pt", THParams::lookup("pur_v_pt"));
|
|
|
- auto& seed_pur_v_eta = *tds.register_container<EfficiencyContainer<float>>("seed_pur_v_eta", THParams::lookup("pur_v_eta"));
|
|
|
- auto& seed_pur_v_phi = *tds.register_container<EfficiencyContainer<float>>("seed_pur_v_phi", THParams::lookup("pur_v_phi"));
|
|
|
-
|
|
|
- auto& tracking_pur_v_pt = *tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_pt", THParams::lookup("pur_v_pt"));
|
|
|
- auto& tracking_pur_v_eta = *tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_eta", THParams::lookup("pur_v_eta"));
|
|
|
- auto& tracking_pur_v_phi = *tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_phi", THParams::lookup("pur_v_phi"));
|
|
|
-
|
|
|
- auto& tracking_pur_v_pt2 = *tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_pt2", THParams::lookup("pur_v_pt"));
|
|
|
- auto& tracking_pur_v_eta2 = *tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_eta2", THParams::lookup("pur_v_eta"));
|
|
|
- auto& tracking_pur_v_phi2 = *tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_phi2", THParams::lookup("pur_v_phi"));
|
|
|
-
|
|
|
+ KinColl<EfficiencyContainer<float>> seed_eff = {
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("seed_eff_v_pt", THParams::lookup("eff_v_pt")),
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("seed_eff_v_eta", THParams::lookup("eff_v_eta")),
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("seed_eff_v_phi", THParams::lookup("eff_v_phi"))};
|
|
|
+ KinColl<EfficiencyContainer<float>> seed_pur = {
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("seed_pur_v_pt", THParams::lookup("pur_v_pt")),
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("seed_pur_v_eta", THParams::lookup("pur_v_eta")),
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("seed_pur_v_phi", THParams::lookup("pur_v_phi"))};
|
|
|
+ KinColl<EfficiencyContainer<float>> tracking_eff = {
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_pt", THParams::lookup("eff_v_pt")),
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_eta", THParams::lookup("eff_v_eta")),
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_phi", THParams::lookup("eff_v_phi"))};
|
|
|
+ KinColl<EfficiencyContainer<float>> tracking_pur = {
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_pt", THParams::lookup("pur_v_pt")),
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_eta", THParams::lookup("pur_v_eta")),
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_phi", THParams::lookup("pur_v_phi"))};
|
|
|
+
|
|
|
+ KinColl<EfficiencyContainer<float>> tracking_eff_dR = {
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_pt_dR", THParams::lookup("eff_v_pt")),
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_eta_dR", THParams::lookup("eff_v_eta")),
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_phi_dR", THParams::lookup("eff_v_phi"))};
|
|
|
+ KinColl<EfficiencyContainer<float>> tracking_pur_dR = {
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_pt_dR", THParams::lookup("pur_v_pt")),
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_eta_dR", THParams::lookup("pur_v_eta")),
|
|
|
+ tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_phi_dR", THParams::lookup("pur_v_phi"))};
|
|
|
|
|
|
|
|
|
auto& hit_vs_layer_barrel = *tds.register_container<ContainerTH2<int>>("hit_vs_layer_barrel", THParams::lookup("hit_vs_layer"));
|
|
@@ -251,6 +265,7 @@ void run(bool silent){
|
|
|
for (const auto& sim_track : sim_tracks) {
|
|
|
if (!is_good_sim(sim_track)) continue;
|
|
|
if (seeds.size() == 0) continue;
|
|
|
+
|
|
|
bool matched = false;
|
|
|
for (const auto& seed_idx : sim_track.seedIdx()) {
|
|
|
const Seed& seed = seeds[seed_idx];
|
|
@@ -259,13 +274,12 @@ void run(bool silent){
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- seed_eff_v_eta_pt.fill(sim_track.eta(), sim_track.pt(), matched);
|
|
|
if (abs(sim_track.eta()) < 2.4)
|
|
|
- seed_eff_v_pt.fill(sim_track.pt(), matched);
|
|
|
+ seed_eff.pt->fill(sim_track.pt(), matched);
|
|
|
if (sim_track.pt() > 20.0)
|
|
|
- seed_eff_v_eta.fill(sim_track.eta(), matched);
|
|
|
+ seed_eff.eta->fill(sim_track.eta(), matched);
|
|
|
if (abs(sim_track.eta()) < 2.4 and sim_track.pt() > 20)
|
|
|
- seed_eff_v_phi.fill(sim_track.phi(), matched);
|
|
|
+ seed_eff.phi->fill(sim_track.phi(), matched);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -280,30 +294,29 @@ void run(bool silent){
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- tracking_eff_v_eta_pt.fill(sim_track.eta(), sim_track.pt(), matched);
|
|
|
if (abs(sim_track.eta()) < 2.4)
|
|
|
- tracking_eff_v_pt.fill(sim_track.pt(), matched);
|
|
|
+ tracking_eff.pt->fill(sim_track.pt(), matched);
|
|
|
if (sim_track.pt() > 20.0)
|
|
|
- tracking_eff_v_eta.fill(sim_track.eta(), matched);
|
|
|
+ tracking_eff.eta->fill(sim_track.eta(), matched);
|
|
|
if (abs(sim_track.eta()) < 2.4 and sim_track.pt() > 20)
|
|
|
- tracking_eff_v_phi.fill(sim_track.phi(), matched);
|
|
|
-
|
|
|
-
|
|
|
+ tracking_eff.phi->fill(sim_track.phi(), matched);
|
|
|
|
|
|
+
|
|
|
matched = false;
|
|
|
- for (const auto& seed_idx : sim_track.seedIdx()) {
|
|
|
- const Seed& seed = seeds[seed_idx];
|
|
|
- if (is_good_seed(seed, hoe_cut) and seed.trkIdx()>=0 and reco_energy_consistent(sim_track, seed)) {
|
|
|
- matched=true;
|
|
|
+ for (const auto& gsf_track : gsf_tracks) {
|
|
|
+ const Seed& seed = seeds[gsf_track.seedIdx()];
|
|
|
+ double dR = deltaR(sim_track, gsf_track);
|
|
|
+ if (is_good_seed(seed, hoe_cut) and dR < 0.2) {
|
|
|
+ matched = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if (abs(sim_track.eta()) < 2.4)
|
|
|
- tracking_eff_v_pt2.fill(sim_track.pt(), matched);
|
|
|
+ tracking_eff_dR.pt->fill(sim_track.pt(), matched);
|
|
|
if (sim_track.pt() > 20.0)
|
|
|
- tracking_eff_v_eta2.fill(sim_track.eta(), matched);
|
|
|
+ tracking_eff_dR.eta->fill(sim_track.eta(), matched);
|
|
|
if (abs(sim_track.eta()) < 2.4 and sim_track.pt() > 20)
|
|
|
- tracking_eff_v_phi2.fill(sim_track.phi(), matched);
|
|
|
+ tracking_eff_dR.phi->fill(sim_track.phi(), matched);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -317,11 +330,11 @@ void run(bool silent){
|
|
|
}
|
|
|
}
|
|
|
if (abs(seed.eta()) < 2.4)
|
|
|
- seed_pur_v_pt.fill(seed.pt(), match);
|
|
|
+ seed_pur.pt->fill(seed.pt(), match);
|
|
|
if (seed.pt() > 20)
|
|
|
- seed_pur_v_eta.fill(seed.eta(), match);
|
|
|
+ seed_pur.eta->fill(seed.eta(), match);
|
|
|
if (abs(seed.eta()) < 2.4 and seed.pt() > 20)
|
|
|
- seed_pur_v_phi.fill(seed.phi(), match);
|
|
|
+ seed_pur.phi->fill(seed.phi(), match);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -329,33 +342,36 @@ void run(bool silent){
|
|
|
gsf_tracks_nmatch_sim_tracks.fill(gsf_track.simTrkIdx().size());
|
|
|
const Seed& seed = seeds[gsf_track.seedIdx()];
|
|
|
if (!is_good_seed(seed, hoe_cut)) continue;
|
|
|
- bool match = false;
|
|
|
+ bool matched = false;
|
|
|
for (const auto& sim_track_idx : gsf_track.simTrkIdx()) {
|
|
|
if (is_good_sim(sim_tracks[sim_track_idx])) {
|
|
|
- match = true;
|
|
|
+ matched = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if (abs(gsf_track.eta()) < 2.4)
|
|
|
- tracking_pur_v_pt.fill(gsf_track.pt(), match);
|
|
|
+ tracking_pur.pt->fill(gsf_track.pt(), matched);
|
|
|
if (gsf_track.pt() > 20)
|
|
|
- tracking_pur_v_eta.fill(gsf_track.eta(), match);
|
|
|
+ tracking_pur.eta->fill(gsf_track.eta(), matched);
|
|
|
if (abs(gsf_track.eta()) < 2.4 and gsf_track.pt() > 20)
|
|
|
- tracking_pur_v_phi.fill(gsf_track.phi(), match);
|
|
|
+ tracking_pur.phi->fill(gsf_track.phi(), matched);
|
|
|
|
|
|
- match = false;
|
|
|
- for (const auto& sim_track_idx : seed.simTrkIdx()) {
|
|
|
- if (is_good_sim(sim_tracks[sim_track_idx])) {
|
|
|
- match = true;
|
|
|
+
|
|
|
+
|
|
|
+ matched = false;
|
|
|
+ for (const auto& sim_track : sim_tracks) {
|
|
|
+ double dR = deltaR(sim_track, gsf_track);
|
|
|
+ if (is_good_sim(sim_track) and dR < 0.2) {
|
|
|
+ matched = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if (abs(gsf_track.eta()) < 2.4)
|
|
|
- tracking_pur_v_pt2.fill(gsf_track.pt(), match);
|
|
|
- if (gsf_track.pt() > 20)
|
|
|
- tracking_pur_v_eta2.fill(gsf_track.eta(), match);
|
|
|
+ tracking_pur_dR.pt->fill(gsf_track.pt(), matched);
|
|
|
+ if (gsf_track.pt() > 20.0)
|
|
|
+ tracking_pur_dR.eta->fill(gsf_track.eta(), matched);
|
|
|
if (abs(gsf_track.eta()) < 2.4 and gsf_track.pt() > 20)
|
|
|
- tracking_pur_v_phi2.fill(gsf_track.phi(), match);
|
|
|
+ tracking_pur_dR.phi->fill(gsf_track.phi(), matched);
|
|
|
}
|
|
|
|
|
|
|