|
@@ -19,6 +19,8 @@ SimVertexCollection sim_vertices;
|
|
|
TrackCollection gsf_tracks;
|
|
|
SuperClusterCollection scls;
|
|
|
|
|
|
+std::vector<SimTrack> sim_els;
|
|
|
+
|
|
|
void register_objects(TrackingDataSet& tds){
|
|
|
seeds.init(&tds);
|
|
|
sim_tracks.init(&tds);
|
|
@@ -58,15 +60,10 @@ bool in_lum_region(const SimVertex& vertex) {
|
|
|
bool is_good_sim(const SimTrack& sim_track) {
|
|
|
const auto& vertex = sim_vertices[sim_track.parentVtxIdx()];
|
|
|
return abs(sim_track.pdgId()) == 11 and
|
|
|
- in_lum_region(vertex) and
|
|
|
- abs(sim_track.eta())<3.0;
|
|
|
+ in_lum_region(vertex) and
|
|
|
+ abs(sim_track.eta())<3.0;
|
|
|
};
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
bool is_good_seed(const Seed& seed, float hoe_cut) {
|
|
|
return seed.isECALDriven() and seed.hoe() < hoe_cut;
|
|
|
}
|
|
@@ -98,6 +95,13 @@ double deltaR(const SimTrack& sim_track, const Track& gsf_track) {
|
|
|
pow(sim_track.phi() - gsf_track.phi(), 2.0));
|
|
|
}
|
|
|
|
|
|
+void update_sim_els() {
|
|
|
+ sim_els.clear();
|
|
|
+ for (const SimTrack sim_track: sim_tracks) {
|
|
|
+ if (is_good_sim(sim_track)) sim_els.push_back(sim_track);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
auto get_match_stats(bool dRMatch) {
|
|
|
int nSimTrack = 0;
|
|
@@ -112,16 +116,15 @@ auto get_match_stats(bool dRMatch) {
|
|
|
vector<float> matched_dpT;
|
|
|
std::map<int, std::vector<int>> sim_matches;
|
|
|
std::map<int, std::vector<int>> gsf_matches;
|
|
|
- for(const auto& sim_track : sim_tracks)
|
|
|
- if (is_good_sim(sim_track)) sim_matches[sim_track.idx] = {};
|
|
|
+ for(const auto& sim_track : sim_els)
|
|
|
+ sim_matches[sim_track.idx] = {};
|
|
|
for(const auto& gsf_track : gsf_tracks)
|
|
|
gsf_matches[gsf_track.idx] = {};
|
|
|
|
|
|
nSimTrack = sim_matches.size();
|
|
|
nGSFTrack = gsf_matches.size();
|
|
|
|
|
|
- for (const auto& sim_track : sim_tracks) {
|
|
|
- if (!is_good_sim(sim_track)) continue;
|
|
|
+ for (const auto& sim_track : sim_els) {
|
|
|
if (dRMatch) {
|
|
|
for (const auto& gsf_track : gsf_tracks) {
|
|
|
float dR = deltaR(sim_track, gsf_track);
|
|
@@ -291,6 +294,27 @@ void run(){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ KinColl<ContainerTH1<float>> good_sim_kinems = {
|
|
|
+ tds.register_container<ContainerTH1<float>>("good_sim_v_pt", THParams::lookup("pt")),
|
|
|
+ tds.register_container<ContainerTH1<float>>("good_sim_v_eta", THParams::lookup("eta")),
|
|
|
+ tds.register_container<ContainerTH1<float>>("good_sim_v_phi", THParams::lookup("phi"))};
|
|
|
+
|
|
|
+ KinColl<ContainerTH1<float>> gsf_kinems = {
|
|
|
+ tds.register_container<ContainerTH1<float>>("gsf_track_v_pt", THParams::lookup("pt")),
|
|
|
+ tds.register_container<ContainerTH1<float>>("gsf_track_v_eta", THParams::lookup("eta")),
|
|
|
+ tds.register_container<ContainerTH1<float>>("gsf_track_v_phi", THParams::lookup("phi"))};
|
|
|
+
|
|
|
+ KinColl<ContainerTH1<float>> seed_kinems = {
|
|
|
+ tds.register_container<ContainerTH1<float>>("seed_v_pt", THParams::lookup("pt")),
|
|
|
+ tds.register_container<ContainerTH1<float>>("seed_v_eta", THParams::lookup("eta")),
|
|
|
+ tds.register_container<ContainerTH1<float>>("seed_v_phi", THParams::lookup("phi"))};
|
|
|
+
|
|
|
+ KinColl<ContainerTH1<float>> scl_kinems = {
|
|
|
+ tds.register_container<ContainerTH1<float>>("scl_v_pt", THParams::lookup("pt")),
|
|
|
+ tds.register_container<ContainerTH1<float>>("scl_v_eta", THParams::lookup("eta")),
|
|
|
+ tds.register_container<ContainerTH1<float>>("scl_v_phi", THParams::lookup("phi"))};
|
|
|
+
|
|
|
+
|
|
|
KinColl<EfficiencyContainer<float>> seed_eff = {
|
|
|
tds.register_container<EfficiencyContainer<float>>("seed_eff_v_pt", THParams::lookup("pt")),
|
|
|
tds.register_container<EfficiencyContainer<float>>("seed_eff_v_eta", THParams::lookup("eta")),
|
|
@@ -341,6 +365,7 @@ void run(){
|
|
|
auto& ecal_energy_resolution = *tds.register_container<ContainerTH1<float>>("ecal_energy_resolution ", THParams::lookup("ecal_energy_resolution"));
|
|
|
|
|
|
auto& n_seeds = *tds.register_container<ContainerTH1<size_t>>("n_seeds", THParams::lookup("n_seeds"));
|
|
|
+ auto& n_good_seeds = *tds.register_container<ContainerTH1<size_t>>("n_good_seeds", THParams::lookup("n_seeds"));
|
|
|
auto& n_good_sim = *tds.register_container<ContainerTH1<int>>("n_good_sim", THParams::lookup("n_seeds"));
|
|
|
auto& n_gsf_tracks = *tds.register_container<ContainerTH1<int>>("n_gsf_track", THParams::lookup("n_seeds"));
|
|
|
|
|
@@ -372,9 +397,43 @@ void run(){
|
|
|
auto& reco_eta = *tds.register_container<ContainerTH1<float>>("reco_eta", THParams::lookup("eta_fine"));
|
|
|
auto& reco_phi = *tds.register_container<ContainerTH1<float>>("reco_phi", THParams::lookup("phi_fine"));
|
|
|
|
|
|
+
|
|
|
+ auto& tm_corr = *tds.register_container<ContainerTH2<int>>("tm_corr", THParams(2, -0.5, 1.5, 2, -0.5, 1.5));
|
|
|
+
|
|
|
while (tds.next()) {
|
|
|
|
|
|
+ update_sim_els();
|
|
|
+
|
|
|
n_seeds.fill(seeds.size());
|
|
|
+ size_t _n_good_seeds = 0;
|
|
|
+ for (const auto& seed : seeds) {
|
|
|
+ if (is_good_seed(seed, hoe_cut)) {
|
|
|
+ _n_good_seeds++;
|
|
|
+ seed_kinems.pt->fill(seed.pt());
|
|
|
+ seed_kinems.eta->fill(seed.eta());
|
|
|
+ seed_kinems.phi->fill(seed.phi());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ n_good_seeds.fill(_n_good_seeds);
|
|
|
+
|
|
|
+ for (const auto& sim_track : sim_els) {
|
|
|
+ good_sim_kinems.pt->fill(sim_track.pt());
|
|
|
+ good_sim_kinems.eta->fill(sim_track.eta());
|
|
|
+ good_sim_kinems.phi->fill(sim_track.phi());
|
|
|
+ }
|
|
|
+
|
|
|
+ for (const auto& gsf_track : gsf_tracks) {
|
|
|
+ gsf_kinems.pt->fill(gsf_track.pt());
|
|
|
+ gsf_kinems.eta->fill(gsf_track.eta());
|
|
|
+ gsf_kinems.phi->fill(gsf_track.phi());
|
|
|
+ }
|
|
|
+
|
|
|
+ for (const auto& scl : scls) {
|
|
|
+ scl_kinems.pt->fill(hypot(scl.px(), scl.py()));
|
|
|
+ scl_kinems.eta->fill(pseudorapidity(scl.x(), scl.y(), scl.z()));
|
|
|
+ scl_kinems.phi->fill(atan2(scl.py(), scl.px()));
|
|
|
+ }
|
|
|
+
|
|
|
auto match_stats = get_match_stats(false);
|
|
|
n_good_sim.fill(std::get<0>(match_stats));
|
|
|
n_gsf_tracks.fill(std::get<1>(match_stats));
|
|
@@ -397,8 +456,7 @@ void run(){
|
|
|
for(float dR : std::get<8>(match_stats)) matched_dR_dR.fill(dR);
|
|
|
for(float dpT : std::get<9>(match_stats)) matched_dpT_dR.fill(dpT);
|
|
|
|
|
|
- for (const auto& sim_track : sim_tracks) {
|
|
|
- if (!is_good_sim(sim_track)) continue;
|
|
|
+ for (const auto& sim_track : sim_els) {
|
|
|
sim_pt.fill(sim_track.pt());
|
|
|
sim_eta.fill(sim_track.eta());
|
|
|
sim_phi.fill(sim_track.phi());
|
|
@@ -410,8 +468,7 @@ void run(){
|
|
|
reco_phi.fill(reco_track.phi());
|
|
|
}
|
|
|
|
|
|
- for (const auto& sim_track : sim_tracks) {
|
|
|
- if (!is_good_sim(sim_track)) continue;
|
|
|
+ for (const auto& sim_track : sim_els) {
|
|
|
if (seeds.size() == 0) continue;
|
|
|
for (const auto &seed_idx : sim_track.seedIdx()) {
|
|
|
const Seed& seed = seeds[seed_idx];
|
|
@@ -421,8 +478,7 @@ void run(){
|
|
|
}
|
|
|
|
|
|
|
|
|
- for (const auto& sim_track : sim_tracks) {
|
|
|
- if (!is_good_sim(sim_track)) continue;
|
|
|
+ for (const auto& sim_track : sim_els) {
|
|
|
if (seeds.size() == 0) continue;
|
|
|
|
|
|
bool matched = false;
|
|
@@ -442,8 +498,7 @@ void run(){
|
|
|
}
|
|
|
|
|
|
|
|
|
- for (const auto& sim_track : sim_tracks) {
|
|
|
- if (!is_good_sim(sim_track)) continue;
|
|
|
+ for (const auto& sim_track : sim_els) {
|
|
|
if (gsf_tracks.size() == 0) continue;
|
|
|
bool matched = false;
|
|
|
for (const auto& track_idx : sim_track.trkIdx()) {
|
|
@@ -483,7 +538,7 @@ void run(){
|
|
|
if (!is_good_seed(seed, hoe_cut)) continue;
|
|
|
bool match = false;
|
|
|
for (const auto& sim_track_idx : seed.simTrkIdx()) {
|
|
|
- if(is_good_sim(sim_tracks[sim_track_idx])) {
|
|
|
+ if (is_good_sim(sim_tracks[sim_track_idx])) {
|
|
|
match = true;
|
|
|
break;
|
|
|
}
|
|
@@ -517,9 +572,9 @@ void run(){
|
|
|
|
|
|
|
|
|
matched = false;
|
|
|
- for (const auto& sim_track : sim_tracks) {
|
|
|
+ for (const auto& sim_track : sim_els) {
|
|
|
double dR = deltaR(sim_track, gsf_track);
|
|
|
- if (is_good_sim(sim_track) and dR < 0.2) {
|
|
|
+ if (dR < 0.2) {
|
|
|
matched = true;
|
|
|
break;
|
|
|
}
|
|
@@ -548,8 +603,7 @@ void run(){
|
|
|
std::set<size_t> tm_scls;
|
|
|
for (const auto &scl : scls) {
|
|
|
Vec4 p4 = scl_p4(scl);
|
|
|
- for(const auto& sim_track : sim_tracks) {
|
|
|
- if (!is_good_sim(sim_track)) continue;
|
|
|
+ for(const auto& sim_track : sim_els) {
|
|
|
if (deltaR(p4.eta(), p4.phi(), sim_track) > 0.2) continue;
|
|
|
if (((p4.Et() - sim_track.pt()) / p4.Et()) > 0.1) continue;
|
|
|
tm_scls.insert(scl.idx);
|
|
@@ -625,6 +679,7 @@ void run(){
|
|
|
} else {
|
|
|
tm_types = {NoMatch};
|
|
|
}
|
|
|
+ tm_corr.fill(is_seed_sim_matched, is_track_sim_matched);
|
|
|
|
|
|
vector<int> hits_valid;
|
|
|
vector<float> hits_dRz;
|