]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG3/vertexingHF/AliCFTaskVertexingHF.cxx
Added PostData in UserCreateOutputObjects (Chiara)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliCFTaskVertexingHF.cxx
index 9c172aee09b92b244fd2162317e93d9d3dd36764..bfb6cf0b85fcdf74cf2715bfd5c9e840f0809432 100644 (file)
@@ -99,7 +99,10 @@ AliCFTaskVertexingHF::AliCFTaskVertexingHF() :
        fPartName(""),
        fDauNames(""),
        fSign(2),
-       fCentralitySelection(kTRUE)
+       fCentralitySelection(kTRUE),
+       fFakeSelection(0),
+       fRejectIfNoQuark(kTRUE),        
+       fUseMCVertex(kFALSE)
 {
        //
        //Default ctor
@@ -132,7 +135,10 @@ AliCFTaskVertexingHF::AliCFTaskVertexingHF(const Char_t* name, AliRDHFCuts* cuts
        fPartName(""),
        fDauNames(""),
        fSign(2), 
-       fCentralitySelection(kTRUE)
+       fCentralitySelection(kTRUE),
+       fFakeSelection(0),
+       fRejectIfNoQuark(kTRUE),
+       fUseMCVertex(kFALSE)
 {
        //
        // Constructor. Initialization of Inputs and Outputs
@@ -191,7 +197,10 @@ AliCFTaskVertexingHF::AliCFTaskVertexingHF(const AliCFTaskVertexingHF& c) :
        fPartName(c.fPartName),
        fDauNames(c.fDauNames),
        fSign(c.fSign),
-       fCentralitySelection(c.fCentralitySelection)
+       fCentralitySelection(c.fCentralitySelection),
+       fFakeSelection(c.fFakeSelection),
+       fRejectIfNoQuark(c.fRejectIfNoQuark),
+       fUseMCVertex(c.fUseMCVertex)
 {
        //
        // Copy Constructor
@@ -227,42 +236,42 @@ void AliCFTaskVertexingHF::Init()
        switch (fDecayChannel){
        case 2:{
                copyfCuts = new AliRDHFCutsD0toKpi(*(static_cast<AliRDHFCutsD0toKpi*>(fCuts)));
-               fNvar = 14;
+               fNvar = 15;
                fPartName="D0";
                fDauNames="K+pi";
                break;
        }
        case 21:{ 
                copyfCuts = new AliRDHFCutsDStartoKpipi(*(static_cast<AliRDHFCutsDStartoKpipi*>(fCuts)));
-               fNvar = 14;
+               fNvar = 15;
                fPartName="Dstar";
                fDauNames="K+pi+pi";
                break;
        }
        case 31:{
                copyfCuts = new AliRDHFCutsDplustoKpipi(*(static_cast<AliRDHFCutsDplustoKpipi*>(fCuts)));
-               fNvar = 13;
+               fNvar = 14;
                fPartName="Dplus";
                fDauNames="K+pi+pi";
                break;
        }
        case 32:{
                copyfCuts = new AliRDHFCutsLctopKpi(*(static_cast<AliRDHFCutsLctopKpi*>(fCuts)));
-               fNvar = 13;
+               fNvar = 14;
                fPartName="Lambdac";
                fDauNames="p+K+pi";
                break;
        }
        case 33:{
                copyfCuts = new AliRDHFCutsDstoKKpi(*(static_cast<AliRDHFCutsDstoKKpi*>(fCuts)));
-               fNvar = 13;
+               fNvar = 14;
                fPartName="Ds";
                fDauNames="K+K+pi";
                break;
        }
        case 4:{
                copyfCuts = new AliRDHFCutsD0toKpipipi(*(static_cast<AliRDHFCutsD0toKpipipi*>(fCuts)));
-               fNvar = 14;
+               fNvar = 15;
                fPartName="D0";
                fDauNames="K+pi+pi+pi";
                break;
@@ -295,8 +304,7 @@ void AliCFTaskVertexingHF::UserExec(Option_t *)
        
        PostData(1,fHistEventsProcessed) ;
        PostData(2,fCFManager->GetParticleContainer()) ;
-       PostData(3,fCorrelation) ;
-       
+       PostData(3,fCorrelation) ;      
 
        if (fFillFromGenerated){
                AliWarning("Flag to fill container with generated value ON ---> dca, d0pi, d0K, d0xd0, cosPointingAngle will be set as dummy!");
@@ -447,7 +455,13 @@ void AliCFTaskVertexingHF::UserExec(Option_t *)
        
        Double_t zPrimVertex = aodVtx ->GetZ();
        Double_t zMCVertex = mcHeader->GetVtxZ();
-       
+       if (TMath::Abs(zMCVertex) > fCuts->GetMaxVtxZ()){
+         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;
+         return;
+       }
+
        AliESDtrackCuts** trackCuts = new AliESDtrackCuts*[cfVtxHF->GetNProngs()];
        if (fDecayChannel == 21){
                // for the D*, setting the third element of the array of the track cuts to those for the soft pion
@@ -467,9 +481,27 @@ void AliCFTaskVertexingHF::UserExec(Option_t *)
        cfVtxHF->SetMCPrimaryVertex(zMCVertex);
        cfVtxHF->SetFillFromGenerated(fFillFromGenerated);
        cfVtxHF->SetNVar(fNvar);
+       cfVtxHF->SetFakeSelection(fFakeSelection);
+       cfVtxHF->SetRejectCandidateIfNotFromQuark(fRejectIfNoQuark);
+
+       // switch-off the trigger class selection (doesn't work for MC)
+       fCuts->SetTriggerClass("");
+
+       // MC vertex, to be used, in case, for pp
+       if (fUseMCVertex) fCuts->SetUseMCVertex(); 
 
-       if (fCentralitySelection)
-         if(fCuts->IsEventSelectedInCentrality(aodEvent)!=0) return;  
+       if (fCentralitySelection){ // keep only the requested centrality
+         if(fCuts->IsEventSelectedInCentrality(aodEvent)!=0) {
+           delete[] containerInput;
+           delete[] containerInputMC;
+            delete [] trackCuts;
+            return;
+          }    
+       }  else { // keep all centralities
+         fCuts->SetMinCentrality(0.);
+         fCuts->SetMaxCentrality(100.);
+       }
+       
        
        Float_t centValue = fCuts->GetCentrality(aodEvent);
        cfVtxHF->SetCentralityValue(centValue);  
@@ -925,6 +957,11 @@ void AliCFTaskVertexingHF::UserCreateOutputObjects()
        //slot #1
        OpenFile(1);
        fHistEventsProcessed = new TH1I("CFHFchist0","",1,0,1) ;
+
+       PostData(1,fHistEventsProcessed) ;
+       PostData(2,fCFManager->GetParticleContainer()) ;
+       PostData(3,fCorrelation) ;
+
 }