Belle II Software  release-06-02-00
FlavorTaggerInfoBuilderModule.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 <analysis/modules/FlavorTaggerInfoBuilder/FlavorTaggerInfoBuilderModule.h>
10 
11 #include <analysis/dataobjects/Particle.h>
12 
13 using namespace Belle2;
14 
15 //-----------------------------------------------------------------
16 // Register the Module
17 //-----------------------------------------------------------------
18 REG_MODULE(FlavorTaggerInfoBuilder)
19 
20 //-----------------------------------------------------------------
21 // Implementation
22 //-----------------------------------------------------------------
23 
25 {
26  // Set module properties
27  setDescription("Initializes the FlavorTaggerInfo DataObject that will be used during the Flavor Tagging. Filling is done in the FlavorTagger.py script");
28  setPropertyFlags(c_ParallelProcessingCertified);
29 }
30 
32 {
33  // input
34  m_roes.isRequired();
35 
36  // output: FlavorTaggerInfo
37  m_flavorTaggerInfos.registerInDataStore();
38  m_flavorTaggerInfoMaps.registerInDataStore();
40  m_roes.registerRelationTo(m_flavorTaggerInfos);
41 }
42 
44 {
45  for (int i = 0; i < m_roes.getEntries(); i++) {
46  const RestOfEvent* roe = m_roes[i];
47  const Particle* particle = roe->getRelated<Particle>();
48 
49  // create FlavorTaggerInfo object if it does not exist
51  m_flavorTaggerInfos.appendNew();
52 
53  flavTag -> addMethodMap("FBDT");
54  flavTag -> addMethodMap("FANN");
55  flavTag -> addMethodMap("DNN");
56 
57  if (!roe->getRelatedTo<FlavorTaggerInfo>()) {
58  // create relations: Particle <-> FlavorTaggerInfo , RestOfEvent <-> FlavorTaggerInfo
59  particle->addRelationTo(flavTag);
60  roe->addRelationTo(flavTag);
61  }
62 
63  }
64 }
Creates for each Particle and RestOfEvent object in the DataStore a FlavorTaggerInfo dataobject and m...
virtual void initialize() override
initialize the module (setup the data store)
virtual void event() override
process event
StoreArray< FlavorTaggerInfoMap > m_flavorTaggerInfoMaps
StoreArray of FlavorTaggerInfoMaps.
StoreArray< FlavorTaggerInfo > m_flavorTaggerInfos
StoreArray of FlavorTaggerInfos.
StoreArray< RestOfEvent > m_roes
StoreArray of ROEs.
This class stores the relevant information for the TagV vertex fit, extracted mainly from the Flavor ...
Base class for Modules.
Definition: Module.h:72
Class to store reconstructed particles.
Definition: Particle.h:74
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
This is a general purpose class for collecting reconstructed MDST data objects that are not used in r...
Definition: RestOfEvent.h:57
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
Definition: StoreArray.h:140
#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.