typo corrected
[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
c93255fe 22#include <TTree.h>
d8da9892 23#include "AliLog.h"
24#include "AliRun.h"
25#include "AliLoader.h"
26#include "AliRunLoader.h"
27#include "AliTriggerInput.h"
28
29#include "AliZDC.h"
30#include "AliZDCDigit.h"
31#include "AliZDCTrigger.h"
32
33//________________________________________________________________
b80faac0 34using std::cerr;
d8da9892 35ClassImp(AliZDCTrigger)
36
37//________________________________________________________________
a718c993 38AliZDCTrigger::AliZDCTrigger() :
39 AliTriggerDetector(),
40 fZDCLeftMinCut(0),
41 fZDCRightMinCut(0),
42 fZEMMinCut(0),
43 fZDCLeftMBCut(0),
44 fZDCRightMBCut(0),
45 fZDCLeftCentrCut(0),
46 fZDCRightCentrCut(0),
47 fZDCLeftSemiCentrCut(0),
48 fZDCRightSemiCentrCut(0),
49 fZEMCentrCut(0)
8a2624cc 50{
51 // Constructor
d8da9892 52 SetName("ZDC");
53 CreateInputs();
54 //
d8da9892 55 SetZDCLeftEMDCuts(0,0);
56 SetZDCRightEMDCuts(0,0);
d8da9892 57
58}
59
60//________________________________________________________________
61void AliZDCTrigger::CreateInputs()
62{
8a2624cc 63 // Trigger inputs
d8da9892 64
65 // Do not create inputs again!!
66 if( fInputs.GetEntriesFast() > 0 ) return;
67
f0b0fc1a 68 fInputs.AddLast(new AliTriggerInput("ZDC_1_L1", "ZDC", 1));
69 fInputs.AddLast(new AliTriggerInput("ZDC_2_L1", "ZDC", 1));
70 fInputs.AddLast(new AliTriggerInput("ZDC_3_L1", "ZDC", 1));
71 fInputs.AddLast(new AliTriggerInput("ZDC_EMD_L1", "ZDC", 1));
d8da9892 72}
73
74//________________________________________________________________
75void AliZDCTrigger::Trigger()
76{
77
8a2624cc 78 // Trigger selection
79 //
33c3c91a 80 AliRunLoader *runLoader = AliRunLoader::Instance();
d8da9892 81
8a2624cc 82 AliLoader *aZDCLoader = runLoader->GetLoader("ZDCLoader");
d3b3a3b2 83
8a2624cc 84 aZDCLoader->LoadDigits("READ");
d8da9892 85 AliZDCDigit digit;
86 AliZDCDigit* pdigit = &digit;
8a2624cc 87 TTree* tD = aZDCLoader->TreeD();
698b2e52 88 if (!tD) {
89 cerr<<"AliZDCTrigger: digits tree not found\n";
90 return;
91 }
8a2624cc 92 tD->SetBranchAddress("ZDC", &pdigit);
d8da9892 93 //
7aff5e7b 94 Float_t signalZNLeft[]={0,0}, signalZPLeft[]={0,0}, signalZDCLeftSum[]={0,0};
95 Float_t signalZNRight[]={0,0}, signalZPRight[]={0,0}, signalZDCRightSum[]={0,0};
96 Float_t signalZEMSum[]={0,0};
8a2624cc 97 for(Int_t iDigit=0; iDigit<tD->GetEntries(); iDigit++){
98 tD->GetEntry(iDigit);
d8da9892 99 //
3b0c190c 100 // *** ZDC LEFT
d8da9892 101 if(digit.GetSector(0)==1)
3b0c190c 102 for(Int_t i=0; i<2; i++){ //0=high range; 1=low range
8a2624cc 103 signalZNLeft[i] += digit.GetADCValue(i);
104 signalZDCLeftSum[i] += digit.GetADCValue(i);
d8da9892 105 }
106 else if(digit.GetSector(0)==2)
107 for(Int_t i=0; i<2; i++){
8a2624cc 108 signalZPLeft[i] += digit.GetADCValue(i);
109 signalZDCLeftSum[i] += digit.GetADCValue(i);
d8da9892 110 }
111 else if(digit.GetSector(0)==3)
8a2624cc 112 for(Int_t i=0; i<2; i++) signalZEMSum[i] += digit.GetADCValue(i);
3b0c190c 113 // *** ZDC RIGHT
114 else if(digit.GetSector(0)==4)
115 for(Int_t i=0; i<2; i++){ //0=high range; 1=low range
8a2624cc 116 signalZNRight[i] += digit.GetADCValue(i);
117 signalZDCRightSum[i] += digit.GetADCValue(i);
3b0c190c 118 }
119 else if(digit.GetSector(0)==5)
120 for(Int_t i=0; i<2; i++){
8a2624cc 121 signalZPRight[i] += digit.GetADCValue(i);
122 signalZDCRightSum[i] += digit.GetADCValue(i);
3b0c190c 123 }
d8da9892 124 }
125 // *******************************************************************
8a2624cc 126 if(signalZDCLeftSum[1]>fZDCLeftMBCut && signalZDCRightSum[1]>fZDCRightMBCut)
3b0c190c 127 // *** ZDC minimum bias trigger
128 SetInput("ZDC_1_L1");
d8da9892 129 // *******************************************************************
8a2624cc 130 if(signalZDCLeftSum[1]>fZDCLeftCentrCut && signalZDCLeftSum[1]<fZDCLeftSemiCentrCut &&
131 signalZDCRightSum[1]>fZDCRightCentrCut && signalZDCRightSum[1]<fZDCRightSemiCentrCut
132 && signalZEMSum[1]>fZEMCentrCut)
3b0c190c 133 // *** ZDC semi-central (10-40%)
4e5f7d9c 134 SetInput("ZDC_2_L1");
135 // *******************************************************************
136 if(signalZDCLeftSum[1]>fZDCLeftMinCut && signalZDCLeftSum[1]<fZDCLeftCentrCut &&
137 signalZDCRightSum[1]>fZDCRightMinCut && signalZDCRightSum[1]<fZDCRightCentrCut &&
138 signalZEMSum[1]>fZEMCentrCut)
139 // *** ZDC central (0-10%)
3b0c190c 140 SetInput("ZDC_3_L1");
4e5f7d9c 141 // *******************************************************************
142 if(signalZNLeft[0]>fZDCLeftEMDCuts[0] && signalZNLeft[0]<fZDCLeftEMDCuts[1] &&
143 signalZNRight[0]>fZDCRightEMDCuts[0] && signalZNRight[0]<fZDCRightEMDCuts[1] &&
144 signalZEMSum[1]<fZEMMinCut){ // *** 1n EMD trigger
145 SetInput("ZDC_EMD_L1");
146 }
d8da9892 147
148}
149
150//________________________________________________________________
3b0c190c 151void AliZDCTrigger::SetZDCLeftMinCut(Float_t ZDCLeftMinCut)
d8da9892 152{
8a2624cc 153 // Set default cut values for ZDC trigger
154 //
3b0c190c 155 if(ZDCLeftMinCut) fZDCLeftMinCut = ZDCLeftMinCut;
156 else fZDCLeftMinCut = 800.;
157}
158//________________________________________________________________
159void AliZDCTrigger::SetZDCRightMinCut(Float_t ZDCRightMinCut)
160{
8a2624cc 161 // Set default cut values for ZDC trigger
162 //
3b0c190c 163 if(ZDCRightMinCut) fZDCRightMinCut = ZDCRightMinCut;
164 else fZDCRightMinCut = 800.;
d8da9892 165}
166
167//________________________________________________________________
168void AliZDCTrigger::SetZEMMinCut(Float_t ZEMMinCut)
169{
8a2624cc 170 // Set default cut values for ZDC trigger
171 //
d8da9892 172 if(ZEMMinCut) fZEMMinCut = ZEMMinCut;
173 else fZEMMinCut = 80.;
174}
175//________________________________________________________________
176void AliZDCTrigger::SetZDCLeftEMDCuts(Float_t* ZDCLeftEMDCuts)
177{
8a2624cc 178 // Set default cut values for ZDC trigger
179 //
d8da9892 180 if(ZDCLeftEMDCuts) for(int j=0; j<2; j++) fZDCLeftEMDCuts[j] = ZDCLeftEMDCuts[j];
181 else{
182 fZDCLeftEMDCuts[0] = 600.;
183 fZDCLeftEMDCuts[1] = 1000.;
184 }
185}
186//________________________________________________________________
187void AliZDCTrigger::SetZDCLeftEMDCuts(Float_t ZDCLeftEMDCutInf,
188 Float_t ZDCLeftEMDCutSup)
189{
8a2624cc 190 // Set default cut values for ZDC trigger
191 //
d8da9892 192 if(ZDCLeftEMDCutInf && ZDCLeftEMDCutSup){
193 fZDCLeftEMDCuts[0]=ZDCLeftEMDCutInf;
194 fZDCLeftEMDCuts[1]=ZDCLeftEMDCutSup;
195 }
196 else{
197 fZDCLeftEMDCuts[0] = 600.;
198 fZDCLeftEMDCuts[1] = 1000.;
199 }
200}
201//________________________________________________________________
202void AliZDCTrigger::SetZDCRightEMDCuts(Float_t* ZDCRightEMDCuts)
203{
8a2624cc 204 // Set default cut values for ZDC trigger
205 //
d8da9892 206 if(ZDCRightEMDCuts) for(int j=0; j<2; j++) fZDCRightEMDCuts[j] = ZDCRightEMDCuts[j];
207 else{
208 fZDCRightEMDCuts[0] = 600.;
209 fZDCRightEMDCuts[1] = 1000.;
210 }
211}
212//________________________________________________________________
213void AliZDCTrigger::SetZDCRightEMDCuts(Float_t ZDCRightEMDCutInf,
214 Float_t ZDCRightEMDCutSup)
215{
8a2624cc 216 // Set default cut values for ZDC trigger
217 //
d8da9892 218 if(ZDCRightEMDCutInf && ZDCRightEMDCutSup){
219 fZDCRightEMDCuts[0]=ZDCRightEMDCutInf;
220 fZDCRightEMDCuts[1]=ZDCRightEMDCutSup;
221 }
222 else{
223 fZDCRightEMDCuts[0] = 600.;
224 fZDCRightEMDCuts[1] = 1000.;
225 }
226}
227//________________________________________________________________
3b0c190c 228void AliZDCTrigger::SetZDCLeftMBCut(Float_t ZDCLeftMBCut)
229{
8a2624cc 230 // Set default cut values for ZDC trigger
231 //
3b0c190c 232 if(ZDCLeftMBCut) fZDCLeftMBCut = ZDCLeftMBCut;
233 else fZDCLeftMBCut = 800.;
234}
235//________________________________________________________________
236void AliZDCTrigger::SetZDCRightMBCut(Float_t ZDCRightMBCut)
237{
8a2624cc 238 // Set default cut values for ZDC trigger
239 //
3b0c190c 240 if(ZDCRightMBCut) fZDCRightMBCut = ZDCRightMBCut;
241 else fZDCRightMBCut = 800.;
242}
243//________________________________________________________________
244void AliZDCTrigger::SetZDCLeftCentrCut(Float_t ZDCLeftCentrCut)
245{
8a2624cc 246 // Set default cut values for ZDC trigger
247 //
3b0c190c 248 if(ZDCLeftCentrCut) fZDCLeftCentrCut = ZDCLeftCentrCut;
249 else fZDCLeftCentrCut = 10000.;
250}
251//________________________________________________________________
252void AliZDCTrigger::SetZDCRightCentrCut(Float_t ZDCRightCentrCut)
d8da9892 253{
8a2624cc 254 // Set default cut values for ZDC trigger
255 //
3b0c190c 256 if(ZDCRightCentrCut) fZDCRightCentrCut = ZDCRightCentrCut;
257 else fZDCRightCentrCut = 10000.;
d8da9892 258}
259//________________________________________________________________
3b0c190c 260void AliZDCTrigger::SetZDCLeftSemiCentrCut(Float_t ZDCLeftSemiCentrCut)
d8da9892 261{
8a2624cc 262 // Set default cut values for ZDC trigger
263 //
3b0c190c 264 if(ZDCLeftSemiCentrCut) fZDCLeftSemiCentrCut = ZDCLeftSemiCentrCut;
265 else fZDCLeftSemiCentrCut = 18500.;
d8da9892 266}
267//________________________________________________________________
3b0c190c 268void AliZDCTrigger::SetZDCRightSemiCentrCut(Float_t ZDCRightSemiCentrCut)
d8da9892 269{
8a2624cc 270 // Set default cut values for ZDC trigger
271 //
3b0c190c 272 if(ZDCRightSemiCentrCut) fZDCRightSemiCentrCut = ZDCRightSemiCentrCut;
273 else fZDCRightSemiCentrCut = 18500.;
d8da9892 274}
275//________________________________________________________________
276void AliZDCTrigger::SetZEMCentrCut(Float_t ZEMCentrCut)
277{
8a2624cc 278 // Set default cut values for ZDC trigger
279 //
d8da9892 280 if(ZEMCentrCut) fZEMCentrCut = ZEMCentrCut;
281 else fZEMCentrCut = 210.;
282}