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 "TGeoManager.h"
15#include "TGeoShape.h"
16#include "TGeoTube.h"
17#include "TMath.h"
18#include "TRandom1.h"
19#include "TRandom3.h"
20#include "TVector3.h"
21#include "strawtubes.h"
22using std::cout;
23using std::endl;
24
25namespace {
26constexpr Double_t speedOfLight = 29.9792458; // TMath::C() * 100 / 1e9, cm/ns
27} // namespace
28// ----- Default constructor -------------------------------------------
30// ----- Standard constructor ------------------------------------------
31strawtubesHit::strawtubesHit(Int_t detID, Float_t tdc)
32 : SHiP::DetectorHit(detID, tdc) {}
33// ----- constructor from strawtubesPoint
34// ------------------------------------------
36 : SHiP::DetectorHit() {
37 if (!p) {
38 LOG(error) << "strawtubesHit: null strawtubesPoint pointer";
39 return;
40 }
41 TVector3 start = TVector3();
42 TVector3 stop = TVector3();
43 fDetectorID = p->GetDetectorID();
44 strawtubes* module = dynamic_cast<strawtubes*>(
45 FairRunSim::Instance()->GetListOfModules()->FindObject("strawtubes"));
46 Double_t v_drift = module->StrawVdrift();
47 Double_t sigma_spatial = module->StrawSigmaSpatial();
49 Double_t t_drift =
50 fabs(gRandom->Gaus(p->dist2Wire(), sigma_spatial)) / v_drift;
51 fdigi = t0 + p->GetTime() + t_drift + (stop[0] - p->GetX()) / speedOfLight;
52}
53
54// -------------------------------------------------------------------------
55
56// -------------------------------------------------------------------------
57
59 Int_t detID = GetDetectorID();
60 const auto decode = strawtubes::StrawDecode(detID);
61
62 return std::get<0>(decode);
63}
64
66 Int_t detID = GetDetectorID();
67 const auto decode = strawtubes::StrawDecode(detID);
68
69 return std::get<1>(decode);
70}
71
73 Int_t detID = GetDetectorID();
74 const auto decode = strawtubes::StrawDecode(detID);
75
76 return std::get<2>(decode);
77}
78
80 Int_t detID = GetDetectorID();
81 const auto decode = strawtubes::StrawDecode(detID);
82
83 return std::get<3>(decode);
84}
85
86// ----- Public method Print -------------------------------------------
88 cout << "-I- strawtubesHit: strawtubes hit " << " in detector " << fDetectorID
89 << endl;
90 cout << " TDC " << fdigi << " ns" << endl;
91}
92// -------------------------------------------------------------------------
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
Double_t StrawSigmaSpatial()
Definition: strawtubes.h:55
static void StrawEndPoints(Int_t detID, TVector3 &top, TVector3 &bot)
Definition: strawtubes.cxx:443
Double_t StrawVdrift()
Definition: strawtubes.h:54
static std::array< Int_t, 4 > StrawDecode(Int_t detID)
Definition: strawtubes.cxx:421
Definition: Detector.h:18
int speedOfLight
Definition: shipunit.py:317