forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathO2MCApplicationEvalMat.cxx
More file actions
94 lines (84 loc) · 2.61 KB
/
O2MCApplicationEvalMat.cxx
File metadata and controls
94 lines (84 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include <Steer/O2MCApplicationEvalMat.h>
#include <SimConfig/MatMapParams.h>
#include <Generators/GeneratorGeantinos.h>
#include <TObjArray.h>
#include <TLorentzVector.h>
#include <FairPrimaryGenerator.h>
namespace o2
{
namespace steer
{
void O2MCApplicationEvalMat::FinishPrimary()
{
mMaterialBudgetMap->FinishPrimary(mC1[mMode], mPhi);
FairMCApplication::FinishPrimary();
}
void O2MCApplicationEvalMat::Stepping()
{
// dispatch to MaterialBudget Map
if (fMC->IsNewTrack()) {
TLorentzVector p;
fMC->TrackMomentum(p);
Float_t x, y, z;
fMC->TrackPosition(x, y, z);
mPhi = p.Phi() * 180. / TMath::Pi();
if (mPhi < 0.) {
mPhi += 360.;
}
mC1[0] = p.Theta() * 180. / TMath::Pi();
mC1[1] = p.Eta();
mC1[2] = z;
}
mMaterialBudgetMap->Stepping();
}
void O2MCApplicationEvalMat::BeginEvent()
{
if (!mMaterialBudgetMap) {
auto& p = o2::conf::MatMapParams::Instance();
Float_t c1min, c1max;
Int_t n1;
if (p.ntheta != 0) {
// theta-phi binning
mMode = 0;
n1 = p.ntheta;
c1min = p.thetamin;
c1max = p.thetamax;
} else if (p.neta != 0) {
// eta-phi binning
mMode = 1;
n1 = p.neta;
c1min = p.etamin;
c1max = p.etamax;
} else if (p.nzv != 0) {
// z-phi binning
mMode = 2;
n1 = p.nzv;
c1min = p.zvmin;
c1max = p.zvmax;
}
printf("MaterialBudgetMap: %5d %13.3f %13.3f %5d %13.3f %13.3f %13.3f %13.3f\n", n1, c1min, c1max, p.nphi, p.phimin, p.phimax, p.rmax, p.zmax);
mMaterialBudgetMap = new MaterialBudgetMap("Map", mMode,
n1, c1min, c1max, p.nphi, p.phimin, p.phimax, p.rmin, p.rmax, p.zmax);
auto gen = GetGenerator();
gen->GetListOfGenerators()->Clear();
gen->AddGenerator(new o2::eventgen::GeneratorGeantinos(mMode, n1, c1min, c1max, p.nphi, p.phimin, p.phimax, p.rmin, p.rmax, p.zmax));
}
mMaterialBudgetMap->BeginEvent();
}
void O2MCApplicationEvalMat::FinishEvent()
{
mMaterialBudgetMap->FinishEvent();
O2MCApplicationBase::FinishEvent();
}
} // namespace steer
} // namespace o2