Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 6 examples/pythia8/pythia8_XeXe.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
29 changes: 17 additions & 12 deletions 29 examples/scripts/rich.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
#! /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)}'`
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
Expand All @@ -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
Expand All @@ -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 &&
Expand Down
45 changes: 27 additions & 18 deletions 45 examples/scripts/tof.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
#! /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)}'`
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
Expand All @@ -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}'`
Expand All @@ -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 &&
Expand Down
10 changes: 5 additions & 5 deletions 10 examples/smearing/rich.C
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.);
}
}

Expand Down
47 changes: 38 additions & 9 deletions 47 examples/smearing/tof.C
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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<int, int> pidmap = { {11, 0}, {13, 1}, {211, 2}, {321, 3}, {2212, 4} };

for (Int_t ientry = 0; ientry < numberOfEntries; ++ientry) {
Expand All @@ -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);

Expand Down Expand Up @@ -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) {
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.