FairShip
Loading...
Searching...
No Matches
vetoHit.cxx
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// SPDX-FileCopyrightText: Copyright CERN for the benefit of the SHiP
3// Collaboration
4
5#include "vetoHit.h"
6
7#include <cmath>
8#include <iostream>
9
10#include "FairLogger.h" // for FairLogger, etc
11#include "FairRun.h"
12#include "FairRunSim.h"
13#include "TGeoArb8.h"
14#include "TGeoManager.h"
15#include "TGeoPhysicalNode.h"
16#include "TMath.h"
17#include "TRandom1.h"
18#include "TRandom3.h"
19#include "TVector3.h"
20#include "veto.h"
21#include "vetoPoint.h"
22
23// ----- Default constructor -------------------------------------------
24vetoHit::vetoHit() : SHiP::DetectorHit() {}
25// ----- Standard constructor ------------------------------------------
26vetoHit::vetoHit(Int_t detID, Float_t adc) : SHiP::DetectorHit(detID, adc) {}
27
28// -------------------------------------------------------------------------
29
30// -------------------------------------------------------------------------
31
32TVector3 vetoHit::GetXYZ() const {
33 TGeoNavigator* nav = gGeoManager->GetCurrentNavigator();
34 TGeoNode* node = GetNode();
35 TGeoVolume* volume = node->GetVolume();
36 TGeoBBox* shape = dynamic_cast<TGeoBBox*>(volume->GetShape());
37 Double_t origin[3] = {shape->GetOrigin()[0], shape->GetOrigin()[1],
38 shape->GetOrigin()[2]};
39 Double_t master[3] = {0, 0, 0};
40 nav->LocalToMaster(origin, master);
41 TVector3 pos = TVector3(master[0], master[1], master[2]);
42 return pos;
43}
44
45Double_t vetoHit::GetX() const {
46 TVector3 pos = GetXYZ();
47 return pos.X();
48}
49Double_t vetoHit::GetY() const {
50 TVector3 pos = GetXYZ();
51 return pos.Y();
52}
53Double_t vetoHit::GetZ() const {
54 TVector3 pos = GetXYZ();
55 return pos.Z();
56}
57TGeoNode* vetoHit::GetNode() const {
58 TGeoNode* node;
59 TGeoNavigator* nav = gGeoManager->GetCurrentNavigator();
60 TString path = "cave/DecayVolume_1/T2_1/VetoLiSc_0/";
61 // id = ShapeType*100000 + blockNr*10000 + Zlayer*100 + number*10 + position;
62
63 Int_t ShapeType = fDetectorID / 100000;
64 Int_t blockNr = (fDetectorID % 100000) / 10000;
65 Int_t Zlayer = (fDetectorID % 10000) / 100;
66 Int_t number = (fDetectorID % 100) / 10;
67 // Int_t position = (fDetectorID % 10);
68
69 if (ShapeType == 1)
70 path += "LiScX_";
71 else if (ShapeType == 2)
72 path += "LiScY_";
73 else if (ShapeType == 3)
74 path += "LiSc_S3_";
75 else if (ShapeType == 4)
76 path += "LiSc_S4_";
77 else if (ShapeType == 5)
78 path += "LiSc_S5_";
79 else if (ShapeType == 6)
80 path += "LiSc_S6_";
81
82 path += ShapeType;
83 path += blockNr;
84 if (Zlayer < 10) path += "0";
85 path += Zlayer;
86 path += number;
87 path += "0_";
88 path += fDetectorID;
89
90 nav->cd(path);
91 node = nav->GetCurrentNode();
92 return node;
93}
94
95// ----- Public method Print -------------------------------------------
96void vetoHit::Print(Int_t detID) const {
97 LOG(info) << "vetoHit: veto hit "
98 << " in detector " << fDetectorID;
99 LOG(info) << " ADC " << fdigi << " ns";
100}
101
102// -------------------------------------------------------------------------
Float_t fdigi
digitized detector hit
Definition: DetectorHit.h:39
Int_t fDetectorID
Detector unique identifier.
Definition: DetectorHit.h:40
vetoHit()
Definition: vetoHit.cxx:24
Double_t GetX() const
Definition: vetoHit.cxx:45
Double_t GetZ() const
Definition: vetoHit.cxx:53
TVector3 GetXYZ() const
Definition: vetoHit.cxx:32
TGeoNode * GetNode() const
Definition: vetoHit.cxx:57
Double_t GetY() const
Definition: vetoHit.cxx:49
void Print(Int_t detID) const
Definition: vetoHit.cxx:96
Definition: Detector.h:18