FairShip
Loading...
Searching...
No Matches
strawtubesHit.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 "strawtubesHit.h"
6
7#include <cmath>
8#include <iostream>
9#include <tuple>
10
11#include "FairLogger.h"
12#include "FairRun.h"
13#include "FairRunSim.h"
14#include "ShipUnit.h"
15#include "TGeoManager.h"
16#include "TGeoShape.h"
17#include "TGeoTube.h"
18#include "TMath.h"
19#include "TRandom1.h"
20#include "TRandom3.h"
21#include "TVector3.h"
22#include "strawtubes.h"
23using std::cout;
24using std::endl;
25
26// ----- Default constructor -------------------------------------------
28// ----- Standard constructor ------------------------------------------
29strawtubesHit::strawtubesHit(Int_t detID, Float_t tdc)
30 : SHiP::DetectorHit(detID, tdc) {}
31// ----- constructor from strawtubesPoint
32// ------------------------------------------
34 : SHiP::DetectorHit() {
35 if (!p) {
36 LOG(error) << "strawtubesHit: null strawtubesPoint pointer";
37 return;
38 }
39 TVector3 start = TVector3();
40 TVector3 stop = TVector3();
41 fDetectorID = p->GetDetectorID();
42 strawtubes* module = dynamic_cast<strawtubes*>(
43 FairRunSim::Instance()->GetListOfModules()->FindObject("strawtubes"));
44 Double_t v_drift = module->StrawVdrift();
45 Double_t sigma_spatial = module->StrawSigmaSpatial();
47 Double_t t_drift =
48 fabs(gRandom->Gaus(p->dist2Wire(), sigma_spatial)) / v_drift;
49 fdigi =
50 t0 + p->GetTime() + t_drift + (stop[0] - p->GetX()) / ShipUnit::c_light;
51}
52
53// -------------------------------------------------------------------------
54
55// -------------------------------------------------------------------------
56
58 Int_t detID = GetDetectorID();
59 const auto decode = strawtubes::StrawDecode(detID);
60
61 return std::get<0>(decode);
62}
63
65 Int_t detID = GetDetectorID();
66 const auto decode = strawtubes::StrawDecode(detID);
67
68 return std::get<1>(decode);
69}
70
72 Int_t detID = GetDetectorID();
73 const auto decode = strawtubes::StrawDecode(detID);
74
75 return std::get<2>(decode);
76}
77
79 Int_t detID = GetDetectorID();
80 const auto decode = strawtubes::StrawDecode(detID);
81
82 return std::get<3>(decode);
83}
84
85// ----- Public method Print -------------------------------------------
87 cout << "-I- strawtubesHit: strawtubes hit " << " in detector " << fDetectorID
88 << endl;
89 cout << " TDC " << fdigi << " ns" << endl;
90}
91// -------------------------------------------------------------------------
Float_t fdigi
digitized detector hit
Definition DetectorHit.h:39
Int_t GetDetectorID() const
Definition DetectorHit.h:29
Int_t fDetectorID
Detector unique identifier.
Definition DetectorHit.h:40
Int_t GetStationNumber() const
void Print() const
Int_t GetLayerNumber() const
Int_t GetViewNumber() const
Int_t GetStrawNumber() const
static void StrawEndPoints(Int_t detID, TVector3 &bot, TVector3 &top)
static std::array< Int_t, 4 > StrawDecode(Int_t detID)
constexpr double c_light
Definition ShipUnit.h:44