digitization under AliSimulation fixed, all the information in chamber's local system...
authorkir <kir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Jan 2004 11:17:33 +0000 (11:17 +0000)
committerkir <kir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Jan 2004 11:17:33 +0000 (11:17 +0000)
18 files changed:
RICH/AliRICH.cxx
RICH/AliRICH.h
RICH/AliRICHChamber.h
RICH/AliRICHClusterFinder.cxx
RICH/AliRICHClusterFinder.h
RICH/AliRICHDigitizer.cxx
RICH/AliRICHDigitizer.h
RICH/AliRICHDisplFast.cxx
RICH/AliRICHParam.cxx
RICH/AliRICHParam.h
RICH/AliRICHRecon.cxx
RICH/AliRICHv0.cxx
RICH/AliRICHv1.cxx
RICH/AliRICHv1.h
RICH/CreateConfig.C
RICH/RichBatch.C
RICH/api.txt
RICH/menu.C

index 775de83..f8a466c 100644 (file)
@@ -23,6 +23,8 @@
 #include <TFile.h>
 #include <TNode.h> 
 #include <TObjArray.h>
+#include <TParticle.h>
+#include <AliStack.h>
 #include <AliMagF.h>
 #include <AliRun.h>
 #include <AliRunDigitizer.h>
@@ -33,18 +35,16 @@ ClassImp(AliRICHhit)
 //__________________________________________________________________________________________________
 void AliRICHhit::Print(Option_t*)const
 {
-  TVector3 glob(fX,fY,fZ);
-  AliRICH *pRich = (AliRICH*)gAlice->GetDetector("RICH");
-  TVector3 loc = pRich->C(fChamber)->Glob2Loc(glob);
-  ::Info("hit","chamber=%2i, PID=%9i, TID=%6i, eloss=%9.3f eV, XYz(%7.2f,%7.2f,%7.2f)",fChamber,fPid,fTrack,fEloss*1e9,loc.X(),loc.Y(),loc.Z());
+  ::Info("hit","Ch=%1i, TID=%6i, eloss=%9.3f eV, in-out dist=%9.4f, OUT(%7.2f,%7.2f,%7.2f)"
+      ,fChamber,fTrack,fEloss*1e9,Length(),fOutX3.X(),fOutX3.Y(),fOutX3.Z());
 }
 //__________________________________________________________________________________________________
 ClassImp(AliRICHdigit)
 //__________________________________________________________________________________________________
 void AliRICHdigit::Print(Option_t*)const
 {
-  ::Info("digit","ID=%6i, PID=%9i, c=%2i, x=%3i, y=%3i, q=%8.2f, TID1=%5i, TID2=%5i, TID3=%5i",
-           Id(),   fCombiPid,fChamber,fPadX,fPadY,fQdc,fTracks[0],fTracks[1],fTracks[2]);
+  ::Info("digit","csxy=%6i, cfm=%9i, c=%2i, x=%3i, y=%3i, q=%8.3f, TID1=%5i, TID2=%5i, TID3=%5i",
+                  Id(),fCombiPid,fChamber,fPadX,fPadY,fQdc,fTracks[0],fTracks[1],fTracks[2]);
 }
 //__________________________________________________________________________________________________
 ClassImp(AliRICHcluster)
@@ -129,10 +129,41 @@ AliRICH::~AliRICH()
 //__________________________________________________________________________________________________
 void AliRICH::Hits2SDigits()
 {
-//Create a list of sdigits corresponding to list of hits. Every hit generates one or more sdigits.
+// Create a list of sdigits corresponding to list of hits. Every hit generates one or more sdigits.
+//   
   if(GetDebug()) Info("Hit2SDigits","Start.");
+  for(Int_t iEventN=0;iEventN<GetLoader()->GetRunLoader()->GetAliRun()->GetEventsPerRun();iEventN++){//events loop
+    GetLoader()->GetRunLoader()->GetEvent(iEventN);
+  
+    if(!GetLoader()->TreeH()) GetLoader()->LoadHits();    GetLoader()->GetRunLoader()->LoadHeader(); 
+                                                          GetLoader()->GetRunLoader()->LoadKinematics();//from
+    if(!GetLoader()->TreeS()) GetLoader()->MakeTree("S"); MakeBranch("S");//to
+          
+    for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
+      GetLoader()->TreeH()->GetEntry(iPrimN);
+      for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){//hits loop 
+        AliRICHhit *pHit=(AliRICHhit*)Hits()->At(iHitN);                
+        TVector2 x2 = Param()->ShiftToWirePos(C(pHit->C())->Glob2Loc(pHit->OutX3()));                
+        Int_t iTotQdc=Param()->TotQdc(x2,pHit->Eloss());
+        
+        Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax;
+        Param()->Loc2Area(x2,iPadXmin,iPadYmin,iPadXmax,iPadYmax);//determine affected pads
+        if(GetDebug()) Info("Hits2SDigits","left-down=(%i,%i) right-up=(%i,%i)",iPadXmin,iPadYmin,iPadXmax,iPadYmax);
+        for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++)//affected pads loop
+          for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++){
+            Double_t padQdc=iTotQdc*Param()->FracQdc(x2,iPadX,iPadY);
+            if(padQdc>0.1) AddSDigit(pHit->C(),iPadX,iPadY,padQdc,
+              GetLoader()->GetRunLoader()->Stack()->Particle(pHit->GetTrack())->GetPdgCode(),pHit->GetTrack());
+          }//affected pads loop 
+      }//hits loop
+    }//prims loop
+    GetLoader()->TreeS()->Fill();
+    GetLoader()->WriteSDigits("OVERWRITE");
+  }//events loop  
+  GetLoader()->UnloadHits(); GetLoader()->GetRunLoader()->UnloadHeader(); GetLoader()->GetRunLoader()->UnloadKinematics();
+  GetLoader()->UnloadSDigits();  
   if(GetDebug()) Info("Hit2SDigits","Stop.");
-}//void AliRICH::Hits2SDigits()
+}//Hits2SDigits()
 //__________________________________________________________________________________________________
 void AliRICH::SDigits2Digits()
 {
@@ -484,7 +515,7 @@ void AliRICH::CreateGeometry()
 //Methane 
   par[0]=pcX/2;par[1]=Param()->GapThickness()/2;par[2]=pcY/2;         gMC->Gsvolu("META","BOX ",idtmed[1004], par, 3);
 //Methane gap 
-  par[0]=pcX/2;par[1]=Param()->ProximityGapThickness()/2;par[2]=pcY/2;gMC->Gsvolu("GAP ","BOX ",(*fIdtmed)[kGAP],par,3);
+  par[0]=pcX/2;par[1]=Param()->ProximityGap()/2;par[2]=pcY/2;gMC->Gsvolu("GAP ","BOX ",(*fIdtmed)[kGAP],par,3);
 //CsI PC
   par[0]=pcX/2;par[1]=.25;par[2]=pcY/2;  gMC->Gsvolu("CSI ", "BOX ", (*fIdtmed)[kCSI], par, 3);
 //Anode grid 
@@ -603,11 +634,11 @@ void AliRICH::CreateGeometry()
   gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()/2, 0., 0, "ONLY");          //Original settings 
   gMC->Gspos("OQF1", 3, "SRIC", - (Param()->OuterFreonWidth()/2 + Param()->InnerFreonWidth()/2) - 2, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()/2, 0., 0, "ONLY");       //Original settings (-31.3)
   gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness()/2, 0., 0, "ONLY");
-  gMC->Gspos("GAP ", 1, "META", 0., Param()->GapThickness()/2 - Param()->ProximityGapThickness()/2 - 0.0001, 0., 0, "ONLY");
+  gMC->Gspos("GAP ", 1, "META", 0., Param()->GapThickness()/2 - Param()->ProximityGap()/2 - 0.0001, 0., 0, "ONLY");
   gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
   gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + Param()->GapThickness()/2 + .25, 0., 0, "ONLY");
 //Wire support placing
-  gMC->Gspos("WSG2", 1, "GAP ", 0., Param()->ProximityGapThickness()/2 - .1, 0., 0, "ONLY");
+  gMC->Gspos("WSG2", 1, "GAP ", 0., Param()->ProximityGap()/2 - .1, 0., 0, "ONLY");
   gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
   gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + Param()->GapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
 //Backplane placing
@@ -644,18 +675,20 @@ void AliRICH::CreateChambers()
 //__________________________________________________________________________________________________
 void AliRICH::GenerateFeedbacks(Int_t iChamber,Float_t eloss)
 {
-// Generate FeedBack photons
-//Determine number of feedback photons
+// Generate FeedBack photons 
+// eloss=0 means photon so only pulse height distribution is to be analysed. This one is done in AliRICHParam::TotQdc()
+  
   TLorentzVector x4;
   gMC->TrackPosition(x4);  
-  Int_t sector;
-  Int_t iTotQdc=Param()->Loc2TotQdc(C(iChamber)->Glob2Loc(x4),eloss,gMC->TrackPid(),sector);
+  TVector2 x2=C(iChamber)->Glob2Loc(x4);
+  Int_t sector=Param()->Sector(x2);
+  Int_t iTotQdc=Param()->TotQdc(x2,eloss);
   Int_t iNphotons=gMC->GetRandom()->Poisson(P()->AlphaFeedback(sector)*iTotQdc);    
   if(GetDebug())Info("GenerateFeedbacks","N photons=%i",iNphotons);
   Int_t j;
   Float_t cthf, phif, enfp = 0, sthf, e1[3], e2[3], e3[3], vmod, uswop,dir[3], phi,pol[3], mom[4];
 //Generate photons
-  for(Int_t i=0;i<iNphotons;i++){//feddbacks loop
+  for(Int_t i=0;i<iNphotons;i++){//feedbacks loop
     Double_t ranf[2];
     gMC->GetRandom()->RndmArray(2,ranf);    //Sample direction
     cthf=ranf[0]*2-1.0;
index 86d8850..cfdf0b5 100644 (file)
@@ -10,7 +10,7 @@
 #include <AliDetector.h>
 #include <AliHit.h>
 #include <AliDigit.h>
-
+#include "AliRICHDigitizer.h"
 #include "AliRICHParam.h"
 
 #include "AliRICHSDigit.h"
 class AliRICHhit : public AliHit
 {
 public:
-  inline   AliRICHhit();
-  inline   AliRICHhit(Int_t fIshunt, Int_t track, Int_t *vol, Float_t *hits);
-  inline   AliRICHhit(Int_t tid,TVector3 x3);
-  inline   AliRICHhit(Int_t tid,TVector3 x3in,TVector3 x3out,Double_t eloss);
+  AliRICHhit():AliHit() {fChamber=fPid=kBad;  fEloss=kBad;  fInX3.SetXYZ(0,0,0);fOutX3.SetXYZ(0,0,0);
+                         fMomX=fMomY=fMomZ=fNPads=fCerenkovAngle=fMomFreoX=fMomFreoY=fMomFreoZ=kBad;}
+  AliRICHhit(Int_t c,Int_t tid,TVector3 in,TVector3 out,Double_t e):AliHit(0,tid) {fInX3=in; fOutX3=out; fChamber=c; fEloss=e;
+                                                                                       fX=out.X();fY=out.Y();fZ=out.Z(); 
+                                            fPid=kBad;fMomX=fMomY=fMomZ=fNPads=fCerenkovAngle=fMomFreoX=fMomFreoY=fMomFreoZ=kBad;}
+  inline   AliRICHhit(Int_t fIshunt, Int_t track, Int_t *vol, Float_t *hits);                  //old version 3 ????? 
   virtual ~AliRICHhit()         {;}
 
   Int_t   C()                   const{return fChamber;}
@@ -39,32 +41,25 @@ public:
   Float_t MomFreoZ()            const{return fMomFreoZ;}
   TVector3 InX3()               const{return fInX3;}
   TVector3 OutX3()              const{return fOutX3;}
+  Double_t Length()             const{return (fOutX3-fInX3).Mag();}
   void    Print(Option_t *option="")const;      //virtual
 protected:
   Int_t     fChamber;                      //chamber number
   Int_t     fPid;                          //particle code
-  Double_t  fEloss;                        //ionisation energy loss in gas
+  Double_t  fEloss;                        //ionisation energy loss in GAP
   Float_t   fMomX,fMomY,fMomZ;             //momentum at photochatode entry point
   Float_t   fNPads;                        //Pads hit
   Float_t   fCerenkovAngle;                //Dummy cerenkov angle
   Float_t   fMomFreoX,fMomFreoY,fMomFreoZ; //momentum at freon entry point
-  TVector3  fInX3,fOutX3;                  //3-vectors at the entrance and exit of the GAP
+  TVector3  fInX3;                         //position at the entrance of the GAP   
+  TVector3  fOutX3;                        //position at exit of the GAP
   ClassDef(AliRICHhit,2)                   //RICH hit class
 };//class AliRICHhit
-
-  //__________________________________________________________________________________________________
-AliRICHhit::AliRICHhit()
-           :AliHit() 
-{//default ctor  
-  fChamber=fPid=kBad;
-  fEloss=kBad;
-  fMomX=fMomY=fMomZ=fNPads=fCerenkovAngle=fMomFreoX=fMomFreoY=fMomFreoZ=kBad;
-  fInX3.SetXYZ(0,0,0);fOutX3.SetXYZ(0,0,0);
-}
 //__________________________________________________________________________________________________
 AliRICHhit::AliRICHhit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hit)
            :AliHit(shunt, track)
-{//ctor
+{
+// old ctor to be deleted
   fChamber=vol[0];
   fPid=(Int_t)hit[0];
   fX=hit[1];fY=hit[2];fZ=hit[3];
@@ -73,23 +68,6 @@ AliRICHhit::AliRICHhit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hit)
   fCerenkovAngle=hit[18];
   fMomFreoX=hit[19];fMomFreoY=hit[20];fMomFreoZ=hit[21];
 }
-  //__________________________________________________________________________________________________
-AliRICHhit::AliRICHhit(Int_t tid,TVector3 x3) :AliHit(0,tid)
-{//default ctor  
-  fChamber=fPid=kBad;
-  fEloss=kBad;
-  fMomX=fMomY=fMomZ=fNPads=fCerenkovAngle=fMomFreoX=fMomFreoY=fMomFreoZ=kBad;
-  fInX3=x3;fOutX3.SetXYZ(0,0,0);
-}
-//__________________________________________________________________________________________________
-AliRICHhit::AliRICHhit(Int_t tid,TVector3 x3in,TVector3 x3out,Double_t eloss)
-           :AliHit(0,tid)
-{//ctor
-  fX=x3out.X();fY=x3out.Y();fZ=x3out.Z();
-  fInX3=x3in;
-  fOutX3=x3out;
-  fEloss=eloss;
-}
 
 //__________________AliRICHCerenkov_________________________________________________________________
 class AliRICHCerenkov: public AliHit 
@@ -149,7 +127,7 @@ class AliRICHdigit :public AliDigit
 public:
            AliRICHdigit() {fCombiPid=fChamber=fPadX=fPadY=fTracks[0]=fTracks[1]=fTracks[2]=kBad;fQdc=kBad;}
            AliRICHdigit(Int_t c,Int_t x,Int_t y,Double_t q,Int_t cpid,Int_t tid0,Int_t tid1,Int_t tid2)
-           {fPadX=x;fPadY=y;fQdc=q;fChamber=10*c+AliRICHParam::Pad2Sec(x,y);fCombiPid=cpid;fTracks[0]=tid0;fTracks[1]=tid1;fTracks[2]=tid2;}        
+           {fPadX=x;fPadY=y;fQdc=q;fChamber=10*c+AliRICHParam::Sector(x,y);fCombiPid=cpid;fTracks[0]=tid0;fTracks[1]=tid1;fTracks[2]=tid2;}        
   virtual ~AliRICHdigit() {;}  
   Int_t    Compare(const TObject *pObj) const                                         //virtual
            {if(Id()==((AliRICHdigit*)pObj)->Id()) return 0; else if(Id()>((AliRICHdigit*)pObj)->Id()) return 1;  else return -1;} 
@@ -237,13 +215,12 @@ void AliRICHcluster::AddDigit(AliRICHdigit *pDig)
 void AliRICHcluster::CoG(Int_t nLocals)
 {//
   Int_t xmin=999,ymin=999,xmax=0,ymax=0;   
-  Double_t x,y;        
   fX=fY=0;
   for(Int_t iDig=0;iDig<Size();iDig++) {
     AliRICHdigit *pDig=(AliRICHdigit*)fDigits->At(iDig);
     Int_t padX = pDig->X();Int_t padY = pDig->Y();Double_t q=pDig->Q();
-    AliRICHParam::Pad2Loc(padX,padY,x,y);
-    fX += x*q;fY +=y*q;
+    TVector2 x2=AliRICHParam::Pad2Loc(padX,padY);
+    fX += x2.X()*q;fY +=x2.Y()*q;
     if(padX<xmin)xmin=padX;if(padX>xmax)xmax=padX;if(padY<ymin)ymin=padY;if(padY>ymax)ymax=padY;
    }
    fX/=fQdc;fY/=fQdc;//Center of Gravity
@@ -251,6 +228,7 @@ void AliRICHcluster::CoG(Int_t nLocals)
    fSize+=nLocals;
    fStatus=kRaw;
 }//CoG()
+//__________________________________________________________________________________________________
 class AliRICHreco: public TObject
 {
 public:
@@ -285,6 +263,7 @@ public:
   AliRICH&  operator=(const AliRICH&)                 {return *this;}
   virtual Int_t   IsVersion()                                            const =0;            
           void    Hits2SDigits();                                                                                 //virtual
+  AliDigitizer*   CreateDigitizer(AliRunDigitizer* man) const {return new AliRICHDigitizer(man);}                 //virtual
           void    SDigits2Digits();                                                                               //virtual
   
   inline  void    CreateHits();    
@@ -292,10 +271,10 @@ public:
   inline  void    CreateDigits();  
   inline  void    CreateClusters();  
   inline  void    CreateRecos();  
-  void AddHit(Int_t track, Int_t *vol, Float_t *hits)                 {TClonesArray &tmp=*fHits; new(tmp[fNhits++])AliRICHhit(fIshunt,track,vol,hits);}//virtual
-  void AddHit(Int_t tid,TVector3 x3)                                  {TClonesArray &tmp=*fHits;new(tmp[fNhits++])AliRICHhit(tid,x3);} 
-  void AddHit(Int_t tid,TVector3 x3in,TVector3 x3out,Double_t eloss)  {TClonesArray &tmp=*fHits;new(tmp[fNhits++])AliRICHhit(tid,x3in,x3out,eloss);} 
-  inline void AddSDigit(int c,int x,int y,int q,int pid,int tid); 
+  void AddHit(Int_t track, Int_t *vol, Float_t *hits)    {TClonesArray &tmp=*fHits; new(tmp[fNhits++])AliRICHhit(fIshunt,track,vol,hits);}//virtual
+  void AddHit(Int_t chamber,Int_t tid,TVector3 iX3,TVector3 oX3,Double_t eloss=0)
+             {TClonesArray &tmp=*fHits;new(tmp[fNhits++])AliRICHhit(chamber,tid,iX3,oX3,eloss);} 
+  inline void AddSDigit(Int_t c,Int_t x,Int_t y,Double_t q,Int_t pid,Int_t tid); 
   void AddDigit(int c,int x,int y,int q,int cpid,int *tid){TClonesArray &tmp=*((TClonesArray*)fDigitsNew->At(c-1));new(tmp[fNdigitsNew[c-1]++])AliRICHdigit(c,x,y,q,cpid,tid[0],tid[1],tid[2]);}  
   void AddCluster(AliRICHcluster &cl)                     {TClonesArray &tmp=*((TClonesArray*)fClusters->At(cl.C()-1));new(tmp[fNclusters[cl.C()-1]++])AliRICHcluster(cl);}
   void AddReco(Int_t tid,Double_t thetaCherenkov,Int_t nPhotons) {TClonesArray &tmp=*(TClonesArray*)fRecos;new(tmp[fNrecos++])AliRICHreco(tid,thetaCherenkov,nPhotons);}  
@@ -321,7 +300,7 @@ public:
           Float_t Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)const;
   
   virtual void    StepManager()=0;
-          void    GenerateFeedbacks(Int_t iChamber,Float_t eloss);
+          void    GenerateFeedbacks(Int_t iChamber,Float_t eloss=0);//eloss=0 for photon
           void    Print(Option_t *option)const;//virtual
           void    MakeBranch(Option_t *opt=" ");
           void    SetTreeAddress();//virtual
@@ -403,12 +382,12 @@ void AliRICH::CreateRecos()
   fRecos = new TClonesArray("AliRICHreco",1000);fNrecos=0;  
 }
 //__________________________________________________________________________________________________
-void AliRICH::AddSDigit(int c,int x,int y,int q,int pid,int tid) 
+void AliRICH::AddSDigit(Int_t c,Int_t x,Int_t y,Double_t q,Int_t pid,Int_t tid) 
 {   
   switch(pid){
-    case 50000048: pid=1000000;break;
-    case 50000052: pid=1000;   break;
-    default:       pid=1;      break;
+    case 50000050: pid=1000000;break;//cerenkov
+    case 50000051: pid=1000;   break;//feedback
+    default:       pid=1;      break;//mip
   }   
   TClonesArray &tmp=*fSdigits;
   new(tmp[fNsdigits++])AliRICHdigit(c,x,y,q,pid,tid,kBad,kBad);
index 2af9a07..9b5d18e 100644 (file)
@@ -46,8 +46,8 @@ public:
   Double_t    Z()                  const{return fCenterV3.Z();}
   TVector3    L2G(TVector3 x3)                       const{x3.Transform(fRot);x3+=fCenterV3;return x3;}
   TVector3    G2L(TVector3 x3)                       const{x3-=fCenterV3;x3.Transform(fRot.Inverse()); return x3;}
-  inline TVector3  Glob2Loc(TVector3 x3, Bool_t isVector=kFALSE) const;
-  TVector3    Glob2Loc(TLorentzVector x4,Bool_t isVector=kFALSE) const{return Glob2Loc(x4.Vect(),isVector);}
+  inline TVector2  Glob2Loc(TVector3 x3, Bool_t isVector=kFALSE) const;
+  TVector2    Glob2Loc(TLorentzVector x4,Bool_t isVector=kFALSE) const{return Glob2Loc(x4.Vect(),isVector);}
   TVector3    L2G(Double_t x,Double_t y,Double_t z)  const{return L2G(TVector3(x,y,z));}
   TVector3    G2L(TLorentzVector x4)                 const{return G2L(x4.Vect());}
   Float_t     G2Ly(TLorentzVector x4)                const{TVector3 x3=G2L(x4.Vect()); return x3.Z();}
@@ -96,12 +96,11 @@ void AliRICHChamber::SetToZenith()
   fPcX3.SetXYZ(0,AliRICHParam::Offset()-AliRICHParam::GapThickness()/2+5.276+0.25,0);   
 }
 //__________________________________________________________________________________________________
-TVector3 AliRICHChamber::Glob2Loc(TVector3 x3,Bool_t isVector)const
+TVector2 AliRICHChamber::Glob2Loc(TVector3 x3,Bool_t isVector)const
 {
   if(!isVector) x3-=fPcX3;
   x3.Transform(fRot.Inverse()); 
-  Double_t tmp=x3.Y(); x3.SetY(x3.Z()); x3.SetZ(tmp);
-  return x3;
+  return TVector2(x3.X(),x3.Z());//attention Y and Z are misplaced!
 }
 //__________________________________________________________________________________________________  
 #endif //AliRICHChamber_h
index 57c2478..823bea2 100644 (file)
@@ -65,7 +65,8 @@ void AliRICHClusterFinder::FindLocalMaxima()
       }
     }
     if(iNotMax==0) {
-      AliRICHParam::Pad2Loc(padX1,padY1,fLocalX[fNlocals],fLocalY[fNlocals]);
+      TVector2 x2=AliRICHParam::Pad2Loc(padX1,padY1);
+      fLocalX[fNlocals]=x2.X();fLocalY[fNlocals]=x2.Y();
       fLocalQ[fNlocals] = (Double_t)padQ1;
       fLocalC[fNlocals] = padC1;
       fNlocals++;
@@ -142,8 +143,8 @@ void AliRICHClusterFinder::FindClusters(Int_t iChamber)
 //__________________________________________________________________________________________________
 void AliRICHClusterFinder::FindClusterContribs(AliRICHcluster *pCluster)
 {
-  //finds CombiPid for a given cluster
-//  Info("FindClusterContribs","Start");
+// finds CombiPid for a given cluster
+// Info("FindClusterContribs","Start");
   
   TObjArray *pDigits = pCluster->Digits();
   Int_t iNmips=0,iNckovs=0,iNfeeds=0;
@@ -169,12 +170,12 @@ void AliRICHClusterFinder::FindClusterContribs(AliRICHcluster *pCluster)
   pCluster->SetCombiPid(iNckovs,iNfeeds,iNmips);
 //  pCluster->Print();
   delete [] pindex; 
-}// FindClusterContribs()
+}//FindClusterContribs()
 //__________________________________________________________________________________________________
 void  AliRICHClusterFinder::FormRawCluster(Int_t i, Int_t j)
 {
-  // Builder of the final Raw Cluster (before deconvolution)  
-//  Info("FormRawCluster","Start with digit(%i,%i)",i,j);
+// Builder of the final Raw Cluster (before deconvolution)  
+  if(GetDebug()) Info("FormRawCluster","Start with digit(%i,%i)",i,j);
   
   fRawCluster.AddDigit((AliRICHdigit*) fHitMap->GetHit(i,j));
   fHitMap->FlagHit(i,j);// Flag hit as taken  
@@ -183,13 +184,12 @@ void  AliRICHClusterFinder::FormRawCluster(Int_t i, Int_t j)
   for (Int_t iNeighbour=0;iNeighbour<Rich()->Param()->PadNeighbours(i,j,listX,listY);iNeighbour++)
     if(fHitMap->TestHit(listX[iNeighbour],listY[iNeighbour])==kUnused) 
                       FormRawCluster(listX[iNeighbour],listY[iNeighbour]);    
-}//AddDigit2Cluster()
+}//FormRawCluster()
 //__________________________________________________________________________________________________
 void AliRICHClusterFinder::ResolveCluster()
 {// Decluster algorithm
-//  Info("ResolveCluster","Start.");    
+  if(GetDebug()) {Info("ResolveCluster","Start."); fRawCluster.Print();}
   
-//  fRawCluster.Print();
   switch (fRawCluster.Size()) {
   
   case 1:                     // nothing to decluster: cluster size = 1
@@ -311,12 +311,12 @@ void RICHMinMathieson(Int_t &npar, Double_t *, Double_t &chi2, Double_t *par, In
   
   AliRICHcluster *pRawCluster = ((AliRICHClusterFinder*)gMinuit->GetObjectFit())->GetRawCluster();
 
-  TVector3 centroid[50];
+  TVector2 centroid[50];
   Double_t q[50];
   Int_t nFunctions = (npar+1)/3;
   Double_t qfract = 0;
   for(Int_t i=0;i<nFunctions;i++) {
-    centroid[i].SetX(par[3*i]);centroid[i].SetY(par[3*i+1]);centroid[i].SetZ(0);
+    centroid[i].Set(par[3*i],par[3*i+1]);
     if(i==nFunctions-1) break;
     q[i]=par[3*i+2];
     qfract+=q[i];
@@ -331,8 +331,8 @@ void RICHMinMathieson(Int_t &npar, Double_t *, Double_t &chi2, Double_t *par, In
     Double_t padQ = ((AliRICHdigit *)pRawCluster->Digits()->At(i))->Q();
     Double_t qfracpar=0;
     for(Int_t j=0;j<nFunctions;j++) {
-      qfracpar += q[j]*AliRICHParam::Loc2PadFrac(centroid[j],padX,padY);
-//      cout << " function n. " << j+1 << " q " << q[j] << " fracMat " << AliRICHParam::Loc2PadFrac(centroid[j],padX,padY) 
+      qfracpar += q[j]*AliRICHParam::FracQdc(centroid[j],padX,padY);
+//      cout << " function n. " << j+1 << " q " << q[j] << " fracMat " << AliRICHParam::FracQdc(centroid[j],padX,padY) 
 //           << " xpar " << centroid[j].X() << " ypar " << centroid[j].Y() << endl;
     }
     chi2 += TMath::Power((qtot*qfracpar-padQ),2)/padQ;
index ed61cb1..9c2b8bc 100644 (file)
@@ -17,7 +17,7 @@ public:
   
   AliRICH *Rich() {return fRICH;}                                             //Pointer to RICH  
   void     Exec();                                                            //Loop on events and chambers  
-  void     FindClusters(Int_t iChamber);                                      //Find raw clusters
+  void     FindClusters(Int_t iChamber);                                      //Find all clusters for a given chamber
   void     FindClusterContribs(AliRICHcluster *pCluster);                     //Find CombiPid for the current cluster
   void     FormRawCluster(Int_t i, Int_t j);                                  //form a raw cluster
   void     FindLocalMaxima();                                                 //Find local maxima in a cluster
@@ -26,6 +26,7 @@ public:
   void     WriteRawCluster();                                                 //write in the list of cluster  
   void     WriteResolvedCluster();                                            //write in the list of cluster  
   AliRICHcluster *GetRawCluster() {return &fRawCluster;}                      //Return pointer to the current raw cluster
+  Bool_t   GetDebug()            const {return fRICH->GetDebug();}            //is debug printout needed?
 protected:
   AliRICH                *fRICH;                         //Pointer to RICH
   AliHitMap              *fHitMap;                       //Hit Map with digit positions
index 1224da6..04b1195 100644 (file)
  **************************************************************************/
 
 
-//Piotr.Skowronski@cern.ch :
-//Corrections applied in order to compile (only) with new I/O and folder structure
-//To be implemented correctly by responsible
-
 #include <Riostream.h> 
 
 #include <TTree.h> 
@@ -44,17 +40,22 @@ AliRICHDigitizer::AliRICHDigitizer()
 //__________________________________________________________________________________________________
 AliRICHDigitizer::AliRICHDigitizer(AliRunDigitizer *pManager) 
                  :AliDigitizer(pManager)
-{//main ctor which should be used
+{
+//main ctor which should be used
+  if(GetDebug())Info("main ctor","Start.");
+  fRich=(AliRICH*)gAlice->GetDetector("RICH");
 }//main ctor
 //__________________________________________________________________________________________________
 AliRICHDigitizer::~AliRICHDigitizer()
-{//dtor
-  if(fManager->GetDebug())Info("dtor","Start.");
+{
+//dtor
+  if(GetDebug())Info("dtor","Start.");
 }//dtor
 //__________________________________________________________________________________________________
 void AliRICHDigitizer::Exec(Option_t*)
 {
-
+  if(GetDebug())Info("Exec","Start with %i input(s) and %i",fManager->GetNinputs(),fManager->GetOutputEventNr());
+  
   AliRunLoader *pInAL, *pOutAL;//in and out Run loaders
   AliLoader    *pInRL, *pOutRL;//in and out RICH loaders
  
@@ -71,8 +72,8 @@ void AliRICHDigitizer::Exec(Option_t*)
   for(Int_t inputFile=0;inputFile<fManager->GetNinputs();inputFile++){//files loop
     pInAL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile));
     pInRL = pInAL->GetLoader("RICHLoader");
-    
-    
+    pInRL->LoadSDigits();
+    pInRL->TreeD()->GetEntries(0);
   }//files loop
 
       
@@ -86,4 +87,6 @@ void AliRICHDigitizer::Exec(Option_t*)
 
   pOutRL->UnloadHits();
   pOutRL->UnloadDigits();
+  if(GetDebug())Info("Exec","Stop");
 }//Exec()
+//__________________________________________________________________________________________________
index 85d8a32..4e9f5f5 100644 (file)
@@ -4,7 +4,9 @@
  * See cxx source for full Copyright notice                               */
 
 
-#include "AliDigitizer.h"
+#include <AliDigitizer.h>
+#include <AliRunDigitizer.h>
+#include <AliRun.h>
 
 class AliRICHDigitizer : public AliDigitizer 
 {
@@ -14,7 +16,9 @@ public:
   virtual ~AliRICHDigitizer();
         
   void   Exec(Option_t* option=0);                //virtual
+  Bool_t GetDebug() const {return gAlice->GetDebug();}
 protected:
+  AliRICH* fRich; //pointer to main RICH object
   ClassDef(AliRICHDigitizer,0)
 };    
 #endif
index dcf75dc..b171449 100644 (file)
@@ -68,7 +68,6 @@ void AliRICHDisplFast::Exec()
    
      pHitsH2->Reset();     pDigitsH2->Reset();     pClustersH2->Reset();
 
-     Double_t xpad,ypad;
 
       for(Int_t i=0;i<nPrimaries;i++){//prims loop
         pRich->GetLoader()->TreeH()->GetEntry(i);
@@ -77,7 +76,7 @@ void AliRICHDisplFast::Exec()
           AliRICHhit *pHit = (AliRICHhit*)Hits[i].At(j);
           if(pHit->C()==iChamber){
             TVector3 xyzhit(pHit->X(),pHit->Y(),pHit->Z());
-            TVector3 hitlocal = pRich->C(iChamber)->Glob2Loc(xyzhit);
+            TVector2 hitlocal = pRich->C(iChamber)->Glob2Loc(xyzhit);
             pHitsH2->Fill(hitlocal.X(),hitlocal.Y(),200);
           }//if
         }//hits loop         
@@ -85,8 +84,8 @@ void AliRICHDisplFast::Exec()
      
       for(Int_t j=0;j<nDigits;j++){//digits loop
         AliRICHdigit *pDigit = (AliRICHdigit*)pRich->Digits(iChamber)->At(j);
-       AliRICHParam::Pad2Loc(pDigit->X(),pDigit->Y(),xpad,ypad);
-       pDigitsH2->Fill(xpad,ypad,100);
+       TVector2 x2=AliRICHParam::Pad2Loc(pDigit->X(),pDigit->Y());
+       pDigitsH2->Fill(x2.X(),x2.Y(),100);
       }//digits loop
         
       for(Int_t j=0;j<nClusters;j++){//clusters loop
index 3c63a82..68d236b 100644 (file)
 //  * provided "as is" without express or implied warranty.                  *
 //  **************************************************************************
 #include "AliRICHParam.h"
+#include <iostream.h>
 
 ClassImp(AliRICHParam)
 Bool_t   AliRICHParam::fgIsWireSag            =kTRUE;
 Bool_t   AliRICHParam::fgIsResolveClusters    =kTRUE;
 Double_t AliRICHParam::fgAngleRot             =-60;
-Int_t    AliRICHParam::fgHV                   =2150;
+Int_t    AliRICHParam::fgHV[kNsectors]        ={2150,2100,2050,2000,2150,2150};
 Int_t    AliRICHParam::fgNsigmaTh             =4;
 Float_t  AliRICHParam::fgSigmaThMean          =1.5;
 Float_t  AliRICHParam::fgSigmaThSpread        =0.5;      
@@ -33,3 +34,12 @@ void AliRICHParam::GenSigmaThMap()
         fSigmaThMap[iChamber][ipadX][ipadY] = SigmaThMean()+(1.-2*gRandom->Rndm())*SigmaThSpread();
   Info("GenSigmaThMap"," Threshold map generated for all RICH chambers");
 }
+//__________________________________________________________________________________________________
+void AliRICHParam::Print()
+{
+  cout<<"\nPads in chamber ("<<NpadsX()<<','<<NpadsY()<<") in sector ("<<NpadsXsec()<<','<<NpadsYsec()<<')'<<endl;
+  cout<<"PC size ("<<PcSizeX()<<','<<PcSizeY()<<") sector size ("<<SectorSizeX()<<','<<SectorSizeY()<<") pad size ("<<PadSizeX()<<','
+      <<PadSizeY()<<") Dead zone "<<DeadZone()<<endl;
+  cout<<"Anode wire pitch "<<WirePitch()<<" Anode-Cathode gap "<<AnodeCathodeGap()<<" Protection wires-cathode gap "<<ProximityGap()<<endl<<endl;
+}
+//__________________________________________________________________________________________________
index fdee982..b7d2471 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <TObject.h>
 #include <TMath.h>
-#include <TVector3.h>
+#include <TVector2.h>
 #include <TRandom.h>
 
 
@@ -11,7 +11,7 @@ static const int kNCH=7;           //number of RICH chambers
 static const int kNpadsX = 144;    //number of pads along X in single chamber
 static const int kNpadsY = 160;    //number of pads along Y in single chamber
 static const int kBad=-101;        //useful static const to mark initial (uninitalised) values
-
+static const int kNsectors=6;      // nb. of sectors per chamber
 
 static const int kadc_satm  = 4096;  //dynamic range (10 bits)
 static const int kCerenkov=50000050;  //??? go to something more general like TPDGCode
@@ -23,29 +23,30 @@ class AliRICHParam :public TObject
 public:
            AliRICHParam()                    {;}
   virtual ~AliRICHParam()                    {;}
-  static const Int_t   NpadsX()              {return kNpadsX;}
-  static const Int_t   NpadsY()              {return kNpadsY;}   
-  static Int_t   NpadsXsec()                 {return NpadsX()/3;}   
-  static Int_t   NpadsYsec()                 {return NpadsY()/2;}   
-  static Double_t DeadZone()                 {return 2.6;}
-  static Double_t PadSizeX()                 {return 0.84;}
-  static Double_t PadSizeY()                 {return 0.8;}
-  static Double_t SectorSizeX()              {return NpadsX()*PadSizeX()/3;}
-  static Double_t SectorSizeY()              {return NpadsY()*PadSizeY()/2;}  
-  static Double_t PcSizeX()                  {return NpadsX()*PadSizeX()+2*DeadZone();}
-  static Double_t PcSizeY()                  {return NpadsY()*PadSizeY()+DeadZone();}
-  static Double_t WirePitch()                {return PadSizeX()/2;}
+  static const Int_t   NpadsX()              {return kNpadsX;}                           //pads along X in chamber
+  static const Int_t   NpadsY()              {return kNpadsY;}                           //pads along Y in chamber
+  static Int_t    NpadsXsec()                {return NpadsX()/3;}                        //pads along X in sector
+  static Int_t    NpadsYsec()                {return NpadsY()/2;}                        //pads along Y in sector
+  static Double_t DeadZone()                 {return 2.6;}                               //dead zone size in cm  
+  static Double_t PadSizeX()                 {return 0.84;}                              //pad size x in cm 
+  static Double_t PadSizeY()                 {return 0.8;}                               //pad size y in cm   
+  static Double_t SectorSizeX()              {return NpadsX()*PadSizeX()/3;}             //sector size x in cm
+  static Double_t SectorSizeY()              {return NpadsY()*PadSizeY()/2;}             //sector size y in cm 
+  static Double_t PcSizeX()                  {return NpadsX()*PadSizeX()+2*DeadZone();}  //photocathode size x in cm
+  static Double_t PcSizeY()                  {return NpadsY()*PadSizeY()+DeadZone();}    //photocathode size y in cm 
+  static Double_t WirePitch()                {return PadSizeX()/2;}                      //distance between anode wires
   static Double_t SizeX()                    {return 132.6;}
   static Double_t SizeY()                    {return 26;}
-  static Double_t SizeZ()                    {return 136.7;}   
-  static Double_t Offset()                   {return 490+1.267;}  
-  static Double_t AngleYZ()                  {return 19.5*TMath::DegToRad();} 
-  static Double_t AngleXY()                  {return 20*TMath::DegToRad();} 
+  static Double_t SizeZ()                    {return 136.7;}                             
+  static Double_t Offset()                   {return 490+1.267;}                         //distance from IP to center of chamber in cm 
+  static Double_t AngleYZ()                  {return 19.5*TMath::DegToRad();}            //angle between chambers in YZ plane, rad
+  static Double_t AngleXY()                  {return 20*TMath::DegToRad();}              //angle between chambers in XY plane, rad
+  static Double_t AngleRot()                 {return fgAngleRot*TMath::DegToRad();}      //RICH rotation around Z, rad
   static Double_t FreonThickness()           {return 1.5;}   
   static Double_t QuartzThickness()          {return 0.5;}   
   static Double_t GapThickness()             {return 8.0;}      
   static Double_t RadiatorToPads()           {return FreonThickness()+QuartzThickness()+GapThickness();}   
-  static Double_t ProximityGapThickness()    {return 0.4;}    
+  static Double_t ProximityGap()             {return 0.445;}    
   static Double_t AnodeCathodeGap()          {return 0.2;}
   static Double_t QuartzLength()             {return 133;}   
   static Double_t QuartzWidth()              {return 127.9;}
@@ -54,52 +55,56 @@ public:
   static Double_t InnerFreonLength()         {return 133;}   
   static Double_t InnerFreonWidth()          {return 41.3;}   
   static Double_t IonisationPotential()      {return 26.0e-9;}                            
-  static Double_t MathiesonDeltaX()          {return 5*0.18;}    
-  static Double_t MathiesonDeltaY()          {return 5*0.18;}    
+  static TVector2 MathiesonDelta()           {return TVector2(5*0.18,5*0.18);}    
   static Int_t    MaxQdc()                   {return 4095;}          
-  static Double_t QdcSlope(Int_t sec)        {HV(sec);return 27;}
   static Double_t AlphaFeedback(Int_t sec)   {HV(sec);return 0.036;}
   
-  static Bool_t  IsResolveClusters()         {return fgIsResolveClusters;}  
-  static Bool_t   IsWireSag()                {return fgIsWireSag;}
-  static Int_t    HV(Int_t)                  {return fgHV;}
-  static Double_t AngleRot()                 {return fgAngleRot*TMath::DegToRad();} 
-    static void  SetResolveClusters(Bool_t a){fgIsResolveClusters=a;}  
-    static void  SetWireSag(Bool_t status)   {fgIsWireSag=status;}  
-    static void  SetHV(Int_t hv)             {fgHV       =hv;}  
-    static void  SetAngleRot(Double_t rot)   {fgAngleRot =rot;}
+  static Bool_t   IsResolveClusters()         {return fgIsResolveClusters;}  //go after resolved clusters?
+  static Bool_t   IsWireSag()                 {return fgIsWireSag;}          //take wire sagita in account?
+  static Int_t    HV(Int_t sector)            {return fgHV[sector-1];}       //high voltage for this sector
+  static void     IsResolveClusters(Bool_t a) {fgIsResolveClusters=a;}  
+  static void     SetWireSag(Bool_t status)   {fgIsWireSag=status;}  
+  static void     SetHV(Int_t sector,Int_t hv){fgHV[sector-1]=hv;}  
+  static void     SetAngleRot(Double_t rot)   {fgAngleRot =rot;}
 
-  inline static Double_t Mathieson(Double_t lx1,Double_t lx2,Double_t ly1,Double_t ly2);   
-  inline static void    Loc2Area(TVector3 hitX3,Int_t &padxMin,Int_t &padyMin,Int_t &padxMax,Int_t &padyMax);
-  inline static Int_t   PadNeighbours(Int_t iPadX,Int_t iPadY,Int_t aListX[4],Int_t aListY[4]);
-  inline static Int_t   Loc2Pad(Double_t x,Double_t y,Int_t &padx,Int_t &pady); 
-  inline static void    Pad2Loc(Int_t padx,Int_t pady,Double_t &x,Double_t &y);  
-  inline static Double_t GainVariation(Double_t y,Int_t sector);       
-  inline static Int_t   Loc2TotQdc(TVector3 locX3,Double_t eloss,Int_t iPid, Int_t &sector);
-  inline static Double_t Loc2PadFrac(TVector3 locX3,Int_t padx,Int_t pady);
+  inline static void     Loc2Area(TVector2 x2,Int_t &padxMin,Int_t &padyMin,Int_t &padxMax,Int_t &padyMax); //
+  inline static Int_t    Loc2Pad(TVector2 x2,Int_t &padx,Int_t &pady);                             //return sector and pad
+  inline static TVector2 Pad2Loc(Int_t padx,Int_t pady);                                           //return center of the pad
+         static Int_t    Sector(Int_t padx,Int_t pady)          {return Pad2Sec(padx,pady);}       //sector of this pad
+         static Int_t    Sector(TVector2 x2)                    {int x,y;return Loc2Pad(x2,x,y);}  //sector of this point
+  inline static Int_t    PadNeighbours(Int_t iPadX,Int_t iPadY,Int_t aListX[4],Int_t aListY[4]);   //number of neighbours for this pad
+  inline static TVector2 ShiftToWirePos(TVector2 x2);                                              //shift to the nearest wire
   
-  inline static Int_t   Loc2Sec(Double_t &x,Double_t &y); 
-  inline static Int_t   Pad2Sec(Int_t &padx,Int_t &pady); 
-  static Int_t   Sector(Int_t padx,Int_t pady) {return Pad2Sec(padx,pady);}
-  inline Bool_t IsOverTh(Int_t iChamber, Int_t x, Int_t y, Double_t q);
-  static Int_t NsigmaTh() {return fgNsigmaTh;}
-  static Float_t SigmaThMean() {return fgSigmaThMean;}
-  static Float_t SigmaThSpread() {return fgSigmaThSpread;}
-  void GenSigmaThMap();
+  inline static Double_t Mathieson(Double_t lx1,Double_t lx2,Double_t ly1,Double_t ly2);           //Mathienson integral over these limits
+  inline static Double_t GainSag(Double_t y,Int_t sector);                                         //gain variations in %
+  inline static Double_t QdcSlope(Int_t sec);                                                      //weight of electon in QDC channels
+  inline static Double_t Gain(TVector2 x2);                                                        //gain for point in ChRS 
+  inline static Double_t FracQdc(TVector2 x2,Int_t padx,Int_t pady);                               //charge fraction to pad from hit
+  inline static Int_t    TotQdc(TVector2 x2,Double_t eloss);                                       //total charge for hit eloss=0 for photons
+  inline        Bool_t   IsOverTh(Int_t iChamber, Int_t x, Int_t y, Double_t q);                   //  
+         static Int_t   NsigmaTh()                    {return fgNsigmaTh;}                         //
+         static Float_t SigmaThMean()                 {return fgSigmaThMean;}      //
+         static Float_t SigmaThSpread()               {return fgSigmaThSpread;}    //
+                void    GenSigmaThMap();                                           //generate pedestal map
+         static void    Print();                
 protected:
-  static Bool_t  fgIsWireSag;                           //is wire sagitta taken into account
-  static Bool_t  fgIsResolveClusters;                   //performs declustering or not
-  static Int_t   fgHV;                                  //HV applied to anod wires
-  static Double_t fgAngleRot;                           //rotation of RICH from up postion (0,0,490)cm
-  static Float_t fSigmaThMap[kNCH][kNpadsX][kNpadsY];   // sigma of the pedestal distributions for all pads
-  static Int_t fgNsigmaTh;                              // n. of sigmas to cut for zero suppression
-  static Float_t fgSigmaThMean;                         // sigma threshold value
-  static Float_t fgSigmaThSpread;                       // spread of sigma
+  inline static Int_t    Loc2Sec(TVector2 &x2);             //return sector, x2->Sector RS
+  inline static Int_t    Pad2Sec(Int_t &padx,Int_t &pady);  //return sector, (padx,pady)->Sector RS
+  static Bool_t  fgIsWireSag;                               //is wire sagitta taken into account
+  static Bool_t  fgIsResolveClusters;                       //performs declustering or not
+  static Int_t   fgHV[6];                                   //HV applied to anod wires
+  static Double_t fgAngleRot;                               //rotation of RICH from up postion (0,0,490)cm
+  static Float_t fSigmaThMap[kNCH][kNpadsX][kNpadsY];       //sigma of the pedestal distributions for all pads
+  static Int_t fgNsigmaTh;                                  //n. of sigmas to cut for zero suppression
+  static Float_t fgSigmaThMean;                             //sigma threshold value
+  static Float_t fgSigmaThSpread;                           //spread of sigma
   ClassDef(AliRICHParam,4)    //RICH main parameters
 };
 //__________________________________________________________________________________________________
 Int_t AliRICHParam::PadNeighbours(Int_t iPadX,Int_t iPadY,Int_t listX[4],Int_t listY[4])
 {
+// Determines all the neighbouring pads for the given one. Returns total amount of these pads.
+// Dead zones are taken into account.    
   Int_t nPads=0;
   if(iPadY!=NpadsY()&&iPadY!=NpadsYsec())                      {listX[nPads]=iPadX;   listY[nPads]=iPadY+1; nPads++;}       
   if(iPadX!=NpadsXsec()&&iPadX!=2*NpadsXsec()&&iPadX!=NpadsX()){listX[nPads]=iPadX+1; listY[nPads]=iPadY;   nPads++;}       
@@ -109,62 +114,68 @@ Int_t AliRICHParam::PadNeighbours(Int_t iPadX,Int_t iPadY,Int_t listX[4],Int_t l
   return nPads;
 }//Pad2ClosePads()
 //__________________________________________________________________________________________________
-Int_t AliRICHParam::Loc2Sec(Double_t &x,Double_t &y)
-{//Determines sector for a given hit (x,y) and trasform this point to the local system of that sector.
+Int_t AliRICHParam::Loc2Sec(TVector2 &x2)
+{
+// Determines sector containing the given point and trasform this point to the local system of that sector.
+// Returns sector code: 1 2 3
+//                      4 5 6
   Int_t sector=kBad;  
-  Double_t x1=-PcSizeX()/2;      Double_t x2=-SectorSizeX()/2-DeadZone();  Double_t x3=-SectorSizeX()/2;
-  Double_t x4= SectorSizeX()/2;  Double_t x5= SectorSizeX()/2+DeadZone();  Double_t x6= PcSizeX()/2;
-
-  if     (x>=x1&&x<=x2)    {sector=1;x+=PcSizeX()/2;}
-  else if(x>=x3&&x<=x4)    {sector=2;x+=SectorSizeX()/2;}
-  else if(x>=x5&&x<=x6)    {sector=3;x-=SectorSizeX()/2+DeadZone();}
-  else                     {return kBad;} //in dead zone
-
-  if     (y>=-PcSizeY()/2   &&y<=-DeadZone()/2)  {y+=PcSizeY()/2;  return sector;}
-  else if(y> -DeadZone()/2  &&y<  DeadZone()/2)  {return kBad;} //in dead zone
-  else if(y>= DeadZone()/2  &&y<= PcSizeY()/2)   {y-=DeadZone()/2; return sector+3;}
-  else                                           {return kBad;}
+  Double_t p1=-0.5*PcSizeX();      Double_t p2=-0.5*SectorSizeX()-DeadZone();  Double_t p3=-0.5*SectorSizeX();
+  Double_t p4= 0.5*SectorSizeX();  Double_t p5= 0.5*SectorSizeX()+DeadZone();  Double_t p6= 0.5*PcSizeX();
+  Double_t x,y;  
+  if     (x2.X()>=p1&&x2.X()<=p2)    {sector=1;x=x2.X()+0.5*PcSizeX();}
+  else if(x2.X()>=p3&&x2.X()<=p4)    {sector=2;x=x2.X()+0.5*SectorSizeX();}
+  else if(x2.X()>=p5&&x2.X()<=p6)    {sector=3;x=x2.X()-0.5*SectorSizeX()-DeadZone();}
+  else                               {return kBad;} //in dead zone or out of chamber
+  
+  if     (x2.Y()>=-0.5*PcSizeY() &&x2.Y()<=-0.5*DeadZone())  {y=x2.Y()+0.5*PcSizeY();sector+=3;} //sectors 4,5,6 
+  else if(x2.Y()> -0.5*DeadZone()&&x2.Y()<  0.5*DeadZone())  {return kBad;}                      //in dead zone
+  else if(x2.Y()>= 0.5*DeadZone()&&x2.Y()<= 0.5*PcSizeY())   {y=x2.Y()-0.5*DeadZone();}          //sectors 1,2,3
+  else                                                       {return kBad;}                      //out of chamber    
+  x2.Set(x,y);
+  return sector;
 }//Loc2Sec(Double_t x, Double_t y)
 //__________________________________________________________________________________________________
+Int_t AliRICHParam::Loc2Pad(TVector2 x2,Int_t &padx,Int_t &pady)
+{
+// Determines pad number (padx,pady) containing the given point x2 defined the chamber RS.
+// Pad count starts in lower left corner from 1,1 to 144,160 in upper right corner of a chamber.
+// Returns sector number of the determined pad.      
+  Int_t sector=Loc2Sec(x2);//trasforms x2 to sector reference system
+  if(sector==kBad) {padx=pady=kBad; return sector;}
+  
+  padx=Int_t(x2.X()/PadSizeX())+1; if(padx>NpadsXsec()) padx= NpadsXsec();       
+  if(sector==2||sector==5)   padx+=  NpadsXsec();     // 1 2 3
+  if(sector==3||sector==6)   padx+=2*NpadsXsec();     // 4 5 6
+
+  pady=Int_t(x2.Y()/PadSizeY())+1; if(pady>NpadsYsec()) pady= NpadsYsec();
+  if(sector<4)               pady+=NpadsYsec();    
+  return sector;
+}
+//__________________________________________________________________________________________________
 Int_t AliRICHParam::Pad2Sec(Int_t &padx, Int_t &pady)
-{//Determines sector for a given pad (padx,pady) and trasform this point to the local system of that sector.
+{
+// Determines sector containing the given pad (padx,pady) and trasform it to the local RS of that sector.
   Int_t sector=kBad;      
   if     (padx>=1            &&padx<=NpadsXsec())      {sector=1;}
   else if(padx> NpadsXsec()  &&padx<=NpadsXsec()*2)    {sector=2;padx-=NpadsXsec();}
   else if(padx> NpadsXsec()*2&&padx<=NpadsX())         {sector=3;padx-=NpadsXsec()*2;}
   else                                                 {return kBad;}
 
-  if     (pady>=1         &&pady<= NpadsYsec())     {return sector;}
-  else if(pady>NpadsYsec()&&pady<= NpadsY())        {pady-=NpadsYsec();return sector+3;} 
-  else                                              {return kBad;}
+  if     (pady>=1            &&pady<=NpadsYsec())      {return sector+3;}
+  else if(pady>NpadsYsec()   &&pady<=NpadsY())         {pady-=NpadsYsec();return sector;} 
+  else                                                 {return kBad;}
 }//Pad2Sec()
 //__________________________________________________________________________________________________
-Int_t AliRICHParam::Loc2Pad(Double_t x, Double_t y, Int_t &padx, Int_t &pady)
-{//returns pad numbers (iPadX,iPadY) for given point in local coordinates (x,y) 
- //count starts in lower left corner from 1,1 to 144,180
-  
-  padx=pady=kBad;
-  Int_t sector=Loc2Sec(x,y);
-  if(sector==kBad) return sector;
-  
-  padx=Int_t(x/PadSizeX())+1; 
-  if(padx>NpadsXsec())            padx= NpadsXsec();
-  if(sector==2||sector==5)       padx+=NpadsXsec();
-  else if(sector==3||sector==6)  padx+=NpadsXsec()*2;
-  
-  pady=Int_t(y/PadSizeY())+1;
-  if(pady>NpadsYsec())            padx= NpadsYsec();
-  if(sector>0)                    pady+=NpadsYsec();    
-
-  return sector;
-}//Loc2Pad()
-//__________________________________________________________________________________________________
-void AliRICHParam::Pad2Loc(Int_t padx,Int_t pady,Double_t &x,Double_t &y)
+TVector2 AliRICHParam::Pad2Loc(Int_t padx,Int_t pady)
 {
-  Int_t sector=Pad2Sec(padx,pady);  
-  if(sector>3)
-    y=0.5*DeadZone()+pady*PadSizeY()-0.5*PadSizeY();
-  else{
+// Returns position of the center of the given pad (padx,pady) in local RS of the chamber    
+  Int_t sector=Pad2Sec(padx,pady);//shifts to sector RS
+  if(sector==kBad) return TVector2(-101,-101);  
+  Double_t x,y;
+  if(sector<=3)
+    y=0.5*DeadZone()+pady*PadSizeY()-0.5*PadSizeY();   // 1 2 3
+  else{                                                // 4 5 6
     y=-0.5*PcSizeY()+pady*PadSizeY()-0.5*PadSizeY();
   }
   if(sector==1||sector==4)
@@ -173,61 +184,71 @@ void AliRICHParam::Pad2Loc(Int_t padx,Int_t pady,Double_t &x,Double_t &y)
     x=-0.5*SectorSizeX()+padx*PadSizeX()-0.5*PadSizeX();
   else
     x= 0.5*SectorSizeX()+DeadZone()+padx*PadSizeX()-0.5*PadSizeX();
-  return;
-}//Pad2Loc()
+  return TVector2(x,y);
+}
 //__________________________________________________________________________________________________
-Double_t AliRICHParam::GainVariation(Double_t y,Int_t sector)
+Double_t AliRICHParam::GainSag(Double_t y,Int_t sector)
 {
-//returns % of gain degradation due to wire sagita  
-  if(IsWireSag()){
-    if(y>0) y-=SectorSizeY()/2; else  y+=SectorSizeY()/2; 
-    switch(HV(sector)){
-      case 2150: return 9e-6*TMath::Power(y,4)+2e-7*TMath::Power(y,3)-0.0316*TMath::Power(y,2)-3e-4*y+25.367;//%
-      case 2100: return 8e-6*TMath::Power(y,4)+2e-7*TMath::Power(y,3)-0.0283*TMath::Power(y,2)-2e-4*y+23.015;
-      case 2050: return 7e-6*TMath::Power(y,4)+1e-7*TMath::Power(y,3)-0.0254*TMath::Power(y,2)-2e-4*y+20.888;
-      case 2000: return 6e-6*TMath::Power(y,4)+8e-8*TMath::Power(y,3)-0.0227*TMath::Power(y,2)-1e-4*y+18.961;
-      default:   return 0;
-    }
-  }else
-    return 0;
+// Returns % of gain variation due to wire sagita.
+// All cureves are parametrized per sector basis, so y must be scaled to the Sector RS.    
+  if(y>0) y-=SectorSizeY()/2; else  y+=SectorSizeY()/2; 
+  switch(HV(sector)){
+    case 2150: return 9e-6*TMath::Power(y,4)+2e-7*TMath::Power(y,3)-0.0316*TMath::Power(y,2)-3e-4*y+25.367;//%
+    case 2100: return 8e-6*TMath::Power(y,4)+2e-7*TMath::Power(y,3)-0.0283*TMath::Power(y,2)-2e-4*y+23.015;
+    case 2050: return 7e-6*TMath::Power(y,4)+1e-7*TMath::Power(y,3)-0.0254*TMath::Power(y,2)-2e-4*y+20.888;
+    case 2000: return 6e-6*TMath::Power(y,4)+8e-8*TMath::Power(y,3)-0.0227*TMath::Power(y,2)-1e-4*y+18.961;
+    default:   return 0;
+  }
 }
 //__________________________________________________________________________________________________
-Int_t AliRICHParam::Loc2TotQdc(TVector3 x3,Double_t eloss,Int_t iPid,Int_t &sector)
-{//calculates the total charge produced by the hit given in local refenrence system
-  Double_t x=x3.X(),y=x3.Y();
-  
-  sector=Loc2Sec(x,y);
-  
-  Double_t gain=QdcSlope(sector)*(1+GainVariation(x3.Y(),sector)/100);
-
-  
-  if(iPid>50000){//it's photon => 1 electron
-    return Int_t(gain*-TMath::Log(gRandom->Rndm()));
-  }else{//it's MIP  
-    Int_t iNelectrons=Int_t(eloss/IonisationPotential());
-    if(iNelectrons==0) return 0;
-    Double_t qdc=0;
-    for(Int_t i=1;i<=iNelectrons;i++) qdc+=gain*-TMath::Log(gRandom->Rndm());
-    return Int_t(qdc);
+Double_t AliRICHParam::QdcSlope(Int_t sec)
+{
+// Returns number of QDC channels per single electron at the unknown yet ???? point for a given sector 
+  switch(sec){
+    case kBad: return 0;
+    default:   return 27;
   }
 }
 //__________________________________________________________________________________________________
-Double_t AliRICHParam::Loc2PadFrac(TVector3 hitX3,Int_t padx,Int_t pady)
-{//
-  Double_t padXcenter=0,padYcenter=0;  Pad2Loc(padx,pady,padXcenter,padYcenter);  
-
-  //correction to the position of the nearest wire
-  
-  Double_t normXmin=(hitX3.X()-padXcenter-PadSizeX()/2)  /AnodeCathodeGap();
-  Double_t normXmax=(hitX3.X()-padXcenter+PadSizeX()/2)  /AnodeCathodeGap();
-  Double_t normYmin=(hitX3.Y()-padYcenter-PadSizeY()/2)  /AnodeCathodeGap();
-  Double_t normYmax=(hitX3.Y()-padYcenter+PadSizeY()/2)  /AnodeCathodeGap();
+Double_t AliRICHParam::Gain(TVector2 x2)
+{ 
+//   
+  if(IsWireSag()) 
+    return QdcSlope(Sector(x2))*(1+GainSag(x2.Y(),Sector(x2))/100);
+  else
+    return QdcSlope(Sector(x2));
+}
+//__________________________________________________________________________________________________
+Int_t AliRICHParam::TotQdc(TVector2 x2,Double_t eloss)
+{
+// Calculates the total charge produced by the eloss in point x2 (Chamber RS).
+// Returns this change parametrised in QDC channels.
+// eloss=0 means photons which provided for only 1 electron
+// eloss > 0 for Mip     
+  Int_t iNelectrons=Int_t(eloss/IonisationPotential()); if(iNelectrons==0) iNelectrons=1;
+  Double_t qdc=0;
+  for(Int_t i=1;i<=iNelectrons;i++) qdc+=-Gain(x2)*TMath::Log(gRandom->Rndm());
+  return Int_t(qdc);
+}
+//__________________________________________________________________________________________________
+Double_t AliRICHParam::FracQdc(TVector2 x2,Int_t padx,Int_t pady)
+{
+// Calculates the charge fraction for a given pad (padx,pady) from the given hit point.
+// Mathieson distribution integrated is used.  
+  TVector2 center2=Pad2Loc(padx,pady);//gives center of requested pad
+  Double_t normXmin=(x2.X()-center2.X()-PadSizeX()/2)  /AnodeCathodeGap();
+  Double_t normXmax=(x2.X()-center2.X()+PadSizeX()/2)  /AnodeCathodeGap();
+  Double_t normYmin=(x2.Y()-center2.Y()-PadSizeY()/2)  /AnodeCathodeGap();
+  Double_t normYmax=(x2.Y()-center2.Y()+PadSizeY()/2)  /AnodeCathodeGap();
   
-  return Mathieson(normXmin,normYmin,normXmax,normYmax);
-}//Loc2PadQdc()
+  if(Sector(x2)!=Sector(padx,pady)) return 0;//requested pad does not belong to the sector of given point  
+  else                              return Mathieson(normXmin, normYmin, normXmax, normYmax);
+}
 //__________________________________________________________________________________________________
 Double_t AliRICHParam::Mathieson(Double_t xMin,Double_t yMin,Double_t xMax,Double_t yMax)
-{//see NIM A370(1988)602-603 
+{
+// All arguments are parametrised according to NIM A370(1988)602-603
+// Returns a charge fraction.   
   const Double_t kSqrtKx3=0.77459667;const Double_t kX2=0.962;const Double_t kX4=0.379;
   const Double_t kSqrtKy3=0.77459667;const Double_t kY2=0.962;const Double_t kY4=0.379;
 
@@ -238,16 +259,30 @@ Double_t AliRICHParam::Mathieson(Double_t xMin,Double_t yMin,Double_t xMax,Doubl
   return 4*kX4*(TMath::ATan(ux2)-TMath::ATan(ux1))*kY4*(TMath::ATan(uy2)-TMath::ATan(uy1));
 }  
 //__________________________________________________________________________________________________
-void AliRICHParam::Loc2Area(TVector3 hitX3,Int_t &iPadXmin,Int_t &iPadYmin,Int_t &iPadXmax,Int_t &iPadYmax)
-{//calculates the area of disintegration for a given hit. Area is a rectangulare set pf pads
- //defined by its left-down and right-up coners
-  //  hitX3.SetX(Shift2NearestWire(hitX3.X());
-  Loc2Pad(hitX3.X()-MathiesonDeltaX(),hitX3.Y()-MathiesonDeltaY(),iPadXmin,iPadYmin);   
-  Loc2Pad(hitX3.X()+MathiesonDeltaX(),hitX3.Y()+MathiesonDeltaY(),iPadXmax,iPadYmax);     
-}//
+void AliRICHParam::Loc2Area(TVector2 x2,Int_t &iPadXmin,Int_t &iPadYmin,Int_t &iPadXmax,Int_t &iPadYmax)
+{
+// Calculates the area of disintegration for a given point. It's assumed here that this points lays on anode wire.
+// Area is a rectangulare set of pads defined by its left-down and right-up coners.
+  Loc2Pad(x2-MathiesonDelta(),iPadXmin,iPadYmin);
+  Loc2Pad(x2+MathiesonDelta(),iPadXmax,iPadYmax);    
+}
 //__________________________________________________________________________________________________
-Bool_t AliRICHParam::IsOverTh(Int_t iChamber, Int_t x, Int_t y, Double_t q)
-{// Calculate the new charge subtracting pedestal and if the current digit is over threshold
-  if(q>NsigmaTh()*fSigmaThMap[iChamber-1][x-1][y-1]) return kTRUE; else return kFALSE;
-}//
+Bool_t AliRICHParam::IsOverTh(Int_t c,Int_t x,Int_t y,Double_t q)
+{
+// Calculate the new charge subtracting pedestal and if the current digit is over threshold
+  if(q>NsigmaTh()*fSigmaThMap[c-1][x-1][y-1]) return kTRUE; else return kFALSE;
+}
+//__________________________________________________________________________________________________
+TVector2 AliRICHParam::ShiftToWirePos(TVector2 x2)
+{
+// Calculate the position of the wire nearest to the hit
+  Int_t padx,pady;
+  Loc2Pad(x2,padx,pady);
+  Double_t x;
+  TVector2 center2=Pad2Loc(padx,pady);
+  if(x2.X()>center2.X()) x=center2.X()+0.5*WirePitch();
+  else                   x=center2.X()-0.5*WirePitch();
+  x2.Set(x,x2.Y());
+  return x2;
+}
 #endif //AliRICHParam_h
index 0b29f26..76e13e9 100644 (file)
@@ -153,14 +153,9 @@ void AliRICHRecon::StartProcessEvent()
       SetTrackEta(trackEta);
       SetTrackCharge(q);
 
-      TVector3 pGlob(pHit->MomFreoX(),pHit->MomFreoY(),pHit->MomFreoZ());
-      TVector3 pLocal = Rich()->C(pHit->Chamber())->Glob2Loc(pGlob,1);
+      TVector3 pLocal(0,0,0);//?????
       
-      Float_t primGlobalX = pHit->X();
-      Float_t primGlobalY = pHit->Y();
-      Float_t primGlobalZ = pHit->Z();
-      TVector3 primGlobal(primGlobalX,primGlobalY,primGlobalZ);
-      TVector3 primLocal = Rich()->C(pHit->Chamber())->Glob2Loc(primGlobal);
+      TVector2 primLocal =Rich()->C(pHit->C())->Glob2Loc(pHit->InX3());
       
 //      Float_t pmodFreo = pLocal.Mag();
       Float_t trackTheta = pLocal.Theta();
@@ -201,8 +196,8 @@ void AliRICHRecon::StartProcessEvent()
       SetMipIndex(maxInd);
       SetTrackIndex(i);
 
-      Float_t shiftX = primLocal.X()/primLocal.Z()*(fRadiatorWidth+fQuartzWidth+fGapWidth) + primLocal.X();
-      Float_t shiftY = primLocal.Y()/primLocal.Z()*(fRadiatorWidth+fQuartzWidth+fGapWidth) + primLocal.Y();
+      Float_t shiftX = 0;//primLocal.X()/primLocal.Z()*(fRadiatorWidth+fQuartzWidth+fGapWidth) + primLocal.X(); ????? 
+      Float_t shiftY = 0;//primLocal.Y()/primLocal.Z()*(fRadiatorWidth+fQuartzWidth+fGapWidth) + primLocal.Y(); ?????
       
       SetShiftX(shiftX);
       SetShiftY(shiftY);
index 49d569f..bb8a57b 100644 (file)
@@ -95,8 +95,8 @@ void AliRICHv0::StepManager()
     gMC->CurrentVolOffID(2,iChamber);
     TVector3 x3=C(iChamber)->G2L(x4);
     Info("","loc(%+8.3f,%+8.3f,%8.3f) by G2L",         x3.X(),x3.Y(),x3.Z());  
-    x3=C(iChamber)->Glob2Loc(x4);
-    Info("","loc(%+8.3f,%+8.3f,%8.3f) by Global2Local",         x3.X(),x3.Y(),x3.Z());  
+    TVector2 x2=C(iChamber)->Glob2Loc(x4);
+    Info("","loc(%+8.3f,%+8.3f) by Global2Local",      x2.X(),x2.Y());  
   }
   Info("","end of current step\n");
 }//StepManager()
index 036fbf1..9defac1 100644 (file)
 #include <AliMC.h>
 
 ClassImp(AliRICHv1)    
-//______________________________________________________________________________
+//__________________________________________________________________________________________________
 void AliRICHv1::StepManager()
 {
 //Full Step Manager
 
   Int_t          copy;
   static Int_t   iCurrentChamber;
-  static TLorentzVector x4,p4,mipInX4,mipOutX4;
-  Float_t        pos[3],mom[4],localPos[3],localMom[4];
-  Float_t        coscerenkov;
-       
-  TParticle *current = (TParticle*)(*gAlice->GetMCApp()->Particles())[gAlice->GetMCApp()->GetCurrentTrackNumber()];
-  Float_t cherenkovLoss=0;
-    
-  if(gMC->TrackPid()==kCerenkov){//C
-    Float_t ckovEnergy = current->Energy();
-    if(ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 ){//C+E
-        if(gMC->IsTrackEntering()){                                     //is track entering?
-                   
-                   if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)){             //is it in csi?      
-                       gMC->TrackMomentum(p4); mom[0]=p4(0);   mom[1]=p4(1);   mom[2]=p4(2);   mom[3]=p4(3);
-                       gMC->Gmtod(mom,localMom,2);
-                       Double_t localTc    = localMom[0]*localMom[0]+localMom[2]*localMom[2];
-                       Double_t localTheta = TMath::ATan2(TMath::Sqrt(localTc),localMom[1]);
-                       Double_t cotheta = TMath::Abs(TMath::Cos(localTheta));
-                        if(gMC->GetRandom()->Rndm() < Fresnel(p4.E()*1e9,cotheta,1))  gMC->StopTrack();
-                               
-                     }//C+E+produced in Freon
-                 } //track entering?
-    }//C+E
-  }//C
-    
-  if((gMC->TrackPid()==kCerenkov||gMC->TrackPid()==kFeedback)&&gMC->CurrentVolID(copy)==gMC->VolId("CSI ")){//photon in CSI     
-      if(gMC->Edep()>0.){//CF+CSI+DE
-        gMC->TrackPosition(x4);   pos[0]=x4(0);   pos[1]=x4(1);   pos[2]=x4(2);
-        gMC->TrackMomentum(p4);   mom[0]=p4(0);   mom[1]=p4(1);   mom[2]=p4(2);   mom[3]=p4(3);
-        if(IsFresnelLoss()){ gMC->StopTrack(); return;}        
-       gMC->CurrentVolOffID(2,copy);iCurrentChamber=copy;
+        
+//Treat photons    
+  static TLorentzVector cerX4;
+  if((gMC->TrackPid()==kCerenkov||gMC->TrackPid()==kFeedback)&&gMC->CurrentVolID(copy)==gMC->VolId("CSI ")){//photon in CSI
+    if(gMC->Edep()>0.){//CF+CSI+DE
+      if(IsLostByFresnel()){ gMC->StopTrack(); return;}        
+      gMC->TrackPosition(cerX4); gMC->CurrentVolOffID(2,iCurrentChamber);
        
-        gMC->Gmtod(pos,localPos,1);     gMC->Gmtod(mom,localMom,2);
-
-       cherenkovLoss  += gMC->Edep();
-                   
-        AliRICHhit *mipHit =  (AliRICHhit*) (fHits->UncheckedAt(0));
-        if(mipHit){
-          mom[0] = current->Px();   mom[1] = current->Py();   mom[2] = current->Pz();
-          Float_t mipPx = mipHit->MomX();   Float_t mipPy = mipHit->MomY();   Float_t mipPz = mipHit->MomZ();
-                       
-          Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
-          Float_t rt = TMath::Sqrt(r);
-          Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz;      
-          Float_t mipRt = TMath::Sqrt(mipR);
-          if((rt*mipRt) > 0)
-            coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
-          else
-            coscerenkov = 0;
-        }
-        AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),x4.Vect());//HIT for PHOTON in conditions CF+CSI+DE
-       GenerateFeedbacks(iCurrentChamber,cherenkovLoss);//CF+CSI+DE
-      }//CF+CSI+DE
+      AddHit(iCurrentChamber,gAlice->GetMCApp()->GetCurrentTrackNumber(),cerX4.Vect(),cerX4.Vect());//HIT for PHOTON in conditions CF+CSI+DE
+      GenerateFeedbacks(iCurrentChamber);
+    }//CF+CSI+DE
   }//CF in CSI
   
 //Treat charged particles  
   static Float_t eloss;
+  static TLorentzVector mipInX4,mipOutX4;
   if(gMC->TrackCharge() && gMC->CurrentVolID(copy)==gMC->VolId("GAP ")){//MIP in GAP
-    gMC->CurrentVolOffID(3,copy); iCurrentChamber=copy;
-    if(gMC->IsTrackEntering()||gMC->IsNewTrack()) {//MIP in GAP Entering
+    gMC->CurrentVolOffID(3,iCurrentChamber);
+    if(gMC->IsTrackEntering()||gMC->IsNewTrack()) {//MIP in GAP entering or newly created
       eloss=0;                                                           
       gMC->TrackPosition(mipInX4);
-    }else if(gMC->IsTrackExiting()||gMC->IsTrackStop()||gMC->IsTrackDisappeared()){//MIP in GAP Exiting
+    }else if(gMC->IsTrackExiting()||gMC->IsTrackStop()||gMC->IsTrackDisappeared()){//MIP in GAP exiting or disappeared
       eloss+=gMC->Edep();//take into account last step dEdX
       gMC->TrackPosition(mipOutX4);  
-      AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),mipInX4.Vect(),mipOutX4.Vect(),eloss);//HIT for MIP for conditions: MIP in GAP Exiting
+      AddHit(iCurrentChamber,gAlice->GetMCApp()->GetCurrentTrackNumber(),mipInX4.Vect(),mipOutX4.Vect(),eloss);//HIT for MIP: MIP in GAP Exiting
       GenerateFeedbacks(iCurrentChamber,eloss);//MIP+GAP+Exit
     }else//MIP in GAP going inside
       eloss   += gMC->Edep();
   }//MIP in GAP
-}//void AliRICHv1::StepManager()
-
-Bool_t AliRICHv1::IsFresnelLoss()
+}//StepManager()
+//__________________________________________________________________________________________________
+Bool_t AliRICHv1::IsLostByFresnel()
 {
-  return kFALSE;
-}
+  TLorentzVector p4;
+  Double_t mom[3],localMom[3];
+  gMC->TrackMomentum(p4); mom[0]=p4(0);   mom[1]=p4(1);   mom[2]=p4(2);   mom[3]=p4(3);
+  gMC->Gmtod(mom,localMom,2);
+  Double_t localTc    = localMom[0]*localMom[0]+localMom[2]*localMom[2];
+  Double_t localTheta = TMath::ATan2(TMath::Sqrt(localTc),localMom[1]);
+  Double_t cotheta = TMath::Abs(TMath::Cos(localTheta));
+  if(gMC->GetRandom()->Rndm() < Fresnel(p4.E()*1e9,cotheta,1)){
+    if(GetDebug()) Info("IsLostByFresnel","");
+    return kTRUE;
+  }else
+    return kFALSE;
+}//IsLostByFresnel()
+//__________________________________________________________________________________________________
index 97cc265..f848de9 100644 (file)
@@ -16,7 +16,7 @@ public:
   virtual Int_t  IsVersion()                                                    const{return 1;}
   
   virtual void   StepManager();
-          Bool_t IsFresnelLoss(); 
+          Bool_t IsLostByFresnel(); 
 private:
   ClassDef(AliRICHv1,1)//RICH full version for simulation
 };
index cf083db..0e5c606 100644 (file)
@@ -181,10 +181,11 @@ void KirConfig::CreateConfigFile()
 //RICH  
   if(fRichTopChkBtn->GetState()==kButtonDown) fprintf(fp,"  AliRICHParam::AngleRot(0);\n");
   switch(fRichVersionCombo->GetSelected()){//RICH
-    case 0:   fprintf(fp,"  pRICH=new AliRICHv0(\"RICH\",\"RICH version 0\");\n\n"); break;   
-    case 1:   fprintf(fp,"  pRICH=new AliRICHv1(\"RICH\",\"RICH version 1\");\n\n"); break;   
-    case 3:   fprintf(fp,"  pRICH=new AliRICHv3(\"RICH\",\"RICH version 3\");\n\n"); break;   
+    case 0:   fprintf(fp,"  pRICH=new AliRICHv0(\"RICH\",\"RICH version 0\");\n"); break;   
+    case 1:   fprintf(fp,"  pRICH=new AliRICHv1(\"RICH\",\"RICH version 1\");\n"); break;   
+    case 3:   fprintf(fp,"  pRICH=new AliRICHv3(\"RICH\",\"RICH version 3\");\n"); break;   
   }
+  fprintf(fp,"  ::Info(\"RICH private config\",\"version %i\");\n\n",fRichVersionCombo->GetSelected()); 
 //Generator
   switch(fGenTypeCombo->GetSelected()){
     case kHijingPara: 
index 1dd25ca..d949429 100644 (file)
@@ -1,15 +1,14 @@
 void RichBatch(const Int_t iNevents,const Bool_t isDebug,const char *sConfigFileName)
 {
-  if(isDebug)
-    gAlice->SetDebug(1);
+  if(isDebug) gAlice->SetDebug(1);
 
-  Info("my/AliceBatch.C","%i event(s) requested, debug %i",iNevents,isDebug);  
+  Info("my/RichBatch.C","%i event(s) requested, debug %i,config file %s",iNevents,isDebug,sConfigFileName);  
   TStopwatch sw;TDatime time;  
 
-  gAlice->Run(iNevents,sConfigFileName);
+  AliSimulation a;  a.Run(iNevents);
    
-  cout<<"\nInfo in <my/AliceBatch.C>: Start time: ";time.Print();
-  cout<<"Info in <my/AliceBatch.C>: Stop  time: ";time.Set();  time.Print();
-  cout<<"Info in <my/AliceBatch.C>: Time  used: ";sw.Print();
-  gSystem->Exec("touch ZZZfinishedZZZ");
+  cout<<"\nInfo in <my/RichBatch.C>: Start time: ";time.Print();
+    cout<<"Info in <my/RichBatch.C>: Stop  time: ";time.Set();  time.Print();
+    cout<<"Info in <my/RichBatch.C>: Time  used: ";sw.Print();
+  gSystem->Exec("touch ZZZ______finished_______ZZZ");
 }
index 3c2e4cb..5c6b51b 100644 (file)
@@ -7,3 +7,42 @@ AliStack::GetNtrack() or AliRun::GetEvent()
 
 total amount of primiry particles in stack for a given event:
 AliStack::GetNprimary() or TreeH()::GetEntries()
+
+to open session 
+AliRunLoader::Open(
+
+
+Hits a stored on primiry by primiry basis. To retrieve all hits one needs to do:
+
+initialise the root tree and containers:    AliLoader::LoadHits() 
+read number of primiries in current event:
+loop on the list of primiries:
+
+
+
+How to retrive sdigits? Sdigits stored in tree S with the branch of TClonesArray, all sdigits in a single TClonesArray
+                        So the tree has only one entry.
+                        One needs to say:
+                        pRich->GetLoader()->LoadSDigits(); this one open file, get the tree and invoke AliRICH::SetTreeAddress()    
+
+
+
+gAlice->GetMCApp()->GetCurrentTrackNumber()
+
+
+Debug staff:
+
+AliModule::GetDebug() 
+AliModule::SetDebug()
+AliRun::GetDebug()
+AliRun::SetDebug()
+
+
+
+
+
+
+pointer to gAlice
+
+
+
index af0d30a..cdef777 100644 (file)
@@ -270,8 +270,8 @@ void SD_D()
         combiPid+=pSdig->CombiPid();
         if(iNdigitsPerPad<=3)
           tid[iNdigitsPerPad-1]=pSdig->Tid(0);
-//        else
-//          Info("","More then 3 sdigits for the given pad");
+        else
+          Warning("SDigits2Digits","More then 3 sdigits for the given pad");
       }else{//new pad, add the pevious one
         if(id!=kBad&&r->Param()->IsOverTh(chamber,x,y,q)) {
            r->AddDigit(chamber,x,y,q,combiPid,tid);
@@ -390,81 +390,6 @@ Bool_t ReadAlice()
   return kTRUE;
 }
 //__________________________________________________________________________________________________
-void PrintGeo(Float_t rotDeg=0)
-{
-  AliRICHParam *p=new AliRICHParam;  
-  Double_t r=p->Offset();
-  Double_t kP=p->AngleXY();
-  Double_t kT=p->AngleYZ();
-  Double_t kRot;
-  
-  if(rotDeg==0)
-    kRot=p->AngleRot();
-  else
-    kRot=rotDeg*deg;
-        
-  cout<<endl;
-  Double_t  phi=90*deg+kRot+kP,theta=90*deg+kT;
-  Info("   menu for          1","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
-                                 r,      theta*r2d,  phi*r2d,  
-                                                               r*sin(theta)*cos(phi),
-                                                                       r*sin(theta)*sin(phi),
-                                                                               r*cos(theta));
-  
-  phi=90*deg+kRot+kP,theta=90*deg;
-  Info("   menu for          2","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
-                                 r,      theta*r2d,  phi*r2d,  
-                                                               r*sin(theta)*cos(phi),
-                                                                       r*sin(theta)*sin(phi),
-                                                                               r*cos(theta));
-  
-  phi=90*deg+kRot,theta=90*deg-kT;    
-  Info("   menu for          3","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
-                                 r,      theta*r2d,  phi*r2d,  
-                                                               r*sin(theta)*cos(phi),
-                                                                       r*sin(theta)*sin(phi),
-                                                                               r*cos(theta));
-  
-  
-  phi=90*deg+kRot,theta=90*deg;
-  Info("   menu for          4","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
-                                 r,      theta*r2d,  phi*r2d,  
-                                                               r*sin(theta)*cos(phi),
-                                                                       r*sin(theta)*sin(phi),
-                                                                               r*cos(theta));
-
-  
-  phi=90*deg+kRot,theta=90*deg+kT;
-  Info("   menu for          5","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
-                                 r,      theta*r2d,  phi*r2d,  
-                                                                r*sin(theta)*cos(phi),
-                                                                       r*sin(theta)*sin(phi),
-                                                                               r*cos(theta));
-  
-  
-  phi=90*deg+kRot-kP,theta=90*deg;
-  Info("   menu for          6","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
-                                 r,      theta*r2d,  phi*r2d,  
-                                                               r*sin(theta)*cos(phi),
-                                                                       r*sin(theta)*sin(phi),
-                                                                               r*cos(theta));
-  
-  phi=90*deg+kRot-kP,theta=90*deg+kT;
-  Info("   menu for          7","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
-                                 r,      theta*r2d,  phi*r2d,  
-                                                               r*sin(theta)*cos(phi),
-                                                                       r*sin(theta)*sin(phi),
-                                                                               r*cos(theta));
-
-  delete p;
-}//PrintGeo()
-//__________________________________________________________________________________________________
-
-Double_t Gain(Double_t *x,Double_t *par)
-{
-  return AliRICHParam::GainSag(x[0],par[0]);
-}
-
 void TestResponse()
 {
   TCanvas *pC=new TCanvas("c","Amplification test",900,800);