]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RICH/AliRICHPatRec.cxx
First interation on SplitByLocalMaxima with Nico
[u/mrichter/AliRoot.git] / RICH / AliRICHPatRec.cxx
index 326ee3edb22f0496869c309ad7692c60be524f24..56516d76e7651df2f8d4ca66ec6ff437b169c441 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-  $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)
-
-  Revision 1.2  2000/06/12 15:26:09  jbarbosa
-  Cleaned up version.
-
-  Revision 1.1  2000/06/09 14:53:01  jbarbosa
-  Bari's pattern recognition algorithm
-
-*/
-
-#include "AliRICHHit.h"
-#include "AliRICHCerenkov.h"
-#include "AliRICHSDigit.h"
+#include "AliRICHPatRec.h"
 #include "AliRICHDigit.h"
-#include "AliRICHRawCluster.h"
 #include "AliRICHRecHit1D.h"
 #include "AliRun.h"
-#include "AliDetector.h"
-#include "AliRICH.h"
-#include "AliRICHPoints.h"
-#include "AliSegmentation.h"
-#include "AliRICHPatRec.h"
 #include "AliRICH.h"
 #include "AliRICHConst.h"
-#include "AliRICHPoints.h"
 #include "AliConst.h"
-#include "AliHitMap.h"
-
+#include "AliRICHParam.h"
 #include <TParticle.h>
 #include <TMath.h>
 #include <TRandom.h>
@@ -81,7 +33,7 @@
 
 ClassImp(AliRICHPatRec)
 //___________________________________________
-AliRICHPatRec::AliRICHPatRec() : TObject()
+AliRICHPatRec::AliRICHPatRec() : TNamed()
 {
   // Default constructor
   
@@ -89,7 +41,7 @@ AliRICHPatRec::AliRICHPatRec() : TObject()
 }
 //___________________________________________
 AliRICHPatRec::AliRICHPatRec(const char *name, const char *title)
-    : TObject()
+    : TNamed(name,title)
 {
     //Constructor for Bari's pattern recogniton method object
 }
@@ -99,15 +51,13 @@ void AliRICHPatRec::PatRec()
 
 // Pattern recognition algorithm
 
-  AliRICHChamber*       iChamber;
-  AliSegmentation*  segmentation;
        
   Int_t ntracks, ndigits[kNCH];
-  Int_t itr, ich, i;
+  Int_t itr, ich=1, i;
   Int_t goodPhotons;
   Int_t x,y,q;
-  Float_t rx,ry,rz;
-  Int_t nent,status;
+  Float_t rx,ry;
+  Int_t status=1;
   Int_t padsUsedX[100];
   Int_t padsUsedY[100];
 
@@ -116,35 +66,36 @@ void AliRICHPatRec::PatRec()
   //printf("PatRec started\n");
 
   AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
-  TTree *treeH = gAlice->TreeH();
+  pRICH->GetLoader()->LoadHits();
+  TTree *treeH = pRICH->GetLoader()->TreeH();
+  
+  pRICH->GetLoader()->LoadDigits();    
+  pRICH->GetLoader()->TreeD()->GetEntry(0);
 
   ntracks =(Int_t) treeH->GetEntries();
   //  ntracks = 1;
   for (itr=0; itr<ntracks; itr++) {
-    status = TrackParam(itr,ich,0,0);    
+    pRICH->GetLoader()->TreeH()->GetEntry(itr); 
+    status = TrackParam(ich,0,0);    
     if(status==1) continue;
     //printf(" theta %f phi %f track \n",fTrackTheta,fTrackPhi);
     //    ring->Fill(fTrackLoc[0],fTrackLoc[1],100.);
 
-    iChamber = &(pRICH->Chamber(ich));
-    segmentation=iChamber->GetSegmentationModel();
 
-    nent=(Int_t)gAlice->TreeD()->GetEntries();
-    gAlice->TreeD()->GetEvent(0);
-    TClonesArray *pDigitss = pRICH->DigitsAddress(ich);
-    ndigits[ich] = pDigitss->GetEntriesFast();
+    TClonesArray *pDigits = pRICH->DigitsAddress(ich);
+    ndigits[ich] = pDigits->GetEntriesFast();
     printf("Digits in chamber %d: %d\n",ich,ndigits[ich]);
-    AliRICHDigit *padI = 0;
+    AliRICHDigit *pDig = 0;
 
     goodPhotons = 0;
 
     for (Int_t dig=0;dig<ndigits[ich];dig++) {
-      padI=(AliRICHDigit*) pDigitss->UncheckedAt(dig);
-      x=padI->PadX();
-      y=padI->PadY();
-      q=padI->Signal();
-      segmentation->GetPadC(x,y,rx,ry,rz);      
+      pDig=(AliRICHDigit*) pDigits->UncheckedAt(dig);
+      pDig->Print();
+      x=pDig->PadX();
+      y=pDig->PadY();
+      q=pDig->Signal();
+      AliRICHParam::Pad2Local(x,y,rx,ry);      
 
       //printf("Pad coordinates x:%d, Real coordinates x:%f\n",x,rx);
       //printf("Pad coordinates y:%d, Real coordinates y:%f\n",y,ry);
@@ -161,7 +112,7 @@ void AliRICHPatRec::PatRec()
       Int_t xpad;
       Int_t ypad;
 
-      segmentation->GetPadI(fXpad,fYpad,0,xpad,ypad);
+      AliRICHParam::Local2Pad(fXpad,fYpad,xpad,ypad);
 
       padsUsedX[goodPhotons]=xpad;
       padsUsedY[goodPhotons]=ypad;
@@ -188,9 +139,11 @@ void AliRICHPatRec::PatRec()
     
     pRICH->AddRecHit1D(ich,rechit,fEtaPhotons,padsUsedX,padsUsedY);
     
-  }    
+  }//prims loop    
 
-  gAlice->TreeR()->Fill();
+  pRICH->GetLoader()->TreeR()->Fill();
+  pRICH->GetLoader()->WriteRecPoints("OVERWRITE");
+  
   TClonesArray *fRec;
   for (i=0;i<kNCH;i++) {
     fRec=pRICH->RecHitsAddress1D(i);
@@ -202,12 +155,11 @@ void AliRICHPatRec::PatRec()
 }     
 
 
-Int_t AliRICHPatRec::TrackParam(Int_t itr, Int_t &ich, Float_t rectheta, Float_t recphi)
+Int_t AliRICHPatRec::TrackParam(Int_t &ich, Float_t rectheta, Float_t recphi)
 {
   // Get Local coordinates of track impact  
 
   AliRICHChamber*       iChamber;
-  AliSegmentation*      segmentation;
 
   Float_t trackglob[3];
   Float_t trackloc[3];
@@ -219,20 +171,18 @@ Int_t AliRICHPatRec::TrackParam(Int_t itr, Int_t &ich, Float_t rectheta, Float_t
 
   //printf("Calling TrackParam\n");
 
-    gAlice->ResetHits();
-    TTree *treeH = gAlice->TreeH();
-    treeH->GetEvent(itr);
     AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
-    AliRICHHit* mHit=(AliRICHHit*)pRICH->FirstHit(-1);
-    if(mHit==0) return 1;
-    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();
+    AliRICHhit* pHit=(AliRICHhit*)pRICH->FirstHit(-1);
+    if(pHit==0) return 1;
+    pHit->Print();
+    ich = pHit->Chamber()-1;
+    trackglob[0] = pHit->X();
+    trackglob[1] = pHit->Y();
+    trackglob[2] = pHit->Z();
+    pX = pHit->MomX();
+    pY = pHit->MomY();
+    pZ = pHit->MomZ();
     fTrackMom = sqrt(TMath::Power(pX,2)+TMath::Power(pY,2)+TMath::Power(pZ,2));
     if(recphi!=0 || rectheta!=0)
       {
@@ -241,25 +191,22 @@ Int_t AliRICHPatRec::TrackParam(Int_t itr, Int_t &ich, Float_t rectheta, Float_t
       }
     else
       {
-       thetatr = mHit->Theta()*TMath::Pi()/180;
-       phitr = mHit->Phi()*TMath::Pi()/180;
+       thetatr = pHit->Theta()*TMath::Pi()/180;
+       phitr = pHit->Phi()*TMath::Pi()/180;
       }
-    iloss = mHit->Loss();
-    part  = mHit->Particle();
+    iloss = pHit->Loss();
+    part  = pHit->Particle();
 
     iChamber = &(pRICH->Chamber(ich));
     iChamber->GlobaltoLocal(trackglob,trackloc);
 
-    segmentation=iChamber->GetSegmentationModel();
 
     // retrieve geometrical params
 
-    AliRICHGeometry* fGeometry=iChamber->GetGeometryModel();   
-    
-    fRw   = fGeometry->GetFreonThickness();
-    fQw   = fGeometry->GetQuartzThickness();
-    fTgap = fGeometry->GetGapThickness(); 
-    Float_t radiatorToPads= fGeometry->GetRadiatorToPads(); 
+    fRw   = pRICH->Param()->FreonThickness();
+    fQw   = pRICH->Param()->QuartzThickness();
+    fTgap = pRICH->Param()->GapThickness(); 
+    Float_t radiatorToPads= pRICH->Param()->RadiatorToPads(); 
       //+ fGeometry->GetProximityGapThickness();
 
     //printf("Distance to pads. From geometry:%f, From calculations:%f\n",radiatorToPads,fRw + fQw + fTgap); 
@@ -393,7 +340,9 @@ void AliRICHPatRec::PhotonSelection(Int_t track, Int_t &nphot, Float_t &thetamea
 {
 
 // not implemented yet
-
+  track++;
+  nphot=10;
+  thetamean=4;
   printf("Calling PhotonSelection\n");
 }
 
@@ -511,7 +460,7 @@ void AliRICHPatRec::FlagPhotons(Int_t track, Float_t theta)
 {
 
 // not implemented yet
-
+  track++;theta++;
   printf("Calling FlagPhotons\n");
 }