X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=RICH%2FAliRICHParam.cxx;h=7b140efcdb7dbb2ad1d8cd20008f9d3def82d5dc;hb=11d31ad9ccd99a826913350e3bdd34b4ce24ffe1;hp=c63e74c89f96883819be936f2232d7a4cb2604a4;hpb=c60862bf5dd7402eb9e152b91e0e3d9172bcf333;p=u%2Fmrichter%2FAliRoot.git diff --git a/RICH/AliRICHParam.cxx b/RICH/AliRICHParam.cxx index c63e74c89f9..7b140efcdb7 100644 --- a/RICH/AliRICHParam.cxx +++ b/RICH/AliRICHParam.cxx @@ -1,163 +1,99 @@ -#include "AliRICHParam.h" -#include "AliRICHConst.h" -#include -#include - +// ************************************************************************** +// * 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. * +// ************************************************************************** +#include "AliRICHParam.h" //class header +#include "AliRICHDigit.h" //ctor +#include //TestXXX() +#include //TestTrans() +#include //TestTrans() +#include //TestTrans() +#include +#include //Stack() +#include //Stack() +#include //Stack() +#include "AliRICHHelix.h" //TestTrans() + ClassImp(AliRICHParam) -// RICH main parameters manipulator -//__________________________________________________________________________________________________ -AliRICHParam::AliRICHParam(): -fNpadsX(0),fNpadsY(0),fNpadsXsector(0),fNpadsYsector(0), -fDeadZone(0), -fPadSizeX(0),fPadSizeY(0), -fSectorSizeX(0),fSectorSizeY(0), -fWirePitch(0), -fCurrentPadX(0),fCurrentPadY(0),fCurrentWire(0), -fSizeZ(0), -fAngleRot(0),fAngleYZ(0),fAngleXY(0), -fOffset(0), -fGapThickness(0), -fProximityGapThickness(0), -fQuartzLength(0), -fQuartzWidth(0), -fQuartzThickness(0), -fOuterFreonLength(0), -fOuterFreonWidth(0), -fInnerFreonLength(0), -fInnerFreonWidth(0), -fFreonThickness(0), -fRadiatorToPads(0), -fPcSizeX(0), -fPcSizeY(0), -fChargeSlope(0), -fChargeSpreadX(0), -fChargeSpreadY(0), -fSigmaIntegration(0), -fAlphaFeedback(0), -fEIonisation(0), -fMaxAdc(0), -fSqrtKx3(0), -fKx2(0), -fKx4(0), -fSqrtKy3(0), -fKy2(0), -fKy4(0), -fPitch(0), -fWireSag(0), -fVoltage(0) -{//defines the default parameters - Segmentation (144,160); //nx,ny for the whole chamber - DeadZone (3*kcm); //spacer between PC planes - PadSize (8.4*kmm,8.0*kmm); - fWirePitch=PadSizeX()/2; - - Size (132.6*kcm,26*kcm,136.7*kcm); //full length, not GEANT half notation - AngleRot (60); //rotation of the whole RICH around Z, deg - Angles (20,19.5); //XY angle, YZ angle deg - Offset (490*kcm+1.267*kcm); //1.267???????cm distance from IP to the center of module - GapThickness (8*kcm); - ProximityGapThickness(0.4*kcm); - QuartzLength (133*kcm); - QuartzWidth (127.9*kcm); - QuartzThickness (0.5*kcm); - OuterFreonLength (133*kcm); - OuterFreonWidth (41.3*kcm); - InnerFreonLength (133*kcm); - InnerFreonWidth (41.3*kcm); - FreonThickness (1.5*kcm); - RadiatorToPads (80*kmm); - - ChargeSlope(27.); - ChargeSpreadX(0.18);ChargeSpreadY(0.18); - SigmaIntegration(5.); - MaxAdc(4096); - AlphaFeedback(0.036); - EIonisation(26.e-9); - SqrtKx3(0.77459667); - Kx2(0.962); - Kx4(0.379); - SqrtKy3(0.77459667); - Ky2(0.962); - Ky4(0.379); - Pitch(0.25); - WireSag(1); // 1->On, 0->Off - Voltage(2150); // Should only be 2000, 2050, 2100 or 2150 +AliRICHParam* AliRICHParam::fgInstance=0x0; //singleton pointer +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +AliRICHParam::AliRICHParam():TNamed("RichParam","default version") +{ +// Here all the intitializition is taken place when AliRICHParam::Instance() is invoked for the first time. +// In particulare, matrices to be used for LORS<->MARS trasnformations are initialized from TGeo structure. +// Note that TGeoManager should be already initialized from geometry.root file + fX=0.5*AliRICHDigit::SizeAllX(); + fY=0.5*AliRICHDigit::SizeAllY(); + for(Int_t i=0;i<7;i++) fM[i]=(TGeoHMatrix*)gGeoManager->GetVolume("ALIC")->GetNode(Form("RICH_%i",i))->GetMatrix(); + fgInstance=this; +}//ctor +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +void AliRICHParam::Print(Option_t* opt) const +{ +// print some usefull (hopefully) info on some internal guts of RICH parametrisation - Recalc(); -}//AliRICHParam::named ctor -//__________________________________________________________________________________________________ -void AliRICHParam::Recalc() -{//recalculate - fNpadsXsector=NpadsX()/3; fNpadsYsector=NpadsY()/2; - fPcSizeX=NpadsX()*fPadSizeX+2*fDeadZone; - fPcSizeY=NpadsY()*fPadSizeY+fDeadZone; - fSectorSizeX=(fPcSizeX-2*fDeadZone)/3; - fSectorSizeY=(fPcSizeY-fDeadZone)/2; -}//void AliRICHParam::Recalc() -//__________________________________________________________________________________________________ -Int_t AliRICHParam::Sector(Float_t &x, Float_t &y)const -{//Determines sector for a given hit (x,y) and trasform this point to the local system of that sector. + for(Int_t i=0;i<7;i++) fM[i]->Print(opt); +}//Print() +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +Int_t AliRICHParam::Stack(Int_t evt,Int_t tid) +{ +// Prints some usefull info from stack +// Arguments: evt - event number. if not -1 print info only for that event +// tid - track id. if not -1 then print it and all it's mothers if any +// Returns: mother tid of the given tid if any + AliRunLoader *pAL=AliRunLoader::Open(); + if(pAL->LoadHeader()) return -1; + if(pAL->LoadKinematics()) return -1; - Int_t sector=kBad; - if(x<=-fSectorSizeX/2-fDeadZone&&x>=-fPcSizeX/2) {sector=1;x+=fPcSizeX/2;} - else if(x>=-fSectorSizeX/2 && x<=fSectorSizeX/2) {sector=2;x+=fSectorSizeX/2;} - else if(x>= fSectorSizeX/2+fDeadZone&&x<=fPcSizeX/2) {sector=3;x-=fSectorSizeX/2+fDeadZone;} - else if(x<-fPcSizeX/2||x>fPcSizeX/2) {Error("Sector","given x position is out of active PC area");return kBad;} - else {return kBad;} //in dead zone - - if(y>=-fPcSizeY/2&&y<= -fDeadZone/2) {y+=fPcSizeY/2; return -sector;} - else if(y>-fDeadZone/2&&y=fDeadZone/2&&y<=fPcSizeY/2) {y-=fDeadZone/2; return sector;} - else {Error("Sector","given y position is out of active PC area");return kBad;} -}//Int_t AliRICHParam::Sector(Float_t x, Float_t y) -//__________________________________________________________________________________________________ -Int_t AliRICHParam::L2P(Float_t x, Float_t y, Int_t &padx, Int_t &pady)const -{//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 + Int_t mtid=-1; + Int_t iNevt=pAL->GetNumberOfEvents(); Printf("This session contains %i event(s)",iNevt); - padx=pady=kBad; - Int_t sector=Sector(x,y); - if(sector==kBad) return sector; + for(Int_t iEvt=0;iEvtGetEvent(iEvt); + AliStack *pStack=pAL->Stack(); + if(tid==-1){ //print all tids for this event + for(Int_t i=0;iGetNtrack();i++) pStack->Particle(i)->Print(); + Printf("totally %i tracks including %i primaries for event %i out of %i event(s)",pStack->GetNtrack(),pStack->GetNprimary(),iEvt,iNevt); + }else{ //print only this tid and it;s mothers + if(tid<0 || tid>pStack->GetNtrack()) {Printf("Wrong tid, valid tid range for event %i is 0-%i",iEvt,pStack->GetNtrack());break;} + TParticle *pTrack=pStack->Particle(tid); mtid=pTrack->GetFirstMother(); + TString str=pTrack->GetName(); + while((tid=pTrack->GetFirstMother()) >= 0){ + pTrack=pStack->Particle(tid); + str+=" from ";str+=pTrack->GetName(); + } + Printf("%s",str.Data()); + }//if(tid==-1) + }//events loop + pAL->UnloadHeader(); pAL->UnloadKinematics(); + return mtid; +} +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +Int_t AliRICHParam::StackCount(Int_t pid,Int_t evt) +{ +// Counts total number of particles of given sort (including secondary) for a given event + AliRunLoader *pAL=AliRunLoader::Open(); + pAL->GetEvent(evt); + if(pAL->LoadHeader()) return 0; + if(pAL->LoadKinematics()) return 0; + AliStack *pStack=pAL->Stack(); - padx=Int_t(x/fPadSizeX)+1; - if(padx>fNpadsXsector) padx=fNpadsXsector; - if(sector==2||sector==-2) padx+=fNpadsXsector; - else if(sector==3||sector==-3) padx+=fNpadsXsector*2; + Int_t iCnt=0; + for(Int_t i=0;iGetNtrack();i++) if(pStack->Particle(i)->GetPdgCode()==pid) iCnt++; - pady=Int_t(y/fPadSizeY)+1; - if(pady>fNpadsYsector) padx=fNpadsYsector; - if(sector>0) pady+=fNpadsYsector; - - return sector; -}//void AliRICHParam::L2P(Float_t x, Float_t y, Int_t &padx, Int_t &pady) -//__________________________________________________________________________________________________ -Float_t AliRICHParam::Gain(Float_t y) -{//Calculates the gain - if(fWireSag){ - Float_t gainK=9e-6*TMath::Power(y,4)+2e-7*TMath::Power(y,3)-0.0316*TMath::Power(y,2)-3e-4*y+25.367; - Float_t gain = (ChargeSlope()+ChargeSlope()*gainK/100)*0.9; - return -gain*TMath::Log(gRandom->Rndm()); - }else - return -ChargeSlope()*TMath::Log(gRandom->Rndm()); -}//Float_t AliRICHParam::IntPH(Float_t yhit) -//__________________________________________________________________________________________________ -Float_t AliRICHParam::TotalCharge(Int_t iPID,Float_t eloss,Float_t y) -{//Get number of electrons and return charge - - if(iPID>50000)//it's photon no more then 1 electron after photoelectron conversion - return Gain(y); - else{ - Int_t iNelectrons=Int_t(eloss/fEIonisation);if(iNelectrons==0) iNelectrons=1; - Float_t charge=0; - for(Int_t i=1;i<=iNelectrons;i++) - charge+=Gain(y); - return charge; - } -}//Float_t AliRICHParam::TotalCharge(Int_t iPID,Float_t eloss, Float_t y) -//__________________________________________________________________________________________________ -void AliRICHParam::FirstPad(Float_t x,Float_t y) -{ - Int_t padx,pady; - L2P(x,y,padx,pady); -}//void AliRICHParam::FirstPad(Float_t x,Float_t y) + pAL->UnloadHeader(); pAL->UnloadKinematics(); + return iCnt; +} +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++