-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
+ if(Sector(x2)==kBad) return 0; //hit in the dead zone
+ 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();