Belle II Software  release-05-01-25
FlavorTaggerInfoBuilderModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Christian Roca and Fernando Abudinen *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <analysis/modules/FlavorTaggerInfoBuilder/FlavorTaggerInfoBuilderModule.h>
12 
13 #include <analysis/dataobjects/Particle.h>
14 #include <analysis/dataobjects/FlavorTaggerInfo.h>
15 #include <analysis/dataobjects/RestOfEvent.h>
16 #include <analysis/dataobjects/FlavorTaggerInfoMap.h>
17 
18 #include <framework/datastore/StoreArray.h>
19 
20 using namespace Belle2;
21 
22 //-----------------------------------------------------------------
23 // Register the Module
24 //-----------------------------------------------------------------
25 REG_MODULE(FlavorTaggerInfoBuilder)
26 
27 //-----------------------------------------------------------------
28 // Implementation
29 //-----------------------------------------------------------------
30 
32 {
33  // Set module properties
34  setDescription("Initializes the FlavorTaggerInfo DataObject that will be used during the Flavor Tagging. Filling is done in the FlavorTagger.py script");
35  setPropertyFlags(c_ParallelProcessingCertified);
36 }
37 
39 {
40  // input: Particles and RestOfEvent
41  StoreArray<RestOfEvent> roeArray;
42  StoreArray<Particle> particles;
43  roeArray.isRequired();
44 
45  // output: FlavorTaggerInfo
46  StoreArray<FlavorTaggerInfo> flavTagArray;
47  flavTagArray.registerInDataStore();
49  flavTagMap.registerInDataStore();
50  particles.registerRelationTo(flavTagArray);
51  roeArray.registerRelationTo(flavTagArray);
52 }
53 
55 {
56  // input
57  StoreArray<RestOfEvent> roeArray;
58 
59  // output
60  StoreArray<FlavorTaggerInfo> flavTagArray;
61 
62 
63  for (int i = 0; i < roeArray.getEntries(); i++) {
64  const RestOfEvent* roe = roeArray[i];
65  const Particle* particle = roe->getRelated<Particle>();
66 
67  // create FlavorTaggerInfo object
68  FlavorTaggerInfo* flavTag = flavTagArray.appendNew();
69 
70  // create relations: Particle <-> FlavorTaggerInfo , RestOfEvent <-> FlavorTaggerInfo
71  particle->addRelationTo(flavTag);
72  roe->addRelationTo(flavTag);
73 
74  }
75 }
Belle2::StoreArray::appendNew
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:256
Belle2::StoreArray::registerRelationTo
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:150
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::FlavorTaggerInfoBuilderModule::initialize
virtual void initialize() override
initialize the module (setup the data store)
Definition: FlavorTaggerInfoBuilderModule.cc:38
Belle2::RelationsInterface::addRelationTo
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).
Definition: RelationsObject.h:144
Belle2::RelationsInterface::getRelated
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.
Definition: RelationsObject.h:280
Belle2::RestOfEvent
This is a general purpose class for collecting reconstructed MDST data objects that are not used in r...
Definition: RestOfEvent.h:59
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::Particle
Class to store reconstructed particles.
Definition: Particle.h:77
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::FlavorTaggerInfoBuilderModule
Creates for each Particle and RestOfEvent object in the DataStore a FlavorTaggerInfo dataobject and m...
Definition: FlavorTaggerInfoBuilderModule.h:38
Belle2::StoreArray::getEntries
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:226
Belle2::FlavorTaggerInfo
This class stores the relevant information for the TagV vertex fit, extracted mainly from the Flavor ...
Definition: FlavorTaggerInfo.h:57
Belle2::FlavorTaggerInfoBuilderModule::event
virtual void event() override
process event
Definition: FlavorTaggerInfoBuilderModule.cc:54