]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/EMCALTasks/macros/AddTaskEMCALTriggerQA.C
Changes for 2012 data analysis
[u/mrichter/AliRoot.git] / PWGGA / EMCALTasks / macros / AddTaskEMCALTriggerQA.C
CommitLineData
f71c02b6 1AliAnalysisTaskEMCALTriggerQA * AddTaskEMCALTriggerQA(TString outputFile = "", Bool_t rmBadCells = kTRUE, Int_t run = 0){
311ee5f3 2
3
4 // Get the pointer to the existing analysis manager via the static access method.
5 //==============================================================================
6 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
7 if (!mgr) {
8 ::Error("AddTaskEMCALTriggerQA", "No analysis manager to connect to.");
9 return NULL;
10 }
11
12 // Check the analysis type using the event handlers connected to the analysis manager.
13 //==============================================================================
14 if (!mgr->GetInputEventHandler()) {
15 ::Error("AddTaskEMCALTriggerQA", "This task requires an input event handler");
16 return NULL;
17 }
18
19 AliAnalysisTaskEMCALTriggerQA * qatrigger = new AliAnalysisTaskEMCALTriggerQA("QATrigger");
20
e395081d 21 if(rmBadCells){
22
23 AliEMCALRecoUtils * reco = qatrigger->GetRecoUtils();
24 reco->SwitchOnRejectExoticCluster();
25
26 // Pass the bad channels, need to access run number
27 TString fileName="$ALICE_ROOT/OADB/EMCAL/EMCALBadChannels.root";
28 AliOADBContainer *contBC=new AliOADBContainer("");
29 contBC->InitFromFile((char*)fileName.Data(),"AliEMCALBadChannels");
30 TObjArray *arrayBC=(TObjArray*)contBC->GetObject(run);
31 if(arrayBC){
32 TObjArray *arrayBCpass=(TObjArray*)arrayBC->FindObject("pass1");
33 if(arrayBCpass){
311ee5f3 34
e395081d 35 reco->SwitchOnBadChannelsRemoval();
36 printf("*** EMCAL trigger QA: REMOVE bad cells \n");
311ee5f3 37
e3990982 38 for (Int_t i=0; i<12; ++i) {
e395081d 39 TH2I *hbm = reco->GetEMCALChannelStatusMap(i);
40 if (hbm)
41 delete hbm;
42 hbm=(TH2I*)arrayBCpass->FindObject(Form("EMCALBadChannelMap_Mod%d",i));
43
44 if (!hbm) {
45 AliError(Form("Can not get EMCALBadChannelMap_Mod%d",i));
46 continue;
47 }
48
49 hbm->SetDirectory(0);
50 reco->SetEMCALChannelStatusMap(i,hbm);
51 }
52 } else printf("trigger AliEMCALRecoUtils ---Do NOT remove bad channels 1\n");
53 } else printf("trigger AliEMCALRecoUtils ---Do NOT remove bad channels 2\n");
54 }
55
311ee5f3 56 if(outputFile.Length()==0)outputFile = AliAnalysisManager::GetCommonFileName();
57
58 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
59
f71c02b6 60 AliAnalysisDataContainer *coutput = 0;
61 if(outputFile.Length()==0)
62 coutput = mgr->CreateContainer("EMCALQATrigger", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:EMCALQATrigger",outputFile.Data()));
63 else
64 coutput = mgr->CreateContainer("EMCALQATrigger", TList::Class(), AliAnalysisManager::kOutputContainer, outputFile.Data());
65
311ee5f3 66 mgr->AddTask(qatrigger);
67 mgr->ConnectInput (qatrigger, 0, cinput1);
68 mgr->ConnectOutput (qatrigger, 1, coutput);
69
70 return qatrigger;
71
72}