KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVACQParam.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  kvacqparam.cpp - description
3  -------------------
4  begin : Wed Nov 20 2002
5  copyright : (C) 2002 by J.D. Frankland
6  email : frankland@ganil.fr
7 
8 $Id: KVACQParam.cpp,v 1.23 2007/12/06 15:12:54 franklan Exp $
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  ***************************************************************************/
19 
20 #include "Riostream.h"
21 #include "KVACQParam.h"
22 #include "KVDetector.h"
23 #include "TRandom.h"
24 
25 using namespace std;
26 
29 //16-bit data acquisition parameters read from raw data.
30 //
31 //This class provides a link between the values of the parameters for each event as read
32 //from a raw data file, and the detectors. Each detector has a KVACQParam object for each
33 //parameter concerning it written in the raw data file (KVDetector::SetACQParams is
34 //responsible for setting up a list of the relevant KVACQParams for each instance).
35 //
36 //GetCoderData() returns the 16-bit integer value of the acquisition parameter
37 //as read from the file. "-1" means that the parameter was not present in the event.
38 //
39 //GetData() takes the value of GetCoderData() and adds a random number in the range
40 //[-0.5,+0.5] to give continuous floating-point values."-1" means that the parameter was
41 //not present in the event.
42 //
43 //Fired() returns true or false depending on if the parameter was 'fired' (i.e. if GetCoderData is > -1)
44 //
45 //GetPedestal() returns the current pedestal value associated to this parameter
46 //Another possibility to access to the pedestal for the current run is to
47 // set a constant pedestal value with SetPedestal() and load only the correction for the current run with SetDeltaPedestal(). Then the real pedestal is given
48 // by GetPetestal()+GetDeltaPedestal(). This method can be usefull in the case where
49 // the correction only depends from the QDC (i.e. all detectors of a same
50 // QDC have the same pedestal correction).
52 
53 
54 
57 void KVACQParam::init()
58 {
59 //Default initialisations
60  fChannel = 0;
61  fData = (Short_t) - 1;
62  fDet = 0;
63  fPied = 0.;
64  fDeltaPied = 0.;
65  fWorks = kTRUE;
66  fNbBits = 16;
67 }
68 
69 
70 
73 
75  : KVBase()
76 {
77  //default constructor
78  init();
79 }
80 
81 
82 
85 
86 KVACQParam::KVACQParam(const TString& name, const TString& type)
87  : KVBase(name, type)
88 {
89  // Make acquisition parameter with given name & type.
90  init();
91 }
92 
93 
94 //
95 
98 
100 {
101  //Copy ctor
102  init();
103 #if ROOT_VERSION_CODE >= ROOT_VERSION(3,4,0)
104  obj.Copy(*this);
105 #else
106  ((KVACQParam&) obj).Copy(*this);
107 #endif
108 }
109 
110 
112 #if ROOT_VERSION_CODE >= ROOT_VERSION(3,4,0)
113 
118 
119 void KVACQParam::Copy(TObject& obj) const
120 #else
121 void KVACQParam::Copy(TObject& obj)
122 #endif
123 {
124  //
125  //Copy this to obj
126  //
127  KVBase::Copy(obj);
128  ((KVACQParam&) obj).SetData(GetCoderData());
129  if (GetDetector())
130  ((KVACQParam&) obj).SetDetector(GetDetector());
131  ((KVACQParam&) obj).SetNbBits(GetNbBits());
132  ((KVACQParam&)obj).SetPedestal(GetPedestal());
133  ((KVACQParam&)obj).SetDeltaPedestal(GetDeltaPedestal());
134  ((KVACQParam&)obj).SetWorking(IsWorking());
135 }
136 
137 
138 
140 
142 {
143  cout << "_________________________________________" << endl;
144  cout << " KVACQParam: " << GetName() << " " << GetType() << endl;
145  if (GetDetector())
146  cout << " Detector: " << GetDetector()->GetName() << endl;
147  cout << " Data = " << GetCoderData() << endl;
148  cout << "_________________________________________" << endl;
149 }
150 
151 
152 
155 
157 {
158  //Dump name of parameter, raw coder value, and "randomised" value
159  cout << ClassName() << " : " << GetName() << " raw=" << GetCoderData()
160  << " randomised=" << GetData() << endl;
161 }
162 
163 
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
short Short_t
const Bool_t kTRUE
const char Option_t
int type
GANIL VXI/VME acquisition parameter.
Definition: KVACQParam.h:15
void init()
Default initialisations.
Definition: KVACQParam.cpp:57
void ls(Option_t *option="") const
Dump name of parameter, raw coder value, and "randomised" value.
Definition: KVACQParam.cpp:156
virtual void Print(Option_t *opt="") const
Definition: KVACQParam.cpp:141
Short_t GetCoderData() const
Definition: KVACQParam.h:64
Double_t GetData() const
Definition: KVACQParam.h:72
KVDetector * GetDetector() const
Definition: KVACQParam.h:40
virtual void Copy(TObject &) const
Definition: KVACQParam.cpp:119
KVACQParam()
default constructor
Definition: KVACQParam.cpp:74
Base class for KaliVeda framework.
Definition: KVBase.h:135
const Char_t * GetType() const
Definition: KVBase.h:170
virtual void Copy(TObject &) const
Make a copy of this object.
Definition: KVBase.cpp:397
virtual const char * GetName() const
virtual const char * ClassName() const