|
@@ -122,6 +122,7 @@ 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
|
|
@@ -196,27 +197,27 @@ void setup_skipped_layer_hit_pairs(TrackingDataSet& tds){
|
|
|
|
|
|
// 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");
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_barrel, 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,
|
|
|
- fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_barrel, L2, skip_zero), "first_hits_in_B2_skip_zero");
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_barrel, L2, skip_zero, first), "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");
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_endcap, 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,
|
|
|
- fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_endcap, L2, skip_zero), "first_hits_in_F2_skip_zero");
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_endcap, L2, skip_zero, first), "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");
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_barrel, 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,
|
|
|
- fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_barrel, L2, skip_one), "first_hits_in_B2_skip_one");
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_barrel, L2, skip_one, first), "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");
|
|
|
+ fv::tuple(seeds, pixrec_hits, sim_hits, tracks, sim_tracks, pix_endcap, L1, skip_one, first), "first_hits_in_F1_skip_one");
|
|
|
|
|
|
|
|
|
TH2Params params_dz = {"$\\eta$", 100, -4, 4,
|
|
@@ -494,47 +495,15 @@ void setup_first_hit_pairs(TrackingDataSet& tds){
|
|
|
}
|
|
|
|
|
|
|
|
|
-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);
|
|
|
- })));
|
|
|
+void sc_value_hists_for_lb(TrackingDataSet& tds, std::function<bool(int)>& parity_check,
|
|
|
+ const std::string& label){
|
|
|
|
|
|
+ auto relabel = [label](const std::string&& base){
|
|
|
+ return base + "_" + label;
|
|
|
+ };
|
|
|
|
|
|
auto pix_barrel = constant("PIXEL_BARREL", PIXEL_BARREL);
|
|
|
- /* auto pix_endcap = constant<unsigned int>("PIXEL_ENDCAP", PIXEL_ENDCAP); */
|
|
|
+ auto pix_endcap = constant("PIXEL_ENDCAP", PIXEL_ENDCAP);
|
|
|
auto first_hit = constant("1st", 0);
|
|
|
auto second_hit = constant("2nd", 1);
|
|
|
auto L1 = constant("L1", 1);
|
|
@@ -545,80 +514,138 @@ void setup_sc_residuals(TrackingDataSet& tds){
|
|
|
auto dRz = constant("dRz", true);
|
|
|
auto dPhi = constant("dPhi", false);
|
|
|
|
|
|
- // First hits on inner two bpix layers
|
|
|
+ auto pcheck = constant(label, parity_check);
|
|
|
+ auto sc_hit_residuals = lookup_function<
|
|
|
+ pair_vec(vector<SuperCluster>, int, int, int, bool, std::function<bool(int)>)>("sc_hit_residuals");
|
|
|
+
|
|
|
+ // First hits on inner three 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");
|
|
|
+ fv::tuple(super_clusters, pix_barrel, 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,
|
|
|
- fv::tuple(super_clusters, pix_barrel, L2, first_hit, dRz), "sc_first_hits_in_B2_dz");
|
|
|
+ fv::tuple(super_clusters, pix_barrel, 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,
|
|
|
- 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");
|
|
|
+ fv::tuple(super_clusters, pix_barrel, 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,
|
|
|
- fv::tuple(super_clusters, pix_barrel, L1, first_hit, dPhi), "sc_first_hits_in_B1_dphi");
|
|
|
+ fv::tuple(super_clusters, pix_barrel, 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,
|
|
|
- fv::tuple(super_clusters, pix_barrel, L2, first_hit, dPhi), "sc_first_hits_in_B2_dphi");
|
|
|
+ fv::tuple(super_clusters, pix_barrel, 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,
|
|
|
- fv::tuple(super_clusters, pix_barrel, L3, first_hit, dPhi), "sc_first_hits_in_B3_dphi");
|
|
|
+ fv::tuple(super_clusters, pix_barrel, L3, first_hit, dPhi, pcheck), relabel("sc_first_hits_in_B3_dphi"));
|
|
|
+
|
|
|
+ // Second hits on outer three bpix layers
|
|
|
+ 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"));
|
|
|
+ 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"));
|
|
|
+ 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"));
|
|
|
|
|
|
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");
|
|
|
+ fv::tuple(super_clusters, pix_barrel, 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,
|
|
|
- fv::tuple(super_clusters, pix_barrel, L3, second_hit, dPhi), "sc_second_hits_in_B3_dphi");
|
|
|
+ fv::tuple(super_clusters, pix_barrel, 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,
|
|
|
- fv::tuple(super_clusters, pix_barrel, L4, second_hit, dPhi), "sc_second_hits_in_B4_dphi");
|
|
|
+ fv::tuple(super_clusters, pix_barrel, L4, second_hit, dPhi, pcheck), relabel("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",
|
|
|
+ tds.register_container<ContainerTH2Many<float>>(relabel("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",
|
|
|
+ tds.register_container<ContainerTH2Many<float>>(relabel("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",
|
|
|
+ tds.register_container<ContainerTH2Many<float>>(relabel("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",
|
|
|
+ tds.register_container<ContainerTH2Many<float>>(relabel("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",
|
|
|
+ tds.register_container<ContainerTH2Many<float>>(relabel("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",
|
|
|
+ tds.register_container<ContainerTH2Many<float>>(relabel("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",
|
|
|
+ tds.register_container<ContainerTH2Many<float>>(relabel("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",
|
|
|
+ tds.register_container<ContainerTH2Many<float>>(relabel("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",
|
|
|
+ tds.register_container<ContainerTH2Many<float>>(relabel("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",
|
|
|
+ tds.register_container<ContainerTH2Many<float>>(relabel("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",
|
|
|
+ tds.register_container<ContainerTH2Many<float>>(relabel("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",
|
|
|
+ tds.register_container<ContainerTH2Many<float>>(relabel("sc_second_hits_in_B4_dphi"),
|
|
|
sc_second_hits_in_B4_dphi,
|
|
|
"Second Hit in BPIX-L4", params_dphi);
|
|
|
}
|
|
|
|
|
|
+void setup_sc_residuals(TrackingDataSet& tds){
|
|
|
+
|
|
|
+ func<pair_vec(vector<SuperCluster>,
|
|
|
+ int, int, int, bool,
|
|
|
+ std::function<bool(int)>)>("sc_hit_residuals",
|
|
|
+ FUNC(([](const vector<SuperCluster>& super_clusters,
|
|
|
+ const int&& det,
|
|
|
+ const int&& pix_layer,
|
|
|
+ const int&& hit_number,
|
|
|
+ const bool&& sel_dRz,
|
|
|
+ const std::function<bool(int)>& pcheck){
|
|
|
+ vector<float> residuals;
|
|
|
+ vector<float> etas;
|
|
|
+ for(const SuperCluster& super_cluster : super_clusters){ // loop over all supser-clusters
|
|
|
+ float dRz, dPhi;
|
|
|
+ int ladder_blade;
|
|
|
+ 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];
|
|
|
+ ladder_blade = super_cluster.ladder_blade1[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];
|
|
|
+ ladder_blade = super_cluster.ladder_blade2[seedIdx];
|
|
|
+ }
|
|
|
+ DEBUG("New Seed, Idx: " << seedIdx << endl
|
|
|
+ << "\tdRz: " << dRz << endl
|
|
|
+ << "\tdPhi: " << dPhi << endl);
|
|
|
+ if(!pcheck(ladder_blade)) continue;
|
|
|
+ if(sel_dRz)
|
|
|
+ residuals.push_back(dRz);
|
|
|
+ else
|
|
|
+ residuals.push_back(dPhi);
|
|
|
+ etas.push_back(pseudorapidityP(super_cluster));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return std::make_pair(etas,residuals);
|
|
|
+ })));
|
|
|
+
|
|
|
+ std::function<bool(int)> even = [](const int& t){ return !(t%2); };
|
|
|
+ std::function<bool(int)> odd = [](const int& t){ return (t%2); };
|
|
|
+ std::function<bool(int)> both = [](const int&){ return true; };
|
|
|
+
|
|
|
+ sc_value_hists_for_lb(tds, even, "even");
|
|
|
+ sc_value_hists_for_lb(tds, odd, "odd");
|
|
|
+ sc_value_hists_for_lb(tds, both, "either");
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
void run_analysis(const vector<fv::util::DataFileDescriptor>& dfds, const string output_filename, bool silent){
|
|
|
gSystem->Load("libfilval.so");
|
|
|
auto replace_suffix = [](const std::string& input, const std::string& new_suffix){
|