KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVUpDater.cpp
1/*
2$Id: KVUpDater.cpp,v 1.4 2006/10/19 14:32:43 franklan Exp $
3$Revision: 1.4 $
4$Date: 2006/10/19 14:32:43 $
5$Author: franklan $
6*/
7
8#include "KVUpDater.h"
9#include "TPluginManager.h"
10#include "KVBase.h"
11#include "Riostream.h"
12#include "KVMultiDetArray.h"
13#include "KVIDTelescope.h"
14#include "KVIDGridManager.h"
15#include "KVDetector.h"
16#include "KVCalibrator.h"
17#include "KVExpDB.h"
18
19using namespace std;
20
21
24
26KVUpDater::KVUpDater() : fArray(nullptr)
27{
28 //Default ctor for KVUpDater object.
29}
30
31
32
33
36
38{
39 //Destructor.
40}
41
42
43
45
50
51
52
58
60{
61 //Looks for plugin (see $KVROOT/KVFiles/.kvrootrc) with name 'uri'(=name of dataset),
62 //loads plugin library, creates object and returns pointer.
63 //If no plugin defined for dataset, instanciates a KVUpDater (default)
64
65 //check and load plugin library
67 KVUpDater* upd = 0;
68 if (!(ph = KVBase::LoadPlugin("KVUpDater", uri))) {
69 upd = new KVUpDater;
70 }
71 else {
72 upd = (KVUpDater*) ph->ExecPlugin(0);
73 }
74 upd->fDataSet = uri;
75 upd->SetArray(a);
76 return upd;
77}
78
79
80
90
91void KVUpDater::SetParameters(UInt_t run, Bool_t physics_parameters_only)
92{
93 // Set parameters of multidetector for this run
94 //
95 //This will:
96 // set the target corresponding to the run
97 // set detector statuses (present/working) for the run
98 //If physics_parameters_only==false:
99 // set calibration parameters for the run
100 // set identification parameters for the run
101
102 if (!gExpDB) return;
103 cout << "Setting parameters of multidetector array for run " << run << ":" <<
104 endl;
105 KVDBRun* kvrun = gExpDB->GetDBRun(run);
106 if (!kvrun) {
107 Error("SetParameters(UInt_t)", "Run %u not found in database!", run);
108 return;
109 }
110 SetTarget(kvrun);
112 if (!physics_parameters_only) {
115 }
116}
117
118
119
120
125
127{
128 //Set target used during this run
129 //If no target is found in the database, the existing target (if there is one)
130 //will be removed, and the multidetector array will have no target defined.
131
132 cout << "--> Setting Target:" << endl;
133
134 //remove existing target
135 fArray->SetTarget(0);
136 if (!kvrun->GetSystem() || !kvrun->GetSystem()->GetTarget()) {
137 cout << " No target defined for run." << endl;
138 return;
139 }
140
142
143 cout << " " << fArray->GetTarget()->
144 GetName() << " Total Thickness: " << fArray->GetTarget()->
145 GetTotalThickness()
146 << " mg/cm2" << endl;
147}
148
149
150
151
156
158{
159 // Set identification parameters for this run.
160 // Will call gMultiDetArray->InitializeIDTelescopes() in order to initialize
161 // identifications & set status IsReadyForID() of each ID telescope for run.
162
163 cout << "Setting identification parameters of multidetector array for run " << run << ":" <<
164 endl;
165 SetIDGrids(run);
167}
168
169
170
171
176
178{
179 // Use global ID grid manager gIDGridManager to set identification grids for all
180 // ID telescopes for this run. First, any previously set grids are removed.
181 // Then all grids for current run are set in the associated ID telescopes.
182
183 cout << "--> Setting Identification Grids" << endl;
185 KVIDTelescope* idt;
186 while ((idt = (KVIDTelescope*) next_idt())) {
187 idt->RemoveGrids();
188 }
190}
191
192
193
194
197
199{
200 //Set calibration parameters for this run.
201
202 cout << "Setting calibration parameters of multidetector array for run " << run << ":" <<
203 endl;
204 KVDBRun* kvrun = gExpDB->GetDBRun(run);
205 if (!kvrun) {
206 Error("SetParameters(UInt_t)", "Run %u not found in database!", run);
207 return;
208 }
209 SetCalibParameters(kvrun);
210}
211
212
213
216
218{
219 // Override in child classes to set specific calibrations.
221}
222
223
unsigned int UInt_t
ROOT::R::TRInterface & r
bool Bool_t
char Char_t
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
Definition KVBase.cpp:793
Description of an experimental run in database ,,.
Definition KVDBRun.h:36
KVDBSystem * GetSystem() const
Definition KVDBRun.cpp:242
KVTarget * GetTarget() const
Definition KVDBSystem.h:79
KVDBRun * GetDBRun(Int_t number) const
Definition KVExpDB.h:76
Base class for all detectors or associations of detectors in array which can identify charged particl...
virtual void RemoveGrids()
Base class for describing the geometry of a detector array.
virtual void SetDetectorParametersForRun(KVDBRun *, const TString &="")
KVSeqCollection * GetListOfIDTelescopes() const
virtual void InitializeIDTelescopes()
virtual void SetTarget(KVTarget *target)
virtual void SetCalibratorParameters(KVDBRun *, const TString &="")
void SetGridsInTelescopes(UInt_t run)
KVTarget * GetTarget()
Calculation/correction of energy losses of particles through an experimental target.
Definition KVTarget.h:127
Abstract class implementing necessary methods for setting multidetector parameters for each run of th...
Definition KVUpDater.h:25
KVUpDater()
Default ctor for KVUpDater object.
Definition KVUpDater.cpp:26
virtual void SetParameters(UInt_t, Bool_t physics_parameters_only=kFALSE)
Definition KVUpDater.cpp:91
static KVUpDater * MakeUpDater(const Char_t *uri, KVMultiDetArray *)
Definition KVUpDater.cpp:59
virtual ~KVUpDater()
Destructor.
Definition KVUpDater.cpp:37
TString fDataSet
name of dataset associated
Definition KVUpDater.h:28
KVMultiDetArray * fArray
associated array
Definition KVUpDater.h:29
virtual void SetCalibrationParameters(UInt_t)
Set calibration parameters for this run.
virtual void SetIdentificationParameters(UInt_t)
void SetArray(KVMultiDetArray *)
Definition KVUpDater.cpp:46
virtual void SetIDGrids(UInt_t)
virtual void SetTarget(KVDBRun *)
virtual void SetCalibParameters(KVDBRun *)
Override in child classes to set specific calibrations.
const char * GetName() const override
Longptr_t ExecPlugin(int nargs)
void Error(const char *location, const char *fmt,...)
TArc a
ClassImp(TPyArg)