Changing cluster E cut to cluster ET cut and changing name of function for correcting...
[u/mrichter/AliRoot.git] / PWGLF / totEt / macros / AddTaskEMCALTenderForEtAnalysis.C
CommitLineData
69008885 1// EMCal tender task adder
2// Author: Jiri Kral
3
4// Script to recover AliEMCALRecParam from OCDB
5// Author: Jiri Kral
6
7#if !defined(__CINT__)
8#include <TString.h>
9#include <TH2.h>
10#include <TF1.h>
11
12#include "AliRun.h"
13#include "AliCaloCalibPedestal.h"
14#include "AliEMCALGeoParams.h"
15#include "AliEMCALRecParam.h"
16#include "AliCDBMetaData.h"
17#include "AliCDBId.h"
18#include "AliCDBEntry.h"
19#include "AliCDBManager.h"
20#include "AliCDBStorage.h"
21#endif
22
23
24
25AliTender *AddTaskEMCALTender(const char *geoname="EMCAL_COMPLETEV1", AliEMCALRecParam *pars = 0 )
26{
27 // Parameters: geoname = "EMCAL_FIRSTYEARV1" or "EMCAL_COMPLETEV1" or ""
28
29 // Get the pointer to the existing analysis manager via the static access method.
30 //==============================================================================
31 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
32 if (!mgr) {
33 ::Error("AddTaskEMCALTender", "No analysis manager to connect to.");
34 return NULL;
35 }
36
37 // Create the task and configure it.
38 //===========================================================================
39 AliTender* ana = new AliTender("TenderTask");
40
41 mgr->AddTask(ana);
42
43 // Adding EMCAL supply
44 AliEMCALTenderSupply *EMCALSupply=new AliEMCALTenderSupply("EMCALtender");
45
46 EMCALSupply->SetEMCALGeometryName(geoname);
47
48 // prepare the reco params ------------------------------------------------
49 if( pars == 0 ){
50 // you can write your reco params here to avoid loading them automatically
51 // from OCDB during execution time
52/* AliEMCALRecParam *params = new AliEMCALRecParam();
53 // reclustering parameters
54 // use v1 for pp and v2 for PbPb
55 params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerv2);
56 params->SetClusteringThreshold(0.1); // 100 MeV
57 params->SetMinECut(0.05); //50 MeV
58 params->SetW0(4.5);
59 // you may want to enable the timing cut
60 params->SetTimeCut(1e6);// s
61 params->SetTimeMin(-1);
62 params->SetTimeMax(1e6);//s
63
64 EMCALSupply->SetRecParam(params);*/
65 }
66 else{
67 cout << "------- TENDER is using supplied reco params -------" << endl;
68 pars->Print( "reco" );
69 cout << "----------------------------------------------------" << endl;
70 EMCALSupply->SetRecParam(pars);
71 }
72
73 // prepare tender parameters ----------------------------------------------
74 EMCALSupply->SetDebugLevel( 0 );
75
76 // fiducial cut
77 EMCALSupply->SetNumberOfCellsFromEMCALBorder( 1 );
78
79 // nonlinearity
80 EMCALSupply->SetNonLinearityFunction( AliEMCALTenderSupply::kBeamTestCorrected );
81
82 // track matching parameters
83 //EMCALSupply->SetMass(0.139);
84 //EMCALSupply->SetStep(5);
85 EMCALSupply->SwitchOnCutEtaPhiSum();
86 EMCALSupply->SetRCut(0.025);
87 //EMCALSupply->SwitchOnCutEtaPhiSeparate();
88 //EMCALSupply->SetEtaCut(0.025);
89 //EMCALSupply->SetPhiCut(0.05);
90
91 // switches ---------------------------------------------------------------
92 EMCALSupply->SwitchOnBadCellRemove();
93 EMCALSupply->SwitchOnExoticCellRemove();
94 EMCALSupply->SwitchOnCalibrateEnergy();
95 EMCALSupply->SwitchOnCalibrateTime();
96 EMCALSupply->SwitchOnUpdateCell();
97 EMCALSupply->SwitchOnReclustering();
98 EMCALSupply->SwitchOnClusterBadChannelCheck();
99 EMCALSupply->SwitchOnClusterExoticChannelCheck();
100 EMCALSupply->SwitchOnCellFiducialRegion();
101 EMCALSupply->SwitchOnReCalibrateCluster();
102 EMCALSupply->SwitchOnRecalculateClusPos();
103 EMCALSupply->SwitchOnRecalShowerShape();
104 EMCALSupply->SwitchOnRecalDistBadChannel();
105 EMCALSupply->SwitchOnNonLinearityCorrection();
106 EMCALSupply->SwitchOnTrackMatch();
107
108
109 ana->AddSupply(EMCALSupply);
110 // Create ONLY the output containers for the data produced by the task.
111 // Get and connect other common input/output containers via the manager as below
112 //==============================================================================
113// AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("histosEmcalTender", TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s", AliAnalysisManager::GetCommonFileName()));
114 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("emcal_tender_event", AliESDEvent::Class(),
115 AliAnalysisManager::kExchangeContainer,"emcal_tender");
116
117 mgr->ConnectInput (ana, 0, mgr->GetCommonInputContainer());
118 mgr->ConnectOutput (ana, 1, coutput1 );
119
120 return ana;
121}
122
123
124AliEMCALRecParam* GetOCDBRecParam( Int_t runNum, char *datatype="pp", Bool_t grid=kTRUE ){
125
126 AliCDBManager *man;
127
128 AliEMCALRecParam *pars;
129 TObjArray *arr;
130
131 if( grid ){
132 cout << "======= Will get reco params from OCDB on grid ============= " << endl;
133 if(!gGrid) {
134 if (!TGrid::Connect("alien://")){
135 cout << "Error: can't connect to grid" << endl;
136 exit(1);
137 }
138 }
139 }
140 else{
141 cout << "======= Will get reco params from local ODCB =============== " << endl;
142 }
143
144 // created the OCDB manager
145 man = AliCDBManager::Instance();
146
147 // point it to local storage
148 // !!! careful, one must build an exact path of OCDB directories
149 // and store the file in those
150 // here "./OCDB/EMCAL/Calib/Pedestals/Run*.root) for masks
151 if( grid )
152 man->SetDefaultStorageFromRun( runNum );
153 else
154 man->SetDefaultStorage( "local://$ALICE_ROOT/OCDB" );
155
156 // load the file data
157 arr = (TObjArray*)(man->Get("EMCAL/Calib/RecoParam", runNum)->GetObject());
158
159 if( !strcmp( datatype, "pp" ))
160 pars = (AliEMCALRecParam*)arr->FindObject( "Low Flux - p+p" );
161 else
162 pars = (AliEMCALRecParam*)arr->FindObject( "High Flux - Pb+Pb" );
163
164 // cleanup
165 arr->Clear();
166 delete arr;
167 man->ClearCache();
168 man->DestroyActiveStorages();
169 man->Destroy();
170
171 cout << "======= Reco parames retrieval finished ==================== " << endl;
172
173 return pars;
174}