]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/macros/mini/AddAnalysisTaskLStar.C
Merge remote-tracking branch 'origin/flatdev' into mergeFlat2Master
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / mini / AddAnalysisTaskLStar.C
1 /***************************************************************************
2   rama.chandra.baral@cern.ch & sarita.sahoo@cern.ch - last modified on 12/06/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 * AddAnalysisTaskLStar
19 (
20    Bool_t      isMC,
21    Bool_t      isPP,
22    Int_t       aodFilterBit = 5,
23    AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutPrCandidate = AliRsnCutSetDaughterParticle::kFastTPCpidNsigma,
24    AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutKaCandidate = AliRsnCutSetDaughterParticle::kFastTPCpidNsigma,
25    Float_t     nsigmaPr = 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    Int_t                  signedPdg = 3124,
38    TString                monitorOpt = "NoSIGN",  //Flag for AddMonitorOutput.C e.g."NoSIGN"
39    Bool_t                 useCrossedRows = kFALSE,
40    AliRsnMiniValue::EType yaxisVar = AliRsnMiniValue::kPt,
41    Bool_t                 useMixLS = 0,
42
43    Int_t       nmix = 5,
44    Float_t     maxDiffVzMix = 1.0,
45    Float_t     maxDiffMultMix = 10.0,
46    TString     outNameSuffix = ""
47 )
48 {  
49   //
50   // -- INITIALIZATION ----------------------------------------------------------------------------
51   // retrieve analysis manager
52   //
53
54   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
55    if (!mgr) {
56       ::Error("AddAnalysisTaskTPCKStarSyst", "No analysis manager to connect to.");
57       return NULL;
58    } 
59
60    // create the task and configure 
61    TString taskName = Form("LStar%s%s_%i%i_%s", (isPP? "pp" : "pPb"), (isMC ? "MC" : "Data"), (Int_t)cutPrCandidate,(Int_t)cutKaCandidate, outNameSuffix.Data() );
62    AliRsnMiniAnalysisTask *task = new AliRsnMiniAnalysisTask(taskName.Data(), isMC);
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("V0A");   
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("AddAnalysisTasLStar", Form("Event mixing configuration: \n events to mix = %i \n max diff. vtxZ = cm %5.3f \n max diff multi = %5.3f \n ", nmix, maxDiffVzMix, maxDiffMultMix));
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    if (isPP) {
94      AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
95      cutVertex->SetCheckPileUp(kTRUE);   // set the check for pileup
96      
97      // define and fill cut set for event cut
98      AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent);
99      eventCuts->AddCut(cutVertex);
100      eventCuts->SetCutScheme(cutVertex->GetName());
101    }
102    else {
103    AliRsnCutEventUtils *cutEventUtils = new AliRsnCutEventUtils("cutEventUtils", kTRUE, kTRUE);
104    cutEventUtils->SetUseVertexSelection2013pA(kTRUE);
105    cutEventUtils->SetMinPlpContribSPD(5);      
106    // define and fill cut set for event cut
107    AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent);
108    eventCuts->AddCut(cutEventUtils);
109    eventCuts->SetCutScheme(cutEventUtils->GetName());
110    }
111
112    // set cuts in task
113    task->SetEventCuts(eventCuts);
114    
115    //
116    // -- EVENT-ONLY COMPUTATIONS -------------------------------------------------------------------
117    //   
118    //vertex
119    Int_t vtxID = task->CreateValue(AliRsnMiniValue::kVz, kFALSE);
120    AliRsnMiniOutput *outVtx = task->CreateOutput("eventVtx", "HIST", "EVENT");
121    outVtx->AddAxis(vtxID, 400, -20.0, 20.0);
122    
123    //multiplicity or centrality
124    Int_t multID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE);
125    AliRsnMiniOutput *outMult = task->CreateOutput("eventMult", "HIST", "EVENT");
126    if (isPP) 
127      outMult->AddAxis(multID, 300, 0.0, 300.0);
128    else
129      outMult->AddAxis(multID, 100, 0.0, 100.0);
130    
131    //
132    // -- PAIR CUTS  -------------------------------------------------------------------------------
133    //
134    AliRsnCutMiniPair *cutY = new AliRsnCutMiniPair("cutRapidity", AliRsnCutMiniPair::kRapidityRange);
135    if(isPP) cutY->SetRangeD(-0.5, 0.5);
136    else     cutY->SetRangeD(-0.465, 0.035);
137
138    AliRsnCutSet *cutsPair = new AliRsnCutSet("pairCuts", AliRsnTarget::kMother);
139    cutsPair->AddCut(cutY);
140    cutsPair->SetCutScheme(cutY->GetName());
141    
142    //
143    // -- CONFIG ANALYSIS --------------------------------------------------------------------------
144
145    
146    //for systematic checks
147      {
148    gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigLStar.C");
149    if (!ConfigLStar(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPrCandidate, cutKaCandidate, nsigmaPr, nsigmaKa, enableSyst, DCAxyFormula, dcazmax, minNcls, maxX2cls, minCrossedRows, maxClsCrossedRows, enableMonitor, isMC&IsMcTrueOnly, signedPdg,monitorOpt,useCrossedRows,yaxisVar ,useMixLS)) 
150 return 0x0;  
151      }
152
153    
154    //
155    // -- CONTAINERS --------------------------------------------------------------------------------
156    //
157    TString outputFileName = AliAnalysisManager::GetCommonFileName();
158    //  outputFileName += ":Rsn";
159    Printf("AddAnalysisTaskTPCKStarSyst - Set OutputFileName : \n %s\n", outputFileName.Data() );
160    
161    AliAnalysisDataContainer *output = mgr->CreateContainer(Form("RsnOut_%s",outNameSuffix.Data()), 
162                                                            TList::Class(), 
163                                                            AliAnalysisManager::kOutputContainer, 
164                                                            outputFileName);
165    mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
166    mgr->ConnectOutput(task, 1, output);
167    
168    return task;
169 }