65 AlignableVolume *volITS =
nullptr, *volLr =
nullptr, *volHB =
nullptr, *volSt =
nullptr, *volHSt =
nullptr, *volMod =
nullptr;
68 std::unordered_map<std::string, AlignableVolume*> sym2vol;
73 for (
int ilr = 0; ilr < geom->getNumberOfLayers(); ilr++) {
74 for (
int ihb = 0; ihb < geom->getNumberOfHalfBarrels(); ihb++) {
76 sym2vol[volLr->getSymName()] = volLr;
77 volLr->setParent(volITS);
78 int nstavesHB = geom->getNumberOfStaves(ilr) / 2;
79 for (
int ist = 0; ist < nstavesHB; ist++) {
81 sym2vol[volSt->getSymName()] = volSt;
82 volSt->setParent(volLr);
83 for (
int ihst = 0; ihst < geom->getNumberOfHalfStaves(ilr); ihst++) {
85 sym2vol[volHSt->getSymName()] = volHSt;
86 volHSt->setParent(volSt);
87 for (
int imd = 0; imd < geom->getNumberOfModules(ilr); imd++) {
89 sym2vol[volMod->getSymName()] = volMod;
90 volMod->setParent(volHSt);
97 for (
int ich = 0; ich < geom->getNumberOfChips(); ich++) {
100 throw std::runtime_error(fmt::format(
"mismatch between counter {} and composed {} chip IDs", ich, chID));
103 int lay = 0, hba, sta = 0, ssta = 0, modd = 0, chip = 0;
104 geom->getChipId(chID, lay, hba, sta, ssta, modd, chip);
105 AlignableVolume* parVol = sym2vol[modd < 0 ? geom->composeSymNameStave(lay, hba, sta) : geom->composeSymNameModule(lay, hba, sta, ssta, modd)];
107 throw std::runtime_error(fmt::format(
"did not find parent for chip {}", chID));
126 auto procClus = [
this, inv, &npoints, &algTrack](
const ClusterD& clus) {
127 auto* sensor = this->
getSensor(clus.getSensorID());
128 auto& pnt = algTrack->addDetectorPoint();
129 const auto* sysE = sensor->getAddError();
130 pnt.setYZErrTracking(clus.getSigmaY2() + sysE[0] * sysE[0], clus.getSigmaYZ(), clus.getSigmaZ2() + sysE[1] * sysE[1]);
132 pnt.setNeedUpdateFromTrack();
134 pnt.setXYZTracking(clus.getX(), clus.getY(), clus.getZ());
135 pnt.setSensor(sensor);
136 pnt.setAlphaSens(sensor->getAlpTracking());
137 pnt.setXSens(sensor->getXTracking());
138 pnt.setDetID(this->
mDetID);
139 pnt.setSID(sensor->getSID());
140 pnt.setContainsMeasurement();
145 std::array<int, 7> clusIDs{};
148 const auto tracks = recoData->getITSTracks();
149 if (tracks.empty()) {
152 const auto& track = tracks[gid.getIndex()];
153 if (track.getNClusters() < npntCut) {
156 const auto& clusIdx = recoData->getITSTracksClusterRefs();
158 int clEntry = track.getFirstClusterEntry();
159 int preevSensID = -1;
160 bool errReported =
false;
161 for (
int icl = track.getNumberOfClusters(); icl--;) {
162 const auto& clus =
mITSClustersArray[(clusIDs[npoints] = clusIdx[clEntry + icl])];
163 if (clus.getSensorID() < preevSensID && !errReported) {
164 std::string errstr{};
165 for (
int ie = track.getNumberOfClusters(); ie--;) {
166 errstr += fmt::format(
" {}",
mITSClustersArray[clusIdx[clEntry + ie]].getSensorID());
168 LOGP(error,
"wrong ITS clusters order? : chips {}", errstr);
171 preevSensID = clus.getSensorID();
172 if (clus.getBits()) {
176 if (clus.getCount()) {
183 const auto& trkITSABref = recoData->getITSABRefs()[gid.getIndex()];
184 const auto& ABTrackClusIdx = recoData->getITSABClusterRefs();
185 int nCl = trkITSABref.getNClusters();
186 int clEntry = trkITSABref.getFirstEntry();
187 for (
int icl = 0; icl < nCl; icl++) {
188 const auto& clus =
mITSClustersArray[(clusIDs[npoints] = ABTrackClusIdx[clEntry + icl])];
189 if (clus.getBits()) {
193 if (clus.getCount()) {
200 if (npoints < npntCut) {
201 algTrack->suppressLastPoints(npoints);
209 trcProp.resetCovariance(10);
211 for (
int icl = 0; icl < npoints; icl++) {
214 if (!trcProp.rotate(alp) ||
215 !propagator->propagateToX(trcProp, clus.getX(), propagator->getNominalBz(), algConf.maxSnp, algConf.maxStep,
base::Propagator::MatCorrType(algConf.matCorType)) ||
216 !trcProp.update(clus)) {
220 if (clus.getCount()) {
223 float bestChi2 = algConf.ITSOverlapMaxChi2;
224 auto trPropOvl = trcProp;
225 for (
int iov = 0; iov < clus.getCount(); iov++) {
230 !propagator->propagateToX(trPropOvl, clusOvl.getX(), propagator->getNominalBz(), algConf.maxSnp, algConf.maxStep, base::Propagator::MatCorrType::USEMatCorrNONE)) {
234 auto chi2 = trPropOvl.getPredictedChi2(clusOvl);
235 if (chi2 < bestChi2) {
237 bestClusID = clusOvlID;
240 if (bestClusID != -1) {
260 const auto clusITSROF = recoData->getITSClustersROFRecords();
261 const auto patterns = recoData->getITSClustersPatterns();
262 auto pattIt = patterns.begin();
265 if (algConf.ITSOverlapMargin > 0) {
272 static std::vector<int> edgeClusters;
274 int16_t curSensID = -1;
275 struct ROFChipEntry {
276 int16_t rofCount = -1;
277 int chipFirstEntry = -1;
281 for (
const auto& rof : clusITSROF) {
282 int maxic = rof.getFirstEntry() + rof.getNEntries();
283 edgeClusters.clear();
284 for (
int ic = rof.getFirstEntry(); ic < maxic; ic++) {
285 const auto&
c = clusITS[ic];
286 int16_t sensID =
c.getSensorID();
288 double sigmaY2, sigmaZ2, sigmaYZ = 0, locXYZC[3], traXYZ[3];
289 auto pattItCopy = pattIt;
291 const auto& matAlg = sensor->getMatrixClAlg();
292 matAlg.LocalToMaster(locXYZ.data(), locXYZC);
293 const auto& mat = sensor->getMatrixT2L();
294 mat.MasterToLocal(locXYZC, traXYZ);
295 auto& cl3d =
mITSClustersArray.emplace_back(sensID, traXYZ[0], traXYZ[1], traXYZ[2], sigmaY2, sigmaZ2, sigmaYZ);
297 if (algConf.ITSOverlapMargin > 0) {
306 if (algConf.ITSOverlapEdgeRows > 0) {
307 auto pattID =
c.getPatternID();
325 if (drow < algConf.ITSOverlapEdgeRows) {
330 if (chipROFStart[sensID].rofCount != ROFCount) {
331 chipROFStart[sensID].rofCount = ROFCount;
332 chipROFStart[sensID].chipFirstEntry = edgeClusters.size();
334 edgeClusters.push_back(ic);
341 for (
auto ic : edgeClusters) {
343 int sensID = cl.getSensorID();
350 int chipOvl = ovl.rowSide[
ir];
352 if (chipROFStart[chipOvl].rofCount == ROFCount) {
353 auto oClusID = edgeClusters[chipROFStart[chipOvl].chipFirstEntry];
356 if (oClus.getSensorID() != sensID) {
359 if (oClus.isBitSet(ovl.rowSideOverlap[
ir]) &&
361 std::abs(oClus.getZ() - cl.getZ()) < algConf.ITSOverlapMaxDZ) {
373 cl.setCount(std::min(127, ovlCount));
392 int chMin = geom->getFirstChipIndex(ilr), chMax = geom->getLastChipIndex(ilr);
393 for (
int isn = chMin; isn <= chMax; isn++) {
403 int chMin = geom->getFirstChipIndex(ilr), chMax = geom->getLastChipIndex(ilr);
404 for (
int isn = chMin; isn <= chMax; isn++) {
Configuration file for global alignment.
Base class of alignable volume.
Steering class for the global alignment.
Definition of the GeometryTGeo class.
Definition of the ITS track.
Reference on ITS/MFT clusters set.
AlignableDetectorITS()=default
bool prepareDetectorData() final
std::vector< ClusterD > mITSClustersArray
void updatePointByTrackInfo(AlignmentPoint *pnt, const trackParam_t *t) const override
std::vector< int > mOverlapCandidateID
int processPoints(GIndex gid, int npntCut, bool inv) final
void setUseErrorParam(int v=0) override
void defineVolumes() final
std::vector< int > mOverlapClusRef
std::vector< o2::itsmft::ChipMappingITS::Overlaps > mOverlaps
void Print(const Option_t *opt="") const override
void SetAddErrorLr(int ilr, double sigY, double sigZ)
const o2::itsmft::TopologyDictionary * mITSDict
AlignableSensor * getSensor(int id) const
virtual void addVolume(AlignableVolume *vol)
int getNonSensLabel(int i) const
int getUseErrorParam() const
int getSensLabel(int i) const
void Print(const Option_t *opt="") const override
void setAddError(double y, double z)
void setSkip(bool v=true)
double getAlpTracking() const
void setParent(AlignableVolume *par)
const char * getSymName() const
GTrackID getCurrentTrackID() const
const o2::globaltracking::RecoContainer * getRecoContainer() const
AlignmentTrack * getAlgTrack() const
static const char * getSymbolicName(o2::detectors::DetID detid, int sensid)
static int getSensID(o2::detectors::DetID detid, int sensid)
GPUd() value_type estimateLTFast(o2 static GPUd() float estimateLTIncrement(const o2 PropagatorImpl * Instance(bool uninitialized=false)
static const AlignConfig & Instance()
Static class with identifiers, bitmasks and names for ALICE detectors.
static GeometryTGeo * Instance()
static constexpr int getNChips()
number of chips per barrel
std::vector< Overlaps > getOverlapsInfo() const
int getRowSpan() const
Returns the number of rows.
static constexpr unsigned short InvalidPatternID
static constexpr int NRows
static constexpr float PitchRow
static void localToDetectorUnchecked(float xRow, float zCol, int &iRow, int &iCol)
same but w/o check for row/column range
const ClusterPattern & getPattern(int n) const
Returns the pattern of the topology.
bool isGroup(int n) const
Returns true if the element corresponds to a group of rare topologies.
typename track::TrackParametrizationWithError< double > trackParam_t
std::array< T, 3 > extractClusterDataA(const itsmft::CompClusterExt &c, iterator &iter, const itsmft::TopologyDictionary *dict, T &sig2y, T &sig2z)
void align(gsl::span< ElinkEncoder< BareFormat, CHARGESUM > > elinks)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
const o2::track::TrackParCov & getTrackParam(GTrackID gidx) const
auto getITSClusters() const
o2::InteractionRecord ir(0, 0)