HMPID friends (Giacomo)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 24 Oct 2010 15:34:58 +0000 (15:34 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 24 Oct 2010 15:34:58 +0000 (15:34 +0000)
HMPID/AliHMPIDCluster.h
HMPID/AliHMPIDRecon.cxx
HMPID/AliHMPIDRecon.h
STEER/AliESDfriendTrack.cxx
STEER/AliESDfriendTrack.h
test/gun/rec.C

index c7a7914..337a89e 100644 (file)
@@ -63,6 +63,7 @@ public:
          void           SetY     (Double_t y                               ){fYY=y;}                                               // Setter
          void           SetSize  (Int_t size                               ){fSi=size;}                                            // Setter
          void           FindClusterSize(Int_t i,Int_t *pSigmaCut);                                                                 //Find the clusterSize of deconvoluted clusters 
+ virtual void          Clear(const Option_t*) { delete [] fDigs; fDigs=0; delete [] fParam; fParam=0; }
          
 protected:
   Int_t         fCh;          //chamber number
index 27069b2..9195dd6 100644 (file)
 #include <TH1D.h>            //HoughResponse()
 #include <TClonesArray.h>    //CkovAngle()
 #include <AliESDtrack.h>     //CkovAngle()
+#include <AliESDfriendTrack.h>     //CkovAngle()
 
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 AliHMPIDRecon::AliHMPIDRecon():
   TTask("RichRec","RichPat"),
   fPhotCnt(-1),
   fPhotFlag(0x0),
+  fPhotClusIndex(0x0),    
   fPhotCkov(0x0),
   fPhotPhi(0x0),
   fPhotWei(0x0),
@@ -62,6 +64,7 @@ void AliHMPIDRecon::InitVars(Int_t n)
 //..
   if(n<=0) return;
   fPhotFlag = new Int_t[n];
+  fPhotClusIndex  = new Int_t[n];
   fPhotCkov = new Double_t[n];
   fPhotPhi  = new Double_t[n];
   fPhotWei  = new Double_t[n];
@@ -74,6 +77,7 @@ void AliHMPIDRecon::DeleteVars()const
 //Delete variables
 //..
   delete [] fPhotFlag;
+  delete [] fPhotClusIndex;
   delete [] fPhotCkov;
   delete [] fPhotPhi;
   delete [] fPhotWei;
@@ -86,7 +90,9 @@ void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Int_t inde
 //              pCluLst  - list of clusters for this chamber   
 //   Returns:            - track ckov angle, [rad], 
     
-
+   
+  AliESDfriendTrack *pFriendTrk = (AliESDfriendTrack*)pTrk->GetFriendTrack();
+  
   const Int_t nMinPhotAcc = 3;                      // Minimum number of photons required to perform the pattern recognition
   
   Int_t nClusTot = pCluLst->GetEntries();
@@ -119,7 +125,8 @@ void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Int_t inde
     Double_t thetaCer,phiCer;
     if(FindPhotCkov(pClu->X(),pClu->Y(),thetaCer,phiCer)){                                    //find ckov angle for this  photon candidate
       fPhotCkov[fPhotCnt]=thetaCer;                                                           //actual theta Cerenkov (in TRS)
-      fPhotPhi [fPhotCnt]=phiCer;                                                             //actual phi   Cerenkov (in TRS): -pi to come back to "unusual" ref system (X,Y,-Z)
+      fPhotPhi [fPhotCnt]=phiCer;
+      fPhotClusIndex[fPhotCnt]=iClu;                                                             //actual phi   Cerenkov (in TRS): -pi to come back to "unusual" ref system (X,Y,-Z)
       fPhotCnt++;                                                                             //increment counter of photon candidates
     }
   }//clusters loop
@@ -127,29 +134,31 @@ void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Int_t inde
   pTrk->SetHMPIDmip(mipX,mipY,mipQ,fPhotCnt);                                                 //store mip info in any case 
   pTrk->SetHMPIDcluIdx(chId,index+1000*sizeClu);                                              //set index of cluster
   
-  if(fPhotCnt<nMinPhotAcc) {                                                                  //no reconstruction with <=3 photon candidates
+  if(fPhotCnt<=nMinPhotAcc) {                                                                 //no reconstruction with <=3 photon candidates
     pTrk->SetHMPIDsignal(kNoPhotAccept);                                                      //set the appropriate flag
     return;
   }
-  
-  
+    
   fMipPos.Set(mipX,mipY);
-  
+    
+  TClonesArray *pPhotCluLst = pFriendTrk->GetHmpPhotClus();
   
 //PATTERN RECOGNITION STARTED: 
   
-  Int_t iNrec=FlagPhot(HoughResponse());                                                      //flag photons according to individual theta ckov with respect to most probable
+  Int_t iNrec=FlagPhot(HoughResponse(),pCluLst,pPhotCluLst);                                                      //flag photons according to individual theta ckov with respect to most probable
+  
   pTrk->SetHMPIDmip(mipX,mipY,mipQ,iNrec);                                                    //store mip info 
 
-  if(iNrec<nMinPhotAcc){
+  if(iNrec<1){
     pTrk->SetHMPIDsignal(kNoPhotAccept);                                                      //no photon candidates are accepted
     return;
   }
+  
   Double_t thetaC = FindRingCkov(pCluLst->GetEntries());                                    //find the best reconstructed theta Cherenkov
 //    FindRingGeom(thetaC,2);
   pTrk->SetHMPIDsignal(thetaC);                                                             //store theta Cherenkov
   pTrk->SetHMPIDchi2(fCkovSigma2);                                                          //store errors squared
-
+  
   DeleteVars();
 }//CkovAngle()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -353,7 +362,7 @@ Double_t AliHMPIDRecon::FindRingCkov(Int_t)
   return weightThetaCerenkov;
 }//FindCkovRing()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Int_t AliHMPIDRecon::FlagPhot(Double_t ckov)
+Int_t AliHMPIDRecon::FlagPhot(Double_t ckov,TClonesArray *pCluLst, TClonesArray *pPhotCluLst)
 {
 // Flag photon candidates if their individual ckov angle is inside the window around ckov angle returned by  HoughResponse()
 // Arguments: ckov- value of most probable ckov angle for track as returned by HoughResponse()
@@ -362,6 +371,7 @@ Int_t AliHMPIDRecon::FlagPhot(Double_t ckov)
 // Photon Flag:  Flag = 0 initial set; 
 //               Flag = 1 good candidate (charge compatible with photon); 
 //               Flag = 2 photon used for the ring;
+  Int_t *PhotIndex = new Int_t[fPhotCnt];
   
   Int_t steps = (Int_t)((ckov )/ fDTheta); //how many times we need to have fDTheta to fill the distance between 0  and thetaCkovHough
 
@@ -376,10 +386,26 @@ Int_t AliHMPIDRecon::FlagPhot(Double_t ckov)
     fPhotFlag[i] = 0;
     if(fPhotCkov[i] >= tmin && fPhotCkov[i] <= tmax)   { 
       fPhotFlag[i]=2;    
+      PhotIndex[iInsideCnt]=fPhotClusIndex[i];
       iInsideCnt++;
     }
   }
+      
+  Int_t nPhot = 0;
+     
+  for (Int_t iClu=0; iClu<pCluLst->GetEntriesFast();iClu++){//clusters loop
+    AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluLst->UncheckedAt(iClu);                       //get pointer to current cluster
+    for(Int_t j=0; j<iInsideCnt; j++){
+      if(iClu==PhotIndex[j]) {
+      new ((*pPhotCluLst)[nPhot++]) AliHMPIDCluster(*pClu);  //add this raw cluster 
+     } 
+    }
+  } 
+                                                                                      
+  delete [] PhotIndex;
+  
   return iInsideCnt;
+  
 }//FlagPhot()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 TVector2 AliHMPIDRecon::TracePhot(Double_t ckovThe,Double_t ckovPhi)const
index 8b1f8dc..b0dcdc9 100644 (file)
@@ -33,7 +33,7 @@ public :
   Double_t FindRingCkov (Int_t iNclus                                                       );     //best ckov for ring formed by found photon candidates
   void     FindRingGeom (Double_t ckovAng,Int_t level=1                                     );     //estimated area of ring in cm^2 and portion accepted by geometry
   TVector2 IntWithEdge  (TVector2 p1,TVector2 p2                                            )const;//find intercection between plane and lines of 2 thetaC
-  Int_t    FlagPhot     (Double_t ckov                                                      );     //is photon ckov near most probable track ckov
+  Int_t    FlagPhot     (Double_t ckov,TClonesArray *pCluLst,TClonesArray *pPhotCluLst      );     //is photon ckov near most probable track ckov
   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
@@ -59,6 +59,7 @@ public :
 protected:
   Int_t     fPhotCnt;                           // counter of photons candidate
   Int_t    *fPhotFlag;                          // flags of photon candidates
+  Int_t    *fPhotClusIndex;                     // cluster index of photon candidates
   Double_t *fPhotCkov;                          // Ckov angles of photon candidates, [rad]
   Double_t *fPhotPhi;                           // phis of photons candidates, [rad]
   Double_t *fPhotWei;                           // weigths of photon candidates
@@ -81,7 +82,7 @@ private:
   AliHMPIDRecon(const AliHMPIDRecon& r);              //dummy copy constructor
   AliHMPIDRecon &operator=(const AliHMPIDRecon& r);   //dummy assignment operator
 //
-  ClassDef(AliHMPIDRecon,1)
+  ClassDef(AliHMPIDRecon,2)
 };
 
 #endif // #ifdef AliHMPIDRecon_cxx
index 508ffe2..f5b0ad6 100644 (file)
@@ -21,6 +21,7 @@
 #include "AliTrackPointArray.h"
 #include "AliESDfriendTrack.h"
 #include "TObjArray.h"
+#include "TClonesArray.h"
 #include "AliKalmanTrack.h"
 
 ClassImp(AliESDfriendTrack)
@@ -28,6 +29,7 @@ ClassImp(AliESDfriendTrack)
 AliESDfriendTrack::AliESDfriendTrack(): 
 TObject(), 
 f1P(0), 
+fHmpPhotClus(new TClonesArray("AliHMPIDCluster",1000)),
 fnMaxITScluster(0),
 fnMaxTPCcluster(0),
 fnMaxTRDcluster(0),
@@ -52,11 +54,15 @@ fTRDIn(0)
   //for (i=0; i<kMaxITScluster; i++) fITSindex[i]=-2;
   //for (i=0; i<kMaxTPCcluster; i++) fTPCindex[i]=-2;
   //for (i=0; i<kMaxTRDcluster; i++) fTRDindex[i]=-2;
+  
+  //fHmpPhotClus->SetOwner(kTRUE); 
+  
 }
 
 AliESDfriendTrack::AliESDfriendTrack(const AliESDfriendTrack &t): 
 TObject(t),
 f1P(t.f1P),
+fHmpPhotClus(t.fHmpPhotClus),        
 fnMaxITScluster(t.fnMaxITScluster),
 fnMaxTPCcluster(t.fnMaxTPCcluster),
 fnMaxTRDcluster(t.fnMaxTRDcluster),
@@ -106,6 +112,8 @@ fTRDIn(0)
   if (t.fITSOut) fITSOut = new AliExternalTrackParam(*(t.fITSOut));
   if (t.fTRDIn)  fTRDIn = new AliExternalTrackParam(*(t.fTRDIn));
 
+  fHmpPhotClus = new TClonesArray(*t.fHmpPhotClus);  
+  
 }
 
 AliESDfriendTrack::~AliESDfriendTrack() {
@@ -115,6 +123,7 @@ AliESDfriendTrack::~AliESDfriendTrack() {
    delete fPoints;
    if (fCalibContainer) fCalibContainer->Delete();
    delete fCalibContainer;
+   delete fHmpPhotClus;   
    delete fITStrack;
    delete fTRDtrack;
    delete fTPCOut;
@@ -167,6 +176,18 @@ void AliESDfriendTrack::SetTRDIn(const AliExternalTrackParam  &param)  {
   fTRDIn=new AliExternalTrackParam(param);
 } 
 
+
+void AliESDfriendTrack::SetHmpPhotClus(TClonesArray  *array)  {
+  //
+  // 
+  //
+  fHmpPhotClus->Clear("C");
+  for(Int_t iClu=0; iClu<array->GetEntriesFast(); iClu++){
+     TObject *pClu = (TObject*)array->UncheckedAt(iClu);
+     new ((*fHmpPhotClus)[iClu]) TObject(*pClu);
+  }
+}
+
 void AliESDfriendTrack::SetITSIndices(Int_t* indices, Int_t n){
 
        //
index 7e2acc6..3edfa97 100644 (file)
@@ -8,6 +8,7 @@
 //-------------------------------------------------------------------------
 
 #include <TObject.h>
+#include <TClonesArray.h>
 #include <AliExternalTrackParam.h>
 
 class AliTrackPointArray;
@@ -47,6 +48,8 @@ public:
   void SetITSOut(const AliExternalTrackParam &param);
   void SetTRDIn(const AliExternalTrackParam  &param);
   //
+  void SetHmpPhotClus(TClonesArray *array);
+  
   const AliExternalTrackParam * GetTPCOut() const {return  fTPCOut;} 
   const AliExternalTrackParam * GetITSOut() const {return fITSOut;} 
   const AliExternalTrackParam * GetTRDIn()  const {return fTRDIn;} 
@@ -59,12 +62,15 @@ public:
   Int_t GetMaxTPCcluster() {return fnMaxTPCcluster;}
   Int_t GetMaxTRDcluster() {return fnMaxTRDcluster;}
 
+  TClonesArray *GetHmpPhotClus() const {return fHmpPhotClus;}   
+  
   // bit manipulation for filtering
   void SetSkipBit(Bool_t skip){SetBit(23,skip);}
   Bool_t TestSkipBit() {return TestBit(23);}
 
 protected:
   Float_t f1P;                     // 1/P (1/(GeV/c))
+  TClonesArray *fHmpPhotClus; // TClonesArray of reconstructed photon clusters  
   Int_t fnMaxITScluster; // Max number of ITS clusters
   Int_t fnMaxTPCcluster; // Max number of TPC clusters
   Int_t fnMaxTRDcluster; // Max number of TRD clusters
@@ -85,7 +91,7 @@ protected:
 private:
   AliESDfriendTrack &operator=(const AliESDfriendTrack & /* t */) {return *this;}
 
-  ClassDef(AliESDfriendTrack,4) //ESD friend track
+  ClassDef(AliESDfriendTrack,5) //ESD friend track
 };
 
 #endif
index e5b3ba9..574df50 100644 (file)
@@ -9,6 +9,8 @@ void rec() {
                          Form("local://%s",gSystem->pwd()));
   reco.SetRunPlaneEff(kTRUE);
 
+  reco.SetFractionFriends(1.);
+
   TStopwatch timer;
   timer.Start();
   reco.Run();