SND@LHC Software
Loading...
Searching...
No Matches
strawtubesHit.cxx
Go to the documentation of this file.
1#include "strawtubesHit.h"
2#include "strawtubes.h"
3#include "TVector3.h"
4#include "FairRun.h"
5#include "FairRunSim.h"
6#include "TMath.h"
7#include "TRandom1.h"
8#include "TRandom3.h"
9#include "TGeoManager.h"
10#include "TGeoShape.h"
11#include "TGeoTube.h"
12
13#include <iostream>
14#include <math.h>
15using std::cout;
16using std::endl;
17
18Double_t speedOfLight = TMath::C() *100./1000000000.0 ; // from m/sec to cm/ns
19// ----- Default constructor -------------------------------------------
21 : ShipHit()
22{
23 flag = true;
24}
25// ----- Standard constructor ------------------------------------------
26strawtubesHit::strawtubesHit(Int_t detID, Float_t tdc)
27 : ShipHit(detID,tdc)
28{
29 flag = true;
30}
31// ----- constructor from strawtubesPoint ------------------------------------------
33 : ShipHit()
34{
35 TVector3 start = TVector3();
36 TVector3 stop = TVector3();
37 fDetectorID = p->GetDetectorID();
38 strawtubes* module = dynamic_cast<strawtubes*> (FairRunSim::Instance()->GetListOfModules()->FindObject("Strawtubes") );
39 Double_t v_drift = module->StrawVdrift();
40 Double_t sigma_spatial = module->StrawSigmaSpatial();
41 module->StrawEndPoints(fDetectorID,start,stop);
42 Double_t t_drift = fabs( gRandom->Gaus( p->dist2Wire(), sigma_spatial ) )/v_drift;
43 fdigi = t0 + p->GetTime() + t_drift + ( stop[0]-p->GetX() )/ speedOfLight;
44 flag = true;
45}
46void strawtubesHit::StrawEndPoints(TVector3 &vbot, TVector3 &vtop)
47{
48 Int_t statnb = fDetectorID/10000000;
49 Int_t vnb = (fDetectorID - statnb*10000000)/1000000;
50 Int_t pnb = (fDetectorID- statnb*10000000 - vnb*1000000)/100000;
51 Int_t lnb = (fDetectorID - statnb*10000000 - vnb*1000000 - pnb*100000)/10000;
52 TString stat = "Tr";stat+=+statnb;stat+="_";stat+=statnb;
53 if (statnb==5){stat="Veto_5";}
54 TString view;
55 switch (vnb) {
56 case 0:
57 view = "_x1";
58 if (statnb==5){view = "_x";}
59 break;
60 case 1:
61 view = "_u";
62 break;
63 case 2:
64 view = "_v";
65 break;
66 case 3:
67 view = "_x2";
68 break;
69 default:
70 view = "_x1";}
71 TGeoNavigator* nav = gGeoManager->GetCurrentNavigator();
72 TString prefix = "Tr";
73 if (statnb==5){prefix="Veto";}
74 else{prefix+=statnb;}
75 prefix+=view;prefix+="_plane_";prefix+=pnb;prefix+="_";
76 TString plane = prefix;plane+=statnb;plane+=vnb;plane+=+pnb;plane+="00000";
77 TString layer = prefix+"layer_";layer+=lnb;layer+="_";layer+=statnb;layer+=vnb;layer+=pnb;layer+=lnb;layer+="0000";
78 TString wire = "wire_";
79 if (statnb==5){wire+="veto_";}
80 wire+=(fDetectorID+1000);
81 if (statnb<3){wire = "wire_12_";wire+=(fDetectorID+1000);}
82 TString path = "/";path+=stat;path+="/";path+=plane;path+="/";path+=layer;path+="/";path+=wire;
83 Bool_t rc = nav->cd(path);
84 if (not rc){
85 cout << "strawtubes::StrawDecode, TgeoNavigator failed "<<path<<endl;
86 return;
87 }
88 TGeoNode* W = nav->GetCurrentNode();
89 TGeoTube* S = dynamic_cast<TGeoTube*>(W->GetVolume()->GetShape());
90 Double_t top[3] = {0,0,S->GetDZ()};
91 Double_t bot[3] = {0,0,-S->GetDZ()};
92 Double_t Gtop[3],Gbot[3];
93 nav->LocalToMaster(top, Gtop); nav->LocalToMaster(bot, Gbot);
94 vtop.SetXYZ(Gtop[0],Gtop[1],Gtop[2]);
95 vbot.SetXYZ(Gbot[0],Gbot[1],Gbot[2]);
96}
97
98// -------------------------------------------------------------------------
99
100// ----- Destructor ----------------------------------------------------
102// -------------------------------------------------------------------------
103
104// ----- Public method Print -------------------------------------------
106{
107 cout << "-I- strawtubesHit: strawtubes hit " << " in detector " << fDetectorID << endl;
108 cout << " TDC " << fdigi << " ns" << endl;
109}
110// -------------------------------------------------------------------------
111
113
Float_t fdigi
digitized detector hit
Definition ShipHit.h:57
Int_t fDetectorID
Detector unique identifier.
Definition ShipHit.h:58
virtual void Print() const
virtual ~strawtubesHit()
void StrawEndPoints(TVector3 &vbot, TVector3 &vtop)
Float_t flag
flag
ClassImp(ecalContFact) ecalContFact
Double_t speedOfLight
Definition muonHit.cxx:27
Double_t speedOfLight