13#include <fairlogger/Logger.h>
38 std::string p = gSystem->Getenv(
"O2_ROOT");
39 p +=
"/share/Detectors/PHOS/files/alignment.root";
43 for (
int m = 1;
m < 5;
m++) {
44 mPHOS[
m] = *
static_cast<TGeoHMatrix*
>(fin.Get(Form(
"Module%d",
m)));
53 const short nStrpZ = 28;
54 const short nCrystalsInModule = 56 * 64;
55 const short nCellsXInStrip = 8;
58 short row = nStrpZ - (strip - 1) % nStrpZ;
59 short col = (
int)std::ceil((
float)strip / (nStrpZ)) - 1;
61 return (moduleNumber - 1) * nCrystalsInModule +
row * 2 + (
col * nCellsXInStrip + (cell - 1) / 2) * nZ -
72 const short nPhi = 64;
74 short phosmodulenumber = absId / (nZ * nPhi);
76 relid[0] = phosmodulenumber + 1;
77 absId -= phosmodulenumber * nPhi * nZ;
78 relid[1] = 1 + absId / nZ;
79 relid[2] = absId - (relid[1] - 1) * nZ + 1;
89 short ddl = truId / 224;
90 relid[0] = 1 + (ddl + 2) / 4;
93 if ((truId > 90 && truId < 112) || truId > 202) {
94 LOG(error) <<
"Wrong TRU id channel " << truId <<
" should be <91";
100 relid[1] = 16 * ((2 + ddl) % 4) + 1 + 2 * (truId % 7);
102 relid[2] = 53 - 2 * (truId / 7);
105 relid[2] = 25 - 2 * (truId / 7);
108 relid[1] = 16 * ((2 + ddl) % 4) + 1 + 2 * (truId % 8);
110 relid[2] = 55 - 2 * (truId / 8);
113 relid[2] = 27 - 2 * (truId / 8);
123 short ddl = relId[0] * 4 + relId[1] / 16 - 6;
126 absId = ((53 - relId[2]) / 2) * 7;
128 absId = 112 + ((25 - relId[2]) / 2) * 7;
130 absId += (((relId[1] - 1) % 16) / 2) % 7;
135 absId = ((55 - relId[2]) / 2) * 8;
137 absId = 112 + ((27 - relId[2]) / 2) * 8;
139 absId += (((relId[1] - 1) % 16) / 2) % 8;
147 char relid[3] = {mod,
static_cast<char>(ceil(
x / CELLSTEP + 32.499)),
static_cast<char>(ceil(
z / CELLSTEP + 28.499))};
154 const short nPhi = 64;
156 return 1 + (absId - 1) / (nZ * nPhi);
177 if (relid1[0] == relid2[0]) {
178 char rowdiff = TMath::Abs(relid1[1] - relid2[1]);
179 char coldiff = TMath::Abs(relid1[2] - relid2[2]);
181 if (coldiff + rowdiff <= 1) {
184 if ((relid2[1] > relid1[1]) && (relid2[2] > relid1[2] + 1)) {
191 if (relid1[0] > relid2[0]) {
204 x = (relid[1] - 32 - 0.5) * CELLSTEP;
205 z = (relid[2] - 28 - 0.5) * CELLSTEP;
210 const short nPhi = 64;
213 (relId[0] - 1) * nPhi * nZ +
214 (relId[1] - 1) * nZ +
223 char relid[3] = {module,
static_cast<char>(ceil(
x / CELLSTEP + 32.499)),
static_cast<char>(ceil(
z / CELLSTEP + 28.499))};
229 relId[1] =
static_cast<char>(ceil(
x / CELLSTEP + 32.499));
230 relId[2] =
static_cast<char>(ceil(
z / CELLSTEP + 28.499));
237 constexpr float shiftY = -1.26;
238 Double_t posL[3] = {
x,
z, shiftY};
240 mPHOS[module].LocalToMaster(posL, posG);
241 globaPos.SetXYZ(posG[0], posG[1], posG[2]);
245 short& module,
float&
z,
float&
x)
const
249 constexpr float shiftY = -1.26;
250 constexpr float moduleXhalfSize = 72.16;
251 constexpr float moduleZhalfSize = 64.14;
253 for (
short mod = 1; mod < 5; mod++) {
255 double tmp[3] = {0., 0., shiftY};
256 double posG[3] = {0., 0., 0.};
257 mPHOS[mod].LocalToMaster(tmp, posG);
258 TVector3
n(posG[0], posG[1], posG[2]);
259 double direction =
n.Dot(p);
260 if (direction <= 0.) {
263 double fr = (
n.Mag2() -
n.Dot(vtx)) / direction;
267 if (TMath::Abs(
n.Z()) < moduleZhalfSize &&
n.Pt() < moduleXhalfSize) {
270 x = TMath::Sign(
n.Pt(),
n.X());
static short relPosToTruId(char mod, float x, float z, short trigType)
static int getTotalNCells()
static void relPosToAbsId(char module, float x, float z, short &absId)
static void relPosToRelId(short module, float x, float z, char *relId)
void local2Global(char module, float x, float z, TVector3 &globaPos) const
bool impactOnPHOS(const TVector3 &vtx, const TVector3 &p, short &module, float &z, float &x) const
static char absIdToModule(short absId)
static int areNeighbours(short absId1, short absId2)
static short truRelToAbsNumbering(const char *relId, short trigType)
static void absIdToRelPosInModule(short absId, float &x, float &z)
static bool relToAbsNumbering(const char *RelId, short &AbsId)
static short relToAbsId(char moduleNumber, int strip, int cell)
static bool truAbsToRelNumbering(short truId, short trigType, char *relid)
static bool absToRelNumbering(short absId, char *relid)
GLuint const GLchar * name
GLdouble GLdouble GLdouble z
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"