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

#include <exitHadronAbsorber.h>

Inheritance diagram for exitHadronAbsorber:
Collaboration diagram for exitHadronAbsorber:

Public Member Functions

 exitHadronAbsorber (const char *Name, Bool_t Active)
 
 exitHadronAbsorber ()
 
virtual ~exitHadronAbsorber ()
 
virtual void Initialize ()
 
virtual Bool_t ProcessHits (FairVolume *v=0)
 
virtual void Register ()
 
virtual TClonesArray * GetCollection (Int_t iColl) const
 
virtual void Reset ()
 
void ConstructGeometry ()
 
virtual void CopyClones (TClonesArray *cl1, TClonesArray *cl2, Int_t offset)
 
virtual void SetSpecialPhysicsCuts ()
 
virtual void EndOfEvent ()
 
virtual void FinishPrimary ()
 
virtual void FinishRun ()
 
virtual void BeginPrimary ()
 
virtual void PostTrack ()
 
virtual void PreTrack ()
 
virtual void BeginEvent ()
 
vetoPointAddHit (Int_t trackID, Int_t detID, TVector3 pos, TVector3 mom, Double_t time, Double_t length, Double_t eLoss, Int_t pdgcode, TVector3 Lpos, TVector3 Lmom)
 
void SetEnergyCut (Float_t emax)
 
void SetOnlyMuons ()
 
void SetOpt4DP ()
 
void SkipNeutrinos ()
 
void SetZposition (Float_t x)
 

Private Attributes

Int_t fTrackID
 
Int_t fVolumeID
 track index
 
TLorentzVector fPos
 volume id
 
TLorentzVector fMom
 position at entrance
 
Double_t fTime
 momentum at entrance
 
Double_t fLength
 time
 
Double_t fzPos
 length
 
Bool_t withNtuple
 zPos, optional
 
TNtuple * fNtuple
 special option for Dark Photon physics studies
 
Float_t EMax
 
Bool_t fOnlyMuons
 max energy to transport
 
Bool_t fSkipNeutrinos
 flag if only muons should be stored
 
TFile * fout
 flag if neutrinos should be ignored
 
TClonesArray * fElectrons
 
Int_t index
 
TClonesArray * fexitHadronAbsorberPointCollection
 

Detailed Description

Definition at line 16 of file exitHadronAbsorber.h.

Constructor & Destructor Documentation

◆ exitHadronAbsorber() [1/2]

exitHadronAbsorber::exitHadronAbsorber ( const char *  Name,
Bool_t  Active 
)

Name : Detector Name Active: kTRUE for active detectors (ProcessHits() will be called) kFALSE for inactive detectors

◆ exitHadronAbsorber() [2/2]

exitHadronAbsorber::exitHadronAbsorber ( )

default constructor

Definition at line 40 of file exitHadronAbsorber.cxx.

41 : FairDetector("exitHadronAbsorber", kTRUE, kVETO),
42 fTrackID(-1),
43 fVolumeID(-1),
44 fPos(),
45 fMom(),
46 fTime(-1.),
47 fLength(-1.),
48 fOnlyMuons(kFALSE),
49 fSkipNeutrinos(kFALSE),
50 fzPos(3E8),
51 withNtuple(kFALSE),
52 fexitHadronAbsorberPointCollection(new TClonesArray("vetoPoint"))
53{}
@ kVETO
TClonesArray * fexitHadronAbsorberPointCollection
Int_t fVolumeID
track index
TLorentzVector fPos
volume id
Bool_t withNtuple
zPos, optional
TLorentzVector fMom
position at entrance
Double_t fTime
momentum at entrance
Bool_t fSkipNeutrinos
flag if only muons should be stored
Bool_t fOnlyMuons
max energy to transport

◆ ~exitHadronAbsorber()

exitHadronAbsorber::~exitHadronAbsorber ( )
virtual

destructor

Definition at line 55 of file exitHadronAbsorber.cxx.

Member Function Documentation

◆ AddHit()

vetoPoint * exitHadronAbsorber::AddHit ( Int_t  trackID,
Int_t  detID,
TVector3  pos,
TVector3  mom,
Double_t  time,
Double_t  length,
Double_t  eLoss,
Int_t  pdgcode,
TVector3  Lpos,
TVector3  Lmom 
)

Definition at line 239 of file exitHadronAbsorber.cxx.

243{
244 TClonesArray& clref = *fexitHadronAbsorberPointCollection;
245 Int_t size = clref.GetEntriesFast();
246 return new(clref[size]) vetoPoint(trackID, detID, pos, mom,
247 time, length, eLoss, pdgCode,Lpos,Lmom);
248}

◆ BeginEvent()

virtual void exitHadronAbsorber::BeginEvent ( )
inlinevirtual

Definition at line 66 of file exitHadronAbsorber.h.

66{;}

◆ BeginPrimary()

virtual void exitHadronAbsorber::BeginPrimary ( )
inlinevirtual

Definition at line 63 of file exitHadronAbsorber.h.

63{;}

◆ ConstructGeometry()

void exitHadronAbsorber::ConstructGeometry ( )

Create the detector geometry

Definition at line 205 of file exitHadronAbsorber.cxx.

206{
207 static FairGeoLoader *geoLoad=FairGeoLoader::Instance();
208 static FairGeoInterface *geoFace=geoLoad->getGeoInterface();
209 static FairGeoMedia *media=geoFace->getMedia();
210 static FairGeoBuilder *geoBuild=geoLoad->getGeoBuilder();
211
212 FairGeoMedium *ShipMedium=media->getMedium("vacuums");
213 TGeoMedium* vac=gGeoManager->GetMedium("vacuums");
214 if (vac==NULL)
215 geoBuild->createMedium(ShipMedium);
216 vac =gGeoManager->GetMedium("vacuums");
217 TGeoVolume *top=gGeoManager->GetTopVolume();
218 TGeoNavigator* nav = gGeoManager->GetCurrentNavigator();
219 Double_t zLoc;
220 if (fzPos>1E8){
221 //Add thin sensitive plane after hadron absorber
222 Float_t distance = 1.;
223 Double_t local[3]= {0,0,0};
224 if (not nav->cd("/MuonShieldArea_1/CoatWall_1")) {
225 nav->cd("/MuonShieldArea_1/MagnAbsorb2_MagRetL_1");
226 distance = -1.;}
227 TGeoBBox* tmp = (TGeoBBox*)(nav->GetCurrentNode()->GetVolume()->GetShape());
228 local[2] = distance * tmp->GetDZ();
229 Double_t global[3] = {0,0,0};
230 nav->LocalToMaster(local,global);
231 zLoc = global[2] + distance * 1.*cm;
232 }else{zLoc = fzPos;} // use external input
233 TGeoVolume *sensPlane = gGeoManager->MakeBox("sensPlane",vac,10.*m-1.*mm,10.*m-1.*mm,1.*mm);
234 nav->cd("/MuonShieldArea_1/");
235 nav->GetCurrentNode()->GetVolume()->AddNode(sensPlane, 1, new TGeoTranslation(0, 0, zLoc));
236 AddSensitiveVolume(sensPlane);
237}
Double_t cm
Double_t m
Double_t mm

◆ CopyClones()

virtual void exitHadronAbsorber::CopyClones ( TClonesArray *  cl1,
TClonesArray *  cl2,
Int_t  offset 
)
inlinevirtual

The following methods can be implemented if you need to make any optional action in your detector during the transport.

Definition at line 57 of file exitHadronAbsorber.h.

58 {;}

◆ EndOfEvent()

void exitHadronAbsorber::EndOfEvent ( )
virtual

Definition at line 132 of file exitHadronAbsorber.cxx.

133{
134
136
137}

◆ FinishPrimary()

virtual void exitHadronAbsorber::FinishPrimary ( )
inlinevirtual

Definition at line 61 of file exitHadronAbsorber.h.

61{;}

◆ FinishRun()

void exitHadronAbsorber::FinishRun ( )
virtual

Definition at line 173 of file exitHadronAbsorber.cxx.

173 {
174 for(Int_t idnu=11; idnu<23; idnu+=1){
175 // nu or anti-nu
176 for (Int_t idadd=-1; idadd<3; idadd+=2){
177 Int_t idw=idnu;
178 if (idnu==18){idw=22;}
179 if (idnu==19){idw=111;}
180 if (idnu==20){idw=221;}
181 if (idnu==21){idw=223;}
182 if (idnu==22){idw=331;}
183 Int_t idhnu=10000+idw;
184 if (idadd==-1){
185 if (idnu>17){continue;}
186 idhnu+=10000;
187 idw=-idnu;
188 }
189 TString key = "";key+=idhnu;
190 TSeqCollection* fileList=gROOT->GetListOfFiles();
191 ((TFile*)fileList->At(0))->cd();
192 TH1D* Hidhnu = (TH1D*)fout->Get(key);
193 Hidhnu->Write();
194 key="";key+=idhnu+1000;
195 TH2D* Hidhnu100 = (TH2D*)fout->Get(key);
196 Hidhnu100->Write();
197 key = "";key+=idhnu+2000;
198 TH2D* Hidhnu200 = (TH2D*)fout->Get(key);
199 Hidhnu200->Write();
200 }
201 }
202 if(withNtuple){fNtuple->Write();}
203}
TFile * fout
flag if neutrinos should be ignored
TNtuple * fNtuple
special option for Dark Photon physics studies
int idhnu
Definition makeDecay.py:88

◆ GetCollection()

TClonesArray * exitHadronAbsorber::GetCollection ( Int_t  iColl) const
virtual

Gets the produced collections

Definition at line 257 of file exitHadronAbsorber.cxx.

258{
259 if (iColl == 0) { return fexitHadronAbsorberPointCollection; }
260 else { return NULL; }
261}

◆ Initialize()

void exitHadronAbsorber::Initialize ( )
virtual

Initialization of the detector is done here

Definition at line 88 of file exitHadronAbsorber.cxx.

89{
90 FairDetector::Initialize();
91 TSeqCollection* fileList=gROOT->GetListOfFiles();
92 fout = ((TFile*)fileList->At(0));
93 // book hists for Genie neutrino momentum distribution
94 // add also leptons, and photon
95 // add pi0 111 eta 221 eta' 331 omega 223 for DM production
96 TDatabasePDG* PDG = TDatabasePDG::Instance();
97 for(Int_t idnu=11; idnu<26; idnu+=1){
98 // nu or anti-nu
99 for (Int_t idadd=-1; idadd<3; idadd+=2){
100 Int_t idw=idnu;
101 if (idnu==18){idw=22;}
102 if (idnu==19){idw=111;}
103 if (idnu==20){idw=221;}
104 if (idnu==21){idw=223;}
105 if (idnu==22){idw=331;}
106 if (idnu==23){idw=211;}
107 if (idnu==24){idw=321;}
108 if (idnu==25){idw=2212;}
109 Int_t idhnu=10000+idw;
110 if (idadd==-1){
111 if (idnu>17){continue;}
112 idhnu+=10000;
113 idw=-idnu;
114 }
115 TString name=PDG->GetParticle(idw)->GetName();
116 TString title = name;title+=" momentum (GeV)";
117 TString key = "";key+=idhnu;
118 TH1D* Hidhnu = new TH1D(key,title,400,0.,400.);
119 title = name;title+=" log10-p vs log10-pt";
120 key = "";key+=idhnu+1000;
121 TH2D* Hidhnu100 = new TH2D(key,title,100,-0.3,1.7,100,-2.,0.5);
122 title = name;title+=" log10-p vs log10-pt";
123 key = "";key+=idhnu+2000;
124 TH2D* Hidhnu200 = new TH2D(key,title,25,-0.3,1.7,100,-2.,0.5);
125 }
126 }
127 if(withNtuple) {
128 fNtuple = new TNtuple("4DP","4DP","id:px:py:pz:x:y:z");
129 }
130}

◆ PostTrack()

virtual void exitHadronAbsorber::PostTrack ( )
inlinevirtual

Definition at line 64 of file exitHadronAbsorber.h.

64{;}

◆ PreTrack()

void exitHadronAbsorber::PreTrack ( )
virtual

Definition at line 139 of file exitHadronAbsorber.cxx.

139 {
140 gMC->TrackMomentum(fMom);
141 if ( (fMom.E()-fMom.M() )<EMax){
142 gMC->StopTrack();
143 return;
144 }
145 TParticle* p = gMC->GetStack()->GetCurrentTrack();
146 Int_t pdgCode = p->GetPdgCode();
147// record statistics for neutrinos, electrons and photons
148// add pi0 111 eta 221 eta' 331 omega 223
149 Int_t idabs = TMath::Abs(pdgCode);
150 if (idabs<18 || idabs==22 || idabs==111 || idabs==221 || idabs==223 || idabs==331
151 || idabs==211 || idabs==321 || idabs==2212 ){
152 Double_t wspill = p->GetWeight();
153 Int_t idhnu=idabs+10000;
154 if (pdgCode<0){ idhnu+=10000;}
155 Double_t l10ptot = TMath::Min(TMath::Max(TMath::Log10(fMom.P()),-0.3),1.69999);
156 Double_t l10pt = TMath::Min(TMath::Max(TMath::Log10(fMom.Pt()),-2.),0.4999);
157 TString key; key+=idhnu;
158 TH1D* h1 = (TH1D*)fout->Get(key);
159 if (h1){h1->Fill(fMom.P(),wspill);}
160 key="";key+=idhnu+1000;
161 TH2D* h2 = (TH2D*)fout->Get(key);
162 if (h2){h2->Fill(l10ptot,l10pt,wspill);}
163 key="";key+=idhnu+2000;
164 h2 = (TH2D*)fout->Get(key);
165 if (h2){h2->Fill(l10ptot,l10pt,wspill);}
166 if(withNtuple){
167 fNtuple->Fill(pdgCode,fMom.Px(),fMom.Py(), fMom.Pz(),fPos.X(),fPos.Y(),fPos.Z());
168 }
169 if (fSkipNeutrinos && (idabs==12 or idabs==14 or idabs == 16 )){gMC->StopTrack();}
170 }
171}

◆ ProcessHits()

Bool_t exitHadronAbsorber::ProcessHits ( FairVolume *  v = 0)
virtual

this method is called for each step during simulation (see FairMCApplication::Stepping())

This method is called from the MC stepping

Definition at line 63 of file exitHadronAbsorber.cxx.

64{
66 if ( gMC->IsTrackEntering() ) {
67 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
68 TParticle* p = gMC->GetStack()->GetCurrentTrack();
69 Int_t pdgCode = p->GetPdgCode();
70 gMC->TrackMomentum(fMom);
71 if (!(fOnlyMuons && TMath::Abs(pdgCode)!=13)){
72 fTime = gMC->TrackTime() * 1.0e09;
73 fLength = gMC->TrackLength();
74 gMC->TrackPosition(fPos);
75 if ( (fMom.E()-fMom.M() )>EMax) {
76 AddHit(fTrackID, 111, TVector3(fPos.X(),fPos.Y(),fPos.Z()),
77 TVector3(fMom.Px(), fMom.Py(), fMom.Pz()), fTime, fLength,
78 0,pdgCode,TVector3(p->Vx(), p->Vy(), p->Vz()),TVector3(p->Px(), p->Py(), p->Pz()) );
79 ShipStack* stack = (ShipStack*) gMC->GetStack();
80 stack->AddPoint(kVETO);
81 }
82 }
83 }
84 gMC->StopTrack();
85 return kTRUE;
86}
vetoPoint * AddHit(Int_t trackID, Int_t detID, TVector3 pos, TVector3 mom, Double_t time, Double_t length, Double_t eLoss, Int_t pdgcode, TVector3 Lpos, TVector3 Lmom)

◆ Register()

void exitHadronAbsorber::Register ( )
virtual

Registers the produced collections in FAIRRootManager.

Definition at line 250 of file exitHadronAbsorber.cxx.

251{
252
253 FairRootManager::Instance()->Register("vetoPoint", "veto",
255}

◆ Reset()

void exitHadronAbsorber::Reset ( )
virtual

has to be called after each event to reset the containers

Definition at line 262 of file exitHadronAbsorber.cxx.

263{
265}

◆ SetEnergyCut()

void exitHadronAbsorber::SetEnergyCut ( Float_t  emax)
inline

Definition at line 72 of file exitHadronAbsorber.h.

72{EMax=emax;}// min energy to be copied to Geant4

◆ SetOnlyMuons()

void exitHadronAbsorber::SetOnlyMuons ( )
inline

Definition at line 73 of file exitHadronAbsorber.h.

73{fOnlyMuons=kTRUE;}

◆ SetOpt4DP()

void exitHadronAbsorber::SetOpt4DP ( )
inline

Definition at line 74 of file exitHadronAbsorber.h.

74{withNtuple=kTRUE;}

◆ SetSpecialPhysicsCuts()

virtual void exitHadronAbsorber::SetSpecialPhysicsCuts ( )
inlinevirtual

Definition at line 59 of file exitHadronAbsorber.h.

59{;}

◆ SetZposition()

void exitHadronAbsorber::SetZposition ( Float_t  x)
inline

Definition at line 76 of file exitHadronAbsorber.h.

◆ SkipNeutrinos()

void exitHadronAbsorber::SkipNeutrinos ( )
inline

Definition at line 75 of file exitHadronAbsorber.h.

75{fSkipNeutrinos=kTRUE;}

Member Data Documentation

◆ EMax

Float_t exitHadronAbsorber::EMax
private

Definition at line 92 of file exitHadronAbsorber.h.

◆ fElectrons

TClonesArray* exitHadronAbsorber::fElectrons
private

Definition at line 96 of file exitHadronAbsorber.h.

◆ fexitHadronAbsorberPointCollection

TClonesArray* exitHadronAbsorber::fexitHadronAbsorberPointCollection
private

container for data points

Definition at line 99 of file exitHadronAbsorber.h.

◆ fLength

Double_t exitHadronAbsorber::fLength
private

time

Definition at line 88 of file exitHadronAbsorber.h.

◆ fMom

TLorentzVector exitHadronAbsorber::fMom
private

position at entrance

Definition at line 86 of file exitHadronAbsorber.h.

◆ fNtuple

TNtuple* exitHadronAbsorber::fNtuple
private

special option for Dark Photon physics studies

Definition at line 91 of file exitHadronAbsorber.h.

◆ fOnlyMuons

Bool_t exitHadronAbsorber::fOnlyMuons
private

max energy to transport

Definition at line 93 of file exitHadronAbsorber.h.

◆ fout

TFile* exitHadronAbsorber::fout
private

flag if neutrinos should be ignored

Definition at line 95 of file exitHadronAbsorber.h.

◆ fPos

TLorentzVector exitHadronAbsorber::fPos
private

volume id

Definition at line 85 of file exitHadronAbsorber.h.

◆ fSkipNeutrinos

Bool_t exitHadronAbsorber::fSkipNeutrinos
private

flag if only muons should be stored

Definition at line 94 of file exitHadronAbsorber.h.

◆ fTime

Double_t exitHadronAbsorber::fTime
private

momentum at entrance

Definition at line 87 of file exitHadronAbsorber.h.

◆ fTrackID

Int_t exitHadronAbsorber::fTrackID
private

Track information to be stored until the track leaves the active volume.

Definition at line 83 of file exitHadronAbsorber.h.

◆ fVolumeID

Int_t exitHadronAbsorber::fVolumeID
private

track index

Definition at line 84 of file exitHadronAbsorber.h.

◆ fzPos

Double_t exitHadronAbsorber::fzPos
private

length

Definition at line 89 of file exitHadronAbsorber.h.

◆ index

Int_t exitHadronAbsorber::index
private

Definition at line 97 of file exitHadronAbsorber.h.

◆ withNtuple

Bool_t exitHadronAbsorber::withNtuple
private

zPos, optional

Definition at line 90 of file exitHadronAbsorber.h.


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