1111#include <TTree.h>
1212
1313#include <vector>
14- #include "ITS3Base /GeometryTGeo.h"
14+ #include "ITSBase /GeometryTGeo.h"
1515#include "DataFormatsITSMFT/Digit.h"
1616#include "ITS3Base/SegmentationSuperAlpide.h"
1717#include "ITSMFTBase/SegmentationAlpide.h"
@@ -43,10 +43,10 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil
4343
4444 // Geometry
4545 o2 ::base ::GeometryManager ::loadGeometry (inputGeom );
46- auto* gman = o2::its3 ::GeometryTGeo::Instance();
46+ auto* gman = o2 ::its ::GeometryTGeo ::Instance ();
4747 gman -> fillMatrixCache (o2 ::math_utils ::bit2Mask (o2 ::math_utils ::TransformType ::L2G ));
4848
49- SegmentationSuperAlpide segs[4 ]{SegmentationSuperAlpide(0), SegmentationSuperAlpide(1), SegmentationSuperAlpide(2), SegmentationSuperAlpide(3 )};
49+ SegmentationSuperAlpide segs [3 ]{SegmentationSuperAlpide (0 ), SegmentationSuperAlpide (1 ), SegmentationSuperAlpide (2 )};
5050 SegmentationSuperAlpide & seg = segs [0 ];
5151
5252 // Hits
@@ -153,7 +153,7 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil
153153
154154 Int_t chipID = (* digArr )[iDigit ].getChipIndex ();
155155
156- if (chipID < 4 ) {
156+ if (chipID / 2 < 3 ) {
157157 segs [chipID ].detectorToLocal (ix , iz , x , z );
158158 } else {
159159 SegmentationAlpide ::detectorToLocal (ix , iz , x , z );
@@ -170,15 +170,17 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil
170170 nDigitRead ++ ;
171171
172172 auto gloD = gman -> getMatrixL2G (chipID )(locD ); // convert to global
173- if (chipID < 4 ) {
173+ if (chipID / 2 < 3 ) {
174174 //
175175 // invert
176- //xyzLocS = {SegmentationSuperAlpide::Radii[detID] * startPhi, 0.f, startPos.Z()};
177- //xyzLocE = {SegmentationSuperAlpide::Radii[detID] * endPhi, 0.f, endPos.Z()};
176+ // xyzLocS = {SegmentationSuperAlpide::Radii[detID] * startPhi, 0.f, startPos.Z()};
177+ // xyzLocE = {SegmentationSuperAlpide::Radii[detID] * endPhi, 0.f, endPos.Z()};
178178 //
179- double radius = SegmentationSuperAlpide::Radii[chipID];
180- double phi = locD.X() / radius;
181- gloD.SetXYZ(radius * std::cos(phi), radius * std::sin(phi), locD.Z());
179+ double radius = SegmentationSuperAlpide ::Radii [chipID / 2 ];
180+ bool isTop = !(chipID % 2 );
181+ double phi = locD .X () / radius + (isTop ? -0.5 : 0.5 ) * (float )TMath ::Pi ();
182+
183+ gloD .SetXYZ (radius * std ::cos (phi ), (isTop ? radius * std ::sin (phi ) + 0.1 / 2 : radius * std ::sin (phi ) - 0.1 / 2 ), locD .Z ());
182184 }
183185 float dx = 0. , dz = 0. ;
184186
@@ -194,28 +196,35 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil
194196 continue ;
195197 }
196198
199+ ////// HITS
197200 Hit & hit = (* hitArray [lab .getEventID ()])[hitEntry -> second ];
198201
199202 // FIXME FOR INNER BARREL
200203 auto locH = gman -> getMatrixL2G (chipID ) ^ (hit .GetPos ()); // inverse conversion from global to local
201204 auto locHsta = gman -> getMatrixL2G (chipID ) ^ (hit .GetPosStart ());
202205
203- if (chipID < 4) {
204- float startPhi{std::atan2(-hit.GetPosStart().Y(), -hit.GetPosStart().X())};
205- float endPhi{std::atan2(-hit.GetPos().Y(), -hit.GetPos().X())};
206- locH.SetXYZ(SegmentationSuperAlpide::Radii[chipID] * endPhi, 0.f, hit.GetPos().Z());
207- locHsta.SetXYZ(SegmentationSuperAlpide::Radii[chipID] * startPhi, 0.f, hit.GetPosStart().Z());
206+ if (chipID / 2 < 3 ) {
207+ // startPhi{std::atan2(-reShiftedStartY, -startPos.X()) + (isTop ? (float)TMath::Pi() / 2 : -(float)TMath::Pi() / 2)};
208+ bool isTop = !(chipID % 2 );
209+ float reShiftedY = isTop ? hit .GetPosStart ().Y () - 0.1 / 2 : hit .GetPosStart ().Y () + 0.1 / 2 ;
210+ float startPhi {std ::atan2 (- reShiftedY , - hit .GetPosStart ().X ()) + (isTop ? (float )TMath ::Pi () / 2 : - (float )TMath ::Pi () / 2 )};
211+ float reShiftedEndY = isTop ? hit .GetPos ().Y () - 0.1 / 2 : hit .GetPos ().Y () + 0.1 / 2 ;
212+ float endPhi {std ::atan2 (- reShiftedEndY , - hit .GetPos ().X ()) + (isTop ? (float )TMath ::Pi () / 2 : - (float )TMath ::Pi () / 2 )};
213+ locH .SetXYZ (SegmentationSuperAlpide ::Radii [chipID / 2 ] * endPhi , 0.f , hit .GetPos ().Z ());
214+ locHsta .SetXYZ (SegmentationSuperAlpide ::Radii [chipID / 2 ] * startPhi , 0.f , hit .GetPosStart ().Z ());
208215 }
209216
210217 locH .SetXYZ (0.5 * (locH .X () + locHsta .X ()), 0.5 * (locH .Y () + locHsta .Y ()), 0.5 * (locH .Z () + locHsta .Z ()));
211218
212219 int row , col ;
213220 float xlc = 0. , zlc = 0. ;
214221
215- segs[chipID < 4 ? chipID : 0].localToDetector(locH.X(), locH.Z(), row, col);
216- segs[chipID < 4 ? chipID : 0].detectorToLocal(row, col, xlc, zlc);
222+ segs [chipID / 2 < 3 ? chipID : 0 ].localToDetector (locH .X (), locH .Z (), row , col );
223+ segs [chipID / 2 < 3 ? chipID : 0 ].detectorToLocal (row , col , xlc , zlc );
217224
218- nt->Fill(chipID, gloD.X(), gloD.Y(), gloD.Z(), ix, iz, row, col, locH.X(), locH.Z(), xlc, zlc, locH.X() - locD.X(), locH.Z() - locD.Z());
225+ if (chipID < 6 ) {
226+ nt -> Fill (chipID , gloD .X (), gloD .Y (), gloD .Z (), ix , iz , row , col , locH .X (), locH .Z (), xlc , zlc , locH .X () - locD .X (), locH .Z () - locD .Z ());
227+ }
219228
220229 nDigitFilled ++ ;
221230 } // not noise
@@ -227,7 +236,7 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil
227236 new TCanvas ;
228237 nt -> Draw ("y:x" );
229238 new TCanvas ;
230- nt->Draw("dx:dz", "abs(dx)<0.02 && abs(dz)<0.02");
239+ nt -> Draw ("dx:dz" , "" ); /// abs(dx)<0.02 && abs(dz)<0.02
231240
232241 f -> Write ();
233242 f -> Close ();
0 commit comments