]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/macros/AddTaskLocalRhoDev.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskLocalRhoDev.C
1 /*
2  * AddTask macro for class 
3  * Redmer Alexander Bertens, rbertens@cern.ch
4  * Utrecht University, Utrecht, Netherlands
5  */
6
7 AliAnalysisTaskLocalRhoDev* AddTaskLocalRhoDev(
8   const char *ntracks           = "Tracks",     // track selection used for vn estimate
9   const char *nclusters         = "",           // clusters (not used) 
10   const char *njets             = "Jets",       // jet selection for finding leading jet
11   const char *nrho              = "Rho",        // name of nominal rho
12   const char *lrho              = "LocalRho",   // name of local rho object
13   Double_t   jetradius          = 0.3,          // jet radius (to remove leading jet)
14   Double_t   jetptcut           = 1,            
15   Double_t   jetareacut         = 0.557,
16   const char* type              = "TPC",
17   Int_t      leadhadtype        = 0,
18   const char *name              = "AliAnalysisTaskLocalRhoDev",    // task name
19   TString    fitOpts            = "WLQI",                       // options for tfitter
20   UInt_t     fitType            = AliAnalysisTaskLocalRhoDev::kCombined,   // fitting strategy
21   TArrayI    *centralities      = 0x0,                                  // centrality binning for qa
22   UInt_t     runMode            = AliAnalysisTaskLocalRhoDev::kGrid        // run mode 
23   )
24 {  
25   // Get the pointer to the existing analysis manager via the static access method.
26   //==============================================================================
27   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
28   if (!mgr)
29   {
30     ::Error("AddTaskEmcalJetSample", "No analysis manager to connect to.");
31     return NULL;
32   }  
33   
34   // Check the analysis type using the event handlers connected to the analysis manager.
35   //==============================================================================
36   if (!mgr->GetInputEventHandler())
37   {
38     ::Error("AddTaskEmcalJetSample", "This task requires an input event handler");
39     return NULL;
40   }
41   
42   //-------------------------------------------------------
43   // Init the task and do settings
44   //-------------------------------------------------------
45
46   AliAnalysisTaskLocalRhoDev* jetTask = new AliAnalysisTaskLocalRhoDev(name, runMode);
47   // inherited setters
48   AliParticleContainer* partCont = jetTask->AddParticleContainer(ntracks);
49   if(partCont) {
50       partCont->SetName("Tracks");
51       partCont->SetParticlePtCut(.15);
52   }
53   AliJetContainer* jetCont = jetTask->AddJetContainer(njets, type, jetradius);
54   if(jetCont) {
55       jetCont->SetName("Jets");
56       jetCont->SetPercAreaCut(jetareacut);
57       jetCont->SetRhoName(nrho);
58       jetCont->ConnectParticleContainer(partCont);
59   }
60   // task specific setters
61   jetTask->SetDebugMode(-1);
62   jetTask->SetModulationFitType(fitType);
63   jetTask->SetModulationFitOptions(fitOpts);
64   jetTask->SetModulationFitMinMaxP(.01, 1);
65   // if centralities haven't been specified use defaults
66   if(!centralities) {
67      Double_t c[] = {0., 10., 30., 50., 70., 90.};
68      jetTask->SetCentralityClasses(new TArrayD(sizeof(c)/sizeof(c[0]), c));
69   }
70   // 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
71   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 */};
72   jetTask->SetExpectedRuns(new TArrayI(sizeof(totalRuns)/sizeof(totalRuns[0]), totalRuns));
73
74   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};
75   jetTask->SetExpectedSemiGoodRuns(new TArrayI(sizeof(semiGoodRuns)/sizeof(semiGoodRuns[0]), semiGoodRuns));
76
77
78   //-------------------------------------------------------
79   // Final settings, pass to manager and set the containers
80   //-------------------------------------------------------
81   
82   mgr->AddTask(jetTask);
83   
84   // Create containers for input/output
85   AliAnalysisDataContainer *cinput1  = mgr->GetCommonInputContainer()  ;
86   TString contname(name);
87   contname += "_histos";
88   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(), 
89                                                             TList::Class(),AliAnalysisManager::kOutputContainer,
90                                                             Form("%s", AliAnalysisManager::GetCommonFileName()));
91   mgr->ConnectInput  (jetTask, 0,  cinput1 );
92   mgr->ConnectOutput (jetTask, 1, coutput1 );
93
94   switch (runMode) {
95       case AliAnalysisTaskLocalRhoDev::kLocal : {
96           gStyle->SetOptFit(1);
97           AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(Form("good_fits_%s", name), 
98                                                             TList::Class(),AliAnalysisManager::kOutputContainer,
99                                                             Form("%s", AliAnalysisManager::GetCommonFileName()));
100           AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(Form("bad_fits_%s", name),
101                                                             TList::Class(),AliAnalysisManager::kOutputContainer,
102                                                              Form("%s", AliAnalysisManager::GetCommonFileName()));
103           mgr->ConnectOutput (jetTask, 2, coutput2);
104           mgr->ConnectOutput (jetTask, 3, coutput3);
105       } break;
106       default: break;
107   }
108   return jetTask;
109 }
110
111 AliAnalysisTaskLocalRhoDev* AddTaskLocalRhoDev(
112   const char *ntracks           = "Tracks",     // track selection used for vn estimate
113   const char *nclusters         = "",           // clusters (not used) 
114   const char *njets             = "Jets",       // jet selection for finding leading jet
115   const char *nrho              = "Rho",        // name of nominal rho
116   const char *lrho              = "LocalRho",   // name of local rho object
117   Double_t   jetradius          = 0.3,          // jet radius (to remove leading jet)
118   Double_t   jetptcut           = 1,            
119   Double_t   jetareacut         = 0.557,
120   const Int_t type              = 0,
121   Int_t      leadhadtype        = 0,
122   const char *name              = "AliAnalysisTaskLocalRhoDev",    // task name
123   TString    fitOpts            = "WLQI",                       // options for tfitter
124   UInt_t     fitType            = AliAnalysisTaskLocalRhoDev::kCombined,   // fitting strategy
125   TArrayI    *centralities      = 0x0,                                  // centrality binning for qa
126   UInt_t     runMode            = AliAnalysisTaskLocalRhoDev::kGrid        // run mode 
127   )
128 {
129   // overloaded addtask for backward compatibility
130   UInt_t jetType = 0;
131   jetType |= AliEmcalJetTask::kAKT;
132
133   if (type==0)
134     jetType |= AliEmcalJetTask::kFullJet; 
135   else if (type==1) 
136     jetType |= AliEmcalJetTask::kChargedJet; 
137   else if (type==2) 
138     jetType |= AliEmcalJetTask::kNeutralJet;
139
140   if (jetradius==0.2) 
141     jetType |= AliEmcalJetTask::kR020Jet; 
142   else if (jetradius==0.3) 
143     jetType |= AliEmcalJetTask::kR030Jet;
144   else if (jetradius==0.4) 
145     jetType |= AliEmcalJetTask::kR040Jet;
146   else
147     jetType |= AliEmcalJetTask::kRX1Jet;
148
149   return AddTaskLocalRhoDev(ntracks, nclusters, njets, nrho, lrho, jetradius, jetptcut, jetareacut, jetType, leadhadtype, name, fitOpts, fitType, centralities, runMode);
150 }