// **************************************************************************
#include "AliHMPIDParam.h" //class header
#include "AliHMPIDDigit.h" //ctor
-#include <TCanvas.h> //TestXXX()
-#include <TLatex.h> //TestTrans()
-#include <TView.h> //TestTrans()
-#include <TPolyMarker3D.h> //TestTrans()
+#include "AliLog.h" //general
+#include <AliRunLoader.h> //Stack()
+#include <AliStack.h> //Stack()
+#include <TLatex.h> //TestTrans()
+#include <TView.h> //TestTrans()
+#include <TPolyMarker3D.h> //TestTrans()
#include <TRotation.h>
-#include <AliRunLoader.h> //Stack()
-#include <AliStack.h> //Stack()
-#include <TParticle.h> //Stack()
+#include <TParticle.h> //Stack()
#include <TGeoPhysicalNode.h> //ctor
#include <TGeoBBox.h>
ClassImp(AliHMPIDParam)
Float_t AliHMPIDParam::fgAllX=0;
Float_t AliHMPIDParam::fgAllY=0;
-Int_t AliHMPIDParam::fgSigmas=4;
+Bool_t AliHMPIDParam::fgInstanceType=kTRUE;
AliHMPIDParam* AliHMPIDParam::fgInstance=0x0; //singleton pointer
+
+Int_t AliHMPIDParam::fgSigmas=4;
+
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AliHMPIDParam::AliHMPIDParam(Bool_t noGeo=kFALSE):TNamed("HmpidParam","default version")
{
// In particular, matrices to be used for LORS<->MARS trasnformations are initialized from TGeo structure.
// Note that TGeoManager should be already initialized from geometry.root file
- if(noGeo==kTRUE){fgCellX=0.8;fgCellY=0.84;}
+
+ fRadNmean = MeanIdxRad(); //initialization of the running ref. index of freon
+ Float_t dead=2.6;// cm of the dead zones between PCs-> See 2CRC2099P1
+
+
+ if(noGeo==kTRUE) fgInstanceType=kFALSE; //instance from ideal geometry, no actual geom is present
+
if(noGeo==kFALSE && !gGeoManager)
{
TGeoManager::Import("geometry.root");
if(!gGeoManager) AliFatal("!!!!!!No geometry loaded!!!!!!!");
}
- Float_t dead=2.6;// cm of the dead zones between PCs-> See 2CRC2099P1
- TGeoVolume *pCellVol = gGeoManager->GetVolume("Hcel");
-
- if(!pCellVol) {
- fgCellX=0.8;fgCellY=0.84;
- } else {
- TGeoBBox *bcell = (TGeoBBox *)pCellVol->GetShape();
- fgCellX=2.*bcell->GetDX(); fgCellY = 2.*bcell->GetDY();
- }
+ fgCellX=0.8;fgCellY=0.84;
+ if(!noGeo==kTRUE){
+ TGeoVolume *pCellVol = gGeoManager->GetVolume("Hcel");
+ if(pCellVol) {
+ TGeoBBox *bcell = (TGeoBBox *)pCellVol->GetShape();
+ fgCellX=2.*bcell->GetDX(); fgCellY = 2.*bcell->GetDY(); // overwrite the values with the read ones
+ }
+ }
fgPcX=80.*fgCellX; fgPcY = 48.*fgCellY;
fgAllX=2.*fgPcX+dead;
fgAllY=3.*fgPcY+2.*dead;
IdealPosition(i,fM[i]);
} else {
TGeoPhysicalNode *pnode = pne->GetPhysicalNode();
- if(pnode) fM[i]=pnode->GetMatrix();
+ if(pnode) fM[i]=new TGeoHMatrix(*(pnode->GetMatrix()));
else {
fM[i]=new TGeoHMatrix;
IdealPosition(i,fM[i]);
AliStack *pStack=pAL->Stack();
if(tid==-1){ //print all tids for this event
for(Int_t i=0;i<pStack->GetNtrack();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);
+ 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();
return iCnt;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Double_t AliHMPIDParam::Sigma2(Double_t trkTheta,Double_t trkPhi,Double_t ckovTh, Double_t ckovPh)
+{
+// Analithical calculation of total error (as a sum of localization, geometrical and chromatic errors) on Cerenkov angle for a given Cerenkov photon
+// created by a given MIP. Fromulae according to CERN-EP-2000-058
+// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
+// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
+// MIP beta
+// Returns: absolute error on Cerenkov angle, [radians]
+
+ TVector3 v(-999,-999,-999);
+ Double_t trkBeta = 1./(TMath::Cos(ckovTh)*GetRefIdx());
+
+ if(trkBeta > 1) trkBeta = 1; //protection against bad measured thetaCer
+ if(trkBeta < 0) trkBeta = 0.0001; //
+
+ v.SetX(SigLoc (trkTheta,trkPhi,ckovTh,ckovPh,trkBeta));
+ v.SetY(SigGeom(trkTheta,trkPhi,ckovTh,ckovPh,trkBeta));
+ v.SetZ(SigCrom(trkTheta,trkPhi,ckovTh,ckovPh,trkBeta));
+
+ return v.Mag2();
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Double_t AliHMPIDParam::SigLoc(Double_t trkTheta,Double_t trkPhi,Double_t thetaC, Double_t phiC,Double_t betaM)
+{
+// Analitical calculation of localization error (due to finite segmentation of PC) on Cerenkov angle for a given Cerenkov photon
+// created by a given MIP. Fromulae according to CERN-EP-2000-058
+// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
+// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
+// MIP beta
+// Returns: absolute error on Cerenkov angle, [radians]
+
+ Double_t phiDelta = phiC - trkPhi;
+
+ Double_t sint = TMath::Sin(trkTheta);
+ Double_t cost = TMath::Cos(trkTheta);
+ Double_t sinf = TMath::Sin(trkPhi);
+ Double_t cosf = TMath::Cos(trkPhi);
+ Double_t sinfd = TMath::Sin(phiDelta);
+ Double_t cosfd = TMath::Cos(phiDelta);
+ Double_t tantheta = TMath::Tan(thetaC);
+
+ Double_t alpha =cost-tantheta*cosfd*sint; // formula (11)
+ Double_t k = 1.-GetRefIdx()*GetRefIdx()+alpha*alpha/(betaM*betaM); // formula (after 8 in the text)
+ if (k<0) return 1e10;
+ Double_t mu =sint*sinf+tantheta*(cost*cosfd*sinf+sinfd*cosf); // formula (10)
+ Double_t e =sint*cosf+tantheta*(cost*cosfd*cosf-sinfd*sinf); // formula (9)
+
+ Double_t kk = betaM*TMath::Sqrt(k)/(GapThick()*alpha); // formula (6) and (7)
+ Double_t dtdxc = kk*(k*(cosfd*cosf-cost*sinfd*sinf)-(alpha*mu/(betaM*betaM))*sint*sinfd); // formula (6)
+ Double_t dtdyc = kk*(k*(cosfd*sinf+cost*sinfd*cosf)+(alpha* e/(betaM*betaM))*sint*sinfd); // formula (7) pag.4
+
+ Double_t errX = 0.2,errY=0.25; //end of page 7
+ return TMath::Sqrt(errX*errX*dtdxc*dtdxc + errY*errY*dtdyc*dtdyc);
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Double_t AliHMPIDParam::SigCrom(Double_t trkTheta,Double_t trkPhi,Double_t thetaC, Double_t phiC,Double_t betaM)
+{
+// Analitical calculation of chromatic error (due to lack of knowledge of Cerenkov photon energy) on Cerenkov angle for a given Cerenkov photon
+// created by a given MIP. Fromulae according to CERN-EP-2000-058
+// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
+// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
+// MIP beta
+// Returns: absolute error on Cerenkov angle, [radians]
+
+ Double_t phiDelta = phiC - trkPhi;
+
+ Double_t sint = TMath::Sin(trkTheta);
+ Double_t cost = TMath::Cos(trkTheta);
+ Double_t cosfd = TMath::Cos(phiDelta);
+ Double_t tantheta = TMath::Tan(thetaC);
+
+ Double_t alpha =cost-tantheta*cosfd*sint; // formula (11)
+ Double_t dtdn = cost*GetRefIdx()*betaM*betaM/(alpha*tantheta); // formula (12)
+
+// Double_t f = 0.00928*(7.75-5.635)/TMath::Sqrt(12.);
+ Double_t f = 0.0172*(7.75-5.635)/TMath::Sqrt(24.);
+
+ return f*dtdn;
+}//SigCrom()
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Double_t AliHMPIDParam::SigGeom(Double_t trkTheta,Double_t trkPhi,Double_t thetaC, Double_t phiC,Double_t betaM)
+{
+// Analitical calculation of geometric error (due to lack of knowledge of creation point in radiator) on Cerenkov angle for a given Cerenkov photon
+// created by a given MIP. Formulae according to CERN-EP-2000-058
+// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
+// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
+// MIP beta
+// Returns: absolute error on Cerenkov angle, [radians]
+
+ Double_t phiDelta = phiC - trkPhi;
+
+ Double_t sint = TMath::Sin(trkTheta);
+ Double_t cost = TMath::Cos(trkTheta);
+ Double_t sinf = TMath::Sin(trkPhi);
+ Double_t cosfd = TMath::Cos(phiDelta);
+ Double_t costheta = TMath::Cos(thetaC);
+ Double_t tantheta = TMath::Tan(thetaC);
+
+ Double_t alpha =cost-tantheta*cosfd*sint; // formula (11)
+
+ Double_t k = 1.-GetRefIdx()*GetRefIdx()+alpha*alpha/(betaM*betaM); // formula (after 8 in the text)
+ if (k<0) return 1e10;
+
+ Double_t eTr = 0.5*RadThick()*betaM*TMath::Sqrt(k)/(GapThick()*alpha); // formula (14)
+ Double_t lambda = 1.-sint*sint*sinf*sinf; // formula (15)
+
+ Double_t c1 = 1./(1.+ eTr*k/(alpha*alpha*costheta*costheta)); // formula (13.a)
+ Double_t c2 = betaM*TMath::Power(k,1.5)*tantheta*lambda/(GapThick()*alpha*alpha); // formula (13.b)
+ Double_t c3 = (1.+eTr*k*betaM*betaM)/((1+eTr)*alpha*alpha); // formula (13.c)
+ Double_t c4 = TMath::Sqrt(k)*tantheta*(1-lambda)/(GapThick()*betaM); // formula (13.d)
+ Double_t dtdT = c1 * (c2+c3*c4);
+ Double_t trErr = RadThick()/(TMath::Sqrt(12.)*cost);
+
+ return trErr*dtdT;
+}//SigGeom()
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++