]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFtracker.cxx
removal of effective c++ warnings (C.Zampolli)+ use of additional calib parameters...
[u/mrichter/AliRoot.git] / TOF / AliTOFtracker.cxx
index 28c9833ba562f6755e13c182e7bcf312b07027dd..54877d211999307913ca8cd563bf3061e83a71d4 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-// AliTOFtracker Class
-// Task: Perform association of the ESD tracks to TOF Clusters
-// and Update ESD track with associated TOF Cluster parameters 
-//
-// -- Authors : S. Arcelli, C. Zampolli (Bologna University and INFN) 
-// -- Contacts: Annalisa.De.Caro@cern.ch
-// --         : Chiara.Zampolli@bo.infn.it
-// --         : Silvia.Arcelli@bo.infn.it
-//--------------------------------------------------------------------
-
-#include <Rtypes.h>
+
+//--------------------------------------------------------------------//
+//                                                                    //
+// AliTOFtracker Class                                                //
+// Task: Perform association of the ESD tracks to TOF Clusters        //
+// and Update ESD track with associated TOF Cluster parameters        //
+//                                                                    //
+// -- Authors : S. Arcelli, C. Zampolli (Bologna University and INFN) //
+// -- Contacts: Annalisa.De.Caro@cern.ch                              //
+// --         : Chiara.Zampolli@bo.infn.it                            //
+// --         : Silvia.Arcelli@bo.infn.it                             //
+//                                                                    //
+//--------------------------------------------------------------------//
+
+#include "Rtypes.h"
 
 #include "TClonesArray.h"
+#include "TGeoManager.h"
+#include "TTree.h"
 
+#include "AliAlignObj.h"
+#include "AliESDtrack.h"
+#include "AliESD.h"
 #include "AliLog.h"
-#include "AliRun.h"
-#include "AliModule.h"
+#include "AliTrackPointArray.h"
 
+#include "AliTOFcalib.h"
 #include "AliTOFcluster.h"
-#include "AliTOFtrack.h"
 #include "AliTOFGeometry.h"
 #include "AliTOFtracker.h"
+#include "AliTOFtrack.h"
 
-
-#include "AliTrackPointArray.h"
-#include "AliAlignObj.h"
+extern TGeoManager *gGeoManager;
 
 ClassImp(AliTOFtracker)
 
 //_____________________________________________________________________________
-AliTOFtracker::AliTOFtracker(AliTOFGeometry * geom, Double_t parPID[2]) { 
+AliTOFtracker::AliTOFtracker(AliTOFGeometry * geom, Double_t parPID[2]):
+  fGeom(geom),
+  fTOFpid(new AliTOFpidESD(parPID)),
+  fHoles(kFALSE),
+  fN(0),
+  fNseeds(0),
+  fNseedsTOF(0),
+  fngoodmatch(0),
+  fnbadmatch(0),
+  fnunmatch(0),
+  fnmatch(0),
+  fR(378.), 
+  fTOFHeigth(15.3),  
+  fdCut(3.), 
+  fDx(1.5), 
+  fDy(0), 
+  fDz(0), 
+  fDzMax(35.), 
+  fDyMax(50.), 
+  fTracks(0x0),
+  fSeeds(0x0)
+ { 
   //AliTOFtracker main Ctor
 
   //fHoles=true;
-  fNseeds=0;
-  fNseedsTOF=0;
-  fngoodmatch=0;
-  fnbadmatch=0;
-  fnunmatch=0;
-  fnmatch=0;
-  fGeom = geom;
-  fTOFpid = new AliTOFpidESD(parPID);
-  fR=378.; 
-  fTOFHeigth=15.3;  
-  fdCut=3.; 
   fDy=AliTOFGeometry::XPad(); 
   fDz=AliTOFGeometry::ZPad(); 
-  fDx=1.5; 
-  fDzMax=35.; 
-  fDyMax=50.; 
-  fSeeds=0x0;
-  fTracks=0x0;
-  fN=0;
   fHoles = fGeom->GetHoles();
 }
 //_____________________________________________________________________________
-AliTOFtracker::AliTOFtracker(const AliTOFtracker &t):AliTracker() { 
+AliTOFtracker::AliTOFtracker(const AliTOFtracker &t):
+  AliTracker(),
+  fGeom(0x0),
+  fTOFpid(0x0),
+  fHoles(kFALSE),
+  fN(0),
+  fNseeds(0),
+  fNseedsTOF(0),
+  fngoodmatch(0),
+  fnbadmatch(0),
+  fnunmatch(0),
+  fnmatch(0),
+  fR(378.), 
+  fTOFHeigth(15.3),  
+  fdCut(3.), 
+  fDx(1.5), 
+  fDy(0), 
+  fDz(0), 
+  fDzMax(35.), 
+  fDyMax(50.), 
+  fTracks(0x0),
+  fSeeds(0x0)
+ { 
   //AliTOFtracker copy Ctor
 
   fHoles=t.fHoles;
@@ -92,6 +125,36 @@ AliTOFtracker::AliTOFtracker(const AliTOFtracker &t):AliTracker() {
   fTracks=t.fTracks;
   fN=t.fN;
 }
+
+//_____________________________________________________________________________
+AliTOFtracker& AliTOFtracker::operator=(const AliTOFtracker &t)
+{ 
+  //AliTOFtracker assignment operator
+
+  this->fHoles=t.fHoles;
+  this->fNseeds=t.fNseeds;
+  this->fNseedsTOF=t.fNseedsTOF;
+  this->fngoodmatch=t.fngoodmatch;
+  this->fnbadmatch=t.fnbadmatch;
+  this->fnunmatch=t.fnunmatch;
+  this->fnmatch=t.fnmatch;
+  this->fGeom = t.fGeom;
+  this->fTOFpid = t.fTOFpid;
+  this->fR=t.fR; 
+  this->fTOFHeigth=t.fTOFHeigth;  
+  this->fdCut=t.fdCut; 
+  this->fDy=t.fDy; 
+  this->fDz=t.fDz; 
+  this->fDx=t.fDx; 
+  this->fDzMax=t.fDzMax; 
+  this->fDyMax=t.fDyMax; 
+  this->fSeeds=t.fSeeds;
+  this->fTracks=t.fTracks;
+  this->fN=t.fN;
+  return *this;
+
+}
+
 //_____________________________________________________________________________
 Int_t AliTOFtracker::PropagateBack(AliESD* event) {
   //
@@ -147,8 +210,12 @@ Int_t AliTOFtracker::PropagateBack(AliESD* event) {
     if(seed->GetTOFsignal()>0){
       t->SetTOFsignal(seed->GetTOFsignal());
       t->SetTOFcluster(seed->GetTOFcluster());
+      t->SetTOFsignalToT(seed->GetTOFsignalToT());
+      t->SetTOFCalChannel(seed->GetTOFCalChannel());
+      Int_t tlab[3]; seed->GetTOFLabel(tlab);    
+      t->SetTOFLabel(tlab);
       AliTOFtrack *track = new AliTOFtrack(*seed); 
-      t->UpdateTrackParams(track,AliESDtrack::kTOFout);    
+      t->UpdateTrackParams(track,AliESDtrack::kTOFout);   
       delete track;
     }
   }
@@ -220,8 +287,10 @@ void AliTOFtracker::MatchTracks( Bool_t mLastStep){
 
   //Match ESD tracks to clusters in TOF
 
+
   Int_t nSteps=(Int_t)(fTOFHeigth/0.1);
 
+  AliTOFcalib *calib = new AliTOFcalib(fGeom);
   //PH Arrays (moved outside of the loop)
   Float_t * trackPos[4];
   for (Int_t ii=0; ii<4; ii++) trackPos[ii] = new Float_t[nSteps];
@@ -277,6 +346,7 @@ void AliTOFtracker::MatchTracks( Bool_t mLastStep){
       AliTOFcluster *c=fClusters[k];
       if (c->GetZ() > z+dz) break;
       if (c->IsUsed()) continue;
+      if (!c->GetStatus()) continue; // skip bad channels as declared in OCDB
       
       //AliInfo(Form(" fClusters[k]->GetZ() (%f) z-dz (%f)   %4i ", fClusters[k]->GetZ(), z-dz, k));
 
@@ -440,6 +510,24 @@ void AliTOFtracker::MatchTracks( Bool_t mLastStep){
 
     delete trackTOFin;
 
+    //  Store quantities to be used in the TOF Calibration
+    Float_t tToT=c->GetToT(); // in ps
+    t->SetTOFsignalToT(tToT);
+    Int_t ind[5];
+    ind[0]=c->GetDetInd(0);
+    ind[1]=c->GetDetInd(1);
+    ind[2]=c->GetDetInd(2);
+    ind[3]=c->GetDetInd(3);
+    ind[4]=c->GetDetInd(4);
+    Int_t calindex = calib->GetIndex(ind);
+    t->SetTOFCalChannel(calindex);
+
+    // keep track of the track labels in the matched cluster
+    Int_t tlab[3];
+    tlab[0]=c->GetLabel(0);
+    tlab[1]=c->GetLabel(1);
+    tlab[2]=c->GetLabel(2);
+    
     Double_t tof=AliTOFGeometry::TdcBinWidth()*c->GetTDC()+32; // in ps
     t->SetTOFsignal(tof);
     //t->SetTOFcluster(c->GetIndex()); // pointing to the digits tree
@@ -456,11 +544,13 @@ void AliTOFtracker::MatchTracks( Bool_t mLastStep){
     t->UpdateTrackParams(trackTOFout,AliESDtrack::kTOFout);    
     t->SetIntegratedLength(recL);
     t->SetIntegratedTimes(time);
+    t->SetTOFLabel(tlab);
 
     delete trackTOFout;
   }
   for (Int_t ii=0; ii<4; ii++) delete [] trackPos[ii];
   for (Int_t ii=0;ii<6;ii++) delete [] clind[ii];
+  delete calib;
 }
 //_________________________________________________________________________
 Int_t AliTOFtracker::LoadClusters(TTree *cTree) {
@@ -484,7 +574,6 @@ Int_t AliTOFtracker::LoadClusters(TTree *cTree) {
   for (Int_t i=0; i<nc; i++) {
     AliTOFcluster *c=(AliTOFcluster*)clusters->UncheckedAt(i);
     fClusters[i]=new AliTOFcluster(*c); fN++;
-
     //AliInfo(Form("%4i %4i  %f %f %f  %f %f   %2i %1i %2i %1i %2i",i, fClusters[i]->GetIndex(),fClusters[i]->GetZ(),fClusters[i]->GetR(),fClusters[i]->GetPhi(), fClusters[i]->GetTDC(),fClusters[i]->GetADC(),fClusters[i]->GetDetInd(0),fClusters[i]->GetDetInd(1),fClusters[i]->GetDetInd(2),fClusters[i]->GetDetInd(3),fClusters[i]->GetDetInd(4)));
     //AliInfo(Form("%i %f",i, fClusters[i]->GetZ()));
   }
@@ -531,7 +620,20 @@ Bool_t AliTOFtracker::GetTrackPoint(Int_t index, AliTrackPoint& p) const
   xyz[0] = cl->GetR()*TMath::Cos(cl->GetPhi());
   xyz[1] = cl->GetR()*TMath::Sin(cl->GetPhi());
   xyz[2] = cl->GetZ();
-  p.SetXYZ(xyz[0],xyz[1],xyz[2]);
+  Float_t phiangle = (Int_t(cl->GetPhi()*TMath::RadToDeg()/20.)+0.5)*20.*TMath::DegToRad();
+  Float_t sinphi = TMath::Sin(phiangle), cosphi = TMath::Cos(phiangle);
+  Float_t tiltangle = fGeom->GetAngles(cl->GetDetInd(1),cl->GetDetInd(2))*TMath::DegToRad();
+  Float_t sinth = TMath::Sin(tiltangle), costh = TMath::Cos(tiltangle);
+  Float_t sigmay2 = fGeom->XPad()*fGeom->XPad()/12.;
+  Float_t sigmaz2 = fGeom->ZPad()*fGeom->ZPad()/12.;
+  Float_t cov[6];
+  cov[0] = sinphi*sinphi*sigmay2 + cosphi*cosphi*sinth*sinth*sigmaz2;
+  cov[1] = -sinphi*cosphi*sigmay2 + sinphi*cosphi*sinth*sinth*sigmaz2;
+  cov[2] = -cosphi*sinth*costh*sigmaz2;
+  cov[3] = cosphi*cosphi*sigmay2 + sinphi*sinphi*sinth*sinth*sigmaz2;
+  cov[4] = -sinphi*sinth*costh*sigmaz2;
+  cov[5] = costh*costh*sigmaz2;
+  p.SetXYZ(xyz[0],xyz[1],xyz[2],cov);
 
   // Detector numbering scheme
   Int_t nSector = fGeom->NSectors();