Skip to content

Commit

Permalink
feat!: generalize Q2 weighting and improve the config file (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks authored Oct 8, 2022
1 parent 6e2706b commit ea8e661
Show file tree
Hide file tree
Showing 45 changed files with 806 additions and 644 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ defaults:
env:
ebeam_en: 10
pbeam_en: 100
cross_ang: -25
root: root -b -q
root_no_delphes: root -b -q macro/ci/define_exclude_delphes.C

Expand Down Expand Up @@ -119,7 +118,7 @@ jobs:
echo "====="
ls -lh datarec
echo "[CI] make config file"
s3tools/make-fastsim-local-config.sh ${{env.ebeam_en}}x${{env.pbeam_en}} ${{matrix.minq2}} datarec delphes.config
s3tools/make-fastsim-local-config.sh ${{env.ebeam_en}}x${{env.pbeam_en}} ${{matrix.minq2}} 0 datarec delphes.config
echo "====="
cat delphes.config
- uses: actions/upload-artifact@v3
Expand All @@ -129,6 +128,7 @@ jobs:
path: |
datarec/*.root
delphes.config
delphes.config.list
# DOWNLOAD FULLSIM ---------------------------------------------------------------------------

Expand All @@ -140,7 +140,7 @@ jobs:
matrix:
include:
- { detector: athena, num_files: 20 }
- { detector: ecce, num_files: 20 }
- { detector: ecce, num_files: 40 }
steps:
- uses: actions/checkout@v3
- uses: cvmfs-contrib/github-action-cvmfs@v3
Expand All @@ -154,7 +154,7 @@ jobs:
run: |
echo "[CI] download files from S3"
s3tools/add-host.sh
s3tools/make-${{matrix.detector}}-config.sh ${{env.ebeam_en}}x${{env.pbeam_en}} d ${{matrix.num_files}} s3files.config
s3tools/make-${{matrix.detector}}-config.sh ${{env.ebeam_en}}x${{env.pbeam_en}} ${{matrix.detector}} d ${{matrix.num_files}} s3files.config
echo "[CI] cat config file"
cat s3files.config
- uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -217,12 +217,12 @@ jobs:
echo "[CI] flatten tree of Delphes files"
find -name "*.root" -print | tee tmp.list
cat tmp.list | while read f; do mv -v $f datarec/; done
cat x_fastsim_delphes*/delphes.config > delphes.config
sort -nr -o delphes.config{,}
echo "[CI] generate combined config file"
s3tools/generate-config-file.rb delphes.config ${{env.ebeam_en}}x${{env.pbeam_en}} x_fastsim_delphes*/delphes.config.list
echo "[CI] cat delphes.config"
cat delphes.config
echo "[CI] ANALYSIS MACRO"
${{env.root}} 'macro/ci/analysis_${{matrix.aname}}.C("delphes.config",${{env.ebeam_en}},${{env.pbeam_en}},${{env.cross_ang}},"fastsim.${{matrix.aname}}.${{matrix.recon}}","${{matrix.recon}}")'
${{env.root}} 'macro/ci/analysis_${{matrix.aname}}.C("delphes.config","fastsim.${{matrix.aname}}.${{matrix.recon}}","${{matrix.recon}}")'
- uses: actions/upload-artifact@v3
with:
name: root_analysis_fastsim_${{matrix.aname}}_${{matrix.recon}}
Expand Down Expand Up @@ -272,7 +272,7 @@ jobs:
echo "[CI] cat s3files.config"
cat s3files.config
echo "[CI] ANALYSIS MACRO"
${{env.root_no_delphes}} 'macro/ci/analysis_${{matrix.aname}}.C("s3files.config",${{env.ebeam_en}},${{env.pbeam_en}},${{env.cross_ang}},"${{matrix.detector}}.${{matrix.aname}}.${{matrix.recon}}","${{matrix.recon}}")'
${{env.root_no_delphes}} 'macro/ci/analysis_${{matrix.aname}}.C("s3files.config","${{matrix.detector}}.${{matrix.aname}}.${{matrix.recon}}","${{matrix.recon}}")'
- uses: actions/upload-artifact@v3
with:
name: root_analysis_${{matrix.detector}}_${{matrix.aname}}_${{matrix.recon}}
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ and follow the [README](tutorial/README.md).
- set any other settings (e.g., a maximum number of events to process,
useful for quick tests)
- execute the analysis
- the input is a config file, which contains a list of files to analyze
together with settings such as beam energy and Q2 ranges; see
[doc/example.config](doc/example.config) for an example config file and
more details
- the output will be a `root` file, filled with `TObjArray`s of
histograms
- each `TObjArray` can be for a different subset of events (bin), e.g.,
Expand Down
3 changes: 3 additions & 0 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ DEPS = -I$(shell root-config --incdir)
LIBS = $(shell root-config --glibs)
#LIBS += -lMinuit -lRooFitCore -lRooFit -lRooStats -lProof -lMathMore

# Miscellaneous
LIBS += -lfmt

# DELPHES
ifdef EXCLUDE_DELPHES
FLAGS += -DEXCLUDE_DELPHES
Expand Down
1 change: 1 addition & 0 deletions datarec/xsec/xsec.dat
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ pythia6:ep-10x100-q2-high 1.159e+03 0.0114 # 100 < Q2
pythia6:ep-18x275 8.830e+05 0.0011 # general Q2
pythia6:ep-18x275-q2-low 8.796e+05 0.0006 # 1 < Q2 < 100
pythia6:ep-18x275-q2-high 3.092e+03 0.0475 # 100 < Q2
pythia6:ep-18x275-Lambda 8.830e+05 0.0011 # FIXME: assuming general Q2
67 changes: 67 additions & 0 deletions doc/example.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
############################################################
# EXAMPLE CONFIGURATION FILE
############################################################

#-----------------------------------------------------------
# This is an example config file
#
# This file can be used as a template, but it is easier to
# auto-generate config files using scripts in `s3tools/`; see
# `s3tools/README.md` for more details
#
# Syntax and Parsing
# - if the first character is ':', it is a setting: the name of
# the parameter together with a value, separated by a space
# - settings are generally optional; if you don't specify
# a setting, it will take a default value, likely set in
# `src/Analysis.cxx`
# - any text after '#' is ignored; use this for comments
# - if none of the above, it is an input file
# - input files can be grouped together by Q2 range
# - each Q2 range includes a cross section, used for weights
# when combining data from multiple Q2 ranges
# - files can be either local, or URLs on S3
#-----------------------------------------------------------


# Global Settings: these settings apply to all of the files in this config file
# ===============
:eleBeamEn 10 # beam energies, in GeV
:ionBeamEn 100
:crossingAngle -25 # crossing angle, in mrad
:totalCrossSection 555660.0 # total cross section, needed for Q2 weights; this may be the same
# cross section as your least-strict Q2 range (e.g., Q2>1)


# Group Settings: these settings are specific for each Q2 range
# ==============
# NOTE: they must be sorted by increasing strictness
# of Q2 cuts, or at least by decreasing cross section

# Q2 range 1
:q2min 1.0
#:q2max 100.0 # specify a Q2 maximum, if you need one
:crossSection 555660.0 # cross section
datarec/10x100/minQ2=1/file1.root # list of local files
datarec/10x100/minQ2=1/file2.root
datarec/10x100/minQ2=1/file3.root
datarec/10x100/minQ2=1/file4.root
datarec/10x100/minQ2=1/file5.root

# to start a new group, specify a new Q2 range and cross section
# Q2 range 2
:q2min 10.0
:crossSection 40026.0
datarec/10x100/minQ2=10/file1.root
datarec/10x100/minQ2=10/file2.root
#datarec/10x100/minQ2=10/file3.root # comment out a bad file
datarec/10x100/minQ2=10/file4.root
datarec/10x100/minQ2=10/file5.root

# to stream from S3, use s3https URLS
# Q2 range 3
:q2min 100.0
:crossSection 1343.0
s3https://dtn01.sdcc.bnl.gov:9000/eictest/EPIC/____/____/10x100/minQ2=100/file1.root
s3https://dtn01.sdcc.bnl.gov:9000/eictest/EPIC/____/____/10x100/minQ2=100/file2.root
s3https://dtn01.sdcc.bnl.gov:9000/eictest/EPIC/____/____/10x100/minQ2=100/file3.root
10 changes: 2 additions & 8 deletions macro/analysis_PvsEta.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,13 @@ R__LOAD_LIBRARY(Sidis-eic)
* - observe how the resulting histograms differ in each (x,Q2) bin
*/
void analysis_PvsEta(
TString infiles="datarec/in.config", /* delphes tree(s) */
Double_t eleBeamEn=10, /* electron beam energy [GeV] */
Double_t ionBeamEn=100, /* ion beam energy [GeV] */
Double_t crossingAngle=-25, /* crossing angle [mrad] */
TString configFile="datarec/in.config", /* delphes tree(s) */
TString outfilePrefix="coverage_pVsEtabins" /* output filename prefix*/
) {

// setup analysis ========================================
AnalysisDelphes *A = new AnalysisDelphes(
infiles,
eleBeamEn,
ionBeamEn,
crossingAngle,
configFile,
outfilePrefix
);

Expand Down
10 changes: 2 additions & 8 deletions macro/analysis_asymmetry.C
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,13 @@ struct WeightsTest : public WeightsSivers {
};

void analysis_asymmetry(
TString infiles="datarec/in.config", /* delphes tree(s) */
Double_t eleBeamEn=5, /* electron beam energy [GeV] */
Double_t ionBeamEn=41, /* ion beam energy [GeV] */
Double_t crossingAngle=-25, /* crossing angle [mrad] */
TString configFile="datarec/in.config", /* delphes tree(s) */
TString outfilePrefix="asymmetry" /* output filename prefix*/
) {

// setup analysis ========================================
AnalysisDelphes *A = new AnalysisDelphes(
infiles,
eleBeamEn,
ionBeamEn,
crossingAngle,
configFile,
outfilePrefix
);
Weights* weights = new WeightsSum({
Expand Down
10 changes: 2 additions & 8 deletions macro/analysis_coverage.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,13 @@ R__LOAD_LIBRARY(Sidis-eic)
* - observe how the resulting histograms differ in each (x,Q2) bin
*/
void analysis_coverage(
TString infiles="datarec/in.config", /* delphes tree(s) */
Double_t eleBeamEn=5, /* electron beam energy [GeV] */
Double_t ionBeamEn=41, /* ion beam energy [GeV] */
Double_t crossingAngle=-25, /* crossing angle [mrad] */
TString configFile="datarec/in.config", /* delphes tree(s) */
TString outfilePrefix="coverage" /* output filename prefix*/
) {

// setup analysis ========================================
AnalysisDelphes *A = new AnalysisDelphes(
infiles,
eleBeamEn,
ionBeamEn,
crossingAngle,
configFile,
outfilePrefix
);

Expand Down
10 changes: 2 additions & 8 deletions macro/analysis_phi_crosscheck.C
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
R__LOAD_LIBRARY(Sidis-eic)

void analysis_phi_crosscheck(
TString infiles="datarec/tutorial.config", /* list of input files */
Double_t eleBeamEn=5, /* electron beam energy [GeV] */
Double_t ionBeamEn=41, /* ion beam energy [GeV] */
Double_t crossingAngle=-25, /* crossing angle [mrad] */
TString configFile="datarec/tutorial.config", /* list of input files */
TString outfilePrefix="phi.crosscheck" /* output filename prefix*/
) {

// setup analysis ========================================
AnalysisDelphes *A = new AnalysisDelphes(
infiles,
eleBeamEn,
ionBeamEn,
crossingAngle,
configFile,
outfilePrefix
);

Expand Down
11 changes: 2 additions & 9 deletions macro/analysis_purity.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,15 @@ R__LOAD_LIBRARY(Sidis-eic)

// ratios of histograms with y-cut enabled to those with y-cut disabled
void analysis_purity(
TString infiles="datarec/in.config", /* delphes tree(s) */
Double_t eleBeamEn=5, /* electron beam energy [GeV] */
Double_t ionBeamEn=41, /* ion beam energy [GeV] */
Double_t crossingAngle=-25, /* crossing angle [mrad] */
TString configFile="datarec/in.config", /* delphes tree(s) */
TString methodname="ele", /*reconstruction method name*/
TString outfilePrefix="resolutions" /* output filename prefix*/

) {

//outfilePrefix+="_DA";
// setup analysis ========================================
AnalysisDelphes *A = new AnalysisDelphes(
infiles,
eleBeamEn,
ionBeamEn,
crossingAngle,
configFile,
outfilePrefix+"_"+methodname
);

Expand Down
13 changes: 5 additions & 8 deletions macro/ci/analysis_p_eta.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@ R__LOAD_LIBRARY(Sidis-eic)

// analysis in bins of (p,eta)
void analysis_p_eta(
TString infiles="datarec/canyonlands-v1.2/5x41/files.config", // default, for manual local testing
Double_t eleBeamEn=5,
Double_t ionBeamEn=41,
Double_t crossingAngle=-25,
TString outfilePrefix="coverage.fullsim",
TString configFile,
TString outfilePrefix,
TString reconMethod="Ele"
) {

// setup analysis ========================================
Analysis *A;
if (outfilePrefix.Contains("athena")) A = new AnalysisAthena( infiles, eleBeamEn, ionBeamEn, crossingAngle, outfilePrefix );
else if(outfilePrefix.Contains("ecce")) A = new AnalysisEcce( infiles, eleBeamEn, ionBeamEn, crossingAngle, outfilePrefix );
if (outfilePrefix.Contains("athena")) A = new AnalysisAthena( configFile, outfilePrefix );
else if(outfilePrefix.Contains("ecce")) A = new AnalysisEcce( configFile, outfilePrefix );
#ifndef EXCLUDE_DELPHES
else A = new AnalysisDelphes( infiles, eleBeamEn, ionBeamEn, crossingAngle, outfilePrefix );
else A = new AnalysisDelphes( configFile, outfilePrefix );
#endif

A->SetReconMethod(reconMethod); // set reconstruction method
Expand Down
20 changes: 7 additions & 13 deletions macro/ci/analysis_x_q2.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,18 @@ R__LOAD_LIBRARY(Sidis-eic)

// analysis in bins of (x,Q2)
void analysis_x_q2(
TString infiles="testconfig/delphes.config", // default, for manual local testing of fastsim
// TString infiles="testconfig/s3files.config", // default, for manual local testing of fullsim
Double_t eleBeamEn=10,
Double_t ionBeamEn=100,
Double_t crossingAngle=-25,
TString outfilePrefix="resolution.fastsim",
// TString outfilePrefix="resolution.fullsim",
// TString outfilePrefix="coverage.fastsim",
// TString outfilePrefix="coverage.fullsim",
TString configFile,
TString outfilePrefix,
TString reconMethod="Ele"
) {
)
{

// setup analysis ========================================
Analysis *A;
if (outfilePrefix.Contains("athena")) A = new AnalysisAthena( infiles, eleBeamEn, ionBeamEn, crossingAngle, outfilePrefix );
else if(outfilePrefix.Contains("ecce")) A = new AnalysisEcce( infiles, eleBeamEn, ionBeamEn, crossingAngle, outfilePrefix );
if (outfilePrefix.Contains("athena")) A = new AnalysisAthena( configFile, outfilePrefix );
else if(outfilePrefix.Contains("ecce")) A = new AnalysisEcce( configFile, outfilePrefix );
#ifndef EXCLUDE_DELPHES
else A = new AnalysisDelphes( infiles, eleBeamEn, ionBeamEn, crossingAngle, outfilePrefix );
else A = new AnalysisDelphes( configFile, outfilePrefix );
#endif

A->SetReconMethod(reconMethod); // set reconstruction method
Expand Down
11 changes: 4 additions & 7 deletions macro/ci/analysis_yRatio.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@ R__LOAD_LIBRARY(Sidis-eic)

// ratios of histograms with y-cut enabled to those with y-cut disabled
void analysis_yRatio(
TString infiles,
Double_t eleBeamEn,
Double_t ionBeamEn,
Double_t crossingAngle,
TString configFile,
TString outfilePrefix,
TString reconMethod="Ele"
) {

// setup analysis ========================================
Analysis *A;
if (outfilePrefix.Contains("athena")) A = new AnalysisAthena( infiles, eleBeamEn, ionBeamEn, crossingAngle, outfilePrefix );
else if(outfilePrefix.Contains("ecce")) A = new AnalysisEcce( infiles, eleBeamEn, ionBeamEn, crossingAngle, outfilePrefix );
if (outfilePrefix.Contains("athena")) A = new AnalysisAthena( configFile, outfilePrefix );
else if(outfilePrefix.Contains("ecce")) A = new AnalysisEcce( configFile, outfilePrefix );
#ifndef EXCLUDE_DELPHES
else A = new AnalysisDelphes( infiles, eleBeamEn, ionBeamEn, crossingAngle, outfilePrefix );
else A = new AnalysisDelphes( configFile, outfilePrefix );
#endif

A->SetReconMethod(reconMethod); // set reconstruction method
Expand Down
1 change: 0 additions & 1 deletion macro/ci/delphes.config

This file was deleted.

23 changes: 0 additions & 23 deletions macro/ci/localtest.sh

This file was deleted.

Loading

0 comments on commit ea8e661

Please sign in to comment.