]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGHF/vertexingHF/macros/AddTaskCFVertexingHF3Prong.C
Change default parameter to not subtract D-daughters from the multiplicity estimation
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / macros / AddTaskCFVertexingHF3Prong.C
index c7e082f343aee1761e6a52199e2693a30020db95..5f9273079f6e118fb46ae27d7b6f583fa6ba9579 100644 (file)
@@ -42,7 +42,7 @@ const Float_t multmax_50_102 = 102;
 
 //----------------------------------------------------
 
-AliCFTaskVertexingHF *AddTaskCFVertexingHF3Prong(const char* cutFile = "./DplustoKpipiCuts.root", Int_t configuration = AliCFTaskVertexingHF::kSnail, Bool_t isKeepDfromB=kFALSE, Bool_t isKeepDfromBOnly=kFALSE, Int_t pdgCode = 411, Char_t isSign = 2)
+AliCFTaskVertexingHF *AddTaskCFVertexingHF3Prong(TString suffixName="", const char* cutFile = "./DplustoKpipiCuts.root", Int_t configuration = AliCFTaskVertexingHF::kCheetah, Bool_t isKeepDfromB=kFALSE, Bool_t isKeepDfromBOnly=kFALSE, Int_t pdgCode = 411, Char_t isSign = 2, TString multFile="", Bool_t useNchWeight=kFALSE)
 //AliCFContainer *AddTaskCFVertexingHF3Prong(const char* cutFile = "./DplustoKpipiCuts.root", Int_t configuration = AliCFTaskVertexingHF::kSnail, Bool_t isKeepDfromB=kFALSE, Bool_t isKeepDfromBOnly=kFALSE, Int_t pdgCode = 411, Char_t isSign = 2)
 {
        printf("Addig CF task using cuts from file %s\n",cutFile);
@@ -59,9 +59,9 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHF3Prong(const char* cutFile = "./Dplust
               
        gSystem->Sleep(2000);
 
-       // isSign = 0 --> D0 only
-       // isSign = 1 --> D0bar only
-       // isSign = 2 --> D0 + D0bar
+       // isSign = 0 --> D+ only
+       // isSign = 1 --> D- only
+       // isSign = 2 --> both
        
        TString expected;
        if (isSign == 0 && pdgCode < 0){
@@ -79,10 +79,19 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHF3Prong(const char* cutFile = "./Dplust
 
        TFile* fileCuts = TFile::Open(cutFile);
        if(!fileCuts || (fileCuts && !fileCuts->IsOpen())){ 
-         AliError("Wrong cut file");
+         AliFatal(" Cut file not found");
          return 0x0;
        }
        AliRDHFCutsDplustoKpipi *cutsDplustoKpipi = (AliRDHFCutsDplustoKpipi*)fileCuts->Get("AnalysisCuts");
+       TH1F *hMult=0x0;
+       if(multFile.EqualTo("") ) {
+         printf("Will not be corrected with weights \n");
+       }else{
+         TFile *fileMult = TFile::Open(multFile.Data());
+         TDirectoryFile *dir1 = (TDirectoryFile*)fileMult->Get("PWG3_D2H_DMult_DplusLoose");
+         TList* list1=(TList*)dir1->Get("coutputDplusLoose");
+         hMult=(TH1F*)list1->FindObject("hGenPrimaryParticlesInelGt0");
+       }
        
        // check that the fKeepD0fromB flag is set to true when the fKeepD0fromBOnly flag is true
        //  for now the binning is the same than for all D's
@@ -303,7 +312,7 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHF3Prong(const char* cutFile = "./Dplust
        if (binLimcent[nbincent_0_10+nbincent_10_60] != centmin_60_100)  {
          Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 2st range - differs from expected!\n");
        }
-       for(Int_t i=0; i<=nbincent_60_100; i++) binLimcent[i+nbincent_10_60]=(Double_t)centmin_60_100 + (centmax_60_100-centmin_60_100)/nbincent_60_100*(Double_t)i ;
+       for(Int_t i=0; i<=nbincent_60_100; i++) binLimcent[i+nbincent_0_10+nbincent_10_60]=(Double_t)centmin_60_100 + (centmax_60_100-centmin_60_100)/nbincent_60_100*(Double_t)i ;
        
        // fake
        for(Int_t i=0; i<=nbinfake; i++) {
@@ -330,14 +339,18 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHF3Prong(const char* cutFile = "./Dplust
        //one "container" for MC
        TString nameContainer="";
        if(!isKeepDfromB) {
-               nameContainer="CFHFccontainer0_3Prong_CommonFramework";
+               nameContainer="CFHFcontainer_DplustoKpipi_Prompt";
+               
        }
        else  if(isKeepDfromBOnly){
-               nameContainer="CFHFccontainer0DfromB_3Prong_CommonFramework";
+               nameContainer="CFHFcontainer_DplustoKpipi_FromB";
+               
        }
        else  {
-               nameContainer="CFHFccontainer0allD_3Prong_CommonFramework";          
+         nameContainer="CFHFcontainer_DplustoKpipi_All";
        }
+       nameContainer += suffixName.Data();
+
        
        AliCFContainer* container;
        if (configuration == AliCFTaskVertexingHF::kSnail){
@@ -532,6 +545,14 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHF3Prong(const char* cutFile = "./Dplust
        task->SetFakeSelection(0);
        task->SetRejectCandidateIfNotFromQuark(kTRUE); // put to false if you want to keep HIJING D0!!
        task->SetUseMCVertex(kFALSE); // put to true if you want to do studies on pp
+       task->SetUseNchWeight(useNchWeight); //correction with mult weight
+       if(useNchWeight){
+         if(hMult) task->SetMCNchHisto(hMult);
+         else{
+           AliFatal("Histogram for multiplicity weights not found");
+           return 0x0;
+         }
+       }
        if (isKeepDfromB && !isKeepDfromBOnly) task->SetDselection(2);
        if (isKeepDfromB && isKeepDfromBOnly) task->SetDselection(1);           
 
@@ -552,18 +573,6 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHF3Prong(const char* cutFile = "./Dplust
        Printf("decay channel = %d",(Int_t)task->GetDecayChannel());
        Printf("FillFromGenerated = %d",(Int_t)task->GetFillFromGenerated());
        Printf("Dselection = %d",(Int_t)task->GetDselection());
-       Printf("UseWeight = %d",(Int_t)task->GetUseWeight());
-       if (task->GetUseWeight()) {
-               funcWeight = (TF1*)cutFile->Get("funcWeight");
-               if (funcWeight == 0x0){
-                       Printf("FONLL Weights will be used");
-               }
-               else {
-                       task->SetWeightFunction(funcWeight);
-                       Printf("User-defined Weights will be used. The function being:");
-                       task->GetWeightFunction()->Print();
-               }
-       }
        Printf("Sign = %d",(Int_t)task->GetSign());
        Printf("Centrality selection = %d",(Int_t)task->GetCentralitySelection());
        Printf("Fake selection = %d",(Int_t)task->GetFakeSelection());
@@ -589,14 +598,16 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHF3Prong(const char* cutFile = "./Dplust
 
        TString nameCorr="";
        if(!isKeepDfromB) {
-               nameCorr="CFHFcorr0_3Prong_CommonFramework";
+               nameCorr="CFHFcorr_DplustoKpipi_Prompt";
        }
        else  if(isKeepDfromBOnly){
-               nameCorr= "CFHFcorr0KeepDfromBOnly_3Prong_CommonFramework";
+               nameCorr="CFHFcorr_DplustoKpipi_FromB";
        }
        else  {
-               nameCorr="CFHFcorr0allD_3Prong_CommonFramework";                
+               nameCorr="CFHFcorr_DplustoKpipi_All";
        }
+       nameCorr += suffixName.Data();
+       
 
         THnSparseD* correlation = new THnSparseD(nameCorr,"THnSparse with correlations",4,thnDim);
         Double_t** binEdges = new Double_t[2];
@@ -627,23 +638,30 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHF3Prong(const char* cutFile = "./Dplust
        // ----- output data -----
        
        TString outputfile = AliAnalysisManager::GetCommonFileName();
-       TString output1name="", output2name="", output3name="", output4name="";;
+       TString output1name="", output2name="", output3name="", output4name="";
        output2name=nameContainer;
        output3name=nameCorr;
        if(!isKeepDfromB) {
-               outputfile += ":PWG3_D2H_CFtaskDplustoKpipi_CommonFramework";
-               output1name="CFHFchist0_3Prong_CommonFramework";
+               outputfile += ":PWG3_D2H_CFtaskDplustoKpipi_Prompt";
+               output1name="CFHFhist_DplustoKpipi_Prompt";
+               output3name+="_Prompt";
+               output4name= "Cuts_DplustoKpipi_Prompt";
        }
        else  if(isKeepDfromBOnly){
-               outputfile += ":PWG3_D2H_CFtaskDplustoKpipiKeepDfromBOnly_CommonFramework";
-               output1name="CFHFchist0DfromB_3Prong_CommonFramework";
+               outputfile += ":PWG3_D2H_CFtaskDplustoKpipi_FromB";
+               output1name="CFHFhist_DplustoKpipi_FromB";
+               output3name+="_FromB";
+               output4name= "Cuts_DplustoKpipi_FromB";
        }
        else{
-               outputfile += ":PWG3_D2H_CFtaskDplustoKpipiKeepDfromB_CommonFramework";
-               output1name="CFHFchist0allD_3Prong_CommonFramework";
-       }
-
-       output4name= "Cuts_3Prong_CommonFramework";
+               outputfile += ":PWG3_D2H_CFtaskDplustoKpipi_All";
+               output1name="CFHFhist_DplustoKpipi_All";
+               output3name+="_All";
+               output4name= "Cuts_DplustoKpipi_All";
+       }
+       outputfile += suffixName.Data();
+       output1name += suffixName.Data();
+       output4name += suffixName.Data();
 
        //now comes user's output objects :
        // output TH1I for event counting