Theta Cerenkov fixed + minors
authordibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Mar 2007 23:07:49 +0000 (23:07 +0000)
committerdibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Mar 2007 23:07:49 +0000 (23:07 +0000)
HMPID/AliHMPIDRecon.cxx
HMPID/AliHMPIDRecon.h
HMPID/AliHMPIDTracker.cxx
HMPID/Hdisp.C

index 804bb8e..7ec9a93 100644 (file)
@@ -34,6 +34,8 @@ const Double_t AliHMPIDRecon::fgkGapThick=8.0;
 const Double_t AliHMPIDRecon::fgkWinIdx  =1.5787;
 const Double_t AliHMPIDRecon::fgkGapIdx  =1.0005;
 
+Double_t xRad;
+Double_t yRad;
 
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 AliHMPIDRecon::AliHMPIDRecon():TTask("RichRec","RichPat"),
@@ -54,7 +56,7 @@ AliHMPIDRecon::AliHMPIDRecon():TTask("RichRec","RichPat"),
   }
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t nmean)
+void AliHMPIDRecon::CkovAngle(Double_t xRa,Double_t yRa,AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t nmean)
 {
 // Pattern recognition method based on Hough transform
 // Arguments:   pTrk     - track for which Ckov angle is to be found
@@ -68,8 +70,8 @@ void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t n
   Float_t xPc,yPc,th,ph;      pTrk->GetHMPIDtrk(xPc,yPc,th,ph);  SetTrack(xPc,yPc,th,ph); //initialize this track            
   fRadNmean=nmean;
 
-  
-  
+  xRad=xRa;yRad=yRa;  
+
   Float_t dMin=999,mipX=-1,mipY=-1;Int_t chId=-1,mipId=-1,mipQ=-1;                                                                           
   fPhotCnt=0;                                                      
   for (Int_t iClu=0; iClu<pCluLst->GetEntriesFast();iClu++){//clusters loop
@@ -110,10 +112,10 @@ Double_t AliHMPIDRecon::FindPhotCkov(Double_t cluX,Double_t cluY)
   while(1){
     if(iIterCnt>=50) return -1;
     Double_t ckov=0.5*(ckov1+ckov2);
-    Double_t dist=cluR-TracePhot(ckov,phi,pos); iIterCnt++;   //get distance between trial point and cluster position
+    Double_t dist=cluR-TracePhot(xRad,yRad,ckov,phi,pos); iIterCnt++;   //get distance between trial point and cluster position
     if     (dist> kTol) ckov1=ckov;                           //cluster @ larger ckov 
     else if(dist<-kTol) ckov2=ckov;                           //cluster @ smaller ckov
-    else                return ckov;                          //precision achived         
+    else return ckov;                                         //precision achived
   }
 }//FindPhotTheta()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -121,9 +123,10 @@ Double_t AliHMPIDRecon::FindPhotPhi(Double_t cluX,Double_t cluY)
 {
 // Finds phi angle og photon candidate by considering the cluster's position  of this candudate w.r.t track position
   
-  Double_t emiss=0; 
-  return fPhotPhi[fPhotCnt]=TMath::ATan2(cluY-fTrkPos.Y()-emiss*TMath::Tan(fTrkDir.Theta())*TMath::Sin(fTrkDir.Phi()),
-                                         cluX-fTrkPos.X()-emiss*TMath::Tan(fTrkDir.Theta())*TMath::Cos(fTrkDir.Phi()));
+//  Double_t emiss=0; 
+//  return fPhotPhi[fPhotCnt]=TMath::ATan2(cluY-fTrkPos.Y()-emiss*TMath::Tan(fTrkDir.Theta())*TMath::Sin(fTrkDir.Phi()),
+//                                         cluX-fTrkPos.X()-emiss*TMath::Tan(fTrkDir.Theta())*TMath::Cos(fTrkDir.Phi()));
+  return fPhotPhi[fPhotCnt]=TMath::ATan2(cluY-yRad,cluX-xRad)-(TMath::Pi()+fTrkDir.Phi());
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Double_t AliHMPIDRecon::FindRingArea(Double_t ckovAng)const
@@ -138,10 +141,9 @@ Double_t AliHMPIDRecon::FindRingArea(Double_t ckovAng)const
   const Int_t kN=100;
   Double_t area=0;
   for(Int_t i=0;i<kN;i++){
-    TracePhot(ckovAng,Double_t(TMath::TwoPi()*i    /kN),pos1);//trace this photon 
-    TracePhot(ckovAng,Double_t(TMath::TwoPi()*(i+1)/kN),pos2);//trace this photon 
-    area+=(pos1-fTrkPos)*(pos2-fTrkPos);
-      
+    TracePhot(xRad,yRad,ckovAng,Double_t(TMath::TwoPi()*i    /kN),pos1);//trace this photon 
+    TracePhot(xRad,yRad,ckovAng,Double_t(TMath::TwoPi()*(i+1)/kN),pos2);//trace this photon 
+    area+=(pos1-fTrkPos)*(pos2-fTrkPos);      
   }
   return area;
 }//FindRingArea()
@@ -202,7 +204,7 @@ Int_t AliHMPIDRecon::FlagPhot(Double_t ckov)
   return iInsideCnt;
 }//FlagPhot()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Double_t AliHMPIDRecon::TracePhot(Double_t ckovThe,Double_t ckovPhi,TVector2 &pos)const
+Double_t AliHMPIDRecon::TracePhot(Double_t x,Double_t y,Double_t ckovThe,Double_t ckovPhi,TVector2 &pos)const
 {
 // Trace a single Ckov photon from emission point somewhere in radiator up to photocathode taking into account ref indexes of materials it travereses
 // Arguments: ckovThe,ckovPhi- photon ckov angles, [rad]  (warning: not photon theta and phi)     
@@ -210,19 +212,17 @@ Double_t AliHMPIDRecon::TracePhot(Double_t ckovThe,Double_t ckovPhi,TVector2 &po
   TRotation mtheta;   mtheta.RotateY(fTrkDir.Theta());
   TRotation mphi;       mphi.RotateZ(fTrkDir.Phi());  
   TRotation mrot=mphi*mtheta;
-  
-  TVector3  posCkov(fTrkPos.X(),fTrkPos.Y(),-0.5*fgkRadThick-fgkWinThick-fgkGapThick);   //RAD: photon position is track position @ middle of RAD 
-  TVector3  dirCkov;   dirCkov.SetMagThetaPhi(1,ckovThe,ckovPhi);                        //initially photon is directed according to requested ckov angle
-                                               dirCkov=mrot*dirCkov;                     //now we know photon direction in LORS
-                       dirCkov.SetPhi(ckovPhi);   
+//  TVector3  posCkov(fTrkPos.X(),fTrkPos.Y(),-0.5*fgkRadThick-fgkWinThick-fgkGapThick);   //RAD: photon position is track position @ middle of RAD 
+  TVector3  posCkov(x,y,-0.5*fgkRadThick-fgkWinThick-fgkGapThick);                                                  //RAD: photon position is track position @ middle of RAD 
+  TVector3  dirCkov,dirCkovTors;   dirCkovTors.SetMagThetaPhi(1,ckovThe,ckovPhi);          //initially photon is directed according to requested ckov angle
+                                               dirCkov=mrot*dirCkovTors;                   //now we know photon direction in LORS
+//  dirCkov.SetPhi(ckovPhi);  
   if(dirCkov.Theta() > TMath::ASin(1./fRadNmean)) return -999;//total refraction on WIN-GAP boundary
-  
-  Propagate(dirCkov,posCkov,-fgkWinThick-fgkGapThick); //go to RAD-WIN boundary  remeber that z=0 is PC plane
-  Refract  (dirCkov,         fRadNmean,fgkWinIdx    ); //RAD-WIN refraction
-  Propagate(dirCkov,posCkov,-fgkGapThick           );  //go to WIN-GAP boundary
-  Refract  (dirCkov,         fgkWinIdx,fgkGapIdx    ); //WIN-GAP refraction
-  Propagate(dirCkov,posCkov,0                     );   //go to PC
-  
+  Propagate(dirCkov,posCkov,-fgkWinThick-fgkGapThick);                           //go to RAD-WIN boundary  
+  Refract  (dirCkov,         fRadNmean,fgkWinIdx    );              //RAD-WIN refraction
+  Propagate(dirCkov,posCkov,            -fgkGapThick);              //go to WIN-GAP boundary
+  Refract  (dirCkov,         fgkWinIdx,fgkGapIdx    );              //WIN-GAP refraction
+  Propagate(dirCkov,posCkov,                       0);   //go to PC
   pos.Set(posCkov.X(),posCkov.Y());
   return (pos-fTrkPos).Mod();
 }//TracePhoton()
index b9ec332..1f60a45 100644 (file)
@@ -26,7 +26,7 @@ public :
     virtual ~AliHMPIDRecon()                                                          {}
 
   
-  void     CkovAngle    (AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t nmean             );                           //reconstructed Theta Cerenkov
+  void     CkovAngle    (Double_t xRa,Double_t yRa,AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t nmean); //reconstructed Theta Cerenkov
   Double_t FindPhotCkov (Double_t cluX,Double_t cluY                                        );     //find ckov angle for single photon candidate
   Double_t FindPhotPhi  (Double_t cluX,Double_t cluY                                        );     //find phi angle for single photon candidate
   Double_t FindRingCkov (Int_t iNclus                                                       );     //best ckov for ring formed by found photon candidates
@@ -35,19 +35,20 @@ public :
   Double_t HoughResponse(                                                                   );     //most probable track ckov angle
   void     Propagate    (const TVector3 &dir,      TVector3 &pos,Double_t z                 )const;//propagate photon alogn the line  
   void     Refract      (      TVector3 &dir,                    Double_t n1,    Double_t n2)const;//refract photon on the boundary
-  Double_t TracePhot    (Double_t ckovTh,Double_t ckovPh,TVector2 &pos                      )const;//trace photon created by track to PC 
+  Double_t TracePhot    (Double_t x,Double_t y,Double_t ckovTh,Double_t ckovPh,TVector2 &pos)const;//trace photon created by track to PC 
   void     SetTrack     (Double_t x,Double_t y,Double_t theta,Double_t phi                  ){fTrkDir.SetMagThetaPhi(1,theta,phi);  fTrkPos.Set(x,y);}//set track
   Double_t SigLoc       (Double_t ckovTh,Double_t ckovPh,Double_t beta                      )const;//error due to cathode segmetation
   Double_t SigGeom      (Double_t ckovTh,Double_t ckovPh,Double_t beta                      )const;//error due to unknown photon origin
   Double_t SigCrom      (Double_t ckovTh,Double_t ckovPh,Double_t beta                      )const;//error due to unknonw photon energy
   Double_t Sigma2       (Double_t ckovTh,Double_t ckovPh                                    )const;//photon candidate sigma
   enum ETrackingFlags {kMipDistCut=-9,kMipQdcCut=-5,kNoPhotAccept=-11};
-protected:
+  
   static const Double_t fgkRadThick;                      //radiator thickness
   static const Double_t fgkWinThick;                      //window thickness
   static const Double_t fgkGapThick;                      //proximity gap thickness
   static const Double_t fgkWinIdx;                        //mean refractive index of WIN material (SiO2) 
   static const Double_t fgkGapIdx;                        //mean refractive index of GAP material (CH4)
+protected:
   Double_t fRadNmean;                          //C6F14 mean refractive index
   Int_t    fPhotCnt;                           // counter of photons candidate
   Int_t    fPhotFlag[3000];                    // flags of photon candidates
index 2ed03e7..e35f860 100644 (file)
@@ -68,7 +68,7 @@ Int_t AliHMPIDTracker::Recon(AliESD *pEsd,TObjArray *pCluAll,TObjArray *pNmean)
     Int_t cham=IntTrkCha(pTrk,xRa,yRa);                                                          //get chamber intersected by thie track 
     if(cham<0) continue;                                                                         //no intersection at all, go after next track
     Double_t nmean=((TF1*)pNmean->At(3*cham))->Eval(pEsd->GetTimeStamp());                       //C6F14 Nmean for this chamber   
-    recon.CkovAngle(pTrk,(TClonesArray *)pCluAll->At(cham),nmean);                               //search for Cerenkov angle for this track
+    recon.CkovAngle((Double_t)xRa,(Double_t)yRa,pTrk,(TClonesArray *)pCluAll->At(cham),nmean);                               //search for Cerenkov angle for this track
   }                                                                                              //ESD tracks loop
   AliDebugClass(1,"Stop pattern recognition");
   return 0; // error code: 0=no error;
index f23be7f..69e1e5a 100644 (file)
@@ -145,7 +145,6 @@ void DrawCh(Int_t iCh)
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void DrawEvt(TClonesArray *pHitLst,TObjArray *pDigLst,TObjArray *pCluLst,AliESD *pEsd)
 {//draws all the objects of current event in given canvas
-
   AliHMPIDRecon rec;  
   TPolyMarker *pTxC[7], *pRin[7]; TMarker *pMip,*pCko,*pFee,*pDig,*pClu;
   pMip=new TMarker; pMip->SetMarkerColor(kRed);  pMip->SetMarkerStyle(kOpenTriangleUp);
@@ -168,10 +167,16 @@ void DrawEvt(TClonesArray *pHitLst,TObjArray *pDigLst,TObjArray *pCluLst,AliESD
     
     Float_t ckov=pTrk->GetHMPIDsignal();  Float_t err=TMath::Sqrt(pTrk->GetHMPIDchi2());
     if(ckov>0){
-      rec.SetTrack(xPc,yPc,th,ph);
-      TVector2 pos;  
-      for(int j=0;j<100;j++){
-       rec.TracePhot(ckov,j*0.0628,pos); 
+      Printf("theta %f phi %f ckov %f",th*TMath::RadToDeg(),ph*TMath::RadToDeg(),ckov);
+      rec.SetTrack(xPc,yPc,th,ph+TMath::Pi());
+      TVector2 pos;
+       Double_t allGapz=rec.fgkWinThick+0.5*rec.fgkRadThick+rec.fgkGapThick;   //to semplify, the (x,y) are calculted from (xPc,yPc) back to radiator in straight line (Bz=0)
+      TVector3 dir(0,0,-1);TVector3 miprad(xPc,yPc,allGapz);
+      AliHMPIDRecon::Propagate(dir,miprad,0);
+      Double_t xRad=miprad.X();
+      Double_t yRad=miprad.Y();
+      for(int j=0;j<100;j++){ 
+        rec.TracePhot(xRad,yRad,ckov,j*0.0628,pos);
        if(!AliHMPIDDigit::IsInDead(pos.X(),pos.Y())) pRin[ch]->SetNextPoint(pos.X(),pos.Y());
       }      
     }