Project
Loading...
Searching...
No Matches
AlignableDetectorTOF.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16
20#include "Align/Controller.h"
23#include "TOFBase/Geo.h"
24#include <TGeoManager.h>
25
27
28namespace o2
29{
30namespace align
31{
32
33//____________________________________________
38
39//____________________________________________
41{
42 // define TOF volumes
43 //
44 constexpr int NSect = 18;
45 int labDet = getDetLabel();
46 AlignableSensorTOF* strip = nullptr;
47 //
48 // AddVolume( volTOF = new AlignableVolume("TOF") ); // no main volume, why?
49 AlignableVolume* sect[NSect] = {};
50 AlignableVolume* volTOF = nullptr; // fictious envelope
51 addVolume(volTOF = new AlignableVolume("TOF_envelope", getDetLabel(), mController));
52 volTOF->setDummyEnvelope();
53 //
54 int cnt = 0;
55 for (int isc = 0; isc < NSect; isc++) {
56 for (int istr = 1; istr <= o2::tof::Geo::NSTRIPXSECTOR; istr++) { // strip
57 const char* symname = Form("TOF/sm%02d/strip%02d", isc, istr);
59 cnt++;
60 if (!gGeoManager->GetAlignableEntry(symname)) {
61 strip->setDummy(true);
62 // continue;
63 }
64 if (!sect[isc]) {
65 sect[isc] = new AlignableVolume(Form("TOF/sm%02d", isc), getNonSensLabel(isc), mController);
66 sect[isc]->setParent(volTOF);
67 }
68 strip->setParent(sect[isc]);
69 } // strip
70 } // layer
71
72 for (int isc = 0; isc < NSect; isc++) {
73 if (sect[isc]) {
74 addVolume(sect[isc]);
75 }
76 }
77}
78
79//____________________________________________
80int AlignableDetectorTOF::processPoints(GIndex gid, int npntCut, bool inv)
81{
82 // Extract the points corresponding to this detector, recalibrate/realign them to the
83 // level of the "starting point" for the alignment/calibration session.
84 // If inv==true, the track propagates in direction of decreasing tracking X
85 // (i.e. upper leg of cosmic track)
86 //
87
88 int npoints = 0;
89 auto algTrack = mController->getAlgTrack();
90 auto recoData = mController->getRecoContainer();
91 auto TOFClusters = recoData->getTOFClusters();
92 if (TOFClusters.empty()) {
93 return -1; // source not loaded?
94 }
95 const auto& clus = TOFClusters[gid.getIndex()];
96 int det[5] = {}, ch = clus.getMainContributingChannel();
98 int sensID = o2::tof::Geo::getStripNumberPerSM(det[1], det[2]) + clus.getSector() * o2::tof::Geo::NSTRIPXSECTOR;
99 auto* sensor = (AlignableSensorTOF*)getSensor(sensID);
100 if (sensor->isDummy()) {
101 LOGP(error, "Dummy sensor {} is referred by a track", sensID);
102 return 0;
103 }
104 double loc[3] = {(det[4] + 0.5) * o2::tof::Geo::XPAD - o2::tof::Geo::XHALFSTRIP, 0., (det[3] - 0.5) * o2::tof::Geo::ZPAD}, locCorr[3] = {}, traCorr[3] = {};
105 const auto& matAlg = sensor->getMatrixClAlg();
106 matAlg.LocalToMaster(loc, locCorr);
107 // rotate to tracking
108 const auto& matT2L = sensor->getMatrixT2L();
109 matT2L.MasterToLocal(locCorr, traCorr);
110 //
111 auto& pnt = algTrack->addDetectorPoint();
112
113 const auto* sysE = sensor->getAddError(); // additional syst error
114 pnt.setYZErrTracking(clus.getSigmaY2() + sysE[0] * sysE[0], clus.getSigmaYZ(), clus.getSigmaZ2() + sysE[1] * sysE[1]);
115 if (getUseErrorParam()) { // errors will be calculated just before using the point in the fit, using track info
116 pnt.setNeedUpdateFromTrack();
117 }
118 pnt.setXYZTracking(traCorr[0], traCorr[1], traCorr[2]);
119 pnt.setSensor(sensor);
120 pnt.setAlphaSens(sensor->getAlpTracking());
121 pnt.setXSens(sensor->getXTracking());
122 pnt.setDetID(mDetID);
123 pnt.setSID(sensor->getSID());
124 pnt.setContainsMeasurement();
125 pnt.setInvDir(inv);
126 pnt.init();
127 npoints++;
128 mNPoints += npoints;
129 return npoints;
130}
131
132} // namespace align
133} // namespace o2
ClassImp(o2::align::AlignableDetectorTOF)
Wrapper for TOF detector.
Base class of alignable volume.
Steering class for the global alignment.
Wrapper container for different reconstructed object types.
Definition of the TOF cluster.
int processPoints(GIndex gid, int npntCut, bool inv) final
AlignableSensor * getSensor(int id) const
virtual void addVolume(AlignableVolume *vol)
void setDummyEnvelope(bool v=true)
void setParent(AlignableVolume *par)
const o2::globaltracking::RecoContainer * getRecoContainer() const
Definition Controller.h:200
AlignmentTrack * getAlgTrack() const
Definition Controller.h:198
Controller * mController
Definition DOFSet.h:73
static int getSensID(o2::detectors::DetID detid, int sensid)
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
static constexpr ID TOF
Definition DetID.h:66
static constexpr Float_t ZPAD
Definition Geo.h:141
static constexpr Float_t XPAD
Definition Geo.h:139
static constexpr Float_t XHALFSTRIP
Definition Geo.h:140
static Int_t getStripNumberPerSM(Int_t iplate, Int_t istrip)
Definition Geo.cxx:593
static constexpr Int_t NSTRIPXSECTOR
Definition Geo.h:116
static void getVolumeIndices(Int_t index, Int_t *detId)
Definition Geo.cxx:543
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...