]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/macros/AddTaskJetV2.C
typo fix in addtask and minor update for dphi dpt fits
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskJetV2.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 AliAnalysisTaskJetV2* AddTaskJetV2(
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           = "AliAnalysisTaskJetV2",
21   UInt_t     runMode            = AliAnalysisTaskJetV2::kGrid,
22   Bool_t     fillQA             = kTRUE,
23   TString    fitOpts            = "WLQI",
24   UInt_t     fitType            = AliAnalysisTaskJetV2::kFourierSeries,
25   TArrayD    *centralities      = 0x0,
26   TRandom3   *randomizer        = 0x0,
27   Double_t   trackptcut         = .15,
28   Bool_t     LHC10h             = kFALSE
29   )
30 {  
31   // Get the pointer to the existing analysis manager via the static access method.
32   //==============================================================================
33   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
34   if (!mgr)
35   {
36     ::Error("AddTaskEmcalJetSample", "No analysis manager to connect to.");
37     return NULL;
38   }  
39   
40   // Check the analysis type using the event handlers connected to the analysis manager.
41   //==============================================================================
42   if (!mgr->GetInputEventHandler())
43   {
44     ::Error("AddTaskEmcalJetSample", "This task requires an input event handler");
45     return NULL;
46   }
47   
48   //-------------------------------------------------------
49   // Init the task and do settings
50   //-------------------------------------------------------
51
52   TString name(taskname);
53   if (strcmp(njets,"")) {
54     name += "_";
55     name += njets;
56   }
57   if (strcmp(nrho,"")) {
58     name += "_";
59     name += nrho;
60   }
61   if (!strcmp(type, "TPC"))
62     name += "_TPC";
63   else if (!strcmp(type, "EMCAL"))
64     name += "_EMCAL";
65   else if (!strcmp(type, "USER")) 
66     name += "_USER";
67
68   // create instance of the object
69   AliAnalysisTaskJetV2* jetTask = new AliAnalysisTaskJetV2(name, runMode);
70   
71   // create and connect data containers
72   AliParticleContainer* partCont = jetTask->AddParticleContainer(ntracks);
73   if(partCont) {
74       partCont->SetName("Tracks");
75       partCont->SetParticlePtCut(trackptcut);
76   }
77   TString tmp(nclusters);
78   AliClusterContainer* clusterCont = 0x0;
79   if(!tmp.IsNull()) {
80       clusterCont = jetTask->AddClusterContainer(nclusters);
81       jetTask->SetAnalysisType(AliAnalysisTaskJetV2::kFull);
82   }
83   AliJetContainer* jetCont = jetTask->AddJetContainer(njets, type, jetradius);
84   if(jetCont) {
85       jetCont->SetName("Jets");
86       jetCont->SetPercAreaCut(jetareacut);
87       jetCont->SetRhoName(nrho);
88       if(partCont)      jetCont->ConnectParticleContainer(partCont);
89       if(clusterCont)   jetCont->ConnectClusterContainer(clusterCont);
90   }
91
92   // task specific setters
93   jetTask->SetFillQAHistograms(fillQA);
94   jetTask->SetDebugMode(-1);
95   jetTask->SetModulationFitType(fitType);
96   jetTask->SetModulationFitOptions(fitOpts);
97   jetTask->SetModulationFitMinMaxP(.01, 1);
98   // if centralities haven't been specified use defaults
99   if(!centralities) {
100      Double_t c[] = {0., 10., 30., 50., 70., 90.};
101      jetTask->SetCentralityClasses(new TArrayD(sizeof(c)/sizeof(c[0]), c));
102   }
103   // if a randomized hasn't specified use a safe default 
104   if(!randomizer) jetTask->SetRandomSeed(new TRandom3(0));
105
106   // 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
107   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 */};
108
109   Int_t totalRuns10h[] = {139510, 139507, 139505, 139503, 139465, 139438, 139437, 139360, 139329, 139328, 139314, 139310, 139309, 139173, 139107, 139105, 139038, 139037, 139036, 139029, 139028, 138872, 138871, 138870, 138837, 138732, 138730, 138666, 138662, 138653, 138652, 138638, 138624, 138621, 138583, 138582, 138579, 138578, 138534, 138469, 138442, 138439, 138438, 138396, 138364, 138275, 138225, 138201, 138197, 138192, 138190, 137848, 137844, 137752, 137751, 137724, 137722, 137718, 137704, 137693, 137692, 137691, 137686, 137685, 137639, 137638, 137608, 137595, 137549, 137544, 137541, 137539, 137443, 137441, 137440, 137439, 137434, 137432, 137431, 137430, 137366, 137243, 137236, 137235, 137232, 137231, 137230, 137162, 137161, 137135};
110
111   // set the runnumbers for either 10h or 11h
112   (LHC10h) ? jetTask->SetExpectedRuns(new TArrayI(sizeof(totalRuns10h)/sizeof(totalRuns10h[0]), totalRuns10h)) : jetTask->SetExpectedRuns(new TArrayI(sizeof(totalRuns)/sizeof(totalRuns[0]), totalRuns));
113
114   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};
115
116   // set the semi-good runnumbers for 10h or 11h (10h has no semi-good numbers, so pass a NULL pointer)
117   (LHC10h) ? jetTask->SetExpectedSemiGoodRuns(0x0) : jetTask->SetExpectedSemiGoodRuns(new TArrayI(sizeof(semiGoodRuns)/sizeof(semiGoodRuns[0]), semiGoodRuns));
118
119   // and if 10h, pass this info to the task so acceptance isn't changed
120   if(LHC10h) jetTask->SetCollisionType(AliAnalysisTaskJetV2::kPbPb10h);
121
122   //-------------------------------------------------------
123   // Final settings, pass to manager and set the containers
124   //-------------------------------------------------------
125   
126   mgr->AddTask(jetTask);
127   
128   // Create containers for input/output
129   AliAnalysisDataContainer *cinput1  = mgr->GetCommonInputContainer()  ;
130   TString contname(name);
131   contname+="_PWGJE";
132   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(), 
133                                                             TList::Class(),AliAnalysisManager::kOutputContainer,
134                                                             Form("%s", AliAnalysisManager::GetCommonFileName()));
135   mgr->ConnectInput  (jetTask, 0,  cinput1 );
136   mgr->ConnectOutput (jetTask, 1, coutput1 );
137
138   switch (runMode) {
139       case AliAnalysisTaskJetV2::kLocal : {
140           gStyle->SetOptFit(1);
141           AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(Form("good_fits_%s", name.Data()), 
142                                                             TList::Class(),AliAnalysisManager::kOutputContainer,
143                                                             Form("%s", AliAnalysisManager::GetCommonFileName()));
144           AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(Form("bad_fits_%s", name.Data()),
145                                                             TList::Class(),AliAnalysisManager::kOutputContainer,
146                                                              Form("%s", AliAnalysisManager::GetCommonFileName()));
147           mgr->ConnectOutput (jetTask, 2, coutput2);
148           mgr->ConnectOutput (jetTask, 3, coutput3);
149       } break;
150       default: break;
151   }
152   return jetTask;
153 }