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