FairShip
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 ()
 
void Initialize () override
 
Bool_t ProcessHits (FairVolume *v=0) override
 
void Register () override
 
void ConstructGeometry () override
 
void FinishRun () override
 
void PreTrack () override
 
void SetEnergyCut (Float_t emax)
 
void SetOnlyMuons ()
 
void SetOpt4DP ()
 
void SkipNeutrinos ()
 
void SetZposition (Float_t x)
 
void SetVetoPointName (TString name)
 
void SetCylindricalPlane ()
 
void SetUseCaveCoordinates ()
 
- Public Member Functions inherited from SHiP::Detector< vetoPoint >
 Detector ()=default
 
 Detector (const char *Name, Bool_t Active, Int_t detID)
 
 Detector (const char *Name, Bool_t Active)
 
 ~Detector () override=default
 
vetoPointAddHit (Args &&... args)
 
void ConstructGeometry () override=0
 
void Initialize () override
 
void Reset () override
 
void EndOfEvent () override
 
void Register () override
 
TClonesArray * GetCollection (Int_t iColl) const override
 
void UpdatePointTrackIndices (const std::map< Int_t, Int_t > &indexMap) override
 Update track indices in point collection after track filtering.
 
void SetSpecialPhysicsCuts () override
 
void FinishPrimary () override
 
void FinishRun () override
 
void BeginPrimary () override
 
void PostTrack () override
 
void PreTrack () override
 
void BeginEvent () override
 
void CopyClones (TClonesArray *cl1, TClonesArray *cl2, Int_t offset) override
 
- Public Member Functions inherited from ISTLPointContainer
virtual void UpdatePointTrackIndices (const std::map< Int_t, Int_t > &indexMap)=0
 Update track indices in point collection after track filtering.
 
virtual ~ISTLPointContainer ()=default
 

Private Attributes

Int_t fUniqueID
 
Bool_t fOnlyMuons
 
Bool_t fSkipNeutrinos
 flag if only muons should be stored
 
TString fVetoName
 flag if neutrinos should be ignored
 
Double_t fzPos
 
Bool_t withNtuple
 zPos, optional
 
TNtuple * fNtuple
 special option for Dark Photon physics studies
 
Float_t EMax
 
Bool_t fCylindricalPlane
 max energy to transport
 
Bool_t fUseCaveCoordinates
 cylindrical sensPlane flag
 
TFile * fout
 set position from cave
 
TClonesArray * fElectrons
 
Int_t index
 

Additional Inherited Members

- Protected Attributes inherited from SHiP::Detector< vetoPoint >
Int_t fEventID
 
Int_t fTrackID
 event index
 
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 fELoss
 length
 
std::vector< vetoPoint > * fDetPoints
 energy loss
 
TGeoVolume * fDetector
 

Detailed Description

Definition at line 15 of file exitHadronAbsorber.h.

Constructor & Destructor Documentation

◆ exitHadronAbsorber() [1/2]

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

Definition at line 37 of file exitHadronAbsorber.cxx.

38 : Detector(Name, Active, kVETO),
39 fOnlyMuons(kFALSE),
40 fSkipNeutrinos(kFALSE),
41 fVetoName("veto"),
42 fzPos(3E8),
43 withNtuple(kFALSE),
44 fCylindricalPlane(kFALSE) {}
@ kVETO
Bool_t fCylindricalPlane
max energy to transport
Bool_t withNtuple
zPos, optional
TString fVetoName
flag if neutrinos should be ignored
Bool_t fSkipNeutrinos
flag if only muons should be stored

◆ exitHadronAbsorber() [2/2]

exitHadronAbsorber::exitHadronAbsorber ( )

Definition at line 46 of file exitHadronAbsorber.cxx.

47 : Detector("exitHadronAbsorber", kTRUE, kVETO),
48 fUniqueID(-1),
49 fOnlyMuons(kFALSE),
50 fSkipNeutrinos(kFALSE),
51 fVetoName("veto"),
52 fzPos(3E8),
53 withNtuple(kFALSE),
54 fCylindricalPlane(kFALSE),
55 fUseCaveCoordinates(kFALSE) {}
Bool_t fUseCaveCoordinates
cylindrical sensPlane flag

Member Function Documentation

◆ ConstructGeometry()

void exitHadronAbsorber::ConstructGeometry ( )
overridevirtual

Create the detector geometry

Implements SHiP::Detector< vetoPoint >.

Definition at line 255 of file exitHadronAbsorber.cxx.

255 {
256 static FairGeoLoader* geoLoad = FairGeoLoader::Instance();
257 static FairGeoInterface* geoFace = geoLoad->getGeoInterface();
258 static FairGeoMedia* media = geoFace->getMedia();
259 static FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
260
261 FairGeoMedium* ShipMedium = media->getMedium("vacuums");
262 TGeoMedium* vac = gGeoManager->GetMedium("vacuums");
263 if (vac == nullptr) geoBuild->createMedium(ShipMedium);
264 vac = gGeoManager->GetMedium("vacuums");
265 gGeoManager->GetTopVolume();
266 TGeoNavigator* nav = gGeoManager->GetCurrentNavigator();
267 Double_t zLoc;
268 if (fzPos > 1E8) {
269 // Add thin sensitive plane after hadron absorber
270 Float_t distance = 1.;
271 Double_t local[3] = {0, 0, 0};
272 if (!nav->cd("/MuonShieldArea_1/AbsorberVol_1")) {
273 nav->cd("/MuonShieldArea_1/MagnAbsorb_MagRetL_1");
274 distance = -1.;
275 }
276 TGeoBBox* tmp =
277 dynamic_cast<TGeoBBox*>(nav->GetCurrentNode()->GetVolume()->GetShape());
278 local[2] = distance * tmp->GetDZ();
279 Double_t global[3] = {0, 0, 0};
280 nav->LocalToMaster(local, global);
281 zLoc = global[2] + distance * 1. * cm;
282 } else {
283 zLoc = fzPos;
284 } // use external input
285
286 TString myname(this->GetName());
287 TString shapename_prefix(myname); // Use a prefix for shapenames
288
289 Double_t xLocPlane = 0.0;
290 Double_t yLocPlane = 0.0;
291 Double_t zLocPlane = zLoc;
292
293 if (!fCylindricalPlane) {
294 TGeoVolume* sensPlane =
295 gGeoManager->MakeBox(shapename_prefix + fVetoName + "_box", vac,
296 3.56 * m - 1. * mm, 1.7 * m - 1. * mm, 1. * mm);
297 std::cout << this->GetName()
298 << ", ConstructGeometry(): Created Box with dimensions: "
299 "3.56*m-1.*mm,1.7*m-1.*mm,1.*mm"
300 << std::endl;
301
302 if (!fUseCaveCoordinates) {
303 nav->cd("/MuonShieldArea_1/");
304 } else {
305 Double_t local[3] = {0, 0, zLoc};
306 Double_t global[3];
307 nav->cd("/target_vacuum_box_1/TargetArea_1");
308 nav->LocalToMaster(local, global);
309 nav->cd("/cave_1");
310 yLocPlane = global[1];
311 zLocPlane = global[2];
312 xLocPlane = global[0];
313 }
314 sensPlane->SetLineColor(kBlue - 10);
315 nav->GetCurrentNode()->GetVolume()->AddNode(
316 sensPlane, 1, new TGeoTranslation(xLocPlane, yLocPlane, zLocPlane));
317 AddSensitiveVolume(sensPlane);
318 } else { // add cylindrical sensPlane
319 TGeoVolume* sensPlaneCyl =
320 gGeoManager->MakeTube(shapename_prefix + fVetoName + "_tube", vac,
321 12.51 * cm, 12.52 * cm, zLoc / 2.);
322 std::cout << this->GetName()
323 << ", ConstructGeometry(): Created Tube with dimensions: "
324 "12.51*cm,12.52*cm,zLoc/2."
325 << std::endl;
326 nav->cd("/target_vacuum_box_1/TargetArea_1/HeVolume_1");
327 nav->GetCurrentNode()->GetVolume()->AddNode(sensPlaneCyl, 1,
328 new TGeoTranslation(0, 0, 0));
329 AddSensitiveVolume(sensPlaneCyl);
330 }
331}
Double_t cm

◆ FinishRun()

void exitHadronAbsorber::FinishRun ( )
override

Definition at line 206 of file exitHadronAbsorber.cxx.

206 {
207 for (Int_t idnu = 11; idnu < 23; idnu += 1) {
208 // nu or anti-nu
209 for (Int_t idadd = -1; idadd < 3; idadd += 2) {
210 Int_t idw = idnu;
211 if (idnu == 18) {
212 idw = 22;
213 }
214 if (idnu == 19) {
215 idw = 111;
216 }
217 if (idnu == 20) {
218 idw = 221;
219 }
220 if (idnu == 21) {
221 idw = 223;
222 }
223 if (idnu == 22) {
224 idw = 331;
225 }
226 Int_t idhnu = 10000 + idw;
227 if (idadd == -1) {
228 if (idnu > 17) {
229 continue;
230 }
231 idhnu += 10000;
232 idw = -idnu;
233 }
234 TString key = fVetoName;
235 key += idhnu;
236 TSeqCollection* fileList = gROOT->GetListOfFiles();
237 dynamic_cast<TFile*>(fileList->At(0))->cd();
238 TH1D* Hidhnu = dynamic_cast<TH1D*>(fout->Get(key));
239 Hidhnu->Write();
240 key = fVetoName;
241 key += idhnu + 1000;
242 TH2D* Hidhnu100 = dynamic_cast<TH2D*>(fout->Get(key));
243 Hidhnu100->Write();
244 key = fVetoName;
245 key += idhnu + 2000;
246 TH2D* Hidhnu200 = dynamic_cast<TH2D*>(fout->Get(key));
247 Hidhnu200->Write();
248 }
249 }
250 if (withNtuple) {
251 fNtuple->Write();
252 }
253}
TFile * fout
set position from cave
TNtuple * fNtuple
special option for Dark Photon physics studies
int idhnu
Definition: makeDecay.py:95

◆ Initialize()

void exitHadronAbsorber::Initialize ( )
override

Definition at line 86 of file exitHadronAbsorber.cxx.

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

◆ PreTrack()

void exitHadronAbsorber::PreTrack ( )
override

Definition at line 155 of file exitHadronAbsorber.cxx.

155 {
156 gMC->TrackMomentum(fMom);
157 if ((fMom.E() - fMom.M()) < EMax) {
158 gMC->StopTrack();
159 return;
160 }
161 TParticle* p = gMC->GetStack()->GetCurrentTrack();
162 Int_t pdgCode = p->GetPdgCode();
163 // record statistics for neutrinos, electrons and photons
164 // add pi0 111 eta 221 eta' 331 omega 223
165 Int_t idabs = TMath::Abs(pdgCode);
166 if (idabs < 18 || idabs == 22 || idabs == 111 || idabs == 221 ||
167 idabs == 223 || idabs == 331 || idabs == 211 || idabs == 321 ||
168 idabs == 2212) {
169 Double_t wspill = p->GetWeight();
170 Int_t idhnu = idabs + 10000;
171 if (pdgCode < 0) {
172 idhnu += 10000;
173 }
174 Double_t l10ptot =
175 TMath::Min(TMath::Max(TMath::Log10(fMom.P()), -0.3), 1.69999);
176 Double_t l10pt =
177 TMath::Min(TMath::Max(TMath::Log10(fMom.Pt()), -2.), 0.4999);
178 TString key = fVetoName;
179 key += idhnu;
180 TH1D* h1 = dynamic_cast<TH1D*>(fout->Get(key));
181 if (h1) {
182 h1->Fill(fMom.P(), wspill);
183 }
184 key = fVetoName;
185 key += idhnu + 1000;
186 TH2D* h2 = dynamic_cast<TH2D*>(fout->Get(key));
187 if (h2) {
188 h2->Fill(l10ptot, l10pt, wspill);
189 }
190 key = fVetoName;
191 key += idhnu + 2000;
192 h2 = dynamic_cast<TH2D*>(fout->Get(key));
193 if (h2) {
194 h2->Fill(l10ptot, l10pt, wspill);
195 }
196 if (withNtuple) {
197 fNtuple->Fill(pdgCode, fMom.Px(), fMom.Py(), fMom.Pz(), fPos.X(),
198 fPos.Y(), fPos.Z());
199 }
200 if (fSkipNeutrinos && (idabs == 12 || idabs == 14 || idabs == 16)) {
201 gMC->StopTrack();
202 }
203 }
204}
TLorentzVector fPos
volume id
Definition: Detector.h:87
TLorentzVector fMom
position at entrance
Definition: Detector.h:88
ROOT p
Definition: makeDecay.py:76
min l10pt
Definition: makeDecay.py:170
min l10ptot
Definition: makeDecay.py:169
float wspill
Definition: makeDecay.py:123

◆ ProcessHits()

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

This method is called from the MC stepping

Definition at line 57 of file exitHadronAbsorber.cxx.

57 {
59 if (gMC->IsTrackEntering()) {
60 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
61 fEventID = gMC->CurrentEvent();
62 TParticle* p = gMC->GetStack()->GetCurrentTrack();
63 fUniqueID = p->GetUniqueID();
64 Int_t pdgCode = p->GetPdgCode();
65 gMC->TrackMomentum(fMom);
66 if (!fOnlyMuons || TMath::Abs(pdgCode) == 13) {
67 fTime = gMC->TrackTime() * 1.0e09;
68 fLength = gMC->TrackLength();
69 gMC->TrackPosition(fPos);
70 if ((fMom.E() - fMom.M()) > EMax) {
71 AddHit(fEventID, fTrackID, 111, TVector3(fPos.X(), fPos.Y(), fPos.Z()),
72 TVector3(fMom.Px(), fMom.Py(), fMom.Pz()), fTime, fLength, 0,
73 pdgCode, TVector3(p->Vx(), p->Vy(), p->Vz()),
74 TVector3(p->Px(), p->Py(), p->Pz()));
75 ShipStack* stack = dynamic_cast<ShipStack*>(gMC->GetStack());
76 stack->AddPoint(kVETO);
77 }
78 }
79 }
80 if ((!fCylindricalPlane) && fzPos > 1E8) {
81 gMC->StopTrack();
82 }
83 return kTRUE;
84}
Int_t fTrackID
event index
Definition: Detector.h:85
Double_t fTime
momentum at entrance
Definition: Detector.h:89
vetoPoint * AddHit(Args &&... args)
Definition: Detector.h:38

◆ Register()

void exitHadronAbsorber::Register ( )
override

Definition at line 333 of file exitHadronAbsorber.cxx.

333 {
334 fDetPoints = new std::vector<vetoPoint>();
335 TString name = fVetoName + "Point";
336 FairRootManager::Instance()->RegisterAny(name.Data(), fDetPoints, kTRUE);
337}
std::vector< vetoPoint > * fDetPoints
energy loss
Definition: Detector.h:92

◆ SetCylindricalPlane()

void exitHadronAbsorber::SetCylindricalPlane ( )
inline

Definition at line 37 of file exitHadronAbsorber.h.

37{ fCylindricalPlane = kTRUE; }

◆ SetEnergyCut()

void exitHadronAbsorber::SetEnergyCut ( Float_t  emax)
inline

Definition at line 31 of file exitHadronAbsorber.h.

31{ EMax = emax; }

◆ SetOnlyMuons()

void exitHadronAbsorber::SetOnlyMuons ( )
inline

Definition at line 32 of file exitHadronAbsorber.h.

32{ fOnlyMuons = kTRUE; }

◆ SetOpt4DP()

void exitHadronAbsorber::SetOpt4DP ( )
inline

Definition at line 33 of file exitHadronAbsorber.h.

33{ withNtuple = kTRUE; }

◆ SetUseCaveCoordinates()

void exitHadronAbsorber::SetUseCaveCoordinates ( )
inline

Definition at line 38 of file exitHadronAbsorber.h.

38{ fUseCaveCoordinates = kTRUE; }

◆ SetVetoPointName()

void exitHadronAbsorber::SetVetoPointName ( TString  name)
inline

Definition at line 36 of file exitHadronAbsorber.h.

36{ fVetoName = name; }

◆ SetZposition()

void exitHadronAbsorber::SetZposition ( Float_t  x)
inline

Definition at line 35 of file exitHadronAbsorber.h.

35{ fzPos = x; }

◆ SkipNeutrinos()

void exitHadronAbsorber::SkipNeutrinos ( )
inline

Definition at line 34 of file exitHadronAbsorber.h.

34{ fSkipNeutrinos = kTRUE; }

Member Data Documentation

◆ EMax

Float_t exitHadronAbsorber::EMax
private

Definition at line 48 of file exitHadronAbsorber.h.

◆ fCylindricalPlane

Bool_t exitHadronAbsorber::fCylindricalPlane
private

max energy to transport

Definition at line 49 of file exitHadronAbsorber.h.

◆ fElectrons

TClonesArray* exitHadronAbsorber::fElectrons
private

Definition at line 53 of file exitHadronAbsorber.h.

◆ fNtuple

TNtuple* exitHadronAbsorber::fNtuple
private

special option for Dark Photon physics studies

Definition at line 47 of file exitHadronAbsorber.h.

◆ fOnlyMuons

Bool_t exitHadronAbsorber::fOnlyMuons
private

Definition at line 42 of file exitHadronAbsorber.h.

◆ fout

TFile* exitHadronAbsorber::fout
private

set position from cave

Definition at line 52 of file exitHadronAbsorber.h.

◆ fSkipNeutrinos

Bool_t exitHadronAbsorber::fSkipNeutrinos
private

flag if only muons should be stored

Definition at line 43 of file exitHadronAbsorber.h.

◆ fUniqueID

Int_t exitHadronAbsorber::fUniqueID
private

Definition at line 41 of file exitHadronAbsorber.h.

◆ fUseCaveCoordinates

Bool_t exitHadronAbsorber::fUseCaveCoordinates
private

cylindrical sensPlane flag

Definition at line 50 of file exitHadronAbsorber.h.

◆ fVetoName

TString exitHadronAbsorber::fVetoName
private

flag if neutrinos should be ignored

Definition at line 44 of file exitHadronAbsorber.h.

◆ fzPos

Double_t exitHadronAbsorber::fzPos
private

Definition at line 45 of file exitHadronAbsorber.h.

◆ index

Int_t exitHadronAbsorber::index
private

Definition at line 54 of file exitHadronAbsorber.h.

◆ withNtuple

Bool_t exitHadronAbsorber::withNtuple
private

zPos, optional

Definition at line 46 of file exitHadronAbsorber.h.


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