AliESDtrackCuts* MyTrackCuts(Int_t clusterCut = 1, Bool_t selPrimaries = kTRUE, TString optSyt="DefaultITSTPC2011") { Double_t dcaxymax = 2.0; TString PtDcaFormula = "0.0105+0.0350/pt^1.1";//7sigma Double_t dcazmax = 2.0; Double_t minNcls = 50; Double_t maxX2TPCcls = 4.0; Double_t maxX2ITScls = 36.0; Double_t minCrossedRows = 70.0; Double_t minRatioClsCrRowsOverFCls = 0.8; if(optSyt.Contains("PtDCAXY5s")) {PtDcaFormula = "0.0075+0.025/pt^1.1";} if(optSyt.Contains("PtDCAXY6s")) {PtDcaFormula = "0.0090+0.030/pt^1.1";} if(optSyt.Contains("PtDCAXY7s")) {PtDcaFormula = "0.0105+0.035/pt^1.1";}//Defult if(optSyt.Contains("PtDCAXY8s")) {PtDcaFormula = "0.0120+0.040/pt^1.1";} if(optSyt.Contains("PtDCAXY9s")) {PtDcaFormula = "0.0135+0.045/pt^1.1";} if(optSyt.Contains("FixDCAZ1")) {dcazmax = 1.0;} if(optSyt.Contains("FixDCAZ2")) {dcazmax = 2.0;}//Defult if(optSyt.Contains("FixDCAZ3")) {dcazmax = 3.0;} if(optSyt.Contains("NCrRows60")){minCrossedRows = 60;} if(optSyt.Contains("NCrRows70")){minCrossedRows = 70;}//Defult if(optSyt.Contains("NCrRows80")){minCrossedRows = 80;} if(optSyt.Contains("NCrRows90")){minCrossedRows = 90;} if(optSyt.Contains("RClsCrRowsOvFCls0.7")){minRatioClsCrRowsOverFCls = 0.7;} if(optSyt.Contains("RClsCrRowsOvFCls0.8")){minRatioClsCrRowsOverFCls = 0.8;}//Defult if(optSyt.Contains("RClsCrRowsOvFCls0.9")){minRatioClsCrRowsOverFCls = 0.9;} if(optSyt.Contains("ChiSqrPerTPCCls3")) {maxX2TPCcls = 3.0;} if(optSyt.Contains("ChiSqrPerTPCCls4")) {maxX2TPCcls = 4.0;}//Defult if(optSyt.Contains("ChiSqrPerTPCCls5")) {maxX2TPCcls = 5.0;} if(optSyt.Contains("ChiSqrPerITSCls30")) {maxX2ITScls = 30.0;} if(optSyt.Contains("ChiSqrPerITSCls36")) {maxX2ITScls = 36.0;}//Defult if(optSyt.Contains("ChiSqrPerITSCls45")) {maxX2ITScls = 45.0;} AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts; if(optSyt.Contains("DefaultITSTPC2011")){ ::Info("Config KSTAR ", Form("Default 2011 ESD track cuts used : %s\n",optSyt.Data())); if(clusterCut == 0) esdTrackCuts->SetMinNClustersTPC(50); else if (clusterCut == 1) { esdTrackCuts->SetMinNCrossedRowsTPC(70); esdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8); } esdTrackCuts->SetMaxChi2PerClusterTPC(4); esdTrackCuts->SetAcceptKinkDaughters(kFALSE); esdTrackCuts->SetRequireTPCRefit(kTRUE); // ITS esdTrackCuts->SetRequireITSRefit(kTRUE); esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny); if(selPrimaries) { // 7*(0.0015+0.0050/pt^1.1) esdTrackCuts->SetMaxDCAToVertexXYPtDep("0.0105+0.0350/pt^1.1"); esdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36); } esdTrackCuts->SetMaxDCAToVertexZ(2); esdTrackCuts->SetDCAToVertex2D(kFALSE); esdTrackCuts->SetRequireSigmaToVertex(kFALSE); esdTrackCuts->SetMaxChi2PerClusterITS(36); } else{ ::Info("Config KSTAR ", Form("User Defined ESD track cuts used for Sys : %s\n",optSyt.Data())); if(clusterCut == 0) esdTrackCuts->SetMinNClustersTPC(minNcls); else if (clusterCut == 1) { esdTrackCuts->SetMinNCrossedRowsTPC(minCrossedRows); esdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(minRatioClsCrRowsOverFCls); } esdTrackCuts->SetMaxChi2PerClusterTPC(maxX2TPCcls); esdTrackCuts->SetAcceptKinkDaughters(kFALSE); esdTrackCuts->SetRequireTPCRefit(kTRUE); // ITS esdTrackCuts->SetRequireITSRefit(kTRUE); esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny); if(selPrimaries) { // 7*(0.0015+0.0050/pt^1.1) esdTrackCuts->SetMaxDCAToVertexXYPtDep(PtDcaFormula.Data()); esdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36); } esdTrackCuts->SetMaxDCAToVertexZ(dcazmax); esdTrackCuts->SetDCAToVertex2D(kFALSE); esdTrackCuts->SetRequireSigmaToVertex(kFALSE); esdTrackCuts->SetMaxChi2PerClusterITS(maxX2ITScls); } return esdTrackCuts; }
Int_t AddRsnDaughterCutsPhiNsigma(AliPID::EParticleType type1,AliPID::EParticleType type2,TString opt,AliRsnInputHandler *rsnIH=0,AliAnalysisTaskSE *task=0) { if (!rsnIH) return 0; Bool_t valid = kTRUE; // Int_t collisionType = AliRsnTrainManager::GetGlobalInt("IsCollisionType",valid); Int_t useCommonQualityCut = AliRsnTrainManager::GetGlobalInt("RsnCommonQualityCut",valid); TString rsnQualityCut = AliRsnTrainManager::GetGlobalStr("RsnQualityCut",valid); Int_t isMC = AliRsnTrainManager::GetGlobalInt("IsMC",valid); Int_t isRsnMini = AliRsnTrainManager::GetGlobalInt("IsRsnMini",valid); Int_t isMixing = AliRsnTrainManager::GetGlobalInt("IsMixing",valid); // experts only (don't touch) Int_t isRsnDev = AliAnalysisManager::GetGlobalInt("rsnUseRSNParDev",valid); // === USER HAS TO SET CORRECT NUMBER OF CUTS SETS ===== Int_t numberOfCuts = 1; //--------------------------------------------- // Define single cuts //--------------------------------------------- Printf("AliRsnCutPIDNSigma Option : %s",opt.Data()); Double_t nSigmaTPC=3.0; Double_t nSigmaTOF=3.0; Double_t etaMin=-0.8; Double_t etaMax=0.8; Double_t trackPtMin=0.; Double_t trackPtMax=1.e10; Int_t NclTPC=70; Char_t DCAxyFormula[100]="0.0182+0.035/pt^1.01"; Bool_t useTPC_K=kFALSE; Bool_t useTOF_K=kFALSE; Bool_t rejectUnmatchedTOF_K=kTRUE; Bool_t useTrackPtCut=kFALSE; if (opt.Contains("qualityonly")) { useTPC_K=kFALSE; useTOF_K=kFALSE; } if (opt.Contains("KTPCnsig")) useTPC_K=kTRUE; if (opt.Contains("KTOFnsig")) useTOF_K=kTRUE; if (opt.Contains("KTOFacceptUnmatched")) rejectUnmatchedTOF_K=kFALSE; if (opt.Contains("KTPCnsig05")) nSigmaTPC = 0.5; if (opt.Contains("KTPCnsig08")) nSigmaTPC = 0.8; if (opt.Contains("KTPCnsig10")) nSigmaTPC = 1.0; if (opt.Contains("KTPCnsig15")) nSigmaTPC = 1.5; if (opt.Contains("KTPCnsig20")) nSigmaTPC = 2.0; if (opt.Contains("KTPCnsig25")) nSigmaTPC = 2.5; if (opt.Contains("KTPCnsig30")) nSigmaTPC = 3.0; if (opt.Contains("KTPCnsig40")) nSigmaTPC = 4.0; if (opt.Contains("KTPCnsig50")) nSigmaTPC = 5.0; if (opt.Contains("KTPCnsig1000")) nSigmaTPC = 100.0; if (opt.Contains("KTOFnsig10")) nSigmaTOF = 1.0; if (opt.Contains("KTOFnsig15")) nSigmaTOF = 1.5; if (opt.Contains("KTOFnsig20")) nSigmaTOF = 2.0; if (opt.Contains("KTOFnsig25")) nSigmaTOF = 2.5; if (opt.Contains("KTOFnsig30")) nSigmaTOF = 3.0; if (opt.Contains("KTOFnsig40")) nSigmaTOF = 4.0; if (opt.Contains("KTOFnsig50")) nSigmaTOF = 5.0; if (opt.Contains("KTOFnsig1000")) nSigmaTOF = 100.0; if (opt.Contains("trackPt")) { useTrackPtCut = kTRUE; if (opt.Contains("trackPtMin015")) trackPtMin = 0.15; if (opt.Contains("trackPtMin02")) trackPtMin = 0.2; if (opt.Contains("trackPtMin05")) trackPtMin = 0.5; if (opt.Contains("trackPtMin06")) trackPtMin = 0.6; if (opt.Contains("trackPtMax18")) trackPtMax = 1.8; if (opt.Contains("trackPtMax20")) trackPtMax = 2.0; if (opt.Contains("trackPtMax25")) trackPtMax = 2.5; } Bool_t usePDG=kFALSE; if (opt.Contains("pdg")) { Printf("Using PDG"); usePDG = kTRUE; } Bool_t useEta = kFALSE; if (opt.Contains("eta")) { for(int j=1;j<=9;j++) if(opt.Contains(Form("eta0%i",j))){etaMin=-0.1*j; etaMax=0.1*j;} for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMinMinus0%i",j))) etaMin=-0.1*j; if(opt.Contains("etaMin00")) etaMin=0.; for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMinPlus0%i",j))) etaMin=0.1*j; for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMaxMinus0%i",j))) etaMax=-0.1*j; if(opt.Contains("etaMax00")) etaMax=0.; for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMaxPlus0%i",j))) etaMax=0.1*j; Printf("Using ETA range (%.2f,%.2f)",etaMin,etaMax); useEta = kTRUE; } Bool_t useNclTPC = kFALSE; if (opt.Contains("NclTPC")) { if (opt.Contains("NclTPC70")) NclTPC=70; if (opt.Contains("NclTPC75")) NclTPC=75; if (opt.Contains("NclTPC80")) NclTPC=80; if (opt.Contains("NclTPC85")) NclTPC=85; if (opt.Contains("NclTPC90")) NclTPC=90; useNclTPC = kTRUE; } Bool_t useDCAxy = kFALSE; if (opt.Contains("DCAxy")) { if (opt.Contains("DCAxyFormula7s")) sprintf(DCAxyFormula,"0.0182+0.035/pt^1.01"); if (opt.Contains("DCAxyFormula6s")) sprintf(DCAxyFormula,"0.0156+0.03/pt^1.01"); if (opt.Contains("DCAxyFormula5s")) sprintf(DCAxyFormula,"0.013+0.025/pt^1.01"); useDCAxy = kTRUE; } //--------------------------------------------- // Combine cuts //--------------------------------------------- TString cutname = "K_Phi"; if (!opt.IsNull()) cutname += Form("_%s",opt.Data()); AliRsnCutSet *cuts = new AliRsnCutSet(cutname.Data(), AliRsnTarget::kDaughter); TString scheme=""; AliRsnCutTrackQuality *qualityCut = new AliRsnCutTrackQuality("cutQualityK"); if (!rsnQualityCut.IsNull()) { AliESDtrackCuts *esdTK = RsnQualityCut(rsnQualityCut.Data()); if(useDCAxy) esdTK->SetMaxDCAToVertexXYPtDep(DCAxyFormula); qualityCut->SetESDtrackCuts(esdTK); } else { if (useCommonQualityCut>=0) { qualityCut->SetAODTestFilterBit(useCommonQualityCut); if(useDCAxy) {qualityCut->SetCheckOnlyFilterBit(kFALSE); qualityCut->SetDCARPtFormula(DCAxyFormula);} } else { qualityCut->SetDefaults2010(); if(useDCAxy) qualityCut->SetDCARPtFormula(DCAxyFormula); } } cuts->AddCut(qualityCut); if (!scheme.IsNull()) scheme += "&"; scheme += qualityCut->GetName(); if (useTPC_K) { AliRsnCutPIDNSigma *cutKTPC = new AliRsnCutPIDNSigma("cutPIDNSigmaTPCK",AliPID::kKaon,AliRsnCutPIDNSigma::kTPC); cutKTPC->SinglePIDRange(nSigmaTPC); cuts->AddCut(cutKTPC); if (!scheme.IsNull()) scheme += "&"; scheme += cutKTPC->GetName(); } if (useTOF_K) { AliRsnCutPIDNSigma *cutKTOF = new AliRsnCutPIDNSigma("cutPIDNSigmaTOFK",AliPID::kKaon,AliRsnCutPIDNSigma::kTOF); cutKTOF->SinglePIDRange(nSigmaTOF); cuts->AddCut(cutKTOF); if(rejectUnmatchedTOF_K){ if (!scheme.IsNull()) scheme += "&"; scheme += cutKTOF->GetName(); }else{ AliRsnCutTOFMatch *cutKTOFMatch = new AliRsnCutTOFMatch("cutKTOFMatch"); cuts->AddCut(cutKTOFMatch); if (!scheme.IsNull()) scheme += "&"; scheme += Form("(%s|(!%s))",cutKTOF->GetName(),cutKTOFMatch->GetName()); } } if (useEta) { Printf("Adding ETA ..."); AliRsnValueDaughter *valEta = new AliRsnValueDaughter(Form("val%sETA%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kEta); AliRsnCutValue *cutEta = new AliRsnCutValue(Form("cut%sETA%s",AliPID::ParticleName(type1),opt.Data()),etaMin,etaMax); cutEta->SetTargetType(AliRsnTarget::kDaughter); cutEta->SetValueObj(valEta); cuts->AddCut(cutEta); if (!scheme.IsNull()) scheme += "&"; scheme += cutEta->GetName(); } if (useTrackPtCut) { Printf("Adding Pt min=%.3f max=%.3f ...",trackPtMin,trackPtMax); AliRsnValueDaughter *valTrackPt = new AliRsnValueDaughter(Form("val%sTrackPt%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kPt); AliRsnCutValue *cutTrackPt = new AliRsnCutValue(Form("cut%sTrackPt%s",AliPID::ParticleName(type1),opt.Data()),trackPtMin,trackPtMax); cutTrackPt->SetTargetType(AliRsnTarget::kDaughter); cutTrackPt->SetValueObj(valTrackPt); cuts->AddCut(cutTrackPt); if (!scheme.IsNull()) scheme += "&"; scheme += cutTrackPt->GetName(); } if (useNclTPC) { Printf("Adding NclTPC >= %i",NclTPC); AliRsnValueDaughter *valNclTPC = new AliRsnValueDaughter(Form("val%sNclTPC%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kNTPCclusters); AliRsnCutValue *cutNclTPC = new AliRsnCutValue(Form("cut%sNclTPC%s",AliPID::ParticleName(type1),opt.Data()),NclTPC-0.1,1000.); cutNclTPC->SetTargetType(AliRsnTarget::kDaughter); cutNclTPC->SetValueObj(valNclTPC); cuts->AddCut(cutNclTPC); if (!scheme.IsNull()) scheme += "&"; scheme += cutNclTPC->GetName(); } if (usePDG) { Printf("Adding PDG ..."); AliRsnCutPID *cutPDG = new AliRsnCutPID(Form("cut%sPDG%s",AliPID::ParticleName(type1),opt.Data()),type1,0.0,kTRUE); cuts->AddCut(cutPDG); if (!scheme.IsNull()) scheme += "&"; scheme += cutPDG->GetName(); } Printf ("CUT Scheme is '%s'",scheme.Data()); cuts->SetCutScheme(scheme.Data()); if (opt.Contains("mon")) { AddMonitorOutput(cuts->GetMonitorOutput(),opt); } if (isRsnMini) { AliRsnMiniAnalysisTask *taskRsnMini = (AliRsnMiniAnalysisTask *)task; if (taskRsnMini) { taskRsnMini->AddTrackCuts(cuts); } } else { AliRsnDaughterSelector *sel = rsnIH->GetSelector(); // sel->SetLabelCheck(kFALSE); sel->Add(cuts, kTRUE); if (isRsnDev>=0 && opt.Contains("pairPID")) { AliRsnActPostDaughterSelection *pairPID = new AliRsnActPostDaughterSelection(); pairPID->SetID(0); const char *fn="rsnRange.txt"; if (!gSystem->AccessPathName(fn)) { TString minStr = gSystem->GetFromPipe(TString::Format("head -n 1 %s").Data()); TString maxStr = gSystem->GetFromPipe(TString::Format("tail -n 1 %s").Data()); pairPID->SetMass(minStr.Atof(),maxStr.Atof()); } else { // pairPID->SetMass(1.01,1.03); pairPID->SetMass(1.015,1.025); pairPID->SetMass(1.019,1.021); pairPID->SetMass(1.0195,1.0205); pairPID->SetMass(1.1000,1.1005); // pairPID->SetMass(1.1005,1.1010); } sel->AddAction(pairPID); } } return numberOfCuts; }
AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly(char *prodType = "LHC10e14",int cuts=2)//1: Standard Cuts 2009 2: GetStandardITSTPCTrackCuts2009 { // Creates HighPtQATPConly analysis task and adds it to the analysis manager. // A. Get the pointer to the existing analysis manager via the static access method. //============================================================================== AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if (!mgr) { Error("AddTaskPWG4HighPtQATPConly", "No analysis manager to connect to."); return NULL; } // B. Check the analysis type using the event handlers connected to the analysis // manager. The availability of MC handler can also be checked here. //============================================================================== if (!mgr->GetInputEventHandler()) { ::Error("AddTaskPWG4HighPtQATPConly", "This task requires an input event handler"); return NULL; } TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" const char *analysisType = "ESD";//"TPC" // C. Create the task, add it to manager. //=========================================================================== //CREATE THE CUTS ----------------------------------------------- //Use AliESDtrackCuts AliESDtrackCuts *trackCuts = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts"); if(cuts==1) { trackCuts=trackCuts->GetStandardITSTPCTrackCuts2010(kTRUE);//Primary Track Selection trackCuts->SetEtaRange(-0.9,0.9); trackCuts->SetPtRange(0.15, 1e10); } else if(cuts==2) { trackCuts=trackCuts->GetStandardITSTPCTrackCuts2009(kTRUE);//Primary Track Selection trackCuts->SetEtaRange(-0.9,0.9); trackCuts->SetPtRange(0.15, 1e10); } AliESDtrackCuts *trackCutsITS = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts with ITSrefit"); if(cuts==1) { //Cuts SPD || SDD // TPC trackCutsITS->SetMinNClustersTPC(70); trackCutsITS->SetMaxChi2PerClusterTPC(4); trackCutsITS->SetAcceptKinkDaughters(kFALSE); trackCutsITS->SetRequireTPCRefit(kTRUE); // ITS trackCutsITS->SetRequireITSRefit(kTRUE); trackCutsITS->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone); trackCutsITS->SetClusterRequirementITS(AliESDtrackCuts::kSDD, AliESDtrackCuts::kFirst); trackCutsITS->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01"); trackCutsITS->SetMaxDCAToVertexZ(2); trackCutsITS->SetDCAToVertex2D(kFALSE); trackCutsITS->SetRequireSigmaToVertex(kFALSE); trackCutsITS->SetEtaRange(-0.9,0.9); trackCutsITS->SetPtRange(0.15, 1e10); trackCutsITS->SetRequireITSRefit(kTRUE); } else if(cuts==2) { trackCutsITS=trackCutsITS->GetStandardITSTPCTrackCuts2009(kTRUE);//Primary Track Selection trackCutsITS->SetEtaRange(-0.9,0.9); trackCutsITS->SetPtRange(0.15, 1e10); } //Create the task AliPWG4HighPtQATPConly *taskPWG4QA = new AliPWG4HighPtQATPConly(Form("AliPWG4HighPtQATPConly%d",cuts)); taskPWG4QA->SetCuts(trackCuts); taskPWG4QA->SetCutsITS(trackCutsITS); taskPWG4QA->SetCutType(cuts); if(!strcmp(prodType, "LHC10e14") || !strcmp(prodType, "PbPb")) taskPWG4QA->SetPtMax(500.); else taskPWG4QA->SetPtMax(100.); // E. Create ONLY the output containers for the data produced by the task. // Get and connect other common input/output containers via the manager as below //============================================================================== //------ input data ------ TString outputfile = ""; outputfile = AliAnalysisManager::GetCommonFileName(); outputfile += Form(":PWG4_HighPtQATPConly%d",cuts); AliAnalysisDataContainer *cout_hist0; AliAnalysisDataContainer *cout_hist1; AliAnalysisDataContainer *cout_hist2; AliAnalysisDataContainer *cout_cuts0; AliAnalysisDataContainer *cout_cuts1; cout_hist0 = mgr->CreateContainer(Form("qa_histsCuts%d",cuts), TList::Class(), AliAnalysisManager::kOutputContainer,outputfile); cout_hist1 = mgr->CreateContainer(Form("qa_histsTPCCuts%d",cuts), TList::Class(), AliAnalysisManager::kOutputContainer,outputfile); cout_hist2 = mgr->CreateContainer(Form("qa_histsITSCuts%d",cuts), TList::Class(), AliAnalysisManager::kOutputContainer,outputfile); cout_cuts0 = mgr->CreateContainer(Form("qa_trackCuts%d",cuts), AliESDtrackCuts::Class(), AliAnalysisManager::kParamContainer,outputfile); cout_cuts1 = mgr->CreateContainer(Form("qa_trackCutsITS%d",cuts), AliESDtrackCuts::Class(), AliAnalysisManager::kParamContainer,outputfile); //Add task to manager mgr->AddTask(taskPWG4QA); //Connect input containter to manager mgr->ConnectInput(taskPWG4QA,0,mgr->GetCommonInputContainer()); //Connect output containers to manager mgr->ConnectOutput(taskPWG4QA,0,cout_hist0); mgr->ConnectOutput(taskPWG4QA,1,cout_hist1); mgr->ConnectOutput(taskPWG4QA,2,cout_hist2); mgr->ConnectOutput(taskPWG4QA,3,cout_cuts0); mgr->ConnectOutput(taskPWG4QA,4,cout_cuts1); // Return task pointer at the end return taskPWG4QA; }