Skip to content

Commit 40a84f6

Browse files
authored
Merge pull request #55 from preghenella/master
Minor updates to examples
2 parents 64504a7 + 592c68c commit 40a84f6

File tree

5 files changed

+90
-47
lines changed

5 files changed

+90
-47
lines changed

examples/pythia8/pythia8_XeXe.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ Beams:idB 1000541290 # Xe
77
Beams:eCM 5860. # GeV
88

99
### heavy-ion settings (valid for Xe-Xe 5860 only)
10-
#HeavyIon:SigFitNGen = 0
11-
#HeavyIon:SigFitDefPar =
12-
#HeavyIon:bWidth =
10+
HeavyIon:SigFitNGen = 0
11+
HeavyIon:SigFitDefPar = 13.85,1.82,0.22,0.0,0.0,0.0,0.0,0.0
12+
#HeavyIon:bWidth = 12.53
1313

1414
### processes (apparently not to be defined)
1515

examples/scripts/rich.sh

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
#! /usr/bin/env bash
22

3-
NJOBS=5 # number of max parallel runs
4-
NRUNS=5 # number of runs
5-
NEVENTS=10000 # number of events in a run
3+
NJOBS=5 # number of max parallel runs
4+
NRUNS=5 # number of runs
5+
NEVENTS=10000 # number of events in a run
66

7-
BFIELD=5. # magnetic field [kG]
8-
RICHRAD=100. # RICH radius [cm]
9-
RICHLEN=200. # RICH half length [cm]
10-
RICHETA=1.443 # RICH max pseudorapidity
7+
LUTTAG="werner" # LUT tag name
8+
PY8CFG="pythia8_ccbar" # pythia8 configuration
9+
BFIELD=5. # magnetic field [kG]
10+
RICHRAD=100. # RICH radius [cm]
11+
RICHLEN=200. # RICH half length [cm]
12+
RICHETA=1.443 # RICH max pseudorapidity
1113

1214
### calculate max eta from geometry
1315
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)}'`
1416
echo "maxEta = $RICHETA"
1517

1618
### copy relevant files in the working directory
1719
cp $DELPHESO2_ROOT/examples/cards/propagate.2kG.tcl propagate.tcl
20+
cp $DELPHESO2_ROOT/examples/pythia8/$PY8CFG.cfg pythia8.cfg
1821
cp $DELPHESO2_ROOT/examples/smearing/rich.C .
19-
cp $DELPHESO2_ROOT/examples/pythia8/pythia8_inel.cfg pythia8.cfg
2022

2123
### adjust pythia8 configuration
24+
echo "" >> pythia8.cfg
25+
echo "### run time configuration" >> pythia8.cfg
2226
echo "Main:numberOfEvents $NEVENTS" >> pythia8.cfg
23-
#echo "Beams:allowVertexSpread on " >> pythia8.cfg
24-
#echo "Beams:sigmaTime 60." >> pythia8.cfg
27+
echo "Beams:allowVertexSpread off " >> pythia8.cfg
28+
echo "Beams:sigmaTime 60." >> pythia8.cfg
2529

2630
### set magnetic field
2731
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
3640

3741
### create LUTs
3842
BFIELDT=`awk -v a=$BFIELD 'BEGIN {print a*0.1}'`
39-
$DELPHESO2_ROOT/examples/scripts/create_luts.sh werner $BFIELDT $TOFRAD
43+
$DELPHESO2_ROOT/examples/scripts/create_luts.sh $LUTTAG $BFIELDT $TOFRAD
4044

4145
### loop over runs
4246
rm -f .running.* delphes.*.root
@@ -54,8 +58,9 @@ for I in $(seq 1 $NRUNS); do
5458

5559
### copy pythia8 configuration and adjust it
5660
cp pythia8.cfg pythia8.$I.cfg
61+
echo "Random:setSeed on" >> pythia8.$I.cfg
5762
echo "Random:seed = $I" >> pythia8.$I.cfg
58-
63+
5964
### run Delphes and analysis
6065
DelphesPythia8 propagate.tcl pythia8.$I.cfg delphes.$I.root &> delphes.$I.log &&
6166
root -b -q -l "rich.C(\"delphes.$I.root\", \"rich.$I.root\")" &> rich.$I.log &&

examples/scripts/tof.sh

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
11
#! /usr/bin/env bash
22

3-
NJOBS=5 # number of max parallel runs
4-
NRUNS=10 # number of runs
5-
NEVENTS=10000 # number of events in a run
3+
NJOBS=5 # number of max parallel runs
4+
NRUNS=10 # number of runs
5+
NEVENTS=10000 # number of events in a run
66

7-
LUTTAG="werner" # LUT tag name
8-
BFIELD=5. # magnetic field [kG]
9-
SIGMAT=0.020 # time resolution [ns]
10-
SIGMA0=0.200 # vertex time spread [ns]
11-
TAILLX=1.0 # tail on left [q]
12-
TAILRX=1.3 # tail on right [q]
13-
TOFRAD=100. # TOF radius [cm]
14-
TOFLEN=200. # TOF half length [cm]
15-
TOFETA=1.443 # TOF max pseudorapidity
7+
LUTTAG="werner" # LUT tag name
8+
PY8CFG="pythia8_ccbar" # pythia8 configuration
9+
BFIELD=5. # magnetic field [kG]
10+
SIGMAT=0.020 # time resolution [ns]
11+
SIGMA0=0.200 # vertex time spread [ns]
12+
TAILLX=1.0 # tail on left [q]
13+
TAILRX=1.0 # tail on right [q]
14+
TOFRAD=100. # TOF radius [cm]
15+
TOFLEN=200. # TOF half length [cm]
16+
TOFETA=1.443 # TOF max pseudorapidity
1617

1718
### calculate max eta from geometry
1819
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)}'`
1920
echo "maxEta = $TOFETA"
2021

2122
### copy relevant files in the working directory
2223
cp $DELPHESO2_ROOT/examples/cards/propagate.2kG.tails.tcl propagate.tcl
23-
cp $DELPHESO2_ROOT/examples/pythia8/pythia8_inel.cfg .
24+
cp $DELPHESO2_ROOT/examples/pythia8/$PY8CFG.cfg pythia8.cfg
2425
cp $DELPHESO2_ROOT/examples/smearing/tof.C .
2526

27+
### adjust pythia8 configuration
28+
echo "" >> pythia8.cfg
29+
echo "### run time configuration" >> pythia8.cfg
30+
echo "Main:numberOfEvents $NEVENTS" >> pythia8.cfg
31+
echo "Beams:allowVertexSpread on " >> pythia8.cfg
32+
echo "Beams:sigmaTime 60." >> pythia8.cfg
33+
2634
### set magnetic field
2735
sed -i -e "s/set barrel_Bz .*$/set barrel_Bz ${BFIELD}e\-1/" propagate.tcl
2836
### set TOF radius
@@ -39,6 +47,9 @@ sed -i -e "s/set barrel_TailRight .*$/set barrel_TailRight ${TAILRX}/" propagate
3947
sed -i -e "s/set barrel_TailLeft .*$/set barrel_TailLeft ${TAILLX}/" propagate.tcl
4048
sed -i -e "s/double tof_sigmat = .*$/double tof_sigmat = ${SIGMAT}\;/" tof.C
4149
sed -i -e "s/double tof_sigma0 = .*$/double tof_sigma0 = ${SIGMA0}\;/" tof.C
50+
### set TOF mismatch information
51+
sed -i -e "s/double tof_mismatch.*$/double tof_mismatch = 0.01;/" tof.C
52+
#sed -i -e "s/std::string tof_mismatch_fname.*$/std::string tof_mismatch_fname = \"tof_mismatch_template.root\";/" tof.C
4253

4354
### create LUTs
4455
BFIELDT=`awk -v a=$BFIELD 'BEGIN {print a*0.1}'`
@@ -58,12 +69,10 @@ for I in $(seq 1 $NRUNS); do
5869
echo " --- starting run $I"
5970
touch .running.$I
6071

61-
### copy pythia8 configuration and adjust it
62-
cp pythia8_inel.cfg pythia8.$I.cfg
63-
echo "Main:numberOfEvents $NEVENTS" >> pythia8.$I.cfg
72+
### copy pythia8 configuration and set random seed
73+
cp pythia8.cfg pythia8.$I.cfg
74+
echo "Random:setSeed on" >> pythia8.$I.cfg
6475
echo "Random:seed = $I" >> pythia8.$I.cfg
65-
echo "Beams:allowVertexSpread on " >> pythia8.$I.cfg
66-
echo "Beams:sigmaTime 60." >> pythia8.$I.cfg
6776

6877
### run Delphes and analysis
6978
DelphesPythia8 propagate.tcl pythia8.$I.cfg delphes.$I.root &> delphes.$I.log &&

examples/smearing/rich.C

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ rich(const char *inputFile = "delphes.root",
3939
smearer.loadTable(2212, "lutCovm.pr.dat");
4040

4141
// logx binning
42-
const Int_t nbins = 80;
42+
const Int_t nbins = 200;
4343
double xmin = 1.e-2;
4444
double xmax = 1.e2;
4545
double logxmin = std::log10(xmin);
@@ -72,11 +72,11 @@ rich(const char *inputFile = "delphes.root",
7272
hRecP[i] = new TH1F(Form("hRecP_%s", pname[i]), ";#it{p} (GeV/#it{c})", nbins, xbins);
7373
hRecPt[i] = new TH1F(Form("hRecPt_%s", pname[i]), ";#it{p} (GeV/#it{c})", nbins, xbins);
7474
hAngleP_true[i] = new TH2F(Form("hAngleP_true_%s", pname[i]), ";#it{p} (GeV/#it{c});#theta (rad)", nbins, xbins, 250, 0., 0.25);
75-
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.);
76-
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.);
75+
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.);
76+
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.);
7777
for (int j = 0; j < 5; ++j) {
78-
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.);
79-
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.);
78+
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.);
79+
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.);
8080
}
8181
}
8282

examples/smearing/tof.C

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ double tof_length = 200.; // [cm]
66
double tof_sigmat = 0.02; // [ns]
77
double tof_sigma0 = 0.20; // [ns]
88

9+
double tof_mismatch = 0.01;
10+
std::string tof_mismatch_fname;
11+
912
void
1013
tof(const char *inputFile = "delphes.root",
1114
const char *outputFile = "tof.root")
@@ -45,23 +48,33 @@ tof(const char *inputFile = "delphes.root",
4548
double logxmax = std::log10(xmax);
4649
double binwidth = (logxmax - logxmin) / nbins;
4750
double xbins[nbins + 1];
48-
xbins[0] = xmin;
49-
for (Int_t i = 1; i <= nbins; ++i)
50-
xbins[i] = xmin + std::pow(10., logxmin + i * binwidth);
51+
for (Int_t i = 0; i <= nbins; ++i)
52+
xbins[i] = std::pow(10., logxmin + i * binwidth);
5153

5254
// histograms
5355
auto hTime0 = new TH1F("hTime0", ";t_{0} (ns)", 1000, -1., 1.);
5456
auto hBetaP = new TH2F("hBetaP", ";#it{p} (GeV/#it{c});#beta", nbins, xbins, 1000, 0.1, 1.1);
57+
TH2 *hHit = new TH2F("hHit", ";#eta;#it{p}_{T} (GeV/#it{c})", 200, -4., 4., nbins, xbins);
5558
TH2 *hNsigmaPt[5], *hNsigmaPt_true[5][5];
5659
const char *pname[5] = {"el", "mu", "pi", "ka", "pr"};
5760
const char *plabel[5] = {"e", "#mu", "#pi", "K", "p"};
5861
for (int i = 0; i < 5; ++i) {
59-
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.);
62+
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.);
6063
for (int j = 0; j < 5; ++j) {
61-
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.);
64+
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.);
6265
}
6366
}
64-
67+
auto hMismatchTemplateOut = new TH1F("hMismatchTemplate", "", 3000., -5., 25.);
68+
69+
// read mismatch template if requested
70+
TH1 *hMismatchTemplateIn = nullptr;
71+
if (!tof_mismatch_fname.empty()) {
72+
auto fmismatch = TFile::Open(tof_mismatch_fname.c_str());
73+
hMismatchTemplateIn = (TH1 *)fmismatch->Get("hMismatchTemplate");
74+
hMismatchTemplateIn->SetDirectory(0);
75+
fmismatch->Close();
76+
}
77+
6578
std::map<int, int> pidmap = { {11, 0}, {13, 1}, {211, 2}, {321, 3}, {2212, 4} };
6679

6780
for (Int_t ientry = 0; ientry < numberOfEntries; ++ientry) {
@@ -80,13 +93,27 @@ tof(const char *inputFile = "delphes.root",
8093
// smear track
8194
if (!smearer.smearTrack(*track)) continue;
8295

96+
// check if has TOF
97+
if (!toflayer.hasTOF(*track)) continue;
98+
99+
// fill output mismatch template
100+
auto L = std::sqrt(track->XOuter * track->XOuter +
101+
track->YOuter * track->YOuter +
102+
track->ZOuter * track->ZOuter);
103+
hMismatchTemplateOut->Fill(track->TOuter * 1.e9 - L / 299.79246);
104+
105+
// do some random mismatch
106+
if (hMismatchTemplateIn && gRandom->Uniform() < tof_mismatch) {
107+
track->TOuter = (hMismatchTemplateIn->GetRandom() + L / 299.79246) * 1.e-9;
108+
}
109+
83110
// select primaries based on 3 sigma DCA cuts
84111
if (fabs(track->D0 / track->ErrorD0) > 3.) continue;
85112
if (fabs(track->DZ / track->ErrorDZ) > 3.) continue;
86113

87-
// check if has TOF
88-
if (!toflayer.hasTOF(*track)) continue;
89-
114+
// fill hit histogram with true (eta,pt)
115+
hHit->Fill(particle->Eta, particle->PT);
116+
90117
// push track
91118
tof_tracks.push_back(track);
92119

@@ -123,6 +150,8 @@ tof(const char *inputFile = "delphes.root",
123150
auto fout = TFile::Open(outputFile, "RECREATE");
124151
hTime0->Write();
125152
hBetaP->Write();
153+
hHit->Write();
154+
hMismatchTemplateOut->Write();
126155
for (int i = 0; i < 5; ++i) {
127156
hNsigmaPt[i]->Write();
128157
for (int j = 0; j < 5; ++j) {

0 commit comments

Comments
 (0)