]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/macros/mini/AddAnalysisTaskTOFKStar.C
Updated macros for K* analysis with TOF PID
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / mini / AddAnalysisTaskTOFKStar.C
1 /***************************************************************************
2               fbellini@cern.ch - last modified on 06/08/2012
3 //
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.
7 // ---
8 // Inputs:
9 //  1) flag to know if running on MC or data
10 //  2) path where all configs are stored
11 // ---
12 // Returns:
13 //  kTRUE  --> initialization successful
14 //  kFALSE --> initialization failed (some config gave errors)
15 //
16 ****************************************************************************/
17
18 AliRsnMiniAnalysisTask * AddAnalysisTaskTOFKStar
19 (
20    Bool_t      isMC,
21    Bool_t      isPP,
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,
29    Int_t       nmix = 0,
30    Float_t     maxDiffVzMix = 1.0,
31    Float_t     maxDiffMultMix = 10.0,
32    Float_t     maxDiffAngleMixDeg = 20.0,
33    Int_t       aodN = 0,
34    TString     outNameSuffix = "",
35    Bool_t      useMixLS = 0
36 )
37 {  
38   //
39   // -- INITIALIZATION ----------------------------------------------------------------------------
40   // retrieve analysis manager
41   //
42
43   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
44    if (!mgr) {
45       ::Error("AddAnalysisTaskTOFKStar", "No analysis manager to connect to.");
46       return NULL;
47    } 
48
49    // create the task and configure 
50    TString taskName = Form("TOFKStar%s%s_%i%i", (isPP? "pp" : "PbPb"), (isMC ? "MC" : "Data"), (Int_t)cutPiCandidate,(Int_t)cutKaCandidate );
51    AliRsnMiniAnalysisTask *task = new AliRsnMiniAnalysisTask(taskName.Data(), isMC);
52    if (!isMC && !isPP){
53      Printf(Form("========== SETTING USE CENTRALITY PATCH AOD049 : %s", (aodN==49)? "yes" : "no"));
54      task->SetUseCentralityPatch(aodN==49);
55    }
56    if (isPP) 
57      task->UseMultiplicity("QUALITY");
58    else
59      task->UseCentrality("V0M");   
60    // set event mixing options
61    task->UseContinuousMix();
62    //task->UseBinnedMix();
63    task->SetNMix(nmix);
64    task->SetMaxDiffVz(maxDiffVzMix);
65    task->SetMaxDiffMult(maxDiffMultMix);
66    if (!isPP) task->SetMaxDiffAngle(maxDiffAngleMixDeg*TMath::DegToRad()); //set angle diff in rad
67    ::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)));
68    
69    mgr->AddTask(task);
70    
71    //
72    // -- EVENT CUTS (same for all configs) ---------------------------------------------------------
73    //  
74    // cut on primary vertex:
75    // - 2nd argument --> |Vz| range
76    // - 3rd argument --> minimum required number of contributors
77    // - 4th argument --> tells if TPC stand-alone vertexes must be accepted
78    AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
79    if (isPP) cutVertex->SetCheckPileUp(kTRUE);   // set the check for pileup
80    
81    // define and fill cut set for event cut
82    AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent);
83    eventCuts->AddCut(cutVertex);
84    eventCuts->SetCutScheme(cutVertex->GetName());
85    // set cuts in task
86    task->SetEventCuts(eventCuts);
87    
88    //
89    // -- EVENT-ONLY COMPUTATIONS -------------------------------------------------------------------
90    //   
91    //vertex
92    Int_t vtxID = task->CreateValue(AliRsnMiniValue::kVz, kFALSE);
93    AliRsnMiniOutput *outVtx = task->CreateOutput("eventVtx", "HIST", "EVENT");
94    outVtx->AddAxis(vtxID, 400, -20.0, 20.0);
95    
96    //multiplicity or centrality
97    Int_t multID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE);
98    AliRsnMiniOutput *outMult = task->CreateOutput("eventMult", "HIST", "EVENT");
99    if (isPP) 
100      outMult->AddAxis(multID, 400, 0.0, 400.0);
101    else
102      outMult->AddAxis(multID, 100, 0.0, 100.0);
103    
104    //event plane (only for PbPb)
105    Int_t planeID = task->CreateValue(AliRsnMiniValue::kPlaneAngle, kFALSE);
106    AliRsnMiniOutput *outPlane = task->CreateOutput("eventPlane", "HIST", "EVENT");
107    outPlane->AddAxis(planeID, 180, 0.0, TMath::Pi());
108    
109    //
110    // -- PAIR CUTS (common to all resonances) ------------------------------------------------------
111    //
112    AliRsnCutMiniPair *cutY = new AliRsnCutMiniPair("cutRapidity", AliRsnCutMiniPair::kRapidityRange);
113    cutY->SetRangeD(-0.5, 0.5);
114    
115    AliRsnCutSet *cutsPair = new AliRsnCutSet("pairCuts", AliRsnTarget::kMother);
116    cutsPair->AddCut(cutY);
117    cutsPair->SetCutScheme(cutY->GetName());
118    
119    //
120    // -- CONFIG ANALYSIS --------------------------------------------------------------------------
121    gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigTOFanalysisKStar.C");
122    if (isMC) {
123      if (((Int_t)cutPiCandidate<4) && ((Int_t)cutKaCandidate<4))
124        Printf("========================== MC analysis - no PID used for efficiency estimation");
125      else 
126        Printf("========================== MC analysis - PID cuts used");
127    } else 
128      Printf("========================== DATA analysis - PID cuts used");
129    if (!ConfigTOFanalysisKStar(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, aodN, useMixLS)) return 0x0;
130    
131    //
132    // -- CONTAINERS --------------------------------------------------------------------------------
133    //
134    TString outputFileName = AliAnalysisManager::GetCommonFileName();
135    //  outputFileName += ":Rsn";
136    Printf("AddAnalysisTaskTOFKStar - Set OutputFileName : \n %s\n", outputFileName.Data() );
137    
138    AliAnalysisDataContainer *output = mgr->CreateContainer(Form("RsnOut_%s",outNameSuffix.Data()), 
139                                                            TList::Class(), 
140                                                            AliAnalysisManager::kOutputContainer, 
141                                                            outputFileName);
142    mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
143    mgr->ConnectOutput(task, 1, output);
144    
145    return task;
146 }