Explorar o código

Incorporates new filval feature: yaml config file.

Caleb Fangmeier %!s(int64=7) %!d(string=hai) anos
pai
achega
7b7d436c1a
Modificáronse 6 ficheiros con 212 adicións e 66 borrados
  1. 5 4
      CMakeLists.txt
  2. 1 0
      analysis/TrackingNtuple.h
  3. 69 0
      analysis/config.yaml
  4. 47 47
      analysis/obj_types.cpp
  5. 89 14
      analysis/tracking_validation.cpp
  6. 1 1
      filval

+ 5 - 4
CMakeLists.txt

@@ -19,7 +19,7 @@ SET( EGAMMA_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
 SET( EGAMMA_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} )
 
 # Setup clang as the project compiler
-SET (CMAKE_CXX_COMPILER             "/usr/bin/clang++")
+SET (CMAKE_CXX_COMPILER             "/usr/bin/clang++" CACHE STRING "" FORCE)
 SET (CMAKE_CXX_FLAGS                "-Wall")
 SET (CMAKE_CXX_FLAGS_DEBUG          "-g")
 SET (CMAKE_CXX_FLAGS_MINSIZEREL     "-Os -DNDEBUG")
@@ -32,6 +32,7 @@ SET (CMAKE_NM      "/usr/bin/llvm-nm")
 SET (CMAKE_OBJDUMP "/usr/bin/llvm-objdump")
 SET (CMAKE_RANLIB  "/usr/bin/llvm-ranlib")
 
+
 LIST( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake )
 
 FIND_PACKAGE(Jupyter)
@@ -50,14 +51,14 @@ IF(NBCONVERT_FOUND)
 ENDIF(NBCONVERT_FOUND)
 
 FIND_PACKAGE(ROOT REQUIRED)
-INCLUDE_DIRECTORIES( SYSTEM ${ROOT_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
+INCLUDE_DIRECTORIES( SYSTEM ${ROOT_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/filval/yaml-cpp/include/ )
 
-# Adds the dictionary library for addiitonal type serialization
+# Adds the dictionary library for additonal type serialization
 SET( CLINGDICTFILE ${CMAKE_CURRENT_BINARY_DIR}/clingdict.cpp )
 ROOT_GENERATE_DICTIONARY( "" ${CMAKE_CURRENT_SOURCE_DIR}/filval/root/LinkDef.hpp ${CLINGDICTFILE} "" )
 ADD_LIBRARY( filval SHARED ${CLINGDICTFILE} )
 
 # Compiles main analysis routine
 ADD_EXECUTABLE(tracking_validation ${CMAKE_CURRENT_SOURCE_DIR}/analysis/tracking_validation.cpp)
-TARGET_LINK_LIBRARIES( tracking_validation filval ${ROOT_LIBRARIES} )
+TARGET_LINK_LIBRARIES( tracking_validation filval ${ROOT_LIBRARIES} ${CMAKE_CURRENT_SOURCE_DIR}/filval/yaml-cpp/build/libyaml-cpp.so )
 

+ 1 - 0
analysis/TrackingNtuple.h

@@ -877,6 +877,7 @@ void TrackingNtuple::Init(TTree *tree)
    scl_z = 0;
    scl_charge = 0;
    scl_lay1 = 0;
+   scl_lay2 = 0;
    scl_ladder_blade1 = 0;
    scl_ladder_blade2 = 0;
    scl_subDet1 = 0;

+ 69 - 0
analysis/config.yaml

@@ -0,0 +1,69 @@
+max-events: 100
+hist-params:
+    sc_dphi2_v_dz1_L1_L2:
+        label_x: "$\\Delta \\phi_2$(rad)"
+        nbins_x: 100
+        low_x: -.1
+        high_x: .1
+        label_y: "$\\Delta z_1$(cm)"
+        nbins_y: 100
+        low_y: -.5
+        high_y: .5
+    sc_dz2_v_dz1_L1_L2:
+        label_x: "$\\Delta z_2$(cm)"
+        nbins_x: 200
+        low_x: -15
+        high_x: 15
+        label_y: "$\\Delta z_1$(cm)"
+        nbins_y: 100
+        low_y: -.5
+        high_y: .5
+
+
+    sc_dphi2_v_dphi1_L1_L2:
+        label_x: "$\\Delta \\phi_2$(rad)"
+        nbins_x: 100
+        low_x: -.1
+        high_x: .1
+        label_y: "$\\Delta \\phi_1$(cm)"
+        nbins_y: 100
+        low_y: -.1
+        high_y: .1
+    sc_dz2_v_dphi1_L1_L2:
+        label_x: "$\\Delta z_2$(cm)"
+        nbins_x: 200
+        low_x: -15
+        high_x: 15
+        label_y: "$\\Delta \\phi_1$(cm)"
+        nbins_y: 100
+        low_y: -.1
+        high_y: .1
+
+
+    sc_dz2_v_dz1_L1_L2_zoom:
+        label_x: "$\\Delta z_2$(cm)"
+        nbins_x: 200
+        low_x: -0.2
+        high_x: 0.2
+        label_y: "$\\Delta z_1$(cm)"
+        nbins_y: 100
+        low_y: -.5
+        high_y: .5
+    sc_dz2_v_dphi1_L1_L2_zoom:
+        label_x: "$\\Delta z_2$(cm)"
+        nbins_x: 200
+        low_x: -0.2
+        high_x: 0.2
+        label_y: "$\\Delta \\phi_1$(cm)"
+        nbins_y: 100
+        low_y: -.1
+        high_y: .1
+    sc_dphi2_v_dphi1_L1_L2_zoom:
+        label_x: "$\\Delta \\phi_2$(rad)"
+        nbins_x: 100
+        low_x: -.01
+        high_x: .01
+        label_y: "$\\Delta \\phi_1$(cm)"
+        nbins_y: 100
+        low_y: -.1
+        high_y: .1

+ 47 - 47
analysis/obj_types.cpp

@@ -283,53 +283,53 @@ struct Seed {
 Value<vector<Seed>>*
 register_seeds(TrackingDataSet &tds){
     auto builder = func<std::vector<Seed>(vector<short>,          // fitok;
-                                               vector<float>,          // px;
-                                               vector<float>,          // py;
-                                               vector<float>,          // pz;
-                                               vector<float>,          // pt;
-                                               vector<float>,          // eta;
-                                               vector<float>,          // phi;
-                                               vector<float>,          // dxy;
-                                               vector<float>,          // dz;
-                                               vector<float>,          // ptErr;
-                                               vector<float>,          // etaErr;
-                                               vector<float>,          // phiErr;
-                                               vector<float>,          // dxyErr;
-                                               vector<float>,          // dzErr;
-                                               vector<float>,          // chi2;
-                                               vector<int>,            // q;
-                                               vector<unsigned int>,   // nValid;
-                                               vector<unsigned int>,   // nPixel;
-                                               vector<unsigned int>,   // nGlued;
-                                               vector<unsigned int>,   // nStrip;
-                                               vector<unsigned int>,   // algo;
-                                               vector<unsigned int>,   // algoOriginal;
-                                               vector<int>,            // trkIdx;
-                                               vector<vector<float> >, // shareFrac;
-                                               vector<vector<int> >,   // simTrkIdx;
-                                               vector<vector<int> >,   // hitIdx;
-                                               vector<vector<int> >,   // hitType;
-                                               vector<unsigned int>,   // offset;
-                                               vector<unsigned char>,  // hitsMask;
-                                               vector<int>,            // subDet2;
-                                               vector<float>,          // dRz2;
-                                               vector<float>,          // dPhi2;
-                                               vector<float>,          // dRz2Pos;
-                                               vector<float>,          // dPhi2Pos;
-                                               vector<int>,            // subDet1;
-                                               vector<float>,          // dRz1;
-                                               vector<float>,          // dPhi1;
-                                               vector<float>,          // dRz1Pos;
-                                               vector<float>,          // dPhi1Pos;
-                                               vector<float>,          // hoe1;
-                                               vector<float>,          // hoe2;
-                                               vector<float>,          // superClusterEnergy;
-                                               vector<float>,          // superClusterEta;
-                                               vector<float>,          // superClusterPhi;
-                                               vector<float>,          // superClusterEt;
-                                               vector<int>,            // superClusterIdx;
-                                               vector<unsigned int>,   // ecalDriven;
-                                               vector<unsigned int>    // trkDriven;
+                                          vector<float>,          // px;
+                                          vector<float>,          // py;
+                                          vector<float>,          // pz;
+                                          vector<float>,          // pt;
+                                          vector<float>,          // eta;
+                                          vector<float>,          // phi;
+                                          vector<float>,          // dxy;
+                                          vector<float>,          // dz;
+                                          vector<float>,          // ptErr;
+                                          vector<float>,          // etaErr;
+                                          vector<float>,          // phiErr;
+                                          vector<float>,          // dxyErr;
+                                          vector<float>,          // dzErr;
+                                          vector<float>,          // chi2;
+                                          vector<int>,            // q;
+                                          vector<unsigned int>,   // nValid;
+                                          vector<unsigned int>,   // nPixel;
+                                          vector<unsigned int>,   // nGlued;
+                                          vector<unsigned int>,   // nStrip;
+                                          vector<unsigned int>,   // algo;
+                                          vector<unsigned int>,   // algoOriginal;
+                                          vector<int>,            // trkIdx;
+                                          vector<vector<float> >, // shareFrac;
+                                          vector<vector<int> >,   // simTrkIdx;
+                                          vector<vector<int> >,   // hitIdx;
+                                          vector<vector<int> >,   // hitType;
+                                          vector<unsigned int>,   // offset;
+                                          vector<unsigned char>,  // hitsMask;
+                                          vector<int>,            // subDet2;
+                                          vector<float>,          // dRz2;
+                                          vector<float>,          // dPhi2;
+                                          vector<float>,          // dRz2Pos;
+                                          vector<float>,          // dPhi2Pos;
+                                          vector<int>,            // subDet1;
+                                          vector<float>,          // dRz1;
+                                          vector<float>,          // dPhi1;
+                                          vector<float>,          // dRz1Pos;
+                                          vector<float>,          // dPhi1Pos;
+                                          vector<float>,          // hoe1;
+                                          vector<float>,          // hoe2;
+                                          vector<float>,          // superClusterEnergy;
+                                          vector<float>,          // superClusterEta;
+                                          vector<float>,          // superClusterPhi;
+                                          vector<float>,          // superClusterEt;
+                                          vector<int>,            // superClusterIdx;
+                                          vector<unsigned int>,   // ecalDriven;
+                                          vector<unsigned int>    // trkDriven;
              )>("build_seeds", FUNC(([](
                const vector<short>&  fitok,
                const vector<float>&  px,

+ 89 - 14
analysis/tracking_validation.cpp

@@ -639,7 +639,7 @@ void setup_sc_residuals(TrackingDataSet& tds){
                  const std::function<bool(int)>& pcheck){
             vector<float> residuals;
             vector<float> etas;
-            for(const SuperCluster& super_cluster : super_clusters){ // loop over all supser-clusters
+            for(const SuperCluster& super_cluster : super_clusters){ // loop over all super-clusters
                 float dRz, dPhi;
                 int ladder_blade;
                 unsigned int nSeeds = super_cluster.charge.size();
@@ -671,11 +671,9 @@ void setup_sc_residuals(TrackingDataSet& tds){
 
     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");
 
 }
 
@@ -752,6 +750,7 @@ void setup_residual_cross_corrolations(TrackingDataSet& tds){
 
     auto v_dz1 = constant("dz1", Res::dz1);
     auto v_dz2 = constant("dz2", Res::dz2);
+    auto v_dPhi1 = constant("dPhi1", Res::dPhi1);
     auto v_dPhi2 = constant("dPhi2", Res::dPhi2);
 
     auto sc_dphi2_v_dz1_L1_L2 = fv::tup_apply(sc_cross_correlations,
@@ -760,17 +759,83 @@ void setup_residual_cross_corrolations(TrackingDataSet& tds){
     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};
+    auto sc_dphi2_v_dphi1_L1_L2 = fv::tup_apply(sc_cross_correlations,
+            fv::tuple(super_clusters, BPIX_L1, BPIX_L2, v_dPhi2, v_dPhi1), "sc_dphi1_v_dphi1_L1_L2");
+
+    auto sc_dz2_v_dphi1_L1_L2 = fv::tup_apply(sc_cross_correlations,
+            fv::tuple(super_clusters, BPIX_L1, BPIX_L2, v_dz2, v_dPhi1), "sc_dz2_v_dphi1_L1_L2");
+
+    TH2Params hist_params = TH2Params::lookup("sc_dphi2_v_dz1_L1_L2");
     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};
+    hist_params = TH2Params::lookup("sc_dz2_v_dz1_L1_L2");
     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);
+    hist_params = TH2Params::lookup("sc_dphi2_v_dphi1_L1_L2");
+    tds.register_container<ContainerTH2Many<float>>("sc_dphi2_v_dphi1_L1_L2",
+                                                    sc_dphi2_v_dphi1_L1_L2,
+                                                    "sc_dphi2_v_dphi1_L1_L2", hist_params);
+    hist_params = TH2Params::lookup("sc_dz2_v_dphi1_L1_L2");
+    tds.register_container<ContainerTH2Many<float>>("sc_dz2_v_dphi1_L1_L2",
+                                                    sc_dz2_v_dphi1_L1_L2,
+                                                    "sc_dz2_v_dphi1_L1_L2", hist_params);
+
+    hist_params = TH2Params::lookup("sc_dz2_v_dz1_L1_L2_zoom");
+    tds.register_container<ContainerTH2Many<float>>("sc_dz2_v_dz1_L1_L2_zoom",
+                                                    sc_dz2_v_dz1_L1_L2,
+                                                    "sc_dz2_v_dz1_L1_L2_zoom", hist_params);
+    hist_params = TH2Params::lookup("sc_dz2_v_dphi1_L1_L2_zoom");
+    tds.register_container<ContainerTH2Many<float>>("sc_dz2_v_dphi1_L1_L2_zoom",
+                                                    sc_dz2_v_dphi1_L1_L2,
+                                                    "sc_dz2_v_dphi1_L1_L2_zoom", hist_params);
+    hist_params = TH2Params::lookup("sc_dphi2_v_dphi1_L1_L2_zoom");
+    tds.register_container<ContainerTH2Many<float>>("sc_dphi2_v_dphi1_L1_L2_zoom",
+                                                    sc_dphi2_v_dphi1_L1_L2,
+                                                    "sc_dphi2_v_dphi1_L1_L2_zoom", hist_params);
+
+    auto sc_dphi2_v_dz1_L1_L3 = fv::tup_apply(sc_cross_correlations,
+            fv::tuple(super_clusters, BPIX_L1, BPIX_L3, v_dPhi2, v_dz1), "sc_dphi1_v_dz1_L1_L3");
+
+    auto sc_dz2_v_dz1_L1_L3 = fv::tup_apply(sc_cross_correlations,
+            fv::tuple(super_clusters, BPIX_L1, BPIX_L3, v_dz2, v_dz1), "sc_dz2_v_dz1_L1_L3");
+
+    auto sc_dphi2_v_dphi1_L1_L3 = fv::tup_apply(sc_cross_correlations,
+            fv::tuple(super_clusters, BPIX_L1, BPIX_L3, v_dPhi2, v_dPhi1), "sc_dphi1_v_dphi1_L1_L3");
+
+    auto sc_dz2_v_dphi1_L1_L3 = fv::tup_apply(sc_cross_correlations,
+            fv::tuple(super_clusters, BPIX_L1, BPIX_L3, v_dz2, v_dPhi1), "sc_dz2_v_dphi1_L1_L3");
+
+    hist_params = TH2Params::lookup("sc_dphi2_v_dz1_L1_L2");
+    tds.register_container<ContainerTH2Many<float>>("sc_dphi2_v_dz1_L1_L3",
+                                                    sc_dphi2_v_dz1_L1_L3,
+                                                    "sc_dphi2_v_dz1_L1_L3", hist_params);
+    hist_params = TH2Params::lookup("sc_dz2_v_dz1_L1_L2");
+    tds.register_container<ContainerTH2Many<float>>("sc_dz2_v_dz1_L1_L3",
+                                                    sc_dz2_v_dz1_L1_L3,
+                                                    "sc_dz2_v_dz1_L1_L3", hist_params);
+    hist_params = TH2Params::lookup("sc_dphi2_v_dphi1_L1_L2");
+    tds.register_container<ContainerTH2Many<float>>("sc_dphi2_v_dphi1_L1_L3",
+                                                    sc_dphi2_v_dphi1_L1_L3,
+                                                    "sc_dphi2_v_dphi1_L1_L3", hist_params);
+    hist_params = TH2Params::lookup("sc_dz2_v_dphi1_L1_L2");
+    tds.register_container<ContainerTH2Many<float>>("sc_dz2_v_dphi1_L1_L3",
+                                                    sc_dz2_v_dphi1_L1_L3,
+                                                    "sc_dz2_v_dphi1_L1_L3", hist_params);
+
+    hist_params = TH2Params::lookup("sc_dz2_v_dz1_L1_L2_zoom");
+    tds.register_container<ContainerTH2Many<float>>("sc_dz2_v_dz1_L1_L3_zoom",
+                                                    sc_dz2_v_dz1_L1_L3,
+                                                    "sc_dz2_v_dz1_L1_L3_zoom", hist_params);
+    hist_params = TH2Params::lookup("sc_dz2_v_dphi1_L1_L2_zoom");
+    tds.register_container<ContainerTH2Many<float>>("sc_dz2_v_dphi1_L1_L3_zoom",
+                                                    sc_dz2_v_dphi1_L1_L3,
+                                                    "sc_dz2_v_dphi1_L1_L3_zoom", hist_params);
+    hist_params = TH2Params::lookup("sc_dphi2_v_dphi1_L1_L2_zoom");
+    tds.register_container<ContainerTH2Many<float>>("sc_dphi2_v_dphi1_L1_L3_zoom",
+                                                    sc_dphi2_v_dphi1_L1_L3,
+                                                    "sc_dphi2_v_dphi1_L1_L3_zoom", hist_params);
 
 
 }
@@ -786,13 +851,13 @@ void run_analysis(const vector<fv::util::DataFileDescriptor>& dfds, const string
 
     TrackingDataSet tds(output_filename, dfds, "trackingNtuple/tree");
     /* tds.set_max_events(10); */
-    /* register_objects(tds); */
-    /* setup_hit_pair_functions(); */
+    register_objects(tds);
+    setup_hit_pair_functions();
 
-    /* setup_first_hit_pairs(tds); */
-    /* setup_skipped_layer_hit_pairs(tds); */
-    /* setup_sc_residuals(tds); */
-    /* setup_residual_cross_corrolations(tds); */
+    setup_first_hit_pairs(tds);
+    setup_skipped_layer_hit_pairs(tds);
+    setup_sc_residuals(tds);
+    setup_residual_cross_corrolations(tds);
 
 
     tds.process(silent);
@@ -803,6 +868,9 @@ int main(int argc, char * argv[]){
     fv::util::ArgParser args(argc, argv);
     bool silent = args.cmdOptionExists("-s");
     string output_filename = args.cmdOptionExists("-o") ? args.getCmdOption("-o") : "output.root";
+    if(args.cmdOptionExists("-c")){
+        fv::util::init_config(args.getCmdOption("-c"));
+    }
     if(args.cmdOptionExists("-F")){
         auto file_list = fv::util::read_input_list(args.getCmdOption("-F"));
         run_analysis(file_list, output_filename, silent);
@@ -818,3 +886,10 @@ int main(int argc, char * argv[]){
     }
     return 0;
 }
+
+/* int main(int argc, char * argv[]){ */
+/*     using namespace fv::util; */
+/*     init_config(argv[1]); */
+/*     int max_events = the_config.get("max-events").as<int>(); */
+/*     cout << max_events << endl; */
+/* } */

+ 1 - 1
filval

@@ -1 +1 @@
-Subproject commit 1b5a7600f1f45686e20683e0d032e08288218bad
+Subproject commit 0bd6e917d03ec47d93a19bfa1599fd3dc4b6cbdb