]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/ESD/AliTriggerScalersRecordESD.cxx
Adding the possibility to get an oldest version, also via GetAll, by means
[u/mrichter/AliRoot.git] / STEER / ESD / AliTriggerScalersRecordESD.cxx
CommitLineData
0bf41faa 1/*************************************************************************\r
56413996 2* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *\r
3* *\r
4* Author: The ALICE Off-line Project. *\r
5* Contributors are mentioned in the code where appropriate. *\r
6* *\r
7* Permission to use, copy, modify and distribute this software and its *\r
8* documentation strictly for non-commercial purposes is hereby granted *\r
9* without fee, provided that the above copyright notice appears in all *\r
10* copies and that both the copyright notice and this permission notice *\r
11* appear in the supporting documentation. The authors make no claims *\r
12* about the suitability of this software for any purpose. It is *\r
0bf41faa 13* provided "as is" without express or implied warranty. * \r
14**************************************************************************/\r
56413996 15\r
16\r
17#include <Riostream.h>\r
18#include <TObjArray.h>\r
435919c9 19#include <AliTimeStamp.h>\r
56413996 20#include "AliLog.h" \r
21#include "AliTriggerScalersESD.h"\r
22#include "AliTriggerScalersRecordESD.h"\r
23\r
66b0310c 24using std::endl;\r
25using std::cout;\r
56413996 26ClassImp( AliTriggerScalersRecordESD )\r
27//_____________________________________________________________________________\r
28AliTriggerScalersRecordESD::AliTriggerScalersRecordESD():\r
0bf41faa 29TObject(),\r
435919c9 30fTimestamp(),\r
24b9e562 31fScalers(),\r
32fTimeGroup(0)\r
56413996 33{\r
34}\r
35\r
36//_____________________________________________________________________________\r
37void AliTriggerScalersRecordESD::AddTriggerScalers( AliTriggerScalersESD* scaler ) \r
38{ \r
39 fScalers.AddLast( scaler ); \r
40}\r
41\r
42//_____________________________________________________________________________\r
43void AliTriggerScalersRecordESD::AddTriggerScalers( UChar_t classIndex, ULong64_t LOCB, ULong64_t LOCA, \r
44 ULong64_t L1CB, ULong64_t L1CA, ULong64_t L2CB, ULong64_t L2CA )\r
45{\r
46 AddTriggerScalers( new AliTriggerScalersESD( classIndex, LOCB, LOCA, L1CB, L1CA, L2CB, L2CA ) );\r
47} \r
48\r
0bf41faa 49//_____________________________________________________________________________\r
50AliTriggerScalersRecordESD::AliTriggerScalersRecordESD( const AliTriggerScalersRecordESD &rec ) :\r
51TObject(rec),\r
435919c9 52fTimestamp(rec.fTimestamp),\r
24b9e562 53fScalers(),\r
54fTimeGroup(rec.fTimeGroup)\r
0bf41faa 55{\r
435919c9 56//copy constructor\r
0bf41faa 57for (Int_t i = 0; i < rec.fScalers.GetEntriesFast(); i++) {\r
58 if (rec.fScalers[i]) fScalers.Add(rec.fScalers[i]->Clone());\r
59 }\r
60}\r
61//_____________________________________________________________________________\r
62AliTriggerScalersRecordESD& AliTriggerScalersRecordESD:: operator=(const AliTriggerScalersRecordESD& rec)\r
63{\r
435919c9 64//asignment operator\r
0bf41faa 65if(&rec == this) return *this;\r
66((TObject *)this)->operator=(rec);\r
435919c9 67fTimestamp=rec.fTimestamp;\r
481acdb5 68fScalers.Delete();\r
0bf41faa 69for (Int_t i = 0; i < rec.fScalers.GetEntriesFast(); i++) {\r
70 if (rec.fScalers[i]) fScalers.Add(rec.fScalers[i]->Clone());\r
71 }\r
24b9e562 72fTimeGroup=rec.fTimeGroup;\r
0bf41faa 73return *this;\r
74} \r
75\r
76//_____________________________________________________________________________\r
77void AliTriggerScalersRecordESD::Reset()\r
78{\r
79fScalers.SetOwner();\r
80fScalers.Clear();\r
24b9e562 81fTimeGroup=0;\r
0bf41faa 82} \r
83\r
56413996 84//_____________________________________________________________________________\r
b69ed284 85const AliTriggerScalersESD* AliTriggerScalersRecordESD::GetTriggerScalersForClass( const Int_t classindex ) const\r
56413996 86{\r
87 // Find Trigger scaler with class ID = classmask using a binary search. \r
88\r
89 Int_t base, last;\r
90 AliTriggerScalersESD *op2 = NULL;\r
91 \r
92 base = 0;\r
93 last = fScalers.GetEntriesFast();\r
94\r
95 while (base < last) {\r
96 op2 = (AliTriggerScalersESD *)fScalers.At(base);\r
97 if( op2->GetClassIndex() == classindex ) return op2;\r
98 base++;\r
99 }\r
100 return op2; \r
101}\r
102 \r
103//_____________________________________________________________________________\r
104void AliTriggerScalersRecordESD::Print( const Option_t* ) const\r
105{\r
106 // Print\r
24b9e562 107 cout << "Trigger Scalers Record, time group: "<< fTimeGroup << endl;\r
ab601dd3 108 fTimestamp.Print();\r
56413996 109 for( Int_t i=0; i<fScalers.GetEntriesFast(); ++i ) \r
110 ((AliTriggerScalersESD*)fScalers.At(i))->Print();\r
111}\r