KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVDataPatchList.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Thu Jan 30 11:06:10 2014
2 //Author: John Frankland,,,
3 
4 #include "KVDataPatchList.h"
5 #include "KVDataPatch.h"
6 #include <TPluginManager.h>
7 
9 
11 
12 
15 
17 {
18  // Fill static list of patches from KVDataPatch plugin list
19 
20  KVString plugins = GetListOfPlugins("KVDataPatch");
21  if (plugins == "") {
22  Info("FillPatchList", "No data patch plugins defined");
23  return;
24  }
25  plugins.Begin(" ");
26  while (!plugins.End()) {
27  KVString plug = plugins.Next(kTRUE);
28  TPluginHandler* h = LoadPlugin("KVDataPatch", GetPluginURI("KVDataPatch", plug));
29  if (h) {
30  KVDataPatch* p = (KVDataPatch*)h->ExecPlugin(0);
31  fPatchList->Add(p);
32  }
33  else
34  Warning("FillPatchList", "Cannot load plugin data patch %s", plug.Data());
35  }
36 }
37 
38 
39 
41 
43 {
46  if (!fPatchList) {
48  FillPatchList();
49  }
50 }
51 
52 
53 
56 
58 {
59  // Default constructor
60  init();
61 }
62 
63 
64 
65 
68 
69 KVDataPatchList::KVDataPatchList(const Char_t* name, const Char_t* title) : KVBase(name, title)
70 {
71  // Write your code here
72  init();
73 }
74 
75 
76 
79 
81 {
82  // Destructor
83 }
84 
85 
86 
89 
90 void KVDataPatchList::InitializePatchList(TString dataset, TString datatype, Int_t runnumber,
91  TString dataseries, Int_t datareleasenumber, const TList* streamerinfolist)
92 {
93  // Fill lists of active patches for given data
94 
95  Info("InitializePatchList",
96  "Initializing patches for |%s|%s|%04d|%s|%02d|",
97  dataset.Data(), datatype.Data(), runnumber, dataseries.Data(), datareleasenumber);
102  TIter nxtP(fPatchList);
103  KVDataPatch* patch;
104  while ((patch = (KVDataPatch*)nxtP())) {
105  if (patch->IsRequired(dataset, datatype, runnumber, dataseries, datareleasenumber, streamerinfolist)) {
106  if (patch->IsEventPatch()) {
107  fActiveEventPatches.Add(patch);
109  }
110  if (patch->IsParticlePatch()) {
113  }
114  }
115  }
116 }
117 
118 
119 
122 
124 {
125  // Apply all currently active patches to event
126 
127  if (fEventPatches) {
128  // Apply event-level patches
130  KVDataPatch* patch;
131  while ((patch = (KVDataPatch*)nxt())) patch->ApplyToEvent(event);
132  }
133  if (fParticlePatches) {
134  // Apply particle-level patches
136  KVDataPatch* patch;
137  KVNucleus* particle;
138  while ((particle = event->GetNextParticle())) {
139  while ((patch = (KVDataPatch*)nxt())) patch->ApplyToParticle(particle);
140  nxt.Reset();
141  }
142  }
143 }
144 
145 
146 
149 
151 {
152  // Print list of currently active patches
153  if (!fEventPatches && !fParticlePatches) {
154  Info("Print", "No currently active data patches");
155  return;
156  }
157  if (fEventPatches) {
158  Info("Print", "Currently active event-level patches:");
160  }
161  if (fParticlePatches) {
162  Info("Print", "Currently active particle-level patches:");
164  }
165 }
166 
167 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
char Char_t
const Bool_t kFALSE
const Bool_t kTRUE
const char Option_t
Base class for KaliVeda framework.
Definition: KVBase.h:135
static const Char_t * GetListOfPlugins(const Char_t *base)
Definition: KVBase.cpp:1223
static const Char_t * GetPluginURI(const Char_t *base, const Char_t *plugin)
Definition: KVBase.cpp:1140
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
Definition: KVBase.cpp:756
List of corrections to be applied to reconstructed calibrated data.
Bool_t fEventPatches
=kTRUE if there are event-level patches
virtual ~KVDataPatchList()
Destructor.
void Apply(KVEvent *)
Apply all currently active patches to event.
void Print(Option_t *="") const
Print list of currently active patches.
Bool_t fParticlePatches
=kTRUE if there are particle-level patches
static KVUniqueNameList * fPatchList
list of all defined patches
void InitializePatchList(TString dataset, TString datatype, Int_t runnumber, TString dataseries, Int_t datareleasenumber, const TList *streamerinfolist)
Fill lists of active patches for given data.
void FillPatchList()
Fill static list of patches from KVDataPatch plugin list.
KVUniqueNameList fActiveParticlePatches
list of currently active particle-level patches
KVUniqueNameList fActiveEventPatches
list of currently active event-level patches
KVDataPatchList()
Default constructor.
Correction to be applied to reconstructed calibrated data.
Definition: KVDataPatch.h:55
virtual void ApplyToParticle(KVNucleus *)=0
virtual Bool_t IsParticlePatch()=0
virtual void ApplyToEvent(KVEvent *)=0
virtual Bool_t IsRequired(TString dataset, TString datatype, Int_t runnumber, TString dataseries, Int_t datareleasenumber, const TList *streamerinfolist)=0
virtual Bool_t IsEventPatch()=0
Base class container for multi-particle events.
Definition: KVEvent.h:176
Description of properties and kinematics of atomic nuclei.
Definition: KVNucleus.h:125
virtual void Clear(Option_t *option="")
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
void Begin(TString delim) const
Definition: KVString.cpp:562
Bool_t End() const
Definition: KVString.cpp:625
KVString Next(Bool_t strip_whitespace=kFALSE) const
Definition: KVString.cpp:675
Optimised list in which named objects can only be placed once.
virtual void Add(TObject *obj)
virtual void Print(Option_t *option, const char *wildcard, Int_t recurse=1) const
void Reset()
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
const char * Data() const
TH1 * h