9#include "FairGeoBuilder.h"
10#include "FairGeoInterface.h"
11#include "FairGeoLoader.h"
12#include "FairGeoMedia.h"
13#include "FairGeoNode.h"
14#include "FairGeoVolume.h"
15#include "FairRootManager.h"
16#include "FairVolume.h"
19#include "TDatabasePDG.h"
21#include "TGeoBoolNode.h"
23#include "TGeoManager.h"
24#include "TGeoMaterial.h"
29#include "TVirtualMC.h"
38 : Detector(Name, Active,
kVETO),
40 fSkipNeutrinos(kFALSE),
44 fCylindricalPlane(kFALSE) {}
47 : Detector(
"exitHadronAbsorber", kTRUE,
kVETO),
50 fSkipNeutrinos(kFALSE),
54 fCylindricalPlane(kFALSE),
55 fUseCaveCoordinates(kFALSE) {}
59 if (gMC->IsTrackEntering()) {
60 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
62 TParticle* p = gMC->GetStack()->GetCurrentTrack();
64 Int_t pdgCode = p->GetPdgCode();
65 gMC->TrackMomentum(
fMom);
66 if (!
fOnlyMuons || TMath::Abs(pdgCode) == 13) {
67 fTime = gMC->TrackTime() * 1.0e09;
69 gMC->TrackPosition(
fPos);
73 pdgCode, TVector3(p->Vx(), p->Vy(), p->Vz()),
74 TVector3(p->Px(), p->Py(), p->Pz()));
76 stack->AddPoint(
kVETO);
87 FairDetector::Initialize();
88 TSeqCollection* fileList = gROOT->GetListOfFiles();
89 fout =
dynamic_cast<TFile*
>(fileList->At(0));
93 TDatabasePDG* PDG = TDatabasePDG::Instance();
94 for (Int_t idnu = 11; idnu < 26; idnu += 1) {
96 for (Int_t idadd = -1; idadd < 3; idadd += 2) {
122 Int_t idhnu = 10000 + idw;
130 TString name = PDG->GetParticle(idw)->GetName();
131 TString title = name;
132 title +=
" momentum (GeV)";
135 [[maybe_unused]] TH1D* Hidhnu =
new TH1D(key, title, 400, 0., 400.);
137 title +=
" log10-p vs log10-pt";
140 [[maybe_unused]] TH2D* Hidhnu100 =
141 new TH2D(key, title, 100, -0.3, 1.7, 100, -2., 0.5);
143 title +=
" log10-p vs log10-pt";
146 [[maybe_unused]] TH2D* Hidhnu200 =
147 new TH2D(key, title, 25, -0.3, 1.7, 100, -2., 0.5);
151 fNtuple =
new TNtuple(
"4DP",
"4DP",
"id:px:py:pz:x:y:z");
156 gMC->TrackMomentum(
fMom);
161 TParticle* p = gMC->GetStack()->GetCurrentTrack();
162 Int_t pdgCode = p->GetPdgCode();
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 ||
169 Double_t wspill = p->GetWeight();
170 Int_t idhnu = idabs + 10000;
175 TMath::Min(TMath::Max(TMath::Log10(
fMom.P()), -0.3), 1.69999);
177 TMath::Min(TMath::Max(TMath::Log10(
fMom.Pt()), -2.), 0.4999);
180 TH1D* h1 =
dynamic_cast<TH1D*
>(
fout->Get(key));
182 h1->Fill(
fMom.P(), wspill);
186 TH2D* h2 =
dynamic_cast<TH2D*
>(
fout->Get(key));
188 h2->Fill(l10ptot, l10pt, wspill);
192 h2 =
dynamic_cast<TH2D*
>(
fout->Get(key));
194 h2->Fill(l10ptot, l10pt, wspill);
200 if (
fSkipNeutrinos && (idabs == 12 || idabs == 14 || idabs == 16)) {
207 for (Int_t idnu = 11; idnu < 23; idnu += 1) {
209 for (Int_t idadd = -1; idadd < 3; idadd += 2) {
226 Int_t idhnu = 10000 + idw;
236 TSeqCollection* fileList = gROOT->GetListOfFiles();
237 dynamic_cast<TFile*
>(fileList->At(0))->cd();
238 TH1D* Hidhnu =
dynamic_cast<TH1D*
>(
fout->Get(key));
242 TH2D* Hidhnu100 =
dynamic_cast<TH2D*
>(
fout->Get(key));
246 TH2D* Hidhnu200 =
dynamic_cast<TH2D*
>(
fout->Get(key));
256 static FairGeoLoader* geoLoad = FairGeoLoader::Instance();
257 static FairGeoInterface* geoFace = geoLoad->getGeoInterface();
258 static FairGeoMedia* media = geoFace->getMedia();
259 static FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
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();
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");
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;
286 TString myname(this->GetName());
287 TString shapename_prefix(myname);
289 Double_t xLocPlane = 0.0;
290 Double_t yLocPlane = 0.0;
291 Double_t zLocPlane = zLoc;
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"
303 nav->cd(
"/MuonShieldArea_1/");
305 Double_t local[3] = {0, 0, zLoc};
307 nav->cd(
"/target_vacuum_box_1/TargetArea_1");
308 nav->LocalToMaster(local, global);
310 yLocPlane = global[1];
311 zLocPlane = global[2];
312 xLocPlane = global[0];
314 sensPlane->SetLineColor(kBlue - 10);
315 nav->GetCurrentNode()->GetVolume()->AddNode(
316 sensPlane, 1,
new TGeoTranslation(xLocPlane, yLocPlane, zLocPlane));
317 AddSensitiveVolume(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."
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);
336 FairRootManager::Instance()->RegisterAny(name.Data(),
fDetPoints, kTRUE);
Int_t fTrackID
event index
std::vector< vetoPoint > * fDetPoints
energy loss
TLorentzVector fPos
volume id
Double_t fTime
momentum at entrance
vetoPoint * AddHit(Args &&... args)
TLorentzVector fMom
position at entrance
void Initialize() override
void ConstructGeometry() override
Bool_t fUseCaveCoordinates
cylindrical sensPlane flag
Bool_t ProcessHits(FairVolume *v=0) override
Bool_t fCylindricalPlane
max energy to transport
Bool_t withNtuple
zPos, optional
TString fVetoName
flag if neutrinos should be ignored
TFile * fout
set position from cave
TNtuple * fNtuple
special option for Dark Photon physics studies
Bool_t fSkipNeutrinos
flag if only muons should be stored
void FinishRun() override