/*
$Log$
+ Revision 1.13 2001/11/06 18:29:36 dibari
+ minor correcttion of Taligent rules
+
+ Revision 1.12 2001/09/07 08:38:10 hristov
+ Pointers initialised to 0 in the default constructors
+
+ Revision 1.11 2001/05/10 12:35:39 jbarbosa
+ Update.
+
+ Revision 1.10 2001/02/23 17:21:17 jbarbosa
+ Re-definition of IntPH() to accomodate for wire sag effect.
+
+ Revision 1.9 2001/02/13 20:15:34 jbarbosa
+ Removed fNsec (number of cathodes - obsolete) related loops and calls.
+
+ Revision 1.8 2000/12/18 17:45:43 jbarbosa
+ Cleaned up PadHits object.
+
+ Revision 1.7 2000/10/03 21:44:09 morsch
+ Use AliSegmentation and AliHit abstract base classes.
+
+ Revision 1.6 2000/10/02 15:44:37 jbarbosa
+ Fixed forward declarations.
+
+ Revision 1.5 2000/07/13 16:19:45 fca
+ Mainly coding conventions + some small bug fixes
+
+ Revision 1.4 2000/06/30 16:48:58 dibari
+ New function GenerateTresholds() for pedestal simulation.
+
+ Revision 1.3 2000/06/12 15:17:58 jbarbosa
+ Cleaned up version.
+
+ Revision 1.2 2000/05/18 13:45:57 jbarbosa
+ Fixed feedback photon origin coordinates
+
+ Revision 1.1 2000/04/19 12:57:20 morsch
+ Newly structured and updated version (JB, AM)
+
*/
#include "AliRICHChamber.h"
-#include "AliRun.h"
+
#include <TLorentzVector.h>
#include <TParticle.h>
#include <TRandom.h>
+#include <TObjArray.h>
+#include <TRotMatrix.h>
+#include <AliRICHTresholdMap.h>
+#include <AliSegmentation.h>
+#include <AliRICHSegmentationV0.h>
+#include <AliRICHGeometry.h>
+#include <AliRICHResponse.h>
ClassImp(AliRICHChamber)
AliRICHChamber::AliRICHChamber()
{
- fSegmentation = 0;
- fResponse= 0;
- fGeometry= 0;
- frMin=0.1;
- frMax=140;
- fnsec=1;
-}
-
-//
-// Get reference to response model
-AliRICHResponse* AliRICHChamber::GetResponseModel()
-{
- return fResponse;
-}
-
-// Configure response model
-void AliRICHChamber::ResponseModel(AliRICHResponse* thisResponse)
-{
- fResponse=thisResponse;
-}
+// default ctor
-void AliRICHChamber::Init()
-{
- fSegmentation->Init(this);
+ fpRotMatrix = 0;
+ fSegmentation = 0;
+ fResponse = 0;
+ fGeometry = 0;
+ fReconstruction = 0;
+ fTresh = 0;
+ frMin = 0.1;
+ frMax = 140;
+ for(Int_t i=0; i<50; ++i) fIndexMap[i] = 0;
}
void AliRICHChamber::LocaltoGlobal(Float_t pos[3],Float_t Globalpos[3])
{
-
- Double_t *fMatrix;
- fMatrix = fChamberMatrix->GetMatrix();
- Globalpos[0]=pos[0]*fMatrix[0]+pos[1]*fMatrix[3]+pos[2]*fMatrix[6];
- Globalpos[1]=pos[0]*fMatrix[1]+pos[1]*fMatrix[4]+pos[2]*fMatrix[7];
- Globalpos[2]=pos[0]*fMatrix[2]+pos[1]*fMatrix[5]+pos[2]*fMatrix[8];
- Globalpos[0]+=fChamberTrans[0];
- Globalpos[1]+=fChamberTrans[1];
- Globalpos[2]+=fChamberTrans[2];
+// Local coordinates to global coordinates transformation
+
+ Double_t *pMatrix;
+ pMatrix = fpRotMatrix->GetMatrix();
+ Globalpos[0]=pos[0]*pMatrix[0]+pos[1]*pMatrix[3]+pos[2]*pMatrix[6];
+ Globalpos[1]=pos[0]*pMatrix[1]+pos[1]*pMatrix[4]+pos[2]*pMatrix[7];
+ Globalpos[2]=pos[0]*pMatrix[2]+pos[1]*pMatrix[5]+pos[2]*pMatrix[8];
+ Globalpos[0]+=fX;
+ Globalpos[1]+=fY;
+ Globalpos[2]+=fZ;
}
void AliRICHChamber::GlobaltoLocal(Float_t pos[3],Float_t Localpos[3])
{
-
- Double_t *fMatrixOrig;
- TMatrix fMatrixCopy(3,3);
- fMatrixOrig = fChamberMatrix->GetMatrix();
+//
+// Global coordinates to local coordinates transformation
+//
+ TMatrix matrixCopy(3,3);
+ Double_t *pMatrixOrig = fpRotMatrix->GetMatrix();
for(Int_t i=0;i<3;i++)
{
for(Int_t j=0;j<3;j++)
- fMatrixCopy(j,i)=fMatrixOrig[j+3*i];
+ matrixCopy(j,i)=pMatrixOrig[j+3*i];
}
- fMatrixCopy.Invert();
- //Int_t elements=fMatrixCopy.GetNoElements();
- //printf("Elements:%d\n",elements);
- //fMatrixOrig= (Double_t*) fMatrixCopy;
- Localpos[0] = pos[0] - fChamberTrans[0];
- Localpos[1] = pos[1] - fChamberTrans[1];
- Localpos[2] = pos[2] - fChamberTrans[2];
- //printf("r1:%f, r2:%f, r3:%f\n",Localpos[0],Localpos[1],Localpos[2]);
- //printf("t1:%f t2:%f t3:%f\n",fChamberTrans[0],fChamberTrans[1],fChamberTrans[2]);
- Localpos[0]=Localpos[0]*fMatrixCopy(0,0)+Localpos[1]*fMatrixCopy(0,1)+Localpos[2]*fMatrixCopy(0,2);
- Localpos[1]=Localpos[0]*fMatrixCopy(1,0)+Localpos[1]*fMatrixCopy(1,1)+Localpos[2]*fMatrixCopy(1,2);
- Localpos[2]=Localpos[0]*fMatrixCopy(2,0)+Localpos[1]*fMatrixCopy(2,1)+Localpos[2]*fMatrixCopy(2,2);
- //Localpos[0]-=fChamberTrans[0];
- //Localpos[1]-=fChamberTrans[1];
- //Localpos[2]-=fChamberTrans[2];
+ matrixCopy.Invert();
+ Localpos[0] = pos[0] - fX;
+ Localpos[1] = pos[1] - fY;
+ Localpos[2] = pos[2] - fZ;
+ Localpos[0]=Localpos[0]*matrixCopy(0,0)+Localpos[1]*matrixCopy(0,1)+Localpos[2]*matrixCopy(0,2);
+ Localpos[1]=Localpos[0]*matrixCopy(1,0)+Localpos[1]*matrixCopy(1,1)+Localpos[2]*matrixCopy(1,2);
+ Localpos[2]=Localpos[0]*matrixCopy(2,0)+Localpos[1]*matrixCopy(2,1)+Localpos[2]*matrixCopy(2,2);
}
-
void AliRICHChamber::DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit,
- Int_t& nnew,Float_t newclust[6][500],Response_t res)
+ Int_t& nnew,Float_t newclust[5][500],ResponseType res)
{
//
// Generates pad hits (simulated cluster)
local[0]=xhit;
// z-position of the wires relative to the RICH mother volume
// (2 mmm before CsI) old value: 6.076
- local[1]=1.276 + fGeometry->GetGapThickness()/2 + fGeometry->GetProximityGapThickness() - .39;
+ local[1]=1.276 + fGeometry->GetGapThickness()/2 - .2;
//printf("AliRICHChamber feedback origin:%f",local[1]);
local[2]=yhit;
LocaltoGlobal(local,global);
- Int_t Nfp=0;
+ Int_t nFp=0;
- if (res==mip) {
- qtot = fResponse->IntPH(eloss);
- Nfp = fResponse->FeedBackPhotons(global,qtot);
- } else if (res==cerenkov) {
- qtot = fResponse->IntPH();
- Nfp = fResponse->FeedBackPhotons(global,qtot);
+
+ // To calculate wire sag, the origin of y-position must be the middle of the photcathode
+ AliRICHSegmentationV0* segmentation = (AliRICHSegmentationV0*) GetSegmentationModel();
+ Float_t newy;
+ if (yhit>0)
+ newy = yhit - segmentation->GetPadPlaneLength()/2;
+ else
+ newy = yhit + segmentation->GetPadPlaneLength()/2;
+
+ if (res==kMip) {
+ qtot = fResponse->IntPH(eloss, newy);
+ nFp = fResponse->FeedBackPhotons(global,qtot);
+ //printf("feedbacks:%d\n",nFp);
+ } else if (res==kCerenkov) {
+ qtot = fResponse->IntPH(newy);
+ nFp = fResponse->FeedBackPhotons(global,qtot);
+ //printf("feedbacks:%d\n",nFp);
}
- //printf("Feedbacks:%d\n",Nfp);
+ //printf("Feedbacks:%d\n",nFp);
//
// Loop Over Pads
Float_t qcheck=0, qp=0;
nnew=0;
- for (Int_t i=1; i<=fnsec; i++) {
- qcheck=0;
- for (fSegmentation->FirstPad(xhit, yhit, dx, dy);
- fSegmentation->MorePads();
- fSegmentation->NextPad())
- {
- qp= fResponse->IntXY(fSegmentation);
- qp= TMath::Abs(qp);
-
- //printf("Qp:%f\n",qp);
-
- if (qp > 1.e-4) {
- qcheck+=qp;
- //
- // --- store signal information
- newclust[0][nnew]=qtot;
- newclust[1][nnew]=fSegmentation->Ix();
- newclust[2][nnew]=fSegmentation->Iy();
- newclust[3][nnew]=qp * qtot;
- newclust[4][nnew]=fSegmentation->ISector();
- newclust[5][nnew]=(Float_t) i;
- nnew++;
- //printf("Newcluster:%d\n",i);
- }
- } // Pad loop
- } // Cathode plane loop
+ for (fSegmentation->FirstPad(xhit, yhit, 0, dx, dy);
+ fSegmentation->MorePads();
+ fSegmentation->NextPad())
+ {
+ qp= fResponse->IntXY(fSegmentation);
+ qp= TMath::Abs(qp);
+
+ //printf("Qp:%f Qtot %f\n",qp,qtot);
+
+ if (qp > 1.e-4) {
+ qcheck+=qp;
+ //
+ // --- store signal information
+ newclust[0][nnew]=qp*qtot;
+ newclust[1][nnew]=fSegmentation->Ix();
+ newclust[2][nnew]=fSegmentation->Iy();
+ newclust[3][nnew]=fSegmentation->ISector();
+ nnew++;
+ //printf("Newcluster:%d\n",i);
+ }
+ } // Pad loop
//if (fSegmentation->ISector()==2)
//printf("Nnew:%d\n\n\n\n",nnew);
}
+void AliRICHChamber::GenerateTresholds()
+{
+
+// Generates random treshold charges for all pads
+
+ //printf("Pads : %dx%d\n",fSegmentation->Npx(),fSegmentation->Npy());
+
+ Int_t nx = fSegmentation->Npx();
+ Int_t ny = fSegmentation->Npy();
+
+ //Int_t size=nx*ny;
+
+ //printf("Size:%d\n",size);
+
+ fTresh = new AliRICHTresholdMap(fSegmentation);
+
+ //printf("Generating tresholds...\n");
+
+ for(Int_t i=-nx/2;i<nx/2;i++)
+ {
+ for(Int_t j=-ny/2;j<ny/2;j++)
+ {
+ Int_t pedestal = (Int_t)(gRandom->Gaus(50, 10));
+ //Int_t pedestal =0;
+ fTresh->SetHit(i,j,pedestal);
+ //printf("Pad %d %d has pedestal %d.\n",i,j,pedestal);
+ }
+ }
+
+}