]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RICH/AliRICHResponseV0.cxx
Changed drwaing routines.
[u/mrichter/AliRoot.git] / RICH / AliRICHResponseV0.cxx
index 410882e3d6fe1d8510c18b24b7bb03d964ed20ed..52869e710a263705dfe9408f8499abfefccef192 100644 (file)
 
 /*
   $Log$
+  Revision 1.6  2001/02/23 17:39:02  jbarbosa
+  Removed verbose output.
+
+  Revision 1.5  2001/02/23 17:25:08  jbarbosa
+  Re-definition of IntPH() to accomodate for wire sag effect.
+
+  Revision 1.4  2000/12/01 17:37:44  morsch
+  Replace in argument of SetTrack(..) string constant by  kPFeedBackPhoton.
+
+  Revision 1.3  2000/10/03 21:44:09  morsch
+  Use AliSegmentation and AliHit abstract base classes.
+
+  Revision 1.2  2000/10/02 21:28:12  fca
+  Removal of useless dependecies via forward declarations
+
+  Revision 1.1  2000/06/12 15:29:37  jbarbosa
+  Cleaned up version.
+
 */
 
 #include "AliRICHResponseV0.h"
-#include "AliRICHSegmentation.h"
+#include "AliSegmentation.h"
 #include "AliRun.h"
+#include "AliMC.h"
 
 #include <TMath.h>
 #include <TRandom.h>
@@ -27,7 +46,7 @@
 //___________________________________________
 ClassImp(AliRICHResponseV0)
 
-Float_t AliRICHResponseV0::IntPH(Float_t eloss)
+Float_t AliRICHResponseV0::IntPH(Float_t eloss, Float_t yhit)
 {
     // Get number of electrons and return charge
     
@@ -35,26 +54,87 @@ Float_t AliRICHResponseV0::IntPH(Float_t eloss)
     nel= Int_t(eloss/fEIonisation);
     
     Float_t charge=0;
+    Double_t gain_var=1;
+
     if (nel == 0) nel=1;
-    for (Int_t i=1;i<=nel;i++) {
-       charge -= fChargeSlope*TMath::Log(gRandom->Rndm());    
-    }
+
+    if (fWireSag)
+      {
+       //printf("Voltage:%d, Yhit:%f\n",fVoltage, yhit);
+
+       if (fVoltage==2150)
+         {
+           gain_var = 9e-6*TMath::Power(yhit,4) + 2e-7*TMath::Power(yhit,3) - 0.0316*TMath::Power(yhit,2) - 3e-4*yhit + 25.367;
+           //gain_var = 9e-5*TMath::Power(yhit,4) + 2e-6*TMath::Power(yhit,3) - 0.316*TMath::Power(yhit,2) - 3e-3*yhit + 253.67;
+         }
+       if (fVoltage==2100)
+           gain_var = 8e-6*TMath::Power(yhit,4) + 2e-7*TMath::Power(yhit,3) - 0.0283*TMath::Power(yhit,2) - 2e-4*yhit + 23.015;
+       if (fVoltage==2050)
+           gain_var = 7e-6*TMath::Power(yhit,4) + 1e-7*TMath::Power(yhit,3) - 0.0254*TMath::Power(yhit,2) - 2e-4*yhit + 20.888;
+       if (fVoltage==2000)
+           gain_var = 6e-6*TMath::Power(yhit,4) + 8e-8*TMath::Power(yhit,3) - 0.0227*TMath::Power(yhit,2) - 1e-4*yhit + 18.961;
+               
+       gain_var = gain_var/100;
+       //printf("Yhit:%f, Gain variation:%f\n",yhit,gain_var);
+
+       Float_t gain = (fChargeSlope + fChargeSlope*gain_var)*.9; 
+       //printf(" Yhit:%f, Gain variation:%f\n",yhit, gain);
+
+       for (Int_t i=1;i<=nel;i++) {
+         charge -= gain*TMath::Log(gRandom->Rndm());    
+       }
+      }
+    else
+      {
+       for (Int_t i=1;i<=nel;i++) {
+         charge -= fChargeSlope*TMath::Log(gRandom->Rndm());    
+       }
+      }
+
     return charge;
 }
 
-Float_t AliRICHResponseV0::IntPH()
+Float_t AliRICHResponseV0::IntPH(Float_t yhit)
 {
 
 //  Get number of electrons and return charge, for a single photon
 
-    Float_t charge = -fChargeSlope*TMath::Log(gRandom->Rndm());
+  Float_t charge=0;
+  Double_t gain_var=1;
+
+   if (fWireSag)
+      {
+       if (fVoltage==2150)
+         {
+           gain_var = 9e-6*TMath::Power(yhit,4) + 2e-7*TMath::Power(yhit,3) - 0.0316*TMath::Power(yhit,2) - 3e-4*yhit + 25.367;
+           //gain_var = 9e-5*TMath::Power(yhit,4) + 2e-6*TMath::Power(yhit,3) - 0.316*TMath::Power(yhit,2) - 3e-3*yhit + 253.67;
+         }
+       if (fVoltage==2100)
+           gain_var = 8e-6*TMath::Power(yhit,4) + 2e-7*TMath::Power(yhit,3) - 0.0283*TMath::Power(yhit,2) - 2e-4*yhit + 23.015;
+       if (fVoltage==2050)
+           gain_var = 7e-6*TMath::Power(yhit,4) + 1e-7*TMath::Power(yhit,3) - 0.0254*TMath::Power(yhit,2) - 2e-4*yhit + 20.888;
+       if (fVoltage==2000)
+           gain_var = 6e-6*TMath::Power(yhit,4) + 8e-8*TMath::Power(yhit,3) - 0.0227*TMath::Power(yhit,2) - 1e-4*yhit + 18.961;
+
+       gain_var = gain_var/100;
+       //printf(" Yhit:%f, Gain variation:%f\n",yhit, gain_var);
+       
+       Float_t gain = (fChargeSlope + fChargeSlope*gain_var)*.9; 
+       
+       charge -= gain*TMath::Log(gRandom->Rndm());
+       //printf(" Yhit:%f, Gain variation:%f\n",yhit, gain);
+      }
+   else
+     {
+       charge -= fChargeSlope*TMath::Log(gRandom->Rndm());
+     }
     return charge;
 }
 
 
 
 // -------------------------------------------
-Float_t AliRICHResponseV0::IntXY(AliRICHSegmentation * segmentation)
+Float_t AliRICHResponseV0::IntXY(AliSegmentation * segmentation)
 {
     
     const Float_t kInversePitch = 1/fPitch;
@@ -129,6 +209,7 @@ Int_t AliRICHResponseV0::FeedBackPhotons(Float_t *source, Float_t qtot)
   
   // This call to fill the time of flight
   gMC->TrackPosition(position);
+  //printf("Track position: %f %f %f %15.12f\n", position[0],position[1],position[2],position[3]);
   //
   // Generate photons
   for (i = 0; i <nfp; i++) {
@@ -156,6 +237,8 @@ Int_t AliRICHResponseV0::FeedBackPhotons(Float_t *source, Float_t qtot)
     mom[0]*=enfp;
     mom[1]*=enfp;
     mom[2]*=enfp;
+    //printf("Dir %f %f %f\n",dir[0],dir[1],dir[2]);
+    //printf("Momentum %15.12f %15.12f %15.12f\n",mom[0],mom[1],mom[2]);
     
     // Polarisation
     e1[0] = 0;
@@ -204,9 +287,13 @@ Int_t AliRICHResponseV0::FeedBackPhotons(Float_t *source, Float_t qtot)
     ++sNfeed;
 
     gAlice->SetTrack(Int_t(1), gAlice->CurrentTrack(), Int_t(50000051),
-                    mom,source,pol,position[3],
-                    "Feedback", nt, 1.);
+                    mom[0],mom[1],mom[2],mom[3],source[0],source[1],source[2],position[3],pol[0],pol[1],pol[2],
+                    kPFeedBackPhoton, nt, 1.);
+    
+    //printf("Adding feedback with tof %f and going to %f %f %f\n",position[3],mom[0],mom[1],mom[2]);
   }
+  //if(sNfeed)
+    //printf("feedbacks produced:%d\n",sNfeed);
   return(sNfeed);
 }