]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/AliHMPIDReconstructor.cxx
Updated to version 5.3.1
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDReconstructor.cxx
index e040af2da0f5f6e99577b7ebcee349f3bc75ac71..8f1c993c073a7fdd7546b285e022af0132266b29 100644 (file)
@@ -43,8 +43,8 @@ AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor(),fUserCut(0),fD
   fDig=new TObjArray(AliHMPIDParam::kMaxCh+1); fDig->SetOwner(kTRUE);
   
   for(int i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++){ 
-    fDig->AddAt(new TClonesArray("AliHMPIDDigit"),i);
-    TClonesArray *pClus = new TClonesArray("AliHMPIDCluster");
+    fDig->AddAt(new TClonesArray("AliHMPIDDigit",24000),i);
+    TClonesArray *pClus = new TClonesArray("AliHMPIDCluster",24000);
     pClus->SetUniqueID(i);
     fClu->AddAt(pClus,i);
   }
@@ -53,7 +53,7 @@ AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor(),fUserCut(0),fD
   {
       for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) {
       fUserCut[iCh] = fgkRecoParam->GetUserCut(iCh);
-      Printf("HMPID: UserCut successfully loaded (from RecoParam) for chamber %i -> %i ",iCh,fUserCut[iCh]);
+      AliDebug(1,Form("UserCut successfully loaded (from RecoParam) for chamber %i -> %i ",iCh,fUserCut[iCh]));
    }
   }  
   else {
@@ -62,16 +62,30 @@ AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor(),fUserCut(0),fD
     TObjArray *pUserCut = (TObjArray*)pUserCutEnt->GetObject(); 
     for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){                  //chambers loop 
       fUserCut[iCh] = pUserCut->At(iCh)->GetUniqueID();
-      Printf("HMPID: UserCut successfully loaded (from OCDB) for chamber %i -> %i ",iCh,fUserCut[iCh]);
+      AliDebug(1,Form("UserCut successfully loaded (from OCDB) for chamber %i -> %i ",iCh,fUserCut[iCh]));
     }
    }
   }
-   
+
+  AliCDBEntry *pQthreEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Qthre"); //contains TObjArray of 7 TF1
+  if(!pQthreEnt) AliFatal("No Qthre available");
+  TObjArray *pQthre = (TObjArray*)pQthreEnt->GetObject();
+  for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) {
+    for(Int_t isec=0;isec<=5;isec++) {
+     TF1 *pfQthre = (TF1*)pQthre->At(6*iCh+isec); 
+     Double_t tMin,tMax;
+     pfQthre->GetRange(tMin,tMax);
+     Double_t qthre=pfQthre->Eval(tMin);
+     AliDebug(1,Form("Qthre successfully loaded for chamber %i  sector %i -> %f ",iCh,isec,qthre));
+    }
+  }
+
+     
   AliCDBEntry *pDaqSigEnt =AliCDBManager::Instance()->Get("HMPID/Calib/DaqSig");  //contains TObjArray of TObjArray 14 TMatrixF sigmas values for pads 
   if(!pDaqSigEnt) AliFatal("No pedestals from DAQ!");
   fDaqSig = (TObjArray*)pDaqSigEnt->GetObject();
   for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){                  //chambers loop 
-    Printf(" HMPID: DaqSigCut successfully loaded for chamber %i -> %i ",iCh,(Int_t)fDaqSig->At(iCh)->GetUniqueID());
+    AliDebug(1,Form("DaqSigCut successfully loaded for chamber %i -> %i ",iCh,(Int_t)fDaqSig->At(iCh)->GetUniqueID()));
   }
 }//AliHMPIDReconstructor
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -136,7 +150,7 @@ void AliHMPIDReconstructor::Reconstruct(TTree *pDigTree,TTree *pCluTree)const
 //  Returns: none    
   AliDebug(1,"Start.");
   for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) {
-    pCluTree->Branch(Form("HMPID%d",iCh),&((*fClu)[iCh]),4000,0);
+    pCluTree->Branch(Form("HMPID%d",iCh),&((*fClu)[iCh]),7);
     pDigTree->SetBranchAddress(Form("HMPID%d",iCh),&((*fDig)[iCh]));
   }   
   pDigTree->GetEntry(0);
@@ -160,31 +174,24 @@ void AliHMPIDReconstructor::ConvertDigits(AliRawReader *pRR,TTree *pDigTree)cons
   AliDebug(1,"Start.");
 //  Int_t digcnt=0;
   
+  Int_t iDigCnt[7]={0,0,0,0,0,0,0};
 
-  for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) {
-    pDigTree->Branch(Form("HMPID%d",iCh),&((*fDig)[iCh]),4000,0); 
+  for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
+    pDigTree->Branch(Form("HMPID%d",iCh),&((*fDig)[iCh]));
+  }
     
-    Int_t iDigCnt=0;
-    AliHMPIDRawStream stream(pRR);    
-    while(stream.Next())
-    {
-      
-      UInt_t ddl=stream.GetDDLNumber(); //returns 0,1,2 ... 13
-      if((UInt_t)(2*iCh)==ddl || (UInt_t)(2*iCh+1)==ddl) {
-       for(Int_t row = 1; row <= AliHMPIDRawStream::kNRows; row++){
-        for(Int_t dil = 1; dil <= AliHMPIDRawStream::kNDILOGICAdd; dil++){
-          for(Int_t pad = 0; pad < AliHMPIDRawStream::kNPadAdd; pad++){
-            if(stream.GetCharge(ddl,row,dil,pad) < 1) continue; 
-              AliHMPIDDigit dig(stream.GetPad(ddl,row,dil,pad),stream.GetCharge(ddl,row,dil,pad));
-              if(!IsDigSurvive(&dig)) continue; 
-              new((*((TClonesArray*)fDig->At(iCh)))[iDigCnt++]) AliHMPIDDigit(dig); //add this digit to the tmp list 
-            }//pad
-          }//dil
-        }//row
-      }//while
+  AliHMPIDRawStream stream(pRR);    
+  
+  while(stream.Next())
+  {
+    Int_t ch = AliHMPIDParam::DDL2C(stream.GetDDLNumber());
+    for(Int_t iPad=0;iPad<stream.GetNPads();iPad++) {
+      AliHMPIDDigit dig(stream.GetPadArray()[iPad],stream.GetChargeArray()[iPad]);
+      if(!IsDigSurvive(&dig)) continue; 
+      new((*((TClonesArray*)fDig->At(ch)))[iDigCnt[ch]++]) AliHMPIDDigit(dig); //add this digit to the tmp list 
     }
-    stream.Delete();
   }
+  
   pDigTree->Fill();
   
   for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++)fDig->At(iCh)->Clear();
@@ -197,9 +204,13 @@ void AliHMPIDReconstructor::FillESD(TTree */*digitsTree*/, TTree */*clustersTree
 // Fill ESD with all the infos from HMPID
 // Probability vector from AliHMPIDPid
 //...
+  AliHMPIDPid pID;
+  Double_t prob[AliPID::kSPECIES];
+  
+  for(Int_t iTrk=0;iTrk<pESD->GetNumberOfTracks();iTrk++){//ESD tracks loop
+    AliESDtrack *pTrk = pESD->GetTrack(iTrk);// get next reconstructed track
+    pID.FindPid(pTrk,AliPID::kSPECIES,prob);
+    pTrk->SetHMPIDpid(prob);
+  }//ESD tracks loop
   
-  AliHMPIDPid *pPid = new AliHMPIDPid();
-  pPid->FindPid(pESD);
-  delete pPid;
-
 }//FillESD()