Skip to content

Commit d3a0aed

Browse files
aphecetchesawenzel
authored andcommitted
First version of MCH geometry and MCH hits. (#1144)
First version of MCH geometry and MCH hits.
1 parent 259aaea commit d3a0aed

31 files changed

Lines changed: 6131 additions & 19 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ compile_commands.json
6161
.ycm_extra_conf.py
6262

6363
# Datafiles
64+
gphysi.dat
6465
*.root
6566
*.o2tf
6667

Detectors/MUON/MCH/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ add_subdirectory(Base)
22
add_subdirectory(Contour)
33
add_subdirectory(Mapping)
44
add_subdirectory(PreClustering)
5+
add_subdirectory(Simulation)

Detectors/MUON/MCH/Contour/include/MCHContour/Helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include <cmath>
1818
#include <limits>
19+
#include <cstdint>
1920

2021
namespace o2
2122
{
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
set(MODULE_NAME "MCHSimulation")
2+
3+
O2_SETUP(NAME ${MODULE_NAME})
4+
5+
set(SRCS
6+
src/Detector.cxx
7+
src/Geometry.cxx
8+
src/GeometryTest.cxx
9+
src/Hit.cxx
10+
src/Materials.cxx
11+
src/Materials.h
12+
src/Station1Geometry.cxx
13+
src/Station1Geometry.h
14+
src/Station2Geometry.cxx
15+
src/Station2Geometry.h
16+
src/Station345Geometry.cxx
17+
src/Station345Geometry.h
18+
src/Stepper.cxx
19+
src/Stepper.h
20+
)
21+
22+
set(HEADERS
23+
include/${MODULE_NAME}/Detector.h
24+
include/${MODULE_NAME}/Geometry.h
25+
include/${MODULE_NAME}/GeometryTest.h
26+
include/${MODULE_NAME}/Hit.h
27+
)
28+
29+
SET(LINKDEF src/MCHSimulationLinkDef.h)
30+
Set(LIBRARY_NAME ${MODULE_NAME})
31+
set(BUCKET_NAME mch_simulation_bucket)
32+
33+
O2_GENERATE_LIBRARY()
34+
35+
if(BUILD_TESTING)
36+
add_subdirectory(test)
37+
endif()
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
#ifndef O2_MCH_SIMULATION_DETECTOR_H
12+
#define O2_MCH_SIMULATION_DETECTOR_H
13+
14+
#include "DetectorsBase/Detector.h"
15+
#include "MCHSimulation/Hit.h"
16+
#include <vector>
17+
#include <memory>
18+
19+
namespace o2
20+
{
21+
namespace mch
22+
{
23+
24+
class Stepper;
25+
26+
class Detector : public o2::Base::DetImpl<Detector>
27+
{
28+
public:
29+
Detector(bool active = true);
30+
31+
~Detector() override;
32+
33+
Bool_t ProcessHits(FairVolume* v = nullptr) override;
34+
35+
void Initialize() override;
36+
37+
void Register() override;
38+
39+
void Reset() override {}
40+
41+
void ConstructGeometry() override;
42+
43+
std::vector<o2::mch::Hit>* getHits(int);
44+
45+
void EndOfEvent() override;
46+
47+
private:
48+
void defineSensitiveVolumes();
49+
50+
private:
51+
o2::mch::Stepper* mStepper{ nullptr }; //!
52+
53+
ClassDefOverride(Detector, 1);
54+
};
55+
56+
} // namespace mch
57+
} // namespace o2
58+
59+
#endif
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// @file Geometry.h
12+
/// @brief Interface for MCH geometry creation
13+
14+
#ifndef O2_MCH_SIMULATION_GEOMETRY_H
15+
#define O2_MCH_SIMULATION_GEOMETRY_H
16+
17+
#include <vector>
18+
#include <iostream>
19+
#include "MathUtils/Cartesian3D.h"
20+
21+
class TGeoVolume;
22+
class TGeoManager;
23+
24+
namespace o2
25+
{
26+
namespace mch
27+
{
28+
29+
/// createGeometry creates MCH geometry and attach it to existing topVolume
30+
void createGeometry(TGeoVolume& topVolume);
31+
32+
/// get a list of MCH sensitive volumes
33+
std::vector<TGeoVolume*> getSensitiveVolumes();
34+
35+
/// get the local-to-global transformation for a given detection element
36+
o2::Transform3D getTransformation(int detElemId, const TGeoManager& geo);
37+
38+
} // namespace mch
39+
} // namespace o2
40+
41+
#endif // O2_MCH_SIMULATION_GEOMETRY_H
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
#ifndef O2_MCH_SIMULATION_GEOMETRYTEST_H
12+
#define O2_MCH_SIMULATION_GEOMETRYTEST_H
13+
14+
#include <iostream>
15+
16+
class TH2;
17+
18+
namespace o2
19+
{
20+
namespace mch
21+
{
22+
namespace test
23+
{
24+
25+
/// creates MCH geometry from scratch (i.e. from a null TGeoManager)
26+
/// usefull for tests or drawing for instance.
27+
void createStandaloneGeometry();
28+
29+
/// tree like textual dump of the geometry nodes
30+
void showGeometryAsTextTree(const char* fromPath = "", int maxdepth = 2, std::ostream& out = std::cout);
31+
32+
/// basic drawing of the geometry
33+
void drawGeometry();
34+
35+
/// set the volume and daughter visibility for all volumes with a name matching the regexp pattern
36+
void setVolumeVisibility(const char* pattern, bool visible, bool visibleDaughters);
37+
38+
/// set the volume line and fill for all volumes with a name matching the regexp pattern
39+
void setVolumeColor(const char* pattern, int lineColor, int fillColor);
40+
inline void setVolumeColor(const char* pattern, int color)
41+
{
42+
setVolumeColor(pattern, color, color);
43+
}
44+
45+
/// get a radlen radiograph of a given detection element within box with the given granularity
46+
TH2* getRadio(int detElemId, float xmin, float ymin, float xmax, float ymax, float xstep, float ystep, float thickness = 5 /* cm */);
47+
48+
class Dummy
49+
{
50+
// to force Root produce a dictionary for namespace test (seems it is doing it fully if there are only functions in the namespace)
51+
};
52+
} // namespace test
53+
} // namespace mch
54+
} // namespace o2
55+
56+
#endif
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
#ifndef O2_MCH_SIMULATION_HIT_H
12+
#define O2_MCH_SIMULATION_HIT_H
13+
14+
#include "SimulationDataFormat/BaseHits.h"
15+
16+
namespace o2
17+
{
18+
namespace mch
19+
{
20+
21+
class Hit : public ::o2::BasicXYZEHit<float>
22+
{
23+
24+
public:
25+
Hit(int trackId = 0, short detElemId = 0, Point3D<float> entrancePoint = {}, const Point3D<float> exitPoint = {},
26+
float eloss = 0.0, float length = 0.0, float tof = 0.0)
27+
: ::o2::BasicXYZEHit<float>(entrancePoint.x(), entrancePoint.y(), entrancePoint.z(), tof, eloss, trackId, detElemId), mLength{ length }, mExitPoint(exitPoint)
28+
{
29+
}
30+
31+
Point3D<float> entrancePoint() const { return GetPos(); }
32+
Point3D<float> exitPoint() const { return mExitPoint; }
33+
34+
float detElemId() const { return GetDetectorID(); }
35+
36+
private:
37+
float mLength = {};
38+
Point3D<float> mExitPoint = {};
39+
ClassDefNV(Hit, 1);
40+
};
41+
42+
} // namespace mch
43+
} // namespace o2
44+
45+
#endif
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#if !defined(__CLING__) || defined(__ROOTCLING__)
2+
#include "MCHSimulation/GeometryTest.h"
3+
#endif
4+
5+
void drawMCHGeometry()
6+
{
7+
o2::mch::test::drawGeometry();
8+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
gSystem->Load("libMCHSimulation");
3+
gSystem->SetIncludePath(gSystem->Getenv("ROOT_INCLUDE_PATH"));
4+
}

0 commit comments

Comments
 (0)