]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/macros/AddTaskRhoVnModulation.C
making script executable
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskRhoVnModulation.C
1 /*
2  * AddTask macro for class 
3  * Redmer Alexander Bertens, rbertens@cern.ch
4  * Utrecht University, Utrecht, Netherlands
5  *
6  * Note: this macro is pretty much a copy of AddTaskEmcalJetSample.C
7  *
8  */
9
10 AliAnalysisTaskRhoVnModulation* AddTaskRhoVnModulation(
11   const char *ntracks            = "Tracks",
12   const char *nclusters          = "",
13   const char *njets              = "Jets",
14   const char *nrho               = "Rho",
15   Double_t   jetradius          = 0.2,
16   Double_t   jetptcut           = 1,
17   Double_t   jetareacut         = 0.557,
18   const char* type              = "TPC",
19   Int_t      leadhadtype        = 0,
20   const char *taskname           = "AliAnalysisTaskRhoVnModulation",
21   UInt_t     runMode            = AliAnalysisTaskRhoVnModulation::kGrid,
22   Bool_t     fillQA             = kTRUE,
23   TString    fitOpts            = "WLQI",
24   UInt_t     fitType            = AliAnalysisTaskRhoVnModulation::kFourierSeries,
25   TArrayD    *centralities      = 0x0,
26   TRandom3   *randomizer        = 0x0,
27   Double_t   trackptcut         = .15
28   )
29 {  
30   // Get the pointer to the existing analysis manager via the static access method.
31   //==============================================================================
32   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
33   if (!mgr)
34   {
35     ::Error("AddTaskEmcalJetSample", "No analysis manager to connect to.");
36     return NULL;
37   }  
38   
39   // Check the analysis type using the event handlers connected to the analysis manager.
40   //==============================================================================
41   if (!mgr->GetInputEventHandler())
42   {
43     ::Error("AddTaskEmcalJetSample", "This task requires an input event handler");
44     return NULL;
45   }
46   
47   //-------------------------------------------------------
48   // Init the task and do settings
49   //-------------------------------------------------------
50
51   TString name(taskname);
52   if (strcmp(njets,"")) {
53     name += "_";
54     name += njets;
55   }
56   if (strcmp(nrho,"")) {
57     name += "_";
58     name += nrho;
59   }
60   if (!strcmp(type, "TPC"))
61     name += "_TPC";
62   else if (!strcmp(type, "EMCAL"))
63     name += "_EMCAL";
64   else if (!strcmp(type, "USER")) 
65     name += "_USER";
66
67   AliAnalysisTaskRhoVnModulation* jetTask = new AliAnalysisTaskRhoVnModulation(name, runMode);
68   // inherited setters
69   AliParticleContainer* partCont = jetTask->AddParticleContainer(ntracks);
70   if(partCont) {
71       partCont->SetName("Tracks");
72       partCont->SetParticlePtCut(trackptcut);
73   }
74   AliJetContainer* jetCont = jetTask->AddJetContainer(njets, type, jetradius);
75   if(jetCont) {
76       jetCont->SetName("Jets");
77       jetCont->SetPercAreaCut(jetareacut);
78       jetCont->SetRhoName(nrho);
79       jetCont->ConnectParticleContainer(partCont);
80   }
81   // task specific setters
82   jetTask->SetFillQAHistograms(fillQA);
83   jetTask->SetDebugMode(-1);
84   jetTask->SetModulationFitType(fitType);
85   jetTask->SetModulationFitOptions(fitOpts);
86   jetTask->SetModulationFitMinMaxP(.01, 1);
87   jetTask->SetRandomConeRadius(jetradius);
88   // if centralities haven't been specified use defaults
89   if(!centralities) {
90      Double_t c[] = {0., 10., 30., 50., 70., 90.};
91      jetTask->SetCentralityClasses(new TArrayD(sizeof(c)/sizeof(c[0]), c));
92   }
93   // if a randomized hasn't specified use a safe default 
94   if(!randomizer) jetTask->SetRandomSeed(new TRandom3(0));
95
96
97   // pass the expected run lists to the task. the total list is used for QA plots which are stored per run-number, the semi-good list is used to change the phi acceptance of jets and pico trakcs, and - if an alternatie is provided - switch to a 'small rho' task, which also runs on limited acceptance
98   Int_t totalRuns[] = {167813, 167988, 168066, 168068, 168069, 168076, 168104, 168212, 168311, 168322, 168325, 168341, 168361, 168362, 168458, 168460, 168461, 168992, 169091, 169094, 169138, 169143, 169167, 169417, 169835, 169837, 169838, 169846, 169855, 169858, 169859, 169923, 169956, 170027, 170036, 170081, /* up till here original good TPC list */169975, 169981, 170038, 170040, 170083, 170084, 170085, 170088, 170089, 170091, 170152, 170155, 170159, 170163, 170193, 170195, 170203, 170204, 170205, 170228, 170230, 170264, 170268, 170269, 170270, 170306, 170308, 170309, /* original semi-good tpc list */169415, 169411, 169035, 168988, 168984, 168826, 168777, 168512, 168511, 168467, 168464, 168342, 168310, 168115, 168108, 168107, 167987, 167915, 167903, /*new runs, good according to RCT */ 169238, 169160, 169156, 169148, 169145, 169144 /* run swith missing OROC 8 but seem ok in QA */};
99   jetTask->SetExpectedRuns(new TArrayI(sizeof(totalRuns)/sizeof(totalRuns[0]), totalRuns));
100
101   Int_t semiGoodRuns[] = {169975, 169981, 170038, 170040, 170083, 170084, 170085, 170088, 170089, 170091, 170152, 170155, 170159, 170163, 170193, 170195, 170203, 170204, 170205, 170228, 170230, 170264, 170268, 170269, 170270, 170306, 170308, 170309};
102   jetTask->SetExpectedSemiGoodRuns(new TArrayI(sizeof(semiGoodRuns)/sizeof(semiGoodRuns[0]), semiGoodRuns));
103
104   //-------------------------------------------------------
105   // Final settings, pass to manager and set the containers
106   //-------------------------------------------------------
107   
108   mgr->AddTask(jetTask);
109   
110   // Create containers for input/output
111   AliAnalysisDataContainer *cinput1  = mgr->GetCommonInputContainer()  ;
112   TString contname(name);
113   contname+="_PWGJE";
114   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(), 
115                                                             TList::Class(),AliAnalysisManager::kOutputContainer,
116                                                             Form("%s", AliAnalysisManager::GetCommonFileName()));
117   mgr->ConnectInput  (jetTask, 0,  cinput1 );
118   mgr->ConnectOutput (jetTask, 1, coutput1 );
119
120   switch (runMode) {
121       case AliAnalysisTaskRhoVnModulation::kLocal : {
122           gStyle->SetOptFit(1);
123           AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(Form("good_fits_%s", name.Data()), 
124                                                             TList::Class(),AliAnalysisManager::kOutputContainer,
125                                                             Form("%s", AliAnalysisManager::GetCommonFileName()));
126           AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(Form("bad_fits_%s", name.Data()),
127                                                             TList::Class(),AliAnalysisManager::kOutputContainer,
128                                                              Form("%s", AliAnalysisManager::GetCommonFileName()));
129           mgr->ConnectOutput (jetTask, 2, coutput2);
130           mgr->ConnectOutput (jetTask, 3, coutput3);
131       } break;
132       default: break;
133   }
134   return jetTask;
135 }