diff --git a/core/detectors/tof/CbmTofGeoHandler.cxx b/core/detectors/tof/CbmTofGeoHandler.cxx index 42fb871eaece07b75ba9423f1d22974ec67f43ab..b48ee4bb7add5babe2b0f699408e623a62bac077 100644 --- a/core/detectors/tof/CbmTofGeoHandler.cxx +++ b/core/detectors/tof/CbmTofGeoHandler.cxx @@ -50,7 +50,9 @@ Int_t CbmTofGeoHandler::Init(Bool_t isSimulation) if (fIsSimulation) { TString tVirtualMCName = gMC->GetName(); - if (tVirtualMCName == "TGeant3TGeo") { fMCVersion = 0; } + if (tVirtualMCName == "TGeant3TGeo") { + fMCVersion = 0; + } else if (tVirtualMCName == "TGeant4") { fMCVersion = 1; } @@ -137,7 +139,8 @@ Int_t CbmTofGeoHandler::CheckGeometryVersion() return fGeoVersion; } else if ((TString(node->GetName()).Contains("v21")) || (TString(node->GetName()).Contains("v18")) - || (TString(node->GetName()).Contains("v20")) || (TString(node->GetName()).Contains("v22"))) { + || (TString(node->GetName()).Contains("v20")) || (TString(node->GetName()).Contains("v22")) + || (TString(node->GetName()).Contains("v24"))) { LOG(info) << "CbmTofGeoHandler::CheckGeometryVersion: Found TOF geometry " << TString(node->GetName()) << ", treat as Id 21a "; // if(nullptr!=fTofId) fTofId->Delete(); @@ -159,7 +162,9 @@ Int_t CbmTofGeoHandler::CheckGeometryVersion() Int_t CbmTofGeoHandler::GetUniqueDetectorId(TString volName) { - if (fGeoPathHash != volName.Hash()) { NavigateTo(volName); } + if (fGeoPathHash != volName.Hash()) { + NavigateTo(volName); + } return GetUniqueDetectorId(); } @@ -192,7 +197,9 @@ Int_t CbmTofGeoHandler::GetUniqueDetectorId() CurrentVolID(cell); } else if (fGeoVersion == k14a) { // test beam - if (fUseNodeName) { Volname = CurrentNodeOffName(4); } + if (fUseNodeName) { + Volname = CurrentNodeOffName(4); + } else { Volname = CurrentVolOffName(4); } @@ -207,7 +214,9 @@ Int_t CbmTofGeoHandler::GetUniqueDetectorId() cell--; } else if (fGeoVersion == k21a) { // test beam - if (fUseNodeName) { Volname = CurrentNodeOffName(4); } + if (fUseNodeName) { + Volname = CurrentNodeOffName(4); + } else { Volname = CurrentVolOffName(4); } @@ -278,7 +287,9 @@ Int_t CbmTofGeoHandler::GetUniqueCounterId() CurrentVolID(cell); } else if (fGeoVersion == k14a) { // test beam - if (fUseNodeName) { Volname = CurrentNodeOffName(4); } + if (fUseNodeName) { + Volname = CurrentNodeOffName(4); + } else { Volname = CurrentVolOffName(4); } @@ -293,7 +304,9 @@ Int_t CbmTofGeoHandler::GetUniqueCounterId() // smodule=smtype; // for test beam setup } else if (fGeoVersion == k21a) { // test beam - if (fUseNodeName) { Volname = CurrentNodeOffName(4); } + if (fUseNodeName) { + Volname = CurrentNodeOffName(4); + } else { Volname = CurrentVolOffName(4); } @@ -410,13 +423,17 @@ Int_t CbmTofGeoHandler::VolIdGeo(const char* name) const Int_t CbmTofGeoHandler::VolId(const Text_t* name) const { - if (fIsSimulation) { return gMC->VolId(name); } + if (fIsSimulation) { + return gMC->VolId(name); + } else { // // Return the unique numeric identifier for volume name // Int_t len = strlen(name) - 1; - if (name[len] != ' ') { return VolIdGeo(name); } + if (name[len] != ' ') { + return VolIdGeo(name); + } char sname[len + 1]; memcpy(sname, name, len); sname[len] = 0; @@ -426,12 +443,16 @@ Int_t CbmTofGeoHandler::VolId(const Text_t* name) const Int_t CbmTofGeoHandler::CurrentVolID(Int_t& copy) const { - if (fIsSimulation) { return gMC->CurrentVolID(copy); } + if (fIsSimulation) { + return gMC->CurrentVolID(copy); + } else { // // Returns the current volume ID and copy number // - if (gGeoManager->IsOutside()) { return 0; } + if (gGeoManager->IsOutside()) { + return 0; + } TGeoNode* node = gGeoManager->GetCurrentNode(); copy = node->GetNumber(); Int_t id = node->GetVolume()->GetNumber(); @@ -442,16 +463,24 @@ Int_t CbmTofGeoHandler::CurrentVolID(Int_t& copy) const //_____________________________________________________________________________ Int_t CbmTofGeoHandler::CurrentVolOffID(Int_t off, Int_t& copy) const { - if (fIsSimulation) { return gMC->CurrentVolOffID(off, copy); } + if (fIsSimulation) { + return gMC->CurrentVolOffID(off, copy); + } else { // // Return the current volume "off" upward in the geometrical tree // ID and copy number // - if (off < 0 || off > gGeoManager->GetLevel()) { return 0; } - if (off == 0) { return CurrentVolID(copy); } + if (off < 0 || off > gGeoManager->GetLevel()) { + return 0; + } + if (off == 0) { + return CurrentVolID(copy); + } TGeoNode* node = gGeoManager->GetMother(off); - if (!node) { return 0; } + if (!node) { + return 0; + } copy = node->GetNumber(); return node->GetVolume()->GetNumber(); } @@ -460,7 +489,9 @@ Int_t CbmTofGeoHandler::CurrentVolOffID(Int_t off, Int_t& copy) const //_____________________________________________________________________________ const char* CbmTofGeoHandler::CurrentVolName() const { - if (fIsSimulation) { return gMC->CurrentVolName(); } + if (fIsSimulation) { + return gMC->CurrentVolName(); + } else { // // Returns the current volume name @@ -473,7 +504,9 @@ const char* CbmTofGeoHandler::CurrentVolName() const //_____________________________________________________________________________ const char* CbmTofGeoHandler::CurrentVolOffName(Int_t off) const { - if (fIsSimulation) { return gMC->CurrentVolOffName(off); } + if (fIsSimulation) { + return gMC->CurrentVolOffName(off); + } else { // // Return the current volume "off" upward in the geometrical tree @@ -520,37 +553,49 @@ void CbmTofGeoHandler::FillDetectorInfoArray(Int_t uniqueId) Int_t CbmTofGeoHandler::GetDetSystemId(Int_t uniqueId) { - if (fLastUsedDetectorID != uniqueId) { FillDetectorInfoArray(uniqueId); } + if (fLastUsedDetectorID != uniqueId) { + FillDetectorInfoArray(uniqueId); + } return fDetectorInfoArray.fDetectorSystem; } Int_t CbmTofGeoHandler::GetSMType(Int_t uniqueId) { - if (fLastUsedDetectorID != uniqueId) { FillDetectorInfoArray(uniqueId); } + if (fLastUsedDetectorID != uniqueId) { + FillDetectorInfoArray(uniqueId); + } return fDetectorInfoArray.fSMtype; } Int_t CbmTofGeoHandler::GetSModule(Int_t uniqueId) { - if (fLastUsedDetectorID != uniqueId) { FillDetectorInfoArray(uniqueId); } + if (fLastUsedDetectorID != uniqueId) { + FillDetectorInfoArray(uniqueId); + } return fDetectorInfoArray.fSModule; } Int_t CbmTofGeoHandler::GetCounter(Int_t uniqueId) { - if (fLastUsedDetectorID != uniqueId) { FillDetectorInfoArray(uniqueId); } + if (fLastUsedDetectorID != uniqueId) { + FillDetectorInfoArray(uniqueId); + } return fDetectorInfoArray.fCounter; } Int_t CbmTofGeoHandler::GetGap(Int_t uniqueId) { - if (fLastUsedDetectorID != uniqueId) { FillDetectorInfoArray(uniqueId); } + if (fLastUsedDetectorID != uniqueId) { + FillDetectorInfoArray(uniqueId); + } return fDetectorInfoArray.fGap; } Int_t CbmTofGeoHandler::GetCell(Int_t uniqueId) { - if (fLastUsedDetectorID != uniqueId) { FillDetectorInfoArray(uniqueId); } + if (fLastUsedDetectorID != uniqueId) { + FillDetectorInfoArray(uniqueId); + } return fDetectorInfoArray.fCell; } @@ -568,46 +613,60 @@ Int_t CbmTofGeoHandler::GetCellId(Int_t uniqueId) { return fTofId->GetCellId(uni Float_t CbmTofGeoHandler::GetSizeX(TString volName) { - if (fGeoPathHash != volName.Hash()) { NavigateTo(volName); } + if (fGeoPathHash != volName.Hash()) { + NavigateTo(volName); + } Float_t sizex = fVolumeShape->GetDX(); return sizex; } Float_t CbmTofGeoHandler::GetSizeY(TString volName) { - if (fGeoPathHash != volName.Hash()) { NavigateTo(volName); } + if (fGeoPathHash != volName.Hash()) { + NavigateTo(volName); + } Float_t sizey = fVolumeShape->GetDY(); return sizey; } Float_t CbmTofGeoHandler::GetSizeZ(TString volName) { - if (fGeoPathHash != volName.Hash()) { NavigateTo(volName); } + if (fGeoPathHash != volName.Hash()) { + NavigateTo(volName); + } Float_t sizez = fVolumeShape->GetDZ(); return sizez; } Float_t CbmTofGeoHandler::GetZ(TString volName) { - if (fGeoPathHash != volName.Hash()) { NavigateTo(volName); } + if (fGeoPathHash != volName.Hash()) { + NavigateTo(volName); + } return fGlobal[2]; } Float_t CbmTofGeoHandler::GetY(TString volName) { - if (fGeoPathHash != volName.Hash()) { NavigateTo(volName); } + if (fGeoPathHash != volName.Hash()) { + NavigateTo(volName); + } return fGlobal[1]; } Float_t CbmTofGeoHandler::GetX(TString volName) { - if (fGeoPathHash != volName.Hash()) { NavigateTo(volName); } + if (fGeoPathHash != volName.Hash()) { + NavigateTo(volName); + } return fGlobal[0]; } void CbmTofGeoHandler::NavigateTo(TString volName) { - if (fIsSimulation) { LOG(fatal) << "This methode is not supported in simulation mode"; } + if (fIsSimulation) { + LOG(fatal) << "This methode is not supported in simulation mode"; + } else { gGeoManager->cd(volName.Data()); fGeoPathHash = volName.Hash(); diff --git a/macro/mcbm/mcbm_transport.C b/macro/mcbm/mcbm_transport.C index 3f502c314cf0069e327b4b16fd8103ef72cead11..edeab6107004582e2d2d21ed3a4dfae5039ac434 100644 --- a/macro/mcbm/mcbm_transport.C +++ b/macro/mcbm/mcbm_transport.C @@ -29,7 +29,9 @@ void mcbm_transport(Int_t nEvents = 10, // const char* setupName = "mcbm_beam_2022_03", // const char* setupName = "mcbm_beam_2022_02", // const char* setupName = "mcbm_beam_2022_01", - const char* setupName = "mcbm_beam_2022_06_16_gold", + const char* setupName = "mcbm_beam_2024_03_22_gold", + // const char* setupName = "mcbm_beam_2023_00_much_out_sts_downstream", + // const char* setupName = "mcbm_beam_2022_06_16_gold", // const char* setupName = "mcbm_beam_2022_05_23_nickel", // const char* setupName = "mcbm_beam_2022_03_28_uranium", // const char* setupName = "mcbm_beam_2022_03_27_iron", @@ -43,8 +45,7 @@ void mcbm_transport(Int_t nEvents = 10, // const char* setupName = "mcbm_beam_2019_11", // const char* setupName = "mcbm_beam_2019_03", // const char* setupName = "sis18_mcbm_25deg_long", - const char* output = "data/test", const char* inputFile = "", - Bool_t overwrite = kTRUE, int randomSeed = 0) + const char* output = "data/test", const char* inputFile = "", Bool_t overwrite = kTRUE) { // --- Define the beam angle ---------------------------------------------- Double_t beamRotY = 25.; @@ -118,33 +119,32 @@ void mcbm_transport(Int_t nEvents = 10, // DE run.AddInput(new FairParticleGenerator(2212, 1, 0., 0., 1.)); // single proton along beam axis - // ACC // geometrical acceptance - // - // ACC Double_t stszoff = 0.; // nominal - // IRO Double_t stszoff = 5.; // Iron Carbon 2022 - // CAR Double_t stszoff = 7.; // July 2021 and Carbon 2022 - // nominal - // - // ACC // mSTS station 0 - // ACC SetTrack(&run, beamRotY,-13, -5.9, +5.8, 28.5 + stszoff); - // ACC SetTrack(&run, beamRotY,-13, -5.9, 0.0, 28.5 + stszoff); - // ACC SetTrack(&run, beamRotY,-13, -5.9, -5.8, 28.5 + stszoff); - // ACC // - // ACC SetTrack(&run, beamRotY, 11, -2.9, +8.8, 41.5 + stszoff); - // ACC SetTrack(&run, beamRotY, 11, -2.9, 0.0, 41.5 + stszoff); - // ACC SetTrack(&run, beamRotY, 11, -2.9, -8.8, 41.5 + stszoff); - // ACC // - // ACC SetTrack(&run, beamRotY, 11, 0.0, +5.8, 28.5 + stszoff); - // ACC SetTrack(&run, beamRotY, 11, 0.0, 0.0, 28.5 + stszoff); - // ACC SetTrack(&run, beamRotY, 11, 0.0, -5.8, 28.5 + stszoff); - // ACC // - // ACC SetTrack(&run, beamRotY, 11, +2.9, +8.8, 41.5 + stszoff); - // ACC SetTrack(&run, beamRotY, 11, +2.9, 0.0, 41.5 + stszoff); - // ACC SetTrack(&run, beamRotY, 11, +2.9, -8.8, 41.5 + stszoff); - // ACC // - // ACC SetTrack(&run, beamRotY,-11, +5.9, +5.8, 28.5 + stszoff); - // ACC SetTrack(&run, beamRotY,-11, +5.9, 0.0, 28.5 + stszoff); - // ACC SetTrack(&run, beamRotY,-11, +5.9, -5.8, 28.5 + stszoff); +// geometrical acceptance + +// Double_t stszoff = 0.; // nominal + Double_t stszoff = 5.; // Iron Carbon 2022 + // Double_t stszoff = 7.; // July 2021 and Carbon 2022 + +// mSTS station 0 + SetTrack(&run, beamRotY,-13, -5.9, +5.8, 28.5 + stszoff); + SetTrack(&run, beamRotY,-13, -5.9, 0.0, 28.5 + stszoff); + SetTrack(&run, beamRotY,-13, -5.9, -5.8, 28.5 + stszoff); +// + SetTrack(&run, beamRotY, 11, -2.9, +8.8, 41.5 + stszoff); + SetTrack(&run, beamRotY, 11, -2.9, 0.0, 41.5 + stszoff); + SetTrack(&run, beamRotY, 11, -2.9, -8.8, 41.5 + stszoff); +// + SetTrack(&run, beamRotY, 11, 0.0, +5.8, 28.5 + stszoff); + SetTrack(&run, beamRotY, 11, 0.0, 0.0, 28.5 + stszoff); + SetTrack(&run, beamRotY, 11, 0.0, -5.8, 28.5 + stszoff); +// + SetTrack(&run, beamRotY, 11, +2.9, +8.8, 41.5 + stszoff); + SetTrack(&run, beamRotY, 11, +2.9, 0.0, 41.5 + stszoff); + SetTrack(&run, beamRotY, 11, +2.9, -8.8, 41.5 + stszoff); +// + SetTrack(&run, beamRotY,-11, +5.9, +5.8, 28.5 + stszoff); + SetTrack(&run, beamRotY,-11, +5.9, 0.0, 28.5 + stszoff); + SetTrack(&run, beamRotY,-11, +5.9, -5.8, 28.5 + stszoff); // // TOFDS SetTrack(&run, beamRotY,-13, 71, +5.8, 235); // TOFDS SetTrack(&run, beamRotY,-13, 71, 0.0, 235); @@ -197,7 +197,7 @@ void mcbm_transport(Int_t nEvents = 10, // clang-format on // comment the following line to remove target interaction - run.AddInput(inFile); + // run.AddInput(inFile); run.SetOutFileName(outFile, overwrite); run.SetParFileName(parFile); run.SetGeoFileName(geoFile); @@ -209,7 +209,6 @@ void mcbm_transport(Int_t nEvents = 10, run.SetBeamAngle(beamRotY * TMath::DegToRad(), 0.); if (nEvents <= 10) // store only for small number of events run.StoreTrajectories(); - run.SetRandomSeed(randomSeed); run.Run(nEvents); // ------------------------------------------------------------------------