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