Belle II Software development
EventT0ShifterModule.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#include <generators/modules/EventT0ShifterModule.h>
10
11#include <framework/datastore/StoreArray.h>
12#include <framework/datastore/StoreObjPtr.h>
13
14using namespace Belle2;
15
16REG_MODULE(EventT0Shifter);
17
19{
20 // set module description
21 setDescription("Shift the time of all MCParticles so that the collision time is t=0."
22 "It reverts the shift done by the EventT0Generator module and should be used after the simulation."
23 "Note that the collisionTime in the MCInitialParticles is not changed.");
24
26}
27
28
30{
32 m_initialParticles.isRequired();
33}
34
35
37{
38 // shift MC particles times
39 double collisionTime = m_initialParticles->getTime();
40 for (auto& particle : m_mcParticles) {
41 particle.setProductionTime(particle.getProductionTime() - collisionTime);
42 particle.setDecayTime(particle.getDecayTime() - collisionTime);
43 }
44}
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
StoreArray< MCParticle > m_mcParticles
MC particles.
StoreObjPtr< MCInitialParticles > m_initialParticles
beam particles
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
#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.