- updates on reduced events (Ionut)
authorjbook <jbook@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Jan 2013 14:34:07 +0000 (14:34 +0000)
committerjbook <jbook@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Jan 2013 14:34:07 +0000 (14:34 +0000)
- user tasks updates

PWGDQ/dielectron/AliAnalysisTaskReducedTree.cxx
PWGDQ/dielectron/AliAnalysisTaskReducedTree.h
PWGDQ/dielectron/AliReducedEvent.cxx
PWGDQ/dielectron/AliReducedEvent.h
PWGDQ/dielectron/macrosJPSI/AddTask_jbook_JPsi.C
PWGDQ/dielectron/macrosJPSI/ConfigJpsiQA_jpsi_PbPb.C
PWGDQ/dielectron/macrosJPSI/ConfigJpsi_jb_PbPb.C

index bb4965887cba6b40966641f4df27c4715d7db8e1..f96145e4571402b73c900afad92c0bb55801cf7d 100644 (file)
@@ -40,6 +40,9 @@
 #include <AliESDv0Cuts.h>
 #include <AliESDv0KineCuts.h>
 #include <AliVCluster.h>
+#include <AliAODTracklets.h>
+#include <AliMultiplicity.h>
+#include <AliPIDResponse.h>
 #include "AliDielectron.h"
 #include "AliDielectronHistos.h"
 #include "AliDielectronMC.h"
@@ -151,7 +154,7 @@ AliAnalysisTaskReducedTree::AliAnalysisTaskReducedTree(const char *name) :
   
   DefineInput(0,TChain::Class());
   DefineOutput(1, TList::Class());   // QA histograms
-  //DefineOutput(2, TTree::Class());   // reduced information tree
+  DefineOutput(2, TTree::Class());   // reduced information tree
   //if(fFillFriendInfo) DefineOutput(3, TTree::Class());   // reduced information tree with friends
   //DefineOutput(2, TTree::Class());   // reduced information tree with friends
   //DefineOutput(2, TTree::Class());   // reduced information tree  
@@ -185,13 +188,14 @@ void AliAnalysisTaskReducedTree::UserCreateOutputObjects()
     fFriendTree->Branch("Event",&fReducedEventFriend,16000,99);
   }
   
-  fTreeFile = new TFile("dstTree.root", "RECREATE");
+  //fTreeFile = new TFile("dstTree.root", "RECREATE");
+  OpenFile(2);
   fTree = new TTree("DstTree","Reduced ESD information");
   fReducedEvent = new AliReducedEvent("DstEvent");
   fTree->Branch("Event",&fReducedEvent,16000,99);
     
   PostData(1, &fListHistos);
-  //PostData(2, fTree);
+  PostData(2, fTree);
   //if(fFillFriendInfo) PostData(3, fFriendTree);
   //PostData(2, fFriendTree);
   //PostData(1, fTree);
@@ -216,7 +220,7 @@ void AliAnalysisTaskReducedTree::UserExec(Option_t *option)
   } else {
     AliFatal("This task needs the PID response attached to the input event handler!");
   }
-  
+
   // Was event selected ?
   UInt_t isSelected = AliVEvent::kAny;
   if(fSelectPhysics && inputHandler){
@@ -283,7 +287,7 @@ void AliAnalysisTaskReducedTree::UserExec(Option_t *option)
       
   // if there are candidate pairs, add the information to the reduced tree
   PostData(1, &fListHistos);
-  //PostData(2, fTree);
+  PostData(2, fTree);
   //if(fFillFriendInfo) PostData(3, fFriendTree);
   //PostData(2, fFriendTree);
   //PostData(2, fTree);
@@ -302,6 +306,11 @@ void AliAnalysisTaskReducedTree::FillEventInfo()
   Bool_t isESD = (event->IsA()==AliESDEvent::Class());
   Bool_t isAOD = (event->IsA()==AliAODEvent::Class());
   
+  AliESDEvent* esdEvent = 0x0;
+  if(isESD) esdEvent = static_cast<AliESDEvent*>(event);
+  AliAODEvent* aodEvent = 0x0;
+  if(isAOD) aodEvent = static_cast<AliAODEvent*>(event);
+  
   AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
   UInt_t isSelected = AliVEvent::kAny;
   if(inputHandler){
@@ -315,11 +324,13 @@ void AliAnalysisTaskReducedTree::FillEventInfo()
   
   fReducedEvent->fRunNo       = event->GetRunNumber();
   fReducedEvent->fBC          = event->GetBunchCrossNumber();
+  fReducedEvent->fEventType   = event->GetEventType();
   fReducedEvent->fTriggerMask = event->GetTriggerMask();
   fReducedEvent->fIsPhysicsSelection = (isSelected!=0 ? kTRUE : kFALSE);
+  fReducedEvent->fIsSPDPileup = event->IsPileupFromSPD(3,0.8,3.,2.,5.);
   AliVVertex* eventVtx = 0x0;
-  if(isESD) eventVtx = const_cast<AliESDVertex*>((static_cast<AliESDEvent*>(event))->GetPrimaryVertexTracks());
-  if(isAOD) eventVtx = const_cast<AliAODVertex*>((static_cast<AliAODEvent*>(event))->GetPrimaryVertex());
+  if(isESD) eventVtx = const_cast<AliESDVertex*>(esdEvent->GetPrimaryVertexTracks());
+  if(isAOD) eventVtx = const_cast<AliAODVertex*>(aodEvent->GetPrimaryVertex());
   if(eventVtx) {
     fReducedEvent->fVtx[0] = (isESD ? ((AliESDVertex*)eventVtx)->GetXv() : ((AliAODVertex*)eventVtx)->GetX());
     fReducedEvent->fVtx[1] = (isESD ? ((AliESDVertex*)eventVtx)->GetYv() : ((AliAODVertex*)eventVtx)->GetY());
@@ -327,13 +338,39 @@ void AliAnalysisTaskReducedTree::FillEventInfo()
     fReducedEvent->fNVtxContributors = eventVtx->GetNContributors();
   }
   if(isESD) {
-    eventVtx = const_cast<AliESDVertex*>((static_cast<AliESDEvent*>(event))->GetPrimaryVertexTPC());
+    eventVtx = const_cast<AliESDVertex*>(esdEvent->GetPrimaryVertexTPC());
     if(eventVtx) {
       fReducedEvent->fVtxTPC[0] = ((AliESDVertex*)eventVtx)->GetXv();
       fReducedEvent->fVtxTPC[1] = ((AliESDVertex*)eventVtx)->GetYv();
       fReducedEvent->fVtxTPC[2] = ((AliESDVertex*)eventVtx)->GetZv();
       fReducedEvent->fNVtxTPCContributors = eventVtx->GetNContributors();
     }
+    fReducedEvent->fTimeStamp     = esdEvent->GetTimeStamp();
+    fReducedEvent->fNpileupSPD    = esdEvent->GetNumberOfPileupVerticesSPD();
+    fReducedEvent->fNpileupTracks = esdEvent->GetNumberOfPileupVerticesTracks();
+    fReducedEvent->fNPMDtracks    = esdEvent->GetNumberOfPmdTracks();
+    fReducedEvent->fNTRDtracks    = esdEvent->GetNumberOfTrdTracks();
+    fReducedEvent->fNTRDtracklets = esdEvent->GetNumberOfTrdTracklets();
+    
+    AliESDZDC* zdc = esdEvent->GetESDZDC();
+    if(zdc) {
+      for(Int_t i=0; i<4; ++i)  fReducedEvent->fZDCnEnergy[i]   = zdc->GetZN1TowerEnergy()[i];
+      for(Int_t i=4; i<8; ++i)  fReducedEvent->fZDCnEnergy[i]   = zdc->GetZN2TowerEnergy()[i-4];
+    }
+  }
+  if(isAOD) {
+    fReducedEvent->fTimeStamp     = 0;
+    fReducedEvent->fNpileupSPD    = aodEvent->GetNumberOfPileupVerticesSPD();
+    fReducedEvent->fNpileupTracks = aodEvent->GetNumberOfPileupVerticesTracks();
+    fReducedEvent->fNPMDtracks    = aodEvent->GetNPmdClusters();
+    fReducedEvent->fNTRDtracks    = 0;
+    fReducedEvent->fNTRDtracklets = 0;
+    
+    AliAODZDC* zdc = aodEvent->GetZDCData();
+    if(zdc) {
+      for(Int_t i=0; i<4; ++i)  fReducedEvent->fZDCnEnergy[i]   = zdc->GetZNATowerEnergy()[i];
+      for(Int_t i=4; i<8; ++i)  fReducedEvent->fZDCnEnergy[i]   = zdc->GetZNCTowerEnergy()[i-4];
+    }
   }
   
   AliCentrality *centrality = event->GetCentrality();
@@ -348,17 +385,13 @@ void AliAnalysisTaskReducedTree::FillEventInfo()
   //cout << "event vtxZ/cent: " << fReducedEvent->fVtx[2] << "/" << fReducedEvent->fCentrality[0] << endl;
   
   fReducedEvent->fNtracks[0] = event->GetNumberOfTracks();
-  fReducedEvent->fSPDntracklets = (Int_t)values[AliDielectronVarManager::kNaccTrckltsEsd10];
-
+  fReducedEvent->fSPDntracklets = GetSPDTrackletMultiplicity(event, -1.0, 1.0);
+  for(Int_t ieta=0; ieta<16; ++ieta)
+    fReducedEvent->fSPDntrackletsEta[ieta] = GetSPDTrackletMultiplicity(event, -1.6+0.2*ieta, -1.6+0.2*(ieta+1));
+  
   AliVVZERO* vzero = event->GetVZEROData();
   for(Int_t i=0;i<64;++i) 
     fReducedEvent->fVZEROMult[i] = vzero->GetMultiplicity(i);  
-
-  AliESDZDC* zdc = (isESD ? (static_cast<AliESDEvent*>(event))->GetESDZDC() : 0x0);
-  if(zdc) {
-    for(Int_t i=0; i<4; ++i)  fReducedEvent->fZDCnEnergy[i]   = zdc->GetZN1TowerEnergy()[i];
-    for(Int_t i=4; i<8; ++i)  fReducedEvent->fZDCnEnergy[i]   = zdc->GetZN2TowerEnergy()[i-4];
-  }
   
   // EMCAL/PHOS clusters
   if(fFillCaloClusterInfo) FillCaloClusters();
@@ -419,6 +452,10 @@ void AliAnalysisTaskReducedTree::FillTrackInfo()
   Bool_t isESD = (event->IsA()==AliESDEvent::Class());
   Bool_t isAOD = (event->IsA()==AliAODEvent::Class());
 
+  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
+  AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
+  AliPIDResponse* pidResponse = inputHandler->GetPIDResponse();
+  
   // find all the tracks which belong to a V0 stored in the reduced event
   UShort_t trackIdsV0[4][20000]={{0}};
   Int_t nV0LegsTagged[4] = {0};
@@ -492,7 +529,16 @@ void AliAnalysisTaskReducedTree::FillTrackInfo()
         break;
       }
     }
-        
+    
+    ULong_t status = (isESD ? esdTrack->GetStatus() : aodTrack->GetStatus());
+    //cout << "TRACK" << endl;
+    for(Int_t ibit=0; ibit<32; ++ibit) {
+      if(status & (ULong_t(1)<<ibit)) {
+        //cout << "bit " << ibit << endl;
+        fReducedEvent->fNtracksPerTrackingFlag[ibit] += 1;
+      }
+    }
+    
     //apply track cuts
     if(!usedForV0Or && !usedForDielectron && fTrackFilter && !fTrackFilter->IsSelected(particle)) continue;
     //cout << "storing track " << trackId << endl;
@@ -502,7 +548,7 @@ void AliAnalysisTaskReducedTree::FillTrackInfo()
         
     Double_t values[AliDielectronVarManager::kNMaxValues];
     AliDielectronVarManager::Fill(particle, values);
-    reducedParticle->fStatus        = (ULong_t)values[AliDielectronVarManager::kTrackStatus];
+    reducedParticle->fStatus        = status;//(ULong_t)values[AliDielectronVarManager::kTrackStatus];
     reducedParticle->fGlobalPhi     = values[AliDielectronVarManager::kPhi];
     reducedParticle->fGlobalPt      = values[AliDielectronVarManager::kPt]*values[AliDielectronVarManager::kCharge];
     reducedParticle->fGlobalEta     = values[AliDielectronVarManager::kEta];    
@@ -525,6 +571,7 @@ void AliAnalysisTaskReducedTree::FillTrackInfo()
     reducedParticle->fTPCnSig[1]   = values[AliDielectronVarManager::kTPCnSigmaPio];
     reducedParticle->fTPCnSig[2]   = values[AliDielectronVarManager::kTPCnSigmaKao];
     reducedParticle->fTPCnSig[3]   = values[AliDielectronVarManager::kTPCnSigmaPro];
+    reducedParticle->fTPCClusterMap = EncodeTPCClusterMap(particle, isAOD);
     
     reducedParticle->fTOFbeta      = values[AliDielectronVarManager::kTOFbeta];
     reducedParticle->fTOFnSig[0]   = values[AliDielectronVarManager::kTOFnSigmaEle];
@@ -532,9 +579,8 @@ void AliAnalysisTaskReducedTree::FillTrackInfo()
     reducedParticle->fTOFnSig[2]   = values[AliDielectronVarManager::kTOFnSigmaKao];
     reducedParticle->fTOFnSig[3]   = values[AliDielectronVarManager::kTOFnSigmaPro];
 
-    reducedParticle->fTRDpid[0]    = values[AliDielectronVarManager::kTRDprobEle];
-    reducedParticle->fTRDpid[1]    = values[AliDielectronVarManager::kTRDprobPio];
-    
+    Double_t trdProbab[AliPID::kSPECIES]={0.0};
+        
     if(fFlowTrackFilter) {
       // switch on the first bit if this particle should be used for the event plane
       if(fFlowTrackFilter->IsSelected(particle)) reducedParticle->fFlags |= (1<<0);
@@ -547,13 +593,18 @@ void AliAnalysisTaskReducedTree::FillTrackInfo()
       //AliESDtrack *track=static_cast<AliESDtrack*>(particle);
       reducedParticle->fTrackId          = (UShort_t)esdTrack->GetID();
       reducedParticle->fTPCCrossedRows   = (UChar_t)esdTrack->GetTPCCrossedRows();
-      reducedParticle->fTPCClusterMap    = EncodeTPCClusterMap(esdTrack);
+      //reducedParticle->fTPCClusterMap    = EncodeTPCClusterMap(esdTrack);
       const AliExternalTrackParam* tpcInner = esdTrack->GetTPCInnerParam();
       reducedParticle->fTPCPhi        = (tpcInner ? tpcInner->Phi() : 0.0);
       reducedParticle->fTPCPt         = (tpcInner ? tpcInner->Pt() : 0.0);
       reducedParticle->fTPCEta        = (tpcInner ? tpcInner->Eta() : 0.0);
+      
       reducedParticle->fTRDntracklets[0] = esdTrack->GetTRDntracklets();
       reducedParticle->fTRDntracklets[1] = esdTrack->GetTRDntrackletsPID();
+      pidResponse->ComputeTRDProbability(esdTrack,AliPID::kSPECIES,trdProbab,AliTRDPIDResponse::kLQ2D);
+      reducedParticle->fTRDpid[0]    = trdProbab[AliPID::kElectron];
+      reducedParticle->fTRDpid[1]    = trdProbab[AliPID::kPion];
+      
       for(Int_t idx=0; idx<3; ++idx) if(esdTrack->GetKinkIndex(idx)>0) reducedParticle->fFlags |= (1<<(5+idx));
       if(esdTrack->IsEMCAL()) reducedParticle->fCaloClusterId = esdTrack->GetEMCALcluster();
       if(esdTrack->IsPHOS()) reducedParticle->fCaloClusterId = esdTrack->GetPHOScluster();
@@ -561,6 +612,19 @@ void AliAnalysisTaskReducedTree::FillTrackInfo()
     if(isAOD) {
       //AliAODTrack *track=static_cast<AliAODTrack*>(particle);
       reducedParticle->fTrackId = aodTrack->GetID(); 
+      reducedParticle->fITSsignal = aodTrack->GetITSsignal();
+      if(pidResponse) {
+        reducedParticle->fITSnSig[0]    = pidResponse->NumberOfSigmasITS(aodTrack,AliPID::kElectron);
+        reducedParticle->fITSnSig[1]    = pidResponse->NumberOfSigmasITS(aodTrack,AliPID::kPion);
+        reducedParticle->fITSnSig[2]    = pidResponse->NumberOfSigmasITS(aodTrack,AliPID::kKaon);
+        reducedParticle->fITSnSig[3]    = pidResponse->NumberOfSigmasITS(aodTrack,AliPID::kProton);
+      }
+      reducedParticle->fTRDntracklets[0] = aodTrack->GetTRDntrackletsPID();
+      reducedParticle->fTRDntracklets[1] = aodTrack->GetTRDntrackletsPID();
+      pidResponse->ComputeTRDProbability(aodTrack,AliPID::kSPECIES,trdProbab,AliTRDPIDResponse::kLQ2D);
+      reducedParticle->fTRDpid[0]    = trdProbab[AliPID::kElectron];
+      reducedParticle->fTRDpid[1]    = trdProbab[AliPID::kPion];
+      
       if(aodTrack->IsEMCAL()) reducedParticle->fCaloClusterId = aodTrack->GetEMCALcluster();
       if(aodTrack->IsPHOS()) reducedParticle->fCaloClusterId = aodTrack->GetPHOScluster();
       if(values[AliDielectronVarManager::kKinkIndex0]>0.0) reducedParticle->fFlags |= (1<<5);
@@ -809,6 +873,7 @@ AliReducedPair* AliAnalysisTaskReducedTree::FillV0PairInfo(AliESDv0* v0, Int_t i
     reducedPair->fEta          = v0->Eta();
     reducedPair->fLxy          = v0->GetRr();
     reducedPair->fPointingAngle = v0->GetV0CosineOfPointingAngle(vtxKF->GetX(), vtxKF->GetY(), vtxKF->GetZ());
+    reducedPair->fChisquare    = v0->GetChi2V0();
   }
   else {
     const AliExternalTrackParam *negHelix=v0->GetParamN();
@@ -842,21 +907,29 @@ AliReducedPair* AliAnalysisTaskReducedTree::FillV0PairInfo(AliESDv0* v0, Int_t i
     Double_t deltaPos2 = deltaPos[0]*deltaPos[0] + deltaPos[1]*deltaPos[1] + deltaPos[2]*deltaPos[2];
     reducedPair->fPointingAngle = (deltaPos[0]*v0Refit.GetPx() + deltaPos[1]*v0Refit.GetPy() + deltaPos[2]*v0Refit.GetPz()) / 
                                   TMath::Sqrt(momV02*deltaPos2);
+    reducedPair->fChisquare = v0Refit.GetChi2();                              
   }
   return reducedPair;
 }
 
 
 //_________________________________________________________________________________
-UChar_t AliAnalysisTaskReducedTree::EncodeTPCClusterMap(AliESDtrack* track) {
+UChar_t AliAnalysisTaskReducedTree::EncodeTPCClusterMap(AliVParticle* track, Bool_t isAOD) {
   //
   // Encode the TPC cluster map into an UChar_t
   // Divide the 159 bits from the bit map into 8 groups of adiacent clusters
   // For each group enable its corresponding bit if in that group there are more clusters compared to
   // a threshold.
   //
+  AliESDtrack* esdTrack=0x0;
+  AliAODTrack* aodTrack=0x0;
+  if(isAOD)
+    aodTrack=static_cast<AliAODTrack*>(track);
+  else
+    esdTrack=static_cast<AliESDtrack*>(track);
+  
   const UChar_t threshold=5;
-  TBits tpcClusterMap = track->GetTPCClusterMap();
+  TBits tpcClusterMap = (isAOD ? aodTrack->GetTPCClusterMap() : esdTrack->GetTPCClusterMap());
   UChar_t map=0;
   UChar_t n=0;
   UChar_t j=0;
@@ -869,12 +942,47 @@ UChar_t AliAnalysisTaskReducedTree::EncodeTPCClusterMap(AliESDtrack* track) {
 }
 
 
+//_________________________________________________________________________________
+Int_t AliAnalysisTaskReducedTree::GetSPDTrackletMultiplicity(AliVEvent* event, Float_t lowEta, Float_t highEta) {
+  //
+  // Count the number of SPD tracklets in a given eta range
+  //
+  if (!event) return -1;
+  
+  Int_t nTracklets = 0;
+  Int_t nAcc = 0;
+  
+  if(event->IsA() == AliAODEvent::Class()) {
+    AliAODTracklets *tracklets = ((AliAODEvent*)event)->GetTracklets();
+    nTracklets = tracklets->GetNumberOfTracklets();
+    for(Int_t nn=0; nn<nTracklets; ++nn) {
+      Double_t theta = tracklets->GetTheta(nn);
+      Double_t eta = -TMath::Log(TMath::Tan(theta/2.0));
+      if(eta < lowEta) continue;
+      if(eta > highEta) continue;
+      ++nAcc;
+    }
+  } else if(event->IsA() == AliESDEvent::Class()) {
+    nTracklets = ((AliESDEvent*)event)->GetMultiplicity()->GetNumberOfTracklets();
+    for(Int_t nn=0; nn<nTracklets; ++nn) {
+      Double_t eta = ((AliESDEvent*)event)->GetMultiplicity()->GetEta(nn);
+      if(eta < lowEta) continue;
+      if(eta > highEta) continue; 
+      ++nAcc;
+    }
+  } else return -1;
+  
+  return nAcc;
+}
+
+
 //_________________________________________________________________________________
 void AliAnalysisTaskReducedTree::FinishTaskOutput()
 {
   //
   // Finish Task 
   //
-  fTreeFile->Write();
-  fTreeFile->Close();
+  
+  //fTreeFile->Write();
+  //fTreeFile->Close();
 }
index ed6acd29e7f44f8c1c797ecd1d4d34b6668e995f..5b7b42402f4e08d78bc688ef455f394f5b4e413f 100644 (file)
@@ -50,11 +50,8 @@ public:
   void SetLambdaPionCuts(AliAnalysisCuts * const filter) {fLambdaPionCuts=filter;}
   void SetGammaElectronCuts(AliAnalysisCuts* const filter) {fGammaElectronCuts=filter;}
   void SetK0sCuts(AliESDv0Cuts* const cuts) {fK0sCuts = cuts;}
-  //void SetK0sStrongCuts(AliESDv0Cuts* const cuts) {fK0sStrongCuts = cuts;}
   void SetLambdaCuts(AliESDv0Cuts* const cuts) {fLambdaCuts = cuts;}
-  //void SetLambdaStrongCuts(AliESDv0Cuts* const cuts) {fLambdaStrongCuts = cuts;}
   void SetGammaConvCuts(AliESDv0KineCuts* const cuts) {fGammaConvCuts = cuts;}
-  //void SetGammaConvStrongCuts(AliESDv0KineCuts* const cuts) {fGammaConvStrongCuts = cuts;}
   void SetV0OpenCuts(AliESDv0KineCuts* const cuts) {fV0OpenCuts = cuts;}
   void SetV0StrongCuts(AliESDv0KineCuts* const cuts) {fV0StrongCuts = cuts;}
   void SetK0sMassRange(Double_t min=0.4, Double_t max=0.6) {fK0sMassRange[0]=min; fK0sMassRange[1]=max;}
@@ -103,8 +100,8 @@ public:
   AliESDv0Cuts *fLambdaCuts;         // v0 standard filter for Lambda0->p + pi
   AliESDv0KineCuts *fGammaConvCuts;  // v0 standard filter for gamma conversions
   AliAnalysisCuts *fK0sPionCuts;     // filter for pions from K0s
-  AliAnalysisCuts *fLambdaProtonCuts;// filter for protons from Lambda
-  AliAnalysisCuts *fLambdaPionCuts;  // filter for pions from Lambda
+  AliAnalysisCuts *fLambdaProtonCuts;   // filter for protons from Lambda
+  AliAnalysisCuts *fLambdaPionCuts;     // filter for pions from Lambda
   AliAnalysisCuts *fGammaElectronCuts;  // filter for electrons from gamma conversions
   AliESDv0KineCuts *fV0OpenCuts;       // v0 strong filter for tagged V0s
   AliESDv0KineCuts *fV0StrongCuts;     // v0 strong filter for tagged V0s
@@ -128,8 +125,9 @@ public:
   void FillDielectronPairInfo(AliDielectron* die, Short_t iDie);  // fill dielectron reduced pair information
   void FillV0PairInfo();                    // fill V0 reduced pair information
   AliReducedPair* FillV0PairInfo(AliESDv0* v0, Int_t id, AliESDtrack* legPos, AliESDtrack* legNeg, AliKFVertex* vtxKF, Bool_t chargesAreCorrect);
-  UChar_t EncodeTPCClusterMap(AliESDtrack* track);
+  UChar_t EncodeTPCClusterMap(AliVParticle* track, Bool_t isAOD);
   void FillCaloClusters();
+  Int_t GetSPDTrackletMultiplicity(AliVEvent* event, Float_t lowEta, Float_t highEta);
   
   AliAnalysisTaskReducedTree(const AliAnalysisTaskReducedTree &c);
   AliAnalysisTaskReducedTree& operator= (const AliAnalysisTaskReducedTree &c);
index 5b8152473cfd7cf719f18fdbdbf05c9af4c728b4..892c70cb4fa16019bde7280df442453d60b7b97f 100644 (file)
@@ -86,6 +86,7 @@ AliReducedPair::AliReducedPair() :
   fLxy(0.0),
   fLxyErr(0.0),
   fPointingAngle(0.0),
+  fChisquare(0.0),
   fMCid(0)
 {
   //
@@ -109,6 +110,7 @@ AliReducedPair::AliReducedPair(const AliReducedPair &c) :
   fLxy(c.Lxy()),
   fLxyErr(c.LxyErr()),
   fPointingAngle(c.PointingAngle()),
+  fChisquare(c.Chi2()),
   fMCid(c.MCid())
 {
   //
@@ -132,12 +134,20 @@ AliReducedEvent::AliReducedEvent() :
   TObject(),
   fRunNo(0),
   fBC(0),
+  fTimeStamp(0),
+  fEventType(0),
   fTriggerMask(0),
   fIsPhysicsSelection(kTRUE),
+  fIsSPDPileup(kTRUE),
   fVtx(),
   fNVtxContributors(0),
   fVtxTPC(),
   fNVtxTPCContributors(0),
+  fNpileupSPD(0),
+  fNpileupTracks(0),
+  fNPMDtracks(0),
+  fNTRDtracks(0),
+  fNTRDtracklets(0),
   fCentrality(),
   fCentQuality(0),
   fNV0candidates(),
@@ -159,6 +169,8 @@ AliReducedEvent::AliReducedEvent() :
   for(Int_t i=0; i<4; ++i) fCentrality[i]=-1.;
   fNV0candidates[0]=0; fNV0candidates[1]=0;
   fNtracks[0]=0; fNtracks[1]=0;
+  for(Int_t i=0; i<16; ++i) fSPDntrackletsEta[i]=0;
+  for(Int_t i=0; i<32; ++i) fNtracksPerTrackingFlag[i]=0;
   for(Int_t i=0; i<64; ++i) fVZEROMult[i] = 0.0;
   for(Int_t i=0; i<8; ++i) fZDCnEnergy[i]=0.0;
 }
@@ -169,12 +181,20 @@ AliReducedEvent::AliReducedEvent(const Char_t* /*name*/) :
   TObject(),
   fRunNo(0),
   fBC(0),
+  fTimeStamp(0),
+  fEventType(0),
   fTriggerMask(0),
   fIsPhysicsSelection(kTRUE),
+  fIsSPDPileup(kTRUE),
   fVtx(),
   fNVtxContributors(0),
   fVtxTPC(),
   fNVtxTPCContributors(0),
+  fNpileupSPD(0),
+  fNpileupTracks(0),
+  fNPMDtracks(0),
+  fNTRDtracks(0),
+  fNTRDtracklets(0),
   fCentrality(),
   fCentQuality(0),
   fNV0candidates(),
@@ -196,6 +216,8 @@ AliReducedEvent::AliReducedEvent(const Char_t* /*name*/) :
   for(Int_t i=0; i<4; ++i) fCentrality[i]=-1.;
   fNV0candidates[0]=0; fNV0candidates[1]=0;
   fNtracks[0]=0; fNtracks[1]=0;
+  for(Int_t i=0; i<16; ++i) fSPDntrackletsEta[i]=0;
+  for(Int_t i=0; i<32; ++i) fNtracksPerTrackingFlag[i]=0;
   for(Int_t i=0; i<64; ++i) fVZEROMult[i] = 0.0;
   for(Int_t i=0; i<8; ++i) fZDCnEnergy[i]=0.0;
   
@@ -293,12 +315,22 @@ void AliReducedEvent::ClearEvent() {
   if(fCaloClusters) fCaloClusters->Clear("C");
   fRunNo = 0;
   fBC = 0;
+  fTimeStamp = 0;
+  fEventType = 0;
   fTriggerMask = 0;
   fIsPhysicsSelection = kTRUE;
+  fIsSPDPileup = kFALSE;
   fCentQuality = 0;
   fNV0candidates[0] = 0; fNV0candidates[1] = 0;
+  fNpileupSPD=0;
+  fNpileupTracks=0;
+  fNPMDtracks=0;
+  fNTRDtracks=0;
+  fNTRDtracklets=0;
   fNDielectronCandidates = 0;
   fNtracks[0] = 0; fNtracks[1] = 0;
+  for(Int_t i=0; i<16; ++i) fSPDntrackletsEta[i] = 0;
+  for(Int_t i=0; i<32; ++i) fNtracksPerTrackingFlag[i] = 0;
   for(Int_t i=0; i<3; ++i) {fVtx[i]=-999.; fVtxTPC[i]=-999.; fCentrality[i]=-1.;}
   for(Int_t i=0; i<64; ++i) fVZEROMult[i] = 0.0;
   for(Int_t i=0; i<8; ++i) fZDCnEnergy[i]=0.0;
index 98c5ce41e7834dfc92fd6c92588f685458965d39..7f06b74a3fd24626dc94ed20a66421e5eff66b9b 100644 (file)
@@ -182,8 +182,10 @@ class AliReducedPair : public TObject {
   Float_t  Rapidity()            const;
   Float_t  Theta()               const {return TMath::ACos(TMath::TanH(fEta));}
   Float_t  Lxy()                 const {return fLxy;}
+  Float_t  Radius()              const {return fLxy;}
   Float_t  LxyErr()              const {return fLxyErr;}
   Float_t  PointingAngle()       const {return fPointingAngle;}
+  Float_t  Chi2()                const {return fChisquare;}
   Bool_t   IsOnTheFly()          const {return fPairType;}
   Bool_t   IsPureV0K0s()         const {return (fMCid&(UInt_t(1)<<1));}
   Bool_t   IsPureV0Lambda()      const {return (fMCid&(UInt_t(1)<<2));}
@@ -201,14 +203,15 @@ class AliReducedPair : public TObject {
   Float_t fPhi;                 // pair phi in the [0,2*pi) interval
   Float_t fPt;                  // pair pt
   Float_t fEta;                 // pair eta 
-  Float_t fLxy;                 // pseudo-proper decay length
+  Float_t fLxy;                 // pseudo-proper decay length (pair candidates) or radius of the secondary vertex for V0s 
   Float_t fLxyErr;              // error on Lxy
   Float_t fPointingAngle;       // angle between the pair momentum vector and the secondary vertex position vector
+  Float_t fChisquare;           // chi2 for the legs matching
   UInt_t  fMCid;                // Bit map with Monte Carlo info about the pair
 
   AliReducedPair& operator= (const AliReducedPair &c);
 
-  ClassDef(AliReducedPair, 2);
+  ClassDef(AliReducedPair, 3);
 };
 
 
@@ -316,12 +319,20 @@ class AliReducedEvent : public TObject {
   // getters
   Int_t     RunNo()                           const {return fRunNo;}
   UShort_t  BC()                              const {return fBC;}
+  UInt_t    TimeStamp()                       const {return fTimeStamp;}
+  UInt_t    EventType()                       const {return fEventType;}
   ULong64_t TriggerMask()                     const {return fTriggerMask;}
   Bool_t    IsPhysicsSelection()              const {return fIsPhysicsSelection;}
+  Bool_t    IsSPDPileup()                     const {return fIsSPDPileup;}
   Float_t   Vertex(Int_t axis)                const {return (axis>=0 && axis<=2 ? fVtx[axis] : 0);}
   Int_t     VertexNContributors()             const {return fNVtxContributors;}
   Float_t   VertexTPC(Int_t axis)             const {return (axis>=0 && axis<=2 ? fVtxTPC[axis] : 0);}
   Int_t     VertexTPCContributors()           const {return fNVtxTPCContributors;}
+  Int_t     NpileupSPD()                      const {return fNpileupSPD;}
+  Int_t     NpileupTracks()                   const {return fNpileupTracks;}
+  Int_t     NPMDtracks()                      const {return fNPMDtracks;}
+  Int_t     NTRDtracks()                      const {return fNTRDtracks;}
+  Int_t     NTRDtracklets()                   const {return fNTRDtracklets;}
   Float_t   CentralityVZERO()                 const {return fCentrality[0];}
   Float_t   CentralitySPD()                   const {return fCentrality[1];}
   Float_t   CentralityTPC()                   const {return fCentrality[2];}
@@ -333,6 +344,8 @@ class AliReducedEvent : public TObject {
   Int_t     NTracksTotal()                    const {return fNtracks[0];}
   Int_t     NTracks()                         const {return fNtracks[1];}
   Int_t     SPDntracklets()                   const {return fSPDntracklets;}
+  Int_t     SPDntracklets(Int_t bin)          const {return (bin>=0 && bin<16 ? fSPDntrackletsEta[bin] : -999);}
+  Int_t     TracksPerTrackingFlag(Int_t flag) const {return (flag>=0 && flag<32 ? fNtracksPerTrackingFlag[flag] : -999);}
   
   Float_t   MultChannelVZERO(Int_t channel)   const {return (channel>=0 && channel<=63 ? fVZEROMult[channel] : -999.);}
   Float_t   MultVZEROA()                      const;
@@ -370,19 +383,29 @@ class AliReducedEvent : public TObject {
  private:
   Int_t     fRunNo;                 // run number
   UShort_t  fBC;                    // bunch crossing
+  UInt_t    fTimeStamp;             // time stamp of the event                (NEW)
+  UInt_t    fEventType;             // event type                             (NEW)
   ULong64_t fTriggerMask;           // trigger mask
   Bool_t    fIsPhysicsSelection;    // PhysicsSelection passed event
+  Bool_t    fIsSPDPileup;           // identified as pileup event by SPD
   Float_t   fVtx[3];                // global event vertex vector in cm
   Int_t     fNVtxContributors;      // global event vertex contributors
   Float_t   fVtxTPC[3];             // TPC only event vertex           
   Int_t     fNVtxTPCContributors;   // TPC only event vertex contributors
+  Int_t     fNpileupSPD;            // number of pileup vertices from SPD     (NEW)
+  Int_t     fNpileupTracks;         // number of pileup vertices from tracks  (NEW)
+  Int_t     fNPMDtracks;            // number of PMD tracks                   (NEW)
+  Int_t     fNTRDtracks;            // number of TRD tracks                   (NEW)
+  Int_t     fNTRDtracklets;         // number of TRD tracklets                (NEW)
   Float_t   fCentrality[4];         // centrality; 0-VZERO, 1-SPD, 2-TPC, 3-ZEMvsZDC 
   Int_t     fCentQuality;           // quality flag for the centrality 
   Int_t     fNV0candidates[2];      // number of V0 candidates, [0]-total, [1]-selected for the tree
   Int_t     fNDielectronCandidates; // number of pairs selected as dielectrons
   Int_t     fNtracks[2];            // number of tracks, [0]-total, [1]-selected for the tree
   Int_t     fSPDntracklets;         // number of SPD tracklets in |eta|<1.0 
-
+  Int_t     fSPDntrackletsEta[16];  // number of SPD tracklets in equal eta bins between -1.6 --> +1.6    (NEW)
+  Int_t     fNtracksPerTrackingFlag[32];  // number of tracks for each tracking status bit                (NEW)
+  
   Float_t   fVZEROMult[64];         // VZERO multiplicity in all 64 channels
   Float_t   fZDCnEnergy[8];         // neutron ZDC energy in all 8 channels
     
@@ -400,7 +423,7 @@ class AliReducedEvent : public TObject {
   AliReducedEvent(const AliReducedEvent &c);
   AliReducedEvent& operator= (const AliReducedEvent &c);
 
-  ClassDef(AliReducedEvent, 2);
+  ClassDef(AliReducedEvent, 4);
 };
 
 //_______________________________________________________________________________
index dedee1e10c4a4b7866a133b6f6c844404fbd6420..24c941c210518471dfa14a94156897988098cb46 100644 (file)
@@ -58,6 +58,7 @@ AliAnalysisTask *AddTask_jbook_JPsi(TString prod="",
   printf("config:     %s Grid: %d \n",configFile.Data(),gridconf);
 
   task = new AliAnalysisTaskMultiDielectron((Form("MultiDieJB_%s",triggerNames[j])));
+  task->SetBeamEnergy(1380.);
   task->SetTriggerMask(triggers);
   //task->SetTriggerMask(AliVEvent::kMB);
 
index 2e1590572ca33f6e5da6a074b0f8bf2962767a21..cf5b559be79a016c06a50c31ad4a6365b878cc7d 100644 (file)
@@ -6,6 +6,8 @@ void SetupPairCuts(AliDielectron *die,  Int_t cutDefinition);
 
 void AddMCSignals(AliDielectron *die);
 
+void SetupNanoTrackCuts(AliDielectron *die, Int_t cutDefinition);
+
 void SetEtaCorrection();
 TVectorD *GetRunNumbers();
 
@@ -55,8 +57,9 @@ AliDielectron* ConfigJpsiQA_jpsi_PbPb(Int_t cutDefinition, TString prod="", ULon
 
   // cut setup
   SetupEventCuts(die,triggers);
-  SetupTrackCuts(die,cutDefinition);
-  SetupPairCuts(die,cutDefinition);
+  //SetupTrackCuts(die,cutDefinition);
+  SetupNanoTrackCuts(die,cutDefinition);
+  //  SetupPairCuts(die,cutDefinition);
 
   // MC signals
   if(hasMC) {
@@ -91,7 +94,7 @@ AliDielectron* ConfigJpsiQA_jpsi_PbPb(Int_t cutDefinition, TString prod="", ULon
   */
 
   // prefilter settings
-  //die->SetNoPairing();
+  die->SetNoPairing();
   //die->SetPreFilterUnlikeOnly();
   //die->SetPreFilterAllSigns();
 
@@ -131,7 +134,7 @@ void SetupEventCuts(AliDielectron *die, ULong64_t triggers)
   eventCuts->SetRequireVertex();
   eventCuts->SetMinVtxContributors(1);
   eventCuts->SetVertexZ(-10.,+10.);
-  eventCuts->SetCentralityRange(minCent,maxCent);
+  //eventCuts->SetCentralityRange(minCent,maxCent);
 
   /*
   TF1 *fMean  = new TF1("fMean", "pol1",               0,25e+3);
@@ -171,7 +174,7 @@ void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition)
   AliDielectronTrackCuts *trkFilter = new AliDielectronTrackCuts("TrkFilter","TrkFilter");
   trkFilter->SetAODFilterBit(AliDielectronTrackCuts::kTPCqual);
   //  trkFilter->SetMinNCrossedRowsOverFindable(0.6);
-  if(!isESD) cuts->AddCut(trkFilter);
+  //if(!isESD) cuts->AddCut(trkFilter);
 
   AliDielectronTrackCuts *trkCuts = new AliDielectronTrackCuts("TrkCuts","TrkCuts");
   trkCuts->SetITSclusterCut(AliDielectronTrackCuts::kOneOf, 15); // ITS-4 = 1+2+4+8
@@ -187,15 +190,15 @@ void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition)
 
   // track cuts ESD and AOD
   AliDielectronVarCuts *varCuts = new AliDielectronVarCuts("VarCuts","VarCuts");
-  varCuts->AddCut(AliDielectronVarManager::kImpactParXY, -1.0,   1.0);
-  varCuts->AddCut(AliDielectronVarManager::kImpactParZ,  -3.0,   3.0);
-  varCuts->AddCut(AliDielectronVarManager::kEta,         -0.9,   0.9);
+  //varCuts->AddCut(AliDielectronVarManager::kImpactParXY, -1.0,   1.0);
+  //varCuts->AddCut(AliDielectronVarManager::kImpactParZ,  -3.0,   3.0);
+  //  varCuts->AddCut(AliDielectronVarManager::kEta,         -0.9,   0.9);
   varCuts->AddCut(AliDielectronVarManager::kTPCchi2Cl,    0.0,   4.0);
   //varCuts->AddCut(AliDielectronVarManager::kNclsTPC,     70.0, 160.0);
   varCuts->AddCut(AliDielectronVarManager::kNclsTPC,     50.0, 160.0);
-  varCuts->AddCut(AliDielectronVarManager::kKinkIndex0,   0.0);
+  //varCuts->AddCut(AliDielectronVarManager::kKinkIndex0,   0.0);
   //varCuts->AddCut(AliDielectronVarManager::kTOFbeta,      0.2,   0.9, kTRUE);
-  varCuts->Print();
+  //varCuts->Print();
   cuts->AddCut(varCuts);
 
   /* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv PID CUTS vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */
@@ -232,14 +235,50 @@ void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition)
 
   } //hasMC
 
-  cuts->AddCut(pid);
+  //  cuts->AddCut(pid);
   /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PID CUTS ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
 
 
   // exclude conversion electrons selected by the tender
   AliDielectronTrackCuts *noconv=new AliDielectronTrackCuts("noConv","noConv");
   noconv->SetV0DaughterCut(AliPID::kElectron,kTRUE);
-  cuts->AddCut(noconv);
+  //cuts->AddCut(noconv);
+
+}
+
+void SetupNanoTrackCuts(AliDielectron *die, Int_t cutDefinition)
+{
+  //
+  // Setup the track cuts
+  //
+
+  // Quality cuts
+  AliDielectronCutGroup* cuts = new AliDielectronCutGroup("cuts","cuts",AliDielectronCutGroup::kCompAND);
+  die->GetTrackFilter().AddCuts(cuts);
+
+  AliDielectronTrackCuts *trkCuts = new AliDielectronTrackCuts("TrkCuts","TrkCuts");
+  //trkCuts->SetITSclusterCut(AliDielectronTrackCuts::kOneOf, 15); // ITS-4 = 1+2+4+8
+  trkCuts->SetRequireITSRefit(kTRUE);
+  trkCuts->SetRequireTPCRefit(kTRUE);
+  //  cuts->AddCut(trkCuts);
+
+  //Pt cut, should make execution a bit faster
+  AliDielectronVarCuts *pt = new AliDielectronVarCuts("PtCut","PtCut");
+  pt->AddCut(AliDielectronVarManager::kPt,0.7,1e30);    //1.1
+  cuts->AddCut(pt);
+  pt->Print();
+
+  // track cuts ESD and AOD
+  AliDielectronVarCuts *varCuts = new AliDielectronVarCuts("VarCuts","VarCuts");
+  varCuts->AddCut(AliDielectronVarManager::kImpactParXY, -1.0,   1.0);
+  varCuts->AddCut(AliDielectronVarManager::kImpactParZ,  -3.0,   3.0);
+  varCuts->AddCut(AliDielectronVarManager::kEta,         -0.9,   0.9);
+  varCuts->AddCut(AliDielectronVarManager::kTPCchi2Cl,    0.0,   4.0);
+  varCuts->AddCut(AliDielectronVarManager::kNclsTPC,     70.0, 160.0);
+  //varCuts->AddCut(AliDielectronVarManager::kKinkIndex0,   0.0);
+  varCuts->AddCut(AliDielectronVarManager::kTPCnSigmaEle,-3.2,   4.0);
+  //varCuts->Print();
+  //cuts->AddCut(varCuts);
 
 }
 
@@ -319,6 +358,12 @@ void InitHistograms(AliDielectron *die, Int_t cutDefinition)
     histos->UserHistogram("Event","","", 80.,0.,80., 150,-15.,15.,
                          AliDielectronVarManager::kCentrality, AliDielectronVarManager::kZvPrim);
 
+    histos->UserHistogram("Event","","", 300.,0.,6000., 300,0.,6000.,
+                         AliDielectronVarManager::kNVtxContrib, AliDielectronVarManager::kNVtxContribTPC);
+    histos->UserHistogram("Event","","", 200.,0.,4000., 200,0.,4000.,
+                         AliDielectronVarManager::kNVtxContrib, AliDielectronVarManager::kNacc);
+
+
     histos->UserHistogram("Event","","", GetRunNumbers(), AliDielectronHelper::MakeLinBinning(250,0.,25000.),
                          AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kMultV0);
     histos->UserHistogram("Event","","", 80.,0.,80., 250,0.,25000.,
@@ -333,6 +378,8 @@ void InitHistograms(AliDielectron *die, Int_t cutDefinition)
     histos->UserHistogram("Event","","", 200,0.,20000., 250,0.,25000., AliDielectronVarManager::kNTrk, AliDielectronVarManager::kMultV0A);
     histos->UserHistogram("Event","","", 200,0.,20000., 250,0.,25000., AliDielectronVarManager::kNTrk, AliDielectronVarManager::kMultV0C);
 
+    
+
     histos->UserHistogram("Event","","", 
                          AliDielectronHelper::MakeLinBinning(200,0.,20000.),
                          AliDielectronHelper::MakeLinBinning(250,0.,25000.),
@@ -352,12 +399,16 @@ void InitHistograms(AliDielectron *die, Int_t cutDefinition)
                          AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kv0ArpH2);
     histos->UserHistogram("Event","","", GetRunNumbers(), AliDielectronHelper::MakeLinBinning(100,-2.,+2.),
                          AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kv0CrpH2);
-    //     histos->UserHistogram("Event","","", GetRunNumbers(), AliDielectronHelper::MakeLinBinning(100,-2.,+2.),
-    //                           AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kTPCrpH2);
+    histos->UserHistogram("Event","","", GetRunNumbers(), AliDielectronHelper::MakeLinBinning(100,-2.,+2.),
+                         AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kTPCrpH2uc);
     histos->UserHistogram("Event","","", 80,0.,80., 100,-2.,+2.,
                          AliDielectronVarManager::kCentrality, AliDielectronVarManager::kv0CrpH2);
     histos->UserHistogram("Event","","", 80,0.,80., 100,-2.,+2.,
                          AliDielectronVarManager::kCentrality, AliDielectronVarManager::kv0ArpH2);
+    histos->UserHistogram("Event","","", 80,0.,80., 100,-2.,+2.,
+                         AliDielectronVarManager::kCentrality, AliDielectronVarManager::kTPCrpH2uc);
+    histos->UserHistogram("Event","","", 80,0.,80., 100,0.,250.,
+                         AliDielectronVarManager::kCentrality, AliDielectronVarManager::kTPCmagH2uc);
 
   }
 
index dbf6f5aaf3a92621bd1accf1389f97c93b53f407..ee9c9da142ce38698dabe637be5756df9af39828 100644 (file)
@@ -2,13 +2,18 @@ void InitHistograms(AliDielectron *die, Int_t cutDefinition);
 void InitCF(AliDielectron* die, Int_t cutDefinition);
 void InitHF(AliDielectron* die, Int_t cutDefinition);
 
-void SetupEventCuts(AliDielectron *die, ULong64_t triggers);
+void SetupEventCuts(AliDielectron *die, ULong64_t triggers, Int_t cutDefinition);
 void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition);
-void SetupPairCuts(AliDielectron *die,  Int_t cutDefinition);
+void SetupV0Cuts( AliDielectron *die,  Int_t cutDefinition);
+void SetupPairCuts( AliDielectron *die,  Int_t cutDefinition);
+
+void ConfigEvtPlane(AliDielectron *die,  Int_t cutDefinition);
+void ConfigBgrd(    AliDielectron *die,  Int_t cutDefinition);
 
 void AddMCSignals(AliDielectron *die);
 void SetEtaCorrection();
 TVectorD *GetRunNumbers();
+TVectorD *GetDeltaPhiBins();
 
 TString names=("TPC;TOF;TRD;TOFTRD;TOFTRD2D;rec;Gam0;Gam01;Gam05;Gam10;Gam15;Gam20;EtaGap01;EtaGap02;EtaGap03;EtaGap04;EtaGap05;SubLS;SubRndm");
 enum { kTPC=0, kTOF, kTRD, kTOFTRD, kTOFTRD2D, krec,kGam0, kGam01, kGam05, kGam10, kGam15, kGam20, kEtaGap01, kEtaGap02, kEtaGap03, kEtaGap04, kEtaGap05, kSubLS, kSubRndm };
@@ -20,12 +25,16 @@ Bool_t  isESD = kTRUE;
 Bool_t  hasMC = kFALSE;
 TString list  = gSystem->Getenv("LIST");
 
-AliDielectron* ConfigJpsi_jb_PbPb(Int_t cutDefinition, TString prod=""/*, ULong64_t triggers=AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB*/)
+AliDielectron* ConfigJpsi_jb_PbPb(Int_t cutDefinition, TString prod="", ULong64_t triggers=AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB)
 {
   //
   // Setup the instance of AliDielectron
   //
 
+  // gsi train?
+  TString trainRoot = gSystem->Getenv("TRAIN_ROOT");
+  Bool_t isGSItrain = (trainRoot.IsNull()?kFALSE:kTRUE); 
+
   // find mc or not?
   if( list.IsNull()) list=prod;
   if( list.Contains("LHC10h")   || list.Contains("LHC11h")   ) hasMC=kFALSE;
@@ -34,148 +43,72 @@ AliDielectron* ConfigJpsi_jb_PbPb(Int_t cutDefinition, TString prod=""/*, ULong6
   //ESD handler?
   isESD=(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->IsA()==AliESDInputHandler::Class());
 
-  // switch off some configurations
+  // switch configurations ON and OFF
   if(hasMC) { // MONTE CARLO
     switch(cutDefinition) {
-    case kTPC:       return 0x0;
-    case kTOF:       return 0x0;
-    case kTRD:       return 0x0;
-    case kTOFTRD:    return 0x0;
-    case kTOFTRD2D:  return 0x0;
-    case krec:       return 0x0;
-    case kGam0:      return 0x0;
-    case kGam01:     return 0x0;
-    case kGam05:     return 0x0;
-    case kGam10:     return 0x0;
-    case kGam15:     return 0x0;
-    case kGam20:     return 0x0;
-    case kEtaGap01:  return 0x0;
-    case kEtaGap02:  return 0x0;
-    case kEtaGap03:  return 0x0;
-    case kEtaGap04:  return 0x0;
-    case kEtaGap05:  return 0x0;
-    case kSubLS:     return 0x0;
-    case kSubRndm:   return 0x0;
+    case kTOF: /* */ break;
+    default:         return 0x0;
     }
   } else { // COLLISION DATA
     switch(cutDefinition) {
-    case kTPC:       return 0x0;
-      //            case kTOF:       return 0x0;
-    case kTRD:       return 0x0;
-      //            case kTOFTRD:    return 0x0;
-    case kTOFTRD2D:  return 0x0;
-    case krec:       return 0x0;
-    case kGam0:      return 0x0;
-    case kGam01:     return 0x0;
-    case kGam05:     return 0x0;
-    case kGam10:     return 0x0;
-    case kGam15:     return 0x0;
-    case kGam20:     return 0x0;
-    case kEtaGap01:  return 0x0;
-    case kEtaGap02:  return 0x0;
-    case kEtaGap03:  return 0x0;
-    case kEtaGap04:  return 0x0;
-    case kEtaGap05:  return 0x0;
-    case kSubLS:     return 0x0;
-    case kSubRndm:   return 0x0;
+    case kTOF: /* */ break;
+    default:         return 0x0;
     }
   }
 
-  // create the actual framework object
+  // task name
   TString name=Form("%02d",cutDefinition);
-  if (cutDefinition<arrNames->GetEntriesFast()){
-    name=arrNames->At(cutDefinition)->GetName();
-  }
-  printf(" Adding %s %s config %s for %s \n",(isESD?"ESD":"AOD"),(hasMC?"MC":""),name.Data(),list.Data());
+  if (cutDefinition<arrNames->GetEntriesFast())  name=arrNames->At(cutDefinition)->GetName();
+  printf(" Adding %s%s config %s for %s \n",(isESD?"ESD":"AOD"),(hasMC?" MC":""),name.Data(),list.Data());
+
+  // init AliDielectron
   AliDielectron *die = new AliDielectron(Form("%s",name.Data()), Form("Track cuts: %s",name.Data()));
   die->SetHasMC(hasMC);
 
   // cut setup
-  SetupEventCuts(die,triggers);
+  SetupEventCuts(die,triggers,cutDefinition);
   SetupTrackCuts(die,cutDefinition);
-  SetupPairCuts(die,cutDefinition);
+  SetupV0Cuts(die,cutDefinition);
+  //  SetupPairCuts(die,cutDefinition);
 
-  // Monte Carlo Signals and TRD efficiency tables
+  // Monte Carlo Signals
   if(hasMC) {
     AddMCSignals(die);
     printf(" Add %d MC signals \n",die->GetMCSignals()->GetEntriesFast());
-
-    // trd tables
-    /* if (list.Contains("LHC11a") ) {
-      TString pidTab="$TRAIN_ROOT/util/dielectron/dielectron/TRDpidEff_eleProb07_TRDntr4_6.root";
-      TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
-      if (trainRoot.IsNull()) pidTab="$ALICE_ROOT/PWGDQ/dielectron/files/TRDpidEff_eleProb07_TRDntr4_6.root";
-
-      if (gSystem->AccessPathName(gSystem->ExpandPathName(pidTab.Data())))
-       Error("ConfigPbPb","PID table not found: %s",pidTab.Data());
-      else
-       die->SetTRDcorrectionFilename(pidTab.Data());
-       }*/
   }
 
+  // TRD efficiencies tables
+  /*
+    if (hasMC && list.Contains("LHC11a") ) {
+     TString pidTab="$TRAIN_ROOT/util/dielectron/dielectron/TRDpidEff_eleProb07_TRDntr4_6.root";
+     if(!isGSItrain) pidTab="$ALICE_ROOT/PWGDQ/dielectron/files/TRDpidEff_eleProb07_TRDntr4_6.root";
+
+     if (gSystem->AccessPathName(gSystem->ExpandPathName(pidTab.Data())))
+     Error("ConfigPbPb","PID table not found: %s",pidTab.Data());
+     else
+     die->SetTRDcorrectionFilename(pidTab.Data());
+     }
+  */
+
   // histogram setup
   InitHistograms(die,cutDefinition);
   printf(" Add %d class types to the histo manager \n",die->GetHistogramList()->GetEntries());
 
-
+  // HF array setup
+  InitHF(die,cutDefinition);
 
   // CF container setup, switched off
-  if(cutDefinition <  kEtaGap01 ||
-     cutDefinition == kSubRndm  ) {
-    if(0) InitCF(die,cutDefinition);
-    if(0) printf(" Add %d pair, %d leg vars, %p steps and %p bins to the container \n",
+  InitCF(die,cutDefinition);
+  /* printf(" Add %d pair, %d leg vars, %p steps and %p bins to the container \n",
                 die->GetCFManagerPair()->GetNvarsPair(),die->GetCFManagerPair()->GetNvarsLeg(),
                 die->GetCFManagerPair()->GetContainer(), die->GetCFManagerPair()->GetContainer() );
-  }
-
-  // HF arrays setup
-  InitHF(die,cutDefinition);
+  */
 
   // bgrd estimators
-  if(!hasMC) {
-      printf(" Activate bgrd estimators: ME and ROT \n");
-
-      // rotations
-      AliDielectronTrackRotator *rot=new AliDielectronTrackRotator;
-      rot->SetIterations(10);
-      rot->SetConeAnglePhi(TMath::Pi());
-      rot->SetStartAnglePhi(TMath::Pi());
-      //      die->SetTrackRotator(rot);
-
-      // mixing
-      AliDielectronMixingHandler *mix=new AliDielectronMixingHandler;
-      //mix->AddVariable(AliDielectronVarManager::kZvPrim,     20,-10.,10.);
-      //mix->AddVariable(AliDielectronVarManager::kCentrality,  8,  0.,5.);
-      //mix->AddVariable(AliDielectronVarManager::kv0ACrpH2,    8,  TMath::Pi()/-2., TMath::Pi()/2.);
-      mix->SetMixType(AliDielectronMixingHandler::kAll);
-      mix->SetDepth(150);
-      die->SetMixingHandler(mix);
-
-      // TPC event plane configurations
-      Double_t gGap;
-      switch(cutDefinition) {
-      case kEtaGap01:   gGap=0.1;   break;
-      case kEtaGap02:   gGap=0.2;   break;
-      case kEtaGap03:   gGap=0.3;   break;
-      case kEtaGap04:   gGap=0.4;   break;
-      case kEtaGap05:   gGap=0.5;   break;
-      default: gGap=0.0;
-      }
-
-    AliDielectronVarCuts *poi = new AliDielectronVarCuts("PoI","PoI");
-    poi->AddCut(AliDielectronVarManager::kM,2.92,3.20);     // particles of interest, jpsi mass window
-    die->GetEventPlanePOIPreFilter().AddCuts(poi);
+  if(!hasMC) ConfigBgrd(die,cutDefinition);
 
-    if(cutDefinition >= kEtaGap01 &&
-       cutDefinition <  kSubLS     ) {
-      AliDielectronVarCuts *etaGap = new AliDielectronVarCuts(AliDielectronVarManager::GetValueName(AliDielectronVarManager::kEta),"etaGap");
-      etaGap->AddCut(AliDielectronVarManager::kEta,-1*gGap,gGap,kTRUE);
-      die->GetEventPlanePreFilter().AddCuts(etaGap);
-    }
-
-    if(cutDefinition==kSubLS) die->SetLikeSignSubEvents();
-    die->SetPreFilterEventPlane();
-  }
+  // tpc event plane configuration
+  ConfigEvtPlane(die,cutDefinition);
 
   // prefilter settings
   die->SetPreFilterUnlikeOnly();
@@ -183,11 +116,10 @@ AliDielectron* ConfigJpsi_jb_PbPb(Int_t cutDefinition, TString prod=""/*, ULong6
   //die->SetNoPairing();
 
   // setup eta correction
-  //  if(isESD && list.Contains("LHC10h")) SetEtaCorrection();
+  // if(isESD && list.Contains("LHC10h")) SetEtaCorrection();
 
   // VZERO calibration
-  TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
-  if (!trainRoot.IsNull()) {
+  if (isGSItrain && list.Contains("LHC10h")) {
     die->SetVZEROCalibrationFilename("$TRAIN_ROOT/util/dielectron/dielectron/VzeroCalibrationLHC10h.root");
     die->SetVZERORecenteringFilename("$TRAIN_ROOT/util/dielectron/dielectron/VzeroRecenteringLHC10h.root");
   }
@@ -196,7 +128,7 @@ AliDielectron* ConfigJpsi_jb_PbPb(Int_t cutDefinition, TString prod=""/*, ULong6
 }
 
 //______________________________________________________________________________________
-void SetupEventCuts(AliDielectron *die, ULong64_t triggers)
+void SetupEventCuts(AliDielectron *die, ULong64_t triggers, Int_t cutDefinition)
 {
   //
   // Setup the event cuts
@@ -212,6 +144,13 @@ void SetupEventCuts(AliDielectron *die, ULong64_t triggers)
     default:                      minCent= 0.; maxCent=80.; break;
     }
   }
+  //  if(cutDefinition >= kEtaGap01) {minCent=20.; maxCent=50.;} // v2 analysis
+
+  // VZERO multiplicity vs. number ob global tracks cut
+  TF1 *fMean  = new TF1("fMean", "pol1",               0,25e+3);
+  fMean->SetParameters(691.633, 1.4892);
+  TF1 *fSigma = new TF1("fSigma","[0]+sqrt([1]*x+[2])",0,25e+3);
+  fSigma->SetParameters(-83.6599, 36.7677, 69530.7);
 
   AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("eventCuts","eventCuts");
   if(!isESD) eventCuts->SetVertexType(AliDielectronEventCuts::kVtxAny);
@@ -219,15 +158,7 @@ void SetupEventCuts(AliDielectron *die, ULong64_t triggers)
   eventCuts->SetMinVtxContributors(1);
   eventCuts->SetVertexZ(-10.,+10.);
   eventCuts->SetCentralityRange(minCent,maxCent);
-
-  /*
-  TF1 *fMean  = new TF1("fMean", "pol1",               0,25e+3);
-  fMean->SetParameters(631.301, 1.49836);
-  TF1 *fSigma = new TF1("fSigma","[0]+sqrt([1]*x+[2])",0,25e+3);
-  fSigma->SetParameters(-25.7843, 32.8055, 35275.7);
   eventCuts->SetCutOnV0MultipicityNTrks(fMean, fSigma, 4.0);
-  */
-
   eventCuts->Print();
   die->GetEventFilter().AddCuts(eventCuts);
 
@@ -242,28 +173,24 @@ void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition)
 
   // Quality cuts
   AliDielectronCutGroup* cuts = new AliDielectronCutGroup("cuts","cuts",AliDielectronCutGroup::kCompAND);
-  //  cuts->AddDielectron(die);
   die->GetTrackFilter().AddCuts(cuts);
 
   // AOD track filter (needs to be first cut to speed up)
   AliDielectronTrackCuts *trkFilter = new AliDielectronTrackCuts("TrkFilter","TrkFilter");
-  //  trkFilter->AddCutQA(die->GetHistoManager());
   trkFilter->SetAODFilterBit(AliDielectronTrackCuts::kTPCqual);
   //  trkFilter->SetMinNCrossedRowsOverFindable(0.6);
   if(!isESD) cuts->AddCut(trkFilter);
 
   //Pt cut, should make execution a bit faster
   AliDielectronVarCuts *pt = new AliDielectronVarCuts("PtCut","PtCut");
-  //  pt->AddCutQA(die->GetHistoManager());
   pt->AddCut(AliDielectronVarManager::kPt,1.1,1e30);    //0.8
   cuts->AddCut(pt);
 
   // track cuts ESD and AOD
   AliDielectronVarCuts *varCuts = new AliDielectronVarCuts("VarCuts","VarCuts");
-  //  varCuts->AddCutQA(die->GetHistoManager());
   varCuts->AddCut(AliDielectronVarManager::kImpactParXY, -1.0,   1.0);
   varCuts->AddCut(AliDielectronVarManager::kImpactParZ,  -3.0,   3.0);
-  varCuts->AddCut(AliDielectronVarManager::kEta,         -0.9,   0.9);
+  varCuts->AddCut(AliDielectronVarManager::kEta,         -0.9,   0.9); // -0.9, 0.9
   varCuts->AddCut(AliDielectronVarManager::kTPCchi2Cl,    0.0,   4.0);
   varCuts->AddCut(AliDielectronVarManager::kNclsTPC,     70.0, 160.0);
   varCuts->AddCut(AliDielectronVarManager::kKinkIndex0,   0.0);
@@ -273,9 +200,6 @@ void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition)
   varCuts->Print();
 
   AliDielectronTrackCuts *trkCuts = new AliDielectronTrackCuts("TrkCuts","TrkCuts");
-  //  trkCuts->AddCutQA(die->GetHistoManager());
-  // trkCuts->SetClusterRequirementITS(AliDielectronTrackCuts::kSPD,AliDielectronTrackCuts::kAny);
-  // trkCuts->SetClusterRequirementITS(AliDielectronTrackCuts::kSPD,AliDielectronTrackCuts::kFirst);
   trkCuts->SetITSclusterCut(AliDielectronTrackCuts::kOneOf, 15); // ITS-4 = 1+2+4+8
   // trkCuts->SetMaxWaivedITSNcls(1);
   trkCuts->SetRequireITSRefit(kTRUE);
@@ -284,7 +208,6 @@ void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition)
 
   /* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv PID CUTS vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */
   AliDielectronPID *pid = new AliDielectronPID("PID","PID");
-  //  pid->AddCutQA(die->GetHistoManager());
   ////////////////////////////////// DATA
   if(!hasMC) {
     pid->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-100.,4.0,0.,0.,kTRUE);
@@ -398,10 +321,45 @@ void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition)
   // exclude conversion electrons selected by the tender
   AliDielectronTrackCuts *noconv=new AliDielectronTrackCuts("noConv","noConv");
   noconv->SetV0DaughterCut(AliPID::kElectron,kTRUE);
-  cuts->AddCut(noconv);
+  //  cuts->AddCut(noconv);
 
 }
 
+//______________________________________________________________________________________
+void SetupV0Cuts(AliDielectron *die, Int_t cutDefinition)
+{
+  //
+  // Setup the V0 cuts
+  //
+
+  // Quality cuts
+  TIter next(die->GetTrackFilter().GetCuts());
+  AliAnalysisCuts *cuts;
+  while((cuts = (AliAnalysisCuts*)next())) {
+    if(cuts->IsA() == AliDielectronCutGroup::Class())  break;
+  }
+
+  AliDielectronV0Cuts *gammaV0Cuts = new AliDielectronV0Cuts("IsGamma","IsGamma");
+  gammaV0Cuts->AddCut(AliDielectronVarManager::kCosPointingAngle, TMath::Cos(0.02),   1.0);
+  gammaV0Cuts->AddCut(AliDielectronVarManager::kChi2NDF,                       0.0,  10.0);
+  gammaV0Cuts->AddCut(AliDielectronVarManager::kLegDist,                       0.0,   0.25);
+  gammaV0Cuts->AddCut(AliDielectronVarManager::kR,                             3.0,  90.0);
+  gammaV0Cuts->AddCut(AliDielectronVarManager::kPsiPair,                       0.0,   0.05);
+  gammaV0Cuts->AddCut(AliDielectronVarManager::kM,                             0.0,   0.05);
+  //  gammaV0Cuts->AddCut(AliDielectronVarManager::kOpeningAngle,              0.0,   0.1);
+  gammaV0Cuts->AddCut(AliDielectronVarManager::kArmPt,                         0.0,   0.05);
+  gammaV0Cuts->AddCut(AliDielectronVarManager::kArmAlpha,                     -0.35,  0.35);
+  gammaV0Cuts->Print();
+
+ //  const Double_t |cutAlphaG| < 0.35; &&  const Double_t cutQTG < 0.05;                                                        
+ //  const Double_t |cutAlphaG2|[2] = {0.6, 0.8}; &&  const Double_t cutQTG2 < 0.04;  
+
+  if(cuts)
+    ((AliDielectronCutGroup*)cuts)->AddCut(gammaV0Cuts);
+  else
+    die->GetTrackFilter().AddCuts(gammaV0Cuts);
+}
+
 //______________________________________________________________________________________
 void SetupPairCuts(AliDielectron *die, Int_t cutDefinition)
 {
@@ -440,6 +398,65 @@ void SetupPairCuts(AliDielectron *die, Int_t cutDefinition)
 
 }
 
+//______________________________________________________________________________________
+void ConfigBgrd(AliDielectron *die, Int_t cutDefinition)
+{
+  //
+  // Configurate the background estimators
+  //
+
+  // add track rotations
+  AliDielectronTrackRotator *rot=new AliDielectronTrackRotator;
+  rot->SetIterations(10);
+  rot->SetConeAnglePhi(TMath::Pi());
+  rot->SetStartAnglePhi(TMath::Pi());
+  //      die->SetTrackRotator(rot);
+
+  // add mixed events
+  AliDielectronMixingHandler *mix=new AliDielectronMixingHandler;
+  mix->AddVariable(AliDielectronVarManager::kZvPrim,      "-10.,-5.,-4.,-3.,-2.,-1.,0.,1.,2.,3.,4.,5.,10.");
+  //  mix->AddVariable(AliDielectronVarManager::kCentrality,  8,  0.,80.);
+  mix->AddVariable(AliDielectronVarManager::kTPCrpH2,     8,  TMath::Pi()/-2., TMath::Pi()/2.);
+  mix->AddVariable(AliDielectronVarManager::kTPCmagH2,    "0.,20.,50.,80.,110.,150.,500.");
+  mix->SetMixType(AliDielectronMixingHandler::kAll);
+  mix->SetDepth(150);
+  die->SetMixingHandler(mix);
+
+}
+
+//______________________________________________________________________________________
+void ConfigEvtPlane(AliDielectron *die, Int_t cutDefinition)
+{
+  //
+  // Configurate the TPC event plane 
+  //
+
+  Double_t gGap;
+  switch(cutDefinition) {
+  case kEtaGap01:   gGap=0.1;   break;
+  case kEtaGap02:   gGap=0.2;   break;
+  case kEtaGap03:   gGap=0.3;   break;
+  case kEtaGap04:   gGap=0.4;   break;
+  case kEtaGap05:   gGap=0.5;   break;
+  default: gGap=0.0;
+  }
+
+  AliDielectronVarCuts *poi = new AliDielectronVarCuts("PoI","PoI");
+  poi->AddCut(AliDielectronVarManager::kM,2.92,3.20);     // particles of interest, jpsi mass window
+  die->GetEventPlanePOIPreFilter().AddCuts(poi);
+
+  // eta gap in tpc event plane
+  if(cutDefinition >= kEtaGap01 &&
+     cutDefinition <  kSubLS     ) {
+    AliDielectronVarCuts *etaGap = new AliDielectronVarCuts(AliDielectronVarManager::GetValueName(AliDielectronVarManager::kEta),"etaGap");
+    etaGap->AddCut(AliDielectronVarManager::kEta,-1*gGap,gGap,kTRUE);
+    die->GetEventPlanePreFilter().AddCuts(etaGap);
+  }
+
+  if(cutDefinition==kSubLS) die->SetLikeSignSubEvents();
+  die->SetPreFilterEventPlane();
+}
+
 //______________________________________________________________________________________
 void InitHistograms(AliDielectron *die, Int_t cutDefinition)
 {
@@ -451,7 +468,7 @@ void InitHistograms(AliDielectron *die, Int_t cutDefinition)
   Bool_t bHistTrackQA=kFALSE, bHistEvts = kFALSE, bHistPair = kFALSE, bHistPairME = kFALSE, bHistFlow = kFALSE, bHistFlowQA=kFALSE;
   switch (cutDefinition) {
   case kTPC:
-  case kTOF:      bHistEvts=kTRUE; bHistFlow=kTRUE; bHistPair=kTRUE; bHistPairME=kTRUE; break;
+  case kTOF:      bHistEvts=kTRUE; bHistFlow=kTRUE; bHistPair=kTRUE; bHistPairME=kFALSE; break;
   case kTRD:
   case kTOFTRD:
   case kTOFTRD2D: bHistFlow=kTRUE; bHistPair=kTRUE; break;
@@ -481,85 +498,35 @@ void InitHistograms(AliDielectron *die, Int_t cutDefinition)
 
   //add histograms to event class
   histos->AddClass("Event");
-  histos->UserHistogram("Event","Centrality","Centrality;centrality (%);events",
-                        100, 0.0, 100.0,
-                        AliDielectronVarManager::kCentrality);
+  histos->UserHistogram("Event","","", 100, 0.0, 100.0,   AliDielectronVarManager::kCentrality);
 
   ////// EVENT HISTOS /////
   if(bHistEvts) {
-    histos->UserHistogram("Event","RunNumber","Events per run;run;events",
-                         GetRunNumbers(),
-                         AliDielectronVarManager::kRunNumber);
-    histos->UserHistogram("Event","RunNumber_VtxZ",";run;z_{vtx} (cm)",
-                         GetRunNumbers(), AliDielectronHelper::MakeLinBinning(150,-15.,15.),
-                         AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kZvPrim);
-    histos->UserHistogram("Event","RunNumber_Multiplicity",";run;multiplicity V0",
-                         GetRunNumbers(), AliDielectronHelper::MakeLinBinning(250,0.,25000.),
-                         AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kMultV0);
-    histos->UserHistogram("Event","RunNumber_v0ArpH2",";run;#Psi_{2}^{V0A} (rad.)",
-                         GetRunNumbers(), AliDielectronHelper::MakeLinBinning(100,-2.,+2.),
-                         AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kv0ArpH2);
-    histos->UserHistogram("Event","RunNumber_v0CrpH2",";run;#Psi_{2}^{V0C} (rad.)",
-                         GetRunNumbers(), AliDielectronHelper::MakeLinBinning(100,-2.,+2.),
-                         AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kv0CrpH2);
-    histos->UserHistogram("Event","RunNumber_TPCrpH2",";run;#Psi_{2}^{TPC} (rad.)",
-                         GetRunNumbers(), AliDielectronHelper::MakeLinBinning(100,-2.,+2.),
-                         AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kTPCrpH2);
-
-    histos->UserHistogram("Event","VtxZ","Vertex Z;z_{vtx} (cm)", 300,-15.,15.,
-                         AliDielectronVarManager::kZvPrim);
-    histos->UserHistogram("Event","Multiplicity","Multiplicity V0;Multiplicity V0;events", 500,0.,25000.,
-                         AliDielectronVarManager::kMultV0);
-    histos->UserHistogram("Event","Cent_Mult","Centrality vs. Multiplicity;centrality (%);Multiplicity V0",
-                         100,0.,100., 250,0.,25000.,
-                         AliDielectronVarManager::kCentrality,AliDielectronVarManager::kMultV0);
-    histos->UserProfile("Event","Cent_Nacc", "accepted tracks;centrality (%)",
-                       AliDielectronVarManager::kNacc,
-                       "0.,5.,10.,20.,40.,50.,60.,80.,100.",
-                       AliDielectronVarManager::kCentrality);
-    histos->UserProfile("Event","Cent_NVtxContrib", "number of vertex contributors;centrality (%)",
-                       AliDielectronVarManager::kNVtxContrib,
-                       100,0.,100.,
-                       AliDielectronVarManager::kCentrality);
+    histos->UserHistogram("Event","","", GetRunNumbers(), AliDielectronVarManager::kRunNumber);
+    histos->UserHistogram("Event","","", 300,-15.,15.,   AliDielectronVarManager::kZvPrim);
+    histos->UserProfile(  "Event","","", AliDielectronVarManager::kNacc,        80, 0., 80.,    AliDielectronVarManager::kCentrality);
+    histos->UserProfile(  "Event","","", AliDielectronVarManager::kNVtxContrib, 80, 0., 80.,   AliDielectronVarManager::kCentrality);
   } //hist: event
 
 
   ////// FLOW //////
   if(bHistFlow) {
-
+    // EP Qvector magnitudes // TODO move to QA
+    histos->UserHistogram("Event","","", 200,0.,200., AliDielectronVarManager::kTPCmagH2uc);
+    histos->UserHistogram("Event","","", 200,0.,800., AliDielectronVarManager::kv0ACmagH2);
+    histos->UserHistogram("Event","","", 200,0.,800., AliDielectronVarManager::kv0AmagH2);
+    histos->UserHistogram("Event","","", 200,0.,800., AliDielectronVarManager::kv0CmagH2);
     // RP angles versus centrality
-    histos->UserHistogram("Event","Cent_TPCrpH2","TPC RP;centrality (%);#Psi^{TPC} (rad.)",
-                          10,0.,100.,100,-2.,2.,
-                          AliDielectronVarManager::kCentrality,AliDielectronVarManager::kTPCrpH2);
-    histos->UserHistogram("Event","Cent_TPCsub1rpH2","TPC-1 RP;centrality (%);#Psi^{sub1} (rad.)",
-                          10,0.,100.,100,-2.,2.,
-                          AliDielectronVarManager::kCentrality,AliDielectronVarManager::kTPCsub1rpH2);
-    histos->UserHistogram("Event","Cent_TPCsub2rpH2","TPC-2 RP;centrality (%);#Psi^{sub2} (rad.)",
-                          10,0.,100.,100,-2.,2.,
-                          AliDielectronVarManager::kCentrality,AliDielectronVarManager::kTPCsub2rpH2);
-
-    histos->UserHistogram("Event","Cent_v0ACrpH2","VZERO-AC RP;centrality (%);#Psi_{2}^{V0AC} (rad.)",
-                          10,0.,100.,100,-2.0,2.0,
-                          AliDielectronVarManager::kCentrality,AliDielectronVarManager::kv0ACrpH2);
-    histos->UserHistogram("Event","Cent_v0ArpH2","VZERO-A RP;centrality (%);#Psi_{2}^{V0A} (rad.)",
-                          10,0.,100.,100,-2.0,2.0,
-                          AliDielectronVarManager::kCentrality,AliDielectronVarManager::kv0ArpH2);
-    histos->UserHistogram("Event","Cent_v0CrpH2","VZERO-C RP;centrality (%);#Psi_{2}^{V0C} (rad.)",
-                          10,0.,100.,100,-2.0,2.0,
-                          AliDielectronVarManager::kCentrality,AliDielectronVarManager::kv0CrpH2);
-
-    histos->UserHistogram("Event","Cent_v0A0rpH2","VZERO-A RP;centrality (%);#Psi_{2}^{V0A0} (rad.)",
-                          10,0.,100.,100,-2.0,2.0,
-                          AliDielectronVarManager::kCentrality,AliDielectronVarManager::kv0A0rpH2);
-    histos->UserHistogram("Event","Cent_v0A3rpH2","VZERO-A RP;centrality (%);#Psi_{2}^{V0A3} (rad.)",
-                          10,0.,100.,100,-2.0,2.0,
-                          AliDielectronVarManager::kCentrality,AliDielectronVarManager::kv0A3rpH2);
-    histos->UserHistogram("Event","Cent_v0C0rpH2","VZERO-C RP;centrality (%);#Psi_{2}^{V0C0} (rad.)",
-                          10,0.,100.,100,-2.0,2.0,
-                          AliDielectronVarManager::kCentrality,AliDielectronVarManager::kv0C0rpH2);
-    histos->UserHistogram("Event","Cent_v0C3rpH2","VZERO-C RP;centrality (%);#Psi_{2}^{V0C3} (rad.)",
-                          10,0.,100.,100,-2.0,2.0,
-                          AliDielectronVarManager::kCentrality,AliDielectronVarManager::kv0C3rpH2);
+    histos->UserHistogram("Event","","", 16,0.,80.,100,-2.,2., AliDielectronVarManager::kCentrality,AliDielectronVarManager::kTPCrpH2);
+    histos->UserHistogram("Event","","", 16,0.,80.,100,-2.,2., AliDielectronVarManager::kCentrality,AliDielectronVarManager::kTPCsub1rpH2);
+    histos->UserHistogram("Event","","", 16,0.,80.,100,-2.,2., AliDielectronVarManager::kCentrality,AliDielectronVarManager::kTPCsub2rpH2);
+    histos->UserHistogram("Event","","", 16,0.,80.,100,-2.,2., AliDielectronVarManager::kCentrality,AliDielectronVarManager::kv0ArpH2);
+    histos->UserHistogram("Event","","", 16,0.,80.,100,-2.,2., AliDielectronVarManager::kCentrality,AliDielectronVarManager::kv0CrpH2);
+    histos->UserHistogram("Event","","", 16,0.,80.,100,-2.,2., AliDielectronVarManager::kCentrality,AliDielectronVarManager::kv0ACrpH2);
+    histos->UserHistogram("Event","","", 16,0.,80.,100,-2.,2., AliDielectronVarManager::kCentrality,AliDielectronVarManager::kv0A0rpH2);
+    histos->UserHistogram("Event","","", 16,0.,80.,100,-2.,2., AliDielectronVarManager::kCentrality,AliDielectronVarManager::kv0C0rpH2);
+    histos->UserHistogram("Event","","", 16,0.,80.,100,-2.,2., AliDielectronVarManager::kCentrality,AliDielectronVarManager::kv0A3rpH2);
+    histos->UserHistogram("Event","","", 16,0.,80.,100,-2.,2., AliDielectronVarManager::kCentrality,AliDielectronVarManager::kv0C3rpH2);
   } // hist: flow
 
   if(bHistFlowQA) {
@@ -570,111 +537,28 @@ void InitHistograms(AliDielectron *die, Int_t cutDefinition)
     histos->UserHistogram("Event","","", 100,   -2.,   2., AliDielectronVarManager::kTPCsub1rpH2);
     histos->UserHistogram("Event","","", 100,   -2.,   2., AliDielectronVarManager::kTPCsub2rpH2);
     histos->UserHistogram("Event","","", 100,   -1.,   1., AliDielectronVarManager::kTPCsub12DiffH2);
-
     // EP resolution calculation
-    histos->UserHistogram("Event","","", 10,0.,100., 300,-1.0,1.0, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kv0ATPCDiffH2);
-    histos->UserHistogram("Event","","", 10,0.,100., 300,-1.0,1.0, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kv0ATPCDiffH2);
-    histos->UserHistogram("Event","","", 10,0.,100., 300,-1.0,1.0, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kv0Av0CDiffH2);
-    histos->UserHistogram("Event","","", 10,0.,100., 300,-1.0,1.0, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kTPCsub12DiffH2);
-
+    histos->UserHistogram("Event","","", 80,0.,80., 300,-1.0,1.0, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kv0ATPCDiffH2);
+    histos->UserHistogram("Event","","", 80,0.,80., 300,-1.0,1.0, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kv0CTPCDiffH2);
+    histos->UserHistogram("Event","","", 80,0.,80., 300,-1.0,1.0, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kv0Av0CDiffH2);
+    histos->UserHistogram("Event","","", 80,0.,80., 300,-1.0,1.0, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kTPCsub12DiffH2);
+    histos->UserHistogram("Event","","", 80,0.,80., 300,-1.0,1.0, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kv0Av0C0DiffH2);
+    histos->UserHistogram("Event","","", 80,0.,80., 300,-1.0,1.0, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kv0Av0C3DiffH2);
+    histos->UserHistogram("Event","","", 80,0.,80., 300,-1.0,1.0, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kv0Cv0A0DiffH2);
+    histos->UserHistogram("Event","","", 80,0.,80., 300,-1.0,1.0, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kv0Cv0A3DiffH2);
+    histos->UserHistogram("Event","","", 80,0.,80., 300,-1.0,1.0, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kv0A0v0A3DiffH2);
+    histos->UserHistogram("Event","","", 80,0.,80., 300,-1.0,1.0, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kv0C0v0C3DiffH2);
     // detector effects
     histos->UserHistogram("Event","","", 10,0.,100., 300,-1.0,1.0, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kTPCsub12DiffH2Sin);
-
     // recentering stuff
-    histos->UserProfile("Pair","TPCxH2-Cent-RunNumber", ";centrality (%);run;#LTQ_{x}#GT",
-                       AliDielectronVarManager::kTPCxH2,
-                       AliDielectronHelper::MakeLinBinning(10, 0.,100.), GetRunNumbers(),
+    histos->UserProfile("Event","","", AliDielectronVarManager::kTPCxH2,
+                       AliDielectronHelper::MakeLinBinning(8, 0.,80.), GetRunNumbers(),
                        AliDielectronVarManager::kCentrality, AliDielectronVarManager::kRunNumber);
-    histos->UserProfile("Pair","TPCyH2-Cent-RunNumber", ";centrality (%);run;#LTQ_{x}#GT",
-                       AliDielectronVarManager::kTPCyH2,
-                       AliDielectronHelper::MakeLinBinning(10, 0.,100.), GetRunNumbers(),
+    histos->UserProfile("Event","","", AliDielectronVarManager::kTPCyH2,
+                       AliDielectronHelper::MakeLinBinning(8, 0.,80.), GetRunNumbers(),
                        AliDielectronVarManager::kCentrality, AliDielectronVarManager::kRunNumber);
-
   } //hist: flowQA
 
-
-  // RUN QA
-  if(bHistTrackQA) {
-
-    // Event QA
-    histos->UserHistogram("Event","RunNumber","Events per run;run;#events",
-                         GetRunNumbers(), AliDielectronVarManager::kRunNumber);
-    histos->UserProfile("Event","RunNumber-Centrality",";run;#LTcentrality#GT (%)", AliDielectronVarManager::kCentrality,
-                       GetRunNumbers(), AliDielectronVarManager::kRunNumber);
-    histos->UserProfile("Event","RunNumber-CentralitySPD",";run;#LTcentrality_{SPD}#GT (%)", AliDielectronVarManager::kCentralitySPD,
-                       GetRunNumbers(), AliDielectronVarManager::kRunNumber);
-    histos->UserProfile("Event","RunNumber-VtxZ",";run;#LTz_{vtx}#GT (cm)", AliDielectronVarManager::kZvPrim,
-                       GetRunNumbers(), AliDielectronVarManager::kRunNumber);
-    histos->UserProfile("Event","RunNumber-sigVtxZ",";run;#LTRMS(z_{vtx})#GT (cm)", AliDielectronVarManager::kZvPrim,
-                       GetRunNumbers(), AliDielectronVarManager::kRunNumber, "s;-10;10");
-
-    //Track classes
-    histos->SetReservedWords("Track");
-    for (Int_t i=0; i<2; ++i) histos->AddClass(Form("Track_%s",AliDielectron::TrackClassName(i)));
-
-    histos->UserProfile("Track","RunNumber-Pt",";run;#LTp_{T}#GT (GeV/c)", AliDielectronVarManager::kPt,
-                       GetRunNumbers(), AliDielectronVarManager::kRunNumber);
-    histos->UserProfile("Track","RunNumber-Eta",";run;#LT#eta#GT", AliDielectronVarManager::kEta,
-                       GetRunNumbers(), AliDielectronVarManager::kRunNumber);
-    histos->UserProfile("Track","RunNumber-Phi",";run;#LT#varphi#GT", AliDielectronVarManager::kPhi,
-                       GetRunNumbers(), AliDielectronVarManager::kRunNumber);
-    histos->UserProfile("Track","RunNumber-ImpactParXY",";run;#LTdXY#GT (cm)", AliDielectronVarManager::kImpactParXY,
-                       GetRunNumbers(), AliDielectronVarManager::kRunNumber);
-    histos->UserProfile("Track","RunNumber-ImpactParZ",";run;#LTdZ#GT (cm)", AliDielectronVarManager::kImpactParZ,
-                       GetRunNumbers(), AliDielectronVarManager::kRunNumber);
-    // TPC
-    histos->UserProfile("Track","RunNumber-NclsTPC",";run;#LTN_{cls}^{TPC}#GT", AliDielectronVarManager::kNclsTPC,
-                       GetRunNumbers(), AliDielectronVarManager::kRunNumber);
-    histos->UserProfile("Track","RunNumber_Cent-NclsTPC",";run;centrality (%);#LTN_{cls}^{TPC}#GT", AliDielectronVarManager::kNclsTPC,
-                       GetRunNumbers(), AliDielectronHelper::MakeLinBinning(32, 0.,80.),
-                       AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kCentrality);
-    histos->UserProfile("Track","RunNumber_Eta-NclsTPC",";run;#eta;#LTN_{cls}^{TPC}#GT", AliDielectronVarManager::kNclsTPC,
-                       GetRunNumbers(), AliDielectronHelper::MakeLinBinning(20, -1.,+1.),
-                       AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kEta);
-    histos->UserProfile("Track","RunNumber_Phi-NclsTPC",";run;#varphi;#LTN_{cls}^{TPC}#GT", AliDielectronVarManager::kNclsTPC,
-                       GetRunNumbers(), AliDielectronHelper::MakeLinBinning(18, 0.,TMath::Pi()),
-                       AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kPhi);
-
-    // ITS
-    histos->UserProfile("Track","RunNumber-NclsITS",";run;#LTN_{cls}^{ITS}#GT", AliDielectronVarManager::kNclsITS,
-                       GetRunNumbers(), AliDielectronVarManager::kRunNumber);
-    histos->UserProfile("Track","RunNumber_Cent-NclsITS",";run;centrality (%);#LTN_{cls}^{ITS}#GT", AliDielectronVarManager::kNclsITS,
-                       GetRunNumbers(), AliDielectronHelper::MakeLinBinning(32, 0.,80.),
-                       AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kCentrality);
-    histos->UserProfile("Track","RunNumber_Eta-NclsITS",";run;#eta;#LTN_{cls}^{ITS}#GT", AliDielectronVarManager::kNclsITS,
-                       GetRunNumbers(), AliDielectronHelper::MakeLinBinning(20, -1.,+1.),
-                       AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kEta);
-    histos->UserProfile("Track","RunNumber_Phi-NclsITS",";run;#varphi;#LTN_{cls}^{ITS}#GT", AliDielectronVarManager::kNclsITS,
-                       GetRunNumbers(), AliDielectronHelper::MakeLinBinning(18, 0.,TMath::Pi()),
-                       AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kPhi);
-
-    // TPC PID
-    histos->UserProfile("Track","RunNumber-TPCnSigmaEle",";run;#LTn#sigma_{ele}^{TPC}#GT", AliDielectronVarManager::kTPCnSigmaEle,
-                       GetRunNumbers(), AliDielectronVarManager::kRunNumber);
-    histos->UserProfile("Track","RunNumber_Cent-TPCnSigmaEle",";run;centrality (%);#LTn#sigma_{ele}^{TPC}#GT", AliDielectronVarManager::kTPCnSigmaEle,
-                       GetRunNumbers(), AliDielectronHelper::MakeLinBinning(32, 0.,80.),
-                       AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kCentrality);
-    histos->UserProfile("Track","RunNumber_Eta-TPCnSigmaEle",";run;#eta;#LTn#sigma_{ele}^{TPC}#GT", AliDielectronVarManager::kTPCnSigmaEle,
-                       GetRunNumbers(), AliDielectronHelper::MakeLinBinning(20, -1.,+1.),
-                       AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kEta);
-    histos->UserProfile("Track","RunNumber_Phi-TPCnSigmaEle",";run;#varphi;#LTn#sigma_{ele}^{TPC}#GT", AliDielectronVarManager::kTPCnSigmaEle,
-                       GetRunNumbers(), AliDielectronHelper::MakeLinBinning(18, 0.,TMath::Pi()),
-                       AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kPhi);
-    // TOF PID
-    histos->UserProfile("Track","RunNumber-TOFnSigmaEle",";run;#LTn#sigma_{ele}^{TOF}#GT", AliDielectronVarManager::kTOFnSigmaEle,
-                       GetRunNumbers(), AliDielectronVarManager::kRunNumber);
-    histos->UserProfile("Track","RunNumber_Cent-TOFnSigmaEle",";run;centrality (%);#LTn#sigma_{ele}^{TOF}#GT", AliDielectronVarManager::kTOFnSigmaEle,
-                       GetRunNumbers(), AliDielectronHelper::MakeLinBinning(32, 0.,80.),
-                       AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kCentrality);
-    histos->UserProfile("Track","RunNumber_Eta-TOFnSigmaEle",";run;#eta;#LTn#sigma_{ele}^{TOF}#GT", AliDielectronVarManager::kTOFnSigmaEle,
-                       GetRunNumbers(), AliDielectronHelper::MakeLinBinning(20, -1.,+1.),
-                       AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kEta);
-    histos->UserProfile("Track","RunNumber_Phi-TOFnSigmaEle",";run;#varphi;#LTn#sigma_{ele}^{TOF}#GT", AliDielectronVarManager::kTOFnSigmaEle,
-                       GetRunNumbers(), AliDielectronHelper::MakeLinBinning(18, 0.,TMath::Pi()),
-                       AliDielectronVarManager::kRunNumber, AliDielectronVarManager::kPhi);
-  }
-
-
   if(bHistPair) {
     //Initialise histogram classes
     histos->SetReservedWords("Track;Pair");
@@ -698,80 +582,58 @@ void InitHistograms(AliDielectron *die, Int_t cutDefinition)
     //   histos->AddClass(Form("Track_Legs_%s",AliDielectron::PairClassName(AliDielectron::kEv1PMRot)));
 
     // Vertex
-    histos->UserHistogram("Track","ImpactParXY",";dXY (cm);#tracks", 500,-1.,1.,
-                          AliDielectronVarManager::kImpactParXY);
-    histos->UserHistogram("Track","ImpactParZ",";dZ (cm);#tracks", 600,-3.,3.,
-                          AliDielectronVarManager::kImpactParZ);
-
+    histos->UserHistogram("Track","","", 500,-1.,1., AliDielectronVarManager::kImpactParXY);
+    histos->UserHistogram("Track","","", 600,-3.,3., AliDielectronVarManager::kImpactParZ);
     // Kinematics
-    histos->UserHistogram("Track","pt",";p_{T} (GeV/c);#tracks", 400,0,20.,
-                          AliDielectronVarManager::kPt);
-    histos->UserHistogram("Track","Eta_Phi",";#eta;#varphi;#tracks", 200,-1,1,200,0,6.285,
-                          AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);
-
+    histos->UserHistogram("Track","","", 400,0,20.,  AliDielectronVarManager::kPt);
+    histos->UserHistogram("Track","","", 200,-1,1, 200,0,6.285, AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);
     // TPC
-    histos->UserHistogram("Track","TPCnCls",";N_{cls}^{TPC};#tracks", 160,-0.5,159.5,
-                          AliDielectronVarManager::kNclsTPC);
-    histos->UserHistogram("Track","TPCsignalN",";N_{cls}^{TPC};#tracks", 160,-0.5,159.5,
-                          AliDielectronVarManager::kTPCsignalN);
-    histos->UserHistogram("Track","NclFr",";N_{max.cls}^{TPC};#tracks", 160,-0.5,159.5,
-                          AliDielectronVarManager::kNFclsTPCr);
-    histos->UserHistogram("Track","Ncl_NclFr",";N_{cls}^{TPC};N_{max.cls}^{TPC};#tracks",
-                          160,-0.5,159.5,160,-0.5,159.5,
-                          AliDielectronVarManager::kNclsTPC,AliDielectronVarManager::kNFclsTPCr);
-
+    histos->UserHistogram("Track","","", 160,-0.5,159.5, AliDielectronVarManager::kNclsTPC);
+    histos->UserHistogram("Track","","", 160,-0.5,159.5, AliDielectronVarManager::kTPCsignalN);
+    histos->UserHistogram("Track","","", 160,-0.5,159.5, AliDielectronVarManager::kNFclsTPCr);
+    histos->UserHistogram("Track","","", 160,-0.5,159.5, 160,-0.5,159.5, AliDielectronVarManager::kNclsTPC,AliDielectronVarManager::kNFclsTPCr);
     // TRD
-    histos->UserHistogram("Track","NtrklTRD",";N_{trkl}^{TRD};#tracks",
-                          8,-0.5,7.5,
-                          AliDielectronVarManager::kTRDpidQuality);
-
+    histos->UserHistogram("Track","","",   8,-0.5,  7.5, AliDielectronVarManager::kTRDpidQuality);
     // PID
-    histos->UserHistogram("Track","dEdx_P",";p (GeV/c);TPC signal (arb units);#tracks",
-                          400,0.2,20.,200,0.,200.,
-                          AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal,kTRUE);
-    histos->UserHistogram("Track","TPCnSigmaEle_P","p (GeV/c);n#sigma_{ele}^{TPC};#tracks",
-                          400,0.2,20.,200,-10.,10.,
-                          AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle,kTRUE);
-    histos->UserHistogram("Track","TOFbeta_P",";p (GeV/c);#beta;#tracks",
-                          250,0.0,5.0,300,0.,1.2,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFbeta,kTRUE);
+    histos->UserHistogram("Track","","", 400,0.2,20.,200,0.,200., AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal,kTRUE);
+    histos->UserHistogram("Track","","", 400,0.2,20.,200,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle,kTRUE);
+    histos->UserHistogram("Track","","", 250,0.0,5.0,300,0.,1.2,  AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFbeta,kTRUE);
+
+    histos->UserHistogram("Track","","",   10000,-5000.,5000.,      AliDielectronVarManager::kTrackID);
+    histos->UserHistogram("Pair","","", 210,-1.05,1.05, 100,0.,2.5, AliDielectronVarManager::kArmAlpha,AliDielectronVarManager::kArmPt);
 
     ///// add histograms to Pair classes /////
-    histos->UserHistogram("Pair","InvMass",";m_{ee} (GeV/c^{2});#pairs",
-                          300,.0,300*0.04, AliDielectronVarManager::kM); // 40MeV bins, 12GeV/c2
-    histos->UserHistogram("Pair","Rapidity",";y;#pairs",
-                          100,-1.,1., AliDielectronVarManager::kY);
-    histos->UserHistogram("Pair","Pt",";p_{T} (GeV/c);#pairs",
-                         400,0,20., AliDielectronVarManager::kPt);
-    histos->UserHistogram("Pair","OpeningAngle",";opening angle (rad.);#pairs",
-                          100,0.,3.15, AliDielectronVarManager::kOpeningAngle);
-    histos->UserHistogram("Pair","Chi2NDF",";#chi^{2}/NDF;#pairs",
-                          100,0.,20, AliDielectronVarManager::kChi2NDF);
-    histos->UserHistogram("Pair","PsiPair",";#psi;#pairs",
-                          100,0.,3.15, AliDielectronVarManager::kPsiPair);
-    histos->UserHistogram("Pair","R",";r (cm)",
-                          200,0.,100., AliDielectronVarManager::kR);
-    histos->UserHistogram("Pair","LegDist",";dca (cm)",
-                          50,0.,5., AliDielectronVarManager::kLegDist);
-    histos->UserHistogram("Pair","LegDistXY",";dca_{xy} (cm)",
-                          50,0.,5., AliDielectronVarManager::kLegDistXY);
+    histos->UserHistogram("Pair","","",  300,.0,300*0.04, AliDielectronVarManager::kM); // 40MeV bins, 12GeV/c2
+    histos->UserHistogram("Pair","","",  100,-1.,1.,      AliDielectronVarManager::kY);
+    histos->UserHistogram("Pair","","",  400,0,20.,       AliDielectronVarManager::kPt);
+    histos->UserHistogram("Pair","","",  100,0.,3.15,     AliDielectronVarManager::kOpeningAngle);
+    histos->UserHistogram("Pair","","",  100,0.,20,       AliDielectronVarManager::kChi2NDF);
+    histos->UserHistogram("Pair","","",  100,0.,3.15,     AliDielectronVarManager::kPsiPair);
+    histos->UserHistogram("Pair","","",  200,0.,100.,     AliDielectronVarManager::kR);
+    histos->UserHistogram("Pair","","",   50,0.,5.,       AliDielectronVarManager::kLegDist);
+    histos->UserHistogram("Pair","","",   50,0.,5.,       AliDielectronVarManager::kLegDistXY);
 
     //// FLOW results use tprofiles
     if(bHistFlow) {
-      histos->UserProfile("Pair","M_Cent_Pt_v0ACrpH2FlowV2",
+      histos->UserProfile("Pair","",
                          "cos(2(#varphi-#Psi^{V0AC}));mass (GeV/c^{2});centrality (%);p_{T} (GeV/c)",
                          AliDielectronVarManager::kv0ACrpH2FlowV2,
                          125,0.,125*.04, 10, 0.,100., 200,0.,100.,
                          AliDielectronVarManager::kM, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kPt);
-      histos->UserProfile("Pair","M_Cent_Pt_v0ArpH2FlowV2",
+      histos->UserProfile("Pair","",
                          "cos(2(#varphi-#Psi^{V0A}));mass (GeV/c^{2});centrality (%);p_{T} (GeV/c)",
                          AliDielectronVarManager::kv0ArpH2FlowV2,
                          125,0.,125*.04, 10, 0.,100., 200,0.,100.,
                          AliDielectronVarManager::kM, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kPt);
-      histos->UserProfile("Pair","M_Cent_Pt_v0CrpH2FlowV2",
+      histos->UserProfile("Pair","",
                          "cos(2(#varphi-#Psi^{V0C}));mass (GeV/c^{2});centrality (%);p_{T} (GeV/c)",
                          AliDielectronVarManager::kv0CrpH2FlowV2,
                          125,0.,125*.04, 10, 0.,100., 200,0.,100.,
                          AliDielectronVarManager::kM, AliDielectronVarManager::kCentrality, AliDielectronVarManager::kPt);
+
+      histos->UserProfile("Pair","","",                          AliDielectronVarManager::kv0ArpH2FlowV2,
+                         125,0.,125*.04, 10, 0.,100.,    AliDielectronVarManager::kM, AliDielectronVarManager::kCentrality);
+
     } //hist: flow
   } //hist: pair
 
@@ -798,6 +660,7 @@ void InitHF(AliDielectron* die, Int_t cutDefinition)
   // Setup the HF arrays
   //
 
+
   AliDielectronHF *hf=new AliDielectronHF(die->GetName(),die->GetTitle());
   //  if(hasMC) hf->SetStepForMCGenerated();
   hf->SetPairTypes(AliDielectronHF::kAll);
@@ -806,6 +669,7 @@ void InitHF(AliDielectron* die, Int_t cutDefinition)
   hf->AddCutVariable(AliDielectronVarManager::kCentrality,  "0.,5.,10.,20.,40.,50.,60.,80."  );
   hf->AddCutVariable(AliDielectronVarManager::kPt,          "0.,2.5,5.,100."                 );
   hf->AddCutVariable(AliDielectronVarManager::kDeltaPhiv0ArpH2, 8,-1.*TMath::Pi(),TMath::Pi());
+  hf->AddCutVariable(AliDielectronVarManager::kDeltaPhiv0CrpH2, 8,-1.*TMath::Pi(),TMath::Pi());
   //  hf->AddCutVariable(AliDielectronVarManager::kY,           1, -0.9, 0.9                     );
   //  hf->AddCutVariable(AliDielectronVarManager::kPt,          "0.8, 1.0, 1.1, 1.2, 1.5, 100.0", kTRUE, AliDielectronHF::kBinToMax);
   // hf->AddCutVariable(AliDielectronVarManager::kNclsTPC,     "70,90,100,120,160",              kTRUE, AliDielectronHF::kBinToMax);
@@ -824,10 +688,21 @@ void InitCF(AliDielectron* die, Int_t cutDefinition)
   // Setup the CF Manager if needed
   //
 
- AliDielectronCF *cf=new AliDielectronCF(die->GetName(),die->GetTitle());
+  // switch off ep systematics
+  if(cutDefinition >  kEtaGap01 && cutDefinition != kSubRndm  ) continue;
+
+  AliDielectronCF *cf=new AliDielectronCF(die->GetName(),die->GetTitle());
 
   // event variables
-  cf->AddVariable(AliDielectronVarManager::kCentrality,"0.,5.,10.,20.,40.,50.,60.,80.");
+  cf->AddVariable(AliDielectronVarManager::kCentrality,      "0.,5.,10.,20.,40.,50.,60.,80.");
+  // pair variables
+  cf->AddVariable(AliDielectronVarManager::kPairType,        11,    0, 11);
+  cf->AddVariable(AliDielectronVarManager::kM,               125, 0.0, 0.04*125); // 40MeV bins
+  cf->AddVariable(AliDielectronVarManager::kPt,              "0., 1., 2.5, 5., 100.0");
+  cf->AddVariable(AliDielectronVarManager::kDeltaPhiv0ArpH2, GetDeltaPhiBins());
+  cf->AddVariable(AliDielectronVarManager::kDeltaPhiv0CrpH2, GetDeltaPhiBins());
+
+  /*
   //    if(!hasMC) cf->AddVariable(AliDielectronVarManager::kZvPrim,20, -10., 10.);
   if(hasMC)  cf->AddVariable(AliDielectronVarManager::kNacc,20,0.,3000.0);
   if(hasMC)  cf->AddVariable(AliDielectronVarManager::kNVtxContrib,20,0.,4000.);
@@ -857,7 +732,7 @@ void InitCF(AliDielectron* die, Int_t cutDefinition)
   //    cf->AddVariable(AliDielectronVarManager::kTOFnSigmaEle,"-3,-2,2,3",kTRUE); break;
   //    cf->AddVariable(AliDielectronVarManager::kTRDpidQuality,"3.5, 4.5, 5.5, 6.5",kTRUE);
   //    if(!hasMC && isESD) cf->AddVariable(AliDielectronVarManager::kTRDchi2,"-1.,0.,2.,4.",kTRUE);
-
+  */
   // mc steps
   if(hasMC) {
     if(cutDefinition==kTOFTRD) cf->SetStepForMCtruth();
@@ -1021,3 +896,18 @@ TVectorD *GetRunNumbers() {
   return vec;
      
 }
+
+TVectorD *GetDeltaPhiBins() {
+  //
+  // for in and out of event plane bins
+  //
+  Double_t pi = TMath::Pi();
+  TVectorD *deltaPhi = new TVectorD(6);
+  (*deltaPhi)[0] = -1.    *pi;
+  (*deltaPhi)[1] = -3./4. *pi;
+  (*deltaPhi)[2] = -1./4. *pi;
+  (*deltaPhi)[3] = +1./4. *pi;
+  (*deltaPhi)[4] = +3./4. *pi;
+  (*deltaPhi)[5] = +1.    *pi;
+  return deltaPhi;
+}