|
@@ -4,7 +4,6 @@
|
|
#include <utility>
|
|
#include <utility>
|
|
#include <numeric>
|
|
#include <numeric>
|
|
#include <limits>
|
|
#include <limits>
|
|
-#include <cmath>
|
|
|
|
#include <TSystem.h>
|
|
#include <TSystem.h>
|
|
|
|
|
|
#include "filval/filval.hpp"
|
|
#include "filval/filval.hpp"
|
|
@@ -13,14 +12,14 @@
|
|
#include <boost/range/combine.hpp>
|
|
#include <boost/range/combine.hpp>
|
|
#include <boost/format.hpp>
|
|
#include <boost/format.hpp>
|
|
|
|
|
|
-#include "TrackingNtuple.h"
|
|
|
|
|
|
+#include "analysis/TrackingNtuple.h"
|
|
#include "analysis/obj_types.cpp"
|
|
#include "analysis/obj_types.cpp"
|
|
|
|
+#include "analysis/common.hpp"
|
|
|
|
|
|
using namespace std;
|
|
using namespace std;
|
|
using namespace fv;
|
|
using namespace fv;
|
|
using namespace fv::root;
|
|
using namespace fv::root;
|
|
|
|
|
|
-typedef std::tuple<Seed, PixRecHit, Track, SimHit, SimTrack> MatchedTrack;
|
|
|
|
typedef std::pair<std::vector<float>,std::vector<float>> pair_vec;
|
|
typedef std::pair<std::vector<float>,std::vector<float>> pair_vec;
|
|
|
|
|
|
#define HIT_TYPE_PIXEL 0
|
|
#define HIT_TYPE_PIXEL 0
|
|
@@ -31,36 +30,64 @@ typedef std::pair<std::vector<float>,std::vector<float>> pair_vec;
|
|
#define PIXEL_ENDCAP 2
|
|
#define PIXEL_ENDCAP 2
|
|
std::map<int,string> subdet_names = {{1, "BPIX"}, {2, "FPIX"}};
|
|
std::map<int,string> subdet_names = {{1, "BPIX"}, {2, "FPIX"}};
|
|
|
|
|
|
-template<typename A, typename B>
|
|
|
|
-float displacement(const A& a, const B& b){
|
|
|
|
- return std::sqrt(pow(a.x-b.x, 2) +
|
|
|
|
- pow(a.y-b.y, 2) +
|
|
|
|
- pow(a.z-b.z, 2));
|
|
|
|
-}
|
|
|
|
|
|
|
|
-template<typename T>
|
|
|
|
-float rho(const T& t){
|
|
|
|
- return std::sqrt(pow(t.x,2)+pow(t.y,2));
|
|
|
|
-}
|
|
|
|
|
|
+typedef std::tuple<PixRecHit, SimHit> HitPair;
|
|
|
|
|
|
-bool in_det(const MatchedTrack &mt, int &&det, int &&layer){
|
|
|
|
- auto& hit = std::get<PixRecHit>(mt);
|
|
|
|
- return hit.det == det && hit.lay == layer;
|
|
|
|
-};
|
|
|
|
|
|
|
|
-float pseudorapidity(float z, float r){
|
|
|
|
- float theta = atan2(r, z);
|
|
|
|
- return -log(tan(theta/2.0));
|
|
|
|
-}
|
|
|
|
-float pseudorapidity(float x, float y, float z){
|
|
|
|
- float r = sqrt(x*x + y*y);
|
|
|
|
- return pseudorapidity(z, r);
|
|
|
|
-}
|
|
|
|
-template<typename T>
|
|
|
|
-float pseudorapidity(const T &t){
|
|
|
|
- return pseudorapidity(t.x, t.y, t.z);
|
|
|
|
-}
|
|
|
|
|
|
+void setup_hit_pair_functions(){
|
|
|
|
+
|
|
|
|
+ func<pair_vec(vector<HitPair>)>("calc_dphi_v_eta",
|
|
|
|
+ FUNC(([](const vector<HitPair>& hit_pairs){
|
|
|
|
+ vector<float> dphis;
|
|
|
|
+ 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);
|
|
|
|
+ dphis.push_back(atan2(sim_hit.x, sim_hit.y) - atan2(pixrec_hit.x, pixrec_hit.y));
|
|
|
|
+ etas.push_back(pseudorapidity(pixrec_hit));
|
|
|
|
+ }
|
|
|
|
+ return std::make_pair(etas, dphis);
|
|
|
|
+ })));
|
|
|
|
|
|
|
|
+ func<pair_vec(vector<HitPair>)>("calc_dr_v_eta",
|
|
|
|
+ FUNC(([](const vector<HitPair>& hit_pairs){
|
|
|
|
+ vector<float> drs;
|
|
|
|
+ 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);
|
|
|
|
+ drs.push_back(displacement(pixrec_hit, sim_hit));
|
|
|
|
+ etas.push_back(pseudorapidity(pixrec_hit));
|
|
|
|
+ }
|
|
|
|
+ return std::make_pair(etas, drs);
|
|
|
|
+ })));
|
|
|
|
+
|
|
|
|
+ func<pair_vec(vector<HitPair>)>("calc_dz_v_eta",
|
|
|
|
+ FUNC(([](const vector<HitPair>& hit_pairs){
|
|
|
|
+ vector<float> dzs;
|
|
|
|
+ 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);
|
|
|
|
+ dzs.push_back(sim_hit.z - pixrec_hit.z);
|
|
|
|
+ etas.push_back(pseudorapidity(pixrec_hit));
|
|
|
|
+ }
|
|
|
|
+ return std::make_pair(etas, dzs);
|
|
|
|
+ })));
|
|
|
|
+
|
|
|
|
+ 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);
|
|
|
|
+ })));
|
|
|
|
+}
|
|
|
|
|
|
vector<string> seedTypes =
|
|
vector<string> seedTypes =
|
|
{"initialStepSeeds",
|
|
{"initialStepSeeds",
|
|
@@ -71,6 +98,7 @@ vector<string> seedTypes =
|
|
"pixelPairElectronSeeds",
|
|
"pixelPairElectronSeeds",
|
|
"stripPairElectronSeeds"};
|
|
"stripPairElectronSeeds"};
|
|
|
|
|
|
|
|
+Value<vector<SuperCluster>>* super_clusters;
|
|
Value<vector<Seed>>* seeds;
|
|
Value<vector<Seed>>* seeds;
|
|
Value<vector<PixRecHit>>* pixrec_hits;
|
|
Value<vector<PixRecHit>>* pixrec_hits;
|
|
Value<vector<Track>>* tracks;
|
|
Value<vector<Track>>* tracks;
|
|
@@ -78,6 +106,7 @@ Value<vector<SimHit>>* sim_hits;
|
|
Value<vector<SimTrack>>* sim_tracks;
|
|
Value<vector<SimTrack>>* sim_tracks;
|
|
|
|
|
|
void register_objects(TrackingDataSet& tds){
|
|
void register_objects(TrackingDataSet& tds){
|
|
|
|
+ super_clusters = register_super_clusters(tds);
|
|
seeds = register_seeds(tds);
|
|
seeds = register_seeds(tds);
|
|
|
|
|
|
pixrec_hits = register_pixrec_hits(tds);
|
|
pixrec_hits = register_pixrec_hits(tds);
|
|
@@ -85,12 +114,127 @@ void register_objects(TrackingDataSet& tds){
|
|
|
|
|
|
sim_hits = register_sim_hits(tds);
|
|
sim_hits = register_sim_hits(tds);
|
|
sim_tracks = register_sim_tracks(tds);
|
|
sim_tracks = register_sim_tracks(tds);
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+template<typename A>
|
|
|
|
+bool in_det(const A& hit, const unsigned int& det, const unsigned int& lay){
|
|
|
|
+ return hit.det == det && hit.lay == lay;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void setup_skipped_layer_hit_pairs(TrackingDataSet& tds){
|
|
|
|
+
|
|
|
|
+ /* Finds SimHit/RecHit pairs
|
|
|
|
+ */
|
|
|
|
+ auto find_matched_nth_hit_in_layer_with_skip =
|
|
|
|
+ func<vector<HitPair>(vector<Seed>,
|
|
|
|
+ vector<PixRecHit>,
|
|
|
|
+ vector<SimHit>,
|
|
|
|
+ vector<Track>,
|
|
|
|
+ vector<SimTrack>,
|
|
|
|
+ int, int, int)>("find_matched_nth_hit_in_layer_with_skip",
|
|
|
|
+ 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 unsigned int&& det,
|
|
|
|
+ const unsigned int&& pix_layer,
|
|
|
|
+ const unsigned int&& skip){
|
|
|
|
+ vector<HitPair> matched_hits;
|
|
|
|
+ for(const Track &trk : tracks){ // loop over all tracks
|
|
|
|
+ const Seed &seed = seeds[trk.seedIdx];
|
|
|
|
+
|
|
|
|
+ // Require seed's source algorithm is one of those in seedTypes
|
|
|
|
+ if(seed.algoOriginal < 0 || seed.algoOriginal >= seedTypes.size()) continue;
|
|
|
|
+ // Require seed w/ at least 2 hits
|
|
|
|
+ if(seed.hitIdx.size() < 2) continue;
|
|
|
|
+ // take only pixel hits for now
|
|
|
|
+ if(seed.hitType[0] != HIT_TYPE_PIXEL || seed.hitType[1] != HIT_TYPE_PIXEL) continue;
|
|
|
|
+
|
|
|
|
+ const PixRecHit &rec_hit1 = pixrec_hits[seed.hitIdx[0]];
|
|
|
|
+ const PixRecHit &rec_hit2 = pixrec_hits[seed.hitIdx[1]];
|
|
|
|
+ if(in_det(rec_hit1, det, pix_layer) && in_det(rec_hit2, det, pix_layer+1+skip)){
|
|
|
|
+ // We have the RecHit we want to work with, now find a properly* matched SimHit
|
|
|
|
+ if(rec_hit1.simHitIdx.size() == 0) continue; // if rechit is matched to no simhits, give up.
|
|
|
|
+ if(trk.simTrkIdx.size() == 0) continue; // if track is matched to no simtracks, give up.
|
|
|
|
+ const int &simTrkIdx = trk.simTrkIdx[0]; // get first matched track
|
|
|
|
+ for(const int& simHitIdx : sim_tracks[simTrkIdx].simHitIdx){ // loop over SimHits from SimTrack
|
|
|
|
+ if(simHitIdx == rec_hit1.simHitIdx[0]) // take first matched simhit (should be the closest one)
|
|
|
|
+ matched_hits.push_back({rec_hit1, sim_hits[rec_hit1.simHitIdx[0]]});
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return matched_hits;
|
|
|
|
+ })));
|
|
|
|
+
|
|
|
|
+ auto pix_barrel = constant("PIXEL_BARREL", PIXEL_BARREL);
|
|
|
|
+ auto pix_endcap = constant("PIXEL_ENDCAP", PIXEL_ENDCAP);
|
|
|
|
+ auto L1 = constant("L1", 1);
|
|
|
|
+ auto L2 = constant("L2", 2);
|
|
|
|
+
|
|
|
|
+ auto skip_zero = constant("skip_zero", 0);
|
|
|
|
+ auto skip_one = constant("skip_one", 1);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // First hit on 1st/2nd bpix layers and second hit in 2nd/3rd
|
|
|
|
+ auto first_hits_in_B1_skip_zero = fv::tup_apply(find_matched_nth_hit_in_layer_with_skip,
|
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_barrel, L1, skip_zero), "first_hits_in_B1_skip_zero");
|
|
|
|
+ auto first_hits_in_B2_skip_zero = fv::tup_apply(find_matched_nth_hit_in_layer_with_skip,
|
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_barrel, L2, skip_zero), "first_hits_in_B2_skip_zero");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // First hit on 1st/2nd fpix layers and second hit in 2nd/3rd
|
|
|
|
+ auto first_hits_in_F1_skip_zero = fv::tup_apply(find_matched_nth_hit_in_layer_with_skip,
|
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_endcap, L1, skip_zero), "first_hits_in_F1_skip_zero");
|
|
|
|
+ auto first_hits_in_F2_skip_zero = fv::tup_apply(find_matched_nth_hit_in_layer_with_skip,
|
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_endcap, L2, skip_zero), "first_hits_in_F2_skip_zero");
|
|
|
|
+
|
|
|
|
+ // First hit on 1st/2nd fpix layers and second hit in 3rd/4th
|
|
|
|
+ auto first_hits_in_B1_skip_one = fv::tup_apply(find_matched_nth_hit_in_layer_with_skip,
|
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_barrel, L1, skip_one), "first_hits_in_B1_skip_one");
|
|
|
|
+ auto first_hits_in_B2_skip_one = fv::tup_apply(find_matched_nth_hit_in_layer_with_skip,
|
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_barrel, L2, skip_one), "first_hits_in_B2_skip_one");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // First hit on 1st fpix layer and second hit in 3rd layer
|
|
|
|
+ auto first_hits_in_F1_skip_one = fv::tup_apply(find_matched_nth_hit_in_layer_with_skip,
|
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_endcap, L1, skip_one), "first_hits_in_F1_skip_one");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ TH2Params params_dz = {"$\\eta$", 100, -4, 4,
|
|
|
|
+ "$\\Delta z$(rad)", 50, -.01, .01};
|
|
|
|
+ auto calc_dz_v_eta = lookup_function<pair_vec(vector<HitPair>)>("calc_dz_v_eta");
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B1_skip_zero",
|
|
|
|
+ fv::apply(calc_dz_v_eta, first_hits_in_B1_skip_zero),
|
|
|
|
+ "First Hit in BPIX-L1 - Skip 0", params_dz);
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B2_skip_zero",
|
|
|
|
+ fv::apply(calc_dz_v_eta, first_hits_in_B2_skip_zero),
|
|
|
|
+ "First Hit in BPIX-L2 - Skip 0", params_dz);
|
|
|
|
+
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_F1_skip_zero",
|
|
|
|
+ fv::apply(calc_dz_v_eta, first_hits_in_F1_skip_zero),
|
|
|
|
+ "First Hit in FPIX-L1 - Skip 0", params_dz);
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_F2_skip_zero",
|
|
|
|
+ fv::apply(calc_dz_v_eta, first_hits_in_F2_skip_zero),
|
|
|
|
+ "First Hit in FPIX-L2 - Skip 0", params_dz);
|
|
|
|
+
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B1_skip_one",
|
|
|
|
+ fv::apply(calc_dz_v_eta, first_hits_in_B1_skip_one),
|
|
|
|
+ "First Hit in BPIX-L1 - Skip 1", params_dz);
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B2_skip_one",
|
|
|
|
+ fv::apply(calc_dz_v_eta, first_hits_in_B2_skip_one),
|
|
|
|
+ "First Hit in BPIX-L2 - Skip 1", params_dz);
|
|
|
|
+
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_F1_skip_one",
|
|
|
|
+ fv::apply(calc_dz_v_eta, first_hits_in_F1_skip_one),
|
|
|
|
+ "First Hit in FPIX-L1 - Skip 1", params_dz);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
- typedef std::tuple<PixRecHit, SimHit> HitPair;
|
|
|
|
|
|
|
|
- auto& find_matched_nth_hit_in_layer =
|
|
|
|
|
|
+ auto find_matched_nth_hit_in_layer =
|
|
func<vector<HitPair>(vector<Seed>,
|
|
func<vector<HitPair>(vector<Seed>,
|
|
vector<PixRecHit>,
|
|
vector<PixRecHit>,
|
|
vector<SimHit>,
|
|
vector<SimHit>,
|
|
@@ -102,24 +246,24 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
const vector<SimHit>& sim_hits,
|
|
const vector<SimHit>& sim_hits,
|
|
const vector<Track>& tracks,
|
|
const vector<Track>& tracks,
|
|
const vector<SimTrack>& sim_tracks,
|
|
const vector<SimTrack>& sim_tracks,
|
|
- const int&& det,
|
|
|
|
- const int&& pix_layer,
|
|
|
|
- const int&& hit_number){
|
|
|
|
|
|
+ const unsigned int&& det,
|
|
|
|
+ const unsigned int&& pix_layer,
|
|
|
|
+ const unsigned int&& hit_number){
|
|
vector<HitPair> matched_hits;
|
|
vector<HitPair> matched_hits;
|
|
for(const Track &trk : tracks){ // loop over all tracks
|
|
for(const Track &trk : tracks){ // loop over all tracks
|
|
const Seed &seed = seeds[trk.seedIdx];
|
|
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.hitIdx.size() <= hit_number) continue; // looking for hit_number'th hit
|
|
if(seed.algoOriginal < 0 || seed.algoOriginal >= seedTypes.size()) continue;
|
|
if(seed.algoOriginal < 0 || seed.algoOriginal >= seedTypes.size()) continue;
|
|
if(seed.hitType[hit_number] != HIT_TYPE_PIXEL) continue; // take only pixel hits for now
|
|
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]];
|
|
const PixRecHit &rec_hit = pixrec_hits[seed.hitIdx[hit_number]];
|
|
if(rec_hit.det == det && rec_hit.lay == pix_layer){
|
|
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
|
|
// 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.
|
|
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]]});
|
|
|
|
- }
|
|
|
|
|
|
+ if(trk.simTrkIdx.size() == 0) continue; // if rechit is matched to no simhits, give up.
|
|
|
|
+ const int &simTrkIdx = trk.simTrkIdx[0]; // get first matched 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,34 +276,34 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
auto second_hit = constant("2nd", 1);
|
|
auto second_hit = constant("2nd", 1);
|
|
|
|
|
|
// First hits on inner three bpix layers
|
|
// First hits on inner three bpix layers
|
|
- auto first_hits_in_B1 = fv::apply(find_matched_nth_hit_in_layer,
|
|
|
|
|
|
+ auto first_hits_in_B1 = fv::tup_apply(find_matched_nth_hit_in_layer,
|
|
fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, 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,
|
|
|
|
|
|
+ auto first_hits_in_B2 = fv::tup_apply(find_matched_nth_hit_in_layer,
|
|
fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, barrel_val, constant("L2", 2), first_hit), "first_hits_in_B2");
|
|
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
|
|
// Second hits on outer three bpix layers
|
|
- auto second_hits_in_B2 = fv::apply(find_matched_nth_hit_in_layer,
|
|
|
|
|
|
+ auto second_hits_in_B2 = fv::tup_apply(find_matched_nth_hit_in_layer,
|
|
fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, 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,
|
|
|
|
|
|
+ auto second_hits_in_B3 = fv::tup_apply(find_matched_nth_hit_in_layer,
|
|
fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, 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,
|
|
|
|
|
|
+ auto second_hits_in_B4 = fv::tup_apply(find_matched_nth_hit_in_layer,
|
|
fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, 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,
|
|
|
|
|
|
+ auto first_hits_in_F1 = fv::tup_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");
|
|
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,
|
|
|
|
|
|
+ auto first_hits_in_F2 = fv::tup_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");
|
|
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,
|
|
|
|
|
|
+ auto second_hits_in_F2 = fv::tup_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");
|
|
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,
|
|
|
|
|
|
+ auto second_hits_in_F3 = fv::tup_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");
|
|
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
|
|
// Even vs Odd Ladders
|
|
auto even = constant("even", false);
|
|
auto even = constant("even", false);
|
|
auto odd = constant("odd", true);
|
|
auto odd = constant("odd", true);
|
|
|
|
|
|
- auto& select_even_odd_ladder_blade_hit_pairs =
|
|
|
|
|
|
+ auto select_even_odd_ladder_blade_hit_pairs =
|
|
func<vector<HitPair>(vector<HitPair>, bool)>("select_even_odd_ladder_blade_hit_pairs",
|
|
func<vector<HitPair>(vector<HitPair>, bool)>("select_even_odd_ladder_blade_hit_pairs",
|
|
FUNC(([](const vector<HitPair>& hit_pairs,
|
|
FUNC(([](const vector<HitPair>& hit_pairs,
|
|
const bool &&odd){
|
|
const bool &&odd){
|
|
@@ -172,210 +316,292 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
return even_pairs;
|
|
return even_pairs;
|
|
})));
|
|
})));
|
|
|
|
|
|
- auto first_hits_in_B1_even_ladder = fv::apply(select_even_odd_ladder_blade_hit_pairs,
|
|
|
|
|
|
+ auto first_hits_in_B1_even_ladder = fv::tup_apply(select_even_odd_ladder_blade_hit_pairs,
|
|
fv::tuple(first_hits_in_B1, even), "first_hits_in_B1_even_ladder");
|
|
fv::tuple(first_hits_in_B1, even), "first_hits_in_B1_even_ladder");
|
|
- auto first_hits_in_B1_odd_ladder = fv::apply(select_even_odd_ladder_blade_hit_pairs,
|
|
|
|
|
|
+ auto first_hits_in_B1_odd_ladder = fv::tup_apply(select_even_odd_ladder_blade_hit_pairs,
|
|
fv::tuple(first_hits_in_B1, odd), "first_hits_in_B1_odd_ladder");
|
|
fv::tuple(first_hits_in_B1, odd), "first_hits_in_B1_odd_ladder");
|
|
|
|
|
|
- auto first_hits_in_B2_even_ladder = fv::apply(select_even_odd_ladder_blade_hit_pairs,
|
|
|
|
|
|
+ auto first_hits_in_B2_even_ladder = fv::tup_apply(select_even_odd_ladder_blade_hit_pairs,
|
|
fv::tuple(first_hits_in_B2, even), "first_hits_in_B2_even_ladder");
|
|
fv::tuple(first_hits_in_B2, even), "first_hits_in_B2_even_ladder");
|
|
- auto first_hits_in_B2_odd_ladder = fv::apply(select_even_odd_ladder_blade_hit_pairs,
|
|
|
|
|
|
+ auto first_hits_in_B2_odd_ladder = fv::tup_apply(select_even_odd_ladder_blade_hit_pairs,
|
|
fv::tuple(first_hits_in_B2, odd), "first_hits_in_B2_odd_ladder");
|
|
fv::tuple(first_hits_in_B2, odd), "first_hits_in_B2_odd_ladder");
|
|
|
|
|
|
//Plots for dPhi of collections defined above
|
|
//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){
|
|
|
|
- vector<float> dphis;
|
|
|
|
- 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);
|
|
|
|
- dphis.push_back(atan2(sim_hit.x, sim_hit.y) - atan2(pixrec_hit.x, pixrec_hit.y));
|
|
|
|
- etas.push_back(pseudorapidity(pixrec_hit));
|
|
|
|
- }
|
|
|
|
- return std::make_pair(etas, dphis);
|
|
|
|
- })));
|
|
|
|
|
|
+ auto calc_dphi_v_eta = lookup_function<pair_vec(vector<HitPair>)>("calc_dphi_v_eta");
|
|
TH2Params params_dphi = {"$\\eta$", 100, -4, 4,
|
|
TH2Params params_dphi = {"$\\eta$", 100, -4, 4,
|
|
"$\\Delta \\phi$(rad)", 50, -.0015, .0015};
|
|
"$\\Delta \\phi$(rad)", 50, -.0015, .0015};
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B1",
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B1",
|
|
- fv::apply(calc_dphi_v_eta, fv::tuple(first_hits_in_B1)),
|
|
|
|
|
|
+ fv::apply(calc_dphi_v_eta, first_hits_in_B1),
|
|
"First Hit in BPIX-L1", params_dphi);
|
|
"First Hit in BPIX-L1", params_dphi);
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B2",
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B2",
|
|
- fv::apply(calc_dphi_v_eta, fv::tuple(first_hits_in_B2)),
|
|
|
|
|
|
+ fv::apply(calc_dphi_v_eta, first_hits_in_B2),
|
|
"First Hit in BPIX-L2", params_dphi);
|
|
"First Hit in BPIX-L2", params_dphi);
|
|
|
|
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B1_even_ladder",
|
|
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)),
|
|
|
|
|
|
+ fv::apply(calc_dphi_v_eta, first_hits_in_B1_even_ladder),
|
|
"First Hit in BPIX-L1 - Even Ladders", params_dphi);
|
|
"First Hit in BPIX-L1 - Even Ladders", params_dphi);
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B1_odd_ladder",
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B1_odd_ladder",
|
|
- fv::apply(calc_dphi_v_eta, fv::tuple(first_hits_in_B1_odd_ladder)),
|
|
|
|
|
|
+ fv::apply(calc_dphi_v_eta, first_hits_in_B1_odd_ladder),
|
|
"First Hit in BPIX-L1 - Odd Ladders", params_dphi);
|
|
"First Hit in BPIX-L1 - Odd Ladders", params_dphi);
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B2_even_ladder",
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B2_even_ladder",
|
|
- fv::apply(calc_dphi_v_eta, fv::tuple(first_hits_in_B2_even_ladder)),
|
|
|
|
|
|
+ fv::apply(calc_dphi_v_eta, first_hits_in_B2_even_ladder),
|
|
"First Hit in BPIX-L2 - Even Ladders", params_dphi);
|
|
"First Hit in BPIX-L2 - Even Ladders", params_dphi);
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_B2_odd_ladder",
|
|
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)),
|
|
|
|
|
|
+ fv::apply(calc_dphi_v_eta, first_hits_in_B2_odd_ladder),
|
|
"First Hit in BPIX-L2 - Odd Ladders", params_dphi);
|
|
"First Hit in BPIX-L2 - Odd Ladders", params_dphi);
|
|
|
|
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_second_hits_in_B2",
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_second_hits_in_B2",
|
|
- fv::apply(calc_dphi_v_eta, fv::tuple(second_hits_in_B2)),
|
|
|
|
|
|
+ fv::apply(calc_dphi_v_eta, second_hits_in_B2),
|
|
"Second Hit in BPIX-L2", params_dphi);
|
|
"Second Hit in BPIX-L2", params_dphi);
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_second_hits_in_B3",
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_second_hits_in_B3",
|
|
- fv::apply(calc_dphi_v_eta, fv::tuple(second_hits_in_B3)),
|
|
|
|
|
|
+ fv::apply(calc_dphi_v_eta, second_hits_in_B3),
|
|
"Second Hit in BPIX-L3", params_dphi);
|
|
"Second Hit in BPIX-L3", params_dphi);
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_second_hits_in_B4",
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_second_hits_in_B4",
|
|
- fv::apply(calc_dphi_v_eta, fv::tuple(second_hits_in_B4)),
|
|
|
|
|
|
+ fv::apply(calc_dphi_v_eta, second_hits_in_B4),
|
|
"Second Hit in BPIX-L4", params_dphi);
|
|
"Second Hit in BPIX-L4", params_dphi);
|
|
|
|
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_F1",
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_F1",
|
|
- fv::apply(calc_dphi_v_eta, fv::tuple(first_hits_in_F1)),
|
|
|
|
|
|
+ fv::apply(calc_dphi_v_eta, first_hits_in_F1),
|
|
"First Hit in FPIX-L1", params_dphi);
|
|
"First Hit in FPIX-L1", params_dphi);
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_F2",
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_first_hits_in_F2",
|
|
- fv::apply(calc_dphi_v_eta, fv::tuple(first_hits_in_F2)),
|
|
|
|
|
|
+ fv::apply(calc_dphi_v_eta, first_hits_in_F2),
|
|
"First Hit in FPIX-L2", params_dphi);
|
|
"First Hit in FPIX-L2", params_dphi);
|
|
|
|
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_second_hits_in_F2",
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_second_hits_in_F2",
|
|
- fv::apply(calc_dphi_v_eta, fv::tuple(second_hits_in_F2)),
|
|
|
|
|
|
+ fv::apply(calc_dphi_v_eta, second_hits_in_F2),
|
|
"Second Hit in FPIX-L2", params_dphi);
|
|
"Second Hit in FPIX-L2", params_dphi);
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_second_hits_in_F3",
|
|
tds.register_container<ContainerTH2Many<float>>("dphi_v_eta_second_hits_in_F3",
|
|
- fv::apply(calc_dphi_v_eta, fv::tuple(second_hits_in_F3)),
|
|
|
|
|
|
+ fv::apply(calc_dphi_v_eta, second_hits_in_F3),
|
|
"Second Hit in FPIX-L3", params_dphi);
|
|
"Second Hit in FPIX-L3", params_dphi);
|
|
|
|
|
|
//Plots for dr of collections defined above
|
|
//Plots for dr of collections defined above
|
|
- auto& calc_dr_v_eta = func<pair_vec(vector<HitPair>)>("calc_dr_v_eta",
|
|
|
|
- FUNC(([](const vector<HitPair>& hit_pairs){
|
|
|
|
- vector<float> drs;
|
|
|
|
- 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);
|
|
|
|
- drs.push_back(displacement(pixrec_hit, sim_hit));
|
|
|
|
- etas.push_back(pseudorapidity(pixrec_hit));
|
|
|
|
- }
|
|
|
|
- return std::make_pair(etas, drs);
|
|
|
|
- })));
|
|
|
|
|
|
+ auto calc_dr_v_eta = lookup_function<pair_vec(vector<HitPair>)>("calc_dr_v_eta");
|
|
TH2Params params_dr = {"$\\eta$", 100, -4, 4,
|
|
TH2Params params_dr = {"$\\eta$", 100, -4, 4,
|
|
"$\\Delta \\r$(rad)", 50, 0, .006};
|
|
"$\\Delta \\r$(rad)", 50, 0, .006};
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_B1",
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_B1",
|
|
- fv::apply(calc_dr_v_eta, fv::tuple(first_hits_in_B1)),
|
|
|
|
|
|
+ fv::apply(calc_dr_v_eta, first_hits_in_B1),
|
|
"First Hit in BPIX-L1", params_dr);
|
|
"First Hit in BPIX-L1", params_dr);
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_B2",
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_B2",
|
|
- fv::apply(calc_dr_v_eta, fv::tuple(first_hits_in_B2)),
|
|
|
|
|
|
+ fv::apply(calc_dr_v_eta, first_hits_in_B2),
|
|
"First Hit in BPIX-L2", params_dr);
|
|
"First Hit in BPIX-L2", params_dr);
|
|
|
|
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_B1_even_ladder",
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_B1_even_ladder",
|
|
- fv::apply(calc_dr_v_eta, fv::tuple(first_hits_in_B1_even_ladder)),
|
|
|
|
|
|
+ fv::apply(calc_dr_v_eta, first_hits_in_B1_even_ladder),
|
|
"First Hit in BPIX-L1 - Even Ladders", params_dr);
|
|
"First Hit in BPIX-L1 - Even Ladders", params_dr);
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_B1_odd_ladder",
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_B1_odd_ladder",
|
|
- fv::apply(calc_dr_v_eta, fv::tuple(first_hits_in_B1_odd_ladder)),
|
|
|
|
|
|
+ fv::apply(calc_dr_v_eta, first_hits_in_B1_odd_ladder),
|
|
"First Hit in BPIX-L1 - Odd Ladders", params_dr);
|
|
"First Hit in BPIX-L1 - Odd Ladders", params_dr);
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_B2_even_ladder",
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_B2_even_ladder",
|
|
- fv::apply(calc_dr_v_eta, fv::tuple(first_hits_in_B2_even_ladder)),
|
|
|
|
|
|
+ fv::apply(calc_dr_v_eta, first_hits_in_B2_even_ladder),
|
|
"First Hit in BPIX-L2 - Even Ladders", params_dr);
|
|
"First Hit in BPIX-L2 - Even Ladders", params_dr);
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_B2_odd_ladder",
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_B2_odd_ladder",
|
|
- fv::apply(calc_dr_v_eta, fv::tuple(first_hits_in_B2_odd_ladder)),
|
|
|
|
|
|
+ fv::apply(calc_dr_v_eta, first_hits_in_B2_odd_ladder),
|
|
"First Hit in BPIX-L2 - Odd Ladders", params_dr);
|
|
"First Hit in BPIX-L2 - Odd Ladders", params_dr);
|
|
|
|
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_second_hits_in_B2",
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_second_hits_in_B2",
|
|
- fv::apply(calc_dr_v_eta, fv::tuple(second_hits_in_B2)),
|
|
|
|
|
|
+ fv::apply(calc_dr_v_eta, second_hits_in_B2),
|
|
"Second Hit in BPIX-L2", params_dr);
|
|
"Second Hit in BPIX-L2", params_dr);
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_second_hits_in_B3",
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_second_hits_in_B3",
|
|
- fv::apply(calc_dr_v_eta, fv::tuple(second_hits_in_B3)),
|
|
|
|
|
|
+ fv::apply(calc_dr_v_eta, second_hits_in_B3),
|
|
"Second Hit in BPIX-L3", params_dr);
|
|
"Second Hit in BPIX-L3", params_dr);
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_second_hits_in_B4",
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_second_hits_in_B4",
|
|
- fv::apply(calc_dr_v_eta, fv::tuple(second_hits_in_B4)),
|
|
|
|
|
|
+ fv::apply(calc_dr_v_eta, second_hits_in_B4),
|
|
"Second Hit in BPIX-L4", params_dr);
|
|
"Second Hit in BPIX-L4", params_dr);
|
|
|
|
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_F1",
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_F1",
|
|
- fv::apply(calc_dr_v_eta, fv::tuple(first_hits_in_F1)),
|
|
|
|
|
|
+ fv::apply(calc_dr_v_eta, first_hits_in_F1),
|
|
"First Hit in FPIX-L1", params_dr);
|
|
"First Hit in FPIX-L1", params_dr);
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_F2",
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_first_hits_in_F2",
|
|
- fv::apply(calc_dr_v_eta, fv::tuple(first_hits_in_F2)),
|
|
|
|
|
|
+ fv::apply(calc_dr_v_eta, first_hits_in_F2),
|
|
"First Hit in FPIX-L2", params_dr);
|
|
"First Hit in FPIX-L2", params_dr);
|
|
|
|
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_second_hits_in_F2",
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_second_hits_in_F2",
|
|
- fv::apply(calc_dr_v_eta, fv::tuple(second_hits_in_F2)),
|
|
|
|
|
|
+ fv::apply(calc_dr_v_eta, second_hits_in_F2),
|
|
"Second Hit in FPIX-L2", params_dr);
|
|
"Second Hit in FPIX-L2", params_dr);
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_second_hits_in_F3",
|
|
tds.register_container<ContainerTH2Many<float>>("dr_v_eta_second_hits_in_F3",
|
|
- fv::apply(calc_dr_v_eta, fv::tuple(second_hits_in_F3)),
|
|
|
|
|
|
+ fv::apply(calc_dr_v_eta, second_hits_in_F3),
|
|
"Second Hit in FPIX-L3", params_dr);
|
|
"Second Hit in FPIX-L3", params_dr);
|
|
|
|
|
|
|
|
|
|
//Plots for dz of collections defined above
|
|
//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){
|
|
|
|
- vector<float> dzs;
|
|
|
|
- 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);
|
|
|
|
- dzs.push_back(sim_hit.z - pixrec_hit.z);
|
|
|
|
- etas.push_back(pseudorapidity(pixrec_hit));
|
|
|
|
- }
|
|
|
|
- return std::make_pair(etas, dzs);
|
|
|
|
- })));
|
|
|
|
|
|
+ auto calc_dz_v_eta = lookup_function<pair_vec(vector<HitPair>)>("calc_dz_v_eta");
|
|
TH2Params params_dz = {"$\\eta$", 100, -4, 4,
|
|
TH2Params params_dz = {"$\\eta$", 100, -4, 4,
|
|
"$\\Delta z$(rad)", 50, -.01, .01};
|
|
"$\\Delta z$(rad)", 50, -.01, .01};
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B1",
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B1",
|
|
- fv::apply(calc_dz_v_eta, fv::tuple(first_hits_in_B1)),
|
|
|
|
|
|
+ fv::apply(calc_dz_v_eta, first_hits_in_B1),
|
|
"First Hit in BPIX-L1", params_dz);
|
|
"First Hit in BPIX-L1", params_dz);
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B2",
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B2",
|
|
- fv::apply(calc_dz_v_eta, fv::tuple(first_hits_in_B2)),
|
|
|
|
|
|
+ fv::apply(calc_dz_v_eta, first_hits_in_B2),
|
|
"First Hit in BPIX-L2", params_dz);
|
|
"First Hit in BPIX-L2", params_dz);
|
|
|
|
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B1_even_ladder",
|
|
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)),
|
|
|
|
|
|
+ fv::apply(calc_dz_v_eta, first_hits_in_B1_even_ladder),
|
|
"First Hit in BPIX-L1 - Even Ladders", params_dz);
|
|
"First Hit in BPIX-L1 - Even Ladders", params_dz);
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B1_odd_ladder",
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B1_odd_ladder",
|
|
- fv::apply(calc_dz_v_eta, fv::tuple(first_hits_in_B1_odd_ladder)),
|
|
|
|
|
|
+ fv::apply(calc_dz_v_eta, first_hits_in_B1_odd_ladder),
|
|
"First Hit in BPIX-L1 - Odd Ladders", params_dz);
|
|
"First Hit in BPIX-L1 - Odd Ladders", params_dz);
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B2_even_ladder",
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B2_even_ladder",
|
|
- fv::apply(calc_dz_v_eta, fv::tuple(first_hits_in_B2_even_ladder)),
|
|
|
|
|
|
+ fv::apply(calc_dz_v_eta, first_hits_in_B2_even_ladder),
|
|
"First Hit in BPIX-L2 - Even Ladders", params_dz);
|
|
"First Hit in BPIX-L2 - Even Ladders", params_dz);
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_first_hits_in_B2_odd_ladder",
|
|
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)),
|
|
|
|
|
|
+ fv::apply(calc_dz_v_eta, first_hits_in_B2_odd_ladder),
|
|
"First Hit in BPIX-L2 - Odd Ladders", params_dz);
|
|
"First Hit in BPIX-L2 - Odd Ladders", params_dz);
|
|
|
|
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_second_hits_in_B2",
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_second_hits_in_B2",
|
|
- fv::apply(calc_dz_v_eta, fv::tuple(second_hits_in_B2)),
|
|
|
|
|
|
+ fv::apply(calc_dz_v_eta, second_hits_in_B2),
|
|
"Second Hit in BPIX-L2", params_dz);
|
|
"Second Hit in BPIX-L2", params_dz);
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_second_hits_in_B3",
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_second_hits_in_B3",
|
|
- fv::apply(calc_dz_v_eta, fv::tuple(second_hits_in_B3)),
|
|
|
|
|
|
+ fv::apply(calc_dz_v_eta, second_hits_in_B3),
|
|
"Second Hit in BPIX-L3", params_dz);
|
|
"Second Hit in BPIX-L3", params_dz);
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_second_hits_in_B4",
|
|
tds.register_container<ContainerTH2Many<float>>("dz_v_eta_second_hits_in_B4",
|
|
- fv::apply(calc_dz_v_eta, fv::tuple(second_hits_in_B4)),
|
|
|
|
|
|
+ fv::apply(calc_dz_v_eta, second_hits_in_B4),
|
|
"Second Hit in BPIX-L4", params_dz);
|
|
"Second Hit in BPIX-L4", params_dz);
|
|
|
|
|
|
//Plots for drho of collections defined above
|
|
//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);
|
|
|
|
- })));
|
|
|
|
|
|
+ auto calc_drho_v_eta = lookup_function<pair_vec(vector<HitPair>)>("calc_drho_v_eta");
|
|
TH2Params params_drho = {"$\\eta$", 100, -4, 4,
|
|
TH2Params params_drho = {"$\\eta$", 100, -4, 4,
|
|
"$\\Delta \\rho$(cm)", 50, -.01, .01};
|
|
"$\\Delta \\rho$(cm)", 50, -.01, .01};
|
|
tds.register_container<ContainerTH2Many<float>>("drho_v_eta_first_hits_in_F1",
|
|
tds.register_container<ContainerTH2Many<float>>("drho_v_eta_first_hits_in_F1",
|
|
- fv::apply(calc_drho_v_eta, fv::tuple(first_hits_in_F1)),
|
|
|
|
|
|
+ fv::apply(calc_drho_v_eta, first_hits_in_F1),
|
|
"First Hit in FPIX-L1", params_drho);
|
|
"First Hit in FPIX-L1", params_drho);
|
|
tds.register_container<ContainerTH2Many<float>>("drho_v_eta_first_hits_in_F2",
|
|
tds.register_container<ContainerTH2Many<float>>("drho_v_eta_first_hits_in_F2",
|
|
- fv::apply(calc_drho_v_eta, fv::tuple(first_hits_in_F2)),
|
|
|
|
|
|
+ fv::apply(calc_drho_v_eta, first_hits_in_F2),
|
|
"First Hit in FPIX-L2", params_drho);
|
|
"First Hit in FPIX-L2", params_drho);
|
|
|
|
|
|
tds.register_container<ContainerTH2Many<float>>("drho_v_eta_second_hits_in_F2",
|
|
tds.register_container<ContainerTH2Many<float>>("drho_v_eta_second_hits_in_F2",
|
|
- fv::apply(calc_drho_v_eta, fv::tuple(second_hits_in_F2)),
|
|
|
|
|
|
+ fv::apply(calc_drho_v_eta, second_hits_in_F2),
|
|
"Second Hit in FPIX-L2", params_drho);
|
|
"Second Hit in FPIX-L2", params_drho);
|
|
tds.register_container<ContainerTH2Many<float>>("drho_v_eta_second_hits_in_F3",
|
|
tds.register_container<ContainerTH2Many<float>>("drho_v_eta_second_hits_in_F3",
|
|
- fv::apply(calc_drho_v_eta, fv::tuple(second_hits_in_F3)),
|
|
|
|
|
|
+ fv::apply(calc_drho_v_eta, second_hits_in_F3),
|
|
"Second Hit in FPIX-L3", params_drho);
|
|
"Second Hit in FPIX-L3", params_drho);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+void setup_sc_residuals(TrackingDataSet& tds){
|
|
|
|
+
|
|
|
|
+ auto sc_hit_residuals =
|
|
|
|
+ func<pair_vec(vector<SuperCluster>,
|
|
|
|
+ int, int, int, bool)>("sc_hit_residuals",
|
|
|
|
+ FUNC(([](const vector<SuperCluster>& super_clusters,
|
|
|
|
+ const int&& det,
|
|
|
|
+ const int&& pix_layer,
|
|
|
|
+ const int&& hit_number,
|
|
|
|
+ const bool&& sel_dRz){
|
|
|
|
+ vector<float> residuals;
|
|
|
|
+ vector<float> etas;
|
|
|
|
+ for(const SuperCluster& super_cluster : super_clusters){ // loop over all supser-clusters
|
|
|
|
+ float dRz, dPhi;
|
|
|
|
+ unsigned int nSeeds = super_cluster.charge.size();
|
|
|
|
+ for(unsigned int seedIdx=0; seedIdx<nSeeds; seedIdx++){ // loop over all seeds associated w/ sc
|
|
|
|
+ if(hit_number == 0){
|
|
|
|
+ if(super_cluster.lay1[seedIdx] != pix_layer || super_cluster.subDet1[seedIdx] != det) continue;
|
|
|
|
+ dRz = super_cluster.dRz1[seedIdx];
|
|
|
|
+ dPhi = super_cluster.dPhi1[seedIdx];
|
|
|
|
+ }else{
|
|
|
|
+ if(super_cluster.lay2[seedIdx] != pix_layer || super_cluster.subDet2[seedIdx] != det) continue;
|
|
|
|
+ dRz = super_cluster.dRz2[seedIdx];
|
|
|
|
+ dPhi = super_cluster.dPhi2[seedIdx];
|
|
|
|
+ }
|
|
|
|
+ DEBUG("New Seed, Idx: " << seedIdx << endl
|
|
|
|
+ << "\tdRz: " << dRz << endl
|
|
|
|
+ << "\tdPhi: " << dPhi << endl);
|
|
|
|
+ if(sel_dRz)
|
|
|
|
+ residuals.push_back(dRz);
|
|
|
|
+ else
|
|
|
|
+ residuals.push_back(dPhi);
|
|
|
|
+ etas.push_back(pseudorapidityP(super_cluster));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return std::make_pair(etas,residuals);
|
|
|
|
+ })));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ auto pix_barrel = constant("PIXEL_BARREL", PIXEL_BARREL);
|
|
|
|
+ /* auto pix_endcap = constant<unsigned int>("PIXEL_ENDCAP", PIXEL_ENDCAP); */
|
|
|
|
+ auto first_hit = constant("1st", 0);
|
|
|
|
+ auto second_hit = constant("2nd", 1);
|
|
|
|
+ auto L1 = constant("L1", 1);
|
|
|
|
+ auto L2 = constant("L2", 2);
|
|
|
|
+ auto L3 = constant("L3", 3);
|
|
|
|
+ auto L4 = constant("L4", 4);
|
|
|
|
+
|
|
|
|
+ auto dRz = constant("dRz", true);
|
|
|
|
+ auto dPhi = constant("dPhi", false);
|
|
|
|
+
|
|
|
|
+ // First hits on inner two bpix layers
|
|
|
|
+ auto sc_first_hits_in_B1_dz = fv::tup_apply(sc_hit_residuals,
|
|
|
|
+ fv::tuple(super_clusters, pix_barrel, L1, first_hit, dRz), "sc_first_hits_in_B1_dz");
|
|
|
|
+ auto sc_first_hits_in_B2_dz = fv::tup_apply(sc_hit_residuals,
|
|
|
|
+ fv::tuple(super_clusters, pix_barrel, L2, first_hit, dRz), "sc_first_hits_in_B2_dz");
|
|
|
|
+ auto sc_first_hits_in_B3_dz = fv::tup_apply(sc_hit_residuals,
|
|
|
|
+ fv::tuple(super_clusters, pix_barrel, L3, first_hit, dRz), "sc_first_hits_in_B3_dz");
|
|
|
|
+
|
|
|
|
+ auto sc_second_hits_in_B2_dz = fv::tup_apply(sc_hit_residuals,
|
|
|
|
+ fv::tuple(super_clusters, pix_barrel, L2, second_hit, dRz), "sc_second_hits_in_B2_dz");
|
|
|
|
+ auto sc_second_hits_in_B3_dz = fv::tup_apply(sc_hit_residuals,
|
|
|
|
+ fv::tuple(super_clusters, pix_barrel, L3, second_hit, dRz), "sc_second_hits_in_B3_dz");
|
|
|
|
+ auto sc_second_hits_in_B4_dz = fv::tup_apply(sc_hit_residuals,
|
|
|
|
+ fv::tuple(super_clusters, pix_barrel, L4, second_hit, dRz), "sc_second_hits_in_B4_dz");
|
|
|
|
+
|
|
|
|
+ auto sc_first_hits_in_B1_dphi = fv::tup_apply(sc_hit_residuals,
|
|
|
|
+ fv::tuple(super_clusters, pix_barrel, L1, first_hit, dPhi), "sc_first_hits_in_B1_dphi");
|
|
|
|
+ auto sc_first_hits_in_B2_dphi = fv::tup_apply(sc_hit_residuals,
|
|
|
|
+ fv::tuple(super_clusters, pix_barrel, L2, first_hit, dPhi), "sc_first_hits_in_B2_dphi");
|
|
|
|
+ auto sc_first_hits_in_B3_dphi = fv::tup_apply(sc_hit_residuals,
|
|
|
|
+ fv::tuple(super_clusters, pix_barrel, L3, first_hit, dPhi), "sc_first_hits_in_B3_dphi");
|
|
|
|
+
|
|
|
|
+ auto sc_second_hits_in_B2_dphi = fv::tup_apply(sc_hit_residuals,
|
|
|
|
+ fv::tuple(super_clusters, pix_barrel, L2, second_hit, dPhi), "sc_second_hits_in_B2_dphi");
|
|
|
|
+ auto sc_second_hits_in_B3_dphi = fv::tup_apply(sc_hit_residuals,
|
|
|
|
+ fv::tuple(super_clusters, pix_barrel, L3, second_hit, dPhi), "sc_second_hits_in_B3_dphi");
|
|
|
|
+ auto sc_second_hits_in_B4_dphi = fv::tup_apply(sc_hit_residuals,
|
|
|
|
+ fv::tuple(super_clusters, pix_barrel, L4, second_hit, dPhi), "sc_second_hits_in_B4_dphi");
|
|
|
|
+
|
|
|
|
+ TH2Params params_dz = {"$\\eta$", 100, -4, 4,
|
|
|
|
+ "$\\delta z$(cm)", 100, -0.7, 0.7};
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("sc_first_hits_in_B1_dz",
|
|
|
|
+ sc_first_hits_in_B1_dz,
|
|
|
|
+ "First Hit in BPIX-L1", params_dz);
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("sc_first_hits_in_B2_dz",
|
|
|
|
+ sc_first_hits_in_B2_dz,
|
|
|
|
+ "First Hit in BPIX-L2", params_dz);
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("sc_first_hits_in_B3_dz",
|
|
|
|
+ sc_first_hits_in_B3_dz,
|
|
|
|
+ "First Hit in BPIX-L3", params_dz);
|
|
|
|
+
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("sc_second_hits_in_B2_dz",
|
|
|
|
+ sc_second_hits_in_B2_dz,
|
|
|
|
+ "Second Hit in BPIX-L2", params_dz);
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("sc_second_hits_in_B3_dz",
|
|
|
|
+ sc_second_hits_in_B3_dz,
|
|
|
|
+ "Second Hit in BPIX-L3", params_dz);
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("sc_second_hits_in_B4_dz",
|
|
|
|
+ sc_second_hits_in_B4_dz,
|
|
|
|
+ "Second Hit in BPIX-L4", params_dz);
|
|
|
|
+
|
|
|
|
+ TH2Params params_dphi = {"$\\eta$", 100, -4, 4,
|
|
|
|
+ "$\\delta \\phi$(rad)", 500, -0.7, 0.7};
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("sc_first_hits_in_B1_dphi",
|
|
|
|
+ sc_first_hits_in_B1_dphi,
|
|
|
|
+ "First Hit in BPIX-L1", params_dphi);
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("sc_first_hits_in_B2_dphi",
|
|
|
|
+ sc_first_hits_in_B2_dphi,
|
|
|
|
+ "First Hit in BPIX-L2", params_dphi);
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("sc_first_hits_in_B3_dphi",
|
|
|
|
+ sc_first_hits_in_B3_dphi,
|
|
|
|
+ "First Hit in BPIX-L3", params_dphi);
|
|
|
|
+
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("sc_second_hits_in_B2_dphi",
|
|
|
|
+ sc_second_hits_in_B2_dphi,
|
|
|
|
+ "Second Hit in BPIX-L2", params_dphi);
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("sc_second_hits_in_B3_dphi",
|
|
|
|
+ sc_second_hits_in_B3_dphi,
|
|
|
|
+ "Second Hit in BPIX-L3", params_dphi);
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("sc_second_hits_in_B4_dphi",
|
|
|
|
+ sc_second_hits_in_B4_dphi,
|
|
|
|
+ "Second Hit in BPIX-L4", params_dphi);
|
|
|
|
+}
|
|
|
|
+
|
|
void run_analysis(const vector<fv::util::DataFileDescriptor>& dfds, const string output_filename, bool silent){
|
|
void run_analysis(const vector<fv::util::DataFileDescriptor>& dfds, const string output_filename, bool silent){
|
|
gSystem->Load("libfilval.so");
|
|
gSystem->Load("libfilval.so");
|
|
auto replace_suffix = [](const std::string& input, const std::string& new_suffix){
|
|
auto replace_suffix = [](const std::string& input, const std::string& new_suffix){
|
|
@@ -388,8 +614,11 @@ void run_analysis(const vector<fv::util::DataFileDescriptor>& dfds, const string
|
|
TrackingDataSet tds(output_filename, dfds, "trackingNtuple/tree");
|
|
TrackingDataSet tds(output_filename, dfds, "trackingNtuple/tree");
|
|
/* tds.set_max_events(10); */
|
|
/* tds.set_max_events(10); */
|
|
register_objects(tds);
|
|
register_objects(tds);
|
|
|
|
+ setup_hit_pair_functions();
|
|
|
|
|
|
setup_first_hit_pairs(tds);
|
|
setup_first_hit_pairs(tds);
|
|
|
|
+ setup_skipped_layer_hit_pairs(tds);
|
|
|
|
+ setup_sc_residuals(tds);
|
|
|
|
|
|
|
|
|
|
tds.process(silent);
|
|
tds.process(silent);
|
|
@@ -406,11 +635,12 @@ int main(int argc, char * argv[]){
|
|
}else if(args.cmdOptionExists("-f")){
|
|
}else if(args.cmdOptionExists("-f")){
|
|
string input_filename = args.getCmdOption("-f");
|
|
string input_filename = args.getCmdOption("-f");
|
|
string data_label = args.cmdOptionExists("-l") ? args.getCmdOption("-l") : "";
|
|
string data_label = args.cmdOptionExists("-l") ? args.getCmdOption("-l") : "";
|
|
- fv::util::DataFileDescriptor dfd(input_filename, data_label);
|
|
|
|
|
|
+ string data_category = args.cmdOptionExists("-c") ? args.getCmdOption("-c") : "";
|
|
|
|
+ fv::util::DataFileDescriptor dfd(input_filename, data_label, data_category);
|
|
run_analysis(std::vector<fv::util::DataFileDescriptor>({dfd}), output_filename, silent);
|
|
run_analysis(std::vector<fv::util::DataFileDescriptor>({dfd}), output_filename, silent);
|
|
}else {
|
|
}else {
|
|
cout << "Usage: ./tracking_validation (-s) {-o output_filename} -F datafiles.txt" << endl;
|
|
cout << "Usage: ./tracking_validation (-s) {-o output_filename} -F datafiles.txt" << endl;
|
|
- cout << " ./tracking_validation (-s) {-l DATA_LABEL} {-o output_filename} -f treefile.root" << endl;
|
|
|
|
|
|
+ cout << " ./tracking_validation (-s) {-l DATA_LABEL} {-c DATA_CATEGORY} {-o output_filename} -f treefile.root" << endl;
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|