-
Notifications
You must be signed in to change notification settings - Fork 494
Expand file tree
/
Copy pathCave.cxx
More file actions
173 lines (155 loc) · 6.05 KB
/
Cave.cxx
File metadata and controls
173 lines (155 loc) · 6.05 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
// 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.
/********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence version 3 (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
// -------------------------------------------------------------------------
// ----- Cave file -----
// ----- Created 26/03/14 by M. Al-Turany -----
// -------------------------------------------------------------------------
#include "DetectorsBase/MaterialManager.h"
#include "DetectorsBase/Detector.h"
#include "DetectorsPassive/Cave.h"
#include "SimConfig/SimConfig.h"
#include "SimConfig/SimParams.h"
#include <TRandom.h>
#include <fairlogger/Logger.h>
#include "TGeoManager.h"
#include "TGeoVolume.h"
#include "TGeoPgon.h"
#include "TGeoTube.h"
#include "TGeoCompositeShape.h"
using namespace o2::passive;
void Cave::createMaterials()
{
auto& matmgr = o2::base::MaterialManager::Instance();
// Create materials and media
Int_t isxfld;
Float_t sxmgmx;
o2::base::Detector::initFieldTrackingParams(isxfld, sxmgmx);
LOG(info) << "Field in CAVE: " << isxfld;
// AIR
isxfld = 1;
Float_t aAir[4] = {12.0107, 14.0067, 15.9994, 39.948};
Float_t zAir[4] = {6., 7., 8., 18.};
Float_t wAir[4] = {0.000124, 0.755267, 0.231781, 0.012827};
Float_t dAir = 1.20479E-3 * 960. / 1014.;
//
matmgr.Mixture("CAVE", 2, "Air", aAir, zAir, dAir, 4, wAir);
matmgr.Mixture("CAVE", 3, "Air_NF", aAir, zAir, dAir, 4, wAir);
//
matmgr.Medium("CAVE", 2, "Air", 2, 0, isxfld, sxmgmx, 10, -1, -0.1, 0.1, -10);
matmgr.Medium("CAVE", 3, "Air_NF", 3, 0, 0, sxmgmx, 10, -1, -0.1, 0.1, -10);
}
void Cave::ConstructGeometry()
{
createMaterials();
auto& matmgr = o2::base::MaterialManager::Instance();
auto kMedAir = gGeoManager->GetMedium("CAVE_Air");
Float_t dALIC[3];
if (mHasZDC) {
LOG(info) << "Setting up CAVE to host ZDC";
// dimensions taken from ALIROOT
dALIC[0] = 2500;
dALIC[1] = 2500;
dALIC[2] = 15000;
} else {
LOG(info) << "Setting up CAVE without ZDC";
dALIC[0] = 2000;
dALIC[1] = 2000;
dALIC[2] = 3000;
}
auto cavevol = gGeoManager->MakeBox("cave", kMedAir, dALIC[0], dALIC[1], dALIC[2]);
gGeoManager->SetTopVolume(cavevol);
TGeoPgon* shCaveTR1 = new TGeoPgon("shCaveTR1", 22.5, 360., 8., 2);
shCaveTR1->DefineSection(0, -706. - 8.6, 0., 790.5);
shCaveTR1->DefineSection(1, 707. + 7.6, 0., 790.5);
TGeoTube* shCaveTR2 = new TGeoTube("shCaveTR2", 0., 150., 110.);
TGeoTube* shCaveTR3 = new TGeoTube("shCaveTR3", 0., 80., 75.);
TGeoTranslation* transCaveTR2 = new TGeoTranslation("transTR2", 0, 30., -505. - 110.);
TGeoTranslation* transCaveTR3 = new TGeoTranslation("transTR3", 0, 30., 714.6 + 75.);
transCaveTR2->RegisterYourself();
transCaveTR3->RegisterYourself();
TGeoCompositeShape* shCaveTR = new TGeoCompositeShape("shCaveTR", "shCaveTR1-shCaveTR2:transTR2+shCaveTR3:transTR3");
TGeoVolume* voBarrel = new TGeoVolume("barrel", shCaveTR, kMedAir);
cavevol->AddNode(voBarrel, 1, new TGeoTranslation(0., -30., 0.));
if (mHasRB24) { // should be not true only for alice 3
// mother volume for RB24 side (FDD, Compensator)
const Float_t kRB24CL = 2. * 597.9 - 150.;
auto shCaveRB24 = new TGeoPcon(0., 360., 6);
Float_t z0 = kRB24CL / 2 + 714.6 + 150.;
shCaveRB24->DefineSection(0, -kRB24CL / 2., 0., 105.);
shCaveRB24->DefineSection(1, -z0 + 1705., 0., 105.);
shCaveRB24->DefineSection(2, -z0 + 1705., 0., 14.5);
shCaveRB24->DefineSection(3, -z0 + 1878, 0., 14.5);
shCaveRB24->DefineSection(4, -z0 + 1878., 0., 40.0);
shCaveRB24->DefineSection(5, kRB24CL / 2., 0., 40.0);
TGeoVolume* caveRB24 = new TGeoVolume("caveRB24", shCaveRB24, kMedAir);
caveRB24->SetVisibility(0);
cavevol->AddNode(caveRB24, 1, new TGeoTranslation(0., 0., z0));
} else {
LOGP(info, "Setting up CAVE without RB24");
}
//
}
Cave::Cave() : FairDetector() {}
Cave::~Cave() = default;
Cave::Cave(const char* name, const char* Title) : FairDetector(name, Title, -1) {}
Cave::Cave(const Cave& rhs) : FairDetector(rhs) {}
Cave& Cave::operator=(const Cave& rhs)
{
// self assignment
if (this == &rhs) {
return *this;
}
// base class assignment
FairModule::operator=(rhs);
return *this;
}
FairModule* Cave::CloneModule() const { return new Cave(*this); }
void Cave::FinishPrimary()
{
LOG(debug) << "CAVE: Primary finished";
for (auto& f : mFinishPrimaryHooks) {
f();
}
}
// we set the random number generator for each
// primary in order to be reproducible in a multi-processing sub-event
// setting
void Cave::BeginPrimary()
{
static int primcounter = 0;
// only do it, if not in pure trackSeeding mode
if (!o2::conf::SimCutParams::Instance().trackSeed) {
auto& conf = o2::conf::SimConfig::Instance();
auto chunks = conf.getInternalChunkSize();
if (chunks != -1) {
if (primcounter % chunks == 0) {
static int counter = 1;
auto seed = counter + 10;
gRandom->SetSeed(seed);
counter++;
}
}
}
primcounter++;
}
bool Cave::ProcessHits(FairVolume*)
{
LOG(fatal) << "CAVE ProcessHits called; should never happen";
return false;
}
ClassImp(o2::passive::Cave);