Coverity (Chiara, Giacomo)
authordainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 31 Jan 2011 15:19:11 +0000 (15:19 +0000)
committerdainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 31 Jan 2011 15:19:11 +0000 (15:19 +0000)
PWG3/vertexingHF/AliAnalysisTaskSESignificance.cxx
PWG3/vertexingHF/macros/AddTaskSignificance.C

index 754e65b702f43fd2034666c2f19110f7b9c1e14a..35a664e06d784e7a37a777d2463ce52db26bbeb5 100644 (file)
@@ -127,6 +127,7 @@ AliAnalysisTaskSESignificance::AliAnalysisTaskSESignificance(const char *name, T
    // Output slot #1 writes into a TList container
   DefineOutput(1,TList::Class());  //My private output
   DefineOutput(2,TList::Class());
+  DefineOutput(3,AliRDHFCuts::Class()); //class of the cuts
   CheckConsistency();
 }
 
@@ -197,8 +198,8 @@ Bool_t AliAnalysisTaskSESignificance::CheckConsistency(){
 void AliAnalysisTaskSESignificance::SetBFeedDown(FeedDownEnum flagB){
   if(fReadMC)fBFeedDown=flagB;
   else {
-    if(flagB||flagB>2){AliInfo("B feed down not allowed without MC info\n");}
-    else fBFeedDown=flagB;
+    AliInfo("B feed down not allowed without MC info\n");
+    fBFeedDown=kBoth;
   }
 }
 //_________________________________________________________________
@@ -227,16 +228,61 @@ void AliAnalysisTaskSESignificance::LocalInit()
 
   if(fDebug > 1) printf("AnalysisTaskSESignificance::Init() \n");
 
+  switch(fDecChannel){
+  case 0:
+    {
+      AliRDHFCutsDplustoKpipi* copycut=new AliRDHFCutsDplustoKpipi(*(static_cast<AliRDHFCutsDplustoKpipi*>(fRDCuts)));
+      // Post the data
+      PostData(3,copycut);
+    }
+    break;
+  case 1:
+    {
+      AliRDHFCutsD0toKpi* copycut=new AliRDHFCutsD0toKpi(*(static_cast<AliRDHFCutsD0toKpi*>(fRDCuts)));
+      // Post the data
+      PostData(3,copycut);
+    }
+    break;
+  case 2:
+    {
+      AliRDHFCutsDStartoKpipi* copycut=new AliRDHFCutsDStartoKpipi(*(static_cast<AliRDHFCutsDStartoKpipi*>(fRDCuts)));
+      // Post the data
+      PostData(3,copycut);
+    }
+    break;
+  case 3:
+    {
+      AliRDHFCutsDstoKKpi* copycut=new AliRDHFCutsDstoKKpi(*(static_cast<AliRDHFCutsDstoKKpi*>(fRDCuts)));
+      // Post the data
+      PostData(3,copycut);
+    }
+    break;
+  case 4:
+    {
+      AliRDHFCutsD0toKpipipi* copycut=new AliRDHFCutsD0toKpipipi(*(static_cast<AliRDHFCutsD0toKpipipi*>(fRDCuts)));
+      // Post the data
+      PostData(3,copycut);
+    }
+    break;
+  case 5:
+    {
+      AliRDHFCutsLctopKpi* copycut=new AliRDHFCutsLctopKpi(*(static_cast<AliRDHFCutsLctopKpi*>(fRDCuts)));
+      // Post the data
+      PostData(3,copycut);
+    }
+    break;
+
+  default:
+    return;
+  }
+
   TList *mdvList =  new TList();
   mdvList->SetOwner();
   mdvList = fCutList;
-  AliRDHFCutsDplustoKpipi *analysis = new AliRDHFCutsDplustoKpipi();
-  analysis=(AliRDHFCutsDplustoKpipi*)fRDCuts;
-  mdvList->Add(analysis);
-
+  
   PostData(2,mdvList);
 
-  return;
+
 }
 //________________________________________________________________________
 void AliAnalysisTaskSESignificance::UserCreateOutputObjects()
@@ -291,13 +337,15 @@ void AliAnalysisTaskSESignificance::UserCreateOutputObjects()
     }
   }
 
-  fHistNEvents=new TH1F("fHistNEvents","Number of AODs scanned",6,-0.5,5.5);
+  fHistNEvents=new TH1F("fHistNEvents","Number of AODs scanned",8,-0.5,7.5);
   fHistNEvents->GetXaxis()->SetBinLabel(1,"nEventsAnal");
   fHistNEvents->GetXaxis()->SetBinLabel(2,"nEvSelected (vtx)");
   fHistNEvents->GetXaxis()->SetBinLabel(3,"nCandidatesSelected");
   fHistNEvents->GetXaxis()->SetBinLabel(4,"nTotEntries Mass hists");
   fHistNEvents->GetXaxis()->SetBinLabel(5,"Pile-up Rej");
   fHistNEvents->GetXaxis()->SetBinLabel(6,"N. of 0SMH");
+  fHistNEvents->GetXaxis()->SetBinLabel(7,"MC Cand from c");
+  fHistNEvents->GetXaxis()->SetBinLabel(8,"MC Cand from b");
   fHistNEvents->GetXaxis()->SetNdivisions(1,kFALSE);
   fOutput->Add(fHistNEvents);
 
@@ -374,7 +422,7 @@ void AliAnalysisTaskSESignificance::UserExec(Option_t */*option*/)
       break; 
     }
   }
-  if(!arrayProng) {
+  if(!aod || !arrayProng) {
     AliError("AliAnalysisTaskSESignificance::UserExec:Branch not found!\n");
     return;
   }
@@ -489,7 +537,7 @@ void AliAnalysisTaskSESignificance::UserExec(Option_t */*option*/)
     Bool_t isFidAcc = fRDCuts->IsInFiducialAcceptance(d->Pt(),d->Y(absPdgMom));
     Int_t isSelected=fRDCuts->IsSelected(d,fSelectionlevel,aod);
 
-    if(fReadMC&&fBFeedDown&&isSelected){
+    if(fReadMC && fBFeedDown!=kBoth && isSelected){
       Int_t labD = d->MatchToMC(absPdgMom,arrayMC,nprongs,pdgdaughters);
       if(labD>=0){
        AliAODMCParticle *partD = (AliAODMCParticle*)arrayMC->At(labD);
@@ -500,11 +548,19 @@ void AliAnalysisTaskSESignificance::UserExec(Option_t */*option*/)
          label=mot->GetMother();
        }
        Int_t pdgMotCode = mot->GetPdgCode();
+       
        if(TMath::Abs(pdgMotCode)<=4){
+         fHistNEvents->Fill(6);
          if(fBFeedDown==kBeautyOnly)isSelected=kFALSE; //from primary charm
        }else{
-         if(fBFeedDown==kCharmOnly)isSelected=kFALSE; //from beauty
+         fHistNEvents->Fill(7);
+         if(fBFeedDown==kCharmOnly) isSelected=kFALSE; //from beauty
        }
+       
+       /*
+       if(TMath::Abs(pdgMotCode)==4 && fBFeedDown==kBeautyOnly) isSelected=kFALSE; //from primary charm
+       if(TMath::Abs(pdgMotCode)==5 && fBFeedDown==kCharmOnly) isSelected=kFALSE; //from beauty
+       */
       }
     }
     
@@ -530,6 +586,7 @@ void AliAnalysisTaskSESignificance::UserExec(Option_t */*option*/)
       for(Int_t ivals=0;ivals<nVals;ivals++){
        if(addresses[ivals]>=((AliMultiDimVector*)fCutList->FindObject(mdvname.Data()))->GetNTotCells()){
          if (fDebug>1) printf("Overflow!!\n");
+         delete addresses;
          return;
        }
 
index 743d93a565fbbc9b48ebf1dbcda870964b0afa61..04fe7352976c8f23190c370764d038950419fe72 100644 (file)
@@ -1,4 +1,4 @@
-AliAnalysisTaskSESignificance *AddTaskSignificance(TString filename="cuts4SignifMaximDplus.root",Int_t decCh=0,Bool_t readMC=kFALSE,Int_t flagOPartAntiPart=0,Int_t nofsteps=8)
+AliAnalysisTaskSESignificance *AddTaskSignificance(TString filename="cuts4SignifMaximDplus.root",Int_t decCh=0,Bool_t readMC=kFALSE,Int_t flagOPartAntiPart=0,Int_t nofsteps=8,AliAnalysisTaskSESignificance::FeedDownEnum fromcb=AliAnalysisTaskSESignificance::kBoth)
 {
   //
   // Test macro for the AliAnalysisTaskSE for D meson candidates
@@ -10,7 +10,7 @@ AliAnalysisTaskSESignificance *AddTaskSignificance(TString filename="cuts4Signif
   //============================================================================
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {
-    ::Error("AddTaskSignificanceN", "No analysis manager to connect to.");
+    ::Error("AddTaskSignificance", "No analysis manager to connect to.");
     return NULL;
   }
 
@@ -25,6 +25,8 @@ AliAnalysisTaskSESignificance *AddTaskSignificance(TString filename="cuts4Signif
   TString suffix2="";
   if(flagOPartAntiPart==1) suffix2="P"; //P=particle, A=antiparticle
   if(flagOPartAntiPart==-1) suffix2="A";
+  if(fromcb==AliAnalysisTaskSESignificance::kCharmOnly) suffix2+="prompt";
+  if(fromcb==AliAnalysisTaskSESignificance::kBeautyOnly) suffix2+="feeddown";
 
   TString cutsobjname="loosercuts";
   //Analysis cuts
@@ -119,7 +121,7 @@ AliAnalysisTaskSESignificance *AddTaskSignificance(TString filename="cuts4Signif
   AliAnalysisTaskSESignificance *sigTask = new AliAnalysisTaskSESignificance("SignificanceAnalysis",listMDV,analysiscuts,decCh,AliRDHFCuts::kAll);//AliRDHFCuts::kCandidate
   sigTask->SetReadMC(readMC);
   //sigTask->SetDoLikeSign(kTRUE);
-  //sigTask->SetBFeedDown(AliAnalysisTaskSESignificance::kBoth);
+  sigTask->SetBFeedDown(fromcb);
   sigTask->SetDebugLevel(3);
   sigTask->SetFillWithPartAntiPartBoth(flagOPartAntiPart);
   mgr->AddTask(sigTask);
@@ -133,6 +135,8 @@ AliAnalysisTaskSESignificance *AddTaskSignificance(TString filename="cuts4Signif
   AliAnalysisDataContainer *coutputSig = mgr->CreateContainer(contname.Data(),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
   contname=Form("coutputmv%s",suffix.Data());
   AliAnalysisDataContainer *coutputmv = mgr->CreateContainer(contname.Data(),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
+  contname=Form("cloosecuts%s",suffix.Data());
+  AliAnalysisDataContainer *coutputcuts = mgr->CreateContainer(contname.Data(),AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
 
 
   mgr->ConnectInput(sigTask,0,mgr->GetCommonInputContainer());
@@ -140,6 +144,8 @@ AliAnalysisTaskSESignificance *AddTaskSignificance(TString filename="cuts4Signif
   mgr->ConnectOutput(sigTask,1,coutputSig);
   
   mgr->ConnectOutput(sigTask,2,coutputmv);
+
+  mgr->ConnectOutput(sigTask,3,coutputcuts);
  
   return sigTask;
 }