]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGHF/vertexingHF/AliCFTaskVertexingHF.cxx
trial to improve the calculation time
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / AliCFTaskVertexingHF.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 34565f5..dff7055
@@ -313,7 +313,7 @@ void AliCFTaskVertexingHF::Init()
   if(fUseWeight && fUseZWeight) { AliFatal("Can not use at the same time pt and z-vtx weights, please choose"); return; }
   if(fUseWeight && fUseNchWeight) { AliInfo("Beware, using at the same time pt and Nch weights, please check"); }
   if(fUseNchWeight && !fHistoMCNch) { AliFatal("Need to pass the MC Nch distribution to use Nch weights"); return; }
-  if(fUseNchWeight) CreateMeasuredNchHisto();
+  if(fUseNchWeight && !fHistoMeasNch) CreateMeasuredNchHisto();
 
   AliRDHFCuts *copyfCuts = 0x0;
   if (!fCuts){
@@ -683,6 +683,7 @@ void AliCFTaskVertexingHF::UserExec(Option_t *)
     AliDebug(3,Form("z coordinate of MC vertex = %f, it was required to be within [-%f, +%f], skipping event", zMCVertex, fCuts->GetMaxVtxZ(), fCuts->GetMaxVtxZ()));
     delete[] containerInput;
     delete[] containerInputMC;
+    delete cfVtxHF;
     return;
   }
 
@@ -691,6 +692,7 @@ void AliCFTaskVertexingHF::UserExec(Option_t *)
     AliDebug(3,"Event rejected because of null trigger mask");
     delete[] containerInput;
     delete[] containerInputMC;
+    delete cfVtxHF;
     return;
   }
 
@@ -734,6 +736,7 @@ void AliCFTaskVertexingHF::UserExec(Option_t *)
       delete[] containerInput;
       delete[] containerInputMC;
       delete [] trackCuts;
+      delete cfVtxHF;
       return;
     }    
   }  else { // keep all centralities
@@ -908,13 +911,14 @@ void AliCFTaskVertexingHF::UserExec(Option_t *)
                
     Bool_t signAssociation = cfVtxHF->SetRecoCandidateParam((AliAODRecoDecayHF*)charmCandidate);
     if (!signAssociation){
-      charmCandidate = 0x0;
+      if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
       continue;
     }
 
     Int_t isPartOrAntipart = cfVtxHF->CheckReflexion(fSign);
     if (isPartOrAntipart == 0){
       AliDebug(2, Form("The candidate pdg code doesn't match the requirement set in the task (fSign = %d)",fSign));
+      if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
       continue;
     }
 
@@ -936,8 +940,10 @@ void AliCFTaskVertexingHF::UserExec(Option_t *)
        AliDebug(2, Form("pt = %f, weight = %f",containerInput[0], fWeight));
       }
 
-      if (!fCuts->IsInFiducialAcceptance(containerInput[0],containerInput[1])) continue;
-                       
+      if (!fCuts->IsInFiducialAcceptance(containerInput[0],containerInput[1])){
+       if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
+       continue;
+      }                
       //Reco Step
       Bool_t recoStep = cfVtxHF->RecoStep();
       Bool_t vtxCheck = fCuts->IsEventSelected(aodEvent);
@@ -952,8 +958,10 @@ void AliCFTaskVertexingHF::UserExec(Option_t *)
       }else if(fDecayChannel==33){
        if(fUseSelectionBit && !charmCandidate->HasSelectionBit(AliRDHFCuts::kDsCuts)) isBitSelected = kFALSE;
       }
-      if(!isBitSelected) continue;
-
+      if(!isBitSelected){
+       if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
+       continue;
+      }
 
 
       if (recoStep && recoContFilled && vtxCheck){
@@ -1033,26 +1041,31 @@ void AliCFTaskVertexingHF::UserExec(Option_t *)
              }
              else {
                AliDebug(3, "Analysis Cuts step not passed \n");
+               if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
                continue;
              }
            }
            else {
              AliDebug(3, "PID selection not passed \n");
+             if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
              continue;
            }
          }
          else{
            AliDebug(3, "Number of ITS cluster step not passed\n");
+           if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
            continue;
          }
        }
        else{
          AliDebug(3, "Reco acceptance step not passed\n");
+         if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
          continue;
        }
       }
       else {
        AliDebug(3, "Reco step not passed\n");
+       if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
        continue;
       }
     }
@@ -1324,7 +1337,7 @@ void AliCFTaskVertexingHF::Terminate(Option_t*)
   file_projection->Close();
   for (Int_t ih = 0; ih<3; ih++) delete [] h[ih];
   delete [] h;
-
+  delete [] titles;
        
 }
 
@@ -1398,7 +1411,7 @@ void AliCFTaskVertexingHF::SetPtWeightsFromFONLL276andBAMPSoverLHC12a17b(){
 
 //_________________________________________________________________________
 void AliCFTaskVertexingHF::SetPtWeightsFromFONLL5overLHC13d3(){
-  // weight function from the ratio of the LHC12a17b MC
+  // weight function from the ratio of the LHC13d3 MC
   // and FONLL calculations for pp data
   if(fFuncWeight) delete fFuncWeight;
   fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x)",0.15,30.);
@@ -1406,6 +1419,66 @@ void AliCFTaskVertexingHF::SetPtWeightsFromFONLL5overLHC13d3(){
   fUseWeight=kTRUE;
 }
 
+//_________________________________________________________________________
+void AliCFTaskVertexingHF::SetPtWeightsFromFONLL7overLHC10f6a(){
+  // weight function from the ratio of the LHC10f6a MC
+  // and FONLL calculations for pp data
+  if(fFuncWeight) delete fFuncWeight;
+  fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x)",0.15,40.);
+  fFuncWeight->SetParameters(2.41522e+01,4.92146e+00,6.72495e+00,2.5,6.15361e-03,4.78995e+00,-4.29135e-01,3.99421e-01,-1.57220e-02);
+  fUseWeight=kTRUE;
+}
+
+//_________________________________________________________________________
+void AliCFTaskVertexingHF::SetPtWeightsFromFONLL7overLHC12a12(){
+  // weight function from the ratio of the LHC12a12 MC
+  // and FONLL calculations for pp data
+  if(fFuncWeight) delete fFuncWeight;
+  fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x+[9])",0.15,50.);
+  fFuncWeight->SetParameters(1.31497e+01,3.30503e+00,3.45594e+00,2.5,2.28642e-02,1.42372e+00,2.32892e-04,5.21986e-02,-2.14236e-01,3.86200e+00);
+  fUseWeight=kTRUE;
+}
+
+//_________________________________________________________________________
+void AliCFTaskVertexingHF::SetPtWeightsFromFONLL7overLHC12a12bis(){
+  // weight function from the ratio of the LHC12a12bis MC
+  // and FONLL calculations for pp data
+  if(fFuncWeight) delete fFuncWeight;
+  fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x+[9])",0.15,50.);
+  fFuncWeight->SetParameters(6.54519e+00,2.74007e+00,2.48325e+00,2.5,1.61113e-01,-5.32546e-01,-3.75916e-04,2.38189e-01,-2.17561e-01,2.35975e+00);
+  fUseWeight=kTRUE;
+}
+
+//_________________________________________________________________________
+void AliCFTaskVertexingHF::SetPtWeightsFromFONLL7overLHC13e2fix(){
+  // weight function from the ratio of the LHC13e2fix MC
+  // and FONLL calculations for pp data
+  if(fFuncWeight) delete fFuncWeight;
+  fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x+[9])",0.15,50.);
+  fFuncWeight->SetParameters(1.85862e+01,2.48171e+00,3.39356e+00,2.5,1.70426e-02,2.28453e+00,-4.57749e-02,5.84585e-02,-3.19719e-01,4.16789e+00);
+  fUseWeight=kTRUE;
+}
+
+//________________________________________________________________
+void AliCFTaskVertexingHF::SetPtWeightsFromFONLL5overLHC10f6a(){
+  // weight function from the ratio of the LHC10f6a MC
+  // and FONLL calculations for pp data
+  if(fFuncWeight) delete fFuncWeight;
+  fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x)",0.15,40.);
+  fFuncWeight->SetParameters(2.77730e+01,4.78942e+00,7.45378e+00,2.5,9.86255e-02,2.30120e+00,-4.16435e-01,3.43770e-01,-2.29380e-02);
+  fUseWeight=kTRUE;
+}
+
+//________________________________________________________________
+void AliCFTaskVertexingHF::SetPtWeightsFromFONLL276overLHC10f6a(){
+  // weight function from the ratio of the LHC10f6a MC
+  // and FONLL calculations for pp data
+  if(fFuncWeight) delete fFuncWeight;
+  fFuncWeight=new TF1("funcWeight","([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x+[9])",0.15,40.);
+  fFuncWeight->SetParameters(1.34412e+01,3.20068e+00,5.14481e+00,2.5,7.59405e-04,7.51821e+00,-3.93811e-01,2.16849e-02,-3.37768e-02,2.40308e+00);
+  fUseWeight=kTRUE;
+}
+
 //_________________________________________________________________________
 Double_t AliCFTaskVertexingHF::GetWeight(Float_t pt)
 {
@@ -1583,19 +1656,20 @@ TProfile* AliCFTaskVertexingHF::GetEstimatorHistogram(const AliVEvent* event){
   //
 
   Int_t runNo  = event->GetRunNumber();
-  Int_t period = -1;   // pp: 0-LHC10b, 1-LHC10c, 2-LHC10d, 3-LHC10e
-                       //pPb: 0-LHC13b, 1-LHC13c
+  Int_t period = -1;   // pp:  0-LHC10b, 1-LHC10c, 2-LHC10d, 3-LHC10e
+                       // pPb: 0-LHC13b, 1-LHC13c
 
   if (fIsPPbData) {    // setting run numbers for LHC13 if pPb
       if (runNo>195343 && runNo<195484) period = 0;
       if (runNo>195528 && runNo<195678) period = 1;
-  } else {     //else assume pp                       
+      if (period<0 || period>1) return 0;
+  } else {             //else assume pp 2010                 
       if(runNo>114930 && runNo<117223) period = 0;
       if(runNo>119158 && runNo<120830) period = 1;
       if(runNo>122373 && runNo<126438) period = 2;
       if(runNo>127711 && runNo<130841) period = 3;
       if(period<0 || period>3) return 0;
   }
-  
+
   return fMultEstimatorAvg[period];
 }