Belle II Software  release-06-01-15
background modules
Collaboration diagram for background modules:

Classes

class  BeamBkgGeneratorModule
 Beam background generator based on SAD files. More...
 
class  BeamBkgHitRateMonitorModule
 A module to monitor detector hit rates of beam background Output is to a flat ntuple. More...
 
class  BeamBkgMixerModule
 New beam background mixer; this one doesn't need ROF files. More...
 
class  BeamBkgTagSetterModule
 A module that sets m_backgroundTag variable in SimHits (see BackgroundMetaData.h). More...
 
class  BGOverlayExecutorModule
 Overlay of measured background with simulated data (Digits or Clusters) More...
 
class  BGOverlayInputModule
 Beam BG data input, either in form of Digits or raw data. More...
 

Functions

 BeamBkgGeneratorModule ()
 Constructor.
 
virtual ~BeamBkgGeneratorModule ()
 Destructor.
 
virtual void initialize () override
 Initialize the Module. More...
 
virtual void beginRun () override
 Called when entering a new run. More...
 
virtual void event () override
 Event processor. More...
 
virtual void endRun () override
 End-of-run action. More...
 
virtual void terminate () override
 Termination action. More...
 
int generateEntry () const
 Pick up particle randomly from the SAD file according to its rate. More...
 
 BeamBkgHitRateMonitorModule ()
 Constructor.
 
virtual ~BeamBkgHitRateMonitorModule ()
 Destructor.
 
virtual void initialize () override
 Initialize the Module. More...
 
virtual void beginRun () override
 Called when entering a new run.
 
virtual void event () override
 Event processor.
 
virtual void endRun () override
 End-of-run action.
 
virtual void terminate () override
 Termination action. More...
 
bool isEventSelected ()
 event selection More...
 
void collectFileMetaData ()
 Collect file meta data: LFN's, low and high experiment, run and event numbers. More...
 
void setFileMetaData ()
 Set output FileMetaData object. More...
 
 BeamBkgMixerModule ()
 Constructor.
 
virtual ~BeamBkgMixerModule ()
 Destructor.
 
virtual void initialize () override
 Initialize the Module. More...
 
virtual void beginRun () override
 Called when entering a new run. More...
 
virtual void event () override
 Event processor.
 
virtual void endRun () override
 End-of-run action. More...
 
virtual void terminate () override
 Termination action. More...
 
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. More...
 
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 More...
 
bool acceptEvent (TClonesArray *cloneArrayECL)
 Checks for deposited energy of ECLHits and returns true if Edep < m_maxEdepECL. More...
 
 BeamBkgTagSetterModule ()
 Constructor.
 
virtual ~BeamBkgTagSetterModule ()
 Destructor.
 
virtual void initialize () override
 Initialize the Module. More...
 
virtual void beginRun () override
 Called when entering a new run. More...
 
virtual void event () override
 Event processor.
 
virtual void endRun () override
 End-of-run action. More...
 
virtual void terminate () override
 Termination action. More...
 
 BGOverlayExecutorModule ()
 Constructor.
 
virtual void initialize () override
 Initialize the Module. More...
 
virtual void event () override
 Event processor.
 

Detailed Description

Function Documentation

◆ acceptEvent()

bool acceptEvent ( TClonesArray *  cloneArrayECL)
private

Checks for deposited energy of ECLHits and returns true if Edep < m_maxEdepECL.

Parameters
cloneArrayECLpointer to TClonesArray of ECLHits
Returns
true if all ECLHits have deposited energy below m_maxEdepECL

Definition at line 558 of file BeamBkgMixerModule.cc.

559  {
560  if (!cloneArrayECL) return true;
561  if (m_maxEdepECL == 0) return true;
562 
563  int numEntries = cloneArrayECL->GetEntriesFast();
564  for (int i = 0; i < numEntries; i++) {
565  ECLHit* simHit = static_cast<ECLHit*>(cloneArrayECL->AddrAt(i));
566  if (simHit->getEnergyDep() > m_maxEdepECL) return false;
567  }
568  return true;
569  }
double m_maxEdepECL
maximal allowed deposited energy in ECL

◆ appendSample()

void appendSample ( BackgroundMetaData::BG_TAG  bkgTag,
const std::string &  bkgType,
const std::string &  fileName,
double  realTime,
BackgroundMetaData::EFileType  fileTyp 
)
private

appends background sample to m_backgrounds

Parameters
bkgTagbackground tag
bkgTypebackground type
fileNamefile name
realTimereal time that corresponds to background sample
fileTypfile type

Definition at line 536 of file BeamBkgMixerModule.cc.

◆ beginRun() [1/3]

void beginRun ( void  )
overridevirtual

Called when entering a new run.

Set run dependent things like run header parameters, alignment, etc.

Reimplemented from Module.

Definition at line 163 of file BeamBkgGeneratorModule.cc.

164  {
165  }

◆ beginRun() [2/3]

void beginRun ( void  )
overridevirtual

Called when entering a new run.

Set run dependent things like run header parameters, alignment, etc.

Reimplemented from Module.

Definition at line 351 of file BeamBkgMixerModule.cc.

◆ beginRun() [3/3]

void beginRun ( void  )
overridevirtual

Called when entering a new run.

Set run dependent things like run header parameters, alignment, etc.

Reimplemented from Module.

Definition at line 125 of file BeamBkgTagSetterModule.cc.

126  {
127  }

◆ collectFileMetaData()

void collectFileMetaData ( )
private

Collect file meta data: LFN's, low and high experiment, run and event numbers.

This code is based on RootOutputModule::event().

Definition at line 297 of file BeamBkgHitRateMonitorModule.cc.

298  {
299  // add file name to the list
300  if (m_fileMetaData.isValid()) {
301  std::string lfn = m_fileMetaData->getLfn();
302  if (not lfn.empty() and (m_parentLfns.empty() or (m_parentLfns.back() != lfn))) {
303  m_parentLfns.push_back(lfn);
304  }
305  }
306 
307  // low and high experiment, run and event numbers
308  unsigned long experiment = m_eventMetaData->getExperiment();
309  unsigned long run = m_eventMetaData->getRun();
310  unsigned long event = m_eventMetaData->getEvent();
311  if (m_experimentLow > m_experimentHigh) { //starting condition
312  m_experimentLow = m_experimentHigh = experiment;
313  m_runLow = m_runHigh = run;
315  } else {
316  if ((experiment < m_experimentLow) or ((experiment == m_experimentLow) and ((run < m_runLow) or ((run == m_runLow)
317  and (event < m_eventLow))))) {
318  m_experimentLow = experiment;
319  m_runLow = run;
320  m_eventLow = event;
321  }
322  if ((experiment > m_experimentHigh) or ((experiment == m_experimentHigh) and ((run > m_runHigh) or ((run == m_runHigh)
323  and (event > m_eventHigh))))) {
324  m_experimentHigh = experiment;
325  m_runHigh = run;
326  m_eventHigh = event;
327  }
328  }
329 
330  }
unsigned long m_experimentLow
Lowest experiment number.
unsigned long m_experimentHigh
Highest experiment number.
unsigned long m_eventLow
Lowest event number in lowest run.
unsigned long m_runLow
Lowest run number.
unsigned long m_runHigh
Highest run number.
StoreObjPtr< EventMetaData > m_eventMetaData
event meta data object
unsigned long m_eventHigh
Highest event number in highest run.
std::vector< std::string > m_parentLfns
Vector of parent file LFNs.
StoreObjPtr< FileMetaData > m_fileMetaData
file metadata
virtual void event() override
Event processor.

◆ endRun() [1/3]

void endRun ( void  )
overridevirtual

End-of-run action.

Save run-related stuff, such as statistics.

Reimplemented from Module.

Definition at line 256 of file BeamBkgGeneratorModule.cc.

◆ endRun() [2/3]

void endRun ( void  )
overridevirtual

End-of-run action.

Save run-related stuff, such as statistics.

Reimplemented from Module.

Definition at line 500 of file BeamBkgMixerModule.cc.

◆ endRun() [3/3]

void endRun ( void  )
overridevirtual

End-of-run action.

Save run-related stuff, such as statistics.

Reimplemented from Module.

Definition at line 176 of file BeamBkgTagSetterModule.cc.

◆ event()

void event ( void  )
overridevirtual

Event processor.

< Transformation matrix from SAD space into geant4 space.

Reimplemented from Module.

Definition at line 167 of file BeamBkgGeneratorModule.cc.

◆ generateEntry()

int generateEntry ( ) const
private

Pick up particle randomly from the SAD file according to its rate.

Returns
TTree entry number

Definition at line 286 of file BeamBkgGeneratorModule.cc.

◆ initialize() [1/5]

void initialize ( void  )
overridevirtual

Initialize the Module.

This method is called at the beginning of data processing.

Reimplemented from Module.

Definition at line 74 of file BeamBkgGeneratorModule.cc.

◆ initialize() [2/5]

void initialize ( void  )
overridevirtual

Initialize the Module.

This method is called at the beginning of data processing.

Reimplemented from Module.

Definition at line 120 of file BeamBkgHitRateMonitorModule.cc.

◆ initialize() [3/5]

void initialize ( void  )
overridevirtual

Initialize the Module.

This method is called at the beginning of data processing.

Reimplemented from Module.

Definition at line 116 of file BeamBkgMixerModule.cc.

◆ initialize() [4/5]

void initialize ( void  )
overridevirtual

Initialize the Module.

This method is called at the beginning of data processing.

Reimplemented from Module.

Definition at line 73 of file BeamBkgTagSetterModule.cc.

◆ initialize() [5/5]

void initialize ( void  )
overridevirtual

Initialize the Module.

This method is called at the beginning of data processing.

Reimplemented from Module.

Definition at line 71 of file BGOverlayExecutorModule.cc.

72  {
73  // get name of extension that is used in BGOverlayInput for BG collections
74  StoreObjPtr<BackgroundInfo> bkgInfo(m_BackgroundInfoInstanceName, DataStore::c_Persistent);
75  if (bkgInfo.isValid()) {
76  if (bkgInfo->getMethod() == BackgroundInfo::c_Overlay) {
77  m_extensionName = bkgInfo->getExtensionName();
78  } else {
79  B2ERROR("BGOverlayExecutor: no BGOverlayInput module in the path");
80  }
81  } else {
82  B2ERROR("BGOverlayExecutor: no BGOverlayInput module in the path");
83  }
84 
85  // registration in datastore (all as optional input - see template function)
86  registerDigits<PXDDigit>(m_PXDDigitsName);
87  registerDigits<SVDShaperDigit>(m_SVDShaperDigitsName);
88  registerDigits<CDCHit>(m_CDCHitsName);
89  registerDigits<TOPDigit>(m_TOPDigitsName);
90  registerDigits<ARICHDigit>(m_ARICHDigitsName);
91  registerDigits<KLMDigit>(m_KLMDigitsName);
92 
93  // toggle ON the components from the list
94  if (m_components.empty()) {
95  m_addPXD = true;
96  m_addSVD = true;
97  m_addCDC = true;
98  m_addTOP = true;
99  m_addARICH = true;
100  m_addKLM = true;
101  } else {
102  for (const auto& component : m_components) {
103  if (component == "PXD") m_addPXD = true;
104  else if (component == "SVD") m_addSVD = true;
105  else if (component == "CDC") m_addCDC = true;
106  else if (component == "TOP") m_addTOP = true;
107  else if (component == "ARICH") m_addARICH = true;
108  else if (component == "ECL") continue; // not relevant - overlay implemented in ECLDigitizer
109  else if (component == "KLM") m_addKLM = true;
110  else B2ERROR("Unknown detector component '" << component << "'");
111  }
112  }
113 
114  }
std::string m_CDCHitsName
name of CDC collection to overlay with BG
std::string m_KLMDigitsName
name of KLM collection to overlay with BG
bool m_addCDC
if true add BG digits of CDC
std::vector< std::string > m_components
detector components included in overlay
std::string m_BackgroundInfoInstanceName
name BackgroundInfo name
bool m_addKLM
if true add BG digits of KLM
bool m_addSVD
if true add BG digits of SVD
std::string m_ARICHDigitsName
name of ARICH collection to overlay with BG
bool m_addTOP
if true add BG digits of TOP
std::string m_extensionName
name added to default branch names
bool m_addPXD
if true add BG digits of PXD
std::string m_TOPDigitsName
name of TOP collection to overlay with BG
bool m_addARICH
if true add BG digits of ARICH
std::string m_PXDDigitsName
name of PXD collection to overlay with BG
std::string m_SVDShaperDigitsName
name of SVD collection to overlay with BG
@ c_Persistent
Object is available during entire execution time.
Definition: DataStore.h:60

◆ isComponentIncluded()

bool isComponentIncluded ( std::vector< std::string > &  components,
const std::string &  component 
)
private

Returns true if a component is found in components or the list is empty.

If found a component is erased from components.

Parameters
componentslist of components to be included
componentthe name of detector component to check
Returns
true if component found in components

Definition at line 523 of file BeamBkgMixerModule.cc.

◆ isEventSelected()

bool isEventSelected ( )
private

event selection

Returns
true if event is selected

Definition at line 275 of file BeamBkgHitRateMonitorModule.cc.

◆ setFileMetaData()

void setFileMetaData ( )
private

Set output FileMetaData object.

This code is based on RootOutputModule::fillFileMetaData().

Definition at line 333 of file BeamBkgHitRateMonitorModule.cc.

◆ terminate() [1/4]

void terminate ( void  )
overridevirtual

Termination action.

Clean-up, close files, summarize statistics, etc.

Reimplemented from Module.

Definition at line 260 of file BeamBkgGeneratorModule.cc.

◆ terminate() [2/4]

void terminate ( void  )
overridevirtual

Termination action.

Clean-up, close files, summarize statistics, etc.

Reimplemented from Module.

Definition at line 262 of file BeamBkgHitRateMonitorModule.cc.

◆ terminate() [3/4]

void terminate ( void  )
overridevirtual

Termination action.

Clean-up, close files, summarize statistics, etc.

Reimplemented from Module.

Definition at line 504 of file BeamBkgMixerModule.cc.

◆ terminate() [4/4]

void terminate ( void  )
overridevirtual

Termination action.

Clean-up, close files, summarize statistics, etc.

Reimplemented from Module.

Definition at line 180 of file BeamBkgTagSetterModule.cc.