FairShip
Loading...
Searching...
No Matches
UpstreamTaggerHit.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 "UpstreamTaggerHit.h"
6
7#include <iostream>
8
9#include "FairLogger.h"
10#include "TRandom.h"
11#include "UpstreamTaggerPoint.h"
12
13using std::cout;
14using std::endl;
15
16// ----- Default constructor --------------
18 : SHiP::DetectorHit(), fX(0.), fY(0.), fZ(0.), fTime(0.) {}
19
20// ----- Constructor from UpstreamTaggerPoint --------------
22 Double_t pos_res, Double_t time_res)
23 : SHiP::DetectorHit() {
24 if (!p) {
25 LOG(error) << "UpstreamTaggerHit: null UpstreamTaggerPoint pointer";
26 return;
27 }
28 fDetectorID = p->GetDetectorID();
29
30 // Smear position with Gaussian resolution
31 fX = gRandom->Gaus(p->GetX(), pos_res);
32 fY = gRandom->Gaus(p->GetY(), pos_res);
33 fZ = gRandom->Gaus(p->GetZ(), pos_res);
34
35 // Smear time with Gaussian resolution
36 fTime = gRandom->Gaus(p->GetTime() + t0, time_res);
37}
38
39// ----- Print ------------------------------
41 cout << "-I- UpstreamTaggerHit: detector " << fDetectorID << endl;
42 cout << " Position: (" << fX << ", " << fY << ", " << fZ << ") cm" << endl;
43 cout << " Time: " << fTime << " ns" << endl;
44}
Int_t fDetectorID
Detector unique identifier.
Definition: DetectorHit.h:40
Double_t fTime
Smeared time (ns)
Double_t fY
Smeared y position (cm)
Double_t fZ
Smeared z position (cm)
Double_t fX
Smeared x position (cm)
Definition: Detector.h:18