1
/* This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus
3
* MAUS is free software: you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License as published by
5
* the Free Software Foundation, either version 3 of the License, or
6
* (at your option) any later version.
8
* MAUS is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with MAUS. If not, see <http://www.gnu.org/licenses/>.
18
#include <G4VPhysicalVolume.hh>
19
#include <G4VSolid.hh>
20
#include <G4Material.hh>
21
#include <G4Element.hh>
22
#include <G4LogicalVolume.hh>
23
#include <G4ThreeVector.hh>
24
#include <G4PVPlacement.hh>
26
#include <G4SDManager.hh>
27
#include <G4UserLimits.hh>
29
#include <G4PVParameterised.hh>
33
#include "src/legacy/Config/MiceModule.hh"
35
#include "src/common_cpp/DetModel/SciFi/SciFiPlane.hh"
37
#include "gtest/gtest.h"
38
#include "CLHEP/Random/Random.h"
41
class SciFiPlaneTest : public ::testing::Test {
44
G4double innerRadiusOfTheTube = 0.*cm;
45
G4double outerRadiusOfTheTube = 30.*cm;
46
G4double hightOfTheTube = 1.*m;
47
G4double startAngleOfTheTube = 0.*deg;
48
G4double spanningAngleOfTheTube = 360.*deg;
50
G4Tubs* tracker_tube = new G4Tubs("tracker_tube",
55
spanningAngleOfTheTube);
57
G4LogicalVolume* tracker_log
58
= new G4LogicalVolume(tracker_tube, mat, "tracker_log");
62
tracker = new G4PVPlacement(0, G4ThreeVector(),
66
virtual ~SciFiPlaneTest() {}
67
virtual void SetUp() {}
68
virtual void TearDown() {}
70
G4PVPlacement* tracker;
74
TEST_F(SciFiPlaneTest, Test_num_fibres_in_all_planes) {
76
filename = "Stage6.dat";
77
std::vector<const MiceModule*> modules;
79
_module = new MiceModule(filename);
80
modules = _module->findModulesByPropertyString("SensitiveDetector", "SciFi");
82
for ( int trackerNo = 0; trackerNo < 2; trackerNo++ ) {
83
for ( int stationNo = 1; stationNo < 6; stationNo++ ) {
84
for ( int planeNo = 0; planeNo < 3; planeNo++ ) {
85
// get the SciFi Modules
87
const MiceModule* this_plane = NULL;
88
for ( unsigned int j = 0; !this_plane && j < modules.size(); ++j ) {
89
// find the module corresponding to this plane
90
if ( modules[j]->propertyExists("Tracker", "int") &&
91
modules[j]->propertyExists("Station", "int") &&
92
modules[j]->propertyExists("Plane", "int") &&
93
modules[j]->propertyInt("Tracker") == trackerNo &&
94
modules[j]->propertyInt("Station") == stationNo &&
95
modules[j]->propertyInt("Plane") == planeNo )
97
this_plane = modules[j];
99
assert(this_plane != NULL);
101
// arguments are the plane module, material and mother physical volume
102
MiceModule* aplane = const_cast < MiceModule* > (this_plane);
103
SciFiPlane(aplane, mat, tracker);
105
// plane 0 (view v), plane 1 (view x), plane 2 (view w)
106
if ( trackerNo == 0 && stationNo == 5 && planeNo == 1 )
107
EXPECT_EQ(SciFiPlane::SciFi_numFibres, 215*7);
108
if ( planeNo == 0 || planeNo == 2 )
109
EXPECT_EQ(SciFiPlane::SciFi_numFibres, 214*7);
110
if ( planeNo == 1 && !(trackerNo == 0 && stationNo == 5) )
111
EXPECT_EQ(SciFiPlane::SciFi_numFibres, 212*7);