]>
Commit | Line | Data |
---|---|---|
f2b45b50 | 1 | // $Id$ |
2 | ||
be085784 | 3 | AliEmcalTriggerMaker* AddTaskEmcalTriggerMakerJSON(const char *configurationString) |
f2b45b50 | 4 | { |
5 | // Get the pointer to the existing analysis manager via the static access method. | |
6 | //============================================================================== | |
7 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
8 | if (!mgr) | |
9 | { | |
10 | ::Error("AddTaskEmcalTriggerMaker", "No analysis manager to connect to."); | |
11 | return NULL; | |
12 | } | |
13 | ||
14 | // Check the analysis type using the event handlers connected to the analysis manager. | |
15 | //============================================================================== | |
16 | AliVEventHandler *evhand = mgr->GetInputEventHandler(); | |
17 | if (!evhand) { | |
18 | ::Error("AddTaskEmcalTriggerMaker", "This task requires an input event handler"); | |
19 | return NULL; | |
20 | } | |
21 | ||
22 | // Handle wagon configuration | |
be085784 | 23 | // Definition of possible parameters |
f2b45b50 | 24 | AliEMCALConfiguration defaultConfiguration("triggerMakerDefault"); |
be085784 | 25 | defaultConfiguration.AddParam("triggersOutName", new AliJSONString("EmcalTriggers")); |
26 | defaultConfiguration.AddParam("triggerSetupOutName", new AliJSONString("EmcalTriggerSetup")); | |
27 | defaultConfiguration.AddParam("cellsName", new AliJSONString("")); | |
28 | defaultConfiguration.AddParam("triggersName", new AliJSONString("")); | |
29 | defaultConfiguration.AddParam("taskName", new AliJSONString("AliEmcalTriggerMaker")); | |
30 | defaultConfiguration.AddParam("jetLowA", new AliJSONInt(0)); | |
31 | defaultConfiguration.AddParam("jetLowB", new AliJSONInt(0)); | |
32 | defaultConfiguration.AddParam("jetLowC", new AliJSONInt(0)); | |
33 | defaultConfiguration.AddParam("jetHighA", new AliJSONInt(0)); | |
34 | defaultConfiguration.AddParam("jetHighB", new AliJSONInt(0)); | |
35 | defaultConfiguration.AddParam("jetHighC", new AliJSONInt(0)); | |
36 | defaultConfiguration.AddParam("doQA", new AliJSONBool(kFALSE)); | |
f2b45b50 | 37 | AliEMCALConfiguration userConfiguration("userConfig"); |
1c18d6ca | 38 | userConfiguration.Build(configurationString); |
39 | AliEMCALConfigurationMatcher combinedConfiguration(&userConfiguration, &defaultConfiguration); | |
f2b45b50 | 40 | |
1c18d6ca | 41 | defaultConfiguration.Print(); |
42 | userConfiguration.Print(); | |
f2b45b50 | 43 | |
1c18d6ca | 44 | TString strTriggersName = (static_cast<AliJSONString *>(combinedConfiguration.GetValue("triggersName")))->GetValue(), |
45 | strCellsName = (static_cast<AliJSONString *>(combinedConfiguration.GetValue("cellsName")))->GetValue(); | |
46 | ||
47 | if(!strTriggersName.Length()) { | |
f2b45b50 | 48 | if (evhand->InheritsFrom("AliESDInputHandler")) { |
49 | strTriggersName = "EMCALTrigger"; | |
1c18d6ca | 50 | ::Info("AddTaskEmcalTriggerMaker", Form( "ESD analysis, triggersName = \"%s\"", strTriggersName.Data() )); |
f2b45b50 | 51 | } |
52 | else { | |
53 | strTriggersName = "emcalTrigger"; | |
1c18d6ca | 54 | ::Info("AddTaskEmcalTriggerMaker", Form( "AOD analysis, triggersName = \"%s\"", strTriggersName.Data() )); |
f2b45b50 | 55 | } |
56 | } | |
57 | ||
1c18d6ca | 58 | if(!strCellsName.Length()) { |
f2b45b50 | 59 | if (evhand->InheritsFrom("AliESDInputHandler")) { |
60 | strCellsName = "EMCALCells"; | |
1c18d6ca | 61 | ::Info("AddTaskEmcalTriggerMaker", Form( "ESD analysis, cellsName = \"%s\"", strCellsName.Data() )); |
f2b45b50 | 62 | } |
63 | else { | |
64 | strCellsName = "emcalCells"; | |
1c18d6ca | 65 | ::Info("AddTaskEmcalTriggerMaker", Form( "AOD analysis, cellsName = \"%s\"", strCellsName.Data() )); |
f2b45b50 | 66 | } |
67 | } | |
68 | ||
69 | char *v0Name; | |
70 | v0Name = new char[100]; | |
71 | if (evhand->InheritsFrom("AliESDInputHandler")) { | |
72 | strcpy(v0Name,"AliESDVZERO"); | |
73 | ::Info("AddTaskEmcalTriggerMaker", Form( "ESD analysis, v0Name = \"%s\"", v0Name )); | |
74 | } | |
75 | else { | |
76 | strcpy(v0Name,"AliAODVZERO"); | |
77 | ::Info("AddTaskEmcalTriggerMaker", Form( "AOD analysis, v0Name = \"%s\"", v0Name )); | |
78 | } | |
79 | ||
80 | //------------------------------------------------------- | |
81 | // Init the task and do settings | |
82 | //------------------------------------------------------- | |
1c18d6ca | 83 | AliJSONBool *doQA = static_cast<AliJSONBool *>(combinedConfiguration.GetValue("doQA")); |
84 | TString taskname = (static_cast<AliJSONString *>(combinedConfiguration.GetValue("taskName")))->GetValue(); | |
f2b45b50 | 85 | |
1c18d6ca | 86 | AliEmcalTriggerMaker *eTask = new AliEmcalTriggerMaker(taskname.Data(), doQA->GetValue()); |
87 | eTask->SetCaloTriggersName(strTriggersName.Data()); | |
88 | eTask->SetCaloTriggersOutName((static_cast<AliJSONString *>(combinedConfiguration.GetValue("triggersOutName")))->GetValue()); | |
89 | eTask->SetCaloTriggerSetupOutName((static_cast<AliJSONString *>(combinedConfiguration.GetValue("triggerSetupOutName")))->GetValue()); | |
90 | eTask->SetCaloCellsName(strCellsName.Data()); | |
f2b45b50 | 91 | eTask->SetV0InName(v0Name); |
1c18d6ca | 92 | AliJSONInt *jetLowA = static_cast<AliJSONInt *>(combinedConfiguration.GetValue("jetLowA")), |
93 | *jetLowB = static_cast<AliJSONInt *>(combinedConfiguration.GetValue("jetLowB")), | |
94 | *jetLowC = static_cast<AliJSONInt *>(combinedConfiguration.GetValue("jetLowC")), | |
95 | *jetHighA = static_cast<AliJSONInt *>(combinedConfiguration.GetValue("jetHighA")), | |
96 | *jetHighB = static_cast<AliJSONInt *>(combinedConfiguration.GetValue("jetHighB")), | |
97 | *jetHighC = static_cast<AliJSONInt *>(combinedConfiguration.GetValue("jetHighC")); | |
f2b45b50 | 98 | eTask->SetTriggerThresholdJetLow( jetLowA->GetValue(), jetLowB->GetValue(), jetLowC->GetValue() ); |
99 | eTask->SetTriggerThresholdJetHigh( jetHighA->GetValue(), jetHighB->GetValue(), jetHighC->GetValue() ); | |
100 | ||
101 | //------------------------------------------------------- | |
102 | // Final settings, pass to manager and set the containers | |
103 | //------------------------------------------------------- | |
104 | mgr->AddTask(eTask); | |
1c18d6ca | 105 | |
f2b45b50 | 106 | // Create containers for input/output |
107 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); | |
108 | mgr->ConnectInput (eTask, 0, cinput1 ); | |
109 | ||
110 | if(doQA){ | |
111 | TString commonoutput = mgr->GetCommonFileName(); | |
112 | commonoutput += ":TriggerQA"; | |
113 | mgr->ConnectOutput(eTask, 1, mgr->CreateContainer("TriggerQA", TList::Class(), AliAnalysisManager::kOutputContainer, commonoutput.Data())); | |
114 | } | |
115 | return eTask; | |
116 | } |