KaliVeda
Toolkit for HIC analysis
KVRawDataPatchList.cpp
1 #include "KVRawDataPatchList.h"
2 #include <TPluginManager.h>
3 #include "KVRawDataPatch.h"
4 
6 
8 
9 
12 
14 {
15  // Fill static list of patches from KVRawDataPatch plugin list
16 
17  KVString plugins = GetListOfPlugins("KVRawDataPatch");
18  if (plugins == "") {
19  Info("FillPatchList", "No raw data patch plugins defined");
20  return;
21  }
22  plugins.Begin(" ");
23  while (!plugins.End()) {
24  KVString plug = plugins.Next(kTRUE);
25  TPluginHandler* h = LoadPlugin("KVRawDataPatch", GetPluginURI("KVRawDataPatch", plug));
26  if (h) {
27  auto p = (KVRawDataPatch*)h->ExecPlugin(0);
28  fPatchList->Add(p);
29  }
30  else
31  Warning("FillPatchList", "Cannot load plugin data patch %s", plug.Data());
32  }
33 }
34 
35 
36 
38 
40 {
41  if (!fPatchList) {
43  FillPatchList();
44  }
45 }
46 
47 
48 
51 
53 {
54  // Fill lists of active patches for given data
55 
56  Info("InitializePatchList",
57  "Initializing patches for |%s|%s|",
58  dataset.Data(), runnumber.as_string().Data());
60  TIter nxtP(fPatchList);
61  KVRawDataPatch* patch;
62  while ((patch = (KVRawDataPatch*)nxtP())) {
63  if (patch->IsRequired(dataset, runnumber))
64  fActivePatches.Add(patch);
65  }
66 
67 }
68 
69 
70 
74 
76 {
77  // Returns kTRUE if any active patch rejects the current event
78  // - called just after KVMultiDetArray::HandleRawDataEvent
79 
80  TIter nxt(&fActivePatches);
81  KVRawDataPatch* patch;
82  while ((patch = (KVRawDataPatch*)nxt()))
83  if (patch->SkipEvent(mda)) return kTRUE;
84  return kFALSE;
85 }
86 
87 
88 
91 
93 {
94  // Print list of currently active patches
95  if (!HasActivePatches()) {
96  Info("Print", "No currently active raw data patches");
97  return;
98  }
99  else {
100  Info("Print", "Currently active raw data patches:");
102  }
103 }
104 
105 
bool Bool_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
const char Option_t
winID h TVirtualViewer3D TVirtualGLPainter p
static const Char_t * GetListOfPlugins(const Char_t *base)
Definition: KVBase.cpp:1228
static const Char_t * GetPluginURI(const Char_t *base, const Char_t *plugin)
Definition: KVBase.cpp:1145
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
Definition: KVBase.cpp:772
Base class for describing the geometry of a detector array.
List of corrections to be applied to raw data.
Bool_t HasActivePatches() const
static KVUniqueNameList * fPatchList
list of all defined patches
void FillPatchList()
Fill static list of patches from KVRawDataPatch plugin list.
void Print(Option_t *="") const
Print list of currently active patches.
KVUniqueNameList fActivePatches
list of currently active patches
void InitializePatchList(TString dataset, const run_index_t &runnumber)
Fill lists of active patches for given data.
Bool_t SkipEvent(KVMultiDetArray *)
Patches for analysis of raw dataAbstract base class for patches to be applied to raw data before user...
virtual Bool_t IsRequired(TString dataset, const run_index_t &runnumber)=0
virtual Bool_t SkipEvent(KVMultiDetArray *)=0
void Clear(Option_t *option="") override
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
void Begin(TString delim) const
Definition: KVString.cpp:565
Bool_t End() const
Definition: KVString.cpp:634
KVString Next(Bool_t strip_whitespace=kFALSE) const
Definition: KVString.cpp:695
Optimised list in which named objects can only be placed once.
void Add(TObject *obj) override
virtual void Print(Option_t *option, const char *wildcard, Int_t recurse=1) const
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
const char * Data() const
Specifies a runfile according to run number and file index ,.
Definition: run_index.h:33
TString as_string() const
Definition: run_index.h:94
TH1 * h
ClassImp(TPyArg)