]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/macros/AddTaskJetResponseMaker.C
Added basic locking for the analysis manager session and data handlers to protect...
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskJetResponseMaker.C
CommitLineData
5193b38c 1// $Id$
2
3AliJetResponseMaker* AddTaskJetResponseMaker(
5193b38c 4 const char *ntracks = "Tracks",
5 const char *nclusters = "CaloClusters",
6 const char *njets = "Jets",
7 const char *nmcjets = "MCJets",
8 const char *nmctracks = "MCParticles",
9 Double_t jetradius = 0.4,
10 Double_t jetptcut = 1,
ceefbfbc 11 Double_t jetareacut = 0.8,
5193b38c 12 Double_t ptcut = 0.15,
13 Double_t jetBiasTrack = 10,
14 Double_t jetBiasClus = 10,
2bddb6ae 15 Double_t maxDistance = 0.25,
4643d2e8 16 UInt_t type = AliAnalysisTaskEmcal::kTPC,
17 Int_t ptHardBin = -999,
18 const char *taskname = "AliJetResponseMaker"
5193b38c 19)
20{
21 // Get the pointer to the existing analysis manager via the static access method.
22 //==============================================================================
23 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
24 if (!mgr)
25 {
26 ::Error("AddTaskJetResponseMaker", "No analysis manager to connect to.");
27 return NULL;
28 }
29
30 // Check the analysis type using the event handlers connected to the analysis manager.
31 //==============================================================================
32 if (!mgr->GetInputEventHandler())
33 {
34 ::Error("AddTaskJetResponseMaker", "This task requires an input event handler");
35 return NULL;
36 }
37
38 //-------------------------------------------------------
39 // Init the task and do settings
40 //-------------------------------------------------------
41
4643d2e8 42 TString name(taskname);
43 name += "_";
44 name += njets;
45 name += "_Track";
46 name += jetBiasTrack;
47 name += "_Clus";
48 name += jetBiasClus;
49 name += "_R0";
50 name += floor(jetradius*10+0.5);
51 name += "_PtCut";
52 name += floor(ptcut*1000+0.5);
53 name += "_";
54 if (type == AliAnalysisTaskEmcal::kTPC)
55 name += "TPC";
56 else if (type == AliAnalysisTaskEmcal::kEMCAL)
57 name += "EMCAL";
58 else if (type == AliAnalysisTaskEmcal::kTPCSmall)
59 name += "TPCSmall";
60 else if (type == AliAnalysisTaskEmcal::kEMCALOnly)
61 name += "EMCALOnly";
62 if (ptHardBin != -999) {
63 name += "_PtHard";
64 name += ptHardBin;
65 }
66
67 AliJetResponseMaker* jetTask = new AliJetResponseMaker(name);
5193b38c 68 jetTask->SetAnaType(type);
69 jetTask->SetTracksName(ntracks);
70 jetTask->SetClusName(nclusters);
71 jetTask->SetJetsName(njets);
72 jetTask->SetMCJetsName(nmcjets);
73 jetTask->SetMCTracksName(nmctracks);
74 jetTask->SetPtCut(ptcut);
75 jetTask->SetJetRadius(jetradius);
76 jetTask->SetJetPtCut(jetptcut);
ceefbfbc 77 jetTask->SetPercAreaCut(jetareacut);
5193b38c 78 jetTask->SetPtBiasJetTrack(jetBiasTrack);
79 jetTask->SetPtBiasJetClus(jetBiasClus);
2bddb6ae 80 jetTask->SetMaxDistance(maxDistance);
4643d2e8 81 jetTask->SetVzRange(-10,10);
82 jetTask->SetPtHardBin(ptHardBin);
5193b38c 83
84 //-------------------------------------------------------
85 // Final settings, pass to manager and set the containers
86 //-------------------------------------------------------
87
88 mgr->AddTask(jetTask);
89
90 // Create containers for input/output
91 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ;
4643d2e8 92 TString contname(name);
5193b38c 93 contname += "_histos";
94 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(),
95 TList::Class(),AliAnalysisManager::kOutputContainer,
96 Form("%s", AliAnalysisManager::GetCommonFileName()));
97 mgr->ConnectInput (jetTask, 0, cinput1 );
98 mgr->ConnectOutput (jetTask, 1, coutput1 );
99
100 return jetTask;
101}