]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliRunTag.cxx
Typo fixed + warnings removed.
[u/mrichter/AliRoot.git] / STEER / AliRunTag.cxx
CommitLineData
f3a97c86 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$ */
17
18//-----------------------------------------------------------------
19// Implementation of the RunTag class
20// This is the class to deal with the tags in the run level
21// Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
22//-----------------------------------------------------------------
23
f3a97c86 24#include "AliRunTag.h"
f3a97c86 25#include "AliDetectorTag.h"
26#include "AliEventTag.h"
27
28ClassImp(AliRunTag)
29
bec9a2e7 30//___________________________________________________________________________
17a9d008 31 AliRunTag::AliRunTag() :
32 TObject(),
33 fAliceRunId(-1),
34 fAliceMagneticField(0.0),
35 fAliceRunStartTime(0),
36 fAliceRunStopTime(0),
bec9a2e7 37 fAlirootVersion(0),
38 fRootVersion(0),
39 fGeant3Version(0),
17a9d008 40 fAliceRunQuality(0),
41 fAliceBeamEnergy(0.0),
bec9a2e7 42 fAliceBeamType(0),
17a9d008 43 fAliceCalibrationVersion(0),
44 fAliceDataType(0),
45 fNumEvents(0),
46 fNumDetectors(0),
47 fEventTag("AliEventTag", 1000),
c5caed45 48 fDetectorTag(),
46af88be 49 fLHCTag(),
9ee5d033 50 fQA(),
27293674 51 fQALength(0),
9ee5d033 52 fQAArray(NULL),
27293674 53 fESLength(0),
54 fEventSpecies(NULL)
f3a97c86 55{
e16601cf 56 //Default constructor
f3a97c86 57}
58
bec9a2e7 59//___________________________________________________________________________
60AliRunTag::~AliRunTag() {
17a9d008 61 //Destructor
62 fEventTag.Delete();
9ee5d033 63 if ( fQAArray )
64 delete [] fQAArray ;
27293674 65 if ( fEventSpecies )
66 delete [] fEventSpecies ;
67}
68
69//___________________________________________________________________________
70AliRunTag::AliRunTag(const AliRunTag& tag):
71TObject(),
72fAliceRunId(tag.fAliceRunId),
73fAliceMagneticField(tag.fAliceMagneticField),
74fAliceRunStartTime(tag.fAliceRunStartTime),
75fAliceRunStopTime(fAliceRunStopTime),
76fAlirootVersion(tag.fAlirootVersion),
77fRootVersion(tag.fRootVersion),
78fGeant3Version(tag.fGeant3Version),
79fAliceRunQuality(tag.fAliceRunQuality),
80fAliceBeamEnergy(tag.fAliceBeamEnergy),
81fAliceBeamType(tag.fAliceBeamType),
82fAliceCalibrationVersion(tag.fAliceCalibrationVersion),
83fAliceDataType(tag.fAliceDataType),
84fNumEvents(tag.fNumEvents),
85fNumDetectors(tag.fNumDetectors),
86fEventTag(tag.fEventTag),
87fDetectorTag(tag.fDetectorTag),
88fLHCTag(tag.fLHCTag),
9ee5d033 89fQA(tag.fQA),
27293674 90fQALength(tag.fQALength),
9ee5d033 91fQAArray(NULL),
27293674 92fESLength(tag.fESLength),
93fEventSpecies(NULL)
94{
95 //copy constructor
96 if (fQALength == 0 )
9ee5d033 97 fQAArray = NULL ;
27293674 98 else {
9ee5d033 99 fQAArray = new ULong_t[fQALength] ;
100 memcpy(fQAArray, tag.fQAArray, fQALength*sizeof(ULong_t)) ;
27293674 101 }
102 if (fESLength == 0 )
103 fEventSpecies = NULL ;
104 else {
e1ffd6bc 105 fEventSpecies = new Bool_t[fESLength] ;
27293674 106 memcpy(fEventSpecies, tag.fEventSpecies, fESLength*sizeof(Bool_t)) ;
107 }
108}
109
110//___________________________________________________________________________
111AliRunTag& AliRunTag::operator = (const AliRunTag& tag) {
112//assignment operator
113 if(&tag != this) {
114 fAliceRunId = tag.fAliceRunId ;
115 fAliceMagneticField = tag.fAliceMagneticField ;
116 fAliceRunStartTime = tag.fAliceRunStartTime ;
117 fAliceRunStopTime = tag.fAliceRunStopTime ;
118 fAlirootVersion = tag.fAlirootVersion ;
119 fRootVersion = tag.fRootVersion ;
120 fGeant3Version = tag.fGeant3Version ;
121 fAliceRunQuality = tag.fAliceRunQuality ;
122 fAliceBeamEnergy = tag.fAliceBeamEnergy ;
123 fAliceBeamType = tag.fAliceBeamType ;
124 fAliceCalibrationVersion = tag.fAliceCalibrationVersion ;
125 fAliceDataType = tag.fAliceDataType ;
126 fNumEvents = tag.fNumEvents ;
127 fNumDetectors = tag.fNumDetectors ;
128 fEventTag = tag.fEventTag ;
129 fDetectorTag = tag.fDetectorTag ;
130 fLHCTag = tag.fLHCTag ;
9ee5d033 131 fQA = tag.fQA ;
27293674 132 fQALength = tag.fQALength ;
9ee5d033 133 if (fQAArray)
134 delete [] fQAArray ;
27293674 135 if (fQALength == 0 )
9ee5d033 136 fQAArray = NULL ;
27293674 137 else {
9ee5d033 138 fQAArray = new ULong_t[fQALength] ;
139 memcpy(fQAArray, tag.fQAArray, fQALength*sizeof(ULong_t)) ;
27293674 140 }
141 fESLength = tag.fESLength ;
142 if (fEventSpecies)
143 delete [] fEventSpecies ;
144 if (fESLength == 0 )
145 fEventSpecies = NULL ;
146 else {
e1ffd6bc 147 fEventSpecies = new Bool_t[fESLength] ;
27293674 148 memcpy(fEventSpecies, tag.fEventSpecies, fESLength*sizeof(Bool_t)) ;
149 }
150 }
151 return *this ;
f3a97c86 152}
153
4c117ffd 154//___________________________________________________________________________
155void AliRunTag::CopyStandardContent(AliRunTag *oldtag) {
156 //function that copies the run, lhc and detector levels
157 SetRunId(oldtag->GetRunId());
158 SetMagneticField(oldtag->GetMagneticField());
159 SetRunStartTime(oldtag->GetRunStartTime());
160 SetRunStopTime(oldtag->GetRunStopTime());
161 SetAlirootVersion(oldtag->GetAlirootVersion());
162 SetRootVersion(oldtag->GetRootVersion());
163 SetGeant3Version(oldtag->GetGeant3Version());
164 SetRunQuality(oldtag->GetRunQuality());
165 SetBeamEnergy(oldtag->GetBeamEnergy());
166 SetBeamType(oldtag->GetBeamType());
167 SetCalibVersion(oldtag->GetCalibVersion());
168 SetDataType(oldtag->GetDataType());
169 SetLHCTag(oldtag->GetLHCTag()->GetLuminosity(),oldtag->GetLHCTag()->GetLHCState());
52314abc 170 SetDetectorTag(oldtag->GetDetectorTags()->GetIntDetectorMask());
9ee5d033 171 SetQA(*(oldtag->GetQA())) ;
172 SetQAArray(oldtag->GetQAArray(), oldtag->GetQALength()) ;
27293674 173 SetEventSpecies(oldtag->GetEventSpecies(), oldtag->GetESLength()) ;
4c117ffd 174}
175
27293674 176//___________________________________________________________________________
9ee5d033 177void AliRunTag::SetQAArray(ULong_t * qa, Int_t qalength) {
27293674 178 //Setter for the qa bits
e1ffd6bc 179 if (qa && qalength > 0) {
180 fQALength = qalength ;
9ee5d033 181 if (fQAArray)
182 delete [] fQAArray ;
183 fQAArray = new ULong_t[qalength] ;
184 memcpy(fQAArray, qa, qalength*sizeof(ULong_t)) ;
e1ffd6bc 185 }
27293674 186}
187
188//___________________________________________________________________________
189void AliRunTag::SetEventSpecies(Bool_t * es, Int_t eslength) {
190 //setter for the eventspecices
e1ffd6bc 191 if (es && eslength >0 ) {
192 fESLength = eslength ;
193 if (fEventSpecies)
194 delete [] fEventSpecies ;
195 fEventSpecies = new Bool_t[eslength] ;
196 memcpy(fEventSpecies, es, eslength*sizeof(Bool_t)) ;
197 }
27293674 198}
199
200
bec9a2e7 201//___________________________________________________________________________
c5caed45 202void AliRunTag::SetLHCTag(Float_t lumin, TString type) {
e16601cf 203 //Setter for the LHC tags
f3a97c86 204 fLHCTag.SetLHCTag(lumin,type);
205}
206
bec9a2e7 207//___________________________________________________________________________
c5caed45 208void AliRunTag::SetDetectorTag(UInt_t mask) {
e16601cf 209 //Setter for the detector tags
c5caed45 210 fDetectorTag.SetDetectorMask(mask);
f3a97c86 211}
212
bec9a2e7 213//___________________________________________________________________________
214void AliRunTag::AddEventTag(const AliEventTag & EvTag) {
e16601cf 215 //Adds an entry to the event tag TClonesArray
17a9d008 216 new(fEventTag[fNumEvents++]) AliEventTag(EvTag);
f3a97c86 217}
218
bec9a2e7 219//___________________________________________________________________________
220void AliRunTag::Clear(const char *) {
e16601cf 221 //Resets the number of events and detectors
9c23604f 222 fEventTag.Delete();
f3a97c86 223 fNumEvents = 0;
fed6034e 224 fDetectorTag.Clear();
f3a97c86 225 fNumDetectors = 0;
226}