]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RICH/AliRICHPatRec.cxx
Old style include needed on HP
[u/mrichter/AliRoot.git] / RICH / AliRICHPatRec.cxx
index 5cc2c3d68aa6a590e3238cc3f1911755923266a4..326ee3edb22f0496869c309ad7692c60be524f24 100644 (file)
 
 /*
   $Log$
+  Revision 1.12  2001/05/10 12:34:23  jbarbosa
+  Changed drwaing routines.
+
+  Revision 1.11  2001/03/14 18:21:24  jbarbosa
+  Corrected bug in digits loading.
+
+  Revision 1.10  2001/02/27 15:21:06  jbarbosa
+  Transition to SDigits.
+
+  Revision 1.9  2001/02/13 20:38:48  jbarbosa
+  Changes to make it work with new IO.
+
+  Revision 1.8  2000/11/01 15:37:18  jbarbosa
+  Updated to use its own rec. point object.
+
+  Revision 1.7  2000/10/03 21:44:09  morsch
+  Use AliSegmentation and AliHit abstract base classes.
+
+  Revision 1.6  2000/10/02 21:28:12  fca
+  Removal of useless dependecies via forward declarations
+
+  Revision 1.5  2000/10/02 15:50:25  jbarbosa
+  Fixed forward declarations.
+
+  Revision 1.4  2000/06/30 16:33:43  dibari
+  Several changes (ring drawing, fiducial selection, etc.)
+
   Revision 1.3  2000/06/15 15:47:12  jbarbosa
   Corrected compilation errors on HP-UX (replaced pow with TMath::Power)
 
 
 #include "AliRICHHit.h"
 #include "AliRICHCerenkov.h"
-#include "AliRICHPadHit.h"
+#include "AliRICHSDigit.h"
 #include "AliRICHDigit.h"
 #include "AliRICHRawCluster.h"
-#include "AliRICHRecHit.h"
+#include "AliRICHRecHit1D.h"
 #include "AliRun.h"
 #include "AliDetector.h"
 #include "AliRICH.h"
 #include "AliRICHPoints.h"
-#include "AliRICHSegmentation.h"
+#include "AliSegmentation.h"
 #include "AliRICHPatRec.h"
 #include "AliRICH.h"
 #include "AliRICHConst.h"
 #include "AliRICHPoints.h"
 #include "AliConst.h"
+#include "AliHitMap.h"
 
 #include <TParticle.h>
 #include <TMath.h>
 #include <TRandom.h>
 #include <TCanvas.h>
 #include <TH2.h>
+#include <TTree.h>
 
 
 ClassImp(AliRICHPatRec)
@@ -71,20 +100,20 @@ void AliRICHPatRec::PatRec()
 // Pattern recognition algorithm
 
   AliRICHChamber*       iChamber;
-  AliRICHSegmentation*  segmentation;
+  AliSegmentation*  segmentation;
        
   Int_t ntracks, ndigits[kNCH];
   Int_t itr, ich, i;
   Int_t goodPhotons;
   Int_t x,y,q;
-  Float_t rx,ry;
+  Float_t rx,ry,rz;
   Int_t nent,status;
   Int_t padsUsedX[100];
   Int_t padsUsedY[100];
 
   Float_t rechit[7];
 
-  printf("PatRec started\n");
+  //printf("PatRec started\n");
 
   AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
   TTree *treeH = gAlice->TreeH();
@@ -93,7 +122,7 @@ void AliRICHPatRec::PatRec()
   //  ntracks = 1;
   for (itr=0; itr<ntracks; itr++) {
  
-    status = TrackParam(itr,ich);    
+    status = TrackParam(itr,ich,0,0);    
     if(status==1) continue;
     //printf(" theta %f phi %f track \n",fTrackTheta,fTrackPhi);
     //    ring->Fill(fTrackLoc[0],fTrackLoc[1],100.);
@@ -102,7 +131,7 @@ void AliRICHPatRec::PatRec()
     segmentation=iChamber->GetSegmentationModel();
 
     nent=(Int_t)gAlice->TreeD()->GetEntries();
-    gAlice->TreeD()->GetEvent(nent-1);
+    gAlice->TreeD()->GetEvent(0);
     TClonesArray *pDigitss = pRICH->DigitsAddress(ich);
     ndigits[ich] = pDigitss->GetEntriesFast();
     printf("Digits in chamber %d: %d\n",ich,ndigits[ich]);
@@ -112,10 +141,10 @@ void AliRICHPatRec::PatRec()
 
     for (Int_t dig=0;dig<ndigits[ich];dig++) {
       padI=(AliRICHDigit*) pDigitss->UncheckedAt(dig);
-      x=padI->fPadX;
-      y=padI->fPadY;
-      q=padI->fSignal;
-      segmentation->GetPadCxy(x,y,rx,ry);      
+      x=padI->PadX();
+      y=padI->PadY();
+      q=padI->Signal();
+      segmentation->GetPadC(x,y,rx,ry,rz);      
 
       //printf("Pad coordinates x:%d, Real coordinates x:%f\n",x,rx);
       //printf("Pad coordinates y:%d, Real coordinates y:%f\n",y,ry);
@@ -132,7 +161,7 @@ void AliRICHPatRec::PatRec()
       Int_t xpad;
       Int_t ypad;
 
-      segmentation->GetPadIxy(fXpad,fYpad,xpad,ypad);
+      segmentation->GetPadI(fXpad,fYpad,0,xpad,ypad);
 
       padsUsedX[goodPhotons]=xpad;
       padsUsedY[goodPhotons]=ypad;
@@ -157,28 +186,28 @@ void AliRICHPatRec::PatRec()
 
     //printf("Center coordinates:%f %f\n",rechit[3],rechit[4]);
     
-    pRICH->AddRecHit(ich,rechit,fEtaPhotons,padsUsedX,padsUsedY);
+    pRICH->AddRecHit1D(ich,rechit,fEtaPhotons,padsUsedX,padsUsedY);
     
   }    
 
   gAlice->TreeR()->Fill();
   TClonesArray *fRec;
   for (i=0;i<kNCH;i++) {
-    fRec=pRICH->RecHitsAddress(i);
+    fRec=pRICH->RecHitsAddress1D(i);
     int ndig=fRec->GetEntriesFast();
     printf ("Chamber %d, rings %d\n",i,ndig);
   }
-  pRICH->ResetRecHits();
+  pRICH->ResetRecHits1D();
   
 }     
 
 
-Int_t AliRICHPatRec::TrackParam(Int_t itr, Int_t &ich)
+Int_t AliRICHPatRec::TrackParam(Int_t itr, Int_t &ich, Float_t rectheta, Float_t recphi)
 {
   // Get Local coordinates of track impact  
 
   AliRICHChamber*       iChamber;
-  AliRICHSegmentation*  segmentation;
+  AliSegmentation*      segmentation;
 
   Float_t trackglob[3];
   Float_t trackloc[3];
@@ -188,7 +217,7 @@ Int_t AliRICHPatRec::TrackParam(Int_t itr, Int_t &ich)
   Float_t part;
   Float_t pX, pY, pZ;
 
-  printf("Calling TrackParam\n");
+  //printf("Calling TrackParam\n");
 
     gAlice->ResetHits();
     TTree *treeH = gAlice->TreeH();
@@ -197,18 +226,26 @@ Int_t AliRICHPatRec::TrackParam(Int_t itr, Int_t &ich)
     AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
     AliRICHHit* mHit=(AliRICHHit*)pRICH->FirstHit(-1);
     if(mHit==0) return 1;
-    ich = mHit->fChamber-1;
-    trackglob[0] = mHit->fX;
-    trackglob[1] = mHit->fY;
-    trackglob[2] = mHit->fZ;
-    pX = mHit->fMomX;
-    pY = mHit->fMomY;
-    pZ = mHit->fMomZ;
+    ich = mHit->Chamber()-1;
+    trackglob[0] = mHit->X();
+    trackglob[1] = mHit->Y();
+    trackglob[2] = mHit->Z();
+    pX = mHit->MomX();
+    pY = mHit->MomY();
+    pZ = mHit->MomZ();
     fTrackMom = sqrt(TMath::Power(pX,2)+TMath::Power(pY,2)+TMath::Power(pZ,2));
-    thetatr = (mHit->fTheta)*(Float_t)kDegrad;
-    phitr = mHit->fPhi*(Float_t)kDegrad;
-    iloss = mHit->fLoss;
-    part  = mHit->fParticle;
+    if(recphi!=0 || rectheta!=0)
+      {
+       thetatr = rectheta;
+       phitr = recphi;
+      }
+    else
+      {
+       thetatr = mHit->Theta()*TMath::Pi()/180;
+       phitr = mHit->Phi()*TMath::Pi()/180;
+      }
+    iloss = mHit->Loss();
+    part  = mHit->Particle();
 
     iChamber = &(pRICH->Chamber(ich));
     iChamber->GlobaltoLocal(trackglob,trackloc);
@@ -408,7 +445,10 @@ void AliRICHPatRec::BackgroundEstimation()
     funBkg = tan(etaStepAvg)*TMath::Power((1.+TMath::Power(tan(etaStepAvg),2)),
                                  5.52)-7.803 + 22.02*tan(etaStepAvg);
     */
-    thetaSig = asin(nfreon/ngas*sin(etaStepAvg));
+    
+    //printf("etaStepAvg: %f, etaStepMax: %f, etaStepMin: %f", etaStepAvg,etaStepMax,etaStepMin);
+
+    thetaSig = TMath::ASin(nfreon/ngas*TMath::Sin(etaStepAvg));
     funBkg = tan(thetaSig)*(1.+TMath::Power(tan(thetaSig),2))*nfreon
        /ngas*cos(etaStepAvg)/cos(thetaSig);
     areaBkg += stepEta*funBkg;
@@ -522,7 +562,7 @@ Int_t AliRICHPatRec::PhotonInBand()
   f1  = 46.411;
   f2  = 228.71;
 
-  phpad = PhiPad();  
+  phpad = PhiPad(fTrackTheta,fTrackPhi);  
 
   for (times=0; times<=1; times++) {
   
@@ -538,7 +578,7 @@ Int_t AliRICHPatRec::PhotonInBand()
 
     bandradius[times] = DistanceFromMip( nfreon[times], nquartz[times],
                                emissPointLength[times], 
-                                      thetacer[times], phpad, pointsOnCathode);
+                                      thetacer[times], phpad, pointsOnCathode,fTrackTheta,fTrackPhi);
     //printf(" ppp %f %f %f \n",pointsOnCathode);  
 }
 
@@ -553,7 +593,7 @@ Int_t AliRICHPatRec::PhotonInBand()
 
 Float_t AliRICHPatRec::DistanceFromMip(Float_t nfreon, Float_t nquartz, 
                       Float_t emissPointLength, Float_t thetacer, 
-                      Float_t phpad, Float_t pointsOnCathode[3])
+                      Float_t phpad, Float_t pointsOnCathode[3], Float_t rectheta, Float_t recphi)
 { 
 
 // Find the distance to MIP impact
@@ -585,11 +625,11 @@ Float_t AliRICHPatRec::DistanceFromMip(Float_t nfreon, Float_t nquartz,
 
   Float_t ngas    = 1.;
 
-  magEmissPointLenght =  emissPointLength/cos(fTrackTheta);
+  magEmissPointLenght =  emissPointLength/cos(rectheta);
 
   vectEmissPointLength.SetMag(magEmissPointLenght);
-  vectEmissPointLength.SetTheta(fTrackTheta);
-  vectEmissPointLength.SetPhi(fTrackPhi);
+  vectEmissPointLength.SetTheta(rectheta);
+  vectEmissPointLength.SetPhi(recphi);
 
 
   radExitPhot2.SetTheta(thetacer);  
@@ -600,8 +640,8 @@ Float_t AliRICHPatRec::DistanceFromMip(Float_t nfreon, Float_t nquartz,
   TRotation r2;
   TRotation r;
 
-  r1. RotateY(fTrackTheta);
-  r2. RotateZ(fTrackPhi);
+  r1. RotateY(rectheta);
+  r2. RotateZ(recphi);
   
 
 
@@ -649,7 +689,7 @@ Float_t AliRICHPatRec::DistanceFromMip(Float_t nfreon, Float_t nquartz,
 
  }
 
-Float_t AliRICHPatRec::PhiPad()
+Float_t AliRICHPatRec::PhiPad(Float_t rectheta, Float_t recphi)
 {
 
 // ??
@@ -668,8 +708,8 @@ Float_t AliRICHPatRec::PhiPad()
   TRotation r2;
   TRotation r;
 
-  thetarot = - fTrackTheta;
-  phirot   = - fTrackPhi;
+  thetarot = - rectheta;
+  phirot   = - recphi;
   r1. RotateZ(phirot);
   r2. RotateY(thetarot);