1 /***************************************************************************
2 fbellini@cern.ch - last modified on 06/08/2012
4 // General macro to configure the RSN analysis task.
5 // It calls all configs desired by the user, by means
6 // of the boolean switches defined in the first lines.
9 // 1) flag to know if running on MC or data
10 // 2) path where all configs are stored
13 // kTRUE --> initialization successful
14 // kFALSE --> initialization failed (some config gave errors)
16 ****************************************************************************/
18 AliRsnMiniAnalysisTask * AddAnalysisTaskTOFKStar
22 Int_t aodFilterBit = 5,
23 AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutPiCandidate = AliRsnCutSetDaughterParticle::kTOFpidKstarPbPb2010,
24 AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutKaCandidate = AliRsnCutSetDaughterParticle::kTOFpidKstarPbPb2010,
25 Float_t nsigmaPi = 2.0,
26 Float_t nsigmaKa = 2.0,
27 Bool_t enableMonitor = kTRUE,
28 Bool_t IsMcTrueOnly = kFALSE,
30 Float_t maxDiffVzMix = 1.0,
31 Float_t maxDiffMultMix = 10.0,
32 Float_t maxDiffAngleMixDeg = 20.0,
33 Bool_t isAOD49 = kTRUE,
34 TString outNameSuffix = "",
36 Int_t signedPdg = 313,
37 TString monitorOpt = "",
38 Double_t minYlab = -0.5,
39 Double_t maxYlab = 0.5,
40 AliRsnMiniValue::EType yaxisvar = AliRsnMiniValue::kPt
44 // -- INITIALIZATION ----------------------------------------------------------------------------
45 // retrieve analysis manager
47 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
49 ::Error("AddAnalysisTaskTOFKStar", "No analysis manager to connect to.");
53 // create the task and configure
54 TString taskName = Form("TOFKStar%s%s_%i%i", (isPP? "pp" : "PbPb"), (isMC ? "MC" : "Data"), (Int_t)cutPiCandidate,(Int_t)cutKaCandidate );
55 AliRsnMiniAnalysisTask *task = new AliRsnMiniAnalysisTask(taskName.Data(), isMC);
57 Printf(Form("========== SETTING USE CENTRALITY PATCH AOD049 : %s", isAOD49 ? "yes" : "no"));
58 task->SetUseCentralityPatch(isAOD49);
61 task->UseMultiplicity("QUALITY");
63 task->UseCentrality("V0M");
64 // set event mixing options
65 task->UseContinuousMix();
66 //task->UseBinnedMix();
68 task->SetMaxDiffVz(maxDiffVzMix);
69 task->SetMaxDiffMult(maxDiffMultMix);
70 if (!isPP) task->SetMaxDiffAngle(maxDiffAngleMixDeg*TMath::DegToRad()); //set angle diff in rad
71 ::Info("AddAnalysisTaskTOFKStar", Form("Event mixing configuration: \n events to mix = %i \n max diff. vtxZ = cm %5.3f \n max diff multi = %5.3f \n max diff EP angle = %5.3f deg", nmix, maxDiffVzMix, maxDiffMultMix, (isPP ? 0.0 : maxDiffAngleMixDeg)));
76 // -- EVENT CUTS (same for all configs) ---------------------------------------------------------
78 // cut on primary vertex:
79 // - 2nd argument --> |Vz| range
80 // - 3rd argument --> minimum required number of contributors
81 // - 4th argument --> tells if TPC stand-alone vertexes must be accepted
82 AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
83 if (isPP) cutVertex->SetCheckPileUp(kTRUE); // set the check for pileup
85 // define and fill cut set for event cut
86 AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent);
87 eventCuts->AddCut(cutVertex);
88 eventCuts->SetCutScheme(cutVertex->GetName());
90 task->SetEventCuts(eventCuts);
93 // -- EVENT-ONLY COMPUTATIONS -------------------------------------------------------------------
96 Int_t vtxID = task->CreateValue(AliRsnMiniValue::kVz, kFALSE);
97 AliRsnMiniOutput *outVtx = task->CreateOutput("eventVtx", "HIST", "EVENT");
98 outVtx->AddAxis(vtxID, 400, -20.0, 20.0);
100 //multiplicity or centrality
101 Int_t multID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE);
102 AliRsnMiniOutput *outMult = task->CreateOutput("eventMult", "HIST", "EVENT");
104 outMult->AddAxis(multID, 400, 0.0, 400.0);
106 outMult->AddAxis(multID, 100, 0.0, 100.0);
108 //event plane (only for PbPb)
109 Int_t planeID = task->CreateValue(AliRsnMiniValue::kPlaneAngle, kFALSE);
110 AliRsnMiniOutput *outPlane = 0x0;
112 outPlane=task->CreateOutput("eventPlane", "HIST", "EVENT");
113 outPlane->AddAxis(planeID, 180, 0.0, TMath::Pi());
116 TH2F* hvz=new TH2F("hVzVsCent","",100,0.,100., 220,-11.,11.);
117 task->SetEventQAHist("vz",hvz);//plugs this histogram into the fHAEventVz data member
119 TH2F* hmc=new TH2F("MultiVsCent","",100,0.,100.,4000,0.,4000.);
120 hmc->GetYaxis()->SetTitle("QUALITY");
121 task->SetEventQAHist("multicent",hmc);//plugs this histogram into the fHAEventMultiCent data member
123 TH2F* hep=new TH2F("hEventPlaneVsCent","",100,0.,100., 180,0.,TMath::Pi());
124 task->SetEventQAHist("eventplane",hep);//plugs this histogram into the fHAEventPlane data member
127 // -- PAIR CUTS (common to all resonances) ------------------------------------------------------
129 AliRsnCutMiniPair *cutY = new AliRsnCutMiniPair("cutRapidity", AliRsnCutMiniPair::kRapidityRange);
130 cutY->SetRangeD(minYlab, maxYlab);
132 AliRsnCutSet *cutsPair = new AliRsnCutSet("pairCuts", AliRsnTarget::kMother);
133 cutsPair->AddCut(cutY);
134 cutsPair->SetCutScheme(cutY->GetName());
137 // -- CONFIG ANALYSIS --------------------------------------------------------------------------
138 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigTOFanalysisKStar.C");
140 if (((Int_t)cutPiCandidate<4) && ((Int_t)cutKaCandidate<4))
141 Printf("========================== MC analysis - no PID used for efficiency estimation");
143 Printf("========================== MC analysis - PID cuts used");
145 Printf("========================== DATA analysis - PID cuts used");
146 if (!ConfigTOFanalysisKStar(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, useMixLS, signedPdg, monitorOpt.Data(), yaxisvar)) return 0x0;
149 // -- CONTAINERS --------------------------------------------------------------------------------
151 TString outputFileName = AliAnalysisManager::GetCommonFileName();
152 // outputFileName += ":Rsn";
153 Printf("AddAnalysisTaskTOFKStar - Set OutputFileName : \n %s\n", outputFileName.Data() );
155 AliAnalysisDataContainer *output = mgr->CreateContainer(Form("RsnOut_%s",outNameSuffix.Data()),
157 AliAnalysisManager::kOutputContainer,
159 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
160 mgr->ConnectOutput(task, 1, output);