]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/macros/mini/AddAnalysisTaskTOFKStar.C
Added charge, phi and phi at TPC outer radius variables + added/modified monitoring...
[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    Bool_t      isAOD49 = kFALSE,
34    TString     outNameSuffix = "",
35    Bool_t      useMixLS = 0,
36    Int_t       signedPdg = 313,
37    TString     monitorOpt = ""
38 )
39 {  
40   //
41   // -- INITIALIZATION ----------------------------------------------------------------------------
42   // retrieve analysis manager
43   //
44
45   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
46    if (!mgr) {
47       ::Error("AddAnalysisTaskTOFKStar", "No analysis manager to connect to.");
48       return NULL;
49    } 
50
51    // create the task and configure 
52    TString taskName = Form("TOFKStar%s%s_%i%i", (isPP? "pp" : "PbPb"), (isMC ? "MC" : "Data"), (Int_t)cutPiCandidate,(Int_t)cutKaCandidate );
53    AliRsnMiniAnalysisTask *task = new AliRsnMiniAnalysisTask(taskName.Data(), isMC);
54    if (!isMC && !isPP){
55      Printf(Form("========== SETTING USE CENTRALITY PATCH AOD049 : %s", isAOD49 ? "yes" : "no"));
56      task->SetUseCentralityPatch(isAOD49);
57    }
58    if (isPP) 
59      task->UseMultiplicity("QUALITY");
60    else
61      task->UseCentrality("V0M");   
62    // set event mixing options
63    task->UseContinuousMix();
64    //task->UseBinnedMix();
65    task->SetNMix(nmix);
66    task->SetMaxDiffVz(maxDiffVzMix);
67    task->SetMaxDiffMult(maxDiffMultMix);
68    if (!isPP) task->SetMaxDiffAngle(maxDiffAngleMixDeg*TMath::DegToRad()); //set angle diff in rad
69    ::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)));
70    
71    mgr->AddTask(task);
72    
73    //
74    // -- EVENT CUTS (same for all configs) ---------------------------------------------------------
75    //  
76    // cut on primary vertex:
77    // - 2nd argument --> |Vz| range
78    // - 3rd argument --> minimum required number of contributors
79    // - 4th argument --> tells if TPC stand-alone vertexes must be accepted
80    AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
81    if (isPP) cutVertex->SetCheckPileUp(kTRUE);   // set the check for pileup
82    
83    // define and fill cut set for event cut
84    AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent);
85    eventCuts->AddCut(cutVertex);
86    eventCuts->SetCutScheme(cutVertex->GetName());
87    // set cuts in task
88    task->SetEventCuts(eventCuts);
89    
90    //
91    // -- EVENT-ONLY COMPUTATIONS -------------------------------------------------------------------
92    //   
93    //vertex
94    Int_t vtxID = task->CreateValue(AliRsnMiniValue::kVz, kFALSE);
95    AliRsnMiniOutput *outVtx = task->CreateOutput("eventVtx", "HIST", "EVENT");
96    outVtx->AddAxis(vtxID, 400, -20.0, 20.0);
97    
98    //multiplicity or centrality
99    Int_t multID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE);
100    AliRsnMiniOutput *outMult = task->CreateOutput("eventMult", "HIST", "EVENT");
101    if (isPP) 
102      outMult->AddAxis(multID, 400, 0.0, 400.0);
103    else
104      outMult->AddAxis(multID, 100, 0.0, 100.0);
105    
106    //event plane (only for PbPb)
107    Int_t planeID = task->CreateValue(AliRsnMiniValue::kPlaneAngle, kFALSE);
108    AliRsnMiniOutput *outPlane = 0x0;
109    if (!isPP){
110      outPlane=task->CreateOutput("eventPlane", "HIST", "EVENT");
111      outPlane->AddAxis(planeID, 180, 0.0, TMath::Pi());
112    }
113
114    TH2F* hvz=new TH2F("hVzVsCent","",100,0.,100., 220,-11.,11.);
115    task->SetEventQAHist("vz",hvz);//plugs this histogram into the fHAEventVz data member
116
117    TH2F* hmc=new TH2F("MultiVsCent","",100,0.,100.,4000,0.,4000.);
118    hmc->GetYaxis()->SetTitle("QUALITY");
119    task->SetEventQAHist("multicent",hmc);//plugs this histogram into the fHAEventMultiCent data member
120
121    TH2F* hep=new TH2F("hEventPlaneVsCent","",100,0.,100., 180,0.,TMath::Pi());
122    task->SetEventQAHist("eventplane",hep);//plugs this histogram into the fHAEventPlane data member
123
124    //
125    // -- PAIR CUTS (common to all resonances) ------------------------------------------------------
126    //
127    AliRsnCutMiniPair *cutY = new AliRsnCutMiniPair("cutRapidity", AliRsnCutMiniPair::kRapidityRange);
128    cutY->SetRangeD(-0.5, 0.5);
129    
130    AliRsnCutSet *cutsPair = new AliRsnCutSet("pairCuts", AliRsnTarget::kMother);
131    cutsPair->AddCut(cutY);
132    cutsPair->SetCutScheme(cutY->GetName());
133    
134    //
135    // -- CONFIG ANALYSIS --------------------------------------------------------------------------
136    gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigTOFanalysisKStar.C");
137    if (isMC) {
138      if (((Int_t)cutPiCandidate<4) && ((Int_t)cutKaCandidate<4))
139        Printf("========================== MC analysis - no PID used for efficiency estimation");
140      else 
141        Printf("========================== MC analysis - PID cuts used");
142    } else 
143      Printf("========================== DATA analysis - PID cuts used");
144    if (!ConfigTOFanalysisKStar(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, useMixLS, signedPdg, monitorOpt.Data())) return 0x0;
145    
146    //
147    // -- CONTAINERS --------------------------------------------------------------------------------
148    //
149    TString outputFileName = AliAnalysisManager::GetCommonFileName();
150    //  outputFileName += ":Rsn";
151    Printf("AddAnalysisTaskTOFKStar - Set OutputFileName : \n %s\n", outputFileName.Data() );
152    
153    AliAnalysisDataContainer *output = mgr->CreateContainer(Form("RsnOut_%s",outNameSuffix.Data()), 
154                                                            TList::Class(), 
155                                                            AliAnalysisManager::kOutputContainer, 
156                                                            outputFileName);
157    mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
158    mgr->ConnectOutput(task, 1, output);
159    
160    return task;
161 }