Belle II Software  release-05-01-25
FlavorTaggerInfo.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/dataobjects/FlavorTaggerInfo.h>
12 #include <framework/datastore/StoreArray.h>
13 
14 #include <mdst/dataobjects/Track.h>
15 #include <mdst/dataobjects/MCParticle.h>
16 
17 #include <framework/logging/Logger.h>
18 
19 using namespace Belle2;
20 
21 
22 
23 /************************SETTERS***********************/
24 
25 
26 void FlavorTaggerInfo::setUseModeFlavorTagger(const std::string& mode)
27 {
28  m_useModeFlavorTagger = mode;
29 }
30 
31 void FlavorTaggerInfo::addMethodMap(const std::string& method)
32 {
33  StoreArray<FlavorTaggerInfoMap> flavTagInfoMap;
34  if (m_methodMap.find(method) == m_methodMap.end()) {
35  // create FlavorTaggerInfoMap object
36 
37  FlavorTaggerInfoMap* flavTagMap = flavTagInfoMap.appendNew();
38  m_methodMap.insert(std::pair<std::string, FlavorTaggerInfoMap*>(method, flavTagMap));
39 
40  } else {
41  B2FATAL("Method " << method << " already added. Please use another name.");
42  }
43 }
44 
45 
47 {
48  m_tracks.push_back(track);
49 }
50 
51 
52 void FlavorTaggerInfo::setCatProb(float catProb)
53 {
54  m_categoryProb.push_back(catProb);
55 }
56 
57 
58 void FlavorTaggerInfo::setTargProb(float targProb)
59 {
60  m_targetProb.push_back(targProb);
61 }
62 
63 void FlavorTaggerInfo::setP(float momentum)
64 {
65  m_P.push_back(momentum);
66 }
67 
69 {
70  if (particle == nullptr) {
71  auto* particle_empty = new Particle();
72  m_particle.push_back(particle_empty);
73  } else {
74  m_particle.push_back(particle);
75  }
76 }
77 
79 {
80  if (particle == nullptr) {
81  auto* particle_empty = new MCParticle();
82  m_MCparticle.push_back(particle_empty);
83  } else {
84  m_MCparticle.push_back(particle);
85  }
86 }
87 
89 {
90  if (particle == nullptr) {
91  auto* particle_empty = new MCParticle();
92  m_MCparticle_mother.push_back(particle_empty);
93  } else {
94  m_MCparticle_mother.push_back(particle);
95  }
96 }
97 
99 {
100  m_isFromB.push_back(isIt);
101 }
102 
104 {
105  m_goodTracksPurityFT = pur;
106 }
107 
109 {
110  m_goodTracksPurityROE = pur;
111 }
112 
114 {
115  m_goodTracksROE = goodTracks;
116 }
117 
119 {
120  m_badTracksROE = badTraks;
121 }
122 
124 {
125  m_goodTracksFT = goodTracks;
126 }
127 
129 {
130  m_badTracksFT = badTraks;
131 }
132 
133 
135 {
136  m_prodPointResZ.push_back(deltaProdZ);
137 }
138 
139 void FlavorTaggerInfo::setD0(double D0)
140 {
141  m_D0.push_back(float(D0));
142 }
143 
144 void FlavorTaggerInfo::setZ0(double Z0)
145 {
146  m_Z0.push_back(float(Z0));
147 }
148 
149 void FlavorTaggerInfo::setCategories(const std::string& category)
150 {
151  m_categories.push_back(category);
152 }
153 
154 
155 /************************GETTERS***********************/
156 
157 
159 {
160  return m_useModeFlavorTagger;
161 }
162 
164 {
165  auto it = m_methodMap.find(method);
166  if (it == m_methodMap.end()) {
167  B2FATAL("Method " << method << " does not exist in the FlavorTaggerInfoMap. Please add it before to combinerMethods.");
168  } else {
169  return it -> second;
170  }
171 }
172 
173 bool FlavorTaggerInfo::isMethodInMap(const std::string& method)
174 {
175  auto it = m_methodMap.find(method);
176  if (it == m_methodMap.end()) {
177  return false;
178  } else {
179  return true;
180  }
181 }
182 
183 std::vector<float> FlavorTaggerInfo::getCatProb()
184 {
185  return m_categoryProb;
186 }
187 
188 std::vector<float> FlavorTaggerInfo::getTargProb()
189 {
190  return m_targetProb;
191 }
192 
193 std::vector<float> FlavorTaggerInfo::getP()
194 {
195  return m_P;
196 }
197 
198 std::vector<Particle*> FlavorTaggerInfo::getParticle()
199 {
200  return m_particle;
201 }
202 
203 std::vector<MCParticle*> FlavorTaggerInfo::getMCParticle()
204 {
205  return m_MCparticle;
206 }
207 
208 std::vector<MCParticle*> FlavorTaggerInfo::getMCParticleMother()
209 {
210  return m_MCparticle_mother;
211 }
212 
213 std::vector<Track*> FlavorTaggerInfo::getTracks()
214 {
215  for (auto& track : m_tracks) {
216  if (track) {
217  }
218  }
219  return m_tracks;
220 }
221 
222 std::vector<float> FlavorTaggerInfo::getD0()
223 {
224  return m_D0;
225 }
226 
227 std::vector<float> FlavorTaggerInfo::getZ0()
228 {
229  return m_Z0;
230 }
231 
233 {
234  return m_tracks[track];
235 }
236 
238 {
239  return m_isFromB;
240 }
241 
242 
244 {
245  return m_goodTracksPurityFT;
246 }
247 
248 
250 {
251  return m_goodTracksPurityROE;
252 }
253 
254 
256 {
257  return m_goodTracksROE;
258 }
259 
261 {
262  return m_badTracksROE;
263 }
264 
266 {
267  return m_goodTracksFT;
268 }
269 
271 {
272  return m_badTracksFT;
273 }
274 
275 
277 {
278  return m_prodPointResZ;
279 }
280 
281 
282 std::vector<std::string> FlavorTaggerInfo::getCategories()
283 {
284  return m_categories;
285 }
Belle2::FlavorTaggerInfo::getTracks
std::vector< Belle2::Track * > getTracks()
Get all the tracks.
Definition: FlavorTaggerInfo.cc:213
Belle2::FlavorTaggerInfo::m_badTracksFT
int m_badTracksFT
number of tracksc not coming from Btag in this object
Definition: FlavorTaggerInfo.h:399
Belle2::StoreArray::appendNew
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:256
Belle2::FlavorTaggerInfo::getUseModeFlavorTagger
std::string getUseModeFlavorTagger()
GETTERS.
Definition: FlavorTaggerInfo.cc:158
Belle2::FlavorTaggerInfo::setCategories
void setCategories(const std::string &catName)
Vector filler: Set the name of the categories.
Definition: FlavorTaggerInfo.cc:149
Belle2::FlavorTaggerInfo::getGoodTracksROE
int getGoodTracksROE()
Get the number of tracks coming from the Btag within the correspondent RestOfEvent object.
Definition: FlavorTaggerInfo.cc:255
Belle2::FlavorTaggerInfo::setBadTracksFT
void setBadTracksFT(int numTracks)
Set the number of tracks not coming from the Btag within this class.
Definition: FlavorTaggerInfo.cc:128
Belle2::FlavorTaggerInfo::m_goodTracksROE
int m_goodTracksROE
number of tracksc coming from Btag in the correspondent RestOfEvent
Definition: FlavorTaggerInfo.h:398
Belle2::FlavorTaggerInfo::m_MCparticle
std::vector< Belle2::MCParticle * > m_MCparticle
MC particle pointer related to each track.
Definition: FlavorTaggerInfo.h:384
Belle2::FlavorTaggerInfo::m_prodPointResZ
std::vector< float > m_prodPointResZ
production point resolution Z for each track
Definition: FlavorTaggerInfo.h:389
Belle2::FlavorTaggerInfo::setUseModeFlavorTagger
void setUseModeFlavorTagger(const std::string &mode)
SETTERS Some of the setters are expected to fill a vector whose each element corresponds to a given c...
Definition: FlavorTaggerInfo.cc:26
Belle2::FlavorTaggerInfo::m_badTracksROE
int m_badTracksROE
number of tracksc not coming from Btag in the correspondent RestOfEvent object
Definition: FlavorTaggerInfo.h:397
Belle2::FlavorTaggerInfo::m_MCparticle_mother
std::vector< Belle2::MCParticle * > m_MCparticle_mother
mother MC particle pointer related to each track
Definition: FlavorTaggerInfo.h:385
Belle2::FlavorTaggerInfo::getCategories
std::vector< std::string > getCategories()
Get the list of names of the categories of this object.
Definition: FlavorTaggerInfo.cc:282
Belle2::FlavorTaggerInfo::m_tracks
std::vector< Belle2::Track * > m_tracks
highest probability track for each category
Definition: FlavorTaggerInfo.h:382
Belle2::FlavorTaggerInfo::setP
void setP(float momentum)
Vector filler: Set the momentum absolute value of the corresponding category's track.
Definition: FlavorTaggerInfo.cc:63
Belle2::FlavorTaggerInfo::getGoodTracksPurityFT
float getGoodTracksPurityFT()
Get the ratio (purity) of tracks coming from the Btag out of the total amount of tracks within this o...
Definition: FlavorTaggerInfo.cc:243
Belle2::FlavorTaggerInfo::setProdPointResolutionZ
void setProdPointResolutionZ(float deltaProdZ)
Vector filler: Set resolution of the production point of each track, i.e real production point - MC m...
Definition: FlavorTaggerInfo.cc:134
Belle2::FlavorTaggerInfo::getP
std::vector< float > getP()
Get the momentum of every category's track.
Definition: FlavorTaggerInfo.cc:193
Belle2::FlavorTaggerInfo::getParticle
std::vector< Particle * > getParticle()
Get the particle's pointer related to each track.
Definition: FlavorTaggerInfo.cc:198
Belle2::FlavorTaggerInfo::setGoodTracksPurityFT
void setGoodTracksPurityFT(float goodTracksPurity)
Set the fraction of tracks coming from the Btag respect to the total amount of tracks within this cla...
Definition: FlavorTaggerInfo.cc:103
Belle2::FlavorTaggerInfo::setGoodTracksPurityROE
void setGoodTracksPurityROE(float goodTracksPurity)
Set the fraction of tracks coming from the Btag respect to the total amount of tracks within RoE.
Definition: FlavorTaggerInfo.cc:108
Belle2::FlavorTaggerInfo::setTrack
void setTrack(Belle2::Track *track)
Vector filler: Set the pointer of the track with the highest probability for each category.
Definition: FlavorTaggerInfo.cc:46
Belle2::FlavorTaggerInfoMap
This class stores the Flavor Tagger information for a specific method and particle filled in the Flav...
Definition: FlavorTaggerInfoMap.h:48
Belle2::FlavorTaggerInfo::m_targetProb
std::vector< float > m_targetProb
probability of each track to be primary
Definition: FlavorTaggerInfo.h:391
Belle2::FlavorTaggerInfo::m_particle
std::vector< Particle * > m_particle
particle pointer related to each track
Definition: FlavorTaggerInfo.h:383
Belle2::FlavorTaggerInfo::m_Z0
std::vector< float > m_Z0
impact parameter Z0 related to each track
Definition: FlavorTaggerInfo.h:387
Belle2::FlavorTaggerInfo::getMCParticleMother
std::vector< Belle2::MCParticle * > getMCParticleMother()
Get the mother MC particle's pointer related to each track.
Definition: FlavorTaggerInfo.cc:208
Belle2::FlavorTaggerInfo::m_goodTracksPurityFT
float m_goodTracksPurityFT
purity of tracks coming from the Btag in this objecy
Definition: FlavorTaggerInfo.h:395
Belle2::FlavorTaggerInfo::m_categories
std::vector< std::string > m_categories
categories name
Definition: FlavorTaggerInfo.h:388
Belle2::FlavorTaggerInfo::getProdPointResolutionZ
std::vector< float > getProdPointResolutionZ()
Get resolution of the production point of each track, i.e real production point - MC matched producti...
Definition: FlavorTaggerInfo.cc:276
Belle2::FlavorTaggerInfo::getBadTracksFT
int getBadTracksFT()
Get the number of tracks not coming from the Btag within this object.
Definition: FlavorTaggerInfo.cc:270
Belle2::FlavorTaggerInfo::getMCParticle
std::vector< Belle2::MCParticle * > getMCParticle()
Get the MC particle's pointer related to each track.
Definition: FlavorTaggerInfo.cc:203
Belle2::FlavorTaggerInfo::setIsFromB
void setIsFromB(int isFromB)
Vector filler: Set the MC matched code of the track depending on its mother (usually set in TagV modu...
Definition: FlavorTaggerInfo.cc:98
Belle2::FlavorTaggerInfo::getZ0
std::vector< float > getZ0()
Get the impact parameter Z0 of every category's track.
Definition: FlavorTaggerInfo.cc:227
Belle2::FlavorTaggerInfo::m_P
std::vector< float > m_P
absolute 3 momentum of each track
Definition: FlavorTaggerInfo.h:392
Belle2::FlavorTaggerInfo::m_methodMap
std::map< std::string, FlavorTaggerInfoMap * > m_methodMap
Map containing the methods used for the FlavorTagger: "TMVA" or "FANN", and the corresponding map.
Definition: FlavorTaggerInfo.h:378
Belle2::FlavorTaggerInfo::getTrack
Belle2::Track * getTrack(int position)
Get a single track.
Definition: FlavorTaggerInfo.cc:232
Belle2::FlavorTaggerInfo::getCatProb
std::vector< float > getCatProb()
Get all the event probabilities to correspond to each category.
Definition: FlavorTaggerInfo.cc:183
Belle2::FlavorTaggerInfo::setCatProb
void setCatProb(float catProb)
Vector filler: Set the probability of the event to correspond to a given category probability for eac...
Definition: FlavorTaggerInfo.cc:52
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::FlavorTaggerInfo::m_goodTracksPurityROE
float m_goodTracksPurityROE
purity of tracks coming from the Btag in the correspondent RestOfEvent object
Definition: FlavorTaggerInfo.h:396
Belle2::FlavorTaggerInfo::setZ0
void setZ0(double Z0)
Vector filler: Set the impact parameter Z0 of each track in an accesible way.
Definition: FlavorTaggerInfo.cc:144
Belle2::FlavorTaggerInfo::setMCParticleMother
void setMCParticleMother(Belle2::MCParticle *MCParticle)
Vector filler: Set the pointer of the MCParticle's mother related to the track with the highest proba...
Definition: FlavorTaggerInfo.cc:88
Belle2::FlavorTaggerInfo::m_categoryProb
std::vector< float > m_categoryProb
probability of the event to belong to each category
Definition: FlavorTaggerInfo.h:390
Belle2::FlavorTaggerInfo::getIsFromB
std::vector< int > getIsFromB()
Get the MC matched code of every track depending on its mother.
Definition: FlavorTaggerInfo.cc:237
Belle2::FlavorTaggerInfo::setGoodTracksFT
void setGoodTracksFT(int numTracks)
Set the number of tracks coming from the Btag within this class.
Definition: FlavorTaggerInfo.cc:123
Belle2::FlavorTaggerInfo::setParticle
void setParticle(Particle *Particle)
Vector filler: Set the pointer of the Partcile related to the track with the highest probability for ...
Definition: FlavorTaggerInfo.cc:68
Belle2::FlavorTaggerInfo::m_D0
std::vector< float > m_D0
impact parameter D0 related to each track
Definition: FlavorTaggerInfo.h:386
Belle2::FlavorTaggerInfo::getMethodMap
FlavorTaggerInfoMap * getMethodMap(const std::string &method)
method used for the FlavorTagger and corresponding FlavorTaggerInfoMap
Definition: FlavorTaggerInfo.cc:163
Belle2::Particle
Class to store reconstructed particles.
Definition: Particle.h:77
Belle2::FlavorTaggerInfo::setGoodTracksROE
void setGoodTracksROE(int numTracks)
Set the number of tracks coming from the Btag in the RoE.
Definition: FlavorTaggerInfo.cc:113
Belle2::FlavorTaggerInfo::setTargProb
void setTargProb(float)
Vector filler: Set the probability of each category's track of being a direct daughter of the Btag.
Definition: FlavorTaggerInfo.cc:58
Belle2::FlavorTaggerInfo::setMCParticle
void setMCParticle(Belle2::MCParticle *MCParticle)
Vector filler: Set the pointer of the MCParticle related related to track with the highest probabilit...
Definition: FlavorTaggerInfo.cc:78
Belle2::FlavorTaggerInfo::isMethodInMap
bool isMethodInMap(const std::string &method)
checks if the given method method is used for the FlavorTagger with a corresponding FlavorTaggerInfoM...
Definition: FlavorTaggerInfo.cc:173
Belle2::FlavorTaggerInfo::getTargProb
std::vector< float > getTargProb()
Get all the track probabilities to come directly from the Btag for each category.
Definition: FlavorTaggerInfo.cc:188
Belle2::FlavorTaggerInfo::setBadTracksROE
void setBadTracksROE(int numTracks)
Set the number of tracks coming not from the Btag in the RoE.
Definition: FlavorTaggerInfo.cc:118
Belle2::Track
Class that bundles various TrackFitResults.
Definition: Track.h:35
Belle2::MCParticle
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:43
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::FlavorTaggerInfo::m_goodTracksFT
int m_goodTracksFT
number of tracksc coming from Btag in this object
Definition: FlavorTaggerInfo.h:400
Belle2::FlavorTaggerInfo::m_isFromB
std::vector< int > m_isFromB
MC matched code of each track depending on its mother.
Definition: FlavorTaggerInfo.h:393
Belle2::FlavorTaggerInfo::setD0
void setD0(double D0)
Vector filler: Set the impact parameter D0 of each track in an accesible way.
Definition: FlavorTaggerInfo.cc:139
Belle2::FlavorTaggerInfo::m_useModeFlavorTagger
std::string m_useModeFlavorTagger
Usemode of the FlavorTagger: "Teacher" or "Expert".
Definition: FlavorTaggerInfo.h:375
Belle2::FlavorTaggerInfo::getD0
std::vector< float > getD0()
Get the impact parameter D0 of every category's track.
Definition: FlavorTaggerInfo.cc:222
Belle2::FlavorTaggerInfo::getBadTracksROE
int getBadTracksROE()
Get the number of tracks not coming from the Btag within the correspondent RestOfEvent object.
Definition: FlavorTaggerInfo.cc:260
Belle2::FlavorTaggerInfo::getGoodTracksFT
int getGoodTracksFT()
Get the number of tracks not coming from the Btag within this object.
Definition: FlavorTaggerInfo.cc:265
Belle2::FlavorTaggerInfo::getGoodTracksPurityROE
float getGoodTracksPurityROE()
Get the ratio (purity) of tracks coming from the Btag out of the total amount of tracks within the co...
Definition: FlavorTaggerInfo.cc:249
Belle2::FlavorTaggerInfo::addMethodMap
void addMethodMap(const std::string &method)
Saves the method and the correspondig FlavorTaggerMap.
Definition: FlavorTaggerInfo.cc:31