]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/macros/mini/AddAnalysisTaskTPCKStarSyst.C
998605160265eb7ab5b51927b7927758178b5e2d
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / mini / AddAnalysisTaskTPCKStarSyst.C
1 /***************************************************************************
2               subhash.singha@cern.ch - last modified on 20/01/2014
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 * AddAnalysisTaskTPCKStarSyst
19 (
20    Bool_t      isMC,
21    Bool_t      isPP,
22    Int_t       aodFilterBit = 5,
23    AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutPiCandidate = AliRsnCutSetDaughterParticle::kFastTPCpidNsigma,
24    AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutKaCandidate = AliRsnCutSetDaughterParticle::kFastTPCpidNsigma,
25    Float_t     nsigmaPi = 2.0,
26    Float_t     nsigmaKa = 2.0,
27    Bool_t      enableSyst = kFALSE,
28    Char_t DCAxyFormula[100] = "0.0182+0.035/pt^1.01",
29    Double_t    dcazmax = 2,
30    Double_t    minNcls = 70,
31    Double_t    maxX2cls = 4.0,
32    Double_t    minCrossedRows = 70.0,
33    Double_t    maxClsCrossedRows = 0.8,
34    Bool_t      enableMonitor = kTRUE,
35    Bool_t      IsMcTrueOnly = kFALSE,
36    UInt_t      triggerMask = AliVEvent::kMB,
37    //Bool_t      is2011PbPb = kFALSE,
38    Int_t       nmix = 0,
39    Float_t     maxDiffVzMix = 1.0,
40    Float_t     maxDiffMultMix = 10.0,
41    Float_t     maxDiffAngleMixDeg = 20.0,
42    Int_t       aodN = 0,
43    TString     outNameSuffix = ""
44 )
45 {  
46   //
47   // -- INITIALIZATION ----------------------------------------------------------------------------
48   // retrieve analysis manager
49   //
50
51   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
52    if (!mgr) {
53       ::Error("AddAnalysisTaskTPCKStarSyst", "No analysis manager to connect to.");
54       return NULL;
55    } 
56
57    // create the task and configure 
58    TString taskName = Form("TPCKStar%s%s_%i%i_%s", (isPP? "pp" : "PbPb"), (isMC ? "MC" : "Data"), (Int_t)cutPiCandidate,(Int_t)cutKaCandidate, outNameSuffix.Data() );
59    AliRsnMiniAnalysisTask *task = new AliRsnMiniAnalysisTask(taskName.Data(), isMC);
60    if (!isMC && !isPP){
61      Printf(Form("========== SETTING USE CENTRALITY PATCH AOD049 : %s", (aodN==49)? "yes" : "no"));
62      task->SetUseCentralityPatch(aodN==49);
63    }
64
65    //if(is2011PbPb)
66    //task->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);
67    //else
68    task->SelectCollisionCandidates(triggerMask);
69
70
71    if (isPP) 
72      task->UseMultiplicity("QUALITY");
73    else
74      task->UseCentrality("V0M");   
75    // set event mixing options
76    task->UseContinuousMix();
77    //task->UseBinnedMix();
78    task->SetNMix(nmix);
79    task->SetMaxDiffVz(maxDiffVzMix);
80    task->SetMaxDiffMult(maxDiffMultMix);
81    if (!isPP) task->SetMaxDiffAngle(maxDiffAngleMixDeg*TMath::DegToRad()); //set angle diff in rad
82    ::Info("AddAnalysisTaskTPCKStarSyst", 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)));
83    
84    mgr->AddTask(task);
85    
86    //
87    // -- EVENT CUTS (same for all configs) ---------------------------------------------------------
88    //  
89    // cut on primary vertex:
90    // - 2nd argument --> |Vz| range
91    // - 3rd argument --> minimum required number of contributors
92    // - 4th argument --> tells if TPC stand-alone vertexes must be accepted
93    AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
94    if (isPP) cutVertex->SetCheckPileUp(kTRUE);   // set the check for pileup
95    
96    // define and fill cut set for event cut
97    AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent);
98    eventCuts->AddCut(cutVertex);
99    eventCuts->SetCutScheme(cutVertex->GetName());
100    // set cuts in task
101    task->SetEventCuts(eventCuts);
102    
103    //
104    // -- EVENT-ONLY COMPUTATIONS -------------------------------------------------------------------
105    //   
106    //vertex
107    Int_t vtxID = task->CreateValue(AliRsnMiniValue::kVz, kFALSE);
108    AliRsnMiniOutput *outVtx = task->CreateOutput("eventVtx", "HIST", "EVENT");
109    outVtx->AddAxis(vtxID, 400, -20.0, 20.0);
110    
111    //multiplicity or centrality
112    Int_t multID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE);
113    AliRsnMiniOutput *outMult = task->CreateOutput("eventMult", "HIST", "EVENT");
114    if (isPP) 
115      outMult->AddAxis(multID, 400, 0.0, 400.0);
116    else
117      outMult->AddAxis(multID, 100, 0.0, 100.0);
118    
119    //event plane (only for PbPb)
120    Int_t planeID = task->CreateValue(AliRsnMiniValue::kPlaneAngle, kFALSE);
121    AliRsnMiniOutput *outPlane = task->CreateOutput("eventPlane", "HIST", "EVENT");
122    if (!isPP)
123      outPlane->AddAxis(planeID, 180, 0.0, TMath::Pi());
124    
125    //
126    // -- PAIR CUTS (common to all resonances) ------------------------------------------------------
127    //
128    AliRsnCutMiniPair *cutY = new AliRsnCutMiniPair("cutRapidity", AliRsnCutMiniPair::kRapidityRange);
129    cutY->SetRangeD(-0.5, 0.5);
130    
131    AliRsnCutSet *cutsPair = new AliRsnCutSet("pairCuts", AliRsnTarget::kMother);
132    cutsPair->AddCut(cutY);
133    cutsPair->SetCutScheme(cutY->GetName());
134    
135    //
136    // -- CONFIG ANALYSIS --------------------------------------------------------------------------
137    if((!isMC) && (!enableSyst)){
138      gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStar.C");
139      if (!ConfigTPCanalysisKStar(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, aodN)) return 0x0;
140    }
141    if((isMC) && (!enableSyst)) {
142      gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStarMC.C");
143      if (!ConfigTPCanalysisKStarMC(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, 313, aodN)) return 0x0; //K*
144      if (!ConfigTPCanalysisKStarMC(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, -313, aodN)) return 0x0; //anti-K* 
145    }
146    
147    //for systematic checks
148    if((!isMC) && (enableSyst))
149      {
150    gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStarSyst.C");
151    if (!ConfigTPCanalysisKStarSyst(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableSyst, DCAxyFormula, dcazmax, minNcls, maxX2cls, minCrossedRows, maxClsCrossedRows, enableMonitor, isMC&IsMcTrueOnly, 313, aodN)) return 0x0;  
152      }
153
154    //for systematic checks
155    if((isMC) && (enableSyst)) {
156      gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStarSyst.C");
157      if (!ConfigTPCanalysisKStarSyst(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableSyst, DCAxyFormula, dcazmax, minNcls, maxX2cls, minCrossedRows, maxClsCrossedRows, enableMonitor, isMC&IsMcTrueOnly, 313, aodN)) return 0x0; //K*
158      if (!ConfigTPCanalysisKStarSyst(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa,enableSyst, DCAxyFormula, dcazmax, minNcls, maxX2cls, minCrossedRows, maxClsCrossedRows, enableMonitor, isMC&IsMcTrueOnly, -313, aodN)) return 0x0; //anti-K* 
159    }
160    
161    //
162    // -- CONTAINERS --------------------------------------------------------------------------------
163    //
164    TString outputFileName = AliAnalysisManager::GetCommonFileName();
165    //  outputFileName += ":Rsn";
166    Printf("AddAnalysisTaskTPCKStarSyst - Set OutputFileName : \n %s\n", outputFileName.Data() );
167    
168    AliAnalysisDataContainer *output = mgr->CreateContainer(Form("RsnOut_%s",outNameSuffix.Data()), 
169                                                            TList::Class(), 
170                                                            AliAnalysisManager::kOutputContainer, 
171                                                            outputFileName);
172    mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
173    mgr->ConnectOutput(task, 1, output);
174    
175    return task;
176 }