diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cbf59e9..c4954663 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,10 @@ env: root: root -b -q root_no_delphes: root -b -q macro/ci/define_exclude_delphes.C +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: # BUILD --------------------------------------------------------------------------- @@ -87,7 +91,7 @@ jobs: strategy: fail-fast: false matrix: - minq2: [1, 10, 100, 1000] # note: keep consistent with `download-artifact` with name `x_delphes_*` + minq2: [1, 10, 100, 1000] # note: keep consistent with `download-artifact` with name `x_fastsim_delphes_*` steps: - uses: actions/checkout@v3 - uses: cvmfs-contrib/github-action-cvmfs@v3 @@ -102,7 +106,7 @@ jobs: echo "[CI] add S3 host" s3tools/add-host.sh echo "[CI] generate list of HEPMC files" - s3tools/generate-hepmc-list.sh ${{env.ebeam_en}}x${{env.pbeam_en}} ${{matrix.minq2}} 4 | tee hepmc.list + s3tools/generate-hepmc-list.sh ${{env.ebeam_en}}x${{env.pbeam_en}} ${{matrix.minq2}} 6 | tee hepmc.list echo "[CI] download HEPMC files" while read hepmc; do mc cp $hepmc datagen/; done < hepmc.list echo "=====" @@ -120,7 +124,7 @@ jobs: cat delphes.config - uses: actions/upload-artifact@v3 with: - name: x_delphes_q2min${{matrix.minq2}} + name: x_fastsim_delphes_q2min${{matrix.minq2}} retention-days: 1 path: | datarec/*.root @@ -128,9 +132,15 @@ jobs: # DOWNLOAD FULLSIM --------------------------------------------------------------------------- -# download fullsim files and make config +# download full simulation files and make config download_fullsim: runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + include: + - { detector: athena, num_files: 20 } + - { detector: ecce, num_files: 20 } steps: - uses: actions/checkout@v3 - uses: cvmfs-contrib/github-action-cvmfs@v3 @@ -142,14 +152,14 @@ jobs: platform-release: "jug_xl:nightly" setup: environ.sh run: | - echo "[CI] download fullsim files" + echo "[CI] download files from S3" s3tools/add-host.sh - s3tools/make-athena-config.sh ${{env.ebeam_en}}x${{env.pbeam_en}} d 8 s3files.config + s3tools/make-${{matrix.detector}}-config.sh ${{env.ebeam_en}}x${{env.pbeam_en}} d ${{matrix.num_files}} s3files.config echo "[CI] cat config file" cat s3files.config - uses: actions/upload-artifact@v3 with: - name: x_fullsim + name: x_fullsim_${{matrix.detector}} retention-days: 1 path: | s3files.config @@ -181,20 +191,20 @@ jobs: name: x_build_all - uses: actions/download-artifact@v3 with: - name: x_delphes_q2min1 - path: x_delphes_q2min1 + name: x_fastsim_delphes_q2min1 + path: x_fastsim_delphes_q2min1 - uses: actions/download-artifact@v3 with: - name: x_delphes_q2min10 - path: x_delphes_q2min10 + name: x_fastsim_delphes_q2min10 + path: x_fastsim_delphes_q2min10 - uses: actions/download-artifact@v3 with: - name: x_delphes_q2min100 - path: x_delphes_q2min100 + name: x_fastsim_delphes_q2min100 + path: x_fastsim_delphes_q2min100 - uses: actions/download-artifact@v3 with: - name: x_delphes_q2min1000 - path: x_delphes_q2min1000 + name: x_fastsim_delphes_q2min1000 + path: x_fastsim_delphes_q2min1000 - uses: cvmfs-contrib/github-action-cvmfs@v3 - uses: eic/run-cvmfs-osg-eic-shell@main with: @@ -207,7 +217,7 @@ 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_delphes*/delphes.config > delphes.config + cat x_fastsim_delphes*/delphes.config > delphes.config sort -nr -o delphes.config{,} echo "[CI] cat delphes.config" cat delphes.config @@ -219,7 +229,7 @@ jobs: retention-days: 7 path: out -# run analysis macros matrix for fullsim +# run analysis macros matrix for full simulation analysis_fullsim: needs: - build_no_delphes @@ -228,14 +238,20 @@ jobs: strategy: fail-fast: true matrix: + detector: [athena, ecce] aname: [x_q2, p_eta, yRatio] recon: [Ele] - include: - - { aname: x_q2, recon: Mixed } - - { aname: x_q2, recon: JB } - - { aname: x_q2, recon: DA } - - { aname: x_q2, recon: Sigma } - - { aname: x_q2, recon: eSigma } + include: # enable other recon methods for `aname==x_q2` only + - { aname: x_q2, recon: Mixed, detector: athena } # FIXME: not sure how to avoid being repetitive... + - { aname: x_q2, recon: JB, detector: athena } + - { aname: x_q2, recon: DA, detector: athena } + - { aname: x_q2, recon: Sigma, detector: athena } + - { aname: x_q2, recon: eSigma, detector: athena } + - { aname: x_q2, recon: Mixed, detector: ecce } + - { aname: x_q2, recon: JB, detector: ecce } + - { aname: x_q2, recon: DA, detector: ecce } + - { aname: x_q2, recon: Sigma, detector: ecce } + - { aname: x_q2, recon: eSigma, detector: ecce } steps: - uses: actions/checkout@v3 - uses: actions/download-artifact@v3 @@ -243,7 +259,7 @@ jobs: name: x_build_no_delphes - uses: actions/download-artifact@v3 with: - name: x_fullsim + name: x_fullsim_${{matrix.detector}} - uses: cvmfs-contrib/github-action-cvmfs@v3 - uses: eic/run-cvmfs-osg-eic-shell@main with: @@ -256,10 +272,10 @@ 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}},"fullsim.${{matrix.aname}}.${{matrix.recon}}","${{matrix.recon}}")' + ${{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}}")' - uses: actions/upload-artifact@v3 with: - name: root_analysis_fullsim_${{matrix.aname}}_${{matrix.recon}} + name: root_analysis_${{matrix.detector}}_${{matrix.aname}}_${{matrix.recon}} retention-days: 7 path: out @@ -276,7 +292,8 @@ jobs: matrix: mode: - fastsim - - fullsim + - athena + - ecce pname: # list only jobs which will only use one (primary) recon method - bin_test - coverage2D_p_eta @@ -285,22 +302,27 @@ jobs: include: # use only primary recon method - { pname: bin_test, aname: x_q2, pmacro: postprocess_bin_test.C } - - { pname: coverage2D_p_eta, aname: p_eta, pmacro: postprocess_p_eta.C } - - { pname: y_minima, aname: yRatio, pmacro: postprocess_yRatio.C } - # use all reconstruction methods: (...seems like we really need to define every matrix element...) - ## coverage - - { mode: fastsim, pname: coverage2D_x_q2, recon: Ele, aname: x_q2, pmacro: postprocess_x_q2.C } - - { mode: fullsim, pname: coverage2D_x_q2, recon: Ele, aname: x_q2, pmacro: postprocess_x_q2.C } - - { mode: fastsim, pname: coverage2D_x_q2, recon: Mixed, aname: x_q2, pmacro: postprocess_x_q2.C } - - { mode: fullsim, pname: coverage2D_x_q2, recon: Mixed, aname: x_q2, pmacro: postprocess_x_q2.C } - - { mode: fastsim, pname: coverage2D_x_q2, recon: DA, aname: x_q2, pmacro: postprocess_x_q2.C } - - { mode: fullsim, pname: coverage2D_x_q2, recon: DA, aname: x_q2, pmacro: postprocess_x_q2.C } - - { mode: fastsim, pname: coverage2D_x_q2, recon: JB, aname: x_q2, pmacro: postprocess_x_q2.C } - - { mode: fullsim, pname: coverage2D_x_q2, recon: JB, aname: x_q2, pmacro: postprocess_x_q2.C } - - { mode: fastsim, pname: coverage2D_x_q2, recon: Sigma, aname: x_q2, pmacro: postprocess_x_q2.C } - - { mode: fullsim, pname: coverage2D_x_q2, recon: Sigma, aname: x_q2, pmacro: postprocess_x_q2.C } - - { mode: fastsim, pname: coverage2D_x_q2, recon: eSigma, aname: x_q2, pmacro: postprocess_x_q2.C } - - { mode: fullsim, pname: coverage2D_x_q2, recon: eSigma, aname: x_q2, pmacro: postprocess_x_q2.C } + - { pname: coverage2D_p_eta, aname: p_eta, pmacro: postprocess_p_eta.C } + - { pname: y_minima, aname: yRatio, pmacro: postprocess_yRatio.C } + # use all reconstruction methods: # FIXME: not sure how to avoid being repetitive... + - { mode: fastsim, pname: coverage2D_x_q2, recon: Ele, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: fastsim, pname: coverage2D_x_q2, recon: DA, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: fastsim, pname: coverage2D_x_q2, recon: eSigma, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: fastsim, pname: coverage2D_x_q2, recon: JB, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: fastsim, pname: coverage2D_x_q2, recon: Mixed, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: fastsim, pname: coverage2D_x_q2, recon: Sigma, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: athena, pname: coverage2D_x_q2, recon: Ele, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: athena, pname: coverage2D_x_q2, recon: DA, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: athena, pname: coverage2D_x_q2, recon: eSigma, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: athena, pname: coverage2D_x_q2, recon: JB, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: athena, pname: coverage2D_x_q2, recon: Mixed, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: athena, pname: coverage2D_x_q2, recon: Sigma, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: ecce, pname: coverage2D_x_q2, recon: Ele, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: ecce, pname: coverage2D_x_q2, recon: DA, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: ecce, pname: coverage2D_x_q2, recon: eSigma, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: ecce, pname: coverage2D_x_q2, recon: JB, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: ecce, pname: coverage2D_x_q2, recon: Mixed, aname: x_q2, pmacro: postprocess_x_q2.C } + - { mode: ecce, pname: coverage2D_x_q2, recon: Sigma, aname: x_q2, pmacro: postprocess_x_q2.C } steps: - uses: actions/checkout@v3 - uses: actions/download-artifact@v3 @@ -338,7 +360,7 @@ jobs: # COMPARATORS --------------------------------------------------------------------------- # run compare macros matrix for fastsim vs. fullsim - compare_fastfull: + comparison: needs: - analysis_fastsim - analysis_fullsim @@ -354,7 +376,7 @@ jobs: # use only primary recon method - { pname: coverage_p_eta, aname: p_eta, xvar: p, yvar: eta } - { pname: resolution_p_eta, aname: p_eta, xvar: p, yvar: eta } - # use all reconstruction methods: (...seems like we really need to define every matrix element...) + # use all reconstruction methods: ## resolution - { pname: resolution_x_q2, recon: Ele, aname: x_q2, xvar: x, yvar: q2 } - { pname: resolution_x_q2, recon: Mixed, aname: x_q2, xvar: x, yvar: q2 } @@ -380,7 +402,11 @@ jobs: path: out - uses: actions/download-artifact@v3 with: - name: root_analysis_fullsim_${{matrix.aname}}_${{matrix.recon}} + name: root_analysis_athena_${{matrix.aname}}_${{matrix.recon}} + path: out + - uses: actions/download-artifact@v3 + with: + name: root_analysis_ecce_${{matrix.aname}}_${{matrix.recon}} path: out - uses: cvmfs-contrib/github-action-cvmfs@v3 - uses: eic/run-cvmfs-osg-eic-shell@main @@ -397,17 +423,19 @@ jobs: echo "[CI] COMPARATOR MACRO" ls out mv -v out/fastsim.{${{matrix.aname}},${{matrix.pname}}}.${{matrix.recon}}.root # rename aname -> pname - mv -v out/fullsim.{${{matrix.aname}},${{matrix.pname}}}.${{matrix.recon}}.root # rename aname -> pname - ${{env.root_no_delphes}} 'macro/ci/comparator.C("out/fastsim.${{matrix.pname}}.${{matrix.recon}}.root","out/fullsim.${{matrix.pname}}.${{matrix.recon}}.root","out/fastfull.${{matrix.pname}}.${{matrix.recon}}","${{matrix.xvar}}","${{matrix.yvar}}")' + mv -v out/athena.{${{matrix.aname}},${{matrix.pname}}}.${{matrix.recon}}.root # rename aname -> pname + mv -v out/ecce.{${{matrix.aname}},${{matrix.pname}}}.${{matrix.recon}}.root # rename aname -> pname + ${{env.root_no_delphes}} 'macro/ci/comparator.C("out/fastsim.${{matrix.pname}}.${{matrix.recon}}.root","out/athena.${{matrix.pname}}.${{matrix.recon}}.root","out/ecce.${{matrix.pname}}.${{matrix.recon}}.root","out/comparison.${{matrix.pname}}.${{matrix.recon}}","${{matrix.xvar}}","${{matrix.yvar}}")' rm -v out/fastsim.${{matrix.pname}}.${{matrix.recon}}.root # rm analysis_root artifact - rm -v out/fullsim.${{matrix.pname}}.${{matrix.recon}}.root # rm analysis_root artifact + rm -v out/athena.${{matrix.pname}}.${{matrix.recon}}.root # rm analysis_root artifact + rm -v out/ecce.${{matrix.pname}}.${{matrix.recon}}.root # rm analysis_root artifact - uses: actions/upload-artifact@v3 with: - name: results_fastfull_${{matrix.pname}}_${{matrix.recon}} + name: comparison_${{matrix.pname}}_${{matrix.recon}} retention-days: 30 path: | - out/fastfull*.images/*.png - out/fastfull*.root + out/comparison*.images/*.png + out/comparison*.root # ARTIFACTS --------------------------------------------------------------------------- @@ -415,7 +443,7 @@ jobs: collect: needs: - postprocess - - compare_fastfull + - comparison runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/datarec/xsec/xsec.dat b/datarec/xsec/xsec.dat index 4f325380..c2805233 100644 --- a/datarec/xsec/xsec.dat +++ b/datarec/xsec/xsec.dat @@ -1,20 +1,34 @@ -#label cross_section_[pb] relative_uncertainty -5x100/minQ2=1000 0.43023 0.00258 -5x100/minQ2=100 778.99 0.00223 -5x100/minQ2=10 30476 0.00251 -5x100/minQ2=1 4.8573e+05 0.0027 -5x41/minQ2=100 287.28 0.00216 -5x41/minQ2=10 20365 0.00242 -5x41/minQ2=1 4.0012e+05 0.00266 -10x100/minQ2=1000 6.8238 0.0023 -10x100/minQ2=100 1343 0.0023 -10x100/minQ2=10 40026 0.00258 -10x100/minQ2=1 5.5566e+05 0.00276 -10x275/minQ2=1000 42.031 0.00221 -10x275/minQ2=100 2489.4 0.0024 -10x275/minQ2=10 57053 0.00266 -10x275/minQ2=1 6.6791e+05 0.00276 -18x275/minQ2=1000 79.451 0.00223 -18x275/minQ2=100 3370.2 0.00245 -18x275/minQ2=10 69275 0.00266 -18x275/minQ2=1 7.4167e+05 0.00277 +# Pythia 8, from ATHENA production HEPMC files: S3/eictest/ATHENA/EVGEN/DIS/NC +#label cross_section_[pb] relative_uncertainty +pythia8:5x100/minQ2=1000 0.43023 0.00258 +pythia8:5x100/minQ2=100 778.99 0.00223 +pythia8:5x100/minQ2=10 30476 0.00251 +pythia8:5x100/minQ2=1 4.8573e+05 0.0027 +pythia8:5x41/minQ2=100 287.28 0.00216 +pythia8:5x41/minQ2=10 20365 0.00242 +pythia8:5x41/minQ2=1 4.0012e+05 0.00266 +pythia8:10x100/minQ2=1000 6.8238 0.0023 +pythia8:10x100/minQ2=100 1343 0.0023 +pythia8:10x100/minQ2=10 40026 0.00258 +pythia8:10x100/minQ2=1 5.5566e+05 0.00276 +pythia8:10x275/minQ2=1000 42.031 0.00221 +pythia8:10x275/minQ2=100 2489.4 0.0024 +pythia8:10x275/minQ2=10 57053 0.00266 +pythia8:10x275/minQ2=1 6.6791e+05 0.00276 +pythia8:18x275/minQ2=1000 79.451 0.00223 +pythia8:18x275/minQ2=100 3370.2 0.00245 +pythia8:18x275/minQ2=10 69275 0.00266 +pythia8:18x275/minQ2=1 7.4167e+05 0.00277 +# Pythia 6, from ECCE production files: +# S3/eictest/ECCE/ProductionInputFiles/SIDIS/pythia6 +# Note: the following are values for noradcor files, radcor +#label cross_section_[pb] relative_uncertainty +pythia6:ep-5x41 3.189e+05 0.0011 # general Q2 +pythia6:ep-5x41-q2-low 3.187e+05 0.0009 # 1 < Q2 < 100 +pythia6:ep-5x41-q2-high 1.622e+02 0.0111 # 100 < Q2 +pythia6:ep-10x100 5.797e+05 0.0011 # general Q2 +pythia6:ep-10x100-q2-low 5.784e+05 0.0010 # 1 < Q2 < 100 +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 diff --git a/macro/ci/analysis_p_eta.C b/macro/ci/analysis_p_eta.C index aa316f68..8feb3ea7 100644 --- a/macro/ci/analysis_p_eta.C +++ b/macro/ci/analysis_p_eta.C @@ -12,8 +12,8 @@ void analysis_p_eta( // setup analysis ======================================== Analysis *A; - if(outfilePrefix.Contains("fullsim")) - A = new AnalysisAthena( infiles, eleBeamEn, ionBeamEn, crossingAngle, outfilePrefix ); + 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 ); #ifndef EXCLUDE_DELPHES else A = new AnalysisDelphes( infiles, eleBeamEn, ionBeamEn, crossingAngle, outfilePrefix ); #endif diff --git a/macro/ci/analysis_x_q2.C b/macro/ci/analysis_x_q2.C index d3b3784d..4eb01516 100644 --- a/macro/ci/analysis_x_q2.C +++ b/macro/ci/analysis_x_q2.C @@ -16,8 +16,8 @@ void analysis_x_q2( // setup analysis ======================================== Analysis *A; - if(outfilePrefix.Contains("fullsim")) - A = new AnalysisAthena( infiles, eleBeamEn, ionBeamEn, crossingAngle, outfilePrefix ); + 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 ); #ifndef EXCLUDE_DELPHES else A = new AnalysisDelphes( infiles, eleBeamEn, ionBeamEn, crossingAngle, outfilePrefix ); #endif diff --git a/macro/ci/analysis_yRatio.C b/macro/ci/analysis_yRatio.C index 1dda0500..96f90820 100644 --- a/macro/ci/analysis_yRatio.C +++ b/macro/ci/analysis_yRatio.C @@ -12,8 +12,8 @@ void analysis_yRatio( // setup analysis ======================================== Analysis *A; - if(outfilePrefix.Contains("fullsim")) - A = new AnalysisAthena( infiles, eleBeamEn, ionBeamEn, crossingAngle, outfilePrefix ); + 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 ); #ifndef EXCLUDE_DELPHES else A = new AnalysisDelphes( infiles, eleBeamEn, ionBeamEn, crossingAngle, outfilePrefix ); #endif diff --git a/macro/ci/comparator.C b/macro/ci/comparator.C index 442b6ecf..9e05bba2 100644 --- a/macro/ci/comparator.C +++ b/macro/ci/comparator.C @@ -4,8 +4,9 @@ R__LOAD_LIBRARY(Sidis-eic) // - depending on infile, different histograms will be drawn void comparator( TString infile0="out/resolution.fastsim.root", - TString infile1="out/resolution.fullsim.root", - TString outfile="out/resolution.fastfull.root", + TString infile1="out/resolution.athena.root", + TString infile2="out/resolution.ecce.root", + TString outfile="out/resolution.comparison.root", TString gx="x", TString gy="q2" // plotgrid vars ) { @@ -69,9 +70,11 @@ void comparator( if(gy=="p") { gyT="p"; logy=true; } // file names and bin vars - std::vector infiles; - infiles.push_back(new TFile(infile0)); - infiles.push_back(new TFile(infile1)); + std::vector infiles = { + new TFile(infile0), + new TFile(infile1), + new TFile(infile2) + }; bool first=true; Int_t numXbins, numYbins; Double_t xMin, xMax, yMin, yMax; @@ -109,20 +112,17 @@ void comparator( } // set legend labels - // - add "key" strings to `legendKeys`, so if the key is contained in the - // infile name, the key string will be used in the legend label, rather than - // the infile name - std::vector legendKeys; - legendKeys.push_back("fastsim"); - legendKeys.push_back("fullsim"); + auto makeLegendName = [] (TString infileName) -> TString { + if (infileName.Contains("fastsim")) return "Delphes"; + else if(infileName.Contains("athena")) return "ATHENA"; + else if(infileName.Contains("ecce")) return "ECCE"; + else if(infileName.Contains("epic")) return "EPIC"; + return "UNKNOWN"; + }; for(auto infile : infiles) { TString infileN = TString(infile->GetName()); - TString key = infileN; - for(auto legendKey : legendKeys) { - if(infileN.Contains(legendKey)) key = legendKey; - } - P0->legendLabels.push_back(key); - }; + P0->legendLabels.push_back(makeLegendName(infileN)); + } // 3D array structure: list of 2D arrays of Histos pointers // - each element of the list will be compared diff --git a/macro/ci/merge-fastfull.sh b/macro/ci/merge-fastfull.sh index 74cfa1a6..a1dc560e 100755 --- a/macro/ci/merge-fastfull.sh +++ b/macro/ci/merge-fastfull.sh @@ -16,7 +16,6 @@ while read dirFast; do # set fullsim and output directory names echo "--------------------" - dirFull=$(echo $dirFast | sed 's/fastsim/fullsim/g') dirOut=$(echo $dirFast | sed 's/fastsim//g' | sed 's/__/_/g') mkdir -p $dirOut @@ -29,16 +28,24 @@ while read dirFast; do popd # repeat for fullsim artifacts - echo "MOVE AND RENAME artifacts in $dirFull -> $dirOut" - pushd $dirFull - for file in *; do - mv -v $file ../$dirOut/$(echo $file | sed 's/^.*\./&fullsim./g') + for detector in athena ecce epic; do + dirFull=$(echo $dirFast | sed "s/fastsim/${detector}/g") + echo "MOVE AND RENAME artifacts in $dirFull -> $dirOut" + if [ -d "$dirFull" ]; then + pushd $dirFull + for file in *; do + mv -v $file ../$dirOut/$(echo $file | sed "s/^.*\./&${detector}./g") + done + popd + echo "CLEANUP" + rm -rv $dirFull + else + echo "WARNING: $dirFull does not exist; ignoring" + fi done - popd - # remove empty directories echo "CLEANUP" - rm -rv $dirFast $dirFull + rm -rv $dirFast done diff --git a/s3tools/make-athena-config.sh b/s3tools/make-athena-config.sh index 21e2591f..6a03d3db 100755 --- a/s3tools/make-athena-config.sh +++ b/s3tools/make-athena-config.sh @@ -84,7 +84,7 @@ if [ -z "$outFile" ]; then configFile=$targetDir/files.config else configFile=$outFile; fi > $configFile for Q2min in ${Q2minima[@]}; do - crossSection=$(s3tools/read-xsec-table.sh $energy $Q2min) + crossSection=$(s3tools/read-xsec-table.sh "pythia8:$energy/minQ2=$Q2min") if [ "$mode" == "d" -o "$mode" == "c" ]; then s3tools/generate-local-list.sh "$targetDir/minQ2=$Q2min" 0 $crossSection $Q2min | tee -a $configFile elif [ "$mode" == "s" ]; then diff --git a/s3tools/make-ecce-config.sh b/s3tools/make-ecce-config.sh index b0b0c01c..b9bda9f4 100755 --- a/s3tools/make-ecce-config.sh +++ b/s3tools/make-ecce-config.sh @@ -6,32 +6,42 @@ # - the config file consists of file names (or URLs), with Q2 minima and cross sections ################### -#### RELEASE TAG AND RECO DIR: ########################### -release="prop.5/prop.5.1/AI"; -# release="prop.6/prop.6.0/SIDIS"; # event evaluator output empty? -releaseDir="S3/eictest/ECCE/MC/$release/pythia6" -#### references for EventEvaluator files -eventEvalDir="eval_00000" -eventEvalFileRegex='.*g4event_eval.root' +#### RELEASE TAG ######################################### +tag=latest ########################################################## +### use tag to specify the release information and settings +case $tag in + latest) + release="22.1" + releaseDir="S3/eictest/EPIC/Campaigns/$release/SIDIS/pythia6" + eventEvalDir="" # latest files are in the top-level directory, not `eval_0000{0,2}` + ;; + legacy) ### older example ECCE release + release="prop.5/prop.5.1/SIDIS"; + releaseDir="S3/eictest/ECCE/MC/$release/pythia6" + eventEvalDir="eval_00000" + ;; + *) + echo "ERROR: unknown production tag" + exit 1 +esac +# common settings for all releases +eventEvalFileRegex='.*g4event_eval.root' + # usage: if [ $# -lt 2 ]; then + echo "Querying S3 for available data directories..." echo """ USAGE: $0 [energy] [mode(d/s/c)] [limit(optional)] [outputFile(optional)] - - [energy]: 5x41 - 5x100 - 10x100 - 10x275 - 18x275 - - NOTES: - - for release 'prop.6/prop.6.0', only 5x41 and 18x275 are available, - with varying Q2 ranges - - note that in some cases, there is a 'suffix' specifying the Q2 range; - to use those, just include it in [energy], for example: - - $0 18x275-q2-low + - [energy]: beam energies; data from differing Q2 ranges are combined + automatically, weighted by cross sections + + AVAILABLE ENERGIES ON S3 in $releaseDir + ======================== +$(mc ls $releaseDir | sed 's;.* ep-; ;' | sed 's;/$;;' | sed 's;-.*;;g' | uniq ) + ======================== - [mode]: s - make config file for streaming from S3 d - download from S3, then make the local config file @@ -52,45 +62,66 @@ if [ $# -lt 2 ]; then configured for a specific set of data, but you may want to change them. - CURRENT RELEASE: $release - - AVAILABLE DATA ON S3 (press ^C to abort S3 query): + CURRENT RELEASE: + release: $release + releaseDir: $releaseDir + eventEvalDir: $eventEvalDir """ - mc tree $releaseDir exit 2 fi -energyArg=$1 +energy=$1 mode=$2 limit=5 outFile="" if [ $# -ge 3 ]; then limit=$3; fi if [ $# -ge 4 ]; then outFile=$4; fi -# split energyArg to energy and suffix -energy=$(echo $energyArg | sed 's/-.*//') -suffix=$(echo $energyArg | sed 's/[^-]*//') +### get list of subdirectories associated to this beam energy; each subdirectory has a different Q2 range +echo "Querying S3 for available data directories..." +subdirListUnsorted=$(mc ls $releaseDir | grep $energy | awk '{print $NF}' | sed 's;/$;;') +### sort in order of decreasing Q2 minimum +function searchSubdirList { echo $subdirListUnsorted | sed 's; ;\n;g' | grep $*; } +subdirList="`searchSubdirList high` `searchSubdirList low` `searchSubdirList -v q2`" # take all 3 directories +# subdirList="`searchSubdirList high` `searchSubdirList -v q2`" # skip the 'q2-low` directory +printf "\nSubdirectories:\n" +for subdir in $subdirList; do echo " $subdir"; done # cd to the main directory pushd $(dirname $(realpath $0))/.. -# settings ############################################################# -sourceDir="$releaseDir/ep-$energyArg/$eventEvalDir" -targetDir="datarec/ecce/$release/$energyArg" -Q2min=1 # FIXME: assumed, so far this script only looks at the general Q2 - # production, and it doesn't matter if this is the *correct* Q2min; - # this Q2min only matters when you want to combine datasets with - # different Q2 minima (see `make-athena-config.sh`) -######################################################################## +# function to get the sourceDir, given subdir $1 +function getSourceDir { + echo "$releaseDir/$1/$eventEvalDir" | sed 's;/$;;' | sed 's;//;/;g'; +} + +# function to get the Q2 minimum, given subdir $1 +function getQ2min { + if [[ "$1" =~ "q2-low" ]]; then echo 1; + elif [[ "$1" =~ "q2-high" ]]; then echo 100; + else echo 1 # general Q2 + fi +} + +# set destination directory +targetDir="datarec/ecce/$release/$energy" + +# print settings +printf "\nsource directories:\n" +for subdir in $subdirList; do echo " $(getSourceDir $subdir) Q2min = $(getQ2min $subdir)"; done +echo "targetDir = $targetDir" # download files from S3 function status { echo ""; echo "[+] $1"; } if [ "$mode" == "d" ]; then status "downloading files from S3..." - if [ $limit -gt 0 ]; then - s3tools/generate-s3-list.sh "$sourceDir" | grep -E $eventEvalFileRegex | head -n$limit | s3tools/download.sh "$targetDir" - else - s3tools/generate-s3-list.sh "$sourceDir" | grep -E $eventEvalFileRegex | s3tools/download.sh "$targetDir" - fi + for subdir in $subdirList; do + sourceDir=$(getSourceDir $subdir) + if [ $limit -gt 0 ]; then + s3tools/generate-s3-list.sh "$sourceDir" | grep -E $eventEvalFileRegex | head -n$limit | s3tools/download.sh "$targetDir/$subdir" + else + s3tools/generate-s3-list.sh "$sourceDir" | grep -E $eventEvalFileRegex | s3tools/download.sh "$targetDir/$subdir" + fi + done fi # build a config file @@ -99,19 +130,23 @@ mkdir -p $targetDir if [ -z "$outFile" ]; then configFile=$targetDir/files.config else configFile=$outFile; fi > $configFile -crossSection=$(s3tools/read-xsec-table.sh $energy $Q2min) -if [ "$mode" == "d" -o "$mode" == "c" ]; then - s3tools/generate-local-list.sh "$targetDir" 0 $crossSection $Q2min | tee -a $configFile -elif [ "$mode" == "s" ]; then - if [ $limit -gt 0 ]; then - s3tools/generate-s3-list.sh "$sourceDir" 0 $crossSection $Q2min | grep -E $eventEvalFileRegex | head -n$limit | tee -a $configFile +for subdir in $subdirList; do + crossSection=$(s3tools/read-xsec-table.sh "pythia6:$subdir") + sourceDir=$(getSourceDir $subdir) + Q2min=$(getQ2min $subdir) + if [ "$mode" == "d" -o "$mode" == "c" ]; then + s3tools/generate-local-list.sh "$targetDir/$subdir" 0 $crossSection $Q2min | tee -a $configFile + elif [ "$mode" == "s" ]; then + if [ $limit -gt 0 ]; then + s3tools/generate-s3-list.sh "$sourceDir" 0 $crossSection $Q2min | grep -E $eventEvalFileRegex | head -n$limit | tee -a $configFile + else + s3tools/generate-s3-list.sh "$sourceDir" 0 $crossSection $Q2min | grep -E $eventEvalFileRegex | tee -a $configFile + fi else - s3tools/generate-s3-list.sh "$sourceDir" 0 $crossSection $Q2min | grep -E $eventEvalFileRegex | tee -a $configFile + echo "ERROR: unknown mode" + exit 1 fi -else - echo "ERROR: unknown mode" - exit 1 -fi +done # PATCH: convert config file to one-line-per-Q2min format status "reformatting config file to one-line-per-Q2min format..." diff --git a/s3tools/make-fastsim-local-config.sh b/s3tools/make-fastsim-local-config.sh index 95e22a6e..fbe49844 100755 --- a/s3tools/make-fastsim-local-config.sh +++ b/s3tools/make-fastsim-local-config.sh @@ -30,7 +30,7 @@ pushd $(dirname $(realpath $0))/.. function status { echo ""; echo "[+] $1"; } status "build config file..." > $configFile -crossSection=$(s3tools/read-xsec-table.sh $energy $Q2min) +crossSection=$(s3tools/read-xsec-table.sh "pythia8:$energy/minQ2=$Q2min") s3tools/generate-local-list.sh "$sourceDir" 0 $crossSection $Q2min | tee -a $configFile # PATCH: convert config file to one-line-per-Q2min format diff --git a/s3tools/read-xsec-table.sh b/s3tools/read-xsec-table.sh index 307b08c6..64a57339 100755 --- a/s3tools/read-xsec-table.sh +++ b/s3tools/read-xsec-table.sh @@ -3,19 +3,18 @@ # arguments table=datarec/xsec/xsec.dat -if [ $# -lt 2 ]; then echo """ - USAGE: $0 [energy] [Q2min] [xsec.dat file (optional)] - - EXAMPLE: $0 18x275 100 +if [ $# -lt 1 ]; then echo """ + USAGE: $0 [search_string] [xsec.dat file (optional)] + EXAMPLE: $0 18x275/minQ2=100 default dat file: $table """ exit 2 fi -if [ $# -ge 3 ]; then table=$3; fi +if [ $# -ge 2 ]; then table=$2; fi # grep for query ("label") -query="$1/minQ2=$2" -xsec=$(grep -w $query $table | awk '{print $2}') +query="$1" +xsec=$(grep -E "^${query} " $table | awk '{print $2}') # not found error if [ -z "$xsec" ]; then diff --git a/src/Analysis.cxx b/src/Analysis.cxx index 68e2a907..a8f7f80a 100644 --- a/src/Analysis.cxx +++ b/src/Analysis.cxx @@ -195,9 +195,9 @@ void Analysis::Prepare() { if (tree == nullptr) tree = file->Get("event_tree"); if (tree == nullptr) { cerr << "ERROR: Couldn't find Delphes or events tree in file '" << fileNames[idx] << "'" << endl; - return; + entries[idx] = 0; } - entries[idx] = tree->GetEntries(); + else entries[idx] = tree->GetEntries(); file->Close(); } } diff --git a/src/AnalysisDelphes.cxx b/src/AnalysisDelphes.cxx index eafd9289..74a51172 100644 --- a/src/AnalysisDelphes.cxx +++ b/src/AnalysisDelphes.cxx @@ -243,7 +243,7 @@ void AnalysisDelphes::Execute() { if(useBreitJets) kin->GetBreitFrameJets(itEFlowTrack, itEFlowPhoton, itEFlowNeutralHadron, itParticle); #endif - Double_t Q2weightFactor = GetEventQ2Weight(kinTrue->Q2, chain->GetTreeNumber()); + Double_t Q2weightFactor = GetEventQ2Weight(kinTrue->Q2, inLookup[chain->GetTreeNumber()]); wJet = Q2weightFactor * weightJet->GetWeight(*kinTrue); // TODO: should we separate weights for breit and non-breit jets? wJetTotal += wJet; diff --git a/src/PostProcessor.cxx b/src/PostProcessor.cxx index 76c6284a..38198f69 100644 --- a/src/PostProcessor.cxx +++ b/src/PostProcessor.cxx @@ -473,9 +473,25 @@ void PostProcessor::DrawInBins( //hist->GetXaxis()->SetLabelSize(0); //hist->GetYaxis()->SetLabelSize(0); - hist->SetLineColor(count+1); hist->SetLineWidth(3); - if(count==0) hist->SetFillColor(kGray); + switch(count) { + case 0: + hist->SetLineColor(kBlack); + hist->SetFillColor(kGray); + break; + case 1: + hist->SetLineColor(kRed); + hist->SetLineStyle(7); + break; + case 2: + hist->SetLineColor(kGreen+2); + hist->SetLineStyle(9); + break; + case 3: + hist->SetLineColor(kAzure); + hist->SetLineStyle(1); + break; + } if(legendLabels.size()>0 && i==0 && j==0) { try { leg->AddEntry(hist,legendLabels[count],"LF"); }