]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliRunTag.cxx
For Pythia with tune don't switch off MI in ConfigHeavyFlavor
[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     fAliceRunStartTime(0),
36     fAliceRunStopTime(0),
37     fAlirootVersion(0),
38     fRootVersion(0),
39     fGeant3Version(0),
40     fAliceRunQuality(0),
41     fAliceBeamEnergy(0.0),
42     fAliceBeamType(0),
43     fAliceCalibrationVersion(0),
44     fAliceDataType(0),
45     fNumEvents(0),
46     fNumDetectors(0),
47     fEventTag("AliEventTag", 1000),
48     fDetectorTag(),
49     fLHCTag(), 
50     fQA(),  
51     fQALength(0), 
52     fQAArray(NULL), 
53     fESLength(0), 
54     fEventSpecies(NULL)
55 {
56   //Default constructor
57 }
58
59 //___________________________________________________________________________
60 AliRunTag::~AliRunTag() {
61   //Destructor
62   fEventTag.Delete();
63   if ( fQAArray ) 
64     delete [] fQAArray ; 
65   if ( fEventSpecies )
66     delete [] fEventSpecies ; 
67 }
68
69 //___________________________________________________________________________
70 AliRunTag::AliRunTag(const AliRunTag& tag):
71 TObject(),
72 fAliceRunId(tag.fAliceRunId),
73 fAliceMagneticField(tag.fAliceMagneticField),
74 fAliceRunStartTime(tag.fAliceRunStartTime),
75 fAliceRunStopTime(fAliceRunStopTime),
76 fAlirootVersion(tag.fAlirootVersion),
77 fRootVersion(tag.fRootVersion),
78 fGeant3Version(tag.fGeant3Version),
79 fAliceRunQuality(tag.fAliceRunQuality),
80 fAliceBeamEnergy(tag.fAliceBeamEnergy),
81 fAliceBeamType(tag.fAliceBeamType),
82 fAliceCalibrationVersion(tag.fAliceCalibrationVersion),
83 fAliceDataType(tag.fAliceDataType),
84 fNumEvents(tag.fNumEvents),
85 fNumDetectors(tag.fNumDetectors),
86 fEventTag(tag.fEventTag),
87 fDetectorTag(tag.fDetectorTag),
88 fLHCTag(tag.fLHCTag), 
89 fQA(tag.fQA),
90 fQALength(tag.fQALength),
91 fQAArray(NULL), 
92 fESLength(tag.fESLength),
93 fEventSpecies(NULL)
94 {
95   //copy constructor
96   if (fQALength == 0 ) 
97     fQAArray = NULL ; 
98   else {
99     fQAArray = new ULong_t[fQALength] ; 
100     memcpy(fQAArray, tag.fQAArray, fQALength*sizeof(ULong_t)) ;
101   }
102   if (fESLength == 0 ) 
103     fEventSpecies = NULL ; 
104   else {
105     fEventSpecies = new Bool_t[fESLength] ; 
106     memcpy(fEventSpecies, tag.fEventSpecies, fESLength*sizeof(Bool_t)) ;
107   }
108 }
109
110 //___________________________________________________________________________
111 AliRunTag& 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 ;  
131     fQA                       = tag.fQA ;      
132     fQALength                 = tag.fQALength ; 
133     if (fQAArray) 
134       delete [] fQAArray ; 
135     if (fQALength == 0 ) 
136       fQAArray = NULL ; 
137     else {
138       fQAArray = new ULong_t[fQALength] ; 
139       memcpy(fQAArray, tag.fQAArray, fQALength*sizeof(ULong_t)) ;
140     }
141     fESLength                 = tag.fESLength ; 
142     if (fEventSpecies)
143       delete [] fEventSpecies ; 
144     if (fESLength == 0 ) 
145       fEventSpecies = NULL ; 
146     else {
147       fEventSpecies = new Bool_t[fESLength] ; 
148       memcpy(fEventSpecies, tag.fEventSpecies, fESLength*sizeof(Bool_t)) ;
149     }
150   }
151   return *this ; 
152 }
153
154 //___________________________________________________________________________
155 void 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());
170   SetDetectorTag(oldtag->GetDetectorTags()->GetIntDetectorMask());
171   SetQA(*(oldtag->GetQA())) ;   
172   SetQAArray(oldtag->GetQAArray(), oldtag->GetQALength()) ;  
173         SetEventSpecies(oldtag->GetEventSpecies(), oldtag->GetESLength()) ;  
174 }
175
176 //___________________________________________________________________________
177 void AliRunTag::SetQAArray(ULong_t * qa, Int_t qalength) {
178   //Setter for the qa bits 
179   if (qa && qalength > 0) {
180     fQALength = qalength ; 
181     if (fQAArray) 
182       delete [] fQAArray ; 
183     fQAArray = new ULong_t[qalength] ; 
184     memcpy(fQAArray, qa, qalength*sizeof(ULong_t)) ;
185   }
186 }
187
188 //___________________________________________________________________________
189 void AliRunTag::SetEventSpecies(Bool_t * es, Int_t eslength) {
190   //setter for the eventspecices 
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   }
198 }
199
200
201 //___________________________________________________________________________
202 void AliRunTag::SetLHCTag(Float_t lumin, TString type) {
203   //Setter for the LHC tags
204   fLHCTag.SetLHCTag(lumin,type);
205 }
206
207 //___________________________________________________________________________
208 void AliRunTag::SetDetectorTag(UInt_t mask) {
209   //Setter for the detector tags
210   fDetectorTag.SetDetectorMask(mask);
211 }
212
213 //___________________________________________________________________________
214 void AliRunTag::AddEventTag(const AliEventTag & EvTag) {
215   //Adds an entry to the event tag TClonesArray
216   new(fEventTag[fNumEvents++]) AliEventTag(EvTag);
217 }
218
219 //___________________________________________________________________________
220 void AliRunTag::Clear(const char *) {
221   //Resets the number of events and detectors
222   fEventTag.Delete();
223   fNumEvents = 0;
224   fDetectorTag.Clear();
225   fNumDetectors = 0;
226   if ( fQAArray ) {
227     delete [] fQAArray ;
228     fQAArray = 0x0;
229   } 
230   fQALength=0;
231   if ( fEventSpecies ) {
232     delete [] fEventSpecies ;
233     fEventSpecies = 0x0;
234   } 
235   fESLength=0;
236 }