13 #define TRGCDC_SHORT_NAMES
15 #include "framework/datastore/StoreArray.h"
16 #include "mdst/dataobjects/MCParticle.h"
17 #include "trg/cdc/Relation.h"
28 const std::map<unsigned, unsigned>& relation)
54 _pairs =
new const pair<unsigned, unsigned>* [n];
55 map<unsigned, unsigned>::const_iterator it =
_relations.begin();
58 _pairs[i] =
new const pair<unsigned, unsigned>(it->first, it->second);
64 for (
unsigned k = 0; k < n - 1; k++) {
65 for (
unsigned j = i + 1; j < n; j++) {
67 const pair<unsigned, unsigned>* tmp =
_pairs[k];
83 const unsigned nMcParticles = mcParticles.
getEntries();
84 if (nMcParticles == 0) cout <<
"[Error] TRGCDCRelation::mcParticle() => There are no mc particles in MCParticle store array." <<
86 return * mcParticles[id];
99 map<unsigned, unsigned>::const_iterator it =
_relations.begin();
102 if (it->first == trkID)
107 return float(na) / float(n);
117 map<unsigned, unsigned>::const_iterator it =
_relations.begin();
120 if (it->first == trkID)
125 return float(na) / float(n);
133 unsigned nFoundTS = 0;
134 unsigned nTrueTS = 0;
137 for (
unsigned iStereoSuperLayer = 0; iStereoSuperLayer < 4; iStereoSuperLayer++) {
138 if (((this->
track()).links(2 * iStereoSuperLayer + 1)).size() > 0) nFoundTS += 1;
142 map<unsigned, unsigned>::iterator itTSF = numTSsParticle.find(trkID);
143 if (itTSF != numTSsParticle.end()) nTrueTS = itTSF->second;
151 return float(nFoundTS) / float(nTrueTS);
157 const std::string& prefix)
const
161 cout << prefix <<
"#contributions=" << n << endl;
162 const string tab = prefix +
" ";
163 for (
unsigned i = 0; i < n; i++) {
165 <<
",purity=" <<
purity(i) * 100 <<
"%"
A Class to store the Monte Carlo particle information.
int getPDG() const
Return PDG code of particle.
int getEntries() const
Get the number of objects in the array.
const std::pair< unsigned, unsigned > ** _pairs
Pairs.
const std::map< unsigned, unsigned > _relations
Map.
A class to represent a track object in TRGCDC.
float efficiency3D(unsigned trkID, std::map< unsigned, unsigned > &numTSsParticle) const
returns efficiency of TS for 3D
const MCParticle & mcParticle(unsigned i=0) const
returns i'th contributor.
const TRGCDCTrackBase & track(void) const
returns a track.
virtual ~TRGCDCRelation()
Destructor.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
Dumps debug information.
unsigned nContributors(void) const
returns /# of contributors.
unsigned contributor(unsigned i=0) const
returns i'th contributor of MCParticle.
float purity(unsigned i=0) const
returns i'th purity.
float purity3D(unsigned trkID) const
returns purity for 3D for trkID particle which should be from 2D.
Abstract base class for different kinds of events.