Bool_t kTPC_Only = kFALSE,
Bool_t kTPCTOF_Cent = kFALSE,
Bool_t kTPCTOF_Sys = kFALSE,
- Bool_t kTPCTOFTRD_Ref = kFALSE,
- Bool_t kTPCTOFTRD_PID = kFALSE,
+ Bool_t kTPCTOFTRD_Ref = kFALSE,
+ Bool_t kTPCTOFTRD_mbPID = kFALSE,
+ Bool_t kTPCTOFTRD_PID = kFALSE,
int TRDtrigger = 0
){
//get the current analysis manager
RegisterTaskPID2(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,kDefTPCs,kDefTPCu,0,0,AliHFEextraCuts::kBoth,kFALSE,TRDtrigger);
}
- if(kTPCTOFTRD_PID){
+ if(kTPCTOFTRD_mbPID){
// without TOF
- RegisterTaskPID2TRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,kDefTPCs,kDefTPCu,0,0,AliHFEextraCuts::kBoth,kFALSE,0,6,4,"TRD,TPC",etacut);
- RegisterTaskPID2TRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,kDefTPCs,kDefTPCu,0,0,AliHFEextraCuts::kBoth,kFALSE,0,6,4,"TPC,TRD",etacut);
- RegisterTaskPID2TRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,kDefTPCs,kDefTPCu,0,0,AliHFEextraCuts::kBoth,kFALSE,0,6,2,"TRD,TPC",etacut);
- RegisterTaskPID2TRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,kDefTPCs,kDefTPCu,0,0,AliHFEextraCuts::kBoth,kFALSE,0,5,4,"TRD,TPC",etacut);
- RegisterTaskPID2TRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,kDefTPCs,kDefTPCu,0,0,AliHFEextraCuts::kBoth,kFALSE,0,5,4,"TPC,TRD",etacut);
- RegisterTaskPID2TRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,kDefTPCs,kDefTPCu,0,0,AliHFEextraCuts::kBoth,kFALSE,0,5,2,"TRD,TPC",etacut);
+ RegisterTaskPID2mbTRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,kDefTPCs,kDefTPCu,0,0,AliHFEextraCuts::kBoth,kFALSE,0,6,4,"TRD,TPC",etacut);
+ RegisterTaskPID2mbTRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,kDefTPCs,kDefTPCu,0,0,AliHFEextraCuts::kBoth,kFALSE,0,6,4,"TPC,TRD",etacut);
+ RegisterTaskPID2mbTRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,kDefTPCs,kDefTPCu,0,0,AliHFEextraCuts::kBoth,kFALSE,0,6,2,"TRD,TPC",etacut);
+ RegisterTaskPID2mbTRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,kDefTPCs,kDefTPCu,0,0,AliHFEextraCuts::kBoth,kFALSE,0,5,4,"TRD,TPC",etacut);
+ RegisterTaskPID2mbTRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,kDefTPCs,kDefTPCu,0,0,AliHFEextraCuts::kBoth,kFALSE,0,5,4,"TPC,TRD",etacut);
+ RegisterTaskPID2mbTRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,kDefTPCs,kDefTPCu,0,0,AliHFEextraCuts::kBoth,kFALSE,0,5,2,"TRD,TPC",etacut);
}
-
+ if(kTPCTOFTRD_PID){
+ // without TOF
+ RegisterTaskPID2TRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,&tpcl1[0],&dEdxhm[0],0,0,AliHFEextraCuts::kBoth,1,0,5,4,"TRD,TPC");
+ RegisterTaskPID2TRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,&tpcl1[0],&dEdxhm[0],0,0,AliHFEextraCuts::kBoth,1,0,5,4,"TPC,TRD");
+ RegisterTaskPID2TRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,&tpcl1[0],&dEdxhm[0],0,0,AliHFEextraCuts::kBoth,1,0,6,4,"TRD,TPC");
+ RegisterTaskPID2TRD(isMC,isAOD,kDefTPCcl,kDefTPCclPID,kDefITScl,kDefDCAr,kDefDCAz,&tpcl1[0],&dEdxhm[0],0,0,AliHFEextraCuts::kBoth,1,0,6,4,"TPC,TRD");
+
+ }
return NULL;
//=========================================================================
-AliAnalysisTask *RegisterTaskPID2TRD(Bool_t useMC, Bool_t isAOD, Int_t tpcCls=120, Int_t tpcClsPID = 80,
+AliAnalysisTask *RegisterTaskPID2mbTRD(Bool_t useMC, Bool_t isAOD, Int_t tpcCls=120, Int_t tpcClsPID = 80,
Int_t itsCls=4, Double_t dcaxy=1.0, Double_t dcaz=2.0,
Double_t tpcs=-0.0113, Double_t tpcu=3.09, Double_t tofs=3.,
Int_t tofm=0,
return NULL;
}
+
+//=========================================================================
+AliAnalysisTask *RegisterTaskPID2TRD(Bool_t useMC, Bool_t isAOD, Int_t tpcCls=120, Int_t tpcClsPID = 80,
+ Int_t itsCls=4, Double_t dcaxy=1.0, Double_t dcaz=2.0,
+ Double_t *tpcdEdxcutlow=NULL,
+ Double_t *tpcdEdxcuthigh=NULL,
+ Double_t tofs=3., Int_t tofm=0,
+ Int_t itshitpixel = AliHFEextraCuts::kBoth, Int_t icent=1,
+ Int_t TRDtrigger=0,Int_t trdl=6, Int_t trde=4,TString detector){
+
+ gROOT->LoadMacro("$ALICE_ROOT/PWGHF/hfe/macros/configs/pPb/ConfigHFEpPbTRD.C");
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+
+ TString detused=detector.Copy();
+ TPRegexp(",").Substitute(detused,"","g");
+ printf("detectors in use %s %s \n",detector.Data(),detused.Data());
+
+ if (icent == 2) TString cesti("V0M");
+ else if (icent == 3) TString cesti("CL1");
+ else if (icent == 4) TString cesti("ZNA");
+ else TString cesti("V0A");
+
+ Int_t idcaxy = (Int_t)(dcaxy*10.);
+ Int_t idcaz = (Int_t)(dcaz*10.);
+ Int_t tpclow = 0;
+ if(tpcdEdxcutlow) tpclow = (Int_t) (tpcdEdxcutlow[0]*1000.);
+ Int_t itofs = (Int_t)(tofs*10.);
+ Int_t ipixelany = itshitpixel;
+
+ TString appendix(TString::Format("mbTPCc%dTPCp%dITS%dDCAr%dz%dTPCs%dTOFs%dm%ipa%dtrdtrg%dtrdl%itrde%iPID%scent%s",tpcCls,
+ tpcClsPID,itsCls,idcaxy,idcaz,tpclow,itofs,tofm,ipixelany,TRDtrigger,trdl,trde,detused.Data(),cesti.Data()));
+ printf("Add macro appendix %s\n", appendix.Data());
+
+ AliAnalysisTaskHFE *task = ConfigHFEpPbTRD(useMC, isAOD, appendix, tpcCls, tpcClsPID, itsCls, dcaxy, dcaz,
+ tpcdEdxcutlow,tpcdEdxcuthigh, tofs, tofm, itshitpixel, icent, -0.8, 0.8,
+ TRDtrigger,trdl,trde,detector);
+ if(isAOD)
+ task->SetAODAnalysis();
+ else
+ task->SetESDAnalysis();
+
+ if (useMC)
+ task->SetHasMCData(kTRUE);
+ else{
+ task->SetHasMCData(kFALSE);
+ }
+
+ if(TRDtrigger<2) task->SelectCollisionCandidates(AliVEvent::kINT7);
+ else task->SelectCollisionCandidates(AliVEvent::kTRD);
+
+ //create data containers
+ task->ConnectOutput(1, mgr->CreateContainer(Form("HFE_Results_%s", appendix.Data()),
+ TList::Class(), AliAnalysisManager::kOutputContainer,
+ containerName.Data()));
+ task->ConnectOutput(2, mgr->CreateContainer(Form("HFE_QA_%s", appendix.Data()), TList::Class(),
+ AliAnalysisManager::kOutputContainer,
+ containerName.Data()));
+ mgr->ConnectInput(task, 0, cinput );
+
+ mgr->AddTask(task);
+ return NULL;
+}
--- /dev/null
+Bool_t ReadContaminationFunctions(TString filename, TF1 **functions, double sigma){
+ TFile *in = TFile::Open(Form("$ALICE_ROOT/PWGHF/hfe/macros/configs/pPb/%s", filename.Data()));
+ gROOT->cd();
+ int isig = static_cast<int>(sigma * 100.);
+ printf("Getting hadron background for the sigma cut: %d\n", isig);
+ bool status = kTRUE;
+ for(int icent = 0; icent < 12; icent++){
+ functions[icent] = dynamic_cast<TF1 *>(in->Get(Form("hback_%d_%d", isig, icent)));
+ if(functions[icent])
+ {
+// new TCanvas;
+// functions[0]->Draw();
+ printf("Config for centrality class %d found\n", icent);
+ }
+ else{
+ printf("Config for the centrality class %d not found\n", icent);
+ status = kFALSE;
+ }
+ }
+ delete in;
+ return status;
+}
+
+AliAnalysisTaskHFE* ConfigHFEpPbTRD(Bool_t useMC, Bool_t isAOD, TString appendix,
+ UChar_t TPCcl=70, UChar_t TPCclPID = 80,
+ UChar_t ITScl=3, Double_t DCAxy=1000., Double_t DCAz=1000.,
+ Double_t* tpcdEdxcutlow=NULL,Double_t* tpcdEdxcuthigh=NULL,
+ Double_t TOFs=3., Int_t TOFmis=0,
+ Int_t itshitpixel = 0, Int_t icent=1,
+ Double_t etami=-0.8, Double_t etama=0.8,
+ Int_t TRDtrigger=1, Int_t TRDtl=6, Int_t TRDeff=4,
+ TString detector){
+
+ Bool_t kAnalyseTaggedTracks = kFALSE;
+
+ // TRD settings
+ Float_t eeff[6] = {0.7, 0.75, 0.8, 0.85, 0.9, 0.95};
+ Int_t eeffint[6] = {70, 75, 80, 85, 90, 95};
+ // if(TRDeff >= 6 || TRDtl < 4 || TRDtl > 6) return NULL;
+ if(TRDeff >= 6 || TRDtl > 6) return NULL;
+ printf("TRD settings: %i %f \n",TRDtl, eeff[TRDeff]);
+
+ //***************************************//
+ // Setting up the HFE cuts //
+ //***************************************//
+
+ AliHFEcuts *hfecuts = new AliHFEcuts(appendix,"HFE cuts for pPb with TRD");
+
+ // hfecuts->SetQAOn();
+ hfecuts->CreateStandardCuts();
+ hfecuts->SetMinNClustersTPC(TPCcl);
+ hfecuts->SetMinNClustersTPCPID(TPCclPID);
+ hfecuts->SetMinNClustersITS(ITScl);
+ hfecuts->SetMinRatioTPCclusters(0.6);
+ hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+ hfecuts->SetCutITSpixel(itshitpixel);
+ hfecuts->SetCheckITSLayerStatus(kFALSE);
+// hfecuts->SetEtaRange(etami,etama);
+ if(TRDtl>0) hfecuts->SetMinNTrackletsTRD(TRDtl, kTRUE); // number of trd tracklets
+ if(isAOD) hfecuts->SetAODFilterBit(4);
+
+ //if((iPixelAny==AliHFEextraCuts::kAny) || (iPixelAny==AliHFEextraCuts::kSecond))
+ //hfecuts->SetProductionVertex(0,7,0,7);
+
+ hfecuts->SetMaxImpactParam(DCAxy,DCAz);
+ hfecuts->SetUseMixedVertex(kTRUE);
+ hfecuts->SetVertexRange(10.);
+ // New pPb cuts (February 2013)
+ hfecuts->SetUseCorrelationVertex();
+ hfecuts->SetSPDVtxResolutionCut();
+ hfecuts->SetpApileupCut();
+
+ // TOF settings:
+ Int_t usetof=0;
+ Bool_t kTOFmis=kFALSE;
+ if (TOFs>0.){
+ usetof = 1;
+ printf("CONFIGURATION FILE: TOF is used \n");
+ hfecuts->SetTOFPIDStep(kTRUE);
+ printf("CONFIGURATION FILE: TOF PID step is requested !!!! \n");
+ if (TOFmis>0){
+ kTOFmis = kTRUE;
+ printf("CONFIGURATION FILE: TOF mismatch rejection is set ON \n");
+ }
+ }
+
+ //***************************************//
+ // Setting up the task //
+ //***************************************//
+
+ AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE(appendix);
+ printf("task %p\n", task);
+ task->SetpPbAnalysis();
+ if(!isAOD) task->SetRemoveFirstEventInChunk();
+ task->SetRemovePileUp(kFALSE);
+ task->SetHFECuts(hfecuts);
+ task->GetPIDQAManager()->SetHighResolutionHistos();
+
+ // Determine the centrality estimator
+ task->SetCentralityEstimator("V0A");
+ if (icent == 2) task->SetCentralityEstimator("V0M");
+ else if (icent == 3) task->SetCentralityEstimator("CL1");
+ else if (icent == 4) task->SetCentralityEstimator("ZNA");
+
+ Bool_t activateTRDTrigger=kFALSE;
+ if(TRDtrigger>0) activateTRDTrigger=kTRUE;
+ task->SetTRDTrigger(activateTRDTrigger,TRDtrigger);
+
+ //***************************************//
+ // Variable manager //
+ //***************************************//
+ // Define Variables
+ Double_t ptbinning[36] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3., 3.5, 4., 4.5, 5., 5.5, 6., 7., 8., 10., 12., 14., 16., 18., 20.};
+ //Double_t ptbinning[53] = {0., 0.1, 0.2, 0.22, 0.24, 0.26, 0.28, 0.3, 0.32, 0.34, 0.36, 0.38, 0.4, 0.42, 0.44, 0.46, 0.48, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3., 3.5, 4., 4.5, 5., 5.5, 6., 7., 8., 10., 12., 14., 16., 18., 20.};
+
+ //Double_t etabinning[9] = {-0.8, -0.6, -0.4, -0.2, 0., 0.2, 0.4, 0.6, 0.8};
+ Double_t etabinning[17] = {-0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8};
+ //Double_t etabinning[33] = {-0.8,-0.75,-0.7,-0.65,-0.6,-0.55,-0.5,-0.45,-0.4,-0.35,-0.3,-0.25,-0.2,-0.15,-0.1,-0.05,
+ //0.,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8};
+
+ Int_t sizept=(sizeof(ptbinning)/sizeof(double))-1;
+ Int_t sizeeta=(sizeof(etabinning)/sizeof(double))-1;
+
+ AliHFEvarManager *vm = task->GetVarManager();
+ vm->AddVariable("pt", sizept, ptbinning);
+ vm->AddVariable("eta", sizeeta, -0.8,0.8);
+ vm->AddVariable("phi",21, -0, 2*TMath::Pi());
+ vm->AddVariable("charge");
+ vm->AddVariable("source");
+ vm->AddVariable("centrality");
+
+ // For the moment, remove the part dedicated to the background subtraction.
+ // It will be implemented in a different way, reading it from a root file.
+
+ //***************************************//
+ // Configure the PID //
+ //***************************************//
+
+ // Define PID
+ AliHFEpid *pid = task->GetPID();
+ if(useMC) pid->SetHasMCData(kTRUE);
+ pid->SetDetectorsForAnalysis(detector);
+
+ // Configure TPC PID
+ // do the identical thing in data and MC
+ Double_t paramsTPCdEdxcutlow[12] ={0.0, 0.0, 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
+ if(tpcdEdxcutlow) memcpy(paramsTPCdEdxcutlow,tpcdEdxcutlow,sizeof(paramsTPCdEdxcutlow));
+
+ Double_t paramsTPCdEdxcuthigh[12] ={3.0, 3.0, 3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0};
+ if(tpcdEdxcuthigh) memcpy(paramsTPCdEdxcuthigh,tpcdEdxcuthigh,sizeof(paramsTPCdEdxcuthigh));
+
+ char *cutmodel;
+ cutmodel="pol0";
+
+ for(Int_t a=0;a<11;a++)
+ {
+ // cout << a << " " << paramsTPCdEdxcut[a] << endl;
+ Double_t tpcparamlow[1]={paramsTPCdEdxcutlow[a]};
+ Float_t tpcparamhigh=paramsTPCdEdxcuthigh[a];
+ pid->ConfigureTPCcentralityCut(a,cutmodel,tpcparamlow,tpcparamhigh);
+ }
+ pid->ConfigureTPCdefaultCut(cutmodel,paramsTPCdEdxcutlow,paramsTPCdEdxcuthigh[0]);
+
+
+
+ // Apply eta correction
+ AliHFEpidTPC *tpcpid = pid->GetDetPID(AliHFEpid::kTPCpid);
+ // Setting to cut on absolute dEdx (not sigma)
+ //tpcpid->UsedEdx();
+ //TF1 *etacorrection = GetEtaCorrection();
+ //if(etacorrection) tpcpid->SetEtaCorrection(etacorrection);
+
+ // Configure TOF PID
+ if (usetof){
+ pid->ConfigureTOF(TOFs);
+ AliHFEpidTOF *tofpid = pid->GetDetPID(AliHFEpid::kTOFpid);
+ if (kTOFmis){
+ tofpid->SetRejectTOFmismatch();
+ }
+ }
+
+ // To make different upper TOF cut to see contamination effect
+ // The below two lines should be removed after this check
+ //AliHFEpidTOF *tofpid = pid->GetDetPID(AliHFEpid::kTOFpid);
+ //if(TOFs<3.) tofpid->SetTOFnSigmaBand(-3,TOFs); //only to check the assymmetric tof cut
+
+ if(TRDtl>0){
+ AliHFEpidTRD *trdpid = pid->GetDetPID(AliHFEpid::kTRDpid);
+ trdpid->SetTRD2DPID();
+ trdpid->SetElectronEfficiency(eeff[TRDeff]); // efficiency
+ trdpid->SetNTracklets(TRDtl); // ntracklets threshold
+ trdpid->SetCutNTracklets(TRDtl, kTRUE);
+ }
+
+
+ // Load hadron background
+ if(!useMC){
+ Bool_t status = kTRUE;
+ TF1 *hBackground[12];
+ //status = ReadContaminationFunctions("hadronContamination_pPbTPCTOF_forwardEta.root", hBackground, tpcdEdxcutlow[0]);
+ //status = ReadContaminationFunctions("hadronContamination_pPbTPCTOF_eta66.root", hBackground, tpcdEdxcutlow[0]);
+ if(TRDtl==5){
+ status = ReadContaminationFunctions("hadroncontamination_TRDTPC_pPb_eta06_5tracklets.root", hBackground, tpcdEdxcutlow[0]);
+ printf("hadroncont5tracklets \n");
+ }
+ if(TRDtl==6)
+ {
+ status = ReadContaminationFunctions("hadroncontamination_TRDTPC_pPb_eta06_6tracklets.root", hBackground, tpcdEdxcutlow[0]);
+ printf("hadroncont6tracklets \n");
+ }
+ for(Int_t a=0;a<12;a++) {
+ //printf("back %f \n",hBackground[a]);
+ if(status) task->SetBackGroundFactorsFunction(hBackground[a],a);
+ else printf("not all background functions found\n");
+ }
+ }
+
+ //***************************************//
+ // V0 tagged tracks //
+ //***************************************//
+ if(kAnalyseTaggedTracks){
+ AliHFEcuts *v0trackCuts = new AliHFEcuts("V0trackCuts", "Track Cuts for tagged track Analysis");
+ v0trackCuts->CreateStandardCuts();
+ v0trackCuts->SetMinNClustersTPC(TPCcl);
+ v0trackCuts->SetMinNClustersTPCPID(TPCclPID);
+ v0trackCuts->SetMinRatioTPCclusters(0.6);
+ v0trackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+ v0trackCuts->SetMinNClustersITS(1);
+ v0trackCuts->SetCutITSpixel(AliHFEextraCuts::kFirst);
+ v0trackCuts->SetCheckITSLayerStatus(kFALSE);
+ v0trackCuts->UnsetVertexRequirement();
+ //hfecuts->SetSigmaToVertex(10);
+ if(usetof) v0trackCuts->SetTOFPIDStep(kTRUE);
+ if(TRDtl>0)v0trackCuts->SetMinNTrackletsTRD(TRDtl,kTRUE); // condition for TRD tracklets
+ v0trackCuts->SetQAOn();
+
+ task->SwitchOnPlugin(AliAnalysisTaskHFE::kTaggedTrackAnalysis);
+ task->SetTaggedTrackCuts(v0trackCuts);
+ task->SetCleanTaggedTrack(kTRUE);
+ }
+
+ // QA
+ printf("task %p\n", task);
+ task->SetQAOn(AliAnalysisTaskHFE::kPIDqa);
+ task->SetQAOn(AliAnalysisTaskHFE::kMCqa);
+ task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
+
+ printf("*************************************\n");
+ printf("Configuring standard Task:\n");
+ task->PrintStatus();
+ pid->PrintStatus();
+ printf("*************************************\n");
+ return task;
+}