Browse Source

Adds handling of super-clusters for fake-rate calculation

Caleb Fangmeier 6 years ago
parent
commit
e0fc618dd4

+ 0 - 6
.gitmodules

@@ -1,9 +1,3 @@
-[submodule "filval"]
-	path = filval
-	url = https://git.fangmeier.tech/caleb/filval.git
 [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

+ 1 - 1
looper/analysis/TrackingNtuple.h

@@ -1 +1 @@
-TrackingNtupleMod.h
+TrackingNtupleWithSCL.h

+ 71 - 1
looper/analysis/TrackingNtupleObjs.hpp

@@ -1,4 +1,4 @@
-/** TrackingNtupleObjs.hpp created on 2018-03-08 10:59:46.474049 by generate_class.py
+/** TrackingNtupleObjs.hpp created on 2018-05-02 13:32:48.869660 by generate_class.py
  * AVOID EDITING THIS FILE BY HAND!! Instead edit TrackingNtupleObjs.yaml and re-run
  * generate_class.py
  */
@@ -66,6 +66,7 @@ class SeedCollection {
     Value<vector<vector<float>>>* val_dRZNeg;
     Value<vector<vector<float>>>* val_dPhiNeg;
     Value<vector<short>>* val_isECALDriven;
+    Value<vector<int>>* val_sclIdx;
 
     SeedCollection() { }
 
@@ -106,6 +107,7 @@ class SeedCollection {
         val_dRZNeg = tds.track_branch_obj<vector<vector<float>>>("see_dRZNeg");
         val_dPhiNeg = tds.track_branch_obj<vector<vector<float>>>("see_dPhiNeg");
         val_isECALDriven = tds.track_branch_obj<vector<short>>("see_isECALDriven");
+        val_sclIdx = tds.track_branch_obj<vector<int>>("see_sclIdx");
     }
 
     size_t size() const { return (*val_fitok)().size();}
@@ -157,6 +159,7 @@ struct Seed {
     const vector<float>& dRZNeg() const {return (*collection->val_dRZNeg)().at(idx);}
     const vector<float>& dPhiNeg() const {return (*collection->val_dPhiNeg)().at(idx);}
     const short& isECALDriven() const {return (*collection->val_isECALDriven)().at(idx);}
+    const int& sclIdx() const {return (*collection->val_sclIdx)().at(idx);}
 };
 
 const Seed SeedCollection::iter::operator*() const {
@@ -555,3 +558,70 @@ const SimVertex SimVertexCollection::iter::operator*() const {
 const SimVertex SimVertexCollection::operator[](size_t idx) const {
     return {this, idx};
 }
+struct SuperCluster;
+
+class SuperClusterCollection {
+  public:
+    class iter {
+      public:
+        iter(const SuperClusterCollection* collection, size_t idx)
+          :collection(collection), idx(idx) { }
+        iter operator++() { ++idx; return *this; }
+        bool operator!=(const iter & other) { return idx != other.idx; }
+        const SuperCluster operator*() const;
+      private:
+        const SuperClusterCollection* collection;
+        size_t idx;
+    };
+
+    Value<vector<float>>* val_e;
+    Value<vector<float>>* val_px;
+    Value<vector<float>>* val_py;
+    Value<vector<float>>* val_pz;
+    Value<vector<float>>* val_x;
+    Value<vector<float>>* val_y;
+    Value<vector<float>>* val_z;
+    Value<vector<float>>* val_hoe;
+
+    SuperClusterCollection() { }
+
+    void init(TrackingDataSet& tds){
+        val_e = tds.track_branch_obj<vector<float>>("scl_e");
+        val_px = tds.track_branch_obj<vector<float>>("scl_px");
+        val_py = tds.track_branch_obj<vector<float>>("scl_py");
+        val_pz = tds.track_branch_obj<vector<float>>("scl_pz");
+        val_x = tds.track_branch_obj<vector<float>>("scl_x");
+        val_y = tds.track_branch_obj<vector<float>>("scl_y");
+        val_z = tds.track_branch_obj<vector<float>>("scl_z");
+        val_hoe = tds.track_branch_obj<vector<float>>("scl_hoe");
+    }
+
+    size_t size() const { return (*val_e)().size();}
+
+    const SuperCluster operator[](size_t) const;
+    iter begin() const { return iter(this, 0); }
+    iter end() const { return iter(this, size()); }
+};
+
+struct SuperCluster {
+    const SuperClusterCollection* collection;
+    const size_t idx;
+    SuperCluster(const SuperClusterCollection* collection, const size_t idx)
+      :collection(collection), idx(idx) { }
+
+    const float& e() const {return (*collection->val_e)().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& 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 float& hoe() const {return (*collection->val_hoe)().at(idx);}
+};
+
+const SuperCluster SuperClusterCollection::iter::operator*() const {
+    return {collection, idx};
+}
+const SuperCluster SuperClusterCollection::operator[](size_t idx) const {
+    return {this, idx};
+}

+ 22 - 0
looper/analysis/TrackingNtupleObjs.yaml

@@ -73,6 +73,8 @@ Seed:
         type: vector<float>
       - name: isECALDriven
         type: short
+      - name: sclIdx
+        type: int
 
 Track:
     treename_prefix: trk
@@ -259,3 +261,23 @@ SimVertex:
         type: vector<int>
       - name: daughterSimIdx
         type: vector<int>
+
+SuperCluster:
+    treename_prefix: scl
+    fields:
+      - name: e
+        type: float
+      - name: px
+        type: float
+      - name: py
+        type: float
+      - name: pz
+        type: float
+      - name: x
+        type: float
+      - name: y
+        type: float
+      - name: z
+        type: float
+      - name: hoe
+        type: float

+ 822 - 0
looper/analysis/TrackingNtupleWithSCL.h

@@ -0,0 +1,822 @@
+//////////////////////////////////////////////////////////
+// This class has been automatically generated on
+// Wed May  2 13:15:10 2018 by ROOT version 6.12/06
+// from TTree tree/tree
+// found on file: trackingNtuple_1.root
+//////////////////////////////////////////////////////////
+
+#ifndef TrackingNtuple_h
+#define TrackingNtuple_h
+
+#include <TROOT.h>
+#include <TChain.h>
+#include <TFile.h>
+
+// Header file for the classes stored in the TTree if any.
+#include <vector>
+
+using std::vector;
+
+class TrackingNtuple {
+public :
+   TTree          *fChain;   //!pointer to the analyzed TTree or TChain
+   Int_t           fCurrent; //!current Tree number in a TChain
+
+// Fixed size dimensions of array or collections stored in the TTree if any.
+
+   // Declaration of leaf types
+   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;
+   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<float>   *see_Et;
+   vector<float>   *see_hoe;
+   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<short>   *see_isECALDriven;
+   vector<int>     *see_sclIdx;
+   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;
+   vector<float>   *scl_e;
+   vector<float>   *scl_px;
+   vector<float>   *scl_py;
+   vector<float>   *scl_pz;
+   vector<float>   *scl_x;
+   vector<float>   *scl_y;
+   vector<float>   *scl_z;
+   vector<float>   *scl_hoe;
+
+   // List of branches
+   TBranch        *b_event;   //!
+   TBranch        *b_lumi;   //!
+   TBranch        *b_run;   //!
+   TBranch        *b_trk_px;   //!
+   TBranch        *b_trk_py;   //!
+   TBranch        *b_trk_pz;   //!
+   TBranch        *b_trk_pt;   //!
+   TBranch        *b_trk_inner_px;   //!
+   TBranch        *b_trk_inner_py;   //!
+   TBranch        *b_trk_inner_pz;   //!
+   TBranch        *b_trk_inner_pt;   //!
+   TBranch        *b_trk_outer_px;   //!
+   TBranch        *b_trk_outer_py;   //!
+   TBranch        *b_trk_outer_pz;   //!
+   TBranch        *b_trk_outer_pt;   //!
+   TBranch        *b_trk_eta;   //!
+   TBranch        *b_trk_lambda;   //!
+   TBranch        *b_trk_cotTheta;   //!
+   TBranch        *b_trk_phi;   //!
+   TBranch        *b_trk_dxy;   //!
+   TBranch        *b_trk_dz;   //!
+   TBranch        *b_trk_ptErr;   //!
+   TBranch        *b_trk_etaErr;   //!
+   TBranch        *b_trk_lambdaErr;   //!
+   TBranch        *b_trk_phiErr;   //!
+   TBranch        *b_trk_dxyErr;   //!
+   TBranch        *b_trk_dzErr;   //!
+   TBranch        *b_trk_refpoint_x;   //!
+   TBranch        *b_trk_refpoint_y;   //!
+   TBranch        *b_trk_refpoint_z;   //!
+   TBranch        *b_trk_nChi2;   //!
+   TBranch        *b_trk_q;   //!
+   TBranch        *b_trk_nValid;   //!
+   TBranch        *b_trk_nInvalid;   //!
+   TBranch        *b_trk_nPixel;   //!
+   TBranch        *b_trk_nStrip;   //!
+   TBranch        *b_trk_nPixelLay;   //!
+   TBranch        *b_trk_nStripLay;   //!
+   TBranch        *b_trk_n3DLay;   //!
+   TBranch        *b_trk_nOuterLost;   //!
+   TBranch        *b_trk_nInnerLost;   //!
+   TBranch        *b_trk_algo;   //!
+   TBranch        *b_trk_originalAlgo;   //!
+   TBranch        *b_trk_algoMask;   //!
+   TBranch        *b_trk_stopReason;   //!
+   TBranch        *b_trk_isHP;   //!
+   TBranch        *b_trk_seedIdx;   //!
+   TBranch        *b_trk_vtxx;   //!
+   TBranch        *b_trk_vtxy;   //!
+   TBranch        *b_trk_vtxz;   //!
+   TBranch        *b_trk_shareFrac;   //!
+   TBranch        *b_trk_simTrkIdx;   //!
+   TBranch        *b_trk_genIdx;   //!
+   TBranch        *b_trk_genDR;   //!
+   TBranch        *b_sim_event;   //!
+   TBranch        *b_sim_bunchCrossing;   //!
+   TBranch        *b_sim_pdgId;   //!
+   TBranch        *b_sim_genPdgIds;   //!
+   TBranch        *b_sim_isFromBHadron;   //!
+   TBranch        *b_sim_px;   //!
+   TBranch        *b_sim_py;   //!
+   TBranch        *b_sim_pz;   //!
+   TBranch        *b_sim_pt;   //!
+   TBranch        *b_sim_eta;   //!
+   TBranch        *b_sim_phi;   //!
+   TBranch        *b_sim_pca_pt;   //!
+   TBranch        *b_sim_pca_eta;   //!
+   TBranch        *b_sim_pca_lambda;   //!
+   TBranch        *b_sim_pca_cotTheta;   //!
+   TBranch        *b_sim_pca_phi;   //!
+   TBranch        *b_sim_pca_dxy;   //!
+   TBranch        *b_sim_pca_dz;   //!
+   TBranch        *b_sim_q;   //!
+   TBranch        *b_sim_nValid;   //!
+   TBranch        *b_sim_nPixel;   //!
+   TBranch        *b_sim_nStrip;   //!
+   TBranch        *b_sim_nLay;   //!
+   TBranch        *b_sim_nPixelLay;   //!
+   TBranch        *b_sim_n3DLay;   //!
+   TBranch        *b_sim_trkIdx;   //!
+   TBranch        *b_sim_shareFrac;   //!
+   TBranch        *b_sim_seedIdx;   //!
+   TBranch        *b_sim_parentVtxIdx;   //!
+   TBranch        *b_sim_decayVtxIdx;   //!
+   TBranch        *b_bsp_x;   //!
+   TBranch        *b_bsp_y;   //!
+   TBranch        *b_bsp_z;   //!
+   TBranch        *b_bsp_sigmax;   //!
+   TBranch        *b_bsp_sigmay;   //!
+   TBranch        *b_bsp_sigmaz;   //!
+   TBranch        *b_see_fitok;   //!
+   TBranch        *b_see_px;   //!
+   TBranch        *b_see_py;   //!
+   TBranch        *b_see_pz;   //!
+   TBranch        *b_see_pt;   //!
+   TBranch        *b_see_eta;   //!
+   TBranch        *b_see_phi;   //!
+   TBranch        *b_see_dxy;   //!
+   TBranch        *b_see_dz;   //!
+   TBranch        *b_see_ptErr;   //!
+   TBranch        *b_see_etaErr;   //!
+   TBranch        *b_see_phiErr;   //!
+   TBranch        *b_see_dxyErr;   //!
+   TBranch        *b_see_dzErr;   //!
+   TBranch        *b_see_chi2;   //!
+   TBranch        *b_see_statePt;   //!
+   TBranch        *b_see_stateTrajX;   //!
+   TBranch        *b_see_stateTrajY;   //!
+   TBranch        *b_see_stateTrajPx;   //!
+   TBranch        *b_see_stateTrajPy;   //!
+   TBranch        *b_see_stateTrajPz;   //!
+   TBranch        *b_see_q;   //!
+   TBranch        *b_see_nValid;   //!
+   TBranch        *b_see_nPixel;   //!
+   TBranch        *b_see_nGlued;   //!
+   TBranch        *b_see_nStrip;   //!
+   TBranch        *b_see_nPhase2OT;   //!
+   TBranch        *b_see_algo;   //!
+   TBranch        *b_see_stopReason;   //!
+   TBranch        *b_see_trkIdx;   //!
+   TBranch        *b_see_shareFrac;   //!
+   TBranch        *b_see_simTrkIdx;   //!
+   TBranch        *b_see_offset;   //!
+   TBranch        *b_see_Et;   //!
+   TBranch        *b_see_hoe;   //!
+   TBranch        *b_see_isBarrel;   //!
+   TBranch        *b_see_layerOrDiskNr;   //!
+   TBranch        *b_see_isValidPos;   //!
+   TBranch        *b_see_dRZPos;   //!
+   TBranch        *b_see_dPhiPos;   //!
+   TBranch        *b_see_isValidNeg;   //!
+   TBranch        *b_see_dRZNeg;   //!
+   TBranch        *b_see_dPhiNeg;   //!
+   TBranch        *b_see_isECALDriven;   //!
+   TBranch        *b_see_sclIdx;   //!
+   TBranch        *b_vtx_x;   //!
+   TBranch        *b_vtx_y;   //!
+   TBranch        *b_vtx_z;   //!
+   TBranch        *b_vtx_xErr;   //!
+   TBranch        *b_vtx_yErr;   //!
+   TBranch        *b_vtx_zErr;   //!
+   TBranch        *b_vtx_ndof;   //!
+   TBranch        *b_vtx_chi2;   //!
+   TBranch        *b_vtx_fake;   //!
+   TBranch        *b_vtx_valid;   //!
+   TBranch        *b_vtx_trkIdx;   //!
+   TBranch        *b_gen_px;   //!
+   TBranch        *b_gen_py;   //!
+   TBranch        *b_gen_pz;   //!
+   TBranch        *b_gen_charge;   //!
+   TBranch        *b_gen_pdgId;   //!
+   TBranch        *b_gen_vx;   //!
+   TBranch        *b_gen_vy;   //!
+   TBranch        *b_gen_vz;   //!
+   TBranch        *b_gen_status;   //!
+   TBranch        *b_gen_mother;   //!
+   TBranch        *b_gen_isTauDecayProduct;   //!
+   TBranch        *b_gen_isDirectHadronDecayProduct;   //!
+   TBranch        *b_gen_isPrompt;   //!
+   TBranch        *b_simvtx_event;   //!
+   TBranch        *b_simvtx_bunchCrossing;   //!
+   TBranch        *b_simvtx_processType;   //!
+   TBranch        *b_simvtx_x;   //!
+   TBranch        *b_simvtx_y;   //!
+   TBranch        *b_simvtx_z;   //!
+   TBranch        *b_simvtx_sourceSimIdx;   //!
+   TBranch        *b_simvtx_daughterSimIdx;   //!
+   TBranch        *b_simpv_idx;   //!
+   TBranch        *b_scl_e;   //!
+   TBranch        *b_scl_px;   //!
+   TBranch        *b_scl_py;   //!
+   TBranch        *b_scl_pz;   //!
+   TBranch        *b_scl_x;   //!
+   TBranch        *b_scl_y;   //!
+   TBranch        *b_scl_z;   //!
+   TBranch        *b_scl_hoe;   //!
+
+   TrackingNtuple(TTree *tree=0);
+   virtual ~TrackingNtuple();
+   virtual Int_t    Cut(Long64_t entry);
+   virtual Int_t    GetEntry(Long64_t entry);
+   virtual Long64_t LoadTree(Long64_t entry);
+   virtual void     Init(TTree *tree);
+   virtual Bool_t   Notify();
+   virtual void     Show(Long64_t entry = -1);
+};
+
+TrackingNtuple::TrackingNtuple(TTree *tree) : fChain(0)
+{
+// if parameter tree is not specified (or zero), connect the file
+// used to generate this class and read the Tree.
+   if (tree == 0) {
+      TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("trackingNtuple_1.root");
+      if (!f || !f->IsOpen()) {
+         f = new TFile("trackingNtuple_1.root");
+      }
+      TDirectory * dir = (TDirectory*)f->Get("trackingNtuple_1.root:/trackingNtuple");
+      dir->GetObject("tree",tree);
+
+   }
+   Init(tree);
+}
+
+TrackingNtuple::~TrackingNtuple()
+{
+   if (!fChain) return;
+   delete fChain->GetCurrentFile();
+}
+
+Int_t TrackingNtuple::GetEntry(Long64_t entry)
+{
+// Read contents of entry.
+   if (!fChain) return 0;
+   return fChain->GetEntry(entry);
+}
+Long64_t TrackingNtuple::LoadTree(Long64_t entry)
+{
+// Set the environment to read one entry
+   if (!fChain) return -5;
+   Long64_t centry = fChain->LoadTree(entry);
+   if (centry < 0) return centry;
+   if (fChain->GetTreeNumber() != fCurrent) {
+      fCurrent = fChain->GetTreeNumber();
+      Notify();
+   }
+   return centry;
+}
+
+void TrackingNtuple::Init(TTree *tree)
+{
+   // The Init() function is called when the selector needs to initialize
+   // a new tree or chain. Typically here the branch addresses and branch
+   // pointers of the tree will be set.
+   // It is normally not necessary to make changes to the generated
+   // code, but the routine can be extended by the user if needed.
+   // Init() will be called many times when running on PROOF
+   // (once per file to be processed).
+
+   // Set object pointer
+   trk_px = 0;
+   trk_py = 0;
+   trk_pz = 0;
+   trk_pt = 0;
+   trk_inner_px = 0;
+   trk_inner_py = 0;
+   trk_inner_pz = 0;
+   trk_inner_pt = 0;
+   trk_outer_px = 0;
+   trk_outer_py = 0;
+   trk_outer_pz = 0;
+   trk_outer_pt = 0;
+   trk_eta = 0;
+   trk_lambda = 0;
+   trk_cotTheta = 0;
+   trk_phi = 0;
+   trk_dxy = 0;
+   trk_dz = 0;
+   trk_ptErr = 0;
+   trk_etaErr = 0;
+   trk_lambdaErr = 0;
+   trk_phiErr = 0;
+   trk_dxyErr = 0;
+   trk_dzErr = 0;
+   trk_refpoint_x = 0;
+   trk_refpoint_y = 0;
+   trk_refpoint_z = 0;
+   trk_nChi2 = 0;
+   trk_q = 0;
+   trk_nValid = 0;
+   trk_nInvalid = 0;
+   trk_nPixel = 0;
+   trk_nStrip = 0;
+   trk_nPixelLay = 0;
+   trk_nStripLay = 0;
+   trk_n3DLay = 0;
+   trk_nOuterLost = 0;
+   trk_nInnerLost = 0;
+   trk_algo = 0;
+   trk_originalAlgo = 0;
+   trk_algoMask = 0;
+   trk_stopReason = 0;
+   trk_isHP = 0;
+   trk_seedIdx = 0;
+   trk_vtxx = 0;
+   trk_vtxy = 0;
+   trk_vtxz = 0;
+   trk_shareFrac = 0;
+   trk_simTrkIdx = 0;
+   trk_genIdx = 0;
+   trk_genDR = 0;
+   sim_event = 0;
+   sim_bunchCrossing = 0;
+   sim_pdgId = 0;
+   sim_genPdgIds = 0;
+   sim_isFromBHadron = 0;
+   sim_px = 0;
+   sim_py = 0;
+   sim_pz = 0;
+   sim_pt = 0;
+   sim_eta = 0;
+   sim_phi = 0;
+   sim_pca_pt = 0;
+   sim_pca_eta = 0;
+   sim_pca_lambda = 0;
+   sim_pca_cotTheta = 0;
+   sim_pca_phi = 0;
+   sim_pca_dxy = 0;
+   sim_pca_dz = 0;
+   sim_q = 0;
+   sim_nValid = 0;
+   sim_nPixel = 0;
+   sim_nStrip = 0;
+   sim_nLay = 0;
+   sim_nPixelLay = 0;
+   sim_n3DLay = 0;
+   sim_trkIdx = 0;
+   sim_shareFrac = 0;
+   sim_seedIdx = 0;
+   sim_parentVtxIdx = 0;
+   sim_decayVtxIdx = 0;
+   see_fitok = 0;
+   see_px = 0;
+   see_py = 0;
+   see_pz = 0;
+   see_pt = 0;
+   see_eta = 0;
+   see_phi = 0;
+   see_dxy = 0;
+   see_dz = 0;
+   see_ptErr = 0;
+   see_etaErr = 0;
+   see_phiErr = 0;
+   see_dxyErr = 0;
+   see_dzErr = 0;
+   see_chi2 = 0;
+   see_statePt = 0;
+   see_stateTrajX = 0;
+   see_stateTrajY = 0;
+   see_stateTrajPx = 0;
+   see_stateTrajPy = 0;
+   see_stateTrajPz = 0;
+   see_q = 0;
+   see_nValid = 0;
+   see_nPixel = 0;
+   see_nGlued = 0;
+   see_nStrip = 0;
+   see_nPhase2OT = 0;
+   see_algo = 0;
+   see_stopReason = 0;
+   see_trkIdx = 0;
+   see_shareFrac = 0;
+   see_simTrkIdx = 0;
+   see_offset = 0;
+   see_Et = 0;
+   see_hoe = 0;
+   see_isBarrel = 0;
+   see_layerOrDiskNr = 0;
+   see_isValidPos = 0;
+   see_dRZPos = 0;
+   see_dPhiPos = 0;
+   see_isValidNeg = 0;
+   see_dRZNeg = 0;
+   see_dPhiNeg = 0;
+   see_isECALDriven = 0;
+   see_sclIdx = 0;
+   vtx_x = 0;
+   vtx_y = 0;
+   vtx_z = 0;
+   vtx_xErr = 0;
+   vtx_yErr = 0;
+   vtx_zErr = 0;
+   vtx_ndof = 0;
+   vtx_chi2 = 0;
+   vtx_fake = 0;
+   vtx_valid = 0;
+   vtx_trkIdx = 0;
+   gen_px = 0;
+   gen_py = 0;
+   gen_pz = 0;
+   gen_charge = 0;
+   gen_pdgId = 0;
+   gen_vx = 0;
+   gen_vy = 0;
+   gen_vz = 0;
+   gen_status = 0;
+   gen_mother = 0;
+   gen_isTauDecayProduct = 0;
+   gen_isDirectHadronDecayProduct = 0;
+   gen_isPrompt = 0;
+   simvtx_event = 0;
+   simvtx_bunchCrossing = 0;
+   simvtx_processType = 0;
+   simvtx_x = 0;
+   simvtx_y = 0;
+   simvtx_z = 0;
+   simvtx_sourceSimIdx = 0;
+   simvtx_daughterSimIdx = 0;
+   simpv_idx = 0;
+   scl_e = 0;
+   scl_px = 0;
+   scl_py = 0;
+   scl_pz = 0;
+   scl_x = 0;
+   scl_y = 0;
+   scl_z = 0;
+   scl_hoe = 0;
+   // Set branch addresses and branch pointers
+   if (!tree) return;
+   fChain = tree;
+   fCurrent = -1;
+   fChain->SetMakeClass(1);
+
+   fChain->SetBranchAddress("event", &event, &b_event);
+   fChain->SetBranchAddress("lumi", &lumi, &b_lumi);
+   fChain->SetBranchAddress("run", &run, &b_run);
+   fChain->SetBranchAddress("trk_px", &trk_px, &b_trk_px);
+   fChain->SetBranchAddress("trk_py", &trk_py, &b_trk_py);
+   fChain->SetBranchAddress("trk_pz", &trk_pz, &b_trk_pz);
+   fChain->SetBranchAddress("trk_pt", &trk_pt, &b_trk_pt);
+   fChain->SetBranchAddress("trk_inner_px", &trk_inner_px, &b_trk_inner_px);
+   fChain->SetBranchAddress("trk_inner_py", &trk_inner_py, &b_trk_inner_py);
+   fChain->SetBranchAddress("trk_inner_pz", &trk_inner_pz, &b_trk_inner_pz);
+   fChain->SetBranchAddress("trk_inner_pt", &trk_inner_pt, &b_trk_inner_pt);
+   fChain->SetBranchAddress("trk_outer_px", &trk_outer_px, &b_trk_outer_px);
+   fChain->SetBranchAddress("trk_outer_py", &trk_outer_py, &b_trk_outer_py);
+   fChain->SetBranchAddress("trk_outer_pz", &trk_outer_pz, &b_trk_outer_pz);
+   fChain->SetBranchAddress("trk_outer_pt", &trk_outer_pt, &b_trk_outer_pt);
+   fChain->SetBranchAddress("trk_eta", &trk_eta, &b_trk_eta);
+   fChain->SetBranchAddress("trk_lambda", &trk_lambda, &b_trk_lambda);
+   fChain->SetBranchAddress("trk_cotTheta", &trk_cotTheta, &b_trk_cotTheta);
+   fChain->SetBranchAddress("trk_phi", &trk_phi, &b_trk_phi);
+   fChain->SetBranchAddress("trk_dxy", &trk_dxy, &b_trk_dxy);
+   fChain->SetBranchAddress("trk_dz", &trk_dz, &b_trk_dz);
+   fChain->SetBranchAddress("trk_ptErr", &trk_ptErr, &b_trk_ptErr);
+   fChain->SetBranchAddress("trk_etaErr", &trk_etaErr, &b_trk_etaErr);
+   fChain->SetBranchAddress("trk_lambdaErr", &trk_lambdaErr, &b_trk_lambdaErr);
+   fChain->SetBranchAddress("trk_phiErr", &trk_phiErr, &b_trk_phiErr);
+   fChain->SetBranchAddress("trk_dxyErr", &trk_dxyErr, &b_trk_dxyErr);
+   fChain->SetBranchAddress("trk_dzErr", &trk_dzErr, &b_trk_dzErr);
+   fChain->SetBranchAddress("trk_refpoint_x", &trk_refpoint_x, &b_trk_refpoint_x);
+   fChain->SetBranchAddress("trk_refpoint_y", &trk_refpoint_y, &b_trk_refpoint_y);
+   fChain->SetBranchAddress("trk_refpoint_z", &trk_refpoint_z, &b_trk_refpoint_z);
+   fChain->SetBranchAddress("trk_nChi2", &trk_nChi2, &b_trk_nChi2);
+   fChain->SetBranchAddress("trk_q", &trk_q, &b_trk_q);
+   fChain->SetBranchAddress("trk_nValid", &trk_nValid, &b_trk_nValid);
+   fChain->SetBranchAddress("trk_nInvalid", &trk_nInvalid, &b_trk_nInvalid);
+   fChain->SetBranchAddress("trk_nPixel", &trk_nPixel, &b_trk_nPixel);
+   fChain->SetBranchAddress("trk_nStrip", &trk_nStrip, &b_trk_nStrip);
+   fChain->SetBranchAddress("trk_nPixelLay", &trk_nPixelLay, &b_trk_nPixelLay);
+   fChain->SetBranchAddress("trk_nStripLay", &trk_nStripLay, &b_trk_nStripLay);
+   fChain->SetBranchAddress("trk_n3DLay", &trk_n3DLay, &b_trk_n3DLay);
+   fChain->SetBranchAddress("trk_nOuterLost", &trk_nOuterLost, &b_trk_nOuterLost);
+   fChain->SetBranchAddress("trk_nInnerLost", &trk_nInnerLost, &b_trk_nInnerLost);
+   fChain->SetBranchAddress("trk_algo", &trk_algo, &b_trk_algo);
+   fChain->SetBranchAddress("trk_originalAlgo", &trk_originalAlgo, &b_trk_originalAlgo);
+   fChain->SetBranchAddress("trk_algoMask", &trk_algoMask, &b_trk_algoMask);
+   fChain->SetBranchAddress("trk_stopReason", &trk_stopReason, &b_trk_stopReason);
+   fChain->SetBranchAddress("trk_isHP", &trk_isHP, &b_trk_isHP);
+   fChain->SetBranchAddress("trk_seedIdx", &trk_seedIdx, &b_trk_seedIdx);
+   fChain->SetBranchAddress("trk_vtxx", &trk_vtxx, &b_trk_vtxx);
+   fChain->SetBranchAddress("trk_vtxy", &trk_vtxy, &b_trk_vtxy);
+   fChain->SetBranchAddress("trk_vtxz", &trk_vtxz, &b_trk_vtxz);
+   fChain->SetBranchAddress("trk_shareFrac", &trk_shareFrac, &b_trk_shareFrac);
+   fChain->SetBranchAddress("trk_simTrkIdx", &trk_simTrkIdx, &b_trk_simTrkIdx);
+   fChain->SetBranchAddress("trk_genIdx", &trk_genIdx, &b_trk_genIdx);
+   fChain->SetBranchAddress("trk_genDR", &trk_genDR, &b_trk_genDR);
+   fChain->SetBranchAddress("sim_event", &sim_event, &b_sim_event);
+   fChain->SetBranchAddress("sim_bunchCrossing", &sim_bunchCrossing, &b_sim_bunchCrossing);
+   fChain->SetBranchAddress("sim_pdgId", &sim_pdgId, &b_sim_pdgId);
+   fChain->SetBranchAddress("sim_genPdgIds", &sim_genPdgIds, &b_sim_genPdgIds);
+   fChain->SetBranchAddress("sim_isFromBHadron", &sim_isFromBHadron, &b_sim_isFromBHadron);
+   fChain->SetBranchAddress("sim_px", &sim_px, &b_sim_px);
+   fChain->SetBranchAddress("sim_py", &sim_py, &b_sim_py);
+   fChain->SetBranchAddress("sim_pz", &sim_pz, &b_sim_pz);
+   fChain->SetBranchAddress("sim_pt", &sim_pt, &b_sim_pt);
+   fChain->SetBranchAddress("sim_eta", &sim_eta, &b_sim_eta);
+   fChain->SetBranchAddress("sim_phi", &sim_phi, &b_sim_phi);
+   fChain->SetBranchAddress("sim_pca_pt", &sim_pca_pt, &b_sim_pca_pt);
+   fChain->SetBranchAddress("sim_pca_eta", &sim_pca_eta, &b_sim_pca_eta);
+   fChain->SetBranchAddress("sim_pca_lambda", &sim_pca_lambda, &b_sim_pca_lambda);
+   fChain->SetBranchAddress("sim_pca_cotTheta", &sim_pca_cotTheta, &b_sim_pca_cotTheta);
+   fChain->SetBranchAddress("sim_pca_phi", &sim_pca_phi, &b_sim_pca_phi);
+   fChain->SetBranchAddress("sim_pca_dxy", &sim_pca_dxy, &b_sim_pca_dxy);
+   fChain->SetBranchAddress("sim_pca_dz", &sim_pca_dz, &b_sim_pca_dz);
+   fChain->SetBranchAddress("sim_q", &sim_q, &b_sim_q);
+   fChain->SetBranchAddress("sim_nValid", &sim_nValid, &b_sim_nValid);
+   fChain->SetBranchAddress("sim_nPixel", &sim_nPixel, &b_sim_nPixel);
+   fChain->SetBranchAddress("sim_nStrip", &sim_nStrip, &b_sim_nStrip);
+   fChain->SetBranchAddress("sim_nLay", &sim_nLay, &b_sim_nLay);
+   fChain->SetBranchAddress("sim_nPixelLay", &sim_nPixelLay, &b_sim_nPixelLay);
+   fChain->SetBranchAddress("sim_n3DLay", &sim_n3DLay, &b_sim_n3DLay);
+   fChain->SetBranchAddress("sim_trkIdx", &sim_trkIdx, &b_sim_trkIdx);
+   fChain->SetBranchAddress("sim_shareFrac", &sim_shareFrac, &b_sim_shareFrac);
+   fChain->SetBranchAddress("sim_seedIdx", &sim_seedIdx, &b_sim_seedIdx);
+   fChain->SetBranchAddress("sim_parentVtxIdx", &sim_parentVtxIdx, &b_sim_parentVtxIdx);
+   fChain->SetBranchAddress("sim_decayVtxIdx", &sim_decayVtxIdx, &b_sim_decayVtxIdx);
+   fChain->SetBranchAddress("bsp_x", &bsp_x, &b_bsp_x);
+   fChain->SetBranchAddress("bsp_y", &bsp_y, &b_bsp_y);
+   fChain->SetBranchAddress("bsp_z", &bsp_z, &b_bsp_z);
+   fChain->SetBranchAddress("bsp_sigmax", &bsp_sigmax, &b_bsp_sigmax);
+   fChain->SetBranchAddress("bsp_sigmay", &bsp_sigmay, &b_bsp_sigmay);
+   fChain->SetBranchAddress("bsp_sigmaz", &bsp_sigmaz, &b_bsp_sigmaz);
+   fChain->SetBranchAddress("see_fitok", &see_fitok, &b_see_fitok);
+   fChain->SetBranchAddress("see_px", &see_px, &b_see_px);
+   fChain->SetBranchAddress("see_py", &see_py, &b_see_py);
+   fChain->SetBranchAddress("see_pz", &see_pz, &b_see_pz);
+   fChain->SetBranchAddress("see_pt", &see_pt, &b_see_pt);
+   fChain->SetBranchAddress("see_eta", &see_eta, &b_see_eta);
+   fChain->SetBranchAddress("see_phi", &see_phi, &b_see_phi);
+   fChain->SetBranchAddress("see_dxy", &see_dxy, &b_see_dxy);
+   fChain->SetBranchAddress("see_dz", &see_dz, &b_see_dz);
+   fChain->SetBranchAddress("see_ptErr", &see_ptErr, &b_see_ptErr);
+   fChain->SetBranchAddress("see_etaErr", &see_etaErr, &b_see_etaErr);
+   fChain->SetBranchAddress("see_phiErr", &see_phiErr, &b_see_phiErr);
+   fChain->SetBranchAddress("see_dxyErr", &see_dxyErr, &b_see_dxyErr);
+   fChain->SetBranchAddress("see_dzErr", &see_dzErr, &b_see_dzErr);
+   fChain->SetBranchAddress("see_chi2", &see_chi2, &b_see_chi2);
+   fChain->SetBranchAddress("see_statePt", &see_statePt, &b_see_statePt);
+   fChain->SetBranchAddress("see_stateTrajX", &see_stateTrajX, &b_see_stateTrajX);
+   fChain->SetBranchAddress("see_stateTrajY", &see_stateTrajY, &b_see_stateTrajY);
+   fChain->SetBranchAddress("see_stateTrajPx", &see_stateTrajPx, &b_see_stateTrajPx);
+   fChain->SetBranchAddress("see_stateTrajPy", &see_stateTrajPy, &b_see_stateTrajPy);
+   fChain->SetBranchAddress("see_stateTrajPz", &see_stateTrajPz, &b_see_stateTrajPz);
+   fChain->SetBranchAddress("see_q", &see_q, &b_see_q);
+   fChain->SetBranchAddress("see_nValid", &see_nValid, &b_see_nValid);
+   fChain->SetBranchAddress("see_nPixel", &see_nPixel, &b_see_nPixel);
+   fChain->SetBranchAddress("see_nGlued", &see_nGlued, &b_see_nGlued);
+   fChain->SetBranchAddress("see_nStrip", &see_nStrip, &b_see_nStrip);
+   fChain->SetBranchAddress("see_nPhase2OT", &see_nPhase2OT, &b_see_nPhase2OT);
+   fChain->SetBranchAddress("see_algo", &see_algo, &b_see_algo);
+   fChain->SetBranchAddress("see_stopReason", &see_stopReason, &b_see_stopReason);
+   fChain->SetBranchAddress("see_trkIdx", &see_trkIdx, &b_see_trkIdx);
+   fChain->SetBranchAddress("see_shareFrac", &see_shareFrac, &b_see_shareFrac);
+   fChain->SetBranchAddress("see_simTrkIdx", &see_simTrkIdx, &b_see_simTrkIdx);
+   fChain->SetBranchAddress("see_offset", &see_offset, &b_see_offset);
+   fChain->SetBranchAddress("see_Et", &see_Et, &b_see_Et);
+   fChain->SetBranchAddress("see_hoe", &see_hoe, &b_see_hoe);
+   fChain->SetBranchAddress("see_isBarrel", &see_isBarrel, &b_see_isBarrel);
+   fChain->SetBranchAddress("see_layerOrDiskNr", &see_layerOrDiskNr, &b_see_layerOrDiskNr);
+   fChain->SetBranchAddress("see_isValidPos", &see_isValidPos, &b_see_isValidPos);
+   fChain->SetBranchAddress("see_dRZPos", &see_dRZPos, &b_see_dRZPos);
+   fChain->SetBranchAddress("see_dPhiPos", &see_dPhiPos, &b_see_dPhiPos);
+   fChain->SetBranchAddress("see_isValidNeg", &see_isValidNeg, &b_see_isValidNeg);
+   fChain->SetBranchAddress("see_dRZNeg", &see_dRZNeg, &b_see_dRZNeg);
+   fChain->SetBranchAddress("see_dPhiNeg", &see_dPhiNeg, &b_see_dPhiNeg);
+   fChain->SetBranchAddress("see_isECALDriven", &see_isECALDriven, &b_see_isECALDriven);
+   fChain->SetBranchAddress("see_sclIdx", &see_sclIdx, &b_see_sclIdx);
+   fChain->SetBranchAddress("vtx_x", &vtx_x, &b_vtx_x);
+   fChain->SetBranchAddress("vtx_y", &vtx_y, &b_vtx_y);
+   fChain->SetBranchAddress("vtx_z", &vtx_z, &b_vtx_z);
+   fChain->SetBranchAddress("vtx_xErr", &vtx_xErr, &b_vtx_xErr);
+   fChain->SetBranchAddress("vtx_yErr", &vtx_yErr, &b_vtx_yErr);
+   fChain->SetBranchAddress("vtx_zErr", &vtx_zErr, &b_vtx_zErr);
+   fChain->SetBranchAddress("vtx_ndof", &vtx_ndof, &b_vtx_ndof);
+   fChain->SetBranchAddress("vtx_chi2", &vtx_chi2, &b_vtx_chi2);
+   fChain->SetBranchAddress("vtx_fake", &vtx_fake, &b_vtx_fake);
+   fChain->SetBranchAddress("vtx_valid", &vtx_valid, &b_vtx_valid);
+   fChain->SetBranchAddress("vtx_trkIdx", &vtx_trkIdx, &b_vtx_trkIdx);
+   fChain->SetBranchAddress("gen_px", &gen_px, &b_gen_px);
+   fChain->SetBranchAddress("gen_py", &gen_py, &b_gen_py);
+   fChain->SetBranchAddress("gen_pz", &gen_pz, &b_gen_pz);
+   fChain->SetBranchAddress("gen_charge", &gen_charge, &b_gen_charge);
+   fChain->SetBranchAddress("gen_pdgId", &gen_pdgId, &b_gen_pdgId);
+   fChain->SetBranchAddress("gen_vx", &gen_vx, &b_gen_vx);
+   fChain->SetBranchAddress("gen_vy", &gen_vy, &b_gen_vy);
+   fChain->SetBranchAddress("gen_vz", &gen_vz, &b_gen_vz);
+   fChain->SetBranchAddress("gen_status", &gen_status, &b_gen_status);
+   fChain->SetBranchAddress("gen_mother", &gen_mother, &b_gen_mother);
+   fChain->SetBranchAddress("gen_isTauDecayProduct", &gen_isTauDecayProduct, &b_gen_isTauDecayProduct);
+   fChain->SetBranchAddress("gen_isDirectHadronDecayProduct", &gen_isDirectHadronDecayProduct, &b_gen_isDirectHadronDecayProduct);
+   fChain->SetBranchAddress("gen_isPrompt", &gen_isPrompt, &b_gen_isPrompt);
+   fChain->SetBranchAddress("simvtx_event", &simvtx_event, &b_simvtx_event);
+   fChain->SetBranchAddress("simvtx_bunchCrossing", &simvtx_bunchCrossing, &b_simvtx_bunchCrossing);
+   fChain->SetBranchAddress("simvtx_processType", &simvtx_processType, &b_simvtx_processType);
+   fChain->SetBranchAddress("simvtx_x", &simvtx_x, &b_simvtx_x);
+   fChain->SetBranchAddress("simvtx_y", &simvtx_y, &b_simvtx_y);
+   fChain->SetBranchAddress("simvtx_z", &simvtx_z, &b_simvtx_z);
+   fChain->SetBranchAddress("simvtx_sourceSimIdx", &simvtx_sourceSimIdx, &b_simvtx_sourceSimIdx);
+   fChain->SetBranchAddress("simvtx_daughterSimIdx", &simvtx_daughterSimIdx, &b_simvtx_daughterSimIdx);
+   fChain->SetBranchAddress("simpv_idx", &simpv_idx, &b_simpv_idx);
+   fChain->SetBranchAddress("scl_e", &scl_e, &b_scl_e);
+   fChain->SetBranchAddress("scl_px", &scl_px, &b_scl_px);
+   fChain->SetBranchAddress("scl_py", &scl_py, &b_scl_py);
+   fChain->SetBranchAddress("scl_pz", &scl_pz, &b_scl_pz);
+   fChain->SetBranchAddress("scl_x", &scl_x, &b_scl_x);
+   fChain->SetBranchAddress("scl_y", &scl_y, &b_scl_y);
+   fChain->SetBranchAddress("scl_z", &scl_z, &b_scl_z);
+   fChain->SetBranchAddress("scl_hoe", &scl_hoe, &b_scl_hoe);
+   Notify();
+}
+
+Bool_t TrackingNtuple::Notify()
+{
+   // The Notify() function is called when a new file is opened. This
+   // can be either for a new TTree in a TChain or when when a new TTree
+   // is started when using PROOF. It is normally not necessary to make changes
+   // to the generated code, but the routine can be extended by the
+   // user if needed. The return value is currently not used.
+
+   return kTRUE;
+}
+
+void TrackingNtuple::Show(Long64_t entry)
+{
+// Print contents of entry.
+// If entry is not specified, print current entry
+   if (!fChain) return;
+   fChain->Show(entry);
+}
+Int_t TrackingNtuple::Cut(Long64_t entry)
+{
+// This function may be called from Loop.
+// returns  1 if entry is accepted.
+// returns -1 otherwise.
+   return 1;
+}
+#endif // #ifdef tree_cxx

+ 20 - 10
looper/analysis/config.yaml

@@ -2,10 +2,13 @@
 debug: false
 
 #output-file: ../hists/ttbar-old-seeding.root
-source-file-key: wide-window
+source-file-key: test_file
 
 hoe_cut: 0.15
 
+test_file:
+    files: /home/caleb/trackingNtuple_1.root
+
 extra-narrow-window:
     files: ../data/EGamma_18-03-07_trackingNtuple_extra-narrow/180307_215057/0000/trackingNtuple_*.root
 
@@ -148,15 +151,6 @@ hist-params:
         nbins_x: 30
         low_x: -3.2
         high_x: 3.2
-    eff_v_eta_pt:
-        label_x: "eta"
-        nbins_x: 30
-        low_x: -3.0
-        high_x: 3.0
-        label_y: "pt"
-        nbins_y: 30
-        low_y: 0
-        high_y: 300
 
     pur_v_pt:
         label_x: "pur_v_pt"
@@ -174,6 +168,22 @@ hist-params:
         low_x: -3.2
         high_x: 3.2
 
+    fake_rate_v_pt:
+        label_x: "fake_rate_v_pt"
+        nbins_x: 30
+        low_x: 0
+        high_x: 300
+    fake_rate_v_eta:
+        label_x: "fake_rate_v_eta"
+        nbins_x: 30
+        low_x: -3.0
+        high_x: 3.0
+    fake_rate_v_phi:
+        label_x: "fake_rate_v_phi"
+        nbins_x: 30
+        low_x: -3.2
+        high_x: 3.2
+
     gsf_tracks_nmatch_sim_tracks:
         label_x: "nMatchedSimTracks"
         nbins_x: 5

+ 29 - 4
looper/analysis/tracking_eff.cpp

@@ -5,6 +5,7 @@
 
 #include "filval.hpp"
 #include "root_filval.hpp"
+#include "common.hpp"
 
 #include "analysis/TrackingNtupleObjs.hpp"
 
@@ -12,12 +13,14 @@ SeedCollection seeds;
 SimTrackCollection sim_tracks;
 SimVertexCollection sim_vertices;
 TrackCollection gsf_tracks;
+SuperClusterCollection scls;
 
 void register_objects(TrackingDataSet& tds){
     seeds.init(tds);
     sim_tracks.init(tds);
     sim_vertices.init(tds);
     gsf_tracks.init(tds);
+    scls.init(tds);
 }
 
 struct {
@@ -54,10 +57,10 @@ bool is_good_sim(const SimTrack& sim_track) {
     return abs(sim_track.pdgId()) == 11 and in_lum_region(vertex);
 };
 
-bool is_good_fake(const SimTrack& sim_track) {
-    const auto& vertex = sim_vertices[sim_track.parentVtxIdx()];
-    return abs(sim_track.pdgId()) != 11 and sim_track.q() != 0 and in_lum_region(vertex);
-};
+//bool is_good_fake(const SimTrack& sim_track) {
+//    const auto& vertex = sim_vertices[sim_track.parentVtxIdx()];
+//    return abs(sim_track.pdgId()) != 11 and sim_track.q() != 0 and in_lum_region(vertex);
+//};
 
 bool is_good_seed(const Seed& seed, float hoe_cut) {
     return seed.isECALDriven() and seed.hoe() < hoe_cut;
@@ -238,6 +241,10 @@ void run(){
             tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_eta_dR", THParams::lookup("pur_v_eta")),
             tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_phi_dR", THParams::lookup("pur_v_phi"))};
 
+    KinColl<EfficiencyContainer<float>> fake_rate = {
+            tds.register_container<EfficiencyContainer<float>>("fake_rate_v_pt",  THParams::lookup("eff_v_pt")),
+            tds.register_container<EfficiencyContainer<float>>("fake_rate_v_eta", THParams::lookup("eff_v_eta")),
+            tds.register_container<EfficiencyContainer<float>>("fake_rate_v_phi", THParams::lookup("pur_v_phi"))};
 
     auto& hit_vs_layer_barrel = *tds.register_container<ContainerTH2<int>>("hit_vs_layer_barrel", THParams::lookup("hit_vs_layer"));
     auto& hit_vs_layer_forward = *tds.register_container<ContainerTH2<int>>("hit_vs_layer_forward", THParams::lookup("hit_vs_layer"));
@@ -374,6 +381,24 @@ void run(){
                 tracking_pur_dR.phi->fill(gsf_track.phi(), matched);
         }
 
+        // Fake Rate (#SC w/ 1 or more gsf-tracks / #SC) all w/ SC HOE>0.15
+        std::map<size_t, size_t> scl2track;
+        for (const auto &trk : gsf_tracks) {
+            int seed_idx = trk.seedIdx();
+            scl2track[seeds[seed_idx].sclIdx()] = trk.idx;
+        }
+        for (const auto &scl : scls) {
+            if (scl.hoe() > hoe_cut) continue;
+            float scl_pt = hypot(scl.px(), scl.py());
+            float scl_eta = pseudorapidity(scl.x(), scl.y(), scl.z());
+            float scl_phi = atan2(scl.py(), scl.px());
+
+            bool has_track = scl2track.count(scl.idx) == 1;
+            fake_rate.pt->fill(scl_pt, has_track);
+            fake_rate.eta->fill(scl_eta, has_track);
+            fake_rate.phi->fill(scl_phi, has_track);
+        }
+
         // Hit Residuals
         for (const auto& seed : seeds) {
             if (seed.trkIdx() < 0) continue;  // require that seed produced gsf-track

+ 1 - 1
looper/filval

@@ -1 +1 @@
-Subproject commit e91fbb1a90a77223dc0ef41b94daedce269673f9
+Subproject commit a227be04fcce25f0beb72116839bbf59af36a85e