SND@LHC Software
Loading...
Searching...
No Matches
muonHit Class Reference

#include <muonHit.h>

Inheritance diagram for muonHit:
Collaboration diagram for muonHit:

Public Member Functions

 muonHit ()
 
 muonHit (Int_t detID, Float_t digi, Bool_t isValid)
 
 muonHit (muonPoint *p, Double_t t0)
 
Int_t DetIDfromXYZ (TVector3 p)
 
TVector3 XYZfromDetID (Int_t detID)
 
virtual ~muonHit ()
 
virtual void Print () const
 
TVector3 getPos ()
 
Bool_t isValid () const
 
Double_t SetMuonTimeRes (Double_t mcTime)
 
void setValidity (Bool_t isValid)
 
- Public Member Functions inherited from ShipHit
 ShipHit ()
 
 ShipHit (Int_t detID, Float_t digi)
 
virtual ~ShipHit ()
 
Double_t GetDigi () const
 
Int_t GetDetectorID () const
 
void SetDigi (Float_t d)
 
void SetDetectorID (Int_t detID)
 
virtual void Print (const Option_t *opt="") const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Member Functions

 muonHit (const muonHit &point)
 
muonHit operator= (const muonHit &point)
 
void stInit ()
 

Private Attributes

Float_t flag
 flag
 
Bool_t hisV
 

Static Private Attributes

static bool onlyOnce =false
 

Additional Inherited Members

- Protected Member Functions inherited from ShipHit
 ClassDef (ShipHit, 1)
 
- Protected Attributes inherited from ShipHit
Float_t fdigi
 digitized detector hit
 
Int_t fDetectorID
 Detector unique identifier.
 

Detailed Description

Definition at line 11 of file muonHit.h.

Constructor & Destructor Documentation

◆ muonHit() [1/4]

muonHit::muonHit ( )

Default constructor

Definition at line 29 of file muonHit.cxx.

30 : ShipHit()
31{
32
33}
ShipHit()
Definition ShipHit.cxx:5

◆ muonHit() [2/4]

muonHit::muonHit ( Int_t  detID,
Float_t  digi,
Bool_t  isValid 
)

Constructor with arguments

Parameters
detIDDetector ID
digidigitized/measured TDC
flagTrue/False, false if there is another hit with smaller tdc

Definition at line 35 of file muonHit.cxx.

36 : ShipHit(detID,digi)
37{
38 //
39 SetDigi(digi);
40 setValidity(isV);
41}
void SetDigi(Float_t d)
Definition ShipHit.h:38
void setValidity(Bool_t isValid)
Definition muonHit.cxx:178

◆ muonHit() [3/4]

muonHit::muonHit ( muonPoint p,
Double_t  t0 
)

Definition at line 43 of file muonHit.cxx.

44 : ShipHit()
45{
46//
47 TVector3 truePosition = TVector3( p->GetX(), p->GetY(),p->GetZ());
48 fdigi = t0 + p->GetTime(); // + drift time, propagation inside tile + tdc
49 SetDetectorID(DetIDfromXYZ(truePosition));
51}
Float_t fdigi
digitized detector hit
Definition ShipHit.h:57
void SetDetectorID(Int_t detID)
Definition ShipHit.h:39
Double_t SetMuonTimeRes(Double_t mcTime)
Definition muonHit.cxx:164
Int_t DetIDfromXYZ(TVector3 p)
Definition muonHit.cxx:53

◆ ~muonHit()

muonHit::~muonHit ( )
virtual

Destructor

Definition at line 180 of file muonHit.cxx.

180 {
181}

◆ muonHit() [4/4]

muonHit::muonHit ( const muonHit point)
private

Copy constructor

Member Function Documentation

◆ DetIDfromXYZ()

Int_t muonHit::DetIDfromXYZ ( TVector3  p)

Definition at line 53 of file muonHit.cxx.

54{
55 // needs some code to produce a unique detector ID
56//
57// tiles numbering example with present tile dimensions (X=10,Y=20cm):
58// ---------------------------
59// muon station 1 |13540|13541...13598|13599|
60// ---------------------------|
61// muon station 0 |03540|03541...03598|03599||
62// How tiles numbering works: |03480|03481...03538|03539|.
63// in each station tiles are numbered by rows starting | ||
64// from 0. Numbering begins at bottom of the station ...........................|
65// from left to right (looking the muon station from | ||
66// em calorimeter). At each tile is added the number |00060|00061...00118|00119|
67// n * 10ˆ4 where n is the station number (0 <= n <= 3). |00000|00001...00058|00059|
68// ---------------------------
69// negative detID means ERROR.
70//
71 Int_t detID, nStat; // unique detector ID, station number
72//
73 if (!onlyOnce) {
74 stInit();
75 onlyOnce = true;
76 }
77 nStat = -1;
78 for(Int_t i=0; i<muStZpos.size(); i++) {
79 if (abs(p.Z() - muStZpos[i]) <= muStzMax[i]) {
80 nStat = i;
81 break;
82 }
83 }
84//
85 if (nStat != -1) {
86 detID=(Int_t)((p.X()+muStxMax[nStat])/tileXdim)+tileXn[nStat]
87 *(Int_t)((p.Y()+muStyMax[nStat])/tileYdim)+10000*nStat;
88 } else {
89 detID = -1;
90 }
91//
92 return detID;
93}
static bool onlyOnce
Definition muonHit.h:47
void stInit()
Definition muonHit.cxx:133
const Double_t tileYdim
Definition muonHit.cxx:19
const Double_t tileXdim
Definition muonHit.cxx:19
int i
Definition ShipAna.py:86

◆ getPos()

TVector3 muonHit::getPos ( )
inline

Definition at line 34 of file muonHit.h.

Int_t fDetectorID
Detector unique identifier.
Definition ShipHit.h:58
TVector3 XYZfromDetID(Int_t detID)
Definition muonHit.cxx:95

◆ isValid()

Bool_t muonHit::isValid ( ) const
inline

Definition at line 35 of file muonHit.h.

35{return hisV;}
Bool_t hisV
Definition muonHit.h:50

◆ operator=()

muonHit muonHit::operator= ( const muonHit point)
private

◆ Print()

void muonHit::Print ( ) const
virtual

Output to screen

Definition at line 171 of file muonHit.cxx.

171 {
172//
173 cout << "-I- muonHit: muon hit " << " in detector " << fDetectorID << endl;
174 cout << " TDC " << fdigi << " ns" << endl;
175
176}

◆ SetMuonTimeRes()

Double_t muonHit::SetMuonTimeRes ( Double_t  mcTime)

Definition at line 164 of file muonHit.cxx.

164 {
165//
166 TRandom3 *rand = new TRandom3(0);
167 Double_t cTime = rand->Gaus(mcTime,muonTimeResSigma);
168 delete rand;
169 return cTime;
170}
const Double_t muonTimeResSigma
Definition muonHit.cxx:20

◆ setValidity()

void muonHit::setValidity ( Bool_t  isValid)

Definition at line 178 of file muonHit.cxx.

178{hisV = isV;}

◆ stInit()

void muonHit::stInit ( )
private

Definition at line 133 of file muonHit.cxx.

134{
135//
136//
137 TGeoShape* muShape; TGeoBBox* muonBox;
138 TGeoNavigator* nav = gGeoManager->GetCurrentNavigator();
139 Double_t loc[3]={0,0,0}, global[3]={0,0,0};
140//
141 TString muDet = "cave/MuonDetector_1";
142 nav->cd(muDet);
143 TGeoNode* node = nav->GetCurrentNode();
144 TObjArray* nodes = node->GetVolume()->GetNodes();
145//
146 for (Int_t i = 0; i < nodes->GetEntries(); i++) {
147 node = (TGeoNode*)nodes->At(i);
148 Int_t muStNs = 0;
149 if (TString(node->GetName()).Contains("muondet")) {
150 nav->cd(muDet+"/"+node->GetName());
151 TGeoVolume* volu = node->GetVolume();
152 muShape = node->GetVolume()->GetShape();
153 muonBox = (TGeoBBox*) muShape;
154 muStxMax.push_back(muonBox->GetDX()); muStyMax.push_back(muonBox->GetDY());
155 muStzMax.push_back(muonBox->GetDZ());
156 nav->LocalToMaster(loc,global); muStZpos.push_back(global[2]);
157 tileXn.push_back(2*muStxMax.at(muStNs)/tileXdim);
158 tileYn.push_back(2*muStyMax.at(muStNs)/tileYdim);
159 muStNs++; // muon stations increment
160 }
161 }
162}

◆ XYZfromDetID()

TVector3 muonHit::XYZfromDetID ( Int_t  detID)

Definition at line 95 of file muonHit.cxx.

96{
97//
98// The center of the tile XYZ coordinates are returned
99//
100// Negative Z coordinate means ERROR
101//
102 Int_t nStat; TVector3 p; // station number, center tile coordinate
103//
104 if (!onlyOnce) {
105 stInit();
106 onlyOnce = true;
107 }
108 nStat = -1;
109 for(Int_t i=0; i<=muStZpos.size(); i++) {
110 if (dID < 10000*i) {
111 nStat = i;
112 break;
113 }
114 }
115 if (nStat < 1) {// ERROR! dID too low (nStat=0) or too high (nStat=-1)
116 p.SetXYZ(-999999,-999999,-999999);
117 return p;
118 }
119
120//
121 p.SetZ(muStZpos[--nStat]); // now must be 0 <= nstat <= (n. of stations - 1)
122 dID -= 10000*(nStat);
123//
124 Int_t muXpos, muYpos;
125 muXpos = tileXdim*((dID%tileXn[nStat])+0.5)-muStxMax[nStat];
126 muYpos = tileYdim*((Int_t)(dID/tileXn[nStat])+0.5)-muStyMax[nStat];
127 p.SetXYZ(muXpos, muYpos, muStZpos[nStat]);
128//
129 return p;
130//
131}

Member Data Documentation

◆ flag

Float_t muonHit::flag
private

flag

Definition at line 45 of file muonHit.h.

◆ hisV

Bool_t muonHit::hisV
private

Definition at line 50 of file muonHit.h.

◆ onlyOnce

bool muonHit::onlyOnce =false
staticprivate

Definition at line 47 of file muonHit.h.


The documentation for this class was generated from the following files: