diff --git a/Detectors/ITSMFT/ITS/base/src/GeometryTGeo.cxx b/Detectors/ITSMFT/ITS/base/src/GeometryTGeo.cxx index b52fd8f58320f..89b4d63729543 100644 --- a/Detectors/ITSMFT/ITS/base/src/GeometryTGeo.cxx +++ b/Detectors/ITSMFT/ITS/base/src/GeometryTGeo.cxx @@ -24,8 +24,6 @@ #ifdef ENABLE_UPGRADES #include "ITS3Base/SpecsV2.h" -#include "ITS3Base/SegmentationSuperAlpide.h" -using SuperSegmentation = o2::its3::SegmentationSuperAlpide; #endif #include // for TGeoBBox @@ -420,33 +418,20 @@ TGeoHMatrix* GeometryTGeo::extractMatrixSensor(int index) const static int chipInGlo{0}; // account for the difference between physical sensitive layer (where charge collection is simulated) and effective sensor thicknesses + // in the ITS3 case this accounted by specialized functions double delta = Segmentation::SensorLayerThickness - Segmentation::SensorLayerThicknessEff; -#ifdef ENABLE_UPGRADES - if (mIsLayerITS3[getLayer(index)]) { - delta = its3::SegmentationSuperAlpide::mSensorLayerThickness - its3::SegmentationSuperAlpide::mSensorLayerThicknessEff; - } -#endif - static TGeoTranslation tra(0., 0.5 * delta, 0.); - +#ifdef ENABLE_UPGRADES // only apply for non ITS3 OB layers + if (!mIsLayerITS3[getLayer(index)]) { + matTmp *= tra; + } +#else matTmp *= tra; +#endif return &matTmp; } -//__________________________________________________________________________ -const o2::math_utils::Transform3D GeometryTGeo::getT2LMatrixITS3(int isn, float alpha) -{ - // create for sensor isn the TGeo matrix for Tracking to Local frame transformations - static TGeoHMatrix t2l; - t2l.Clear(); - t2l.RotateZ(alpha * RadToDeg()); // rotate in direction of normal to the tangent to the cylinder - const TGeoHMatrix& matL2G = getMatrixL2G(isn); - const auto& matL2Gi = matL2G.Inverse(); - t2l.MultiplyLeft(&matL2Gi); - return Mat3D(t2l); -} - //__________________________________________________________________________ void GeometryTGeo::Build(int loadTrans) { @@ -492,23 +477,6 @@ void GeometryTGeo::Build(int loadTrans) mLastChipIndex[i] = numberOfChips - 1; } - LOGP(debug, "Summary of extracted Geometry:"); - LOGP(debug, " There are {} Layers and {} HalfBarrels", mNumberOfLayers, mNumberOfHalfBarrels); - for (int i = 0; i < mNumberOfLayers; i++) { - LOGP(debug, " Layer {}: {:*^30}", i, "START"); - LOGP(debug, " - mNumberOfStaves={}", mNumberOfStaves[i]); - LOGP(debug, " - mNumberOfChipsPerStave={}", mNumberOfChipsPerStave[i]); - LOGP(debug, " - mNumberOfHalfStaves={}", mNumberOfHalfStaves[i]); - LOGP(debug, " - mNumberOfChipsPerHalfStave={}", mNumberOfChipsPerHalfStave[i]); - LOGP(debug, " - mNumberOfModules={}", mNumberOfModules[i]); - LOGP(debug, " - mNumberOfChipsPerModules={}", mNumberOfChipsPerModule[i]); - LOGP(debug, " - mNumberOfChipsPerLayer={}", mNumberOfChipsPerLayer[i]); - LOGP(debug, " - mNumberOfChipsPerHalfBarrel={}", mNumberOfChipsPerHalfBarrel[i]); - LOGP(debug, " - mLastChipIndex={}", mLastChipIndex[i]); - LOGP(debug, " Layer {}: {:*^30}", i, "END"); - } - LOGP(debug, "In total there {} chips registered", numberOfChips); - #ifdef ENABLE_UPGRADES if (std::any_of(mIsLayerITS3.cbegin(), mIsLayerITS3.cend(), [](auto b) { return b; })) { LOGP(info, "Found active IT3 layers -> Renaming Detector ITS to IT3"); @@ -880,34 +848,39 @@ void GeometryTGeo::extractSensorXAlpha(int isn, float& x, float& alp) const TGeoHMatrix* matL2G = extractMatrixSensor(isn); double locA[3] = {-100., 0., 0.}, locB[3] = {100., 0., 0.}, gloA[3], gloB[3]; - int iLayer = getLayer(isn); + double xp{0}, yp{0}; #ifdef ENABLE_UPGRADES - if (mIsLayerITS3[iLayer]) { - // We need to calcualte the line tangent at the mid-point in the geometry + if (int iLayer = getLayer(isn); mIsLayerITS3[iLayer]) { + // For a TGeoTubeSeg the local coordinate system is defined at the origin + // of the circle of the side, since in our implementation we rotated the geometry a bit const auto radius = o2::its3::constants::radii[iLayer]; const auto phi1 = o2::its3::constants::tile::width / radius; const auto phi2 = o2::its3::constants::pixelarray::width / radius + phi1; const auto phi3 = (phi2 - phi1) / 2.; // mid-point in phi - const auto x = radius * std::cos(phi3); - const auto y = radius * std::sin(phi3); - // For the tangent we make the parametric line equation y = m * x - c - const auto m = x / y; - const auto c = y - m * x; - // Now we can given any x calulate points along this line, we pick points far away, - // the calculation of the normal should work then below. - locA[1] = m * locA[0] + c; - locB[1] = m * locB[0] + c; - } -#endif - + locA[0] = radius * std::cos(phi3); + locA[1] = radius * std::sin(phi3); + matL2G->LocalToMaster(locA, gloA); + xp = gloA[0]; + yp = gloA[1]; + } else { + matL2G->LocalToMaster(locA, gloA); + matL2G->LocalToMaster(locB, gloB); + double dx = gloB[0] - gloA[0], dy = gloB[1] - gloA[1]; + double t = (gloB[0] * dx + gloB[1] * dy) / (dx * dx + dy * dy); + xp = gloB[0] - dx * t; + yp = gloB[1] - dy * t; + } +#else // just ITS2 part matL2G->LocalToMaster(locA, gloA); matL2G->LocalToMaster(locB, gloB); double dx = gloB[0] - gloA[0], dy = gloB[1] - gloA[1]; double t = (gloB[0] * dx + gloB[1] * dy) / (dx * dx + dy * dy); - double xp = gloB[0] - dx * t, yp = gloB[1] - dy * t; - x = Sqrt(xp * xp + yp * yp); - alp = ATan2(yp, xp); + xp = gloB[0] - dx * t; + yp = gloB[1] - dy * t; +#endif + x = std::hypot(xp, yp); + alp = std::atan2(yp, xp); o2::math_utils::bringTo02Pi(alp); } @@ -926,6 +899,19 @@ TGeoHMatrix& GeometryTGeo::createT2LMatrix(int isn) return t2l; } +//__________________________________________________________________________ +const o2::math_utils::Transform3D GeometryTGeo::getT2LMatrixITS3(int isn, float alpha) +{ + // create for sensor isn the TGeo matrix for Tracking to Local frame transformations with correction for effective thickness + static TGeoHMatrix t2l; + t2l.Clear(); + t2l.RotateZ(alpha * RadToDeg()); // rotate in direction of normal to the tangent to the cylinder + const TGeoHMatrix& matL2G = getMatrixL2G(isn); + const auto& matL2Gi = matL2G.Inverse(); + t2l.MultiplyLeft(&matL2Gi); + return Mat3D(t2l); +} + //__________________________________________________________________________ int GeometryTGeo::extractVolumeCopy(const char* name, const char* prefix) const { diff --git a/Detectors/ITSMFT/ITS/simulation/src/Detector.cxx b/Detectors/ITSMFT/ITS/simulation/src/Detector.cxx index bf2e997794ee4..2304a9102092a 100644 --- a/Detectors/ITSMFT/ITS/simulation/src/Detector.cxx +++ b/Detectors/ITSMFT/ITS/simulation/src/Detector.cxx @@ -190,7 +190,7 @@ Detector::Detector(Bool_t active, TString name) } else { mLayerName[j].Form("%s%d", GeometryTGeo::getITSSensorPattern(), j); // See V3Layer } - LOGP(info, "{}: mLayerName={}", j, mLayerName[j].Data()); + LOGP(debug, "{}: mLayerName={}", j, mLayerName[j].Data()); } if (mNumberLayers > 0) { // if not, we'll Fatal-ize in CreateGeometry @@ -723,8 +723,8 @@ void Detector::defineLayer(Int_t nlay, Double_t phi0, Double_t r, Int_t nstav, I // Return: // none. - LOG(info) << "L# " << nlay << " Phi:" << phi0 << " R:" << r << " Nst:" << nstav << " Nunit:" << nunit - << " Lthick:" << lthick << " Dthick:" << dthick << " DetID:" << dettypeID << " B:" << buildLevel; + LOG(debug) << "L# " << nlay << " Phi:" << phi0 << " R:" << r << " Nst:" << nstav << " Nunit:" << nunit + << " Lthick:" << lthick << " Dthick:" << dthick << " DetID:" << dettypeID << " B:" << buildLevel; if (nlay >= mNumberLayers || nlay < 0) { LOG(error) << "Wrong layer number " << nlay; diff --git a/Detectors/ITSMFT/common/data/AlpideResponseData/CMakeLists.txt b/Detectors/ITSMFT/common/data/AlpideResponseData/CMakeLists.txt index ad26d9e658e16..88ec19a543db5 100644 --- a/Detectors/ITSMFT/common/data/AlpideResponseData/CMakeLists.txt +++ b/Detectors/ITSMFT/common/data/AlpideResponseData/CMakeLists.txt @@ -20,10 +20,10 @@ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DI if(ITSRESPONSE) message(STATUS "ITSRESPONSE option provided, setting ITSRESPONSE_DIR from it: " ${ITSRESPONSE}) - set(ITSRESPONSE_DIR ${ITSRESPONSE}) + set(ITSRESPONSE_DIR ${ITSRESPONSE} CACHE PATH "ITSResponse directory") else() message(STATUS "ITSRESPONSE option not provided, setting ITSRESPONSE_DIR from environment ITSRESPONSE_ROOT: " $ENV{ITSRESPONSE_ROOT}) - set(ITSRESPONSE_DIR $ENV{ITSRESPONSE_ROOT}) + set(ITSRESPONSE_DIR $ENV{ITSRESPONSE_ROOT} CACHE PATH "ITSResponse directory") endif() add_custom_command(TARGET O2exe-alpide-response-generator POST_BUILD diff --git a/Detectors/ITSMFT/common/simulation/include/ITSMFTSimulation/DigiParams.h b/Detectors/ITSMFT/common/simulation/include/ITSMFTSimulation/DigiParams.h index 7772c47237ae8..b27739c26bc4d 100644 --- a/Detectors/ITSMFT/common/simulation/include/ITSMFTSimulation/DigiParams.h +++ b/Detectors/ITSMFT/common/simulation/include/ITSMFTSimulation/DigiParams.h @@ -96,18 +96,18 @@ class DigiParams const SignalShape& getSignalShape() const { return mSignalShape; } SignalShape& getSignalShape() { return (SignalShape&)mSignalShape; } - void print() const; + virtual void print() const; private: static constexpr double infTime = 1e99; - bool mIsContinuous = false; ///< flag for continuous simulation - float mNoisePerPixel = 1.e-8; ///< ALPIDE Noise per chip - int mROFrameLengthInBC = 0; ///< ROF length in BC for continuos mode - float mROFrameLength = 0; ///< length of RO frame in ns - float mStrobeDelay = 0.; ///< strobe start (in ns) wrt ROF start - float mStrobeLength = 0; ///< length of the strobe in ns (sig. over threshold checked in this window only) - double mTimeOffset = -2 * infTime; ///< time offset (in seconds!) to calculate ROFrame from hit time - int mROFrameBiasInBC = 0; ///< misalignment of the ROF start in BC + bool mIsContinuous = false; ///< flag for continuous simulation + float mNoisePerPixel = 1.e-8; ///< ALPIDE Noise per chip + int mROFrameLengthInBC = 0; ///< ROF length in BC for continuos mode + float mROFrameLength = 0; ///< length of RO frame in ns + float mStrobeDelay = 0.; ///< strobe start (in ns) wrt ROF start + float mStrobeLength = 0; ///< length of the strobe in ns (sig. over threshold checked in this window only) + double mTimeOffset = -2 * infTime; ///< time offset (in seconds!) to calculate ROFrame from hit time + int mROFrameBiasInBC = 0; ///< misalignment of the ROF start in BC int mChargeThreshold = 150; ///< charge threshold in Nelectrons int mMinChargeToAccount = 15; ///< minimum charge contribution to account int mNSimSteps = 7; ///< number of steps in response simulation @@ -125,7 +125,7 @@ class DigiParams float mROFrameLengthInv = 0; ///< inverse length of RO frame in ns float mNSimStepsInv = 0; ///< its inverse - ClassDefNV(DigiParams, 2); + ClassDef(DigiParams, 2); }; } // namespace itsmft } // namespace o2