fUseZWeight(kFALSE),
fUseNchWeight(kFALSE),
fUseTrackletsWeight(kFALSE),
+ fUseMultRatioAsWeight(kFALSE),
fNvar(0),
fPartName(""),
fDauNames(""),
fRefMult(9.26),
fZvtxCorrectedNtrkEstimator(kFALSE),
fIsPPData(kFALSE),
- fIsPPbData(kFALSE)
+ fIsPPbData(kFALSE),
+ fUseAdditionalCuts(kFALSE),
+ fUseCutsForTMVA(kFALSE),
+ fUseCascadeTaskForLctoV0bachelor(kFALSE),
+ fCutOnMomConservation(0.00001)
{
//
//Default ctor
fUseZWeight(kFALSE),
fUseNchWeight(kFALSE),
fUseTrackletsWeight(kFALSE),
+ fUseMultRatioAsWeight(kFALSE),
fNvar(0),
fPartName(""),
fDauNames(""),
fRefMult(9.26),
fZvtxCorrectedNtrkEstimator(kFALSE),
fIsPPData(kFALSE),
- fIsPPbData(kFALSE)
+ fIsPPbData(kFALSE),
+ fUseAdditionalCuts(kFALSE),
+ fUseCutsForTMVA(kFALSE),
+ fUseCascadeTaskForLctoV0bachelor(kFALSE),
+ fCutOnMomConservation(0.00001)
{
//
// Constructor. Initialization of Inputs and Outputs
fUseZWeight(c.fUseZWeight),
fUseNchWeight(c.fUseNchWeight),
fUseTrackletsWeight(c.fUseTrackletsWeight),
+ fUseMultRatioAsWeight(c.fUseMultRatioAsWeight),
fNvar(c.fNvar),
fPartName(c.fPartName),
fDauNames(c.fDauNames),
fRefMult(c.fRefMult),
fZvtxCorrectedNtrkEstimator(c.fZvtxCorrectedNtrkEstimator),
fIsPPData(c.fIsPPData),
- fIsPPbData(c.fIsPPbData)
+ fIsPPbData(c.fIsPPbData),
+ fUseAdditionalCuts(c.fUseAdditionalCuts),
+ fUseCutsForTMVA(c.fUseCutsForTMVA),
+ fUseCascadeTaskForLctoV0bachelor(c.fUseCascadeTaskForLctoV0bachelor),
+ fCutOnMomConservation(c.fCutOnMomConservation)
{
//
// Copy Constructor
PostData(2,fCFManager->GetParticleContainer()) ;
PostData(3,fCorrelation) ;
+ AliDebug(3,Form("*** Processing event %d\n", fEvents));
+
if (fFillFromGenerated){
AliWarning("Flag to fill container with generated value ON ---> dca, d0pi, d0K, d0xd0, cosPointingAngle will be set as dummy!");
}
}
AliAODVertex *aodVtx = (AliAODVertex*)aodEvent->GetPrimaryVertex();
- if (!aodVtx) return;
-
+ if (!aodVtx) {
+ AliDebug(3, "The event was skipped due to missing vertex");
+ return;
+ }
+
if (!arrayBranch) {
AliError("Could not find array of HF vertices");
return;
}
case 21:{
cfVtxHF = new AliCFVertexingHFCascade(mcArray, fOriginDselection);
+ ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGcascade(413);
+ ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGbachelor(211);
+ ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaugh(421);
+ ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaughForMC(421);
+ ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaughPositive(211);
+ ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaughNegative(321);
+ ((AliCFVertexingHFCascade*)cfVtxHF)->SetPrimaryVertex(aodVtx);
break;
}
case 22:{
- cfVtxHF = new AliCFVertexingHFLctoV0bachelor(mcArray, fOriginDselection,fGenLctoV0bachelorOption); // Lc -> K0S+proton
+ // Lc -> K0S+proton
+ if (fUseCascadeTaskForLctoV0bachelor){
+ cfVtxHF = new AliCFVertexingHFCascade(mcArray, fOriginDselection);
+ ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGcascade(4122);
+ ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGbachelor(2212);
+ ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaugh(310);
+ ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaughForMC(311);
+ ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaughPositive(211);
+ ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaughNegative(211);
+ ((AliCFVertexingHFCascade*)cfVtxHF)->SetPrimaryVertex(aodVtx);
+ ((AliCFVertexingHFCascade*)cfVtxHF)->SetCutOnMomConservation(fCutOnMomConservation);
+ if (fUseAdditionalCuts) ((AliCFVertexingHFCascade*)cfVtxHF)->SetUseCutsForTMVA(fUseCutsForTMVA);
+ }
+ else {
+ cfVtxHF = new AliCFVertexingHFLctoV0bachelor(mcArray, fOriginDselection,fGenLctoV0bachelorOption);
+ }
break;
}
case 31:
// Multiplicity definition with tracklets
Double_t nTracklets = 0;
- Int_t nTrackletsEta10 = AliVertexingHFUtils::GetNumberOfTrackletsInEtaRange(aodEvent,-1.,1.);
- Int_t nTrackletsEta16 = AliVertexingHFUtils::GetNumberOfTrackletsInEtaRange(aodEvent,-1.6,1.6);
+ Int_t nTrackletsEta10 = static_cast<Int_t>(AliVertexingHFUtils::GetNumberOfTrackletsInEtaRange(aodEvent,-1.,1.));
+ Int_t nTrackletsEta16 = static_cast<Int_t>(AliVertexingHFUtils::GetNumberOfTrackletsInEtaRange(aodEvent,-1.6,1.6));
nTracklets = (Double_t)nTrackletsEta10;
if(fMultiplicityEstimator==kNtrk10to16) { nTracklets = (Double_t)(nTrackletsEta16 - nTrackletsEta10); }
if(fZvtxCorrectedNtrkEstimator) {
TProfile* estimatorAvg = GetEstimatorHistogram(aodEvent);
if(estimatorAvg) {
- Int_t nTrackletsEta10Corr = AliVertexingHFUtils::GetCorrectedNtracklets(estimatorAvg,nTrackletsEta10,zPrimVertex,fRefMult);
- Int_t nTrackletsEta16Corr = AliVertexingHFUtils::GetCorrectedNtracklets(estimatorAvg,nTrackletsEta16,zPrimVertex,fRefMult);
+ Int_t nTrackletsEta10Corr = static_cast<Int_t>(AliVertexingHFUtils::GetCorrectedNtracklets(estimatorAvg,nTrackletsEta10,zPrimVertex,fRefMult));
+ Int_t nTrackletsEta16Corr = static_cast<Int_t>(AliVertexingHFUtils::GetCorrectedNtracklets(estimatorAvg,nTrackletsEta16,zPrimVertex,fRefMult));
nTracklets = (Double_t)nTrackletsEta10Corr;
if(fMultiplicityEstimator==kNtrk10to16) { nTracklets = (Double_t)(nTrackletsEta16Corr - nTrackletsEta10Corr); }
}
if(fUseNchWeight){
Int_t nChargedMCPhysicalPrimary=AliVertexingHFUtils::GetGeneratedPhysicalPrimariesInEtaRange(mcArray,-1.0,1.0);
if(!fUseTrackletsWeight) fWeight *= GetNchWeight(nChargedMCPhysicalPrimary);
- else fWeight *= GetNchWeight(nTracklets);
+ else fWeight *= GetNchWeight(static_cast<Int_t>(nTracklets));
AliDebug(2,Form("Using Nch weights, Mult=%d Weight=%f\n",nChargedMCPhysicalPrimary,fWeight));
}
Double_t eventWeight=fWeight;
if (fUseMCVertex) fCuts->SetUseMCVertex();
if (fCentralitySelection){ // keep only the requested centrality
+
if(fCuts->IsEventSelectedInCentrality(aodEvent)!=0) {
delete[] containerInput;
delete[] containerInputMC;
Double_t multiplicity = nTracklets; // set to the Ntracklet estimator
if(fMultiplicityEstimator==kVZERO) { multiplicity = vzeroMult; }
-
cfVtxHF->SetMultiplicity(multiplicity);
// printf("Multiplicity estimator %d, value %2.2f\n",fMultiplicityEstimator,multiplicity);
AliDebug(2,"Check the MC-level cuts - not desidered particle");
continue; // 0 stands for MC level
}
+ else {
+ AliDebug(3, Form("\n\n---> COOL! we found a particle (particle %d)!!! with PDG code = %d \n\n", iPart, mcPart->GetPdgCode()));
+ }
cfVtxHF->SetMCCandidateParam(iPart);
if (!(cfVtxHF->SetLabelArray())){
- AliDebug(2,Form("Impossible to set the label array (decaychannel = %d)",fDecayChannel));
+ AliDebug(2,Form("Impossible to set the label array for particle %d (decaychannel = %d)", iPart, fDecayChannel));
continue;
}
//check the candiate family at MC level
if (!(cfVtxHF->CheckMCPartFamily(mcPart, mcArray))) {
- AliDebug(2,Form("Check on the family wrong!!! (decaychannel = %d)",fDecayChannel));
+ AliDebug(2,Form("Check on the family wrong for particle %d!!! (decaychannel = %d)", iPart, fDecayChannel));
continue;
}
else{
- AliDebug(2,Form("Check on the family OK!!! (decaychannel = %d)",fDecayChannel));
+ AliDebug(2,Form("Check on the family OK for particle %d!!! (decaychannel = %d)", iPart, fDecayChannel));
}
//Fill the MC container
Bool_t mcContainerFilled = cfVtxHF -> FillMCContainer(containerInputMC);
- AliDebug(2,Form("mcContainerFilled = %d)",mcContainerFilled));
+ AliDebug(2, Form("particle = %d mcContainerFilled = %d",iPart, mcContainerFilled));
if (mcContainerFilled) {
if (fUseWeight){
if (fFuncWeight){ // using user-defined function
}
AliDebug(2,Form("pt = %f, weight = %f",containerInputMC[0], fWeight));
}
- if (!fCuts->IsInFiducialAcceptance(containerInputMC[0],containerInputMC[1])) continue;
+ if (!fCuts->IsInFiducialAcceptance(containerInputMC[0],containerInputMC[1])) {
+ AliDebug(3, Form("Not in limited acceptance, containerInputMC[0] = %f, containerInputMC[1] = %f", containerInputMC[0], containerInputMC[1]));
+ continue;
+ }
+ else{
+ AliDebug(3, Form("YES!! in limited acceptance, containerInputMC[0] = %f, containerInputMC[1] = %f", containerInputMC[0],containerInputMC[1]));
+ }
+
//MC Limited Acceptance
if (TMath::Abs(containerInputMC[1]) < 0.5) {
fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepGeneratedLimAcc, fWeight);
AliDebug(3,"MC Lim Acc container filled\n");
- }
+ }
//MC
fCFManager->GetParticleContainer()->Fill(containerInputMC, kStepGenerated, fWeight);
icountMC++;
- AliDebug(3,"MC cointainer filled \n");
+ AliDebug(3,"MC container filled \n");
// MC in acceptance
// check the MC-Acceptance level cuts
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;
}
AliDebug(3,Form("iCandid=%d - signAssociation=%d, isPartOrAntipart=%d",iCandid, signAssociation, isPartOrAntipart));
Bool_t recoContFilled = cfVtxHF->FillRecoContainer(containerInput);
+ AliDebug(3, Form("CF task: RecoContFilled for candidate %d is %d", iCandid, (Int_t)recoContFilled));
if (recoContFilled){
// weight according to pt
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();
+ if (recoStep) AliDebug(2, Form("CF task: Reco step for candidate %d is %d", iCandid, (Int_t)recoStep));
Bool_t vtxCheck = fCuts->IsEventSelected(aodEvent);
}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){
else if (fDecayChannel==22){ // Lc->V0+bachelor case, where more possibilities are considered
Bool_t keepLctoV0bachelor=ProcessLctoV0Bachelor(recoAnalysisCuts);
if (keepLctoV0bachelor) recoAnalysisCuts=3;
- }
-
-
+ AliAnalysisManager *man = AliAnalysisManager::GetAnalysisManager();
+ AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
+ AliPIDResponse* pidResponse = inputHandler->GetPIDResponse();
+ if (fUseAdditionalCuts){
+ if (!((AliCFVertexingHFCascade*)cfVtxHF)->CheckAdditionalCuts(pidResponse)) recoAnalysisCuts = -1;
+ }
+ }
fCuts->SetUsePID(iscutsusingpid); //restoring usage of the PID from the cuts object
Bool_t tempAn=(recoAnalysisCuts == 3 || recoAnalysisCuts == isPartOrAntipart);
if (fDecayChannel == 32) tempPid=(recoPidSelection >0 || recoPidSelection == isPartOrAntipart);
if (tempPid){
- fCFManager->GetParticleContainer()->Fill(containerInput, kStepRecoPID, fWeight);
+ Double_t weigPID = 1.;
+ if (fDecayChannel == 2){ // D0 with Bayesian PID using weights
+ if(((AliRDHFCutsD0toKpi*)fCuts)->GetCombPID() && (((AliRDHFCutsD0toKpi*)fCuts)->GetBayesianStrategy() == AliRDHFCutsD0toKpi::kBayesWeight || ((AliRDHFCutsD0toKpi*)fCuts)->GetBayesianStrategy() == AliRDHFCutsD0toKpi::kBayesWeightNoFilter)){
+ if (isPartOrAntipart == 1){
+ weigPID = ((AliRDHFCutsD0toKpi*)fCuts)->GetWeightsNegative()[AliPID::kKaon] * ((AliRDHFCutsD0toKpi*)fCuts)->GetWeightsPositive()[AliPID::kPion];
+ }else if (isPartOrAntipart == 2){
+ weigPID = ((AliRDHFCutsD0toKpi*)fCuts)->GetWeightsPositive()[AliPID::kKaon] * ((AliRDHFCutsD0toKpi*)fCuts)->GetWeightsNegative()[AliPID::kPion];
+ }
+ if ((weigPID < 0) || (weigPID > 1)) weigPID = 0.;
+ }
+ }else if (fDecayChannel == 33){ // Ds with Bayesian PID using weights
+ if(((AliRDHFCutsDstoKKpi*)fCuts)->GetPidOption()==AliRDHFCutsDstoKKpi::kBayesianWeights){
+ Int_t labDau0=((AliAODTrack*)charmCandidate->GetDaughter(0))->GetLabel();
+ AliAODMCParticle* firstDau=(AliAODMCParticle*)mcArray->UncheckedAt(TMath::Abs(labDau0));
+ if(firstDau){
+ Int_t pdgCode0=TMath::Abs(firstDau->GetPdgCode());
+ if(pdgCode0==321){
+ weigPID=((AliRDHFCutsDstoKKpi*)fCuts)->GetWeightForKKpi();
+ }else if(pdgCode0==211){
+ weigPID=((AliRDHFCutsDstoKKpi*)fCuts)->GetWeightForpiKK();
+ }
+ if ((weigPID < 0) || (weigPID > 1)) weigPID = 0.;
+ }else{
+ weigPID=0.;
+ }
+ }
+ }
+ fCFManager->GetParticleContainer()->Fill(containerInput, kStepRecoPID, fWeight*weigPID);
icountRecoPID++;
AliDebug(3,"Reco PID cuts passed and container filled \n");
if(!fAcceptanceUnf){
}
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;
}
}
//_________________________________________________________________________
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.);
//_________________________________________________________________________
void AliCFTaskVertexingHF::SetPtWeightsFromFONLL7overLHC10f6a(){
- // weight function from the ratio of the LHC12a17b MC
+ // 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.);
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 LHC12a17b MC
+ // 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.);
//________________________________________________________________
void AliCFTaskVertexingHF::SetPtWeightsFromFONLL276overLHC10f6a(){
- // weight function from the ratio of the LHC12a17b MC
+ // 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.);
Double_t pMeas=fHistoMeasNch->GetBinContent(fHistoMeasNch->FindBin(nch));
Double_t pMC=fHistoMCNch->GetBinContent(fHistoMCNch->FindBin(nch));
Double_t weight = pMC>0 ? pMeas/pMC : 0.;
- if(fUseTrackletsWeight) weight = pMC;
+ if(fUseMultRatioAsWeight) weight = pMC;
return weight;
}
//__________________________________________________________________________________________________