#include "AliITSUGeomTGeo.h"
#include "AliITSsegmentation.h"
#include "AliExternalTrackParam.h"
+#include "AliITSUAux.h"
+#include "AliLog.h"
+
+using namespace AliITSUAux;
+using namespace TMath;
ClassImp(AliITSURecoSens)
{
// def. c-tor
SetID(id);
- for (int i=kNNeighbors;i--;) fNeighbors[i] = -1;
}
//______________________________________________________
,fZMax(source.fZMax)
{
// copy c-tor
- for (int i=kNNeighbors;i--;) fNeighbors[i] = source.fNeighbors[i];
}
//______________________________________________________
fZMin = source.fZMin;
fZMax = source.fZMax;
//
- for (int i=kNNeighbors;i--;) fNeighbors[i] = source.fNeighbors[i];
return *this;
}
void AliITSURecoSens::Print(Option_t*) const
{
//print
- printf("Sensor%4d xTF=%+.3e phiTF=%+.3e | Phi:[%5.3f:%5.3f] Z:[%+7.3f:%+7.3f]| Neighb.:",
+ printf("Sensor%4d xTF=%+.3e phiTF=%+.3e | Phi:[%5.3f:%5.3f] Z:[%+7.3f:%+7.3f]\n",
GetID(),GetXTF(),GetPhiTF(), fPhiMin,fPhiMax, fZMin,fZMax);
- for (int i=0;i<kNNeighbors;i++) printf(" %4d",fNeighbors[i]); printf("\n");
}
//______________________________________________________
//
// to do
}
+
+//______________________________________________________________________________
+Int_t AliITSURecoSens::Compare(const TObject* obj) const
+{
+ // compare sensor positions
+ AliITSURecoSens* copy = (AliITSURecoSens*)obj;
+ double phi = MeanPhiSmall(fPhiMin,fPhiMax);
+ double phiC = MeanPhiSmall(copy->fPhiMin,copy->fPhiMax);
+ double span = DeltaPhiSmall(fPhiMin,fPhiMax)/2;
+ double dPhi = DeltaPhiSmall(phi,phiC);
+ //
+ // special case to well define 1st raw (closest to 0 from above): wrap around 0/2pi
+ if (dPhi>span) return phi<phiC ? -1 : 1;
+ //
+ double phiT = phi+span;
+ BringTo02Pi(phiT);
+ // if (phiT<phiC && OKforPhiMin(phiT,phiC)) return -1;
+ if (OKforPhiMin(phiT,phiC)) return -1;
+ phiT = phi-span;
+ BringTo02Pi(phiT);
+ //if (phiT>phiC && OKforPhiMax( phiT,phiC)) return 1;
+ if (OKforPhiMax( phiT,phiC)) return 1;
+ //
+ // sane phi range, check Z
+ double dz = (fZMax-fZMin)/2;
+ if (fZMax+dz < copy->fZMax) return -1;
+ if (fZMin-dz > copy->fZMin) return 1;
+ AliError(Form("Same chip compared? %d %d",GetID(),copy->GetID()));
+ Print();
+ copy->Print();
+ return 0;
+ //
+}