]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Cleaned up version.
authorjbarbosa <jbarbosa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Jun 2000 15:38:55 +0000 (15:38 +0000)
committerjbarbosa <jbarbosa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Jun 2000 15:38:55 +0000 (15:38 +0000)
55 files changed:
RICH/AliRICH.cxx
RICH/AliRICH.h
RICH/AliRICHCerenkov.cxx [new file with mode: 0644]
RICH/AliRICHCerenkov.h [new file with mode: 0644]
RICH/AliRICHChamber.cxx
RICH/AliRICHChamber.h
RICH/AliRICHClusterFinder.cxx
RICH/AliRICHClusterFinder.h
RICH/AliRICHDetect.cxx
RICH/AliRICHDetect.h
RICH/AliRICHDigit.cxx [new file with mode: 0644]
RICH/AliRICHDigit.h [new file with mode: 0644]
RICH/AliRICHDisplay.cxx
RICH/AliRICHDisplay.h
RICH/AliRICHEllipse.cxx [new file with mode: 0644]
RICH/AliRICHEllipse.h [new file with mode: 0644]
RICH/AliRICHGeometry.cxx [new file with mode: 0644]
RICH/AliRICHGeometry.h [new file with mode: 0644]
RICH/AliRICHHit.cxx [new file with mode: 0644]
RICH/AliRICHHit.h [new file with mode: 0644]
RICH/AliRICHHitMap.cxx
RICH/AliRICHHitMap.h
RICH/AliRICHHitMapA1.cxx [new file with mode: 0644]
RICH/AliRICHHitMapA1.h [new file with mode: 0644]
RICH/AliRICHPadHit.cxx [new file with mode: 0644]
RICH/AliRICHPadHit.h [new file with mode: 0644]
RICH/AliRICHPatRec.cxx
RICH/AliRICHPatRec.h
RICH/AliRICHPoints.cxx
RICH/AliRICHPoints.h
RICH/AliRICHRawCluster.cxx [new file with mode: 0644]
RICH/AliRICHRawCluster.h [new file with mode: 0644]
RICH/AliRICHRecHit.cxx [new file with mode: 0644]
RICH/AliRICHRecHit.h [new file with mode: 0644]
RICH/AliRICHResponse.cxx [new file with mode: 0644]
RICH/AliRICHResponse.h [new file with mode: 0644]
RICH/AliRICHResponseV0.cxx [new file with mode: 0644]
RICH/AliRICHResponseV0.h [new file with mode: 0644]
RICH/AliRICHSegmentation.cxx [new file with mode: 0644]
RICH/AliRICHSegmentation.h [new file with mode: 0644]
RICH/AliRICHSegmentationV0.cxx [new file with mode: 0644]
RICH/AliRICHSegmentationV0.h [new file with mode: 0644]
RICH/AliRICHSegmentationV1.cxx [new file with mode: 0644]
RICH/AliRICHSegmentationV1.h [new file with mode: 0644]
RICH/AliRICHTransientDigit.cxx [new file with mode: 0644]
RICH/AliRICHTransientDigit.h [new file with mode: 0644]
RICH/AliRICHv0.cxx
RICH/AliRICHv0.h
RICH/AliRICHv1.cxx
RICH/AliRICHv1.h
RICH/Config.C
RICH/Makefile
RICH/RICHLinkDef.h
RICH/RICHdigit.C
RICH/RICHpadtest.C

index 93be72de2b50f21dbace8d82dcfca5d85d6b8a56..a4451541474aa57c0944736ed0575fa00a050d08 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
   $Log$
+  Revision 1.17  2000/06/09 14:58:37  jbarbosa
+  New digitisation per particle type
+
   Revision 1.16  2000/04/19 12:55:43  morsch
   Newly structured and updated version (JB, AM)
 
 #include <TVector.h>
 #include <TObjArray.h>
 #include <TArrayF.h>
+#include <TFile.h>
+#include <TParticle.h>
+#include <iostream.h>
 
 #include "AliRICH.h"
-#include "AliRICHHitMap.h"
+#include "AliRICHSegmentation.h"
+#include "AliRICHHit.h"
+#include "AliRICHCerenkov.h"
+#include "AliRICHPadHit.h"
+#include "AliRICHDigit.h"
+#include "AliRICHTransientDigit.h"
+#include "AliRICHRawCluster.h"
+#include "AliRICHRecHit.h"
+#include "AliRICHHitMapA1.h"
 #include "AliRICHClusterFinder.h"
 #include "AliRun.h"
 #include "AliMC.h"
 #include "AliPoints.h"
-#include "iostream.h"
 #include "AliCallf77.h" 
-#include "TParticle.h"
+
 
 // Static variables for the pad-hit iterator routines
 static Int_t sMaxIterPad=0;
@@ -56,6 +69,8 @@ ClassImp(AliRICH)
 //___________________________________________
 AliRICH::AliRICH()
 {
+// Default constructor for RICH manager class
+
     fIshunt     = 0;
     fHits       = 0;
     fPadHits    = 0;
@@ -86,32 +101,32 @@ AliRICH::AliRICH(const char *name, const char *title)
     fNcerenkovs = 0;
     fIshunt     = 0;
     
-    fNdch      = new Int_t[7];
+    fNdch      = new Int_t[kNCH];
     
-    fDchambers = new TObjArray(7);
+    fDchambers = new TObjArray(kNCH);
 
-    fRecHits = new TObjArray(7);
+    fRecHits = new TObjArray(kNCH);
     
     Int_t i;
    
-    for (i=0; i<7 ;i++) {
+    for (i=0; i<kNCH ;i++) {
        (*fDchambers)[i] = new TClonesArray("AliRICHDigit",10000); 
        fNdch[i]=0;
     }
 
-    fNrawch      = new Int_t[7];
+    fNrawch      = new Int_t[kNCH];
     
-    fRawClusters = new TObjArray(7);
+    fRawClusters = new TObjArray(kNCH);
     //printf("Created fRwClusters with adress:%p",fRawClusters);
 
-    for (i=0; i<7 ;i++) {
+    for (i=0; i<kNCH ;i++) {
       (*fRawClusters)[i] = new TClonesArray("AliRICHRawCluster",10000); 
       fNrawch[i]=0;
     }
 
-    fNrechits      = new Int_t[7];
+    fNrechits      = new Int_t[kNCH];
     
-    for (i=0; i<7 ;i++) {
+    for (i=0; i<kNCH ;i++) {
        (*fRecHits)[i] = new TClonesArray("AliRICHRecHit",1000); 
     }
     //printf("Created fRecHits with adress:%p",fRecHits);
@@ -120,9 +135,18 @@ AliRICH::AliRICH(const char *name, const char *title)
     SetMarkerColor(kRed);
 }
 
+AliRICH::AliRICH(const AliRICH& RICH)
+{
+// Copy Constructor
+}
+
+
 //___________________________________________
 AliRICH::~AliRICH()
 {
+
+// Destructor of RICH manager class
+
     fIshunt  = 0;
     delete fHits;
     delete fPadHits;
@@ -132,12 +156,22 @@ AliRICH::~AliRICH()
 //___________________________________________
 void AliRICH::AddHit(Int_t track, Int_t *vol, Float_t *hits)
 {
+
+//  
+// Adds a hit to the Hits list
+//
+
     TClonesArray &lhits = *fHits;
     new(lhits[fNhits++]) AliRICHHit(fIshunt,track,vol,hits);
 }
 //_____________________________________________________________________________
 void AliRICH::AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs)
 {
+
+//
+// Adds a RICH cerenkov hit to the Cerenkov Hits list
+//
+
     TClonesArray &lcerenkovs = *fCerenkovs;
     new(lcerenkovs[fNcerenkovs++]) AliRICHCerenkov(fIshunt,track,vol,cerenkovs);
     //printf ("Done for Cerenkov %d\n\n\n\n",fNcerenkovs);
@@ -145,15 +179,21 @@ void AliRICH::AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs)
 //___________________________________________
 void AliRICH::AddPadHit(Int_t *clhits)
 {
+
+//
+// Add a RICH pad hit to the list
+//
+
     TClonesArray &lPadHits = *fPadHits;
     new(lPadHits[fNPadHits++]) AliRICHPadHit(clhits);
 }
 //_____________________________________________________________________________
 void AliRICH::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
 {
-    //
-    // Add a RICH digit to the list
-    //
+
+  //
+  // Add a RICH digit to the list
+  //
 
     TClonesArray &ldigits = *((TClonesArray*)(*fDchambers)[id]);
     new(ldigits[fNdch[id]++]) AliRICHDigit(tracks,charges,digits);
@@ -173,9 +213,10 @@ void AliRICH::AddRawCluster(Int_t id, const AliRICHRawCluster& c)
 //_____________________________________________________________________________
 void AliRICH::AddRecHit(Int_t id, Float_t *rechit)
 {
-    //
-    // Add a RICH reconstructed hit to the list
-    //
+  
+  //
+  // Add a RICH reconstructed hit to the list
+  //
 
     TClonesArray &lrec = *((TClonesArray*)(*fRecHits)[id]);
     new(lrec[fNrechits[id]++]) AliRICHRecHit(id,rechit);
@@ -185,138 +226,142 @@ void AliRICH::AddRecHit(Int_t id, Float_t *rechit)
 void AliRICH::BuildGeometry()
     
 {
-    //
-    // Builds a TNode geometry for event display
-    //
-    TNode *Node, *Top;
+  
+  //
+  // Builds a TNode geometry for event display
+  //
+    TNode *node, *top;
     
     const int kColorRICH = kGreen;
     //
-    Top=gAlice->GetGeometry()->GetNode("alice");
+    top=gAlice->GetGeometry()->GetNode("alice");
     
     
     new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
     
-    Top->cd();
+    top->cd();
     Float_t pos1[3]={0,471.8999,165.2599};
     //Chamber(0).SetChamberTransform(pos1[0],pos1[1],pos1[2],
     new TRotMatrix("rot993","rot993",90,0,70.69,90,19.30999,-90);
-    Node = new TNode("RICH1","RICH1","S_RICH",pos1[0],pos1[1],pos1[2],"rot993");
+    node = new TNode("RICH1","RICH1","S_RICH",pos1[0],pos1[1],pos1[2],"rot993");
     
 
-    Node->SetLineColor(kColorRICH);
-    fNodes->Add(Node);
-    Top->cd();
+    node->SetLineColor(kColorRICH);
+    fNodes->Add(node);
+    top->cd();
     
     Float_t pos2[3]={171,470,0};
     //Chamber(1).SetChamberTransform(pos2[0],pos2[1],pos2[2],
     new TRotMatrix("rot994","rot994",90,-20,90,70,0,0);
-    Node = new TNode("RICH2","RICH2","S_RICH",pos2[0],pos2[1],pos2[2],"rot994");
+    node = new TNode("RICH2","RICH2","S_RICH",pos2[0],pos2[1],pos2[2],"rot994");
     
     
-    Node->SetLineColor(kColorRICH);
-    fNodes->Add(Node);
-    Top->cd();
+    node->SetLineColor(kColorRICH);
+    fNodes->Add(node);
+    top->cd();
     Float_t pos3[3]={0,500,0};
     //Chamber(2).SetChamberTransform(pos3[0],pos3[1],pos3[2],
     new TRotMatrix("rot995","rot995",90,0,90,90,0,0);
-    Node = new TNode("RICH3","RICH3","S_RICH",pos3[0],pos3[1],pos3[2],"rot995");
+    node = new TNode("RICH3","RICH3","S_RICH",pos3[0],pos3[1],pos3[2],"rot995");
     
 
-    Node->SetLineColor(kColorRICH);
-    fNodes->Add(Node);
-    Top->cd();
+    node->SetLineColor(kColorRICH);
+    fNodes->Add(node);
+    top->cd();
     Float_t pos4[3]={-171,470,0};
     //Chamber(3).SetChamberTransform(pos4[0],pos4[1],pos4[2], 
     new TRotMatrix("rot996","rot996",90,20,90,110,0,0);  
-    Node = new TNode("RICH4","RICH4","S_RICH",pos4[0],pos4[1],pos4[2],"rot996");
+    node = new TNode("RICH4","RICH4","S_RICH",pos4[0],pos4[1],pos4[2],"rot996");
     
 
-    Node->SetLineColor(kColorRICH);
-    fNodes->Add(Node);
-    Top->cd();
+    node->SetLineColor(kColorRICH);
+    fNodes->Add(node);
+    top->cd();
     Float_t pos5[3]={161.3999,443.3999,-165.3};
     //Chamber(4).SetChamberTransform(pos5[0],pos5[1],pos5[2],
     new TRotMatrix("rot997","rot997",90,340,108.1999,70,18.2,70);
-    Node = new TNode("RICH5","RICH5","S_RICH",pos5[0],pos5[1],pos5[2],"rot997");
+    node = new TNode("RICH5","RICH5","S_RICH",pos5[0],pos5[1],pos5[2],"rot997");
     
-    Node->SetLineColor(kColorRICH);
-    fNodes->Add(Node);
-    Top->cd();
+    node->SetLineColor(kColorRICH);
+    fNodes->Add(node);
+    top->cd();
     Float_t pos6[3]={0., 471.9, -165.3,};
     //Chamber(5).SetChamberTransform(pos6[0],pos6[1],pos6[2],
     new TRotMatrix("rot998","rot998",90,0,109.3099,90,19.30999,90);
-    Node = new TNode("RICH6","RICH6","S_RICH",pos6[0],pos6[1],pos6[2],"rot998");
+    node = new TNode("RICH6","RICH6","S_RICH",pos6[0],pos6[1],pos6[2],"rot998");
     
     
-    Node->SetLineColor(kColorRICH);
-    fNodes->Add(Node);
-    Top->cd();
+    node->SetLineColor(kColorRICH);
+    fNodes->Add(node);
+    top->cd();
     Float_t pos7[3]={-161.399,443.3999,-165.3};
     //Chamber(6).SetChamberTransform(pos7[0],pos7[1],pos7[2],
     new TRotMatrix("rot999","rot999",90,20,108.1999,110,18.2,110);
-    Node = new TNode("RICH7","RICH7","S_RICH",pos7[0],pos7[1],pos7[2],"rot999");
-    Node->SetLineColor(kColorRICH);
-    fNodes->Add(Node); 
+    node = new TNode("RICH7","RICH7","S_RICH",pos7[0],pos7[1],pos7[2],"rot999");
+    node->SetLineColor(kColorRICH);
+    fNodes->Add(node); 
     
 }
 
 //___________________________________________
 Int_t AliRICH::DistancetoPrimitive(Int_t , Int_t )
 {
+
+// Default value
+
     return 9999;
 }
 
 //___________________________________________
 void AliRICH::MakeBranch(Option_t* option)
 {
-    // Create Tree branches for the RICH.
+  // Create Tree branches for the RICH.
     
-    const Int_t buffersize = 4000;
+    const Int_t kBufferSize = 4000;
     char branchname[20];
     
     
     AliDetector::MakeBranch(option);
     sprintf(branchname,"%sCerenkov",GetName());
     if (fCerenkovs   && gAlice->TreeH()) {
-       gAlice->TreeH()->Branch(branchname,&fCerenkovs, buffersize);
+       gAlice->TreeH()->Branch(branchname,&fCerenkovs, kBufferSize);
        printf("Making Branch %s for Cerenkov Hits\n",branchname);
     }
     
     sprintf(branchname,"%sPadHits",GetName());
     if (fPadHits   && gAlice->TreeH()) {
-       gAlice->TreeH()->Branch(branchname,&fPadHits, buffersize);
+       gAlice->TreeH()->Branch(branchname,&fPadHits, kBufferSize);
        printf("Making Branch %s for PadHits\n",branchname);
     }
     
 // one branch for digits per chamber
     Int_t i;
     
-    for (i=0; i<7 ;i++) {
+    for (i=0; i<kNCH ;i++) {
        sprintf(branchname,"%sDigits%d",GetName(),i+1);
        
        if (fDchambers   && gAlice->TreeD()) {
-           gAlice->TreeD()->Branch(branchname,&((*fDchambers)[i]), buffersize);
+           gAlice->TreeD()->Branch(branchname,&((*fDchambers)[i]), kBufferSize);
            printf("Making Branch %s for digits in chamber %d\n",branchname,i+1);
        }       
     }
 
 // one branch for raw clusters per chamber
-  for (i=0; i<7 ;i++) {
+  for (i=0; i<kNCH ;i++) {
       sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
       
       if (fRawClusters   && gAlice->TreeR()) {
-        gAlice->TreeR()->Branch(branchname,&((*fRawClusters)[i]), buffersize);
+        gAlice->TreeR()->Branch(branchname,&((*fRawClusters)[i]), kBufferSize);
         printf("Making Branch %s for raw clusters in chamber %d\n",branchname,i+1);
       }        
   }
 
   // one branch for rec hits per chamber
-  for (i=0; i<7 ;i++) {
+  for (i=0; i<kNCH ;i++) {
     sprintf(branchname,"%sRecHits%d",GetName(),i+1);
     
     if (fRecHits   && gAlice->TreeR()) {
-      gAlice->TreeR()->Branch(branchname,&((*fRecHits)[i]), buffersize);
+      gAlice->TreeR()->Branch(branchname,&((*fRecHits)[i]), kBufferSize);
       printf("Making Branch %s for rec. hits in chamber %d\n",branchname,i+1);
     }  
   }
@@ -325,7 +370,7 @@ void AliRICH::MakeBranch(Option_t* option)
 //___________________________________________
 void AliRICH::SetTreeAddress()
 {
-    // Set branch address for the Hits and Digits Tree.
+  // Set branch address for the Hits and Digits Tree.
   char branchname[20];
   Int_t i;
 
@@ -348,7 +393,7 @@ void AliRICH::SetTreeAddress()
     }
     
     if (treeD) {
-       for (int i=0; i<7; i++) {
+       for (int i=0; i<kNCH; i++) {
            sprintf(branchname,"%sDigits%d",GetName(),i+1);
            if (fDchambers) {
                branch = treeD->GetBranch(branchname);
@@ -357,7 +402,7 @@ void AliRICH::SetTreeAddress()
        }
     }
   if (treeR) {
-      for (i=0; i<7; i++) {
+      for (i=0; i<kNCH; i++) {
          sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
          if (fRawClusters) {
              branch = treeR->GetBranch(branchname);
@@ -365,7 +410,7 @@ void AliRICH::SetTreeAddress()
          }
       }
       
-      for (i=0; i<7; i++) {
+      for (i=0; i<kNCH; i++) {
        sprintf(branchname,"%sRecHits%d",GetName(),i+1);
        if (fRecHits) {
          branch = treeR->GetBranch(branchname);
@@ -378,7 +423,7 @@ void AliRICH::SetTreeAddress()
 //___________________________________________
 void AliRICH::ResetHits()
 {
-    // Reset number of clusters and the cluster array for this detector
+  // Reset number of clusters and the cluster array for this detector
     AliDetector::ResetHits();
     fNPadHits   = 0;
     fNcerenkovs = 0;
@@ -390,10 +435,10 @@ void AliRICH::ResetHits()
 //____________________________________________
 void AliRICH::ResetDigits()
 {
-    //
-    // Reset number of digits and the digits array for this detector
-    //
-    for ( int i=0;i<7;i++ ) {
+  //
+  // Reset number of digits and the digits array for this detector
+  //
+    for ( int i=0;i<kNCH;i++ ) {
        if ((*fDchambers)[i])   (*fDchambers)[i]->Clear();
        if (fNdch)  fNdch[i]=0;
     }
@@ -402,10 +447,10 @@ void AliRICH::ResetDigits()
 //____________________________________________
 void AliRICH::ResetRawClusters()
 {
-    //
-    // Reset number of raw clusters and the raw clust array for this detector
-    //
-    for ( int i=0;i<7;i++ ) {
+  //
+  // Reset number of raw clusters and the raw clust array for this detector
+  //
+    for ( int i=0;i<kNCH;i++ ) {
        if ((*fRawClusters)[i])    ((TClonesArray*)(*fRawClusters)[i])->Clear();
        if (fNrawch)  fNrawch[i]=0;
     }
@@ -414,11 +459,11 @@ void AliRICH::ResetRawClusters()
 //____________________________________________
 void AliRICH::ResetRecHits()
 {
-    //
-    // Reset number of raw clusters and the raw clust array for this detector
-    //
+  //
+  // Reset number of raw clusters and the raw clust array for this detector
+  //
   
-  for ( int i=0;i<7;i++ ) {
+  for ( int i=0;i<kNCH;i++ ) {
        if ((*fRecHits)[i])    ((TClonesArray*)(*fRecHits)[i])->Clear();
        if (fNrechits)  fNrechits[i]=0;
     }
@@ -427,28 +472,54 @@ void AliRICH::ResetRecHits()
 //___________________________________________
 void   AliRICH::SetGeometryModel(Int_t id, AliRICHGeometry *geometry)
 {
+
+//
+// Setter for the RICH geometry model
+//
+
+
     ((AliRICHChamber*) (*fChambers)[id])->GeometryModel(geometry);
 }
 
 //___________________________________________
 void   AliRICH::SetSegmentationModel(Int_t id, AliRICHSegmentation *segmentation)
 {
+
+//
+// Setter for the RICH segmentation model
+//
+
     ((AliRICHChamber*) (*fChambers)[id])->SegmentationModel(segmentation);
 }
 
 //___________________________________________
 void   AliRICH::SetResponseModel(Int_t id, AliRICHResponse *response)
 {
+
+//
+// Setter for the RICH response model
+//
+
     ((AliRICHChamber*) (*fChambers)[id])->ResponseModel(response);
 }
 
 void   AliRICH::SetReconstructionModel(Int_t id, AliRICHClusterFinder *reconst)
 {
+
+//
+// Setter for the RICH reconstruction model (clusters)
+//
+
     ((AliRICHChamber*) (*fChambers)[id])->ReconstructionModel(reconst);
 }
 
 void   AliRICH::SetNsec(Int_t id, Int_t nsec)
 {
+
+//
+// Sets the number of padplanes
+//
+
     ((AliRICHChamber*) (*fChambers)[id])->SetNsec(nsec);
 }
 
@@ -457,9 +528,12 @@ void   AliRICH::SetNsec(Int_t id, Int_t nsec)
 
 void AliRICH::StepManager()
 {
+
+// Dummy step manager (should never be called)
+
 }
 
-void AliRICH::FindClusters(Int_t nev,Int_t last_entry)
+void AliRICH::FindClusters(Int_t nev,Int_t lastEntry)
 {
 
 //
@@ -468,10 +542,10 @@ void AliRICH::FindClusters(Int_t nev,Int_t last_entry)
     for (Int_t icat=1;icat<2;icat++) {
        gAlice->ResetDigits();
        gAlice->TreeD()->GetEvent(1); // spurious +1 ...
-       for (Int_t ich=0;ich<7;ich++) {
+       for (Int_t ich=0;ich<kNCH;ich++) {
          AliRICHChamber* iChamber=(AliRICHChamber*) (*fChambers)[ich];
-         TClonesArray *RICHdigits  = this->DigitsAddress(ich);
-         if (RICHdigits == 0)        
+         TClonesArray *pRICHdigits  = this->DigitsAddress(ich);
+         if (pRICHdigits == 0)       
              continue;
          //
          // Get ready the current chamber stuff
@@ -482,7 +556,7 @@ void AliRICH::FindClusters(Int_t nev,Int_t last_entry)
          if (seg) {      
              rec->SetSegmentation(seg);
              rec->SetResponse(response);
-             rec->SetDigits(RICHdigits);
+             rec->SetDigits(pRICHdigits);
              rec->SetChamber(ich);
              if (nev==0) rec->CalibrateCOG(); 
              rec->FindRawClusters();
@@ -494,7 +568,7 @@ void AliRICH::FindClusters(Int_t nev,Int_t last_entry)
 
        gAlice->TreeR()->Fill();
        TClonesArray *fRch;
-       for (int i=0;i<7;i++) {
+       for (int i=0;i<kNCH;i++) {
            fRch=RawClustAddress(i);
            int nraw=fRch->GetEntriesFast();
            printf ("Chamber %d, raw clusters %d\n",i,nraw);
@@ -540,7 +614,7 @@ void AliRICH::Streamer(TBuffer &R__b)
 //
        R__b >> fChambers;
 // Stream chamber related information
-       for (Int_t i =0; i<7; i++) {
+       for (Int_t i =0; i<kNCH; i++) {
            iChamber=(AliRICHChamber*) (*fChambers)[i];
            iChamber->Streamer(R__b);
            segmentation=iChamber->GetSegmentationModel();
@@ -565,13 +639,13 @@ void AliRICH::Streamer(TBuffer &R__b)
        R__b << fDchambers;
        R__b << fRawClusters;
        R__b << fRecHits; //diff
-       R__b.WriteArray(fNdch, 7);
-       R__b.WriteArray(fNrawch, 7);
-       R__b.WriteArray(fNrechits, 7);
+       R__b.WriteArray(fNdch, kNCH);
+       R__b.WriteArray(fNrawch, kNCH);
+       R__b.WriteArray(fNrechits, kNCH);
        //
        R__b << fChambers;
 //  Stream chamber related information
-       for (Int_t i =0; i<7; i++) {
+       for (Int_t i =0; i<kNCH; i++) {
            iChamber=(AliRICHChamber*) (*fChambers)[i];
            iChamber->Streamer(R__b);
            segmentation=iChamber->GetSegmentationModel();
@@ -606,6 +680,9 @@ AliRICHPadHit* AliRICH::FirstPad(AliRICHHit*  hit,TClonesArray *clusters )
 
 AliRICHPadHit* AliRICH::NextPad(TClonesArray *clusters) 
 {
+
+  // Iterates over pads
+  
     sCurIterPad++;
     if (sCurIterPad <= sMaxIterPad) {
        return (AliRICHPadHit*) clusters->UncheckedAt(sCurIterPad-1);
@@ -621,8 +698,8 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
     // background when add! otherwise the track info for signal will be lost !
 
     static Bool_t first=kTRUE;
-    static TFile *File;
-    char *Add = strstr(option,"Add");
+    static TFile *pFile;
+    char *addBackground = strstr(option,"Add");
 
     FILE* points; //these will be the digits...
 
@@ -635,25 +712,25 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
     Int_t trk[50];
     Int_t chtrk[50];  
     TObjArray *list=new TObjArray;
-    static TClonesArray *p_adr=0;
-    if(!p_adr) p_adr=new TClonesArray("TVector",1000);
+    static TClonesArray *pAddress=0;
+    if(!pAddress) pAddress=new TClonesArray("TVector",1000);
     Int_t digits[5]; 
     
-    AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH");
-    AliRICHHitMap* HitMap[10];
+    AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
+    AliRICHHitMap* pHitMap[10];
     Int_t i;
-    for (i=0; i<10; i++) {HitMap[i]=0;}
-    if (Add ) {
+    for (i=0; i<10; i++) {pHitMap[i]=0;}
+    if (addBackground ) {
        if(first) {
            fFileName=filename;
            cout<<"filename"<<fFileName<<endl;
-           File=new TFile(fFileName);
+           pFile=new TFile(fFileName);
            cout<<"I have opened "<<fFileName<<" file "<<endl;
            fHits2     = new TClonesArray("AliRICHHit",1000  );
            fClusters2 = new TClonesArray("AliRICHPadHit",10000);
            first=kFALSE;
        }
-       File->cd();
+       pFile->cd();
        // Get Hits Tree header from file
        if(fHits2) fHits2->Clear();
        if(fClusters2) fClusters2->Clear();
@@ -686,36 +763,36 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
     Int_t countadr=0;
     for (int icat=0; icat<1; icat++) { 
        Int_t counter=0;
-       for (i =0; i<7; i++) {
+       for (i =0; i<kNCH; i++) {
            iChamber=(AliRICHChamber*) (*fChambers)[i];
            if (iChamber->Nsec()==1 && icat==1) {
                continue;
            } else {
                segmentation=iChamber->GetSegmentationModel(icat+1);
            }
-           HitMap[i] = new AliRICHHitMapA1(segmentation, list);
+           pHitMap[i] = new AliRICHHitMapA1(segmentation, list);
        }
 //
 //   Loop over tracks
 //
 
-       TTree *TH = gAlice->TreeH();
-       Int_t ntracks =(Int_t) TH->GetEntries();
+       TTree *treeH = gAlice->TreeH();
+       Int_t ntracks =(Int_t) treeH->GetEntries();
        for (Int_t track=0; track<ntracks; track++) {
            gAlice->ResetHits();
-           TH->GetEvent(track);
+           treeH->GetEvent(track);
 //
 //   Loop over hits
-           for(AliRICHHit* mHit=(AliRICHHit*)RICH->FirstHit(-1); 
+           for(AliRICHHit* mHit=(AliRICHHit*)pRICH->FirstHit(-1); 
                mHit;
-               mHit=(AliRICHHit*)RICH->NextHit()) 
+               mHit=(AliRICHHit*)pRICH->NextHit()) 
            {
              
              digitse=0;
              
              Int_t   nch   = mHit->fChamber-1;  // chamber number
-             if (nch >7) continue;
-             iChamber = &(RICH->Chamber(nch));
+             if (nch >kNCH) continue;
+             iChamber = &(pRICH->Chamber(nch));
              
              TParticle *current = (TParticle*)(*gAlice->Particles())[track];
              
@@ -759,9 +836,9 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
 //
 // Loop over pad hits
                  for (AliRICHPadHit* mPad=
-                        (AliRICHPadHit*)RICH->FirstPad(mHit,fPadHits);
+                        (AliRICHPadHit*)pRICH->FirstPad(mHit,fPadHits);
                       mPad;
-                      mPad=(AliRICHPadHit*)RICH->NextPad(fPadHits))
+                      mPad=(AliRICHPadHit*)pRICH->NextPad(fPadHits))
                    {
                      Int_t cathode  = mPad->fCathode;    // cathode number
                      Int_t ipx      = mPad->fPadX;       // pad number on X
@@ -774,8 +851,8 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
                      Float_t thex, they;
                      segmentation=iChamber->GetSegmentationModel(cathode);
                      segmentation->GetPadCxy(ipx,ipy,thex,they);
-                     new((*p_adr)[countadr++]) TVector(2);
-                     TVector &trinfo=*((TVector*) (*p_adr)[countadr-1]);
+                     new((*pAddress)[countadr++]) TVector(2);
+                     TVector &trinfo=*((TVector*) (*pAddress)[countadr-1]);
                      trinfo(0)=(Float_t)track;
                      trinfo(1)=(Float_t)iqpad;
                      
@@ -785,31 +862,31 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
                      
                      AliRICHTransientDigit* pdigit;
                      // build the list of fired pads and update the info
-                     if (!HitMap[nch]->TestHit(ipx, ipy)) {
+                     if (!pHitMap[nch]->TestHit(ipx, ipy)) {
                        list->AddAtAndExpand(new AliRICHTransientDigit(nch,digits),counter);
-                       HitMap[nch]->SetHit(ipx, ipy, counter);
+                       pHitMap[nch]->SetHit(ipx, ipy, counter);
                        counter++;
                        pdigit=(AliRICHTransientDigit*)list->At(list->GetLast());
                        // list of tracks
                        TObjArray *trlist=(TObjArray*)pdigit->TrackList();
                        trlist->Add(&trinfo);
                      } else {
-                       pdigit=(AliRICHTransientDigit*) HitMap[nch]->GetHit(ipx, ipy);
+                       pdigit=(AliRICHTransientDigit*) pHitMap[nch]->GetHit(ipx, ipy);
                        // update charge
                        (*pdigit).fSignal+=iqpad;
                        // update list of tracks
                        TObjArray* trlist=(TObjArray*)pdigit->TrackList();
-                       Int_t last_entry=trlist->GetLast();
-                       TVector *ptrk_p=(TVector*)trlist->At(last_entry);
-                       TVector &ptrk=*ptrk_p;
-                       Int_t last_track=Int_t(ptrk(0));
-                       Int_t last_charge=Int_t(ptrk(1));
-                       if (last_track==track) {
-                           last_charge+=iqpad;
-                           trlist->RemoveAt(last_entry);
-                           trinfo(0)=last_track;
-                           trinfo(1)=last_charge;
-                           trlist->AddAt(&trinfo,last_entry);
+                       Int_t lastEntry=trlist->GetLast();
+                       TVector *ptrkP=(TVector*)trlist->At(lastEntry);
+                       TVector &ptrk=*ptrkP;
+                       Int_t lastTrack=Int_t(ptrk(0));
+                       Int_t lastCharge=Int_t(ptrk(1));
+                       if (lastTrack==track) {
+                           lastCharge+=iqpad;
+                           trlist->RemoveAt(lastEntry);
+                           trinfo(0)=lastTrack;
+                           trinfo(1)=lastCharge;
+                           trlist->AddAt(&trinfo,lastEntry);
                        } else {
                            trlist->Add(&trinfo);
                        }
@@ -819,8 +896,8 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
                            printf("Attention - tracks:  %d (>2)\n",nptracks);
                            //printf("cat,nch,ix,iy %d %d %d %d  \n",icat+1,nch,ipx,ipy);
                            for (Int_t tr=0;tr<nptracks;tr++) {
-                               TVector *pptrk_p=(TVector*)trlist->At(tr);
-                               TVector &pptrk=*pptrk_p;
+                               TVector *pptrkP=(TVector*)trlist->At(tr);
+                               TVector &pptrk=*pptrkP;
                                trk[tr]=Int_t(pptrk(0));
                                chtrk[tr]=Int_t(pptrk(1));
                            }
@@ -833,7 +910,7 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
        
        // open the file with background
        
-       if (Add ) {
+       if (addBackground ) {
            ntracks =(Int_t)TrH1->GetEntries();
            //printf("background - icat,ntracks1  %d %d\n",icat,ntracks);
            //printf("background - Start loop over tracks \n");     
@@ -852,15 +929,15 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
                    mHit=(AliRICHHit*) (*fHits2)[j];
                    Int_t   nch   = mHit->fChamber-1;  // chamber number
                    if (nch >6) continue;
-                   iChamber = &(RICH->Chamber(nch));
+                   iChamber = &(pRICH->Chamber(nch));
                    Int_t rmin = (Int_t)iChamber->RInner();
                    Int_t rmax = (Int_t)iChamber->ROuter();
 //
 // Loop over pad hits
                    for (AliRICHPadHit* mPad=
-                            (AliRICHPadHit*)RICH->FirstPad(mHit,fClusters2);
+                            (AliRICHPadHit*)pRICH->FirstPad(mHit,fClusters2);
                         mPad;
-                        mPad=(AliRICHPadHit*)RICH->NextPad(fClusters2))
+                        mPad=(AliRICHPadHit*)pRICH->NextPad(fClusters2))
                    {
                        Int_t cathode  = mPad->fCathode;    // cathode number
                        Int_t ipx      = mPad->fPadX;       // pad number on X
@@ -874,22 +951,22 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
                        segmentation->GetPadCxy(ipx,ipy,thex,they);
                        Float_t rpad=TMath::Sqrt(thex*thex+they*they);
                        if (rpad < rmin || iqpad ==0 || rpad > rmax) continue;
-                       new((*p_adr)[countadr++]) TVector(2);
-                       TVector &trinfo=*((TVector*) (*p_adr)[countadr-1]);
+                       new((*pAddress)[countadr++]) TVector(2);
+                       TVector &trinfo=*((TVector*) (*pAddress)[countadr-1]);
                        trinfo(0)=-1;  // tag background
                        trinfo(1)=-1;
                        digits[0]=ipx;
                        digits[1]=ipy;
                        digits[2]=iqpad;
                        if (trak <4 && icat==0 && nch==0)
-                           printf("bgr - HitMap[nch]->TestHit(ipx, ipy),trak %d %d\n",
-                                  HitMap[nch]->TestHit(ipx, ipy),trak);
+                           printf("bgr - pHitMap[nch]->TestHit(ipx, ipy),trak %d %d\n",
+                                  pHitMap[nch]->TestHit(ipx, ipy),trak);
                        AliRICHTransientDigit* pdigit;
                        // build the list of fired pads and update the info
-                       if (!HitMap[nch]->TestHit(ipx, ipy)) {
+                       if (!pHitMap[nch]->TestHit(ipx, ipy)) {
                            list->AddAtAndExpand(new AliRICHTransientDigit(nch,digits),counter);
                            
-                           HitMap[nch]->SetHit(ipx, ipy, counter);
+                           pHitMap[nch]->SetHit(ipx, ipy, counter);
                            counter++;
                            printf("bgr new elem in list - counter %d\n",counter);
                            
@@ -898,16 +975,16 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
                            TObjArray *trlist=(TObjArray*)pdigit->TrackList();
                            trlist->Add(&trinfo);
                        } else {
-                           pdigit=(AliRICHTransientDigit*) HitMap[nch]->GetHit(ipx, ipy);
+                           pdigit=(AliRICHTransientDigit*) pHitMap[nch]->GetHit(ipx, ipy);
                            // update charge
                            (*pdigit).fSignal+=iqpad;
                            // update list of tracks
                            TObjArray* trlist=(TObjArray*)pdigit->TrackList();
-                           Int_t last_entry=trlist->GetLast();
-                           TVector *ptrk_p=(TVector*)trlist->At(last_entry);
-                           TVector &ptrk=*ptrk_p;
-                           Int_t last_track=Int_t(ptrk(0));
-                           if (last_track==-1) {
+                           Int_t lastEntry=trlist->GetLast();
+                           TVector *ptrkP=(TVector*)trlist->At(lastEntry);
+                           TVector &ptrk=*ptrkP;
+                           Int_t lastTrack=Int_t(ptrk(0));
+                           if (lastTrack==-1) {
                                continue;
                            } else {
                                trlist->Add(&trinfo);
@@ -916,8 +993,8 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
                            Int_t nptracks=trlist->GetEntriesFast();
                            if (nptracks > 0) {
                                for (Int_t tr=0;tr<nptracks;tr++) {
-                                   TVector *pptrk_p=(TVector*)trlist->At(tr);
-                                   TVector &pptrk=*pptrk_p;
+                                   TVector *pptrkP=(TVector*)trlist->At(tr);
+                                   TVector &pptrk=*pptrkP;
                                    trk[tr]=Int_t(pptrk(0));
                                    chtrk[tr]=Int_t(pptrk(1));
                                }
@@ -927,8 +1004,8 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
                } // hit loop
            } // track loop
            TTree *fAli=gAlice->TreeK();
-           if (fAli) File =fAli->GetCurrentFile();
-           File->cd();
+           if (fAli) pFile =fAli->GetCurrentFile();
+           pFile->cd();
        } // if Add     
        
        Int_t tracks[10];
@@ -948,9 +1025,9 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
            AliRICHResponse * response=iChamber->GetResponseModel();
            Int_t adcmax= (Int_t) response->MaxAdc();
            // add white noise and do zero-suppression and signal truncation (new electronics,old electronics gaus 1.2,0.2)
-           Float_t MeanNoise = gRandom->Gaus(1.7, 0.25);
-           Float_t Noise     = gRandom->Gaus(0, MeanNoise);
-           q+=(Int_t)Noise;
+           Float_t meanNoise = gRandom->Gaus(1.7, 0.25);
+           Float_t noise     = gRandom->Gaus(0, meanNoise);
+           q+=(Int_t)noise;
 //          magic number to be parametrised !!! 
            if ( q <= 6.8) continue;
            if ( q >= adcmax) q=adcmax;
@@ -972,8 +1049,8 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
                       //icat,ich,digits[0],digits[1],q);
            }
            for (Int_t tr=0;tr<nptracks;tr++) {
-               TVector *pp_p=(TVector*)trlist->At(tr);
-               TVector &pp  =*pp_p;
+               TVector *ppP=(TVector*)trlist->At(tr);
+               TVector &pp  =*ppP;
                tracks[tr]=Int_t(pp(0));
                charges[tr]=Int_t(pp(1));
            }      //end loop over list of tracks for one pad
@@ -988,16 +1065,16 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
              fprintf(points,"%4d,      %4d,      %4d\n",digits[0],digits[1],digits[2]);
            
            // fill digits
-           RICH->AddDigits(ich,tracks,charges,digits);
+           pRICH->AddDigits(ich,tracks,charges,digits);
        }
        gAlice->TreeD()->Fill();
 
        list->Delete();
-       for(Int_t ii=0;ii<7;++ii) {
-           if (HitMap[ii]) {
-               hm=HitMap[ii];
+       for(Int_t ii=0;ii<kNCH;++ii) {
+           if (pHitMap[ii]) {
+               hm=pHitMap[ii];
                delete hm;
-               HitMap[ii]=0;
+               pHitMap[ii]=0;
            }
        }
        
@@ -1005,12 +1082,12 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
        //Stat_t ndig=TD->GetEntries();
        //cout<<"number of digits  "<<ndig<<endl;
        TClonesArray *fDch;
-       for (int k=0;k<7;k++) {
-           fDch= RICH->DigitsAddress(k);
+       for (int k=0;k<kNCH;k++) {
+           fDch= pRICH->DigitsAddress(k);
            int ndigit=fDch->GetEntriesFast();
            printf ("Chamber %d digits %d \n",k,ndigit);
        }
-       RICH->ResetDigits();
+       pRICH->ResetDigits();
     } //end loop over cathodes
     char hname[30];
     sprintf(hname,"TreeD%d",nev);
@@ -1019,9 +1096,56 @@ void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
 // reset tree
 //    gAlice->TreeD()->Reset();
     delete list;
-    p_adr->Clear();
+    pAddress->Clear();
 // gObjectTable->Print();
 }
 
+AliRICH& AliRICH::operator=(const AliRICH& rhs)
+{
+// Assignment operator
+    return *this;
+    
+}
 
+Int_t AliRICH::MakePadHits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
+{
+//
+//  Calls the charge disintegration method of the current chamber and adds
+//  the simulated cluster to the root treee 
+//
+    Int_t clhits[kNCH];
+    Float_t newclust[6][500];
+    Int_t nnew;
+    
+//
+//  Integrated pulse height on chamber
+    
+    clhits[0]=fNhits+1;
+    
+    ((AliRICHChamber*) (*fChambers)[idvol])->DisIntegration(eloss, xhit, yhit, nnew, newclust, res);
+    Int_t ic=0;
+    
+//
+//  Add new clusters
+    for (Int_t i=0; i<nnew; i++) {
+       if (Int_t(newclust[3][i]) > 0) {
+           ic++;
+// Cathode plane
+           clhits[1] = Int_t(newclust[5][i]);
+//  Cluster Charge
+           clhits[2] = Int_t(newclust[0][i]);
+//  Pad: ix
+           clhits[3] = Int_t(newclust[1][i]);
+//  Pad: iy 
+           clhits[4] = Int_t(newclust[2][i]);
+//  Pad: charge
+           clhits[5] = Int_t(newclust[3][i]);
+//  Pad: chamber sector
+           clhits[6] = Int_t(newclust[4][i]);
+           
+           AddPadHit(clhits);
+       }
+    }
+return nnew;
+}
 
index 2724a5e38de5821e5b635707495d38fd23492844..2d8d2e9e5f730c604d8a15f620395c705306af4a 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef RICH_H
-#define RICH_H
+#ifndef ALIRICH_H
+#define ALIRICH_H
 
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 ////////////////////////////////////////////////
 #include "AliDetector.h"
 #include "AliRICHConst.h"
-#include "AliRICHSegRes.h"
-#include "DataStructures.h"
 #include "AliRICHChamber.h"
-#include "AliRICHSegRes.h"
-#include <TVector.h>
-#include <TArrayF.h>
-#include <TObjArray.h>
-#include <TFile.h>
-#include <TTree.h>
-#include <TParticle.h>
-
-static const int NCH=7;
-
+static const int kNCH=7;
 
 
+class AliRICHHit;
 class AliRICHPadHit;
 class AliRICHRawCluster;
 class AliRICHRecHit;
@@ -37,18 +27,20 @@ class AliRICHCerenkov;
 class AliRICHSegmentation;
 class AliRICHResponse;
 class AliRICHEllipse;
+class AliRICHGeometry;
 
 class AliRICH : public  AliDetector {
  public:
     AliRICH();
     AliRICH(const char *name, const char *title);
+    AliRICH(const AliRICH& RICH);
     virtual       ~AliRICH();
-    virtual void   AddHit(Int_t, Int_t*, Float_t*);
-    virtual void   AddCerenkov(Int_t, Int_t*, Float_t*);
-    virtual void   AddPadHit(Int_t*);
-    virtual void   AddDigits(Int_t, Int_t*, Int_t*, Int_t*);
-    virtual void   AddRawCluster(Int_t, const AliRICHRawCluster&);
-    virtual void   AddRecHit(Int_t, Float_t*);
+    virtual void   AddHit(Int_t track, Int_t *vol, Float_t *hits);
+    virtual void   AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs);
+    virtual void   AddPadHit(Int_t *clhits);
+    virtual void   AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits);
+    virtual void   AddRawCluster(Int_t id, const AliRICHRawCluster& cluster);
+    virtual void   AddRecHit(Int_t id, Float_t* rechit);
 
 
     virtual void   BuildGeometry();
@@ -66,7 +58,7 @@ class AliRICH : public  AliDetector {
     virtual void   ResetDigits();
     virtual void   ResetRawClusters();
     virtual void   ResetRecHits();
-    virtual void   FindClusters(Int_t,Int_t);
+    virtual void   FindClusters(Int_t nev,Int_t lastEntry);
     virtual void   Digitise(Int_t nev,Int_t flag,Option_t *opt=" ",Text_t *name=" ");
 // 
 // Configuration Methods (per station id)
@@ -81,12 +73,12 @@ class AliRICH : public  AliDetector {
 // Set Reconstruction Model
     virtual void   SetReconstructionModel(Int_t id, AliRICHClusterFinder *reconstruction);
 // Response Simulation
-    virtual Int_t   MakePadHits(Float_t xhit,Float_t yhit,Float_t eloss,Int_t id,Response_t res);
+    virtual Int_t   MakePadHits(Float_t xhit,Float_t yhit,Float_t eloss,Int_t id, ResponseType res);
 // Return reference to Chamber #id
     virtual AliRICHChamber& Chamber(Int_t id) {return *((AliRICHChamber *) (*fChambers)[id]);}
 // Retrieve pad hits for a given Hit
-    virtual AliRICHPadHit* FirstPad(AliRICHHit *, TClonesArray *);
-    virtual AliRICHPadHit* NextPad(TClonesArray *);
+    virtual AliRICHPadHit* FirstPad(AliRICHHit *hit, TClonesArray *clusters);
+    virtual AliRICHPadHit* NextPad(TClonesArray *clusters);
 // Return pointers to digits 
     TObjArray            *Dchambers() {return fDchambers;}
     Int_t                *Ndch() {return fNdch;}
@@ -97,6 +89,8 @@ class AliRICH : public  AliDetector {
     virtual TClonesArray *RecHitsAddress(Int_t id) {return ((TClonesArray *) (*fRecHits)[id]);}
 // Return pointers to reconstructed clusters
     virtual TClonesArray *RawClustAddress(Int_t id) {return ((TClonesArray *) (*fRawClusters)[id]);}    
+// Assignment operator
+    AliRICH& operator=(const AliRICH& rhs);
     
     
  protected:
diff --git a/RICH/AliRICHCerenkov.cxx b/RICH/AliRICHCerenkov.cxx
new file mode 100644 (file)
index 0000000..04407ea
--- /dev/null
@@ -0,0 +1,46 @@
+/**************************************************************************
+ * 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 "AliRICHCerenkov.h"
+
+ClassImp(AliRICHCerenkov)
+//___________________________________________
+AliRICHCerenkov::AliRICHCerenkov(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
+    AliHit(shunt, track)
+{
+// Constructor for object AliRICHCerenkov
+    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];
+    fNPads=hits[17];
+    fCerenkovAngle=hits[18];
+}
+
diff --git a/RICH/AliRICHCerenkov.h b/RICH/AliRICHCerenkov.h
new file mode 100644 (file)
index 0000000..0028967
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef ALIRICHCERENKOV_H
+#define ALIRICHCERENKOV_H
+
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+
+#include "AliHit.h"
+//------------------------------------------------
+// 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
+    Float_t   fNPads;           // Pads hit
+    Float_t   fCerenkovAngle;   // Cerenkov Angle
+ 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
+};
+#endif
index 62189ab794997c9ef0f8b988fb1ec4d480fbcf52..ae73f85f67ee1e73d7b9e333ad5231d2779e830d 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
   $Log$
+  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)
 
@@ -22,7 +25,7 @@
 
 
 #include "AliRICHChamber.h"
-#include "AliRun.h"
+
 #include <TLorentzVector.h>
 #include <TParticle.h>
 #include <TRandom.h>
@@ -31,6 +34,10 @@ ClassImp(AliRICHChamber)
     
 AliRICHChamber::AliRICHChamber() 
 {
+
+//
+// Chamber object constructor
+
     fSegmentation = 0;
     fResponse= 0;
     fGeometry= 0;
@@ -39,27 +46,36 @@ AliRICHChamber::AliRICHChamber()
     fnsec=1;
 }
 
-//  
-//  Get reference to response model
+AliRICHChamber::AliRICHChamber(const AliRICHChamber& Chamber)
+{
+// Copy Constructor
+}
+
+
 AliRICHResponse* AliRICHChamber::GetResponseModel()
 {
+//  
+//  Get reference to response model
     return fResponse;
 }
 
-// Configure response model
 void   AliRICHChamber::ResponseModel(AliRICHResponse* thisResponse)
 {
+// Configure response model
     fResponse=thisResponse;
 }
 
 void AliRICHChamber::Init()
 {
+// Initialise chambers
     fSegmentation->Init(this);
 }
 
 void AliRICHChamber::LocaltoGlobal(Float_t pos[3],Float_t Globalpos[3])
 {
 
+// Local coordinates to global coordinates transformation
+
     Double_t *fMatrix;
     fMatrix =  fChamberMatrix->GetMatrix();
     Globalpos[0]=pos[0]*fMatrix[0]+pos[1]*fMatrix[3]+pos[2]*fMatrix[6];
@@ -73,6 +89,8 @@ void AliRICHChamber::LocaltoGlobal(Float_t pos[3],Float_t Globalpos[3])
 void AliRICHChamber::GlobaltoLocal(Float_t pos[3],Float_t Localpos[3])
 {
 
+// Global coordinates to local coordinates transformation
+
     Double_t *fMatrixOrig;
     TMatrix fMatrixCopy(3,3);
     fMatrixOrig = fChamberMatrix->GetMatrix();
@@ -100,7 +118,7 @@ void AliRICHChamber::GlobaltoLocal(Float_t pos[3],Float_t Localpos[3])
 
 
 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[6][500],ResponseType res) 
 {
 //    
 //  Generates pad hits (simulated cluster) 
@@ -128,17 +146,17 @@ void AliRICHChamber::DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit,
 
     LocaltoGlobal(local,global);
 
-    Int_t Nfp=0;
+    Int_t nFp=0;
     
-    if (res==mip) {
+    if (res==kMip) {
        qtot = fResponse->IntPH(eloss);
-       Nfp  = fResponse->FeedBackPhotons(global,qtot);
-    } else if (res==cerenkov) {
+       nFp  = fResponse->FeedBackPhotons(global,qtot);
+    } else if (res==kCerenkov) {
        qtot = fResponse->IntPH();
-       Nfp  = fResponse->FeedBackPhotons(global,qtot);
+       nFp  = fResponse->FeedBackPhotons(global,qtot);
     }
 
-    //printf("Feedbacks:%d\n",Nfp);
+    //printf("Feedbacks:%d\n",nFp);
     
     //
     // Loop Over Pads
@@ -177,5 +195,11 @@ void AliRICHChamber::DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit,
 }
 
 
+AliRICHChamber& AliRICHChamber::operator=(const AliRICHChamber& rhs)
+{
+// Assignment operator
+    return *this;
+    
+}
 
 
index 8cd045cf89c795fc90fc59c94c9308670ac0e544..0b376328a24be0c1a5ecdb1ae0ada38f34285d1c 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef AliRICHChamber_H
-#define AliRICHChamber_H
+#ifndef ALIRICHCHAMBER_H
+#define ALIRICHCHAMBER_H
 
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
@@ -8,26 +8,22 @@
 
 #include <TObjArray.h>
 #include <TRotMatrix.h>
-#include "AliRICHSegRes.h"
 
+#include "AliRICHSegmentation.h"
+#include "AliRICHGeometry.h"
+#include "AliRICHResponse.h"
 
 class AliRICHClusterFinder;
-class AliRICHResponse;
-class AliRICHSegmentation;
-class AliRICHGeometry;
-typedef enum {mip, cerenkov} Response_t;
+
+typedef enum {kMip, kCerenkov} ResponseType;
 
 class AliRICHChamber : public TObject
 {
  public:
     
-//Rotation matrices for each chamber
-    
-    TRotMatrix *fChamberMatrix;
-    Float_t fChamberTrans[3];
-    
  public:
     AliRICHChamber();
+    AliRICHChamber(const AliRICHChamber & Chamber);
     ~AliRICHChamber(){}
 //
 // Set and get GEANT id  
@@ -227,26 +223,31 @@ class AliRICHChamber : public TObject
        fGeometry->SetFreonThickness(thickness);
       }
 
-
+    AliRICHChamber& operator=(const AliRICHChamber& rhs);
+    
 //  
 // Cluster formation method
-    void   DisIntegration(Float_t, Float_t, Float_t, Int_t&x, Float_t newclust[6][500], Response_t res);
+    void   DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit, Int_t&x, Float_t newclust[6][500], ResponseType res);
  private:
 // GEANT volume if for sensitive volume of this
-// Maximum and Minimum Chamber size
-    Float_t frMin;    
-    Float_t frMax;
-    Int_t   fGid;
-// z-position of this chamber
-    Float_t fzPos;
+    Float_t frMin;                 // Minimum Chamber size
+    Float_t frMax;                 // Maximum Chamber size 
+    Int_t   fGid;                  // Id tag 
+    Float_t fzPos;                 // z-position of this chamber
 // The segmentation models for the cathode planes
-// fnsec=1: one plane segmented, fnsec=2: both planes are segmented.
-    Int_t   fnsec;
+    Int_t   fnsec;                 // fnsec=1: one plane segmented, fnsec=2: both planes are segmented.
     
-    AliRICHSegmentation           *fSegmentation;
-    AliRICHResponse               *fResponse;
-    AliRICHGeometry               *fGeometry;
-    AliRICHClusterFinder          *fReconstruction;
+    TRotMatrix *fChamberMatrix;          //Rotation matrices for each chamber
+    Float_t fChamberTrans[3];            //Translaction vectors for each chamber
+
+    AliRICHSegmentation           *fSegmentation;          //Segmentation model for each chamber
+    AliRICHResponse               *fResponse;              //Response model for each chamber
+    AliRICHGeometry               *fGeometry;              //Geometry model for each chamber
+    AliRICHClusterFinder          *fReconstruction;        //Reconstruction model for each chamber
     ClassDef(AliRICHChamber,1)
 };
 #endif
+
+
+
+
index f03b98f82ab31841e46478be005c90b2b70f3297..d4766b721c57d970acf86a027c4d51dab44a83b2 100644 (file)
 
 /*
   $Log$
+  Revision 1.1  2000/04/19 13:01:48  morsch
+  A cluster finder and hit reconstruction class for RICH (adapted from MUON).
+  Cluster Finders for MUON and RICH should derive from the same class in the
+  future (JB, AM).
+
 */
 
 
 #include "AliRICHClusterFinder.h"
-#include "TTree.h"
 #include "AliRun.h"
+#include "AliRICH.h"
+#include "AliRICHHit.h"
+#include "AliRICHHitMapA1.h"
+#include "AliRICHCerenkov.h"
+#include "AliRICHPadHit.h"
+#include "AliRICHDigit.h"
+#include "AliRICHRawCluster.h"
+#include "AliRICHRecHit.h"
+
+#include <TTree.h>
 #include <TCanvas.h>
 #include <TH1.h>
 #include <TPad.h>
@@ -42,10 +56,13 @@ static Int_t                gChargeTot;
 
 ClassImp(AliRICHClusterFinder)
 
-    AliRICHClusterFinder::AliRICHClusterFinder
+AliRICHClusterFinder::AliRICHClusterFinder
 (AliRICHSegmentation *segmentation, AliRICHResponse *response, 
  TClonesArray *digits, Int_t chamber)   
 {
+
+// Constructor for Cluster Finder object
+
     fSegmentation=segmentation;
     fResponse=response;
     
@@ -61,8 +78,11 @@ ClassImp(AliRICHClusterFinder)
     fNPeaks=-1;
 }
 
-    AliRICHClusterFinder::AliRICHClusterFinder()
+AliRICHClusterFinder::AliRICHClusterFinder()
 {
+
+// Default constructor
+
     fSegmentation=0;
     fResponse=0;
     
@@ -79,13 +99,26 @@ ClassImp(AliRICHClusterFinder)
     fNPeaks=-1;
 }
 
+AliRICHClusterFinder::AliRICHClusterFinder(const AliRICHClusterFinder& ClusterFinder)
+{
+// Copy Constructor
+}
+
+AliRICHClusterFinder::~AliRICHClusterFinder()
+{
+
+// Destructor
+
+delete fRawClusters;
+}
+
 void AliRICHClusterFinder::AddRawCluster(const AliRICHRawCluster c)
 {
   //
   // Add a raw cluster copy to the list
   //
-    AliRICH *RICH=(AliRICH*)gAlice->GetModule("RICH");
-    RICH->AddRawCluster(fChamber,c); 
+    AliRICH *pRICH=(AliRICH*)gAlice->GetModule("RICH");
+    pRICH->AddRawCluster(fChamber,c); 
     fNRawClusters++;
 }
 
@@ -93,9 +126,9 @@ void AliRICHClusterFinder::AddRawCluster(const AliRICHRawCluster c)
 
 void AliRICHClusterFinder::Decluster(AliRICHRawCluster *cluster)
 {
-//    AliRICHDigit *dig;
-//    Int_t q;
 
+//
+// Decluster algorithm
     
     Int_t mul = cluster->fMultiplicity;
 //    printf("Decluster - multiplicity   %d \n",mul);
@@ -149,20 +182,25 @@ void AliRICHClusterFinder::Decluster(AliRICHRawCluster *cluster)
 
 Bool_t AliRICHClusterFinder::Centered(AliRICHRawCluster *cluster)
 {
+
+// Is the cluster centered?
+
     AliRICHDigit* dig;
     dig= (AliRICHDigit*)fDigits->UncheckedAt(cluster->fIndexMap[0]);
     Int_t ix=dig->fPadX;
     Int_t iy=dig->fPadY;
     Int_t nn;
-    Int_t X[kMaxNeighbours], Y[kMaxNeighbours], XN[kMaxNeighbours], YN[kMaxNeighbours];
+    Int_t x[kMaxNeighbours], y[kMaxNeighbours], xN[kMaxNeighbours], yN[kMaxNeighbours];
     
-    fSegmentation->Neighbours(ix,iy,&nn,X,Y);
+    fSegmentation->Neighbours(ix,iy,&nn,x,y);
     Int_t nd=0;
     for (Int_t i=0; i<nn; i++) {
-       if (fHitMap->TestHit(X[i],Y[i]) == used) {
-           XN[nd]=X[i];
-           YN[nd]=Y[i];
+       if (fHitMap->TestHit(x[i],y[i]) == kUsed) {
+           yN[nd]=x[i];
+           yN[nd]=y[i];
            nd++;
+           
+           printf("Getting: %d %d %d\n",i,x[i],y[i]);
        }
     }
     if (nd==2) {
@@ -181,7 +219,10 @@ Bool_t AliRICHClusterFinder::Centered(AliRICHRawCluster *cluster)
 // Highest signal on an edge, split cluster into 2+1
 //
 // who is the neighbour ?
-       Int_t nind=fHitMap->GetHitIndex(XN[0], YN[0]);
+      
+      printf("Calling GetIndex with x:%d y:%d\n",xN[0], yN[0]);
+      
+       Int_t nind=fHitMap->GetHitIndex(xN[0], yN[0]);
        Int_t i1= (nind==cluster->fIndexMap[1]) ? 1:2;
        Int_t i2= (nind==cluster->fIndexMap[1]) ? 2:1;    
 //
@@ -225,6 +266,11 @@ Bool_t AliRICHClusterFinder::Centered(AliRICHRawCluster *cluster)
 }
 void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
 {
+
+//
+// Split the cluster according to the number of maxima inside
+
+
     AliRICHDigit* dig[100], *digt;
     Int_t ix[100], iy[100], q[100];
     Float_t x[100], y[100];
@@ -248,50 +294,50 @@ void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
 //
 //  Find local maxima
 //
-    Bool_t IsLocal[100];
-    Int_t NLocal=0;
-    Int_t AssocPeak[100];
-    Int_t IndLocal[100];
+    Bool_t isLocal[100];
+    Int_t nLocal=0;
+    Int_t associatePeak[100];
+    Int_t indLocal[100];
     Int_t nn;
-    Int_t X[kMaxNeighbours], Y[kMaxNeighbours];
+    Int_t xNei[kMaxNeighbours], yNei[kMaxNeighbours];
     for (i=0; i<mul; i++) {
-       fSegmentation->Neighbours(ix[i], iy[i], &nn, X, Y);
-       IsLocal[i]=kTRUE;
+       fSegmentation->Neighbours(ix[i], iy[i], &nn, xNei, yNei);
+       isLocal[i]=kTRUE;
        for (j=0; j<nn; j++) {
-           if (fHitMap->TestHit(X[j], Y[j])==empty) continue;
-           digt=(AliRICHDigit*) fHitMap->GetHit(X[j], Y[j]);
+           if (fHitMap->TestHit(xNei[j], yNei[j])==kEmpty) continue;
+           digt=(AliRICHDigit*) fHitMap->GetHit(xNei[j], yNei[j]);
            if (digt->fSignal > q[i]) {
-               IsLocal[i]=kFALSE;
+               isLocal[i]=kFALSE;
                break;
 //
 // handle special case of neighbouring pads with equal signal
            } else if (digt->fSignal == q[i]) {
-               if (NLocal >0) {
-                   for (Int_t k=0; k<NLocal; k++) {
-                       if (X[j]==ix[IndLocal[k]] && Y[j]==iy[IndLocal[k]]){
-                           IsLocal[i]=kFALSE;
+               if (nLocal >0) {
+                   for (Int_t k=0; k<nLocal; k++) {
+                       if (xNei[j]==ix[indLocal[k]] && yNei[j]==iy[indLocal[k]]){
+                           isLocal[i]=kFALSE;
                        }
                    }
                }
            } 
        } // loop over next neighbours
        // Maxima should not be on the edge
-       if (IsLocal[i]) {
-           IndLocal[NLocal]=i;
-           NLocal++;
+       if (isLocal[i]) {
+           indLocal[nLocal]=i;
+           nLocal++;
        } 
     } // loop over all digits
-//    printf("Found %d local Maxima",NLocal);
+//    printf("Found %d local Maxima",nLocal);
 //
 // If only one local maximum found but multiplicity is high 
 // take global maximum from the list of digits.    
-    if (NLocal==1 && mul>5) {
+    if (nLocal==1 && mul>5) {
        Int_t nnew=0;
        for (i=0; i<mul; i++) {
-           if (!IsLocal[i]) {
-               IndLocal[NLocal]=i;
-               IsLocal[i]=kTRUE;
-               NLocal++;
+           if (!isLocal[i]) {
+               indLocal[nLocal]=i;
+               isLocal[i]=kTRUE;
+               nLocal++;
                nnew++;
            }
            if (nnew==1) break;
@@ -299,7 +345,7 @@ void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
     }
     
 // If number of local maxima is 2 try to fit a double gaussian
-    if (NLocal==-100) {
+    if (nLocal==-100) {
 //
 //  Initialise global variables for fit
        gFirst=1;
@@ -325,15 +371,15 @@ void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
 //     gMyMinuit->mnexcm("SET ERR",arglist,1,ierflag);
 // Set starting values 
        static Double_t vstart[5];
-       vstart[0]=x[IndLocal[0]];
-       vstart[1]=y[IndLocal[0]];       
-       vstart[2]=x[IndLocal[1]];
-       vstart[3]=y[IndLocal[1]];       
-       vstart[4]=Float_t(q[IndLocal[0]])/
-           Float_t(q[IndLocal[0]]+q[IndLocal[1]]);
+       vstart[0]=x[indLocal[0]];
+       vstart[1]=y[indLocal[0]];       
+       vstart[2]=x[indLocal[1]];
+       vstart[3]=y[indLocal[1]];       
+       vstart[4]=Float_t(q[indLocal[0]])/
+           Float_t(q[indLocal[0]]+q[indLocal[1]]);
 // lower and upper limits
        static Double_t lower[5], upper[5];
-       Int_t isec=fSegmentation->Sector(ix[IndLocal[0]], iy[IndLocal[0]]);
+       Int_t isec=fSegmentation->Sector(ix[indLocal[0]], iy[indLocal[0]]);
        lower[0]=vstart[0]-fSegmentation->Dpx(isec)/2;
        lower[1]=vstart[1]-fSegmentation->Dpy(isec)/2;
 //     lower[1]=vstart[1];
@@ -342,7 +388,7 @@ void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
        upper[1]=lower[1]+fSegmentation->Dpy(isec);
 //     upper[1]=vstart[1];
        
-       isec=fSegmentation->Sector(ix[IndLocal[1]], iy[IndLocal[1]]);
+       isec=fSegmentation->Sector(ix[indLocal[1]], iy[indLocal[1]]);
        lower[2]=vstart[2]-fSegmentation->Dpx(isec)/2;
        lower[3]=vstart[3]-fSegmentation->Dpy(isec)/2;
 //     lower[3]=vstart[3];
@@ -428,27 +474,27 @@ void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
 
     Bool_t fitted=kTRUE;
 
-    if (NLocal !=-100 || !fitted) {
+    if (nLocal !=-100 || !fitted) {
        // Check if enough local clusters have been found,
        // if not add global maxima to the list 
        //
        Int_t nPerMax;
-       if (NLocal!=0) {
-           nPerMax=mul/NLocal;
+       if (nLocal!=0) {
+           nPerMax=mul/nLocal;
        } else {
            printf("\n Warning, no local maximum found \n");
            nPerMax=fNperMax+1;
        }
        
        if (nPerMax > fNperMax) {
-           Int_t nGlob=mul/fNperMax-NLocal+1;
+           Int_t nGlob=mul/fNperMax-nLocal+1;
            if (nGlob > 0) {
                Int_t nnew=0;
                for (i=0; i<mul; i++) {
-                   if (!IsLocal[i]) {
-                       IndLocal[NLocal]=i;
-                       IsLocal[i]=kTRUE;
-                       NLocal++;
+                   if (!isLocal[i]) {
+                       indLocal[nLocal]=i;
+                       isLocal[i]=kTRUE;
+                       nLocal++;
                        nnew++;
                    }
                    if (nnew==nGlob) break;
@@ -461,9 +507,9 @@ void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
        for (i=0; i<mul; i++) {
            Float_t dmin=1.E10;
            Float_t qmax=0;
-           if (IsLocal[i]) continue;
-           for (j=0; j<NLocal; j++) {
-               Int_t il=IndLocal[j];
+           if (isLocal[i]) continue;
+           for (j=0; j<nLocal; j++) {
+               Int_t il=indLocal[j];
                Float_t d=TMath::Sqrt((x[i]-x[il])*(x[i]-x[il])
                                      +(y[i]-y[il])*(y[i]-y[il]));
                Float_t ql=q[il];
@@ -473,7 +519,7 @@ void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
                if (d<dmin) {
                    dmin=d;
                    qmax=ql;
-                   AssocPeak[i]=j;
+                   associatePeak[i]=j;
                } else if (d==dmin) {
                    //
                    // If more than one take highest peak
@@ -481,7 +527,7 @@ void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
                    if (ql>qmax) {
                        dmin=d;
                        qmax=ql;
-                       AssocPeak[i]=j;
+                       associatePeak[i]=j;
                    }
                }
            }
@@ -491,7 +537,7 @@ void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
  //
  // One cluster for each maximum
  //
-       for (j=0; j<NLocal; j++) {
+       for (j=0; j<nLocal; j++) {
            AliRICHRawCluster cnew;
            if (fNPeaks == 0) {
                cnew.fNcluster[0]=-1;
@@ -500,11 +546,11 @@ void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
                cnew.fNcluster[0]=fNPeaks;
                cnew.fNcluster[1]=0;
            }
-           cnew.fIndexMap[0]=c->fIndexMap[IndLocal[j]];
+           cnew.fIndexMap[0]=c->fIndexMap[indLocal[j]];
            cnew.fMultiplicity=1;
            for (i=0; i<mul; i++) {
-               if (IsLocal[i]) continue;
-               if (AssocPeak[i]==j) {
+               if (isLocal[i]) continue;
+               if (associatePeak[i]==j) {
                    cnew.fIndexMap[cnew.fMultiplicity]=c->fIndexMap[i];
                    cnew.fMultiplicity++;
                }
@@ -602,11 +648,11 @@ void  AliRICHClusterFinder::FillCluster(AliRICHRawCluster* c, Int_t flag)
      fSegmentation->GetPadIxy(x, y, ix, iy);
      fSegmentation->GetPadCxy(ix, iy, x, y);
      Int_t isec=fSegmentation->Sector(ix,iy);
-     TF1* CogCorr = fSegmentation->CorrFunc(isec-1);
+     TF1* cogCorr = fSegmentation->CorrFunc(isec-1);
      
-     if (CogCorr) {
-        Float_t YonPad=(c->fY-y)/fSegmentation->Dpy(isec);
-        c->fY=c->fY-CogCorr->Eval(YonPad, 0, 0);
+     if (cogCorr) {
+        Float_t yOnPad=(c->fY-y)/fSegmentation->Dpy(isec);
+        c->fY=c->fY-cogCorr->Eval(yOnPad, 0, 0);
      }
  }
 }
@@ -680,12 +726,12 @@ void  AliRICHClusterFinder::FindCluster(Int_t i, Int_t j, AliRICHRawCluster &c){
 //  Now look recursively for all neighbours
 //  
     Int_t nn;
-    Int_t Xlist[kMaxNeighbours], Ylist[kMaxNeighbours];
-    fSegmentation->Neighbours(i,j,&nn,Xlist,Ylist);
+    Int_t xList[kMaxNeighbours], yList[kMaxNeighbours];
+    fSegmentation->Neighbours(i,j,&nn,xList,yList);
     for (Int_t in=0; in<nn; in++) {
-       Int_t ix=Xlist[in];
-       Int_t iy=Ylist[in];
-       if (fHitMap->TestHit(ix,iy)==unused) FindCluster(ix, iy, c);
+       Int_t ix=xList[in];
+       Int_t iy=yList[in];
+       if (fHitMap->TestHit(ix,iy)==kUnused) FindCluster(ix, iy, c);
     }
 }
 
@@ -713,7 +759,7 @@ void AliRICHClusterFinder::FindRawClusters()
        dig = (AliRICHDigit*)fDigits->UncheckedAt(ndig);
        Int_t i=dig->fPadX;
        Int_t j=dig->fPadY;
-       if (fHitMap->TestHit(i,j)==used ||fHitMap->TestHit(i,j)==empty) {
+       if (fHitMap->TestHit(i,j)==kUsed ||fHitMap->TestHit(i,j)==kEmpty) {
            nskip++;
            continue;
        }
@@ -745,10 +791,10 @@ void AliRICHClusterFinder::FindRawClusters()
        fSegmentation->GetPadIxy(x, y, ix, iy);
        fSegmentation->GetPadCxy(ix, iy, x, y);
        Int_t isec=fSegmentation->Sector(ix,iy);
-       TF1* CogCorr=fSegmentation->CorrFunc(isec-1);
-       if (CogCorr) {
-           Float_t YonPad=(c.fY-y)/fSegmentation->Dpy(isec);
-           c.fY=c.fY-CogCorr->Eval(YonPad,0,0);
+       TF1* cogCorr=fSegmentation->CorrFunc(isec-1);
+       if (cogCorr) {
+           Float_t yOnPad=(c.fY-y)/fSegmentation->Dpy(isec);
+           c.fY=c.fY-cogCorr->Eval(yOnPad,0,0);
        }
 
 //
@@ -774,6 +820,9 @@ void AliRICHClusterFinder::FindRawClusters()
 void AliRICHClusterFinder::
 CalibrateCOG()
 {
+
+// Calibration
+
     Float_t x[5];
     Float_t y[5];
     Int_t n, i;
@@ -793,15 +842,17 @@ CalibrateCOG()
 void AliRICHClusterFinder::
 SinoidalFit(Float_t x, Float_t y, TF1 &func)
 {
-//
+// Sinoidal fit
+
+
     static Int_t count=0;
     char canvasname[3];
     count++;
     sprintf(canvasname,"c%d",count);
 
-    const Int_t ns=101;
-    Float_t xg[ns], yg[ns], xrg[ns], yrg[ns];
-    Float_t xsig[ns], ysig[ns];
+    const Int_t kNs=101;
+    Float_t xg[kNs], yg[kNs], xrg[kNs], yrg[kNs];
+    Float_t xsig[kNs], ysig[kNs];
    
     AliRICHSegmentation *segmentation=fSegmentation;
 
@@ -825,9 +876,9 @@ SinoidalFit(Float_t x, Float_t y, TF1 &func)
 //
 //  y-position
     Float_t yscan=ymin;
-    Float_t dy=segmentation->Dpy(isec)/(ns-1);
+    Float_t dy=segmentation->Dpy(isec)/(kNs-1);
 
-    for (i=0; i<ns; i++) {
+    for (i=0; i<kNs; i++) {
 //
 //      Pad Loop
 //      
@@ -861,9 +912,9 @@ SinoidalFit(Float_t x, Float_t y, TF1 &func)
 //
 //  x-position
     Float_t xscan=xmin;
-    Float_t dx=segmentation->Dpx(isec)/(ns-1);
+    Float_t dx=segmentation->Dpx(isec)/(kNs-1);
 
-    for (i=0; i<ns; i++) {
+    for (i=0; i<kNs; i++) {
 //
 //      Pad Loop
 //      
@@ -900,10 +951,10 @@ SinoidalFit(Float_t x, Float_t y, TF1 &func)
 // Creates a Root function based on function sinoid above
 // and perform the fit
 //
-    //    TGraph *graphx = new TGraph(ns,xg ,xsig);
-    //    TGraph *graphxr= new TGraph(ns,xrg,xsig);   
-    //    TGraph *graphy = new TGraph(ns,yg ,ysig);
-    TGraph *graphyr= new TGraph(ns,yrg,ysig);
+    //    TGraph *graphx = new TGraph(kNs,xg ,xsig);
+    //    TGraph *graphxr= new TGraph(kNs,xrg,xsig);   
+    //    TGraph *graphy = new TGraph(kNs,yg ,ysig);
+    TGraph *graphyr= new TGraph(kNs,yrg,ysig);
 
     Double_t sinoid(Double_t *x, Double_t *par);
     new TF1("sinoidf",sinoid,0.5,0.5,5);
@@ -968,6 +1019,9 @@ SinoidalFit(Float_t x, Float_t y, TF1 &func)
 
 Double_t sinoid(Double_t *x, Double_t *par)
 {
+
+// Sinoid function
+
     Double_t arg = -2*TMath::Pi()*x[0];
     Double_t fitval= par[0]*TMath::Sin(arg)+
        par[1]*TMath::Sin(2*arg)+
@@ -980,6 +1034,9 @@ Double_t sinoid(Double_t *x, Double_t *par)
 
 Double_t DoubleGauss(Double_t *x, Double_t *par)
 {
+
+// Doublr gaussian function
+
     Double_t arg1 = (x[0]-par[1])/0.18;
     Double_t arg2 = (x[0]-par[3])/0.18;
     Double_t fitval= par[0]*TMath::Exp(-arg1*arg1/2)
@@ -1043,6 +1100,22 @@ void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
 }
 
 
+void AliRICHClusterFinder::SetDigits(TClonesArray *RICHdigits)
+{
+
+// Get all the digits
+
+    fDigits=RICHdigits;
+    fNdigits = fDigits->GetEntriesFast();
+}
+
+AliRICHClusterFinder& AliRICHClusterFinder::operator=(const AliRICHClusterFinder& rhs)
+{
+// Assignment operator
+    return *this;
+    
+}
+
 
 
 
index 1e9afff5f6da8b0c1bf8e1398f20fef155de2d87..ffb6648738fadec00e997c8c0a24cfd1c9ef83df 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef AliRICHClusterFinder_H
-#define AliRICHClusterFinder_H
+#ifndef ALIRICHCLUSTERFINDER_H
+#define ALIRICHCLUSTERFINDER_H
 
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 ////////////////////////////////////////////////
 //  RICH Cluster Finder Class                 //
 ////////////////////////////////////////////////
-#include "AliRICHHitMap.h"
+class AliRICHHitMapA1;
+
 #include "TF1.h"
+#include "TObject.h"
+class  TClonesArray;
+class AliRICHSegmentation;
+class AliRICHRawCluster;
+class AliRICHResponse;
+class TClonesArray;
+
+
 class AliRICHClusterFinder :
  public TObject
 {
-public:
-    TClonesArray*           fDigits;
-    Int_t                   fNdigits;
-protected:
-    AliRICHSegmentation*    fSegmentation;
-    AliRICHResponse*        fResponse;
-    TClonesArray*           fRawClusters;
-    Int_t                   fChamber;
-    Int_t                   fNRawClusters;
-    AliRICHHitMapA1*        fHitMap;
-    TF1*                    fCogCorr;
-    Int_t                   fNperMax;
-    Int_t                   fDeclusterFlag;
-    Int_t                   fClusterSize;
-    Int_t                   fNPeaks; 
  public:
     AliRICHClusterFinder
        (AliRICHSegmentation *segmentation,
         AliRICHResponse *response, TClonesArray *digits, Int_t chamber);
     AliRICHClusterFinder();
-    ~AliRICHClusterFinder(){delete fRawClusters;}
+    AliRICHClusterFinder(const AliRICHClusterFinder & ClusterFinder);
+    virtual ~AliRICHClusterFinder();
     virtual void SetSegmentation(
        AliRICHSegmentation *segmentation){
        fSegmentation=segmentation;
@@ -44,16 +39,13 @@ protected:
        fResponse=response;
     }
 
-    virtual void SetDigits(TClonesArray *RICHdigits) {
-       fDigits=RICHdigits;
-       fNdigits = fDigits->GetEntriesFast();
-    }
+    virtual void SetDigits(TClonesArray *RICHdigits);
     
     virtual void SetChamber(Int_t ich){
        fChamber=ich;
     }
     
-    virtual void AddRawCluster(const AliRICHRawCluster);
+    virtual void AddRawCluster(const AliRICHRawCluster c);
     // Search for raw clusters
     virtual void FindRawClusters();
     virtual void  FindCluster(Int_t i, Int_t j, AliRICHRawCluster &c);
@@ -74,11 +66,27 @@ protected:
     //
     virtual Bool_t Centered(AliRICHRawCluster *cluster);
     virtual void   SplitByLocalMaxima(AliRICHRawCluster *cluster);
-    virtual void   FillCluster(AliRICHRawCluster *cluster, Int_t);
+    virtual void   FillCluster(AliRICHRawCluster *cluster, Int_t flag);
     virtual void   FillCluster(AliRICHRawCluster *cluster) {
        FillCluster(cluster,1);}
     TClonesArray* RawClusters(){return fRawClusters;}
+    AliRICHClusterFinder& operator=(const AliRICHClusterFinder& rhs);
     ClassDef(AliRICHClusterFinder,1) //Class for clustering and reconstruction of space points
+protected:
+    AliRICHSegmentation*    fSegmentation;                 //Segmentation model
+    AliRICHResponse*        fResponse;                     //Response model
+    TClonesArray*           fRawClusters;                  //Raw clusters list
+    Int_t                   fChamber;                      //Chamber number
+    Int_t                   fNRawClusters;                 //Number of raw clusters
+    AliRICHHitMapA1*        fHitMap;                       //Hit Map with digit positions
+    TF1*                    fCogCorr;                      //Correction for center of gravity
+    Int_t                   fNperMax;                      //Number of pad hits per local maximum
+    Int_t                   fDeclusterFlag;                //Split clusters flag
+    Int_t                   fClusterSize;                  //Size of cluster 
+    Int_t                   fNPeaks;                       //Number of maxima in the cluster
+    TClonesArray*           fDigits;                       //List of digits
+    Int_t                   fNdigits;                      //Number of digits
+
 };
 #endif
 
index 273f9b8b3aaba17ccb303295c75ad4d9edba55bf..2a44456e3d15886be496ee60bdc5b23d599d6f5c 100644 (file)
 
 /*
   $Log$
+  Revision 1.1  2000/04/19 13:05:14  morsch
+  J. Barbosa's spot reconstruction algorithm.
+
 */
 
 
 #include "AliRICH.h"
 #include "AliRICHPoints.h"
 #include "AliRICHDetect.h"
-#include "DataStructures.h"
+#include "AliRICHHit.h"
+#include "AliRICHDigit.h"
 #include "AliRun.h"
 #include "TParticle.h"
 #include "TMath.h"
@@ -33,6 +37,9 @@ ClassImp(AliRICHDetect)
 //___________________________________________
 AliRICHDetect::AliRICHDetect() : TObject()
 {
+
+// Default constructor 
+
     //fChambers = 0;
 }
 
@@ -41,6 +48,8 @@ AliRICHDetect::AliRICHDetect(const char *name, const char *title)
     : TObject()
 {
     
+// Constructor
+
     /*fChambers = new TObjArray(7);
     for (Int_t i=0; i<7; i++) {
     
@@ -53,6 +62,10 @@ AliRICHDetect::AliRICHDetect(const char *name, const char *title)
 void AliRICHDetect::Detect()
 {      
     
+//
+// Detection algorithm
+
+
   //printf("Detection started!\n");
   Float_t OMEGA,steptheta,stepphi,x,y,cx,cy,l,aux1,aux2,aux3,maxi,maxj,maxk,max;
   //Float_t theta,phi,realomega,realtheta;
@@ -297,7 +310,7 @@ void AliRICHDetect::Detect()
   //TTree *TR=gAlice->TreeR();
   //Stat_t ndig=TR->GetEntries();
   TClonesArray *fRec;
-  for (i=0;i<7;i++) {
+  for (i=0;i<kNCH;i++) {
     fRec=RICH->RecHitsAddress(i);
     int ndig=fRec->GetEntriesFast();
     printf ("Chamber %d, rings %d\n",i,ndig);
@@ -312,7 +325,11 @@ void AliRICHDetect::Detect()
 
 Float_t AliRICHDetect:: Area(Float_t theta,Float_t OMEGA)
 {
-    
+
+//
+// Calculates area of an ellipse for given incidence angles    
+
+
     Float_t area;
     const Float_t h=9.25;                       //Distance from Radiator to Pads in pads
     
index 7bea6dfae5204b4594c392630d6234bd96a1f840..48cb7a72754a13af8e8baadee62a4c4a2a1c5a97 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef AliRICHDetect_H
-#define AliRICHDetect_H
+#ifndef ALIRICHDETECT_H
+#define ALIRICHDETECT_H
 
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
diff --git a/RICH/AliRICHDigit.cxx b/RICH/AliRICHDigit.cxx
new file mode 100644 (file)
index 0000000..2eefb6c
--- /dev/null
@@ -0,0 +1,48 @@
+/**************************************************************************
+ * 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 "AliRICHDigit.h"
+
+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];
+    }
+}
diff --git a/RICH/AliRICHDigit.h b/RICH/AliRICHDigit.h
new file mode 100644 (file)
index 0000000..7505606
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef ALIRICHDIGIT_H
+#define ALIRICHDIGIT_H
+
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#include "AliDigit.h"
+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
+};
+#endif
+
+
+
+
+
+
+
index 138d36b57fc6853961adbd95490df5aaad3bb8bb..cb879b25893867025c606fad2ae78e51c5800a38 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
   $Log$
+  Revision 1.3  2000/06/09 14:52:08  jbarbosa
+  New tentative ellipse drawing routine
+
   Revision 1.1  2000/04/19 13:07:45  morsch
   Digits, clusters and reconstruction results added.
 
@@ -52,6 +55,7 @@
 #include <TMath.h>
 #include <TRandom.h>
 #include <X3DBuffer.h>
+#include <TParticle.h>
 
 #include "AliRun.h"
 #include "AliPDG.h"
 #include "AliRICHConst.h"
 #include "AliRICHDisplay.h"
 #include "AliRICHPoints.h"
-#include "TParticle.h"
 
+#include "AliRICHHit.h"
+#include "AliRICHCerenkov.h"
+#include "AliRICHPadHit.h"
+#include "AliRICHDigit.h"
+#include "AliRICHRawCluster.h"
+#include "AliRICHRecHit.h"
+#include "AliRICHEllipse.h"
 
 ClassImp(AliRICHDisplay)
     
@@ -69,6 +79,9 @@ ClassImp(AliRICHDisplay)
 //____________________________________________________________________________
 AliRICHDisplay::AliRICHDisplay()
 { 
+
+// default constructor
+
     fPoints = 0;
     fPhits = 0;
     fPCerenkovs = 0;
@@ -380,6 +393,8 @@ void AliRICHDisplay::CreateColors()
 //_____________________________________________________________________________
 void AliRICHDisplay::DisplayColorScale()
 {
+
+// Draw the color scale in the RICH display canvas
     
     Int_t i;
     Int_t color;
@@ -425,8 +440,8 @@ Int_t AliRICHDisplay::DistancetoPrimitive(Int_t px, Int_t)
     
     if (gPad == fTrigPad) return 9999;
     
-    const Int_t big = 9999;
-    Int_t dist   = big;
+    const Int_t kBig = 9999;
+    Int_t dist   = kBig;
     Float_t xmin = gPad->GetX1();
     Float_t xmax = gPad->GetX2();
     Float_t dx   = 0.02*(xmax - xmin);
@@ -457,7 +472,7 @@ void AliRICHDisplay::DrawCoG()
 
     if (!fDrawCoG) return;
     ResetRpoints();
-    for (Int_t chamber=0;chamber<7;chamber++) {
+    for (Int_t chamber=0;chamber<kNCH;chamber++) {
        LoadCoG(chamber,1);
     }
     
@@ -480,7 +495,7 @@ void AliRICHDisplay::DrawRecHits()
 
     if (!fDrawRecHits) return;
     //ResetRecpoints();
-    for (Int_t chamber=0;chamber<7;chamber++) {
+    for (Int_t chamber=0;chamber<kNCH;chamber++) {
        LoadRecHits(chamber,1);
     }
     
@@ -733,31 +748,31 @@ void AliRICHDisplay::LoadCoG(Int_t chamber, Int_t cathode)
    printf("Entering LoadCoG\n");
 
 
-   AliRICH *RICH  = (AliRICH*)gAlice->GetModule("RICH");
+   AliRICH *pRICH  = (AliRICH*)gAlice->GetModule("RICH");
    AliRICHChamber*  iChamber;
 
-   TClonesArray *RICHrawclust  = RICH->RawClustAddress(chamber);
-   printf ("Chamber:%d has adress:%p\n", chamber, RICHrawclust );
-   if (RICHrawclust == 0) return;
+   TClonesArray *pRICHrawclust  = pRICH->RawClustAddress(chamber);
+   printf ("Chamber:%d has adress:%p\n", chamber, pRICHrawclust );
+   if (pRICHrawclust == 0) return;
 
-   RICH->ResetRawClusters();
+   pRICH->ResetRawClusters();
 
 
    Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
    gAlice->TreeR()->GetEvent(nent-1+cathode-1);
-   Int_t nrawcl = RICHrawclust->GetEntriesFast();
+   Int_t nrawcl = pRICHrawclust->GetEntriesFast();
    printf ("nrawcl:%d\n",nrawcl);
    if (nrawcl == 0) return;
    if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
    
-   iChamber = &(RICH->Chamber(chamber));
+   iChamber = &(pRICH->Chamber(chamber));
    AliRICHRawCluster  *mRaw;
    AliRICHPoints *points = 0;
    //
    //loop over all raw clusters and store their position
    points = new AliRICHPoints(nrawcl);
    for (Int_t iraw=0;iraw<nrawcl;iraw++) {
-       mRaw   = (AliRICHRawCluster*)RICHrawclust->UncheckedAt(iraw);
+       mRaw   = (AliRICHRawCluster*)pRICHrawclust->UncheckedAt(iraw);
        fRpoints->AddAt(points,iraw);
        points->SetMarkerColor(3);
        points->SetMarkerStyle(3);
@@ -766,10 +781,10 @@ void AliRICHDisplay::LoadCoG(Int_t chamber, Int_t cathode)
        points->SetHitIndex(-1);
        points->SetTrackIndex(-1);
        points->SetDigitIndex(-1);
-       Float_t  VecLoc[3]={mRaw->fX,6.276,mRaw->fY};
-       Float_t  VecGlob[3];
-       iChamber->LocaltoGlobal(VecLoc,VecGlob);
-       points->SetPoint(iraw,VecGlob[0],VecGlob[1],VecGlob[2]);
+       Float_t  vectorLoc[3]={mRaw->fX,6.276,mRaw->fY};
+       Float_t  vectorGlob[3];
+       iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
+       points->SetPoint(iraw,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
    }
 }
 //___________________________________________
@@ -783,24 +798,24 @@ void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
    printf("Entering LoadRecHits\n");
 
 
-   AliRICH *RICH  = (AliRICH*)gAlice->GetModule("RICH");
+   AliRICH *pRICH  = (AliRICH*)gAlice->GetModule("RICH");
    AliRICHChamber*  iChamber;
 
-   TClonesArray *RICHrechits  = RICH->RecHitsAddress(chamber);
-   printf ("Chamber:%d has adress:%p\n", chamber, RICHrechits );
-   if (RICHrechits == 0) return;
+   TClonesArray *pRICHrechits  = pRICH->RecHitsAddress(chamber);
+   printf ("Chamber:%d has adress:%p\n", chamber, pRICHrechits );
+   if (pRICHrechits == 0) return;
 
    //RICH->ResetRecHits();
 
 
    Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
    gAlice->TreeR()->GetEvent(nent-1+cathode-1);
-   Int_t nrechits = RICHrechits->GetEntriesFast();
+   Int_t nrechits = pRICHrechits->GetEntriesFast();
    printf ("nrechits:%d\n",nrechits);
    if (nrechits == 0) return;
    if (fRecpoints == 0) fRecpoints = new TObjArray(50);
    
-   iChamber = &(RICH->Chamber(chamber));
+   iChamber = &(pRICH->Chamber(chamber));
    AliRICHRecHit  *mRec;
    AliRICHPoints *points = 0;
    //AliRICHEllipse *ellipse = 0;
@@ -809,7 +824,7 @@ void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
 
    points = new AliRICHPoints(nrechits);
    for (Int_t irec=0;irec<nrechits;irec++) {
-       mRec   = (AliRICHRecHit*)RICHrechits->UncheckedAt(irec);
+       mRec   = (AliRICHRecHit*)pRICHrechits->UncheckedAt(irec);
        fRecpoints->AddAt(points,irec);
        points->SetMarkerColor(38);
        points->SetMarkerStyle(8);
@@ -818,15 +833,15 @@ void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
        points->SetHitIndex(-1);
        points->SetTrackIndex(-1);
        points->SetDigitIndex(-1);
-       Float_t  VecLoc[3]={mRec->fX,6.276,mRec->fY};
-       Float_t  VecGlob[3];
-       iChamber->LocaltoGlobal(VecLoc,VecGlob);
-       points->SetPoint(irec,VecGlob[0],VecGlob[1],VecGlob[2]);
+       Float_t  vectorLoc[3]={mRec->fX,6.276,mRec->fY};
+       Float_t  vectorGlob[3];
+       iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
+       points->SetPoint(irec,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
        //Float_t theta = iChamber->GetRotMatrix()->GetTheta();
        //Float_t phi   = iChamber->GetRotMatrix()->GetPhi();      
-       //ellipse=new TEllipse(VecGlob[0],VecGlob[2],10,10,0,360,phi);
+       //ellipse=new TEllipse(vectorGlob[0],vectorGlob[2],10,10,0,360,phi);
        printf("Generating ellipse %d\n",irec);
-       AliRICHEllipse *ellipse=new AliRICHEllipse(mRec->fX,mRec->fY,mRec->Omega,mRec->Theta,mRec->Phi);
+       AliRICHEllipse *ellipse=new AliRICHEllipse(mRec->fX,mRec->fY,mRec->fOmega,mRec->fTheta,mRec->fPhi);
        ellipse->CreatePoints(chamber);
        //ellipse->SetFillStyle(1001);
        ellipse->SetMarkerColor(38);
@@ -842,30 +857,30 @@ void AliRICHDisplay::LoadDigits()
 // Loop on all detectors
     
    ResetPoints();
-   AliRICH *RICH  = (AliRICH*)gAlice->GetDetector("RICH");
+   AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
    AliRICHChamber*       iChamber;
    AliRICHSegmentation*  segmentation;
-   Int_t NallDigits=0;
+   Int_t nAllDigits=0;
    Int_t ich;
    
-   for (ich=0; ich<7; ich++) {
-       TClonesArray *RICHdigits  = RICH->DigitsAddress(ich);
-       if (RICHdigits == 0) continue;
+   for (ich=0; ich<kNCH; ich++) {
+       TClonesArray *pRICHdigits  = pRICH->DigitsAddress(ich);
+       if (pRICHdigits == 0) continue;
        gAlice->ResetDigits();
        gAlice->TreeD()->GetEvent(1);
-       Int_t ndigits = RICHdigits->GetEntriesFast();
-        NallDigits+=ndigits;
+       Int_t ndigits = pRICHdigits->GetEntriesFast();
+        nAllDigits+=ndigits;
    }
-   if (fPoints == 0) fPoints = new TObjArray(NallDigits);   
+   if (fPoints == 0) fPoints = new TObjArray(nAllDigits);   
    Int_t counter=0;
-   for (ich=0; ich<7; ich++) {
-       TClonesArray *RICHdigits  = RICH->DigitsAddress(ich);
-       if (RICHdigits == 0) continue;
+   for (ich=0; ich<kNCH; ich++) {
+       TClonesArray *pRICHdigits  = pRICH->DigitsAddress(ich);
+       if (pRICHdigits == 0) continue;
        gAlice->ResetDigits();
        gAlice->TreeD()->GetEvent(1);
-       Int_t ndigits = RICHdigits->GetEntriesFast();
+       Int_t ndigits = pRICHdigits->GetEntriesFast();
        if (ndigits == 0) continue;
-       iChamber = &(RICH->Chamber(ich));
+       iChamber = &(pRICH->Chamber(ich));
        segmentation=iChamber->GetSegmentationModel();
        Float_t dpx  = segmentation->Dpx();
        Float_t dpy  = segmentation->Dpy();
@@ -880,7 +895,7 @@ void AliRICHDisplay::LoadDigits()
        Int_t npoints=1;
        
        for (Int_t digit=0;digit<ndigits;digit++) {
-          mdig    = (AliRICHDigit*)RICHdigits->UncheckedAt(digit);
+          mdig    = (AliRICHDigit*)pRICHdigits->UncheckedAt(digit);
           points = new AliRICHPoints(npoints);
           fPoints->AddAt(points,counter);
           counter++;
@@ -893,19 +908,19 @@ void AliRICHDisplay::LoadDigits()
           points->SetMarkerSize(0.5);
           Float_t xpad, ypad;
           segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY,xpad, ypad);
-          Float_t VecLoc[3]={xpad,6.276,ypad};
-          Float_t  VecGlob[3];
-          iChamber->LocaltoGlobal(VecLoc,VecGlob);
+          Float_t vectorLoc[3]={xpad,6.276,ypad};
+          Float_t  vectorGlob[3];
+          iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
           points->SetParticle(-1);
           points->SetHitIndex(-1);
           points->SetTrackIndex(-1);
           points->SetDigitIndex(digit);
-          points->SetPoint(0,VecGlob[0],VecGlob[1],VecGlob[2]);
+          points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
           
           segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY, xpad, ypad);
           Float_t theta = iChamber->GetRotMatrix()->GetTheta();
           Float_t phi   = iChamber->GetRotMatrix()->GetPhi();     
-          marker=new TMarker3DBox(VecGlob[0],VecGlob[1],VecGlob[2],
+          marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
                                   dpy/2,0,dpx/2,theta,phi);
           marker->SetLineColor(2);
           marker->SetFillStyle(1001);
@@ -927,10 +942,10 @@ void AliRICHDisplay::LoadHits(Int_t chamber)
     fChamber=chamber; 
     ResetPhits();
     
-    AliRICH *RICH  = (AliRICH*)gAlice->GetDetector("RICH");
+    AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
     AliRICHChamber*  iChamber;
     
-    iChamber = &(RICH->Chamber(chamber-1));
+    iChamber = &(pRICH->Chamber(chamber-1));
     Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
     Int_t track;
     
@@ -940,32 +955,32 @@ void AliRICHDisplay::LoadHits(Int_t chamber)
     //TVector *zp = new TVector(1000);
     //TVector *ptrk = new TVector(1000);
     //TVector *phit = new TVector(1000);
-    Int_t NallHits=0;
+    Int_t nAllHits=0;
     for (track=0; track<ntracks;track++) {
        gAlice->ResetHits();
        gAlice->TreeH()->GetEvent(track);
-       TClonesArray *RICHhits  = RICH->Hits();
-       if (RICHhits == 0) return;
-       Int_t nhits = RICHhits->GetEntriesFast();
-       NallHits+=nhits;
+       TClonesArray *pRICHhits  = pRICH->Hits();
+       if (pRICHhits == 0) return;
+       Int_t nhits = pRICHhits->GetEntriesFast();
+       nAllHits+=nhits;
     }
 
-    fPhits = new TObjArray(NallHits);
+    fPhits = new TObjArray(nAllHits);
 
     Int_t npoints=0;
     for (track=0; track<ntracks;track++) {
        gAlice->ResetHits();
        gAlice->TreeH()->GetEvent(track);
-       TClonesArray *RICHhits  = RICH->Hits();
-       if (RICHhits == 0) return;
-       Int_t nhits = RICHhits->GetEntriesFast();
+       TClonesArray *pRICHhits  = pRICH->Hits();
+       if (pRICHhits == 0) return;
+       Int_t nhits = pRICHhits->GetEntriesFast();
        if (nhits == 0) continue;
        AliRICHHit *mHit;
        AliRICHPoints *points = 0;
        for (Int_t hit=0;hit<nhits;hit++) {
            points = new AliRICHPoints(1);
            fPhits->AddAt(points,npoints);
-            mHit = (AliRICHHit*)RICHhits->UncheckedAt(hit);
+            mHit = (AliRICHHit*)pRICHhits->UncheckedAt(hit);
            TParticle *current = 
                (TParticle*)(*gAlice->Particles())[mHit->fTrack];
            if (current->GetPdgCode() == 50000050) {
@@ -997,12 +1012,12 @@ void AliRICHDisplay::LoadCerenkovs(Int_t chamber)
     fChamber=chamber; 
     ResetPCerenkovs();
     
-    AliRICH *RICH  = (AliRICH*)gAlice->GetDetector("RICH");
+    AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
     AliRICHChamber*  iChamber;
     
-    iChamber = &(RICH->Chamber(chamber-1));
+    iChamber = &(pRICH->Chamber(chamber-1));
     
-    RICH->SetTreeAddress();
+    pRICH->SetTreeAddress();
     Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
     
     if (fPCerenkovs == 0) fPCerenkovs = new TObjArray(ntracks);
@@ -1014,9 +1029,9 @@ void AliRICHDisplay::LoadCerenkovs(Int_t chamber)
     for (Int_t track=0; track<ntracks;track++) {
        gAlice->ResetHits();
        gAlice->TreeH()->GetEvent(track);
-       TClonesArray *RICHCerenkovs  = RICH->Cerenkovs();
-       if (RICHCerenkovs == 0) return;
-       Int_t nhits = RICHCerenkovs->GetEntriesFast();
+       TClonesArray *pRICHCerenkovs  = pRICH->Cerenkovs();
+       if (pRICHCerenkovs == 0) return;
+       Int_t nhits = pRICHCerenkovs->GetEntriesFast();
        if (nhits == 0) continue;
        AliRICHCerenkov *mCerenkov;
        AliRICHPoints *cpoints = 0;
@@ -1026,7 +1041,7 @@ void AliRICHDisplay::LoadCerenkovs(Int_t chamber)
 //Display Cerenkov hits in blue
        
        for (Int_t hit=0;hit<nhits;hit++) {
-            mCerenkov = (AliRICHCerenkov*)RICHCerenkovs->UncheckedAt(hit);
+            mCerenkov = (AliRICHCerenkov*)pRICHCerenkovs->UncheckedAt(hit);
            (*xp)(npoints)=mCerenkov->fX;
             (*yp)(npoints)=mCerenkov->fY;
             (*zp)(npoints)=mCerenkov->fZ;
@@ -1064,6 +1079,9 @@ void AliRICHDisplay::Paint(Option_t *)
 //_____________________________________________________________________________
 void AliRICHDisplay::SetPickMode()
 {
+
+// Toggle pick mode
+
     fZoomMode = 0;
     
     fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
@@ -1073,6 +1091,9 @@ void AliRICHDisplay::SetPickMode()
 //_____________________________________________________________________________
 void AliRICHDisplay::SetZoomMode()
 {
+
+// Toggle Zoom mode
+
     fZoomMode = 1;
     
     fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
@@ -1132,9 +1153,9 @@ void AliRICHDisplay::ShowNextEvent(Int_t delta)
     
     if (delta) {
        gAlice->Clear();
-       Int_t current_event = gAlice->GetHeader()->GetEvent();
-       Int_t new_event     = current_event + delta;
-       gAlice->GetEvent(new_event);
+       Int_t currentEvent = gAlice->GetHeader()->GetEvent();
+       Int_t newEvent     = currentEvent + delta;
+       gAlice->GetEvent(newEvent);
        if (!gAlice->TreeD()) return; 
     }
     LoadDigits();
@@ -1148,6 +1169,9 @@ void AliRICHDisplay::ShowNextEvent(Int_t delta)
 //______________________________________________________________________________
 void AliRICHDisplay::UnZoom()
 {
+
+// Return to previous zoom factor
+
     if (fZooms <= 0) return;
     fZooms--;
     TPad *pad = (TPad*)gPad->GetPadSave();
@@ -1240,120 +1264,3 @@ void AliRICHDisplay::DrawViewX3D()
    if (!view) return;
    pad->x3d();
 }
-
-
-
-
-ClassImp(AliRICHEllipse)
-
-//________________________________________________________________________________
-AliRICHEllipse::AliRICHEllipse()
-{ 
-    fCx = 0;
-    fCy = 0;
-    fOmega = 0;
-    fTheta = 0;
-    fPhi = 0;
-    h= 0;
-}
-
-//________________________________________________________________________________
-AliRICHEllipse::~AliRICHEllipse()
-{ 
-    fCx = 0;
-    fCy = 0;
-    fOmega = 0;
-    fTheta = 0;
-    fPhi = 0;
-    h= 0;
-}
-
-
-//________________________________________________________________________________
-AliRICHEllipse::AliRICHEllipse(Float_t cx, Float_t cy, Float_t omega, Float_t theta, Float_t phi)
-{ 
-    fCx = cx;
-    fCy = cy;
-    fOmega = omega;
-    fTheta = theta;
-    fPhi = phi;
-    h=11.25;
-}
-
-//________________________________________________________________________________
-void AliRICHEllipse::CreatePoints(Int_t chamber)
-{
-  Int_t s1,s2;
-  Float_t fiducial=h*TMath::Tan(fOmega+fTheta), l=h/TMath::Cos(fTheta), xtrial, y, c0, c1, c2;
-  //TRandom *random=new TRandom();
-
-  AliRICH *RICH  = (AliRICH*)gAlice->GetModule("RICH");
-  AliRICHChamber*       iChamber;
-  
-  iChamber = &(RICH->Chamber(chamber));
-  //cout<<"fiducial="<<fiducial<<endl;
-  
-  for(Float_t i=0;i<1000;i++)
-    {
-      
-      Float_t counter=0;
-      
-      c0=0;c1=0;c2=0;
-      while((c1*c1-4*c2*c0)<=0 && counter<1000)
-       {
-         //Choose which side to go...
-         if(i>250 && i<750) s1=1; 
-         //if (gRandom->Rndm(1)>.5) s1=1;
-         else s1=-1;
-         //printf("s1:%d\n",s1);
-         //Trial a y
-         y=s1*i*gRandom->Rndm(Int_t(fiducial/50));
-         //printf("Fiducial %f  for omega:%f theta:%f phi:%f\n",fiducial,fOmega,fTheta,fPhi);
-         Float_t alfa1=fTheta;
-         Float_t theta1=fPhi;
-         Float_t OMEGA1=fOmega;
-         
-         //Solve the eq for a trial x
-         c0=-TMath::Power(y*TMath::Cos(alfa1)*TMath::Cos(theta1),2)-TMath::Power(y*TMath::Sin(alfa1),2)+TMath::Power(l*TMath::Tan(OMEGA1),2)+2*l*y*TMath::Cos(alfa1)*TMath::Sin(theta1)*TMath::Power(TMath::Tan(OMEGA1),2)+TMath::Power(y*TMath::Cos(alfa1)*TMath::Sin(theta1)*TMath::Tan(OMEGA1),2);
-         c1=2*y*TMath::Cos(alfa1)*TMath::Sin(alfa1)-2*y*TMath::Cos(alfa1)*TMath::Power(TMath::Cos(theta1),2)*TMath::Sin(alfa1)+2*l*TMath::Sin(alfa1)*TMath::Sin(theta1)*TMath::Power(TMath::Tan(OMEGA1),2)+2*y*TMath::Cos(alfa1)*TMath::Sin(alfa1)*TMath::Power(TMath::Sin(theta1),2)*TMath::Power(TMath::Tan(OMEGA1),2);
-         c2=-TMath::Power(TMath::Cos(alfa1),2)-TMath::Power(TMath::Cos(theta1)*TMath::Sin(alfa1),2)+TMath::Power(TMath::Sin(alfa1)*TMath::Sin(theta1)*TMath::Tan(OMEGA1),2);
-         //cout<<"Trial: y="<<y<<"c0="<<c0<<" c1="<<c1<<" c2="<<c2<<endl;
-         //printf("Result:%f\n\n",c1*c1-4*c2*c0);
-         //i+=.01;
-         counter +=1;
-       }
-      
-      if (counter>=1000)
-       y=0; 
-
-      //Choose which side to go...
-      //if(gRandom->Rndm(1)>.5) s=1; 
-      //else s=-1;
-      if(i>500) s2=1;
-      //if (gRandom->Rndm(1)>.5) s2=1;
-      else s2=-1;
-      xtrial=fCx+(-c1+s2*TMath::Sqrt(c1*c1-4*c2*c0))/(2*c2);
-      //cout<<"x="<<xtrial<<" y="<<cy+y<<endl;
-      //printf("Coordinates: %f %f\n",xtrial,fCy+y);
-
-      Float_t VecLoc[3]={xtrial,6.276,(fCy+y)};
-      Float_t  VecGlob[3];
-      iChamber->LocaltoGlobal(VecLoc,VecGlob);
-      SetPoint(i,VecGlob[0],VecGlob[1],VecGlob[2]);
-      //printf("Coordinates: %f %f %f\n",VecGlob[0],VecGlob[1],VecGlob[2]);
-    }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
index 529a221003d36dd02684f2f5e5a5b5febfc25e45..27f5e9bab6c7ef7912909cc00a651e6c6bdea885 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef AliRICHDisplay_H
-#define AliRICHDisplay_H
+#ifndef ALIRICHDISPLAY_H
+#define ALIRICHDISPLAY_H
 
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
@@ -35,43 +35,7 @@ class AliRICHEllipse;
 
 const Int_t kMAXZOOM = 20;
 
-class AliRICHDisplay : /*splaypublic TObject,*/ public AliDisplay {
-    
- private:
-    Int_t             fChamber;
-    Int_t             fCathode;
-    Int_t             fZoomMode;             //=1 if in zoom mode
-    
-    Bool_t            fDrawClusters;         //Flag True if Clusters to be drawn
-    Bool_t            fDrawCoG;              //Flag True if CoG to be drawn
-    Bool_t            fDrawRecHits;          //Flag True if rec hits to be drawn
-    Float_t           fTheta;                //Viewing angle theta
-    Float_t           fPhi;                  //Viewing angle phi
-    Float_t           fPsi;                  //Viewving angle psi (rotation on display)
-    Float_t           fRrange;               //Size of view in R
-    Float_t           fZrange;               //Size of view along Z
-    Float_t           fZoomX0[20];           //Low x range of zoom number i
-    Float_t           fZoomY0[20];           //Low y range of zoom number i
-    Float_t           fZoomX1[20];           //High x range of zoom number i
-    Float_t           fZoomY1[20];           //High y range of zoom number i
-    Int_t             fZooms;                //Number of zooms
-    Int_t             fHitsCuts;             //Number of hits surviving cuts
-    Int_t             fClustersCuts;         //Number of clusters surviving cuts
-    TCanvas          *fCanvas;               //Pointer to the display canvas
-    TPad             *fTrigPad;              //Pointer to the trigger pad 
-    TPad             *fColPad;               //Pointer to the colors pad 
-    TPad             *fButtons;              //Pointer to the buttons pad
-    TPad             *fPad;                  //Pointer to the event display main pad
-    TSlider          *fRangeSlider;          //Range slider
-    TButton          *fPickButton;           //Button to activate Pick mode
-    TButton          *fZoomButton;           //Button to activate Zoom mode
-    TArc             *fArcButton;            //Gren/Red button to show Pick/Zoom mode
-    TObjArray        *fPoints;               //Array of points for each cathode
-    TObjArray        *fPhits;                //Array of hit points for each chamber
-    TObjArray        *fPCerenkovs;           //Array of cerenkov hits for each chamber
-    TObjArray        *fRpoints;              //Array of cog points for each cathode 
-    TObjArray        *fRecpoints;            //Array of rec points for each cathode 
-    
+class AliRICHDisplay : public AliDisplay {
  public:
     AliRICHDisplay();
     AliRICHDisplay(Int_t size);
@@ -120,28 +84,42 @@ class AliRICHDisplay : /*splaypublic TObject,*/ public AliDisplay {
     virtual void      ResetRecpoints();
     virtual void      ResetPhits();
     virtual void      ResetPCerenkovs();
-    ClassDef(AliRICHDisplay, 0)   //Utility class to display RICH clusters...
-};
-
-
-class AliRICHEllipse :  public TPolyMarker3D {
-
-public:
-    AliRICHEllipse();
-    AliRICHEllipse(Float_t cx, Float_t cy, Float_t omega, Float_t theta, Float_t phi);
+ private:
+    Int_t             fChamber;              //Chamber number
+    Int_t             fCathode;              //Cathode number
+    Int_t             fZoomMode;             //=1 if in zoom mode
     
-    virtual          ~AliRICHEllipse();
-    virtual void CreatePoints(Int_t chamber);
-
-    Float_t fOmega;
-    Float_t fTheta;
-    Float_t fPhi;
-    Float_t fCx;
-    Float_t fCy;
-    Float_t h;
-
-    ClassDef(AliRICHEllipse, 1)   //Utility class to draw an ellipse
-};
+    Bool_t            fDrawClusters;         //Flag True if Clusters to be drawn
+    Bool_t            fDrawCoG;              //Flag True if CoG to be drawn
+    Bool_t            fDrawRecHits;          //Flag True if rec hits to be drawn
+    Float_t           fTheta;                //Viewing angle theta
+    Float_t           fPhi;                  //Viewing angle phi
+    Float_t           fPsi;                  //Viewving angle psi (rotation on display)
+    Float_t           fRrange;               //Size of view in R
+    Float_t           fZrange;               //Size of view along Z
+    Float_t           fZoomX0[20];           //Low x range of zoom number i
+    Float_t           fZoomY0[20];           //Low y range of zoom number i
+    Float_t           fZoomX1[20];           //High x range of zoom number i
+    Float_t           fZoomY1[20];           //High y range of zoom number i
+    Int_t             fZooms;                //Number of zooms
+    Int_t             fHitsCuts;             //Number of hits surviving cuts
+    Int_t             fClustersCuts;         //Number of clusters surviving cuts
+    TCanvas          *fCanvas;               //Pointer to the display canvas
+    TPad             *fTrigPad;              //Pointer to the trigger pad 
+    TPad             *fColPad;               //Pointer to the colors pad 
+    TPad             *fButtons;              //Pointer to the buttons pad
+    TPad             *fPad;                  //Pointer to the event display main pad
+    TSlider          *fRangeSlider;          //Range slider
+    TButton          *fPickButton;           //Button to activate Pick mode
+    TButton          *fZoomButton;           //Button to activate Zoom mode
+    TArc             *fArcButton;            //Gren/Red button to show Pick/Zoom mode
+    TObjArray        *fPoints;               //Array of points for each cathode
+    TObjArray        *fPhits;                //Array of hit points for each chamber
+    TObjArray        *fPCerenkovs;           //Array of cerenkov hits for each chamber
+    TObjArray        *fRpoints;              //Array of cog points for each cathode 
+    TObjArray        *fRecpoints;            //Array of rec points for each cathode 
+    ClassDef(AliRICHDisplay, 0)   //Utility class to display RICH clusters...
        
+};
 #endif
        
diff --git a/RICH/AliRICHEllipse.cxx b/RICH/AliRICHEllipse.cxx
new file mode 100644 (file)
index 0000000..d1f9d5a
--- /dev/null
@@ -0,0 +1,150 @@
+/**************************************************************************
+ * 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 "AliRICHEllipse.h"
+#include "AliRICH.h"
+#include "AliRun.h"
+
+#include <TRandom.h>
+
+ClassImp(AliRICHEllipse)
+
+//________________________________________________________________________________
+AliRICHEllipse::AliRICHEllipse()
+{ 
+
+//  Default Constructor for a RICH ellipse
+
+    fCx = 0;
+    fCy = 0;
+    fOmega = 0;
+    fTheta = 0;
+    fPhi = 0;
+    fh= 0;
+}
+
+//________________________________________________________________________________
+AliRICHEllipse::~AliRICHEllipse()
+{ 
+
+// Destructor
+
+    fCx = 0;
+    fCy = 0;
+    fOmega = 0;
+    fTheta = 0;
+    fPhi = 0;
+    fh= 0;
+}
+
+
+//________________________________________________________________________________
+AliRICHEllipse::AliRICHEllipse(Float_t cx, Float_t cy, Float_t omega, Float_t theta, Float_t phi)
+{ 
+
+//  Constructor for a RICH ellipse
+
+    fCx = cx;
+    fCy = cy;
+    fOmega = omega;
+    fTheta = theta;
+    fPhi = phi;
+    fh=11.25;
+}
+
+//________________________________________________________________________________
+void AliRICHEllipse::CreatePoints(Int_t chamber)
+{
+
+// Create points along the ellipse equation
+
+  Int_t s1,s2;
+  Float_t fiducial=fh*TMath::Tan(fOmega+fTheta), l=fh/TMath::Cos(fTheta), xtrial, y=0, c0, c1, c2;
+  //TRandom *random=new TRandom();
+
+  AliRICH *pRICH  = (AliRICH*)gAlice->GetModule("RICH");
+  AliRICHChamber*       iChamber;
+  
+  iChamber = &(pRICH->Chamber(chamber));
+  //cout<<"fiducial="<<fiducial<<endl;
+  
+  for(Float_t i=0;i<1000;i++)
+    {
+      
+      Float_t counter=0;
+      
+      c0=0;c1=0;c2=0;
+      while((c1*c1-4*c2*c0)<=0 && counter<1000)
+       {
+         //Choose which side to go...
+         if(i>250 && i<750) s1=1; 
+         //if (gRandom->Rndm(1)>.5) s1=1;
+         else s1=-1;
+         //printf("s1:%d\n",s1);
+         //Trial a y
+         y=s1*i*gRandom->Rndm(Int_t(fiducial/50));
+         //printf("Fiducial %f  for omega:%f theta:%f phi:%f\n",fiducial,fOmega,fTheta,fPhi);
+         Float_t alfa1=fTheta;
+         Float_t theta1=fPhi;
+         Float_t omega1=fOmega;
+         
+         //Solve the eq for a trial x
+         c0=-TMath::Power(y*TMath::Cos(alfa1)*TMath::Cos(theta1),2)-TMath::Power(y*TMath::Sin(alfa1),2)+TMath::Power(l*TMath::Tan(omega1),2)+2*l*y*TMath::Cos(alfa1)*TMath::Sin(theta1)*TMath::Power(TMath::Tan(omega1),2)+TMath::Power(y*TMath::Cos(alfa1)*TMath::Sin(theta1)*TMath::Tan(omega1),2);
+         c1=2*y*TMath::Cos(alfa1)*TMath::Sin(alfa1)-2*y*TMath::Cos(alfa1)*TMath::Power(TMath::Cos(theta1),2)*TMath::Sin(alfa1)+2*l*TMath::Sin(alfa1)*TMath::Sin(theta1)*TMath::Power(TMath::Tan(omega1),2)+2*y*TMath::Cos(alfa1)*TMath::Sin(alfa1)*TMath::Power(TMath::Sin(theta1),2)*TMath::Power(TMath::Tan(omega1),2);
+         c2=-TMath::Power(TMath::Cos(alfa1),2)-TMath::Power(TMath::Cos(theta1)*TMath::Sin(alfa1),2)+TMath::Power(TMath::Sin(alfa1)*TMath::Sin(theta1)*TMath::Tan(omega1),2);
+         //cout<<"Trial: y="<<y<<"c0="<<c0<<" c1="<<c1<<" c2="<<c2<<endl;
+         //printf("Result:%f\n\n",c1*c1-4*c2*c0);
+         //i+=.01;
+         counter +=1;
+       }
+      
+      if (counter>=1000)
+       y=0; 
+
+      //Choose which side to go...
+      //if(gRandom->Rndm(1)>.5) s=1; 
+      //else s=-1;
+      if(i>500) s2=1;
+      //if (gRandom->Rndm(1)>.5) s2=1;
+      else s2=-1;
+      xtrial=fCx+(-c1+s2*TMath::Sqrt(c1*c1-4*c2*c0))/(2*c2);
+      //cout<<"x="<<xtrial<<" y="<<cy+y<<endl;
+      //printf("Coordinates: %f %f\n",xtrial,fCy+y);
+
+      Float_t vectorLoc[3]={xtrial,6.276,(fCy+y)};
+      Float_t  vectorGlob[3];
+      iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
+      SetPoint(i,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
+      //printf("Coordinates: %f %f %f\n",vectorGlob[0],vectorGlob[1],vectorGlob[2]);
+    }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/RICH/AliRICHEllipse.h b/RICH/AliRICHEllipse.h
new file mode 100644 (file)
index 0000000..899e39a
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef ALIRICHELLIPSE_H
+#define ALIRICHELLIPSE_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#include <TPolyMarker3D.h>
+
+class AliRICHEllipse :  public TPolyMarker3D {
+
+ public:
+    AliRICHEllipse();
+    AliRICHEllipse(Float_t cx, Float_t cy, Float_t omega, Float_t theta, Float_t phi);
+    
+    virtual          ~AliRICHEllipse();
+    virtual void CreatePoints(Int_t chamber);
+ private:
+    Float_t fOmega;                    //Cherenkov angle 
+    Float_t fTheta;                    //Incidence angle (dip angle)
+    Float_t fPhi;                      //Incidence angle 
+    Float_t fCx;                       //Hit coordinate-x
+    Float_t fCy;                       //Hit coordinate-y
+    Float_t fh;                        //Distance from radiator to pads
+
+    ClassDef(AliRICHEllipse, 1)   //Utility class to draw an ellipse
+};
+#endif
+       
diff --git a/RICH/AliRICHGeometry.cxx b/RICH/AliRICHGeometry.cxx
new file mode 100644 (file)
index 0000000..b250c40
--- /dev/null
@@ -0,0 +1,21 @@
+/**************************************************************************
+ * 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 "AliRICHGeometry.h"
+
+ClassImp(AliRICHGeometry)
diff --git a/RICH/AliRICHGeometry.h b/RICH/AliRICHGeometry.h
new file mode 100644 (file)
index 0000000..b8bb70d
--- /dev/null
@@ -0,0 +1,81 @@
+#ifndef ALIRICHGEOMETRY_H
+#define ALIRICHGEOMETRY_H
+
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#include <TObject.h>
+
+
+class AliRICHGeometry : //Chamber geometry
+public TObject {
+ public:
+    // Radiator Thickness
+    void   SetGapThickness(Float_t thickness) {fGapThickness=thickness;} 
+    // Proximity Gap Thickness
+    void   SetProximityGapThickness(Float_t thickness) {fProximityGapThickness=thickness;}
+    // Quartz Length
+    void   SetQuartzLength(Float_t length) {fQuartzLength=length;}
+    // Quartz Width
+    void   SetQuartzWidth(Float_t width) {fQuartzWidth=width;}
+    // Quartz Thickness
+    void   SetQuartzThickness(Float_t thickness) {fQuartzThickness=thickness;}
+    // Freon Length
+    void   SetOuterFreonLength(Float_t length) {fOuterFreonLength=length;}
+    // Freon Width
+    void   SetOuterFreonWidth(Float_t width) {fOuterFreonWidth=width;}
+    // Freon Length
+    void   SetInnerFreonLength(Float_t length) {fInnerFreonLength=length;}
+    // Freon Width
+    void   SetInnerFreonWidth(Float_t width) {fInnerFreonWidth=width;}
+    // Freon Thickness
+    void   SetFreonThickness(Float_t thickness) {fFreonThickness=thickness;}
+    // Freon Thickness
+    void   SetRadiatorToPads(Float_t distance) {fRadiatorToPads=distance;}
+
+    // Radiator thickness
+    Float_t  GetGapThickness() {return fGapThickness;}
+    // Proximity Gap thickness
+    Float_t  GetProximityGapThickness() {return fProximityGapThickness;}
+    // Quartz Length
+    Float_t  GetQuartzLength() {return fQuartzLength;}
+    // Quartz Width
+    Float_t  GetQuartzWidth() {return fQuartzWidth;}
+    // Quartz Thickness
+    Float_t  GetQuartzThickness() {return fQuartzThickness;}
+    // Freon Length
+    Float_t  GetOuterFreonLength() {return fOuterFreonLength;}
+    // Freon Width
+    Float_t  GetOuterFreonWidth() {return fOuterFreonWidth;}
+    // Freon Length
+    Float_t  GetInnerFreonLength() {return fInnerFreonLength;}
+    // Freon Width
+    Float_t  GetInnerFreonWidth() {return fInnerFreonWidth;}
+    // Freon Thickness
+    Float_t  GetFreonThickness() {return fFreonThickness;}
+    // Get distance between radiator and pads
+    Float_t  GetRadiatorToPads() {return fRadiatorToPads;}   
+    
+ private:
+    Float_t fGapThickness;            // Gap Thickness
+    Float_t fProximityGapThickness;   // Proximity Gap Thickness
+    Float_t fQuartzLength;            // Quartz Length
+    Float_t fQuartzWidth;             // Quartz Width
+    Float_t fQuartzThickness;         // Quartz Thickness
+    Float_t fOuterFreonLength;        // Outer Freon Length
+    Float_t fOuterFreonWidth;         // Outer Freon Width
+    Float_t fInnerFreonLength;        // Inner Freon Length
+    Float_t fInnerFreonWidth;         // Inner Freon Width
+    Float_t fFreonThickness;          // Freon Thickness
+    Float_t fRadiatorToPads;          // Distance from radiator to pads
+
+    ClassDef(AliRICHGeometry,1)
+};
+#endif
+
+
+
+
diff --git a/RICH/AliRICHHit.cxx b/RICH/AliRICHHit.cxx
new file mode 100644 (file)
index 0000000..3fc6f74
--- /dev/null
@@ -0,0 +1,44 @@
+/**************************************************************************
+ * 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 "AliRICHHit.h"
+ClassImp(AliRICHHit)
+//___________________________________________
+AliRICHHit::AliRICHHit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
+    AliHit(shunt, track)
+{
+// Constructor
+    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];
+    fNPads=hits[17];
+}
diff --git a/RICH/AliRICHHit.h b/RICH/AliRICHHit.h
new file mode 100644 (file)
index 0000000..9be73d1
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef ALIRICHHIT_H
+#define ALIRICHHIT_H
+
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+
+#include "AliHit.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
+    Float_t   fNPads;           // Pads hit
+ 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
+};
+#endif
index 3cc9537c6eb41e089dc093b6d5c324c4a552ff8c..673c5877fc7881b0f772e4664c9d4913deba1fd7 100644 (file)
 
 /*
   $Log$
+  Revision 1.4  2000/04/19 13:14:36  morsch
+  Minor changes on class names.
+
 */
 
 
 #include "AliRICHHitMap.h"
 
 ClassImp(AliRICHHitMap)
-ClassImp(AliRICHHitMapA1)
-
-
-AliRICHHitMapA1::AliRICHHitMapA1(AliRICHSegmentation *seg, TObjArray *dig)
-{
-    fSegmentation = seg;
-    fNpx  = fSegmentation->Npx();
-    fNpy  = fSegmentation->Npy();
-    fMaxIndex=2*(fNpx+1)*2*(fNpy+1)+2*fNpy;
-    
-    fHitMap = new Int_t[fMaxIndex];
-    fDigits =  dig;
-    fNdigits = fDigits->GetEntriesFast();
-    Clear();
-}
-
-
-AliRICHHitMapA1::~AliRICHHitMapA1()
-{
-//    if (fDigits) delete   fDigits;
-    if (fHitMap) delete[] fHitMap;
-}
-
-void AliRICHHitMapA1::Clear()
-{
-    memset(fHitMap,0,sizeof(int)*fMaxIndex);
-}
-
-Int_t AliRICHHitMapA1::CheckedIndex(Int_t ix, Int_t iy)
-{
-    Int_t index=2*fNpy*(ix+fNpx)+(iy+fNpy);
-    if (index > fMaxIndex) {
-       printf("\n \n \n Try to read/write outside array !!!! \n \n %d %d %d %d %d %d",ix,iy, fMaxIndex, index, fNpx, fNpy);
-       return  fMaxIndex-1;
-    } else {
-       return index;
-    }
-}
-
-       
-void  AliRICHHitMapA1::FillHits()
-{
-    Int_t ndigits = fDigits->GetEntriesFast();
-    //printf("\n Filling hits into HitMap\n");
-    //printf("FindRawClusters -- ndigits %d \n",ndigits);
-    if (!ndigits) return;
-    AliRICHDigit *dig;
-    for (Int_t ndig=0; ndig<fNdigits; ndig++) {
-       dig = (AliRICHDigit*)fDigits->UncheckedAt(ndig);
-       SetHit(dig->fPadX,dig->fPadY,ndig);
-    }
-}
-
-
-void  AliRICHHitMapA1::SetHit(Int_t ix, Int_t iy, Int_t idigit)
-{
-//    fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=idigit+1;
-    fHitMap[CheckedIndex(ix, iy)]=idigit+1;
-}
-
-void AliRICHHitMapA1::DeleteHit(Int_t ix, Int_t iy)
-{
-//    fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=0;
-    fHitMap[CheckedIndex(ix, iy)]=0;
-}
-
-void AliRICHHitMapA1::FlagHit(Int_t ix, Int_t iy)
-{
-    fHitMap[CheckedIndex(ix, iy)]=
-       -TMath::Abs(fHitMap[CheckedIndex(ix, iy)]);
-}
-
-Int_t AliRICHHitMapA1::GetHitIndex(Int_t ix, Int_t iy)
-{
-    return TMath::Abs(fHitMap[CheckedIndex(ix, iy)])-1;
-}
-
-TObject* AliRICHHitMapA1::GetHit(Int_t ix, Int_t iy)
-{
-    Int_t index=GetHitIndex(ix,iy);
-    // Force crash if index does not exist ! (Manu)
-    return (index <0) ? 0 : fDigits->UncheckedAt(GetHitIndex(ix,iy));
-}
-
-Flag_t AliRICHHitMapA1::TestHit(Int_t ix, Int_t iy)
-{
-    Int_t inf=fHitMap[CheckedIndex(ix, iy)];
-    if (inf < 0) {
-       return used;
-    } else if (inf == 0) {
-       return empty;
-    } else {
-       return unused;
-    }
-}
-
-
index bbe5ba66a5495dc15fa898fc32de38033cee15fd..50c1335ca76d61230b7fb05ffc291e04bc5d2896 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef AliRICHHitMap_H
-#define AliRICHHitMap_H
+#ifndef ALIRICHHITMAP_H
+#define ALIRICHHITMAP_H
 
 
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
@@ -8,53 +8,26 @@
 /* $Id$ */
 
 
-#include "AliRICH.h"
-#include "TArrayI.h"
-typedef enum {empty, used, unused} Flag_t;
+#include <TObject.h>
+
+
+typedef enum {kEmpty, kUsed, kUnused} FlagType;
 const Int_t kMaxNpadx=1200, kMaxNpady=1200;
 
 class AliRICHHitMap :
 public TObject {
  public:
-    virtual  void  FillHits()                                      =0;
-    virtual  void  Clear()                                         =0;
-    virtual  void  SetHit(Int_t ix, Int_t iy, Int_t idigit)        =0;
-    virtual  void  DeleteHit(Int_t ix, Int_t iy)                   =0;
-    virtual Int_t  GetHitIndex(Int_t ix, Int_t iy)                 =0;
-    virtual TObject * GetHit(Int_t ix, Int_t iy)                   =0;
-    virtual void   FlagHit(Int_t ix, Int_t iy)                     =0;    
-    virtual Flag_t TestHit(Int_t ix, Int_t iy)                     =0;
+    virtual  void    FillHits()                                      =0;
+    virtual  void    Clear()                                         =0;
+    virtual  void    SetHit(Int_t ix, Int_t iy, Int_t idigit)        =0;
+    virtual  void    DeleteHit(Int_t ix, Int_t iy)                   =0;
+    virtual Int_t    GetHitIndex(Int_t ix, Int_t iy)                 =0;
+    virtual TObject* GetHit(Int_t ix, Int_t iy)                      =0;
+    virtual void     FlagHit(Int_t ix, Int_t iy)                     =0;    
+    virtual FlagType TestHit(Int_t ix, Int_t iy)                     =0;
     
     ClassDef(AliRICHHitMap,1) //virtual base class for muon HitMap
 };
-
-class AliRICHHitMapA1 :
-public AliRICHHitMap 
-{
- private:
-    AliRICHSegmentation *fSegmentation;
-    Int_t fNpx;
-    Int_t fNpy;
-    TObjArray *fDigits;
-    Int_t fNdigits;
-    Int_t *fHitMap;                  //!
-    Int_t fMaxIndex;
-    
- public:
-    AliRICHHitMapA1(AliRICHSegmentation *seg, TObjArray *dig);
-    virtual ~AliRICHHitMapA1();
-    virtual  void  FillHits();
-    virtual  void  Clear();    
-    virtual  void  SetHit(Int_t ix, Int_t iy, Int_t idigit);
-    virtual  void  DeleteHit(Int_t ix, Int_t iy);
-    virtual Int_t  GetHitIndex(Int_t ix, Int_t iy);
-    virtual TObject*  GetHit(Int_t ix, Int_t);
-    virtual  void  FlagHit(Int_t ix, Int_t iy);    
-    virtual Flag_t TestHit(Int_t ix, Int_t iy);
-    private:
-    Int_t CheckedIndex(Int_t ix, Int_t iy);
-    ClassDef(AliRICHHitMapA1,1) // Implements HitMap as a 2-dim array
-};
 #endif 
 
 
diff --git a/RICH/AliRICHHitMapA1.cxx b/RICH/AliRICHHitMapA1.cxx
new file mode 100644 (file)
index 0000000..390ced0
--- /dev/null
@@ -0,0 +1,156 @@
+/**************************************************************************
+ * 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 "AliRICHHitMapA1.h"
+#include "AliRICHSegmentation.h"
+#include "AliRICHDigit.h"
+
+#include <TObjArray.h>
+#include <TMath.h>
+
+ClassImp(AliRICHHitMapA1)
+
+
+AliRICHHitMapA1::AliRICHHitMapA1(AliRICHSegmentation *seg, TObjArray *dig)
+{
+
+// Constructor for AliRICHMapA1
+
+    fSegmentation = seg;
+    fNpx  = fSegmentation->Npx();
+    fNpy  = fSegmentation->Npy();
+    fMaxIndex=2*(fNpx+1)*2*(fNpy+1)+2*fNpy;
+    
+    fHitMap = new Int_t[fMaxIndex];
+    fDigits =  dig;
+    fNdigits = fDigits->GetEntriesFast();
+    Clear();
+}
+
+
+AliRICHHitMapA1::~AliRICHHitMapA1()
+{
+// Destructor
+//    if (fDigits) delete   fDigits;
+    if (fHitMap) delete[] fHitMap;
+}
+
+void AliRICHHitMapA1::Clear()
+{
+
+// Clear contents of hit map
+
+    memset(fHitMap,0,sizeof(int)*fMaxIndex);
+}
+
+Int_t AliRICHHitMapA1::CheckedIndex(Int_t ix, Int_t iy)
+{
+
+// Check if index is valid
+
+    Int_t index=2*fNpy*(ix+fNpx)+(iy+fNpy);
+    if (index > fMaxIndex) {
+       printf("\n \n \n Try to read/write outside array !!!! \n \n %d %d %d %d %d %d",ix,iy, fMaxIndex, index, fNpx, fNpy);
+       return  fMaxIndex-1;
+    } else {
+       return index;
+    }
+}
+
+       
+void  AliRICHHitMapA1::FillHits()
+{
+
+// Fill hits into HitMap
+
+    Int_t ndigits = fDigits->GetEntriesFast();
+    //printf("\n Filling hits into HitMap\n");
+    //printf("FindRawClusters -- ndigits %d \n",ndigits);
+    if (!ndigits) return;
+    AliRICHDigit *dig;
+    for (Int_t ndig=0; ndig<fNdigits; ndig++) {
+       dig = (AliRICHDigit*)fDigits->UncheckedAt(ndig);
+       SetHit(dig->fPadX,dig->fPadY,ndig);
+    }
+}
+
+
+void  AliRICHHitMapA1::SetHit(Int_t ix, Int_t iy, Int_t idigit)
+{
+//
+// Set current hit
+//    fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=idigit+1;
+    fHitMap[CheckedIndex(ix, iy)]=idigit+1;
+}
+
+void AliRICHHitMapA1::DeleteHit(Int_t ix, Int_t iy)
+{
+// Delete hit
+//
+//    fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=0;
+    fHitMap[CheckedIndex(ix, iy)]=0;
+}
+
+void AliRICHHitMapA1::FlagHit(Int_t ix, Int_t iy)
+{
+//
+// Flag hit
+
+    fHitMap[CheckedIndex(ix, iy)]=
+       -TMath::Abs(fHitMap[CheckedIndex(ix, iy)]);
+}
+
+Int_t AliRICHHitMapA1::GetHitIndex(Int_t ix, Int_t iy)
+{
+
+// Return hit coordinates from index
+
+  printf("ix:%d, iy:%d, index:%d\n",ix,iy,CheckedIndex(ix, iy));
+   
+  return TMath::Abs(fHitMap[CheckedIndex(ix, iy)])-1;
+    
+}
+
+TObject* AliRICHHitMapA1::GetHit(Int_t ix, Int_t iy)
+{
+
+// Return index from coordinates
+
+    Int_t index=GetHitIndex(ix,iy);
+    // Force crash if index does not exist ! (Manu)
+    return (index <0) ? 0 : fDigits->UncheckedAt(GetHitIndex(ix,iy));
+}
+
+FlagType AliRICHHitMapA1::TestHit(Int_t ix, Int_t iy)
+{
+
+// Is there a hit?
+
+    Int_t inf=fHitMap[CheckedIndex(ix, iy)];
+    if (inf < 0) {
+       return kUsed;
+    } else if (inf == 0) {
+       return kEmpty;
+    } else {
+       return kUnused;
+    }
+}
+
+
diff --git a/RICH/AliRICHHitMapA1.h b/RICH/AliRICHHitMapA1.h
new file mode 100644 (file)
index 0000000..e135271
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef ALIRICHHITMAPA1_H
+#define ALIRICHHITMAPA1_H
+
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+#include "AliRICHHitMap.h"
+
+class  TObjArray;
+class  AliRICHSegmentation;
+
+
+class AliRICHHitMapA1 :
+public AliRICHHitMap 
+{
+    
+ public:
+    AliRICHHitMapA1(AliRICHSegmentation *seg, TObjArray *dig);
+    virtual ~AliRICHHitMapA1();
+    virtual  void    FillHits();
+    virtual  void    Clear();    
+    virtual  void    SetHit(Int_t ix, Int_t iy, Int_t idigit);
+    virtual  void    DeleteHit(Int_t ix, Int_t iy);
+    virtual Int_t    GetHitIndex(Int_t ix, Int_t iy);
+    virtual TObject* GetHit(Int_t ix, Int_t iy);
+    virtual  void    FlagHit(Int_t ix, Int_t iy);    
+    virtual FlagType TestHit(Int_t ix, Int_t iy);
+ private:
+    Int_t CheckedIndex(Int_t ix, Int_t iy);
+
+ private:
+    AliRICHSegmentation *fSegmentation;                    //Segmentation model
+    Int_t fNpx;                                            //Pads in x
+    Int_t fNpy;                                            //Pads in y
+    TObjArray *fDigits;                                    //List of digits
+    Int_t fNdigits;                                        //Number of digits
+    Int_t *fHitMap;                                        // !
+    Int_t fMaxIndex;                                       //Index size
+
+    ClassDef(AliRICHHitMapA1,1) // Implements HitMap as a 2-dim array
+};
+#endif 
+
+
+
+
+
diff --git a/RICH/AliRICHPadHit.cxx b/RICH/AliRICHPadHit.cxx
new file mode 100644 (file)
index 0000000..e5ae9cc
--- /dev/null
@@ -0,0 +1,38 @@
+/**************************************************************************
+ * 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 "AliRICHPadHit.h"
+
+ClassImp(AliRICHPadHit)
+//______________________________________________________________
+AliRICHPadHit::AliRICHPadHit(Int_t *clhits)
+{
+
+// Default constructor for AliRICHPadHits
+
+  fHitNumber=clhits[0];
+  fCathode=clhits[1];
+  fQ=clhits[2];
+  fPadX=clhits[3];
+  fPadY=clhits[4];
+  fQpad=clhits[5];
+  fRSec=clhits[6];
+}
+
diff --git a/RICH/AliRICHPadHit.h b/RICH/AliRICHPadHit.h
new file mode 100644 (file)
index 0000000..5122be7
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef ALIRICHPADHIT_H
+#define ALIRICHPADHIT_H
+
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#include <TObject.h>
+
+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
+};
+#endif
index c134f7043f3c86bcbdcb5756ccc032f96d243314..c48db2b2574753f5b46743b333fcd2ee77f46440 100644 (file)
 
 /*
   $Log$
+  Revision 1.1  2000/06/09 14:53:01  jbarbosa
+  Bari's pattern recognition algorithm
+
 */
 
-#include "DataStructures.h"
+#include "AliRICHHit.h"
+#include "AliRICHCerenkov.h"
+#include "AliRICHPadHit.h"
+#include "AliRICHDigit.h"
+#include "AliRICHRawCluster.h"
+#include "AliRICHRecHit.h"
 #include "AliRun.h"
 #include "AliDetector.h"
 #include "AliRICH.h"
 #include "AliRICHPoints.h"
-#include "AliRICHSegResV0.h"
+#include "AliRICHSegmentation.h"
 #include "AliRICHPatRec.h"
 #include "AliRICH.h"
 #include "AliRICHConst.h"
 #include "AliRICHPoints.h"
 #include "AliConst.h"
-#include "TParticle.h"
-#include "TMath.h"
-#include "TRandom.h"
-#include "TCanvas.h"
-#include "TH2.h"
+
+#include <TParticle.h>
+#include <TMath.h>
+#include <TRandom.h>
+#include <TCanvas.h>
+#include <TH2.h>
 
 
 ClassImp(AliRICHPatRec)
 //___________________________________________
 AliRICHPatRec::AliRICHPatRec() : TObject()
 {
+  // Default constructor
+  
     //fChambers = 0;
 }
 //___________________________________________
 AliRICHPatRec::AliRICHPatRec(const char *name, const char *title)
     : TObject()
 {
-    
+    //Constructor for Bari's pattern recogniton method object
 }
 
 void AliRICHPatRec::PatRec()
 {
 
+// Pattern recognition algorithm
+
   AliRICHChamber*       iChamber;
   AliRICHSegmentation*  segmentation;
        
-  Int_t ntracks, ndigits[7];
+  Int_t ntracks, ndigits[kNCH];
   Int_t itr, ich, i;
-  Int_t GoodPhotons;
+  Int_t goodPhotons;
   Int_t x,y,q;
   Float_t rx,ry;
   Int_t nent,status;
 
-  Float_t gamma,MassCer,BetaCer;
+  Float_t gamma,massCer,betaCer;
 
   Float_t rechit[5];
 
@@ -76,10 +89,10 @@ void AliRICHPatRec::PatRec()
   TH1F *hough    = new TH1F("hough","hough",75,0.45,0.75);
   TH1F *mass     = new TH1F("mass","mass",100,50.,1050.); 
  
-  AliRICH *RICH  = (AliRICH*)gAlice->GetDetector("RICH");
-  TTree *TH = gAlice->TreeH();
+  AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
+  TTree *treeH = gAlice->TreeH();
 
-  ntracks =(Int_t) TH->GetEntries();
+  ntracks =(Int_t) treeH->GetEntries();
   //  ntracks = 1;
   for (itr=0; itr<ntracks; itr++) {
  
@@ -88,20 +101,20 @@ void AliRICHPatRec::PatRec()
     printf(" theta %f phi %f track \n",fTrackTheta,fTrackPhi);
     //    ring->Fill(fTrackLoc[0],fTrackLoc[1],100.);
 
-    iChamber = &(RICH->Chamber(ich));
+    iChamber = &(pRICH->Chamber(ich));
     segmentation=iChamber->GetSegmentationModel();
 
     nent=(Int_t)gAlice->TreeD()->GetEntries();
     gAlice->TreeD()->GetEvent(nent-1);
-    TClonesArray *Digits = RICH->DigitsAddress(ich);
-    ndigits[ich] = Digits->GetEntriesFast();
+    TClonesArray *pDigitss = pRICH->DigitsAddress(ich);
+    ndigits[ich] = pDigitss->GetEntriesFast();
     printf("ndigits %d in chamber %d\n",ndigits[ich],ich);
     AliRICHDigit *padI = 0;
 
-    GoodPhotons = 0;
+    goodPhotons = 0;
 
     for (Int_t dig=0;dig<ndigits[ich];dig++) {
-      padI=(AliRICHDigit*) Digits->UncheckedAt(dig);
+      padI=(AliRICHDigit*) pDigitss->UncheckedAt(dig);
       x=padI->fPadX;
       y=padI->fPadY;
       q=padI->fSignal;
@@ -120,14 +133,14 @@ void AliRICHPatRec::PatRec()
       ring->Fill(fXpad,fYpad,1.);
       cerangle->Fill(fCerenkovAnglePad,1.);
 
-      GoodPhotons++;
-      fEtaPhotons[GoodPhotons] = fCerenkovAnglePad;
+      goodPhotons++;
+      fEtaPhotons[goodPhotons] = fCerenkovAnglePad;
     }
-    fNumEtaPhotons = GoodPhotons;
+    fNumEtaPhotons = goodPhotons;
 
     BackgroundEstimation();
 
-    for(i=0;i<GoodPhotons;i++) {
+    for(i=0;i<goodPhotons;i++) {
       ceranglew->Fill(fEtaPhotons[i],fWeightPhotons[i]);
       //      printf(" Eta %f weight %f \n",fEtaPhotons[i],fWeightPhotons[i]);
     }
@@ -143,23 +156,23 @@ void AliRICHPatRec::PatRec()
 
     hough->Fill(fThetaCerenkov,1.);
     
-    RICH->AddRecHit(ich,rechit);
+    pRICH->AddRecHit(ich,rechit);
     
-    BetaCer = BetaCerenkov(1.29,fThetaCerenkov);
-    gamma  = 1./sqrt(1.-pow(BetaCer,2));
-    MassCer = fTrackMom/(BetaCer*gamma);
-    //    printf(" mass %f \n",MassCer);
-    mass->Fill(MassCer*1000,1.);
+    betaCer = BetaCerenkov(1.29,fThetaCerenkov);
+    gamma  = 1./sqrt(1.-pow(betaCer,2));
+    massCer = fTrackMom/(betaCer*gamma);
+    //    printf(" mass %f \n",massCer);
+    mass->Fill(massCer*1000,1.);
   }    
 
   gAlice->TreeR()->Fill();
   TClonesArray *fRec;
-  for (i=0;i<7;i++) {
-    fRec=RICH->RecHitsAddress(i);
+  for (i=0;i<kNCH;i++) {
+    fRec=pRICH->RecHitsAddress(i);
     int ndig=fRec->GetEntriesFast();
     printf ("Chamber %d, rings %d\n",i,ndig);
   }
-  RICH->ResetRecHits();
+  pRICH->ResetRecHits();
   
 
   c1->Divide(2,2);
@@ -193,11 +206,11 @@ Int_t AliRICHPatRec::TrackParam(Int_t itr, Int_t &ich)
   printf("Calling TrackParam\n");
 
     gAlice->ResetHits();
-    TTree *TH = gAlice->TreeH();
-    TH->GetEvent(itr);
+    TTree *treeH = gAlice->TreeH();
+    treeH->GetEvent(itr);
  
-    AliRICH *RICH  = (AliRICH*)gAlice->GetDetector("RICH");
-    AliRICHHit* mHit=(AliRICHHit*)RICH->FirstHit(-1);
+    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;
@@ -212,7 +225,7 @@ Int_t AliRICHPatRec::TrackParam(Int_t itr, Int_t &ich)
     iloss = mHit->fLoss;
     part  = mHit->fParticle;
 
-    iChamber = &(RICH->Chamber(ich));
+    iChamber = &(pRICH->Chamber(ich));
     iChamber->GlobaltoLocal(trackglob,trackloc);
 
     segmentation=iChamber->GetSegmentationModel();
@@ -242,6 +255,9 @@ Int_t AliRICHPatRec::TrackParam(Int_t itr, Int_t &ich)
 Float_t AliRICHPatRec::EstimationAtLimits(Float_t lim, Float_t radius,
                                                  Float_t phiphot)
 {
+
+// Estimation of emission point
+
   Float_t nquartz = 1.585;
   Float_t ngas    = 1.;
   Float_t nfreon  = 1.295;
@@ -272,7 +288,7 @@ Float_t AliRICHPatRec::PhotonCerenkovAngle()
   Float_t eps = 0.0001;
   Int_t   niterEmiss = 0;
   Int_t   niterEmissMax = 0;
-  Float_t x1,x2,x3,p1,p2,p3;
+  Float_t x1,x2,x3=0,p1,p2,p3;
   Float_t argY,argX;
   Int_t niterFun;
 
@@ -331,119 +347,128 @@ Float_t AliRICHPatRec::PhotonCerenkovAngle()
 
 void AliRICHPatRec::EmissionPoint()
 { 
-  Float_t AbsorLength=7.83*fRw; //absorption length in the freon (cm)
+
+// Find emission point
+
+  Float_t absorbtionLength=7.83*fRw; //absorption length in the freon (cm)
   // 7.83 = -1/ln(T0) where 
   // T0->Trasmission freon at 180nm = 0.88 (Eph=6.85eV)
-  Float_t PhotonLength, PhotonLengthMin, PhotonLengthMax;
+  Float_t photonLength, photonLengthMin, photonLengthMax;
 
-  PhotonLength=exp(-fRw/(AbsorLength*cos(fCerenkovAnglePad)));
-  PhotonLengthMin=fRw*PhotonLength/(1.-PhotonLength);
-  PhotonLengthMax=AbsorLength*cos(fCerenkovAnglePad);
-  fEmissPoint = fRw + PhotonLengthMin - PhotonLengthMax;
+  photonLength=exp(-fRw/(absorbtionLength*cos(fCerenkovAnglePad)));
+  photonLengthMin=fRw*photonLength/(1.-photonLength);
+  photonLengthMax=absorbtionLength*cos(fCerenkovAnglePad);
+  fEmissPoint = fRw + photonLengthMin - photonLengthMax;
 
 }
 
 void AliRICHPatRec::PhotonSelection(Int_t track, Int_t &nphot, Float_t &thetamean)
 {
+
+// not implemented yet
+
   printf("Calling PhotonSelection\n");
 }
 
 void AliRICHPatRec::BackgroundEstimation()
 {
-  Float_t StepEta   = 0.001;  
-  Float_t EtaMinBkg = 0.72;
-  Float_t EtaMaxBkg = 0.75;
-  Float_t EtaMin    = 0.;
-  Float_t EtaMax    = 0.75;
+
+// estimate background noise
+
+  Float_t stepEta   = 0.001;  
+  Float_t etaMinBkg = 0.72;
+  Float_t etaMaxBkg = 0.75;
+  Float_t etaMin    = 0.;
+  Float_t etaMax    = 0.75;
   Float_t ngas      = 1.;
   Float_t nfreon    = 1.295;
 
-  Float_t EtaStepMin,EtaStepMax,EtaStepAvg;
+  Float_t etaStepMin,etaStepMax,etaStepAvg;
   Int_t i,ip,nstep;
-  Int_t NumPhotBkg, NumPhotonStep;
-  Float_t FunBkg,AreaBkg,NormBkg;
-  Float_t DensityBkg,StoreBkg,NumStore;
-  Float_t ThetaSig;
+  Int_t numPhotBkg, numPhotonStep;
+  Float_t funBkg,areaBkg,normBkg;
+  Float_t densityBkg,storeBkg,numStore;
+  Float_t thetaSig;
   
-  NumPhotBkg = 0;
-  AreaBkg = 0.;
+  numPhotBkg = 0;
+  areaBkg = 0.;
 
-  nstep = (int)((EtaMaxBkg-EtaMinBkg)/StepEta);
+  nstep = (int)((etaMaxBkg-etaMinBkg)/stepEta);
 
   for (i=0;i<fNumEtaPhotons;i++) {
 
-    if(fEtaPhotons[i]>EtaMinBkg && fEtaPhotons[i]<EtaMaxBkg) {
-      NumPhotBkg++;
+    if(fEtaPhotons[i]>etaMinBkg && fEtaPhotons[i]<etaMaxBkg) {
+      numPhotBkg++;
     }    
   }
-  if (NumPhotBkg == 0) {
+  if (numPhotBkg == 0) {
      for (i=0;i<fNumEtaPhotons;i++) {
         fWeightPhotons[i] = 1.;
      }
     return;
   }
 
-  //  printf(" NumPhotBkg %i ",NumPhotBkg);
+  //  printf(" numPhotBkg %i ",numPhotBkg);
 
   for (i=0;i<nstep;i++) {
-    EtaStepMin = EtaMinBkg + (Float_t)(i)*StepEta;
-    EtaStepMax = EtaMinBkg + (Float_t)(i+1)*StepEta;    
-    EtaStepAvg = 0.5*(EtaStepMax + EtaStepMin);
+    etaStepMin = etaMinBkg + (Float_t)(i)*stepEta;
+    etaStepMax = etaMinBkg + (Float_t)(i+1)*stepEta;    
+    etaStepAvg = 0.5*(etaStepMax + etaStepMin);
     /*
-    FunBkg = tan(EtaStepAvg)*pow((1.+pow(tan(EtaStepAvg),2)),
-                                 5.52)-7.803 + 22.02*tan(EtaStepAvg);
+    funBkg = tan(etaStepAvg)*pow((1.+pow(tan(etaStepAvg),2)),
+                                 5.52)-7.803 + 22.02*tan(etaStepAvg);
     */
-    ThetaSig = asin(nfreon/ngas*sin(EtaStepAvg));
-    FunBkg = tan(ThetaSig)*(1.+pow(tan(ThetaSig),2))*nfreon
-       /ngas*cos(EtaStepAvg)/cos(ThetaSig);
-    AreaBkg += StepEta*FunBkg;
+    thetaSig = asin(nfreon/ngas*sin(etaStepAvg));
+    funBkg = tan(thetaSig)*(1.+pow(tan(thetaSig),2))*nfreon
+       /ngas*cos(etaStepAvg)/cos(thetaSig);
+    areaBkg += stepEta*funBkg;
   }
 
-  DensityBkg = 0.95*(Float_t)(NumPhotBkg)/AreaBkg;
-  //  printf(" DensityBkg %f \n",DensityBkg);
+  densityBkg = 0.95*(Float_t)(numPhotBkg)/areaBkg;
+  //  printf(" densityBkg %f \n",densityBkg);
   
-  nstep = (int)((EtaMax-EtaMin)/StepEta); 
-  StoreBkg = 0.;
-  NumStore = 0;
+  nstep = (int)((etaMax-etaMin)/stepEta); 
+  storeBkg = 0.;
+  numStore = 0;
   for (i=0;i<nstep;i++) {
-    EtaStepMin = EtaMinBkg + (Float_t)(i)*StepEta;
-    EtaStepMax = EtaMinBkg + (Float_t)(i+1)*StepEta;    
-    EtaStepAvg = 0.5*(EtaStepMax + EtaStepMin);
+    etaStepMin = etaMinBkg + (Float_t)(i)*stepEta;
+    etaStepMax = etaMinBkg + (Float_t)(i+1)*stepEta;    
+    etaStepAvg = 0.5*(etaStepMax + etaStepMin);
     /*
-    FunBkg = tan(EtaStepAvg)*pow((1.+pow(tan(EtaStepAvg),2)),
-                                 5.52)-7.803 + 22.02*tan(EtaStepAvg);
+    funBkg = tan(etaStepAvg)*pow((1.+pow(tan(etaStepAvg),2)),
+                                 5.52)-7.803 + 22.02*tan(etaStepAvg);
     */
 
-    ThetaSig = asin(nfreon/ngas*sin(EtaStepAvg));
-    FunBkg = tan(ThetaSig)*(1.+pow(tan(ThetaSig),2))*nfreon
-       /ngas*cos(EtaStepAvg)/cos(ThetaSig);
+    thetaSig = asin(nfreon/ngas*sin(etaStepAvg));
+    funBkg = tan(thetaSig)*(1.+pow(tan(thetaSig),2))*nfreon
+       /ngas*cos(etaStepAvg)/cos(thetaSig);
 
-    AreaBkg = StepEta*FunBkg;
-    NormBkg = DensityBkg*AreaBkg; 
-    NumPhotonStep = 0;
+    areaBkg = stepEta*funBkg;
+    normBkg = densityBkg*areaBkg; 
+    numPhotonStep = 0;
     for (ip=0;ip<fNumEtaPhotons;ip++) {
-      if(fEtaPhotons[ip]>EtaStepMin && fEtaPhotons[ip]<EtaStepMax) {
-        NumPhotonStep++;
+      if(fEtaPhotons[ip]>etaStepMin && fEtaPhotons[ip]<etaStepMax) {
+        numPhotonStep++;
       }
     }
-    if (NumPhotonStep == 0) {
-      StoreBkg += NormBkg;
-      NumStore++;
-      if (NumStore>50) {
-        NumStore = 0;
-        StoreBkg = 0.;
+    if (numPhotonStep == 0) {
+      storeBkg += normBkg;
+      numStore++;
+      if (numStore>50) {
+        numStore = 0;
+        storeBkg = 0.;
       }
     }
-    if (NumPhotonStep == 0) continue;
+    if (numPhotonStep == 0) continue;
     for (ip=0;ip<fNumEtaPhotons;ip++) {
-      if(fEtaPhotons[ip]>EtaStepMin && fEtaPhotons[ip]<EtaStepMax) {
-        NormBkg +=StoreBkg;
-        StoreBkg = 0;
-        NumStore = 0;
-        fWeightPhotons[ip] = 1. - NormBkg/(Float_t)(NumPhotonStep);
+      if(fEtaPhotons[ip]>etaStepMin && fEtaPhotons[ip]<etaStepMax) {
+        normBkg +=storeBkg;
+        storeBkg = 0;
+        numStore = 0;
+        fWeightPhotons[ip] = 1. - normBkg/(Float_t)(numPhotonStep);
        /*
-        printf(" NormBkg %f NumPhotonStep %i fW %f \n",
-              NormBkg, NumPhotonStep, fWeightPhotons[ip]);
+        printf(" normBkg %f numPhotonStep %i fW %f \n",
+              normBkg, numPhotonStep, fWeightPhotons[ip]);
        */
         if(fWeightPhotons[ip]<0) fWeightPhotons[ip] = 0.;
       }
@@ -454,6 +479,9 @@ void AliRICHPatRec::BackgroundEstimation()
 
 void AliRICHPatRec::FlagPhotons(Int_t track, Float_t theta)
 {
+
+// not implemented yet
+
   printf("Calling FlagPhotons\n");
 }
 
@@ -469,9 +497,9 @@ Int_t AliRICHPatRec::PhotonInBand()
   //0=label for parameters giving internal band ellipse
   //1=label for parameters giving external band ellipse  
 
-  Float_t imp[2], mass[2], Energ[2], beta[2]; 
-  Float_t EmissPointLength[2];
-  Float_t E1, E2, F1, F2;
+  Float_t imp[2], mass[2], energy[2], beta[2]; 
+  Float_t emissPointLength[2];
+  Float_t e1, e2, f1, f2;
   Float_t nfreon[2], nquartz[2]; 
   Int_t times;
 
@@ -485,8 +513,8 @@ Int_t AliRICHPatRec::PhotonInBand()
   mass[0] = 0.938; //proton mass 
   mass[1] = 0.139; //pion mass
 
-  EmissPointLength[0] = fRw-0.0001; //at the beginning of the radiator
-  EmissPointLength[1] = 0.;//at the end of radiator
+  emissPointLength[0] = fRw-0.0001; //at the beginning of the radiator
+  emissPointLength[1] = 0.;//at the end of radiator
   
   //parameters to calculate freon window refractive index vs. energy
   Float_t a = 1.177;
@@ -497,29 +525,29 @@ Int_t AliRICHPatRec::PhotonInBand()
   Energ[0]  = 5.6;
   Energ[1]  = 7.7;
   */
-  Energ[0]  = 5.0;
-  Energ[1]  = 8.0;
-  E1 = 10.666;
-  E2  = 18.125;
-  F1  = 46.411;
-  F2  = 228.71;
+  energy[0]  = 5.0;
+  energy[1]  = 8.0;
+  e1 = 10.666;
+  e2  = 18.125;
+  f1  = 46.411;
+  f2  = 228.71;
 
 
   phpad = PhiPad();  
 
   for (times=0; times<=1; times++) {
   
-    nfreon[times]   = a+b*Energ[times];
+    nfreon[times]   = a+b*energy[times];
 
-    nquartz[times] = sqrt(1+(F1/(pow(E1,2)-pow(Energ[times],2)))+
-                         (F2/(pow(E2,2)-pow(Energ[times],2))));
+    nquartz[times] = sqrt(1+(f1/(pow(e1,2)-pow(energy[times],2)))+
+                         (f2/(pow(e2,2)-pow(energy[times],2))));
 
     beta[times]  = imp[times]/sqrt(pow(imp[times],2)+pow(mass[times],2));
    
     thetacer[times] =  CherenkovAngle( nfreon[times], beta[times]);
 
     bandradius[times] = DistanceFromMip( nfreon[times], nquartz[times],
-                                       EmissPointLength[times], 
+                                       emissPointLength[times], 
                                         thetacer[times], phpad);
   }
 
@@ -533,27 +561,30 @@ Int_t AliRICHPatRec::PhotonInBand()
 }
 
 Float_t AliRICHPatRec::DistanceFromMip(Float_t nfreon, Float_t nquartz, 
-                      Float_t EmissPointLength, Float_t thetacer, 
+                      Float_t emissPointLength, Float_t thetacer, 
                       Float_t phpad)
 { 
-  Float_t DistanceValue;
 
-  TVector3 RadExitPhot(1,1,1);//photon impact at the radiator exit with respect
+// Find the distance to MIP impact
+
+  Float_t distanceValue;
+
+  TVector3 radExitPhot(1,1,1);//photon impact at the radiator exit with respect
   //to local reference sistem with the origin in the MIP entrance 
    
-  TVector3 VectEmissPointLength(1,1,1);
-  Float_t MagEmissPointLenght;
+  TVector3 vectEmissPointLength(1,1,1);
+  Float_t magEmissPointLenght;
 
-  TVector3 RadExitPhot2(1,1,1);//photon impact at the radiator exit with respect
-  Float_t MagRadExitPhot2;
+  TVector3 radExitPhot2(1,1,1);//photon impact at the radiator exit with respect
+  Float_t magRadExitPhot2;
   //to a reference sistem with origin in the photon emission point and  
   //axes parallel to the MIP reference sistem
 
-  TVector3 QuarExitPhot(1,1,1);//photon impact at the quartz exit with respect
-  Float_t MagQuarExitPhot;
+  TVector3 quarExitPhot(1,1,1);//photon impact at the quartz exit with respect
+  Float_t magQuarExitPhot;
   // 
-  TVector3 GapExitPhot(1,1,1) ;
-  Float_t MagGapExitPhot;
+  TVector3 gapExitPhot(1,1,1) ;
+  Float_t magGapExitPhot;
   //
   TVector3 fPhotocatExitPhot(1,1,1);
   Double_t theta2;
@@ -563,15 +594,15 @@ Float_t AliRICHPatRec::DistanceFromMip(Float_t nfreon, Float_t nquartz,
 
   Float_t ngas    = 1.;
 
-  MagEmissPointLenght =  EmissPointLength/cos(fTrackTheta);
+  magEmissPointLenght =  emissPointLength/cos(fTrackTheta);
 
-  VectEmissPointLength.SetMag(MagEmissPointLenght);
-  VectEmissPointLength.SetTheta(fTrackTheta);
-  VectEmissPointLength.SetPhi(fTrackPhi);
+  vectEmissPointLength.SetMag(magEmissPointLenght);
+  vectEmissPointLength.SetTheta(fTrackTheta);
+  vectEmissPointLength.SetPhi(fTrackPhi);
 
 
-  RadExitPhot2.SetTheta(thetacer);  
-  RadExitPhot2.SetPhi(phpad); 
+  radExitPhot2.SetTheta(thetacer);  
+  radExitPhot2.SetPhi(phpad); 
 
 
   TRotation r1;
@@ -587,51 +618,54 @@ Float_t AliRICHPatRec::DistanceFromMip(Float_t nfreon, Float_t nquartz,
   //following by a rotation about the z axis by MIP phi incidence angle; 
 
 
-  RadExitPhot2    = r * RadExitPhot2;
-  theta2          = RadExitPhot2.Theta();
-  MagRadExitPhot2 = (fRw -  VectEmissPointLength(2))/cos(theta2);
-  RadExitPhot2.SetMag(MagRadExitPhot2);
+  radExitPhot2    = r * radExitPhot2;
+  theta2          = radExitPhot2.Theta();
+  magRadExitPhot2 = (fRw -  vectEmissPointLength(2))/cos(theta2);
+  radExitPhot2.SetMag(magRadExitPhot2);
 
 
-  RadExitPhot = VectEmissPointLength + RadExitPhot2;
-  thetarad    = RadExitPhot.Theta();
+  radExitPhot = vectEmissPointLength + radExitPhot2;
+  thetarad    = radExitPhot.Theta();
 
-  phirad  =  RadExitPhot.Phi(); //check on the original file //
+  phirad  =  radExitPhot.Phi(); //check on the original file //
 
   thetaquar   = SnellAngle( nfreon, nquartz, theta2); 
-  phiquar     = RadExitPhot2.Phi(); 
+  phiquar     = radExitPhot2.Phi(); 
   if(thetaquar == 999.) return thetaquar;
-  MagQuarExitPhot    = fQw/cos(thetaquar);
-  QuarExitPhot.SetMag( MagQuarExitPhot);
-  QuarExitPhot.SetTheta(thetaquar);
-  QuarExitPhot.SetPhi(phiquar);
+  magQuarExitPhot    = fQw/cos(thetaquar);
+  quarExitPhot.SetMag( magQuarExitPhot);
+  quarExitPhot.SetTheta(thetaquar);
+  quarExitPhot.SetPhi(phiquar);
 
   thetagap = SnellAngle( nquartz, ngas, thetaquar); 
   phigap   = phiquar; 
   if(thetagap == 999.) return thetagap;
-  MagGapExitPhot    = fTgap/cos(thetagap);
-  GapExitPhot.SetMag( MagGapExitPhot);
-  GapExitPhot.SetTheta(thetagap);
-  GapExitPhot.SetPhi(phigap);
+  magGapExitPhot    = fTgap/cos(thetagap);
+  gapExitPhot.SetMag( magGapExitPhot);
+  gapExitPhot.SetTheta(thetagap);
+  gapExitPhot.SetPhi(phigap);
 
-  fPhotocatExitPhot =  RadExitPhot + QuarExitPhot + GapExitPhot; 
+  fPhotocatExitPhot =  radExitPhot + quarExitPhot + gapExitPhot; 
 
-  DistanceValue = sqrt(pow(fPhotocatExitPhot(0),2)
+  distanceValue = sqrt(pow(fPhotocatExitPhot(0),2)
                            +pow(fPhotocatExitPhot(1),2)); 
-  return  DistanceValue ;
+  return  distanceValue ;
 }
 
 Float_t AliRICHPatRec::PhiPad()
 {
+
+// ??
+
   Float_t zpad;
   Float_t thetapad, phipad;
   Float_t thetarot, phirot;
 
   zpad = fRw + fQw + fTgap;
 
-  TVector3 PhotonPad(fXpad, fYpad, zpad);
-  thetapad = PhotonPad.Theta();
-  phipad = PhotonPad.Phi();
+  TVector3 photonPad(fXpad, fYpad, zpad);
+  thetapad = photonPad.Theta();
+  phipad = photonPad.Phi();
 
   TRotation r1;
   TRotation r2;
@@ -645,15 +679,18 @@ Float_t AliRICHPatRec::PhiPad()
   r = r2 * r1;//rotation about the z axis by MIP -phi incidence angle
   //following by a rotation about the y axis by MIP -theta incidence angle; 
 
-  PhotonPad  = r * PhotonPad;
+  photonPad  = r * photonPad;
 
-  phipad = PhotonPad.Phi(); 
+  phipad = photonPad.Phi(); 
 
   return phipad;
 }
 
 Float_t AliRICHPatRec:: SnellAngle(Float_t n1, Float_t n2, Float_t theta1)
 { 
+
+// Compute the Snell angle
+
   Float_t sinrefractangle;
   Float_t refractangle;
 
@@ -670,6 +707,9 @@ Float_t AliRICHPatRec:: SnellAngle(Float_t n1, Float_t n2, Float_t theta1)
 
 Float_t AliRICHPatRec::CherenkovAngle(Float_t n, Float_t beta)
 { 
+
+// Compute the cerenkov angle
+
   Float_t thetacer;  
       
   if((n*beta)<1.) {
@@ -683,6 +723,9 @@ Float_t AliRICHPatRec::CherenkovAngle(Float_t n, Float_t beta)
 
 Float_t AliRICHPatRec::BetaCerenkov(Float_t n, Float_t theta)
 { 
+
+// Find beta
+
   Float_t beta;  
       
   beta = 1./(n*cos(theta));
@@ -695,162 +738,171 @@ Float_t AliRICHPatRec::BetaCerenkov(Float_t n, Float_t theta)
 void AliRICHPatRec::HoughResponse()
 
 {      
+
+// Implement Hough response pat. rec. method
+
   int          bin=0;
   int           bin1=0;
   int           bin2=0;
-  int           i, j, k, NcorrBand;
-  int           EtaBin = 750;
-  float         HCS[750];
-  float         angle, ThetaCerMean;
+  int           i, j, k, nCorrBand;
+  int           etaBin = 750;
+  float         hcs[750];
+  float         angle, thetaCerMean;
 
-  float         EtaPeak[30];
-  float         EtaMin = 0.00;
-  float         EtaMax = 0.75;
-  float         StepEta = 0.001;
-  float         WindowEta = 0.040;
+  float         etaPeak[30];
+  float         etaMin = 0.00;
+  float         etaMax = 0.75;
+  float         stepEta = 0.001;
+  float         windowEta = 0.040;
 
-  int           Nbin;
+  int           nBin;
 
-  float EtaPeakPos  = -1;
-  Int_t   EtaPeakCount = -1;
+  float etaPeakPos  = -1;
+  Int_t   etaPeakCount = -1;
   
-  ThetaCerMean   = 0.;
+  thetaCerMean   = 0.;
   fThetaCerenkov = 0.;    
     
-  Nbin = (int)(0.5+EtaMax/(StepEta));
-  NcorrBand = (int)(0.5+ WindowEta/(2 * StepEta)); 
-  memset ((void *)HCS, 0, EtaBin*sizeof(int));
+  nBin = (int)(0.5+etaMax/(stepEta));
+  nCorrBand = (int)(0.5+ windowEta/(2 * stepEta)); 
+  memset ((void *)hcs, 0, etaBin*sizeof(int));
 
   for (k=0; k< fNumEtaPhotons; k++) {
 
     angle = fEtaPhotons[k];
 
-    if (angle>=EtaMin && angle<= EtaMax) {
-      bin = (int)(0.5+angle/(StepEta));
-      bin1= bin-NcorrBand;
-      bin2= bin+NcorrBand;
+    if (angle>=etaMin && angle<= etaMax) {
+      bin = (int)(0.5+angle/(stepEta));
+      bin1= bin-nCorrBand;
+      bin2= bin+nCorrBand;
       if (bin1<0)    bin1=0;
-      if (bin2>Nbin) bin2=Nbin;
+      if (bin2>nBin) bin2=nBin;
       
       for (j=bin1; j<bin2; j++) {
-        HCS[j] += fWeightPhotons[k]; 
+        hcs[j] += fWeightPhotons[k]; 
       }
 
-      ThetaCerMean += angle;
+      thetaCerMean += angle;
     }
   }
  
ThetaCerMean /= fNumEtaPhotons; 
thetaCerMean /= fNumEtaPhotons; 
  
-  HoughFiltering(HCS);
-
-  for (bin=0; bin <Nbin; bin++) {
-    angle = (bin+0.5) * (StepEta);
-    if (HCS[bin] && HCS[bin] > EtaPeakPos) {
-      EtaPeakCount = 0;
-      EtaPeakPos = HCS[bin];
-      EtaPeak[0]=angle;
+  HoughFiltering(hcs);
+
+  for (bin=0; bin <nBin; bin++) {
+    angle = (bin+0.5) * (stepEta);
+    if (hcs[bin] && hcs[bin] > etaPeakPos) {
+      etaPeakCount = 0;
+      etaPeakPos = hcs[bin];
+      etaPeak[0]=angle;
     }
     else { 
-      if (HCS[bin] == EtaPeakPos) {
-       EtaPeak[++EtaPeakCount] = angle;
+      if (hcs[bin] == etaPeakPos) {
+       etaPeak[++etaPeakCount] = angle;
       }
     }
   } 
 
-  for (i=0; i<EtaPeakCount+1; i++) {
-    fThetaCerenkov += EtaPeak[i];
+  for (i=0; i<etaPeakCount+1; i++) {
+    fThetaCerenkov += etaPeak[i];
   }
-  if (EtaPeakCount>=0) {
-    fThetaCerenkov /= EtaPeakCount+1;
-    fThetaPeakPos = EtaPeakPos;
+  if (etaPeakCount>=0) {
+    fThetaCerenkov /= etaPeakCount+1;
+    fThetaPeakPos = etaPeakPos;
   }
 }
 
 
-void AliRICHPatRec::HoughFiltering(float HCS[])
+void AliRICHPatRec::HoughFiltering(float hcs[])
 {
-   float HCS_filt[750];
-   float K[5] = {0.05, 0.25, 0.4, 0.25, 0.05};
-   int nx, i, nx_dx;
+
+// hough filtering
+
+   float hcsFilt[750];
+   float k[5] = {0.05, 0.25, 0.4, 0.25, 0.05};
+   int nx, i, nxDx;
    int sizeHCS;
-   int Nbin;
+   int nBin;
 
-   int   EtaBin = 750;
-   float EtaMax = 0.75;
-   float StepEta = 0.001;
+   int   etaBin = 750;
+   float etaMax = 0.75;
+   float stepEta = 0.001;
 
-   Nbin =  (int)(1+EtaMax/StepEta); 
-   sizeHCS = EtaBin*sizeof(float);
+   nBin =  (int)(1+etaMax/stepEta); 
+   sizeHCS = etaBin*sizeof(float);
 
-   memset ((void *)HCS_filt, 0, sizeHCS); 
+   memset ((void *)hcsFilt, 0, sizeHCS); 
 
-   for (nx = 0; nx < Nbin; nx++) {
+   for (nx = 0; nx < nBin; nx++) {
       for (i = 0; i < 5; i++)  {
-        nx_dx = nx + (i-2);
-       if (nx_dx> -1 && nx_dx<Nbin)
-             HCS_filt[nx] +=  HCS[nx_dx] * K[i];
+        nxDx = nx + (i-2);
+       if (nxDx> -1 && nxDx<nBin)
+             hcsFilt[nx] +=  hcs[nxDx] * k[i];
       }      
    }
      
-   for (nx = 0; nx < Nbin; nx++) {
-     HCS[nx] = HCS_filt[nx];
+   for (nx = 0; nx < nBin; nx++) {
+     hcs[nx] = hcsFilt[nx];
    }
 }
 
 Float_t AliRICHPatRec::CherenkovRingDrawing(Float_t fixedthetacer)
-
 {
 
 //to draw Cherenkov ring by known Cherenkov angle
 
-   Int_t nmaxdegrees, nstepdegrees;
-   Float_t phpad, thetacer;
-   Float_t nfreonave, nquartzave;
-   Float_t AveEnerg;
-   Float_t Energ[2];
-   Float_t E1, E2, F1, F2;
-   Float_t bandradius;
-   Float_t CoordPadRing;
-
+    Int_t nmaxdegrees, nstepdegrees;
+    Float_t phpad, thetacer;
+    Float_t nfreonave, nquartzave;
+    Float_t aveEnerg;
+    Float_t energy[2];
+    Float_t e1, e2, f1, f2;
+    Float_t bandradius;
+    Float_t coordPadRing;
+    
 //parameters to calculate freon window refractive index vs. energy
-   Float_t a = 1.177;
-   Float_t b = 0.0172;
-
+    Float_t a = 1.177;
+    Float_t b = 0.0172;
+    
 //parameters to calculate quartz window refractive index vs. energy
 /*
    Energ[0]  = 5.6;
    Energ[1]  = 7.7;
 */     
-   Energ[0]  = 5.0;
-   Energ[1]  = 8.0;
-   E1  = 10.666;
-   E2  = 18.125;
-   F1  = 46.411;
-   F2  = 228.71;
-
-
-   nmaxdegrees = 360;
+    energy[0]  = 5.0;
+    energy[1]  = 8.0;
+    e1  = 10.666;
+    e2  = 18.125;
+    f1  = 46.411;
+    f2  = 228.71;
+   
 
+    nmaxdegrees = 360;
+    
    nstepdegrees = 36;
-
+   
    for (phpad=0; phpad<nmaxdegrees;phpad++) { 
       
-     AveEnerg =  (Energ[0]+Energ[1])/2.;
-
-     nfreonave  = a+b*AveEnerg;
-     nquartzave = sqrt(1+(F1/(pow(E1,2)-pow(AveEnerg,2)))+
-                        (F2/(pow(E2,2)-pow(AveEnerg,2))));
-
-     thetacer =  fixedthetacer;
-
-     bandradius = DistanceFromMip(nfreonave, nquartzave,
+       aveEnerg =  (energy[0]+energy[1])/2.;
+       
+       nfreonave  = a+b*aveEnerg;
+       nquartzave = sqrt(1+(f1/(pow(e1,2)-pow(aveEnerg,2)))+
+                        (f2/(pow(e2,2)-pow(aveEnerg,2))));
+       
+       thetacer =  fixedthetacer;
+       
+       bandradius = DistanceFromMip(nfreonave, nquartzave,
                                   fEmissPoint,thetacer, phpad); 
 
-     CoordPadRing=fPhotocatExitPhot;
+       coordPadRing=fPhotocatExitPhot;
+       
+       phpad = (nmaxdegrees/nstepdegrees)*phpad;
+       
+       return coordPadRing;
+   }
+
+    return coordPadRing;
+}
 
-     phpad = (nmaxdegrees/nstepdegrees)*phpad;
 
-     return CoordPadRing;
-                                                                                   }
- }
index 7492b42713ed837b6f6c57d177fbab0cc7dcd8a5..c91000489962130bcd2dbe1e31794abcf1dc92e8 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef AliRICHPatRec_H
-#define AliRICHPatRec_H
+#ifndef ALIRICHPATREC_H
+#define ALIRICHPATREC_H
 
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
@@ -61,38 +61,38 @@ class AliRICHPatRec : public TObject {
   //new
   Float_t CherenkovRingDrawing(Float_t fixedthetacer);
 
+ public:
+  Int_t   fNumEtaPhotons;                 // Number of photons
+  Float_t fEtaPhotons[1000];              // Cerenkov angle each photon
+  Float_t fWeightPhotons[1000];           // weight for each photon
+  Float_t fThetaCerenkov;                 // Theta angle for photon
+  Float_t fThetaPeakPos;                  // Peak position
+
+  Float_t fDTheta;                        //Step for sliding window
+  Float_t fWindowWidth;                   //Hough width of sliding window
 
 private:
 
-  Float_t fRw,fQw,fTgap;
+  Float_t fRw,fQw,fTgap;                  //  
 
-  Float_t fTrackLoc[3];
-  Float_t fTrackTheta;
-  Float_t fTrackPhi;
-  Float_t fTrackMom;
-  Float_t fXpad;
-  Float_t fYpad;
-  Int_t   fQpad;
+  Float_t fTrackLoc[3];                   // Position of track
+  Float_t fTrackTheta;                    // Theta angle for track (dip angle)
+  Float_t fTrackPhi;                      // Phi angle
+  Float_t fTrackMom;                      // Track momentum
+  Float_t fXpad;                          // x-position of pad hit
+  Float_t fYpad;                          // y-position of pad hit
+  Int_t   fQpad;                          // Charge deposited
 
-  Float_t fXshift,fYshift;
-  Float_t fEmissPoint;
+  Float_t fXshift,fYshift;                // Shifts in x and y
+  Float_t fEmissPoint;                    // Emission point for Cerenkov photons
   Float_t fCerenkovAnglePad;              // Cerenkov angle of single pad
-  Float_t fPhotocatExitPhot;              
+  Float_t fPhotocatExitPhot;              // Point of exit from photocathode 
 
 
- public:
-  Int_t   fNumEtaPhotons;
-  Float_t fEtaPhotons[1000];              // Cerenkov angle each photon
-  Float_t fWeightPhotons[1000];           // weight for each photon
-  Float_t fThetaCerenkov;
-  Float_t fThetaPeakPos;
-
-  Float_t fDTheta;                        //Step for sliding window
-  Float_t fWindowWidth;                   //Hough width of sliding window
 
-  ClassDef(AliRICHPatRec,1)  //Pat Rec module for :RICH version 0
+  ClassDef(AliRICHPatRec,1)                //Pat Rec module for :RICH version 0
       
-       };
+};
 
 
        
index 65a3088054622c50aeac0b62d55dd1e51c970c27..0bb4911a553e0dcc24a6bc22a65855cdaddabcf2 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
   $Log$
+  Revision 1.2  2000/05/18 13:43:54  jbarbosa
+  Added the ShowRing function.
+
   Revision 1.1  2000/04/19 13:16:47  morsch
   Minor changes on class names.
 
 //                                                                           //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
+#include <TPad.h>
+#include <TView.h>
+#include <TMath.h>
+
 #include "AliRICHDisplay.h"
 #include "AliRICHPoints.h"
 #include "AliRun.h"
-#include "TPad.h"
-#include "TView.h"
-#include "TMath.h"
-
-const Int_t MAX_Nipx=400, MAX_Nipy=800;
+#include "AliRICHHit.h"
+#include "AliRICHCerenkov.h"
+#include "AliRICHPadHit.h"
+#include "AliRICHDigit.h"
+#include "AliRICHRawCluster.h"
+#include "AliRICHRecHit.h"
+
+const Int_t kMaxNipx=400, kMaxNipy=800;
  
 ClassImp(AliRICHPoints)
 
@@ -148,12 +158,12 @@ AliRICHHit *AliRICHPoints::GetHit() const
   //
   //   Returns pointer to hit index in AliRun::fParticles
   //
-  AliRICH *RICH  = (AliRICH*)gAlice->GetDetector("RICH");
+  AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
   gAlice->TreeH()->GetEvent(fTrackIndex);
-  TClonesArray *RICHhits  = RICH->Hits();
-  Int_t nhits = RICHhits->GetEntriesFast();
+  TClonesArray *pRICHhits  = pRICH->Hits();
+  Int_t nhits = pRICHhits->GetEntriesFast();
   if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
-  return (AliRICHHit*)RICHhits->UncheckedAt(fHitIndex);
+  return (AliRICHHit*)pRICHhits->UncheckedAt(fHitIndex);
 }
 
 //_____________________________________________________________________________
@@ -167,17 +177,21 @@ AliRICHDigit *AliRICHPoints::GetDigit() const
   Int_t chamber=display->GetChamber();
   Int_t cathode=display->GetCathode();
    
-  AliRICH *RICH  = (AliRICH*)gAlice->GetDetector("RICH");
-  TClonesArray *RICHdigits  = RICH->DigitsAddress(chamber-1);
+  AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
+  TClonesArray *pRICHdigits  = pRICH->DigitsAddress(chamber-1);
   gAlice->TreeD()->GetEvent(cathode);
-  Int_t ndigits = RICHdigits->GetEntriesFast();
+  Int_t ndigits = pRICHdigits->GetEntriesFast();
   if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
-  return (AliRICHDigit*)RICHdigits->UncheckedAt(fDigitIndex);
+  return (AliRICHDigit*)pRICHdigits->UncheckedAt(fDigitIndex);
 }
 //----------------------------------------------------------------------------
 void AliRICHPoints::ShowRing(Int_t highlight) {
+
+//
+// Highlights all pads generated by the same mother particle
+
    
-  AliRICH *RICH  = (AliRICH*)gAlice->GetDetector("RICH");
+  AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
   AliRICHChamber*       iChamber;
   AliRICHSegmentation*  segmentation;
 
@@ -189,8 +203,8 @@ void AliRICHPoints::ShowRing(Int_t highlight) {
 
   printf("Hit %d on chamber: %d\n",fHitIndex, mHit->fChamber);
 
-  TClonesArray *digits  = RICH->DigitsAddress(mHit->fChamber - 1);
-  iChamber = &(RICH->Chamber(mHit->fChamber - 1));
+  TClonesArray *digits  = pRICH->DigitsAddress(mHit->fChamber - 1);
+  iChamber = &(pRICH->Chamber(mHit->fChamber - 1));
   segmentation=iChamber->GetSegmentationModel();
 
   Float_t dpx  = segmentation->Dpx();
@@ -220,19 +234,19 @@ void AliRICHPoints::ShowRing(Int_t highlight) {
       points->SetMarkerSize(.5);
       Float_t xpad, ypad;
       segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY,xpad, ypad);
-      Float_t VecLoc[3]={xpad,6.276,ypad};
-      Float_t  VecGlob[3];
+      Float_t vectorLoc[3]={xpad,6.276,ypad};
+      Float_t  vectorGlob[3];
       points->SetParticle(-1);
       points->SetHitIndex(-1);
       points->SetTrackIndex(-1);
       points->SetDigitIndex(digit);
-      iChamber->LocaltoGlobal(VecLoc,VecGlob);
-      points->SetPoint(0,VecGlob[0],VecGlob[1],VecGlob[2]);
+      iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
+      points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
       
       segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY, xpad, ypad);
       Float_t theta = iChamber->GetRotMatrix()->GetTheta();
       Float_t phi   = iChamber->GetRotMatrix()->GetPhi();         
-      marker=new TMarker3DBox(VecGlob[0],VecGlob[1],VecGlob[2],
+      marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
                              dpy/2,0,dpx/2,theta,phi);
       marker->SetLineColor(highlight);
       marker->SetFillStyle(1001);
@@ -256,135 +270,6 @@ void AliRICHPoints::ShowRing(Int_t highlight) {
     }
   }
 }
-//_____________________________________________________________________________
-struct Bin {
-   const AliRICHDigit *dig;
-   int idx;
-   Bin() {dig=0; idx=-1;}
-};
-
-struct PreCluster : public AliRICHRawCluster {
-   const AliRICHDigit* summit;
-   int idx;
-   int cut;
-   int npeaks;
-   PreCluster() : AliRICHRawCluster() {cut=npeaks=0;}
-};
-//_____________________________________________________________________________
-
-static void FindCluster(AliRICHChamber *iChamber, AliRICHSegmentation *segmentation, int i, int j, Bin bins[MAX_Nipx][MAX_Nipy], PreCluster &c) 
-
-{
-
-  //
-  // Find clusters
-  //
-
-  printf("I'm in FindCluster \n"); 
-
-  Bin& b=bins[i][j];
-  Int_t q=b.dig->fSignal;
-
-  printf("FindCluster - i j q %d %d %d\n",i,j,q);
-  
-  if (q<0) { 
-    q=-q;
-    c.cut=1;
-  } 
-  if (b.idx >= 0 && b.idx != c.idx) {
-    c.idx=b.idx;
-    c.npeaks++;
-  }
-  
-  if (q > TMath::Abs(c.summit->fSignal)) c.summit=b.dig;
-
-  Int_t npx  = segmentation->Npx();
-  Int_t npy  = segmentation->Npy();
-  Float_t x,y;
-  segmentation->GetPadCxy(i-npx, j-npy, x,y);
-  printf("FindCluster - x  y %f %f \n",x,y);
-
-
-  c.fX += q*x;
-  c.fY += q*y;
-  c.fQ += q;
-  
-  b.dig = 0;  b.idx = c.idx;
-  
-  if (bins[i-1][j].dig) FindCluster(iChamber,segmentation,i-1,j,bins,c);
-  if (bins[i][j-1].dig) FindCluster(iChamber,segmentation,i,j-1,bins,c);
-  if (bins[i+1][j].dig) FindCluster(iChamber,segmentation,i+1,j,bins,c);
-  if (bins[i][j+1].dig) FindCluster(iChamber,segmentation,i,j+1,bins,c);
-
-}
-
-//_____________________________________________________________________________
-
-void AliRICHPoints::GetCenterOfGravity()
-{
-  //
-  // simple RICH cluster finder from digits -- finds neighbours and 
-  // calculates center of gravity for the cluster
-  //
-  const Int_t MAX_nipx=400, MAX_nipy=800;
-  printf("\n Hallo world");
-  AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display();
-  Int_t chamber=display->GetChamber();
-  Int_t cathode=display->GetCathode();
-   
-  AliRICH *RICH  = (AliRICH*)gAlice->GetDetector("RICH");
-  AliRICHChamber *iChamber;
-  AliRICHSegmentation *segmentation;
-  iChamber =&(RICH->Chamber(chamber-1));
-  segmentation=iChamber->GetSegmentationModel(cathode);
-  Int_t npx  = segmentation->Npx();
-  Int_t npy  = segmentation->Npy();
-  Float_t zpos=iChamber->ZPosition();
-  
-  TClonesArray *RICHdigits  = RICH->DigitsAddress(chamber-1);
-  gAlice->TreeD()->GetEvent(cathode);
-  Int_t ndigits = RICHdigits->GetEntriesFast();
-  if (fDigitIndex < 0 || fDigitIndex >= ndigits) return;
-
-  AliRICHDigit  *dig;
-  dig=(AliRICHDigit*)RICHdigits->UncheckedAt(fDigitIndex);
-  Int_t ipx=dig->fPadX;
-  Int_t ipy=dig->fPadY;
-  Bin bins[MAX_nipx][MAX_nipy]; 
-  bins[ipx+npx][ipy+npy].dig=dig;
-    
-  int ndig;
-  int ncls=0;
-  for (ndig=0; ndig<ndigits; ndig++) {
-      dig = (AliRICHDigit*)RICHdigits->UncheckedAt(ndig);
-      int i=dig->fPadX, j=dig->fPadY;
-      bins[i+npx][j+npy].dig=dig;
-  }
-
-  PreCluster c; c.summit=bins[ipx+npx][ipy+npy].dig; c.idx=ncls;
-  FindCluster(iChamber,segmentation,ipx+npx, ipy+npy, bins, c);
-  if (c.npeaks>1) {
-      printf("GetCenterOfGravity -- more than one peak");
-  }
-  c.fX /= c.fQ;
-  c.fY /= c.fQ;
-  printf("GetCenterOfGravity - c.fX c.fY c.fQ %f %f %d \n",c.fX,c.fY,c.fQ);
-  
-  c.fTracks[0]=c.summit->fTracks[0];
-  c.fTracks[1]=c.summit->fTracks[1];
-  c.fTracks[2]=c.summit->fTracks[2];
-  ncls++;
-  AliRICHPoints *points = 0;
-  points = new AliRICHPoints(1);
-  points->SetMarkerColor(kYellow);
-  points->SetMarkerStyle(5);
-  points->SetMarkerSize(1.);
-  points->SetPoint(0,c.fX,c.fY,zpos);
-  points->Draw();
-  
-  printf("GetCenterOfGravity -- ncls %d \n",ncls);
-
-}
 
 //_____________________________________________________________________________
 const Text_t *AliRICHPoints::GetName() const
index 8ac31570a440876b4545a488afa100620fcd3c1b..82f7872b1adc439d1e57fcccebbc3ed95cba7387 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef AliRICHPoints_H
-#define AliRICHPoints_H
+#ifndef ALIRICHPOINTS_H
+#define ALIRICHPOINTS_H
 
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 #include <TMarker3DBox.h>
 #include "AliRICH.h"
 #include "AliPoints.h"
+class AliRICHDigit;
 
 class AliRICHPoints : public AliPoints {
-protected:
-  Int_t            fIndex;            // Particle number in AliRun::fParticles
-  Int_t            fHitIndex;         // Link to hit number 
-  Int_t            fTrackIndex;       // Link to track number 
-  Int_t            fDigitIndex;       // Link to digit 
-  TMarker3DBox     *fMarker[3];       // pointer to  associated 3D-marker
 public:
   AliRICHPoints();
   AliRICHPoints(Int_t npoints);
@@ -37,13 +32,25 @@ public:
   virtual void          DumpHit(); // *MENU*
   virtual void          InspectDigit(); // *MENU*
   virtual void          DumpDigit(); // *MENU*
-  virtual void          GetCenterOfGravity(); // *MENU*
   virtual void          ShowRing(Int_t highlight); // *MENU*
   virtual void          SetHitIndex(Int_t hitindex) {fHitIndex = hitindex;}
   virtual void          SetTrackIndex(Int_t trackindex) {fTrackIndex = trackindex;}
   virtual void          SetDigitIndex(Int_t digitindex) {fDigitIndex = digitindex;}
   virtual void          Set3DMarker(Int_t i,TMarker3DBox *marker) {fMarker[i] = marker;}  
   virtual void          SetParticle(Int_t index) {fIndex = index;}
+ protected:
+  Int_t            fIndex;            // Particle number in AliRun::fParticles
+  Int_t            fHitIndex;         // Link to hit number 
+  Int_t            fTrackIndex;       // Link to track number 
+  Int_t            fDigitIndex;       // Link to digit 
+  TMarker3DBox     *fMarker[3];       // pointer to  associated 3D-marker
+
   ClassDef(AliRICHPoints,1) //Class to draw detector clusters (is PolyMarker3D)
 };
 #endif
+
+
+
+
+
+
diff --git a/RICH/AliRICHRawCluster.cxx b/RICH/AliRICHRawCluster.cxx
new file mode 100644 (file)
index 0000000..270424b
--- /dev/null
@@ -0,0 +1,135 @@
+/**************************************************************************
+ * 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 "AliRICHRawCluster.h"
+
+
+ClassImp(AliRICHRawCluster)
+Int_t AliRICHRawCluster::Compare(TObject *obj)
+{
+
+// Compare two clusters
+
+         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()
+{
+
+// Type of physics processes
+
+    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;
+    }
+}
diff --git a/RICH/AliRICHRawCluster.h b/RICH/AliRICHRawCluster.h
new file mode 100644 (file)
index 0000000..bf25987
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef ALIRICHRAWCLUSTER_H
+#define ALIRICHRAWCLUSTER_H
+
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+#include <TObject.h>
+#include <TMath.h>
+#include <TArrayF.h>
+
+
+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;     // Charge in the peak
+    Int_t       fIndexMap[50];   //indeces of digits
+    Int_t       fOffsetMap[50];  // offset map
+    Float_t     fContMap[50];    //Contribution from digit
+    Int_t       fPhysicsMap[50]; // physics processes
+    Int_t       fMultiplicity;   //cluster multiplicity
+    Int_t       fNcluster[2];    //number of clusters
+    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 coord, Int_t from, Int_t upto);
+    static void  SortMin(Int_t *idx,Float_t *xdarray,Float_t *xarray,Float_t *yarray,Float_t *qarray,Int_t ntr);
+    
+   ClassDef(AliRICHRawCluster,1)  //Cluster object for set:RICH
+};
+#endif
diff --git a/RICH/AliRICHRecHit.cxx b/RICH/AliRICHRecHit.cxx
new file mode 100644 (file)
index 0000000..df5025d
--- /dev/null
@@ -0,0 +1,37 @@
+/**************************************************************************
+ * 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 "AliRICHRecHit.h"
+ClassImp(AliRICHRecHit)
+
+AliRICHRecHit::AliRICHRecHit(Int_t id, Float_t *rechit)
+{
+    //
+    // Creates a RICH rec. hit object
+    //
+    fTheta        = rechit[0];
+    fPhi          = rechit[1];
+    fOmega        = rechit[2];
+    fX            = rechit[3];
+    fY            = rechit[4];
+}
+
+
diff --git a/RICH/AliRICHRecHit.h b/RICH/AliRICHRecHit.h
new file mode 100644 (file)
index 0000000..4920fd1
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef ALIRICHRECHIT_H
+#define ALIRICHRECHIT_H
+
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+#include <TObject.h>
+class AliRICHRecHit : public TObject {
+public:
+  Float_t     fTheta  ;            //Incidence Angle theta
+  Float_t     fPhi  ;              //Incidence Angle phi
+  Float_t     fOmega;              //Cherenkov angle omega
+  Float_t     fX;                  //Impact coordinate x
+  Float_t     fY;                  //Impact coordinate y
+ public:
+    AliRICHRecHit() {
+      fTheta=fPhi=fOmega=0;
+    }
+    AliRICHRecHit(Int_t id, Float_t* rechit);
+    virtual ~AliRICHRecHit() {}
+    ClassDef(AliRICHRecHit,1)  //Reconstructed hit object for set:RICH
+};
+
+#endif
+
+
+
+
+
+
diff --git a/RICH/AliRICHResponse.cxx b/RICH/AliRICHResponse.cxx
new file mode 100644 (file)
index 0000000..1705d3d
--- /dev/null
@@ -0,0 +1,21 @@
+/**************************************************************************
+ * 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 "AliRICHResponse.h"
+
+ClassImp(AliRICHResponse)
diff --git a/RICH/AliRICHResponse.h b/RICH/AliRICHResponse.h
new file mode 100644 (file)
index 0000000..db55258
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef ALIRICHRESPONSE_H
+#define ALIRICHRESPONSE_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+
+//----------------------------------------------
+//
+// Chamber response virtual base class
+//
+#include <TObject.h>
+class AliRICHSegmentation;
+
+
+class AliRICHResponse :
+public TObject {
+ public:
+    //
+    // Configuration methods
+    //
+    // Number of sigmas over which cluster didintegration is performed
+    virtual void    SetSigmaIntegration(Float_t p1)           =0;
+    virtual Float_t SigmaIntegration()                        =0;
+    // charge slope in ADC/e
+    virtual void    SetChargeSlope(Float_t p1)                =0;
+    virtual Float_t ChargeSlope()                             =0;
+    // sigma of the charge spread function
+    virtual void    SetChargeSpread(Float_t p1, Float_t p2)   =0;
+    virtual Float_t ChargeSpreadX()                           =0;
+    virtual Float_t ChargeSpreadY()                           =0;
+    // Adc-count saturation value
+    virtual void    SetMaxAdc(Float_t p1)                     =0;
+    virtual Float_t MaxAdc()                                  =0;
+    // anode cathode Pitch
+    virtual void    SetPitch(Float_t)                         =0;
+    virtual Float_t Pitch()                                   =0;
+    // alpha feedback
+    virtual void    SetAlphaFeedback(Float_t)                 =0;
+    virtual Float_t AlphaFeedback()                           =0;
+    // ionisation enrgy
+    virtual void    SetEIonisation(Float_t)                   =0;
+    virtual Float_t EIonisation()                             =0;
+    // Chamber response methods
+    // Pulse height from scored quantity (eloss)
+    virtual Float_t IntPH(Float_t eloss)                       =0;
+    virtual Float_t IntPH()                                    =0;
+    // Charge disintegration
+    virtual Float_t IntXY(AliRICHSegmentation *)                 =0;
+    virtual Int_t   FeedBackPhotons(Float_t *source, Float_t qtot) =0;
+    //
+    // Mathieson parameters
+    virtual void   SetSqrtKx3(Float_t p1)                        =0;
+    virtual void   SetKx2(Float_t p1)                            =0;
+    virtual void   SetKx4(Float_t p1)                            =0;
+    virtual void   SetSqrtKy3(Float_t p1)                        =0;
+    virtual void   SetKy2(Float_t p1)                            =0;
+    virtual void   SetKy4(Float_t p1)                            =0;
+    ClassDef(AliRICHResponse,1)
+};
+
+#endif
diff --git a/RICH/AliRICHResponseV0.cxx b/RICH/AliRICHResponseV0.cxx
new file mode 100644 (file)
index 0000000..410882e
--- /dev/null
@@ -0,0 +1,215 @@
+/**************************************************************************
+ * 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 "AliRICHResponseV0.h"
+#include "AliRICHSegmentation.h"
+#include "AliRun.h"
+
+#include <TMath.h>
+#include <TRandom.h>
+#include <TParticle.h>
+//___________________________________________
+ClassImp(AliRICHResponseV0)
+
+Float_t AliRICHResponseV0::IntPH(Float_t eloss)
+{
+    // Get number of electrons and return charge
+    
+    Int_t nel;
+    nel= Int_t(eloss/fEIonisation);
+    
+    Float_t charge=0;
+    if (nel == 0) nel=1;
+    for (Int_t i=1;i<=nel;i++) {
+       charge -= fChargeSlope*TMath::Log(gRandom->Rndm());    
+    }
+    return charge;
+}
+
+Float_t AliRICHResponseV0::IntPH()
+{
+
+//  Get number of electrons and return charge, for a single photon
+
+    Float_t charge = -fChargeSlope*TMath::Log(gRandom->Rndm());
+    return charge;
+}
+
+
+
+// -------------------------------------------
+Float_t AliRICHResponseV0::IntXY(AliRICHSegmentation * segmentation)
+{
+    
+    const Float_t kInversePitch = 1/fPitch;
+    Float_t response;
+//
+//  Integration limits defined by segmentation model
+//  
+    
+    Float_t xi1, xi2, yi1, yi2;
+    segmentation->IntegrationLimits(xi1,xi2,yi1,yi2);
+
+    xi1=xi1*kInversePitch;
+    xi2=xi2*kInversePitch;
+    yi1=yi1*kInversePitch;
+    yi2=yi2*kInversePitch;
+
+    //printf("Integration Limits: %f-%f, %f-%f\n",xi1,xi2,yi1,yi2);
+    
+    //printf("KInversePitch:%f\n",kInversePitch);
+
+    //
+// The Mathieson function 
+    Double_t ux1=fSqrtKx3*TMath::TanH(fKx2*xi1);
+    Double_t ux2=fSqrtKx3*TMath::TanH(fKx2*xi2);
+    
+    Double_t uy1=fSqrtKy3*TMath::TanH(fKy2*yi1);
+    Double_t uy2=fSqrtKy3*TMath::TanH(fKy2*yi2);
+
+    //printf("Integration Data: %f-%f, %f-%f\n",ux1,ux2,uy1,uy2);
+    
+    //printf("%f %f %f %f\n",fSqrtKx3,fKx2,fKy4,fKx4);
+    
+    response=4.*fKx4*(TMath::ATan(ux2)-TMath::ATan(ux1))*fKy4*(TMath::ATan(uy2)-TMath::ATan(uy1));
+
+    //printf("Response:%f\n",response);
+
+    return response;       
+    
+}
+
+Int_t AliRICHResponseV0::FeedBackPhotons(Float_t *source, Float_t qtot)
+{
+  //
+  // Generate FeedBack photons
+  //
+  Int_t j, ipart, nt;
+    
+  Int_t sNfeed=0;
+  
+  
+  // Local variables 
+  Float_t cthf, ranf[2], phif, enfp = 0, sthf;
+  Int_t i, ifeed;
+  Float_t e1[3], e2[3], e3[3];
+  Float_t vmod, uswop;
+  Float_t fp, random;
+  Float_t dir[3], phi;
+  Int_t nfp;
+  Float_t pol[3], mom[3];
+  TLorentzVector position;
+  //
+  // Determine number of feedback photons
+
+  //  Get weight of current particle
+  TParticle *current = (TParticle*) 
+    (*gAlice->Particles())[gAlice->CurrentTrack()];
+    
+  ifeed = Int_t(current->GetWeight()/100+0.5);
+  ipart = gMC->TrackPid();
+  fp = fAlphaFeedback * qtot;
+  nfp = gRandom->Poisson(fp);
+  
+  // This call to fill the time of flight
+  gMC->TrackPosition(position);
+  //
+  // Generate photons
+  for (i = 0; i <nfp; i++) {
+       
+    // Direction
+    gMC->Rndm(ranf, 2);
+    cthf = ranf[0] * 2 - 1.;
+    if (cthf < 0)  continue;
+    sthf = TMath::Sqrt((1 - cthf) * (1 + cthf));
+    phif = ranf[1] * 2 * TMath::Pi();
+    //
+    gMC->Rndm(&random, 1);
+    if (random <= .57) {
+      enfp = 7.5e-9;
+    } else if (random <= .7) {
+      enfp = 6.4e-9;
+    } else {
+      enfp = 7.9e-9;
+    }
+
+    dir[0] = sthf * TMath::Sin(phif);
+    dir[1] = cthf;
+    dir[2] = sthf * TMath::Cos(phif);
+    gMC->Gdtom(dir, mom, 2);
+    mom[0]*=enfp;
+    mom[1]*=enfp;
+    mom[2]*=enfp;
+    
+    // Polarisation
+    e1[0] = 0;
+    e1[1] = -dir[2];
+    e1[2] = dir[1];
+    
+    e2[0] = -dir[1];
+    e2[1] = dir[0];
+    e2[2] = 0;
+    
+    e3[0] = dir[1];
+    e3[1] = 0;
+    e3[2] = -dir[0];
+    
+    vmod=0;
+    for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
+    if (!vmod) for(j=0;j<3;j++) {
+      uswop=e1[j];
+      e1[j]=e3[j];
+      e3[j]=uswop;
+    }
+    vmod=0;
+    for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
+    if (!vmod) for(j=0;j<3;j++) {
+      uswop=e2[j];
+      e2[j]=e3[j];
+      e3[j]=uswop;
+    }
+    
+    vmod=0;
+    for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
+    vmod=TMath::Sqrt(1/vmod);
+    for(j=0;j<3;j++) e1[j]*=vmod;
+    
+    vmod=0;
+    for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
+    vmod=TMath::Sqrt(1/vmod);
+    for(j=0;j<3;j++) e2[j]*=vmod;
+    
+    gMC->Rndm(ranf, 1);
+    phi = ranf[0] * 2 * TMath::Pi();
+    for(j=0;j<3;j++) pol[j]=e1[j]*TMath::Sin(phi)+e2[j]*TMath::Cos(phi);
+    gMC->Gdtom(pol, pol, 2);
+    
+    // Put photon on the stack and label it as feedback (51, 52) 
+    ++sNfeed;
+
+    gAlice->SetTrack(Int_t(1), gAlice->CurrentTrack(), Int_t(50000051),
+                    mom,source,pol,position[3],
+                    "Feedback", nt, 1.);
+  }
+  return(sNfeed);
+}
+
+
+
+
diff --git a/RICH/AliRICHResponseV0.h b/RICH/AliRICHResponseV0.h
new file mode 100644 (file)
index 0000000..85961c0
--- /dev/null
@@ -0,0 +1,76 @@
+#ifndef ALIRICHRESPONSEV0_H
+#define ALIRICHRESPONSEV0_H
+
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+
+#include "AliRICHResponse.h"
+
+class AliRICHResponseV0 : //Mathieson response
+public AliRICHResponse {
+ public:
+    AliRICHResponseV0(){}
+    virtual ~AliRICHResponseV0(){}
+    //
+    // Configuration methods
+    // 
+    // Number of sigmas over which cluster didintegration is performed
+    virtual void    SetSigmaIntegration(Float_t p1) {fSigmaIntegration=p1;}
+    virtual Float_t SigmaIntegration() {return fSigmaIntegration;}    
+    // charge slope in ADC/e
+    virtual void    SetChargeSlope(Float_t p1) {fChargeSlope=p1;}
+    virtual Float_t ChargeSlope()      {return fChargeSlope;}
+    // sigma of the charge spread function
+    virtual void    SetChargeSpread(Float_t p1, Float_t p2)
+       {fChargeSpreadX=p1; fChargeSpreadY=p2;}
+    virtual Float_t ChargeSpreadX()    {return fChargeSpreadX;}    
+    virtual Float_t ChargeSpreadY()    {return fChargeSpreadY;}        
+    // Adc-count saturation value
+    virtual void    SetMaxAdc(Float_t p1) {fMaxAdc=p1;}
+    virtual Float_t MaxAdc()           {return fMaxAdc;}
+    // anode cathode Pitch
+    virtual Float_t Pitch()            {return fPitch;}
+    virtual void    SetPitch(Float_t p1) {fPitch=p1;};
+    // alpha feedback
+    virtual void    SetAlphaFeedback(Float_t alpha) {fAlphaFeedback=alpha;}
+    virtual Float_t AlphaFeedback()  {return fAlphaFeedback;}
+    // ionisation enrgy
+    virtual void    SetEIonisation(Float_t e) {fEIonisation=e;}
+    virtual Float_t EIonisation() {return fEIonisation;}                            
+    // Mathieson parameters
+    virtual void   SetSqrtKx3(Float_t p1) {fSqrtKx3=p1;};
+    virtual void   SetKx2(Float_t p1) {fKx2=p1;};
+    virtual void   SetKx4(Float_t p1) {fKx4=p1;};
+    virtual void   SetSqrtKy3(Float_t p1) {fSqrtKy3=p1;};
+    virtual void   SetKy2(Float_t p1) {fKy2=p1;};
+    virtual void   SetKy4(Float_t p1) {fKy4=p1;};
+    //  
+    // Chamber response methods
+    // Pulse height from scored quantity (eloss)
+    virtual Float_t IntPH(Float_t eloss);
+    virtual Float_t IntPH();
+    // Charge disintegration
+    virtual Float_t IntXY(AliRICHSegmentation * segmentation);
+    virtual Int_t   FeedBackPhotons(Float_t *source, Float_t qtot);
+       protected:
+    Float_t fChargeSlope;              // Slope of the charge distribution
+    Float_t fChargeSpreadX;            // Width of the charge distribution in x
+    Float_t fChargeSpreadY;            // Width of the charge distribution in y
+    Float_t fSigmaIntegration;         // Number of sigma's used for charge distribution
+    Float_t fAlphaFeedback;            // Feedback photons coefficient
+    Float_t fEIonisation;              // Mean ionisation energy
+    Float_t fMaxAdc;                   // Maximum ADC channel
+    Float_t fSqrtKx3;         // Mathieson parameters for x
+    Float_t fKx2;             // Mathieson parameters for x
+    Float_t fKx4;             // Mathieson parameters for x
+    Float_t fSqrtKy3;         // Mathieson parameters for y
+    Float_t fKy2;             // Mathieson parameters for y 
+    Float_t fKy4;             // Mathieson parameters for y
+    Float_t fPitch;           //anode-cathode pitch
+    ClassDef(AliRICHResponseV0,1)
+};
+#endif
diff --git a/RICH/AliRICHSegmentation.cxx b/RICH/AliRICHSegmentation.cxx
new file mode 100644 (file)
index 0000000..fb4f953
--- /dev/null
@@ -0,0 +1,21 @@
+/**************************************************************************
+ * 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 "AliRICHSegmentation.h"
+
+ClassImp(AliRICHSegmentation)
diff --git a/RICH/AliRICHSegmentation.h b/RICH/AliRICHSegmentation.h
new file mode 100644 (file)
index 0000000..45d7354
--- /dev/null
@@ -0,0 +1,103 @@
+#ifndef ALIRICHSEGMENTATION_H
+#define ALIRICHSEGMENTATION_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#include <TObject.h>
+
+class AliRICHChamber;
+class TF1;
+class AliRICHSegmentation :
+
+public TObject {
+    
+ public:
+    
+    // Set Chamber Segmentation Parameters
+    //
+    // Pad size Dx*Dy 
+    virtual void    SetPadSize(Float_t p1, Float_t p2)  =0;
+    // Anod Pitch
+    virtual void    SetDAnod(Float_t D)                 =0;
+    
+    //
+    // Anod wire coordinate closest to xhit
+    virtual Float_t GetAnod(Float_t xhit)               =0;
+    // Transform from pad (wire) to real coordinates
+    virtual void    GetPadIxy(Float_t x ,Float_t y ,Int_t   &ix,Int_t   &iy)=0;
+    // Transform from real to pad coordinates
+    virtual void    GetPadCxy(Int_t   ix,Int_t   iy,Float_t &x ,Float_t &y )=0;
+    //
+    // Initialisation
+    virtual void Init(AliRICHChamber*)                  =0;
+    //
+    // Get member data
+    //
+    // Pad size in x
+    virtual Float_t Dpx()                               =0;
+    // Pad size in y
+    virtual Float_t Dpy()                               =0;
+    // Pad size in x by Sector 
+    virtual Float_t Dpx(Int_t)                          =0;
+    // Pad size in y by Sector 
+    virtual Float_t Dpy(Int_t)                          =0;
+    // Max number of Pads in x
+    virtual Int_t Npx()                                 =0;
+    // Max number of Pads in y
+    virtual Int_t Npy()                                 =0;
+    
+
+    // set pad position
+    virtual void     SetPad(Int_t, Int_t)               =0;
+    // set hit position
+    virtual void     SetHit(Float_t, Float_t)           =0;
+    //
+    // Iterate over pads
+    // Initialiser
+    virtual void  FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy) =0;
+    // Stepper
+    virtual void  NextPad()=0;
+    // Condition
+    virtual Int_t MorePads()                           =0;
+    //
+    // Distance between 1 pad and a position
+    virtual Float_t Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y, Int_t *dummy) =0;
+    // Number of pads read in parallel and offset to add to x 
+    // (specific to LYON, but mandatory for display)
+    virtual void GetNParallelAndOffset(Int_t iX, Int_t iY,
+                                      Int_t *Nparallel, Int_t *Offset) =0;
+    // Get next neighbours 
+    virtual void Neighbours
+       (Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])     =0;
+    //
+    // Current pad cursor during disintegration
+    // x-coordinate
+    virtual Int_t  Ix()                                =0;
+    // y-coordinate
+    virtual Int_t  Iy()                                =0;
+    // current Sector
+    virtual Int_t  ISector()                           =0;
+    // calculate sector from pad coordinates
+    virtual Int_t  Sector(Float_t ix, Float_t iy)          =0;
+    //
+    // Signal Generation Condition during Stepping
+    virtual Int_t SigGenCond(Float_t x, Float_t y, Float_t z) = 0;
+    // Initialise signal gneration at coord (x,y,z)
+    virtual void  SigGenInit(Float_t x, Float_t y, Float_t z) = 0;
+    // Current integration limits 
+    virtual void  IntegrationLimits
+       (Float_t& x1, Float_t& x2, Float_t& y1, Float_t& y2)  = 0;
+    // Test points for auto calibration
+    virtual void GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) = 0;
+    // Debug utilities
+    virtual void Draw()                                           = 0;
+    // Function for systematic corrections
+    virtual void SetCorrFunc(Int_t, TF1*)                         = 0;
+    virtual TF1* CorrFunc(Int_t)                                  = 0;
+    ClassDef(AliRICHSegmentation,1)
+    
+};
+#endif
diff --git a/RICH/AliRICHSegmentationV0.cxx b/RICH/AliRICHSegmentationV0.cxx
new file mode 100644 (file)
index 0000000..e5fb49e
--- /dev/null
@@ -0,0 +1,284 @@
+/**************************************************************************
+ * 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 "AliRICHSegmentationV0.h"
+
+
+ClassImp(AliRICHSegmentationV0)
+
+void AliRICHSegmentationV0::Init(AliRICHChamber* Chamber)
+{
+
+// Initialisation of chambers
+
+    //fNpx=(Int_t) (Chamber->ROuter()/fDpx+1);
+    //fNpy=(Int_t) (Chamber->ROuter()/fDpy+1);
+  fNpx=160;
+  fNpy=144;
+  //fNpx=80;
+  //fNpy=48;
+  fSector=-1;
+}
+
+
+Float_t AliRICHSegmentationV0::GetAnod(Float_t xhit)
+{
+
+// Get anod wire closer to hit
+
+    Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
+    return fWireD*wire;
+}
+
+void AliRICHSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
+{
+
+// Set the pad size
+
+    fDpx=p1;
+    fDpy=p2;
+}
+void AliRICHSegmentationV0::GetPadIxy(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
+{
+//  returns pad coordinates (ix,iy) for given real coordinates (x,y)
+//
+// Please check origin of pad numbering !!!
+
+  
+  ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
+  iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
+  if (iy >  fNpy) iy= fNpy;
+  if (iy < -fNpy) iy=-fNpy;
+  if (ix >  fNpx) ix= fNpx;
+  if (ix < -fNpx) ix=-fNpx;
+}
+void AliRICHSegmentationV0::
+GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
+{
+//  returns real coordinates (x,y) for given pad coordinates (ix,iy)
+//
+
+  x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
+  y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
+}
+
+void AliRICHSegmentationV0::
+SetHit(Float_t xhit, Float_t yhit)
+{
+//
+// Find the wire position (center of charge distribution)
+//    Float_t x0a=GetAnod(xhit);
+    fxhit=xhit;
+    fyhit=yhit;
+}
+
+void AliRICHSegmentationV0::
+SetPad(Int_t ix, Int_t iy)
+{
+
+// Move to pad ix, iy
+
+    GetPadCxy(ix,iy,fx,fy);
+}
+
+
+
+void AliRICHSegmentationV0::
+FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
+{
+
+    //
+    // Find the wire position (center of charge distribution)
+    Float_t x0a=GetAnod(xhit);
+    fxhit=x0a;
+    fyhit=yhit;
+    //
+    // and take fNsigma*sigma around this center
+    Float_t x01=x0a  - dx;
+    Float_t x02=x0a  + dx;
+    Float_t y01=yhit - dy;
+    Float_t y02=yhit + dy;
+    //
+    // find the pads over which the charge distributes
+    GetPadIxy(x01,y01,fixmin,fiymin);
+    GetPadIxy(x02,y02,fixmax,fiymax);    
+    // 
+    // Set current pad to lower left corner
+    fix=fixmin;
+    fiy=fiymin;
+    GetPadCxy(fix,fiy,fx,fy);
+    
+    //if (fSector==2)
+      //printf("fix: %d, fiy: %d fx: %f, fy: %f\n",fix,fiy,fx,fy);
+}
+
+void AliRICHSegmentationV0::NextPad()
+{
+    //printf("\n Next Pad \n");
+    
+    // 
+    // Step to next pad in integration region
+    if (fix <= fixmax) {
+//     if (fix==-1) fix++;
+       fix++;
+    } else if (fiy <= fiymax) {
+//     if (fiy==-1) fiy++;
+       fix=fixmin;
+       fiy++;
+    } else {
+       printf("\n Error: Stepping outside integration region\n ");
+    }
+    GetPadCxy(fix,fiy,fx,fy);
+}
+
+Int_t AliRICHSegmentationV0::MorePads()
+
+{
+//
+// Are there more pads in the integration region
+
+    //printf("\n More  Pads ? \n");
+  
+  
+  if (fix >= fixmax && fiy >= fiymax) {
+    //printf("There are no more pads\n\n\n\n\n");
+    return 0;
+  } else {
+    //printf("There are more pads\n\n");
+    return 1;
+  }
+}
+
+void AliRICHSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t)
+{
+//
+//  Initialises pad and wire position during stepping
+    fxt =x;
+    fyt =y;
+    GetPadIxy(x,y,fixt,fiyt);
+    fiwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
+}
+
+Int_t AliRICHSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t)
+{
+//
+//  Signal will be generated if particle crosses pad boundary or
+//  boundary between two wires. 
+    Int_t ixt, iyt;
+    GetPadIxy(x,y,ixt,iyt);
+    Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
+    
+    if ((ixt != fixt) || (iyt !=fiyt) || (iwt != fiwt)) {
+      return 1;
+    } else {
+      return 0;
+    }
+}
+void AliRICHSegmentationV0::
+IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
+{
+
+// Calculate the integration limits
+
+/*
+  x1=fxt-fx-fDpx/2.;
+  x2=x1+fDpx;
+  y1=fyt-fy-fDpy/2.;
+  y2=y1+fDpy;    
+*/
+  x1=fxhit-fx-fDpx/2.;
+  x2=x1+fDpx;
+  y1=fyhit-fy-fDpy/2.;
+  y2=y1+fDpy;
+}
+
+void AliRICHSegmentationV0::
+Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[7], Int_t Ylist[7])
+{
+//Is used for the cluster finder, include diagonal elements
+    
+    *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
+    Ylist[0]=iY-1;Ylist[1]=iY+1;Ylist[2]=Ylist[3]=iY;
+/*
+    *Nlist=8;
+    Xlist[0]=Xlist[1]=iX;
+    Xlist[2]=iX-1;
+    Xlist[3]=iX+1;
+    Ylist[0]=iY-1;
+    Ylist[1]=iY+1;
+    Ylist[2]=Ylist[3]=iY;
+
+   // Diagonal elements
+    Xlist[4]=iX+1;
+    Ylist[4]=iY+1;
+
+    Xlist[5]=iX-1;
+    Ylist[5]=iY-1;
+
+    Xlist[6]=iX-1;
+    Ylist[6]=iY+1;
+
+    Xlist[7]=iX+1;
+    Ylist[7]=iY-1;
+*/
+}
+
+Float_t AliRICHSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y
+, Int_t *dummy)
+
+{
+// Returns the square of the distance between 1 pad
+// labelled by its Channel numbers and a coordinate
+
+  Float_t x,y;
+  GetPadCxy(iX,iY,x,y);
+  return (x-X)*(x-X) + (y-Y)*(y-Y);
+}
+
+
+void  AliRICHSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y)
+{
+
+// Test
+
+    n=1;
+    x[0]=0.;
+    y[0]=x[0];
+}
+
+void AliRICHSegmentationV0::Draw()
+{
+
+// Dummy draw routine
+
+/*
+    TArc *circle;
+    Float_t scale=0.95/fRmax/2.;
+    
+
+    circle = new TArc(0.5,0.5,fRmax*scale,0.,360.);
+    circle->SetFillColor(2);
+    circle->Draw();
+
+    circle = new TArc(0.5,0.5,fRmin*scale,0.,360.);
+    circle->SetFillColor(1);
+    circle->Draw();
+*/
+    ;
+    
+}
diff --git a/RICH/AliRICHSegmentationV0.h b/RICH/AliRICHSegmentationV0.h
new file mode 100644 (file)
index 0000000..14b67a5
--- /dev/null
@@ -0,0 +1,146 @@
+#ifndef ALIRICHSEGMENTATIONV0_H
+#define ALIRICHSEGMENTATIONV0_H
+
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#include "AliRICHSegmentation.h"
+
+class AliRICHSegmentationV0 :
+public AliRICHSegmentation {
+ public:
+    AliRICHSegmentationV0(){}
+    virtual ~AliRICHSegmentationV0(){}
+    //    
+    // Set Chamber Segmentation Parameters
+    //
+    // Pad size Dx*Dy 
+    virtual  void    SetPadSize(Float_t p1, Float_t p2);
+    // Anod Pitch
+    virtual  void    SetDAnod(Float_t D) {fWireD = D;};
+        
+    //
+    // Transform from pad (wire) to real coordinates and vice versa
+    //
+    // Anod wire coordinate closest to xhit
+    virtual Float_t GetAnod(Float_t xhit);
+    // Transform from pad to real coordinates
+    virtual void    GetPadIxy(Float_t x ,Float_t y ,Int_t   &ix,Int_t   &iy);
+    // Transform from real to pad coordinates
+    virtual void    GetPadCxy(Int_t   ix,Int_t   iy,Float_t &x ,Float_t &y );
+    //
+    // Initialisation
+    virtual void Init(AliRICHChamber* chamber);
+    //
+    // Get member data
+    //
+    // Pad size in x
+    virtual Float_t Dpx(){return fDpx;}
+    //
+    // Pad size in y
+    virtual Float_t Dpy(){return fDpy;}
+    // Pad size in x by Sector
+    virtual Float_t Dpx(Int_t) {return fDpx;}
+    // Pad size in y by Sector
+    virtual Float_t Dpy(Int_t) {return fDpy;}
+    // Max number of Pads in x
+    virtual Int_t   Npx(){return fNpx;}
+    // Max number of Pads in y
+    virtual Int_t   Npy(){return fNpy;}
+    
+
+    // set pad position
+    virtual void     SetPad(Int_t ix, Int_t iy);
+    // set hit position
+    virtual void     SetHit(Float_t xhit , Float_t yhit);
+    //
+    // Iterate over pads
+    // Initialiser
+    virtual void  FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy);
+    // Stepper
+    virtual void  NextPad();
+    // Condition
+    virtual Int_t MorePads();
+    //
+    // Distance between 1 pad and a position
+    virtual Float_t Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y, Int_t *
+                                      dummy);
+    // Number of pads read in parallel and offset to add to x 
+    // (specific to LYON, but mandatory for display)
+    virtual void GetNParallelAndOffset(Int_t iX, Int_t iY,
+                                      Int_t *Nparallel, Int_t *Offset) {*Nparallel=1;*Offset=0;}
+    // Get next neighbours 
+    virtual void Neighbours
+       (Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]);
+    //
+    // Current Pad during Integration
+    // x-coordinate
+    virtual Int_t  Ix(){return fix;}
+    // y-coordinate
+    virtual Int_t  Iy(){return fiy;}
+    // current sector
+    virtual Int_t  ISector(){return 1;}
+    // calculate sector from x-y coordinates
+    virtual Int_t  Sector(Float_t x, Float_t y){return 1;}
+    //
+    // Signal Generation Condition during Stepping
+    virtual Int_t SigGenCond(Float_t x, Float_t y, Float_t z);
+    // Initialise signal gneration at coord (x,y,z)
+    virtual void  SigGenInit(Float_t x, Float_t y, Float_t z);
+    // Current integration limits
+    virtual void IntegrationLimits
+       (Float_t& x1, Float_t& x2, Float_t& y1, Float_t& y2);
+    // Test points for auto calibration
+    virtual void GiveTestPoints(Int_t &n, Float_t *x, Float_t *y);
+    // Debugging utilities
+    virtual void Draw();
+    // Function for systematic corrections
+    virtual void SetCorrFunc(Int_t dum, TF1* func) {fCorr=func;}
+    
+    virtual TF1* CorrFunc(Int_t) {return fCorr;} 
+    ClassDef(AliRICHSegmentationV0,1)
+       protected:
+    //
+    // Implementation of the segmentation data
+    // Version 0 models rectangular pads with the same dimensions all
+    // over the cathode plane
+    //
+    //  geometry
+    //
+    Float_t    fDpx;             // x pad width per sector  
+    Float_t    fDpy;             // y pad base width
+    Int_t      fNpx;             // Number of pads in x
+    Int_t      fNpy;             // Number of pads in y
+    Int_t      fSector;          // Current padplane
+    Float_t    fWireD;           // wire pitch
+    
+
+        
+    // Chamber region consideres during disintegration (lower left and upper right corner)
+    //
+    Int_t fixmin; // lower left  x
+    Int_t fixmax; // lower left  y
+    Int_t fiymin; // upper right x
+    Int_t fiymax; // upper right y 
+    //
+    // Current pad during integration (cursor for disintegration)
+    Int_t fix;  // pad coord. x 
+    Int_t fiy;  // pad coord. y 
+    Float_t fx; // x
+    Float_t fy; // y
+    //
+    // Current pad and wire during tracking (cursor at hit centre)
+    Float_t fxhit;   //x position
+    Float_t fyhit;   //y position
+    // Reference point to define signal generation condition
+    Int_t fixt;     // pad coord. x
+    Int_t fiyt;     // pad coord. y
+    Int_t fiwt;     // wire number
+    Float_t fxt;    // x
+    Float_t fyt;    // y
+    TF1*    fCorr;  // correction function
+};
+#endif
diff --git a/RICH/AliRICHSegmentationV1.cxx b/RICH/AliRICHSegmentationV1.cxx
new file mode 100644 (file)
index 0000000..b35e1fe
--- /dev/null
@@ -0,0 +1,268 @@
+/**************************************************************************
+ * 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 "AliRICHSegmentationV1.h"
+
+
+//--------------------------------------------------------
+ClassImp(AliRICHSegmentationV1)
+
+//________________________________________________________________________________
+AliRICHSegmentationV1::AliRICHSegmentationV1()
+{ 
+
+// Default constructor for AliRICHSegmantionV1 (with dead zones)
+
+  fNpx=160;
+  fNpy=144;
+  //fNpx=80;
+  //fNpy=48;
+  fSector=-1;
+}
+
+//________________________________________________________________________________
+AliRICHSegmentationV1::~AliRICHSegmentationV1()
+{ 
+// Destructor
+
+}
+
+
+// calculate sector from x-y coordinates
+
+Int_t AliRICHSegmentationV1::Sector(Float_t x, Float_t y)
+{
+
+// Calculate in which sector is the hit
+
+  fSector=-1;
+  
+  if (x<-1.3)
+    {
+      if (y>22.75)
+       {
+         if (y<63.1)
+           fSector=0;
+       }
+      if (y<20.15)
+       {
+         if (y>(-20.15))
+           fSector=2;
+       }
+      if (y<(-22.75))
+       {
+         if (y>(-63.1))
+           fSector=4;
+       }
+    }
+  else if (x>1.3)
+    {
+      if (y>22.75)
+       {
+         if (y<63.1)
+           fSector=1;
+       }
+      if (y<20.15)
+       {
+         if (y>(-20.15))
+           fSector=3;
+       }
+      if (y<(-22.75))
+       {
+         if (y>(-63.1))
+           fSector=5;
+       }
+    }
+  
+  //if (fSector==2)
+    //printf("x:%f, y:%f, sector:%d\n",x,y,fSector);
+
+  return fSector;
+}
+
+
+void AliRICHSegmentationV1::GetPadIxy(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
+{
+//  returns pad coordinates (ix,iy) for given real coordinates (x,y)
+//
+// Please check origin of pad numbering !!!
+
+  Int_t sector=Sector(x,y);
+
+  //printf("Sector: %d\n",sector);
+
+
+  if (sector==0)
+    {
+      //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
+      //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
+      ix = Int_t (x/fDpx+1.3);
+      iy = Int_t (y/fDpy-2.6);
+    }
+  if (sector==1)
+    {
+      ix = Int_t (x/fDpx-1.3);
+      iy = Int_t (y/fDpy-2.6);
+    }
+  if (sector==2)
+    {
+      ix = Int_t (x/fDpx+1.3);
+      iy = Int_t (y/fDpy);
+    }
+  if (sector==3)
+    {
+      ix = Int_t (x/fDpx-1.3);
+      iy = Int_t (y/fDpy);
+    }
+  if (sector==4)
+    {
+      ix = Int_t (x/fDpx+1.3);
+      iy = Int_t (y/fDpy+2.6);
+    }
+  if (sector==5)
+    {
+      ix = Int_t (x/fDpx-1.3);
+      iy = Int_t (y/fDpy+2.6);
+    }
+  
+  //ix = Int_t (x/fDpx);
+  //iy = Int_t (y/fDpy);
+
+  //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
+  //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
+
+  if (sector==-1)
+    {
+      ix = fixmax;
+      iy = fiymax;
+    }
+
+  if (iy >  fNpy) iy= fNpy;
+  if (iy < -fNpy) iy=-fNpy;
+  if (ix >  fNpx) ix= fNpx;
+  if (ix < -fNpx) ix=-fNpx;
+}
+
+void AliRICHSegmentationV1::
+GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
+{
+//  returns real coordinates (x,y) for given pad coordinates (ix,iy)
+//
+
+  //Int_t sector=Sector(ix*.8,iy*.84);
+
+  Int_t sector=-1;
+
+  if (ix<=0)
+    {
+      if (iy<=72)
+       {
+         if (iy>24)
+           sector=0;
+       }
+      if (iy<=24)
+       {
+         if (iy>-24)
+           sector=2;
+       }
+      if (iy<=-24)
+       {
+         if (iy>-72)
+           sector=4;
+       }
+    }
+  if (ix>0)
+    {
+      if (iy<=72)
+       {
+         if (iy>24)
+           sector=1;
+       }
+      if (iy<=24)
+       {
+         if (iy>-24)
+           sector=3;
+       }
+      if (iy<=-24)
+       {
+         if (iy>-72)
+           sector=5;
+       }
+    }
+  
+
+  if (sector==0)
+    {
+      //x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
+      //y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
+      x = Float_t(ix*fDpx)-fDpx/2.-1.3;
+      y = Float_t(iy*fDpy)-fDpy/2.+2.6;
+    }
+  if (sector==1)
+    {
+      x = Float_t(ix*fDpx)-fDpx/2.+1.3;
+      y = Float_t(iy*fDpy)-fDpy/2.+2.6;
+    }
+  if (sector==2)
+    {
+      x = Float_t(ix*fDpx)-fDpx/2.-1.3;
+      y = Float_t(iy*fDpy)-fDpy/2.;
+    }
+  if (sector==3)
+    {
+      x = Float_t(ix*fDpx)-fDpx/2.+1.3;
+      y = Float_t(iy*fDpy)-fDpy/2.;
+    }
+  if (sector==4)
+    {
+      x = Float_t(ix*fDpx)-fDpx/2.-1.3;
+      y = Float_t(iy*fDpy)-fDpy/2.-2.6;
+    }
+  if (sector==5)
+    {
+      x = Float_t(ix*fDpx)-fDpx/2.+1.3;
+      y = Float_t(iy*fDpy)-fDpy/2.-2.6;
+    }
+  
+  //if (sector==2)
+    //printf("fSector:%d x:%f y:%f\n",fSector,x,y);
+  
+}
+
+void AliRICHSegmentationV1::
+IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
+{
+
+// Calculates integration limits
+
+/*
+  x1=fxt-fx-fDpx/2.;
+  x2=x1+fDpx;
+  y1=fyt-fy-fDpy/2.;
+  y2=y1+fDpy;    
+*/
+  //Int_t sector=Sector(fx,fy);
+
+  //printf("Sector:%d\n",sector);
+
+  x1=fxhit-fx-fDpx/2.;
+  x2=x1+fDpx;
+  y1=fyhit-fy-fDpy/2.;
+  y2=y1+fDpy;
+}
diff --git a/RICH/AliRICHSegmentationV1.h b/RICH/AliRICHSegmentationV1.h
new file mode 100644 (file)
index 0000000..2837dea
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef ALIRICHSEGMENTATIONV1_H
+#define ALIRICHSEGMENTATIONV1_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#include "AliRICHSegmentationV0.h"
+
+class AliRICHSegmentationV1 : public AliRICHSegmentationV0 {
+    
+ public:
+    AliRICHSegmentationV1();
+    virtual ~AliRICHSegmentationV1();
+    // current sector
+    virtual Int_t  ISector(){return fSector;}
+    // calculate sector from x-y coordinates
+    virtual Int_t  Sector(Float_t x, Float_t y);
+
+    // Transform from pad to real coordinates
+    virtual void    GetPadIxy(Float_t x ,Float_t y ,Int_t   &ix,Int_t   &iy);
+    // Transform from real to pad coordinates
+    virtual void    GetPadCxy(Int_t   ix,Int_t   iy,Float_t &x ,Float_t &y );
+    // Current integration limits
+    virtual void IntegrationLimits
+       (Float_t& x1, Float_t& x2, Float_t& y1, Float_t& y2);
+ private:
+    Int_t fSector;             //Pad plane sector
+    ClassDef(AliRICHSegmentationV1,1)
+};
+       
+#endif
+
+
+
+
+
+
+
+
diff --git a/RICH/AliRICHTransientDigit.cxx b/RICH/AliRICHTransientDigit.cxx
new file mode 100644 (file)
index 0000000..b5bfefb
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+ * 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 "AliRICHTransientDigit.h"
+#include <TObjArray.h>
+
+ClassImp(AliRICHTransientDigit)
+    
+//____________________________________________________________________________
+AliRICHTransientDigit::AliRICHTransientDigit(Int_t ich, Int_t *digits): 
+    AliRICHDigit(digits)
+{
+    //
+    // Creates a RICH digit list object
+    //
+    
+    fChamber = ich;
+    fTrackList   = new TObjArray;
+    
+}
+//_____________________________________________________________________________
+
diff --git a/RICH/AliRICHTransientDigit.h b/RICH/AliRICHTransientDigit.h
new file mode 100644 (file)
index 0000000..6cb0cbe
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef ALIRICHTRANSIENTDIGIT_H
+#define ALIRICHTRANSIENTDIGIT_H
+
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id $ */
+#include "AliRICHDigit.h"
+
+class AliRICHTransientDigit : public AliRICHDigit {
+ public:
+    Int_t          fRpad;          // r_pos of pad
+    Int_t          fChamber;       // chamber number of pad
+    TObjArray     *fTrackList;     // list of tracks
+ public:
+    AliRICHTransientDigit() {fTrackList=0;}
+    AliRICHTransientDigit(Int_t ich, Int_t *digits);
+    virtual ~AliRICHTransientDigit() {}
+    
+    TObjArray  *TrackList()   {return fTrackList;}
+    
+    ClassDef(AliRICHTransientDigit,1)  //Digits for set:RICH
+};
+
+#endif
index 8d0cf3a0088239aaa49f4cf82de74b9129db6ab4..4e2aab971b3f2b01414ad0647e283dd00860cd92 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
   $Log$
+  Revision 1.10  2000/06/09 14:59:25  jbarbosa
+  New default version. No setters needed, no hits.
+
   Revision 1.9  2000/05/31 08:19:38  jbarbosa
   Fixed bug in StepManager
 
 #include <TRandom.h> 
 
 #include "AliRICHv0.h"
-#include "AliRICHSegResV0.h"
+#include "AliRICHSegmentation.h"
+#include "AliRICHResponse.h"
+#include "AliRICHSegmentationV0.h"
+#include "AliRICHResponseV0.h"
+#include "AliRICHGeometry.h"
 #include "AliRun.h"
 #include "AliMC.h"
 #include "iostream.h"
@@ -61,6 +68,9 @@ ClassImp(AliRICHv0)
 //___________________________________________
 AliRICHv0::AliRICHv0() : AliRICH()
 {
+
+// Default constructor
+
     //fChambers = 0;
 }
 
@@ -70,59 +80,59 @@ AliRICHv0::AliRICHv0(const char *name, const char *title)
 {
     //
 // Version 0
-// Default Segmentation
-    AliRICHSegmentationV0* SegmentationV0 = new AliRICHSegmentationV0;
+// Default Segmentation, no hits
+    AliRICHSegmentationV0* segmentationV0 = new AliRICHSegmentationV0;
 //
 //  Segmentation parameters
-    SegmentationV0->SetPadSize(0.84,0.80);
-    SegmentationV0->SetDAnod(0.84/2);
+    segmentationV0->SetPadSize(0.84,0.80);
+    segmentationV0->SetDAnod(0.84/2);
 //
 //  Geometry parameters
-    AliRICHGeometry* GeometryV0 = new AliRICHGeometryV0;
-    GeometryV0->SetGapThickness(8);
-    GeometryV0->SetProximityGapThickness(.4);
-    GeometryV0->SetQuartzLength(131);
-    GeometryV0->SetQuartzWidth(126.2);
-    GeometryV0->SetQuartzThickness(.5);
-    GeometryV0->SetOuterFreonLength(131);
-    GeometryV0->SetOuterFreonWidth(40.3);
-    GeometryV0->SetInnerFreonLength(131);
-    GeometryV0->SetInnerFreonWidth(40.3);
-    GeometryV0->SetFreonThickness(1);
+    AliRICHGeometry* geometry = new AliRICHGeometry;
+    geometry->SetGapThickness(8);
+    geometry->SetProximityGapThickness(.4);
+    geometry->SetQuartzLength(131);
+    geometry->SetQuartzWidth(126.2);
+    geometry->SetQuartzThickness(.5);
+    geometry->SetOuterFreonLength(131);
+    geometry->SetOuterFreonWidth(40.3);
+    geometry->SetInnerFreonLength(131);
+    geometry->SetInnerFreonWidth(40.3);
+    geometry->SetFreonThickness(1);
 //
 //  Response parameters
-    AliRICHResponseV0*  Rresponse0   = new AliRICHResponseV0;
-    Rresponse0->SetSigmaIntegration(5.);
-    Rresponse0->SetChargeSlope(40.);
-    Rresponse0->SetChargeSpread(0.18, 0.18);
-    Rresponse0->SetMaxAdc(1024);
-    Rresponse0->SetAlphaFeedback(0.05);
-    Rresponse0->SetEIonisation(26.e-9);
-    Rresponse0->SetSqrtKx3(0.77459667);
-    Rresponse0->SetKx2(0.962);
-    Rresponse0->SetKx4(0.379);
-    Rresponse0->SetSqrtKy3(0.77459667);
-    Rresponse0->SetKy2(0.962);
-    Rresponse0->SetKy4(0.379);
-    Rresponse0->SetPitch(0.25);
+    AliRICHResponseV0*  responseV0   = new AliRICHResponseV0;
+    responseV0->SetSigmaIntegration(5.);
+    responseV0->SetChargeSlope(40.);
+    responseV0->SetChargeSpread(0.18, 0.18);
+    responseV0->SetMaxAdc(1024);
+    responseV0->SetAlphaFeedback(0.05);
+    responseV0->SetEIonisation(26.e-9);
+    responseV0->SetSqrtKx3(0.77459667);
+    responseV0->SetKx2(0.962);
+    responseV0->SetKx4(0.379);
+    responseV0->SetSqrtKy3(0.77459667);
+    responseV0->SetKy2(0.962);
+    responseV0->SetKy4(0.379);
+    responseV0->SetPitch(0.25);
 //
 //
 //    AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH"); 
     
-    fCkov_number=0;
-    fFreon_prod=0;
+    fCkovNumber=0;
+    fFreonProd=0;
     
-    fChambers = new TObjArray(7);
-    for (Int_t i=0; i<7; i++) {
+    fChambers = new TObjArray(kNCH);
+    for (Int_t i=0; i<kNCH; i++) {
       
       (*fChambers)[i] = new AliRICHChamber();  
       
     }
   
-    for (Int_t i=0; i<7; i++) {
-      SetGeometryModel(i,GeometryV0);
-      SetSegmentationModel(i, SegmentationV0);
-      SetResponseModel(i, Rresponse0);
+    for (Int_t i=0; i<kNCH; i++) {
+      SetGeometryModel(i,geometry);
+      SetSegmentationModel(i, segmentationV0);
+      SetResponseModel(i, responseV0);
       SetNsec(i,1);
     }
 }
@@ -149,12 +159,12 @@ void AliRICHv0::CreateGeometry()
     */
     //End_Html
 
-  AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH"); 
+  AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH"); 
   AliRICHSegmentation*  segmentation;
   AliRICHGeometry*  geometry;
   AliRICHChamber*       iChamber;
 
-  iChamber = &(RICH->Chamber(0));
+  iChamber = &(pRICH->Chamber(0));
   segmentation=iChamber->GetSegmentationModel(0);
   geometry=iChamber->GetGeometryModel();
 
@@ -411,39 +421,39 @@ void AliRICHv0::CreateMaterials()
     //               R.A. Fini  (INFN - BARI, Rosanna.Fini@ba.infn.it) 
     //               R.A. Loconsole (Bari University, loco@riscom.ba.infn.it) 
     //
-    Int_t   ISXFLD = gAlice->Field()->Integ();
-    Float_t SXMGMX = gAlice->Field()->Max();
+    Int_t   isxfld = gAlice->Field()->Integ();
+    Float_t sxmgmx = gAlice->Field()->Max();
     Int_t i;
 
     /************************************Antonnelo's Values (14-vectors)*****************************************/
     /*
     Float_t ppckov[14] = { 5.63e-9,5.77e-9,5.9e-9,6.05e-9,6.2e-9,6.36e-9,6.52e-9,
                           6.7e-9,6.88e-9,7.08e-9,7.3e-9,7.51e-9,7.74e-9,8e-9 };
-    Float_t rindex_quarz[14] = { 1.528309,1.533333,
+    Float_t rIndexQuarz[14] = { 1.528309,1.533333,
                                 1.538243,1.544223,1.550568,1.55777,
                                 1.565463,1.574765,1.584831,1.597027,
                               1.611858,1.6277,1.6472,1.6724 };
-    Float_t rindex_quarzo[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
-    Float_t rindex_methane[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
-    Float_t rindex_gri[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
-    Float_t absco_freon[14] = { 179.0987,179.0987,
+    Float_t rIndexOpaqueQuarz[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
+    Float_t rIndexMethane[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
+    Float_t rIndexGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
+    Float_t abscoFreon[14] = { 179.0987,179.0987,
                                179.0987,179.0987,179.0987,142.92,56.65,13.95,10.43,7.07,2.03,.5773,.33496,0. };
-    //Float_t absco_freon[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
+    //Float_t abscoFreon[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
        //                       1e-5,1e-5,1e-5,1e-5,1e-5 };
-    Float_t absco_quarz[14] = { 64.035,39.98,35.665,31.262,27.527,22.815,21.04,17.52,
+    Float_t abscoQuarz[14] = { 64.035,39.98,35.665,31.262,27.527,22.815,21.04,17.52,
                                14.177,9.282,4.0925,1.149,.3627,.10857 };
-    Float_t absco_quarzo[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
+    Float_t abscoOpaqueQuarz[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
                                 1e-5,1e-5,1e-5,1e-5,1e-5 };
-    Float_t absco_csi[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
+    Float_t abscoCsI[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
                              1e-4,1e-4,1e-4,1e-4 };
-    Float_t absco_methane[14] = { 1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,
+    Float_t abscoMethane[14] = { 1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,
                                  1e6,1e6,1e6 };
-    Float_t absco_gri[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
+    Float_t abscoGrid[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
                              1e-4,1e-4,1e-4,1e-4 };
-    Float_t effic_all[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
-    Float_t effic_csi[14] = { 6e-4,.005,.0075,.01125,.045,.117,.135,.16575,
+    Float_t efficAll[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
+    Float_t efficCsI[14] = { 6e-4,.005,.0075,.01125,.045,.117,.135,.16575,
                              .17425,.1785,.1836,.1904,.1938,.221 };
-    Float_t effic_gri[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
+    Float_t efficGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
     */
    
     
@@ -462,7 +472,7 @@ void AliRICHv0::CreateMaterials()
     
     
     //Refraction index for quarz
-    Float_t rindex_quarz[26];
+    Float_t rIndexQuarz[26];
     Float_t  e1= 10.666;
     Float_t  e2= 18.125;
     Float_t  f1= 46.411;
@@ -472,24 +482,24 @@ void AliRICHv0::CreateMaterials()
        Float_t ene=ppckov[i]*1e9;
        Float_t a=f1/(e1*e1 - ene*ene);
        Float_t b=f2/(e2*e2 - ene*ene);
-       rindex_quarz[i] = TMath::Sqrt(1. + a + b );
-       //printf ("Rindex_quarz: %e\n",rindex_quarz[i]);
+       rIndexQuarz[i] = TMath::Sqrt(1. + a + b );
+       //printf ("rIndexQuarz: %e\n",rIndexQuarz[i]);
     } 
     
     //Refraction index for opaque quarz, methane and grid
-    Float_t rindex_quarzo[26];
-    Float_t rindex_methane[26];
-    Float_t rindex_gri[26];
+    Float_t rIndexOpaqueQuarz[26];
+    Float_t rIndexMethane[26];
+    Float_t rIndexGrid[26];
     for (i=0;i<26;i++)
     {
-       rindex_quarzo[i]=1;
-       rindex_methane[i]=1.000444;
-       rindex_gri[i]=1;
-       //printf ("Rindex_quarzo , etc: %e, %e, %e\n",rindex_quarzo[i], rindex_methane[i], rindex_gri[i]=1);
+       rIndexOpaqueQuarz[i]=1;
+       rIndexMethane[i]=1.000444;
+       rIndexGrid[i]=1;
+       //printf ("rIndexOpaqueQuarz , etc: %e, %e, %e\n",rIndexOpaqueQuarz[i], rIndexMethane[i], rIndexGrid[i]=1);
     } 
     
     //Absorption index for freon
-    Float_t absco_freon[26] = {179.0987, 179.0987, 179.0987, 179.0987, 179.0987,  179.0987, 179.0987, 179.0987, 
+    Float_t abscoFreon[26] = {179.0987, 179.0987, 179.0987, 179.0987, 179.0987,  179.0987, 179.0987, 179.0987, 
                               179.0987, 142.9206, 56.64957, 25.58622, 13.95293, 12.03905, 10.42953, 8.804196, 
                               7.069031, 4.461292, 2.028366, 1.293013, .577267,   .40746,  .334964, 0., 0., 0.};
     
@@ -498,12 +508,12 @@ void AliRICHv0::CreateMaterials()
                        .906,.907,.907,.907};
     Float_t Wavl2[] = {150.,155.,160.0,165.0,170.0,175.0,180.0,185.0,190.0,195.0,200.0,205.0,210.0,
                       215.0,220.0,225.0,230.0,235.0,240.0,245.0,250.0};                                 
-    Float_t absco_quarz[31];        
+    Float_t abscoQuarz[31];         
     for (Int_t i=0;i<31;i++)
     {
        Float_t Xlam = 1237.79 / (ppckov[i]*1e9);
-       if (Xlam <= 160) absco_quarz[i] = 0;
-       if (Xlam > 250) absco_quarz[i] = 1;
+       if (Xlam <= 160) abscoQuarz[i] = 0;
+       if (Xlam > 250) abscoQuarz[i] = 1;
        else 
        {
            for (Int_t j=0;j<21;j++)
@@ -513,54 +523,54 @@ void AliRICHv0::CreateMaterials()
                {
                    Float_t Dabs = (Qzt[j+1] - Qzt[j])/(Wavl2[j+1] - Wavl2[j]);
                    Float_t Abso = Qzt[j] + Dabs*(Xlam - Wavl2[j]);
-                   absco_quarz[i] = -5.0/(TMath::Log(Abso));
+                   abscoQuarz[i] = -5.0/(TMath::Log(Abso));
                } 
            }
        }
-       printf ("Absco_quarz: %e Absco_freon: %e for energy: %e\n",absco_quarz[i],absco_freon[i],ppckov[i]);
+       printf ("abscoQuarz: %e abscoFreon: %e for energy: %e\n",abscoQuarz[i],abscoFreon[i],ppckov[i]);
     }*/
 
-    /*Float_t absco_quarz[31] = {49.64211, 48.41296, 47.46989, 46.50492, 45.13682, 44.47883, 43.1929 , 41.30922, 40.5943 ,
+    /*Float_t abscoQuarz[31] = {49.64211, 48.41296, 47.46989, 46.50492, 45.13682, 44.47883, 43.1929 , 41.30922, 40.5943 ,
                               39.82956, 38.98623, 38.6247 , 38.43448, 37.41084, 36.22575, 33.74852, 30.73901, 24.25086, 
                               17.94531, 11.88753, 5.99128,  3.83503,  2.36661,  1.53155, 1.30582, 1.08574, .8779708, 
                               .675275, 0., 0., 0.};
     
     for (Int_t i=0;i<31;i++)
     {
-       absco_quarz[i] = absco_quarz[i]/10;
+       abscoQuarz[i] = abscoQuarz[i]/10;
     }*/
 
-    Float_t absco_quarz [26] = {105.8, 65.52, 48.58, 42.85, 35.79, 31.262, 28.598, 27.527, 25.007, 22.815, 21.004,
+    Float_t abscoQuarz [26] = {105.8, 65.52, 48.58, 42.85, 35.79, 31.262, 28.598, 27.527, 25.007, 22.815, 21.004,
                                19.266, 17.525, 15.878, 14.177, 11.719, 9.282, 6.62, 4.0925, 2.601, 1.149, .667, .3627,
                                .192, .1497, .10857};
     
     //Absorption index for methane
-    Float_t absco_methane[26];
+    Float_t abscoMethane[26];
     for (i=0;i<26;i++) 
     {
-       absco_methane[i]=AbsoCH4(ppckov[i]*1e9); 
-       //printf("Absco_methane: %e for energy: %e\n", absco_methane[i],ppckov[i]*1e9);
+       abscoMethane[i]=AbsoCH4(ppckov[i]*1e9); 
+       //printf("abscoMethane: %e for energy: %e\n", abscoMethane[i],ppckov[i]*1e9);
     }
     
     //Absorption index for opaque quarz, csi and grid, efficiency for all and grid
-    Float_t absco_quarzo[26];
-    Float_t absco_csi[26];
-    Float_t absco_gri[26];
-    Float_t effic_all[26];
-    Float_t effic_gri[26];
+    Float_t abscoOpaqueQuarz[26];
+    Float_t abscoCsI[26];
+    Float_t abscoGrid[26];
+    Float_t efficAll[26];
+    Float_t efficGrid[26];
     for (i=0;i<26;i++)
     { 
-       absco_quarzo[i]=1e-5; 
-       absco_csi[i]=1e-4; 
-       absco_gri[i]=1e-4; 
-       effic_all[i]=1; 
-       effic_gri[i]=1;
-       //printf ("All must be 1: %e,  %e,  %e,  %e,  %e\n",absco_quarzo[i],absco_csi[i],absco_gri[i],effic_all[i],effic_gri[i]);
+       abscoOpaqueQuarz[i]=1e-5; 
+       abscoCsI[i]=1e-4; 
+       abscoGrid[i]=1e-4; 
+       efficAll[i]=1; 
+       efficGrid[i]=1;
+       //printf ("All must be 1: %e,  %e,  %e,  %e,  %e\n",abscoOpaqueQuarz[i],abscoCsI[i],abscoGrid[i],efficAll[i],efficGrid[i]);
     } 
     
     //Efficiency for csi 
     
-    Float_t effic_csi[26] = {0.000199999995, 0.000600000028, 0.000699999975, 0.00499999989, 0.00749999983, 0.010125,
+    Float_t efficCsI[26] = {0.000199999995, 0.000600000028, 0.000699999975, 0.00499999989, 0.00749999983, 0.010125,
                             0.0242999997, 0.0405000001, 0.0688500032, 0.105299994, 0.121500008, 0.141749993, 0.157949999,
                             0.162, 0.166050002, 0.167669997, 0.174299985, 0.176789999, 0.179279998, 0.182599992, 0.18592,
                             0.187579989, 0.189239994, 0.190899998, 0.207499996, 0.215799987};
@@ -572,7 +582,7 @@ void AliRICHv0::CreateMaterials()
 
     for (i=0;i<26;i++)
     {
-       effic_csi[i] = effic_csi[i]/(1.-Fresnel(ppckov[i]*1e9,1.,0)); 
+       efficCsI[i] = efficCsI[i]/(1.-Fresnel(ppckov[i]*1e9,1.,0)); 
        //printf ("Fresnel result: %e for energy: %e\n",Fresnel(ppckov[i]*1e9,1.,0),ppckov[i]*1e9);
     }
        
@@ -588,7 +598,7 @@ void AliRICHv0::CreateMaterials()
     Int_t nlmatfre;
     Float_t densquao;
     Int_t nlmatmet, nlmatqua;
-    Float_t wmatquao[2], rindex_freon[26];
+    Float_t wmatquao[2], rIndexFreon[26];
     Float_t aquao[2], epsil, stmin, zquao[2];
     Int_t nlmatquao;
     Float_t radlal, densal, tmaxfd, deemax, stemax;
@@ -601,8 +611,8 @@ void AliRICHv0::CreateMaterials()
     // --- Photon energy (GeV) 
     // --- Refraction indexes 
     for (i = 0; i < 26; ++i) {
-       rindex_freon[i] = ppckov[i] * .0172 * 1e9 + 1.177;
-       //printf ("Rindex_freon: %e \n Effic_csi: %e for energy: %e\n",rindex_freon[i], effic_csi[i], ppckov[i]);
+       rIndexFreon[i] = ppckov[i] * .0172 * 1e9 + 1.177;
+       //printf ("rIndexFreon: %e \n efficCsI: %e for energy: %e\n",rIndexFreon[i], efficCsI[i], ppckov[i]);
     }
             
     // --- Detection efficiencies (quantum efficiency for CsI) 
@@ -689,28 +699,28 @@ void AliRICHv0::CreateMaterials()
     epsil  = .001;
     stmin  = -.001;
     
-    AliMedium(1, "DEFAULT MEDIUM AIR$", 1, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-    AliMedium(2, "HONEYCOMB$", 6, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-    AliMedium(3, "QUARZO$", 20, 1, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-    AliMedium(4, "FREON$", 30, 1, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-    AliMedium(5, "METANO$", 40, 1, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-    AliMedium(6, "CSI$", 16, 1, ISXFLD, SXMGMX,tmaxfd, stemax, deemax, epsil, stmin);
-    AliMedium(7, "GRIGLIA$", 11, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-    AliMedium(8, "QUARZOO$", 21, 1, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-    AliMedium(9, "GAP$", 41, 1, ISXFLD, SXMGMX,tmaxfd, .1, -deemax, epsil, -stmin);
-    AliMedium(10, "ALUMINUM$", 50, 1, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-    
-
-    geant3->Gsckov(idtmed[1000], 26, ppckov, absco_methane, effic_all, rindex_methane);
-    geant3->Gsckov(idtmed[1001], 26, ppckov, absco_methane, effic_all, rindex_methane);
-    geant3->Gsckov(idtmed[1002], 26, ppckov, absco_quarz, effic_all,rindex_quarz);
-    geant3->Gsckov(idtmed[1003], 26, ppckov, absco_freon, effic_all,rindex_freon);
-    geant3->Gsckov(idtmed[1004], 26, ppckov, absco_methane, effic_all, rindex_methane);
-    geant3->Gsckov(idtmed[1005], 26, ppckov, absco_csi, effic_csi, rindex_methane);
-    geant3->Gsckov(idtmed[1006], 26, ppckov, absco_gri, effic_gri, rindex_gri);
-    geant3->Gsckov(idtmed[1007], 26, ppckov, absco_quarzo, effic_all, rindex_quarzo);
-    geant3->Gsckov(idtmed[1008], 26, ppckov, absco_methane, effic_all, rindex_methane);
-    geant3->Gsckov(idtmed[1009], 26, ppckov, absco_gri, effic_gri, rindex_gri);
+    AliMedium(1, "DEFAULT MEDIUM AIR$", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+    AliMedium(2, "HONEYCOMB$", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+    AliMedium(3, "QUARZO$", 20, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+    AliMedium(4, "FREON$", 30, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+    AliMedium(5, "METANO$", 40, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+    AliMedium(6, "CSI$", 16, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin);
+    AliMedium(7, "GRIGLIA$", 11, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+    AliMedium(8, "QUARZOO$", 21, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+    AliMedium(9, "GAP$", 41, 1, isxfld, sxmgmx,tmaxfd, .1, -deemax, epsil, -stmin);
+    AliMedium(10, "ALUMINUM$", 50, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+    
+
+    geant3->Gsckov(idtmed[1000], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
+    geant3->Gsckov(idtmed[1001], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
+    geant3->Gsckov(idtmed[1002], 26, ppckov, abscoQuarz, efficAll,rIndexQuarz);
+    geant3->Gsckov(idtmed[1003], 26, ppckov, abscoFreon, efficAll,rIndexFreon);
+    geant3->Gsckov(idtmed[1004], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
+    geant3->Gsckov(idtmed[1005], 26, ppckov, abscoCsI, efficCsI, rIndexMethane);
+    geant3->Gsckov(idtmed[1006], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
+    geant3->Gsckov(idtmed[1007], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
+    geant3->Gsckov(idtmed[1008], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
+    geant3->Gsckov(idtmed[1009], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
 }
 
 //___________________________________________
@@ -780,14 +790,14 @@ Float_t AliRICHv0::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
 Float_t AliRICHv0::AbsoCH4(Float_t x)
 {
 
-    //LOSCH,SCH4(9),WL(9),EM(9),ALENGTH(31)
+    //KLOSCH,SCH4(9),WL(9),EM(9),ALENGTH(31)
     Float_t sch4[9] = {.12,.16,.23,.38,.86,2.8,7.9,28.,80.};              //MB X 10^22
     //Float_t wl[9] = {153.,152.,151.,150.,149.,148.,147.,146.,145};
     Float_t em[9] = {8.1,8.158,8.212,8.267,8.322,8.378,8.435,8.493,8.55};
-    const Float_t losch=2.686763E19;                                      // LOSCHMIDT NUMBER IN CM-3
-    const Float_t igas1=100, igas2=0, oxy=10., wat=5., pre=750.,tem=283.;                                      
-    Float_t pn=pre/760.;
-    Float_t tn=tem/273.16;
+    const Float_t kLosch=2.686763E19;                                      // LOSCHMIDT NUMBER IN CM-3
+    const Float_t kIgas1=100, kIgas2=0, kOxy=10., kWater=5., kPressure=750.,kTemperature=283.;                                      
+    Float_t pn=kPressure/760.;
+    Float_t tn=kTemperature/273.16;
     
        
 // ------- METHANE CROSS SECTION -----------------
@@ -817,7 +827,7 @@ Float_t AliRICHv0::AbsoCH4(Float_t x)
        }
     }
     
-    Float_t dm=(igas1/100.)*(1.-((oxy+wat)/1.e6))*losch*pn/tn;
+    Float_t dm=(kIgas1/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
     Float_t abslm=1./sm/dm;
     
 //    ------- ISOBUTHANE CROSS SECTION --------------
@@ -827,7 +837,7 @@ Float_t AliRICHv0::AbsoCH4(Float_t x)
     
     Float_t ai;
     Float_t absli;
-    if (igas2 != 0) 
+    if (kIgas2 != 0) 
     {
        if (x<7.25)
            ai=100000000.;
@@ -838,8 +848,8 @@ Float_t AliRICHv0::AbsoCH4(Float_t x)
        if(x>=7.375)
            ai=.0000000001;
        
-       Float_t si = 1./(ai*losch*273.16/293.);                    // ISOB. CRO.SEC.IN CM2
-       Float_t di=(igas2/100.)*(1.-((oxy+wat)/1.e6))*losch*pn/tn;
+       Float_t si = 1./(ai*kLosch*273.16/293.);                    // ISOB. CRO.SEC.IN CM2
+       Float_t di=(kIgas2/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
        absli =1./si/di;
     }
     else
@@ -882,7 +892,7 @@ Float_t AliRICHv0::AbsoCH4(Float_t x)
            so=so*1e-18;
        }
        
-       Float_t dox=(oxy/1e6)*losch*pn/tn;
+       Float_t dox=(kOxy/1e6)*kLosch*pn/tn;
        abslo=1./so/dox;
     }
     else
@@ -908,7 +918,7 @@ Float_t AliRICHv0::AbsoCH4(Float_t x)
     {    
        Float_t sw= b0+(b1*x)+(b2*x*x)+(b3*x*x*x)+(b4*x*x*x*x);
        sw=sw*1e-18;
-       Float_t dw=(wat/1e6)*losch*pn/tn;
+       Float_t dw=(kWater/1e6)*kLosch*pn/tn;
        abslw=1./sw/dw;
     }
     else
@@ -942,7 +952,7 @@ void AliRICHv0::Init()
     // 
     // Initialize Tracking Chambers
     //
-    for (Int_t i=1; i<7; i++) {
+    for (Int_t i=1; i<kNCH; i++) {
        //printf ("i:%d",i);
        ( (AliRICHChamber*) (*fChambers)[i])->Init();  
     }  
@@ -1007,44 +1017,3 @@ void AliRICHv0::StepManager()
 
   
 //___________________________________________
-Int_t AliRICH::MakePadHits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, Response_t res)
-{
-//
-//  Calls the charge disintegration method of the current chamber and adds
-//  the simulated cluster to the root treee 
-//
-    Int_t clhits[7];
-    Float_t newclust[6][500];
-    Int_t nnew;
-    
-//
-//  Integrated pulse height on chamber
-    
-    clhits[0]=fNhits+1;
-    
-    ((AliRICHChamber*) (*fChambers)[idvol])->DisIntegration(eloss, xhit, yhit, nnew, newclust, res);
-    Int_t ic=0;
-    
-//
-//  Add new clusters
-    for (Int_t i=0; i<nnew; i++) {
-       if (Int_t(newclust[3][i]) > 0) {
-           ic++;
-// Cathode plane
-           clhits[1] = Int_t(newclust[5][i]);
-//  Cluster Charge
-           clhits[2] = Int_t(newclust[0][i]);
-//  Pad: ix
-           clhits[3] = Int_t(newclust[1][i]);
-//  Pad: iy 
-           clhits[4] = Int_t(newclust[2][i]);
-//  Pad: charge
-           clhits[5] = Int_t(newclust[3][i]);
-//  Pad: chamber sector
-           clhits[6] = Int_t(newclust[4][i]);
-           
-           AddPadHit(clhits);
-       }
-    }
-return nnew;
-}
index b8a052f6d5577b2d5d5f18f426e6bd227b122e0a..e13a51b6b4d0e46fa587c727b57157be0c2d8e64 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef RICHv0_H
-#define RICHv0_H
+#ifndef ALIRICHV0_H
+#define ALIRICHV0_H
 
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 class AliRICHv0 : public AliRICH {
     
  public:
-    Int_t fCkov_number;
-    Int_t fCkov_quarz;
-    Int_t fCkov_gap;
-    Int_t fCkov_csi;
-    Int_t fLost_rfreo;
-    Int_t fLost_rquar;
-    Int_t fLost_afreo;
-    Int_t fLost_aquarz;
-    Int_t fLost_ameta;
-    Int_t fLost_csi;
-    Int_t fLost_wires;
-    Int_t fFreon_prod;
-    Float_t fMipx;
-    Float_t fMipy;
-    Int_t fFeedbacks;
-    Int_t fLost_fresnel;
-    
     AliRICHv0();
     AliRICHv0(const char *name, const char *title);
     virtual       ~AliRICHv0() {}
@@ -44,7 +27,23 @@ class AliRICHv0 : public AliRICH {
     Float_t        Fresnel(Float_t ene,Float_t pdoti, Bool_t pola);
     Float_t        AbsoCH4(Float_t x);
 //   virtual void   Trigger(Float_t (*)[4], Float_t (*)[4], Int_t& iflag);
- private:
+ protected:
+    Int_t fCkovNumber;                   // Number of Cerenkov photons
+    Int_t fCkovQuarz;                    // Cerenkovs crossing quartz
+    Int_t fCkovGap;                      // Cerenkovs crossing gap
+    Int_t fCkovCsi;                      // Cerenkovs crossing csi
+    Int_t fLostRfreo;                    // Cerenkovs reflected in freon
+    Int_t fLostRquar;                    // Cerenkovs reflected in quartz
+    Int_t fLostAfreo;                    // Cerenkovs absorbed in freon 
+    Int_t fLostAquarz;                   // Cerenkovs absorbed in quartz
+    Int_t fLostAmeta;                    // Cerenkovs absorbed in methane
+    Int_t fLostCsi;                      // Cerenkovs below csi quantum efficiency 
+    Int_t fLostWires;                    // Cerenkovs lost in wires
+    Int_t fFreonProd;                    // Cerenkovs produced in freon
+    Float_t fMipx;                       // x coord. of MIP
+    Float_t fMipy;                       // y coord. of MIP
+    Int_t fFeedbacks;                    // Number of feedback photons
+    Int_t fLostFresnel;                  // Cerenkovs lost by Fresnel reflection
     ClassDef(AliRICHv0,1)  //Hits manager for set: RICH default version
        
        };
index c67da8994cfee00f9b09fb2f7c820e53dad303f6..2e393114227348a41338426422a11e33858ec544 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
   $Log$
+  Revision 1.1  2000/06/09 15:00:31  jbarbosa
+  New full version. All parameters configurable.
+
   Revision 1.9  2000/05/31 08:19:38  jbarbosa
   Fixed bug in StepManager
 
 #include <TTUBE.h>
 #include <TNode.h> 
 #include <TRandom.h> 
+#include <TParticle.h> 
 
 #include "AliRICHv1.h"
+#include "AliRICHHit.h"
 #include "AliRun.h"
 #include "AliMC.h"
 #include "iostream.h"
@@ -60,6 +65,9 @@ ClassImp(AliRICHv1)
 //___________________________________________
 AliRICHv1::AliRICHv1() : AliRICHv0()
 {
+
+// Default constructor fo AliRICHvv1 (full version)
+
     //fChambers = 0;
 }
 
@@ -67,41 +75,120 @@ AliRICHv1::AliRICHv1() : AliRICHv0()
 AliRICHv1::AliRICHv1(const char *name, const char *title)
     : AliRICHv0(name,title)
 {
-    fCkov_number=0;
-    fFreon_prod=0;
 
-    fChambers = new TObjArray(7);
-    for (Int_t i=0; i<7; i++) {
+// Full version of RICH with hits and diagnostics
+
+    fCkovNumber=0;
+    fFreonProd=0;
+
+    fChambers = new TObjArray(kNCH);
+    for (Int_t i=0; i<kNCH; i++) {
     
        (*fChambers)[i] = new AliRICHChamber();  
        
     }
 }
 
+void AliRICHv1::Init()
+{
+
+  printf("*********************************** RICH_INIT ***********************************\n");
+  printf("*                                                                               *\n");
+  printf("*                    AliRICHv1 Configurable version started                     *\n");
+  printf("*                                                                               *\n");
+
+  
+  AliRICHSegmentation*  segmentation;
+  AliRICHGeometry*  geometry;
+  AliRICHResponse*  response;
+
+
+    // 
+    // Initialize Tracking Chambers
+    //
+    for (Int_t i=1; i<kNCH; i++) {
+       //printf ("i:%d",i);
+       ( (AliRICHChamber*) (*fChambers)[i])->Init();  
+    }  
+    
+    //
+    // Set the chamber (sensitive region) GEANT identifier
+    
+    ((AliRICHChamber*)(*fChambers)[0])->SetGid(1);  
+    ((AliRICHChamber*)(*fChambers)[1])->SetGid(2);  
+    ((AliRICHChamber*)(*fChambers)[2])->SetGid(3);  
+    ((AliRICHChamber*)(*fChambers)[3])->SetGid(4);  
+    ((AliRICHChamber*)(*fChambers)[4])->SetGid(5);  
+    ((AliRICHChamber*)(*fChambers)[5])->SetGid(6);  
+    ((AliRICHChamber*)(*fChambers)[6])->SetGid(7); 
+
+    Float_t pos1[3]={0,471.8999,165.2599};
+    Chamber(0).SetChamberTransform(pos1[0],pos1[1],pos1[2],new TRotMatrix("rot993","rot993",90,0,70.69,90,19.30999,-90));
+
+    Float_t pos2[3]={171,470,0};
+    Chamber(1).SetChamberTransform(pos2[0],pos2[1],pos2[2],new TRotMatrix("rot994","rot994",90,-20,90,70,0,0));
+
+    Float_t pos3[3]={0,500,0};
+    Chamber(2).SetChamberTransform(pos3[0],pos3[1],pos3[2],new TRotMatrix("rot995","rot995",90,0,90,90,0,0));
+    
+    Float_t pos4[3]={-171,470,0};
+    Chamber(3).SetChamberTransform(pos4[0],pos4[1],pos4[2], new TRotMatrix("rot996","rot996",90,20,90,110,0,0));  
+
+    Float_t pos5[3]={161.3999,443.3999,-165.3};
+    Chamber(4).SetChamberTransform(pos5[0],pos5[1],pos5[2],new TRotMatrix("rot997","rot997",90,340,108.1999,70,18.2,70));
+
+    Float_t pos6[3]={0., 471.9, -165.3,};
+    Chamber(5).SetChamberTransform(pos6[0],pos6[1],pos6[2],new TRotMatrix("rot998","rot998",90,0,109.3099,90,19.30999,90));
+
+    Float_t pos7[3]={-161.399,443.3999,-165.3};
+    Chamber(6).SetChamberTransform(pos7[0],pos7[1],pos7[2],new TRotMatrix("rot999","rot999",90,20,108.1999,110,18.2,110));
+    
+    segmentation=Chamber(0).GetSegmentationModel(0);
+    geometry=Chamber(0).GetGeometryModel();
+    response=Chamber(0).GetResponseModel();
+    
+     
+    printf("*                            Pads            : %3dx%3d                          *\n",segmentation->Npx(),segmentation->Npy());
+    printf("*                            Pad size        : %5.2f x%5.2f mm2                 *\n",segmentation->Dpx(),segmentation->Dpy()); 
+    printf("*                            Gap Thickness   : %5.1f mm                         *\n",geometry->GetGapThickness());
+    printf("*                            Radiator Width  : %5.1f mm                         *\n",geometry->GetQuartzWidth());
+    printf("*                            Radiator Length : %5.1f mm                         *\n",geometry->GetQuartzLength());
+    printf("*                            Freon Thickness : %5.1f mm                         *\n",geometry->GetFreonThickness());
+    printf("*                            Charge Slope    : %5.1f ADC                        *\n",response->ChargeSlope());
+    printf("*                            Feedback Prob.  : %5.2f %%                          *\n",response->AlphaFeedback());
+    printf("*                                                                               *\n");
+    printf("*                                   Success!                                    *\n");
+    printf("*                                                                               *\n");
+    printf("*********************************************************************************\n");
+
+}
 
 //___________________________________________
 void AliRICHv1::StepManager()
 {
+
+// Full Step Manager
+
     Int_t          copy, id;
     static Int_t   idvol;
     static Int_t   vol[2];
     Int_t          ipart;
     static Float_t hits[18];
-    static Float_t Ckov_data[19];
-    TLorentzVector Position;
-    TLorentzVector Momentum;
+    static Float_t ckovData[19];
+    TLorentzVector position;
+    TLorentzVector momentum;
     Float_t        pos[3];
     Float_t        mom[4];
-    Float_t        Localpos[3];
-    Float_t        Localmom[4];
-    Float_t        Localtheta,Localphi;
+    Float_t        localPos[3];
+    Float_t        localMom[4];
+    Float_t        localTheta,localPhi;
     Float_t        theta,phi;
     Float_t        destep, step;
     Float_t        ranf[2];
-    Int_t          NPads;
+    Int_t          nPads;
     Float_t        coscerenkov;
     static Float_t eloss, xhit, yhit, tlength;
-    const  Float_t big=1.e10;
+    const  Float_t kBig=1.e10;
        
     TClonesArray &lhits = *fHits;
     TGeant3 *geant3 = (TGeant3*) gMC;
@@ -115,17 +202,17 @@ void AliRICHv1::StepManager()
     
     idvol=-1;
     id=gMC->CurrentVolID(copy);
-    Float_t cherenkov_loss=0;
+    Float_t cherenkovLoss=0;
     //gAlice->KeepTrack(gAlice->CurrentTrack());
     
-    gMC->TrackPosition(Position);
-    pos[0]=Position(0);
-    pos[1]=Position(1);
-    pos[2]=Position(2);
-    Ckov_data[1] = pos[0];                 // X-position for hit
-    Ckov_data[2] = pos[1];                 // Y-position for hit
-    Ckov_data[3] = pos[2];                 // Z-position for hit
-    //Ckov_data[11] = gAlice->CurrentTrack();
+    gMC->TrackPosition(position);
+    pos[0]=position(0);
+    pos[1]=position(1);
+    pos[2]=position(2);
+    ckovData[1] = pos[0];                 // X-position for hit
+    ckovData[2] = pos[1];                 // Y-position for hit
+    ckovData[3] = pos[2];                 // Z-position for hit
+    //ckovData[11] = gAlice->CurrentTrack();
 
     //AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH"); 
     
@@ -135,10 +222,10 @@ void AliRICHv1::StepManager()
 
       //if (gMC->VolId("GAP ")==gMC->CurrentVolID(copy))
         //{                    
-         Float_t Ckov_energy = current->Energy();
+         Float_t ckovEnergy = current->Energy();
          //energy interval for tracking
-         if  (Ckov_energy > 5.6e-09 && Ckov_energy < 7.8e-09 )       
-           //if (Ckov_energy > 0)
+         if  (ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 )       
+           //if (ckovEnergy > 0)
            {
              if (gMC->IsTrackEntering()){                                     //is track entering?
                if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
@@ -148,38 +235,38 @@ void AliRICHv1::StepManager()
                      
                      //printf("Second Mother:%d\n",current->GetSecondMother());
                      
-                     Ckov_data[10] = mother;
-                     Ckov_data[11] = gAlice->CurrentTrack();
-                     Ckov_data[12] = 1;             //Media where photon was produced 1->Freon, 2->Quarz
-                     fCkov_number++;
-                     fFreon_prod=1;
-                     //printf("Index: %d\n",fCkov_number);
+                     ckovData[10] = mother;
+                     ckovData[11] = gAlice->CurrentTrack();
+                     ckovData[12] = 1;             //Media where photon was produced 1->Freon, 2->Quarz
+                     fCkovNumber++;
+                     fFreonProd=1;
+                     //printf("Index: %d\n",fCkovNumber);
                    }    //first step question
                  }        //freo question
                
                if (geant3->Gctrak()->nstep<1){                                  //is it first step?
                  if (gMC->VolId("QUAR")==gMC->CurrentVolID(copy))             //is it in quarz?
                    {
-                     Ckov_data[12] = 2;
+                     ckovData[12] = 2;
                    }    //quarz question
                }        //first step question
                
-               //printf("Before %d\n",fFreon_prod);
+               //printf("Before %d\n",fFreonProd);
              }   //track entering question
              
-             if (Ckov_data[12] == 1)                                        //was it produced in Freon?
-               //if (fFreon_prod == 1)
+             if (ckovData[12] == 1)                                        //was it produced in Freon?
+               //if (fFreonProd == 1)
                {
                  if (gMC->IsTrackEntering()){                                     //is track entering?
                    //printf("Got in");
                    if (gMC->VolId("META")==gMC->CurrentVolID(copy))                //is it in gap?      
                      {
                        //printf("Got in\n");
-                       gMC->TrackMomentum(Momentum);
-                       mom[0]=Momentum(0);
-                       mom[1]=Momentum(1);
-                       mom[2]=Momentum(2);
-                       mom[3]=Momentum(3);
+                       gMC->TrackMomentum(momentum);
+                       mom[0]=momentum(0);
+                       mom[1]=momentum(1);
+                       mom[2]=momentum(2);
+                       mom[3]=momentum(3);
                        // Z-position for hit
                        
                        
@@ -191,8 +278,8 @@ void AliRICHv1::StepManager()
                        //printf("grid calculation:%f\n",t);
                        if (ranf[0] > t) {
                          //geant3->StopTrack();
-                         Ckov_data[13] = 5;
-                         AddCerenkov(gAlice->CurrentTrack(),vol,Ckov_data);
+                         ckovData[13] = 5;
+                         AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
                          //printf("Lost one in grid\n");
                        }
                        /**********************************************************************************/
@@ -200,22 +287,22 @@ void AliRICHv1::StepManager()
                    
                    if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy))             //is it in csi?      
                      {
-                       gMC->TrackMomentum(Momentum);
-                       mom[0]=Momentum(0);
-                       mom[1]=Momentum(1);
-                       mom[2]=Momentum(2);
-                       mom[3]=Momentum(3);
+                       gMC->TrackMomentum(momentum);
+                       mom[0]=momentum(0);
+                       mom[1]=momentum(1);
+                       mom[2]=momentum(2);
+                       mom[3]=momentum(3);
                        
                        /********* Photons lost by Fresnel reflection have to be calculated by hand********/ 
                        /***********************Cerenkov phtons (always polarised)*************************/
                        
                        Float_t cophi = TMath::Cos(TMath::ATan2(mom[0], mom[1]));
-                       Float_t t = Fresnel(Ckov_energy*1e9,cophi,1);
+                       Float_t t = Fresnel(ckovEnergy*1e9,cophi,1);
                        gMC->Rndm(ranf, 1);
                        if (ranf[0] < t) {
                          //geant3->StopTrack();
-                         Ckov_data[13] = 6;
-                         AddCerenkov(gAlice->CurrentTrack(),vol,Ckov_data);
+                         ckovData[13] = 6;
+                         AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
                          //printf("Lost by Fresnel\n");
                        }
                        /**********************************************************************************/
@@ -230,46 +317,46 @@ void AliRICHv1::StepManager()
                  for (Int_t i = 0; i < i1; ++i) {
                    //        Reflection loss 
                    if (geant3->Gctrak()->lmec[i] == 106) {        //was it reflected
-                     Ckov_data[13]=10;
+                     ckovData[13]=10;
                      if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy)) 
-                       Ckov_data[13]=1;
+                       ckovData[13]=1;
                      if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR")) 
-                       Ckov_data[13]=2;
+                       ckovData[13]=2;
                      //geant3->StopTrack();
-                     AddCerenkov(gAlice->CurrentTrack(),vol,Ckov_data);
+                     AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
                    } //reflection question
                    
                    
                    //        Absorption loss 
                    else if (geant3->Gctrak()->lmec[i] == 101) {              //was it absorbed?
-                     Ckov_data[13]=20;
+                     ckovData[13]=20;
                      if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy)) 
-                       Ckov_data[13]=11;
+                       ckovData[13]=11;
                      if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR")) 
-                       Ckov_data[13]=12;
+                       ckovData[13]=12;
                      if (gMC->CurrentVolID(copy) == gMC->VolId("META")) 
-                       Ckov_data[13]=13;
+                       ckovData[13]=13;
                      if (gMC->CurrentVolID(copy) == gMC->VolId("GAP ")) 
-                       Ckov_data[13]=13;
+                       ckovData[13]=13;
                      
                      if (gMC->CurrentVolID(copy) == gMC->VolId("SRIC")) 
-                       Ckov_data[13]=15;
+                       ckovData[13]=15;
                      
                      //        CsI inefficiency 
                      if (gMC->CurrentVolID(copy) == gMC->VolId("CSI ")) {
-                       Ckov_data[13]=16;
+                       ckovData[13]=16;
                      }
                      //geant3->StopTrack();
-                     AddCerenkov(gAlice->CurrentTrack(),vol,Ckov_data);
-                     //printf("Added cerenkov %d\n",fCkov_number);
+                     AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
+                     //printf("Added cerenkov %d\n",fCkovNumber);
                    } //absorption question 
                    
                    
                    //        Photon goes out of tracking scope 
                    else if (geant3->Gctrak()->lmec[i] == 30) {                 //is it below energy treshold?
-                     Ckov_data[13]=21;
+                     ckovData[13]=21;
                      //geant3->StopTrack();
-                     AddCerenkov(gAlice->CurrentTrack(),vol,Ckov_data);
+                     AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
                    }   // energy treshold question         
                  }  //number of mechanisms cycle
                  /**********************End of evaluation************************/
@@ -289,28 +376,28 @@ void AliRICHv1::StepManager()
        {
            
          if (gMC->Edep() > 0.){
-               gMC->TrackPosition(Position);
-               gMC->TrackMomentum(Momentum);
-               pos[0]=Position(0);
-               pos[1]=Position(1);
-               pos[2]=Position(2);
-               mom[0]=Momentum(0);
-               mom[1]=Momentum(1);
-               mom[2]=Momentum(2);
-               mom[3]=Momentum(3);
+               gMC->TrackPosition(position);
+               gMC->TrackMomentum(momentum);
+               pos[0]=position(0);
+               pos[1]=position(1);
+               pos[2]=position(2);
+               mom[0]=momentum(0);
+               mom[1]=momentum(1);
+               mom[2]=momentum(2);
+               mom[3]=momentum(3);
                Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
                Double_t rt = TMath::Sqrt(tc);
                theta   = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
                phi     = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
-               gMC->Gmtod(pos,Localpos,1);                                                                    
-               gMC->Gmtod(mom,Localmom,2);
+               gMC->Gmtod(pos,localPos,1);                                                                    
+               gMC->Gmtod(mom,localMom,2);
                
                gMC->CurrentVolOffID(2,copy);
                vol[0]=copy;
                idvol=vol[0]-1;
 
                //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
-                       //->Sector(Localpos[0], Localpos[2]);
+                       //->Sector(localPos[0], localPos[2]);
                //printf("Sector:%d\n",sector);
 
                /*if (gMC->TrackPid() == 50000051){
@@ -319,34 +406,34 @@ void AliRICHv1::StepManager()
                }*/     
                
                ((AliRICHChamber*) (*fChambers)[idvol])
-                   ->SigGenInit(Localpos[0], Localpos[2], Localpos[1]);
-               if(idvol<7) {   
-                   Ckov_data[0] = gMC->TrackPid();        // particle type
-                   Ckov_data[1] = pos[0];                 // X-position for hit
-                   Ckov_data[2] = pos[1];                 // Y-position for hit
-                   Ckov_data[3] = pos[2];                 // Z-position for hit
-                   Ckov_data[4] = theta;                      // theta angle of incidence
-                   Ckov_data[5] = phi;                      // phi angle of incidence 
-                   Ckov_data[8] = (Float_t) fNPadHits;      // first padhit
-                   Ckov_data[9] = -1;                       // last pad hit
-                   Ckov_data[13] = 4;                       // photon was detected
-                   Ckov_data[14] = mom[0];
-                   Ckov_data[15] = mom[1];
-                   Ckov_data[16] = mom[2];
+                   ->SigGenInit(localPos[0], localPos[2], localPos[1]);
+               if(idvol<kNCH) {        
+                   ckovData[0] = gMC->TrackPid();        // particle type
+                   ckovData[1] = pos[0];                 // X-position for hit
+                   ckovData[2] = pos[1];                 // Y-position for hit
+                   ckovData[3] = pos[2];                 // Z-position for hit
+                   ckovData[4] = theta;                      // theta angle of incidence
+                   ckovData[5] = phi;                      // phi angle of incidence 
+                   ckovData[8] = (Float_t) fNPadHits;      // first padhit
+                   ckovData[9] = -1;                       // last pad hit
+                   ckovData[13] = 4;                       // photon was detected
+                   ckovData[14] = mom[0];
+                   ckovData[15] = mom[1];
+                   ckovData[16] = mom[2];
                    
                    destep = gMC->Edep();
-                   gMC->SetMaxStep(big);
-                   cherenkov_loss  += destep;
-                   Ckov_data[7]=cherenkov_loss;
+                   gMC->SetMaxStep(kBig);
+                   cherenkovLoss  += destep;
+                   ckovData[7]=cherenkovLoss;
                    
-                   NPads = MakePadHits(Localpos[0],Localpos[2],cherenkov_loss,idvol,cerenkov);
-                   if (fNPadHits > (Int_t)Ckov_data[8]) {
-                       Ckov_data[8]= Ckov_data[8]+1;
-                       Ckov_data[9]= (Float_t) fNPadHits;
+                   nPads = MakePadHits(localPos[0],localPos[2],cherenkovLoss,idvol,kCerenkov);
+                   if (fNPadHits > (Int_t)ckovData[8]) {
+                       ckovData[8]= ckovData[8]+1;
+                       ckovData[9]= (Float_t) fNPadHits;
                    }
 
-                   Ckov_data[17] = NPads;
-                   //printf("Npads:%d",NPads);
+                   ckovData[17] = nPads;
+                   //printf("nPads:%d",nPads);
                    
                    //TClonesArray *Hits = RICH->Hits();
                    AliRICHHit *mipHit =  (AliRICHHit*) (fHits->UncheckedAt(0));
@@ -355,29 +442,29 @@ void AliRICHv1::StepManager()
                        mom[0] = current->Px();
                        mom[1] = current->Py();
                        mom[2] = current->Pz();
-                       Float_t Mip_px = mipHit->fMomX;
-                       Float_t Mip_py = mipHit->fMomY;
-                       Float_t Mip_pz = mipHit->fMomZ;
+                       Float_t mipPx = mipHit->fMomX;
+                       Float_t mipPy = mipHit->fMomY;
+                       Float_t mipPz = mipHit->fMomZ;
                        
                        Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
                        Float_t rt = TMath::Sqrt(r);
-                       Float_t Mip_r = Mip_px*Mip_px + Mip_py*Mip_py + Mip_pz*Mip_pz;  
-                       Float_t Mip_rt = TMath::Sqrt(Mip_r);
-                       if ((rt*Mip_rt) > 0)
+                       Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz; 
+                       Float_t mipRt = TMath::Sqrt(mipR);
+                       if ((rt*mipRt) > 0)
                          {
-                           coscerenkov = (mom[0]*Mip_px + mom[1]*Mip_py + mom[2]*Mip_pz)/(rt*Mip_rt);
+                           coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
                          }
                        else
                          {
                            coscerenkov = 0;
                          }
                        Float_t cherenkov = TMath::ACos(coscerenkov);
-                       Ckov_data[18]=cherenkov;
+                       ckovData[18]=cherenkov;
                      }
                    //if (sector != -1)
                    //{
-                   AddHit(gAlice->CurrentTrack(),vol,Ckov_data);
-                   AddCerenkov(gAlice->CurrentTrack(),vol,Ckov_data);
+                   AddHit(gAlice->CurrentTrack(),vol,ckovData);
+                   AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
                    //}
                }
            }
@@ -399,7 +486,7 @@ void AliRICHv1::StepManager()
          }*/
        if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
          {
-           fFreon_prod=1;
+           fFreonProd=1;
          }
 
        if (gMC->VolId("GAP ")== gMC->CurrentVolID(copy)) {
@@ -410,20 +497,20 @@ void AliRICHv1::StepManager()
            idvol=vol[0]-1;
 
            //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
-                       //->Sector(Localpos[0], Localpos[2]);
+                       //->Sector(localPos[0], localPos[2]);
            //printf("Sector:%d\n",sector);
            
-           gMC->TrackPosition(Position);
-           gMC->TrackMomentum(Momentum);
-           pos[0]=Position(0);
-           pos[1]=Position(1);
-           pos[2]=Position(2);
-           mom[0]=Momentum(0);
-           mom[1]=Momentum(1);
-           mom[2]=Momentum(2);
-           mom[3]=Momentum(3);
-           gMC->Gmtod(pos,Localpos,1);                                                                    
-           gMC->Gmtod(mom,Localmom,2);
+           gMC->TrackPosition(position);
+           gMC->TrackMomentum(momentum);
+           pos[0]=position(0);
+           pos[1]=position(1);
+           pos[2]=position(2);
+           mom[0]=momentum(0);
+           mom[1]=momentum(1);
+           mom[2]=momentum(2);
+           mom[3]=momentum(3);
+           gMC->Gmtod(pos,localPos,1);                                                                    
+           gMC->Gmtod(mom,localMom,2);
            
            ipart  = gMC->TrackPid();
            //
@@ -441,40 +528,40 @@ void AliRICHv1::StepManager()
                phi     = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
                
 
-               Double_t Localtc = Localmom[0]*Localmom[0]+Localmom[2]*Localmom[2];
-               Double_t Localrt = TMath::Sqrt(Localtc);
-               Localtheta   = Float_t(TMath::ATan2(Localrt,Double_t(Localmom[1])))*kRaddeg;                       
-               Localphi     = Float_t(TMath::ATan2(Double_t(Localmom[2]),Double_t(Localmom[0])))*kRaddeg;    
+               Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
+               Double_t localRt = TMath::Sqrt(localTc);
+               localTheta   = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])))*kRaddeg;                       
+               localPhi     = Float_t(TMath::ATan2(Double_t(localMom[2]),Double_t(localMom[0])))*kRaddeg;    
                
                hits[0] = Float_t(ipart);         // particle type
-               hits[1] = Localpos[0];                 // X-position for hit
-               hits[2] = Localpos[1];                 // Y-position for hit
-               hits[3] = Localpos[2];                 // Z-position for hit
-               hits[4] = Localtheta;                  // theta angle of incidence
-               hits[5] = Localphi;                    // phi angle of incidence 
+               hits[1] = localPos[0];                 // X-position for hit
+               hits[2] = localPos[1];                 // Y-position for hit
+               hits[3] = localPos[2];                 // Z-position for hit
+               hits[4] = localTheta;                  // theta angle of incidence
+               hits[5] = localPhi;                    // phi angle of incidence 
                hits[8] = (Float_t) fNPadHits;    // first padhit
                hits[9] = -1;                     // last pad hit
-               hits[13] = fFreon_prod;