Line data Source code
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 :
16 : //-------------------------------------------------------------------------
17 : // Implementation of Class AliESDHeader
18 : // Header data
19 : // for the ESD
20 : // Origin: Christian Klein-Boesing, CERN, Christian.Klein-Boesing@cern.ch
21 : //-------------------------------------------------------------------------
22 :
23 : #include "AliESDHeader.h"
24 : #include "AliTriggerScalersESD.h"
25 : #include "AliTriggerScalersRecordESD.h"
26 : #include "AliTriggerIR.h"
27 : #include "AliTriggerConfiguration.h"
28 : #include "AliLog.h"
29 :
30 172 : ClassImp(AliESDHeader)
31 :
32 : //______________________________________________________________________________
33 : AliESDHeader::AliESDHeader() :
34 18 : AliVHeader(),
35 18 : fTriggerMask(0),
36 18 : fTriggerMaskNext50(0),
37 18 : fOrbitNumber(0),
38 18 : fTimeStamp(0),
39 18 : fEventType(0),
40 18 : fEventSpecie(0),
41 18 : fPeriodNumber(0),
42 18 : fEventNumberInFile(0),
43 18 : fBunchCrossNumber(0),
44 18 : fTriggerCluster(0),
45 18 : fL0TriggerInputs(0),
46 18 : fL1TriggerInputs(0),
47 18 : fL2TriggerInputs(0),
48 18 : fTriggerScalers(),
49 18 : fTriggerScalersDeltaEvent(),
50 18 : fTriggerScalersDeltaRun(),
51 18 : fTriggerInputsNames(kNTriggerInputs),
52 18 : fCTPConfig(NULL),
53 18 : fIRBufferArray(),
54 18 : fIRInt2InteractionsMap(0),
55 18 : fIRInt1InteractionsMap(0)
56 90 : {
57 : // default constructor
58 :
59 18 : SetName("AliESDHeader");
60 144 : for(Int_t i = 0; i<kNMaxIR ; i++) fIRArray[i] = 0;
61 18 : fTriggerInputsNames.SetOwner(kTRUE);
62 144 : for (Int_t itype=0; itype<3; itype++) fTPCNoiseFilterCounter[itype]=0;
63 18 : fIRBufferArray.SetOwner(kTRUE);
64 36 : }
65 :
66 : AliESDHeader::~AliESDHeader()
67 60 : {
68 : // destructor
69 110 : for(Int_t i=0;i<kNMaxIR;i++)if(fIRArray[i])delete fIRArray[i];
70 10 : delete fCTPConfig;
71 : // fIRBufferArray.Delete();
72 30 : }
73 :
74 :
75 : AliESDHeader::AliESDHeader(const AliESDHeader &header) :
76 0 : AliVHeader(header),
77 0 : fTriggerMask(header.fTriggerMask),
78 0 : fTriggerMaskNext50(header.fTriggerMaskNext50),
79 0 : fOrbitNumber(header.fOrbitNumber),
80 0 : fTimeStamp(header.fTimeStamp),
81 0 : fEventType(header.fEventType),
82 0 : fEventSpecie(header.fEventSpecie),
83 0 : fPeriodNumber(header.fPeriodNumber),
84 0 : fEventNumberInFile(header.fEventNumberInFile),
85 0 : fBunchCrossNumber(header.fBunchCrossNumber),
86 0 : fTriggerCluster(header.fTriggerCluster),
87 0 : fL0TriggerInputs(header.fL0TriggerInputs),
88 0 : fL1TriggerInputs(header.fL1TriggerInputs),
89 0 : fL2TriggerInputs(header.fL2TriggerInputs),
90 0 : fTriggerScalers(header.fTriggerScalers),
91 0 : fTriggerScalersDeltaEvent(header.fTriggerScalersDeltaEvent),
92 0 : fTriggerScalersDeltaRun(header.fTriggerScalersDeltaRun),
93 0 : fTriggerInputsNames(TObjArray(kNTriggerInputs)),
94 0 : fCTPConfig(header.fCTPConfig),
95 0 : fIRBufferArray(),
96 0 : fIRInt2InteractionsMap(header.fIRInt2InteractionsMap),
97 0 : fIRInt1InteractionsMap(header.fIRInt1InteractionsMap)
98 0 : {
99 : // copy constructor
100 0 : for(Int_t i = 0; i<kNMaxIR ; i++) {
101 0 : if(header.fIRArray[i])fIRArray[i] = new AliTriggerIR(*header.fIRArray[i]);
102 0 : else fIRArray[i]=0;
103 : }
104 0 : for(Int_t i = 0; i < kNTriggerInputs; i++) {
105 0 : TNamed *str = (TNamed *)((header.fTriggerInputsNames).At(i));
106 0 : if (str) fTriggerInputsNames.AddAt(new TNamed(*str),i);
107 : }
108 :
109 0 : for(Int_t i = 0; i < (header.fIRBufferArray).GetEntries(); ++i) {
110 0 : AliTriggerIR *ir = (AliTriggerIR*)((header.fIRBufferArray).At(i));
111 0 : if (ir) fIRBufferArray.Add(new AliTriggerIR(*ir));
112 : }
113 0 : for (Int_t itype=0; itype<3; itype++) fTPCNoiseFilterCounter[itype]=header.fTPCNoiseFilterCounter[itype];
114 0 : fTriggerInputsNames.SetOwner(kTRUE);
115 0 : fIRBufferArray.SetOwner(kTRUE);
116 0 : }
117 :
118 : AliESDHeader& AliESDHeader::operator=(const AliESDHeader &header)
119 : {
120 : // assigment operator
121 4 : if(this!=&header) {
122 2 : AliVHeader::operator=(header);
123 2 : fTriggerMask = header.fTriggerMask;
124 2 : fTriggerMaskNext50 = header.fTriggerMaskNext50;
125 2 : fOrbitNumber = header.fOrbitNumber;
126 2 : fTimeStamp = header.fTimeStamp;
127 2 : fEventType = header.fEventType;
128 2 : fEventSpecie = header.fEventSpecie;
129 2 : fPeriodNumber = header.fPeriodNumber;
130 2 : fEventNumberInFile = header.fEventNumberInFile;
131 2 : fBunchCrossNumber = header.fBunchCrossNumber;
132 2 : fTriggerCluster = header.fTriggerCluster;
133 2 : fL0TriggerInputs = header.fL0TriggerInputs;
134 2 : fL1TriggerInputs = header.fL1TriggerInputs;
135 2 : fL2TriggerInputs = header.fL2TriggerInputs;
136 2 : fTriggerScalers = header.fTriggerScalers;
137 2 : fTriggerScalersDeltaEvent = header.fTriggerScalersDeltaEvent;
138 2 : fTriggerScalersDeltaRun = header.fTriggerScalersDeltaRun;
139 2 : fIRInt2InteractionsMap = header.fIRInt2InteractionsMap;
140 2 : fIRInt1InteractionsMap = header.fIRInt1InteractionsMap;
141 :
142 2 : delete fCTPConfig;
143 2 : fCTPConfig = header.fCTPConfig;
144 :
145 2 : fTriggerInputsNames.Clear();
146 244 : for(Int_t i = 0; i < kNTriggerInputs; i++) {
147 120 : TNamed *str = (TNamed *)((header.fTriggerInputsNames).At(i));
148 120 : if (str) fTriggerInputsNames.AddAt(new TNamed(*str),i);
149 : }
150 16 : for(Int_t i = 0; i<kNMaxIR ; i++) {
151 6 : delete fIRArray[i];
152 6 : if(header.fIRArray[i])fIRArray[i] = new AliTriggerIR(*header.fIRArray[i]);
153 6 : else fIRArray[i]=0;
154 : }
155 :
156 2 : fIRBufferArray.Delete();
157 4 : for(Int_t i = 0; i < (header.fIRBufferArray).GetEntries(); ++i) {
158 0 : AliTriggerIR *ir = (AliTriggerIR*)((header.fIRBufferArray).At(i));
159 0 : if (ir) fIRBufferArray.Add(new AliTriggerIR(*ir));
160 : }
161 16 : for (Int_t itype=0; itype<3; itype++) fTPCNoiseFilterCounter[itype]=header.fTPCNoiseFilterCounter[itype];
162 2 : }
163 2 : return *this;
164 0 : }
165 :
166 : void AliESDHeader::Copy(TObject &obj) const
167 : {
168 : // this overwrites the virtual TOBject::Copy()
169 : // to allow run time copying without casting
170 : // in AliESDEvent
171 :
172 4 : if(this==&obj)return;
173 6 : AliESDHeader *robj = dynamic_cast<AliESDHeader*>(&obj);
174 2 : if(!robj)return; // not an AliESDHeader
175 2 : *robj = *this;
176 :
177 4 : }
178 : //______________________________________________________________________________
179 : void AliESDHeader::Reset()
180 : {
181 : // reset all data members
182 66 : fTriggerMask = 0;
183 33 : fTriggerMaskNext50 = 0;
184 33 : fOrbitNumber = 0;
185 33 : fTimeStamp = 0;
186 33 : fEventType = 0;
187 33 : fEventSpecie = 0;
188 33 : fPeriodNumber = 0;
189 33 : fEventNumberInFile = 0;
190 33 : fBunchCrossNumber = 0;
191 33 : fTriggerCluster = 0;
192 33 : fL0TriggerInputs = 0;
193 33 : fL1TriggerInputs = 0;
194 33 : fL2TriggerInputs = 0;
195 33 : fTriggerScalers.Reset();
196 33 : fTriggerScalersDeltaEvent.Reset();
197 33 : fTriggerScalersDeltaRun.Reset();
198 33 : fTriggerInputsNames.Clear();
199 :
200 33 : fIRInt2InteractionsMap.ResetAllBits();
201 33 : fIRInt1InteractionsMap.ResetAllBits();
202 :
203 33 : delete fCTPConfig;
204 33 : fCTPConfig = 0;
205 363 : for(Int_t i=0;i<kNMaxIR;i++)if(fIRArray[i]){
206 0 : delete fIRArray[i];
207 0 : fIRArray[i]=0;
208 0 : }
209 264 : for (Int_t itype=0; itype<3; itype++) fTPCNoiseFilterCounter[itype]=0;
210 33 : fIRBufferArray.Clear();
211 33 : }
212 : //______________________________________________________________________________
213 : Bool_t AliESDHeader::AddTriggerIR(const AliTriggerIR* ir)
214 : {
215 : // Add an IR object into the array
216 : // of IRs in the ESD header
217 :
218 0 : fIRBufferArray.Add(new AliTriggerIR(*ir));
219 :
220 0 : return kTRUE;
221 0 : }
222 : //______________________________________________________________________________
223 : void AliESDHeader::Print(const Option_t *) const
224 : {
225 : // Print some data members
226 0 : printf("Event # %d in file Bunch crossing # %d Orbit # %d Trigger %lld %lld\n",
227 0 : GetEventNumberInFile(),
228 0 : GetBunchCrossNumber(),
229 0 : GetOrbitNumber(),
230 0 : GetTriggerMask(),
231 0 : GetTriggerMaskNext50());
232 0 : printf("List of the active trigger inputs: ");
233 0 : for(Int_t i = 0; i < kNTriggerInputs; i++) {
234 0 : TNamed *str = (TNamed *)((fTriggerInputsNames).At(i));
235 0 : if (str) printf("%i %s ",i,str->GetName());
236 : }
237 0 : printf("\n");
238 0 : }
239 :
240 : //______________________________________________________________________________
241 : void AliESDHeader::SetActiveTriggerInputs(const char*name, Int_t index)
242 : {
243 : // Fill the active trigger inputs names
244 : // into the corresponding fTriggerInputsNames (TObjArray of TNamed)
245 312 : if (index >= kNTriggerInputs || index < 0) {
246 0 : AliError(Form("Index (%d) is outside the allowed range (0,59)!",index));
247 0 : return;
248 : }
249 :
250 312 : fTriggerInputsNames.AddAt(new TNamed(name,NULL),index);
251 312 : }
252 : //______________________________________________________________________________
253 : const char* AliESDHeader::GetTriggerInputName(Int_t index, Int_t trglevel) const
254 : {
255 : // Get the trigger input name
256 : // at the specified position in the trigger mask and trigger level (0,1,2)
257 : TNamed *trginput = 0;
258 0 : if (trglevel == 0) trginput = (TNamed *)fTriggerInputsNames.At(index);
259 0 : if (trglevel == 1) trginput = (TNamed *)fTriggerInputsNames.At(index+24);
260 0 : if (trglevel == 2) trginput = (TNamed *)fTriggerInputsNames.At(index+48);
261 0 : if (trginput) return trginput->GetName();
262 0 : else return "";
263 0 : }
264 : //______________________________________________________________________________
265 : TString AliESDHeader::GetActiveTriggerInputs() const
266 : {
267 : // Returns the list with the names of the active trigger inputs
268 0 : TString trginputs;
269 0 : for(Int_t i = 0; i < kNTriggerInputs; i++) {
270 0 : TNamed *str = (TNamed *)((fTriggerInputsNames).At(i));
271 0 : if (str) {
272 0 : trginputs += " ";
273 0 : trginputs += str->GetName();
274 0 : trginputs += " ";
275 : }
276 : }
277 :
278 : return trginputs;
279 0 : }
280 : //______________________________________________________________________________
281 : TString AliESDHeader::GetFiredTriggerInputs() const
282 : {
283 : // Returns the list with the names of the fired trigger inputs
284 0 : TString trginputs;
285 0 : for(Int_t i = 0; i < kNTriggerInputs; i++) {
286 0 : TNamed *str = (TNamed *)((fTriggerInputsNames.At(i)));
287 0 : if (i < 24 && (fL0TriggerInputs & (1ul << i))) {
288 0 : if (str) {
289 0 : trginputs += " ";
290 0 : trginputs += str->GetName();
291 0 : trginputs += " ";
292 : }
293 : }
294 0 : if (i >= 24 && i < 48 && (fL1TriggerInputs & (1ul << (i-24)))) {
295 0 : if (str) {
296 0 : trginputs += " ";
297 0 : trginputs += str->GetName();
298 0 : trginputs += " ";
299 : }
300 : }
301 0 : if (i >= 48 && (fL2TriggerInputs & (1u << (i-48)))) {
302 0 : if (str) {
303 0 : trginputs += " ";
304 0 : trginputs += str->GetName();
305 0 : trginputs += " ";
306 : }
307 : }
308 :
309 : }
310 : return trginputs;
311 0 : }
312 : //______________________________________________________________________________
313 : Bool_t AliESDHeader::IsTriggerInputFired(const char *name) const
314 : {
315 : // Checks if the trigger input is fired
316 :
317 0 : TNamed *trginput = (TNamed *)fTriggerInputsNames.FindObject(name);
318 0 : if (trginput == 0) return kFALSE;
319 :
320 0 : Int_t inputIndex = fTriggerInputsNames.IndexOf(trginput);
321 0 : if (inputIndex < 0) return kFALSE;
322 :
323 0 : if(inputIndex < 24){
324 0 : if (fL0TriggerInputs & (1lu << inputIndex)) return kTRUE;
325 0 : } else if(inputIndex < 48){
326 0 : if (fL1TriggerInputs & (1lu << (inputIndex-24))) return kTRUE;
327 0 : } else if(inputIndex < 60){
328 0 : if (fL2TriggerInputs & (1u << (inputIndex-48))) return kTRUE;
329 : }
330 : else {
331 0 : AliError(Form("Index (%d) is outside the allowed range (0,59)!",inputIndex));
332 0 : return kFALSE;
333 : }
334 0 : return kFALSE;
335 0 : }
336 : //________________________________________________________________________________
337 : Int_t AliESDHeader::GetTriggerIREntries(Int_t int1, Int_t int2, Float_t deltaTime) const
338 : {
339 : // returns number of IR-s within time window deltaTime
340 : // all possible combinations of int1 and int2 int1 - zdc bit, int2 v0 bit
341 : //
342 : const AliTriggerIR *IR;
343 : // triggered event
344 0 : Int_t nIR = GetTriggerIREntries();
345 0 : UInt_t orbit1 = GetOrbitNumber();
346 : const Double_t ot=0.0889218; //orbit time msec
347 : Float_t timediff; // time difference between orbits (msec)
348 : //
349 : Int_t nofIR;
350 : nofIR=0;
351 : // loop over IR-s
352 0 : for(Int_t i=0;i<nIR;i++){//1
353 0 : IR=GetTriggerIR(i);
354 : //
355 0 : UInt_t orbit2 = IR->GetOrbit();
356 0 : timediff = (orbit2<=orbit1) ? (Float_t)((orbit1-orbit2))*ot :
357 0 : (Float_t)((16777215-orbit1+orbit2))*ot;
358 0 : if (timediff>deltaTime) continue; //timediff outside time window
359 0 : if((int1&int2) == -1){ //ignore both bits, just count IR-s within time window
360 0 : nofIR++;
361 0 : continue;
362 : }
363 : // now check if int1, int2 bits are set
364 0 : UInt_t nw = IR->GetNWord();
365 0 : Bool_t *bint1 = IR->GetInt1s();
366 0 : Bool_t *bint2 = IR->GetInt2s();
367 : //
368 : Int_t flag1,flag2;
369 : flag1=0;
370 : flag2=0;
371 0 : for(UInt_t j=0;j<nw;j++){//2
372 0 : if(bint1[j]) flag1=1; // at least one int1 set
373 0 : if(bint2[j]) flag2=1; // at least one int2 set
374 : //printf("IR %d, bint1 %d, bint2 %d\n",i,bint1[j],bint2[j]);
375 : }//2
376 : // checking combinations
377 : //
378 :
379 0 : if((flag1*int1*flag2*int2)==1){// int1=1 & int2=1
380 0 : nofIR++;
381 0 : continue;
382 : }
383 0 : if(int1 == -1){// ignore int1
384 0 : if(flag2&int2){// int2=1
385 0 : nofIR++;
386 0 : continue;
387 : }
388 0 : else if (!flag2&!int2){ //int2=0
389 0 : nofIR++;
390 0 : continue;
391 : }
392 : }
393 :
394 0 : if(int2 ==-1){//ignore int2
395 0 : if(flag1&int1){//int1=1
396 0 : nofIR++;
397 0 : continue;
398 : }
399 0 : else if(!flag1&!int1){ //int1=0
400 0 : nofIR++;
401 0 : continue;
402 : }
403 : }
404 :
405 0 : if((flag1*int1)&!flag2&!int2){// int1=1, int2=0
406 0 : nofIR++;
407 0 : continue;
408 : }
409 :
410 0 : if((int2*flag2)&!int1&!flag1){// int1=0, int2=1
411 0 : nofIR++;
412 0 : continue;
413 : }
414 :
415 :
416 :
417 0 : }//1
418 :
419 0 : return nofIR;
420 : }
421 : //__________________________________________________________________________
422 : TObjArray AliESDHeader::GetIRArray(Int_t int1, Int_t int2, Float_t deltaTime) const
423 : {
424 : //
425 : // returns an array of IR-s within time window deltaTime
426 : // all possible combinations of int1 and int2 int1 - zdc bit, int2 v0 bit
427 : //
428 : const AliTriggerIR *IR;
429 0 : TObjArray arr;
430 : // triggered event
431 0 : Int_t nIR = GetTriggerIREntries();
432 0 : UInt_t orbit1 = GetOrbitNumber();
433 : const Double_t ot=0.0889218; //orbit time msec
434 : Float_t timediff; // time difference between orbits (msec)
435 : //
436 : // loop over IR-s
437 0 : for(Int_t i=0;i<nIR;i++){//1
438 0 : IR=GetTriggerIR(i);
439 : //
440 0 : UInt_t orbit2 = IR->GetOrbit();
441 0 : timediff = (orbit2<=orbit1) ? (Float_t)((orbit1-orbit2))*ot :
442 0 : (Float_t)((16777215-orbit1+orbit2))*ot;
443 0 : if (timediff>deltaTime) continue; //timediff outside time window
444 0 : if((int1&int2) == -1){ //ignore both bits, just count IR-s within time window
445 0 : arr.Add((AliTriggerIR*)IR); //add this IR
446 0 : continue;
447 : }
448 : // now check if int1, int2 bits are set
449 0 : UInt_t nw = IR->GetNWord();
450 0 : Bool_t *bint1 = IR->GetInt1s();
451 0 : Bool_t *bint2 = IR->GetInt2s();
452 : //
453 : Int_t flag1,flag2;
454 : flag1=0;
455 : flag2=0;
456 0 : for(UInt_t j=0;j<nw;j++){//2
457 0 : if(bint1[j]) flag1=1; // at least one int1 set
458 0 : if(bint2[j]) flag2=1; // at least one int2 set
459 : }//2
460 : // checking combinations
461 : //
462 0 : if((flag1*int1*flag2*int2)==1){// int1=1 & int2=1
463 0 : arr.Add((AliTriggerIR*)IR); //add this IR
464 0 : continue;
465 : }
466 0 : if(int1 == -1){// ignore int1
467 0 : if(flag2&int2){// int2=1
468 0 : arr.Add((AliTriggerIR*)IR); //add this IR
469 0 : continue;
470 : }
471 0 : else if (!flag2&!int2){ //int2=0
472 0 : arr.Add((AliTriggerIR*)IR); //add this IR
473 0 : continue;
474 : }
475 : }
476 0 : if(int2 ==-1){//ignore int2
477 0 : if(flag1&int1){//int1=1
478 0 : arr.Add((AliTriggerIR*)IR); //add this IR
479 0 : continue;
480 : }
481 0 : else if(!flag1&!int1){ //int1=0
482 0 : arr.Add((AliTriggerIR*)IR); //add this IR
483 0 : continue;
484 : }
485 : }
486 0 : if ((flag1*int1)&!flag2&!int2){// int1=1, int2=0
487 0 : arr.Add((AliTriggerIR*)IR); //add this IR
488 0 : continue;
489 : }
490 0 : if ((int2*flag2)&!int1&!flag1){// int1=0, int2=1
491 0 : arr.Add((AliTriggerIR*)IR); //add this IR
492 0 : continue;
493 : }
494 :
495 0 : }//1
496 :
497 : return arr;
498 0 : }
499 :
500 : //__________________________________________________________________________
501 : void AliESDHeader::SetIRInteractionMap() const
502 : {
503 : //
504 : // Function to compute the map of interations
505 : // within 0TVX (int2) or V0A&V0C (int1) and the Event Id
506 : // Note, the zero value is excluded
507 : //
508 32 : const AliTriggerIR *ir[5] = {GetTriggerIR(0),GetTriggerIR(1),GetTriggerIR(2),GetTriggerIR(3),GetTriggerIR(4)};
509 :
510 16 : Long64_t orb = (Long64_t)GetOrbitNumber();
511 16 : Long64_t bc = (Long64_t)GetBunchCrossNumber();
512 :
513 16 : Long64_t evId = orb*3564 + bc;
514 :
515 192 : for(Int_t i = 0; i < 5; ++i) {
516 80 : if (ir[i] == NULL || ir[i]->GetNWord() == 0) continue;
517 0 : Long64_t irOrb = (Long64_t)ir[i]->GetOrbit();
518 0 : Bool_t* int2 = ir[i]->GetInt2s();
519 0 : Bool_t* int1 = ir[i]->GetInt1s();
520 0 : UShort_t* bcs = ir[i]->GetBCs();
521 0 : for(UInt_t nW = 0; nW < ir[i]->GetNWord(); ++nW) {
522 0 : Long64_t intId = irOrb*3564 + (Long64_t)bcs[nW];
523 0 : if (int2[nW] == kTRUE) {
524 0 : Int_t item = (intId-evId);
525 0 : Int_t bin = FindIRIntInteractionsBXMap(item);
526 0 : if(bin>=0) {
527 0 : fIRInt2InteractionsMap.SetBitNumber(bin,kTRUE);
528 0 : }
529 0 : }
530 0 : if (int1[nW] == kTRUE) {
531 0 : Int_t item = (intId-evId);
532 0 : Int_t bin = FindIRIntInteractionsBXMap(item);
533 0 : if(bin>=0) {
534 0 : fIRInt1InteractionsMap.SetBitNumber(bin,kTRUE);
535 0 : }
536 0 : }
537 : }
538 0 : }
539 :
540 16 : fIRInt2InteractionsMap.Compact();
541 16 : fIRInt1InteractionsMap.Compact();
542 16 : }
543 :
544 : //__________________________________________________________________________
545 : Int_t AliESDHeader::FindIRIntInteractionsBXMap(Int_t difference) const
546 : {
547 : //
548 : // The mapping is of 181 bits, from -90 to +90
549 : //
550 : Int_t bin=-1;
551 :
552 0 : if(difference<-90 || difference>90) return bin;
553 0 : else { bin = 90 + difference; }
554 :
555 0 : return bin;
556 0 : }
557 :
558 : //__________________________________________________________________________
559 : Int_t AliESDHeader::GetIRInt2ClosestInteractionMap() const
560 : {
561 : //
562 : // Calculation of the closest interaction
563 : //
564 0 : SetIRInteractionMap();
565 :
566 : Int_t firstNegative=100;
567 0 : for(Int_t item=-1; item>=-90; item--) {
568 0 : Int_t bin = FindIRIntInteractionsBXMap(item);
569 0 : Bool_t isFired = fIRInt2InteractionsMap.TestBitNumber(bin);
570 0 : if(isFired) {
571 : firstNegative = item;
572 0 : break;
573 : }
574 0 : }
575 : Int_t firstPositive=100;
576 0 : for(Int_t item=1; item<=90; item++) {
577 0 : Int_t bin = FindIRIntInteractionsBXMap(item);
578 0 : Bool_t isFired = fIRInt2InteractionsMap.TestBitNumber(bin);
579 0 : if(isFired) {
580 : firstPositive = item;
581 0 : break;
582 : }
583 0 : }
584 :
585 0 : Int_t closest = firstPositive < TMath::Abs(firstNegative) ? firstPositive : TMath::Abs(firstNegative);
586 0 : if(firstPositive==100 && firstNegative==100) closest=0;
587 0 : return closest;
588 : }
589 :
590 : //__________________________________________________________________________
591 : Int_t AliESDHeader::GetIRInt1ClosestInteractionMap(Int_t gap) const
592 : {
593 : //
594 : // Calculation of the closest interaction
595 : // In case of VZERO (Int1) one has to introduce a gap
596 : // in order to avoid false positivies from after-pulses
597 :
598 0 : SetIRInteractionMap();
599 :
600 : Int_t firstNegative=100;
601 0 : for(Int_t item=-1; item>=-90; item--) {
602 0 : Int_t bin = FindIRIntInteractionsBXMap(item);
603 0 : Bool_t isFired = fIRInt1InteractionsMap.TestBitNumber(bin);
604 0 : if(isFired) {
605 : firstNegative = item;
606 0 : break;
607 : }
608 0 : }
609 : Int_t firstPositive=100;
610 0 : for(Int_t item=1+gap; item<=90; item++) {
611 0 : Int_t bin = FindIRIntInteractionsBXMap(item);
612 0 : Bool_t isFired = fIRInt1InteractionsMap.TestBitNumber(bin);
613 0 : if(isFired) {
614 : firstPositive = item;
615 0 : break;
616 : }
617 0 : }
618 :
619 0 : Int_t closest = firstPositive < TMath::Abs(firstNegative) ? firstPositive : TMath::Abs(firstNegative);
620 0 : if(firstPositive==100 && firstNegative==100) closest=0;
621 0 : return closest;
622 : }
623 :
624 : //__________________________________________________________________________
625 : Int_t AliESDHeader::GetIRInt2LastInteractionMap() const
626 : {
627 : //
628 : // Calculation of the last interaction
629 : //
630 0 : SetIRInteractionMap();
631 :
632 : Int_t lastNegative=0;
633 0 : for(Int_t item=-90; item<=-1; item++) {
634 0 : Int_t bin = FindIRIntInteractionsBXMap(item);
635 0 : Bool_t isFired = fIRInt2InteractionsMap.TestBitNumber(bin);
636 0 : if(isFired) {
637 : lastNegative = item;
638 0 : break;
639 : }
640 0 : }
641 : Int_t lastPositive=0;
642 0 : for(Int_t item=90; item>=1; item--) {
643 0 : Int_t bin = FindIRIntInteractionsBXMap(item);
644 0 : Bool_t isFired = fIRInt2InteractionsMap.TestBitNumber(bin);
645 0 : if(isFired) {
646 : lastPositive = item;
647 0 : break;
648 : }
649 0 : }
650 :
651 0 : Int_t last = lastPositive > TMath::Abs(lastNegative) ? lastPositive : TMath::Abs(lastNegative);
652 0 : return last;
653 : }
|