Skip to content

Commit

Permalink
ITS3: renamed SuperAlpide to Mosaix
Browse files Browse the repository at this point in the history
This is essentially a rebase on the changes by @ChunzhengLab.

Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
  • Loading branch information
f3sch committed Jan 31, 2025
1 parent db88145 commit 09f35ec
Show file tree
Hide file tree
Showing 19 changed files with 112 additions and 127 deletions.
1 change: 0 additions & 1 deletion Detectors/Upgrades/ITS3/alignment/src/MisalignmentHits.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
// or submit itself to any jurisdiction.

#include "ITS3Align/MisalignmentHits.h"
#include "ITS3Base/SegmentationSuperAlpide.h"
#include "ITS3Base/ITS3Params.h"
#include "SimConfig/DigiParams.h"
#include "DetectorsBase/Propagator.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// \file SegmentationSuperAlpide.h
/// \brief Definition of the SegmentationSuperAlpide class
/// \file SegmentationMosaix.h
/// \brief Definition of the SegmentationMosaix class
/// \author felix.schlepper@cern.ch

#ifndef ALICEO2_ITS3_SEGMENTATIONSUPERALPIDE_H_
#define ALICEO2_ITS3_SEGMENTATIONSUPERALPIDE_H_
#ifndef ALICEO2_ITS3_SEGMENTATIONMOSAIX_H_
#define ALICEO2_ITS3_SEGMENTATIONMOSAIX_H_

#include "MathUtils/Cartesian.h"
#include "ITS3Base/SpecsV2.h"
Expand All @@ -26,7 +26,7 @@ namespace o2::its3
{

/// Segmentation and response for pixels in ITS3 upgrade
class SegmentationSuperAlpide
class SegmentationMosaix
{
// This class defines the segmenation of the pixelArray in the tile. We define
// two coordinate systems, one width x,z detector local coordianates (cm) and
Expand All @@ -53,12 +53,12 @@ class SegmentationSuperAlpide
// | | |
// x----------------------x
public:
~SegmentationSuperAlpide() = default;
SegmentationSuperAlpide(const SegmentationSuperAlpide&) = default;
SegmentationSuperAlpide(SegmentationSuperAlpide&&) = delete;
SegmentationSuperAlpide& operator=(const SegmentationSuperAlpide&) = default;
SegmentationSuperAlpide& operator=(SegmentationSuperAlpide&&) = delete;
constexpr SegmentationSuperAlpide(int layer) : mLayer{layer} {}
~SegmentationMosaix() = default;
SegmentationMosaix(const SegmentationMosaix&) = default;
SegmentationMosaix(SegmentationMosaix&&) = delete;
SegmentationMosaix& operator=(const SegmentationMosaix&) = default;
SegmentationMosaix& operator=(SegmentationMosaix&&) = delete;
constexpr SegmentationMosaix(int layer) : mLayer{layer} {}

static constexpr int mNCols{constants::pixelarray::nCols};
static constexpr int mNRows{constants::pixelarray::nRows};
Expand Down
21 changes: 8 additions & 13 deletions Detectors/Upgrades/ITS3/macros/test/CheckClustersITS3.C
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define ENABLE_UPGRADES
#include "DetectorsCommonDataFormats/DetID.h"
#include "ITSMFTBase/SegmentationAlpide.h"
#include "ITS3Base/SegmentationSuperAlpide.h"
#include "ITS3Base/SegmentationMosaix.h"
#include "ITS3Base/SpecsV2.h"
#include "ITSBase/GeometryTGeo.h"
#include "DataFormatsITSMFT/CompCluster.h"
Expand All @@ -50,15 +50,15 @@ void CheckClustersITS3(const std::string& clusfile = "o2clus_its.root",
using namespace o2::base;
using namespace o2::its;

using SuperSegmentation = o2::its3::SegmentationSuperAlpide;
using MosaixSegmentation = o2::its3::SegmentationMosaix;
using Segmentation = o2::itsmft::SegmentationAlpide;
using o2::itsmft::CompClusterExt;
using o2::itsmft::Hit;
using ROFRec = o2::itsmft::ROFRecord;
using MC2ROF = o2::itsmft::MC2ROFRecord;
using HitVec = std::vector<Hit>;
using MC2HITS_map = std::unordered_map<uint64_t, int>; // maps (track_ID<<32 + chip_ID) to entry in the hit vector
std::array<SuperSegmentation, 3> mSuperSegmentations{0, 1, 2};
std::array<MosaixSegmentation, 3> mMosaixSegmentations{0, 1, 2};

std::vector<HitVec*> hitVecPool;
std::vector<MC2HITS_map> mc2hitVec;
Expand Down Expand Up @@ -185,8 +185,8 @@ void CheckClustersITS3(const std::string& clusfile = "o2clus_its.root",
locC = dict.getClusterCoordinates(cluster);
errX = dict.getErrX(pattID);
errZ = dict.getErrZ(pattID);
errX *= (isIB) ? SuperSegmentation::mPitchRow : Segmentation::PitchRow;
errZ *= (isIB) ? SuperSegmentation::mPitchCol : Segmentation::PitchCol;
errX *= (isIB) ? MosaixSegmentation::mPitchRow : Segmentation::PitchRow;
errZ *= (isIB) ? MosaixSegmentation::mPitchCol : Segmentation::PitchCol;
npix = dict.getNpixels(pattID);
++cPattValid;
}
Expand Down Expand Up @@ -235,21 +235,16 @@ void CheckClustersITS3(const std::string& clusfile = "o2clus_its.root",
} else {
// compare in local flat coordinates
float xFlatEnd{0.}, yFlatEnd{0.};
mSuperSegmentations[layer].curvedToFlat(locH.X(), locH.Y(), xFlatEnd, yFlatEnd);
mMosaixSegmentations[layer].curvedToFlat(locH.X(), locH.Y(), xFlatEnd, yFlatEnd);
locH.SetXYZ(xFlatEnd, yFlatEnd, locH.Z());
float xFlatSta{0.}, yFlatSta{0.};
mSuperSegmentations[layer].curvedToFlat(locHsta.X(), locHsta.Y(), xFlatSta, yFlatSta);
mMosaixSegmentations[layer].curvedToFlat(locHsta.X(), locHsta.Y(), xFlatSta, yFlatSta);
locHsta.SetXYZ(xFlatSta, yFlatSta, locHsta.Z());
// recalculate x/y in flat
// x0 = xFlatSta, dltx = xFlatEnd - x0;
// y0 = yFlatSta, dlty = yFlatEnd - y0;
// r = (0.5 * (SuperSegmentation::mSensorLayerThickness - SuperSegmentation::mSensorLayerThicknessEff) - y0) / dlty;
// locH.SetXYZ(x0 + r * dltx, y0 + r * dlty, z0 + r * dltz);

// not really precise, but okish
locH.SetXYZ(0.5f * (locH.X() + locHsta.X()), 0.5f * (locH.Y() + locHsta.Y()), 0.5f * (locH.Z() + locHsta.Z()));

mSuperSegmentations[layer].curvedToFlat(locC.X(), locC.Y(), xFlatSta, yFlatSta);
mMosaixSegmentations[layer].curvedToFlat(locC.X(), locC.Y(), xFlatSta, yFlatSta);
locC.SetXYZ(xFlatSta, yFlatSta, locC.Z());
}
float theta = std::acos(gloC.Z() / gloC.Rho());
Expand Down
12 changes: 6 additions & 6 deletions Detectors/Upgrades/ITS3/macros/test/CheckDigitsDensity.C
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "ITS3Base/SpecsV2.h"
#include "CommonConstants/MathConstants.h"
#include "DataFormatsITSMFT/Digit.h"
#include "ITS3Base/SegmentationSuperAlpide.h"
#include "ITS3Base/SegmentationMosaix.h"
#include "DetectorsBase/GeometryManager.h"
#include "ITSBase/GeometryTGeo.h"
#include "fairlogger/Logger.h"
Expand All @@ -56,15 +56,15 @@ constexpr double qedRate = qedXSection / hadXSection * interaction_rate; // Hz
constexpr double qedFactor = qedRate * integration_time; // a.u.
using o2::itsmft::Digit;
namespace its3 = o2::its3;
using SSAlpide = its3::SegmentationSuperAlpide;
using Mosaix = its3::SegmentationMosaix;

void checkFile(const std::unique_ptr<TFile>& file);

void CheckDigitsDensity(int nEvents = 10000, std::string digitFileName = "it3digits.root", std::string geomFileName = "o2sim_geometry.root", bool qed = false, bool batch = true)
{
gROOT->SetBatch(batch);
LOGP(debug, "Checking Digit ITS3 Density");
std::array<SSAlpide, 3> mSuperSegmentations{0, 1, 2};
std::array<Mosaix, 3> mMosaixSegmentations{0, 1, 2};

// Geometry
o2::base::GeometryManager::loadGeometry(geomFileName);
Expand Down Expand Up @@ -103,8 +103,8 @@ void CheckDigitsDensity(int nEvents = 10000, std::string digitFileName = "it3dig
// goto curved coordinates
float x{0.f}, y{0.f}, z{0.f};
float xFlat{0.f}, yFlat{0.f};
mSuperSegmentations[layer].detectorToLocal(row, col, xFlat, z);
mSuperSegmentations[layer].flatToCurved(xFlat, 0., x, y);
mMosaixSegmentations[layer].detectorToLocal(row, col, xFlat, z);
mMosaixSegmentations[layer].flatToCurved(xFlat, 0., x, y);
const o2::math_utils::Point3D<double> locD(x, y, z);
const auto gloD = gman->getMatrixL2G(id)(locD); // convert to global
const auto R = std::hypot(gloD.X(), gloD.Y());
Expand All @@ -115,7 +115,7 @@ void CheckDigitsDensity(int nEvents = 10000, std::string digitFileName = "it3dig
std::unique_ptr<TFile> oFile(TFile::Open("checkDigitsDensity.root", "RECREATE"));
checkFile(oFile);
for (const auto& h : hists) {
h->Scale(1. / (SSAlpide::mPitchCol * SSAlpide::mPitchRow * nEvents));
h->Scale(1. / (Mosaix::mPitchCol * Mosaix::mPitchRow * nEvents));
h->ProjectionX()->Write();
h->Write();
}
Expand Down
16 changes: 8 additions & 8 deletions Detectors/Upgrades/ITS3/macros/test/CheckDigitsITS3.C
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define ENABLE_UPGRADES
#include "ITSBase/GeometryTGeo.h"
#include "DataFormatsITSMFT/Digit.h"
#include "ITS3Base/SegmentationSuperAlpide.h"
#include "ITS3Base/SegmentationMosaix.h"
#include "ITSMFTBase/SegmentationAlpide.h"
#include "ITSMFTSimulation/Hit.h"
#include "MathUtils/Utils.h"
Expand All @@ -51,7 +51,7 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil
using o2::itsmft::Hit;

using o2::itsmft::SegmentationAlpide;
std::array<its3::SegmentationSuperAlpide, 3> mSuperSegmentations{0, 1, 2};
std::array<its3::SegmentationMosaix, 3> mMosaixSegmentations{0, 1, 2};

TFile* f = TFile::Open("CheckDigits.root", "recreate");
TNtuple* nt = new TNtuple("ntd", "digit ntuple", "id:x:y:z:rowD:colD:rowH:colH:xlH:zlH:xlcH:zlcH:dx:dz");
Expand Down Expand Up @@ -166,8 +166,8 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil
if (isIB) {
// ITS3 IB
float xFlat{0.f}, yFlat{0.f};
mSuperSegmentations[layer].detectorToLocal(ix, iz, xFlat, z);
mSuperSegmentations[layer].flatToCurved(xFlat, 0., x, y);
mMosaixSegmentations[layer].detectorToLocal(ix, iz, xFlat, z);
mMosaixSegmentations[layer].flatToCurved(xFlat, 0., x, y);
} else {
// ITS2 OB
SegmentationAlpide::detectorToLocal(ix, iz, x, z);
Expand Down Expand Up @@ -203,12 +203,12 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil

if (isIB) {
float xFlat{0.}, yFlat{0.};
mSuperSegmentations[layer].curvedToFlat(xyzLocM.X(), xyzLocM.Y(), xFlat, yFlat);
mMosaixSegmentations[layer].curvedToFlat(xyzLocM.X(), xyzLocM.Y(), xFlat, yFlat);
xyzLocM.SetCoordinates(xFlat, yFlat, xyzLocM.Z());
mSuperSegmentations[layer].curvedToFlat(locD.X(), locD.Y(), xFlat, yFlat);
mMosaixSegmentations[layer].curvedToFlat(locD.X(), locD.Y(), xFlat, yFlat);
locD.SetCoordinates(xFlat, yFlat, locD.Z());
if (auto v1 = !mSuperSegmentations[layer].localToDetector(xyzLocM.X(), xyzLocM.Z(), row, col),
v2 = !mSuperSegmentations[layer].detectorToLocal(row, col, xlc, zlc);
if (auto v1 = !mMosaixSegmentations[layer].localToDetector(xyzLocM.X(), xyzLocM.Z(), row, col),
v2 = !mMosaixSegmentations[layer].detectorToLocal(row, col, xlc, zlc);
v1 || v2) {
continue;
}
Expand Down
2 changes: 0 additions & 2 deletions Detectors/Upgrades/ITS3/macros/test/CheckHits.C
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@

#define ENABLE_UPGRADES
#include "CommonConstants/MathConstants.h"
#include "ITS3Base/SegmentationSuperAlpide.h"
#include "ITS3Base/SpecsV2.h"
#include "ITSMFTSimulation/Hit.h"
#include "SimulationDataFormat/MCTrack.h"
#endif

namespace it3c = o2::its3::constants;
namespace it3d = it3c::detID;
using SSAlpide = o2::its3::SegmentationSuperAlpide;
using o2::itsmft::Hit;

constexpr double interaction_rate = 50e3; // Hz
Expand Down
22 changes: 11 additions & 11 deletions Detectors/Upgrades/ITS3/macros/test/CheckSuperAlpideSegment.C
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@
#include "MathUtils/Cartesian.h"

#include "ITS3Base/SpecsV2.h"
#include "ITS3Base/SegmentationSuperAlpide.h"
#include "ITS3Base/SegmentationMosaix.h"
#include "ITSBase/GeometryTGeo.h"

#endif

using gITS = o2::its::GeometryTGeo;

void CheckSuperAlpideSegment(bool isTestDetectorToLocal = false,
bool isTestFlatToCurved = false,
bool isTestLocalToGlobal = false)
void CheckMosaixSegment(bool isTestDetectorToLocal = false,
bool isTestFlatToCurved = false,
bool isTestLocalToGlobal = false)
{
using namespace o2::its3;
static constexpr unsigned int mNCols{SegmentationSuperAlpide::mNCols};
static constexpr unsigned int mNRows{SegmentationSuperAlpide::mNRows};
static constexpr unsigned int mNCols{SegmentationMosaix::mNCols};
static constexpr unsigned int mNRows{SegmentationMosaix::mNRows};
static constexpr unsigned int nPixels{mNCols * mNRows};
std::array<SegmentationSuperAlpide, 3> mSuperSegmentations{0, 1, 2};
std::array<SegmentationMosaix, 3> mMosaixSegmentations{0, 1, 2};

if (isTestDetectorToLocal || isTestFlatToCurved) {
namespace cp = constants::pixelarray;
Expand All @@ -75,7 +75,7 @@ void CheckSuperAlpideSegment(bool isTestDetectorToLocal = false,
TGraph* g_col_zLocal_translate = new TGraph();
g_col_zLocal_translate->SetMarkerStyle(20);

SegmentationSuperAlpide seg(0);
SegmentationMosaix seg(0);
int nPoint = 0;
for (UInt_t i = 0; i < mNRows; ++i) {
for (UInt_t j = 0; j < mNCols; ++j) {
Expand Down Expand Up @@ -164,11 +164,11 @@ void CheckSuperAlpideSegment(bool isTestDetectorToLocal = false,
float xLocal_translate = 0;
float yLocal_translate = 0;

mSuperSegmentations[iLayer].detectorToLocal(row, col, xLocal, zLocal);
mSuperSegmentations[iLayer].flatToCurved(xLocal, 0., xCurved, yCurved);
mMosaixSegmentations[iLayer].detectorToLocal(row, col, xLocal, zLocal);
mMosaixSegmentations[iLayer].flatToCurved(xLocal, 0., xCurved, yCurved);
double posLocal[3] = {xCurved, yCurved, zLocal};
double posGlobal[3] = {0, 0, 0};
mSuperSegmentations[iLayer].curvedToFlat(xCurved, yCurved, xLocal_translate, yLocal_translate);
mMosaixSegmentations[iLayer].curvedToFlat(xCurved, yCurved, xLocal_translate, yLocal_translate);
matrix->LocalToMaster(posLocal, posGlobal);

h_xCurved_yCurved->Fill(xLocal, 0);
Expand Down
28 changes: 14 additions & 14 deletions Detectors/Upgrades/ITS3/macros/test/CheckSuperAlpideSegmentTrans.C
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "TStyle.h"
#include "TTree.h"

#include "ITS3Base/SegmentationSuperAlpide.h"
#include "ITS3Base/SegmentationMosaix.h"
#include "ITS3Base/SpecsV2.h"

#endif
Expand All @@ -37,11 +37,11 @@ constexpr float PI = 3.14159274101257324e+00f;
constexpr float Rad2Deg = 180.f / PI;
constexpr float Deg2Rad = 1. / Rad2Deg;

constexpr auto nRows{SegmentationSuperAlpide::mNRows};
constexpr auto nCols{SegmentationSuperAlpide::mNCols};
constexpr auto fLength{SegmentationSuperAlpide::mLength};
constexpr auto fWidth{SegmentationSuperAlpide::mWidth};
std::array<SegmentationSuperAlpide, 3> mSuperSegmentations{0, 1, 2};
constexpr auto nRows{SegmentationMosaix::mNRows};
constexpr auto nCols{SegmentationMosaix::mNCols};
constexpr auto fLength{SegmentationMosaix::mLength};
constexpr auto fWidth{SegmentationMosaix::mWidth};
const std::array<SegmentationMosaix, 3> mMosaixSegmentations{0, 1, 2};

TH2* DrawReverseBins(TH2* h)
{
Expand Down Expand Up @@ -84,7 +84,7 @@ void DrawXAxisCol(TH1* h)
newaxis->Draw();
}

void CheckSuperAlpideSegmentTrans()
void CheckMosaxisSegmentTrans()
{
gStyle->SetOptStat(1111111);

Expand Down Expand Up @@ -141,10 +141,10 @@ void CheckSuperAlpideSegmentTrans()
g_arc_inner->AddPoint(x_inner, y_inner);
g_arc_outer->AddPoint(x_outer, y_outer);
// Test Segmentation
mSuperSegmentations[iLayer].curvedToFlat(x_inner, y_inner, x_inner_flat, y_inner_flat);
mSuperSegmentations[iLayer].flatToCurved(x_inner_flat, y_inner_flat, x_inner_curved, y_inner_curved);
mSuperSegmentations[iLayer].curvedToFlat(x_outer, y_outer, x_outer_flat, y_outer_flat);
mSuperSegmentations[iLayer].flatToCurved(x_outer_flat, y_outer_flat, x_outer_curved, y_outer_curved);
mMosaixSegmentations[iLayer].curvedToFlat(x_inner, y_inner, x_inner_flat, y_inner_flat);
mMosaixSegmentations[iLayer].flatToCurved(x_inner_flat, y_inner_flat, x_inner_curved, y_inner_curved);
mMosaixSegmentations[iLayer].curvedToFlat(x_outer, y_outer, x_outer_flat, y_outer_flat);
mMosaixSegmentations[iLayer].flatToCurved(x_outer_flat, y_outer_flat, x_outer_curved, y_outer_curved);
g_arc_inner_flat->AddPoint(x_inner_flat, y_inner_flat);
g_arc_outer_flat->AddPoint(x_outer_flat, y_outer_flat);
h_f2c_res->Fill(x_inner - x_inner_curved, y_inner - y_inner_curved);
Expand Down Expand Up @@ -202,9 +202,9 @@ void CheckSuperAlpideSegmentTrans()
for (int iCol{0}; iCol < nCols; ++iCol) {
float xRow{0}, zCol{0};
int iiRow{0}, iiCol{0};
auto v1 = mSuperSegmentations[iLayer].detectorToLocal(iRow, iCol, xRow, zCol);
auto v2 = mSuperSegmentations[iLayer].localToDetector(xRow, zCol, iiRow,
iiCol);
auto v1 = mMosaixSegmentations[iLayer].detectorToLocal(iRow, iCol, xRow, zCol);
auto v2 = mMosaixSegmentations[iLayer].localToDetector(xRow, zCol, iiRow,
iiCol);
// Info("L2D",
// "iRow=%d, iCol=%d --d2l(%s)--> xRow=%f, zCol=%f --l2d(%s)--> "
// "iiRow=%d, iiCol=%d",
Expand Down
6 changes: 3 additions & 3 deletions Detectors/Upgrades/ITS3/macros/test/CheckTileNumbering.C
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "ITSBase/GeometryTGeo.h"
#include "ITS3Base/SpecsV2.h"
#include "ITS3Base/SegmentationSuperAlpide.h"
#include "ITS3Base/SegmentationMosaix.h"
#include "MathUtils/Cartesian.h"
#include "MathUtils/Utils.h"
#include "DataFormatsITSMFT/NoiseMap.h"
Expand Down Expand Up @@ -102,7 +102,7 @@ void CheckTileNumbering(const std::string& inputGeom = "", const std::string& de
Int_t colors[NRGBs] = {kWhite, kRed, kGray};
TColor::SetPalette(NRGBs, colors, 1.0);

std::array<o2::its3::SegmentationSuperAlpide, 3> mSuperSegmentations{0, 1, 2};
std::array<o2::its3::SegmentationMosaix, 3> mMosaixSegmentations{0, 1, 2};

const float phiOffsetL0 = std::asin(o2::its3::constants::equatorialGap / 2.f / o2::its3::constants::radii[0]);
const float phiOffsetL1 = std::asin(o2::its3::constants::equatorialGap / 2.f / o2::its3::constants::radii[1]);
Expand Down Expand Up @@ -144,7 +144,7 @@ void CheckTileNumbering(const std::string& inputGeom = "", const std::string& de
for (unsigned int iDet{0}; iDet <= o2::its3::constants::detID::l2IDEnd; ++iDet) {
int sensorID = o2::its3::constants::detID::getSensorID(iDet);
int layerID = o2::its3::constants::detID::getDetID2Layer(iDet);
mSuperSegmentations[layerID].flatToCurved(xFlat, 0., x, y);
mMosaixSegmentations[layerID].flatToCurved(xFlat, 0., x, y);
o2::math_utils::Point3D<float> locC{x, y, z};
auto gloC = gman->getMatrixL2G(iDet)(locC);
float phi = o2::math_utils::to02Pi(std::atan2(gloC.Y(), gloC.X()));
Expand Down
Loading

0 comments on commit 09f35ec

Please sign in to comment.