Skip to content

Commit

Permalink
Merge pull request #187 from JeffersonLab/feeSmearing
Browse files Browse the repository at this point in the history
Fee smearing
  • Loading branch information
pbutti authored Apr 22, 2024
2 parents 0ba156a + f428382 commit 3b03733
Show file tree
Hide file tree
Showing 19 changed files with 786 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ include(MacroModule)
# import macro for declaring external dependencies
include(MacroExtDeps)

set(MODULES event analysis processing processors)
set(MODULES event utils analysis processing processors)

# build each module in the list
foreach(module ${MODULES})
Expand Down
262 changes: 262 additions & 0 deletions analysis/plotconfigs/fee_smearing/feeSmearing.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
{
"n_tracks_h" : {
"bins" : 10,
"minX" : 0,
"maxX" : 10,
"xtitle" : "N_{tracks}",
"ytitle" : "Events"
},
"nHits_2d_h" : {
"bins" : 15,
"minX" : 0,
"maxX" : 15,
"xtitle" : "N_{2Dhits}",
"ytitle" : "Tracks"
},
"nShared_h" : {
"bins" : 8,
"minX" : -0.5,
"maxX" : 7.5,
"xtitle" : "N_{shared}^{hits}",
"ytitle" : "Tracks"
},
"d0_h" : {
"bins" : 200,
"minX" : -10,
"maxX" : 10,
"xtitle" : "d_{0} [mm]",
"ytitle" : "Tracks"
},
"Phi_h" : {
"bins" : 100,
"minX" : -0.5,
"maxX" : 0.5,
"xtitle" : "phi_{0}",
"ytitle" : "Tracks"
},
"Omega_h" : {
"bins" : 100,
"minX" : -0.002,
"maxX" : 0.002,
"xtitle" : "#omega",
"ytitle" : "Tracks"
},
"TanLambda_h" : {
"bins" : 200,
"minX" : -0.3,
"maxX" : 0.3,
"xtitle" : "tan(#lambda)",
"ytitle" : "Tracks"
},
"Z0_h" : {
"bins" : 200,
"minX" : -5,
"maxX" : 5,
"xtitle" : "z_0 [mm]",
"ytitle" : "Tracks"
},
"time_h" : {
"bins" : 200,
"minX" : -40,
"maxX" : 40,
"xtitle" : "track time [ns]",
"ytitle" : "Tracks"
},
"chi2_h" : {
"bins" : 200,
"minX" : 0,
"maxX" : 100,
"xtitle" : "track #chi^{2}",
"ytitle" : "Tracks"
},
"p_h" : {
"bins" : 200,
"minX" : 0,
"maxX" : 4,
"xtitle" : "p_{e^{-}} [GeV]",
"ytitle" : "Tracks"
},
"p_vs_nHits_hh" : {
"binsX" : 5,
"minX" : 8,
"maxX" : 13,
"binsY" : 200,
"minY" : 0,
"maxY" : 4,
"xtitle" : "Nhits",
"ytitle" : "p_{e^{-}} [GeV]"
},
"p_vs_nHits_top_hh" : {
"binsX" : 5,
"minX" : 8,
"maxX" : 13,
"binsY" : 200,
"minY" : 0,
"maxY" : 4,
"xtitle" : "Nhits",
"ytitle" : "top p_{e^{-}} [GeV]"
},
"p_vs_nHits_bot_hh" : {
"binsX" : 5,
"minX" : 8,
"maxX" : 13,
"binsY" : 200,
"minY" : 0,
"maxY" : 4,
"xtitle" : "Nhits",
"ytitle" : "bot p_{e^{-}} [GeV]"
},
"p_vs_TanLambda_hh" : {
"binsX" : 100,
"minX" : -0.1,
"maxX" : 0.1,
"binsY" : 200,
"minY" : 0,
"maxY" : 4,
"xtitle" : "tan(#lambda)",
"ytitle" : "p_{e^{-}} [GeV]"
},
"p_vs_Phi_hh" : {
"binsX" : 100,
"minX" : -0.2,
"maxX" : 0.2,
"binsY" : 200,
"minY" : 0,
"maxY" : 4,
"xtitle" : "#phi_{0}",
"ytitle" : "p_{e^{-}} [GeV]"
},
"p_vs_TanLambda_Phi_hhh" : {
"binsX" : 100,
"minX" : -0.2,
"maxX" : 0.2,
"binsY" : 100,
"minY" : -0.1,
"maxY" : 0.1,
"binsZ" : 200,
"minZ" : 0,
"maxZ" : 4,
"xtitle" : "#phi_{0}",
"ytitle" : "tan(#lambda)",
"ztitle" : "p_{e^{-}} [GeV]"
},
"p_vs_TanLambda_nHits_hhh" : {
"binsX" : 100,
"minX" : -0.2,
"maxX" : 0.2,
"binsY" : 5,
"minY" : 8,
"maxY" : 13,
"binsZ" : 200,
"minZ" : 0,
"maxZ" : 4,
"xtitle" : "#phi_{0}",
"ytitle" : "tan(#lambda)",
"ztitle" : "p_{e^{-}} [GeV]"
},
"chi2ndf_h" : {
"bins" : 200,
"minX" : 0,
"maxX" : 30,
"xtitle" : "track #chi^{2} / ndf",
"ytitle" : "Tracks"
},
"d0_vs_p_hh" : {
"binsX" : 100,
"minX" : 0,
"maxX" : 4,
"binsY" : 200,
"minY" : -10,
"maxY" : 10,
"xtitle" : "trk p [GeV]",
"ytitle" : "trk d0 [mm]"
},
"d0_vs_phi0_hh" : {
"binsX" : 100,
"minX" : -0.4,
"maxX" : 0.4,
"binsY" : 200,
"minY" : -10,
"maxY" : 10,
"xtitle" : "trk #phi_{0}",
"ytitle" : "trk d0 [mm]"
},

"d0_vs_tanlambda_hh" : {
"binsX" : 200,
"minX" : -0.1,
"maxX" : 0.1,
"binsY" : 200,
"minY" : -10,
"maxY" : 10,
"xtitle" : "trk(#lamdba)",
"ytitle" : "trk d0 [mm]"
},

"z0_vs_p_hh" : {
"binsX" : 100,
"minX" : 0,
"maxX" : 4,
"binsY" : 200,
"minY" : -5,
"maxY" : 5,
"xtitle" : "trk p [GeV]",
"ytitle" : "trk z0 [mm]"
},

"z0_vs_phi0_hh" : {
"binsX" : 100,
"minX" : -0.4,
"maxX" : 0.4,
"binsY" : 200,
"minY" : -5,
"maxY" : 5,
"xtitle" : "trk #phi_{0}",
"ytitle" : "trk z0 [mm]"
},

"z0_vs_tanlambda_hh" : {
"binsX" : 200,
"minX" : -0.1,
"maxX" : 0.1,
"binsY" : 200,
"minY" : -5,
"maxY" : 5,
"xtitle" : "trk(#lamdba)",
"ytitle" : "trk z0 [mm]"
},
"tanlambda_vs_phi0_hh" : {
"binsX" : 100,
"minX" : -0.4,
"maxX" : 0.4,
"binsY" : 100,
"minY" : -0.2,
"maxY" : 0.2,
"xtitle" : "trk #phi_{0}",
"ytitle" : "trk tan(#lambda)"
},
"xpos_at_ecal_h" : {
"bins" : 400,
"minX" : -100,
"maxX" : 100,
"xtitle" : "track x pos [mm]",
"ytitle" : "Tracks"
},
"ypos_at_ecal_h" : {
"bins" : 400,
"minX" : -100,
"maxX" : 100,
"xtitle" : "track y pos [mm]",
"ytitle" : "Tracks"
},
"xypos_at_ecal_hh" : {
"binsX" : 100,
"minX" : -200,
"maxX" : 200,
"binsY" : 100,
"minY" : -200,
"maxY" : 200,
"xtitle" : "trk ecal x [mm]",
"ytitle" : "trk ecal y [mm]"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,13 @@
"xtitle" : "vtx E_{sum} [GeV]",
"ytitle" : "Vertices"
},
"vtx_smear_InvM_h" : {
"bins" : 200,
"minX" : 0.0,
"maxX" : 0.2,
"xtitle" : "M_{vtx} [GeV]",
"ytitle" : "Vertices"
},
"vtx_InvM_vtx_z_hh" : {
"binsX" : 200,
"minX" : 0.0,
Expand Down
4 changes: 2 additions & 2 deletions event/include/Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ class Track : public TObject {
* @return momentum magnitude
*/

double getP(){return sqrt(px_*px_ + py_*py_ + pz_*pz_);};
double getP() const {return sqrt(px_*px_ + py_*py_ + pz_*pz_);};

double getPt() {return sqrt(px_*px_ + pz_*pz_);}
double getPt() const {return sqrt(px_*px_ + py_*py_);}

/**
* Set the lambda kink of the given layer.
Expand Down
2 changes: 1 addition & 1 deletion processors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# Declare processors module
module(
NAME processors
DEPENDENCIES event processing analysis
DEPENDENCIES event processing analysis utils
EXTERNAL_DEPENDENCIES ROOT LCIO
)
47 changes: 47 additions & 0 deletions processors/config/anaFeeSmearing_cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import HpstrConf
import os
import sys
import baseConfig as base

options = base.parser.parse_args()

# Use the input file to set the output file name
inFilename = options.inFilename
outFilename = options.outFilename

# The seed is the file number.
smearingSeed = options.seed

print('Input file: %s' % inFilename)
print('Output file: %s' % outFilename)

p = HpstrConf.Process()

p.run_mode = 1
p.skip_events = options.skip_events
p.max_events = options.nevents


p.add_library("libprocessors")

#anaTrks = HpstrConf.Processor('anaTrks', 'TrackHitAnaProcessor')
anaTrks = HpstrConf.Processor('anaTrks', 'TrackingAnaProcessor')
anaTrks.parameters["debug"] = 0
anaTrks.parameters["seed"] = smearingSeed
anaTrks.parameters["trkCollName"] = 'KalmanFullTracks'
anaTrks.parameters["histCfg"] = os.environ['HPSTR_BASE']+'/analysis/plotconfigs/fee_smearing/feeSmearing.json'
anaTrks.parameters["selectionjson"] = os.environ['HPSTR_BASE']+'/analysis/selections/trackHit/trackHitAna.json'
anaTrks.parameters["isData"] = options.isData

#SmearingClosureTest
anaTrks.parameters["pSmearingFile"] = os.environ['HPSTR_BASE']+"/utils/data/smearingFile_2016_all_12112023.root"

RegionPath = os.environ['HPSTR_BASE']+"/analysis/selections/feeSmearing/"
anaTrks.parameters["regionDefinitions"] = []

p.sequence = [anaTrks]

p.input_files = inFilename
p.output_files = [outFilename]

p.printProcess()
1 change: 1 addition & 0 deletions processors/config/anaSimps_2016_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
vtxana.parameters["isRadPDG"] = options.isRadPDG
vtxana.parameters["makeFlatTuple"] = options.makeFlatTuple
vtxana.parameters["beamPosCfg"] = ""
vtxana.parameters["pSmearingFile"] = os.environ['HPSTR_BASE']+"/utils/data/smearingFile_2016_all_12112023.root"
if options.isData:
vtxana.parameters["v0ProjectionFitsCfg"] = os.environ['HPSTR_BASE']+'/analysis/data/v0_projection_2016_config.json'
else:
Expand Down
1 change: 1 addition & 0 deletions processors/config/baseConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
help="Which analysis is being run ", metavar="analysis", default="vertex")
parser.add_argument('--infile', '-i', type=str, dest="inFilename", metavar='infiles', nargs="+",
help="Input files, specify on or more.")
parser.add_argument('--seed', '-s', type=int, dest='seed',metavar='seed',default=42)


#options = parser.parse_args()
Expand Down
4 changes: 4 additions & 0 deletions processors/include/NewVertexAnaProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "MCAnaHistos.h"
#include "utilities.h"

#include "TrackSmearingTool.h"
#include "FlatTupleMaker.h"
#include "AnaHelpers.h"

Expand Down Expand Up @@ -114,6 +115,9 @@ class NewVertexAnaProcessor : public Processor {
int makeFlatTuple_{0}; //!< make true in config to save flat tuple
TTree* tree_{nullptr}; //!< description

std::string pSmearingFile_{""};
std::shared_ptr<TrackSmearingTool> smearingTool_;

std::shared_ptr<TrackHistos> _vtx_histos; //!< description
std::shared_ptr<MCAnaHistos> _mc_vtx_histos; //!< description

Expand Down
Loading

0 comments on commit 3b03733

Please sign in to comment.