Belle II Software  release-05-01-25
EventT0ShifterModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Thomas kuhr *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <generators/modules/EventT0ShifterModule.h>
12 
13 #include <framework/datastore/StoreArray.h>
14 #include <framework/datastore/StoreObjPtr.h>
15 
16 using namespace Belle2;
17 
18 REG_MODULE(EventT0Shifter)
19 
21 {
22  // set module description
23  setDescription("Shift the time of all MCParticles so that the collision time is t=0."
24  "It reverts the shift done by the EventT0Generator module and should be used after the simulation."
25  "Note that the collisionTime in the MCInitialParticles is not changed.");
26 
27  setPropertyFlags(c_ParallelProcessingCertified);
28 }
29 
30 
32 {
33  m_mcParticles.isRequired();
34  m_initialParticles.isRequired();
35 }
36 
37 
39 {
40  // shift MC particles times
41  double collisionTime = m_initialParticles->getTime();
42  for (auto& particle : m_mcParticles) {
43  particle.setProductionTime(particle.getProductionTime() - collisionTime);
44  particle.setDecayTime(particle.getDecayTime() - collisionTime);
45  }
46 }
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::EventT0ShifterModule
Module that shifts the time of all MCParticles so that the collision is at t=0.
Definition: EventT0ShifterModule.h:41
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::EventT0ShifterModule::event
virtual void event() override
Event processor.
Definition: EventT0ShifterModule.cc:38
Belle2::EventT0ShifterModule::m_mcParticles
StoreArray< MCParticle > m_mcParticles
MC particles.
Definition: EventT0ShifterModule.h:62
Belle2::EventT0ShifterModule::initialize
virtual void initialize() override
Initialize the Module.
Definition: EventT0ShifterModule.cc:31
Belle2::EventT0ShifterModule::m_initialParticles
StoreObjPtr< MCInitialParticles > m_initialParticles
beam particles
Definition: EventT0ShifterModule.h:63