]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/AliHMPIDTracker.cxx
Default run number from CDB. Using directly the clusters from AliHMPIDTracker
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDTracker.cxx
index 1b3e4f5b7338747278ecdd42abc0764e456a62e1..d479ae72e5b602cbc26038cae53dc4a441084570 100644 (file)
@@ -6,7 +6,18 @@
 #include <AliRun.h>              //GetTrackPoint(),PropagateBack()  
 #include <AliTrackPointArray.h>  //GetTrackPoint()
 #include <AliAlignObj.h>         //GetTrackPoint()
 #include <AliRun.h>              //GetTrackPoint(),PropagateBack()  
 #include <AliTrackPointArray.h>  //GetTrackPoint()
 #include <AliAlignObj.h>         //GetTrackPoint()
+#include <AliCDBManager.h>
+#include <AliCDBEntry.h>
+
 ClassImp(AliHMPIDTracker)
 ClassImp(AliHMPIDTracker)
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+AliHMPIDTracker::AliHMPIDTracker():AliTracker()
+{
+// ctor
+  fClu=new TObjArray(AliHMPIDDigit::kMaxCh+1);
+  fClu->SetOwner(kTRUE);
+  for(int i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++) fClu->AddAt(new TClonesArray("AliHMPIDCluster"),i);
+}
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++    
 Bool_t AliHMPIDTracker::GetTrackPoint(Int_t idx, AliTrackPoint& point) const
 {
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++    
 Bool_t AliHMPIDTracker::GetTrackPoint(Int_t idx, AliTrackPoint& point) const
 {
@@ -19,8 +30,8 @@ Bool_t AliHMPIDTracker::GetTrackPoint(Int_t idx, AliTrackPoint& point) const
   Int_t iCham=idx/1000000;
   Int_t iClu=idx%1000000;
   point.SetVolumeID(AliAlignObj::LayerToVolUID(AliAlignObj::kHMPID,iCham-1));//layer and chamber number
   Int_t iCham=idx/1000000;
   Int_t iClu=idx%1000000;
   point.SetVolumeID(AliAlignObj::LayerToVolUID(AliAlignObj::kHMPID,iCham-1));//layer and chamber number
-  AliHMPID *pRich=((AliHMPID*)gAlice->GetDetector("HMPID"));  
-  AliHMPIDCluster *pClu=(AliHMPIDCluster*)pRich->CluLst(iCham)->UncheckedAt(iClu);//get pointer to cluster
+  TClonesArray *pArr=(TClonesArray*)(*fClu)[iCham];
+  AliHMPIDCluster *pClu=(AliHMPIDCluster*)pArr->UncheckedAt(iClu);//get pointer to cluster
   Double_t mars[3];
   AliHMPIDParam::Instance()->Lors2Mars(iCham,pClu->X(),pClu->Y(),mars);
   point.SetXYZ(mars[0],mars[1],mars[2]);
   Double_t mars[3];
   AliHMPIDParam::Instance()->Lors2Mars(iCham,pClu->X(),pClu->Y(),mars);
   point.SetXYZ(mars[0],mars[1],mars[2]);
@@ -32,50 +43,69 @@ Int_t AliHMPIDTracker::LoadClusters(TTree *pCluTree)
 // Interface callback methode invoked from AliReconstruction::RunTracking() to load HMPID clusters before PropagateBack() gets control 
 // Arguments: pCluTree- pointer to clusters tree got by AliHMPIDLoader::LoadRecPoints("read") then AliHMPIDLoader::TreeR()
 //   Returns: error code (currently ignored in AliReconstruction::RunTraking())    
 // Interface callback methode invoked from AliReconstruction::RunTracking() to load HMPID clusters before PropagateBack() gets control 
 // Arguments: pCluTree- pointer to clusters tree got by AliHMPIDLoader::LoadRecPoints("read") then AliHMPIDLoader::TreeR()
 //   Returns: error code (currently ignored in AliReconstruction::RunTraking())    
-  AliDebug(1,"Start.");  pCluTree->GetEntry(0);  AliDebug(1,"Stop."); return 0;
+  AliDebug(1,"Start.");
+  for(int i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++) pCluTree->SetBranchAddress(Form("HMPID%d",i),&((*fClu)[i]));
+  pCluTree->GetEntry(0);
+  AliDebug(1,"Stop."); 
+  return 0;  
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Int_t AliHMPIDTracker::Recon(AliESD *pESD,TObjArray *pCluAll)
+Int_t AliHMPIDTracker::PropagateBack(AliESD *pEsd)
 {
 {
-// Interface callback methode invoked by AliRecontruction::RunTracking() during tracking after TOF. It's done just once per event
-// Arguments: pESD - pointer to Event Summary Data class instance which contains a list of tracks
+// This method defined as pure virtual in AliTracker. It is invoked from AliReconstruction::RunTracking() after invocation of AliTracker::LoadClusters()
+// Agruments: pEsd - pointer to ESD
+//   Returns: error code    
+  AliCDBEntry *pNmeanEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Nmean"); //contains TObjArray of 21 TF1
+  AliCDBEntry *pQthreEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Qthre"); //contains TObjArray of 7 TF1
+  if(!pNmeanEnt) AliFatal("No Nmean C6F14 ");
+  if(!pQthreEnt) AliFatal("No Qthre");
+    
+  return Recon(pEsd,fClu,(TObjArray*)pNmeanEnt->GetObject());  
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Int_t AliHMPIDTracker::Recon(AliESD *pEsd,TObjArray *pCluAll,TObjArray *pNmean)
+{
+// Interface callback method invoked by AliRecontruction::RunTracking() during tracking after TOF. It's done just once per event
+// Arguments: pEsd - pointer to Event Summary Data class instance which contains a list of tracks
 //   Returns: error code, 0 if no errors   
 //   Returns: error code, 0 if no errors   
-  Int_t iNtracks=pESD->GetNumberOfTracks();  AliDebugClass(1,Form("Start with %i tracks",iNtracks));
+  Int_t iNtracks=pEsd->GetNumberOfTracks();  AliDebugClass(1,Form("Start with %i tracks",iNtracks));
   
   
-  AliHMPIDRecon recon;                                                                           //instance of reconstruction class, nothing important in ctor
-  Float_t xRa,yRa;
+  AliHMPIDRecon recon;                                                                       //instance of reconstruction class, nothing important in ctor
+  Double_t xPc,yPc;
   for(Int_t iTrk=0;iTrk<iNtracks;iTrk++){                                                        //ESD tracks loop
   for(Int_t iTrk=0;iTrk<iNtracks;iTrk++){                                                        //ESD tracks loop
-    AliESDtrack *pTrk = pESD->GetTrack(iTrk);                                                    //get next reconstructed track    
-    Int_t cham=IntTrkCha(pTrk,xRa,yRa);                                                          //get chamber intersected by thie track 
+    AliESDtrack *pTrk = pEsd->GetTrack(iTrk);                                                    //get next reconstructed track    
+    Int_t cham=IntTrkCha(pTrk,xPc,yPc);                                                          //get chamber intersected by this track 
     if(cham<0) continue;                                                                         //no intersection at all, go after next track
     if(cham<0) continue;                                                                         //no intersection at all, go after next track
-    recon.CkovAngle(pTrk,(TClonesArray *)pCluAll->At(cham));                                     //search for Cerenkov angle for this track
+    Double_t nmean=((TF1*)pNmean->At(3*cham))->Eval(pEsd->GetTimeStamp());                       //C6F14 Nmean for this chamber
+    recon.SetImpPC(xPc,yPc);                                                                     //store track impact to PC
+    recon.CkovAngle(pTrk,(TClonesArray *)pCluAll->At(cham),nmean);                               //search for Cerenkov angle of this track
   }                                                                                              //ESD tracks loop
   AliDebugClass(1,"Stop pattern recognition");
   return 0; // error code: 0=no error;
 }//PropagateBack()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   }                                                                                              //ESD tracks loop
   AliDebugClass(1,"Stop pattern recognition");
   return 0; // error code: 0=no error;
 }//PropagateBack()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Int_t AliHMPIDTracker::IntTrkCha(AliESDtrack *pTrk,Float_t &xRa,Float_t &yRa)
+Int_t AliHMPIDTracker::IntTrkCha(AliESDtrack *pTrk,Double_t &xToPc,Double_t &yToPc)
 {
 // Static method to find intersection in between given track and HMPID chambers
 // Arguments: pTrk    - ESD track 
 {
 // Static method to find intersection in between given track and HMPID chambers
 // Arguments: pTrk    - ESD track 
-//            xRa,yRa - track intersection with the middle of radiator, LORS
+//            xPc,yPc - track intersection with PC, LORS
 //   Returns: intersected chamber ID or -1
   
   AliHMPIDParam *pParam=AliHMPIDParam::Instance();
 //   Returns: intersected chamber ID or -1
   
   AliHMPIDParam *pParam=AliHMPIDParam::Instance();
-  Float_t xPc=0,yPc=0,th=0,ph=0;                                                                //track intersection point and angles, LORS  
-  for(Int_t i=0;i<7;i++){                                                                       //chambers loop
+  Float_t xRa=0,yRa=0,xPc=0,yPc=0,theta=0,phi=0;                                                //track intersection point and angles, LORS  
+  for(Int_t i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++){                              //chambers loop
     Double_t p1[3],n1[3]; pParam->Norm(i,n1); pParam->Lors2Mars(i,0,0,p1,AliHMPIDParam::kRad);  //point & norm  for RAD
     Double_t p2[3],n2[3]; pParam->Norm(i,n2); pParam->Lors2Mars(i,0,0,p2,AliHMPIDParam::kPc);   //point & norm  for PC
       
     if(pTrk->Intersect(p1,n1,-GetBz())==kFALSE) continue;                                       //try to intersect track with the middle of radiator
     if(pTrk->Intersect(p2,n2,-GetBz())==kFALSE) continue;                                       //try to intersect track with PC
       
     Double_t p1[3],n1[3]; pParam->Norm(i,n1); pParam->Lors2Mars(i,0,0,p1,AliHMPIDParam::kRad);  //point & norm  for RAD
     Double_t p2[3],n2[3]; pParam->Norm(i,n2); pParam->Lors2Mars(i,0,0,p2,AliHMPIDParam::kPc);   //point & norm  for PC
       
     if(pTrk->Intersect(p1,n1,-GetBz())==kFALSE) continue;                                       //try to intersect track with the middle of radiator
     if(pTrk->Intersect(p2,n2,-GetBz())==kFALSE) continue;                                       //try to intersect track with PC
       
-    pParam->Mars2LorsVec(i,n1,th,ph);                                                           //track angles
+    pParam->Mars2LorsVec(i,n1,theta,phi);                                                       //track angles at RAD
     pParam->Mars2Lors   (i,p1,xRa,yRa);                                                         //TRKxRAD position
     pParam->Mars2Lors   (i,p2,xPc,yPc);                                                         //TRKxPC position
     pParam->Mars2Lors   (i,p1,xRa,yRa);                                                         //TRKxRAD position
     pParam->Mars2Lors   (i,p2,xPc,yPc);                                                         //TRKxPC position
-      
-    if(AliHMPIDDigit::IsInside(xPc,yPc)==kFALSE) continue;                                      //not in active area  
-    pTrk->SetHMPIDtrk      (xPc,yPc,th,ph);                                                     //store track intersection info
+    xToPc=(Double_t)xPc;yToPc=(Double_t)yPc;                                                    //conversion float->double only
+    if(AliHMPIDDigit::IsInside(xPc,yPc,pParam->DistCut())==kFALSE) continue;             //not in active area  
+    pTrk->SetHMPIDtrk      (xRa,yRa,theta,phi);                                                 //store track intersection info
     pTrk->SetHMPIDcluIdx   (i,0);
     return i;
   }                                                                                             //chambers loop
     pTrk->SetHMPIDcluIdx   (i,0);
     return i;
   }                                                                                             //chambers loop