Various updates (Markus)
authordainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Sep 2009 17:06:17 +0000 (17:06 +0000)
committerdainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Sep 2009 17:06:17 +0000 (17:06 +0000)
13 files changed:
PWG3/hfe/AliAnalysisTaskHFE.cxx
PWG3/hfe/AliAnalysisTaskHFE.h
PWG3/hfe/AliHFEcuts.cxx
PWG3/hfe/AliHFEcuts.h
PWG3/hfe/AliHFEextraCuts.cxx
PWG3/hfe/AliHFEmcQA.cxx
PWG3/hfe/AliHFEpid.cxx
PWG3/hfe/AliHFEpid.h
PWG3/hfe/AliHFEpidBase.cxx
PWG3/hfe/AliHFEpidMC.cxx
PWG3/hfe/AliHFEpidTPC.cxx
PWG3/hfe/AliHFEpriVtx.cxx
PWG3/hfe/AliHFEsecVtx.cxx

index 69a8202..2b75b45 100644 (file)
@@ -69,7 +69,7 @@ AliAnalysisTaskHFE::AliAnalysisTaskHFE():
   , fMC(0x0)
   , fCFM(0x0)
   , fCorrelation(0x0)
-  , fFakeElectrons(0x0)
+  , fPIDperformance(0x0)
   , fPID(0x0)
   , fCuts(0x0)
   , fSecVtx(0x0)
@@ -103,7 +103,7 @@ AliAnalysisTaskHFE::AliAnalysisTaskHFE(const AliAnalysisTaskHFE &ref):
   , fMC(ref.fMC)
   , fCFM(ref.fCFM)
   , fCorrelation(ref.fCorrelation)
-  , fFakeElectrons(ref.fFakeElectrons)
+  , fPIDperformance(ref.fPIDperformance)
   , fPID(ref.fPID)
   , fCuts(ref.fCuts)
   , fSecVtx(ref.fSecVtx)
@@ -133,7 +133,7 @@ AliAnalysisTaskHFE &AliAnalysisTaskHFE::operator=(const AliAnalysisTaskHFE &ref)
   fMC = ref.fMC;
   fCFM = ref.fCFM;
   fCorrelation = ref.fCorrelation;
-  fFakeElectrons = ref.fFakeElectrons;
+  fPIDperformance = ref.fPIDperformance;
   fPID = ref.fPID;
   fCuts = ref.fCuts;
   fSecVtx = ref.fSecVtx;
@@ -175,8 +175,11 @@ AliAnalysisTaskHFE::~AliAnalysisTaskHFE(){
   if(fSecVtx) delete fSecVtx;
   if(fMCQA) delete fMCQA;
   if(fNEvents) delete fNEvents;
-  if(fCorrelation) delete fCorrelation;
-  if(fFakeElectrons) delete fFakeElectrons;
+  if(fCorrelation){
+    fCorrelation->Clear();
+    delete fCorrelation;
+  }
+  if(fPIDperformance) delete fPIDperformance;
 }
 
 //____________________________________________________________
@@ -232,12 +235,14 @@ void AliAnalysisTaskHFE::CreateOutputObjects(){
     fQA->Add(fCuts->GetQAhistograms());
   }
   fCuts->CreateStandardCuts();
+  //fCuts->SetDebugLevel(1);
   fCuts->SetMinNTrackletsTRD(0);  // Minimal requirement to get a minimum biased electron sample (only TPC and ITS requirements allowed)
+  fCuts->SetCutITSpixel(AliHFEextraCuts::kAny);
   fCuts->Initialize(fCFM);
   // add output objects to the List
   fOutput->AddAt(fCFM->GetParticleContainer(), 0);
   fOutput->AddAt(fCorrelation, 1);
-  fOutput->AddAt(fFakeElectrons, 2);
+  fOutput->AddAt(fPIDperformance, 2);
   fOutput->AddAt(fNElectronTracksEvent, 3);
 
   // Initialize PID
@@ -317,6 +322,8 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
 
   //fCFM->CheckEventCuts(AliCFManager::kEvtGenCuts, fMC);
   Double_t container[6];
+  // container for the output THnSparse
+  Double_t dataE[5]; // [pT, eta, Phi, type, 'C' or 'B']
 
   // Loop over the Monte Carlo tracks to see whether we have overlooked any track
   AliMCParticle *mctrack = 0x0;
@@ -362,7 +369,7 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
   // Loop MC
   //
   for(Int_t imc = fMC->GetNumberOfTracks(); imc--;){
-    mctrack = (AliMCParticle*) fMC->GetTrack(imc);
+    mctrack = dynamic_cast<AliMCParticle *>(fMC->GetTrack(imc));
 
     container[0] = mctrack->Pt();
     container[1] = mctrack->Eta();
@@ -385,31 +392,15 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
   // Loop ESD
   //
 
-  Int_t nbtrackrec = fESD->GetNumberOfTracks();
   Int_t nElectronCandidates = 0;
   AliESDtrack *track = 0x0, *htrack = 0x0;
   Int_t pid = 0;
   // For double counted tracks
-  Int_t *indexRecKineTPC = new Int_t[nbtrackrec];
-  Int_t *indexRecKineITS = new Int_t[nbtrackrec];
-  Int_t *indexRecPrim = new Int_t[nbtrackrec];
-  Int_t *indexHFEcutsITS = new Int_t[nbtrackrec];
-  Int_t *indexHFEcutsTPC = new Int_t[nbtrackrec];
-  Int_t *indexHFEcutsTRD = new Int_t[nbtrackrec];
-  Int_t *indexPid = new Int_t[nbtrackrec];
-
-  for(Int_t nb = 0; nb < nbtrackrec; nb++){
-    indexRecKineTPC[nb] = -1;
-    indexRecKineITS[nb] = -1;
-    indexRecPrim[nb]    = -1;
-    indexHFEcutsITS[nb] = -1;
-    indexHFEcutsTPC[nb] = -1;
-    indexHFEcutsTRD[nb] = -1;
-    indexPid[nb]        = -1;
-  } 
-
+  LabelContainer cont(fESD->GetNumberOfTracks());
   Bool_t alreadyseen = kFALSE;
 
+  Bool_t signal = kTRUE;
+
   for(Int_t itrack = 0; itrack < fESD->GetNumberOfTracks(); itrack++){
     
     track = fESD->GetTrack(itrack);
@@ -418,7 +409,13 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
     container[1] = track->Eta();
     container[2] = track->Phi();
 
-    Bool_t signal = kTRUE;
+    dataE[0] = track->Pt();
+    dataE[1] = track->Eta();
+    dataE[2] = track->Phi();
+    dataE[3] = -1;
+    dataE[4] = -1;
+
+    signal = kTRUE;
           
     // RecKine: TPC cuts  
     if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepRecKineTPC, track)) continue;
@@ -426,8 +423,8 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
     
 
     // Check if it is signal electrons
-    if(!(mctrack = (AliMCParticle*) fMC->GetTrack(TMath::Abs(track->GetLabel())))) continue;
-    
+    if(!(mctrack = dynamic_cast<AliMCParticle *>(fMC->GetTrack(TMath::Abs(track->GetLabel()))))) continue;
+
     container[3] = mctrack->Pt();
     container[4] = mctrack->Eta();
     container[5] = mctrack->Phi();
@@ -435,11 +432,8 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
     if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, mctrack)) signal = kFALSE;
     
     if(signal) {
-      alreadyseen = kFALSE;
-      for(Int_t nb = 0; nb < itrack; nb++){
-        if(indexRecKineTPC[nb] == TMath::Abs(track->GetLabel())) alreadyseen = kTRUE;
-      }
-      indexRecKineTPC[itrack] = TMath::Abs(track->GetLabel());
+      alreadyseen = cont.Find(TMath::Abs(track->GetLabel()));
+      cont.Append(TMath::Abs(track->GetLabel()));
       
       fCFM->GetParticleContainer()->Fill(container, (AliHFEcuts::kStepRecKineTPC + AliHFEcuts::kNcutESDSteps + 1));
       fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepRecKineTPC + 2*(AliHFEcuts::kNcutESDSteps + 1)));
@@ -456,11 +450,6 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
     if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepRecKineITS, track)) continue;
     fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepRecKineITS);
     if(signal) {
-      alreadyseen = kFALSE;
-      for(Int_t nb = 0; nb < itrack; nb++){
-        if(indexRecKineITS[nb] == TMath::Abs(track->GetLabel())) alreadyseen = kTRUE;
-      }
-      indexRecKineITS[itrack] = TMath::Abs(track->GetLabel());
       fCFM->GetParticleContainer()->Fill(container, (AliHFEcuts::kStepRecKineITS + AliHFEcuts::kNcutESDSteps + 1));
       fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepRecKineITS + 2*(AliHFEcuts::kNcutESDSteps + 1)));
       if(alreadyseen) {
@@ -487,11 +476,6 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
     if(signal) {
       fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepRecPrim + AliHFEcuts::kNcutESDSteps + 1);
       fCFM->GetParticleContainer()->Fill(&container[3], AliHFEcuts::kStepRecPrim + 2*(AliHFEcuts::kNcutESDSteps + 1));
-      alreadyseen = kFALSE;
-      for(Int_t nb = 0; nb < itrack; nb++){
-        if(indexRecPrim[nb] == TMath::Abs(track->GetLabel())) alreadyseen = kTRUE;
-      }
-      indexRecPrim[itrack] = TMath::Abs(track->GetLabel());
       if(alreadyseen) {
         fCFM->GetParticleContainer()->Fill(&container[3], AliHFEcuts::kStepRecPrim + 4*(AliHFEcuts::kNcutESDSteps + 1));
       }
@@ -507,11 +491,6 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
     if(signal) {
       fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepHFEcutsITS + AliHFEcuts::kNcutESDSteps + 1);
       fCFM->GetParticleContainer()->Fill(&container[3], AliHFEcuts::kStepHFEcutsITS + 2*(AliHFEcuts::kNcutESDSteps + 1));
-      alreadyseen = kFALSE;
-      for(Int_t nb = 0; nb < itrack; nb++){
-        if(indexHFEcutsITS[nb] == TMath::Abs(track->GetLabel())) alreadyseen = kTRUE;
-      }
-      indexHFEcutsITS[itrack] = TMath::Abs(track->GetLabel());
       if(alreadyseen) {
         fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepHFEcutsITS + 4*(AliHFEcuts::kNcutESDSteps + 1)));
       }
@@ -526,36 +505,30 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
     if(signal) {
       fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepHFEcutsTPC + AliHFEcuts::kNcutESDSteps + 1);
       fCFM->GetParticleContainer()->Fill(&container[3], AliHFEcuts::kStepHFEcutsTPC + 2*(AliHFEcuts::kNcutESDSteps + 1));
-      alreadyseen = kFALSE;
-      for(Int_t nb = 0; nb < itrack; nb++){
-        if(indexHFEcutsTPC[nb] == TMath::Abs(track->GetLabel())) alreadyseen = kTRUE;
-      }
-      indexHFEcutsTPC[itrack] = TMath::Abs(track->GetLabel());    
       if(alreadyseen) {
         fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepHFEcutsTPC + 4*(AliHFEcuts::kNcutESDSteps + 1)));
       }
       else {
         fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepHFEcutsTPC + 3*(AliHFEcuts::kNcutESDSteps + 1)));
       }
+      // dimensions 3&4&5 : pt,eta,phi (MC)
+      ((THnSparseF *)fCorrelation->At(0))->Fill(container);
     }
     
-    // HFEcuts: Nb of tracklets TRD
+    // HFEcuts: Nb of tracklets TRD0
     if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTRD, track)) continue;
     fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepHFEcutsTRD);
     if(signal) {
       fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepHFEcutsTRD + AliHFEcuts::kNcutESDSteps + 1);
       fCFM->GetParticleContainer()->Fill(&container[3], AliHFEcuts::kStepHFEcutsTRD + 2*(AliHFEcuts::kNcutESDSteps + 1));
-      alreadyseen = kFALSE;
-      for(Int_t nb = 0; nb < itrack; nb++){
-        if(indexHFEcutsTRD[nb] == TMath::Abs(track->GetLabel())) alreadyseen = kTRUE;
-      }
-      indexHFEcutsTRD[itrack] = TMath::Abs(track->GetLabel());
       if(alreadyseen) {
         fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepHFEcutsTRD + 4*(AliHFEcuts::kNcutESDSteps + 1)));
       }
       else {
         fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepHFEcutsTRD + 3*(AliHFEcuts::kNcutESDSteps + 1)));
       }
+      // dimensions 3&4&5 : pt,eta,phi (MC)
+      ((THnSparseF *)fCorrelation->At(1))->Fill(container);
     }
 
 
@@ -569,11 +542,6 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
     if(signal) {
       fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepHFEcutsTRD + AliHFEcuts::kNcutESDSteps + 2);
       fCFM->GetParticleContainer()->Fill(&container[3], AliHFEcuts::kStepHFEcutsTRD + 2*(AliHFEcuts::kNcutESDSteps + 1)+1);
-      alreadyseen = kFALSE;
-      for(Int_t nb = 0; nb < itrack; nb++){
-        if(indexPid[nb] == TMath::Abs(track->GetLabel())) alreadyseen = kTRUE;
-      }
-      indexPid[itrack] = TMath::Abs(track->GetLabel());
       if(alreadyseen) {
         fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepHFEcutsTRD + 1 + 4*(AliHFEcuts::kNcutESDSteps + 1)));
       }
@@ -581,12 +549,22 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
         fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepHFEcutsTRD + 1 + 3*(AliHFEcuts::kNcutESDSteps + 1)));
       }
       // dimensions 3&4&5 : pt,eta,phi (MC)
-      fCorrelation->Fill(container);
+      ((THnSparseF *)fCorrelation->At(2))->Fill(container);
     }
 
-
     // Track selected: distinguish between true and fake
+    AliDebug(1, Form("Candidate Selected, filling THnSparse, PID: %d\n", mctrack->Particle()->GetPdgCode()));
     if((pid = TMath::Abs(mctrack->Particle()->GetPdgCode())) == 11){
+      Int_t type = IsSignalElectron(track);
+      AliDebug(1, Form("Type: %d\n", type));
+      if(type){
+             dataE[4] = type; // beauty[1] or charm[2]
+             dataE[3] = 2;  // signal electron
+      }
+      else{
+             dataE[3] = 1; // not a signal electron
+             dataE[4] = 0;
+      }
       // pair analysis [mj]
       if (IsSecVtxOn()) {
         AliDebug(2, "Running Secondary Vertex Analysis");
@@ -601,28 +579,22 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
         // based on the partner of e info, you run secandary vertexing function
         fSecVtx->RunSECVTX(track);
       } // end of pair analysis
-    } else {
+    } 
+    else {
       // Fill THnSparse with the information for Fake Electrons
-      switch(pid){
-      case 13:    container[3] = AliPID::kMuon;
-      case 211:   container[3] = AliPID::kPion;
-      case 321:   container[3] = AliPID::kKaon;
-      case 2212:  container[3] = AliPID::kProton;
-      }
-      fFakeElectrons->Fill(container);
+      dataE[3] = 0;
+      dataE[4] = 0;
+    }
+    // fill the performance THnSparse, if the mc origin could be defined
+    if(dataE[3] > -1){
+      AliDebug(1, Form("Entries: [%.3f|%.3f|%.3f|%f|%f]\n", dataE[0],dataE[1],dataE[2],dataE[3],dataE[4]));
+      fPIDperformance->Fill(dataE);
     }
   }
+  
   fNEvents->Fill(1);
   fNElectronTracksEvent->Fill(nElectronCandidates);
-
-  // release memory
-  delete[] indexRecKineTPC;
-  delete[] indexRecKineITS;
-  delete[] indexRecPrim;
-  delete[] indexHFEcutsITS;
-  delete[] indexHFEcutsTPC;
-  delete[] indexHFEcutsTRD;
-  delete[] indexPid;
   
   // Done!!!
   PostData(0, fNEvents);
@@ -681,18 +653,46 @@ void AliAnalysisTaskHFE::MakeParticleContainer(){
     thnDim[k+kNvar] = iBin[k];
   }
 
-  fCorrelation = new THnSparseF("correlation","THnSparse with correlations",2*kNvar,thnDim);
+  if(!fCorrelation) fCorrelation = new TList();
+  fCorrelation->SetName("correlation");
+
+  THnSparseF *correlation0 = new THnSparseF("correlationstep13","THnSparse with correlations",2*kNvar,thnDim);
+  THnSparseF *correlation1 = new THnSparseF("correlationstep14","THnSparse with correlations",2*kNvar,thnDim);
+  THnSparseF *correlation2 = new THnSparseF("correlationstep15","THnSparse with correlations",2*kNvar,thnDim);
   for (int k=0; k<kNvar; k++) {
-    fCorrelation->SetBinEdges(k,binEdges[k]);
-    fCorrelation->SetBinEdges(k+kNvar,binEdges[k]);
+    correlation0->SetBinEdges(k,binEdges[k]);
+    correlation0->SetBinEdges(k+kNvar,binEdges[k]);
+    correlation1->SetBinEdges(k,binEdges[k]);
+    correlation1->SetBinEdges(k+kNvar,binEdges[k]);
+    correlation2->SetBinEdges(k,binEdges[k]);
+    correlation2->SetBinEdges(k+kNvar,binEdges[k]);
   }
-  fCorrelation->Sumw2();
+  correlation0->Sumw2();
+  correlation1->Sumw2();
+  correlation2->Sumw2();
+
+  fCorrelation->AddAt(correlation0,0);
+  fCorrelation->AddAt(correlation1,1);
+  fCorrelation->AddAt(correlation2,2);
+  
 
   // Add a histogram for Fake electrons
-  thnDim[3] = AliPID::kSPECIES;
-  fFakeElectrons = new THnSparseF("fakeEkectrons", "Output for Fake Electrons", kNvar + 1, thnDim);
-  for(Int_t idim = 0; idim < kNvar; idim++)
-    fFakeElectrons->SetBinEdges(idim, binEdges[idim]);
+  const Int_t nDim=5;
+  Int_t nBin[nDim] = {40, 8, 18, 3, 3};
+  Double_t* binEdges2[nDim];
+  for(Int_t ivar = 0; ivar < nDim; ivar++)
+    binEdges2[ivar] = new Double_t[nBin[ivar] + 1];
+
+  //values for bin lower bounds
+  for(Int_t i=0; i<=nBin[0]; i++) binEdges2[0][i]=(Double_t)TMath::Power(10,TMath::Log10(kPtmin) + (TMath::Log10(kPtmax)-TMath::Log10(kPtmin))/nBin[0]*(Double_t)i);  
+  for(Int_t i=0; i<=nBin[1]; i++) binEdges2[1][i]=(Double_t)kEtamin  + (kEtamax-kEtamin)/nBin[1]*(Double_t)i;
+  for(Int_t i=0; i<=nBin[2]; i++) binEdges2[2][i]=(Double_t)kPhimin  + (kPhimax-kPhimin)/nBin[2]*(Double_t)i;
+  for(Int_t i=0; i<=nBin[3]; i++) binEdges2[3][i] = i;
+  for(Int_t i=0; i<=nBin[4]; i++) binEdges2[4][i] = i;
+
+  fPIDperformance = new THnSparseF("PIDperformance", "PID performance; pT [GeV/c]; theta [rad]; phi [rad] type (0 - not el, 1 - other el, 2 - HF el; flavor (0 - no, 1 - charm, 2 - bottom)", nDim, nBin);
+  for(Int_t idim = 0; idim < nDim; idim++)
+    fPIDperformance->SetBinEdges(idim, binEdges2[idim]);
 }
 
 void AliAnalysisTaskHFE::AddPIDdetector(Char_t *detector){
@@ -704,6 +704,9 @@ void AliAnalysisTaskHFE::AddPIDdetector(Char_t *detector){
 
 //____________________________________________________________
 void AliAnalysisTaskHFE::PrintStatus(){
+  //
+  // Print Analysis status
+  //
   printf("\n\tAnalysis Settings\n\t========================================\n\n");
   printf("\tSecondary Vertex finding: %s\n", IsSecVtxOn() ? "YES" : "NO");
   printf("\tPrimary Vertex resolution: %s\n", IsPriVtxOn() ? "YES" : "NO");
@@ -719,3 +722,81 @@ void AliAnalysisTaskHFE::PrintStatus(){
   printf("\t\tMC: %s\n", IsQAOn(kMCqa) ? "YES" : "NO");
   printf("\n");
 }
+
+//____________________________________________________________
+AliAnalysisTaskHFE::LabelContainer::LabelContainer(Int_t capacity):
+  fContainer(NULL),
+  fBegin(NULL),
+  fEnd(NULL),
+  fLast(NULL),
+  fCurrent(NULL)
+{
+  //
+  // Default constructor
+  //
+  fContainer = new Int_t[capacity];
+  fBegin = &fContainer[0];
+  fEnd = &fContainer[capacity - 1];
+  fLast = fCurrent = fBegin;
+}
+
+//____________________________________________________________
+Bool_t AliAnalysisTaskHFE::LabelContainer::Append(Int_t label){
+  //
+  // Add Label to the container
+  //
+  if(fLast > fEnd) return kFALSE;
+  *fLast++ = label;
+  return kTRUE;
+}
+
+//____________________________________________________________
+Bool_t AliAnalysisTaskHFE::LabelContainer::Find(Int_t label){
+  //
+  // Find track in the list of labels
+  //
+  for(Int_t *entry = fBegin; entry <= fLast; entry++) 
+    if(*entry == label) return kTRUE;
+  return kFALSE;
+}
+
+//____________________________________________________________
+Int_t AliAnalysisTaskHFE::LabelContainer::Next(){
+  //
+  // Mimic iterator
+  //
+  if(fCurrent > fLast) return -1; 
+  return *fCurrent++;
+}
+
+//____________________________________________________________
+Int_t AliAnalysisTaskHFE::IsSignalElectron(AliESDtrack *fTrack) const{
+  //
+  // Checks whether the identified electron track is coming from heavy flavour
+  // returns 0 in case of no signal, 1 in case of charm and 2 in case of Bottom
+  //
+  enum{
+    kNoSignal = 0,
+    kCharm,
+    kBeauty
+  };
+  AliMCParticle *mctrack = dynamic_cast<AliMCParticle *>(fMC->GetTrack(TMath::Abs(fTrack->GetLabel())));
+  if(!mctrack) return kNoSignal;
+  TParticle *ecand = mctrack->Particle(); 
+  if(TMath::Abs(ecand->GetPdgCode()) != 11) return kNoSignal; // electron candidate not true electron
+  Int_t motherLabel = TMath::Abs(ecand->GetFirstMother());
+  AliDebug(3, Form("mother label: %d\n", motherLabel));
+  if(!motherLabel) return kNoSignal; // mother track unknown
+  AliMCParticle *motherTrack = dynamic_cast<AliMCParticle *>(fMC->GetTrack(motherLabel));
+  if(!motherTrack) return kNoSignal;
+  TParticle *mparticle = motherTrack->Particle();
+  Int_t pid = TMath::Abs(mparticle->GetPdgCode());
+  AliDebug(3, Form("PDG code: %d\n", pid));
+
+  // identify signal according to Pdg Code 
+  if((pid % 1000) / 100 == 4) return kCharm;    // charmed meson, 3rd position in pdg code == 4
+  if(pid / 1000 == 4) return kCharm;            // charmed baryon, 4th position in pdg code == 4
+  if((pid % 1000) / 100 == 5) return kBeauty;   // beauty meson, 3rd position in pdg code == 5
+  if(pid / 1000 == 5) return kBeauty;           // beauty baryon, 4th position in pdg code == 5   
+  return kNoSignal;
+}
index 837d85b..f3e21d2 100644 (file)
@@ -58,6 +58,7 @@ class AliAnalysisTaskHFE : public AliAnalysisTask{
     Bool_t IsQAOn(Int_t qaLevel) const { return TESTBIT(fQAlevel, qaLevel); };
     Bool_t IsSecVtxOn() const { return TestBit(kIsSecVtxOn); };
     Bool_t IsPriVtxOn() const { return TestBit(kIsPriVtxOn); };
+    Int_t IsSignalElectron(AliESDtrack *) const;
     void SetQAOn(Int_t qaLevel) { SETBIT(fQAlevel, qaLevel); };
     void SetPriVtxOn()        { SetBit(kIsPriVtxOn, kTRUE); };
     void SetSecVtxOn()        { SetBit(kIsSecVtxOn, kTRUE); };
@@ -66,6 +67,25 @@ class AliAnalysisTaskHFE : public AliAnalysisTask{
     void PrintStatus();
  
   private:
+    class LabelContainer{
+      public:
+        LabelContainer(Int_t capacity);
+        ~LabelContainer() {delete[] fContainer; };
+
+        Bool_t Append(Int_t label);
+        Bool_t Find(Int_t Label);
+        Int_t Next();
+        void ResetIterator(){ fCurrent = fBegin; }
+
+      private:
+        LabelContainer(const LabelContainer &);
+        LabelContainer &operator=(const LabelContainer &);
+        Int_t *fContainer;    // the Container for the labels
+        Int_t *fBegin;        // Pointer to the first entry
+        Int_t *fEnd;          // Pointer to the end of the container
+        Int_t *fLast;         // Pointer to the last entry
+        Int_t *fCurrent;      // Current entry to mimic an iterator
+    };
     void MakeParticleContainer();
     
     ULong_t fQAlevel;                     // QA level
@@ -73,8 +93,8 @@ class AliAnalysisTaskHFE : public AliAnalysisTask{
     AliESDEvent *fESD;                    //! The ESD Event
     AliMCEvent *fMC;                      //! The MC Event
     AliCFManager *fCFM;                   //! Correction Framework Manager
-    THnSparseF *fCorrelation;             //! response matrix for unfolding  
-    THnSparseF *fFakeElectrons;           //! Contamination from Fake Electrons
+    TList *fCorrelation;                  //! response matrix for unfolding  
+    THnSparseF *fPIDperformance;          //! info on contamination and yield of electron spectra
     AliHFEpid *fPID;                      //! PID
     AliHFEcuts *fCuts;                    //! Cut Collection
     AliHFEsecVtx *fSecVtx;                //! Secondary Vertex Analysis
index c8bcb2c..5bf3e53 100644 (file)
@@ -274,7 +274,7 @@ void AliHFEcuts::SetRecPrimaryCutList(){
   //
   AliCFTrackIsPrimaryCuts *primaryCut = new AliCFTrackIsPrimaryCuts("fCutsPrimaryCuts", "REC Primary Cuts");
   if(IsRequireDCAToVertex()){
-    primaryCut->SetDCAToVertex2D(kTRUE);
+    //primaryCut->SetDCAToVertex2D(kTRUE);
     primaryCut->SetMaxDCAToVertexXY(fDCAtoVtx[0]);
     primaryCut->SetMaxDCAToVertexZ(fDCAtoVtx[1]);
   }
@@ -300,13 +300,10 @@ void AliHFEcuts::SetHFElectronITSCuts(){
   if(IsRequireITSpixel()){
     hfecuts->SetRequireITSpixel(AliHFEextraCuts::ITSPixel_t(fCutITSPixel));
   }
-  if(IsRequireDCAToVertex()){
-    hfecuts->SetMaxImpactParamR(fDCAtoVtx[0]);
-    hfecuts->SetMaxImpactParamZ(fDCAtoVtx[1]);
-  }
   
   if(IsInDebugMode()) hfecuts->SetQAOn(fHistQA);
-  
+  hfecuts->SetDebugLevel(fDebugLevel);
+
   TObjArray *hfeCuts = new TObjArray;
   hfeCuts->SetName("fPartHFECutsITS");
   hfeCuts->AddLast(hfecuts);
@@ -321,6 +318,7 @@ void AliHFEcuts::SetHFElectronTPCCuts(){
   AliHFEextraCuts *hfecuts = new AliHFEextraCuts("fCutsHFElectronGroupTPC","Extra cuts from the HFE group");
   if(fMinClusterRatioTPC > 0.) hfecuts->SetClusterRatioTPC(fMinClusterRatioTPC);
   if(IsInDebugMode()) hfecuts->SetQAOn(fHistQA);
+  hfecuts->SetDebugLevel(fDebugLevel);
   
   TObjArray *hfeCuts = new TObjArray;
   hfeCuts->SetName("fPartHFECutsTPC");
@@ -336,6 +334,7 @@ void AliHFEcuts::SetHFElectronTRDCuts(){
   AliHFEextraCuts *hfecuts = new AliHFEextraCuts("fCutsHFElectronGroupTRD","Extra cuts from the HFE group");
   if(fMinTrackletsTRD > 0.) hfecuts->SetMinTrackletsTRD(fMinTrackletsTRD);
   if(IsInDebugMode()) hfecuts->SetQAOn(fHistQA);
+  hfecuts->SetDebugLevel(fDebugLevel);
   
   TObjArray *hfeCuts = new TObjArray;
   hfeCuts->SetName("fPartHFECutsTRD");
index e527f0f..3231a67 100644 (file)
@@ -180,7 +180,7 @@ void AliHFEcuts::CreateStandardCuts(){
   fMinClustersTPC = 50;
   fMinTrackletsTRD = 6;
   SetRequireITSPixel();
-  fCutITSPixel = AliHFEextraCuts::kBoth;
+  fCutITSPixel = AliHFEextraCuts::kAny;
   fMaxChi2clusterTPC = 3.5;
   fMinClusterRatioTPC = 0.6;
   fPtRange[0] = 0.1;
index 8f62090..d4584bd 100644 (file)
@@ -173,6 +173,9 @@ Bool_t AliHFEextraCuts::CheckESDCuts(AliESDtrack *track){
   }
   if(TESTBIT(fRequirements, kMinTrackletsTRD)){
     // cut on minimum number of TRD tracklets
+    if(fDebugLevel > 0){
+      printf("Min TRD cut: [%d|%d]\n", fMinTrackletsTRD, trdTracklets);
+    }
     if(trdTracklets >= fMinTrackletsTRD) SETBIT(survivedCut, kMinTrackletsTRD);
   }
   if(TESTBIT(fRequirements, kPixelITS)){
index 863f634..7cde801 100644 (file)
@@ -136,7 +136,7 @@ void AliHFEmcQA::CreateHistograms(const Int_t kquark, Int_t icut, TString hnopt)
      hname = hnopt+"PdgCode_"+kqTypeLabel[iqType];
      fHist[iq][iqType][icut].fPdgCode = new TH1F(hname,hname,20001,-10000.5,10000.5);
      hname = hnopt+"Pt_"+kqTypeLabel[iqType];
-     fHist[iq][iqType][icut].fPt = new TH1F(hname,hname+";p_{T} (GeV/c)",150,0,30);
+     fHist[iq][iqType][icut].fPt = new TH1F(hname,hname+";p_{T} (GeV/c)",250,0,50);
      hname = hnopt+"Y_"+kqTypeLabel[iqType];
      fHist[iq][iqType][icut].fY = new TH1F(hname,hname,150,-7.5,7.5);
      hname = hnopt+"Eta_"+kqTypeLabel[iqType];
index 380d3c3..4513240 100644 (file)
@@ -47,7 +47,8 @@ ClassImp(AliHFEpid)
 //____________________________________________________________
 AliHFEpid::AliHFEpid():
   fEnabledDetectors(0),
-  fQAlist(0x0)
+  fQAlist(0x0),
+  fDebugLevel(0)
 {
   //
   // Default constructor
@@ -59,7 +60,8 @@ AliHFEpid::AliHFEpid():
 AliHFEpid::AliHFEpid(const AliHFEpid &c):
   TObject(c),
   fEnabledDetectors(c.fEnabledDetectors),
-  fQAlist(0x0)
+  fQAlist(0x0),
+  fDebugLevel(c.fDebugLevel)
 {
   //
   // Copy Constructor
@@ -91,6 +93,7 @@ AliHFEpid& AliHFEpid::operator=(const AliHFEpid &c){
   if(this != &c){
     fEnabledDetectors = c.fEnabledDetectors;
     fQAlist = 0x0;
+    fDebugLevel = c.fDebugLevel;
   
     memset(fDetectorPID, 0, sizeof(AliHFEpidBase *) * kNdetectorPID);
     if(c.fDetectorPID[kMCpid])
@@ -131,7 +134,7 @@ Bool_t AliHFEpid::InitializePID(TString detectors){
   // + Initializes Detector PID objects
   // + Handles QA
   //
-  AliInfo(Form("Doing InitializePID for Detectors %s", detectors.Data()));
+  AliInfo(Form("Doing InitializePID for Detectors %s end", detectors.Data()));
   fDetectorPID[kMCpid] = new AliHFEpidMC("Monte Carlo PID"); // Always there
   fDetectorPID[kITSpid] = new AliHFEpidITS("ITS development PID");  // Development version of the ITS pid, for the moment always there
   SETBIT(fEnabledDetectors, kMCpid);
@@ -142,6 +145,7 @@ Bool_t AliHFEpid::InitializePID(TString detectors){
   TObjString *det = 0x0;
   while((det = dynamic_cast<TObjString *>(detIterator->Next()))){
     if(det->String().CompareTo("TPC") == 0){
+      AliInfo("Doing TPC PID");
       fDetectorPID[kTPCpid] = new AliHFEpidTPC("TPC PID");
       SETBIT(fEnabledDetectors, kTPCpid);
     } else if(det->String().CompareTo("TRD") == 0){
@@ -176,8 +180,10 @@ Bool_t AliHFEpid::IsSelected(AliVParticle *track){
   }
   if(TString(track->IsA()->GetName()).CompareTo("AliESDtrack") == 0){
     if(TESTBIT(fEnabledDetectors, kTPCpid)){
-      if(IsQAOn()) 
+      if(IsQAOn() && fDebugLevel > 1){ 
+        AliInfo("Filling QA plots");
         MakePlotsItsTpc(dynamic_cast<AliESDtrack *>(track));  // First fill the QA histograms
+      }
       if(TESTBIT(fEnabledDetectors, kTOFpid)){
         // case TPC-TOF
         return MakePidTpcTof(dynamic_cast<AliESDtrack *>(track));
@@ -220,7 +226,7 @@ Bool_t AliHFEpid::MakePidTpcTrd(AliESDtrack *track){
   content[3] = trdPid->GetTRDSignalV1(track);
   content[4] = trdPid->GetTRDSignalV2(track);
   AliDebug(1, Form("Momentum: %f, TRD Signal: Method 1[%f], Method 2[%f]", content[1], content[3], content[4]));
-  if(IsQAOn()){
+  if(IsQAOn() && fDebugLevel > 0){
     if(HasMCData()){
       // Fill My Histograms for MC PID
       Int_t pdg = TMath::Abs(fDetectorPID[kMCpid]->IsSelected(track));
@@ -265,7 +271,7 @@ void AliHFEpid::MakePlotsItsTpc(AliESDtrack *track){
     };
     content[0] = pid;
   }
-  (dynamic_cast<THnSparse *>(fQAlist->At(kITSSignal)))->Fill(content);
+  (dynamic_cast<THnSparseF *>(fQAlist->At(kITSSignal)))->Fill(content);
 }
 
 //____________________________________________________________
@@ -288,29 +294,33 @@ void AliHFEpid::SetQAOn(){
     momentumBins[ibin] = static_cast<Double_t>(TMath::Power(10,TMath::Log10(kPtMin) + (TMath::Log10(kPtMax)-TMath::Log10(kPtMin))/(kMomentumBins-1)*static_cast<Double_t>(ibin)));
 
   // Add Histogram for combined TPC-TRD PID
-  const Int_t kDimensionsTRDsig = 5;
-  Int_t kNbinsTRDsig[kDimensionsTRDsig] = {AliPID::kSPECIES + 1, kMomentumBins - 1, 200, 3000, 3000};
-  Double_t binMinTRDsig[kDimensionsTRDsig] = {-1., 0.1, 0, 0, 0};
-  Double_t binMaxTRDsig[kDimensionsTRDsig] = {AliPID::kSPECIES, 10., 200., 3000., 3000.};
-  fQAlist->AddAt((histo = new THnSparseF("fCombTPCTRDpid", "Combined TPC-TRD PID", kDimensionsTRDsig, kNbinsTRDsig, binMinTRDsig, binMaxTRDsig)), kTRDSignal);
-  histo->GetAxis(1)->Set(kMomentumBins - 1, momentumBins);
-  histo->GetAxis(0)->SetTitle("Particle Species");
-  histo->GetAxis(1)->SetTitle("p / GeV/c");
-  histo->GetAxis(2)->SetTitle("TPC Signal / a.u.");
-  histo->GetAxis(3)->SetTitle("TRD Signal / a.u.");
-  histo->GetAxis(4)->SetTitle("TRD Signal / a.u.");
+  if(fDebugLevel > 1){
+    const Int_t kDimensionsTRDsig = 5;
+    Int_t kNbinsTRDsig[kDimensionsTRDsig] = {AliPID::kSPECIES + 1, kMomentumBins - 1, 200, 3000, 3000};
+    Double_t binMinTRDsig[kDimensionsTRDsig] = {-1., 0.1, 0, 0, 0};
+    Double_t binMaxTRDsig[kDimensionsTRDsig] = {AliPID::kSPECIES, 10., 200., 3000., 3000.};
+    fQAlist->AddAt((histo = new THnSparseF("fCombTPCTRDpid", "Combined TPC-TRD PID", kDimensionsTRDsig, kNbinsTRDsig, binMinTRDsig, binMaxTRDsig)), kTRDSignal);
+    histo->GetAxis(1)->Set(kMomentumBins - 1, momentumBins);
+    histo->GetAxis(0)->SetTitle("Particle Species");
+    histo->GetAxis(1)->SetTitle("p / GeV/c");
+    histo->GetAxis(2)->SetTitle("TPC Signal / a.u.");
+    histo->GetAxis(3)->SetTitle("TRD Signal / a.u.");
+    histo->GetAxis(4)->SetTitle("TRD Signal / a.u.");
+  }
 
   // Add Histogram for combined TPC-ITS PID
-  const Int_t kDimensionsITSsig = 4;
-  Int_t kNbinsITSsig[kDimensionsITSsig] = {AliPID::kSPECIES + 1, kMomentumBins - 1, 200, 1000};
-  Double_t binMinITSsig[kDimensionsITSsig] = {-1., 0.1, 0., 0.};
-  Double_t binMaxITSsig[kDimensionsITSsig] = {AliPID::kSPECIES, 10., 200., 300.};
-  fQAlist->AddAt((histo = new THnSparseF("fCombTPCITSpid", "Combined TPC-ITS PID", kDimensionsITSsig, kNbinsITSsig, binMinITSsig, binMaxITSsig)), kITSSignal);
-  histo->GetAxis(0)->Set(kMomentumBins - 1, momentumBins);
-  histo->GetAxis(0)->SetTitle("Particle Species");
-  histo->GetAxis(1)->SetTitle("p / GeV/c");
-  histo->GetAxis(2)->SetTitle("TPC Signal / a.u.");
-  histo->GetAxis(3)->SetTitle("ITS Signal / a.u.");
+  if(fDebugLevel > 0){
+    const Int_t kDimensionsITSsig = 4;
+    Int_t kNbinsITSsig[kDimensionsITSsig] = {AliPID::kSPECIES + 1, kMomentumBins - 1, 300, 3000};
+    Double_t binMinITSsig[kDimensionsITSsig] = {-1., 0.1, 0., 0.};
+    Double_t binMaxITSsig[kDimensionsITSsig] = {AliPID::kSPECIES, 10., 300., 300.};
+    fQAlist->AddAt((histo = new THnSparseF("fCombTPCITSpid", "Combined TPC-ITS PID", kDimensionsITSsig, kNbinsITSsig, binMinITSsig, binMaxITSsig)), kITSSignal);
+    histo->GetAxis(1)->Set(kMomentumBins - 1, momentumBins);
+    histo->GetAxis(0)->SetTitle("Particle Species");
+    histo->GetAxis(1)->SetTitle("p / GeV/c");
+    histo->GetAxis(2)->SetTitle("ITS Signal / a.u.");
+    histo->GetAxis(3)->SetTitle("TPC Signal / a.u.");
+  }
 }
 
 //____________________________________________________________
index b805662..8f9204e 100644 (file)
@@ -59,6 +59,7 @@ class AliHFEpid : public TObject{
 
     Bool_t IsQAOn() const { return TestBit(kIsQAOn); };
     Bool_t HasMCData() const { return TestBit(kHasMCData); };
+    void SetDebugLevel(Int_t debugLevel) { fDebugLevel = debugLevel; }
     void SetQAOn();
     void SetHasMCData(Bool_t hasMCdata = kTRUE) { SetBit(kHasMCData, hasMCdata); };
     TList *GetQAhistograms() const { return fQAlist; };
@@ -68,9 +69,10 @@ class AliHFEpid : public TObject{
     Bool_t MakePidTpcTrd(AliESDtrack *track);
     void MakePlotsItsTpc(AliESDtrack *track);
   private:
-    AliHFEpidBase *fDetectorPID[kNdetectorPID];    //! Detector PID classes
-    UInt_t fEnabledDetectors;             // Enabled Detectors
-    TList *fQAlist;                       //! QA histograms
+    AliHFEpidBase *fDetectorPID[kNdetectorPID];     //! Detector PID classes
+    UInt_t fEnabledDetectors;                       //  Enabled Detectors
+    TList *fQAlist;                                 //! QA histograms
+    Int_t fDebugLevel;                              //  Debug Level
 
   ClassDef(AliHFEpid, 1)      // Steering class for Electron ID
 };
index afb6117..7b8aa8b 100644 (file)
@@ -85,7 +85,7 @@ Int_t AliHFEpidBase::GetPdgCode(AliVParticle *track){
   if(!fMCEvent) return 0;
   AliMCParticle *mctrack = 0x0;
   if(TString(track->IsA()->GetName()).CompareTo("AliESDtrack") == 0)
-    mctrack = (AliMCParticle*) (fMCEvent->GetTrack(TMath::Abs((dynamic_cast<AliESDtrack *>(track))->GetLabel())));
+    mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs((dynamic_cast<AliESDtrack *>(track))->GetLabel())));
   else if(TString(track->IsA()->GetName()).CompareTo("AliMCParticle") == 0)
     mctrack = dynamic_cast<AliMCParticle *>(track);
   if(!mctrack) return 0;
index 1319cc8..d57be64 100644 (file)
@@ -26,6 +26,7 @@
 #include <TMath.h>
 #include <TParticle.h>
 
+#include "AliESDtrack.h"
 #include "AliMCParticle.h"
 #include "AliVParticle.h"
 
@@ -54,11 +55,9 @@ Bool_t AliHFEpidMC::InitializePID(){
 //___________________________________________________________________
 Int_t AliHFEpidMC::IsSelected(AliVParticle *track){
   //
-  // PID decision for Monte Carlo particles
-  // return true if PDG Code is +/-11 (electron)
-  // otherwise return false
+  // returns MC PDG Code
+  // Functionality implemented in the base class
+  // (necessary for PID QA)
   //
-  AliMCParticle *mctrack = 0x0;
-  if(!(mctrack = dynamic_cast<AliMCParticle *>(track))) return 0;
-  return mctrack->Particle()->GetPdgCode();
+  return GetPdgCode(track);
 }
index bbae770..ec55ddc 100644 (file)
@@ -153,7 +153,7 @@ Int_t AliHFEpidTPC::IsSelected(AliVParticle *track)
   }
   if(isLineCrossing) return 0;
   // Check whether distance from the electron line is smaller than n-sigma
-  if(fPIDtpcESD->GetNumberOfSigmas(esdTrack, AliPID::kElectron) < fNsigmaTPC ) return 11;
+  if(TMath::Abs(fPIDtpcESD->GetNumberOfSigmas(esdTrack, AliPID::kElectron)) < fNsigmaTPC ) return 11;
   return 0;
 }
 
@@ -184,7 +184,7 @@ Double_t AliHFEpidTPC::Likelihood(const AliESDtrack *track, Int_t species, Float
   Bool_t outlier = kTRUE;
   // Check whether distance from the respective particle line is smaller than r sigma
   for(Int_t hypo = 0; hypo < AliPID::kSPECIES; hypo++){
-    if(fPIDtpcESD->GetNumberOfSigmas(track, (AliPID::EParticleType)hypo) > rsig)
+    if(TMath::Abs(fPIDtpcESD->GetNumberOfSigmas(track, (AliPID::EParticleType)hypo)) > rsig)
       outlier = kTRUE;
     else {
            outlier = kFALSE;
index 286881e..321feca 100644 (file)
@@ -141,9 +141,9 @@ void AliHFEpriVtx::CreateHistograms(TString hnopt)
            hname=hnopt+"nPrimVtxContributor_"+fkSourceLabel[isource];
            fPrimVtx[isource].fNprimVtxContributor = new TH1F(hname,hname,100,0,100);
            hname=hnopt+"PtElec_"+fkSourceLabel[isource];
-           fPrimVtx[isource].fPtElec = new TH1F(hname,hname,150,0,30);
+           fPrimVtx[isource].fPtElec = new TH1F(hname,hname,250,0,50);
            hname=hnopt+"PtElecContributor_"+fkSourceLabel[isource];
-           fPrimVtx[isource].fPtElecContributor = new TH1F(hname,hname,150,0,30);
+           fPrimVtx[isource].fPtElecContributor = new TH1F(hname,hname,250,0,50);
 
         }
 
@@ -154,7 +154,7 @@ void AliHFEpriVtx::CreateHistograms(TString hnopt)
         hname=hnopt+"nESDprimVtxIndices";
         fNESDprimVtxIndices= new TH1I(hname,hname,100,0,100);
         hname=hnopt+"diffDCAvsPt";
-        fDiffDCAvsPt = new TH2F(hname,hname,150,0,30,500,0,1);
+        fDiffDCAvsPt = new TH2F(hname,hname,250,0,50,500,0,1);
         hname=hnopt+"diffDCAvsNt";
         fDiffDCAvsNt = new TH2F(hname,hname,100,0,100,500,0,1);
 
index a3e7c80..208611e 100644 (file)
@@ -286,13 +286,13 @@ void AliHFEsecVtx::CreateHistograms(TString hnopt)
         }
 
         hname=hnopt+"pt_beautyelec";
-        fHistTagged.fPtBeautyElec= new TH1F(hname,hname,150,0,30);
+        fHistTagged.fPtBeautyElec= new TH1F(hname,hname,250,0,50);
         hname=hnopt+"pt_taggedelec";
-        fHistTagged.fPtTaggedElec= new TH1F(hname,hname,150,0,30);
+        fHistTagged.fPtTaggedElec= new TH1F(hname,hname,250,0,50);
         hname=hnopt+"pt_righttaggedelec";
-        fHistTagged.fPtRightTaggedElec = new TH1F(hname,hname,150,0,30);
+        fHistTagged.fPtRightTaggedElec = new TH1F(hname,hname,250,0,50);
         hname=hnopt+"pt_wrongtaggedelec";
-        fHistTagged.fPtWrongTaggedElec = new TH1F(hname,hname,150,0,30);
+        fHistTagged.fPtWrongTaggedElec = new TH1F(hname,hname,250,0,50);
 
         hname=hnopt+"InvmassBeautyElecSecVtx";
         fHistTagged.fInvmassBeautyElecSecVtx= new TH1F(hname,hname,120,-2,10);