AliRoot Core  3dc7879 (3dc7879)
AliTriggerScalersRecordESD.cxx
Go to the documentation of this file.
1 /*************************************************************************
2 * Copyright(c) 1998-2008, 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 #include <Riostream.h>
18 #include <TObjArray.h>
19 #include <AliTimeStamp.h>
20 #include "AliLog.h"
21 #include "AliTriggerScalersESD.h"
23 
24 using std::endl;
25 using std::cout;
27 //_____________________________________________________________________________
29 TObject(),
30 fTimestamp(),
31 fScalers(),
32 fTimeGroup(0)
33 {
34 }
35 
36 //_____________________________________________________________________________
38 {
39  fScalers.AddLast( scaler );
40 }
41 
42 //_____________________________________________________________________________
43 void AliTriggerScalersRecordESD::AddTriggerScalers( UChar_t classIndex, ULong64_t LOCB, ULong64_t LOCA,
44  ULong64_t L1CB, ULong64_t L1CA, ULong64_t L2CB, ULong64_t L2CA )
45 {
46  AddTriggerScalers( new AliTriggerScalersESD( classIndex, LOCB, LOCA, L1CB, L1CA, L2CB, L2CA ) );
47 }
48 
49 //_____________________________________________________________________________
51 TObject(rec),
53 fScalers(),
55 {
56 //copy constructor
57 for (Int_t i = 0; i < rec.fScalers.GetEntriesFast(); i++) {
58  if (rec.fScalers[i]) fScalers.Add(rec.fScalers[i]->Clone());
59  }
60 }
61 //_____________________________________________________________________________
63 {
64 //asignment operator
65 if(&rec == this) return *this;
66 ((TObject *)this)->operator=(rec);
68 fScalers.Delete();
69 for (Int_t i = 0; i < rec.fScalers.GetEntriesFast(); i++) {
70  if (rec.fScalers[i]) fScalers.Add(rec.fScalers[i]->Clone());
71  }
73 return *this;
74 }
75 
76 //_____________________________________________________________________________
78 {
79 fScalers.SetOwner();
80 fScalers.Clear();
81 fTimeGroup=0;
82 }
83 
84 //_____________________________________________________________________________
86 {
87  // Find Trigger scaler with class ID = classmask using a binary search.
88 
89  Int_t base, last;
90  AliTriggerScalersESD *op2 = NULL;
91 
92  base = 0;
93  last = fScalers.GetEntriesFast();
94 
95  while (base < last) {
96  op2 = (AliTriggerScalersESD *)fScalers.At(base);
97  if( op2->GetClassIndex() == classindex ) return op2;
98  base++;
99  }
100  return op2;
101 }
102 
103 //_____________________________________________________________________________
104 void AliTriggerScalersRecordESD::Print( const Option_t* ) const
105 {
106  // Print
107  cout << "Trigger Scalers Record, time group: "<< fTimeGroup << endl;
108  fTimestamp.Print();
109  for( Int_t i=0; i<fScalers.GetEntriesFast(); ++i )
110  ((AliTriggerScalersESD*)fScalers.At(i))->Print();
111 }
const AliTriggerScalersESD * GetTriggerScalersForClass(const Int_t classindex) const
virtual void Print(const Option_t *opt="") const
void AddTriggerScalers(AliTriggerScalersESD *scaler)
UChar_t GetClassIndex() const
AliTriggerScalersRecordESD & operator=(const AliTriggerScalersRecordESD &rec)
void rec(const char *filename="raw.root")
Definition: rec.C:1
virtual void Print(const Option_t *opt="") const