]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/macros/AddTaskEmcalDiJetAna.C
DiJet analysis updates (Marta)
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskEmcalDiJetAna.C
1 Double_t fitf(Double_t *x, Double_t *par) {
2   //5 parameters, 0: transition from f0 to f2, 1: pol0, 2-4: pol2
3   Double_t trans = par[0];
4
5   TF1 *f0 = new TF1("f0","pol0",0,trans);
6   TF1 *f2 = new TF1("f2","pol2",trans,100);
7
8   Double_t fitval = 0.;
9   if(x[0]<par[0]) 
10     fitval = par[1];
11   else
12     fitval = par[2]+x[0]*par[3]+x[0]*x[0]*par[4];
13
14   return fitval;
15
16 }
17
18 AliAnalysisTaskEmcalDiJetAna* AddTaskEmcalDiJetAna(TString     kTracksName         = "PicoTracks", 
19                                                    TString     kClusName           = "caloClusterCorr",
20                                                    Double_t    R                   = 0.4, 
21                                                    Double_t    ptminTrack          = 0.15, 
22                                                    Double_t    etminClus           = 0.3, 
23                                                    Int_t       rhoType             = 0,
24                                                    TString     trigClass           = "",
25                                                    const char *CentEst             = "V0A",
26                                                    Int_t       pSel                = AliVEvent::kINT7,
27                                                    Int_t       matchFullCh         = AliAnalysisTaskEmcalDiJetBase::kNoMatching,
28                                                    Double_t    ptTrackBias         = 0.
29                                                    ) {
30   
31   enum AlgoType {kKT, kANTIKT};
32   enum JetType  {kFULLJETS, kCHARGEDJETS, kNEUTRALJETS};
33
34   // #### Define manager and data container names
35   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
36   if (!mgr) {
37     ::Error("AddTaskEmcalDiJet", "No analysis manager to connect to.");
38     return NULL;
39   }
40
41   // Check the analysis type using the event handlers connected to the analysis manager.
42   //==============================================================================
43   if (!mgr->GetInputEventHandler())
44     {
45       ::Error("AddTaskEmcalDiJet", "This task requires an input event handler");
46       return NULL;
47     }
48
49   // #### Add necessary jet finder tasks
50   gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskEmcalJet.C");
51
52   AliEmcalJetTask* jetFinderTaskFull    = AddTaskEmcalJet(kTracksName, kClusName, kANTIKT, R, kFULLJETS, ptminTrack, etminClus);
53   AliEmcalJetTask* jetFinderTaskCharged = AddTaskEmcalJet(kTracksName, kClusName, kANTIKT, R, kCHARGEDJETS, ptminTrack, etminClus);
54
55   TString strJetsFull = jetFinderTaskFull->GetName();
56   TString strJetsCh   = jetFinderTaskCharged->GetName();
57
58   // Add kt jet finder and rho task in case we want background subtraction
59   gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskRhoSparse.C");
60   AliEmcalJetTask *jetFinderKt;
61   AliEmcalJetTask *jetFinderAKt;
62   AliAnalysisTaskRhoSparse *rhoTask;
63   if(rhoType==1) {
64     jetFinderKt   = AddTaskEmcalJet(kTracksName, kClusName, kKT, R, kCHARGEDJETS, ptminTrack, etminClus);
65     jetFinderKt->SetMinJetPt(0.);
66     jetFinderAKt  = AddTaskEmcalJet(kTracksName, kClusName, kANTIKT, R, kCHARGEDJETS, ptminTrack, etminClus);
67     
68     TF1 *fScale = new TF1("fScale","1.42",0.,100.);
69     /*
70     TF1 *fScale = new TF1("fit",fitf,0,100,5);
71     fScale->SetParameters(60.,1.41363e+00,7.95329e-01,1.95281e-02,-1.55196e-04);
72     */
73     rhoTask = AddTaskRhoSparse(
74                                jetFinderKt->GetName(),
75                                jetFinderAKt->GetName(),
76                                kTracksName,
77                                kClusName,
78                                Form("RhoSparseR%03d",(int)(100*R)),
79                                R,
80                                AliAnalysisTaskEmcal::kTPC,
81                                0.01,
82                                0.15,
83                                0,
84                                fScale,
85                                0,
86                                kTRUE,
87                                Form("RhoSparseR%03d",(int)(100*R)),
88                                kTRUE
89                                );
90     rhoTask->SetCentralityEstimator(CentEst);
91  
92   }
93
94   TString wagonName = Form("DiJet_%s_%s_Rho%dTC%sMatch%dHadTrig%d",strJetsFull.Data(),strJetsCh.Data(),rhoType,trigClass.Data(),matchFullCh,(Int_t)(ptTrackBias));
95
96   //Configure DiJet task
97   AliAnalysisTaskEmcalDiJetAna *taskDiJet = NULL;
98   taskDiJet = new AliAnalysisTaskEmcalDiJetAna(wagonName.Data());
99  
100   Printf("strJetsFull: %s",strJetsFull.Data());
101   Printf("strJetsCh: %s",strJetsCh.Data());
102
103   taskDiJet->AddParticleContainer(kTracksName.Data());
104   taskDiJet->AddClusterContainer(kClusName.Data());
105    
106   taskDiJet->SetAnaType(AliAnalysisTaskEmcal::kEMCAL);
107
108   taskDiJet->SetContainerFull(0);
109   taskDiJet->SetContainerCharged(1);
110   taskDiJet->AddJetContainer(strJetsFull.Data(),"EMCAL",R);
111   taskDiJet->AddJetContainer(strJetsCh.Data(),"TPC",R);
112
113   for(Int_t i=0; i<2; i++) {
114     taskDiJet->SetPercAreaCut(0.557, i);
115     taskDiJet->SetPtBiasJetTrack(ptTrackBias,i);
116   }
117
118   taskDiJet->SetRhoType(rhoType);
119   if(rhoType==1) {
120     taskDiJet->SetRhoName(rhoTask->GetRhoScaledName(),0);
121     taskDiJet->SetRhoName(rhoTask->GetRhoName(),1);
122   }
123
124   taskDiJet->SetCentralityEstimator(CentEst);
125
126   taskDiJet->SelectCollisionCandidates(pSel);
127
128   taskDiJet->SetFullChargedMatchingType(matchFullCh);
129
130   taskDiJet->SetDoChargedCharged(kTRUE);
131   taskDiJet->SetDoFullCharged(kTRUE);
132   taskDiJet->SetMatchFullCharged(kTRUE);
133
134
135   mgr->AddTask(taskDiJet);
136
137   //Connnect input
138   mgr->ConnectInput (taskDiJet, 0, mgr->GetCommonInputContainer() );
139
140   //Connect output
141   AliAnalysisDataContainer *coutput1 = 0x0;
142
143   TString containerName1 = Form("%s",wagonName.Data());
144
145   TString outputfile = Form("%s:%s",AliAnalysisManager::GetCommonFileName(),wagonName.Data());
146
147   coutput1 = mgr->CreateContainer(containerName1, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile);
148
149   mgr->ConnectOutput(taskDiJet,1,coutput1);
150   
151   return taskDiJet;
152 }