]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/CaloTasks/macros/AddTaskCaloFilter.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGGA / CaloTasks / macros / AddTaskCaloFilter.C
CommitLineData
2ec3a257 1AliAnalysisTaskCaloFilter * AddTaskCaloFilter(const Bool_t bias = kTRUE,
eee2ea01 2 const Bool_t mc = kFALSE,
3 const Float_t minE = 6,
ea00d1fa 4 const Float_t minN = 3,
2ec3a257 5 const Float_t vz = 10.,
ea00d1fa 6 const Int_t opt = AliAnalysisTaskCaloFilter::kBoth, //kPHOS, kEMCAL or kBoth
2ec3a257 7 const Bool_t correct = kFALSE,
8 const Bool_t fillTrack = kTRUE,
9 const Bool_t fillAOD = kTRUE)
10{
5994e71f 11
12 // Get the pointer to the existing analysis manager via the static access method.
13 //==============================================================================
14 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
2ec3a257 15 if (!mgr)
16 {
e4de0408 17 ::Error("AddTaskCaloFilter", "No analysis manager to connect to.");
5994e71f 18 return NULL;
19 }
20
21 // Check the analysis type using the event handlers connected to the analysis manager.
22 //==============================================================================
2ec3a257 23 if (!mgr->GetInputEventHandler())
24 {
e4de0408 25 ::Error("AddTaskCaloFilter", "This task requires an input event handler");
5994e71f 26 return NULL;
27 }
28
29 AliAnalysisTaskCaloFilter * filter = new AliAnalysisTaskCaloFilter("CaloFilter");
5994e71f 30
ea00d1fa 31 //filter->SetDebugLevel(2);
32
2ec3a257 33 filter->SetCaloFilter(opt); //kPHOS, kEMCAL or kBoth
5994e71f 34
2ec3a257 35 filter->SetVzCut(vz);
36
eee2ea01 37 if(mc)
2ec3a257 38 {
eee2ea01 39 filter->SetEventSelection(1,0,0); // Select events depending on EMCAL, PHOS and tracks criteria
40 filter->SwitchOnAcceptAllMBEvent();
41
42 filter->SwitchOnFillMCParticles();
43
44 filter->SetEMCALEnergyCut(minE);
45 filter->SetEMCALNcellsCut(minN);
46
47 filter->SetPHOSEnergyCut(minE);
48 filter->SetPHOSNcellsCut(minN);
49
50 filter->SetTrackPtCut(minE);
51 }
52 else if(bias) // select events with significant signal in EMCAL or TPC or PHOS
53 {
54 filter->SetEventSelection(1,0,0); // Select events depending on EMCAL, PHOS and tracks criteria
ea00d1fa 55 filter->SwitchOnAcceptAllMBEvent();
56
57 filter->SetEMCALEnergyCut(minE);
58 filter->SetEMCALNcellsCut(minN);
59
60 filter->SetPHOSEnergyCut(minE);
61 filter->SetPHOSNcellsCut(minN);
2ec3a257 62
ea00d1fa 63 filter->SetTrackPtCut(minE);
64
b186bc3e 65 //filter->SetMBTriggerMask(AliVEvent::kAnyINT);
66 filter->SetMBTriggerMask(AliVEvent::kMB); // not working for all productions
67
2ec3a257 68 filter->SelectCollisionCandidates(AliVEvent::kAny) ;
69
70 printf("--- Select events with 1 cluster with at least %2.2f GeV and N = %d ---\n",minE,minN);
71 }
72 else // Do not bias the signal in EMCAL, select MB events
73 {
ea00d1fa 74
75 filter->SetEventSelection(0,0,0);
76 filter->SwitchOnAcceptAllMBEvent();
77
78 filter->SetEMCALEnergyCut(-1);
79 filter->SetEMCALNcellsCut(0);
80
81 filter->SetPHOSEnergyCut(-1);
82 filter->SetPHOSNcellsCut(0);
83
84 filter->SetTrackPtCut(-1);
85
86 filter->SelectCollisionCandidates(AliVEvent::kMB);// | AliVEvent::kCentral | AliVEvent::kSemiCentral ) ;
2ec3a257 87
88 printf("--- Select Min Bias events ---\n");
89 }
90
eee2ea01 91
92 // filter->SelectCollisionCandidates(AliVEvent::kAny) ;
93
2ec3a257 94 if(correct) filter->SwitchOnClusterCorrection();
95 else filter->SwitchOffClusterCorrection();
96
ea00d1fa 97 AliEMCALRecoUtils * reco = filter->GetEMCALRecoUtils();
98 reco->SwitchOnRejectExoticCluster() ;
99 reco->SetExoticCellFractionCut(0.97);
100 reco->SetExoticCellMinAmplitudeCut(2.);
101
102 if(fillTrack) { filter->SwitchOnFillTracks() ; filter->SwitchOnFillHybridTracks() ; }
103 else { filter->SwitchOffFillTracks() ; filter->SwitchOffFillHybridTracks() ; }
104
105 filter->SwitchOffFillv0s() ; // Put ON if you know what you do.
106
107 filter->SwitchOnFillVZERO(); // Be able to recalculate centrality and event plane afterwards even it is stored in header
2ec3a257 108
109 if(fillAOD) filter->SwitchOnFillAODFile();
110 else filter->SwitchOffFillAODFile();
111
112 filter->PrintInfo();
5994e71f 113
5994e71f 114 mgr->AddTask(filter);
115
5994e71f 116 // Create containers for input/output
117 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
118 AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer();
119
5994e71f 120 mgr->ConnectInput (filter, 0, cinput1);
121 mgr->ConnectOutput (filter, 0, coutput1 );
5994e71f 122
123 return filter;
124
125}