|
@@ -26,13 +26,53 @@ typedef std::pair<std::vector<float>,std::vector<float>> pair_vec;
|
|
#define HIT_TYPE_GLUED 1
|
|
#define HIT_TYPE_GLUED 1
|
|
#define HIT_TYPE_STRIP 2
|
|
#define HIT_TYPE_STRIP 2
|
|
|
|
|
|
-#define PIXEL_BARREL 1
|
|
+enum PixSubDet{
|
|
-#define PIXEL_ENDCAP 2
|
|
+ Void = 0,
|
|
-std::map<int,string> subdet_names = {{1, "BPIX"}, {2, "FPIX"}};
|
|
+ Barrel = 1,
|
|
|
|
+ EndCap = 2
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+struct PixDetElem{
|
|
|
|
+ PixSubDet subdet;
|
|
|
|
+ unsigned char lay;
|
|
|
|
+
|
|
|
|
+ PixDetElem():subdet(PixSubDet::Void), lay(0) {}
|
|
|
|
+
|
|
|
|
+ PixDetElem(const PixSubDet& subdet, const unsigned char& lay){
|
|
|
|
+ this->subdet = subdet;
|
|
|
|
+ this->lay = lay;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ template<typename T>
|
|
|
|
+ bool contains(const T& obj) const{
|
|
|
|
+ return obj.det == subdet && obj.lay == lay;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ bool contains(const PixSubDet& subdet, const unsigned char& lay) const{
|
|
|
|
+ return subdet == this->subdet && lay == this->lay;
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+std::map<PixSubDet,string> subdet_names = {{PixSubDet::Barrel, "BPIX"}, {PixSubDet::EndCap, "FPIX"}};
|
|
|
|
|
|
|
|
|
|
typedef std::tuple<PixRecHit, SimHit> HitPair;
|
|
typedef std::tuple<PixRecHit, SimHit> HitPair;
|
|
|
|
|
|
|
|
+vector<string> seedTypes =
|
|
|
|
+ {"initialStepSeeds",
|
|
|
|
+ "highPtTripletStepSeeds",
|
|
|
|
+ "mixedTripletStepSeeds",
|
|
|
|
+ "pixelLessStepSeeds",
|
|
|
|
+ "tripletElectronSeeds",
|
|
|
|
+ "pixelPairElectronSeeds",
|
|
|
|
+ "stripPairElectronSeeds"};
|
|
|
|
+
|
|
|
|
+Value<vector<SuperCluster>>* super_clusters;
|
|
|
|
+Value<vector<Seed>>* seeds;
|
|
|
|
+Value<vector<PixRecHit>>* pixrec_hits;
|
|
|
|
+Value<vector<Track>>* tracks;
|
|
|
|
+Value<vector<SimHit>>* sim_hits;
|
|
|
|
+Value<vector<SimTrack>>* sim_tracks;
|
|
|
|
|
|
void setup_hit_pair_functions(){
|
|
void setup_hit_pair_functions(){
|
|
|
|
|
|
@@ -89,22 +129,6 @@ void setup_hit_pair_functions(){
|
|
})));
|
|
})));
|
|
}
|
|
}
|
|
|
|
|
|
-vector<string> seedTypes =
|
|
|
|
- {"initialStepSeeds",
|
|
|
|
- "highPtTripletStepSeeds",
|
|
|
|
- "mixedTripletStepSeeds",
|
|
|
|
- "pixelLessStepSeeds",
|
|
|
|
- "tripletElectronSeeds",
|
|
|
|
- "pixelPairElectronSeeds",
|
|
|
|
- "stripPairElectronSeeds"};
|
|
|
|
-
|
|
|
|
-Value<vector<SuperCluster>>* super_clusters;
|
|
|
|
-Value<vector<Seed>>* seeds;
|
|
|
|
-Value<vector<PixRecHit>>* pixrec_hits;
|
|
|
|
-Value<vector<Track>>* tracks;
|
|
|
|
-Value<vector<SimHit>>* sim_hits;
|
|
|
|
-Value<vector<SimTrack>>* sim_tracks;
|
|
|
|
-
|
|
|
|
void register_objects(TrackingDataSet& tds){
|
|
void register_objects(TrackingDataSet& tds){
|
|
super_clusters = register_super_clusters(tds);
|
|
super_clusters = register_super_clusters(tds);
|
|
seeds = register_seeds(tds);
|
|
seeds = register_seeds(tds);
|
|
@@ -117,12 +141,6 @@ void register_objects(TrackingDataSet& 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){
|
|
void setup_skipped_layer_hit_pairs(TrackingDataSet& tds){
|
|
|
|
|
|
|
|
|
|
@@ -133,14 +151,13 @@ void setup_skipped_layer_hit_pairs(TrackingDataSet& tds){
|
|
vector<SimHit>,
|
|
vector<SimHit>,
|
|
vector<Track>,
|
|
vector<Track>,
|
|
vector<SimTrack>,
|
|
vector<SimTrack>,
|
|
- int, int, int, bool)>("find_matched_nth_hit_in_layer_with_skip",
|
|
+ PixDetElem, int, bool)>("find_matched_nth_hit_in_layer_with_skip",
|
|
FUNC(([](const vector<Seed>& seeds,
|
|
FUNC(([](const vector<Seed>& seeds,
|
|
const vector<PixRecHit>& pixrec_hits,
|
|
const vector<PixRecHit>& pixrec_hits,
|
|
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 unsigned int&& det,
|
|
+ const PixDetElem&& pixdet,
|
|
- const unsigned int&& pix_layer,
|
|
|
|
const unsigned int&& skip,
|
|
const unsigned int&& skip,
|
|
const bool&& first){
|
|
const bool&& first){
|
|
vector<HitPair> matched_hits;
|
|
vector<HitPair> matched_hits;
|
|
@@ -157,7 +174,7 @@ void setup_skipped_layer_hit_pairs(TrackingDataSet& tds){
|
|
const PixRecHit &rec_hit1 = pixrec_hits[seed.hitIdx[0]];
|
|
const PixRecHit &rec_hit1 = pixrec_hits[seed.hitIdx[0]];
|
|
const PixRecHit &rec_hit2 = pixrec_hits[seed.hitIdx[1]];
|
|
const PixRecHit &rec_hit2 = pixrec_hits[seed.hitIdx[1]];
|
|
if(first){
|
|
if(first){
|
|
- if(in_det(rec_hit1, det, pix_layer) && in_det(rec_hit2, det, pix_layer+1+skip)){
|
|
+ if(pixdet.contains(rec_hit1) && pixdet.contains((PixSubDet)rec_hit2.det, rec_hit2.lay-1-skip)){
|
|
|
|
|
|
if(rec_hit1.simHitIdx.size() == 0) continue;
|
|
if(rec_hit1.simHitIdx.size() == 0) continue;
|
|
if(trk.simTrkIdx.size() == 0) continue;
|
|
if(trk.simTrkIdx.size() == 0) continue;
|
|
@@ -168,7 +185,7 @@ void setup_skipped_layer_hit_pairs(TrackingDataSet& tds){
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
- if(in_det(rec_hit2, det, pix_layer) && in_det(rec_hit1, det, pix_layer-1-skip)){
|
|
+ if(pixdet.contains(rec_hit2) && pixdet.contains((PixSubDet)rec_hit1.det, rec_hit2.lay+1+skip)){
|
|
|
|
|
|
if(rec_hit2.simHitIdx.size() == 0) continue;
|
|
if(rec_hit2.simHitIdx.size() == 0) continue;
|
|
if(trk.simTrkIdx.size() == 0) continue;
|
|
if(trk.simTrkIdx.size() == 0) continue;
|
|
@@ -183,10 +200,10 @@ void setup_skipped_layer_hit_pairs(TrackingDataSet& tds){
|
|
return matched_hits;
|
|
return matched_hits;
|
|
})));
|
|
})));
|
|
|
|
|
|
- auto pix_barrel = constant("PIXEL_BARREL", PIXEL_BARREL);
|
|
+ auto BPIX_L1 = constant("BPIX_L1", PixDetElem(PixSubDet::Barrel, 1));
|
|
- auto pix_endcap = constant("PIXEL_ENDCAP", PIXEL_ENDCAP);
|
|
+ auto BPIX_L2 = constant("BPIX_L2", PixDetElem(PixSubDet::Barrel, 2));
|
|
- auto L1 = constant("L1", 1);
|
|
+ auto FPIX_L1 = constant("FPIX_L1", PixDetElem(PixSubDet::EndCap, 1));
|
|
- auto L2 = constant("L2", 2);
|
|
+ auto FPIX_L2 = constant("FPIX_L2", PixDetElem(PixSubDet::EndCap, 2));
|
|
|
|
|
|
auto skip_zero = constant("skip_zero", 0);
|
|
auto skip_zero = constant("skip_zero", 0);
|
|
auto skip_one = constant("skip_one", 1);
|
|
auto skip_one = constant("skip_one", 1);
|
|
@@ -197,27 +214,27 @@ void setup_skipped_layer_hit_pairs(TrackingDataSet& tds){
|
|
|
|
|
|
|
|
|
|
auto first_hits_in_B1_skip_zero = fv::tup_apply(find_matched_nth_hit_in_layer_with_skip,
|
|
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), "first_hits_in_B1_skip_zero");
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, BPIX_L1, skip_zero, first), "first_hits_in_B1_skip_zero");
|
|
auto first_hits_in_B2_skip_zero = fv::tup_apply(find_matched_nth_hit_in_layer_with_skip,
|
|
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), "first_hits_in_B2_skip_zero");
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, BPIX_L2, skip_zero, first), "first_hits_in_B2_skip_zero");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto first_hits_in_F1_skip_zero = fv::tup_apply(find_matched_nth_hit_in_layer_with_skip,
|
|
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), "first_hits_in_F1_skip_zero");
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, FPIX_L1, skip_zero, first), "first_hits_in_F1_skip_zero");
|
|
auto first_hits_in_F2_skip_zero = fv::tup_apply(find_matched_nth_hit_in_layer_with_skip,
|
|
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), "first_hits_in_F2_skip_zero");
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, FPIX_L2, skip_zero, first), "first_hits_in_F2_skip_zero");
|
|
|
|
|
|
|
|
|
|
auto first_hits_in_B1_skip_one = fv::tup_apply(find_matched_nth_hit_in_layer_with_skip,
|
|
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), "first_hits_in_B1_skip_one");
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, BPIX_L1, skip_one, first), "first_hits_in_B1_skip_one");
|
|
auto first_hits_in_B2_skip_one = fv::tup_apply(find_matched_nth_hit_in_layer_with_skip,
|
|
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), "first_hits_in_B2_skip_one");
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, BPIX_L2, skip_one, first), "first_hits_in_B2_skip_one");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto first_hits_in_F1_skip_one = fv::tup_apply(find_matched_nth_hit_in_layer_with_skip,
|
|
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), "first_hits_in_F1_skip_one");
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, FPIX_L1, skip_one, first), "first_hits_in_F1_skip_one");
|
|
|
|
|
|
|
|
|
|
TH2Params params_dz = {"$\\eta$", 100, -4, 4,
|
|
TH2Params params_dz = {"$\\eta$", 100, -4, 4,
|
|
@@ -258,14 +275,13 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
vector<SimHit>,
|
|
vector<SimHit>,
|
|
vector<Track>,
|
|
vector<Track>,
|
|
vector<SimTrack>,
|
|
vector<SimTrack>,
|
|
- int, int, int)>("find_matched_nth_hit_in_layer",
|
|
+ PixDetElem, int)>("find_matched_nth_hit_in_layer",
|
|
FUNC(([](const vector<Seed>& seeds,
|
|
FUNC(([](const vector<Seed>& seeds,
|
|
const vector<PixRecHit>& pixrec_hits,
|
|
const vector<PixRecHit>& pixrec_hits,
|
|
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 unsigned int&& det,
|
|
+ const PixDetElem&& pixdet,
|
|
- const unsigned int&& pix_layer,
|
|
|
|
const unsigned int&& hit_number){
|
|
const unsigned int&& hit_number){
|
|
vector<HitPair> matched_hits;
|
|
vector<HitPair> matched_hits;
|
|
for(const Track &trk : tracks){
|
|
for(const Track &trk : tracks){
|
|
@@ -274,7 +290,7 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
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;
|
|
if(seed.hitType[hit_number] != HIT_TYPE_PIXEL) continue;
|
|
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(pixdet.contains(rec_hit)){
|
|
|
|
|
|
if(rec_hit.simHitIdx.size() == 0) continue;
|
|
if(rec_hit.simHitIdx.size() == 0) continue;
|
|
if(trk.simTrkIdx.size() == 0) continue;
|
|
if(trk.simTrkIdx.size() == 0) continue;
|
|
@@ -288,34 +304,40 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
return matched_hits;
|
|
return matched_hits;
|
|
})));
|
|
})));
|
|
|
|
|
|
- auto barrel_val = constant("PIXEL_BARREL", PIXEL_BARREL);
|
|
+ auto BPIX_L1 = constant("BPIX_L1", PixDetElem(PixSubDet::Barrel, 1));
|
|
- auto endcap_val = constant("PIXEL_ENDCAP", PIXEL_ENDCAP);
|
|
+ auto BPIX_L2 = constant("BPIX_L2", PixDetElem(PixSubDet::Barrel, 2));
|
|
|
|
+ auto BPIX_L3 = constant("BPIX_L3", PixDetElem(PixSubDet::Barrel, 3));
|
|
|
|
+ auto BPIX_L4 = constant("BPIX_L4", PixDetElem(PixSubDet::Barrel, 4));
|
|
|
|
+ auto FPIX_L1 = constant("FPIX_L1", PixDetElem(PixSubDet::EndCap, 1));
|
|
|
|
+ auto FPIX_L2 = constant("FPIX_L2", PixDetElem(PixSubDet::EndCap, 2));
|
|
|
|
+ auto FPIX_L3 = constant("FPIX_L3", PixDetElem(PixSubDet::EndCap, 3));
|
|
|
|
+
|
|
auto first_hit = constant("1st", 0);
|
|
auto first_hit = constant("1st", 0);
|
|
auto second_hit = constant("2nd", 1);
|
|
auto second_hit = constant("2nd", 1);
|
|
|
|
|
|
-
|
|
+
|
|
auto first_hits_in_B1 = fv::tup_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, BPIX_L1, first_hit), "first_hits_in_B1");
|
|
auto first_hits_in_B2 = fv::tup_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, BPIX_L2, first_hit), "first_hits_in_B2");
|
|
|
|
|
|
|
|
|
|
auto second_hits_in_B2 = fv::tup_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, BPIX_L2, second_hit), "second_hits_in_B2");
|
|
auto second_hits_in_B3 = fv::tup_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, BPIX_L3, second_hit), "second_hits_in_B3");
|
|
auto second_hits_in_B4 = fv::tup_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, BPIX_L4, second_hit), "second_hits_in_B4");
|
|
|
|
|
|
auto first_hits_in_F1 = fv::tup_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, FPIX_L1, first_hit), "first_hits_in_F1");
|
|
auto first_hits_in_F2 = fv::tup_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, FPIX_L2, first_hit), "first_hits_in_F2");
|
|
|
|
|
|
auto second_hits_in_F2 = fv::tup_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, FPIX_L2, second_hit), "second_hits_in_F2");
|
|
auto second_hits_in_F3 = fv::tup_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, FPIX_L3, second_hit), "second_hits_in_F3");
|
|
|
|
|
|
|
|
|
|
auto even = constant("even", false);
|
|
auto even = constant("even", false);
|
|
@@ -347,7 +369,7 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
|
|
|
|
auto calc_dphi_v_eta = lookup_function<pair_vec(vector<HitPair>)>("calc_dphi_v_eta");
|
|
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)", 150, -.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, 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);
|
|
@@ -501,52 +523,54 @@ void sc_value_hists_for_lb(TrackingDataSet& tds, std::function<bool(int)>& parit
|
|
auto relabel = [label](const std::string&& base){
|
|
auto relabel = [label](const std::string&& base){
|
|
return base + "_" + label;
|
|
return base + "_" + label;
|
|
};
|
|
};
|
|
|
|
+ auto BPIX_L1 = constant("BPIX_L1", PixDetElem(PixSubDet::Barrel, 1));
|
|
|
|
+ auto FPIX_L1 = constant("FPIX_L1", PixDetElem(PixSubDet::EndCap, 1));
|
|
|
|
+ auto BPIX_L2 = constant("BPIX_L2", PixDetElem(PixSubDet::Barrel, 2));
|
|
|
|
+ auto FPIX_L2 = constant("FPIX_L2", PixDetElem(PixSubDet::EndCap, 2));
|
|
|
|
+ auto BPIX_L3 = constant("BPIX_L3", PixDetElem(PixSubDet::Barrel, 3));
|
|
|
|
+ auto FPIX_L3 = constant("FPIX_L2", PixDetElem(PixSubDet::EndCap, 3));
|
|
|
|
+ auto BPIX_L4 = constant("BPIX_L4", PixDetElem(PixSubDet::Barrel, 4));
|
|
|
|
+
|
|
|
|
|
|
- auto pix_barrel = constant("PIXEL_BARREL", PIXEL_BARREL);
|
|
|
|
- auto pix_endcap = constant("PIXEL_ENDCAP", PIXEL_ENDCAP);
|
|
|
|
auto first_hit = constant("1st", 0);
|
|
auto first_hit = constant("1st", 0);
|
|
auto second_hit = constant("2nd", 1);
|
|
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 dRz = constant("dRz", true);
|
|
auto dPhi = constant("dPhi", false);
|
|
auto dPhi = constant("dPhi", false);
|
|
|
|
|
|
auto pcheck = constant(label, parity_check);
|
|
auto pcheck = constant(label, parity_check);
|
|
auto sc_hit_residuals = lookup_function<
|
|
auto sc_hit_residuals = lookup_function<
|
|
- pair_vec(vector<SuperCluster>, int, int, int, bool, std::function<bool(int)>)>("sc_hit_residuals");
|
|
+ pair_vec(vector<SuperCluster>, PixDetElem, int, bool, std::function<bool(int)>)>("sc_hit_residuals");
|
|
|
|
|
|
|
|
|
|
auto sc_first_hits_in_B1_dz = fv::tup_apply(sc_hit_residuals,
|
|
auto sc_first_hits_in_B1_dz = fv::tup_apply(sc_hit_residuals,
|
|
- fv::tuple(super_clusters, pix_barrel, L1, first_hit, dRz, pcheck), relabel("sc_first_hits_in_B1_dz"));
|
|
+ fv::tuple(super_clusters, BPIX_L1, first_hit, dRz, pcheck), relabel("sc_first_hits_in_B1_dz"));
|
|
auto sc_first_hits_in_B2_dz = fv::tup_apply(sc_hit_residuals,
|
|
auto sc_first_hits_in_B2_dz = fv::tup_apply(sc_hit_residuals,
|
|
- fv::tuple(super_clusters, pix_barrel, L2, first_hit, dRz, pcheck), relabel("sc_first_hits_in_B2_dz"));
|
|
+ fv::tuple(super_clusters, BPIX_L2, first_hit, dRz, pcheck), relabel("sc_first_hits_in_B2_dz"));
|
|
auto sc_first_hits_in_B3_dz = fv::tup_apply(sc_hit_residuals,
|
|
auto sc_first_hits_in_B3_dz = fv::tup_apply(sc_hit_residuals,
|
|
- fv::tuple(super_clusters, pix_barrel, L3, first_hit, dRz, pcheck), relabel("sc_first_hits_in_B3_dz"));
|
|
+ fv::tuple(super_clusters, BPIX_L3, first_hit, dRz, pcheck), relabel("sc_first_hits_in_B3_dz"));
|
|
|
|
|
|
auto sc_first_hits_in_B1_dphi = fv::tup_apply(sc_hit_residuals,
|
|
auto sc_first_hits_in_B1_dphi = fv::tup_apply(sc_hit_residuals,
|
|
- fv::tuple(super_clusters, pix_barrel, L1, first_hit, dPhi, pcheck), relabel("sc_first_hits_in_B1_dphi"));
|
|
+ fv::tuple(super_clusters, BPIX_L1, first_hit, dPhi, pcheck), relabel("sc_first_hits_in_B1_dphi"));
|
|
auto sc_first_hits_in_B2_dphi = fv::tup_apply(sc_hit_residuals,
|
|
auto sc_first_hits_in_B2_dphi = fv::tup_apply(sc_hit_residuals,
|
|
- fv::tuple(super_clusters, pix_barrel, L2, first_hit, dPhi, pcheck), relabel("sc_first_hits_in_B2_dphi"));
|
|
+ fv::tuple(super_clusters, BPIX_L2, first_hit, dPhi, pcheck), relabel("sc_first_hits_in_B2_dphi"));
|
|
auto sc_first_hits_in_B3_dphi = fv::tup_apply(sc_hit_residuals,
|
|
auto sc_first_hits_in_B3_dphi = fv::tup_apply(sc_hit_residuals,
|
|
- fv::tuple(super_clusters, pix_barrel, L3, first_hit, dPhi, pcheck), relabel("sc_first_hits_in_B3_dphi"));
|
|
+ fv::tuple(super_clusters, BPIX_L3, first_hit, dPhi, pcheck), relabel("sc_first_hits_in_B3_dphi"));
|
|
|
|
|
|
|
|
|
|
auto sc_second_hits_in_B2_dz = fv::tup_apply(sc_hit_residuals,
|
|
auto sc_second_hits_in_B2_dz = fv::tup_apply(sc_hit_residuals,
|
|
- fv::tuple(super_clusters, pix_barrel, L2, second_hit, dRz, pcheck), relabel("sc_second_hits_in_B2_dz"));
|
|
+ fv::tuple(super_clusters, BPIX_L2, second_hit, dRz, pcheck), relabel("sc_second_hits_in_B2_dz"));
|
|
auto sc_second_hits_in_B3_dz = fv::tup_apply(sc_hit_residuals,
|
|
auto sc_second_hits_in_B3_dz = fv::tup_apply(sc_hit_residuals,
|
|
- fv::tuple(super_clusters, pix_barrel, L3, second_hit, dRz, pcheck), relabel("sc_second_hits_in_B3_dz"));
|
|
+ fv::tuple(super_clusters, BPIX_L3, second_hit, dRz, pcheck), relabel("sc_second_hits_in_B3_dz"));
|
|
auto sc_second_hits_in_B4_dz = fv::tup_apply(sc_hit_residuals,
|
|
auto sc_second_hits_in_B4_dz = fv::tup_apply(sc_hit_residuals,
|
|
- fv::tuple(super_clusters, pix_barrel, L4, second_hit, dRz, pcheck), relabel("sc_second_hits_in_B4_dz"));
|
|
+ fv::tuple(super_clusters, BPIX_L4, second_hit, dRz, pcheck), relabel("sc_second_hits_in_B4_dz"));
|
|
|
|
|
|
auto sc_second_hits_in_B2_dphi = fv::tup_apply(sc_hit_residuals,
|
|
auto sc_second_hits_in_B2_dphi = fv::tup_apply(sc_hit_residuals,
|
|
- fv::tuple(super_clusters, pix_barrel, L2, second_hit, dPhi, pcheck), relabel("sc_second_hits_in_B2_dphi"));
|
|
+ fv::tuple(super_clusters, BPIX_L2, second_hit, dPhi, pcheck), relabel("sc_second_hits_in_B2_dphi"));
|
|
auto sc_second_hits_in_B3_dphi = fv::tup_apply(sc_hit_residuals,
|
|
auto sc_second_hits_in_B3_dphi = fv::tup_apply(sc_hit_residuals,
|
|
- fv::tuple(super_clusters, pix_barrel, L3, second_hit, dPhi, pcheck), relabel("sc_second_hits_in_B3_dphi"));
|
|
+ fv::tuple(super_clusters, BPIX_L3, second_hit, dPhi, pcheck), relabel("sc_second_hits_in_B3_dphi"));
|
|
auto sc_second_hits_in_B4_dphi = fv::tup_apply(sc_hit_residuals,
|
|
auto sc_second_hits_in_B4_dphi = fv::tup_apply(sc_hit_residuals,
|
|
- fv::tuple(super_clusters, pix_barrel, L4, second_hit, dPhi, pcheck), relabel("sc_second_hits_in_B4_dphi"));
|
|
+ fv::tuple(super_clusters, BPIX_L4, second_hit, dPhi, pcheck), relabel("sc_second_hits_in_B4_dphi"));
|
|
|
|
|
|
TH2Params params_dz = {"$\\eta$", 100, -4, 4,
|
|
TH2Params params_dz = {"$\\eta$", 100, -4, 4,
|
|
"$\\delta z$(cm)", 100, -0.7, 0.7};
|
|
"$\\delta z$(cm)", 100, -0.7, 0.7};
|
|
@@ -571,7 +595,7 @@ void sc_value_hists_for_lb(TrackingDataSet& tds, std::function<bool(int)>& parit
|
|
"Second Hit in BPIX-L4", params_dz);
|
|
"Second Hit in BPIX-L4", params_dz);
|
|
|
|
|
|
TH2Params params_dphi = {"$\\eta$", 100, -4, 4,
|
|
TH2Params params_dphi = {"$\\eta$", 100, -4, 4,
|
|
- "$\\delta \\phi$(rad)", 500, -0.7, 0.7};
|
|
+ "$\\delta \\phi$(rad)", 1500, -0.7, 0.7};
|
|
tds.register_container<ContainerTH2Many<float>>(relabel("sc_first_hits_in_B1_dphi"),
|
|
tds.register_container<ContainerTH2Many<float>>(relabel("sc_first_hits_in_B1_dphi"),
|
|
sc_first_hits_in_B1_dphi,
|
|
sc_first_hits_in_B1_dphi,
|
|
"First Hit in BPIX-L1", params_dphi);
|
|
"First Hit in BPIX-L1", params_dphi);
|
|
@@ -595,12 +619,21 @@ void sc_value_hists_for_lb(TrackingDataSet& tds, std::function<bool(int)>& parit
|
|
|
|
|
|
void setup_sc_residuals(TrackingDataSet& tds){
|
|
void setup_sc_residuals(TrackingDataSet& tds){
|
|
|
|
|
|
|
|
+
|
|
|
|
+ * examins the matched pixel hits. It calculates a residual based on the
|
|
|
|
+ * extrapolated position of the SC track and the position of the matched
|
|
|
|
+ * hit.
|
|
|
|
+ * det: 1 for barrel, 2 for endcap
|
|
|
|
+ * pix_layer: 1-4 for barrel, 1-3 for endcap
|
|
|
|
+ * hit_number: examin either the first or second matched hit
|
|
|
|
+ * sel_dRz: True: calculate dR, False: calculate dz
|
|
|
|
+ * pcheck: a boolean function that filters residuals based on
|
|
|
|
+ * ladder/blade. Normally used to select either even or odd ladders.
|
|
|
|
+ */
|
|
func<pair_vec(vector<SuperCluster>,
|
|
func<pair_vec(vector<SuperCluster>,
|
|
- int, int, int, bool,
|
|
+ PixDetElem, int, bool, std::function<bool(int)>)>("sc_hit_residuals",
|
|
- std::function<bool(int)>)>("sc_hit_residuals",
|
|
|
|
FUNC(([](const vector<SuperCluster>& super_clusters,
|
|
FUNC(([](const vector<SuperCluster>& super_clusters,
|
|
- const int&& det,
|
|
+ const PixDetElem&& pixdet,
|
|
- const int&& pix_layer,
|
|
|
|
const int&& hit_number,
|
|
const int&& hit_number,
|
|
const bool&& sel_dRz,
|
|
const bool&& sel_dRz,
|
|
const std::function<bool(int)>& pcheck){
|
|
const std::function<bool(int)>& pcheck){
|
|
@@ -612,12 +645,12 @@ void setup_sc_residuals(TrackingDataSet& tds){
|
|
unsigned int nSeeds = super_cluster.charge.size();
|
|
unsigned int nSeeds = super_cluster.charge.size();
|
|
for(unsigned int seedIdx=0; seedIdx<nSeeds; seedIdx++){
|
|
for(unsigned int seedIdx=0; seedIdx<nSeeds; seedIdx++){
|
|
if(hit_number == 0){
|
|
if(hit_number == 0){
|
|
- if(super_cluster.lay1[seedIdx] != pix_layer || super_cluster.subDet1[seedIdx] != det) continue;
|
|
+ if(!pixdet.contains((PixSubDet)super_cluster.subDet1[seedIdx], super_cluster.lay1[seedIdx])) continue;
|
|
dRz = super_cluster.dRz1[seedIdx];
|
|
dRz = super_cluster.dRz1[seedIdx];
|
|
dPhi = super_cluster.dPhi1[seedIdx];
|
|
dPhi = super_cluster.dPhi1[seedIdx];
|
|
ladder_blade = super_cluster.ladder_blade1[seedIdx];
|
|
ladder_blade = super_cluster.ladder_blade1[seedIdx];
|
|
}else{
|
|
}else{
|
|
- if(super_cluster.lay2[seedIdx] != pix_layer || super_cluster.subDet2[seedIdx] != det) continue;
|
|
+ if(!pixdet.contains((PixSubDet)super_cluster.subDet2[seedIdx], super_cluster.lay2[seedIdx])) continue;
|
|
dRz = super_cluster.dRz2[seedIdx];
|
|
dRz = super_cluster.dRz2[seedIdx];
|
|
dPhi = super_cluster.dPhi2[seedIdx];
|
|
dPhi = super_cluster.dPhi2[seedIdx];
|
|
ladder_blade = super_cluster.ladder_blade2[seedIdx];
|
|
ladder_blade = super_cluster.ladder_blade2[seedIdx];
|
|
@@ -646,6 +679,102 @@ void setup_sc_residuals(TrackingDataSet& tds){
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+void setup_residual_cross_corrolations(TrackingDataSet& tds){
|
|
|
|
+
|
|
|
|
+ * Interesting cross-corrolations
|
|
|
|
+ * for hit1 in L1 or L2
|
|
|
|
+ * dphi2 v dz1
|
|
|
|
+ * dz2 v dz1
|
|
|
|
+ * dphi2 v dphi1
|
|
|
|
+ * dz2 v dphi1
|
|
|
|
+ */
|
|
|
|
+ enum Res{
|
|
|
|
+ dz1,
|
|
|
|
+ dz2,
|
|
|
|
+ dPhi1,
|
|
|
|
+ dPhi2
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ auto sc_cross_correlations = func<pair_vec(vector<SuperCluster>,
|
|
|
|
+ PixDetElem, PixDetElem, Res, Res)>("sc_cross_correlations",
|
|
|
|
+ FUNC(([](const vector<SuperCluster>& super_clusters,
|
|
|
|
+ const PixDetElem&& subdet1,
|
|
|
|
+ const PixDetElem&& subdet2,
|
|
|
|
+ const Res&& res1,
|
|
|
|
+ const Res&& res2){
|
|
|
|
+ vector<float> residuals1;
|
|
|
|
+ vector<float> residuals2;
|
|
|
|
+ for(const SuperCluster& super_cluster : super_clusters){
|
|
|
|
+ unsigned int nSeeds = super_cluster.charge.size();
|
|
|
|
+ for(unsigned int seedIdx=0; seedIdx<nSeeds; seedIdx++){
|
|
|
|
+ if (!subdet1.contains((PixSubDet)super_cluster.subDet1[seedIdx],super_cluster.lay1[seedIdx]) ||
|
|
|
|
+ !subdet2.contains((PixSubDet)super_cluster.subDet2[seedIdx],super_cluster.lay2[seedIdx]))
|
|
|
|
+ continue;
|
|
|
|
+ switch(res1){
|
|
|
|
+ case Res::dz1:
|
|
|
|
+ residuals1.push_back(super_cluster.dRz1[seedIdx]);
|
|
|
|
+ break;
|
|
|
|
+ case Res::dz2:
|
|
|
|
+ residuals1.push_back(super_cluster.dRz2[seedIdx]);
|
|
|
|
+ break;
|
|
|
|
+ case Res::dPhi1:
|
|
|
|
+ residuals1.push_back(super_cluster.dPhi1[seedIdx]);
|
|
|
|
+ break;
|
|
|
|
+ case Res::dPhi2:
|
|
|
|
+ residuals1.push_back(super_cluster.dPhi2[seedIdx]);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ switch(res2){
|
|
|
|
+ case Res::dz1:
|
|
|
|
+ residuals2.push_back(super_cluster.dRz1[seedIdx]);
|
|
|
|
+ break;
|
|
|
|
+ case Res::dz2:
|
|
|
|
+ residuals2.push_back(super_cluster.dRz2[seedIdx]);
|
|
|
|
+ break;
|
|
|
|
+ case Res::dPhi1:
|
|
|
|
+ residuals2.push_back(super_cluster.dPhi1[seedIdx]);
|
|
|
|
+ break;
|
|
|
|
+ case Res::dPhi2:
|
|
|
|
+ residuals2.push_back(super_cluster.dPhi2[seedIdx]);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return std::make_pair(residuals1,residuals2);
|
|
|
|
+ })));
|
|
|
|
+
|
|
|
|
+ auto BPIX_L1 = constant("BPIX_L1", PixDetElem(PixSubDet::Barrel, 1));
|
|
|
|
+ auto BPIX_L2 = constant("BPIX_L2", PixDetElem(PixSubDet::Barrel, 2));
|
|
|
|
+ auto BPIX_L3 = constant("BPIX_L3", PixDetElem(PixSubDet::Barrel, 3));
|
|
|
|
+ auto BPIX_L4 = constant("BPIX_L4", PixDetElem(PixSubDet::Barrel, 4));
|
|
|
|
+
|
|
|
|
+ auto v_dz1 = constant("dz1", Res::dz1);
|
|
|
|
+ auto v_dz2 = constant("dz2", Res::dz2);
|
|
|
|
+ auto v_dPhi2 = constant("dPhi2", Res::dPhi2);
|
|
|
|
+
|
|
|
|
+ auto sc_dphi2_v_dz1_L1_L2 = fv::tup_apply(sc_cross_correlations,
|
|
|
|
+ fv::tuple(super_clusters, BPIX_L1, BPIX_L2, v_dPhi2, v_dz1), "sc_dphi1_v_dz1_L1_L2");
|
|
|
|
+
|
|
|
|
+ auto sc_dz2_v_dz1_L1_L2 = fv::tup_apply(sc_cross_correlations,
|
|
|
|
+ fv::tuple(super_clusters, BPIX_L1, BPIX_L2, v_dz2, v_dz1), "sc_dz2_v_dz1_L1_L2");
|
|
|
|
+
|
|
|
|
+ TH2Params hist_params;
|
|
|
|
+ hist_params = {"$\\Delta \\phi_2$(rad)", 100, -.01, .01,
|
|
|
|
+ "$\\Delta z_1$(cm)", 100, -.01, .01};
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("sc_dphi2_v_dz1_L1_L2",
|
|
|
|
+ sc_dphi2_v_dz1_L1_L2,
|
|
|
|
+ "sc_dphi2_v_dz1_L1_L2", hist_params);
|
|
|
|
+ hist_params = {"$\\Delta z_2$(cm)", 100, -.01, .01,
|
|
|
|
+ "$\\Delta z_1$(cm)", 100, -.01, .01};
|
|
|
|
+ tds.register_container<ContainerTH2Many<float>>("sc_dz2_v_dz1_L1_L2",
|
|
|
|
+ sc_dz2_v_dz1_L1_L2,
|
|
|
|
+ "sc_dz2_v_dz1_L1_L2", hist_params);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
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){
|
|
@@ -657,12 +786,13 @@ 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");
|
|
|
|
|
|
- register_objects(tds);
|
|
+
|
|
- setup_hit_pair_functions();
|
|
+
|
|
|
|
|
|
- setup_first_hit_pairs(tds);
|
|
+
|
|
- setup_skipped_layer_hit_pairs(tds);
|
|
+
|
|
- setup_sc_residuals(tds);
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
tds.process(silent);
|
|
tds.process(silent);
|