Changes for report #76227: ZDC TDC info in ESD and physics selection (for release...
[u/mrichter/AliRoot.git] / ZDC / AliZDCTrigger.cxx
CommitLineData
d8da9892 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
8a2624cc 16// ****************************************************************
17//
18// Trigger class for ZDC
19//
20// ****************************************************************
21
d8da9892 22#include "AliLog.h"
23#include "AliRun.h"
24#include "AliLoader.h"
25#include "AliRunLoader.h"
26#include "AliTriggerInput.h"
27
28#include "AliZDC.h"
29#include "AliZDCDigit.h"
30#include "AliZDCTrigger.h"
31
32//________________________________________________________________
33ClassImp(AliZDCTrigger)
34
35//________________________________________________________________
a718c993 36AliZDCTrigger::AliZDCTrigger() :
37 AliTriggerDetector(),
38 fZDCLeftMinCut(0),
39 fZDCRightMinCut(0),
40 fZEMMinCut(0),
41 fZDCLeftMBCut(0),
42 fZDCRightMBCut(0),
43 fZDCLeftCentrCut(0),
44 fZDCRightCentrCut(0),
45 fZDCLeftSemiCentrCut(0),
46 fZDCRightSemiCentrCut(0),
47 fZEMCentrCut(0)
8a2624cc 48{
49 // Constructor
d8da9892 50 SetName("ZDC");
51 CreateInputs();
52 //
d8da9892 53 SetZDCLeftEMDCuts(0,0);
54 SetZDCRightEMDCuts(0,0);
d8da9892 55
56}
57
58//________________________________________________________________
59void AliZDCTrigger::CreateInputs()
60{
8a2624cc 61 // Trigger inputs
d8da9892 62
63 // Do not create inputs again!!
64 if( fInputs.GetEntriesFast() > 0 ) return;
65
f0b0fc1a 66 fInputs.AddLast(new AliTriggerInput("ZDC_1_L1", "ZDC", 1));
67 fInputs.AddLast(new AliTriggerInput("ZDC_2_L1", "ZDC", 1));
68 fInputs.AddLast(new AliTriggerInput("ZDC_3_L1", "ZDC", 1));
69 fInputs.AddLast(new AliTriggerInput("ZDC_EMD_L1", "ZDC", 1));
d8da9892 70}
71
72//________________________________________________________________
73void AliZDCTrigger::Trigger()
74{
75
8a2624cc 76 // Trigger selection
77 //
33c3c91a 78 AliRunLoader *runLoader = AliRunLoader::Instance();
d8da9892 79
8a2624cc 80 AliLoader *aZDCLoader = runLoader->GetLoader("ZDCLoader");
d3b3a3b2 81
8a2624cc 82 aZDCLoader->LoadDigits("READ");
d8da9892 83 AliZDCDigit digit;
84 AliZDCDigit* pdigit = &digit;
8a2624cc 85 TTree* tD = aZDCLoader->TreeD();
698b2e52 86 if (!tD) {
87 cerr<<"AliZDCTrigger: digits tree not found\n";
88 return;
89 }
8a2624cc 90 tD->SetBranchAddress("ZDC", &pdigit);
d8da9892 91 //
7aff5e7b 92 Float_t signalZNLeft[]={0,0}, signalZPLeft[]={0,0}, signalZDCLeftSum[]={0,0};
93 Float_t signalZNRight[]={0,0}, signalZPRight[]={0,0}, signalZDCRightSum[]={0,0};
94 Float_t signalZEMSum[]={0,0};
8a2624cc 95 for(Int_t iDigit=0; iDigit<tD->GetEntries(); iDigit++){
96 tD->GetEntry(iDigit);
d8da9892 97 //
3b0c190c 98 // *** ZDC LEFT
d8da9892 99 if(digit.GetSector(0)==1)
3b0c190c 100 for(Int_t i=0; i<2; i++){ //0=high range; 1=low range
8a2624cc 101 signalZNLeft[i] += digit.GetADCValue(i);
102 signalZDCLeftSum[i] += digit.GetADCValue(i);
d8da9892 103 }
104 else if(digit.GetSector(0)==2)
105 for(Int_t i=0; i<2; i++){
8a2624cc 106 signalZPLeft[i] += digit.GetADCValue(i);
107 signalZDCLeftSum[i] += digit.GetADCValue(i);
d8da9892 108 }
109 else if(digit.GetSector(0)==3)
8a2624cc 110 for(Int_t i=0; i<2; i++) signalZEMSum[i] += digit.GetADCValue(i);
3b0c190c 111 // *** ZDC RIGHT
112 else if(digit.GetSector(0)==4)
113 for(Int_t i=0; i<2; i++){ //0=high range; 1=low range
8a2624cc 114 signalZNRight[i] += digit.GetADCValue(i);
115 signalZDCRightSum[i] += digit.GetADCValue(i);
3b0c190c 116 }
117 else if(digit.GetSector(0)==5)
118 for(Int_t i=0; i<2; i++){
8a2624cc 119 signalZPRight[i] += digit.GetADCValue(i);
120 signalZDCRightSum[i] += digit.GetADCValue(i);
3b0c190c 121 }
d8da9892 122 }
123 // *******************************************************************
8a2624cc 124 if(signalZDCLeftSum[1]>fZDCLeftMBCut && signalZDCRightSum[1]>fZDCRightMBCut)
3b0c190c 125 // *** ZDC minimum bias trigger
126 SetInput("ZDC_1_L1");
d8da9892 127 // *******************************************************************
8a2624cc 128 if(signalZDCLeftSum[1]>fZDCLeftCentrCut && signalZDCLeftSum[1]<fZDCLeftSemiCentrCut &&
129 signalZDCRightSum[1]>fZDCRightCentrCut && signalZDCRightSum[1]<fZDCRightSemiCentrCut
130 && signalZEMSum[1]>fZEMCentrCut)
3b0c190c 131 // *** ZDC semi-central (10-40%)
4e5f7d9c 132 SetInput("ZDC_2_L1");
133 // *******************************************************************
134 if(signalZDCLeftSum[1]>fZDCLeftMinCut && signalZDCLeftSum[1]<fZDCLeftCentrCut &&
135 signalZDCRightSum[1]>fZDCRightMinCut && signalZDCRightSum[1]<fZDCRightCentrCut &&
136 signalZEMSum[1]>fZEMCentrCut)
137 // *** ZDC central (0-10%)
3b0c190c 138 SetInput("ZDC_3_L1");
4e5f7d9c 139 // *******************************************************************
140 if(signalZNLeft[0]>fZDCLeftEMDCuts[0] && signalZNLeft[0]<fZDCLeftEMDCuts[1] &&
141 signalZNRight[0]>fZDCRightEMDCuts[0] && signalZNRight[0]<fZDCRightEMDCuts[1] &&
142 signalZEMSum[1]<fZEMMinCut){ // *** 1n EMD trigger
143 SetInput("ZDC_EMD_L1");
144 }
d8da9892 145
146}
147
148//________________________________________________________________
3b0c190c 149void AliZDCTrigger::SetZDCLeftMinCut(Float_t ZDCLeftMinCut)
d8da9892 150{
8a2624cc 151 // Set default cut values for ZDC trigger
152 //
3b0c190c 153 if(ZDCLeftMinCut) fZDCLeftMinCut = ZDCLeftMinCut;
154 else fZDCLeftMinCut = 800.;
155}
156//________________________________________________________________
157void AliZDCTrigger::SetZDCRightMinCut(Float_t ZDCRightMinCut)
158{
8a2624cc 159 // Set default cut values for ZDC trigger
160 //
3b0c190c 161 if(ZDCRightMinCut) fZDCRightMinCut = ZDCRightMinCut;
162 else fZDCRightMinCut = 800.;
d8da9892 163}
164
165//________________________________________________________________
166void AliZDCTrigger::SetZEMMinCut(Float_t ZEMMinCut)
167{
8a2624cc 168 // Set default cut values for ZDC trigger
169 //
d8da9892 170 if(ZEMMinCut) fZEMMinCut = ZEMMinCut;
171 else fZEMMinCut = 80.;
172}
173//________________________________________________________________
174void AliZDCTrigger::SetZDCLeftEMDCuts(Float_t* ZDCLeftEMDCuts)
175{
8a2624cc 176 // Set default cut values for ZDC trigger
177 //
d8da9892 178 if(ZDCLeftEMDCuts) for(int j=0; j<2; j++) fZDCLeftEMDCuts[j] = ZDCLeftEMDCuts[j];
179 else{
180 fZDCLeftEMDCuts[0] = 600.;
181 fZDCLeftEMDCuts[1] = 1000.;
182 }
183}
184//________________________________________________________________
185void AliZDCTrigger::SetZDCLeftEMDCuts(Float_t ZDCLeftEMDCutInf,
186 Float_t ZDCLeftEMDCutSup)
187{
8a2624cc 188 // Set default cut values for ZDC trigger
189 //
d8da9892 190 if(ZDCLeftEMDCutInf && ZDCLeftEMDCutSup){
191 fZDCLeftEMDCuts[0]=ZDCLeftEMDCutInf;
192 fZDCLeftEMDCuts[1]=ZDCLeftEMDCutSup;
193 }
194 else{
195 fZDCLeftEMDCuts[0] = 600.;
196 fZDCLeftEMDCuts[1] = 1000.;
197 }
198}
199//________________________________________________________________
200void AliZDCTrigger::SetZDCRightEMDCuts(Float_t* ZDCRightEMDCuts)
201{
8a2624cc 202 // Set default cut values for ZDC trigger
203 //
d8da9892 204 if(ZDCRightEMDCuts) for(int j=0; j<2; j++) fZDCRightEMDCuts[j] = ZDCRightEMDCuts[j];
205 else{
206 fZDCRightEMDCuts[0] = 600.;
207 fZDCRightEMDCuts[1] = 1000.;
208 }
209}
210//________________________________________________________________
211void AliZDCTrigger::SetZDCRightEMDCuts(Float_t ZDCRightEMDCutInf,
212 Float_t ZDCRightEMDCutSup)
213{
8a2624cc 214 // Set default cut values for ZDC trigger
215 //
d8da9892 216 if(ZDCRightEMDCutInf && ZDCRightEMDCutSup){
217 fZDCRightEMDCuts[0]=ZDCRightEMDCutInf;
218 fZDCRightEMDCuts[1]=ZDCRightEMDCutSup;
219 }
220 else{
221 fZDCRightEMDCuts[0] = 600.;
222 fZDCRightEMDCuts[1] = 1000.;
223 }
224}
225//________________________________________________________________
3b0c190c 226void AliZDCTrigger::SetZDCLeftMBCut(Float_t ZDCLeftMBCut)
227{
8a2624cc 228 // Set default cut values for ZDC trigger
229 //
3b0c190c 230 if(ZDCLeftMBCut) fZDCLeftMBCut = ZDCLeftMBCut;
231 else fZDCLeftMBCut = 800.;
232}
233//________________________________________________________________
234void AliZDCTrigger::SetZDCRightMBCut(Float_t ZDCRightMBCut)
235{
8a2624cc 236 // Set default cut values for ZDC trigger
237 //
3b0c190c 238 if(ZDCRightMBCut) fZDCRightMBCut = ZDCRightMBCut;
239 else fZDCRightMBCut = 800.;
240}
241//________________________________________________________________
242void AliZDCTrigger::SetZDCLeftCentrCut(Float_t ZDCLeftCentrCut)
243{
8a2624cc 244 // Set default cut values for ZDC trigger
245 //
3b0c190c 246 if(ZDCLeftCentrCut) fZDCLeftCentrCut = ZDCLeftCentrCut;
247 else fZDCLeftCentrCut = 10000.;
248}
249//________________________________________________________________
250void AliZDCTrigger::SetZDCRightCentrCut(Float_t ZDCRightCentrCut)
d8da9892 251{
8a2624cc 252 // Set default cut values for ZDC trigger
253 //
3b0c190c 254 if(ZDCRightCentrCut) fZDCRightCentrCut = ZDCRightCentrCut;
255 else fZDCRightCentrCut = 10000.;
d8da9892 256}
257//________________________________________________________________
3b0c190c 258void AliZDCTrigger::SetZDCLeftSemiCentrCut(Float_t ZDCLeftSemiCentrCut)
d8da9892 259{
8a2624cc 260 // Set default cut values for ZDC trigger
261 //
3b0c190c 262 if(ZDCLeftSemiCentrCut) fZDCLeftSemiCentrCut = ZDCLeftSemiCentrCut;
263 else fZDCLeftSemiCentrCut = 18500.;
d8da9892 264}
265//________________________________________________________________
3b0c190c 266void AliZDCTrigger::SetZDCRightSemiCentrCut(Float_t ZDCRightSemiCentrCut)
d8da9892 267{
8a2624cc 268 // Set default cut values for ZDC trigger
269 //
3b0c190c 270 if(ZDCRightSemiCentrCut) fZDCRightSemiCentrCut = ZDCRightSemiCentrCut;
271 else fZDCRightSemiCentrCut = 18500.;
d8da9892 272}
273//________________________________________________________________
274void AliZDCTrigger::SetZEMCentrCut(Float_t ZEMCentrCut)
275{
8a2624cc 276 // Set default cut values for ZDC trigger
277 //
d8da9892 278 if(ZEMCentrCut) fZEMCentrCut = ZEMCentrCut;
279 else fZEMCentrCut = 210.;
280}