--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/*
+ $Log$
+*/
+
+
+#include "DataStructures.h"
+#include "AliRun.h"
+#include <TObjArray.h>
+#include <TParticle.h>
+
+ClassImp(AliRICHPadHit)
+
+ClassImp(AliRICHHit)
+
+//___________________________________________
+AliRICHHit::AliRICHHit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
+ AliHit(shunt, track)
+{
+ fChamber=vol[0];
+ fParticle=hits[0];
+ fX=hits[1];
+ fY=hits[2];
+ fZ=hits[3];
+ fTheta=hits[4];
+ fPhi=hits[5];
+ fTlength=hits[6];
+ fEloss=hits[7];
+ fPHfirst=(Int_t) hits[8];
+ fPHlast=(Int_t) hits[9];
+ fLoss=hits[13];
+ fMomX=hits[14];
+ fMomY=hits[15];
+ fMomZ=hits[16];
+}
+
+ClassImp(AliRICHCerenkov)
+//___________________________________________
+AliRICHCerenkov::AliRICHCerenkov(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
+ AliHit(shunt, track)
+{
+ fChamber=vol[0];
+ fX=hits[1];
+ fY=hits[2];
+ fZ=hits[3];
+ fTheta=hits[4];
+ fPhi=hits[5];
+ fEloss=hits[7];
+ fPHfirst=(Int_t) hits[8];
+ fPHlast=(Int_t) hits[9];
+ fCMother=Int_t(hits[10]);
+ fIndex = hits[11];
+ fProduction = hits[12];
+ fLoss=hits[13];
+ fMomX=hits[14];
+ fMomY=hits[15];
+ fMomZ=hits[16];
+}
+
+//___________________________________________
+AliRICHPadHit::AliRICHPadHit(Int_t *clhits)
+{
+ fHitNumber=clhits[0];
+ fCathode=clhits[1];
+ fQ=clhits[2];
+ fPadX=clhits[3];
+ fPadY=clhits[4];
+ fQpad=clhits[5];
+ fRSec=clhits[6];
+}
+
+ClassImp(AliRICHDigit)
+//_____________________________________________________________________________
+AliRICHDigit::AliRICHDigit(Int_t *digits)
+{
+ //
+ // Creates a RICH digit object to be updated
+ //
+ fPadX = digits[0];
+ fPadY = digits[1];
+ fSignal = digits[2];
+
+}
+//_____________________________________________________________________________
+AliRICHDigit::AliRICHDigit(Int_t *tracks, Int_t *charges, Int_t *digits)
+{
+ //
+ // Creates a RICH digit object
+ //
+ fPadX = digits[0];
+ fPadY = digits[1];
+ fSignal = digits[2];
+ for(Int_t i=0; i<100; i++) {
+ fTcharges[i] = charges[i];
+ fTracks[i] = tracks[i];
+ }
+}
+
+ClassImp(AliRICHTransientDigit)
+
+//____________________________________________________________________________
+AliRICHTransientDigit::AliRICHTransientDigit(Int_t ich, Int_t *digits):
+ AliRICHDigit(digits)
+{
+ //
+ // Creates a RICH digit list object
+ //
+
+ fChamber = ich;
+ fTrackList = new TObjArray;
+
+}
+//_____________________________________________________________________________
+
+
+ClassImp(AliRICHRawCluster)
+Int_t AliRICHRawCluster::Compare(TObject *obj)
+{
+ AliRICHRawCluster *raw=(AliRICHRawCluster *)obj;
+ Float_t y=fY;
+ Float_t yo=raw->fY;
+ if (y>yo) return 1;
+ else if (y<yo) return -1;
+ else return 0;
+
+}
+
+Int_t AliRICHRawCluster::
+BinarySearch(Float_t y, TArrayF coord, Int_t from, Int_t upto)
+{
+ // Find object using a binary search. Array must first have been sorted.
+ // Search can be limited by setting upto to desired index.
+
+ Int_t low=from, high=upto-1, half;
+ while(high-low>1) {
+ half=(high+low)/2;
+ if(y>coord[half]) low=half;
+ else high=half;
+ }
+ return low;
+}
+
+void AliRICHRawCluster::SortMin(Int_t *idx,Float_t *xdarray,Float_t *xarray,Float_t *yarray,Float_t *qarray, Int_t ntr)
+{
+ //
+ // Get the 3 closest points(cog) one can find on the second cathode
+ // starting from a given cog on first cathode
+ //
+
+ //
+ // Loop over deltax, only 3 times
+ //
+
+ Float_t xmin;
+ Int_t jmin;
+ Int_t id[3] = {-2,-2,-2};
+ Float_t jx[3] = {0.,0.,0.};
+ Float_t jy[3] = {0.,0.,0.};
+ Float_t jq[3] = {0.,0.,0.};
+ Int_t jid[3] = {-2,-2,-2};
+ Int_t i,j,imax;
+
+ if (ntr<3) imax=ntr;
+ else imax=3;
+ for(i=0;i<imax;i++){
+ xmin=1001.;
+ jmin=0;
+
+ for(j=0;j<ntr;j++){
+ if ((i == 1 && j == id[i-1])
+ ||(i == 2 && (j == id[i-1] || j == id[i-2]))) continue;
+ if (TMath::Abs(xdarray[j]) < xmin) {
+ xmin = TMath::Abs(xdarray[j]);
+ jmin=j;
+ }
+ } // j
+ if (xmin != 1001.) {
+ id[i]=jmin;
+ jx[i]=xarray[jmin];
+ jy[i]=yarray[jmin];
+ jq[i]=qarray[jmin];
+ jid[i]=idx[jmin];
+ }
+
+ } // i
+
+ for (i=0;i<3;i++){
+ if (jid[i] == -2) {
+ xarray[i]=1001.;
+ yarray[i]=1001.;
+ qarray[i]=1001.;
+ idx[i]=-1;
+ } else {
+ xarray[i]=jx[i];
+ yarray[i]=jy[i];
+ qarray[i]=jq[i];
+ idx[i]=jid[i];
+ }
+ }
+
+}
+
+
+Int_t AliRICHRawCluster::PhysicsContribution()
+{
+ Int_t iPhys=0;
+ Int_t iBg=0;
+ Int_t iMixed=0;
+ for (Int_t i=0; i<fMultiplicity; i++) {
+ if (fPhysicsMap[i]==2) iPhys++;
+ if (fPhysicsMap[i]==1) iMixed++;
+ if (fPhysicsMap[i]==0) iBg++;
+ }
+ if (iMixed==0 && iBg==0) {
+ return 2;
+ } else if ((iPhys != 0 && iBg !=0) || iMixed != 0) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+//_____________________________________________________________________________
+
+
+ClassImp(AliRICHRecHit)
+
+
+//_____________________________________________________________________________
+AliRICHRecHit::AliRICHRecHit(Int_t id, Float_t *rechit)
+{
+ //
+ // Creates a RICH rec. hit object
+ //
+ Theta = rechit[0];
+ Phi = rechit[1];
+ Omega = rechit[2];
+ fX = rechit[3];
+ fY = rechit[4];
+}
--- /dev/null
+#ifndef RICHDataStructures_H
+#define RICHDataStructures_H
+
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+
+#include "AliHit.h"
+#include "AliDigit.h"
+#include <TObjArray.h>
+#include <TArrayF.h>
+#include <TMath.h>
+
+
+class AliRICHHit : public AliHit {
+ public:
+ Int_t fChamber; // Chamber number
+ Float_t fParticle; // Geant3 particle type
+ Float_t fTheta ; // Incident theta angle in degrees
+ Float_t fPhi ; // Incident phi angle in degrees
+ Float_t fTlength; // Track length inside the chamber
+ Float_t fEloss; // ionisation energy loss in gas
+ Float_t fPHfirst; // first padhit
+ Float_t fPHlast; // last padhit
+ Float_t fLoss; // did it hit the freon?
+ Float_t fMomX; // Local Momentum
+ Float_t fMomY; // Local Momentum
+ Float_t fMomZ; // Local Momentum
+ public:
+ AliRICHHit() {}
+ AliRICHHit(Int_t fIshunt, Int_t track, Int_t *vol, Float_t *hits);
+ virtual ~AliRICHHit() {}
+
+ ClassDef(AliRICHHit,1) //Hits object for set:RICH
+};
+
+//------------------------------------------------
+// Cerenkov photon object
+//------------------------------------------------
+
+class AliRICHCerenkov: public AliHit {
+ public:
+ Int_t fChamber; // Chamber number
+ Float_t fTheta ; // Incident theta angle in degrees
+ Float_t fPhi ; // Incident phi angle in degrees
+ Float_t fTlength; // Track length inside the chamber
+ Float_t fEloss; // ionisation energy loss in gas
+ Int_t fPHfirst; // first padhit
+ Int_t fPHlast; // last padhit
+ Int_t fCMother; // index of mother particle
+ Float_t fLoss; // nature of particle loss
+ Float_t fIndex; // Index of photon
+ Float_t fProduction; // Point of production
+ Float_t fMomX; // Local Momentum
+ Float_t fMomY; // Local Momentum
+ Float_t fMomZ; // Local Momentum
+ public:
+ AliRICHCerenkov() {}
+ AliRICHCerenkov(Int_t fIshunt, Int_t track, Int_t *vol, Float_t *Cerenkovs);
+ virtual ~AliRICHCerenkov() {}
+
+ ClassDef(AliRICHCerenkov,1) //Cerenkovs object for set:RICH
+};
+
+//
+class AliRICHPadHit : public TObject {
+ public:
+
+ Int_t fHitNumber; // Hit number
+ Int_t fCathode; // Cathode number
+ Int_t fQ ; // Total charge
+ Int_t fPadX ; // Pad number along X
+ Int_t fPadY ; // Pad number along Y
+ Int_t fQpad ; // Charge per pad
+ Int_t fRSec ; // R -sector of pad
+
+ public:
+ AliRICHPadHit() {
+ fHitNumber=fQ=fPadX=fPadY=fQpad=fRSec=0;
+ }
+ AliRICHPadHit(Int_t *clhits);
+ virtual ~AliRICHPadHit() {;}
+
+ ClassDef(AliRICHPadHit,1) //Cluster object for set:RICH
+};
+
+class AliRICHDigit : public TObject {
+ public:
+ Int_t fPadX; // Pad number along x
+ Int_t fPadY ; // Pad number along y
+ Int_t fSignal; // Signal amplitude
+
+
+ Int_t fTcharges[100]; // charge per track making this digit (up to 10)
+ Int_t fTracks[100]; // tracks making this digit (up to 10)
+ Int_t fPhysics; // physics contribution to signal
+ Int_t fHit; // hit number - temporary solution
+
+ public:
+ AliRICHDigit() {}
+ AliRICHDigit(Int_t *digits);
+ AliRICHDigit(Int_t *tracks, Int_t *charges, Int_t *digits);
+ virtual ~AliRICHDigit() {}
+ ClassDef(AliRICHDigit,1) //Digits for set:RICH
+};
+//_____________________________________________________________________________
+
+class AliRICHTransientDigit : public AliRICHDigit {
+ public:
+ Int_t fRpad; // r_pos of pad
+ Int_t fChamber; // chamber number of pad
+ TObjArray *fTrackList;
+ public:
+ AliRICHTransientDigit() {fTrackList=0;}
+ AliRICHTransientDigit(Int_t ich, Int_t *digits);
+ virtual ~AliRICHTransientDigit() {}
+
+ TObjArray *TrackList() {return fTrackList;}
+
+ ClassDef(AliRICHTransientDigit,1) //Digits for set:RICH
+};
+//___________________________________________
+class AliRICHRawCluster : public TObject {
+public:
+ Int_t fTracks[3]; //labels of overlapped tracks
+ Int_t fQ ; // Q of cluster (in ADC counts)
+ Float_t fX ; // X of cluster
+ Float_t fY ; // Y of cluster
+ Int_t fPeakSignal;
+ Int_t fIndexMap[50]; //indeces of digits
+ Int_t fOffsetMap[50];
+ Float_t fContMap[50]; //Contribution from digit
+ Int_t fPhysicsMap[50];
+ Int_t fMultiplicity; //cluster multiplicity
+ Int_t fNcluster[2];
+ Int_t fClusterType;
+ Int_t fCtype; //CL0, CL1, etc...
+ public:
+ AliRICHRawCluster() {
+ fTracks[0]=fTracks[1]=fTracks[2]=-1;
+ fQ=0; fX=fY=0; fMultiplicity=0;
+ for (int k=0;k<50;k++) {
+ fIndexMap[k]=-1;
+ fOffsetMap[k]=0;
+ fContMap[k]=0;
+ fPhysicsMap[k]=-1;
+ fCtype=-1;
+ }
+ fNcluster[0]=fNcluster[1]=-1;
+ }
+ virtual ~AliRICHRawCluster() {}
+
+ Float_t GetRadius() {return TMath::Sqrt(fX*fX+fY*fY);}
+
+ Bool_t IsSortable() const {return kTRUE;}
+ Int_t Compare(TObject *obj);
+ Int_t PhysicsContribution();
+ static Int_t BinarySearch(Float_t r, TArrayF, Int_t from, Int_t upto);
+ static void SortMin(Int_t *,Float_t *,Float_t *,Float_t *,Float_t *,Int_t);
+
+ ClassDef(AliRICHRawCluster,1) //Cluster object for set:RICH
+};
+//___________________________________________
+class AliRICHRecHit : public TObject {
+public:
+ Float_t Theta ; //Incidence Angle theta
+ Float_t Phi ; //Incidence Angle phi
+ Float_t Omega; //Cherenkov angle omega
+ Float_t fX; //Impact coordinate x
+ Float_t fY; //Impact coordinate y
+ public:
+ AliRICHRecHit() {
+ Theta=Phi=Omega=0;
+ }
+ AliRICHRecHit(Int_t id, Float_t* rechit);
+ virtual ~AliRICHRecHit() {}
+ ClassDef(AliRICHRecHit,1) //Reconstructed hit object for set:RICH
+};
+
+#endif