]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliRunTag.cxx
Fixed compilation
[u/mrichter/AliRoot.git] / STEER / AliRunTag.cxx
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
24 #include "AliRunTag.h"
25 #include "AliDetectorTag.h"
26 #include "AliEventTag.h"
27
28 ClassImp(AliRunTag)
29
30 //___________________________________________________________________________
31   AliRunTag::AliRunTag() :
32     TObject(),
33     fAliceRunId(-1),
34     fAliceMagneticField(0.0),
35     fAliceDipoleField(0.0),
36     fAliceRunStartTime(0),
37     fAliceRunStopTime(0),
38     fAlirootVersion(0),
39     fRootVersion(0),
40     fGeant3Version(0),
41     fLHCPeriod(0),
42     fRecPass(0),
43     fProductionName(0),
44     fAliceRunQuality(0),
45     fAliceBeamEnergy(0.0),
46     fAliceBeamType(0),
47     fAliceCalibrationVersion(0),
48     fAliceDataType(0),
49     fNumEvents(0),
50     fNumDetectors(0),
51     fEventTag("AliEventTag", 1000),
52     fDetectorTag(),
53     fLHCTag(), 
54     fQA(),  
55     fQALength(0), 
56     fQAArray(NULL), 
57     fESLength(0), 
58     fEventSpecies(NULL)
59 {
60   //Default constructor
61 }
62
63 //___________________________________________________________________________
64 AliRunTag::~AliRunTag() {
65   //Destructor
66   fEventTag.Delete();
67   if ( fQAArray ) 
68     delete [] fQAArray ; 
69   if ( fEventSpecies )
70     delete [] fEventSpecies ; 
71 }
72
73 //___________________________________________________________________________
74 AliRunTag::AliRunTag(const AliRunTag& tag):
75 TObject(),
76 fAliceRunId(tag.fAliceRunId),
77 fAliceMagneticField(tag.fAliceMagneticField),
78 fAliceDipoleField(tag.fAliceDipoleField),
79 fAliceRunStartTime(tag.fAliceRunStartTime),
80 fAliceRunStopTime(fAliceRunStopTime),
81 fAlirootVersion(tag.fAlirootVersion),
82 fRootVersion(tag.fRootVersion),
83 fGeant3Version(tag.fGeant3Version),
84 fLHCPeriod(tag.fLHCPeriod),
85 fRecPass(tag.fRecPass),
86 fProductionName(tag.fProductionName),
87 fAliceRunQuality(tag.fAliceRunQuality),
88 fAliceBeamEnergy(tag.fAliceBeamEnergy),
89 fAliceBeamType(tag.fAliceBeamType),
90 fAliceCalibrationVersion(tag.fAliceCalibrationVersion),
91 fAliceDataType(tag.fAliceDataType),
92 fNumEvents(tag.fNumEvents),
93 fNumDetectors(tag.fNumDetectors),
94 fEventTag(tag.fEventTag),
95 fDetectorTag(tag.fDetectorTag),
96 fLHCTag(tag.fLHCTag), 
97 fQA(tag.fQA),
98 fQALength(tag.fQALength),
99 fQAArray(NULL), 
100 fESLength(tag.fESLength),
101 fEventSpecies(NULL)
102 {
103   //copy constructor
104   if (fQALength == 0 ) 
105     fQAArray = NULL ; 
106   else {
107     fQAArray = new ULong_t[fQALength] ; 
108     memcpy(fQAArray, tag.fQAArray, fQALength*sizeof(ULong_t)) ;
109   }
110   if (fESLength == 0 ) 
111     fEventSpecies = NULL ; 
112   else {
113     fEventSpecies = new Bool_t[fESLength] ; 
114     memcpy(fEventSpecies, tag.fEventSpecies, fESLength*sizeof(Bool_t)) ;
115   }
116 }
117
118 //___________________________________________________________________________
119 AliRunTag& AliRunTag::operator = (const AliRunTag& tag) {
120 //assignment operator
121   if(&tag != this) {
122     fAliceRunId               = tag.fAliceRunId ; 
123     fAliceMagneticField       = tag.fAliceMagneticField ;
124     fAliceDipoleField         = tag.fAliceDipoleField ;
125     fAliceRunStartTime        = tag.fAliceRunStartTime ; 
126     fAliceRunStopTime         = tag.fAliceRunStopTime ; 
127     fAlirootVersion           = tag.fAlirootVersion ; 
128     fRootVersion              = tag.fRootVersion ;
129     fGeant3Version            = tag.fGeant3Version ; 
130     fLHCPeriod                = tag.fLHCPeriod ; 
131     fRecPass                  = tag.fRecPass ; 
132     fProductionName           = tag.fProductionName ; 
133     fAliceRunQuality          = tag.fAliceRunQuality ; 
134     fAliceBeamEnergy          = tag.fAliceBeamEnergy ;
135     fAliceBeamType            = tag.fAliceBeamType ; 
136     fAliceCalibrationVersion  = tag.fAliceCalibrationVersion ; 
137     fAliceDataType            = tag.fAliceDataType ; 
138     fNumEvents                = tag.fNumEvents ;
139     fNumDetectors             = tag.fNumDetectors ; 
140     fEventTag                 = tag.fEventTag ;
141     fDetectorTag              = tag.fDetectorTag ;
142     fLHCTag                   = tag.fLHCTag ;  
143     fQA                       = tag.fQA ;      
144     fQALength                 = tag.fQALength ; 
145     if (fQAArray) 
146       delete [] fQAArray ; 
147     if (fQALength == 0 ) 
148       fQAArray = NULL ; 
149     else {
150       fQAArray = new ULong_t[fQALength] ; 
151       memcpy(fQAArray, tag.fQAArray, fQALength*sizeof(ULong_t)) ;
152     }
153     fESLength                 = tag.fESLength ; 
154     if (fEventSpecies)
155       delete [] fEventSpecies ; 
156     if (fESLength == 0 ) 
157       fEventSpecies = NULL ; 
158     else {
159       fEventSpecies = new Bool_t[fESLength] ; 
160       memcpy(fEventSpecies, tag.fEventSpecies, fESLength*sizeof(Bool_t)) ;
161     }
162   }
163   return *this ; 
164 }
165
166 //___________________________________________________________________________
167 void AliRunTag::CopyStandardContent(AliRunTag *oldtag) {
168   //function that copies the run, lhc and detector levels
169   SetRunId(oldtag->GetRunId());
170   SetMagneticField(oldtag->GetMagneticField());
171   SetDipoleField(oldtag->GetDipoleField());
172   SetRunStartTime(oldtag->GetRunStartTime());
173   SetRunStopTime(oldtag->GetRunStopTime());
174   SetAlirootVersion(oldtag->GetAlirootVersion());
175   SetRootVersion(oldtag->GetRootVersion());
176   SetGeant3Version(oldtag->GetGeant3Version());
177   SetLHCPeriod(oldtag->GetLHCPeriod());
178   SetReconstructionPass(oldtag->GetReconstructionPass());
179   SetProductionName(oldtag->GetProductionName());
180   SetRunQuality(oldtag->GetRunQuality());
181   SetBeamEnergy(oldtag->GetBeamEnergy());
182   SetBeamType(oldtag->GetBeamType());
183   SetCalibVersion(oldtag->GetCalibVersion());
184   SetDataType(oldtag->GetDataType());
185   SetLHCTag(oldtag->GetLHCTag()->GetLuminosity(),oldtag->GetLHCTag()->GetLHCState());
186   SetDetectorTag(oldtag->GetDetectorTags()->GetIntDetectorMaskDAQ(), oldtag->GetDetectorTags()->GetIntDetectorMaskReco());
187   SetQA(*(oldtag->GetQA())) ;   
188   SetQAArray(oldtag->GetQAArray(), oldtag->GetQALength()) ;  
189   SetEventSpecies(oldtag->GetEventSpecies(), oldtag->GetESLength()) ;  
190 }
191
192 //___________________________________________________________________________
193 void AliRunTag::SetQAArray(ULong_t * qa, Int_t qalength) {
194   //Setter for the qa bits 
195   if (qa && qalength > 0) {
196     fQALength = qalength ; 
197     if (fQAArray) 
198       delete [] fQAArray ; 
199     fQAArray = new ULong_t[qalength] ; 
200     memcpy(fQAArray, qa, qalength*sizeof(ULong_t)) ;
201   }
202 }
203
204 //___________________________________________________________________________
205 void AliRunTag::SetEventSpecies(Bool_t * es, Int_t eslength) {
206   //setter for the eventspecices 
207   if (es && eslength >0 ) {
208     fESLength = eslength ; 
209     if (fEventSpecies) 
210       delete [] fEventSpecies ; 
211     fEventSpecies = new Bool_t[eslength] ;
212     memcpy(fEventSpecies, es, eslength*sizeof(Bool_t)) ; 
213   }
214 }
215
216
217 //___________________________________________________________________________
218 void AliRunTag::SetLHCTag(Float_t lumin, TString type) {
219   //Setter for the LHC tags
220   fLHCTag.SetLHCTag(lumin,type);
221 }
222
223 //___________________________________________________________________________
224 void AliRunTag::SetDetectorTag(UInt_t mask, UInt_t maskReco) {
225   //Setter for the detector tags
226   fDetectorTag.SetDetectorMaskDAQ(mask);
227   if (maskReco == 0)
228     fDetectorTag.SetDetectorMaskReco(mask);
229   else
230     fDetectorTag.SetDetectorMaskReco(maskReco);
231
232   int ndet = 0;
233   for (int iter=0; iter<32; iter++)  
234     ndet += (mask & (1 << iter)) > 0;
235   
236   fNumDetectors = ndet;
237 }
238
239 //___________________________________________________________________________
240 void AliRunTag::AddEventTag(const AliEventTag & EvTag) {
241   //Adds an entry to the event tag TClonesArray
242   new(fEventTag[fNumEvents++]) AliEventTag(EvTag);
243 }
244
245 //___________________________________________________________________________
246 void AliRunTag::Clear(const char *) {
247   //Resets the number of events and detectors
248   fEventTag.Delete();
249   fNumEvents = 0;
250   fDetectorTag.Clear();
251   fNumDetectors = 0;
252   if ( fQAArray ) {
253     delete [] fQAArray ;
254     fQAArray = 0x0;
255   } 
256   fQALength=0;
257   if ( fEventSpecies ) {
258     delete [] fEventSpecies ;
259     fEventSpecies = 0x0;
260   } 
261   fESLength=0;
262 }