]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - CORRFW/AliCFManager.cxx
Added correlated error calculation (instead of gaussian) in unfolded spectrum
[u/mrichter/AliRoot.git] / CORRFW / AliCFManager.cxx
index dc81fb17260beb8cb3076171046b4cf28ac3bda7..3e697868497c5d611155e78598532341ed37088a 100644 (file)
 // efficiency calculation.
 // prototype version by S.Arcelli silvia.arcelli@cern.ch
 ///////////////////////////////////////////////////////////////////////////
-#include "AliLog.h"
 #include "AliCFCutBase.h"
 #include "AliCFManager.h"
-#include "AliCFContainer.h"
 
 ClassImp(AliCFManager)
 
 //_____________________________________________________________________________
 AliCFManager::AliCFManager() : 
   TNamed(),
+  fNStepEvt(0),
+  fNStepPart(0),
   fEvtContainer(0x0),
   fPartContainer(0x0),
   fEvtCutList(0x0),
@@ -43,6 +43,8 @@ AliCFManager::AliCFManager() :
 //_____________________________________________________________________________
 AliCFManager::AliCFManager(Char_t* name, Char_t* title) : 
   TNamed(name,title),
+  fNStepEvt(0),
+  fNStepPart(0),
   fEvtContainer(0x0),
   fPartContainer(0x0),
   fEvtCutList(0x0),
@@ -55,6 +57,8 @@ AliCFManager::AliCFManager(Char_t* name, Char_t* title) :
 //_____________________________________________________________________________
 AliCFManager::AliCFManager(const AliCFManager& c) : 
   TNamed(c),
+  fNStepEvt(c.fNStepEvt),
+  fNStepPart(c.fNStepPart),
   fEvtContainer(c.fEvtContainer),
   fPartContainer(c.fPartContainer),
   fEvtCutList(c.fEvtCutList),
@@ -74,6 +78,8 @@ AliCFManager& AliCFManager::operator=(const AliCFManager& c)
     TNamed::operator=(c) ;
   }
   
+  this->fNStepEvt=c.fNStepEvt;
+  this->fNStepPart=c.fNStepPart;
   this->fEvtContainer=c.fEvtContainer;
   this->fPartContainer=c.fPartContainer;
   this->fEvtCutList=c.fEvtCutList;
@@ -94,8 +100,8 @@ Bool_t AliCFManager::CheckParticleCuts(Int_t isel, TObject *obj, const TString
   // check whether object obj passes particle-level selection isel
   //
 
-  if(isel>=fPartContainer->GetNStep()){
-    AliWarning(Form("Selection index out of Range! isel=%i, max. number of selections= %i", isel,fPartContainer->GetNStep()));
+  if(isel>=fNStepPart){
+    AliWarning(Form("Selection index out of Range! isel=%i, max. number of selections= %i", isel,fNStepPart));
     return kTRUE;
   }
   if(!fPartCutList[isel])return kTRUE;
@@ -115,8 +121,8 @@ Bool_t AliCFManager::CheckEventCuts(Int_t isel, TObject *obj, const TString  &se
   // check whether object obj passes event-level selection isel
   //
 
-  if(isel>=fEvtContainer->GetNStep()){
-    AliWarning(Form("Selection index out of Range! isel=%i, max. number of selections= %i", isel,fEvtContainer->GetNStep()));
+  if(isel>=fNStepEvt){
+    AliWarning(Form("Selection index out of Range! isel=%i, max. number of selections= %i", isel,fNStepEvt));
       return kTRUE;
   }
   if(!fEvtCutList[isel])return kTRUE;
@@ -131,36 +137,71 @@ Bool_t AliCFManager::CheckEventCuts(Int_t isel, TObject *obj, const TString  &se
 }
 
 //_____________________________________________________________________________
-void  AliCFManager::SetEventInfo(TObject *obj) const {
+void  AliCFManager::SetMCEventInfo(const TObject *obj) const {
 
   //Particle level cuts
 
-  if (!fPartContainer) {
-    AliWarning("No particle container");
+  if (!fPartCutList) {
+    AliWarning("No particle cut list found");
   }
   else {
-    for(Int_t isel=0;isel<fPartContainer->GetNStep(); isel++){
+    for(Int_t isel=0;isel<fNStepPart; isel++){
       if(!fPartCutList[isel])continue;  
       TObjArrayIter iter(fPartCutList[isel]);
       AliCFCutBase *cut = 0;
       while ( (cut = (AliCFCutBase*)iter.Next()) ) {
-       cut->SetEvtInfo(obj);
+       cut->SetMCEventInfo(obj);
       }    
     }
   }
   
   //Event level cuts 
   
-  if (!fEvtContainer) {
-    AliWarning("No event container found");
+  if (!fEvtCutList) {
+    AliWarning("No event cut list found");
   }
   else {
-    for(Int_t isel=0;isel<fEvtContainer->GetNStep(); isel++){
+    for(Int_t isel=0;isel<fNStepEvt; isel++){
       if(!fEvtCutList[isel])continue;  
       TObjArrayIter iter(fEvtCutList[isel]);
       AliCFCutBase *cut = 0;
       while ( (cut = (AliCFCutBase*)iter.Next()) ) {
-       cut->SetEvtInfo(obj);
+       cut->SetMCEventInfo(obj);
+      }   
+    }
+  }
+}
+//_____________________________________________________________________________
+void  AliCFManager::SetRecEventInfo(const TObject *obj) const {
+
+  //Particle level cuts
+
+  if (!fPartCutList) {
+    AliWarning("No particle cut list found");
+  }
+  else {
+    for(Int_t isel=0;isel<fNStepPart; isel++){
+      if(!fPartCutList[isel])continue;  
+      TObjArrayIter iter(fPartCutList[isel]);
+      AliCFCutBase *cut = 0;
+      while ( (cut = (AliCFCutBase*)iter.Next()) ) {
+       cut->SetRecEventInfo(obj);
+      }    
+    }
+  }
+  
+  //Event level cuts 
+  
+  if (!fEvtCutList) {
+    AliWarning("No event cut list found");
+  }
+  else {
+    for(Int_t isel=0;isel<fNStepEvt; isel++){
+      if(!fEvtCutList[isel])continue;  
+      TObjArrayIter iter(fEvtCutList[isel]);
+      AliCFCutBase *cut = 0;
+      while ( (cut = (AliCFCutBase*)iter.Next()) ) {
+       cut->SetRecEventInfo(obj);
       }   
     }
   }
@@ -188,13 +229,15 @@ void AliCFManager::SetEventCutsList(Int_t isel, TObjArray* array) {
   //
 
   if (!fEvtContainer) {
-    AliError("No event container defined, please set it first!"); 
-    return;
+    AliWarning("No event container defined, you may need to set it first!"); 
   }
 
-  Int_t nstep = fEvtContainer->GetNStep() ;
+  Int_t nstep = fNStepEvt;
 
-  if (!fEvtCutList) fEvtCutList = new TObjArray*[nstep] ;
+  if (!fEvtCutList) {
+    fEvtCutList = new TObjArray*[nstep] ;
+    for (Int_t i=0; i<nstep; ++i) fEvtCutList[i] = 0;
+  }
   if (isel >= nstep) {
     AliWarning(Form("Selection index out of Range! isel=%i, max. number of selections= %i", isel,nstep));
     return;
@@ -209,13 +252,16 @@ void AliCFManager::SetParticleCutsList(Int_t isel, TObjArray* array) {
   //
 
   if (!fPartContainer) {
-    AliError("No event container defined, please set it first!"); 
-    return;
+    AliWarning("No particle container defined, you may need to set it first!"); 
   }
   
-  Int_t nstep = fPartContainer->GetNStep() ;
+  Int_t nstep = fNStepPart ;
+  
+  if (!fPartCutList) {
+    fPartCutList = new TObjArray*[nstep] ;
+    for (Int_t istep = 0; istep < nstep; istep++)  fPartCutList[istep] = 0; 
+  }
   
-  if (!fPartCutList) fPartCutList = new TObjArray*[nstep] ;
   if (isel >= nstep) {
     AliWarning(Form("Selection index out of Range! isel=%i, max. number of selections= %i", isel,nstep));
     return;