1 |
dhidas |
1.1 |
/*
|
2 |
|
|
* MCParticle.cpp
|
3 |
|
|
*
|
4 |
|
|
* Created on: Jun 25, 2010
|
5 |
|
|
* Author: lkreczko
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
#include "../../interface/RecoObjects/MCParticle.h"
|
9 |
|
|
|
10 |
|
|
namespace BAT {
|
11 |
|
|
|
12 |
|
|
MCParticle::MCParticle() : Particle(),
|
13 |
|
|
particlePdgId(0), particleMotherIndex(0), particleStatus(0){
|
14 |
|
|
|
15 |
|
|
}
|
16 |
|
|
|
17 |
|
|
MCParticle::MCParticle(float energy, float px, float py, float pz): Particle(energy, px, py, pz),
|
18 |
|
|
particlePdgId(0), particleMotherIndex(0), particleStatus(0){
|
19 |
|
|
|
20 |
|
|
}
|
21 |
|
|
//MCParticle::Particle(const MCParticle& particle) :
|
22 |
|
|
// particlePdgId(particle.pdgId()), particleMotherIndex(particle.motherIndex()), particleStatus(particle.status) {
|
23 |
|
|
//
|
24 |
|
|
//}
|
25 |
|
|
|
26 |
|
|
//MCParticle::Particle(int pdgId, float phi, float eta, float pt, float energy, int motherIndex, int status) {
|
27 |
|
|
//
|
28 |
|
|
//}
|
29 |
|
|
|
30 |
|
|
//MCParticle::Particle(): Particle() {
|
31 |
|
|
//
|
32 |
|
|
//}
|
33 |
|
|
|
34 |
|
|
MCParticle::~MCParticle() {
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
int MCParticle::pdgId() const {
|
38 |
|
|
return particlePdgId;
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
int MCParticle::motherIndex() const {
|
42 |
|
|
return particleMotherIndex;
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
int MCParticle::status() const {
|
46 |
|
|
return particleStatus;
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
void MCParticle::setStatus(int Status) {
|
50 |
|
|
particleStatus = Status;
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
void MCParticle::setMotherIndex(int MotherIndex){
|
54 |
|
|
particleMotherIndex = MotherIndex;
|
55 |
|
|
}
|
56 |
|
|
|
57 |
|
|
void MCParticle::setPdgId(int PdgId){
|
58 |
|
|
particlePdgId = PdgId;
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
bool MCParticle::isQuark() const {
|
62 |
|
|
if ((abs(pdgId())>0) && (abs(pdgId())<9)) return true; else return false;
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
bool MCParticle::isLepton() const {
|
66 |
|
|
if ((abs(pdgId())>10) && (abs(pdgId())<19)) return true; else return false;
|
67 |
|
|
}
|
68 |
|
|
|
69 |
|
|
bool MCParticle::isNeutrino() const {
|
70 |
|
|
if ((abs(pdgId())==12) || (abs(pdgId())==14) || (abs(pdgId())==16) || (abs(pdgId())==18)) return true; else return false;
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
unsigned short MCParticle::getClosestJetIndex(const JetCollection& jets) const {
|
74 |
|
|
unsigned short idOfClosest = 999;
|
75 |
|
|
float closestDR = 999.;
|
76 |
|
|
for (unsigned short index = 0; index < jets.size(); ++index) {
|
77 |
|
|
float DR = deltaR(jets.at(index));
|
78 |
|
|
if (DR < closestDR) {
|
79 |
|
|
closestDR = DR;
|
80 |
|
|
idOfClosest = index;
|
81 |
|
|
}
|
82 |
|
|
}
|
83 |
|
|
return idOfClosest;
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
}
|