]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGDQ/dielectron/AliDielectronHF.cxx
including switch to set on/off iso-track core removal, cleaning and bug fix
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / AliDielectronHF.cxx
index 9187a751d2a8c191d80807caa9ad93d855f6407e..b00b68f5311f5a45a1f663818fabc56baac2338b 100644 (file)
@@ -33,6 +33,7 @@ Detailed description
 #include <TProfile.h>
 #include <TProfile2D.h>
 #include <TProfile3D.h>
+#include <THnSparse.h>
 #include <TAxis.h>
 #include <TString.h>
 #include <TObjString.h>
@@ -54,9 +55,11 @@ ClassImp(AliDielectronHF)
 
 AliDielectronHF::AliDielectronHF() :
   TNamed(),
-  fArrPairType(0x0),
-  fPairType(kOSonly),
+  fUsedVars(new TBits(AliDielectronVarManager::kNMaxValues)),
+  fArrPairType(),
+  fPairType(kSeOnlyOS),
   fSignalsMC(0x0),
+  fVarCutType(new TBits(kMaxCuts)),
   fAxes(kMaxCuts),
   fHasMC(kFALSE),
   fStepGenerated(kFALSE),
@@ -67,19 +70,22 @@ AliDielectronHF::AliDielectronHF() :
   //
   for (Int_t i=0; i<kMaxCuts; ++i){
     fVarCuts[i]=0;
-    fVarCutType[i]=0;
+    //    fVarCutType[i]=0;
     fBinType[i]=kStdBin;
   }
   fAxes.SetOwner(kTRUE);
   fRefObj.SetOwner(kTRUE);
+  fArrPairType.SetOwner(kTRUE);
 }
 
 //______________________________________________
 AliDielectronHF::AliDielectronHF(const char* name, const char* title) :
   TNamed(name, title),
-  fArrPairType(0x0),
-  fPairType(kOSonly),
+  fUsedVars(new TBits(AliDielectronVarManager::kNMaxValues)),
+  fArrPairType(),
+  fPairType(kSeOnlyOS),
   fSignalsMC(0x0),
+  fVarCutType(new TBits(kMaxCuts)),
   fAxes(kMaxCuts),
   fHasMC(kFALSE),
   fStepGenerated(kFALSE),
@@ -90,11 +96,12 @@ AliDielectronHF::AliDielectronHF(const char* name, const char* title) :
   //
   for (Int_t i=0; i<kMaxCuts; ++i){
     fVarCuts[i]=0;
-    fVarCutType[i]=0;
+    //    fVarCutType[i]=0;
     fBinType[i]=kStdBin;
   }
   fAxes.SetOwner(kTRUE);
   fRefObj.SetOwner(kTRUE);
+  fArrPairType.SetOwner(kTRUE);
 }
 
 //______________________________________________
@@ -103,13 +110,17 @@ AliDielectronHF::~AliDielectronHF()
   //
   // Default Destructor
   //
+  if(fUsedVars)   delete fUsedVars;
+  if(fVarCutType) delete fVarCutType;
   fAxes.Delete();
+  fRefObj.Delete();
+  fArrPairType.Delete();
 }
 
 //_____________________________________________________________________________
 void AliDielectronHF::UserProfile(const char* histClass, UInt_t valTypeP,
                                      const TVectorD * const binsX,
-                                     UInt_t valTypeX, TString option)
+                                     UInt_t valTypeX, TString option, UInt_t valTypeW)
 {
   //
   // Histogram creation 1D case with arbitraty binning X
@@ -117,7 +128,7 @@ void AliDielectronHF::UserProfile(const char* histClass, UInt_t valTypeP,
   //
 
   TH1 *hist=0x0;
-  if(valTypeP==999)
+  if(valTypeP==AliDielectronHistos::kNoProfile)
     hist=new TH1F("","",binsX->GetNrows()-1,binsX->GetMatrixArray());
   else {
     TString opt=""; Double_t pmin=0., pmax=0.;
@@ -129,8 +140,7 @@ void AliDielectronHF::UserProfile(const char* histClass, UInt_t valTypeP,
       if(arr->GetEntriesFast()>2) pmax=(((TObjString*)arr->At(2))->GetString()).Atof();
       delete arr;
     }
-    hist=new TProfile("","",binsX->GetNrows()-1,binsX->GetMatrixArray());
-    ((TProfile*)hist)->BuildOptions(pmin,pmax,opt.Data());
+    hist=new TProfile("","",binsX->GetNrows()-1,binsX->GetMatrixArray(),pmin,pmax,opt.Data());
     //      printf(" name %s PROFILE options: pmin %.1f pmax %.1f err %s \n",name,((TProfile*)hist)->GetYmin(),((TProfile*)hist)->GetYmax(),((TProfile*)hist)->GetErrorOption() );
   }
 
@@ -138,6 +148,10 @@ void AliDielectronHF::UserProfile(const char* histClass, UInt_t valTypeP,
   UInt_t valType[4] = {0};
   valType[0]=valTypeX;     valType[1]=valTypeP;
   AliDielectronHistos::StoreVariables(hist, valType);
+  hist->SetUniqueID(valTypeW); // store weighting variable
+
+  for(Int_t i=0; i<4; i++)   fUsedVars->SetBitNumber(valType[i],kTRUE);
+  fUsedVars->SetBitNumber(valTypeW,kTRUE);
 
   // adapt the name and title of the histogram in case they are empty
   AliDielectronHistos::AdaptNameTitle(hist, histClass);
@@ -150,7 +164,7 @@ void AliDielectronHF::UserProfile(const char* histClass, UInt_t valTypeP,
 //_____________________________________________________________________________
 void AliDielectronHF::UserProfile(const char* histClass, UInt_t valTypeP,
                                      const TVectorD * const binsX, const TVectorD * const binsY,
-                                     UInt_t valTypeX, UInt_t valTypeY, TString option)
+                                     UInt_t valTypeX, UInt_t valTypeY, TString option, UInt_t valTypeW)
 {
   //
   // Histogram creation 2D case with arbitraty binning X and Y
@@ -158,7 +172,7 @@ void AliDielectronHF::UserProfile(const char* histClass, UInt_t valTypeP,
   //
 
   TH1 *hist=0x0;
-  if(valTypeP==999) {
+  if(valTypeP==AliDielectronHistos::kNoProfile) {
     hist=new TH2F("","",
                  binsX->GetNrows()-1,binsX->GetMatrixArray(),
                  binsY->GetNrows()-1,binsY->GetMatrixArray()); 
@@ -181,8 +195,12 @@ void AliDielectronHF::UserProfile(const char* histClass, UInt_t valTypeP,
 
   // store variales in axes
   UInt_t valType[4] = {0};
-  valType[0]=valTypeX;     valType[1]=valTypeY; valType[3]=valTypeP;
+  valType[0]=valTypeX;     valType[1]=valTypeY; valType[2]=valTypeP;
   AliDielectronHistos::StoreVariables(hist, valType);
+  hist->SetUniqueID(valTypeW); // store weighting variable
+
+  for(Int_t i=0; i<4; i++)   fUsedVars->SetBitNumber(valType[i],kTRUE);
+  fUsedVars->SetBitNumber(valTypeW,kTRUE);
 
   // adapt the name and title of the histogram in case they are empty
   AliDielectronHistos::AdaptNameTitle(hist, histClass);
@@ -196,14 +214,14 @@ void AliDielectronHF::UserProfile(const char* histClass, UInt_t valTypeP,
 //_____________________________________________________________________________
 void AliDielectronHF::UserProfile(const char* histClass, UInt_t valTypeP,
                                      const TVectorD * const binsX, const TVectorD * const binsY, const TVectorD * const binsZ,
-                                     UInt_t valTypeX, UInt_t valTypeY, UInt_t valTypeZ, TString option)
+                                     UInt_t valTypeX, UInt_t valTypeY, UInt_t valTypeZ, TString option, UInt_t valTypeW)
 {
   //
   // Histogram creation 3D case with arbitraty binning X, Y, Z
   // the TVectorD is assumed to be surplus after the creation and will be deleted!!!
   //
   TH1 *hist=0x0;
-  if(valTypeP==999) {
+  if(valTypeP==AliDielectronHistos::kNoProfile) {
     hist=new TH3F("","",
                  binsX->GetNrows()-1,binsX->GetMatrixArray(),
                  binsY->GetNrows()-1,binsY->GetMatrixArray(),
@@ -230,6 +248,10 @@ void AliDielectronHF::UserProfile(const char* histClass, UInt_t valTypeP,
   UInt_t valType[4] = {0};
   valType[0]=valTypeX;     valType[1]=valTypeY;     valType[2]=valTypeZ;     valType[3]=valTypeP;
   AliDielectronHistos::StoreVariables(hist, valType);
+  hist->SetUniqueID(valTypeW); // store weighting variable
+
+  for(Int_t i=0; i<4; i++)   fUsedVars->SetBitNumber(valType[i],kTRUE);
+  fUsedVars->SetBitNumber(valTypeW,kTRUE);
 
   // adapt the name and title of the histogram in case they are empty
   AliDielectronHistos::AdaptNameTitle(hist, histClass);
@@ -241,6 +263,48 @@ void AliDielectronHF::UserProfile(const char* histClass, UInt_t valTypeP,
   delete binsZ;
 }
 
+//_____________________________________________________________________________
+void AliDielectronHF::UserSparse(const char* histClass, Int_t ndim, TObjArray *limits, UInt_t *vars, UInt_t valTypeW)
+{
+  //
+  // THnSparse creation with non-linear binning
+  //
+
+  THnSparseF *hist=0;
+  Int_t bins[ndim];
+  // get number of bins
+  for(Int_t idim=0 ;idim<ndim; idim++) {
+    TVectorD *vec = (TVectorD*) limits->At(idim);
+    bins[idim]=vec->GetNrows()-1;
+  }
+
+  hist=new THnSparseF("",histClass, ndim, bins, 0x0, 0x0);
+
+  // set binning
+  for(Int_t idim=0 ;idim<ndim; idim++) {
+    TVectorD *vec = (TVectorD*) limits->At(idim);
+    hist->SetBinEdges(idim,vec->GetMatrixArray());
+  }
+
+  // store variales in axes
+  AliDielectronHistos::StoreVariables(hist, vars);
+  hist->SetUniqueID(valTypeW); // store weighting variable
+
+  // store which variables are used
+  for(Int_t i=0; i<20; i++)   fUsedVars->SetBitNumber(vars[i],kTRUE);
+  fUsedVars->SetBitNumber(valTypeW,kTRUE);
+
+  // adapt the name and title of the histogram in case they are empty
+  TString name;
+  for(Int_t iv=0; iv < ndim; iv++) name+=Form("%s_",AliDielectronVarManager::GetValueName(vars[iv]));
+  name.Resize(name.Length()-1);
+  hist->SetName(Form("HF_%s",name.Data()));
+
+  fRefObj.AddLast(hist);
+  delete limits;
+  
+}
+
 //________________________________________________________________
 void AliDielectronHF::AddCutVariable(AliDielectronVarManager::ValueTypes type,
                                     Int_t nbins, Double_t min, Double_t max, Bool_t log, Bool_t leg, EBinType btype)
@@ -259,9 +323,11 @@ void AliDielectronHF::AddCutVariable(AliDielectronVarManager::ValueTypes type,
 
   Int_t size=fAxes.GetEntriesFast();
   fVarCuts[size]=(UShort_t)type;
-  fVarCutType[size]=leg;
+  //  fVarCutType[size]=leg;
+  fVarCutType->SetBitNumber(size,leg);
   fAxes.Add(binLimits->Clone());
   fBinType[size]=btype;
+  fUsedVars->SetBitNumber(type,kTRUE);
 }
 
 //________________________________________________________________
@@ -280,9 +346,11 @@ void AliDielectronHF::AddCutVariable(AliDielectronVarManager::ValueTypes type,
   
   Int_t size=fAxes.GetEntriesFast();
   fVarCuts[size]=(UShort_t)type;
-  fVarCutType[size]=leg;
+  //  fVarCutType[size]=leg;
+  fVarCutType->SetBitNumber(size,leg);
   fAxes.Add(binLimits);
   fBinType[size]=btype;
+  fUsedVars->SetBitNumber(type,kTRUE);
 }
 
 //________________________________________________________________
@@ -301,9 +369,11 @@ void AliDielectronHF::AddCutVariable(AliDielectronVarManager::ValueTypes type,
   
   Int_t size=fAxes.GetEntriesFast();
   fVarCuts[size]=(UShort_t)type;
-  fVarCutType[size]=leg;
+  //  fVarCutType[size]=leg;
+  fVarCutType->SetBitNumber(size,leg);
   fAxes.Add(binLimits);
   fBinType[size]=btype;
+  fUsedVars->SetBitNumber(type,kTRUE);
 }
 
 //______________________________________________
@@ -317,6 +387,7 @@ void AliDielectronHF::Fill(Int_t label1, Int_t label2, Int_t nSignal)
 
   AliVParticle* part1 = AliDielectronMC::Instance()->GetMCTrackFromMCEvent(label1);
   AliVParticle* part2 = AliDielectronMC::Instance()->GetMCTrackFromMCEvent(label2);
+  if(!part1 || !part2) return;
 
   AliDielectronMC* dieMC = AliDielectronMC::Instance();
   
@@ -328,6 +399,7 @@ void AliDielectronHF::Fill(Int_t label1, Int_t label2, Int_t nSignal)
   if(sigMC->GetMothersRelation()==AliDielectronSignalMC::kSame && mLabel1!=mLabel2) return;
   if(sigMC->GetMothersRelation()==AliDielectronSignalMC::kDifferent && mLabel1==mLabel2) return;
     
+  AliDielectronVarManager::SetFillMap(fUsedVars);
   // fill the leg variables
   Double_t valuesLeg1[AliDielectronVarManager::kNMaxValues];
   Double_t valuesLeg2[AliDielectronVarManager::kNMaxValues];
@@ -339,20 +411,14 @@ void AliDielectronHF::Fill(Int_t label1, Int_t label2, Int_t nSignal)
   AliDielectronVarManager::Fill(dieMC->GetMCEvent(), valuesPair);
   AliDielectronVarManager::FillVarMCParticle2(part1,part2,valuesPair);
 
+  // if pair types are filled, fill mc sources at the end
+  Int_t istep=0;
+  if(fPairType!=kMConly) istep=AliDielectron::kEv1PMRot+1;
+
+  // only OS at the moment
   if(part1->Charge()*part2->Charge()<0) {
-    //valuesPair[AliDielectronVarManager::kPairType]=1;
-//     for(Int_t i=0; i<fAxes.GetEntriesFast(); i++) {
-//       printf("[D]: %s %f %f %f \n",
-//          AliDielectronVarManager::GetValueName(fVarCuts[i]),
-//          valuesLeg1[fVarCuts[i]], valuesLeg2[fVarCuts[i]], valuesPair[fVarCuts[i]]); 
-//     }
-    Fill(nSignal+fSignalsMC->GetEntries(), valuesPair,  valuesLeg1, valuesLeg2);
+    Fill(istep+nSignal+fSignalsMC->GetEntries(), valuesPair,  valuesLeg1, valuesLeg2);
   }
-  // only OS at the moment
-  // else if(part1->Charge()>0)
-  //   valuesPair[AliDielectronVarManager::kPairType]=0;
-  // else
-  //   valuesPair[AliDielectronVarManager::kPairType]=2; // if one of the two particles is neutral, the pair will go here
 
   return;
 }
@@ -364,42 +430,55 @@ void AliDielectronHF::Fill(Int_t pairIndex, const AliDielectronPair *particle)
   //
   
   // only OS pairs in case of MC
-  if(fHasMC && pairIndex!=AliDielectron::kEv1PM) return;
+  //////////////////////////////  if(fHasMC && pairIndex!=AliDielectron::kEv1PM) return;
 
   // only selected pair types in case of data
   if(!IsPairTypeSelected(pairIndex)) return;
 
   // get event and pair variables
   Double_t valuesPair[AliDielectronVarManager::kNMaxValues];
+  AliDielectronVarManager::SetFillMap(fUsedVars);
   AliDielectronVarManager::Fill(particle,valuesPair);
 
-  // get leg variables
+  // get leg variables (TODO: do not fill for the moment since leg cuts are not opened)
   Double_t valuesLeg1[AliDielectronVarManager::kNMaxValues]={0};
-  AliDielectronVarManager::Fill(particle->GetFirstDaughter(),valuesLeg1);
+  if(fVarCutType->CountBits())  AliDielectronVarManager::Fill(particle->GetFirstDaughterP(),valuesLeg1);
   Double_t valuesLeg2[AliDielectronVarManager::kNMaxValues]={0};
-  AliDielectronVarManager::Fill(particle->GetSecondDaughter(),valuesLeg2);
+  if(fVarCutType->CountBits())  AliDielectronVarManager::Fill(particle->GetSecondDaughterP(),valuesLeg2);
 
   // fill
-  if(!fHasMC) { Fill(pairIndex, valuesPair,  valuesLeg1, valuesLeg2); }
-  if(fHasMC && fSignalsMC) {
+
+  // if pair types are filled, fill mc sources at the end
+  Int_t istep = 0;
+  if(fPairType!=kMConly) istep=AliDielectron::kEv1PMRot+1;
+
+  // mc source steps (only OS SE pairs)
+  if(fHasMC && fSignalsMC && pairIndex==AliDielectron::kEv1PM) {
     for(Int_t i=0; i<fSignalsMC->GetEntries(); i++) {
-      if(AliDielectronMC::Instance()->IsMCTruth(particle, (AliDielectronSignalMC*)fSignalsMC->At(i))) 
-       Fill(i, valuesPair,  valuesLeg1, valuesLeg2);
+      if(AliDielectronMC::Instance()->IsMCTruth(particle, (AliDielectronSignalMC*)fSignalsMC->At(i)))
+       Fill(istep+i, valuesPair,  valuesLeg1, valuesLeg2);
     }
   }
-  
+
+  // all pair types w/o use of mc information
+  if(fPairType==kMConly) return;
+
+  // remove comments
+  //// select correct step if we are looking at signals too
+  ////  if(fHasMC && fSignalsMC) pairIndex += ( fSignalsMC->GetEntries() * (fStepGenerated ? 2 : 1) );
+  Fill(pairIndex, valuesPair,  valuesLeg1, valuesLeg2); 
+
   return;
-  
 }
 
 //______________________________________________
-void AliDielectronHF::Fill(Int_t Index, Double_t * const valuesPair, Double_t * const valuesLeg1, Double_t * const valuesLeg2)
+void AliDielectronHF::Fill(Int_t index, Double_t * const valuesPair, Double_t * const valuesLeg1, Double_t * const valuesLeg2)
 {
   //
   // main fill function using index and values as input
   //
 
-  TObjArray *histArr = static_cast<TObjArray*>(fArrPairType.At(Index));
+  TObjArray *histArr = static_cast<TObjArray*>(fArrPairType.At(index));
   if(!histArr) return;
 
   Int_t size  = GetNumberOfBins();
@@ -431,7 +510,7 @@ void AliDielectronHF::Fill(Int_t Index, Double_t * const valuesPair, Double_t *
       }
 
       // leg variable
-      if(fVarCutType[ivar]) {
+      if(fVarCutType->TestBitNumber(ivar)) {
        if( (valuesLeg1[fVarCuts[ivar]] < lowEdge || valuesLeg1[fVarCuts[ivar]] >= upEdge) ||
            (valuesLeg2[fVarCuts[ivar]] < lowEdge || valuesLeg2[fVarCuts[ivar]] >= upEdge) ) {
          selected=kFALSE;
@@ -451,7 +530,7 @@ void AliDielectronHF::Fill(Int_t Index, Double_t * const valuesPair, Double_t *
     // do not fill the histogram
     if(!selected) continue;
 
-    // fill the object with Pair and event values (TODO: this needs to be changed)
+    // fill the object with Pair and event values
     TObjArray *tmp = (TObjArray*) histArr->At(ihist);
     TString title = tmp->GetName();
     AliDebug(10,title.Data());
@@ -478,25 +557,28 @@ void AliDielectronHF::Init()
 
   // init pair type array
   fArrPairType.SetName(Form("%s_HF",GetName()));
-  if(fHasMC) fArrPairType.Expand(steps);
-  else fArrPairType.Expand(AliDielectron::kEv1PMRot+1);
+  if(fHasMC && fPairType==kMConly) fArrPairType.Expand(steps);
+  else fArrPairType.Expand(AliDielectron::kEv1PMRot+1+steps);
 
   Int_t size  = GetNumberOfBins();
   AliDebug(10,Form("Creating a histo array with size %d \n",size));
 
   Int_t sizeAdd  = 1; 
 
-  // fill object array with the histograms
-  TObjArray *histArr = new TObjArray();
+  // fill object array with the array of bin cells
+  TObjArray *histArr = new TObjArray(0);
+  if(!histArr) return;
+  histArr->SetOwner(kTRUE);
   histArr->Expand(size);
 
   //  printf("fRefObj %p \n",fRefObj);
+  // array of histograms to each bin cell
   for(Int_t ihist=0; ihist<size; ihist++) {
     histArr->AddAt(fRefObj.Clone(""), ihist);
     //histArr->AddAt(fRefObj.Clone(Form("h%04d",ihist)), ihist);
   }
 
-  // loop over all cut variables
+  // loop over all cut variables and do the naming according to its bin cell
   Int_t nvars = fAxes.GetEntriesFast();
   for(Int_t ivar=0; ivar<nvars; ivar++) {
     
@@ -505,7 +587,7 @@ void AliDielectronHF::Init()
     Int_t nbins    = bins->GetNrows()-1;
 
 
-    // loop over all histograms an set unique titles
+    // loop over all bin cells an set unique titles
     for(Int_t ihist=0; ihist<size; ihist++) {
 
       // get the lower limit for current ivar bin
@@ -525,33 +607,48 @@ void AliDielectronHF::Init()
       TString title = tmp->GetName();
       if(!ivar)             title ="";
       if( ivar)             title+=":";
-      if(fVarCutType[ivar]) title+="Leg";
+      if(fVarCutType->TestBitNumber(ivar)) title+="Leg";
       title+=AliDielectronVarManager::GetValueName(fVarCuts[ivar]);
       title+=Form("#%.2f#%.2f",lowEdge,upEdge);
       tmp->SetName(title.Data());
       AliDebug(10,title.Data());
-    }
+    } // end: array of bin cell
     sizeAdd*=nbins;
-  }
+  } //end: cut loop
 
   // copy array to the selected pair types/ MC sources
+
+  // pair types
+  Int_t istep=0;
+  if(fPairType != kMConly) {
+    for(istep=0; istep<AliDielectron::kEv1PMRot+1; istep++) {
+
+      if(IsPairTypeSelected(istep)) {
+       // add a deep copy of the array
+       fArrPairType[istep]=(TObjArray*)histArr->Clone(AliDielectron::PairClassName(istep));
+       ((TObjArray*)fArrPairType[istep])->SetOwner();
+      }
+      else {
+       fArrPairType[istep]=new TObjArray(0);
+       ((TObjArray*)fArrPairType[istep])->SetOwner();
+       ((TObjArray*)fArrPairType[istep])->SetName(AliDielectron::PairClassName(istep));
+      }
+    } //end: loop over pair types
+  }
+
+  // mc sources
   if(fHasMC) {
     for(Int_t i=0; i<fSignalsMC->GetEntries(); i++) {
-       TString title = Form("(Signal: %s)",fSignalsMC->At(i)->GetTitle());
-       fArrPairType[i]=(TObjArray*)histArr->Clone(title.Data());
-       if(fStepGenerated)  {
-         title+=" MC truth";
-         fArrPairType[i+fSignalsMC->GetEntries()]=(TObjArray*)histArr->Clone(title.Data());
-       }
+      TString title = Form("(Signal: %s)",fSignalsMC->At(i)->GetTitle());
+      fArrPairType[istep+i]=(TObjArray*)histArr->Clone(title.Data());
+      if(fStepGenerated)  {
+       title+=" MC truth";
+       fArrPairType[istep+i+fSignalsMC->GetEntries()]=(TObjArray*)histArr->Clone(title.Data());
       }
-   }
-   else {
-    for(Int_t i=0; i<AliDielectron::kEv1PMRot+1; i++) {
-      if(IsPairTypeSelected(i)) fArrPairType[i]=(TObjArray*)histArr->Clone(Form("%s",AliDielectron::PairClassName(i)));
-      else fArrPairType[i]=0x0;
-    }
+    } // end: loop over sources
   }
-  
+
+
   // clean up
   if(histArr) {
     delete histArr;
@@ -564,7 +661,7 @@ void AliDielectronHF::Init()
 Int_t AliDielectronHF::GetNumberOfBins() const
 {
   //
-  // return the number of bins this mixing handler has
+  // return the number of bins this histogram grid has
   //
   Int_t size=1;
   for (Int_t i=0; i<fAxes.GetEntriesFast(); ++i)
@@ -577,36 +674,41 @@ Bool_t AliDielectronHF::IsPairTypeSelected(Int_t itype)
 {
   //
   // check whether a pair type was selected
-  //
-  
+  // TODO: cross check or replace by mixinghandlers processsing
+
   Bool_t selected = kFALSE;
 
   // fill all
-  if(fPairType==kAll) selected = kTRUE;
+  if(fPairType==kAll) return kTRUE;
 
   switch(itype) {
-  case AliDielectron::kEv1PP: 
+  case AliDielectron::kEv1PP:
   case AliDielectron::kEv1MM:
-    if(fPairType==kOSandLS)   selected = kTRUE;
+    if(fPairType==kSeAll || fPairType==kSeMeAll || fPairType==kSeReAll )   selected = kTRUE;
     break;
-  case AliDielectron::kEv1PM: selected = kTRUE;
+  case AliDielectron::kEv1PM:
+    if(fPairType!=kMeOnlyOS)  selected = kTRUE;
     break;
   case AliDielectron::kEv1PEv2P:
-  case AliDielectron::kEv1MEv2P:
-  case AliDielectron::kEv1PEv2M:
   case AliDielectron::kEv1MEv2M:
-    if(fPairType==kOSandMIX)  selected = kTRUE;
+    if(fPairType==kMeAll || fPairType==kSeMeAll)   selected = kTRUE;
+    break;
+  case AliDielectron::kEv1PEv2M:
+    if(fPairType==kMeAll || fPairType==kSeMeAll) selected = kTRUE;
+    break;
+  case AliDielectron::kEv1MEv2P:
+    if(fPairType==kMeAll || fPairType==kSeMeAll || fPairType==kMeOnlyOS || fPairType==kSeMeOnlyOS)   selected = kTRUE;
     break;
   case AliDielectron::kEv2PP:
-  case AliDielectron::kEv2PM: 
+  case AliDielectron::kEv2PM:
   case AliDielectron::kEv2MM:
     selected = kFALSE;
     break;
   case AliDielectron::kEv1PMRot:
-    if(fPairType==kOSandROT)  selected = kTRUE;
+    if(fPairType==kSeReAll || fPairType==kSeReOnlyOS)   selected = kTRUE;
     break;
   }
-  
+
   return selected;
 
 }