From 121cb79317f7337b87cbd51680b24c8a5fa52243 Mon Sep 17 00:00:00 2001 From: tubagundem Date: Thu, 15 Oct 2026 15:05:21 +0200 Subject: [PATCH 1/2] Extending track references --- .../include/CPVSimulation/Detector.h | 1 + Detectors/CPV/simulation/src/Detector.cxx | 8 + .../include/FDDSimulation/Detector.h | 1 + Detectors/FIT/FDD/simulation/src/Detector.cxx | 14 +- .../include/FT0Simulation/Detector.h | 5 +- Detectors/FIT/FT0/simulation/src/Detector.cxx | 224 +++++++++--------- .../include/FV0Simulation/Detector.h | 1 + Detectors/FIT/FV0/simulation/src/Detector.cxx | 8 + .../include/MFTSimulation/Detector.h | 1 + .../ITSMFT/MFT/simulation/src/Detector.cxx | 8 + Detectors/PHOS/simulation/src/Detector.cxx | 1 + .../include/TOFSimulation/Detector.h | 5 +- Detectors/TOF/simulation/src/Detector.cxx | 10 +- 13 files changed, 171 insertions(+), 116 deletions(-) diff --git a/Detectors/CPV/simulation/include/CPVSimulation/Detector.h b/Detectors/CPV/simulation/include/CPVSimulation/Detector.h index c9ece3ba482ec..3bd41f89c7ea2 100644 --- a/Detectors/CPV/simulation/include/CPVSimulation/Detector.h +++ b/Detectors/CPV/simulation/include/CPVSimulation/Detector.h @@ -157,6 +157,7 @@ class Detector : public o2::base::DetImpl // Simulation std::vector* mHits = nullptr; //! Collection of CPV hits + int mTrackRefLastTrackID = -1; //! last track that received a TrackReference in the current event template friend class o2::base::DetImpl; diff --git a/Detectors/CPV/simulation/src/Detector.cxx b/Detectors/CPV/simulation/src/Detector.cxx index ee6ceef3de1e3..1203aad5526f9 100644 --- a/Detectors/CPV/simulation/src/Detector.cxx +++ b/Detectors/CPV/simulation/src/Detector.cxx @@ -106,6 +106,7 @@ void Detector::Reset() if (!o2::utils::ShmManager::Instance().isOperational()) { mHits->clear(); } + mTrackRefLastTrackID = -1; } void Detector::Register() { FairRootManager::Instance()->RegisterAny(addNameTo("Hit").data(), mHits, kTRUE); } @@ -123,6 +124,13 @@ Bool_t Detector::ProcessHits(FairVolume* v) // ported from AliRoot 2019 // ------------------------------------------------------------------------ + if (fMC->IsTrackEntering() && !fMC->IsNewTrack() && fMC->TrackCharge() != 0) { // one reference per charged particle, first entry from outside + auto o2stack = static_cast(fMC->GetStack()); + if (o2stack->GetCurrentTrackNumber() != mTrackRefLastTrackID) { + mTrackRefLastTrackID = o2stack->GetCurrentTrackNumber(); + o2stack->addTrackReference(o2::TrackReference(*fMC, GetDetId())); + } + } // analyze only charged if (fMC->TrackCharge() == 0) { fMC->SetMaxStep(1.e10); diff --git a/Detectors/FIT/FDD/simulation/include/FDDSimulation/Detector.h b/Detectors/FIT/FDD/simulation/include/FDDSimulation/Detector.h index 485197b30d0bb..363c05dd4fec4 100644 --- a/Detectors/FIT/FDD/simulation/include/FDDSimulation/Detector.h +++ b/Detectors/FIT/FDD/simulation/include/FDDSimulation/Detector.h @@ -71,6 +71,7 @@ class Detector : public o2::base::DetImpl /// Container for data points std::vector* mHits = nullptr; + int mTrackRefLastTrackID = -1; //! last track that received a TrackReference in the current event Detector& operator=(const Detector&); diff --git a/Detectors/FIT/FDD/simulation/src/Detector.cxx b/Detectors/FIT/FDD/simulation/src/Detector.cxx index 3bb945ddd1bba..c74f65ad29d20 100644 --- a/Detectors/FIT/FDD/simulation/src/Detector.cxx +++ b/Detectors/FIT/FDD/simulation/src/Detector.cxx @@ -103,6 +103,13 @@ void Detector::InitializeO2Detector() Bool_t Detector::ProcessHits(FairVolume* vol) { // This is step manager + if (fMC->IsTrackEntering() && !fMC->IsNewTrack() && fMC->TrackCharge() != 0) { // one reference per charged particle, first entry from outside + auto o2stack = static_cast(fMC->GetStack()); + if (o2stack->GetCurrentTrackNumber() != mTrackRefLastTrackID) { + mTrackRefLastTrackID = o2stack->GetCurrentTrackNumber(); + o2stack->addTrackReference(o2::TrackReference(*fMC, GetDetId())); + } + } // do not track neutral particles if (!(fMC->TrackCharge())) { return kFALSE; @@ -138,7 +145,7 @@ Bool_t Detector::ProcessHits(FairVolume* vol) // FDA 3 = 12-15 Float_t fFDDLightYield(12.8e6); - //BC420 yield is 0.64 of antracene which is 20k photons/MeV = 12800/MeV = 12.8e6/GeV + // BC420 yield is 0.64 of antracene which is 20k photons/MeV = 12800/MeV = 12.8e6/GeV Float_t destep_ad = fMC->Edep(); Int_t nPhotonsInStep_ad = Int_t(fFDDLightYield * destep_ad); @@ -164,7 +171,7 @@ Bool_t Detector::ProcessHits(FairVolume* vol) if (fMC->IsTrackExiting() || fMC->IsTrackStop() || fMC->IsTrackDisappeared()) { Int_t trackID = fMC->GetStack()->GetCurrentTrackNumber(); - Float_t time = fMC->TrackTime() * 1.0e9; //time from seconds to ns + Float_t time = fMC->TrackTime() * 1.0e9; // time from seconds to ns addHit(trackID, ADsector, vPos, time, eloss_ad, nPhotons_ad); return kTRUE; @@ -176,7 +183,7 @@ Bool_t Detector::ProcessHits(FairVolume* vol) //_____________________________________________________________________________ Hit* Detector::addHit(int trackID, unsigned short detID, const TVector3& Pos, double Time, double eLoss, int nPhot) { - //LOG(info) << "FDD hit "<emplace_back(trackID, detID, Pos, Time, eLoss, nPhot); auto stack = (o2::data::Stack*)fMC->GetStack(); stack->addHit(GetDetId()); @@ -373,4 +380,5 @@ void Detector::Reset() if (!o2::utils::ShmManager::Instance().isOperational()) { mHits->clear(); } + mTrackRefLastTrackID = -1; } diff --git a/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h b/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h index ebfe6e4a1ba3a..a35af48ba7334 100644 --- a/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h +++ b/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h @@ -149,8 +149,8 @@ class Detector : public o2::base::DetImpl std::vector mRindexFrontWindow; // Define the aluminium frame for the detector - TGeoVolume* constructFrameAGeometry(); //A-side - TGeoVolume* constructFrameCGeometry(); //C-side + TGeoVolume* constructFrameAGeometry(); // A-side + TGeoVolume* constructFrameCGeometry(); // C-side std::string cPlateShapeString(); // BEGIN: Support structure constants @@ -179,6 +179,7 @@ class Detector : public o2::base::DetImpl /// Container for data points std::vector* mHits = nullptr; + int mTrackRefLastTrackID = -1; //! last track that received a TrackReference in the current event // Define volume IDs int mREGVolID = -1; diff --git a/Detectors/FIT/FT0/simulation/src/Detector.cxx b/Detectors/FIT/FT0/simulation/src/Detector.cxx index 3b7bff8d51633..2932d1d1cacc8 100644 --- a/Detectors/FIT/FT0/simulation/src/Detector.cxx +++ b/Detectors/FIT/FT0/simulation/src/Detector.cxx @@ -134,7 +134,7 @@ void Detector::ConstructGeometry() TGeoCombiTrans* comCable[nCellsC]; TString nameCom; - //Additional elements for the C-side frame + // Additional elements for the C-side frame TGeoCombiTrans* plateCom[nCellsC]; TGeoMedium* Al = gGeoManager->GetMedium("FT0_Aluminium$"); TGeoCompositeShape* plateCompositeShape = new TGeoCompositeShape("plateCompositeShape", cPlateShapeString().c_str()); @@ -161,26 +161,26 @@ void Detector::ConstructGeometry() TGeoVolume* cables = SetCablesSize(itr); LOG(debug) << " C " << mPosModuleCx[ic] << " " << mPosModuleCy[ic]; // cables->Print(); - //Additional shift (+0.1) introduced to cable planes so they don't overlap the C-side frame + // Additional shift (+0.1) introduced to cable planes so they don't overlap the C-side frame comCable[ic] = new TGeoCombiTrans(mPosModuleCx[ic], mPosModuleCy[ic], mPosModuleCz[ic] + mInStart[2] + 0.2 + 0.1, rot[ic]); TGeoHMatrix hmCable = *comCable[ic]; TGeoHMatrix* phCable = new TGeoHMatrix(hmCable); stlinC->AddNode(cables, itr, comCable[ic]); - //C-side frame elements - module plates + // C-side frame elements - module plates plateCom[ic] = new TGeoCombiTrans(mPosModuleCx[ic], mPosModuleCy[ic], (mPosModuleCz[ic] - 3), rot[ic]); TGeoHMatrix hmPlate = *plateCom[ic]; TGeoHMatrix* phPlate = new TGeoHMatrix(hmPlate); stlinC->AddNode(plateVol, itr, phPlate); } - //Add C-side frame + // Add C-side frame stlinC->AddNode(constructFrameCGeometry(), nCellsA + nCellsC + 1); TGeoVolume* alice = gGeoManager->GetVolume("barrel"); - //Add A-side detector - alice->AddNode(stlinA, 1, new TGeoTranslation(0, 30., zdetA + 0.63)); //offset to avoid overlap with FV0 + // Add A-side detector + alice->AddNode(stlinA, 1, new TGeoTranslation(0, 30., zdetA + 0.63)); // offset to avoid overlap with FV0 - //Add C-side detector + // Add C-side detector TGeoRotation* rotC = new TGeoRotation("rotC", 90., 0., 90., 90., 180., 0.); alice->AddNode(stlinC, 1, new TGeoCombiTrans(0., 30., -zdetC, rotC)); @@ -214,7 +214,7 @@ void Detector::SetOneMCP(TGeoVolume* ins) const double kWrapClearance = 1.e-4; // cm Float_t ptopref[3] = {static_cast(ptop[0] + 2 * prfv[0] + kWrapClearance), static_cast(ptop[1] + 2 * prfh[1] + kWrapClearance), 1.}; - Float_t pmcp[3] = {2.949, 2.949, 0.66}; // MCP + Float_t pmcp[3] = {2.949, 2.949, 0.66}; // MCP Float_t pmcpinner[3] = {2.749, 2.749, 0.1}; Float_t pmcpbase[3] = {2.949, 2.949, 0.675}; Float_t pmcpside[3] = {0.15, 2.949, 0.65}; @@ -431,18 +431,18 @@ void Detector::addAlignableVolumes() const } } -//Construction of FT0-A support structure -//The frame is constructed by first building a block of Aluminum as a mother volume from which details can -//be subtracted. First, 6 boxe shapes are subtracted from around the edges and 2 from the center of the frame -//to create the fin shapes at the edges of the detector and the cross shape at the center of the detector. -//These boxe shapes are then subtracted again but from positions reflected in both x and y which is -//reflects the symmetry of the frame. Then a loop is used to subtract out the PMT sockets which are also -//box shapes from the positions given in the Geometry.cxx file. In the loop, after a socket is subtracted, -//either an inner or an outer plate group is placed inside of it. Inner and outer plate groups are -//both composed of a cover plate and a cable plate with fiber heads subtracted from the cable plate. -//The orientation of these holes differs between the inner and outer plates making them distinct. -//Contributors: Joe Crowley (2019-20), Jason Pruitt (2020-21), Sam Christensen (2021-22), -//and Jennifer Klay (2019-22) from Cal Poly SLO. +// Construction of FT0-A support structure +// The frame is constructed by first building a block of Aluminum as a mother volume from which details can +// be subtracted. First, 6 boxe shapes are subtracted from around the edges and 2 from the center of the frame +// to create the fin shapes at the edges of the detector and the cross shape at the center of the detector. +// These boxe shapes are then subtracted again but from positions reflected in both x and y which is +// reflects the symmetry of the frame. Then a loop is used to subtract out the PMT sockets which are also +// box shapes from the positions given in the Geometry.cxx file. In the loop, after a socket is subtracted, +// either an inner or an outer plate group is placed inside of it. Inner and outer plate groups are +// both composed of a cover plate and a cable plate with fiber heads subtracted from the cable plate. +// The orientation of these holes differs between the inner and outer plates making them distinct. +// Contributors: Joe Crowley (2019-20), Jason Pruitt (2020-21), Sam Christensen (2021-22), +// and Jennifer Klay (2019-22) from Cal Poly SLO. TGeoVolume* Detector::constructFrameAGeometry() { // define the media @@ -452,20 +452,20 @@ TGeoVolume* Detector::constructFrameAGeometry() // make a volume assembly for the frame TGeoVolumeAssembly* FT0_Frame = new TGeoVolumeAssembly("FT0_Frame"); - //Define the block of aluminum that forms the frame - Double_t blockdX = 37.1; //slightly larger in x - Double_t blockdY = 36.85; //than y - Double_t blockdZ = 6.95; //thickness of frame and back plates + // Define the block of aluminum that forms the frame + Double_t blockdX = 37.1; // slightly larger in x + Double_t blockdY = 36.85; // than y + Double_t blockdZ = 6.95; // thickness of frame and back plates TGeoBBox* block = new TGeoBBox("block", blockdX / 2, blockdY / 2, blockdZ / 2); - //To form the outer frame shape with fins that bolt it to the FV0, remove - //aluminum in six chunks (boxes) from two sides, then reflect these to remove - //from the other sides. As viewed from the back side of the detector, count - //clockwise from bottom left for numbering. - Double_t box1dX = 1.57; //narrower - Double_t box1dY = 6.55; //than it is tall - Double_t box1PosX = -(blockdX / 2 - box1dX / 2); //placement on the frame block - Double_t box1PosY = 0; //starts at the middle + // To form the outer frame shape with fins that bolt it to the FV0, remove + // aluminum in six chunks (boxes) from two sides, then reflect these to remove + // from the other sides. As viewed from the back side of the detector, count + // clockwise from bottom left for numbering. + Double_t box1dX = 1.57; // narrower + Double_t box1dY = 6.55; // than it is tall + Double_t box1PosX = -(blockdX / 2 - box1dX / 2); // placement on the frame block + Double_t box1PosY = 0; // starts at the middle TGeoBBox* box1 = new TGeoBBox("box1", box1dX / 2, box1dY / 2, blockdZ / 2); TGeoTranslation* box1Tr1 = new TGeoTranslation("box1Tr1", box1PosX, box1PosY, 0); box1Tr1->RegisterYourself(); @@ -482,14 +482,14 @@ TGeoVolume* Detector::constructFrameAGeometry() TGeoTranslation* box2Tr2 = new TGeoTranslation("box2Tr2", -box2PosX, -box2PosY, 0); box2Tr2->RegisterYourself(); - //Box 3 is shallower than the others to preserve the aluminum fin where the - //FT0 is bolted to the FV0 + // Box 3 is shallower than the others to preserve the aluminum fin where the + // FT0 is bolted to the FV0 Double_t box3dX = 12.7; Double_t box3dY = 3; Double_t box3dZ = 5.45; Double_t box3PosX = -(blockdX / 2 - box2dX - box3dZ / 2); Double_t box3PosY = blockdY / 2 - box3dY / 2; - Double_t box3PosZ = blockdZ / 2 - box3dZ / 2; //subtract from the back, leaving fin on the front + Double_t box3PosZ = blockdZ / 2 - box3dZ / 2; // subtract from the back, leaving fin on the front TGeoBBox* box3 = new TGeoBBox("box3", box3dX / 2, box3dY / 2, box3dZ / 2); TGeoTranslation* box3Tr1 = new TGeoTranslation("box3Tr1", box3PosX, box3PosY, box3PosZ); box3Tr1->RegisterYourself(); @@ -516,25 +516,25 @@ TGeoVolume* Detector::constructFrameAGeometry() TGeoTranslation* box5Tr2 = new TGeoTranslation("box5Tr2", -box5PosX, -box5PosY, 0); box5Tr2->RegisterYourself(); - //Similar to box 3, box 6 is shallower in z to leave aluminum for the fin that - //bolts FT0 to FV0 + // Similar to box 3, box 6 is shallower in z to leave aluminum for the fin that + // bolts FT0 to FV0 Double_t box6dX = 2.9; Double_t box6dY = 12.2; Double_t box6dZ = 5.45; Double_t box6PosX = blockdX / 2 - box6dX / 2; Double_t box6PosY = blockdY / 2 - box5dY - box6dY / 2; - Double_t box6PosZ = blockdZ / 2 - box6dZ / 2; //subtract from the back, leaving fin at the front + Double_t box6PosZ = blockdZ / 2 - box6dZ / 2; // subtract from the back, leaving fin at the front TGeoBBox* box6 = new TGeoBBox("box6", box6dX / 2, box6dY / 2, box6dZ / 2); TGeoTranslation* box6Tr1 = new TGeoTranslation("box6Tr1", box6PosX, box6PosY, box6PosZ); box6Tr1->RegisterYourself(); TGeoTranslation* box6Tr2 = new TGeoTranslation("box6Tr2", -box6PosX, -box6PosY, box6PosZ); box6Tr2->RegisterYourself(); - //The central hole that accommodates the beam pipe is not the same on all four sides - //so we define two rectangular boxes - one vertical and one horizontal - and copy/rotate them - //to remove the aluminum in a "+" shape at the center - // cbox is a central rectangle - Double_t cbox1dX = 7.175; //horizontal center box + // The central hole that accommodates the beam pipe is not the same on all four sides + // so we define two rectangular boxes - one vertical and one horizontal - and copy/rotate them + // to remove the aluminum in a "+" shape at the center + // cbox is a central rectangle + Double_t cbox1dX = 7.175; // horizontal center box Double_t cbox1dY = 5.5; Double_t cbox1Xoffset = 14.425; Double_t cbox1PosX = -(blockdX / 2 - cbox1Xoffset - cbox1dX / 2); @@ -545,7 +545,7 @@ TGeoVolume* Detector::constructFrameAGeometry() TGeoTranslation* cbox1Tr2 = new TGeoTranslation("cbox1Tr2", -cbox1PosX, -cbox1PosY, 0); cbox1Tr2->RegisterYourself(); - Double_t cbox2dX = 5.75; //vertical center box + Double_t cbox2dX = 5.75; // vertical center box Double_t cbox2dY = 6.575; Double_t cbox2Yoffset = 14.425; @@ -557,11 +557,11 @@ TGeoVolume* Detector::constructFrameAGeometry() TGeoTranslation* cbox2Tr2 = new TGeoTranslation("cbox2Tr2", -cbox2PosX, -cbox2PosY, 0); cbox2Tr2->RegisterYourself(); - //The two L-shaped pieces that form the frame have a small 1mm gap between them, - //where they come together. As viewed from the back, the gaps are on the upper - //left and lower right, so that for the center column of modules, the upper two - //are shifted slightly to the right (as viewed from the back) and the lower two - //are shifted slightly to the left (as viewed from the back) + // The two L-shaped pieces that form the frame have a small 1mm gap between them, + // where they come together. As viewed from the back, the gaps are on the upper + // left and lower right, so that for the center column of modules, the upper two + // are shifted slightly to the right (as viewed from the back) and the lower two + // are shifted slightly to the left (as viewed from the back) Double_t gapBoxdX = 0.1; Double_t gapBoxdY = blockdY / 2; Double_t gapPosX = -(sPmtSide / 2 + sEps + gapBoxdX / 2); @@ -572,8 +572,8 @@ TGeoVolume* Detector::constructFrameAGeometry() TGeoTranslation* gapBoxTr2 = new TGeoTranslation("gapBoxTr2", -gapPosX, -gapPosY, 0); gapBoxTr2->RegisterYourself(); - //Create a string to define the complete frame object shape - //Start from the aluminum block then subtract the boxes + // Create a string to define the complete frame object shape + // Start from the aluminum block then subtract the boxes std::string frameACompositeString = "block "; frameACompositeString += "- box1:box1Tr1 - box1:box1Tr2 "; frameACompositeString += "- box2:box2Tr1 - box2:box2Tr2 "; @@ -585,33 +585,33 @@ TGeoVolume* Detector::constructFrameAGeometry() frameACompositeString += "- cbox2:cbox2Tr1 - cbox2:cbox2Tr2 "; frameACompositeString += "- gapBox:gapBoxTr1 - gapBox:gapBoxTr2"; - //The next section defines the objects that form the sockets in the - //frame for the sensitive elements and the individual cover plates - //at the front of the detector which include the optical fiber - //heads that permit the LED pulser light to reach the quartz radiator - //surfaces of each module + // The next section defines the objects that form the sockets in the + // frame for the sensitive elements and the individual cover plates + // at the front of the detector which include the optical fiber + // heads that permit the LED pulser light to reach the quartz radiator + // surfaces of each module - //There are two fiber head configurations, called "inner" and "outer" - //with different locations and angles of the fiber heads. - Double_t coverPlatedZ = 0.2; //top cover thickness - Double_t fiberPlatedZ = 0.5; //fiberhead plate is underneath + // There are two fiber head configurations, called "inner" and "outer" + // with different locations and angles of the fiber heads. + Double_t coverPlatedZ = 0.2; // top cover thickness + Double_t fiberPlatedZ = 0.5; // fiberhead plate is underneath - //Each fiber is guided to a small rectangular opening in the plate - Double_t opticalFiberHeaddY = 0.52; //narrow side - Double_t opticalFiberHeaddX = 1.142; //long side + // Each fiber is guided to a small rectangular opening in the plate + Double_t opticalFiberHeaddY = 0.52; // narrow side + Double_t opticalFiberHeaddX = 1.142; // long side - //The "top" two fiber heads are positioned at slightly different - //locations than the bottom two, which are also rotated + // The "top" two fiber heads are positioned at slightly different + // locations than the bottom two, which are also rotated //"Outer" fiberhead placements Double_t fh1TopPosX = -1.6; Double_t fh1TopPosY = 1.325; Double_t fh1BotPosX = 1.555; Double_t fh1BotPosY = 1.249; - Double_t fh1BotAngle = 16; //degrees + Double_t fh1BotAngle = 16; // degrees //"Inner" fiberhead placements - //All of these are placed at an angle + // All of these are placed at an angle Double_t fh2TopPosX = -1.563; Double_t fh2TopPosY = 1.4625; Double_t fh2TopAngle = 60; @@ -645,7 +645,7 @@ TGeoVolume* Detector::constructFrameAGeometry() TGeoCombiTrans* fh2BotTr2 = new TGeoCombiTrans("fh2BotTr2", fh2BotPosX, -fh2BotPosY, 0, new TGeoRotation("fh2BotRot2", fh2BotAngle, 0, 0)); fh2BotTr2->RegisterYourself(); - //Create a string that defines the plate group for the outer plates + // Create a string that defines the plate group for the outer plates std::string outerPlateGroupString = "fiberPlate "; outerPlateGroupString += "- opticalFiberHead:fh1TopTr1 "; outerPlateGroupString += "- opticalFiberHead:fh1TopTr2 "; @@ -653,10 +653,10 @@ TGeoVolume* Detector::constructFrameAGeometry() outerPlateGroupString += "- opticalFiberHead:fh1BotTr2 "; outerPlateGroupString += "+ coverPlate:coverPlateTr"; - //Create the composite shape for the outer plates + // Create the composite shape for the outer plates TGeoCompositeShape* outerPlateGroup = new TGeoCompositeShape("outerPlateGroup", outerPlateGroupString.c_str()); - //Create a string that defines the plate group for the inner plates + // Create a string that defines the plate group for the inner plates std::string innerPlateGroupString = "fiberPlate "; innerPlateGroupString += "- opticalFiberHead:fh2TopTr1 "; innerPlateGroupString += "- opticalFiberHead:fh2TopTr2 "; @@ -664,38 +664,38 @@ TGeoVolume* Detector::constructFrameAGeometry() innerPlateGroupString += "- opticalFiberHead:fh2BotTr2 "; innerPlateGroupString += "+ coverPlate:coverPlateTr"; - //Create the composite shape for the inner plates + // Create the composite shape for the inner plates TGeoCompositeShape* innerPlateGroup = new TGeoCompositeShape("innerPlateGroup", innerPlateGroupString.c_str()); - //The sockets that are cut out of the aluminum block for the senitive elements - //to fit into are offset slightly in z to leave a thin plate of aluminum at the - //back - the back plate covers + // The sockets that are cut out of the aluminum block for the senitive elements + // to fit into are offset slightly in z to leave a thin plate of aluminum at the + // back - the back plate covers Double_t backPlanedZ = 0.25; Double_t socketdZ = blockdZ - backPlanedZ; - //Define the socket volume as a box of vacuum + // Define the socket volume as a box of vacuum TGeoVolume* socket = gGeoManager->MakeBox("Socket", Vacuum, sPmtSide / 2 + sEps, sPmtSide / 2 + sEps, socketdZ / 2); - //Define the orientation angles of the plate groups that will cover - //the sockets holding the sensitive elements + // Define the orientation angles of the plate groups that will cover + // the sockets holding the sensitive elements Double_t rotAngle[Geometry::NCellsA] = {0, 0, -90, -90, -90, 0, 0, -90, -90, -90, 0, 0, 180, 180, 90, 90, 90, 180, 180, 90, 90, 90, 180, 180}; - //Define the socket and plate group translations + // Define the socket and plate group translations TGeoTranslation* trSocket[Geometry::NCellsA]; TString nameTrSocket; TGeoCombiTrans* trPlateGroup[Geometry::NCellsA]; TString nameTrPlateGroup; TString namePGRot; - //Loop over the number of modules, subtracting the sockets and adding back in the - //plate groups at the position of each module + // Loop over the number of modules, subtracting the sockets and adding back in the + // plate groups at the position of each module for (Int_t itr = 0; itr < Geometry::NCellsA; itr++) { nameTrSocket = Form("trSocket%i", itr + 1); float z = -backPlanedZ / 4.0; trSocket[itr] = new TGeoTranslation(nameTrSocket.Data(), mPosModuleAx[itr], mPosModuleAy[itr], z); trSocket[itr]->RegisterYourself(); - frameACompositeString += "- Socket:"; //subtract it from the aluminum block - frameACompositeString += nameTrSocket.Data(); //at its corresponding location + frameACompositeString += "- Socket:"; // subtract it from the aluminum block + frameACompositeString += nameTrSocket.Data(); // at its corresponding location nameTrPlateGroup = Form("trPlateGroup%i", itr + 1); namePGRot = Form("pgRot%i", itr + 1); @@ -704,29 +704,29 @@ TGeoVolume* Detector::constructFrameAGeometry() trPlateGroup[itr]->RegisterYourself(); if (itr == 0 || itr == 2 || itr == 3 || itr == 4 || itr == 5 || itr == 10 || itr == 13 || itr == 18 || itr == 19 || itr == 20 || itr == 21 || itr == 23) { - frameACompositeString += " + outerPlateGroup:"; //add the outer plate group back on to these modules + frameACompositeString += " + outerPlateGroup:"; // add the outer plate group back on to these modules frameACompositeString += nameTrPlateGroup.Data(); frameACompositeString += " "; } else { - frameACompositeString += " + innerPlateGroup:"; //or add the inner plate group back on to all other modules + frameACompositeString += " + innerPlateGroup:"; // or add the inner plate group back on to all other modules frameACompositeString += nameTrPlateGroup.Data(); frameACompositeString += " "; } } - //Finally, define the A side frame object from the complete composite shape defined above + // Finally, define the A side frame object from the complete composite shape defined above TGeoVolume* frameA = new TGeoVolume("frameA", new TGeoCompositeShape("frameA", frameACompositeString.c_str()), Al); - //Add the frame object to the mother volume + // Add the frame object to the mother volume FT0_Frame->AddNode(frameA, 1); return FT0_Frame; } -//C-side Support Structure -//This code was written by Jason Pruitt and Sam Christensen of Cal Poly in 2021 -//They followed a similar method as for the A-side frame but had to account for the -//spherical geometry of the C-side. +// C-side Support Structure +// This code was written by Jason Pruitt and Sam Christensen of Cal Poly in 2021 +// They followed a similar method as for the A-side frame but had to account for the +// spherical geometry of the C-side. TGeoVolume* Detector::constructFrameCGeometry() { @@ -842,7 +842,7 @@ TGeoVolume* Detector::constructFrameCGeometry() TGeoCombiTrans* comCorners2 = new TGeoCombiTrans("comCorners2", xCorn2, yCorn2, zCorn2, rotCorners); comCorners2->RegisterYourself(); - //Create a string that defines the composite shape + // Create a string that defines the composite shape std::string shellString = ""; shellString += "sphere1"; // start with spherical shell - this will be reflected shellString += "- sphere2:rotTr1"; // copy and combitrans a subtraction @@ -852,7 +852,7 @@ TGeoVolume* Detector::constructFrameCGeometry() shellString += "- framecornerBox:comCorners"; // subtract corners shellString += "- framecornerBox:comCorners2"; // - //Create string that defines the back plate composite shape + // Create string that defines the back plate composite shape std::string backPlateString = ""; backPlateString += "sphere3"; backPlateString += "- sphere4:rotTr1"; @@ -862,8 +862,8 @@ TGeoVolume* Detector::constructFrameCGeometry() backPlateString += "- framecornerBox:comCorners"; backPlateString += "- framecornerBox:comCorners2"; - //These could be set up to use the values in the geometry file after some - //investigation of subtle differences... + // These could be set up to use the values in the geometry file after some + // investigation of subtle differences... static constexpr Double_t xi[NCellsC] = {-15.038271418735729, 15.038271418735729, -15.003757581112167, 15.003757581112167, -9.02690018974363, 9.02690018974363, -9.026897413747076, 9.026897413747076, -9.026896531935773, 9.026896531935773, -3.0004568618531313, 3.0004568618531313, -3.0270795197907225, 3.0270795197907225, 3.0003978432927543, -3.0003978432927543, 3.0270569670429572, -3.0270569670429572, 9.026750365564254, -9.026750365564254, 9.026837450695885, -9.026837450695885, 9.026849243816981, -9.026849243816981, 15.038129472387304, -15.038129472387304, 15.003621961057961, -15.003621961057961}; static constexpr Double_t yi[NCellsC] = {3.1599494336464455, -3.1599494336464455, 9.165191680982874, -9.165191680982874, 3.1383331772537426, -3.1383331772537426, 9.165226363918643, -9.165226363918643, 15.141616002932361, -15.141616002932361, 9.16517861649866, -9.16517861649866, 15.188854859073416, -15.188854859073416, 9.165053319552113, -9.165053319552113, 15.188703787345304, -15.188703787345304, 3.138263189805292, -3.138263189805292, 9.165104089644917, -9.165104089644917, 15.141494417823818, -15.141494417823818, 3.1599158563428644, -3.1599158563428644, 9.165116302773846, -9.165116302773846}; @@ -1027,31 +1027,31 @@ TGeoVolume* Detector::constructFrameCGeometry() std::string Detector::cPlateShapeString() { - Double_t prismHeight = 0.3895; //height of vertical edge of square prism part of base - Double_t prismSide = 5.9; //width and length of square prism part of base - Double_t radCurve = 81.9469; //radius of curvature of top part of base + Double_t prismHeight = 0.3895; // height of vertical edge of square prism part of base + Double_t prismSide = 5.9; // width and length of square prism part of base + Double_t radCurve = 81.9469; // radius of curvature of top part of base Double_t delHeight = radCurve * (1.0 - TMath::Sqrt(1.0 - 0.5 * TMath::Power(prismSide / radCurve, 2.0))); - //height from top of square prism to center of curved top surface of base + // height from top of square prism to center of curved top surface of base - Double_t heightBase = prismHeight + delHeight; //from center of bottom to center of top - Double_t sliceSide = 5.3; //side lengths of slice's flat top + Double_t heightBase = prismHeight + delHeight; // from center of bottom to center of top + Double_t sliceSide = 5.3; // side lengths of slice's flat top Double_t heightBaseBox = 2 * heightBase; Double_t totalHeight = 0.5; Double_t sliceHeight = 0.5 - heightBase; - //cable dimensions and distances + // cable dimensions and distances Double_t cableHoleWidth = 0.3503; Double_t cableHoleLength = 0.9003; - Double_t cableHoleDepth = 1; //really big just to punch a hole + Double_t cableHoleDepth = 1; // really big just to punch a hole - //sholes denotes "straight holes" and rholes denote "rotated holes" - //all distances measured from edges of slice - //up and down sholes + // sholes denotes "straight holes" and rholes denote "rotated holes" + // all distances measured from edges of slice + // up and down sholes Double_t sHolesBottomEdge = 1.585; Double_t sHolesTopEdge = 0.515; Double_t sHolesAvgTopBottom = (sHolesBottomEdge + sHolesTopEdge) / 2.0; - Double_t sHolesUpFromCenter = ((sliceSide / 2.0) - sHolesAvgTopBottom); //amount up in x the sholes need to move - //left and right sholes + Double_t sHolesUpFromCenter = ((sliceSide / 2.0) - sHolesAvgTopBottom); // amount up in x the sholes need to move + // left and right sholes Double_t sHolesFarEdge = 1.585; Double_t sHolesNearEdge = 1.065; Double_t sHolesAvgNearFar = (sHolesFarEdge + sHolesNearEdge) / 2.0; @@ -1115,7 +1115,7 @@ std::string Detector::cPlateShapeString() return plateString; } -//End Support structure code +// End Support structure code //////////////////////////////////////////// Bool_t Detector::ProcessHits(FairVolume* v) @@ -1123,6 +1123,13 @@ Bool_t Detector::ProcessHits(FairVolume* v) Int_t copy; Int_t volID = fMC->CurrentVolID(copy); + if (fMC->IsTrackEntering() && !fMC->IsNewTrack() && fMC->TrackCharge() != 0 && volID == mTOPVolID) { // one reference per charged particle, first entry from outside + auto o2stack = static_cast(fMC->GetStack()); + if (o2stack->GetCurrentTrackNumber() != mTrackRefLastTrackID) { + mTrackRefLastTrackID = o2stack->GetCurrentTrackNumber(); + o2stack->addTrackReference(o2::TrackReference(*fMC, GetDetId())); + } + } TVirtualMCStack* stack = fMC->GetStack(); Int_t quadrant, mcp; @@ -1203,6 +1210,7 @@ void Detector::Reset() if (!o2::utils::ShmManager::Instance().isOperational()) { mHits->clear(); } + mTrackRefLastTrackID = -1; } void Detector::CreateMaterials() diff --git a/Detectors/FIT/FV0/simulation/include/FV0Simulation/Detector.h b/Detectors/FIT/FV0/simulation/include/FV0Simulation/Detector.h index f9126061bf214..fdff96b6eafa8 100644 --- a/Detectors/FIT/FV0/simulation/include/FV0Simulation/Detector.h +++ b/Detectors/FIT/FV0/simulation/include/FV0Simulation/Detector.h @@ -107,6 +107,7 @@ class Detector : public o2::base::DetImpl private: /// Container for hits std::vector* mHits = nullptr; + int mTrackRefLastTrackID = -1; //! last track that received a TrackReference in the current event /// Geometry pointer Geometry* mGeometry = nullptr; //! diff --git a/Detectors/FIT/FV0/simulation/src/Detector.cxx b/Detectors/FIT/FV0/simulation/src/Detector.cxx index 07eb9053bf3b8..a91c599f30020 100644 --- a/Detectors/FIT/FV0/simulation/src/Detector.cxx +++ b/Detectors/FIT/FV0/simulation/src/Detector.cxx @@ -80,6 +80,13 @@ Bool_t Detector::ProcessHits(FairVolume* v) { // This method is called from the MC stepping + if (fMC->IsTrackEntering() && !fMC->IsNewTrack() && fMC->TrackCharge() != 0) { // one reference per charged particle, first entry from outside + auto o2stack = static_cast(fMC->GetStack()); + if (o2stack->GetCurrentTrackNumber() != mTrackRefLastTrackID) { + mTrackRefLastTrackID = o2stack->GetCurrentTrackNumber(); + o2stack->addTrackReference(o2::TrackReference(*fMC, GetDetId())); + } + } // Track only charged particles and photons bool isPhotonTrack = false; Int_t particlePdg = fMC->TrackPid(); @@ -150,6 +157,7 @@ void Detector::Reset() if (!o2::utils::ShmManager::Instance().isOperational()) { mHits->clear(); } + mTrackRefLastTrackID = -1; } void Detector::EndOfEvent() diff --git a/Detectors/ITSMFT/MFT/simulation/include/MFTSimulation/Detector.h b/Detectors/ITSMFT/MFT/simulation/include/MFTSimulation/Detector.h index 1e0a58fc80217..3c44705f747c0 100644 --- a/Detectors/ITSMFT/MFT/simulation/include/MFTSimulation/Detector.h +++ b/Detectors/ITSMFT/MFT/simulation/include/MFTSimulation/Detector.h @@ -148,6 +148,7 @@ class Detector : public o2::base::DetImpl private: /// Container for hit data std::vector* mHits; + int mTrackRefLastTrackID = -1; //! last track that received a TrackReference in the current event Detector(const Detector&); Detector& operator=(const Detector&); diff --git a/Detectors/ITSMFT/MFT/simulation/src/Detector.cxx b/Detectors/ITSMFT/MFT/simulation/src/Detector.cxx index 7a5243fde8063..3de16362130d6 100644 --- a/Detectors/ITSMFT/MFT/simulation/src/Detector.cxx +++ b/Detectors/ITSMFT/MFT/simulation/src/Detector.cxx @@ -96,6 +96,13 @@ Bool_t Detector::ProcessHits(FairVolume* vol) { // This method is called from the MC stepping + if (fMC->IsTrackEntering() && !fMC->IsNewTrack() && fMC->TrackCharge() != 0) { // one reference per charged particle, first entry from outside + auto o2stack = static_cast(fMC->GetStack()); + if (o2stack->GetCurrentTrackNumber() != mTrackRefLastTrackID) { + mTrackRefLastTrackID = o2stack->GetCurrentTrackNumber(); + o2stack->addTrackReference(o2::TrackReference(*fMC, GetDetId())); + } + } // do not track neutral particles if (!(fMC->TrackCharge())) { return kFALSE; @@ -744,4 +751,5 @@ void Detector::Reset() if (!o2::utils::ShmManager::Instance().isOperational()) { mHits->clear(); } + mTrackRefLastTrackID = -1; } diff --git a/Detectors/PHOS/simulation/src/Detector.cxx b/Detectors/PHOS/simulation/src/Detector.cxx index a8ff99b3805f1..086c4dd600a3d 100644 --- a/Detectors/PHOS/simulation/src/Detector.cxx +++ b/Detectors/PHOS/simulation/src/Detector.cxx @@ -163,6 +163,7 @@ Bool_t Detector::ProcessHits(FairVolume* v) if (isNewPartile) { // mark track to be kept by stack stack->addHit(GetDetId()); + stack->addTrackReference(o2::TrackReference(*fMC, GetDetId())); // PHOS entry (new superparent) } Double_t lostenergy = fMC->Edep(); diff --git a/Detectors/TOF/simulation/include/TOFSimulation/Detector.h b/Detectors/TOF/simulation/include/TOFSimulation/Detector.h index 1aa0efb6ef61c..1dfd730efe716 100644 --- a/Detectors/TOF/simulation/include/TOFSimulation/Detector.h +++ b/Detectors/TOF/simulation/include/TOFSimulation/Detector.h @@ -158,8 +158,9 @@ class Detector : public o2::base::DetImpl Int_t mEventNr; // event count Int_t mTOFSectors[o2::tof::Geo::NSECTORS]; - Bool_t mTOFHoles; // flag to allow for holes in front of the PHOS - Int_t mLastChannelID = -1; ///< Last channel seen by the hit + Bool_t mTOFHoles; // flag to allow for holes in front of the PHOS + Int_t mLastChannelID = -1; ///< Last channel seen by the hit + Int_t mTrackRefLastTrackID = -1; //! last track that received a TrackReference in the current event /// container for data points std::vector* mHits; //! diff --git a/Detectors/TOF/simulation/src/Detector.cxx b/Detectors/TOF/simulation/src/Detector.cxx index a9af40e208d81..9e16c0b8da45d 100644 --- a/Detectors/TOF/simulation/src/Detector.cxx +++ b/Detectors/TOF/simulation/src/Detector.cxx @@ -75,6 +75,13 @@ void Detector::InitializeO2Detector() Bool_t Detector::ProcessHits(FairVolume* v) { // This method is called from the MC stepping for the sensitive volume only + if (fMC->IsTrackEntering() && !fMC->IsNewTrack() && fMC->TrackCharge() != 0) { // one reference per charged particle, first entry from outside + auto o2stack = static_cast(fMC->GetStack()); + if (o2stack->GetCurrentTrackNumber() != mTrackRefLastTrackID) { + mTrackRefLastTrackID = o2stack->GetCurrentTrackNumber(); + o2stack->addTrackReference(o2::TrackReference(*fMC, GetDetId())); + } + } if (static_cast(fMC->TrackCharge()) == 0) { // set a very large step size for neutral particles return kFALSE; // take only charged particles @@ -130,6 +137,7 @@ void Detector::Reset() mHits->clear(); } mLastChannelID = -1; + mTrackRefLastTrackID = -1; } void Detector::CreateMaterials() @@ -1179,7 +1187,7 @@ void Detector::createBackZone(Double_t xtof, Double_t ytof, Double_t zlenA) cons if (mTOFHoles) { TVirtualMC::GetMC()->Gsvolu("FAIB", "BOX ", getMediumID(kAir), par, 3); // Air } - TVirtualMC::GetMC()->Gsvolu("FAIC", "BOX ", getMediumID(kAir), par, 3); // Air + TVirtualMC::GetMC()->Gsvolu("FAIC", "BOX ", getMediumID(kAir), par, 3); // Air Double_t feaParam[3] = {Geo::FEAPARAMETERS[0], Geo::FEAPARAMETERS[1], Geo::FEAPARAMETERS[2]}; Double_t feaRoof1[3] = {Geo::ROOF1PARAMETERS[0], Geo::ROOF1PARAMETERS[1], Geo::ROOF1PARAMETERS[2]}; From f55fd4e6afd1967ed9ed0dc0c9b7eb6203f2c009 Mon Sep 17 00:00:00 2001 From: Sandro Wenzel Date: Fri, 23 Oct 2026 06:50:44 +0200 Subject: [PATCH 2/2] Revert unrelated formatting changes This restores the original formatting of the FT0, FDD and TOF code that the PR does not change functionally. - Only the TrackReference blocks, the new members and their Reset() lines remain. --- Detectors/FIT/FDD/simulation/src/Detector.cxx | 6 +- .../include/FT0Simulation/Detector.h | 4 +- Detectors/FIT/FT0/simulation/src/Detector.cxx | 216 +++++++++--------- Detectors/TOF/simulation/src/Detector.cxx | 2 +- 4 files changed, 114 insertions(+), 114 deletions(-) diff --git a/Detectors/FIT/FDD/simulation/src/Detector.cxx b/Detectors/FIT/FDD/simulation/src/Detector.cxx index c74f65ad29d20..174a62785494e 100644 --- a/Detectors/FIT/FDD/simulation/src/Detector.cxx +++ b/Detectors/FIT/FDD/simulation/src/Detector.cxx @@ -145,7 +145,7 @@ Bool_t Detector::ProcessHits(FairVolume* vol) // FDA 3 = 12-15 Float_t fFDDLightYield(12.8e6); - // BC420 yield is 0.64 of antracene which is 20k photons/MeV = 12800/MeV = 12.8e6/GeV + //BC420 yield is 0.64 of antracene which is 20k photons/MeV = 12800/MeV = 12.8e6/GeV Float_t destep_ad = fMC->Edep(); Int_t nPhotonsInStep_ad = Int_t(fFDDLightYield * destep_ad); @@ -171,7 +171,7 @@ Bool_t Detector::ProcessHits(FairVolume* vol) if (fMC->IsTrackExiting() || fMC->IsTrackStop() || fMC->IsTrackDisappeared()) { Int_t trackID = fMC->GetStack()->GetCurrentTrackNumber(); - Float_t time = fMC->TrackTime() * 1.0e9; // time from seconds to ns + Float_t time = fMC->TrackTime() * 1.0e9; //time from seconds to ns addHit(trackID, ADsector, vPos, time, eloss_ad, nPhotons_ad); return kTRUE; @@ -183,7 +183,7 @@ Bool_t Detector::ProcessHits(FairVolume* vol) //_____________________________________________________________________________ Hit* Detector::addHit(int trackID, unsigned short detID, const TVector3& Pos, double Time, double eLoss, int nPhot) { - // LOG(info) << "FDD hit "<emplace_back(trackID, detID, Pos, Time, eLoss, nPhot); auto stack = (o2::data::Stack*)fMC->GetStack(); stack->addHit(GetDetId()); diff --git a/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h b/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h index a35af48ba7334..75f3c7a1f188f 100644 --- a/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h +++ b/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h @@ -149,8 +149,8 @@ class Detector : public o2::base::DetImpl std::vector mRindexFrontWindow; // Define the aluminium frame for the detector - TGeoVolume* constructFrameAGeometry(); // A-side - TGeoVolume* constructFrameCGeometry(); // C-side + TGeoVolume* constructFrameAGeometry(); //A-side + TGeoVolume* constructFrameCGeometry(); //C-side std::string cPlateShapeString(); // BEGIN: Support structure constants diff --git a/Detectors/FIT/FT0/simulation/src/Detector.cxx b/Detectors/FIT/FT0/simulation/src/Detector.cxx index 2932d1d1cacc8..f0f87f4a55c22 100644 --- a/Detectors/FIT/FT0/simulation/src/Detector.cxx +++ b/Detectors/FIT/FT0/simulation/src/Detector.cxx @@ -134,7 +134,7 @@ void Detector::ConstructGeometry() TGeoCombiTrans* comCable[nCellsC]; TString nameCom; - // Additional elements for the C-side frame + //Additional elements for the C-side frame TGeoCombiTrans* plateCom[nCellsC]; TGeoMedium* Al = gGeoManager->GetMedium("FT0_Aluminium$"); TGeoCompositeShape* plateCompositeShape = new TGeoCompositeShape("plateCompositeShape", cPlateShapeString().c_str()); @@ -161,26 +161,26 @@ void Detector::ConstructGeometry() TGeoVolume* cables = SetCablesSize(itr); LOG(debug) << " C " << mPosModuleCx[ic] << " " << mPosModuleCy[ic]; // cables->Print(); - // Additional shift (+0.1) introduced to cable planes so they don't overlap the C-side frame + //Additional shift (+0.1) introduced to cable planes so they don't overlap the C-side frame comCable[ic] = new TGeoCombiTrans(mPosModuleCx[ic], mPosModuleCy[ic], mPosModuleCz[ic] + mInStart[2] + 0.2 + 0.1, rot[ic]); TGeoHMatrix hmCable = *comCable[ic]; TGeoHMatrix* phCable = new TGeoHMatrix(hmCable); stlinC->AddNode(cables, itr, comCable[ic]); - // C-side frame elements - module plates + //C-side frame elements - module plates plateCom[ic] = new TGeoCombiTrans(mPosModuleCx[ic], mPosModuleCy[ic], (mPosModuleCz[ic] - 3), rot[ic]); TGeoHMatrix hmPlate = *plateCom[ic]; TGeoHMatrix* phPlate = new TGeoHMatrix(hmPlate); stlinC->AddNode(plateVol, itr, phPlate); } - // Add C-side frame + //Add C-side frame stlinC->AddNode(constructFrameCGeometry(), nCellsA + nCellsC + 1); TGeoVolume* alice = gGeoManager->GetVolume("barrel"); - // Add A-side detector - alice->AddNode(stlinA, 1, new TGeoTranslation(0, 30., zdetA + 0.63)); // offset to avoid overlap with FV0 + //Add A-side detector + alice->AddNode(stlinA, 1, new TGeoTranslation(0, 30., zdetA + 0.63)); //offset to avoid overlap with FV0 - // Add C-side detector + //Add C-side detector TGeoRotation* rotC = new TGeoRotation("rotC", 90., 0., 90., 90., 180., 0.); alice->AddNode(stlinC, 1, new TGeoCombiTrans(0., 30., -zdetC, rotC)); @@ -214,7 +214,7 @@ void Detector::SetOneMCP(TGeoVolume* ins) const double kWrapClearance = 1.e-4; // cm Float_t ptopref[3] = {static_cast(ptop[0] + 2 * prfv[0] + kWrapClearance), static_cast(ptop[1] + 2 * prfh[1] + kWrapClearance), 1.}; - Float_t pmcp[3] = {2.949, 2.949, 0.66}; // MCP + Float_t pmcp[3] = {2.949, 2.949, 0.66}; // MCP Float_t pmcpinner[3] = {2.749, 2.749, 0.1}; Float_t pmcpbase[3] = {2.949, 2.949, 0.675}; Float_t pmcpside[3] = {0.15, 2.949, 0.65}; @@ -431,18 +431,18 @@ void Detector::addAlignableVolumes() const } } -// Construction of FT0-A support structure -// The frame is constructed by first building a block of Aluminum as a mother volume from which details can -// be subtracted. First, 6 boxe shapes are subtracted from around the edges and 2 from the center of the frame -// to create the fin shapes at the edges of the detector and the cross shape at the center of the detector. -// These boxe shapes are then subtracted again but from positions reflected in both x and y which is -// reflects the symmetry of the frame. Then a loop is used to subtract out the PMT sockets which are also -// box shapes from the positions given in the Geometry.cxx file. In the loop, after a socket is subtracted, -// either an inner or an outer plate group is placed inside of it. Inner and outer plate groups are -// both composed of a cover plate and a cable plate with fiber heads subtracted from the cable plate. -// The orientation of these holes differs between the inner and outer plates making them distinct. -// Contributors: Joe Crowley (2019-20), Jason Pruitt (2020-21), Sam Christensen (2021-22), -// and Jennifer Klay (2019-22) from Cal Poly SLO. +//Construction of FT0-A support structure +//The frame is constructed by first building a block of Aluminum as a mother volume from which details can +//be subtracted. First, 6 boxe shapes are subtracted from around the edges and 2 from the center of the frame +//to create the fin shapes at the edges of the detector and the cross shape at the center of the detector. +//These boxe shapes are then subtracted again but from positions reflected in both x and y which is +//reflects the symmetry of the frame. Then a loop is used to subtract out the PMT sockets which are also +//box shapes from the positions given in the Geometry.cxx file. In the loop, after a socket is subtracted, +//either an inner or an outer plate group is placed inside of it. Inner and outer plate groups are +//both composed of a cover plate and a cable plate with fiber heads subtracted from the cable plate. +//The orientation of these holes differs between the inner and outer plates making them distinct. +//Contributors: Joe Crowley (2019-20), Jason Pruitt (2020-21), Sam Christensen (2021-22), +//and Jennifer Klay (2019-22) from Cal Poly SLO. TGeoVolume* Detector::constructFrameAGeometry() { // define the media @@ -452,20 +452,20 @@ TGeoVolume* Detector::constructFrameAGeometry() // make a volume assembly for the frame TGeoVolumeAssembly* FT0_Frame = new TGeoVolumeAssembly("FT0_Frame"); - // Define the block of aluminum that forms the frame - Double_t blockdX = 37.1; // slightly larger in x - Double_t blockdY = 36.85; // than y - Double_t blockdZ = 6.95; // thickness of frame and back plates + //Define the block of aluminum that forms the frame + Double_t blockdX = 37.1; //slightly larger in x + Double_t blockdY = 36.85; //than y + Double_t blockdZ = 6.95; //thickness of frame and back plates TGeoBBox* block = new TGeoBBox("block", blockdX / 2, blockdY / 2, blockdZ / 2); - // To form the outer frame shape with fins that bolt it to the FV0, remove - // aluminum in six chunks (boxes) from two sides, then reflect these to remove - // from the other sides. As viewed from the back side of the detector, count - // clockwise from bottom left for numbering. - Double_t box1dX = 1.57; // narrower - Double_t box1dY = 6.55; // than it is tall - Double_t box1PosX = -(blockdX / 2 - box1dX / 2); // placement on the frame block - Double_t box1PosY = 0; // starts at the middle + //To form the outer frame shape with fins that bolt it to the FV0, remove + //aluminum in six chunks (boxes) from two sides, then reflect these to remove + //from the other sides. As viewed from the back side of the detector, count + //clockwise from bottom left for numbering. + Double_t box1dX = 1.57; //narrower + Double_t box1dY = 6.55; //than it is tall + Double_t box1PosX = -(blockdX / 2 - box1dX / 2); //placement on the frame block + Double_t box1PosY = 0; //starts at the middle TGeoBBox* box1 = new TGeoBBox("box1", box1dX / 2, box1dY / 2, blockdZ / 2); TGeoTranslation* box1Tr1 = new TGeoTranslation("box1Tr1", box1PosX, box1PosY, 0); box1Tr1->RegisterYourself(); @@ -482,14 +482,14 @@ TGeoVolume* Detector::constructFrameAGeometry() TGeoTranslation* box2Tr2 = new TGeoTranslation("box2Tr2", -box2PosX, -box2PosY, 0); box2Tr2->RegisterYourself(); - // Box 3 is shallower than the others to preserve the aluminum fin where the - // FT0 is bolted to the FV0 + //Box 3 is shallower than the others to preserve the aluminum fin where the + //FT0 is bolted to the FV0 Double_t box3dX = 12.7; Double_t box3dY = 3; Double_t box3dZ = 5.45; Double_t box3PosX = -(blockdX / 2 - box2dX - box3dZ / 2); Double_t box3PosY = blockdY / 2 - box3dY / 2; - Double_t box3PosZ = blockdZ / 2 - box3dZ / 2; // subtract from the back, leaving fin on the front + Double_t box3PosZ = blockdZ / 2 - box3dZ / 2; //subtract from the back, leaving fin on the front TGeoBBox* box3 = new TGeoBBox("box3", box3dX / 2, box3dY / 2, box3dZ / 2); TGeoTranslation* box3Tr1 = new TGeoTranslation("box3Tr1", box3PosX, box3PosY, box3PosZ); box3Tr1->RegisterYourself(); @@ -516,25 +516,25 @@ TGeoVolume* Detector::constructFrameAGeometry() TGeoTranslation* box5Tr2 = new TGeoTranslation("box5Tr2", -box5PosX, -box5PosY, 0); box5Tr2->RegisterYourself(); - // Similar to box 3, box 6 is shallower in z to leave aluminum for the fin that - // bolts FT0 to FV0 + //Similar to box 3, box 6 is shallower in z to leave aluminum for the fin that + //bolts FT0 to FV0 Double_t box6dX = 2.9; Double_t box6dY = 12.2; Double_t box6dZ = 5.45; Double_t box6PosX = blockdX / 2 - box6dX / 2; Double_t box6PosY = blockdY / 2 - box5dY - box6dY / 2; - Double_t box6PosZ = blockdZ / 2 - box6dZ / 2; // subtract from the back, leaving fin at the front + Double_t box6PosZ = blockdZ / 2 - box6dZ / 2; //subtract from the back, leaving fin at the front TGeoBBox* box6 = new TGeoBBox("box6", box6dX / 2, box6dY / 2, box6dZ / 2); TGeoTranslation* box6Tr1 = new TGeoTranslation("box6Tr1", box6PosX, box6PosY, box6PosZ); box6Tr1->RegisterYourself(); TGeoTranslation* box6Tr2 = new TGeoTranslation("box6Tr2", -box6PosX, -box6PosY, box6PosZ); box6Tr2->RegisterYourself(); - // The central hole that accommodates the beam pipe is not the same on all four sides - // so we define two rectangular boxes - one vertical and one horizontal - and copy/rotate them - // to remove the aluminum in a "+" shape at the center - // cbox is a central rectangle - Double_t cbox1dX = 7.175; // horizontal center box + //The central hole that accommodates the beam pipe is not the same on all four sides + //so we define two rectangular boxes - one vertical and one horizontal - and copy/rotate them + //to remove the aluminum in a "+" shape at the center + // cbox is a central rectangle + Double_t cbox1dX = 7.175; //horizontal center box Double_t cbox1dY = 5.5; Double_t cbox1Xoffset = 14.425; Double_t cbox1PosX = -(blockdX / 2 - cbox1Xoffset - cbox1dX / 2); @@ -545,7 +545,7 @@ TGeoVolume* Detector::constructFrameAGeometry() TGeoTranslation* cbox1Tr2 = new TGeoTranslation("cbox1Tr2", -cbox1PosX, -cbox1PosY, 0); cbox1Tr2->RegisterYourself(); - Double_t cbox2dX = 5.75; // vertical center box + Double_t cbox2dX = 5.75; //vertical center box Double_t cbox2dY = 6.575; Double_t cbox2Yoffset = 14.425; @@ -557,11 +557,11 @@ TGeoVolume* Detector::constructFrameAGeometry() TGeoTranslation* cbox2Tr2 = new TGeoTranslation("cbox2Tr2", -cbox2PosX, -cbox2PosY, 0); cbox2Tr2->RegisterYourself(); - // The two L-shaped pieces that form the frame have a small 1mm gap between them, - // where they come together. As viewed from the back, the gaps are on the upper - // left and lower right, so that for the center column of modules, the upper two - // are shifted slightly to the right (as viewed from the back) and the lower two - // are shifted slightly to the left (as viewed from the back) + //The two L-shaped pieces that form the frame have a small 1mm gap between them, + //where they come together. As viewed from the back, the gaps are on the upper + //left and lower right, so that for the center column of modules, the upper two + //are shifted slightly to the right (as viewed from the back) and the lower two + //are shifted slightly to the left (as viewed from the back) Double_t gapBoxdX = 0.1; Double_t gapBoxdY = blockdY / 2; Double_t gapPosX = -(sPmtSide / 2 + sEps + gapBoxdX / 2); @@ -572,8 +572,8 @@ TGeoVolume* Detector::constructFrameAGeometry() TGeoTranslation* gapBoxTr2 = new TGeoTranslation("gapBoxTr2", -gapPosX, -gapPosY, 0); gapBoxTr2->RegisterYourself(); - // Create a string to define the complete frame object shape - // Start from the aluminum block then subtract the boxes + //Create a string to define the complete frame object shape + //Start from the aluminum block then subtract the boxes std::string frameACompositeString = "block "; frameACompositeString += "- box1:box1Tr1 - box1:box1Tr2 "; frameACompositeString += "- box2:box2Tr1 - box2:box2Tr2 "; @@ -585,33 +585,33 @@ TGeoVolume* Detector::constructFrameAGeometry() frameACompositeString += "- cbox2:cbox2Tr1 - cbox2:cbox2Tr2 "; frameACompositeString += "- gapBox:gapBoxTr1 - gapBox:gapBoxTr2"; - // The next section defines the objects that form the sockets in the - // frame for the sensitive elements and the individual cover plates - // at the front of the detector which include the optical fiber - // heads that permit the LED pulser light to reach the quartz radiator - // surfaces of each module + //The next section defines the objects that form the sockets in the + //frame for the sensitive elements and the individual cover plates + //at the front of the detector which include the optical fiber + //heads that permit the LED pulser light to reach the quartz radiator + //surfaces of each module - // There are two fiber head configurations, called "inner" and "outer" - // with different locations and angles of the fiber heads. - Double_t coverPlatedZ = 0.2; // top cover thickness - Double_t fiberPlatedZ = 0.5; // fiberhead plate is underneath + //There are two fiber head configurations, called "inner" and "outer" + //with different locations and angles of the fiber heads. + Double_t coverPlatedZ = 0.2; //top cover thickness + Double_t fiberPlatedZ = 0.5; //fiberhead plate is underneath - // Each fiber is guided to a small rectangular opening in the plate - Double_t opticalFiberHeaddY = 0.52; // narrow side - Double_t opticalFiberHeaddX = 1.142; // long side + //Each fiber is guided to a small rectangular opening in the plate + Double_t opticalFiberHeaddY = 0.52; //narrow side + Double_t opticalFiberHeaddX = 1.142; //long side - // The "top" two fiber heads are positioned at slightly different - // locations than the bottom two, which are also rotated + //The "top" two fiber heads are positioned at slightly different + //locations than the bottom two, which are also rotated //"Outer" fiberhead placements Double_t fh1TopPosX = -1.6; Double_t fh1TopPosY = 1.325; Double_t fh1BotPosX = 1.555; Double_t fh1BotPosY = 1.249; - Double_t fh1BotAngle = 16; // degrees + Double_t fh1BotAngle = 16; //degrees //"Inner" fiberhead placements - // All of these are placed at an angle + //All of these are placed at an angle Double_t fh2TopPosX = -1.563; Double_t fh2TopPosY = 1.4625; Double_t fh2TopAngle = 60; @@ -645,7 +645,7 @@ TGeoVolume* Detector::constructFrameAGeometry() TGeoCombiTrans* fh2BotTr2 = new TGeoCombiTrans("fh2BotTr2", fh2BotPosX, -fh2BotPosY, 0, new TGeoRotation("fh2BotRot2", fh2BotAngle, 0, 0)); fh2BotTr2->RegisterYourself(); - // Create a string that defines the plate group for the outer plates + //Create a string that defines the plate group for the outer plates std::string outerPlateGroupString = "fiberPlate "; outerPlateGroupString += "- opticalFiberHead:fh1TopTr1 "; outerPlateGroupString += "- opticalFiberHead:fh1TopTr2 "; @@ -653,10 +653,10 @@ TGeoVolume* Detector::constructFrameAGeometry() outerPlateGroupString += "- opticalFiberHead:fh1BotTr2 "; outerPlateGroupString += "+ coverPlate:coverPlateTr"; - // Create the composite shape for the outer plates + //Create the composite shape for the outer plates TGeoCompositeShape* outerPlateGroup = new TGeoCompositeShape("outerPlateGroup", outerPlateGroupString.c_str()); - // Create a string that defines the plate group for the inner plates + //Create a string that defines the plate group for the inner plates std::string innerPlateGroupString = "fiberPlate "; innerPlateGroupString += "- opticalFiberHead:fh2TopTr1 "; innerPlateGroupString += "- opticalFiberHead:fh2TopTr2 "; @@ -664,38 +664,38 @@ TGeoVolume* Detector::constructFrameAGeometry() innerPlateGroupString += "- opticalFiberHead:fh2BotTr2 "; innerPlateGroupString += "+ coverPlate:coverPlateTr"; - // Create the composite shape for the inner plates + //Create the composite shape for the inner plates TGeoCompositeShape* innerPlateGroup = new TGeoCompositeShape("innerPlateGroup", innerPlateGroupString.c_str()); - // The sockets that are cut out of the aluminum block for the senitive elements - // to fit into are offset slightly in z to leave a thin plate of aluminum at the - // back - the back plate covers + //The sockets that are cut out of the aluminum block for the senitive elements + //to fit into are offset slightly in z to leave a thin plate of aluminum at the + //back - the back plate covers Double_t backPlanedZ = 0.25; Double_t socketdZ = blockdZ - backPlanedZ; - // Define the socket volume as a box of vacuum + //Define the socket volume as a box of vacuum TGeoVolume* socket = gGeoManager->MakeBox("Socket", Vacuum, sPmtSide / 2 + sEps, sPmtSide / 2 + sEps, socketdZ / 2); - // Define the orientation angles of the plate groups that will cover - // the sockets holding the sensitive elements + //Define the orientation angles of the plate groups that will cover + //the sockets holding the sensitive elements Double_t rotAngle[Geometry::NCellsA] = {0, 0, -90, -90, -90, 0, 0, -90, -90, -90, 0, 0, 180, 180, 90, 90, 90, 180, 180, 90, 90, 90, 180, 180}; - // Define the socket and plate group translations + //Define the socket and plate group translations TGeoTranslation* trSocket[Geometry::NCellsA]; TString nameTrSocket; TGeoCombiTrans* trPlateGroup[Geometry::NCellsA]; TString nameTrPlateGroup; TString namePGRot; - // Loop over the number of modules, subtracting the sockets and adding back in the - // plate groups at the position of each module + //Loop over the number of modules, subtracting the sockets and adding back in the + //plate groups at the position of each module for (Int_t itr = 0; itr < Geometry::NCellsA; itr++) { nameTrSocket = Form("trSocket%i", itr + 1); float z = -backPlanedZ / 4.0; trSocket[itr] = new TGeoTranslation(nameTrSocket.Data(), mPosModuleAx[itr], mPosModuleAy[itr], z); trSocket[itr]->RegisterYourself(); - frameACompositeString += "- Socket:"; // subtract it from the aluminum block - frameACompositeString += nameTrSocket.Data(); // at its corresponding location + frameACompositeString += "- Socket:"; //subtract it from the aluminum block + frameACompositeString += nameTrSocket.Data(); //at its corresponding location nameTrPlateGroup = Form("trPlateGroup%i", itr + 1); namePGRot = Form("pgRot%i", itr + 1); @@ -704,29 +704,29 @@ TGeoVolume* Detector::constructFrameAGeometry() trPlateGroup[itr]->RegisterYourself(); if (itr == 0 || itr == 2 || itr == 3 || itr == 4 || itr == 5 || itr == 10 || itr == 13 || itr == 18 || itr == 19 || itr == 20 || itr == 21 || itr == 23) { - frameACompositeString += " + outerPlateGroup:"; // add the outer plate group back on to these modules + frameACompositeString += " + outerPlateGroup:"; //add the outer plate group back on to these modules frameACompositeString += nameTrPlateGroup.Data(); frameACompositeString += " "; } else { - frameACompositeString += " + innerPlateGroup:"; // or add the inner plate group back on to all other modules + frameACompositeString += " + innerPlateGroup:"; //or add the inner plate group back on to all other modules frameACompositeString += nameTrPlateGroup.Data(); frameACompositeString += " "; } } - // Finally, define the A side frame object from the complete composite shape defined above + //Finally, define the A side frame object from the complete composite shape defined above TGeoVolume* frameA = new TGeoVolume("frameA", new TGeoCompositeShape("frameA", frameACompositeString.c_str()), Al); - // Add the frame object to the mother volume + //Add the frame object to the mother volume FT0_Frame->AddNode(frameA, 1); return FT0_Frame; } -// C-side Support Structure -// This code was written by Jason Pruitt and Sam Christensen of Cal Poly in 2021 -// They followed a similar method as for the A-side frame but had to account for the -// spherical geometry of the C-side. +//C-side Support Structure +//This code was written by Jason Pruitt and Sam Christensen of Cal Poly in 2021 +//They followed a similar method as for the A-side frame but had to account for the +//spherical geometry of the C-side. TGeoVolume* Detector::constructFrameCGeometry() { @@ -842,7 +842,7 @@ TGeoVolume* Detector::constructFrameCGeometry() TGeoCombiTrans* comCorners2 = new TGeoCombiTrans("comCorners2", xCorn2, yCorn2, zCorn2, rotCorners); comCorners2->RegisterYourself(); - // Create a string that defines the composite shape + //Create a string that defines the composite shape std::string shellString = ""; shellString += "sphere1"; // start with spherical shell - this will be reflected shellString += "- sphere2:rotTr1"; // copy and combitrans a subtraction @@ -852,7 +852,7 @@ TGeoVolume* Detector::constructFrameCGeometry() shellString += "- framecornerBox:comCorners"; // subtract corners shellString += "- framecornerBox:comCorners2"; // - // Create string that defines the back plate composite shape + //Create string that defines the back plate composite shape std::string backPlateString = ""; backPlateString += "sphere3"; backPlateString += "- sphere4:rotTr1"; @@ -862,8 +862,8 @@ TGeoVolume* Detector::constructFrameCGeometry() backPlateString += "- framecornerBox:comCorners"; backPlateString += "- framecornerBox:comCorners2"; - // These could be set up to use the values in the geometry file after some - // investigation of subtle differences... + //These could be set up to use the values in the geometry file after some + //investigation of subtle differences... static constexpr Double_t xi[NCellsC] = {-15.038271418735729, 15.038271418735729, -15.003757581112167, 15.003757581112167, -9.02690018974363, 9.02690018974363, -9.026897413747076, 9.026897413747076, -9.026896531935773, 9.026896531935773, -3.0004568618531313, 3.0004568618531313, -3.0270795197907225, 3.0270795197907225, 3.0003978432927543, -3.0003978432927543, 3.0270569670429572, -3.0270569670429572, 9.026750365564254, -9.026750365564254, 9.026837450695885, -9.026837450695885, 9.026849243816981, -9.026849243816981, 15.038129472387304, -15.038129472387304, 15.003621961057961, -15.003621961057961}; static constexpr Double_t yi[NCellsC] = {3.1599494336464455, -3.1599494336464455, 9.165191680982874, -9.165191680982874, 3.1383331772537426, -3.1383331772537426, 9.165226363918643, -9.165226363918643, 15.141616002932361, -15.141616002932361, 9.16517861649866, -9.16517861649866, 15.188854859073416, -15.188854859073416, 9.165053319552113, -9.165053319552113, 15.188703787345304, -15.188703787345304, 3.138263189805292, -3.138263189805292, 9.165104089644917, -9.165104089644917, 15.141494417823818, -15.141494417823818, 3.1599158563428644, -3.1599158563428644, 9.165116302773846, -9.165116302773846}; @@ -1027,31 +1027,31 @@ TGeoVolume* Detector::constructFrameCGeometry() std::string Detector::cPlateShapeString() { - Double_t prismHeight = 0.3895; // height of vertical edge of square prism part of base - Double_t prismSide = 5.9; // width and length of square prism part of base - Double_t radCurve = 81.9469; // radius of curvature of top part of base + Double_t prismHeight = 0.3895; //height of vertical edge of square prism part of base + Double_t prismSide = 5.9; //width and length of square prism part of base + Double_t radCurve = 81.9469; //radius of curvature of top part of base Double_t delHeight = radCurve * (1.0 - TMath::Sqrt(1.0 - 0.5 * TMath::Power(prismSide / radCurve, 2.0))); - // height from top of square prism to center of curved top surface of base + //height from top of square prism to center of curved top surface of base - Double_t heightBase = prismHeight + delHeight; // from center of bottom to center of top - Double_t sliceSide = 5.3; // side lengths of slice's flat top + Double_t heightBase = prismHeight + delHeight; //from center of bottom to center of top + Double_t sliceSide = 5.3; //side lengths of slice's flat top Double_t heightBaseBox = 2 * heightBase; Double_t totalHeight = 0.5; Double_t sliceHeight = 0.5 - heightBase; - // cable dimensions and distances + //cable dimensions and distances Double_t cableHoleWidth = 0.3503; Double_t cableHoleLength = 0.9003; - Double_t cableHoleDepth = 1; // really big just to punch a hole + Double_t cableHoleDepth = 1; //really big just to punch a hole - // sholes denotes "straight holes" and rholes denote "rotated holes" - // all distances measured from edges of slice - // up and down sholes + //sholes denotes "straight holes" and rholes denote "rotated holes" + //all distances measured from edges of slice + //up and down sholes Double_t sHolesBottomEdge = 1.585; Double_t sHolesTopEdge = 0.515; Double_t sHolesAvgTopBottom = (sHolesBottomEdge + sHolesTopEdge) / 2.0; - Double_t sHolesUpFromCenter = ((sliceSide / 2.0) - sHolesAvgTopBottom); // amount up in x the sholes need to move - // left and right sholes + Double_t sHolesUpFromCenter = ((sliceSide / 2.0) - sHolesAvgTopBottom); //amount up in x the sholes need to move + //left and right sholes Double_t sHolesFarEdge = 1.585; Double_t sHolesNearEdge = 1.065; Double_t sHolesAvgNearFar = (sHolesFarEdge + sHolesNearEdge) / 2.0; @@ -1115,7 +1115,7 @@ std::string Detector::cPlateShapeString() return plateString; } -// End Support structure code +//End Support structure code //////////////////////////////////////////// Bool_t Detector::ProcessHits(FairVolume* v) diff --git a/Detectors/TOF/simulation/src/Detector.cxx b/Detectors/TOF/simulation/src/Detector.cxx index 9e16c0b8da45d..5e9938e7fc084 100644 --- a/Detectors/TOF/simulation/src/Detector.cxx +++ b/Detectors/TOF/simulation/src/Detector.cxx @@ -1187,7 +1187,7 @@ void Detector::createBackZone(Double_t xtof, Double_t ytof, Double_t zlenA) cons if (mTOFHoles) { TVirtualMC::GetMC()->Gsvolu("FAIB", "BOX ", getMediumID(kAir), par, 3); // Air } - TVirtualMC::GetMC()->Gsvolu("FAIC", "BOX ", getMediumID(kAir), par, 3); // Air + TVirtualMC::GetMC()->Gsvolu("FAIC", "BOX ", getMediumID(kAir), par, 3); // Air Double_t feaParam[3] = {Geo::FEAPARAMETERS[0], Geo::FEAPARAMETERS[1], Geo::FEAPARAMETERS[2]}; Double_t feaRoof1[3] = {Geo::ROOF1PARAMETERS[0], Geo::ROOF1PARAMETERS[1], Geo::ROOF1PARAMETERS[2]};