AliRoot Core  3dc7879 (3dc7879)
AliTriggerRunScalers.cxx
Go to the documentation of this file.
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 /* $Id: AliTriggerRunScalers.cxx 22322 2007-11-22 11:43:14Z cvetan $ */
17 
19 //
20 // Class to define the ALICE Trigger Scalers Record per Run.
21 // ReadScalers():
22 // read the txt file (rXXXX.cnt) provided by CTP and creates array of records.
23 // Saves resuly without any corrections as 32 bit words in AliTriggerScaler.
24 // ReadScalers called by AliGRPPreprocessor , result saved in OCDB.
25 // CorrectScalersOverflow():
26 // correct 32 bit counter words for overflow and saves them as 64 bit words AliTriggerRecordESD
27 // Called in AliReconstruction/
28 // ConsistencyCheck():
29 // checks if the last scaler added to record is consistent,
30 // i.e. time increases and valued are not decreasing in time.
31 //
32 //
34 
35 #include <stdlib.h>
36 #include <Riostream.h>
37 
38 //#include <TObject.h>
39 //#include <TArrayC.h>
40 //#include <TFile.h>
41 #include <TClass.h>
42 #include <TSystem.h>
43 #include <TObjString.h>
44 #include <TObjArray.h>
45 #include <TMath.h>
46 #include <TGraphErrors.h>
47 
48 #include "AliLog.h"
49 #include "AliTimeStamp.h"
50 #include "AliTriggerScalers.h"
51 #include "AliTriggerScalersESD.h"
54 #include "AliTriggerRunScalers.h"
56 #include "AliTriggerClass.h"
57 #include "AliTriggerBCMask.h"
58 
59 using std::endl;
60 using std::cout;
61 using std::ifstream;
62 ClassImp( AliTriggerRunScalers )
63 
64 //_____________________________________________________________________________
66  TObject(),
67  fVersion(0),
68  fRunNumber(0),
69  fnClasses(0),
70  fClassIndex(),
71  fScalersRecord(),
72  fScalersRecordESD()
73 {
74  // Default constructor
75 }
76 //______________________________________________________________________________
78 {
79  // Destructor
80  fScalersRecord.SetOwner();
81  fScalersRecord.Delete();
82  fScalersRecordESD.SetOwner();
83  fScalersRecordESD.Delete();
84 }
85 //_____________________________________________________________________________
87 {
88  // Add scaler and check consistency
89  fScalersRecord.AddLast( scaler );
90  UInt_t* overflow[8];
91  for(Int_t i=0; i<8; i++) {
92  overflow[i] = new UInt_t[fnClasses];
93  for(Int_t j=0; j<fnClasses; j++) overflow[i][j] = 0;
94  }
95  if (AliTriggerRunScalers::ConsistencyCheck(fScalersRecord.GetEntriesFast()-1,kFALSE,overflow)){
96  AliErrorClass("Trigger counters not in the right order or decreasing!");
97  // scaler->Print();
98  // fScalersRecord.Sort();
99  }
100  for(Int_t i=0; i<8; i++) {
101  delete overflow[i];
102  }
103 }
104 //_____________________________________________________________________________
105 
107  TObject(),
108  fVersion(run.fVersion),
109  fRunNumber(run.fRunNumber),
110  fnClasses(run.fnClasses),
111  fClassIndex(),
112  fScalersRecord(),
114 {
115 // copy constructor
116  fClassIndex.Set(run.fClassIndex.GetSize());
117 for (Int_t i = 0; i < run.fClassIndex.GetSize(); i++) {
118  if (run.fClassIndex[i]) fClassIndex.AddAt(run.fClassIndex[i], i);
119  }
120 for (Int_t i = 0; i < run.fScalersRecord.GetEntriesFast(); i++) {
121  if (run.fScalersRecord[i]) fScalersRecord.Add(run.fScalersRecord[i]->Clone());
122  }
123 for (Int_t i = 0; i < run.fScalersRecordESD.GetEntriesFast(); i++) {
124  if (run.fScalersRecordESD[i]) fScalersRecordESD.Add(run.fScalersRecordESD[i]->Clone());
125  }
126 
127 }
128 //_____________________________________________________________________________
130 {
131 // assignment operator
132 if(&run == this) return *this;
133 ((TObject *)this)->operator=(run);
134 
135 fVersion = run.fVersion;
136 fRunNumber = run.fRunNumber;
137 fnClasses = run.fnClasses;
138 
139 for (Int_t i = 0; i < run.fClassIndex.GetSize(); i++) {
140  if (run.fClassIndex[i]) fClassIndex.AddAt(run.fClassIndex[i], i);
141  }
142 for (Int_t i = 0; i < run.fScalersRecord.GetEntriesFast(); i++) {
143  if (run.fScalersRecord[i]) fScalersRecord.Add(run.fScalersRecord[i]->Clone());
144  }
145 for (Int_t i = 0; i < run.fScalersRecordESD.GetEntriesFast(); i++) {
146  if (run.fScalersRecordESD[i]) fScalersRecordESD.Add(run.fScalersRecordESD[i]->Clone());
147  }
148 return *this;
149 }
150 //_____________________________________________________________________________
152 {
153  // Read scalers from text file(.cnt) provided by CTP
154  // for given run and convert it to root format
155  if( gSystem->AccessPathName( filename.Data() ) ) {
156  AliErrorClass( Form( "file (%s) not found", filename.Data() ) );
157  return NULL;
158  }
159 
160  ifstream *file = new ifstream ( filename.Data() );
161  if (!*file) {
162  AliErrorClass(Form("Error opening file (%s) !",filename.Data()));
163  file->close();
164  delete file;
165  return NULL;
166  }
167 
169 
170  TString strLine;
171  Bool_t verflag = kFALSE;
172  Bool_t classflag = kFALSE;
173  Bool_t run2=kFALSE;
174  UChar_t nclass = 0;
175  while (strLine.ReadLine(*file)) {
176  if (strLine.BeginsWith("#")) continue;
177 
178  TObjArray *tokens = strLine.Tokenize(" \t");
179  Int_t ntokens = tokens->GetEntriesFast();
180  // 1st line, version, it is one number,
181  if (!verflag) {
182  if (ntokens != 1) {
183  AliErrorClass( Form( "Error reading version number from (%s), line :%s",
184  filename.Data() , strLine.Data() ) );
185  delete tokens;
186  return NULL;
187  }
188  // cout << "Version "<< ((TObjString*)tokens->At(0))->String().Atoi() << endl;
189  Short_t version= ((TObjString*)tokens->At(0))->String().Atoi();
190  rScaler->SetVersion( version );
191  verflag = kTRUE;
192  if(version > 2) run2=kTRUE;
193  delete tokens;
194  continue;
195  }
196 
197  // 2nd line, run number , number of classes, list of classes used in this partition
198 
199  if (!classflag) {
200  if ( !((TObjString*)tokens->At(1))->String().IsDigit() ) {
201  AliErrorClass( Form( "Error reading Run number from (%s)", filename.Data() ));
202  }
203  // cout << "Run Number " << ((TObjString*)tokens->At(0))->String().Atoi() << endl;
204  rScaler->SetRunNumber( ((TObjString*)tokens->At(0))->String().Atoi() );
205  nclass = (UChar_t)((TObjString*)tokens->At(1))->String().Atoi();
206  // cout << "Number of classes " << nclass << endl;
207  rScaler->SetNumClasses( nclass );
208  if ( nclass != ntokens - 2 ) {
209  AliErrorClass( Form( "Error reading number of classes from (%s)", filename.Data() ));
210  return NULL;
211  }
212  for (UChar_t i=0; i<nclass; ++i) {
213  rScaler->SetClass( i, (Char_t)((TObjString*)tokens->At(2+i))->String().Atoi() );
214  }
215  classflag = kTRUE;
216  delete tokens;
217  continue;
218  }
219 
220  // Records
221  // Each record consists of 1+(number of classes in partition) lines
222  // 1st line of record = time stamp (4 words)
223  // 1st word = ORBIT(24 bits)
224  // 2nd word = Period Counter (28 bit)
225  // 3rd word = seconds (32 bits) from epoch
226  // 4th word = microsecs (32 bits)
227  // other lines = 6 words of counters (L0 before,L0 after, ....)
228  if (ntokens != 4 && ntokens !=5) {
229  AliErrorClass( Form( "Error reading timestamp from (%s): line (%s)",
230  filename.Data(), strLine.Data() ));
231  return NULL;
232  }
233 
234  UInt_t orbit = strtoul(((TObjString*)tokens->At(0))->String(), NULL, 10);
235  UInt_t period = strtoul(((TObjString*)tokens->At(1))->String(), NULL, 10);
236  UInt_t seconds = strtoul(((TObjString*)tokens->At(2))->String(), NULL, 10);
237  UInt_t microSecs = strtoul(((TObjString*)tokens->At(3))->String(), NULL, 10);
238 
240  if(ntokens==5){
241  UInt_t tgroup=strtoul(((TObjString*)tokens->At(4))->String(), NULL, 10);
242  rec->SetTimeGroup(tgroup);
243  }
244  rec->SetTimeStamp( orbit, period, seconds, microSecs );
245  TString strLine1;
246  for (Int_t i=0; i<nclass; ++i) {
247  strLine1.ReadLine(*file);
248  if (strLine1.BeginsWith("#")) continue;
249  TObjArray *tokens1 = strLine1.Tokenize(" \t");
250  Int_t ntokens1 = tokens1->GetEntriesFast();
251  // Wrong number of classes
252  Bool_t err = run2 || (ntokens1 !=6);
253  err = err && (!run2 || (ntokens1 != 8));
254  if(err) {
255  AliErrorClass( Form( "Error reading scalers from (%s): line (%s): ntokens=%i",
256  filename.Data(), strLine1.Data(),ntokens1 ));
257  delete rec;
258  delete tokens1;
259  //return rScaler;
260  return 0;
261  }
262 
263  UInt_t lOCB = strtoul(((TObjString*)tokens1->At(0))->String(), NULL, 10);
264  UInt_t lOCA = strtoul(((TObjString*)tokens1->At(1))->String(), NULL, 10);
265  UInt_t l1CB = strtoul(((TObjString*)tokens1->At(2))->String(), NULL, 10);
266  UInt_t l1CA = strtoul(((TObjString*)tokens1->At(3))->String(), NULL, 10);
267  UInt_t l2CB = strtoul(((TObjString*)tokens1->At(4))->String(), NULL, 10);
268  UInt_t l2CA = strtoul(((TObjString*)tokens1->At(5))->String(), NULL, 10);
269  if(run2){
270  UInt_t lMCB = strtoul(((TObjString*)tokens1->At(6))->String(), NULL, 10);
271  UInt_t lMCA = strtoul(((TObjString*)tokens1->At(7))->String(), NULL, 10);
272  rec->AddTriggerScalers( rScaler->GetClass(i),
273  lOCB, lOCA, l1CB,
274  l1CA, l2CB, l2CA, lMCB, lMCA );
275  }else{
276  rec->AddTriggerScalers( rScaler->GetClass(i),
277  lOCB, lOCA, l1CB,
278  l1CA, l2CB, l2CA );
279  }
280  delete tokens1;
281  }
282  rScaler->AddTriggerScalers( rec );
283 
284  delete tokens;
285  }
286  file->close();
287  delete file;
288 
289  return rScaler;
290 }
291 
292 //_____________________________________________________________________________
294 {
295  // Find Trigger scaler record with the closest timestamp <= "stamp"
296  // using a binary search.
297  // return the index in the array of records, if the timestamp
298  // is out of range return -1
299 
300  Int_t base, position=-1, last, result = 0;
301  Int_t op2 = 0;
302 
303  //fScalersRecord.Sort();
304 
305  base = 0;
306  last = fScalersRecord.GetEntriesFast();
307 
308  while (last >= base) {
309  position = (base+last) / 2;
310  AliDebug(1, Form("position= %d base= %d last= %d ",position,base,last));
312  if( rec && rec->GetTimeStamp()) op2 = 1;
313  if( op2 && (result = stamp->Compare(rec->GetTimeStamp())) == 0 )
314  return position; // exact match
315  if (!op2 || result < 0)
316  last = position-1;
317  else
318  base = position+1;
319  op2 = 0;
320  }
321  if( (position == 0 && result < 0) || position >= fScalersRecord.GetEntriesFast() )
322  return -1; // out of range
323  else
324  return (result < 0 ) ? position-1 : position; // nearst < stamp
325 }
326 //_____________________________________________________________________________
327 Int_t AliTriggerRunScalers::ConsistencyCheck(Int_t position,Bool_t correctOverflow, UInt_t** overflow)
328 {
329  //Check if counters are consistent(increase). Example: lOCB(n) < lOCB(n+1) and lOCB > lOCA
330  // scalers coding 0,1,2,3,4,5=0b,0a,1b,1a,2b,2a
331  // returns:
332  // 1 = decresing time
333  // 2 = too big jump in scalers, looks like some readings are missing
334  // 3 = (level+1) > (level)
335  if (position == 0){
336  if(correctOverflow){
337  AliErrorClass("Position=0 not alowed as comparison with previous record not possible");
338  return 1;
339  }else return 0; // to work correctly in AddScalers
340  };
341  UInt_t ovflow[8]; // Overflow for last pair of counters
342  Int_t nlevels=6;
343  if(fVersion>2) nlevels=8;
344  UInt_t c2[8], c1[8];
345  ULong64_t c64[6];
346  ULong64_t c1_64[8],c2_64[8];
347  ULong64_t const max1 = 4294967296ul; //32bit counters overflow after 4294967296
348  ULong64_t const max2 = 1000000000ul; //when counters overflow they seem to be decreasing. Assume decrease cannot be smaller than max2.
349 
352  if (scalers2->Compare((AliTriggerScalersRecord*)fScalersRecord.At(position-1)) == -1){
353  AliError("Records time decreases.");
354  return 1;
355  }
356 
357  AliTriggerScalersRecordESD* recESD = 0;
358  // Create overflow corrected record
359  if(correctOverflow){
360  recESD = new AliTriggerScalersRecordESD();
361  recESD->SetTimeStamp(scalers2->GetTimeStamp());
362  recESD->SetTimeGroup(scalers2->GetTimeGroup());
363  }
364  // Consistency check
365  for( Int_t ic=0; ic<fnClasses; ++ic ){
366  for(Int_t i=0;i<8;i++)ovflow[i]=0;
367  TObjArray* scalersArray2 = (TObjArray*)scalers2->GetTriggerScalers();
368  AliTriggerScalers* counters2 = (AliTriggerScalers*)scalersArray2->At(ic);
369  UChar_t iclass = counters2->GetClassIndex();
370  if(fVersion>2)counters2->GetAllScalersM012(c2); else counters2->GetAllScalers(c2);
371  TObjArray* scalersArray1 = (TObjArray*)scalers1->GetTriggerScalers();
372  AliTriggerScalers* counters1 = (AliTriggerScalers*)scalersArray1->At(ic);
373  if(fVersion>2)counters1->GetAllScalersM012(c1); else counters1->GetAllScalers(c1);
374  for(Int_t i=0;i<(nlevels);i++){
375  if ( c2[i] >= c1[i] ) continue;
376  //else if ( c2[i] < c1[i] && (c1[i] - c2[i]) > max2) overflow[i][ic]++;
377  else if ( c2[i] < c1[i] && (c1[i] - c2[i]) > max2) ovflow[i]++;
378  else{
379  AliError("Decreasing count with time.");
380  AliError(Form("%d c2: %u c1[i] %u ",i,c2[i],c1[i]));
381  return 2;
382  }
383  //printf("i %i c2 %ul c1 %ul increase %i overflow %i \n",i,c2[i],c1[i],increase[i],overflow[i][ic]);
384  }
385  // Checking reletaive increase between 2 subsequent records
386  // Counters in one record can decrease versus level
387  for(Int_t i=0;i<nlevels;i++){
388  c2_64[i]=c2[i]+max1*(overflow[i][ic]+ovflow[i]);
389  c1_64[i]=c1[i]+max1*overflow[i][ic];
390  }
391  for(Int_t i=0;i<(nlevels-1);i++){
392  if ((c2_64[i] - c1_64[i]) < (c2_64[i+1] - c1_64[i+1]) ) {
393  if ( ((c2_64[i+1] - c1_64[i+1]) - (c2_64[i] - c1_64[i])) < 16ull ) {AliDebugClass(1,"Trigger scaler Level[i+1] > Level[i]. Diff < 16!");}
394  else {
395  ULong64_t delta= (c2_64[i+1] - c1_64[i+1]) - (c2_64[i] - c1_64[i]);
396  // Difference for LMA a L0B can be bigger due to the way counters are read
397  if ((i != 1) || (delta>512ull)){
398  AliWarning(Form("Run %09lu (level+1)>level pos= %d i=%d",GetRunNumber(),position,i));
399  AliWarning(Form("%llu %llu %llu %llu delta: %llu",c1_64[i],c1_64[i+1],c2_64[i],c2_64[i+1],delta));
400  AliError("Diff too big");
401  return 1;
402  }
403  }
404  }
405  }
406  // Correct for overflow
407  if(correctOverflow){
408  for(Int_t i=0;i<8;i++)overflow[i][ic] += ovflow[i];
409  if(fVersion>2){for(Int_t i=0;i<6;i++){ c64[i]=c2[i+2]+max1*overflow[i+2][ic]; }}
410  else{for(Int_t i=0;i<6;i++){ c64[i]=c2[i]+max1*overflow[i][ic]; }}
411  AliTriggerScalersESD* s= new AliTriggerScalersESD(iclass,c64);
412  if(fVersion>2){
413  ULong64_t cLMB = c2[0]+max1*overflow[0][ic];
414  ULong64_t cLMA = c2[1]+max1*overflow[1][ic];
415  s->SetLMCB(cLMB);
416  s->SetLMCA(cLMA);
417  }
418  recESD->AddTriggerScalers(s);
419  }
420 
421  }
422  if(correctOverflow)fScalersRecordESD.AddLast(recESD);
423  return 0;
424 }
425 //____________________________________________________________________________
427 {
428  // Run over fScalersRecord, check overflow using CheckConsistency methos
429  // and save corrected result in fScalersRecordESD.
430 
431  // Temporary fix for the OCDB entries written with v4-16-Release
432  // where the wrong sorting was used
433  fScalersRecord.Sort();
434  UInt_t c1[8];
435  ULong64_t c64[8];
437  // add 0
438  if (!fScalersRecord.GetEntriesFast()) {
439  AliError("Scalers record array is empty");
440  return 0;
441  }
443 
444  recESD->SetTimeStamp(scalers->GetTimeStamp());
445  recESD->SetTimeGroup(scalers->GetTimeGroup());
446  // Create ESD scalers, i.e. ULong64_t, next correct for overflow
447  for( Int_t ic=0; ic<fnClasses; ++ic ){
448  TObjArray* scalersArray = (TObjArray*)scalers->GetTriggerScalers();
449  AliTriggerScalers* counters = (AliTriggerScalers*)scalersArray->At(ic);
450  if(fVersion>2)counters->GetAllScalersM012(c1); else counters->GetAllScalers(c1);
451  UChar_t iclass = counters->GetClassIndex();
452  if(fVersion>2){
453  for(Int_t i=0; i<6; i++)c64[i]=c1[i+2];
454  }else{
455  for(Int_t i=0; i<6; i++)c64[i]=c1[i];
456  }
457  AliTriggerScalersESD* s= new AliTriggerScalersESD(iclass,c64);
458  if(fVersion>2){
459  s->SetLMCB(counters->GetLMCB());
460  s->SetLMCA(counters->GetLMCA());
461  }
462  recESD->AddTriggerScalers(s);
463  }
464  fScalersRecordESD.AddLast(recESD);
465  // Correct for overflow
466  UInt_t* overflow[8];
467  for(Int_t i=0; i<8; i++) {
468  overflow[i] = new UInt_t[fnClasses];
469  for(Int_t j=0; j<fnClasses; j++) overflow[i][j] = 0;
470  }
471 
472  for(Int_t i=1;i<fScalersRecord.GetEntriesFast(); i++){
473  if(ConsistencyCheck(i,kTRUE,overflow)){
474  StdoutToAliError(fScalersRecord.At(i)->Print(); fScalersRecord.At(i-1)->Print(););
475  fScalersRecordESD.SetOwner();
476  fScalersRecordESD.Delete();
477  AliErrorClass("Inconsistent scalers, they will not be provided.");
478  for(Int_t i=0; i<8; i++)delete overflow[i];
479  return 1;
480  }
481  }
482  for(Int_t i=0; i<8; i++)delete[] overflow[i];
483  if(fScalersRecordESD.GetEntriesFast() != fScalersRecord.GetEntriesFast()){
484  AliErrorClass("Internal error: #scalers ESD != #scalers ");
485  return 1;
486  }
487  return 0;
488 }
489 //_____________________________________________________________________________
491 {
492  // Find scalers for event for class in fScalersRecordESD
493  // Assumes that fScalerRecord = fScalerRecordESD
494  Int_t position = FindNearestScalersRecord(stamp);
495  if ( position == -1 ) {
496  AliErrorClass("Event AliTimeStamp out of range!");
497  return 0;
498  }
499  // check also position=max
502  TObjArray* scalers1 = (TObjArray*)scalrec1->GetTriggerScalers();
503  TObjArray* scalers2 = (TObjArray*)scalrec2->GetTriggerScalers();
504 
505  if(scalers1->GetEntriesFast() != fnClasses){
506  AliErrorClass("Internal error: #classes in RecordESD != fnClasses");
507  return 0;
508  }
509 
510  AliTriggerScalersESD *s1,*s2;
511  for ( Int_t ic=0; ic < (Int_t)fnClasses; ++ic ){
512 
513  s1 = (AliTriggerScalersESD*)scalers1->At(ic);
514  s2 = (AliTriggerScalersESD*)scalers2->At(ic);
515 
516  Bool_t classfound = (s1->GetClassIndex() == classIndex) && (s2->GetClassIndex() == classIndex);
517  if(classfound){
518  ULong64_t max = 16777216ul;
520  TObjArray* scalers0 = (TObjArray*)scalrec0->GetTriggerScalers();
521  AliTriggerScalersESD *s0 = (AliTriggerScalersESD*)scalers0->At(ic);
522  ULong64_t base[6],c1[6],c2[6],cint[6];
523  ULong64_t orbit = max*(stamp->GetPeriod()) + stamp->GetOrbit();
524  s0->GetAllScalers(base);
525  s1->GetAllScalers(c1);
526  s2->GetAllScalers(c2);
527  ULong64_t orbit1 = max*(scalrec1->GetTimeStamp()->GetPeriod())+scalrec1->GetTimeStamp()->GetOrbit();
528  ULong64_t orbit2 = max*(scalrec2->GetTimeStamp()->GetPeriod())+scalrec2->GetTimeStamp()->GetOrbit();
529  for(Int_t i=0;i<6;i++){
530  Double_t slope=Double_t(c2[i]-c1[i])/Double_t(orbit2-orbit1);
531  cint[i]=ULong64_t(slope*(orbit-orbit1)) +c1[i] -base[i];
532  }
533  AliTriggerScalersESD* result = new AliTriggerScalersESD(classIndex,cint);
534  return result;
535  }
536  }
537  AliErrorClass(Form("Classindex %i not found.",classIndex));
538  return 0;
539 }
540 
541 //_____________________________________________________________________________
543 {
544  // Find scalers for event for class in fScalersRecordESD
545  // Assumes that fScalerRecord = fScalerRecordESD
546  Int_t position = FindNearestScalersRecord(stamp);
547  if ( position == -1 ) {
548  AliErrorClass("Event AliTimeStamp out of range!");
549  return 0;
550  }
551  // check also position=max
552  if (fScalersRecordESD.GetEntriesFast()<2) return 0;
553 
556  TObjArray* scalers1 = (TObjArray*)scalrec1->GetTriggerScalers();
557  TObjArray* scalers2 = (TObjArray*)scalrec2->GetTriggerScalers();
558 
559  if(scalers1->GetEntriesFast() != fnClasses){
560  AliErrorClass("Internal error: #classes in RecordESD != fnClasses");
561  return 0;
562  }
564  AliTriggerScalersESD *s1,*s2;
565  for ( Int_t ic=0; ic < (Int_t)fnClasses; ++ic ){
566 
567  s1 = (AliTriggerScalersESD*)scalers1->At(ic);
568  s2 = (AliTriggerScalersESD*)scalers2->At(ic);
569 
570  ULong64_t c1[6],c2[6],cint[6];
571  s1->GetAllScalers(c1);
572  s2->GetAllScalers(c2);
573  for(Int_t i=0;i<6;i++){
574  cint[i]=c2[i]-c1[i];
575  }
576  AliTriggerScalersESD* result = new AliTriggerScalersESD(s1->GetClassIndex(),cint);
577  scalrec->AddTriggerScalers(result);
578  }
579  UInt_t max = 16777216ul;
580  UInt_t orbit, period;
581 
582  if (scalrec2->GetTimeStamp()->GetOrbit() > scalrec1->GetTimeStamp()->GetOrbit()) {
583  orbit = scalrec2->GetTimeStamp()->GetOrbit() - scalrec1->GetTimeStamp()->GetOrbit();
584  period = scalrec2->GetTimeStamp()->GetPeriod() - scalrec1->GetTimeStamp()->GetPeriod();
585  }
586  else {
587  orbit = max - (scalrec1->GetTimeStamp()->GetOrbit() - scalrec2->GetTimeStamp()->GetOrbit());
588  period = scalrec2->GetTimeStamp()->GetPeriod() - scalrec1->GetTimeStamp()->GetPeriod() - 1;
589  }
590 
591  AliTimeStamp *timestamp = new AliTimeStamp(orbit, period, 0);
592  scalrec->SetTimeStamp(timestamp);
593  delete timestamp;
594  return scalrec;
595 }
596 //_____________________________________________________________________________
598 {
599  // Find scalers for event for class in fScalersRecordESD
600  // Assumes that fScalerRecord = fScalerRecordESD
601  if (fScalersRecordESD.GetEntriesFast()<2) return 0;
602 
605  TObjArray* scalers1 = (TObjArray*)scalrec1->GetTriggerScalers();
606  TObjArray* scalers2 = (TObjArray*)scalrec2->GetTriggerScalers();
607 
608  if(scalers1->GetEntriesFast() != fnClasses){
609  AliErrorClass("Internal error: #classes in RecordESD != fnClasses");
610  return 0;
611  }
612  AliTriggerScalersESD *s1,*s2;
614  for ( Int_t ic=0; ic < (Int_t)fnClasses; ++ic ){
615 
616  s1 = (AliTriggerScalersESD*)scalers1->At(ic);
617  s2 = (AliTriggerScalersESD*)scalers2->At(ic);
618 
619  ULong64_t c1[6],c2[6],cint[6];
620  s1->GetAllScalers(c1);
621  s2->GetAllScalers(c2);
622  for(Int_t i=0;i<6;i++){
623  cint[i]=c2[i]-c1[i];
624  }
625  AliTriggerScalersESD* result = new AliTriggerScalersESD(s1->GetClassIndex(),cint);
626  scalrec->AddTriggerScalers(result);
627  }
628  UInt_t max = 16777216ul;
629  UInt_t orbit, period;
630 
631  if (scalrec2->GetTimeStamp()->GetOrbit() > scalrec1->GetTimeStamp()->GetOrbit()) {
632  orbit = scalrec2->GetTimeStamp()->GetOrbit() - scalrec1->GetTimeStamp()->GetOrbit();
633  period = scalrec2->GetTimeStamp()->GetPeriod() - scalrec1->GetTimeStamp()->GetPeriod();
634  }
635  else {
636  orbit = max - (scalrec1->GetTimeStamp()->GetOrbit() - scalrec2->GetTimeStamp()->GetOrbit());
637  period = scalrec2->GetTimeStamp()->GetPeriod() - scalrec1->GetTimeStamp()->GetPeriod() - 1;
638  }
639 
640  AliTimeStamp *timestamp = new AliTimeStamp(orbit, period, 0);
641  scalrec->SetTimeStamp(timestamp);
642  delete timestamp;
643  return scalrec;
644 }
645 //_____________________________________________________________________________
646 Bool_t AliTriggerRunScalers::CalculateMu(Double_t &mu, Double_t &errmu, ULong64_t countsB, ULong64_t countsAC, UShort_t nB, UShort_t nAC, UInt_t orbits, Bool_t bkgCorr, Double_t triggerEff, Double_t errorEff)
647 {
648 
649  if (nB!=0 && orbits!=0) {
650  Double_t pB = (Double_t)countsB/((ULong64_t)nB*orbits); // probability for B trigger
651  if (!bkgCorr || nAC==0 ) {
652  mu = -log(1-pB)/triggerEff;
653  errmu = TMath::Sqrt(pB/((1-pB)*nB*orbits) + mu*mu*errorEff*errorEff/(triggerEff*triggerEff)); //
654  return kTRUE;
655  }
656  else
657  {
658  Double_t pAC = (Double_t)countsAC/((ULong64_t)nAC*orbits); // probability for AC trigger (background)
659  mu = ( log(1.-pAC) - log(1.-pB) )/triggerEff;
660  // error
661  errmu = TMath::Sqrt(pB/((1.-pB)*nB*orbits) + pAC/((1.-pAC)*nAC*orbits) /*- 2*TMath::Sqrt(pB*pAC/(nB*nAC*(1.-pB)*(1.-pAC)))/orbits*/ + mu*mu*errorEff*errorEff/(triggerEff*triggerEff)); // assume no correlation between B and AC rates, hence no cov term in error
662  return kTRUE;
663  }
664  }
665  return kFALSE;
666 }
667 //_____________________________________________________________________________
668 Bool_t AliTriggerRunScalers::CalculateMu(Double_t &mu, Double_t &errmu, ULong64_t countsB, ULong64_t countsAC, ULong64_t beamB, UShort_t nB, UShort_t nAC, Bool_t bkgCorr, Double_t triggerEff, Double_t errorEff)
669 {
670 
671  if (beamB!=0) {
672  Double_t pB = (Double_t)countsB/beamB; // probability for B trigger
673  if (!bkgCorr || nAC==0 || nB==0) {
674  mu = -log(1-pB)/triggerEff;
675  errmu = TMath::Sqrt(pB/((1-pB)*beamB) + mu*mu*errorEff*errorEff/(triggerEff*triggerEff)); //
676  return kTRUE;
677  }
678  else
679  {
680  Double_t pAC = (Double_t)countsAC/((ULong64_t)nAC*beamB/(Double_t)nB); // probability for AC trigger (background)
681  mu = ( log(1-pAC) - log(1-pB) )/triggerEff;
682  // error
683  errmu = TMath::Sqrt(pB/((1-pB)*beamB) + pAC/((1-pAC)*nAC*beamB/nB) + mu*mu*errorEff*errorEff/(triggerEff*triggerEff));
684  return kTRUE;
685  }
686  }
687  return kFALSE;
688 }
689 //_____________________________________________________________________________
690 ULong64_t AliTriggerRunScalers::GetDeltaScaler(const AliTriggerScalersRecordESD* scalRec1, const AliTriggerScalersRecordESD* scalRec2, Int_t classIndex, TString level)
691 {
692  const AliTriggerScalersESD* scalers1 = scalRec1->GetTriggerScalersForClass(classIndex);
693  const AliTriggerScalersESD* scalers2 = scalRec2->GetTriggerScalersForClass(classIndex);
694  ULong64_t s1=0;
695  ULong64_t s2=0;
696 
697  if (level == "l0b") {s1=scalers1->GetLOCB(); s2=scalers2->GetLOCB();}
698  else if (level == "l0a") {s1=scalers1->GetLOCA(); s2=scalers2->GetLOCA();}
699  else if (level == "l1b") {s1=scalers1->GetL1CB(); s2=scalers2->GetL1CB();}
700  else if (level == "l1a") {s1=scalers1->GetL1CA(); s2=scalers2->GetL1CA();}
701  else if (level == "l2b") {s1=scalers1->GetL2CB(); s2=scalers2->GetL2CB();}
702  else if (level == "l2a") {s1=scalers1->GetL2CA(); s2=scalers2->GetL2CA();}
703  else return 0;
704 
705  return s2-s1;
706 }
707 //_____________________________________________________________________________
709 {
710  const AliTimeStamp* stamp1 = scalRec1->GetTimeStamp();
711  const AliTimeStamp* stamp2 = scalRec2->GetTimeStamp();
712  UInt_t orbit1 = stamp1->GetOrbit();
713  UInt_t orbit2 = stamp2->GetOrbit();
714  UInt_t period1 = stamp1->GetPeriod();
715  UInt_t period2 = stamp2->GetPeriod();
716  UInt_t max = 16777216; // The period counter increases when 24 bit orbit counter overflow
717  Double_t orbitSec = 89.1*1.e-6; // Length of 1 orbit in seconds
718  return ((period2 - period1)*max + (orbit2-orbit1))*orbitSec;
719 }
720 //_____________________________________________________________________________
722 {
723  const AliTimeStamp* stamp1 = scalRec1->GetTimeStamp();
724  const AliTimeStamp* stamp2 = scalRec2->GetTimeStamp();
725  UInt_t orbit1 = stamp1->GetOrbit();
726  UInt_t orbit2 = stamp2->GetOrbit();
727  UInt_t period1 = stamp1->GetPeriod();
728  UInt_t period2 = stamp2->GetPeriod();
729  UInt_t max = 16777216; // The period counter increases when 24 bit orbit counter overflow
730  return (period2 - period1)*max + (orbit2-orbit1);
731 }
732 //_____________________________________________________________________________
733 Bool_t AliTriggerRunScalers::GetScalerRate(Double_t &rate, Double_t &error, const AliTriggerScalersRecordESD* scalRec1, const AliTriggerScalersRecordESD* scalRec2, Int_t classIndex, TString level)
734 {
735  if (level != "l0b" && level != "l0a" && level != "l1b" && level != "l1a" && level != "l2b" && level != "l2a") return kFALSE;
736 
737  ULong64_t scaler = GetDeltaScaler(scalRec1, scalRec2, classIndex, level);
738  Double_t time = GetDeltaTime(scalRec1, scalRec2 );
739  if (time==0.) return kFALSE;
740  rate = (Double_t)scaler/time;
741  error = (Double_t)sqrt(scaler)/time;
742  return kTRUE;
743 }
744 //_____________________________________________________________________________
745 Bool_t AliTriggerRunScalers::GetScalerRatePerBC(Double_t &rate, Double_t &error, const AliTriggerScalersRecordESD* scalRec1, const AliTriggerScalersRecordESD* scalRec2, AliTriggerConfiguration* cfg, Int_t classIndex, TString level)
746 {
747  if (level != "l0b" && level != "l0a" && level != "l1b" && level != "l1a" && level != "l2b" && level != "l2a") return kFALSE;
748  const AliTriggerClass* trgclass = cfg->GetTriggerClass(classIndex);
749  AliTriggerBCMask* bcMask = new AliTriggerBCMask();
750  if (trgclass) bcMask = (AliTriggerBCMask*)trgclass->GetBCMask();
751  Int_t nBC=0;
752  if (TString(bcMask->GetName()).CompareTo("NONE")!=0){
753  nBC = (UShort_t)bcMask->GetNUnmaskedBCs();
754  }
755  if (nBC<1) return kFALSE;
756  ULong64_t scaler = GetDeltaScaler(scalRec1, scalRec2, classIndex, level);
757  Double_t time = GetDeltaTime(scalRec1, scalRec2 );
758  if (time==0.) return kFALSE;
759  rate = (Double_t)scaler/time/nBC;
760  error = (Double_t)sqrt(scaler)/time/nBC;
761  return kTRUE;
762 }
763 //_____________________________________________________________________________
764 Bool_t AliTriggerRunScalers::GetClassL2L0(Double_t &l2l0, Double_t &error, const AliTriggerScalersRecordESD* scalRec1, const AliTriggerScalersRecordESD* scalRec2, Int_t classIndex)
765 {
766  ULong64_t l0 = GetDeltaScaler(scalRec1, scalRec2, classIndex, "l0b");
767  ULong64_t l2 = GetDeltaScaler(scalRec1, scalRec2, classIndex, "l2a");
768  if (l0!=0) {
769  l2l0 = (Double_t)l2/l0;
770  error = (Double_t)sqrt(l2-l2*l2/l0)/l0;
771  return kTRUE;
772  }
773  return kFALSE;
774 }
775 //_____________________________________________________________________________
776 Bool_t AliTriggerRunScalers::GetMuFromClassScaler(Double_t &mu, Double_t &errmu, const char* className, const AliTriggerScalersRecordESD* scalRec1, const AliTriggerScalersRecordESD* scalRec2, AliTriggerConfiguration* cfg, Bool_t colBCsFromFillScheme, Bool_t bkgCorr, Double_t triggerEff, Double_t errorEff)
777 {
778  // className = the first part of the class name. For example CINT1 for the class CINT1-B-NOPF-ALL
779  // colBCsFromFillScheme=kTRUE - use filling scheme and orbit counter
780  // colBCsFromFillScheme=kFALSE - use cbeamb scaler to get number of colliding BCs
781  // One can also switch background correction ON or OFF with bkgCorr
782  TObjArray cint1bNames;
783  TObjArray cint1acNames;
784  TObjArray cbeambNames;
785  //
786  cint1bNames.Add(new TNamed(Form("%s-ABCE",className),NULL));
787  cint1bNames.Add(new TNamed(Form("%s-B",className),NULL));
788  cint1acNames.Add(new TNamed(Form("%s-AC",className),NULL));
789  cbeambNames.Add(new TNamed("CBEAMB",NULL));
790  cbeambNames.Add(new TNamed("CTRUE",NULL));
791  //
792  Int_t cint1bIndex=-1, cint1acIndex=-1, cbeambIndex=-1;
793  TString nameString;
794  //
795  for (Int_t i=0; i<cfg->GetClasses().GetEntriesFast(); i++ ) {
796  nameString = cfg->GetClassNameFromIndex(i);
797  for (Int_t j=0; j<cint1bNames.GetEntriesFast(); j++ ) {
798  if (nameString.BeginsWith(cint1bNames.At(j)->GetName())) cint1bIndex = i;
799  }
800  for (Int_t j=0; j<cint1acNames.GetEntriesFast(); j++ ) {
801  if (nameString.BeginsWith(cint1acNames.At(j)->GetName())) cint1acIndex = i;
802  }
803  for (Int_t j=0; j<cbeambNames.GetEntriesFast(); j++ ) {
804  if (nameString.BeginsWith(cbeambNames.At(j)->GetName())) cbeambIndex = i;
805  }
806  nameString.Clear();
807  }
808  //
809  ULong64_t cint1b = 0;
810  UShort_t nB=0;
811  if (cint1bIndex!=-1) {
812  cint1b=GetDeltaScaler(scalRec1, scalRec2, cint1bIndex, "l0b");
813  const AliTriggerClass* cint1bClass = cfg->GetTriggerClass(cint1bIndex);
814  AliTriggerBCMask* cint1bBCMask = new AliTriggerBCMask();
815  if (cint1bClass) cint1bBCMask = (AliTriggerBCMask*)cint1bClass->GetBCMask();
816  if (TString(cint1bBCMask->GetName()).CompareTo("NONE")!=0){
817  nB = (UShort_t)cint1bBCMask->GetNUnmaskedBCs();
818  }
819  } else return kFALSE;
820  ULong64_t cint1ac = 0;
821  UShort_t nAC=0;
822  if (cint1acIndex!=-1) {
823  cint1ac=GetDeltaScaler(scalRec1, scalRec2, cint1acIndex, "l0b");
824  AliTriggerClass* cint1acClass = cfg->GetTriggerClass(cint1acIndex);
825  AliTriggerBCMask* cint1acBCMask = new AliTriggerBCMask();
826  if (cint1acClass) cint1acBCMask = (AliTriggerBCMask*)cint1acClass->GetBCMask();
827  if (TString(cint1acBCMask->GetName()).CompareTo("NONE")!=0){
828  nAC = (UShort_t)cint1acBCMask->GetNUnmaskedBCs();
829  }
830  }
831  ULong64_t cbeamb = 0;
832  if (cbeambIndex!=-1) cbeamb=GetDeltaScaler(scalRec1, scalRec2, cbeambIndex, "l0b");
833  UInt_t orbits = GetDeltaOrbits(scalRec1, scalRec2);
834  //
835  if (bkgCorr && (nB==0 || nAC==0 )) return kFALSE;
836  //
837  if (colBCsFromFillScheme) {
838  if (CalculateMu(mu, errmu, cint1b, cint1ac, nB, nAC, orbits, bkgCorr, triggerEff, errorEff)) return kTRUE;
839  }
840  else {
841  if (cint1b!=0 && cbeamb==0) return kFALSE;
842  if (CalculateMu(mu, errmu, cint1b, cint1ac, cbeamb, nB, nAC, bkgCorr, triggerEff, errorEff)) return kTRUE;
843  }
844  //
845  return kFALSE;
846 }
847 //_____________________________________________________________________________
848 ULong64_t AliTriggerRunScalers::GetDeltaScalerForRun(Int_t classIndex, TString level)
849 {
850  if (fScalersRecordESD.GetEntriesFast()==0) {
851  if (CorrectScalersOverflow()==1) return 0;
852  }
853  if (level != "l0b" && level != "l0a" && level != "l1b" && level != "l1a" && level != "l2b" && level != "l2a") return 0;
854 
855  if (fScalersRecordESD.GetEntriesFast()>1) {
858  return GetDeltaScaler(scalRec1, scalRec2, classIndex, level);
859  }
860  return 0;
861 }
862 //_____________________________________________________________________________
863 Bool_t AliTriggerRunScalers::GetScalerRateForRun(Double_t &rate, Double_t &error, Int_t classIndex, TString level)
864 {
865  if (level != "l0b" && level != "l0a" && level != "l1b" && level != "l1a" && level != "l2b" && level != "l2a") return 0;
866  if (fScalersRecordESD.GetEntriesFast()==0) {
867  if (CorrectScalersOverflow()==1) return kFALSE;
868  }
869  if (fScalersRecordESD.GetEntriesFast()>=4) {
872  if (GetScalerRate(rate, error, scalRec1, scalRec2, classIndex, level)) return kTRUE;
873  }
874  return kFALSE;
875 }
876 //_____________________________________________________________________________
877 Bool_t AliTriggerRunScalers::GetClassL2L0ForRun(Double_t &l2l0, Double_t &error, Int_t classIndex)
878 {
879  if (fScalersRecordESD.GetEntriesFast()==0) {
880  if (CorrectScalersOverflow()==1) return kFALSE;
881  }
882  if (fScalersRecordESD.GetEntriesFast()>=4) {
884  const AliTriggerScalersRecordESD* scalRec2 = (AliTriggerScalersRecordESD*)fScalersRecordESD.At(fScalersRecordESD.GetEntriesFast()-1); // Skip the first and last scaler readings for timing reasons
885 
886  if ( GetClassL2L0(l2l0, error, scalRec1, scalRec2, classIndex)) return kTRUE;
887  }
888  return kFALSE;
889 }
890 //_____________________________________________________________________________
891 TGraphErrors* AliTriggerRunScalers::GetGraphScalerRate(const char* className, TString level, AliTriggerConfiguration* cfg)
892 {
893  Int_t classIndex = cfg->GetClassIndexFromName(className);
894  if (classIndex == -1) return 0;
895  if (fScalersRecordESD.GetEntriesFast()==0) {
896  if (CorrectScalersOverflow()==1) return 0;
897  }
898  if (level != "l0b" && level != "l0a" && level != "l1b" && level != "l1a" && level != "l2b" && level != "l2a") return 0;
899  Int_t nent = fScalersRecordESD.GetEntriesFast();
900  Double_t* time = new Double_t[nent];
901  Double_t* etime = new Double_t[nent];
902  Double_t* rate = new Double_t[nent];
903  Double_t* erate = new Double_t[nent];
904  for (Int_t i=0;i<nent-1;i++) {
908  if (!GetScalerRate( rate[i], erate[i], (AliTriggerScalersRecordESD*)fScalersRecordESD.At(i), (AliTriggerScalersRecordESD*)fScalersRecordESD.At(i+1), classIndex, level)) {rate[i]=-1; erate[i]=0.;}
909  }
910  TGraphErrors* graph = new TGraphErrors(nent-1, time, rate, etime, erate);
911  return graph;
912 }
913 //_____________________________________________________________________________
915 {
916  Int_t classIndex = cfg->GetClassIndexFromName(className);
917  if (classIndex == -1) return 0;
918  if (fScalersRecordESD.GetEntriesFast()==0) {
919  if (CorrectScalersOverflow()==1) return 0;
920  }
921  Int_t nent = fScalersRecordESD.GetEntriesFast();
922  Double_t* time = new Double_t[nent];
923  Double_t* etime = new Double_t[nent];
924  Double_t* ratio = new Double_t[nent];
925  Double_t* eratio = new Double_t[nent];
926 
927  for (Int_t i=0;i<nent-1;i++) {
931  if (!GetClassL2L0(ratio[i], eratio[i], (AliTriggerScalersRecordESD*)fScalersRecordESD.At(i), (AliTriggerScalersRecordESD*)fScalersRecordESD.At(i+1), classIndex)) {ratio[i]=-1; eratio[i]=0.;}
932  }
933  TGraphErrors* graph = new TGraphErrors(nent-1, time, ratio, etime, eratio);
934  return graph;
935 }
936 //_____________________________________________________________________________
937 TGraphErrors* AliTriggerRunScalers::GetGraphMu(AliTriggerConfiguration* cfg, const char* className, Bool_t colBCsFromFillScheme, Bool_t bkgCorr, Double_t triggerEff, Double_t errorEff)
938 {
939  if (fScalersRecordESD.GetEntriesFast()==0) {
940  if (CorrectScalersOverflow()==1) return 0;
941  }
942  Int_t nent = fScalersRecordESD.GetEntriesFast();
943  Double_t* time = new Double_t[nent];
944  Double_t* etime = new Double_t[nent];
945  Double_t* mu = new Double_t[nent];
946  Double_t* emu = new Double_t[nent];
947 
948  for (Int_t i=0;i<nent-1;i++) {
949  Double_t m=0.;
950  Double_t err=0.;
954  if (GetMuFromClassScaler( m,err, className, (AliTriggerScalersRecordESD*)fScalersRecordESD.At(i), (AliTriggerScalersRecordESD*)fScalersRecordESD.At(i+1), cfg, colBCsFromFillScheme, bkgCorr, triggerEff, errorEff)!=kFALSE) {mu[i]=m; emu[i]=err;}
955  else {mu[i]=-1.; emu[i]=0.;}
956  }
957  TGraphErrors* graph = new TGraphErrors(nent-1, time, mu, etime, emu);
958  return graph;
959 }
960 //_____________________________________________________________________________
961 void AliTriggerRunScalers::Print( const Option_t* ) const
962 {
963  // Print
964  cout << "Trigger Scalers Record per Run: " << endl;
965  cout << " File version :" << fVersion << endl;
966  cout << " Run Number :" << fRunNumber << endl;
967  cout << " Number of Classes :" << (Int_t)fnClasses << endl;
968  cout << " Classes ID:";
969  for( Int_t i=0; i<fnClasses; ++i ){cout << " " << (Int_t)fClassIndex[i]; }
970  cout << endl;
971 
972  for( Int_t i=0; i<fScalersRecord.GetEntriesFast(); ++i )
974 }
975 
UChar_t GetClassIndex() const
void SetTimeStamp(const AliTimeStamp *stamp)
void SetNumClasses(UChar_t nclass)
virtual void Print(const Option_t *opt="") const
void SetLMCA(ULong64_t count)
static Bool_t CalculateMu(Double_t &mu, Double_t &errmu, ULong64_t countsB, ULong64_t countsAC, UShort_t nB, UShort_t nAC, UInt_t orbits, Bool_t bkgCorr=kTRUE, Double_t triggerEff=1., Double_t errorEff=0.)
void GetAllScalers(UInt_t *scalers) const
Bool_t GetClassL2L0ForRun(Double_t &l2l0, Double_t &error, Int_t classIndex)
AliTriggerBCMask * GetBCMask() const
#define TObjArray
void SetTimeGroup(const UInt_t group)
const TObjArray & GetClasses() const
Char_t GetClass(Int_t i) const
void SetClass(UChar_t i, UChar_t index)
const AliTriggerScalersESD * GetTriggerScalersForClass(const Int_t classindex) const
ULong64_t GetL1CB() const
static ULong64_t GetDeltaScaler(const AliTriggerScalersRecordESD *scalRec1, const AliTriggerScalersRecordESD *scalRec2, Int_t classIndex, TString level)
void SetLMCB(ULong64_t count)
const TObjArray * GetTriggerScalers() const
void AddTriggerScalers(AliTriggerScalersESD *scaler)
static UInt_t GetDeltaOrbits(const AliTriggerScalersRecordESD *scalRec1, const AliTriggerScalersRecordESD *scalRec2)
UInt_t GetLMCB() const
static Bool_t GetClassL2L0(Double_t &l2l0, Double_t &error, const AliTriggerScalersRecordESD *scalRec1, const AliTriggerScalersRecordESD *scalRec2, Int_t classIndex)
#define AliWarning(message)
Definition: AliLog.h:541
AliTriggerScalersESD * GetScalersForEventClass(const AliTimeStamp *stamp, const Int_t classIndex) const
ULong64_t GetL2CA() const
const TObjArray * GetTriggerScalers() const
Int_t GetClassIndexFromName(const char *className) const
static AliTriggerRunScalers * ReadScalers(TString &filename)
#define AliErrorClass(message)
Definition: AliLog.h:596
static Bool_t GetScalerRate(Double_t &rate, Double_t &error, const AliTriggerScalersRecordESD *scalRec1, const AliTriggerScalersRecordESD *scalRec2, Int_t classIndex, TString level)
#define AliDebugClass(logLevel, message)
Definition: AliLog.h:313
ULong64_t GetDeltaScalerForRun(Int_t classIndex, TString level)
virtual Int_t Compare(const TObject *obj) const
static Double_t GetDeltaTime(const AliTriggerScalersRecordESD *scalRec1, const AliTriggerScalersRecordESD *scalRec2)
static Bool_t GetScalerRatePerBC(Double_t &rate, Double_t &error, const AliTriggerScalersRecordESD *scalRec1, const AliTriggerScalersRecordESD *scalRec2, AliTriggerConfiguration *cfg, Int_t classIndex, TString level)
static Bool_t GetMuFromClassScaler(Double_t &mu, Double_t &errmu, const char *className, const AliTriggerScalersRecordESD *scalRec1, const AliTriggerScalersRecordESD *scalRec2, AliTriggerConfiguration *cfg, Bool_t colBCsFromFillScheme=kTRUE, Bool_t bkgCorr=kTRUE, Double_t triggerEff=1., Double_t errorEff=0.)
UChar_t GetClassIndex() const
virtual Int_t Compare(const TObject *obj) const
ULong64_t GetL2CB() const
ULong_t GetRunNumber() const
const AliTriggerScalersRecordESD * GetScalersDeltaForRun() const
void SetRunNumber(ULong_t run)
void GetAllScalersM012(UInt_t *scalers) const
Int_t ConsistencyCheck(Int_t position, Bool_t correctOverflow, UInt_t **overflow)
void rec(const char *filename="raw.root")
Definition: rec.C:1
ULong64_t GetLOCB() const
TGraphErrors * GetGraphScalerRate(const char *className, TString level, AliTriggerConfiguration *cfg)
#define StdoutToAliError(whatever)
Definition: AliLog.h:619
TGraphErrors * GetGraphScalerL2L0Ratio(const char *className, AliTriggerConfiguration *cfg)
UInt_t GetPeriod() const
Definition: AliTimeStamp.h:37
void AddTriggerScalers(AliTriggerScalersRecord *scal)
#define AliDebug(logLevel, message)
Definition: AliLog.h:300
UInt_t GetLMCA() const
const AliTriggerScalersRecordESD * GetScalersDeltaForEvent(const AliTimeStamp *stamp) const
const AliTimeStamp * GetTimeStamp() const
UInt_t GetOrbit() const
Definition: AliTimeStamp.h:36
void GetAllScalers(ULong64_t *scalers) const
Int_t FindNearestScalersRecord(const AliTimeStamp *stamp) const
AliTriggerClass * GetTriggerClass(Int_t classIndex) const
ULong64_t GetL1CA() const
#define AliError(message)
Definition: AliLog.h:591
Bool_t GetScalerRateForRun(Double_t &rate, Double_t &error, Int_t classIndex, TString level)
AliTriggerRunScalers & operator=(const AliTriggerRunScalers &run)
ULong64_t GetLOCA() const
UShort_t GetNUnmaskedBCs() const
const AliTimeStamp * GetTimeStamp() const
const char * GetClassNameFromIndex(Int_t classIndex) const
void SetVersion(Short_t ver)
TGraphErrors * GetGraphMu(AliTriggerConfiguration *cfg, const char *className, Bool_t colBCsFromFillScheme=kTRUE, Bool_t bkgCorr=kTRUE, Double_t triggerEff=1., Double_t errorEff=0.)