Project
Loading...
Searching...
No Matches
testCoordinateTransforms.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
15
16#define BOOST_TEST_MODULE Test CoordinateTransforms
17#define BOOST_TEST_MAIN
18#define BOOST_TEST_DYN_LINK
19#include <boost/test/unit_test.hpp>
20#include <iostream>
21#include <numeric>
22
25
26#include "TRDBase/PadPlane.h"
28#include "TRDBase/Geometry.h"
29
30namespace o2
31{
32namespace trd
33{
34
35using namespace o2::trd::constants;
36using namespace std;
37
38void testRCPoint(double calculatedPoint, double predictedPoint)
39{
40 float e = 0.000001;
41 BOOST_CHECK(fabs(predictedPoint - calculatedPoint) <= e);
42}
43
45{
46 auto mGeo = o2::trd::Geometry::instance();
47 mGeo->createPadPlaneArray();
48
49 int hcid = 776;
50 // This C1 chamber has 16 pad rows with I pad length = 90mm and O pad length = 75mm
51 int detector = hcid / 2;
52 int stack = mGeo->getStack(detector);
53 int layer = mGeo->getLayer(detector);
54
55 auto padPlane = mGeo->getPadPlane(layer, stack);
56 double lengthIPad = padPlane->getLengthIPad();
57 double lengthOPad = padPlane->getLengthOPad();
58
59 double padIWidth = padPlane->getWidthIPad();
60 double padOWidth = padPlane->getWidthOPad();
61
62 double tiltingAngle = padPlane->getTiltingAngle();
63
64 // Test padrows
65 auto p1 = padPlane->getPadRow(0);
66 // Center of the chamber. This should return the lower edge of padrow 8.
67 // Since we are using float values, the lower edge of padrow 8 correspond with float value 8.0.
68 testRCPoint(p1, 8.);
69
70 auto p2 = padPlane->getPadRow(lengthIPad / 2.);
71 // With an I pad length of 9 cm, 9. / 2. should put us half way into the preceeding pad (pad 7) since padrow number
72 // decreses in positive z direction.
73 testRCPoint(p2, 7.5);
74
75 auto p3 = padPlane->getPadRow(-lengthIPad / 2.);
76 // Same as above but in the other direction.
77 testRCPoint(p3, 8.5);
78
79 auto p4 = padPlane->getPadRow(lengthIPad * 4.2);
80 // Arbitrary distance in z.
81 testRCPoint(p4, 8 - 4.2);
82
83 auto p5 = padPlane->getPadRow(lengthIPad * 7 + lengthOPad);
84 // Lower border case. Take center and add 7 pads * 9 cm + 1 pad * 7.5 cm.
85 testRCPoint(p5, 0);
86
87 auto p6 = padPlane->getPadRow(-lengthIPad * 7 - lengthOPad);
88 // Upper border case. Take center and subtract 7 pads * 9 cm - 1 pad * 7.5 cm.
89 testRCPoint(p6, 16);
90
91 // Test pads with pad tilting
92 double p13 = padPlane->getPad(0, 0.01);
93 // Center of chamber plus epsilon (in z). Note the discontinuity in pad vs. z at z=0. This puts us at a point on the lower
94 // (in z direction) end of padrow 7. Since we have a pad tilt of -2 deg (pads tilted clockwise for particle coming
95 // from interaction vertex). After a lot thought and doodles on Miro (https://miro.com/app/board/o9J_lKgybMc=/) we
96 // find that we expect a small negative offset which would place us in the upper half of pad 71.
97 // To calculate that offset, we multiply the tangent of the tilting angle by the distance that our point is away
98 // from the center of its local padrow. Some unit conversions are also neccessary...
99 testRCPoint(p13, 72 + TMath::Tan(TMath::DegToRad() * tiltingAngle) * (0.5 * lengthIPad - 0.01) / padIWidth);
100
101 double p14 = padPlane->getPad(0, -lengthIPad / 2.);
102 // Move from center of chamber to to center of padrow 8 = 8.5.
103 // This should now place us as edge of pad 72 = 72.0 since no offset is applied from pad tilt.
104 testRCPoint(p14, 72);
105
106 double p15 = padPlane->getPad(0, lengthIPad / 2.);
107 // Should be the same in the other direction at padrow = 7.5
108 testRCPoint(p15, 72);
109
110 double p16 = padPlane->getPad(padIWidth * 42, lengthIPad / 2.);
111 // Adding an arbitrary number of pads should just increase position by same number
112 testRCPoint(p16, 72 + 42);
113
114 double p17 = padPlane->getPad(padIWidth * 42, -lengthIPad * 4 - 2.3);
115 // Moving to arbitrary point in both y and z. In y, we are 42 pads from the center which would be 72 + 42 = 114
116 // if we were in the center of the padrow and no pad tilting is considered. However, we are not in the center of
117 // a padrow, but rather 2.3 cm into padrow 8 + 4 = 12. This puts us below the center which is at 4.5 cm
118 // into the padrow and therefore, we expect a small postiive offset since the pad tilting angle is -2 deg.
119 testRCPoint(p17, 72 + 42 + TMath::Tan(TMath::DegToRad() * tiltingAngle) * (2.3 - 0.5 * lengthIPad) / padIWidth);
120
121 double p18 = padPlane->getPad(padIWidth * 71 + padOWidth, lengthIPad / 2.);
122 // Border case right on the upper edge of the padrow in y direction and at the center of the padrow in z
123 testRCPoint(p18, 144);
124
125 double p19 = padPlane->getPad(-padIWidth * 71 - padOWidth, lengthIPad / 2.);
126 // Border case right on the lower edge of the padrow in y direction and at the center of the padrow in z
127 testRCPoint(p19, 0);
128
129 double p20 = padPlane->getPad(0, lengthIPad * 7 + 1.5);
130 // Ensure that shorter length of outer padrows is considered correctly
131 testRCPoint(p20, 72 + TMath::Tan(TMath::DegToRad() * tiltingAngle) * (0.5 * lengthOPad - 1.5) / padIWidth);
132}
133
134} // namespace trd
135} // namespace o2
Global TRD definitions and constants.
Definition of the GeometryManager class.
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h trd
constexpr int p2()
constexpr int p1()
constexpr to accelerate the coordinates changing
uint32_t stack
Definition RawData.h:1
static Geometry * instance()
Definition Geometry.h:33
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
void testRCPoint(double calculatedPoint, double predictedPoint)
BOOST_AUTO_TEST_CASE(TRDDigit_test)
Definition testDigit.cxx:48
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
BOOST_CHECK(tree)