Updated geometry
[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(),
27293674 50 fQALength(0),
51 fQA(NULL),
52 fESLength(0),
53 fEventSpecies(NULL)
f3a97c86 54{
e16601cf 55 //Default constructor
f3a97c86 56}
57
bec9a2e7 58//___________________________________________________________________________
59AliRunTag::~AliRunTag() {
17a9d008 60 //Destructor
61 fEventTag.Delete();
27293674 62 if ( fQA )
63 delete [] fQA ;
64 if ( fEventSpecies )
65 delete [] fEventSpecies ;
66}
67
68//___________________________________________________________________________
69AliRunTag::AliRunTag(const AliRunTag& tag):
70TObject(),
71fAliceRunId(tag.fAliceRunId),
72fAliceMagneticField(tag.fAliceMagneticField),
73fAliceRunStartTime(tag.fAliceRunStartTime),
74fAliceRunStopTime(fAliceRunStopTime),
75fAlirootVersion(tag.fAlirootVersion),
76fRootVersion(tag.fRootVersion),
77fGeant3Version(tag.fGeant3Version),
78fAliceRunQuality(tag.fAliceRunQuality),
79fAliceBeamEnergy(tag.fAliceBeamEnergy),
80fAliceBeamType(tag.fAliceBeamType),
81fAliceCalibrationVersion(tag.fAliceCalibrationVersion),
82fAliceDataType(tag.fAliceDataType),
83fNumEvents(tag.fNumEvents),
84fNumDetectors(tag.fNumDetectors),
85fEventTag(tag.fEventTag),
86fDetectorTag(tag.fDetectorTag),
87fLHCTag(tag.fLHCTag),
88fQALength(tag.fQALength),
89fQA(NULL),
90fESLength(tag.fESLength),
91fEventSpecies(NULL)
92{
93 //copy constructor
94 if (fQALength == 0 )
95 fQA = NULL ;
96 else {
97 fQA = new ULong_t(fQALength) ;
98 memcpy(fQA, tag.fQA, fQALength*sizeof(ULong_t)) ;
99 }
100 if (fESLength == 0 )
101 fEventSpecies = NULL ;
102 else {
103 fEventSpecies = new Bool_t(fESLength) ;
104 memcpy(fEventSpecies, tag.fEventSpecies, fESLength*sizeof(Bool_t)) ;
105 }
106}
107
108//___________________________________________________________________________
109AliRunTag& AliRunTag::operator = (const AliRunTag& tag) {
110//assignment operator
111 if(&tag != this) {
112 fAliceRunId = tag.fAliceRunId ;
113 fAliceMagneticField = tag.fAliceMagneticField ;
114 fAliceRunStartTime = tag.fAliceRunStartTime ;
115 fAliceRunStopTime = tag.fAliceRunStopTime ;
116 fAlirootVersion = tag.fAlirootVersion ;
117 fRootVersion = tag.fRootVersion ;
118 fGeant3Version = tag.fGeant3Version ;
119 fAliceRunQuality = tag.fAliceRunQuality ;
120 fAliceBeamEnergy = tag.fAliceBeamEnergy ;
121 fAliceBeamType = tag.fAliceBeamType ;
122 fAliceCalibrationVersion = tag.fAliceCalibrationVersion ;
123 fAliceDataType = tag.fAliceDataType ;
124 fNumEvents = tag.fNumEvents ;
125 fNumDetectors = tag.fNumDetectors ;
126 fEventTag = tag.fEventTag ;
127 fDetectorTag = tag.fDetectorTag ;
128 fLHCTag = tag.fLHCTag ;
129 fQALength = tag.fQALength ;
130 if (fQA)
131 delete [] fQA ;
132 if (fQALength == 0 )
133 fQA = NULL ;
134 else {
135 fQA = new ULong_t(fQALength) ;
136 memcpy(fQA, tag.fQA, fQALength*sizeof(ULong_t)) ;
137 }
138 fESLength = tag.fESLength ;
139 if (fEventSpecies)
140 delete [] fEventSpecies ;
141 if (fESLength == 0 )
142 fEventSpecies = NULL ;
143 else {
144 memcpy(fEventSpecies, tag.fEventSpecies, fESLength*sizeof(Bool_t)) ;
145 }
146 }
147 return *this ;
f3a97c86 148}
149
bec9a2e7 150//___________________________________________________________________________
4c117ffd 151void AliRunTag::CopyStandardContent(AliRunTag *oldtag) {
152 //function that copies the run, lhc and detector levels
153 SetRunId(oldtag->GetRunId());
154 SetMagneticField(oldtag->GetMagneticField());
155 SetRunStartTime(oldtag->GetRunStartTime());
156 SetRunStopTime(oldtag->GetRunStopTime());
157 SetAlirootVersion(oldtag->GetAlirootVersion());
158 SetRootVersion(oldtag->GetRootVersion());
159 SetGeant3Version(oldtag->GetGeant3Version());
160 SetRunQuality(oldtag->GetRunQuality());
161 SetBeamEnergy(oldtag->GetBeamEnergy());
162 SetBeamType(oldtag->GetBeamType());
163 SetCalibVersion(oldtag->GetCalibVersion());
164 SetDataType(oldtag->GetDataType());
165 SetLHCTag(oldtag->GetLHCTag()->GetLuminosity(),oldtag->GetLHCTag()->GetLHCState());
52314abc 166 SetDetectorTag(oldtag->GetDetectorTags()->GetIntDetectorMask());
27293674 167 SetQA(oldtag->GetQA(), oldtag->GetQALength()) ;
168 SetEventSpecies(oldtag->GetEventSpecies(), oldtag->GetESLength()) ;
4c117ffd 169}
170
171//___________________________________________________________________________
27293674 172void AliRunTag::SetQA(ULong_t * qa, Int_t qalength) {
173 //Setter for the qa bits
174 fQALength = qalength ;
175 if (fQA)
176 delete [] fQA ;
177 fQA = new ULong_t(qalength) ;
178 memcpy(fQA, qa, qalength*sizeof(ULong_t)) ;
179}
180
181//___________________________________________________________________________
182void AliRunTag::SetEventSpecies(Bool_t * es, Int_t eslength) {
183 //setter for the eventspecices
184 fESLength = eslength ;
185 if (fEventSpecies)
186 delete [] fEventSpecies ;
187 fEventSpecies = new Bool_t(eslength) ;
188 memcpy(fEventSpecies, es, eslength*sizeof(Bool_t)) ;
189}
190
191
192//___________________________________________________________________________
c5caed45 193void AliRunTag::SetLHCTag(Float_t lumin, TString type) {
e16601cf 194 //Setter for the LHC tags
f3a97c86 195 fLHCTag.SetLHCTag(lumin,type);
196}
197
bec9a2e7 198//___________________________________________________________________________
c5caed45 199void AliRunTag::SetDetectorTag(UInt_t mask) {
e16601cf 200 //Setter for the detector tags
c5caed45 201 fDetectorTag.SetDetectorMask(mask);
f3a97c86 202}
203
bec9a2e7 204//___________________________________________________________________________
205void AliRunTag::AddEventTag(const AliEventTag & EvTag) {
e16601cf 206 //Adds an entry to the event tag TClonesArray
17a9d008 207 new(fEventTag[fNumEvents++]) AliEventTag(EvTag);
f3a97c86 208}
209
bec9a2e7 210//___________________________________________________________________________
211void AliRunTag::Clear(const char *) {
e16601cf 212 //Resets the number of events and detectors
9c23604f 213 fEventTag.Delete();
f3a97c86 214 fNumEvents = 0;
fed6034e 215 fDetectorTag.Clear();
f3a97c86 216 fNumDetectors = 0;
217}