Added classes for geometry - reconstruction interface, minor fixes in other classes
authorshahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 2 Nov 2012 22:08:06 +0000 (22:08 +0000)
committershahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 2 Nov 2012 22:08:06 +0000 (22:08 +0000)
22 files changed:
ITS/UPGRADE/AliITSUAux.cxx [new file with mode: 0644]
ITS/UPGRADE/AliITSUAux.h [new file with mode: 0644]
ITS/UPGRADE/AliITSUGeomTGeo.h
ITS/UPGRADE/AliITSUInitGeometry.cxx
ITS/UPGRADE/AliITSUModule.cxx
ITS/UPGRADE/AliITSURecoDet.cxx [new file with mode: 0644]
ITS/UPGRADE/AliITSURecoDet.h [new file with mode: 0644]
ITS/UPGRADE/AliITSURecoLayer.cxx [new file with mode: 0644]
ITS/UPGRADE/AliITSURecoLayer.h [new file with mode: 0644]
ITS/UPGRADE/AliITSURecoSens.cxx [new file with mode: 0644]
ITS/UPGRADE/AliITSURecoSens.h [new file with mode: 0644]
ITS/UPGRADE/AliITSUSDigit.cxx
ITS/UPGRADE/AliITSUSegmentationPix.cxx
ITS/UPGRADE/AliITSUSimuParam.cxx
ITS/UPGRADE/AliITSUSimulation.cxx
ITS/UPGRADE/AliITSUSimulationPix.cxx
ITS/UPGRADE/AliITSUv11.cxx
ITS/UPGRADE/AliITSUv11Layer.cxx
ITS/UPGRADE/CMakelibITSUpgradeBase.pkg
ITS/UPGRADE/CMakelibITSUpgradeRec.pkg
ITS/UPGRADE/ITSUpgradeBaseLinkDef.h
ITS/UPGRADE/ITSUpgradeRecLinkDef.h

diff --git a/ITS/UPGRADE/AliITSUAux.cxx b/ITS/UPGRADE/AliITSUAux.cxx
new file mode 100644 (file)
index 0000000..b218e7c
--- /dev/null
@@ -0,0 +1 @@
+#include "AliITSUAux.h"
diff --git a/ITS/UPGRADE/AliITSUAux.h b/ITS/UPGRADE/AliITSUAux.h
new file mode 100644 (file)
index 0000000..79483cd
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef ALIITSUAUX
+#define ALIITSUAUX
+
+#include <TObject.h>
+#include <TMath.h>
+
+///////////////////////////////////////////////////////////////////////
+//                                                                   //
+//  Namespace AliITSUAux                                             //
+//  Set of utilities for the ITSU classes                            //
+//                                                                   //
+///////////////////////////////////////////////////////////////////////
+
+
+class AliITSUGeomTGeo;
+class AliITSsegmentation;
+using namespace TMath;
+
+
+namespace AliITSUAux {
+  void   BringTo02Pi(double &phi);
+  Bool_t OKforPhiMin(double phiMin,double phi);
+  Bool_t OKforPhiMax(double phiMax,double phi);
+}
+
+//_________________________________________________________________________________
+inline void AliITSUAux::BringTo02Pi(double &phi) {   
+  // bring phi to 0-2pi range
+  if (phi<0) phi+=TwoPi(); else if (phi>TwoPi()) phi-=TwoPi();
+}
+
+//_________________________________________________________________________________
+inline Bool_t AliITSUAux::OKforPhiMin(double phiMin,double phi) {
+  // check if phi is above the phiMin, phi's must be in 0-2pi range
+  double dphi = phi-phiMin;
+  return ((dphi>0 && dphi<Pi()) || dphi<-Pi()) ? kTRUE:kFALSE;
+}
+
+//_________________________________________________________________________________
+inline Bool_t AliITSUAux::OKforPhiMax(double phiMax,double phi) {
+  // check if phi is below the phiMax, phi's must be in 0-2pi range
+  double dphi = phi-phiMax;
+  return ((dphi<0 && dphi>-Pi()) || dphi>Pi()) ? kTRUE:kFALSE;
+}
+
+
+#endif
index f668b39..09a1cbc 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef ALIITSUGEOMTGEO_H
 #define ALIITSUGEOMTGEO_H
+
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
@@ -35,6 +36,7 @@
 #include <TObject.h>
 #include <TGeoMatrix.h>
 #include <TString.h>
+#include <TObjArray.h>
 
 class TGeoPNEntry;
 class TDatime;
index 001b565..c7dfa71 100644 (file)
@@ -48,6 +48,7 @@ $Id: AliITSUInitGeometry.cxx $
 #include "AliITSUGeomTGeo.h"
 #include "AliITSUInitGeometry.h"
 #include <TDatime.h>
+using namespace TMath;
 
 ClassImp(AliITSUInitGeometry)
 
@@ -445,18 +446,18 @@ Bool_t AliITSUInitGeometry::GetShape(const TString &volumePath,
        npar = 11;
        par.Set(npar);
        TGeoTrap *trap = (TGeoTrap*)shape;
-       Double_t tth = TMath::Tan(trap->GetTheta()*TMath::DegToRad());
+       Double_t tth = Tan(trap->GetTheta()*DegToRad());
        par.AddAt(trap->GetDz(),0);
-       par.AddAt(tth*TMath::Cos(trap->GetPhi()*TMath::DegToRad()),1);
-       par.AddAt(tth*TMath::Sin(trap->GetPhi()*TMath::DegToRad()),2);
+       par.AddAt(tth*Cos(trap->GetPhi()*DegToRad()),1);
+       par.AddAt(tth*Sin(trap->GetPhi()*DegToRad()),2);
        par.AddAt(trap->GetH1(),3);
        par.AddAt(trap->GetBl1(),4);
        par.AddAt(trap->GetTl1(),5);
-       par.AddAt(TMath::Tan(trap->GetAlpha1()*TMath::DegToRad()),6);
+       par.AddAt(Tan(trap->GetAlpha1()*DegToRad()),6);
        par.AddAt(trap->GetH2(),7);
        par.AddAt(trap->GetBl2(),8);
        par.AddAt(trap->GetTl2(),9);
-       par.AddAt(TMath::Tan(trap->GetAlpha2()*TMath::DegToRad()),10);
+       par.AddAt(Tan(trap->GetAlpha2()*DegToRad()),10);
        return kTRUE;
     } // end if
     if (classType==TGeoTube::Class()) {
@@ -589,8 +590,8 @@ Bool_t AliITSUInitGeometry::GetShape(const TString &volumePath,
        npar = 5;
        par.Set(npar);
        TGeoHype *hype = (TGeoHype*)shape;
-       par.AddAt(TMath::Sqrt(hype->RadiusHypeSq(0.,kTRUE)),0);
-       par.AddAt(TMath::Sqrt(hype->RadiusHypeSq(0.,kFALSE)),1);
+       par.AddAt(Sqrt(hype->RadiusHypeSq(0.,kTRUE)),0);
+       par.AddAt(Sqrt(hype->RadiusHypeSq(0.,kFALSE)),1);
        par.AddAt(hype->GetDZ(),2);
        par.AddAt(hype->GetStIn(),3);
        par.AddAt(hype->GetStOut(),4);
@@ -601,18 +602,18 @@ Bool_t AliITSUInitGeometry::GetShape(const TString &volumePath,
        npar = 12;
        par.Set(npar);
        TGeoGtra *trap = (TGeoGtra*)shape;
-       Double_t tth = TMath::Tan(trap->GetTheta()*TMath::DegToRad());
+       Double_t tth = Tan(trap->GetTheta()*DegToRad());
        par.AddAt(trap->GetDz(),0);
-       par.AddAt(tth*TMath::Cos(trap->GetPhi()*TMath::DegToRad()),1);
-       par.AddAt(tth*TMath::Sin(trap->GetPhi()*TMath::DegToRad()),2);
+       par.AddAt(tth*Cos(trap->GetPhi()*DegToRad()),1);
+       par.AddAt(tth*Sin(trap->GetPhi()*DegToRad()),2);
        par.AddAt(trap->GetH1(),3);
        par.AddAt(trap->GetBl1(),4);
        par.AddAt(trap->GetTl1(),5);
-       par.AddAt(TMath::Tan(trap->GetAlpha1()*TMath::DegToRad()),6);
+       par.AddAt(Tan(trap->GetAlpha1()*DegToRad()),6);
        par.AddAt(trap->GetH2(),7);
        par.AddAt(trap->GetBl2(),8);
        par.AddAt(trap->GetTl2(),9);
-       par.AddAt(TMath::Tan(trap->GetAlpha2()*TMath::DegToRad()),10);
+       par.AddAt(Tan(trap->GetAlpha2()*DegToRad()),10);
        par.AddAt(trap->GetTwistAngle(),11);
        return kTRUE;
     } // end if
@@ -1012,8 +1013,8 @@ Bool_t AliITSUInitGeometry::WriteVersionString(Char_t *str,Int_t length,
     cvsDateLength = (Int_t)strlen(cvslikedate);
     cvsRevisionLength = (Int_t)strlen(cvsRevision);
     i = (Int_t)maj;
-    n = 50+(Int_t)(TMath::Log10(TMath::Abs((Double_t)i)))+1+
-        (Int_t)(TMath::Log10(TMath::Abs((Double_t)min)))+1
+    n = 50+(Int_t)(Log10(Abs((Double_t)i)))+1+
+        (Int_t)(Log10(Abs((Double_t)min)))+1
         +cvsDateLength-6+cvsRevisionLength-10;
     if(GetDebug()>1) printf("AliITSUInitGeometry::WriteVersionString:"
                         "length=%d major=%d minor=%d cvsDate=%s[%d] "
index a4f6316..0bf764e 100644 (file)
@@ -23,6 +23,7 @@
 #include "AliITS.h"
 #include "AliITSUModule.h"
 #include "AliITSUGeomTGeo.h"
+using namespace TMath;
 
 ClassImp(AliITSUModule)
 
@@ -95,9 +96,9 @@ Double_t AliITSUModule::PathLength(const AliITSUHit *itsHit1,const AliITSUHit *i
   itsHit1->GetPositionG(x1g,y1g,z1g);
   itsHit2->GetPositionG(x2g,y2g,z2g);
   //
-  s = TMath::Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
-                  ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
-                  ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g))  );
+  s = Sqrt( ((Double_t)(x2g-x1g)*(Double_t)(x2g-x1g)) +
+           ((Double_t)(y2g-y1g)*(Double_t)(y2g-y1g)) +
+           ((Double_t)(z2g-z1g)*(Double_t)(z2g-z1g)) );
    return s;
 }
 
diff --git a/ITS/UPGRADE/AliITSURecoDet.cxx b/ITS/UPGRADE/AliITSURecoDet.cxx
new file mode 100644 (file)
index 0000000..d36da8d
--- /dev/null
@@ -0,0 +1,83 @@
+#include "AliITSURecoDet.h"
+#include "AliITSUGeomTGeo.h"
+#include "AliITSsegmentation.h"
+#include "AliITSUSegmentationPix.h"
+
+ClassImp(AliITSURecoDet)
+
+//______________________________________________________
+AliITSURecoDet::AliITSURecoDet(const char* name)
+:  fNLayers(0)
+  ,fNLayersActive(0)
+  ,fRMax(-1)
+  ,fRMin(-1)
+  ,fLayers(0)
+  ,fLayersActive(0)
+  ,fSegmentations(0)
+  ,fITSGeom(0)
+{
+  // def. c-tor
+  SetNameTitle(name,name);
+  fLayers.SetOwner(kTRUE);        // layers belong to this array
+  fLayersActive.SetOwner(kFALSE); // this one just points on active layers in fLayers
+  fSegmentations.SetOwner(kTRUE); // segmentations are owned by the detector
+}
+
+//______________________________________________________
+AliITSURecoDet::~AliITSURecoDet()
+{
+  // def. d-tor
+  fLayersActive.Clear(); 
+  fLayers.Clear();         // owned!
+  fSegmentations.Clear();  // owned!
+  delete fITSGeom;
+}
+
+//______________________________________________________
+void AliITSURecoDet::Print(Option_t* opt) const                              
+{
+  //print 
+  printf("Detector %s, %d layers, %d active layers\n",GetName(),GetNLayers(),GetNLayersActive());
+  TString opts = opt; opts.ToLower();
+  if (opts.Contains("lr")) for (int i=0;i<GetNLayers();i++) GetLayer(i)->Print(opt);
+}
+
+//______________________________________________________
+void AliITSURecoDet::AddLayer(const AliITSURecoLayer* lr)
+{
+  //add new layer
+  fLayers.AddLast((TObject*)lr);
+  fNLayers++;
+  if (lr->IsActive()) {
+    fLayersActive.AddLast((TObject*)lr);
+    fNLayersActive++;
+  }
+}
+
+//______________________________________________________
+Bool_t AliITSURecoDet::Build()
+{
+  // build detector from TGeo
+  //
+  fITSGeom = new AliITSUGeomTGeo(kTRUE);
+  int nlr = fITSGeom->GetNLayers();
+  if (!nlr) AliFatal("No geometry loaded");
+  AliITSUSegmentationPix::LoadSegmentations(&fSegmentations, fITSGeom->GetITSsegmentationFileName());
+  if (!fSegmentations.GetEntriesFast()) AliFatal(Form("Segmentations from %s are not loaded",fITSGeom->GetITSsegmentationFileName()));
+  //
+  // build active ITS layers
+  for (int ilr=0;ilr<nlr;ilr++) {
+    int lrTyp = fITSGeom->GetLayerDetTypeID(ilr);
+    int nLad = fITSGeom->GetNLadders(ilr);
+    int nDet = fITSGeom->GetNDetectors(ilr);
+    // name layer according its active id, detector type and segmentation tyoe
+    AliITSUSegmentationPix* segm = (AliITSUSegmentationPix*)fSegmentations.At(lrTyp);
+    if (!segm) { AliFatal(Form("Did not find segmentation type %d",lrTyp)); continue; }
+    AliITSURecoLayer* lra = new AliITSURecoLayer( Form("Lr%d%s%d",ilr,fITSGeom->GetDetTypeName(lrTyp),
+                                                      lrTyp%AliITSUGeomTGeo::kMaxSegmPerDetType),
+                                                 ilr,nLad*nDet,fITSGeom,segm);
+    lra->Build();
+    AddLayer(lra);
+  }
+  return kTRUE;
+}
diff --git a/ITS/UPGRADE/AliITSURecoDet.h b/ITS/UPGRADE/AliITSURecoDet.h
new file mode 100644 (file)
index 0000000..c93d63f
--- /dev/null
@@ -0,0 +1,85 @@
+#ifndef ALIITSURECODET
+#define ALIITSURECODET
+
+#include <TNamed.h>
+#include <TObjArray.h>
+#include "AliITSURecoLayer.h"
+class AliITSUGeomTGeo;
+class AliITSsegmentation;
+
+///////////////////////////////////////////////////////////////////////
+//                                                                   //
+//  Class AliITSURecoDet                                             //
+//  Interface between the framework and reconstruction for ITS       //
+//                                                                   //
+///////////////////////////////////////////////////////////////////////
+
+
+class AliITSURecoDet : public TNamed
+{
+ public:
+  //
+  AliITSURecoDet(const char* name="");
+  virtual ~AliITSURecoDet();
+  //
+  Double_t           GetRMin()                     const {return fRMin;}
+  Double_t           GetRMax()                     const {return fRMax;}
+  Int_t              GetNLayers()                  const {return fNLayers;}
+  Int_t              GetNLayersActive()            const {return fNLayersActive;}
+  Int_t              GetLrIDActive(Int_t lrActID)  const;
+  AliITSURecoLayer*  GetLayer(Int_t i)             const;
+  AliITSURecoLayer*  GetLayerActive(Int_t i)       const;
+  AliITSUGeomTGeo*   GetGeom()                     const {return fITSGeom;}
+  TObjArray*         GetSegmentations()            const {return (TObjArray*)&fSegmentations;}
+  //
+  void               SetRMin(Double_t r)                 {fRMin = r;}
+  void               SetRMax(Double_t r)                 {fRMax = r;}
+  //
+  void               AddLayer(const AliITSURecoLayer* lr);
+  Bool_t             Build();
+  //
+  virtual void       Print(Option_t* option = "")  const;
+  //
+ protected:
+  Int_t              fNLayers;        // total number of layers
+  Int_t              fNLayersActive;  // N of active layers
+  Double_t           fRMax;           // max  R
+  Double_t           fRMin;           // min  R
+  TObjArray          fLayers;         // layers
+  TObjArray          fLayersActive;   // active layers
+  //
+  TObjArray          fSegmentations;
+  AliITSUGeomTGeo*   fITSGeom;        // ITS geometry
+  //
+ private:
+  AliITSURecoDet(const AliITSURecoDet &source); 
+  AliITSURecoDet& operator=(const AliITSURecoDet &source); 
+  //
+  ClassDef(AliITSURecoDet,1); // helper for ITS data in reco
+};
+
+
+
+//_____________________________________________________________
+inline Int_t AliITSURecoDet::GetLrIDActive(Int_t lrActID) const 
+{
+  // get global layer id from active id
+  return (lrActID<fNLayersActive) ? ((AliITSURecoLayer*)fLayersActive.UncheckedAt(lrActID))->GetID() : fNLayers;
+}
+
+//_____________________________________________________________
+inline AliITSURecoLayer* AliITSURecoDet::GetLayer(Int_t i) const 
+{
+  // get layer with global id=i
+  return i<fNLayers ? (AliITSURecoLayer*)fLayers.UncheckedAt(i):0;
+}
+
+//_____________________________________________________________
+inline AliITSURecoLayer* AliITSURecoDet::GetLayerActive(Int_t i) const
+{
+  // get layer with activeID=i
+  return i<fNLayersActive ? (AliITSURecoLayer*)fLayersActive.UncheckedAt(i):0;
+}
+
+
+#endif
diff --git a/ITS/UPGRADE/AliITSURecoLayer.cxx b/ITS/UPGRADE/AliITSURecoLayer.cxx
new file mode 100644 (file)
index 0000000..3f85b94
--- /dev/null
@@ -0,0 +1,267 @@
+#include "AliITSURecoLayer.h"
+#include "AliITSUGeomTGeo.h"
+#include "AliITSsegmentation.h"
+#include "AliITSURecoSens.h"
+#include "AliITSUAux.h"
+
+using namespace AliITSUAux;
+using namespace TMath;
+
+ClassImp(AliITSURecoLayer)
+
+
+//______________________________________________________
+AliITSURecoLayer::AliITSURecoLayer(const char* name)
+  :fActiveID(-1)
+  ,fNSensors(0)
+  ,fNSensInLadder(0)
+  ,fNLadders(0)
+  ,fR(0)
+  ,fRMax(0)
+  ,fRMin(0)
+  ,fZMax(0)
+  ,fZMin(0)
+  ,fPhiLadMax(0)
+  ,fPhiLadMin(0)
+  ,fPhiOffs(0)
+  ,fSensDZInv(0)
+  ,fDPhiLadInv(0)
+  ,fSensors(0)
+  ,fITSGeom(0)
+  ,fkSegm(0)
+{
+  // def. c-tor
+  SetNameTitle(name,name);
+  fSensors.SetOwner(kTRUE);
+}
+
+//______________________________________________________
+AliITSURecoLayer::AliITSURecoLayer(const char* name,Int_t activeID,Int_t nsens, AliITSUGeomTGeo* gm,const AliITSsegmentation* segm)
+  :fActiveID(activeID)
+  ,fNSensors(0)
+  ,fNSensInLadder(0)
+  ,fNLadders(0)
+  ,fR(0)
+  ,fRMax(0)
+  ,fRMin(0)
+  ,fZMax(0)
+  ,fZMin(0)
+  ,fPhiLadMax(0)
+  ,fPhiLadMin(0)
+  ,fPhiOffs(0)
+  ,fSensDZInv(0)
+  ,fDPhiLadInv(0)
+  ,fSensors(nsens)
+  ,fITSGeom(gm)
+  ,fkSegm(segm)
+{
+  // def. c-tor
+  SetNameTitle(name,name);
+  fSensors.SetOwner(kTRUE);
+}
+
+//______________________________________________________
+AliITSURecoLayer::~AliITSURecoLayer()
+{
+  // def. d-tor
+}
+
+//______________________________________________________
+void AliITSURecoLayer::Print(Option_t* opt) const                            
+{
+  //print 
+  printf("Layer %s %d (active:%+d), NSensors: %d\n",GetName(),GetID(),GetActiveID(),GetNSensors());
+  TString opts = opt; opts.ToLower();
+  if (opts.Contains("sn")) for (int i=0;i<GetNSensors();i++) GetSensor(i)->Print(opt);
+}
+
+//______________________________________________________
+Bool_t AliITSURecoLayer::Build()
+{
+  // build internal structures
+  fNLadders = fITSGeom->GetNLadders(fActiveID);
+  fNSensInLadder = fITSGeom->GetNDetectors(fActiveID);
+  //
+  // name layer according its active id, detector type and segmentation tyoe
+  TGeoHMatrix mmod;
+  const TGeoHMatrix* mt2l;
+  fRMin=fZMin=1e9;
+  fRMax=fZMax=-1e9;
+  double phiTF,rTF, loc[3]={0,0,0},glo[3];
+  fNSensors = 0;
+  fPhiLadMin = new Double_t[fNLadders];
+  fPhiLadMax = new Double_t[fNLadders];
+  fSensDZInv = 0;
+  //
+  for (int ild=0;ild<fNLadders;ild++) {
+    fPhiLadMin[ild] = 1e9;
+    fPhiLadMax[ild] = -1e9;
+    //
+    for (int idt=0;idt<fNSensInLadder;idt++) {
+      AliITSURecoSens* sens = new AliITSURecoSens(fNSensors++);
+      fSensors.AddLast(sens);
+      //
+      double phiMin=1e9,phiMax=-1e9,zMin=1e9,zMax=-1e9;
+      mmod = *fITSGeom->GetMatrix(fActiveID,ild,idt);
+      for (int ix=0;ix<2;ix++) {
+       loc[0] = (ix-0.5)*fkSegm->Dx(); // +-DX/2
+       for (int iy=0;iy<2;iy++) {
+         loc[1] = (iy-0.5)*fkSegm->Dy(); // +-DY/2
+         for (int iz=0;iz<2;iz++) {
+           loc[2] = (iz-0.5)*fkSegm->Dz(); // +-DZ/2
+           //
+           mmod.LocalToMaster(loc,glo);
+           double phi = ATan2(glo[1],glo[0]);
+           double r   = glo[0]*glo[0] + glo[1]*glo[1];
+           if (fRMin>r) fRMin = r;
+           if (fRMax<r) fRMax = r;
+           BringTo02Pi(phi);
+           if      (phiMin>1e8) phiMin=phi; 
+           else if (!OKforPhiMin(phiMin,phi)) phiMin=phi;
+           if      (phiMax<-1e8) phiMax=phi;
+           else if (!OKforPhiMax(phiMax,phi)) phiMax=phi;            
+           if (glo[2]>zMax) zMax=glo[2]; else if (glo[2]<zMin) zMin=glo[2];
+         }
+       }
+      }
+      printf("%d %d (%d)  %f %f\n",ild,idt, ild*fNSensInLadder+idt,phiMin,phiMax);
+
+      sens->SetBoundaries(phiMin,phiMax,zMin,zMax);
+      mt2l = fITSGeom->GetMatrixT2L(fActiveID,ild,idt);
+      mmod.Multiply(mt2l);     
+      loc[0]=loc[1]=loc[2]=0;
+      mmod.LocalToMaster(loc,glo);
+      rTF   = Sqrt(glo[0]*glo[0] + glo[1]*glo[1]);  //  tracking params (misaligned)
+      phiTF = ATan2(glo[1],glo[0]);
+      BringTo02Pi(phiTF);
+      //
+      sens->SetXTF(rTF);
+      sens->SetPhiTF(phiTF);
+      //
+      if      (fPhiLadMin[ild]>1e8)  fPhiLadMin[ild] = phiMin;
+      else if (!OKforPhiMin(fPhiLadMin[ild],phiMin)) fPhiLadMin[ild] = phiMin;
+      if      (fPhiLadMax[ild]<-1e8) fPhiLadMax[ild] = phiMax;
+      else if (!OKforPhiMax(fPhiLadMax[ild],phiMax)) fPhiLadMax[ild] = phiMax;
+      if (fZMin>zMin) fZMin = zMin;
+      if (fZMax<zMax) fZMax = zMax;
+      //
+      if (idt>0) fSensDZInv += zMax - GetSensor(fNSensors-2)->GetZMax(); // z interval to previoud
+    }
+  }
+  //
+  fRMin = Sqrt(fRMin);
+  fRMax = Sqrt(fRMax);
+  fR = 0.5*(fRMin+fRMax);
+  double dz = fNSensInLadder>0 ? fSensDZInv/(fNSensInLadder-1)/fNLadders : fZMax-fZMin;
+  fSensDZInv = 1./dz;
+
+  const int kNBId[3][3] = { 
+    {AliITSURecoSens::kNghbBL,AliITSURecoSens::kNghbB,AliITSURecoSens::kNghbBR},
+    {AliITSURecoSens::kNghbL,          -1            ,AliITSURecoSens::kNghbR },
+    {AliITSURecoSens::kNghbTL,AliITSURecoSens::kNghbT,AliITSURecoSens::kNghbTR}
+  };
+
+  // add neighbours info
+  double zTol = 0.45*dz, phiTol = 0.45*TwoPi()/fNLadders;
+  for (int ild=0;ild<fNLadders;ild++) {
+    for (int idt=0;idt<fNSensInLadder;idt++) {
+      AliITSURecoSens* sens = GetSensor(ild,idt);
+      //
+      for (int ils=-1;ils<=1;ils++) {
+       int ildN = ild+ils;  // ladders of neighbouring sensors
+       if (ildN<0) ildN = fNLadders-1; else if (ildN==fNLadders) ildN = 0;
+       for (int ids=-1;ids<=1;ids++) {
+         int idtN = idt+ids;
+         if (idtN<0 || idtN==fNSensInLadder || (ids==0&&ils==0)) continue;
+         AliITSURecoSens* sensN = GetSensor(ildN,idtN); // potential neighbor
+         int neighbID = ildN*fNSensInLadder+idtN;
+         //      
+         int zType = 1;  // side
+         if (sens->GetZMin()-zTol>sensN->GetZMax()) continue; // too large distance
+         if (sensN->GetZMin()-zTol>sens->GetZMax()) continue; // too large distance
+         if      (sens->GetZMin()-zTol>sensN->GetZMin()) zType =  0;     // bottom
+         else if (sensN->GetZMin()-zTol>sens->GetZMin()) zType =  2;     // top
+         //
+         int phiType = 1;
+         double phiTstMn = sensN->GetPhiMin()-phiTol;
+         BringTo02Pi(phiTstMn);
+         if (!OKforPhiMax(sens->GetPhiMax(),phiTstMn)) continue; // too large angle      
+         double phiTstMx = sensN->GetPhiMax()+phiTol;    
+         BringTo02Pi(phiTstMx);
+         if (!OKforPhiMin(sens->GetPhiMin(),phiTstMx)) continue; // too large angle
+         //
+         phiTstMn = sensN->GetPhiMin()+phiTol;
+         BringTo02Pi(phiTstMn);
+         phiTstMx = sensN->GetPhiMax()-phiTol;   
+         BringTo02Pi(phiTstMx);
+         if      (!OKforPhiMax(sens->GetPhiMax(),phiTstMx)) phiType = 0; // left
+         else if (!OKforPhiMin(sens->GetPhiMin(),phiTstMn)) phiType = 2; // right
+         //
+         sens->SetNeighborID(kNBId[zType][phiType], neighbID);
+       } // phi scan
+      } // z scan
+    } // sensors
+  } // ladders
+  //
+  //
+  return kTRUE;
+}
+
+//______________________________________________________
+void AliITSURecoLayer::AddSensor(const AliITSURecoSens* mod)
+{
+  //add new module
+  fSensors.AddLast((TObject*)mod);
+  fNSensors++;
+}
+
+//______________________________________________________
+Int_t AliITSURecoLayer::FindSensors(const double* impPar, AliITSURecoSens **sensors)
+{
+  // find sensors having intersection with track
+  // impPar contains: lab phi of track, dphi, labZ, dz
+  double z = impPar[2];
+  if (z>fZMax+impPar[3]) return -1; // outside of Z coverage
+  z -= fZMin;
+  if (z<-impPar[3]) return -1; // outside of Z coverage
+  int sensInLad = int(z*fSensDZInv);
+  //
+  double phi = impPar[0] - fPhiOffs;
+  BringTo02Pi(phi);
+  int ladID = int(phi*fDPhiLadInv);  // ladder id
+  int nsens = 0;
+  //
+  AliITSURecoSens* sensN,*sens = GetSensor(ladID*fNSensInLadder+sensInLad);
+  sensors[nsens++] = sens;
+  // check neighbours
+  double zMn=impPar[2]-impPar[3], zMx=impPar[2]+impPar[3], phiMn=impPar[0]-impPar[1], phiMx=impPar[0]+impPar[1];
+  BringTo02Pi(phiMn);
+  BringTo02Pi(phiMx);
+  //
+  sensN = GetSensor(sens->GetNeighborID(AliITSURecoSens::kNghbR)); // neighbor on the right
+  if (sensN && OKforPhiMax(phiMx,sensN->GetPhiMin())) sensors[nsens++] = sensN;
+  //
+  sensN = GetSensor(sens->GetNeighborID(AliITSURecoSens::kNghbTR)); // neighbor on the top right
+  if (sensN && OKforPhiMax(phiMx,sensN->GetPhiMin()) && sensN->GetZMin()<zMx) sensors[nsens++] = sensN;
+  //
+  sensN = GetSensor(sens->GetNeighborID(AliITSURecoSens::kNghbT)); // neighbor on the top
+  if (sensN && sensN->GetZMin()>zMx) sensors[nsens++] = sensN;
+  //
+  sensN = GetSensor(sens->GetNeighborID(AliITSURecoSens::kNghbTL)); // neighbor on the top left
+  if (sensN && OKforPhiMin(phiMn,sensN->GetPhiMax()) && sensN->GetZMin()<zMx) sensors[nsens++] = sensN;
+  //
+  sensN = GetSensor(sens->GetNeighborID(AliITSURecoSens::kNghbL)); // neighbor on the left
+  if (sensN && OKforPhiMin(phiMn,sensN->GetPhiMax())) sensors[nsens++] = sensN;
+  //
+  sensN = GetSensor(sens->GetNeighborID(AliITSURecoSens::kNghbBL)); // neighbor on the bottom left
+  if (sensN && OKforPhiMin(phiMn,sensN->GetPhiMax()) && sensN->GetZMax()>zMn) sensors[nsens++] = sensN;
+  //
+  sensN = GetSensor(sens->GetNeighborID(AliITSURecoSens::kNghbB));  // neighbor on the bottom
+  if (sensN && sensN->GetZMax()>zMn) sensors[nsens++] = sensN;
+  //
+  sensN = GetSensor(sens->GetNeighborID(AliITSURecoSens::kNghbBR)); // neighbor on the bottom right
+  if (sensN && OKforPhiMax(phiMx,sensN->GetPhiMin()) && sensN->GetZMax()>zMn) sensors[nsens++] = sensN;
+  //
+  return nsens;
+}
+
diff --git a/ITS/UPGRADE/AliITSURecoLayer.h b/ITS/UPGRADE/AliITSURecoLayer.h
new file mode 100644 (file)
index 0000000..435276e
--- /dev/null
@@ -0,0 +1,81 @@
+#ifndef ALIITSURECOLAYER
+#define ALIITSURECOLAYER
+
+#include <TNamed.h>
+#include <TObjArray.h>
+class AliITSUGeomTGeo;
+class AliITSsegmentation;
+class AliITSURecoSens;
+
+///////////////////////////////////////////////////////////////////////
+//                                                                   //
+//  Class AliITSURecoLayer                                           //
+//  Interface between the framework and reconstruction for ITS layer //
+//                                                                   //
+///////////////////////////////////////////////////////////////////////
+
+
+class AliITSURecoLayer : public TNamed
+{
+ public:
+  //
+  enum {kPassive=BIT(14)};
+  AliITSURecoLayer(const char* name);
+  AliITSURecoLayer(const char* name, Int_t activeID,Int_t nsens,AliITSUGeomTGeo* gm,const AliITSsegmentation* segm);
+  virtual ~AliITSURecoLayer();
+  //
+  Bool_t             Build();
+  //
+  Int_t              GetID()                       const {return (int)GetUniqueID();}
+  Int_t              GetActiveID()                 const {return fActiveID;}
+  Int_t              GetNSensors()                 const {return fNSensors;}
+  Double_t           GetRMin()                     const {return fRMin;}
+  Double_t           GetRMax()                     const {return fRMax;}
+  Double_t           GetR()                        const {return fR;}
+  Bool_t             IsActive()                    const {return !TestBit(kPassive);}
+  Bool_t             IsPassive()                   const {return TestBit(kPassive);}
+  //
+  void               SetID(Int_t i)                      {SetUniqueID(i);} 
+  void               SetActiveID(Int_t i)                {fActiveID = i;} 
+  void               SetRMin(Double_t r)                 {fRMin = r;}
+  void               SetRMax(Double_t r)                 {fRMax = r;}
+  void               SetR(Double_t r)                    {fR = r;}
+  void               SetPassive(Bool_t v=kTRUE)          {SetBit(kPassive,v);}
+
+  //
+  AliITSURecoSens*   GetSensor(Int_t i)            const {return (AliITSURecoSens*)fSensors.UncheckedAt(i);}
+  AliITSURecoSens*   GetSensor(Int_t ld,Int_t is)  const {return GetSensor(ld*fNSensInLadder+is);}
+  void               AddSensor(const AliITSURecoSens* mod); 
+  //
+  Int_t              FindSensors(const double* impPar, AliITSURecoSens **sensors);
+  //
+  virtual void       Print(Option_t* option = "")  const;
+
+ protected:
+  Int_t              fActiveID;  // ID within active layers
+  Int_t              fNSensors;  // N of modules
+  Int_t              fNSensInLadder; // N sensors in the ladder
+  Int_t              fNLadders;  // N ladder
+  Double_t           fR;         // mean R
+  Double_t           fRMax;      // max  R
+  Double_t           fRMin;      // min  R
+  Double_t           fZMax;      // max  Z
+  Double_t           fZMin;      // min  Z
+  Double_t*          fPhiLadMax; // max lab phi of the ladder
+  Double_t*          fPhiLadMin; // min lab phi of the ladder
+  Double_t           fPhiOffs;   // offset in phi for 1st ladder
+  Double_t           fSensDZInv; // inverse mean sensor Z span
+  Double_t           fDPhiLadInv;// inverse mean ladder dphi
+  TObjArray          fSensors;   // sensors
+  AliITSUGeomTGeo*   fITSGeom;   // geometry interface
+  const AliITSsegmentation* fkSegm;     // layer segmentation
+  //
+ private:
+  AliITSURecoLayer(const AliITSURecoLayer &source); 
+  AliITSURecoLayer& operator=(const AliITSURecoLayer &source); 
+  //
+
+  ClassDef(AliITSURecoLayer,1); // helper for layer data used in reco
+};
+
+#endif
diff --git a/ITS/UPGRADE/AliITSURecoSens.cxx b/ITS/UPGRADE/AliITSURecoSens.cxx
new file mode 100644 (file)
index 0000000..8c18335
--- /dev/null
@@ -0,0 +1,70 @@
+#include "AliITSURecoSens.h"
+#include "AliITSUGeomTGeo.h"
+#include "AliITSsegmentation.h"
+
+ClassImp(AliITSURecoSens)
+
+//______________________________________________________
+AliITSURecoSens::AliITSURecoSens(Int_t id)
+:  fXTF(0)
+  ,fPhiTF(0)
+  ,fPhiMin(0)
+  ,fPhiMax(0)
+  ,fZMin(0)
+  ,fZMax(0)
+{
+  // def. c-tor
+  SetID(id);
+  for (int i=kNNeighbors;i--;) fNeighbors[i] = -1;
+}
+
+//______________________________________________________
+AliITSURecoSens::AliITSURecoSens(const AliITSURecoSens &source)
+  :TObject(source)
+  ,fXTF(source.fXTF)
+  ,fPhiTF(source.fPhiTF)
+  ,fPhiMin(source.fPhiMin)
+  ,fPhiMax(source.fPhiMax)
+  ,fZMin(source.fZMin)
+  ,fZMax(source.fZMax)
+{
+  // copy c-tor
+  for (int i=kNNeighbors;i--;) fNeighbors[i] = source.fNeighbors[i];
+}
+
+//______________________________________________________
+AliITSURecoSens& AliITSURecoSens::operator=(const AliITSURecoSens &source)
+{
+  // = operator
+  if (&source==this) return *this;
+  TObject::operator=(source);
+  fXTF = source.fXTF;
+  fPhiTF = source.fPhiTF;
+  fPhiMin = source.fPhiMin;
+  fPhiMax = source.fPhiMax;
+  fZMin   = source.fZMin;
+  fZMax   = source.fZMax;
+  //
+  for (int i=kNNeighbors;i--;) fNeighbors[i] = source.fNeighbors[i];
+  return *this;
+}
+
+//______________________________________________________
+void AliITSURecoSens::SetBoundaries(double phiMn,double phiMx, double zMn, double zMx)
+{
+  // set phi,z limits 
+  fPhiMin = phiMn;
+  fPhiMax = phiMx;
+  fZMin = zMn;
+  fZMax = zMx;
+}
+
+//______________________________________________________
+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.:",
+        GetID(),GetXTF(),GetPhiTF(), fPhiMin,fPhiMax, fZMin,fZMax);
+  for (int i=0;i<kNNeighbors;i++) printf(" %4d",fNeighbors[i]); printf("\n");
+}
+
diff --git a/ITS/UPGRADE/AliITSURecoSens.h b/ITS/UPGRADE/AliITSURecoSens.h
new file mode 100644 (file)
index 0000000..50cbcfa
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef ALIITSURECOSENS
+#define ALIITSURECOSENS
+
+#include <TObject.h>
+
+///////////////////////////////////////////////////////////////////////
+//                                                                   //
+//  Class AliITSURecoSens                                            //
+//  Interface between the framework and reconstruction for           //
+//  single ITS sensor                                                //
+//                                                                   //
+///////////////////////////////////////////////////////////////////////
+
+class AliITSURecoSens : public TObject
+{
+ public:
+  enum {kNghbR,kNghbTR,kNghbT,kNghbTL,kNghbL,kNghbBL,kNghbB,kNghbBR,kNNeighbors}; // neighbors: Top,Left etc
+  //
+  AliITSURecoSens(Int_t id);
+  AliITSURecoSens(const AliITSURecoSens &source); 
+  virtual ~AliITSURecoSens() {}
+  AliITSURecoSens& operator=(const AliITSURecoSens &source); 
+  //
+  Int_t              GetID()                       const {return (int)GetUniqueID();}
+  Double_t           GetXTF()                      const {return fXTF;}
+  Double_t           GetPhiTF()                    const {return fPhiTF;}
+  Double_t           GetPhiMin()                   const {return fPhiMin;}
+  Double_t           GetPhiMax()                   const {return fPhiMax;}
+  Double_t           GetZMin()                     const {return fZMin;}
+  Double_t           GetZMax()                     const {return fZMax;}
+  //
+  Int_t              GetNeighborID(int i)          const {return fNeighbors[i];}
+  //
+  void               SetID(Int_t i)                      {SetUniqueID(i);}
+  void               SetXTF(double v)                    {fXTF = v;}
+  void               SetPhiTF(double v)                  {fPhiTF = v;}
+  void               SetNeighborID(int i, int id)        {fNeighbors[i] = id;}
+  void               SetBoundaries(double phiMn,double phiMx, double zMn, double zMx);
+  //
+  virtual void       Print(Option_t* option = "")  const;
+
+ protected:
+  Int_t              fNeighbors[kNNeighbors];      // id of neighbors  
+  Double_t           fXTF;                         // X in tracking frame
+  Double_t           fPhiTF;                       // phi of tracking frame
+  Double_t           fPhiMin;                      // lab phi min
+  Double_t           fPhiMax;                      // lab phi max
+  Double_t           fZMin;                        // lab Z min
+  Double_t           fZMax;                        // lab Z max
+  //
+  ClassDef(AliITSURecoSens,1); // helper for sensor data used in reco
+};
+
+
+#endif
index 1af348e..b7054b2 100644 (file)
@@ -19,6 +19,7 @@ ClassImp(AliITSUSDigit)
 
 using std::istream;
 using std::swap;
+using namespace TMath;
 
 // Addapted from ITS/AliITSpListItem, ruben.shahoyan@cern.ch
 
@@ -119,11 +120,11 @@ void AliITSUSDigit::AddSignal(Int_t track,Int_t hit,Double_t signal)
   Int_t    i,j;
   Bool_t   flg=kFALSE;
   //
-  if (TMath::Abs(signal)>2147483647.0) {
+  if (Abs(signal)>2147483647.0) {
     //PH 2147483647 is the max. integer
     //PH This apparently is a problem which needs investigation
     AliWarning(Form("Too big or too small signal value %f",signal));
-    signal = TMath::Sign((Double_t)2147483647,signal);
+    signal = Sign((Double_t)2147483647,signal);
   }
   //
   fTsignal += signal; // Keep track of sum signal.
index 7f1c01d..10bf714 100644 (file)
@@ -23,6 +23,7 @@
 #include <TFile.h>
 #include "AliITSUGeomTGeo.h"
 #include "AliITSUSegmentationPix.h"
+using namespace TMath;
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // Segmentation class for pixels                                                                          //
@@ -354,8 +355,8 @@ Int_t AliITSUSegmentationPix::GetChipsInLocalWindow(Int_t* array, Float_t zmin,
   Int_t n2 = GetChipFromLocal(0,zmax);
 
   if(n2!=n1){
-    Int_t imin=TMath::Min(n1,n2);
-    Int_t imax=TMath::Max(n1,n2);
+    Int_t imin=Min(n1,n2);
+    Int_t imax=Max(n1,n2);
     for(Int_t ichip=imin; ichip<=imax; ichip++){
       if(ichip==n1) continue;
       array[nChipInW]=ichip;
index 7d88768..a9c9676 100644 (file)
@@ -24,6 +24,7 @@
 ///////////////////////////////////////////////////////////////////
 #include "AliITSUSimuParam.h"
 #include "AliLog.h"
+using namespace TMath;
 
 
 const Double_t  AliITSUSimuParam::fgkPixBiasVoltageDefault = 18.182;
@@ -384,11 +385,11 @@ Double_t AliITSUSimuParam::LorentzAngleHole(Double_t B) const
   const Double_t keT2 = 0.52;       // Power of Temp. for vsat
   Double_t tT = fT;
   Double_t eE= 1./fDOverV;
-  Double_t muLow=kmulow0*TMath::Power(tT/kT0,keT0);
-  Double_t beta=beta0*TMath::Power(tT/kT0,keT1);
-  Double_t vsat=kvsat0*TMath::Power(tT/kT0,keT2);
-  Double_t mu=muLow/TMath::Power(1+TMath::Power(muLow*eE/vsat,beta),1/beta);
-  Double_t angle=TMath::ATan(krH*mu*B*1.E-05); // Conversion Factor
+  Double_t muLow=kmulow0*Power(tT/kT0,keT0);
+  Double_t beta=beta0*Power(tT/kT0,keT1);
+  Double_t vsat=kvsat0*Power(tT/kT0,keT2);
+  Double_t mu=muLow/Power(1+Power(muLow*eE/vsat,beta),1/beta);
+  Double_t angle=ATan(krH*mu*B*1.E-05); // Conversion Factor
   return angle;
 }
 
@@ -411,11 +412,11 @@ Double_t AliITSUSimuParam::LorentzAngleElectron(Double_t B) const
   const Double_t keT2 = 0.87;       // Power of Temp. for vsat
   Double_t tT = fT;
   Double_t eE= 1./fDOverV;
-  Double_t muLow=kmulow0*TMath::Power(tT/kT0,keT0);
-  Double_t beta=beta0*TMath::Power(tT/kT0,keT1);
-  Double_t vsat=kvsat0*TMath::Power(tT/kT0,keT2);
-  Double_t mu=muLow/TMath::Power(1+TMath::Power(muLow*eE/vsat,beta),1/beta);
-  Double_t angle=TMath::ATan(krH*mu*B*1.E-05);
+  Double_t muLow=kmulow0*Power(tT/kT0,keT0);
+  Double_t beta=beta0*Power(tT/kT0,keT1);
+  Double_t vsat=kvsat0*Power(tT/kT0,keT2);
+  Double_t mu=muLow/Power(1+Power(muLow*eE/vsat,beta),1/beta);
+  Double_t angle=ATan(krH*mu*B*1.E-05);
   return angle;
 }
 
@@ -439,7 +440,7 @@ Double_t AliITSUSimuParam::SigmaDiffusion3D(Double_t l) const
   // Return:
   //    The Sigma due to the diffution of electrons. [cm]
   const Double_t kcon = 5.17040258E-04; // == 6k/e [J/col or volts]  
-  return TMath::Sqrt(kcon*fT*fDOverV*l);  // [cm]
+  return Sqrt(kcon*fT*fDOverV*l);  // [cm]
 }
 
 //______________________________________________________________________
@@ -462,7 +463,7 @@ Double_t AliITSUSimuParam::SigmaDiffusion2D(Double_t l) const
   // Return:
   //    The Sigma due to the diffution of electrons. [cm]
   const Double_t kcon = 3.446935053E-04; // == 4k/e [J/col or volts]
-  return TMath::Sqrt(kcon*fT*fDOverV*l);  // [cm]
+  return Sqrt(kcon*fT*fDOverV*l);  // [cm]
 }
 
 //______________________________________________________________________
@@ -485,5 +486,5 @@ Double_t AliITSUSimuParam::SigmaDiffusion1D(Double_t l) const
   // Return:
   //    The Sigma due to the diffution of electrons. [cm]
   const Double_t kcon = 1.723467527E-04; // == 2k/e [J/col or volts]
-  return TMath::Sqrt(kcon*fT*fDOverV*l);  // [cm]
+  return Sqrt(kcon*fT*fDOverV*l);  // [cm]
 }
index 71bd11d..5a6a271 100644 (file)
@@ -22,6 +22,7 @@
 #include "TSeqCollection.h"
 #include "AliITSUSimulation.h"
 #include "AliITSUSDigit.h"
+using namespace TMath;
 
 ClassImp(AliITSUSimulation)
 
@@ -161,6 +162,6 @@ Int_t AliITSUSimulation::GenOrderedSample(UInt_t nmax,UInt_t ngen,TArrayI &vals,
       for (int j=i;j--;) if (valA[j]==valA[i]) {rep=kTRUE;break;}
     } while(rep);
   }
-  TMath::Sort((int)ngen,valA,indA,kFALSE);
+  Sort((int)ngen,valA,indA,kFALSE);
   return ngen;
 }
index 0087e38..8a71022 100644 (file)
@@ -39,6 +39,7 @@
 
 using std::cout;
 using std::endl;
+using namespace TMath;
 
 ClassImp(AliITSUSimulationPix)
 ////////////////////////////////////////////////////////////////////////
@@ -140,7 +141,7 @@ Bool_t AliITSUSimulationPix::SetTanLorAngle(Double_t weightHole)
   AliMagF* fld = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
   if (!fld) AliFatal("The field is not initialized");
   Double_t bz = fld->SolenoidField();
-  fTanLorAng = TMath::Tan(weightHole*fSimuParam->LorentzAngleHole(bz) +
+  fTanLorAng = Tan(weightHole*fSimuParam->LorentzAngleHole(bz) +
                          weightEle*fSimuParam->LorentzAngleElectron(bz));
   return kTRUE;
 }
@@ -229,7 +230,7 @@ void AliITSUSimulationPix::Hits2SDigits(AliITSUModule *mod)
        ) continue;
     //
     if (!mod->LineSegmentL(h,x0,x1,y0,y1,z0,z1,de,idtrack)) continue;
-    st = TMath::Sqrt(x1*x1+y1*y1+z1*z1);
+    st = Sqrt(x1*x1+y1*y1+z1*z1);
     if (st>0.0) {
       st = (Double_t)((Int_t)(st*1e4)); // number of microns
       if (st<=1.0) st = 1.0;
@@ -242,7 +243,7 @@ void AliITSUSimulationPix::Hits2SDigits(AliITSUModule *mod)
        if (!(fSeg->LocalToDet(x,z,ix,iz))) continue; // outside
        el  = dt * de / fSimuParam->GetGeVToCharge();
        //
-       sig = fSimuParam->SigmaDiffusion1D(TMath::Abs(thick + y)); 
+       sig = fSimuParam->SigmaDiffusion1D(Abs(thick + y)); 
        sigx=sig;
        sigz=sig*fda;
        if (fSimuParam->GetPixLorentzDrift()) ld=(y+thick)*fTanLorAng;
@@ -254,7 +255,7 @@ void AliITSUSimulationPix::Hits2SDigits(AliITSUModule *mod)
       z   = z0;
       if (!(fSeg->LocalToDet(x,z,ix,iz))) continue; // outside
       el  = de / fSimuParam->GetGeVToCharge();
-      sig = fSimuParam->SigmaDiffusion1D(TMath::Abs(thick + y));
+      sig = fSimuParam->SigmaDiffusion1D(Abs(thick + y));
       sigx = sig;
       sigz = sig*fda;
       if (fSimuParam->GetPixLorentzDrift()) ld=(y+thick)*fTanLorAng;
@@ -326,7 +327,7 @@ void AliITSUSimulationPix::Hits2SDigitsFast(AliITSUModule *mod)
        ) continue;
     //
     if (!mod->LineSegmentL(h,x0,x1,y0,y1,z0,z1,de,idtrack)) continue;
-    st = TMath::Sqrt(x1*x1+y1*y1+z1*z1);
+    st = Sqrt(x1*x1+y1*y1+z1*z1);
     if (st>0.0) 
       for (i=0;i<kn10;i++) { // Integrate over t
        t   = kti[i];
@@ -335,7 +336,7 @@ void AliITSUSimulationPix::Hits2SDigitsFast(AliITSUModule *mod)
        z   = z0+z1*t;
        if (!(fSeg->LocalToDet(x,z,ix,iz))) continue; // outside
        el  = kwi[i]*de/fSimuParam->GetGeVToCharge();
-       sig = fSimuParam->SigmaDiffusion1D(TMath::Abs(thick + y));
+       sig = fSimuParam->SigmaDiffusion1D(Abs(thick + y));
        sigx=sig;
        sigz=sig*fda;
        if (fSimuParam->GetPixLorentzDrift()) ld=(y+thick)*fTanLorAng;
@@ -347,7 +348,7 @@ void AliITSUSimulationPix::Hits2SDigitsFast(AliITSUModule *mod)
       z   = z0;
       if (!(fSeg->LocalToDet(x,z,ix,iz))) continue; // outside
       el  = de / fSimuParam->GetGeVToCharge();
-      sig = fSimuParam->SigmaDiffusion1D(TMath::Abs(thick + y));
+      sig = fSimuParam->SigmaDiffusion1D(Abs(thick + y));
       sigx=sig;
       sigz=sig*fda;
       if (fSimuParam->GetPixLorentzDrift()) ld=(y+thick)*fTanLorAng;
@@ -417,10 +418,10 @@ void AliITSUSimulationPix::SpreadCharge(Double_t x0,Double_t z0,
      return;
    } // end if
    sp = 1.0/(sig*kRoot2);
-   ixs = TMath::Max(-knx+ix0,0);
-   ixe = TMath::Min(knx+ix0,fSeg->Npx()-1);
-   izs = TMath::Max(-knz+iz0,0);
-   ize = TMath::Min(knz+iz0,fSeg->Npz()-1);
+   ixs = Max(-knx+ix0,0);
+   ixe = Min(knx+ix0,fSeg->Npx()-1);
+   izs = Max(-knz+iz0,0);
+   ize = Min(knz+iz0,fSeg->Npz()-1);
    for (ix=ixs;ix<=ixe;ix++) 
      for (iz=izs;iz<=ize;iz++) {
        fSeg->DetToLocal(ix,iz,x,z); // pixel center
@@ -485,10 +486,10 @@ void AliITSUSimulationPix::SpreadChargeAsym(Double_t x0,Double_t z0,
   } // end if
   spx = 1.0/(sigx*kRoot2);     
   spz = 1.0/(sigz*kRoot2);
-  ixs = TMath::Max(-knx+ix0,0);
-  ixe = TMath::Min(knx+ix0,fSeg->Npx()-1);
-  izs = TMath::Max(-knz+iz0,0);
-  ize = TMath::Min(knz+iz0,fSeg->Npz()-1);
+  ixs = Max(-knx+ix0,0);
+  ixe = Min(knx+ix0,fSeg->Npx()-1);
+  izs = Max(-knz+iz0,0);
+  ize = Min(knz+iz0,fSeg->Npz()-1);
   for (ix=ixs;ix<=ixe;ix++) 
     for (iz=izs;iz<=ize;iz++) {
       fSeg->DetToLocal(ix,iz,x,z); // pixel center
@@ -596,7 +597,7 @@ void AliITSUSimulationPix::FrompListToDigits()
     }
     //
     if ((sig=sd->GetSumSignal())<=fSimuParam->GetPixThreshold(fModule)) continue;
-    if (TMath::Abs(sig)>2147483647.0) { //RS?
+    if (Abs(sig)>2147483647.0) { //RS?
       //PH 2147483647 is the max. integer
       //PH This apparently is a problem which needs investigation
       AliWarning(Form("Too big or too small signal value %f",sig));
index e4f001e..3d97fb9 100644 (file)
@@ -52,6 +52,7 @@
 #include "AliITSUv11.h"
 #include "AliITSUGeomTGeo.h"
 #include "AliGeomManager.h"
+using namespace TMath;
 
 
 ClassImp(AliITSUv11)
@@ -173,8 +174,8 @@ void AliITSUv11::SetT2Lmatrix(Int_t uid, Double_t yShift,
   TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
   Double_t *gtrans = globMatrix->GetTranslation(), rotMatrix[9];
   memcpy(&rotMatrix[0], globMatrix->GetRotationMatrix(), 9*sizeof(Double_t));
-  Double_t al = TMath::ATan2(rotMatrix[1], yRot180 ? -rotMatrix[0] : rotMatrix[0]);
-  Double_t xShift = gtrans[0]*TMath::Cos(al)+gtrans[1]*TMath::Sin(al);
+  Double_t al = ATan2(rotMatrix[1], yRot180 ? -rotMatrix[0] : rotMatrix[0]);
+  Double_t xShift = gtrans[0]*Cos(al)+gtrans[1]*Sin(al);
   Double_t zShift = -gtrans[2];
   TGeoHMatrix *matLtoT = new TGeoHMatrix;
   matLtoT->SetDx( xShift ); // translation
index d52122c..7fe1199 100644 (file)
@@ -38,6 +38,7 @@
 #include <TGeoMatrix.h>
 #include "AliITSUv11Layer.h"
 #include "AliITSUGeomTGeo.h"
+using namespace TMath;
 
 const Double_t AliITSUv11Layer::fgkDefaultSensorThick = 300*fgkmicron;
 const Double_t AliITSUv11Layer::fgkDefaultLadderThick =   1*fgkcm;
@@ -238,12 +239,12 @@ void AliITSUv11Layer::CreateLayer(TGeoVolume *moth,const TGeoManager *mgr){
 
 
   // First create the ladder container
-  alpha = (360./(2*fNLadders))*TMath::DegToRad();
+  alpha = (360./(2*fNLadders))*DegToRad();
 
-  //  fLadderWidth = fLayRadius*TMath::Tan(alpha);
+  //  fLadderWidth = fLayRadius*Tan(alpha);
 
   rmin = 0.98*fLayRadius;
-  rmax = 1.02*TMath::Sqrt( fLadderWidth*fLadderWidth +
+  rmax = 1.02*Sqrt( fLadderWidth*fLadderWidth +
                          (rmin+fLadderThick)*(rmin+fLadderThick) );
 
   TGeoTube *layer = new TGeoTube(rmin, rmax, 0.5*fZLength);
@@ -317,7 +318,7 @@ void AliITSUv11Layer::CreateLayerTurbo(TGeoVolume *moth,
   // Check if the user set the proper (remaining) parameters
   if (fLadderWidth <= 0)
     AliFatal(Form("Wrong ladder width (%f)",fLadderWidth));
-  if (TMath::Abs(fLadderTilt) > 45)
+  if (Abs(fLadderTilt) > 45)
     AliWarning(Form("Ladder tilt angle (%f) greater than 45deg",fLadderTilt));
 
 
@@ -325,8 +326,8 @@ void AliITSUv11Layer::CreateLayerTurbo(TGeoVolume *moth,
   // d is half the diagonal of the ladder section
   // rladd is the radius at the ladder's center-of-gravity
   // alpha here is the angle between the diagonal and rladd
-  d = 0.5*TMath::Sqrt(fLadderThick*fLadderThick + fLadderWidth*fLadderWidth);
-  alpha = TMath::ACos(0.5*fLadderThick/d)*TMath::RadToDeg();
+  d = 0.5*Sqrt(fLadderThick*fLadderThick + fLadderWidth*fLadderWidth);
+  alpha = ACos(0.5*fLadderThick/d)*RadToDeg();
   gamma = alpha - fLadderTilt;
   rladd = fLayRadius + 0.5*fLadderThick;
 
@@ -336,9 +337,9 @@ void AliITSUv11Layer::CreateLayerTurbo(TGeoVolume *moth,
   if (rcont > 0)
     rmin = 0.98*rcont;
   else
-    rmin = 0.98*TMath::Sqrt( rladd*rladd + d*d - 2*rladd*d*CosD(gamma) );
+    rmin = 0.98*Sqrt( rladd*rladd + d*d - 2*rladd*d*CosD(gamma) );
   
-  rmax = 1.02*TMath::Sqrt( rladd*rladd + d*d + 2*rladd*d*CosD(gamma) );
+  rmax = 1.02*Sqrt( rladd*rladd + d*d + 2*rladd*d*CosD(gamma) );
   
   TGeoTube *layer = new TGeoTube(rmin, rmax, 0.5*fZLength);
 
@@ -399,10 +400,10 @@ TGeoVolume* AliITSUv11Layer::CreateLadder(const TGeoManager *mgr){
 
 
   // First create all needed shapes
-  alpha = (360./(2*fNLadders))*TMath::DegToRad();
+  alpha = (360./(2*fNLadders))*DegToRad();
 
   // The ladder
-  xlen = fLayRadius*TMath::Tan(alpha);
+  xlen = fLayRadius*Tan(alpha);
   if (fIsTurbo) xlen = 0.5*fLadderWidth;
   ylen = 0.5*fLadderThick;
   zlen = 0.5*fZLength;
index 239f5c1..e6a76e4 100644 (file)
@@ -36,6 +36,7 @@ AliITSUCalibrationPix.cxx
 AliITSUSegmentationPix.cxx
 AliITSUSensMap.cxx
 AliITSUSDigit.cxx
+AliITSUAux.cxx
 )
 
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
index 93b4e6d..d3a7b2e 100644 (file)
@@ -30,6 +30,9 @@ set ( SRCS
     AliITSURecoParam.cxx
     AliITSUReconstructor.cxx
     AliITSUClusterizer.cxx
+    AliITSURecoSens.cxx
+    AliITSURecoLayer.cxx
+    AliITSURecoDet.cxx
 #
 #    v0/AliITSlayerUpgrade.cxx 
 #    v0/AliITStrackerUpgrade.cxx 
index 399b292..b808e1b 100644 (file)
@@ -21,4 +21,5 @@
 #pragma link C++ class  AliITSUSegmentationPix+;
 #pragma link C++ class  AliITSUSensMap+;
 #pragma link C++ class  AliITSUSDigit+;
+#pragma link C++ namespace  AliITSUAux;
 #endif
index 048ebf2..b2350ff 100644 (file)
@@ -16,6 +16,9 @@
 #pragma link C++ class AliITSURecoParam+;
 #pragma link C++ class AliITSUReconstructor+;
 #pragma link C++ class AliITSUClusterizer+;
+#pragma link C++ class AliITSURecoSens+;
+#pragma link C++ class AliITSURecoLayer+;
+#pragma link C++ class AliITSURecoDet+;
 
 //