Belle II Software  release-08-01-10
BoostVectorCollectorModule.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 #include <tracking/modules/BoostVectorCollector/BoostVectorCollectorModule.h>
9 
10 #include <analysis/dataobjects/ParticleList.h>
11 #include <mdst/dataobjects/PIDLikelihood.h>
12 
13 using namespace Belle2;
14 
15 #include <iostream>
16 
17 //-----------------------------------------------------------------
18 // Register the Module
19 //-----------------------------------------------------------------
20 REG_MODULE(BoostVectorCollector);
21 
22 //-----------------------------------------------------------------
23 // Implementation
24 //-----------------------------------------------------------------
25 
27  m_exp(-99), m_run(-99), m_evt(-99),
28  m_time(-99),
29  m_mu0_pid(-99), m_mu1_pid(-99)
30 {
31  //Set module properties
32 
33  setDescription("Collect data for BoostVector calibration algorithm using the momenta of the mu+mu- events");
35 
36  addParam("Y4SPListName", m_Y4SPListName, "Name of the Y4S particle list", std::string("Upsilon(4S):IPDQM"));
37 }
38 
40 {
41  B2INFO("Init of the trees");
42  TString objectName = "events";
43  //Data object creation --------------------------------------------------
44  TTree* tree = new TTree(objectName, "");
45 
46  tree->Branch<int>("event", &m_evt);
47  tree->Branch<int>("exp", &m_exp);
48  tree->Branch<int>("run", &m_run);
49  tree->Branch<double>("time", &m_time);
50 
51  tree->Branch<double>("mu0_pid", &m_mu0_pid);
52  tree->Branch<double>("mu1_pid", &m_mu1_pid);
53 
54  tree->Branch<B2Vector3D>("mu0_p", &m_mu0_p);
55  tree->Branch<B2Vector3D>("mu1_p", &m_mu1_p);
56 
57 
58  // We register the objects so that our framework knows about them.
59  // Don't try and hold onto the pointers or fill these objects directly
60  // Use the getObjectPtr functions to access collector objects
61  registerObject<TTree>(objectName.Data(), tree);
62 }
63 
64 
66 {
67  m_evt = m_emd->getEvent();
68  m_run = m_emd->getRun();
69  m_exp = m_emd->getExperiment();
70  m_time = m_emd->getTime() / 1e9 / 3600.; //from ns to hours
71 
72 
74 
75 
76  if (!Y4SParticles.isValid() || abs(Y4SParticles->getPDGCode()) != 300553)
77  return;
78 
79  if (Y4SParticles->getListSize() != 1)
80  return;
81 
82 
83  std::vector<int> indxes = Y4SParticles->getParticle(0)->getDaughterIndices();
84  if (indxes.size() != 2) return;
85 
86  const Particle* part0 = Y4SParticles->getParticle(0)->getDaughter(0);
87  const Particle* part1 = Y4SParticles->getParticle(0)->getDaughter(1);
88 
89  // Get the mu/e PID
92 
93  // get 3-vectors of the mu/e momenta
94  m_mu0_p = B2Vector3D(part0->getMomentum());
95  m_mu1_p = B2Vector3D(part1->getMomentum());
96 
97 
98  getObjectPtr<TTree>("events")->Fill();
99 
100 }
void prepare() override final
Initialize the module.
double m_mu1_pid
particle ID of mu/e separation second muon
std::string m_Y4SPListName
Name of the Y4S particle list.
B2Vector3D m_mu0_p
three momentum of first muon
void collect() override final
Event processor The filling of the tree.
double m_mu0_pid
particle ID of mu/e separation first muon
B2Vector3D m_mu1_p
three momentum of second muon
Calibration collector module base class.
StoreObjPtr< EventMetaData > m_emd
Current EventMetaData.
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:580
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
double getProbability(const Const::ChargedStable &p1, const Const::ChargedStable &p2, Const::PIDDetectorSet set=Const::PIDDetectorSet::set()) const
Return combined likelihood probability for a particle being p1 and not p2, assuming equal prior proba...
Definition: PIDLikelihood.h:83
Class to store reconstructed particles.
Definition: Particle.h:75
const PIDLikelihood * getPIDLikelihood() const
Returns the pointer to the PIDLikelihood object that is related to the Track, which was used to creat...
Definition: Particle.cc:875
ROOT::Math::XYZVector getMomentum() const
Returns momentum vector.
Definition: Particle.h:526
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
bool isValid() const
Check whether the object was created.
Definition: StoreObjPtr.h:111
REG_MODULE(arichBtest)
Register the Module.
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
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition: B2Vector3.h:516
Abstract base class for different kinds of events.