From c5b3845eff5b8a41580bbc4278cdfc71190d3cf0 Mon Sep 17 00:00:00 2001 From: Roberto Preghenella Date: Fri, 9 Apr 2021 11:58:03 +0200 Subject: [PATCH 1/3] Add pythia8 XeXe HI parameters to speed up init --- examples/pythia8/pythia8_XeXe.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/pythia8/pythia8_XeXe.cfg b/examples/pythia8/pythia8_XeXe.cfg index 9a285d6..9c23e26 100644 --- a/examples/pythia8/pythia8_XeXe.cfg +++ b/examples/pythia8/pythia8_XeXe.cfg @@ -7,9 +7,9 @@ Beams:idB 1000541290 # Xe Beams:eCM 5860. # GeV ### heavy-ion settings (valid for Xe-Xe 5860 only) -#HeavyIon:SigFitNGen = 0 -#HeavyIon:SigFitDefPar = -#HeavyIon:bWidth = +HeavyIon:SigFitNGen = 0 +HeavyIon:SigFitDefPar = 13.85,1.82,0.22,0.0,0.0,0.0,0.0,0.0 +#HeavyIon:bWidth = 12.53 ### processes (apparently not to be defined) From 9b73f2de6e1c6fe14e2b8d23fc1ed7208ebee9ec Mon Sep 17 00:00:00 2001 From: Roberto Preghenella Date: Fri, 9 Apr 2021 12:04:52 +0200 Subject: [PATCH 2/3] Initial work to bring TOF mismatch to public --- examples/scripts/tof.sh | 45 +++++++++++++++++++++++---------------- examples/smearing/tof.C | 47 +++++++++++++++++++++++++++++++++-------- 2 files changed, 65 insertions(+), 27 deletions(-) diff --git a/examples/scripts/tof.sh b/examples/scripts/tof.sh index bc585cf..3630960 100755 --- a/examples/scripts/tof.sh +++ b/examples/scripts/tof.sh @@ -1,18 +1,19 @@ #! /usr/bin/env bash -NJOBS=5 # number of max parallel runs -NRUNS=10 # number of runs -NEVENTS=10000 # number of events in a run +NJOBS=5 # number of max parallel runs +NRUNS=10 # number of runs +NEVENTS=10000 # number of events in a run -LUTTAG="werner" # LUT tag name -BFIELD=5. # magnetic field [kG] -SIGMAT=0.020 # time resolution [ns] -SIGMA0=0.200 # vertex time spread [ns] -TAILLX=1.0 # tail on left [q] -TAILRX=1.3 # tail on right [q] -TOFRAD=100. # TOF radius [cm] -TOFLEN=200. # TOF half length [cm] -TOFETA=1.443 # TOF max pseudorapidity +LUTTAG="werner" # LUT tag name +PY8CFG="pythia8_ccbar" # pythia8 configuration +BFIELD=5. # magnetic field [kG] +SIGMAT=0.020 # time resolution [ns] +SIGMA0=0.200 # vertex time spread [ns] +TAILLX=1.0 # tail on left [q] +TAILRX=1.0 # tail on right [q] +TOFRAD=100. # TOF radius [cm] +TOFLEN=200. # TOF half length [cm] +TOFETA=1.443 # TOF max pseudorapidity ### calculate max eta from geometry TOFETA=`awk -v a=$TOFRAD -v b=$TOFLEN 'BEGIN {th=atan2(a,b)*0.5; sth=sin(th); cth=cos(th); print -log(sth/cth)}'` @@ -20,9 +21,16 @@ echo "maxEta = $TOFETA" ### copy relevant files in the working directory cp $DELPHESO2_ROOT/examples/cards/propagate.2kG.tails.tcl propagate.tcl -cp $DELPHESO2_ROOT/examples/pythia8/pythia8_inel.cfg . +cp $DELPHESO2_ROOT/examples/pythia8/$PY8CFG.cfg pythia8.cfg cp $DELPHESO2_ROOT/examples/smearing/tof.C . +### adjust pythia8 configuration +echo "" >> pythia8.cfg +echo "### run time configuration" >> pythia8.cfg +echo "Main:numberOfEvents $NEVENTS" >> pythia8.cfg +echo "Beams:allowVertexSpread on " >> pythia8.cfg +echo "Beams:sigmaTime 60." >> pythia8.cfg + ### set magnetic field sed -i -e "s/set barrel_Bz .*$/set barrel_Bz ${BFIELD}e\-1/" propagate.tcl ### set TOF radius @@ -39,6 +47,9 @@ sed -i -e "s/set barrel_TailRight .*$/set barrel_TailRight ${TAILRX}/" propagate sed -i -e "s/set barrel_TailLeft .*$/set barrel_TailLeft ${TAILLX}/" propagate.tcl sed -i -e "s/double tof_sigmat = .*$/double tof_sigmat = ${SIGMAT}\;/" tof.C sed -i -e "s/double tof_sigma0 = .*$/double tof_sigma0 = ${SIGMA0}\;/" tof.C +### set TOF mismatch information +sed -i -e "s/double tof_mismatch.*$/double tof_mismatch = 0.01;/" tof.C +#sed -i -e "s/std::string tof_mismatch_fname.*$/std::string tof_mismatch_fname = \"tof_mismatch_template.root\";/" tof.C ### create LUTs BFIELDT=`awk -v a=$BFIELD 'BEGIN {print a*0.1}'` @@ -58,12 +69,10 @@ for I in $(seq 1 $NRUNS); do echo " --- starting run $I" touch .running.$I - ### copy pythia8 configuration and adjust it - cp pythia8_inel.cfg pythia8.$I.cfg - echo "Main:numberOfEvents $NEVENTS" >> pythia8.$I.cfg + ### copy pythia8 configuration and set random seed + cp pythia8.cfg pythia8.$I.cfg + echo "Random:setSeed on" >> pythia8.$I.cfg echo "Random:seed = $I" >> pythia8.$I.cfg - echo "Beams:allowVertexSpread on " >> pythia8.$I.cfg - echo "Beams:sigmaTime 60." >> pythia8.$I.cfg ### run Delphes and analysis DelphesPythia8 propagate.tcl pythia8.$I.cfg delphes.$I.root &> delphes.$I.log && diff --git a/examples/smearing/tof.C b/examples/smearing/tof.C index c871ca2..24d1605 100644 --- a/examples/smearing/tof.C +++ b/examples/smearing/tof.C @@ -6,6 +6,9 @@ double tof_length = 200.; // [cm] double tof_sigmat = 0.02; // [ns] double tof_sigma0 = 0.20; // [ns] +double tof_mismatch = 0.01; +std::string tof_mismatch_fname; + void tof(const char *inputFile = "delphes.root", const char *outputFile = "tof.root") @@ -45,23 +48,33 @@ tof(const char *inputFile = "delphes.root", double logxmax = std::log10(xmax); double binwidth = (logxmax - logxmin) / nbins; double xbins[nbins + 1]; - xbins[0] = xmin; - for (Int_t i = 1; i <= nbins; ++i) - xbins[i] = xmin + std::pow(10., logxmin + i * binwidth); + for (Int_t i = 0; i <= nbins; ++i) + xbins[i] = std::pow(10., logxmin + i * binwidth); // histograms auto hTime0 = new TH1F("hTime0", ";t_{0} (ns)", 1000, -1., 1.); auto hBetaP = new TH2F("hBetaP", ";#it{p} (GeV/#it{c});#beta", nbins, xbins, 1000, 0.1, 1.1); + TH2 *hHit = new TH2F("hHit", ";#eta;#it{p}_{T} (GeV/#it{c})", 200, -4., 4., nbins, xbins); TH2 *hNsigmaPt[5], *hNsigmaPt_true[5][5]; const char *pname[5] = {"el", "mu", "pi", "ka", "pr"}; const char *plabel[5] = {"e", "#mu", "#pi", "K", "p"}; for (int i = 0; i < 5; ++i) { - hNsigmaPt[i] = new TH2F(Form("hNsigmaPt_%s", pname[i]), Form(";#it{p_{T}} (GeV/#it{c});n#sigma_{%s}", plabel[i]), nbins, xbins, 200, -10., 10.); + hNsigmaPt[i] = new TH2F(Form("hNsigmaPt_%s", pname[i]), Form(";#it{p_{T}} (GeV/#it{c});n#sigma_{%s}", plabel[i]), nbins, xbins, 500, -25., 25.); for (int j = 0; j < 5; ++j) { - hNsigmaPt_true[i][j] = new TH2F(Form("hNsigmaPt_%s_true_%s", pname[i], pname[j]), Form(";#it{p_{T}} (GeV/#it{c});n#sigma_{%s}", plabel[i]), nbins, xbins, 200, -10., 10.); + hNsigmaPt_true[i][j] = new TH2F(Form("hNsigmaPt_%s_true_%s", pname[i], pname[j]), Form(";#it{p_{T}} (GeV/#it{c});n#sigma_{%s}", plabel[i]), nbins, xbins, 500, -25., 25.); } } - + auto hMismatchTemplateOut = new TH1F("hMismatchTemplate", "", 3000., -5., 25.); + + // read mismatch template if requested + TH1 *hMismatchTemplateIn = nullptr; + if (!tof_mismatch_fname.empty()) { + auto fmismatch = TFile::Open(tof_mismatch_fname.c_str()); + hMismatchTemplateIn = (TH1 *)fmismatch->Get("hMismatchTemplate"); + hMismatchTemplateIn->SetDirectory(0); + fmismatch->Close(); + } + std::map pidmap = { {11, 0}, {13, 1}, {211, 2}, {321, 3}, {2212, 4} }; for (Int_t ientry = 0; ientry < numberOfEntries; ++ientry) { @@ -80,13 +93,27 @@ tof(const char *inputFile = "delphes.root", // smear track if (!smearer.smearTrack(*track)) continue; + // check if has TOF + if (!toflayer.hasTOF(*track)) continue; + + // fill output mismatch template + auto L = std::sqrt(track->XOuter * track->XOuter + + track->YOuter * track->YOuter + + track->ZOuter * track->ZOuter); + hMismatchTemplateOut->Fill(track->TOuter * 1.e9 - L / 299.79246); + + // do some random mismatch + if (hMismatchTemplateIn && gRandom->Uniform() < tof_mismatch) { + track->TOuter = (hMismatchTemplateIn->GetRandom() + L / 299.79246) * 1.e-9; + } + // select primaries based on 3 sigma DCA cuts if (fabs(track->D0 / track->ErrorD0) > 3.) continue; if (fabs(track->DZ / track->ErrorDZ) > 3.) continue; - // check if has TOF - if (!toflayer.hasTOF(*track)) continue; - + // fill hit histogram with true (eta,pt) + hHit->Fill(particle->Eta, particle->PT); + // push track tof_tracks.push_back(track); @@ -123,6 +150,8 @@ tof(const char *inputFile = "delphes.root", auto fout = TFile::Open(outputFile, "RECREATE"); hTime0->Write(); hBetaP->Write(); + hHit->Write(); + hMismatchTemplateOut->Write(); for (int i = 0; i < 5; ++i) { hNsigmaPt[i]->Write(); for (int j = 0; j < 5; ++j) { From 592c68c84c48d1af3adbae180d9254a40270cf18 Mon Sep 17 00:00:00 2001 From: Roberto Preghenella Date: Fri, 9 Apr 2021 12:40:21 +0200 Subject: [PATCH 3/3] Improvements to RICH examples --- examples/scripts/rich.sh | 29 +++++++++++++++++------------ examples/smearing/rich.C | 10 +++++----- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/examples/scripts/rich.sh b/examples/scripts/rich.sh index 0a9717a..022d4fe 100755 --- a/examples/scripts/rich.sh +++ b/examples/scripts/rich.sh @@ -1,13 +1,15 @@ #! /usr/bin/env bash -NJOBS=5 # number of max parallel runs -NRUNS=5 # number of runs -NEVENTS=10000 # number of events in a run +NJOBS=5 # number of max parallel runs +NRUNS=5 # number of runs +NEVENTS=10000 # number of events in a run -BFIELD=5. # magnetic field [kG] -RICHRAD=100. # RICH radius [cm] -RICHLEN=200. # RICH half length [cm] -RICHETA=1.443 # RICH max pseudorapidity +LUTTAG="werner" # LUT tag name +PY8CFG="pythia8_ccbar" # pythia8 configuration +BFIELD=5. # magnetic field [kG] +RICHRAD=100. # RICH radius [cm] +RICHLEN=200. # RICH half length [cm] +RICHETA=1.443 # RICH max pseudorapidity ### calculate max eta from geometry RICHETA=`awk -v a=$RICHRAD -v b=$RICHLEN 'BEGIN {th=atan2(a,b)*0.5; sth=sin(th); cth=cos(th); print -log(sth/cth)}'` @@ -15,13 +17,15 @@ echo "maxEta = $RICHETA" ### copy relevant files in the working directory cp $DELPHESO2_ROOT/examples/cards/propagate.2kG.tcl propagate.tcl +cp $DELPHESO2_ROOT/examples/pythia8/$PY8CFG.cfg pythia8.cfg cp $DELPHESO2_ROOT/examples/smearing/rich.C . -cp $DELPHESO2_ROOT/examples/pythia8/pythia8_inel.cfg pythia8.cfg ### adjust pythia8 configuration +echo "" >> pythia8.cfg +echo "### run time configuration" >> pythia8.cfg echo "Main:numberOfEvents $NEVENTS" >> pythia8.cfg -#echo "Beams:allowVertexSpread on " >> pythia8.cfg -#echo "Beams:sigmaTime 60." >> pythia8.cfg +echo "Beams:allowVertexSpread off " >> pythia8.cfg +echo "Beams:sigmaTime 60." >> pythia8.cfg ### set magnetic field sed -i -e "s/set barrel_Bz .*$/set barrel_Bz ${BFIELD}e\-1/" propagate.tcl @@ -36,7 +40,7 @@ sed -i -e "s/set barrel_Acceptance .*$/set barrel_Acceptance \{ 0.0 + 1.0 * fabs ### create LUTs BFIELDT=`awk -v a=$BFIELD 'BEGIN {print a*0.1}'` -$DELPHESO2_ROOT/examples/scripts/create_luts.sh werner $BFIELDT $TOFRAD +$DELPHESO2_ROOT/examples/scripts/create_luts.sh $LUTTAG $BFIELDT $TOFRAD ### loop over runs rm -f .running.* delphes.*.root @@ -54,8 +58,9 @@ for I in $(seq 1 $NRUNS); do ### copy pythia8 configuration and adjust it cp pythia8.cfg pythia8.$I.cfg + echo "Random:setSeed on" >> pythia8.$I.cfg echo "Random:seed = $I" >> pythia8.$I.cfg - + ### run Delphes and analysis DelphesPythia8 propagate.tcl pythia8.$I.cfg delphes.$I.root &> delphes.$I.log && root -b -q -l "rich.C(\"delphes.$I.root\", \"rich.$I.root\")" &> rich.$I.log && diff --git a/examples/smearing/rich.C b/examples/smearing/rich.C index bef8aba..6d1cd36 100644 --- a/examples/smearing/rich.C +++ b/examples/smearing/rich.C @@ -39,7 +39,7 @@ rich(const char *inputFile = "delphes.root", smearer.loadTable(2212, "lutCovm.pr.dat"); // logx binning - const Int_t nbins = 80; + const Int_t nbins = 200; double xmin = 1.e-2; double xmax = 1.e2; double logxmin = std::log10(xmin); @@ -72,11 +72,11 @@ rich(const char *inputFile = "delphes.root", hRecP[i] = new TH1F(Form("hRecP_%s", pname[i]), ";#it{p} (GeV/#it{c})", nbins, xbins); hRecPt[i] = new TH1F(Form("hRecPt_%s", pname[i]), ";#it{p} (GeV/#it{c})", nbins, xbins); hAngleP_true[i] = new TH2F(Form("hAngleP_true_%s", pname[i]), ";#it{p} (GeV/#it{c});#theta (rad)", nbins, xbins, 250, 0., 0.25); - hNsigmaP[i] = new TH2F(Form("hNsigmaP_%s", pname[i]), Form(";#it{p} (GeV/#it{c});n#sigma_{%s}", plabel[i]), nbins, xbins, 200, -10., 10.); - hNsigmaPt[i] = new TH2F(Form("hNsigmaPt_%s", pname[i]), Form(";#it{p_{T}} (GeV/#it{c});n#sigma_{%s}", plabel[i]), nbins, xbins, 200, -10., 10.); + hNsigmaP[i] = new TH2F(Form("hNsigmaP_%s", pname[i]), Form(";#it{p} (GeV/#it{c});n#sigma_{%s}", plabel[i]), nbins, xbins, 500, -25., 25.); + hNsigmaPt[i] = new TH2F(Form("hNsigmaPt_%s", pname[i]), Form(";#it{p_{T}} (GeV/#it{c});n#sigma_{%s}", plabel[i]), nbins, xbins, 500, -25., 25.); for (int j = 0; j < 5; ++j) { - hNsigmaP_true[i][j] = new TH2F(Form("hNsigmaP_%s_true_%s", pname[i], pname[j]), Form(";#it{p} (GeV/#it{c});n#sigma_{%s}", plabel[i]), nbins, xbins, 200, -10., 10.); - hNsigmaPt_true[i][j] = new TH2F(Form("hNsigmaPt_%s_true_%s", pname[i], pname[j]), Form(";#it{p_{T}} (GeV/#it{c});n#sigma_{%s}", plabel[i]), nbins, xbins, 200, -10., 10.); + hNsigmaP_true[i][j] = new TH2F(Form("hNsigmaP_%s_true_%s", pname[i], pname[j]), Form(";#it{p} (GeV/#it{c});n#sigma_{%s}", plabel[i]), nbins, xbins, 500, -25., 25.); + hNsigmaPt_true[i][j] = new TH2F(Form("hNsigmaPt_%s_true_%s", pname[i], pname[j]), Form(";#it{p_{T}} (GeV/#it{c});n#sigma_{%s}", plabel[i]), nbins, xbins, 500, -25., 25.); } }