Browse Source

Updates filval dependencies and update plotting routines to use filval
2.0

Caleb Fangmeier 6 years ago
parent
commit
2e00053ab8

+ 1 - 14
.gitignore

@@ -1,15 +1,2 @@
-
-legacy/
 data/
-output/
-build/
-env/
-analysis/output/
-analysis/figures/
-
-tags
-.ipynb_checkpoints/
-*.plist
-
-*/__pycache__/
-.idea/
+hists/

+ 3 - 0
.gitmodules

@@ -4,3 +4,6 @@
 [submodule "looper/filval"]
 	path = looper/filval
 	url = gogs@git.fangmeier.tech:caleb/filval.git
+[submodule "plotting/filval-python"]
+	path = plotting/filval-python
+	url = gogs@git.fangmeier.tech:caleb/filval-python.git

+ 2 - 0
looper/.gitignore

@@ -0,0 +1,2 @@
+cmake-build-*/
+.idea/

+ 8 - 3
looper/CMakeLists.txt

@@ -1,13 +1,18 @@
 
-CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
+CMAKE_MINIMUM_REQUIRED (VERSION 3.1)
 
 PROJECT (EGAMMA CXX)
 
+SET(CMAKE_CXX_STANDARD 14)
+
 SET(CMAKE_BUILD_TYPE "Release")
 
 ADD_SUBDIRECTORY(filval)
 
+LIST( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/filval/cmake )
+FIND_PACKAGE(ROOT REQUIRED)
+
 # Compiles tracking efficiency executable
 ADD_EXECUTABLE(tracking_eff analysis/tracking_eff.cpp)
-TARGET_LINK_LIBRARIES(tracking_eff filval yaml-cpp)
-TARGET_INCLUDE_DIRECTORIES(tracking_eff ${ROOT_INCLUDE_DIR} filval/include/ filval/root/include/ filval/yaml-cpp/include/)
+TARGET_LINK_LIBRARIES(tracking_eff filval yaml-cpp ${ROOT_LIBRARIES})
+TARGET_INCLUDE_DIRECTORIES(tracking_eff PUBLIC ${ROOT_INCLUDE_DIR} ${CMAKE_SOURCE_DIR} filval/include/ filval/root/include/ filval/yaml-cpp/include/)

+ 156 - 163
looper/analysis/TrackingNtupleMod.h

@@ -12,14 +12,7 @@
 #include <TChain.h>
 #include <TFile.h>
 
-// Header file for the classes stored in the TTree if any.
-#include "vector"
-#include "vector"
-#include "vector"
-#include "vector"
-#include "vector"
-#include "vector"
-#include "vector"
+#include <vector>
 
 class TrackingNtuple {
 public :
@@ -32,167 +25,167 @@ public :
    ULong64_t       event;
    UInt_t          lumi;
    UInt_t          run;
-   vector<float>   *trk_px;
-   vector<float>   *trk_py;
-   vector<float>   *trk_pz;
-   vector<float>   *trk_pt;
-   vector<float>   *trk_inner_px;
-   vector<float>   *trk_inner_py;
-   vector<float>   *trk_inner_pz;
-   vector<float>   *trk_inner_pt;
-   vector<float>   *trk_outer_px;
-   vector<float>   *trk_outer_py;
-   vector<float>   *trk_outer_pz;
-   vector<float>   *trk_outer_pt;
-   vector<float>   *trk_eta;
-   vector<float>   *trk_lambda;
-   vector<float>   *trk_cotTheta;
-   vector<float>   *trk_phi;
-   vector<float>   *trk_dxy;
-   vector<float>   *trk_dz;
-   vector<float>   *trk_ptErr;
-   vector<float>   *trk_etaErr;
-   vector<float>   *trk_lambdaErr;
-   vector<float>   *trk_phiErr;
-   vector<float>   *trk_dxyErr;
-   vector<float>   *trk_dzErr;
-   vector<float>   *trk_refpoint_x;
-   vector<float>   *trk_refpoint_y;
-   vector<float>   *trk_refpoint_z;
-   vector<float>   *trk_nChi2;
-   vector<int>     *trk_q;
-   vector<unsigned int> *trk_nValid;
-   vector<unsigned int> *trk_nInvalid;
-   vector<unsigned int> *trk_nPixel;
-   vector<unsigned int> *trk_nStrip;
-   vector<unsigned int> *trk_nPixelLay;
-   vector<unsigned int> *trk_nStripLay;
-   vector<unsigned int> *trk_n3DLay;
-   vector<unsigned int> *trk_nOuterLost;
-   vector<unsigned int> *trk_nInnerLost;
-   vector<unsigned int> *trk_algo;
-   vector<unsigned int> *trk_originalAlgo;
-   vector<ULong64_t> *trk_algoMask;
-   vector<unsigned short> *trk_stopReason;
-   vector<short>   *trk_isHP;
-   vector<int>     *trk_seedIdx;
-   vector<float>   *trk_vtxx;
-   vector<float>   *trk_vtxy;
-   vector<float>   *trk_vtxz;
-   vector<vector<float> > *trk_shareFrac;
-   vector<vector<int> > *trk_simTrkIdx;
-   vector<int>     *trk_genIdx;
-   vector<float>   *trk_genDR;
-   vector<int>     *sim_event;
-   vector<int>     *sim_bunchCrossing;
-   vector<int>     *sim_pdgId;
-   vector<vector<int> > *sim_genPdgIds;
-   vector<int>     *sim_isFromBHadron;
-   vector<float>   *sim_px;
-   vector<float>   *sim_py;
-   vector<float>   *sim_pz;
-   vector<float>   *sim_pt;
-   vector<float>   *sim_eta;
-   vector<float>   *sim_phi;
-   vector<float>   *sim_pca_pt;
-   vector<float>   *sim_pca_eta;
-   vector<float>   *sim_pca_lambda;
-   vector<float>   *sim_pca_cotTheta;
-   vector<float>   *sim_pca_phi;
-   vector<float>   *sim_pca_dxy;
-   vector<float>   *sim_pca_dz;
-   vector<int>     *sim_q;
-   vector<unsigned int> *sim_nValid;
-   vector<unsigned int> *sim_nPixel;
-   vector<unsigned int> *sim_nStrip;
-   vector<unsigned int> *sim_nLay;
-   vector<unsigned int> *sim_nPixelLay;
-   vector<unsigned int> *sim_n3DLay;
-   vector<vector<int> > *sim_trkIdx;
-   vector<vector<float> > *sim_shareFrac;
-   vector<vector<int> > *sim_seedIdx;
-   vector<int>     *sim_parentVtxIdx;
-   vector<vector<int> > *sim_decayVtxIdx;
+   std::vector<float>   *trk_px;
+   std::vector<float>   *trk_py;
+   std::vector<float>   *trk_pz;
+   std::vector<float>   *trk_pt;
+   std::vector<float>   *trk_inner_px;
+   std::vector<float>   *trk_inner_py;
+   std::vector<float>   *trk_inner_pz;
+   std::vector<float>   *trk_inner_pt;
+   std::vector<float>   *trk_outer_px;
+   std::vector<float>   *trk_outer_py;
+   std::vector<float>   *trk_outer_pz;
+   std::vector<float>   *trk_outer_pt;
+   std::vector<float>   *trk_eta;
+   std::vector<float>   *trk_lambda;
+   std::vector<float>   *trk_cotTheta;
+   std::vector<float>   *trk_phi;
+   std::vector<float>   *trk_dxy;
+   std::vector<float>   *trk_dz;
+   std::vector<float>   *trk_ptErr;
+   std::vector<float>   *trk_etaErr;
+   std::vector<float>   *trk_lambdaErr;
+   std::vector<float>   *trk_phiErr;
+   std::vector<float>   *trk_dxyErr;
+   std::vector<float>   *trk_dzErr;
+   std::vector<float>   *trk_refpoint_x;
+   std::vector<float>   *trk_refpoint_y;
+   std::vector<float>   *trk_refpoint_z;
+   std::vector<float>   *trk_nChi2;
+   std::vector<int>     *trk_q;
+   std::vector<unsigned int> *trk_nValid;
+   std::vector<unsigned int> *trk_nInvalid;
+   std::vector<unsigned int> *trk_nPixel;
+   std::vector<unsigned int> *trk_nStrip;
+   std::vector<unsigned int> *trk_nPixelLay;
+   std::vector<unsigned int> *trk_nStripLay;
+   std::vector<unsigned int> *trk_n3DLay;
+   std::vector<unsigned int> *trk_nOuterLost;
+   std::vector<unsigned int> *trk_nInnerLost;
+   std::vector<unsigned int> *trk_algo;
+   std::vector<unsigned int> *trk_originalAlgo;
+   std::vector<ULong64_t> *trk_algoMask;
+   std::vector<unsigned short> *trk_stopReason;
+   std::vector<short>   *trk_isHP;
+   std::vector<int>     *trk_seedIdx;
+   std::vector<float>   *trk_vtxx;
+   std::vector<float>   *trk_vtxy;
+   std::vector<float>   *trk_vtxz;
+   std::vector<std::vector<float> > *trk_shareFrac;
+   std::vector<std::vector<int> > *trk_simTrkIdx;
+   std::vector<int>     *trk_genIdx;
+   std::vector<float>   *trk_genDR;
+   std::vector<int>     *sim_event;
+   std::vector<int>     *sim_bunchCrossing;
+   std::vector<int>     *sim_pdgId;
+   std::vector<std::vector<int> > *sim_genPdgIds;
+   std::vector<int>     *sim_isFromBHadron;
+   std::vector<float>   *sim_px;
+   std::vector<float>   *sim_py;
+   std::vector<float>   *sim_pz;
+   std::vector<float>   *sim_pt;
+   std::vector<float>   *sim_eta;
+   std::vector<float>   *sim_phi;
+   std::vector<float>   *sim_pca_pt;
+   std::vector<float>   *sim_pca_eta;
+   std::vector<float>   *sim_pca_lambda;
+   std::vector<float>   *sim_pca_cotTheta;
+   std::vector<float>   *sim_pca_phi;
+   std::vector<float>   *sim_pca_dxy;
+   std::vector<float>   *sim_pca_dz;
+   std::vector<int>     *sim_q;
+   std::vector<unsigned int> *sim_nValid;
+   std::vector<unsigned int> *sim_nPixel;
+   std::vector<unsigned int> *sim_nStrip;
+   std::vector<unsigned int> *sim_nLay;
+   std::vector<unsigned int> *sim_nPixelLay;
+   std::vector<unsigned int> *sim_n3DLay;
+   std::vector<std::vector<int> > *sim_trkIdx;
+   std::vector<std::vector<float> > *sim_shareFrac;
+   std::vector<std::vector<int> > *sim_seedIdx;
+   std::vector<int>     *sim_parentVtxIdx;
+   std::vector<std::vector<int> > *sim_decayVtxIdx;
    Float_t         bsp_x;
    Float_t         bsp_y;
    Float_t         bsp_z;
    Float_t         bsp_sigmax;
    Float_t         bsp_sigmay;
    Float_t         bsp_sigmaz;
-   vector<short>   *see_fitok;
-   vector<float>   *see_px;
-   vector<float>   *see_py;
-   vector<float>   *see_pz;
-   vector<float>   *see_pt;
-   vector<float>   *see_eta;
-   vector<float>   *see_phi;
-   vector<float>   *see_dxy;
-   vector<float>   *see_dz;
-   vector<float>   *see_ptErr;
-   vector<float>   *see_etaErr;
-   vector<float>   *see_phiErr;
-   vector<float>   *see_dxyErr;
-   vector<float>   *see_dzErr;
-   vector<float>   *see_chi2;
-   vector<float>   *see_statePt;
-   vector<float>   *see_stateTrajX;
-   vector<float>   *see_stateTrajY;
-   vector<float>   *see_stateTrajPx;
-   vector<float>   *see_stateTrajPy;
-   vector<float>   *see_stateTrajPz;
-   vector<int>     *see_q;
-   vector<unsigned int> *see_nValid;
-   vector<unsigned int> *see_nPixel;
-   vector<unsigned int> *see_nGlued;
-   vector<unsigned int> *see_nStrip;
-   vector<unsigned int> *see_nPhase2OT;
-   vector<unsigned int> *see_algo;
-   vector<unsigned short> *see_stopReason;
-   vector<int>     *see_trkIdx;
-   vector<vector<float> > *see_shareFrac;
-   vector<vector<int> > *see_simTrkIdx;
-   vector<unsigned int> *see_offset;
-   vector<vector<int> > *see_isBarrel;
-   vector<vector<int> > *see_layerOrDiskNr;
-   vector<vector<int> > *see_isValidPos;
-   vector<vector<float> > *see_dRZPos;
-   vector<vector<float> > *see_dPhiPos;
-   vector<vector<int> > *see_isValidNeg;
-   vector<vector<float> > *see_dRZNeg;
-   vector<vector<float> > *see_dPhiNeg;
-   vector<float>   *vtx_x;
-   vector<float>   *vtx_y;
-   vector<float>   *vtx_z;
-   vector<float>   *vtx_xErr;
-   vector<float>   *vtx_yErr;
-   vector<float>   *vtx_zErr;
-   vector<float>   *vtx_ndof;
-   vector<float>   *vtx_chi2;
-   vector<short>   *vtx_fake;
-   vector<short>   *vtx_valid;
-   vector<vector<int> > *vtx_trkIdx;
-   vector<float>   *gen_px;
-   vector<float>   *gen_py;
-   vector<float>   *gen_pz;
-   vector<float>   *gen_charge;
-   vector<int>     *gen_pdgId;
-   vector<float>   *gen_vx;
-   vector<float>   *gen_vy;
-   vector<float>   *gen_vz;
-   vector<int>     *gen_status;
-   vector<int>     *gen_mother;
-   vector<bool>    *gen_isTauDecayProduct;
-   vector<bool>    *gen_isDirectHadronDecayProduct;
-   vector<bool>    *gen_isPrompt;
-   vector<int>     *simvtx_event;
-   vector<int>     *simvtx_bunchCrossing;
-   vector<unsigned int> *simvtx_processType;
-   vector<float>   *simvtx_x;
-   vector<float>   *simvtx_y;
-   vector<float>   *simvtx_z;
-   vector<vector<int> > *simvtx_sourceSimIdx;
-   vector<vector<int> > *simvtx_daughterSimIdx;
-   vector<int>     *simpv_idx;
+   std::vector<short>   *see_fitok;
+   std::vector<float>   *see_px;
+   std::vector<float>   *see_py;
+   std::vector<float>   *see_pz;
+   std::vector<float>   *see_pt;
+   std::vector<float>   *see_eta;
+   std::vector<float>   *see_phi;
+   std::vector<float>   *see_dxy;
+   std::vector<float>   *see_dz;
+   std::vector<float>   *see_ptErr;
+   std::vector<float>   *see_etaErr;
+   std::vector<float>   *see_phiErr;
+   std::vector<float>   *see_dxyErr;
+   std::vector<float>   *see_dzErr;
+   std::vector<float>   *see_chi2;
+   std::vector<float>   *see_statePt;
+   std::vector<float>   *see_stateTrajX;
+   std::vector<float>   *see_stateTrajY;
+   std::vector<float>   *see_stateTrajPx;
+   std::vector<float>   *see_stateTrajPy;
+   std::vector<float>   *see_stateTrajPz;
+   std::vector<int>     *see_q;
+   std::vector<unsigned int> *see_nValid;
+   std::vector<unsigned int> *see_nPixel;
+   std::vector<unsigned int> *see_nGlued;
+   std::vector<unsigned int> *see_nStrip;
+   std::vector<unsigned int> *see_nPhase2OT;
+   std::vector<unsigned int> *see_algo;
+   std::vector<unsigned short> *see_stopReason;
+   std::vector<int>     *see_trkIdx;
+   std::vector<std::vector<float> > *see_shareFrac;
+   std::vector<std::vector<int> > *see_simTrkIdx;
+   std::vector<unsigned int> *see_offset;
+   std::vector<std::vector<int> > *see_isBarrel;
+   std::vector<std::vector<int> > *see_layerOrDiskNr;
+   std::vector<std::vector<int> > *see_isValidPos;
+   std::vector<std::vector<float> > *see_dRZPos;
+   std::vector<std::vector<float> > *see_dPhiPos;
+   std::vector<std::vector<int> > *see_isValidNeg;
+   std::vector<std::vector<float> > *see_dRZNeg;
+   std::vector<std::vector<float> > *see_dPhiNeg;
+   std::vector<float>   *vtx_x;
+   std::vector<float>   *vtx_y;
+   std::vector<float>   *vtx_z;
+   std::vector<float>   *vtx_xErr;
+   std::vector<float>   *vtx_yErr;
+   std::vector<float>   *vtx_zErr;
+   std::vector<float>   *vtx_ndof;
+   std::vector<float>   *vtx_chi2;
+   std::vector<short>   *vtx_fake;
+   std::vector<short>   *vtx_valid;
+   std::vector<std::vector<int> > *vtx_trkIdx;
+   std::vector<float>   *gen_px;
+   std::vector<float>   *gen_py;
+   std::vector<float>   *gen_pz;
+   std::vector<float>   *gen_charge;
+   std::vector<int>     *gen_pdgId;
+   std::vector<float>   *gen_vx;
+   std::vector<float>   *gen_vy;
+   std::vector<float>   *gen_vz;
+   std::vector<int>     *gen_status;
+   std::vector<int>     *gen_mother;
+   std::vector<bool>    *gen_isTauDecayProduct;
+   std::vector<bool>    *gen_isDirectHadronDecayProduct;
+   std::vector<bool>    *gen_isPrompt;
+   std::vector<int>     *simvtx_event;
+   std::vector<int>     *simvtx_bunchCrossing;
+   std::vector<unsigned int> *simvtx_processType;
+   std::vector<float>   *simvtx_x;
+   std::vector<float>   *simvtx_y;
+   std::vector<float>   *simvtx_z;
+   std::vector<std::vector<int> > *simvtx_sourceSimIdx;
+   std::vector<std::vector<int> > *simvtx_daughterSimIdx;
+   std::vector<int>     *simpv_idx;
 
    // List of branches
    TBranch        *b_event;   //!

+ 128 - 128
looper/analysis/TrackingNtupleObjs.hpp

@@ -1,9 +1,9 @@
-/** TrackingNtupleObjs.hpp created on 2018-01-21 23:00:12.588429 by generate_class.py
+/** TrackingNtupleObjs.hpp created on 2018-01-24 22:12:19.846573 by generate_class.py
  * AVOID EDITING THIS FILE BY HAND!! Instead edit TrackingNtupleObjs.yaml and re-run
  * generate_class.py
  */
-#include "filval/filval.hpp"
-#include "filval/root/filval.hpp"
+#include "filval.hpp"
+#include "root_filval.hpp"
 
 #include<cmath>
 
@@ -11,7 +11,7 @@
 
 using namespace std;
 using namespace fv;
-using namespace fv::root;
+using namespace fv_root;
 
 typedef TreeDataSet<TrackingNtuple> TrackingDataSet;
 struct Seed;
@@ -102,7 +102,7 @@ class SeedCollection {
         val_dPhiNeg = tds.track_branch_obj<vector<vector<float>>>("see_dPhiNeg");
     }
 
-    size_t size() const { return val_fitok->get_value().size();}
+    size_t size() const { return (*val_fitok)().size();}
 
     const Seed operator[](size_t) const;
     iter begin() const { return iter(this, 0); }
@@ -115,39 +115,39 @@ struct Seed {
     Seed(const SeedCollection* collection, const size_t idx)
       :collection(collection), idx(idx) { }
 
-    const short& fitok() const {return collection->val_fitok->get_value().at(idx);}
-    const float& px() const {return collection->val_px->get_value().at(idx);}
-    const float& py() const {return collection->val_py->get_value().at(idx);}
-    const float& pz() const {return collection->val_pz->get_value().at(idx);}
-    const float& pt() const {return collection->val_pt->get_value().at(idx);}
-    const float& eta() const {return collection->val_eta->get_value().at(idx);}
-    const float& phi() const {return collection->val_phi->get_value().at(idx);}
-    const float& dxy() const {return collection->val_dxy->get_value().at(idx);}
-    const float& dz() const {return collection->val_dz->get_value().at(idx);}
-    const float& ptErr() const {return collection->val_ptErr->get_value().at(idx);}
-    const float& etaErr() const {return collection->val_etaErr->get_value().at(idx);}
-    const float& phiErr() const {return collection->val_phiErr->get_value().at(idx);}
-    const float& dxyErr() const {return collection->val_dxyErr->get_value().at(idx);}
-    const float& dzErr() const {return collection->val_dzErr->get_value().at(idx);}
-    const float& chi2() const {return collection->val_chi2->get_value().at(idx);}
-    const int& q() const {return collection->val_q->get_value().at(idx);}
-    const unsigned int& nValid() const {return collection->val_nValid->get_value().at(idx);}
-    const unsigned int& nPixel() const {return collection->val_nPixel->get_value().at(idx);}
-    const unsigned int& nGlued() const {return collection->val_nGlued->get_value().at(idx);}
-    const unsigned int& nStrip() const {return collection->val_nStrip->get_value().at(idx);}
-    const unsigned int& algo() const {return collection->val_algo->get_value().at(idx);}
-    const int& trkIdx() const {return collection->val_trkIdx->get_value().at(idx);}
-    const vector<float>& shareFrac() const {return collection->val_shareFrac->get_value().at(idx);}
-    const vector<int>& simTrkIdx() const {return collection->val_simTrkIdx->get_value().at(idx);}
-    const unsigned int& offset() const {return collection->val_offset->get_value().at(idx);}
-    const vector<int>& isBarrel() const {return collection->val_isBarrel->get_value().at(idx);}
-    const vector<int>& layerOrDiskNr() const {return collection->val_layerOrDiskNr->get_value().at(idx);}
-    const vector<int>& isValidPos() const {return collection->val_isValidPos->get_value().at(idx);}
-    const vector<float>& dRZPos() const {return collection->val_dRZPos->get_value().at(idx);}
-    const vector<float>& dPhiPos() const {return collection->val_dPhiPos->get_value().at(idx);}
-    const vector<int>& isValidNeg() const {return collection->val_isValidNeg->get_value().at(idx);}
-    const vector<float>& dRZNeg() const {return collection->val_dRZNeg->get_value().at(idx);}
-    const vector<float>& dPhiNeg() const {return collection->val_dPhiNeg->get_value().at(idx);}
+    const short& fitok() const {return (*collection->val_fitok)().at(idx);}
+    const float& px() const {return (*collection->val_px)().at(idx);}
+    const float& py() const {return (*collection->val_py)().at(idx);}
+    const float& pz() const {return (*collection->val_pz)().at(idx);}
+    const float& pt() const {return (*collection->val_pt)().at(idx);}
+    const float& eta() const {return (*collection->val_eta)().at(idx);}
+    const float& phi() const {return (*collection->val_phi)().at(idx);}
+    const float& dxy() const {return (*collection->val_dxy)().at(idx);}
+    const float& dz() const {return (*collection->val_dz)().at(idx);}
+    const float& ptErr() const {return (*collection->val_ptErr)().at(idx);}
+    const float& etaErr() const {return (*collection->val_etaErr)().at(idx);}
+    const float& phiErr() const {return (*collection->val_phiErr)().at(idx);}
+    const float& dxyErr() const {return (*collection->val_dxyErr)().at(idx);}
+    const float& dzErr() const {return (*collection->val_dzErr)().at(idx);}
+    const float& chi2() const {return (*collection->val_chi2)().at(idx);}
+    const int& q() const {return (*collection->val_q)().at(idx);}
+    const unsigned int& nValid() const {return (*collection->val_nValid)().at(idx);}
+    const unsigned int& nPixel() const {return (*collection->val_nPixel)().at(idx);}
+    const unsigned int& nGlued() const {return (*collection->val_nGlued)().at(idx);}
+    const unsigned int& nStrip() const {return (*collection->val_nStrip)().at(idx);}
+    const unsigned int& algo() const {return (*collection->val_algo)().at(idx);}
+    const int& trkIdx() const {return (*collection->val_trkIdx)().at(idx);}
+    const vector<float>& shareFrac() const {return (*collection->val_shareFrac)().at(idx);}
+    const vector<int>& simTrkIdx() const {return (*collection->val_simTrkIdx)().at(idx);}
+    const unsigned int& offset() const {return (*collection->val_offset)().at(idx);}
+    const vector<int>& isBarrel() const {return (*collection->val_isBarrel)().at(idx);}
+    const vector<int>& layerOrDiskNr() const {return (*collection->val_layerOrDiskNr)().at(idx);}
+    const vector<int>& isValidPos() const {return (*collection->val_isValidPos)().at(idx);}
+    const vector<float>& dRZPos() const {return (*collection->val_dRZPos)().at(idx);}
+    const vector<float>& dPhiPos() const {return (*collection->val_dPhiPos)().at(idx);}
+    const vector<int>& isValidNeg() const {return (*collection->val_isValidNeg)().at(idx);}
+    const vector<float>& dRZNeg() const {return (*collection->val_dRZNeg)().at(idx);}
+    const vector<float>& dPhiNeg() const {return (*collection->val_dPhiNeg)().at(idx);}
 };
 
 const Seed SeedCollection::iter::operator*() const {
@@ -280,7 +280,7 @@ class TrackCollection {
         val_genDR = tds.track_branch_obj<vector<float>>("trk_genDR");
     }
 
-    size_t size() const { return val_px->get_value().size();}
+    size_t size() const { return (*val_px)().size();}
 
     const Track operator[](size_t) const;
     iter begin() const { return iter(this, 0); }
@@ -293,57 +293,57 @@ struct Track {
     Track(const TrackCollection* collection, const size_t idx)
       :collection(collection), idx(idx) { }
 
-    const float& px() const {return collection->val_px->get_value().at(idx);}
-    const float& py() const {return collection->val_py->get_value().at(idx);}
-    const float& pz() const {return collection->val_pz->get_value().at(idx);}
-    const float& pt() const {return collection->val_pt->get_value().at(idx);}
-    const float& inner_px() const {return collection->val_inner_px->get_value().at(idx);}
-    const float& inner_py() const {return collection->val_inner_py->get_value().at(idx);}
-    const float& inner_pz() const {return collection->val_inner_pz->get_value().at(idx);}
-    const float& inner_pt() const {return collection->val_inner_pt->get_value().at(idx);}
-    const float& outer_px() const {return collection->val_outer_px->get_value().at(idx);}
-    const float& outer_py() const {return collection->val_outer_py->get_value().at(idx);}
-    const float& outer_pz() const {return collection->val_outer_pz->get_value().at(idx);}
-    const float& outer_pt() const {return collection->val_outer_pt->get_value().at(idx);}
-    const float& eta() const {return collection->val_eta->get_value().at(idx);}
-    const float& lambda() const {return collection->val_lambda->get_value().at(idx);}
-    const float& cotTheta() const {return collection->val_cotTheta->get_value().at(idx);}
-    const float& phi() const {return collection->val_phi->get_value().at(idx);}
-    const float& dxy() const {return collection->val_dxy->get_value().at(idx);}
-    const float& dz() const {return collection->val_dz->get_value().at(idx);}
-    const float& ptErr() const {return collection->val_ptErr->get_value().at(idx);}
-    const float& etaErr() const {return collection->val_etaErr->get_value().at(idx);}
-    const float& lambdaErr() const {return collection->val_lambdaErr->get_value().at(idx);}
-    const float& phiErr() const {return collection->val_phiErr->get_value().at(idx);}
-    const float& dxyErr() const {return collection->val_dxyErr->get_value().at(idx);}
-    const float& dzErr() const {return collection->val_dzErr->get_value().at(idx);}
-    const float& refpoint_x() const {return collection->val_refpoint_x->get_value().at(idx);}
-    const float& refpoint_y() const {return collection->val_refpoint_y->get_value().at(idx);}
-    const float& refpoint_z() const {return collection->val_refpoint_z->get_value().at(idx);}
-    const float& nChi2() const {return collection->val_nChi2->get_value().at(idx);}
-    const int& q() const {return collection->val_q->get_value().at(idx);}
-    const unsigned int& nValid() const {return collection->val_nValid->get_value().at(idx);}
-    const unsigned int& nInvalid() const {return collection->val_nInvalid->get_value().at(idx);}
-    const unsigned int& nPixel() const {return collection->val_nPixel->get_value().at(idx);}
-    const unsigned int& nStrip() const {return collection->val_nStrip->get_value().at(idx);}
-    const unsigned int& nPixelLay() const {return collection->val_nPixelLay->get_value().at(idx);}
-    const unsigned int& nStripLay() const {return collection->val_nStripLay->get_value().at(idx);}
-    const unsigned int& n3DLay() const {return collection->val_n3DLay->get_value().at(idx);}
-    const unsigned int& nOuterLost() const {return collection->val_nOuterLost->get_value().at(idx);}
-    const unsigned int& nInnerLost() const {return collection->val_nInnerLost->get_value().at(idx);}
-    const unsigned int& algo() const {return collection->val_algo->get_value().at(idx);}
-    const unsigned int& originalAlgo() const {return collection->val_originalAlgo->get_value().at(idx);}
-    const ULong64_t& algoMask() const {return collection->val_algoMask->get_value().at(idx);}
-    const unsigned int& stopReason() const {return collection->val_stopReason->get_value().at(idx);}
-    const short& isHP() const {return collection->val_isHP->get_value().at(idx);}
-    const int& seedIdx() const {return collection->val_seedIdx->get_value().at(idx);}
-    const float& vtxx() const {return collection->val_vtxx->get_value().at(idx);}
-    const float& vtxy() const {return collection->val_vtxy->get_value().at(idx);}
-    const float& vtxz() const {return collection->val_vtxz->get_value().at(idx);}
-    const vector<float>& shareFrac() const {return collection->val_shareFrac->get_value().at(idx);}
-    const vector<int>& simTrkIdx() const {return collection->val_simTrkIdx->get_value().at(idx);}
-    const int& genIdx() const {return collection->val_genIdx->get_value().at(idx);}
-    const float& genDR() const {return collection->val_genDR->get_value().at(idx);}
+    const float& px() const {return (*collection->val_px)().at(idx);}
+    const float& py() const {return (*collection->val_py)().at(idx);}
+    const float& pz() const {return (*collection->val_pz)().at(idx);}
+    const float& pt() const {return (*collection->val_pt)().at(idx);}
+    const float& inner_px() const {return (*collection->val_inner_px)().at(idx);}
+    const float& inner_py() const {return (*collection->val_inner_py)().at(idx);}
+    const float& inner_pz() const {return (*collection->val_inner_pz)().at(idx);}
+    const float& inner_pt() const {return (*collection->val_inner_pt)().at(idx);}
+    const float& outer_px() const {return (*collection->val_outer_px)().at(idx);}
+    const float& outer_py() const {return (*collection->val_outer_py)().at(idx);}
+    const float& outer_pz() const {return (*collection->val_outer_pz)().at(idx);}
+    const float& outer_pt() const {return (*collection->val_outer_pt)().at(idx);}
+    const float& eta() const {return (*collection->val_eta)().at(idx);}
+    const float& lambda() const {return (*collection->val_lambda)().at(idx);}
+    const float& cotTheta() const {return (*collection->val_cotTheta)().at(idx);}
+    const float& phi() const {return (*collection->val_phi)().at(idx);}
+    const float& dxy() const {return (*collection->val_dxy)().at(idx);}
+    const float& dz() const {return (*collection->val_dz)().at(idx);}
+    const float& ptErr() const {return (*collection->val_ptErr)().at(idx);}
+    const float& etaErr() const {return (*collection->val_etaErr)().at(idx);}
+    const float& lambdaErr() const {return (*collection->val_lambdaErr)().at(idx);}
+    const float& phiErr() const {return (*collection->val_phiErr)().at(idx);}
+    const float& dxyErr() const {return (*collection->val_dxyErr)().at(idx);}
+    const float& dzErr() const {return (*collection->val_dzErr)().at(idx);}
+    const float& refpoint_x() const {return (*collection->val_refpoint_x)().at(idx);}
+    const float& refpoint_y() const {return (*collection->val_refpoint_y)().at(idx);}
+    const float& refpoint_z() const {return (*collection->val_refpoint_z)().at(idx);}
+    const float& nChi2() const {return (*collection->val_nChi2)().at(idx);}
+    const int& q() const {return (*collection->val_q)().at(idx);}
+    const unsigned int& nValid() const {return (*collection->val_nValid)().at(idx);}
+    const unsigned int& nInvalid() const {return (*collection->val_nInvalid)().at(idx);}
+    const unsigned int& nPixel() const {return (*collection->val_nPixel)().at(idx);}
+    const unsigned int& nStrip() const {return (*collection->val_nStrip)().at(idx);}
+    const unsigned int& nPixelLay() const {return (*collection->val_nPixelLay)().at(idx);}
+    const unsigned int& nStripLay() const {return (*collection->val_nStripLay)().at(idx);}
+    const unsigned int& n3DLay() const {return (*collection->val_n3DLay)().at(idx);}
+    const unsigned int& nOuterLost() const {return (*collection->val_nOuterLost)().at(idx);}
+    const unsigned int& nInnerLost() const {return (*collection->val_nInnerLost)().at(idx);}
+    const unsigned int& algo() const {return (*collection->val_algo)().at(idx);}
+    const unsigned int& originalAlgo() const {return (*collection->val_originalAlgo)().at(idx);}
+    const ULong64_t& algoMask() const {return (*collection->val_algoMask)().at(idx);}
+    const unsigned int& stopReason() const {return (*collection->val_stopReason)().at(idx);}
+    const short& isHP() const {return (*collection->val_isHP)().at(idx);}
+    const int& seedIdx() const {return (*collection->val_seedIdx)().at(idx);}
+    const float& vtxx() const {return (*collection->val_vtxx)().at(idx);}
+    const float& vtxy() const {return (*collection->val_vtxy)().at(idx);}
+    const float& vtxz() const {return (*collection->val_vtxz)().at(idx);}
+    const vector<float>& shareFrac() const {return (*collection->val_shareFrac)().at(idx);}
+    const vector<int>& simTrkIdx() const {return (*collection->val_simTrkIdx)().at(idx);}
+    const int& genIdx() const {return (*collection->val_genIdx)().at(idx);}
+    const float& genDR() const {return (*collection->val_genDR)().at(idx);}
 };
 
 const Track TrackCollection::iter::operator*() const {
@@ -430,7 +430,7 @@ class SimTrackCollection {
         val_seedIdx = tds.track_branch_obj<vector<vector<int>>>("sim_seedIdx");
     }
 
-    size_t size() const { return val_event->get_value().size();}
+    size_t size() const { return (*val_event)().size();}
 
     const SimTrack operator[](size_t) const;
     iter begin() const { return iter(this, 0); }
@@ -443,34 +443,34 @@ struct SimTrack {
     SimTrack(const SimTrackCollection* collection, const size_t idx)
       :collection(collection), idx(idx) { }
 
-    const int& event() const {return collection->val_event->get_value().at(idx);}
-    const int& bunchCrossing() const {return collection->val_bunchCrossing->get_value().at(idx);}
-    const int& pdgId() const {return collection->val_pdgId->get_value().at(idx);}
-    const float& px() const {return collection->val_px->get_value().at(idx);}
-    const float& py() const {return collection->val_py->get_value().at(idx);}
-    const float& pz() const {return collection->val_pz->get_value().at(idx);}
-    const float& pt() const {return collection->val_pt->get_value().at(idx);}
-    const float& eta() const {return collection->val_eta->get_value().at(idx);}
-    const float& phi() const {return collection->val_phi->get_value().at(idx);}
-    const float& pca_pt() const {return collection->val_pca_pt->get_value().at(idx);}
-    const float& pca_eta() const {return collection->val_pca_eta->get_value().at(idx);}
-    const float& pca_lambda() const {return collection->val_pca_lambda->get_value().at(idx);}
-    const float& pca_cotTheta() const {return collection->val_pca_cotTheta->get_value().at(idx);}
-    const float& pca_phi() const {return collection->val_pca_phi->get_value().at(idx);}
-    const float& pca_dxy() const {return collection->val_pca_dxy->get_value().at(idx);}
-    const float& pca_dz() const {return collection->val_pca_dz->get_value().at(idx);}
-    const int& q() const {return collection->val_q->get_value().at(idx);}
-    const unsigned int& nValid() const {return collection->val_nValid->get_value().at(idx);}
-    const unsigned int& nPixel() const {return collection->val_nPixel->get_value().at(idx);}
-    const unsigned int& nStrip() const {return collection->val_nStrip->get_value().at(idx);}
-    const unsigned int& nLay() const {return collection->val_nLay->get_value().at(idx);}
-    const unsigned int& nPixelLay() const {return collection->val_nPixelLay->get_value().at(idx);}
-    const unsigned int& n3DLay() const {return collection->val_n3DLay->get_value().at(idx);}
-    const vector<int>& trkIdx() const {return collection->val_trkIdx->get_value().at(idx);}
-    const vector<float>& shareFrac() const {return collection->val_shareFrac->get_value().at(idx);}
-    const int& parentVtxIdx() const {return collection->val_parentVtxIdx->get_value().at(idx);}
-    const vector<int>& decayVtxIdx() const {return collection->val_decayVtxIdx->get_value().at(idx);}
-    const vector<int>& seedIdx() const {return collection->val_seedIdx->get_value().at(idx);}
+    const int& event() const {return (*collection->val_event)().at(idx);}
+    const int& bunchCrossing() const {return (*collection->val_bunchCrossing)().at(idx);}
+    const int& pdgId() const {return (*collection->val_pdgId)().at(idx);}
+    const float& px() const {return (*collection->val_px)().at(idx);}
+    const float& py() const {return (*collection->val_py)().at(idx);}
+    const float& pz() const {return (*collection->val_pz)().at(idx);}
+    const float& pt() const {return (*collection->val_pt)().at(idx);}
+    const float& eta() const {return (*collection->val_eta)().at(idx);}
+    const float& phi() const {return (*collection->val_phi)().at(idx);}
+    const float& pca_pt() const {return (*collection->val_pca_pt)().at(idx);}
+    const float& pca_eta() const {return (*collection->val_pca_eta)().at(idx);}
+    const float& pca_lambda() const {return (*collection->val_pca_lambda)().at(idx);}
+    const float& pca_cotTheta() const {return (*collection->val_pca_cotTheta)().at(idx);}
+    const float& pca_phi() const {return (*collection->val_pca_phi)().at(idx);}
+    const float& pca_dxy() const {return (*collection->val_pca_dxy)().at(idx);}
+    const float& pca_dz() const {return (*collection->val_pca_dz)().at(idx);}
+    const int& q() const {return (*collection->val_q)().at(idx);}
+    const unsigned int& nValid() const {return (*collection->val_nValid)().at(idx);}
+    const unsigned int& nPixel() const {return (*collection->val_nPixel)().at(idx);}
+    const unsigned int& nStrip() const {return (*collection->val_nStrip)().at(idx);}
+    const unsigned int& nLay() const {return (*collection->val_nLay)().at(idx);}
+    const unsigned int& nPixelLay() const {return (*collection->val_nPixelLay)().at(idx);}
+    const unsigned int& n3DLay() const {return (*collection->val_n3DLay)().at(idx);}
+    const vector<int>& trkIdx() const {return (*collection->val_trkIdx)().at(idx);}
+    const vector<float>& shareFrac() const {return (*collection->val_shareFrac)().at(idx);}
+    const int& parentVtxIdx() const {return (*collection->val_parentVtxIdx)().at(idx);}
+    const vector<int>& decayVtxIdx() const {return (*collection->val_decayVtxIdx)().at(idx);}
+    const vector<int>& seedIdx() const {return (*collection->val_seedIdx)().at(idx);}
 };
 
 const SimTrack SimTrackCollection::iter::operator*() const {
@@ -517,7 +517,7 @@ class SimVertexCollection {
         val_daughterSimIdx = tds.track_branch_obj<vector<vector<int>>>("simvtx_daughterSimIdx");
     }
 
-    size_t size() const { return val_event->get_value().size();}
+    size_t size() const { return (*val_event)().size();}
 
     const SimVertex operator[](size_t) const;
     iter begin() const { return iter(this, 0); }
@@ -530,14 +530,14 @@ struct SimVertex {
     SimVertex(const SimVertexCollection* collection, const size_t idx)
       :collection(collection), idx(idx) { }
 
-    const int& event() const {return collection->val_event->get_value().at(idx);}
-    const int& bunchCrossing() const {return collection->val_bunchCrossing->get_value().at(idx);}
-    const unsigned int& processType() const {return collection->val_processType->get_value().at(idx);}
-    const float& x() const {return collection->val_x->get_value().at(idx);}
-    const float& y() const {return collection->val_y->get_value().at(idx);}
-    const float& z() const {return collection->val_z->get_value().at(idx);}
-    const vector<int>& sourceSimIdx() const {return collection->val_sourceSimIdx->get_value().at(idx);}
-    const vector<int>& daughterSimIdx() const {return collection->val_daughterSimIdx->get_value().at(idx);}
+    const int& event() const {return (*collection->val_event)().at(idx);}
+    const int& bunchCrossing() const {return (*collection->val_bunchCrossing)().at(idx);}
+    const unsigned int& processType() const {return (*collection->val_processType)().at(idx);}
+    const float& x() const {return (*collection->val_x)().at(idx);}
+    const float& y() const {return (*collection->val_y)().at(idx);}
+    const float& z() const {return (*collection->val_z)().at(idx);}
+    const vector<int>& sourceSimIdx() const {return (*collection->val_sourceSimIdx)().at(idx);}
+    const vector<int>& daughterSimIdx() const {return (*collection->val_daughterSimIdx)().at(idx);}
 };
 
 const SimVertex SimVertexCollection::iter::operator*() const {

+ 98 - 46
looper/analysis/config.yaml

@@ -1,55 +1,97 @@
-#max-events: 3000
+# max-events: 300
 debug: false
 
-output-file: new_seeding.root
+output-file: ../hists/new_seeding.root
 source-files:
-    - filename: data/new_trees/trackingNtuple_1.root
+    - filename: ../data/new_trees/trackingNtuple_1.root
+    - filename: ../data/new_trees/trackingNtuple_2.root
+    - filename: ../data/new_trees/trackingNtuple_3.root
+    - filename: ../data/new_trees/trackingNtuple_4.root
+    - filename: ../data/new_trees/trackingNtuple_5.root
+    - filename: ../data/new_trees/trackingNtuple_6.root
+    - filename: ../data/new_trees/trackingNtuple_7.root
+    - filename: ../data/new_trees/trackingNtuple_8.root
+    - filename: ../data/new_trees/trackingNtuple_9.root
+    - filename: ../data/new_trees/trackingNtuple_10.root
+    - filename: ../data/new_trees/trackingNtuple_11.root
+    - filename: ../data/new_trees/trackingNtuple_12.root
+    - filename: ../data/new_trees/trackingNtuple_13.root
+    - filename: ../data/new_trees/trackingNtuple_14.root
+    - filename: ../data/new_trees/trackingNtuple_15.root
+    - filename: ../data/new_trees/trackingNtuple_16.root
+    - filename: ../data/new_trees/trackingNtuple_17.root
+    - filename: ../data/new_trees/trackingNtuple_18.root
+    - filename: ../data/new_trees/trackingNtuple_19.root
 
-# output-file: old_seeding2.root
-# source-files:
-#     - filename: data/old_seeding2/trackingNtuple_1.root
-#     - filename: data/old_seeding2/trackingNtuple_2.root
-#     - filename: data/old_seeding2/trackingNtuple_3.root
-#     - filename: data/old_seeding2/trackingNtuple_4.root
-#     - filename: data/old_seeding2/trackingNtuple_5.root
-#     - filename: data/old_seeding2/trackingNtuple_6.root
-#     - filename: data/old_seeding2/trackingNtuple_7.root
-#     - filename: data/old_seeding2/trackingNtuple_8.root
-#     - filename: data/old_seeding2/trackingNtuple_9.root
-#     - filename: data/old_seeding2/trackingNtuple_10.root
-#     - filename: data/old_seeding2/trackingNtuple_11.root
-#     - filename: data/old_seeding2/trackingNtuple_12.root
-#     - filename: data/old_seeding2/trackingNtuple_13.root
-#     - filename: data/old_seeding2/trackingNtuple_14.root
-#     - filename: data/old_seeding2/trackingNtuple_15.root
-#     - filename: data/old_seeding2/trackingNtuple_16.root
-#     - filename: data/old_seeding2/trackingNtuple_17.root
-#     - filename: data/old_seeding2/trackingNtuple_18.root
-#     - filename: data/old_seeding2/trackingNtuple_19.root
+hist-params:
 
-#output-file: new_seeding2.root
-#source-files:
-#    - filename: data/new_seeding2/trackingNtuple_1.root
-#    - filename: data/new_seeding2/trackingNtuple_2.root
-#    - filename: data/new_seeding2/trackingNtuple_3.root
-#    - filename: data/new_seeding2/trackingNtuple_4.root
-#    - filename: data/new_seeding2/trackingNtuple_5.root
-#    - filename: data/new_seeding2/trackingNtuple_6.root
-#    - filename: data/new_seeding2/trackingNtuple_7.root
-#    - filename: data/new_seeding2/trackingNtuple_8.root
-#    - filename: data/new_seeding2/trackingNtuple_9.root
-#    - filename: data/new_seeding2/trackingNtuple_10.root
-#    - filename: data/new_seeding2/trackingNtuple_11.root
-#    - filename: data/new_seeding2/trackingNtuple_12.root
-#    - filename: data/new_seeding2/trackingNtuple_13.root
-#    - filename: data/new_seeding2/trackingNtuple_14.root
-#    - filename: data/new_seeding2/trackingNtuple_15.root
-#    - filename: data/new_seeding2/trackingNtuple_16.root
-#    - filename: data/new_seeding2/trackingNtuple_17.root
-#    - filename: data/new_seeding2/trackingNtuple_18.root
-#    - filename: data/new_seeding2/trackingNtuple_19.root
+    dRz:
+        label_x: "dRz (cm)"
+        nbins: 30
+        low: 0
+        high: 10
+        label_y: ""
 
-hist-params:
+    dPhi:
+        label_x: "dPhi (rad)"
+        nbins: 30
+        low: 0
+        high: 0.15
+        label_y: ""
+
+    dRz_v_Et:
+        label_x: "dRz (cm)"
+        nbins_x: 30
+        low_x: 0
+        high_x: 10
+        label_y: "$E_T$"
+        nbins_y: 30
+        low_y: 0
+        high_y: 100
+
+    dPhi_v_Et:
+        label_x: "dPhi (rad)"
+        nbins_x: 30
+        low_x: 0
+        high_x: 0.15
+        label_y: "$E_T$"
+        nbins_y: 30
+        low_y: 0
+        high_y: 100
+
+    dRz_outer_hits:
+        label_x: "dRz (cm)"
+        nbins: 30
+        low: 0
+        high: 0.1
+        label_y: ""
+
+    dPhi_outer_hits:
+        label_x: "dPhi (rad)"
+        nbins: 30
+        low: 0
+        high: 0.004
+        label_y: ""
+
+    dRz_v_Et_outer_hits:
+        label_x: "dRz (cm)"
+        nbins_x: 30
+        low_x: 0
+        high_x: 0.15
+        label_y: "$E_T$"
+        nbins_y: 30
+        low_y: 0
+        high_y: 100
+
+    dPhi_v_Et_outer_hits:
+        label_x: "dPhi (rad)"
+        nbins_x: 30
+        low_x: 0
+        high_x: 0.004
+        label_y: "$E_T$"
+        nbins_y: 30
+        low_y: 0
+        high_y: 100
 
     eff_v_pt:
         label_x: "eff_v_pt"
@@ -98,3 +140,13 @@ hist-params:
         nbins_y: 7
         low_y: -0.5
         high_y: 6.5
+
+    hit_vs_layer:
+        label_x: "layer"
+        nbins_x: 4
+        low_x: 0.5
+        high_x: 4.5
+        label_y: "hit number"
+        nbins_y: 5
+        low_y: 0.5
+        high_y: 5.5

+ 155 - 193
looper/analysis/tracking_eff.cpp

@@ -1,34 +1,15 @@
 #include <iostream>
 #include <vector>
-#include <map>
-#include <utility>
-#include <numeric>
-#include <limits>
 #include <cmath>
 #include <TSystem.h>
 
-#include "filval/filval.hpp"
-#include "filval/root/filval.hpp"
+#include "filval.hpp"
+#include "root_filval.hpp"
 
 #include <boost/range/combine.hpp>
-#include <boost/format.hpp>
 
-#include "analysis/TrackingNtuple.h"
 #include "analysis/TrackingNtupleObjs.hpp"
-#include "analysis/common.hpp"
 
-using namespace std;
-using namespace fv;
-using namespace fv::root;
-
-enum class HitType {
-  Pixel = 0,
-  Strip = 1,
-  Glued = 2,
-  Invalid = 3,
-  Phase2OT = 4,
-  Unknown = 99
-};
 
 SeedCollection seeds;
 SimTrackCollection sim_tracks;
@@ -55,22 +36,27 @@ bool in_lum_region(const SimVertex& vertex) {
     /* Here approximate the luminous region as a cylinder with length 5*\sigma_z and radius
      * sqrt(\simga_x^2 + \sigma_y^2) centered as beamspot position.
      */
-    float dx = vertex.x() - bs.x->get_value();
-    float dy = vertex.y() - bs.y->get_value();
-    float dz = vertex.z() - bs.z->get_value();
-    float radius = 5*sqrt(pow(bs.sigma_x->get_value(), 2) + pow(bs.sigma_y->get_value(), 2));
-    float half_len = 5*bs.sigma_z->get_value();
+    float dx = vertex.x() - bs.x->get();
+    float dy = vertex.y() - bs.y->get();
+    float dz = vertex.z() - bs.z->get();
+    float radius = static_cast<float>(5 * sqrt(pow(bs.sigma_x->get(), 2) + pow(bs.sigma_y->get(), 2)));
+    float half_len = 5*bs.sigma_z->get();
     return sqrt(dx*dx + dy*dy) < radius and abs(dz) < half_len;
 };
 
-bool is_good_sim(size_t simTrkIdx) {
-    const auto& track = sim_tracks[simTrkIdx];
-    const auto& vertex = sim_vertices[track.parentVtxIdx()];
-    return abs(track.pdgId()) == 11 and in_lum_region(vertex);
+bool is_good_sim(const SimTrack& sim_track) {
+    const auto& vertex = sim_vertices[sim_track.parentVtxIdx()];
+    return abs(sim_track.pdgId()) == 11 and in_lum_region(vertex);
 };
 
-void run_analysis(const vector<fv::util::DataFileDescriptor>& dfds, const string output_filename, bool silent){
-    TrackingDataSet tds(output_filename, dfds, "trackingNtuple/tree");
+
+void run(bool silent){
+    using namespace std;
+    using namespace fv;
+    using namespace fv_root;
+    auto file_list = the_config->get_source_files();
+    string output_filename = the_config->get_output_filename();
+    TrackingDataSet tds(output_filename, file_list, "trackingNtuple/tree");
     register_objects(tds);
 
     bs = {
@@ -82,189 +68,165 @@ void run_analysis(const vector<fv::util::DataFileDescriptor>& dfds, const string
         tds.track_branch<float>("bsp_sigmaz")
     };
 
-    // Indices of prompt-ish sim electrons
-    auto good_sim_electrons = func_value<vector<size_t>>("good_sim_electrons",
-        FUNC(([](){
-            vector<size_t> idxs;
-            for(const auto& sim_track : sim_tracks) {
-                if (is_good_sim(sim_track.idx)) idxs.push_back(sim_track.idx);
-            }
-            return idxs;
-        })));
-
-    // Indices of prompt-ish sim electrons that have a matched seed
-    function<bool(size_t)> with_seed = [](const size_t& e_idx) {
-        return seeds.size() != 0 and sim_tracks[e_idx].seedIdx().size() != 0;
-    };
-
-    // Indices of prompt-ish sim electrons that have a matched gsftrack
-    function<bool(size_t)> with_track = [](const size_t& e_idx) { return sim_tracks[e_idx].trkIdx().size() > 0; };
-
-    function<float(size_t)> sim_pt = [](const size_t& sim_idx) { return sim_tracks[sim_idx].pt(); };
-
-    function<float(size_t)> sim_eta = [](const size_t& sim_idx) { return sim_tracks[sim_idx].eta(); };
-
-    function<float(size_t)> sim_phi = [](const size_t& sim_idx) { return sim_tracks[sim_idx].phi(); };
-
-    float pt_cut = 20; // GeV
-    float eta_cut = 2.4;
-    function<bool(size_t)> sim_in_pt = [pt_cut](size_t sim_idx) {
-        return sim_tracks[sim_idx].pt() > pt_cut;
-    };
-
-    function<bool(size_t)> sim_in_eta = [eta_cut](size_t sim_idx) {
-        return abs(sim_tracks[sim_idx].eta()) < eta_cut;
-    };
-
-    function<bool(size_t)> sim_in_eta_and_pt = [eta_cut, pt_cut](size_t sim_idx) {
-        return abs(sim_tracks[sim_idx].eta()) < eta_cut and
-               sim_tracks[sim_idx].pt() > pt_cut;
-    };
-
-    tds.register_container<EfficiencyContainer<size_t>>("seed_eff_v_pt",
-        good_sim_electrons, TH1Params::lookup("eff_v_pt"), &sim_in_eta, &with_seed, &sim_pt);
-
-    tds.register_container<EfficiencyContainer<size_t>>("seed_eff_v_eta",
-        good_sim_electrons, TH1Params::lookup("eff_v_eta"), &sim_in_pt, &with_seed, &sim_eta);
-
-    tds.register_container<EfficiencyContainer<size_t>>("seed_eff_v_phi",
-        good_sim_electrons, TH1Params::lookup("eff_v_phi"), &sim_in_eta_and_pt, &with_seed, &sim_phi);
-
-    tds.register_container<EfficiencyContainer<size_t>>("track_eff_v_pt",
-        good_sim_electrons, TH1Params::lookup("eff_v_pt"), &sim_in_eta, &with_track, &sim_pt);
-
-    tds.register_container<EfficiencyContainer<size_t>>("track_eff_v_eta",
-        good_sim_electrons, TH1Params::lookup("eff_v_eta"), &sim_in_pt, &with_track, &sim_eta);
+    auto& dRz_BPIX_L1_H1  = *tds.register_container<ContainerTH1<float>>("dRz_BPIX_L1_H1",  TH1Params::lookup("dRz"));
+    auto& dPhi_BPIX_L1_H1 = *tds.register_container<ContainerTH1<float>>("dPhi_BPIX_L1_H1", TH1Params::lookup("dPhi"));
+    auto& dRz_BPIX_L1_H1_v_Et  = *tds.register_container<ContainerTH2<float>>("dRz_BPIX_L1_H1_v_Et",  TH2Params::lookup("dRz_v_Et"));
+    auto& dPhi_BPIX_L1_H1_v_Et = *tds.register_container<ContainerTH2<float>>("dPhi_BPIX_L1_H1_v_Et", TH2Params::lookup("dPhi_v_Et"));
+
+    auto& dRz_BPIX_L2_H2  = *tds.register_container<ContainerTH1<float>>("dRz_BPIX_L2_H2",  TH1Params::lookup("dRz_outer_hits"));
+    auto& dPhi_BPIX_L2_H2 = *tds.register_container<ContainerTH1<float>>("dPhi_BPIX_L2_H2", TH1Params::lookup("dPhi_outer_hits"));
+    auto& dRz_BPIX_L2_H2_v_Et  = *tds.register_container<ContainerTH2<float>>("dRz_BPIX_L2_H2_v_Et",  TH2Params::lookup("dRz_v_Et_outer_hits"));
+    auto& dPhi_BPIX_L2_H2_v_Et = *tds.register_container<ContainerTH2<float>>("dPhi_BPIX_L2_H2_v_Et", TH2Params::lookup("dPhi_v_Et_outer_hits"));
+
+    auto& dRz_BPIX_L3_H3  = *tds.register_container<ContainerTH1<float>>("dRz_BPIX_L3_H3",  TH1Params::lookup("dRz_outer_hits"));
+    auto& dPhi_BPIX_L3_H3 = *tds.register_container<ContainerTH1<float>>("dPhi_BPIX_L3_H3", TH1Params::lookup("dPhi_outer_hits"));
+    auto& dRz_BPIX_L3_H3_v_Et  = *tds.register_container<ContainerTH2<float>>("dRz_BPIX_L3_H3_v_Et",  TH2Params::lookup("dRz_v_Et_outer_hits"));
+    auto& dPhi_BPIX_L3_H3_v_Et = *tds.register_container<ContainerTH2<float>>("dPhi_BPIX_L3_H3_v_Et", TH2Params::lookup("dPhi_v_Et_outer_hits"));
+
+    auto& seed_eff_v_pt  = *tds.register_container<EfficiencyContainer<float>>("seed_eff_v_pt",  TH1Params::lookup("eff_v_pt"));
+    auto& seed_eff_v_eta = *tds.register_container<EfficiencyContainer<float>>("seed_eff_v_eta", TH1Params::lookup("eff_v_eta"));
+    auto& seed_eff_v_phi = *tds.register_container<EfficiencyContainer<float>>("seed_eff_v_phi", TH1Params::lookup("eff_v_phi"));
+
+    auto& tracking_eff_v_pt  = *tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_pt",  TH1Params::lookup("eff_v_pt"));
+    auto& tracking_eff_v_eta = *tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_eta", TH1Params::lookup("eff_v_eta"));
+    auto& tracking_eff_v_phi = *tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_phi", TH1Params::lookup("eff_v_phi"));
+
+    auto& seed_pur_v_pt  = *tds.register_container<EfficiencyContainer<float>>("seed_pur_v_pt",  TH1Params::lookup("pur_v_pt"));
+    auto& seed_pur_v_eta = *tds.register_container<EfficiencyContainer<float>>("seed_pur_v_eta", TH1Params::lookup("pur_v_eta"));
+    auto& seed_pur_v_phi = *tds.register_container<EfficiencyContainer<float>>("seed_pur_v_phi", TH1Params::lookup("pur_v_phi"));
+
+    auto& tracking_pur_v_pt  = *tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_pt",  TH1Params::lookup("pur_v_pt"));
+    auto& tracking_pur_v_eta = *tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_eta", TH1Params::lookup("pur_v_eta"));
+    auto& tracking_pur_v_phi = *tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_phi", TH1Params::lookup("pur_v_phi"));
+
+
+    auto& hit_vs_layer_barrel = *tds.register_container<ContainerTH2<int>>("hit_vs_layer_barrel", TH2Params::lookup("hit_vs_layer"));
+    auto& hit_vs_layer_forward = *tds.register_container<ContainerTH2<int>>("hit_vs_layer_forward", TH2Params::lookup("hit_vs_layer"));
+
+    while (tds.next(!silent)) {
+
+        for (const auto& sim_track : sim_tracks) {
+            if (!is_good_sim(sim_track)) continue;
+            if (seeds.size() == 0) continue;
+            bool matched = !sim_track.seedIdx().empty();
+            if (abs(sim_track.eta()) < 2.4)
+                seed_eff_v_pt.fill(sim_track.pt(), matched);
+            if (abs(sim_track.pt()) > 20.0)
+                seed_eff_v_eta.fill(sim_track.eta(), matched);
+            if (abs(sim_track.eta()) < 2.4 and abs(sim_track.pt()) < 20)
+                seed_eff_v_phi.fill(sim_track.phi(), matched);
+        }
 
-    tds.register_container<EfficiencyContainer<size_t>>("track_eff_v_phi",
-        good_sim_electrons, TH1Params::lookup("eff_v_phi"), &sim_in_eta_and_pt, &with_track, &sim_phi);
+        for (const auto& sim_track : sim_tracks) {
+            if (!is_good_sim(sim_track)) continue;
+            if (gsf_tracks.size() == 0) continue;
+            bool matched = !sim_track.trkIdx().empty();
+            if (abs(sim_track.eta()) < 2.4)
+                tracking_eff_v_pt.fill(sim_track.pt(), matched);
+            if (sim_track.pt() > 20.0)
+                tracking_eff_v_eta.fill(sim_track.eta(), matched);
+            if (abs(sim_track.eta()) < 2.4 and sim_track.pt() > 20)
+                tracking_eff_v_phi.fill(sim_track.phi(), matched);
+        }
 
-    // Indices of ecal-driven seeds
-    auto ecal_seeds = func_value<vector<size_t>>("ecal_seeds",
-        FUNC(([](){
-            vector<size_t> idxs;
-            for (const auto& seed : seeds) {
-                idxs.push_back(seed.idx);
+        for (const auto& seed : seeds) {
+            bool match = false;
+            for (const auto& sim_track_idx : seed.simTrkIdx()) {
+                if(is_good_sim(sim_tracks[sim_track_idx])) {
+                    match = true;
+                    break;
+                }
             }
-            return idxs;
-        })));
-
-    function<bool(size_t)> seed_with_sim_electron = [](const size_t& seed_idx) {
-        for (const int& simTrkIdx : seeds[seed_idx].simTrkIdx()) {
-            if (is_good_sim(simTrkIdx)) return true;
+            if (abs(seed.eta()) < 2.4)
+                seed_pur_v_pt.fill(seed.pt(), match);
+            if (seed.pt() > 20)
+                seed_pur_v_eta.fill(seed.eta(), match);
+            if (abs(seed.eta()) < 2.4 and seed.pt() > 20)
+                seed_pur_v_phi.fill(seed.phi(), match);
         }
-        return false;
-    };
-
-    function<float(size_t)> seed_pt = [](const size_t& seed_idx) { return seeds[seed_idx].pt(); };
 
-    function<float(size_t)> seed_eta = [](const size_t& seed_idx) { return seeds[seed_idx].eta(); };
-
-    function<float(size_t)> seed_phi = [](const size_t& seed_idx) { return seeds[seed_idx].phi(); };
-
-    function<bool(size_t)> seed_in_pt = [pt_cut](size_t seed_idx) { return seeds[seed_idx].pt() > pt_cut; };
-
-    function<bool(size_t)> seed_in_eta = [eta_cut](size_t seed_idx) { return abs(seeds[seed_idx].eta()) < eta_cut; };
-
-    function<bool(size_t)> seed_in_eta_and_pt = [eta_cut, pt_cut](size_t seed_idx) {
-        return abs(seeds[seed_idx].eta()) < eta_cut and
-               seeds[seed_idx].pt() > pt_cut;
-    };
-
-    tds.register_container<EfficiencyContainer<size_t>>("seed_pur_v_pt",
-        ecal_seeds, TH1Params::lookup("pur_v_pt"), &seed_in_eta, &seed_with_sim_electron, &seed_pt, true);
-
-    tds.register_container<EfficiencyContainer<size_t>>("seed_pur_v_eta",
-        ecal_seeds, TH1Params::lookup("pur_v_eta"), &seed_in_pt, &seed_with_sim_electron, &seed_eta, true);
-
-    tds.register_container<EfficiencyContainer<size_t>>("seed_pur_v_phi",
-        ecal_seeds, TH1Params::lookup("pur_v_phi"), &seed_in_eta_and_pt, &seed_with_sim_electron, &seed_phi, true);
-
-
-    // Indices of gsf-tracks from ECAL-Driven Seeds
-    auto ecal_tracks = func_value<vector<size_t>>("ecal_tracks",
-        FUNC(([]() {
-            vector<size_t> idxs;
-            for (const auto& seed : seeds) {
-                const int& trk_idx = seed.trkIdx();
-                if (trk_idx >= 0) idxs.push_back(trk_idx);
+        for (const auto& gsf_track : gsf_tracks) {
+            bool match = false;
+            for (const auto& sim_track_idx : gsf_track.simTrkIdx()) {
+                if(is_good_sim(sim_tracks[sim_track_idx])) {
+                    match = true;
+                    break;
+                }
             }
-            return idxs;
-        })));
+            if (abs(gsf_track.eta()) < 2.4)
+                tracking_pur_v_pt.fill(gsf_track.pt(), match);
+            if (gsf_track.pt() > 20)
+                tracking_pur_v_eta.fill(gsf_track.eta(), match);
+            if (abs(gsf_track.eta()) < 2.4 and gsf_track.pt() > 20)
+                tracking_pur_v_phi.fill(gsf_track.phi(), match);
 
-    function<bool(size_t)> gsf_track_with_sim_electron = [](const size_t& track_idx) {
-        for (const int& simTrkIdx : gsf_tracks[track_idx].simTrkIdx()) {
-            if (is_good_sim(simTrkIdx)) return true;
         }
-        return false;
-    };
-
-    function<float(size_t)> track_pt = [](const size_t& track_idx) { return gsf_tracks[track_idx].pt(); };
-    function<float(size_t)> track_eta = [](const size_t& track_idx) { return gsf_tracks[track_idx].eta(); };
-    function<float(size_t)> track_phi = [](const size_t& track_idx) { return gsf_tracks[track_idx].phi(); };
-
-    function<bool(size_t)> track_in_pt = [pt_cut](size_t track_idx) { return gsf_tracks[track_idx].pt() > pt_cut; };
 
-    function<bool(size_t)> track_in_eta = [eta_cut](size_t track_idx) { return abs(gsf_tracks[track_idx].eta()) < eta_cut; };
-
-    function<bool(size_t)> track_in_eta_and_pt = [eta_cut, pt_cut](size_t track_idx) {
-        return abs(gsf_tracks[track_idx].eta()) < eta_cut and gsf_tracks[track_idx].pt() > pt_cut;
-    };
-
-    tds.register_container<EfficiencyContainer<size_t>>("track_pur_v_pt",
-        ecal_tracks, TH1Params::lookup("pur_v_pt"), &track_in_eta, &gsf_track_with_sim_electron, &track_pt, true);
-
-    tds.register_container<EfficiencyContainer<size_t>>("track_pur_v_eta",
-        ecal_tracks, TH1Params::lookup("pur_v_eta"), &track_in_pt, &gsf_track_with_sim_electron, &track_eta, true);
-
-    tds.register_container<EfficiencyContainer<size_t>>("track_pur_v_phi",
-        ecal_tracks, TH1Params::lookup("pur_v_phi"), &track_in_eta_and_pt, &gsf_track_with_sim_electron, &track_phi, true);
-
-    auto residuals_rPhi = func<vector<float>(int, int, int)>("residuals_rPhi",
-        FUNC(([](int detSel, int layerSel, int hitSel) {
-        std::vector<float> residuals;
-        for (const Seed& seed : seeds) {
-            int nHits = seed.isBarrel().size();
-            for (int idx_hit=0; idx_hit<nHits; idx_hit++) {
-                if ((detSel==0 or detSel==seed.isBarrel()[idx_hit]) and
-                    (layerSel==0 or layerSel==seed.layerOrDiskNr()[idx_hit]) and
-                    (hitSel==0 or hitSel==(idx_hit+1))) {
-                    if (seed.isValidPos()[idx_hit]) {
-                        residuals.push_back(seed.dRZPos()[idx_hit]);
-                    }
-                    if (seed.isValidNeg()[idx_hit]) {
-                        residuals.push_back(seed.dRZNeg()[idx_hit]);
-                    }
+        for (const auto& seed : seeds) {
+            if (seed.trkIdx() < 0) continue;
+            const auto the_track = gsf_tracks[seed.trkIdx()];
+            vector<int>   hits_valid;
+            vector<float> hits_dRz;
+            vector<float> hits_dPhi;
+            if (the_track.q() == 1) {
+                hits_valid = seed.isValidPos();
+                hits_dRz   = seed.dRZPos();
+                hits_dPhi  = seed.dPhiPos();
+            } else {
+                hits_valid = seed.isValidNeg();
+                hits_dRz   = seed.dRZNeg();
+                hits_dPhi  = seed.dPhiNeg();
+            }
+            const vector<int>& hits_isBarrel = seed.isBarrel();
+            const vector<int>& hits_layerOrDiskNr = seed.layerOrDiskNr();
+
+            size_t nHits = hits_valid.size();
+            for(size_t hit_idx=0; hit_idx<nHits; hit_idx++) {
+                if (!hits_valid[hit_idx]) continue;
+                bool isBarrel = hits_isBarrel[hit_idx] == 1;
+                int layerOrDiskNr = hits_layerOrDiskNr[hit_idx];
+                float dRz = abs(hits_dRz[hit_idx]);
+                float dPhi = abs(hits_dPhi[hit_idx]);
+                if (isBarrel and layerOrDiskNr == 1 and hit_idx == 0 ) {
+                    dRz_BPIX_L1_H1.fill(dRz);
+                    dPhi_BPIX_L1_H1.fill(dPhi);
+                    dRz_BPIX_L1_H1_v_Et.fill(dRz, seed.pt());
+                    dPhi_BPIX_L1_H1_v_Et.fill(dPhi, seed.pt());
                 }
+                if (isBarrel and layerOrDiskNr == 2 and hit_idx == 1 ) {
+                    dRz_BPIX_L2_H2.fill(dRz);
+                    dPhi_BPIX_L2_H2.fill(dPhi);
+                    dRz_BPIX_L2_H2_v_Et.fill(dRz, seed.pt());
+                    dPhi_BPIX_L2_H2_v_Et.fill(dPhi, seed.pt());
+                }
+                if (isBarrel and layerOrDiskNr == 3 and hit_idx == 2 ) {
+                    dRz_BPIX_L3_H3.fill(dRz);
+                    dPhi_BPIX_L3_H3.fill(dPhi);
+                    dRz_BPIX_L3_H3_v_Et.fill(dRz, seed.pt());
+                    dPhi_BPIX_L3_H3_v_Et.fill(dPhi, seed.pt());
+                }
+                if (isBarrel)
+                    hit_vs_layer_barrel.fill(layerOrDiskNr, static_cast<const int &>(hit_idx + 1));
+                else
+                    hit_vs_layer_forward.fill(layerOrDiskNr, static_cast<const int &>(hit_idx + 1));
             }
         }
-        return residuals;
-    })));
-
-    tds.register_container<ContainerTH1Many<float>>("residuals_all",
-                                                    tup_apply(residuals_rPhi, fv::tuple(constant("BPIX", 1), constant("ALL", 0), constant("ALL", 0))),
-                                                    TH1Params::lookup("residuals_all"));
+    }
 
-    tds.process(silent);
     tds.save_all();
 }
 
 int main(int argc, char * argv[]){
-    using namespace fv::util;
+    using namespace fv_util;
     ArgParser args(argc, argv);
     bool silent = args.cmdOptionExists("-s");
     if(args.cmdOptionExists("-c")) {
         init_config(args.getCmdOption("-c"));
-        auto output_filename = the_config->get_output_filename();
-        if (output_filename == "") return -1;
-
-        init_log(fv::util::LogPriority::kLogInfo);
-        gSystem->Load("libfilval.so");
-
-        auto file_list = the_config->get_source_files();
-        run_analysis(file_list, output_filename, silent);
+        init_log(LogPriority::kLogInfo);
+//        gSystem->Load("libfilval.so");
+        run(silent);
     } else {
-        cout << "Usage: ./tracking_eff (-s) -c config_file.yaml" << endl;
+        cout << "Usage: ./" << argv[0] << " (-s) -c config_file.yaml" << endl;
     }
     return 0;
 }

+ 0 - 16
looper/cmake/FindJupyter.cmake

@@ -1,16 +0,0 @@
-# - Find Jupyter instalation
-# This module tries to find the Jupyter installation on your system.
-
-FIND_PROGRAM(JUPYTER_EXECUTABLE NAMES jupyter)
-SET(JUPYTER_FOUND False)
-IF(NOT ${JUPYTER_EXECUTABLE} MATCHES "JUPYTER_EXECUTABLE-NOTFOUND")
-    SET(JUPYTER_FOUND True)
-    MESSAGE("-- Found Jupyter: " ${JUPYTER_EXECUTABLE})
-ENDIF()
-
-FIND_PROGRAM(NBCONVERT_EXECUTABLE NAMES jupyter-nbconvert)
-SET(NBCONVERT_FOUND False)
-IF(NOT ${NBCONVERT_EXECUTABLE} MATCHES "NBCONVERT_EXECUTABLE-NOTFOUND")
-    SET(NBCONVERT_FOUND True)
-    MESSAGE("-- Found nbconvert: " ${NBCONVERT_EXECUTABLE})
-ENDIF()

+ 0 - 237
looper/cmake/FindROOT.cmake

@@ -1,237 +0,0 @@
-# - Find ROOT instalation
-# This module tries to find the ROOT installation on your system.
-# It tries to find the root-config script which gives you all the needed information.
-# If the system variable ROOTSYS is set this is straight forward.
-# If not the module uses the pathes given in ROOT_CONFIG_SEARCHPATH.
-# If you need an other path you should add this path to this varaible.
-# The root-config script is then used to detect basically everything else.
-# This module defines a number of key variables and macros.
-
-# F.Uhlig@gsi.de (fairroot.gsi.de)
-
-
-SET(ROOT_CONFIG_SEARCHPATH
-  ${SIMPATH}/tools/root/bin
-  $ENV{ROOTSYS}/bin
-  /usr/local/bin
-  /opt/local/bin
-  /root/bin
-)
-
-SET(ROOT_DEFINITIONS "")
-
-SET(ROOT_INSTALLED_VERSION_TOO_OLD FALSE)
-
-SET(ROOT_CONFIG_EXECUTABLE ROOT_CONFIG_EXECUTABLE-NOTFOUND)
-
-FIND_PROGRAM(ROOT_CONFIG_EXECUTABLE NAMES root-config PATHS
-   ${ROOT_CONFIG_SEARCHPATH}
-   NO_DEFAULT_PATH)
-
-IF (${ROOT_CONFIG_EXECUTABLE} MATCHES "ROOT_CONFIG_EXECUTABLE-NOTFOUND")
-  MESSAGE( FATAL_ERROR "ROOT not installed in the searchpath and ROOTSYS is not set. Please
- set ROOTSYS or add the path to your ROOT installation in the Macro FindROOT.cmake in the
- subdirectory cmake/modules.")
-ELSE (${ROOT_CONFIG_EXECUTABLE} MATCHES "ROOT_CONFIG_EXECUTABLE-NOTFOUND")
-  STRING(REGEX REPLACE "(^.*)/bin/root-config" "\\1" test ${ROOT_CONFIG_EXECUTABLE})
-  SET( ENV{ROOTSYS} ${test})
-  set( ROOTSYS ${test})
-ENDIF (${ROOT_CONFIG_EXECUTABLE} MATCHES "ROOT_CONFIG_EXECUTABLE-NOTFOUND")
-
-# root config is a bash script and not commonly executable under Windows
-# make some static assumptions instead
-IF (WIN32)
-  SET(ROOT_FOUND FALSE)
-  IF (ROOT_CONFIG_EXECUTABLE)
-    SET(ROOT_FOUND TRUE)
-    set(ROOT_INCLUDE_DIR ${ROOTSYS}/include)
-    set(ROOT_LIBRARY_DIR ${ROOTSYS}/lib)
-    SET(ROOT_BINARY_DIR ${ROOTSYS}/bin)
-    set(ROOT_LIBRARIES -LIBPATH:${ROOT_LIBRARY_DIR} libGpad.lib libHist.lib libGraf.lib libGraf3d.lib libTree.lib libRint.lib libPostscript.lib libMatrix.lib libPhysics.lib libMathCore.lib libRIO.lib libNet.lib libThread.lib libCore.lib libCint.lib libMinuit.lib libGui.lib libSpectrum.lib)
-    FIND_PROGRAM(ROOT_CINT_EXECUTABLE
-      NAMES rootcint
-      PATHS ${ROOT_BINARY_DIR}
-      NO_DEFAULT_PATH
-      )
-    MESSAGE(STATUS "Found ROOT: $ENV{ROOTSYS}/bin/root (WIN32/version not identified)")
-  ENDIF (ROOT_CONFIG_EXECUTABLE)
-
-ELSE(WIN32)
-
-  IF (ROOT_CONFIG_EXECUTABLE)
-
-    SET(ROOT_FOUND FALSE)
-
-    EXEC_PROGRAM(${ROOT_CONFIG_EXECUTABLE} ARGS "--version" OUTPUT_VARIABLE ROOTVERSION)
-
-    MESSAGE(STATUS "Found ROOT: $ENV{ROOTSYS}/bin/root (found version ${ROOTVERSION})")
-
-    # we need at least version 5.00/00
-    IF (NOT ROOT_MIN_VERSION)
-      SET(ROOT_MIN_VERSION "5.00/00")
-    ENDIF (NOT ROOT_MIN_VERSION)
-
-    # now parse the parts of the user given version string into variables
-    STRING(REGEX REPLACE "^([0-9]+)\\.[0-9][0-9]+\\/[0-9][0-9]+" "\\1" req_root_major_vers "${ROOT_MIN_VERSION}")
-    STRING(REGEX REPLACE "^[0-9]+\\.([0-9][0-9])+\\/[0-9][0-9]+.*" "\\1" req_root_minor_vers "${ROOT_MIN_VERSION}")
-    STRING(REGEX REPLACE "^[0-9]+\\.[0-9][0-9]+\\/([0-9][0-9]+)" "\\1" req_root_patch_vers "${ROOT_MIN_VERSION}")
-
-    # and now the version string given by qmake
-    STRING(REGEX REPLACE "^([0-9]+)\\.[0-9][0-9]+\\/[0-9][0-9]+.*" "\\1" found_root_major_vers "${ROOTVERSION}")
-    STRING(REGEX REPLACE "^[0-9]+\\.([0-9][0-9])+\\/[0-9][0-9]+.*" "\\1" found_root_minor_vers "${ROOTVERSION}")
-    STRING(REGEX REPLACE "^[0-9]+\\.[0-9][0-9]+\\/([0-9][0-9]+).*" "\\1" found_root_patch_vers "${ROOTVERSION}")
-
-    IF (found_root_major_vers LESS 5)
-      MESSAGE( FATAL_ERROR "Invalid ROOT version \"${ROOTERSION}\", at least major version 4 is required, e.g. \"5.00/00\"")
-    ENDIF (found_root_major_vers LESS 5)
-
-    # compute an overall version number which can be compared at once
-    MATH(EXPR req_vers "${req_root_major_vers}*10000 + ${req_root_minor_vers}*100 + ${req_root_patch_vers}")
-    MATH(EXPR found_vers "${found_root_major_vers}*10000 + ${found_root_minor_vers}*100 + ${found_root_patch_vers}")
-
-    IF (found_vers LESS req_vers)
-      SET(ROOT_FOUND FALSE)
-      SET(ROOT_INSTALLED_VERSION_TOO_OLD TRUE)
-    ELSE (found_vers LESS req_vers)
-      SET(ROOT_FOUND TRUE)
-    ENDIF (found_vers LESS req_vers)
-
-  ENDIF (ROOT_CONFIG_EXECUTABLE)
-
-
-  IF (ROOT_FOUND)
-
-    STRING(REGEX REPLACE "^([0-9]+)\\.[0-9][0-9]+\\/[0-9][0-9]+" "\\1" ROOT_MAJOR_VER "${ROOTVERSION}")
-    IF(ROOT_MAJOR_VER EQUAL 6)
-      MESSAGE("-- ROOT 6 detected - requiring C++11")
-      ADD_DEFINITIONS("-std=c++1y -DROOT_MAJOR_VER=6")
-    ENDIF(ROOT_MAJOR_VER EQUAL 6)
-
-    # ask root-config for the library dir
-    # Set ROOT_LIBRARY_DIR
-
-    EXEC_PROGRAM( ${ROOT_CONFIG_EXECUTABLE}
-      ARGS "--libdir"
-      OUTPUT_VARIABLE ROOT_LIBRARY_DIR_TMP )
-
-    IF(EXISTS "${ROOT_LIBRARY_DIR_TMP}")
-      SET(ROOT_LIBRARY_DIR ${ROOT_LIBRARY_DIR_TMP} )
-    ELSE(EXISTS "${ROOT_LIBRARY_DIR_TMP}")
-      MESSAGE("Warning: ROOT_CONFIG_EXECUTABLE reported ${ROOT_LIBRARY_DIR_TMP} as library path,")
-      MESSAGE("Warning: but ${ROOT_LIBRARY_DIR_TMP} does NOT exist, ROOT must NOT be installed correctly.")
-    ENDIF(EXISTS "${ROOT_LIBRARY_DIR_TMP}")
-
-    # ask root-config for the binary dir
-    EXEC_PROGRAM(${ROOT_CONFIG_EXECUTABLE}
-      ARGS "--bindir"
-      OUTPUT_VARIABLE root_bins )
-    SET(ROOT_BINARY_DIR ${root_bins})
-
-    # ask root-config for the include dir
-    EXEC_PROGRAM( ${ROOT_CONFIG_EXECUTABLE}
-      ARGS "--incdir"
-      OUTPUT_VARIABLE root_headers )
-    SET(ROOT_INCLUDE_DIR ${root_headers})
-    # CACHE INTERNAL "")
-
-    # ask root-config for the library varaibles
-    EXEC_PROGRAM( ${ROOT_CONFIG_EXECUTABLE}
-      #    ARGS "--noldflags --noauxlibs --libs"
-      ARGS "--glibs"
-      OUTPUT_VARIABLE root_flags )
-
-    #  STRING(REGEX MATCHALL "([^ ])+"  root_libs_all ${root_flags})
-    #  STRING(REGEX MATCHALL "-L([^ ])+"  root_library ${root_flags})
-    #  REMOVE_FROM_LIST(root_flags "${root_libs_all}" "${root_library}")
-
-    SET(ROOT_LIBRARIES "${root_flags} -lMinuit -lSpectrum -lTMVA")
-
-    # Make variables changeble to the advanced user
-    MARK_AS_ADVANCED( ROOT_LIBRARY_DIR ROOT_INCLUDE_DIR ROOT_DEFINITIONS)
-
-    # Set ROOT_INCLUDES
-    SET( ROOT_INCLUDES ${ROOT_INCLUDE_DIR})
-
-    SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${ROOT_LIBRARY_DIR})
-
-    #######################################
-    #
-    #       Check the executables of ROOT
-    #          ( rootcint )
-    #
-    #######################################
-
-    FIND_PROGRAM(ROOT_CINT_EXECUTABLE
-      NAMES rootcint
-      PATHS ${ROOT_BINARY_DIR}
-      NO_DEFAULT_PATH
-      )
-
-  ENDIF (ROOT_FOUND)
-ENDIF(WIN32)
-
-  ###########################################
-  #
-  #       Macros for building ROOT dictionary
-  #
-  ###########################################
-
-MACRO (ROOT_GENERATE_DICTIONARY INFILES LINKDEF_FILE OUTFILE INCLUDE_DIRS_IN)
-
-  set(INCLUDE_DIRS)
-
-  foreach (_current_FILE ${INCLUDE_DIRS_IN})
-    set(INCLUDE_DIRS ${INCLUDE_DIRS} -I${_current_FILE})
-  endforeach (_current_FILE ${INCLUDE_DIRS_IN})
-
-  if (CMAKE_SYSTEM_NAME MATCHES Linux)
-    ADD_CUSTOM_COMMAND(OUTPUT ${OUTFILE}
-       COMMAND LD_LIBRARY_PATH=${ROOT_LIBRARY_DIR} ROOTSYS=${ROOTSYS} ${ROOT_CINT_EXECUTABLE}
-       ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${INCLUDE_DIRS} ${INFILES} ${LINKDEF_FILE} DEPENDS ${INFILES} ${LINKDEF_FILE})
-  else (CMAKE_SYSTEM_NAME MATCHES Linux)
-    if (CMAKE_SYSTEM_NAME MATCHES Darwin)
-      ADD_CUSTOM_COMMAND(OUTPUT ${OUTFILE}
-       COMMAND DYLD_LIBRARY_PATH=${ROOT_LIBRARY_DIR} ROOTSYS=${ROOTSYS} ${ROOT_CINT_EXECUTABLE}
-       ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${INCLUDE_DIRS} ${INFILES} ${LINKDEF_FILE} DEPENDS ${INFILES} ${LINKDEF_FILE})
-    endif (CMAKE_SYSTEM_NAME MATCHES Darwin)
-  endif (CMAKE_SYSTEM_NAME MATCHES Linux)
-
-ENDMACRO (ROOT_GENERATE_DICTIONARY)
-
-MACRO (GENERATE_ROOT_TEST_SCRIPT SCRIPT_FULL_NAME)
-
-  get_filename_component(path_name ${SCRIPT_FULL_NAME} PATH)
-  get_filename_component(file_extension ${SCRIPT_FULL_NAME} EXT)
-  get_filename_component(file_name ${SCRIPT_FULL_NAME} NAME_WE)
-  set(shell_script_name "${file_name}.sh")
-
-  #MESSAGE("PATH: ${path_name}")
-  #MESSAGE("Ext: ${file_extension}")
-  #MESSAGE("Name: ${file_name}")
-  #MESSAGE("Shell Name: ${shell_script_name}")
-
-  string(REPLACE ${PROJECT_SOURCE_DIR}
-         ${PROJECT_BINARY_DIR} new_path ${path_name}
-        )
-
-  #MESSAGE("New PATH: ${new_path}")
-
-  file(MAKE_DIRECTORY ${new_path}/data)
-
-  CONVERT_LIST_TO_STRING(${LD_LIBRARY_PATH})
-  set(MY_LD_LIBRARY_PATH ${output})
-  set(my_script_name ${SCRIPT_FULL_NAME})
-
-  if(CMAKE_SYSTEM MATCHES Darwin)
-    configure_file(${PROJECT_SOURCE_DIR}/cmake/scripts/root_macro_macos.sh.in
-                   ${new_path}/${shell_script_name}
-                  )
-  else(CMAKE_SYSTEM MATCHES Darwin)
-    configure_file(${PROJECT_SOURCE_DIR}/cmake/scripts/root_macro.sh.in
-                   ${new_path}/${shell_script_name}
-                  )
-  endif(CMAKE_SYSTEM MATCHES Darwin)
-
-  EXEC_PROGRAM(/bin/chmod ARGS "u+x  ${new_path}/${shell_script_name}")
-
-ENDMACRO (GENERATE_ROOT_TEST_SCRIPT)

+ 1 - 1
looper/filval

@@ -1 +1 @@
-Subproject commit 8ec9c7a1be53c50252b69d65c0f27b2fe98f1d78
+Subproject commit 7805222983a853d6b440a700b1d7ab3d43714118

+ 2 - 0
plotting/.gitignore

@@ -0,0 +1,2 @@
+.idea/
+output/

+ 121 - 100
plotting/eff_plots.py

@@ -3,9 +3,9 @@ import numpy as np
 import matplotlib.pyplot as plt
 
 from filval.result_set import ResultSet
-from filval.histogram_utils import hist, hist_add, hist_normalize, hist_scale, hist2d
-from filval.plotter import (decl_plot, render_plots, hist_plot, hist2d_plot,
-                            hist_plot_stack, Plot, generate_dashboard)
+from filval.histogram import hist, hist_add, hist_norm, hist_scale, hist2d
+from filval.plotting import (decl_plot, render_plots, hist_plot, hist2d_plot,
+                             Plot, generate_dashboard, simple_plot)
 
 
 def center_text(x, y, txt, **kwargs):
@@ -15,7 +15,59 @@ def center_text(x, y, txt, **kwargs):
 
 
 @decl_plot
-def plot_seed_eff(old_seeds, new_seeds):
+def plot_residuals(rs, layer, hit, variable, plot_cuts=True):
+    matching_cuts = [
+        dict(
+            dPhiMaxHighEt=0.05,
+            dPhiMaxHighEtThres=20.0,
+            dPhiMaxLowEtGrad=-0.002,
+            dRzMaxHighEt=9999.0,
+            dRzMaxHighEtThres=0.0,
+            dRzMaxLowEtGrad=0.0,
+        ),
+        dict(
+            dPhiMaxHighEt=0.003,
+            dPhiMaxHighEtThres=0.0,
+            dPhiMaxLowEtGrad=0.0,
+            dRzMaxHighEt=0.05,
+            dRzMaxHighEtThres=30.0,
+            dRzMaxLowEtGrad=-0.002,
+        ),
+        dict(
+            dPhiMaxHighEt=0.003,
+            dPhiMaxHighEtThres=0.0,
+            dPhiMaxLowEtGrad=0.0,
+            dRzMaxHighEt=0.05,
+            dRzMaxHighEtThres=30.0,
+            dRzMaxLowEtGrad=-0.002,
+        )
+    ]
+
+    h = hist2d(getattr(rs, f'{variable}_BPIX_L{layer}_H{hit}_v_Et'))
+
+    def calc_window(et):
+        idx = min(hit-1, 2)
+        high_et = matching_cuts[idx][f'{variable}MaxHighEt']
+        high_et_thres = matching_cuts[idx][f'{variable}MaxHighEtThres']
+        low_et_grad = matching_cuts[idx][f'{variable}MaxLowEtGrad']
+        return high_et + min(0, et-high_et_thres)*low_et_grad
+
+    hist2d_plot(h, colorbar=True)
+
+    if plot_cuts:
+        ets = h[3][:, 0]
+        cuts = [calc_window(et) for et in ets]
+        plt.plot(cuts, ets, color='red', label='Cut Value')
+        plt.legend()
+
+    plt.xlabel({'dPhi': r'$\delta \phi$ (rads)',
+                'dRz': r'$\delta R/z$ (cm)'}[variable])
+    plt.ylabel('$E_T$ (GeV)')
+
+
+
+@decl_plot
+def plot_seed_eff(rs):
     r"""## ECAL-Driven Seeding Efficiency
 
     The proportion of gen-level electrons originating in the luminous region that have
@@ -25,33 +77,28 @@ def plot_seed_eff(old_seeds, new_seeds):
     ax_eta = plt.subplot(222)
     ax_phi = plt.subplot(223)
 
-
     errors = True
     plt.sca(ax_pt)
-    hist_plot(hist(new_seeds.seed_eff_v_pt), include_errors=errors, label='New')
-    hist_plot(hist(old_seeds.seed_eff_v_pt), include_errors=errors, label='Old')
+    hist_plot(hist(rs.seed_eff_v_pt), include_errors=errors)
     center_text(0.5, 0.3, r'$|\eta|<2.4$')
     plt.xlabel(r"Sim-Track $p_T$")
     plt.ylim((0, 1.1))
 
     plt.sca(ax_eta)
-    hist_plot(hist(new_seeds.seed_eff_v_eta), include_errors=errors, label='New')
-    hist_plot(hist(old_seeds.seed_eff_v_eta), include_errors=errors, label='Old')
+    hist_plot(hist(rs.seed_eff_v_eta), include_errors=errors)
     center_text(0.5, 0.3, r'$p_T>20$')
     plt.xlabel(r"Sim-Track $\eta$")
     plt.ylim((0, 1.1))
-    plt.legend()
 
     plt.sca(ax_phi)
-    hist_plot(hist(new_seeds.seed_eff_v_phi), include_errors=errors, label='New')
-    hist_plot(hist(old_seeds.seed_eff_v_phi), include_errors=errors, label='Old')
+    hist_plot(hist(rs.seed_eff_v_phi), include_errors=errors)
     center_text(0.5, 0.3, r'$p_T>20$ and $|\eta|<2.4$')
     plt.xlabel(r"Sim-Track $\phi$")
     plt.ylim((0, 1.1))
 
 
 @decl_plot
-def plot_track_eff(old_seeds, new_seeds):
+def plot_tracking_eff(rs):
     r"""## GSF Tracking Efficiency
 
     The proportion of electrons origination in the luminous region from the that have
@@ -63,30 +110,26 @@ def plot_track_eff(old_seeds, new_seeds):
 
     errors = True
     plt.sca(ax_pt)
-    hist_plot(hist(new_seeds.track_eff_v_pt), include_errors=errors, label='New')
-    hist_plot(hist(old_seeds.track_eff_v_pt), include_errors=errors, label='Old')
+    hist_plot(hist(rs.tracking_eff_v_pt), include_errors=errors)
     center_text(0.5, 0.3, r'$|\eta|<2.4$')
     plt.xlabel(r"Sim-Track $p_T$")
-    plt.ylim((0, 1.1))
+    # plt.ylim((0, 1.1))
 
     plt.sca(ax_eta)
-    hist_plot(hist(new_seeds.track_eff_v_eta), include_errors=errors, label='New')
-    hist_plot(hist(old_seeds.track_eff_v_eta), include_errors=errors, label='Old')
+    hist_plot(hist(rs.tracking_eff_v_eta), include_errors=errors)
     center_text(0.5, 0.3, r'$p_T>20$')
     plt.xlabel(r"Sim-Track $\eta$")
-    plt.ylim((0, 1.1))
-    plt.legend()
+    # plt.ylim((0, 1.1))
 
     plt.sca(ax_phi)
-    hist_plot(hist(new_seeds.track_eff_v_phi), include_errors=errors, label='New')
-    hist_plot(hist(old_seeds.track_eff_v_phi), include_errors=errors, label='Old')
+    hist_plot(hist(rs.tracking_eff_v_phi), include_errors=errors)
     center_text(0.5, 0.3, r'$p_T>20$ and $|\eta|<2.4$')
     plt.xlabel(r"Sim-Track $\phi$")
-    plt.ylim((0, 1.1))
+    # plt.ylim((0, 1.1))
 
 
 @decl_plot
-def plot_seed_purity(old_seeds, new_seeds, ext=""):
+def plot_seed_purity(rs, ext=""):
     r"""## ECAL-Driven Seed Purity
 
     The proportion of ECAL-driven seeds that have a matched gen-level electron originating in
@@ -96,30 +139,26 @@ def plot_seed_purity(old_seeds, new_seeds, ext=""):
     ax_eta = plt.subplot(222)
     ax_phi = plt.subplot(223)
 
-    def get_hist(rs, base_name):
+    def get_hist(base_name):
         return hist(getattr(rs, base_name+ext))
 
     errors = True
     plt.sca(ax_pt)
-    hist_plot(get_hist(new_seeds, "seed_pur_v_pt"), include_errors=errors, label='New')
-    hist_plot(get_hist(old_seeds, "seed_pur_v_pt"), include_errors=errors, label='Old')
+    hist_plot(get_hist("seed_pur_v_pt"), include_errors=errors)
     center_text(0.5, 0.3, r'$|\eta|<2.4$')
     plt.xlabel(r"Seed $p_T$")
     if not ext:
         plt.ylim((0, 1.1))
 
     plt.sca(ax_eta)
-    hist_plot(get_hist(new_seeds, "seed_pur_v_eta"), include_errors=errors, label='New')
-    hist_plot(get_hist(old_seeds, "seed_pur_v_eta"), include_errors=errors, label='Old')
+    hist_plot(get_hist("seed_pur_v_eta"), include_errors=errors)
     center_text(0.5, 0.3, r'$p_T>20$')
     plt.xlabel(r"Seed $\eta$")
     if not ext:
         plt.ylim((0, 1.1))
-    plt.legend()
 
     plt.sca(ax_phi)
-    hist_plot(get_hist(new_seeds, "seed_pur_v_phi"), include_errors=errors, label='New')
-    hist_plot(get_hist(old_seeds, "seed_pur_v_phi"), include_errors=errors, label='Old')
+    hist_plot(get_hist("seed_pur_v_phi"), include_errors=errors)
     center_text(0.5, 0.3, r'$p_T>20$ and $|\eta|<2.4$')
     plt.xlabel(r"Seed $\phi$")
     if not ext:
@@ -127,7 +166,7 @@ def plot_seed_purity(old_seeds, new_seeds, ext=""):
 
 
 @decl_plot
-def plot_track_purity(old_seeds, new_seeds, ext=""):
+def plot_track_purity(rs, ext=""):
     r"""## GSF Track Purity
 
     The proportion of GSF-tracks w\ ECAL-driven seeds that have a matched gen-level electron originating in
@@ -137,30 +176,26 @@ def plot_track_purity(old_seeds, new_seeds, ext=""):
     ax_eta = plt.subplot(222)
     ax_phi = plt.subplot(223)
 
-    def get_hist(rs, base_name):
+    def get_hist( base_name):
         return hist(getattr(rs, base_name+ext))
 
     errors = True
     plt.sca(ax_pt)
-    hist_plot(get_hist(new_seeds, "track_pur_v_pt"), include_errors=errors, label='New')
-    hist_plot(get_hist(old_seeds, "track_pur_v_pt"), include_errors=errors, label='Old')
+    hist_plot(get_hist("tracking_pur_v_pt"), include_errors=errors)
     center_text(0.5, 0.3, r'$|\eta|<2.4$')
     plt.xlabel(r"GSF-Track $p_T$")
     if not ext:
         plt.ylim((0, 1.1))
 
     plt.sca(ax_eta)
-    hist_plot(get_hist(new_seeds, "track_pur_v_eta"), include_errors=errors, label='New')
-    hist_plot(get_hist(old_seeds, "track_pur_v_eta"), include_errors=errors, label='Old')
+    hist_plot(get_hist("tracking_pur_v_eta"), include_errors=errors)
     center_text(0.5, 0.3, r'$p_T>20$')
     plt.xlabel(r"GSF-Track $\eta$")
     if not ext:
         plt.ylim((0, 1.1))
-    plt.legend()
 
     plt.sca(ax_phi)
-    hist_plot(get_hist(new_seeds, "track_pur_v_phi"), include_errors=errors, label='New')
-    hist_plot(get_hist(old_seeds, "track_pur_v_phi"), include_errors=errors, label='Old')
+    hist_plot(get_hist("tracking_pur_v_phi"), include_errors=errors)
     center_text(0.5, 0.3, r'$p_T>20$ and $|\eta|<2.4$')
     plt.xlabel(r"GSF-Track $\phi$")
     if not ext:
@@ -168,79 +203,65 @@ def plot_track_purity(old_seeds, new_seeds, ext=""):
 
 
 @decl_plot
-def plot_nhits(old_seeds, new_seeds):
-    ax_sim = plt.subplot(211)
-    ax_rec_new = plt.subplot(223)
-    ax_rec_old = plt.subplot(224)
-
-    def _plot(histo):
-        hit_hist2d = hist2d(histo)
-        hist2d_plot(hit_hist2d)
-        weights, _, xs, ys = hit_hist2d
-        hits = (ys[1:, :-1] + ys[:-1, :-1])/2
-        etas = (xs[0, :-1] + xs[0, 1:])/2
-        avg_hits = np.ma.average(hits, axis=0, weights=weights)
-        plt.plot(etas, avg_hits, 'wo', label=r'Average in $\eta$ bin')
-        plt.xlabel(r'Track $\eta$')
-        plt.ylabel(r'\# of pixel layers with Hit')
-
-    plt.sca(ax_sim)
-    _plot(new_seeds.simpixlay_v_eta)
-    plt.legend()
-    plt.colorbar()
-    center_text(0.5, 0.1, "Sim Tracks", bbox=dict(facecolor='white', alpha=0.5))
-    plt.sca(ax_rec_old)
-    _plot(old_seeds.recpixlay_v_eta)
-    plt.colorbar()
-    center_text(0.5, 0.1, "GSF-Tracks (Old Seeding)", bbox=dict(facecolor='white', alpha=0.5))
-    plt.sca(ax_rec_new)
-    _plot(new_seeds.recpixlay_v_eta)
-    plt.colorbar()
-    center_text(0.5, 0.1, "GSF-Tracks (New Seeding)", bbox=dict(facecolor='white', alpha=0.5))
+def plot_hit_vs_layer(rs, region):
+
+    h = hist2d(getattr(rs, f'hit_vs_layer_{region}'))
+
+    hist2d_plot(h, txt_format='{:2.0f}')
+    plt.xlabel('Layer \#')
+    plt.ylabel('Hit \#')
 
 
 if __name__ == '__main__':
-    old_seeds = ResultSet("old_seeds", 'old_seeding2.root')
-    new_seeds = ResultSet("new_seeds", 'new_seeding2.root')
+    rs = ResultSet('seeds', '../hists/new_seeding.root')
 
     # Next, declare all of the (sub)plots that will be assembled into full
     # figures later
-    seed_eff = plot_seed_eff, (old_seeds, new_seeds)
-    track_eff = plot_track_eff, (old_seeds, new_seeds)
+    seed_eff = plot_seed_eff, (rs, )
+    tracking_eff = plot_tracking_eff, (rs,)
+
+    seed_pur = plot_seed_purity, rs
+    seed_pur_num = plot_seed_purity, (rs,), {'ext': '_num'}
+    seed_pur_den = plot_seed_purity, (rs,), {'ext': '_den'}
+
+    track_pur = plot_track_purity, (rs,)
+    track_pur_num = plot_track_purity, (rs,), {'ext': '_num'}
+    track_pur_den = plot_track_purity, (rs,), {'ext': '_den'}
 
-    seed_pur = plot_seed_purity, (old_seeds, new_seeds)
-    seed_pur_num = plot_seed_purity, (old_seeds, new_seeds), {'ext': '_num'}
-    seed_pur_den = plot_seed_purity, (old_seeds, new_seeds), {'ext': '_den'}
+    residuals_L1_H1_dPhi = plot_residuals, (rs, 1, 1, 'dPhi')
+    residuals_L2_H2_dPhi = plot_residuals, (rs, 2, 2, 'dPhi')
+    residuals_L3_H3_dPhi = plot_residuals, (rs, 3, 3, 'dPhi')
 
-    track_pur = plot_track_purity, (old_seeds, new_seeds)
-    track_pur_num = plot_track_purity, (old_seeds, new_seeds), {'ext': '_num'}
-    track_pur_den = plot_track_purity, (old_seeds, new_seeds), {'ext': '_den'}
+    residuals_L1_H1_dRz = plot_residuals, (rs, 1, 1, 'dRz')
+    residuals_L1_H1_dRz_no_cuts = plot_residuals, (rs, 1, 1, 'dRz'), {'plot_cuts': False}
+    residuals_L2_H2_dRz = plot_residuals, (rs, 2, 2, 'dRz')
+    residuals_L3_H3_dRz = plot_residuals, (rs, 3, 3, 'dRz')
 
-    nHits = (plot_nhits, (old_seeds, new_seeds), {})
+    hit_vs_layer_barrel = plot_hit_vs_layer, (rs, 'barrel')
+    hit_vs_layer_forward = plot_hit_vs_layer, (rs, 'forward')
 
     # Now assemble the plots into figures.
     plots = [
-        Plot([[seed_eff]],
-             'ECAL-Driven Seeding Efficiency'),
-        Plot([[seed_pur]],
-             'ECAL-Driven Seed Purity'),
-        Plot([[seed_pur_num]],
-             'ECAL-Driven Seed Purity Numerator'),
-        Plot([[seed_pur_den]],
-             'ECAL-Driven Seed Purity Denominator'),
-        Plot([[track_eff]],
-             'GSF Tracking Efficiency'),
-        Plot([[track_pur]],
-             'GSF Track Purity'),
-        Plot([[track_pur_num]],
-             'GSF Track Purity Numerator'),
-        Plot([[track_pur_den]],
-             'GSF Track Purity Denominator'),
-        Plot([[nHits]],
-             'Hits'),
+        Plot(residuals_L1_H1_dPhi, 'Phi Residuals Layer 1 Hit 1'),
+        Plot(residuals_L2_H2_dPhi, 'Phi Residuals Layer 2 Hit 2'),
+        Plot(residuals_L3_H3_dPhi, 'Phi Residuals Layer 3 Hit 3'),
+        Plot(residuals_L1_H1_dRz, 'dZ Residuals Layer 1 Hit 1'),
+        Plot(residuals_L1_H1_dRz_no_cuts, 'dZ Residuals Layer 1 Hit 1 w/o cuts'),
+        Plot(residuals_L2_H2_dRz, 'dZ Residuals Layer 2 Hit 2'),
+        Plot(residuals_L3_H3_dRz, 'dZ Residuals Layer 3 Hit 3'),
+        Plot(seed_eff, 'ECAL-Driven Seeding Efficiency'),
+        Plot(tracking_eff, 'GSF Tracking Efficiency'),
+        Plot(hit_vs_layer_barrel, 'Hit vs Layer - Barrel'),
+        Plot(hit_vs_layer_forward, 'Hit vs Layer - Forward'),
+        Plot(track_pur, 'GSF Track Purity'),
+        Plot(track_pur_num, 'GSF Track Purity Numerator'),
+        Plot(track_pur_den, 'GSF Track Purity Denominator'),
     ]
 
     # Finally, render and save the plots and generate the html+bootstrap
     # dashboard to view them
     render_plots(plots, to_disk=False)
-    generate_dashboard(plots, 'Seeding Efficiency', output='eff_plots.html', source_file=__file__)
+    generate_dashboard(plots, 'Seeding Efficiency',
+                       output='eff_plots.html',
+                       source=__file__,
+                       config=rs.config)

+ 1 - 0
plotting/filval-python

@@ -0,0 +1 @@
+Subproject commit dc8c3cf99bc4193833b82c69e4dd9cf57306a7ea

+ 16 - 0
plotting/publish.py

@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+from datetime import datetime as dt
+from subprocess import run
+
+dir_name = f'seeding_studies_{dt.strftime(dt.now(), "%Y_%m_%d_%H")}'
+remote = 'caleb@fangmeier.tech:/var/www/eg/'
+run(('rm', '-rf', dir_name))
+run(('mkdir', '-p', dir_name+'/output'))
+run(('cp', '-r', '../hists', dir_name))
+run(('cp', '-r', 'output', dir_name))
+
+run(('scp', '-r', dir_name, remote))
+print(f'Data available at https://eg.fangmeier.tech/{dir_name}/')
+
+
+