|
@@ -38,6 +38,11 @@ float displacement(const A& a, const B& b){
|
|
|
pow(a.x-b.x, 2));
|
|
|
}
|
|
|
|
|
|
+template<typename T>
|
|
|
+float rho(const T& t){
|
|
|
+ return std::sqrt(pow(t.x,2)+pow(t.y,2));
|
|
|
+}
|
|
|
+
|
|
|
bool in_det(const MatchedTrack &mt, int &&det, int &&layer){
|
|
|
auto& hit = std::get<PixRecHit>(mt);
|
|
|
return hit.det == det && hit.lay == layer;
|
|
@@ -89,23 +94,32 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
|
func<vector<HitPair>(vector<Seed>,
|
|
|
vector<PixRecHit>,
|
|
|
vector<SimHit>,
|
|
|
+ vector<Track>,
|
|
|
+ vector<SimTrack>,
|
|
|
int, int, int)>("find_matched_nth_hit_in_layer",
|
|
|
FUNC(([](const vector<Seed>& seeds,
|
|
|
const vector<PixRecHit>& pixrec_hits,
|
|
|
const vector<SimHit>& sim_hits,
|
|
|
+ const vector<Track>& tracks,
|
|
|
+ const vector<SimTrack>& sim_tracks,
|
|
|
const int&& det,
|
|
|
- const int&& bpix_layer,
|
|
|
+ const int&& pix_layer,
|
|
|
const int&& hit_number){
|
|
|
vector<HitPair> matched_hits;
|
|
|
- for(const Seed &seed : seeds){ // loop over all seeds
|
|
|
- if(seed.hitIdx.size() <= hit_number) continue;
|
|
|
+ for(const Track &trk : tracks){ // loop over all tracks
|
|
|
+ const Seed &seed = seeds[trk.seedIdx];
|
|
|
+ if(seed.hitIdx.size() <= hit_number) continue; // looking for hit_number'th hit, which this seed doesn't have
|
|
|
if(seed.algoOriginal < 0 || seed.algoOriginal >= seedTypes.size()) continue;
|
|
|
if(seed.hitType[hit_number] != HIT_TYPE_PIXEL) continue; // take only pixel hits for now
|
|
|
const PixRecHit &rec_hit = pixrec_hits[seed.hitIdx[hit_number]];
|
|
|
- if(rec_hit.det == det && rec_hit.lay == bpix_layer){
|
|
|
- if(rec_hit.simHitIdx.size() > 0){
|
|
|
- // take first matched simhit (should be the closest one)
|
|
|
- matched_hits.push_back({rec_hit, sim_hits[rec_hit.simHitIdx[0]]});
|
|
|
+ if(rec_hit.det == det && rec_hit.lay == pix_layer){
|
|
|
+ // We have the RecHit we want to work with, now find a properly* matched SimHit
|
|
|
+ if(rec_hit.simHitIdx.size() == 0) continue; // if rechit is matched to no simhits, give up.
|
|
|
+ for(const int &simTrkIdx : trk.simTrkIdx){ // loop over SimTracks matched to Track
|
|
|
+ for(const int& simHitIdx : sim_tracks[simTrkIdx].simHitIdx){ // loop over SimHits from SimTrack
|
|
|
+ if(simHitIdx == rec_hit.simHitIdx[0]) // take first matched simhit (should be the closest one)
|
|
|
+ matched_hits.push_back({rec_hit, sim_hits[rec_hit.simHitIdx[0]]});
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -132,24 +146,27 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
|
|
|
|
// First hits on inner three bpix layers
|
|
|
auto first_hits_in_B1 = fv::apply(find_matched_nth_hit_in_layer,
|
|
|
- fv::tuple(seeds, pixrec_hits, sim_hits, barrel_val, constant("L1", 1), first_hit), "first_hits_in_B1");
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, barrel_val, constant("L1", 1), first_hit), "first_hits_in_B1");
|
|
|
auto first_hits_in_B2 = fv::apply(find_matched_nth_hit_in_layer,
|
|
|
- fv::tuple(seeds, pixrec_hits, sim_hits, barrel_val, constant("L2", 2), first_hit), "first_hits_in_B2");
|
|
|
- auto first_hits_in_B3 = fv::apply(find_matched_nth_hit_in_layer,
|
|
|
- fv::tuple(seeds, pixrec_hits, sim_hits, barrel_val, constant("L3", 3), first_hit), "first_hits_in_B3");
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, barrel_val, constant("L2", 2), first_hit), "first_hits_in_B2");
|
|
|
|
|
|
// Second hits on outer three bpix layers
|
|
|
auto second_hits_in_B2 = fv::apply(find_matched_nth_hit_in_layer,
|
|
|
- fv::tuple(seeds, pixrec_hits, sim_hits, barrel_val, constant("L2", 2), second_hit), "second_hits_in_B2");
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, barrel_val, constant("L2", 2), second_hit), "second_hits_in_B2");
|
|
|
auto second_hits_in_B3 = fv::apply(find_matched_nth_hit_in_layer,
|
|
|
- fv::tuple(seeds, pixrec_hits, sim_hits, barrel_val, constant("L3", 3), second_hit), "second_hits_in_B3");
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, barrel_val, constant("L3", 3), second_hit), "second_hits_in_B3");
|
|
|
auto second_hits_in_B4 = fv::apply(find_matched_nth_hit_in_layer,
|
|
|
- fv::tuple(seeds, pixrec_hits, sim_hits, barrel_val, constant("L4", 4), second_hit), "second_hits_in_B4");
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, barrel_val, constant("L4", 4), second_hit), "second_hits_in_B4");
|
|
|
|
|
|
- /* auto first_hits_in_F1 = fv::apply(find_matched_nth_hit_in_layer, */
|
|
|
- /* fv::tuple(seeds, pixrec_hits, sim_hits, endcap_val, constant("1", 1)), "first_hits_in_F1"); */
|
|
|
- /* auto first_hits_in_F2 = fv::apply(find_matched_nth_hit_in_layer, */
|
|
|
- /* fv::tuple(seeds, pixrec_hits, sim_hits, endcap_val, constant("2", 2)), "first_hits_in_F2"); */
|
|
|
+ auto first_hits_in_F1 = fv::apply(find_matched_nth_hit_in_layer,
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, endcap_val, constant("L1", 1), first_hit), "first_hits_in_F1");
|
|
|
+ auto first_hits_in_F2 = fv::apply(find_matched_nth_hit_in_layer,
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, endcap_val, constant("L2", 2), first_hit), "first_hits_in_F2");
|
|
|
+
|
|
|
+ auto second_hits_in_F2 = fv::apply(find_matched_nth_hit_in_layer,
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, endcap_val, constant("L2", 2), second_hit), "second_hits_in_F2");
|
|
|
+ auto second_hits_in_F3 = fv::apply(find_matched_nth_hit_in_layer,
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, endcap_val, constant("L3", 3), second_hit), "second_hits_in_F3");
|
|
|
|
|
|
// Even vs Odd Ladders
|
|
|
auto even = constant("even", false);
|
|
@@ -165,11 +182,6 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
|
auto first_hits_in_B2_odd_ladder = fv::apply(select_even_odd_ladder_blade_hit_pairs,
|
|
|
fv::tuple(first_hits_in_B2, odd), "first_hits_in_B2_odd_ladder");
|
|
|
|
|
|
- auto first_hits_in_B3_even_ladder = fv::apply(select_even_odd_ladder_blade_hit_pairs,
|
|
|
- fv::tuple(first_hits_in_B3, even), "first_hits_in_B3_even_ladder");
|
|
|
- auto first_hits_in_B3_odd_ladder = fv::apply(select_even_odd_ladder_blade_hit_pairs,
|
|
|
- fv::tuple(first_hits_in_B3, odd), "first_hits_in_B3_odd_ladder");
|
|
|
-
|
|
|
//Plots for dPhi of collections defined above
|
|
|
auto& calc_dphi_v_eta = func<pair_vec(vector<HitPair>)>("calc_dphi_v_eta",
|
|
|
FUNC(([](const vector<HitPair>& hit_pairs){
|
|
@@ -184,16 +196,13 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
|
return std::make_pair(etas, dphis);
|
|
|
})));
|
|
|
TH2Params params_dphi = {"$\\eta$", 100, -4, 4,
|
|
|
- "$\\Delta \\phi$(rad)", 75, -.0015, .0015};
|
|
|
+ "$\\Delta \\phi$(rad)", 50, -.0015, .0015};
|
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B1",
|
|
|
fv::apply(calc_dphi_v_eta, fv::tuple(first_hits_in_B1)),
|
|
|
"First Hit in BPIX-L1", params_dphi);
|
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B2",
|
|
|
fv::apply(calc_dphi_v_eta, fv::tuple(first_hits_in_B2)),
|
|
|
"First Hit in BPIX-L2", params_dphi);
|
|
|
- tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B3",
|
|
|
- fv::apply(calc_dphi_v_eta, fv::tuple(first_hits_in_B3)),
|
|
|
- "First Hit in BPIX-L3", params_dphi);
|
|
|
|
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B1_even_ladder",
|
|
|
fv::apply(calc_dphi_v_eta, fv::tuple(first_hits_in_B1_even_ladder)),
|
|
@@ -207,12 +216,6 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B2_odd_ladder",
|
|
|
fv::apply(calc_dphi_v_eta, fv::tuple(first_hits_in_B2_odd_ladder)),
|
|
|
"First Hit in BPIX-L2 - Odd Ladders", params_dphi);
|
|
|
- tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B3_even_ladder",
|
|
|
- fv::apply(calc_dphi_v_eta, fv::tuple(first_hits_in_B3_even_ladder)),
|
|
|
- "First Hit in BPIX-L3 - Even Ladders", params_dphi);
|
|
|
- tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B3_odd_ladder",
|
|
|
- fv::apply(calc_dphi_v_eta, fv::tuple(first_hits_in_B3_odd_ladder)),
|
|
|
- "First Hit in BPIX-L3 - Odd Ladders", params_dphi);
|
|
|
|
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_second_hits_in_B2",
|
|
|
fv::apply(calc_dphi_v_eta, fv::tuple(second_hits_in_B2)),
|
|
@@ -224,6 +227,21 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
|
fv::apply(calc_dphi_v_eta, fv::tuple(second_hits_in_B4)),
|
|
|
"Second Hit in BPIX-L4", params_dphi);
|
|
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_F1",
|
|
|
+ fv::apply(calc_dphi_v_eta, fv::tuple(first_hits_in_F1)),
|
|
|
+ "First Hit in FPIX-L1", params_dphi);
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_F2",
|
|
|
+ fv::apply(calc_dphi_v_eta, fv::tuple(first_hits_in_F2)),
|
|
|
+ "First Hit in FPIX-L2", params_dphi);
|
|
|
+
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_second_hits_in_F2",
|
|
|
+ fv::apply(calc_dphi_v_eta, fv::tuple(second_hits_in_F2)),
|
|
|
+ "Second Hit in FPIX-L2", params_dphi);
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_second_hits_in_F3",
|
|
|
+ fv::apply(calc_dphi_v_eta, fv::tuple(second_hits_in_F3)),
|
|
|
+ "Second Hit in FPIX-L3", params_dphi);
|
|
|
+
|
|
|
+
|
|
|
//Plots for dz of collections defined above
|
|
|
auto& calc_dz_v_eta = func<pair_vec(vector<HitPair>)>("calc_dz_v_eta",
|
|
|
FUNC(([](const vector<HitPair>& hit_pairs){
|
|
@@ -238,16 +256,13 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
|
return std::make_pair(etas, dzs);
|
|
|
})));
|
|
|
TH2Params params_dz = {"$\\eta$", 100, -4, 4,
|
|
|
- "$\\Delta z$(rad)", 100, -.01, .01};
|
|
|
+ "$\\Delta z$(rad)", 50, -.01, .01};
|
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B1",
|
|
|
fv::apply(calc_dz_v_eta, fv::tuple(first_hits_in_B1)),
|
|
|
"First Hit in BPIX-L1", params_dz);
|
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B2",
|
|
|
fv::apply(calc_dz_v_eta, fv::tuple(first_hits_in_B2)),
|
|
|
"First Hit in BPIX-L2", params_dz);
|
|
|
- tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B3",
|
|
|
- fv::apply(calc_dz_v_eta, fv::tuple(first_hits_in_B3)),
|
|
|
- "First Hit in BPIX-L3", params_dz);
|
|
|
|
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B1_even_ladder",
|
|
|
fv::apply(calc_dz_v_eta, fv::tuple(first_hits_in_B1_even_ladder)),
|
|
@@ -261,12 +276,6 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B2_odd_ladder",
|
|
|
fv::apply(calc_dz_v_eta, fv::tuple(first_hits_in_B2_odd_ladder)),
|
|
|
"First Hit in BPIX-L2 - Odd Ladders", params_dz);
|
|
|
- tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B3_even_ladder",
|
|
|
- fv::apply(calc_dz_v_eta, fv::tuple(first_hits_in_B3_even_ladder)),
|
|
|
- "First Hit in BPIX-L3 - Even Ladders", params_dz);
|
|
|
- tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B3_odd_ladder",
|
|
|
- fv::apply(calc_dz_v_eta, fv::tuple(first_hits_in_B3_odd_ladder)),
|
|
|
- "First Hit in BPIX-L3 - Odd Ladders", params_dz);
|
|
|
|
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_second_hits_in_B2",
|
|
|
fv::apply(calc_dz_v_eta, fv::tuple(second_hits_in_B2)),
|
|
@@ -278,7 +287,34 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
|
fv::apply(calc_dz_v_eta, fv::tuple(second_hits_in_B4)),
|
|
|
"Second Hit in BPIX-L4", params_dz);
|
|
|
|
|
|
-
|
|
|
+ //Plots for drho of collections defined above
|
|
|
+ auto& calc_drho_v_eta = func<pair_vec(vector<HitPair>)>("calc_drho_v_eta",
|
|
|
+ FUNC(([](const vector<HitPair>& hit_pairs){
|
|
|
+ vector<float> drhos;
|
|
|
+ vector<float> etas;
|
|
|
+ for(auto hit_pair : hit_pairs){
|
|
|
+ auto& pixrec_hit = std::get<PixRecHit>(hit_pair);
|
|
|
+ auto& sim_hit = std::get<SimHit>(hit_pair);
|
|
|
+ drhos.push_back(rho(sim_hit) - rho(pixrec_hit));
|
|
|
+ etas.push_back(pseudorapidity(pixrec_hit));
|
|
|
+ }
|
|
|
+ return std::make_pair(etas, drhos);
|
|
|
+ })));
|
|
|
+ TH2Params params_drho = {"$\\eta$", 100, -4, 4,
|
|
|
+ "$\\Delta \\rho$(cm)", 50, -.01, .01};
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("drho_v_eta_first_hits_in_F1",
|
|
|
+ fv::apply(calc_drho_v_eta, fv::tuple(first_hits_in_F1)),
|
|
|
+ "First Hit in FPIX-L1", params_drho);
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("drho_v_eta_first_hits_in_F2",
|
|
|
+ fv::apply(calc_drho_v_eta, fv::tuple(first_hits_in_F2)),
|
|
|
+ "First Hit in FPIX-L2", params_drho);
|
|
|
+
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("drho_v_eta_second_hits_in_F2",
|
|
|
+ fv::apply(calc_drho_v_eta, fv::tuple(second_hits_in_F2)),
|
|
|
+ "Second Hit in FPIX-L2", params_drho);
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("drho_v_eta_second_hits_in_F3",
|
|
|
+ fv::apply(calc_drho_v_eta, fv::tuple(second_hits_in_F3)),
|
|
|
+ "Second Hit in FPIX-L3", params_drho);
|
|
|
}
|
|
|
|
|
|
void setup_matched_tracks(TrackingDataSet& tds){
|