KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVSimDirFilterAnalyser.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Thu Mar 23 14:02:40 2017
2 //Author: John Frankland,,,
3 
5 #include <KVClassFactory.h>
6 #include <KVDataSetManager.h>
7 #include <KVExpDB.h>
8 #include <KVTriggerConditions.h>
9 #include "KVMultiDetArray.h"
10 
12 
13 
14 
19 {
20  // Default constructor
21 }
22 
23 
24 
25 
28 
30 {
31  // Destructor
32 
34 }
35 
36 
37 
40 
42 {
43  // Use options passed to KVEventSelector to initialise dataset used for filter
44 
45  if (!gDataSetManager) {
48  }
50 }
51 
52 
53 
57 
59 {
60  // Use options passed to KVEventSelector to initialise kinematics for reaction
61  // and build experimental set-up
62 
63  KVString system = fAnalysisClass->GetOpt("System");
64  fSystem = gExpDB->GetSystem(system);
65  if (fSystem) {
67  }
68  else {
69  fKinematics = new KV2Body(system);
70  fKinematics->SetBit(kCanDelete); // clean up in destructor
72  }
73  KVString run = fAnalysisClass->GetOpt("Run");
74  fRun = gExpDB->GetDBRun(run.Atoi());
77  // put detector array in simulation mode
79 }
80 
81 
82 
87 
89 {
90  // Called by KVEventSelector just after reading new event and just before calling user analysis
91  //
92  // Copy calculated energy losses of all particles into the detectors
93 
95 
96  for (auto& n : EventIterator(fAnalysisClass->GetEvent())) {
97  for (auto& p : *n.GetParameters()) {
98  auto d = gMultiDetArray->GetDetector(p.GetName());
99  if (d) {
100  // sum up energy losses in each detector
101  d->SetEnergyLoss(p.GetDouble() + d->GetEnergyLoss());
102  }
103  }
104  }
105 }
106 
107 
108 
111 
113 {
114  // Generate a new filtered analysis selector class
115 
116  KVClassFactory cf(kvsname, "Analysis of filtered simulated events", "",
117 #ifndef USING_ROOT6
118  kTRUE, "FilteredEventAnalysisTemplate");
119 #else
120  kTRUE, "ROOT6FilteredEventAnalysisTemplate");
121 #endif
122  cf.AddImplIncludeFile("KVReconstructedNucleus.h");
123  cf.AddImplIncludeFile("KVBatchSystem.h");
124 
125  cf.GenerateCode();
126 }
127 
128 
129 #ifdef USING_ROOT6
130 
141 
143 {
144  // When called from the InitRun() method of a user's analysis class, this method will ensure that only data
145  // compatible with the experimental trigger will be provided for analysis in the user's Analysis() method.
146  //
147  // This will be done by searching for a KVTriggerConditions plugin class defined for the currently-analysed
148  // dataset, defined like so:
149  //
150  //~~~~
151  //+Plugin.KVTriggerConditions: [dataset] [classname] [libname] "[default constructor]()"
152  //~~~~
153 
154  TPluginHandler* ph = KVBase::LoadPlugin("KVTriggerConditions", gDataSet->GetName());
155  if (!ph) {
156  Info("SetTriggerConditionsForRun",
157  "No definition of trigger conditions available for dataset %s",
158  gDataSet->GetName());
159  return;
160  }
161  std::unique_ptr<KVTriggerConditions> trig((KVTriggerConditions*) ph->ExecPlugin(0));
162  trig->SetTriggerConditionsForRun(fAnalysisClass, run);
163 }
164 
165 #endif
166 //____________________________________________________________________________//
167 
168 
KVDataSetManager * gDataSetManager
KVDataSet * gDataSet
Definition: KVDataSet.cpp:29
KVExpDB * gExpDB
Definition: KVExpDB.cpp:13
KVMultiDetArray * gMultiDetArray
KVTemplateEvent< KVNucleus >::EventIterator EventIterator
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
#define d(i)
char Char_t
const Bool_t kTRUE
Relativistic binary kinematics calculator.
Definition: KV2Body.h:165
void CalculateKinematics()
Definition: KV2Body.cpp:678
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
Definition: KVBase.cpp:793
Factory class for generating skeleton files for new classes.
void GenerateCode()
Generate header and implementation file for currently-defined class.
void AddImplIncludeFile(const Char_t *filename)
KV2Body * GetKinematics()
Definition: KVDBSystem.cpp:80
Manage all datasets contained in a given data repository.
virtual Bool_t Init(KVDataRepository *=0)
KVDataSet * GetDataSet(Int_t) const
Return pointer to DataSet using index in list of all datasets, index>=0.
void cd() const
Definition: KVDataSet.cpp:736
virtual void SetCurrentRun(KVDBRun *)
KVEvent * GetEvent() const
TString GetOpt(const Char_t *option) const
virtual KVDBSystem * GetSystem(const Char_t *system) const
Definition: KVExpDB.h:84
KVDBRun * GetDBRun(Int_t number) const
Definition: KVExpDB.h:75
KVDetector * GetDetector(const Char_t *name) const
Return detector in this structure with given name.
virtual void SetMinimumOKMultiplicity(KVEvent *) const
static KVMultiDetArray * MakeMultiDetector(const Char_t *dataset_name, Int_t run=-1, TString classname="KVMultiDetArray")
virtual void SetSimMode(Bool_t on=kTRUE)
Class piloting analyses of simulated data.
Manage user analysis of filtered simulation data.
virtual ~KVSimDirFilterAnalyser()
Destructor.
static void Make(const Char_t *kvsname="MyFilteredAnalysis")
Generate a new filtered analysis selector class.
KVDBRun * fRun
currently analysed run
KVEventSelector * fAnalysisClass
user analysis class
void preInitAnalysis()
Use options passed to KVEventSelector to initialise dataset used for filter.
KVDBSystem * fSystem
currently analysed system
KV2Body * fKinematics
kinematics of reaction
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
Set trigger conditions for analysis of reconstructed data.
virtual const char * GetName() const
void SetBit(UInt_t f)
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void Info(const char *method, const char *msgfmt,...) const
Longptr_t ExecPlugin(int nargs, const T &... params)
Int_t Atoi() const
const Int_t n