Belle II Software  release-08-01-10
BeamBkgMixerModule.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 // Own header.
10 #include <background/modules/BeamBkgMixer/BeamBkgMixerModule.h>
11 
12 
13 
14 // framework - DataStore
15 #include <framework/datastore/DataStore.h>
16 #include <framework/datastore/StoreArray.h>
17 #include <framework/datastore/StoreObjPtr.h>
18 #include <framework/datastore/RelationArray.h>
19 
20 // framework aux
21 #include <framework/core/ModuleParam.templateDetails.h>
22 #include <framework/logging/Logger.h>
23 
24 // SimHits
25 #include <pxd/dataobjects/PXDSimHit.h>
26 #include <svd/dataobjects/SVDSimHit.h>
27 #include <cdc/dataobjects/CDCSimHit.h>
28 #include <top/dataobjects/TOPSimHit.h>
29 #include <arich/dataobjects/ARICHSimHit.h>
30 #include <ecl/dataobjects/ECLHit.h>
31 #include <klm/dataobjects/KLMSimHit.h>
32 #include <simulation/dataobjects/BeamBackHit.h>
33 
34 // MetaData
35 #include <framework/dataobjects/EventMetaData.h>
36 #include <framework/dataobjects/BackgroundInfo.h>
37 
38 // Root
39 #include <TFile.h>
40 #include <TRandom3.h>
41 
42 //std::find
43 #include <algorithm>
44 
45 using namespace std;
46 using namespace Belle2;
47 
48 //-----------------------------------------------------------------
49 // Register module
50 //-----------------------------------------------------------------
51 
52 REG_MODULE(BeamBkgMixer);
53 
54 //-----------------------------------------------------------------
55 // Implementation
56 //-----------------------------------------------------------------
57 
58 BeamBkgMixerModule::BeamBkgMixerModule() : Module()
59 {
60  // set module description (e.g. insert text)
61  setDescription("Beam background mixer at SimHit level that uses beam background"
62  " simulation output directly (collision files) and not ROF files. "
63  "Each background event is shifted in time randomly within "
64  "a time window specified with minTime and maxTime.");
65 
66  // Add parameters
67  addParam("backgroundFiles", m_backgroundFiles,
68  "List of background (collision) files (wildcards not allowed - "
69  "use python glob.glob() to expand to list of files)");
70  addParam("minTime", m_minTime,
71  "Time window lower edge in nano seconds", -1000.0);
72  addParam("maxTime", m_maxTime,
73  "Time window upper edge in nano seconds", 800.0);
74  addParam("overallScaleFactor", m_overallScaleFactor,
75  "Overall factor to scale rates of backgrounds", 1.0);
76  addParam("scaleFactors", m_scaleFactors,
77  "Factors to scale rates of backgrounds. "
78  "Possible tag names: " + m_bgTypes.getBGTypes(),
80  addParam("components", m_components,
81  "Detector components to be included, empty list means all components",
82  m_components);
83  addParam("wrapAround", m_wrapAround,
84  "if true wrap around events passing time window upper edge", true);
85  addParam("minTimeECL", m_minTimeECL,
86  "Time window lower edge for ECL in nano seconds", -17600.0);
87  addParam("maxTimeECL", m_maxTimeECL,
88  "Time window upper edge for ECL in nano seconds", 8500.0);
89  addParam("minTimePXD", m_minTimePXD,
90  "Time window lower edge for PXD in nano seconds", -10000.0);
91  addParam("maxTimePXD", m_maxTimePXD,
92  "Time window upper edge for PXD in nano seconds", 10000.0);
93 
94  addParam("beambackhits", m_BeamBackHits,
95  "If true also add the BeamBackHits collection for the selected "
96  "subdetectors to the output file", false);
97 
98  addParam("maxEdepECL", m_maxEdepECL,
99  "maximal deposited energy of ECLHit to accept BG event for mixing"
100  "(0 means accept all events)", 1.0);
101 
102  addParam("cacheSize", m_cacheSize,
103  "file cache size in Mbytes. If negative, use root default", 0);
104 }
105 
107 {
108 }
109 
111 {
112 
113  // included components
114 
115  std::vector<std::string> components = m_components;
116  m_PXD = isComponentIncluded(components, "PXD");
117  m_SVD = isComponentIncluded(components, "SVD");
118  m_CDC = isComponentIncluded(components, "CDC");
119  m_TOP = isComponentIncluded(components, "TOP");
120  m_ARICH = isComponentIncluded(components, "ARICH");
121  m_ECL = isComponentIncluded(components, "ECL");
122  m_KLM = isComponentIncluded(components, "KLM");
123 
124  // ignore these ones
125 
126  isComponentIncluded(components, "MagneticField2d");
127  isComponentIncluded(components, "MagneticField3d");
128  isComponentIncluded(components, "MagneticField");
129  isComponentIncluded(components, "MagneticFieldConstant4LimitedRCDC");
130  isComponentIncluded(components, "MagneticFieldConstant4LimitedRSVD");
131  isComponentIncluded(components, "BeamPipe");
132  isComponentIncluded(components, "Cryostat");
133  isComponentIncluded(components, "FarBeamLine");
134  isComponentIncluded(components, "HeavyMetalShield");
135  isComponentIncluded(components, "COIL");
136  isComponentIncluded(components, "STR");
137  isComponentIncluded(components, "VXDService");
138 
139  if (!components.empty()) {
140  std::string str;
141  for (unsigned i = 0; i < components.size(); ++i) str = str + " " + components[i];
142  B2WARNING("Unknown components:" << str);
143  }
144 
145  // check files and append them to sample container
146 
147  for (auto file : m_backgroundFiles) {
148 
149  // wildcarding is not allowed anymore
150  if (TString(file.c_str()).Contains("*")) {
151  B2ERROR(file << ": wildcards are not allowed");
152  continue;
153  }
154 
155  // check the file existance
156  TFile* f = TFile::Open(file.c_str(), "READ");
157  if (!f) {
158  B2ERROR(file << ": file not found");
159  continue;
160  }
161  if (!f->IsOpen()) {
162  B2ERROR(file << ": can't open file");
163  continue;
164  }
165  f->Close();
166 
167  TChain persistent("persistent");
168  int nFiles = persistent.Add(file.c_str());
169  if (nFiles == 0) {
170  B2ERROR(file << ": no such files");
171  continue;
172  }
173  if (persistent.GetEntries() == 0) {
174  B2ERROR(file << ": tree 'persistent' has no entries");
175  continue;
176  }
177 
178  TObject* bkgMetaData = 0; // Note: allocation left to root
179  TBranch* branchBMD = persistent.GetBranch("BackgroundMetaData");
180  if (!branchBMD) {
181  B2ERROR(file << ": branch 'BackgroundMetaData' not found");
182  continue;
183  }
184  branchBMD->SetAddress(&bkgMetaData);
185 
186  std::vector<BackgroundMetaData::BG_TAG> tags;
187  std::vector<std::string> types;
188  std::vector<BackgroundMetaData::EFileType> fileTypes;
189  double realTime = 0;
190  for (unsigned k = 0; k < persistent.GetEntries(); k++) {
191  persistent.GetEntry(k);
192  BackgroundMetaData* bgMD = static_cast<BackgroundMetaData*>(bkgMetaData);
193  tags.push_back(bgMD->getBackgroundTag());
194  types.push_back(bgMD->getBackgroundType());
195  fileTypes.push_back(bgMD->getFileType());
196  realTime += bgMD->getRealTime();
197  }
198  if (realTime <= 0) {
199  B2ERROR(file << ": invalid realTime: " << realTime);
200  continue;
201  }
202  for (unsigned i = 1; i < tags.size(); ++i) {
203  if (tags[i] != tags[0]) {
204  B2ERROR(file << ": files with mixed background types not supported");
205  continue;
206  }
207  }
208  for (unsigned i = 1; i < fileTypes.size(); ++i) {
209  if (fileTypes[i] != fileTypes[0]) {
210  B2ERROR(file << ": files with mixed file types not supported");
211  continue;
212  }
213  }
214 
215  appendSample(tags[0], types[0], file, realTime, fileTypes[0]);
216 
217  }
218 
219 
220  // set scale factors
221 
222  for (auto scaleFactor : m_scaleFactors) {
223  std::string type = std::get<0>(scaleFactor);
224  if (m_bgTypes.getTag(type) == 0)
225  B2ERROR("Unknown beam background type found in 'scaleFactors': " << type << "\n"
226  "Possible are: " + m_bgTypes.getBGTypes());
227  for (auto& bkg : m_backgrounds) {
228  if (bkg.tag == m_bgTypes.getTag(type))
229  bkg.scaleFactor *= std::get<1>(scaleFactor);
230  }
231  }
232 
233  // open files for reading SimHits
234 
235  for (auto& bkg : m_backgrounds) {
236 
237  // define TChain for reading SimHits
238  bkg.tree.reset(new TChain("tree"));
239  for (unsigned i = 0; i < bkg.fileNames.size(); ++i) {
240  bkg.numFiles += bkg.tree->Add(bkg.fileNames[i].c_str());
241  }
242 
243  bkg.numEvents = bkg.tree->GetEntries();
244  bkg.rate = bkg.numEvents / bkg.realTime * bkg.scaleFactor;
245 
246  if (m_cacheSize >= 0) bkg.tree->SetCacheSize(m_cacheSize * 1024 * 1024);
247 
248  if (m_PXD and bkg.tree->GetBranch("PXDSimHits"))
249  bkg.tree->SetBranchAddress("PXDSimHits", &m_simHits.PXD);
250  if (m_SVD and bkg.tree->GetBranch("SVDSimHits"))
251  bkg.tree->SetBranchAddress("SVDSimHits", &m_simHits.SVD);
252  if (m_CDC and bkg.tree->GetBranch("CDCSimHits"))
253  bkg.tree->SetBranchAddress("CDCSimHits", &m_simHits.CDC);
254  if (m_TOP and bkg.tree->GetBranch("TOPSimHits"))
255  bkg.tree->SetBranchAddress("TOPSimHits", &m_simHits.TOP);
256  if (m_ARICH and bkg.tree->GetBranch("ARICHSimHits"))
257  bkg.tree->SetBranchAddress("ARICHSimHits", &m_simHits.ARICH);
258  if (m_ECL and bkg.tree->GetBranch("ECLHits"))
259  bkg.tree->SetBranchAddress("ECLHits", &m_simHits.ECL);
260  if (m_KLM and bkg.tree->GetBranch("KLMSimHits"))
261  bkg.tree->SetBranchAddress("KLMSimHits", &m_simHits.KLM);
262 
263  if (m_BeamBackHits and bkg.tree->GetBranch("BeamBackHits"))
264  bkg.tree->SetBranchAddress("BeamBackHits", &m_simHits.BeamBackHits);
265 
266  // print INFO
267  std::string unit(" ns");
268  double realTime = bkg.realTime;
269  if (realTime >= 1000.0) {realTime /= 1000.0; unit = " us";}
270  if (realTime >= 1000.0) {realTime /= 1000.0; unit = " ms";}
271  if (realTime >= 1000.0) {realTime /= 1000.0; unit = " s";}
272 
273  B2INFO("BeamBkgMixer: " << bkg.type <<
274  " tag=" << bkg.tag <<
275  " files=" << bkg.numFiles <<
276  " events=" << bkg.numEvents <<
277  " realTime=" << realTime << unit <<
278  " scaleFactor=" << bkg.scaleFactor <<
279  " rate=" << bkg.rate * 1000 << " MHz");
280  }
281 
282 
283  // SimHits registration
284 
285  StoreArray<PXDSimHit> pxdSimHits;
286  if (m_PXD) pxdSimHits.registerInDataStore();
287 
288  StoreArray<SVDSimHit> svdSimHits;
289  if (m_SVD) svdSimHits.registerInDataStore();
290 
291  StoreArray<CDCSimHit> cdcSimHits;
292  if (m_CDC) cdcSimHits.registerInDataStore();
293 
294  StoreArray<TOPSimHit> topSimHits;
295  if (m_TOP) topSimHits.registerInDataStore();
296 
297  StoreArray<ARICHSimHit> arichSimHits;
298  if (m_ARICH) arichSimHits.registerInDataStore();
299 
300  StoreArray<ECLHit> eclHits;
301  if (m_ECL) eclHits.registerInDataStore();
302 
303  StoreArray<KLMSimHit> klmSimHits;
304  if (m_KLM) klmSimHits.registerInDataStore();
305 
306  StoreArray<BeamBackHit> beamBackHits;
307  if (m_BeamBackHits) beamBackHits.registerInDataStore();
308 
309 
310  // add BackgroundInfo to persistent tree
311 
313  bkgInfo.registerInDataStore();
314  bkgInfo.create();
315  bkgInfo->setMethod(BackgroundInfo::c_Mixing);
316  bkgInfo->setComponents(m_components);
317  bkgInfo->setMinTime(m_minTime);
318  bkgInfo->setMaxTime(m_maxTime);
319  bkgInfo->setMinTimeECL(m_minTimeECL);
320  bkgInfo->setMaxTimeECL(m_maxTimeECL);
321  bkgInfo->setMinTimePXD(m_minTimePXD);
322  bkgInfo->setMaxTimePXD(m_maxTimePXD);
323  bkgInfo->setWrapAround(m_wrapAround);
324  bkgInfo->setMaxEdepECL(m_maxEdepECL);
325  for (auto& bkg : m_backgrounds) {
327  descr.tag = bkg.tag;
328  descr.type = bkg.type;
329  descr.fileType = bkg.fileType;
330  descr.fileNames = bkg.fileNames;
331  descr.realTime = bkg.realTime;
332  descr.numEvents = bkg.numEvents;
333  descr.scaleFactor = bkg.scaleFactor;
334  descr.rate = bkg.rate;
335  descr.reused = 0;
336  bkgInfo->appendBackgroundDescr(descr);
337  }
338 
339 }
340 
342 {
343 }
344 
346 {
347  StoreArray<PXDSimHit> pxdSimHits;
348  StoreArray<SVDSimHit> svdSimHits;
349  StoreArray<CDCSimHit> cdcSimHits;
350  StoreArray<TOPSimHit> topSimHits;
351  StoreArray<ARICHSimHit> arichSimHits;
352  StoreArray<ECLHit> eclHits;
353  StoreArray<KLMSimHit> klmSimHits;
354  StoreArray<BeamBackHit> beamBackHits;
356 
357  for (auto& bkg : m_backgrounds) {
358 
359  if (bkg.fileType != BackgroundMetaData::c_Usual) continue;
360 
361  double mean = bkg.rate * (m_maxTime - m_minTime);
362  int nev = gRandom->Poisson(mean);
363 
364  for (int iev = 0; iev < nev; iev++) {
365  double timeShift = gRandom->Rndm() * (m_maxTime - m_minTime) + m_minTime;
366  bkg.tree->GetEntry(bkg.eventCount);
367 
368  if (acceptEvent(m_simHits.ECL)) {
369  addSimHits(pxdSimHits, m_simHits.PXD, timeShift, m_minTime, m_maxTime);
370  addSimHits(svdSimHits, m_simHits.SVD, timeShift, m_minTime, m_maxTime);
371  addSimHits(cdcSimHits, m_simHits.CDC, timeShift, m_minTime, m_maxTime);
372  addSimHits(topSimHits, m_simHits.TOP, timeShift, m_minTime, m_maxTime);
373  addSimHits(arichSimHits, m_simHits.ARICH, timeShift, m_minTime, m_maxTime);
374  addSimHits(eclHits, m_simHits.ECL, timeShift, m_minTime, m_maxTime);
375  addSimHits(klmSimHits, m_simHits.KLM, timeShift, m_minTime, m_maxTime);
376  addBeamBackHits(beamBackHits, m_simHits.BeamBackHits, timeShift,
378  } else {
379  iev--;
380  std::string message = "BeamBkgMixer: event " + to_string(bkg.eventCount)
381  + " of " + bkg.type + " rejected due to large energy deposit in ECL";
382  m_rejected[message] += 1;
383  m_rejectedCount++;
384  if (m_rejectedCount < 10) {
385  B2INFO("BeamBkgMixer: event rejected due to large energy deposit in ECL");
386  } else if (m_rejectedCount == 10) {
387  B2INFO("BeamBkgMixer: event rejected due to large energy deposit in ECL "
388  << "(message will be suppressed now)");
389  }
390  }
391 
392  bkg.eventCount++;
393  if (bkg.eventCount >= bkg.numEvents) {
394  bkg.eventCount = 0;
395  std::string message = "BeamBkgMixer: events of " + bkg.type + " will be re-used";
396  m_reused[message] += 1;
397  if (m_reused[message] == 1) B2INFO(message);
398  bkgInfo->incrementReusedCounter(bkg.index);
399  }
400  }
401  }
402 
403 
404  for (auto& bkg : m_backgrounds) {
405 
406  if (bkg.fileType != BackgroundMetaData::c_ECL) continue;
407 
408  double mean = bkg.rate * (m_maxTimeECL - m_minTimeECL);
409  int nev = gRandom->Poisson(mean);
410 
411  for (int iev = 0; iev < nev; iev++) {
412  double timeShift = gRandom->Rndm() * (m_maxTimeECL - m_minTimeECL) + m_minTimeECL;
413  if (timeShift > m_minTime and timeShift < m_maxTime) continue;
414  bkg.tree->GetEntry(bkg.eventCount);
415 
416  if (acceptEvent(m_simHits.ECL)) {
417  double minTime = m_minTimeECL;
418  double maxTime = m_maxTimeECL;
419  if (timeShift <= m_minTime) {
420  maxTime = m_minTime;
421  } else {
422  minTime = m_maxTime;
423  }
424  addSimHits(eclHits, m_simHits.ECL, timeShift, minTime, maxTime);
425  } else {
426  iev--;
427  std::string message = "BeamBkgMixer: event " + to_string(bkg.eventCount)
428  + " of " + bkg.type + " rejected due to large energy deposit in ECL";
429  m_rejected[message] += 1;
430  m_rejectedCount++;
431  if (m_rejectedCount < 10) {
432  B2INFO("BeamBkgMixer: event rejected due to large energy deposit in ECL");
433  } else if (m_rejectedCount == 10) {
434  B2INFO("BeamBkgMixer: event rejected due to large energy deposit in ECL "
435  << "(message will be suppressed now)");
436  }
437  }
438 
439  bkg.eventCount++;
440  if (bkg.eventCount >= bkg.numEvents) {
441  bkg.eventCount = 0;
442  std::string message = "BeamBkgMixer: events of " + bkg.type + " will be re-used";
443  m_reused[message] += 1;
444  if (m_reused[message] == 1) B2INFO(message);
445  bkgInfo->incrementReusedCounter(bkg.index);
446  }
447  }
448 
449  }
450 
451 
452  for (auto& bkg : m_backgrounds) {
453 
454  if (bkg.fileType != BackgroundMetaData::c_PXD) continue;
455 
456  double mean = bkg.rate * (m_maxTimePXD - m_minTimePXD);
457  int nev = gRandom->Poisson(mean);
458 
459  for (int iev = 0; iev < nev; iev++) {
460  double timeShift = gRandom->Rndm() * (m_maxTimePXD - m_minTimePXD) + m_minTimePXD;
461  if (timeShift > m_minTime and timeShift < m_maxTime) continue;
462  bkg.tree->GetEntry(bkg.eventCount);
463 
464  double minTime = m_minTimePXD;
465  double maxTime = m_maxTimePXD;
466  if (timeShift <= m_minTime) {
467  maxTime = m_minTime;
468  } else {
469  minTime = m_maxTime;
470  }
471  addSimHits(pxdSimHits, m_simHits.PXD, timeShift, minTime, maxTime);
472 
473  bkg.eventCount++;
474  if (bkg.eventCount >= bkg.numEvents) {
475  bkg.eventCount = 0;
476  std::string message = "BeamBkgMixer: events of " + bkg.type + " will be re-used";
477  m_reused[message] += 1;
478  if (m_reused[message] == 1) B2INFO(message);
479  bkgInfo->incrementReusedCounter(bkg.index);
480  }
481  }
482 
483  }
484 
485 }
486 
487 
489 {
490 }
491 
493 {
494 
495  B2INFO("BeamBkgMixer - reused samples:");
496  for (const auto& message : m_reused) {
497  B2INFO(message.first << "(occured " << message.second << " times)");
498  }
499  B2INFO("BeamBkgMixer - rejected events:");
500  for (const auto& message : m_rejected) {
501  B2INFO(message.first << "(occured " << message.second << " times)");
502  }
503 
504  for (auto& bkg : m_backgrounds) {
505  bkg.tree.reset();
506  }
507 
508 }
509 
510 
511 bool BeamBkgMixerModule::isComponentIncluded(std::vector<std::string>& components,
512  const std::string& component)
513 {
514  if (m_components.empty()) return true;
515  auto iterator = std::find(components.begin(), components.end(), component);
516  if (iterator != components.end()) {
517  components.erase(iterator);
518  return true;
519  }
520  return false;
521 }
522 
523 
525  const std::string& type,
526  const std::string& fileName,
527  double realTime,
529 {
530  for (auto& bkg : m_backgrounds) {
531  if (tag == bkg.tag and fileType == bkg.fileType) {
532  bkg.fileNames.push_back(fileName);
533  bkg.realTime += realTime;
534  return;
535  }
536  }
537  std::string ftype = type;
538  if (fileType == BackgroundMetaData::c_ECL) ftype += "(ECL)";
539  if (fileType == BackgroundMetaData::c_PXD) ftype += "(PXD)";
540  unsigned index = m_backgrounds.size();
541  m_backgrounds.push_back(BkgFiles(tag, ftype, fileName, realTime,
542  m_overallScaleFactor, fileType, index));
543 }
544 
545 
546 bool BeamBkgMixerModule::acceptEvent(TClonesArray* cloneArrayECL)
547 {
548  if (!cloneArrayECL) return true;
549  if (m_maxEdepECL == 0) return true;
550 
551  int numEntries = cloneArrayECL->GetEntriesFast();
552  for (int i = 0; i < numEntries; i++) {
553  ECLHit* simHit = static_cast<ECLHit*>(cloneArrayECL->AddrAt(i));
554  if (simHit->getEnergyDep() > m_maxEdepECL) return false;
555  }
556  return true;
557 }
Metadata information about the beam background file.
EFileType
Enum for BG file types.
const std::string & getBackgroundType() const
Returns the type of background.
float getRealTime() const
Returns real time that corresponds to this background sample.
EFileType getFileType() const
Returns file type.
BG_TAG
Enum for background tags.
BG_TAG getBackgroundTag() const
Returns background tag value.
std::map< std::string, int > m_reused
messages: rejused events
double m_maxEdepECL
maximal allowed deposited energy in ECL
std::vector< BkgFiles > m_backgrounds
container for background samples
virtual ~BeamBkgMixerModule()
Destructor.
double m_maxTimeECL
maximal time shift of background event for ECL
std::map< std::string, int > m_rejected
messages: rejected events
bool isComponentIncluded(std::vector< std::string > &components, const std::string &component)
Returns true if a component is found in components or the list is empty.
bool m_ECL
true if found in m_components
std::vector< std::string > m_components
detector components
void addBeamBackHits(StoreArray< HIT > &hits, TClonesArray *cloneArray, double timeShift, double minTime, double maxTime)
functions that add BeamBackHits to those in the DataStore
double m_minTimePXD
minimal time shift of background event for PXD
bool m_PXD
true if found in m_components
void addSimHits(StoreArray< SIMHIT > &simHits, TClonesArray *cloneArray, double timeShift, double minTime, double maxTime)
functions that add background SimHits to those in the DataStore
background::BeamBGTypes m_bgTypes
defined BG types
std::vector< std::string > m_backgroundFiles
names of beam background files
virtual void initialize() override
Initialize the Module.
bool m_CDC
true if found in m_components
double m_maxTime
maximal time shift of background event
virtual void event() override
Event processor.
double m_minTime
minimal time shift of background event
bool m_wrapAround
if true wrap around events in the tail after maxTime
virtual void endRun() override
End-of-run action.
double m_maxTimePXD
maximal time shift of background event for PXD
int m_rejectedCount
counter for suppresing "rejected event" messages
virtual void terminate() override
Termination action.
BkgHits m_simHits
input event buffer
int m_cacheSize
file cache size in Mbytes
bool m_BeamBackHits
if true add also background hits
virtual void beginRun() override
Called when entering a new run.
bool m_ARICH
true if found in m_components
double m_overallScaleFactor
overall scale factor
void appendSample(BackgroundMetaData::BG_TAG bkgTag, const std::string &bkgType, const std::string &fileName, double realTime, BackgroundMetaData::EFileType fileTyp)
appends background sample to m_backgrounds
bool acceptEvent(TClonesArray *cloneArrayECL)
Checks for deposited energy of ECLHits and returns true if Edep < m_maxEdepECL.
double m_minTimeECL
minimal time shift of background event for ECL
std::vector< std::tuple< std::string, double > > m_scaleFactors
scale factors
bool m_KLM
true if found in m_components
bool m_SVD
true if found in m_components
bool m_TOP
true if found in m_components
@ c_Persistent
Object is available during entire execution time.
Definition: DataStore.h:60
Class to store simulated hits which equate to average of ECLSImHit on crystals input for digitization...
Definition: ECLHit.h:25
double getEnergyDep() const
Get deposit energy.
Definition: ECLHit.h:70
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
bool create(bool replace=false)
Create a default object in the data store.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
std::string getBGTypes() const
Return all defined BG types as a string.
Definition: BeamBGTypes.h:111
BackgroundMetaData::BG_TAG getTag(const std::string &bgType)
Return BG tag for a given BG type.
Definition: BeamBGTypes.h:74
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.
Structure for background description.
structure to hold samples of a particular background type
TClonesArray * BeamBackHits
BeamBackHits from collision file.
TClonesArray * KLM
KLM SimHits from collision file.
TClonesArray * ARICH
ARICH SimHits from collision file.
TClonesArray * CDC
CDC SimHits from collision file.
TClonesArray * PXD
PXD SimHits from collision file.
TClonesArray * ECL
ECL SimHits from collision file.
TClonesArray * SVD
SVD SimHits from collision file.
TClonesArray * TOP
TOP SimHits from collision file.