3333#define ENABLE_UPGRADES
3434#include "DetectorsCommonDataFormats/DetID.h"
3535#include "ITSBase/GeometryTGeo.h"
36+ #include "ITS3Base/SpecsV2.h"
3637#include "ITSMFTBase/SegmentationAlpide.h"
3738#include "ITS3Base/SegmentationMosaix.h"
3839#include "DataFormatsITSMFT/CompCluster.h"
@@ -94,7 +95,7 @@ void CreateDictionariesITS3(bool saveDeltas = true,
9495 TNtuple * nt = nullptr ;
9596 if (saveDeltas ) {
9697 fout = TFile ::Open ("CreateDictionaries.root" , "recreate" );
97- nt = new TNtuple ("nt" , "hashes ntuple" , "hash:layer:chipID:xhf:zhf:xcf:zcf:dx:dz:outlimDx:outlimDz" );
98+ nt = new TNtuple ("nt" , "hashes ntuple" , "hash:layer:chipID:xhf:zhf:xcf:zcf:dx:dz:outlimDx:outlimDz:clusterSize:eta " );
9899 }
99100
100101 const o2 ::steer ::DigitizationContext * digContext = nullptr ;
@@ -270,16 +271,34 @@ void CreateDictionariesITS3(bool saveDeltas = true,
270271 auto xyzLocE = gman -> getMatrixL2G (chipID ) ^ (hit .GetPos ()); // inverse conversion from global to local
271272 auto xyzLocS = gman -> getMatrixL2G (chipID ) ^ (hit .GetPosStart ());
272273 o2 ::math_utils ::Vector3D < float > xyzLocM ;
273- xyzLocM .SetCoordinates (0.5f * (xyzLocE .X () + xyzLocS .X ()), 0.5f * (xyzLocE .Y () + xyzLocS .Y ()), 0.5f * (xyzLocE .Z () + xyzLocS .Z ()));
274274 auto locC = o2 ::its3 ::TopologyDictionary ::getClusterCoordinates (cluster , pattern , false );
275275 int layer = gman -> getLayer (chipID );
276+ float x0 , y0 , z0 , dltx , dlty , dltz , r ;
276277 if (ib ) {
277278 float xFlat {0. }, yFlat {0. };
278- mMosaixSegmentations [layer ].curvedToFlat (xyzLocM .X (), xyzLocM .Y (), xFlat , yFlat );
279- xyzLocM .SetCoordinates (xFlat , yFlat , xyzLocM .Z ());
280279 mMosaixSegmentations [layer ].curvedToFlat (locC .X (), locC .Y (), xFlat , yFlat );
281280 locC .SetCoordinates (xFlat , yFlat , locC .Z ());
281+ mMosaixSegmentations [layer ].curvedToFlat (xyzLocE .X (), xyzLocE .Y (), xFlat , yFlat );
282+ xyzLocE .SetCoordinates (xFlat , yFlat , xyzLocE .Z ());
283+ mMosaixSegmentations [layer ].curvedToFlat (xyzLocS .X (), xyzLocS .Y (), xFlat , yFlat );
284+ xyzLocS .SetCoordinates (xFlat , yFlat , xyzLocS .Z ());
285+ x0 = xyzLocS .X ();
286+ dltx = xyzLocE .X () - x0 ;
287+ y0 = xyzLocS .Y ();
288+ dlty = xyzLocE .Y () - y0 ;
289+ z0 = xyzLocS .Z ();
290+ dltz = xyzLocE .Z () - z0 ;
291+ r = (its3 ::constants ::pixelarray ::pixels ::apts ::responseYShift - y0 ) / dlty ;
292+ } else {
293+ x0 = xyzLocS .X ();
294+ dltx = xyzLocE .X () - x0 ;
295+ y0 = xyzLocS .Y ();
296+ dlty = xyzLocE .Y () - y0 ;
297+ z0 = xyzLocS .Z ();
298+ dltz = xyzLocE .Z () - z0 ;
299+ r = (0.5 * (Segmentation ::SensorLayerThickness - Segmentation ::SensorLayerThicknessEff ) - y0 ) / dlty ;
282300 }
301+ xyzLocM .SetXYZ (x0 + r * dltx , y0 + r * dlty , z0 + r * dltz );
283302
284303 auto pitchX = (ib ) ? o2 ::its3 ::SegmentationMosaix ::PitchRow : o2 ::itsmft ::SegmentationAlpide ::PitchRow ;
285304 auto pitchZ = (ib ) ? o2 ::its3 ::SegmentationMosaix ::PitchCol : o2 ::itsmft ::SegmentationAlpide ::PitchCol ;
@@ -302,7 +321,13 @@ void CreateDictionariesITS3(bool saveDeltas = true,
302321 }
303322 }
304323 if (saveDeltas ) {
305- nt -> Fill (topology .getHash (), layer , chipID , xyzLocM .X (), xyzLocM .Z (), locC .X (), locC .Z (), dX , dZ , outLimitDx , outLimitDz );
324+ auto vectDiff = xyzLocE - xyzLocS ;
325+ auto theta = std ::acos (vectDiff .Z () / std ::hypot (vectDiff .X (), vectDiff .Y (), vectDiff .Z ()));
326+ auto eta = - std ::log (std ::tan (theta /2 ));
327+ if (ib ) {
328+ LOGP (info , "Yhit flat start: {}, end: {}, middle: {}" , xyzLocS .Y (), xyzLocE .Y (), xyzLocM .Y ());
329+ }
330+ nt -> Fill (topology .getHash (), layer , chipID , xyzLocM .X (), xyzLocM .Z (), locC .X (), locC .Z (), dX , dZ , outLimitDx , outLimitDz , pattern .getNPixels (), eta );
306331 }
307332 }
308333 } else {
0 commit comments