1 |
bendavid |
1.45 |
// $Id: FillerElectrons.cc,v 1.44 2010/05/29 11:58:28 bendavid Exp $
|
2 |
loizides |
1.1 |
|
3 |
|
|
#include "MitProd/TreeFiller/interface/FillerElectrons.h"
|
4 |
|
|
#include "DataFormats/TrackReco/interface/Track.h"
|
5 |
|
|
#include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
|
6 |
|
|
#include "DataFormats/TrackReco/interface/TrackFwd.h"
|
7 |
sixie |
1.11 |
#include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
|
8 |
|
|
#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
|
9 |
|
|
#include "DataFormats/EgammaReco/interface/ClusterShape.h"
|
10 |
|
|
#include "DataFormats/EgammaReco/interface/BasicClusterShapeAssociation.h"
|
11 |
bendavid |
1.18 |
#include "DataFormats/Common/interface/RefToPtr.h"
|
12 |
loizides |
1.35 |
#include "DataFormats/Common/interface/ValueMap.h"
|
13 |
|
|
#include "AnalysisDataFormats/Egamma/interface/ElectronID.h"
|
14 |
|
|
#include "AnalysisDataFormats/Egamma/interface/ElectronIDAssociation.h"
|
15 |
sixie |
1.11 |
#include "RecoEgamma/EgammaIsolationAlgos/interface/ElectronTkIsolation.h"
|
16 |
|
|
#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaEcalIsolation.h"
|
17 |
sixie |
1.14 |
#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h"
|
18 |
loizides |
1.35 |
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
|
19 |
bendavid |
1.43 |
#include "DataFormats/VertexReco/interface/VertexFwd.h"
|
20 |
|
|
#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
|
21 |
|
|
#include "TrackingTools/TransientTrack/plugins/TransientTrackBuilderESProducer.h"
|
22 |
bendavid |
1.44 |
#include "RecoVertex/GaussianSumVertexFit/interface/GsfVertexTrackCompatibilityEstimator.h"
|
23 |
bendavid |
1.43 |
#include "TrackingTools/IPTools/interface/IPTools.h"
|
24 |
|
|
#include "RecoEgamma/EgammaTools/interface/ConversionFinder.h"
|
25 |
|
|
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
|
26 |
|
|
#include "MagneticField/Engine/interface/MagneticField.h"
|
27 |
loizides |
1.35 |
#include "MitAna/DataTree/interface/ElectronCol.h"
|
28 |
|
|
#include "MitAna/DataTree/interface/Names.h"
|
29 |
|
|
#include "MitAna/DataTree/interface/Track.h"
|
30 |
loizides |
1.33 |
#include "MitEdm/DataFormats/interface/RefToBaseToPtr.h"
|
31 |
loizides |
1.35 |
#include "MitProd/ObjectService/interface/ObjectService.h"
|
32 |
bendavid |
1.45 |
#include "MitEdm/DataFormats/interface/DecayPart.h"
|
33 |
|
|
#include "MitEdm/ConversionRejection/interface/ConversionMatcher.h"
|
34 |
sixie |
1.13 |
|
35 |
loizides |
1.1 |
using namespace std;
|
36 |
|
|
using namespace edm;
|
37 |
|
|
using namespace mithep;
|
38 |
|
|
|
39 |
loizides |
1.5 |
//--------------------------------------------------------------------------------------------------
|
40 |
loizides |
1.28 |
FillerElectrons::FillerElectrons(const edm::ParameterSet &cfg, const char *name, bool active) :
|
41 |
|
|
BaseFiller(cfg,name,active),
|
42 |
loizides |
1.1 |
edmName_(Conf().getUntrackedParameter<string>("edmName","pixelMatchGsfElectrons")),
|
43 |
|
|
mitName_(Conf().getUntrackedParameter<string>("mitName",Names::gkElectronBrn)),
|
44 |
loizides |
1.10 |
gsfTrackMapName_(Conf().getUntrackedParameter<string>("gsfTrackMapName","")),
|
45 |
|
|
trackerTrackMapName_(Conf().getUntrackedParameter<string>("trackerTrackMapName","")),
|
46 |
sixie |
1.12 |
barrelSuperClusterMapName_(Conf().getUntrackedParameter<string>("barrelSuperClusterMapName","")),
|
47 |
|
|
endcapSuperClusterMapName_(Conf().getUntrackedParameter<string>("endcapSuperClusterMapName","")),
|
48 |
bendavid |
1.36 |
pfSuperClusterMapName_(Conf().getUntrackedParameter<string>("pfSuperClusterMapName","")),
|
49 |
loizides |
1.16 |
eIDCutBasedTightName_(Conf().getUntrackedParameter<string>("eIDCutBasedTightName","eidTight")),
|
50 |
bendavid |
1.43 |
eIDCutBasedLooseName_(Conf().getUntrackedParameter<string>("eIDCutBasedLooseName","eidLoose")),
|
51 |
|
|
pvEdmName_(Conf().getUntrackedParameter<string>("pvEdmName","offlinePrimaryVertices")),
|
52 |
|
|
pvBSEdmName_(Conf().getUntrackedParameter<string>("pvEdmName","offlinePrimaryVerticesWithBS")),
|
53 |
loizides |
1.8 |
electrons_(new mithep::ElectronArr(16)),
|
54 |
loizides |
1.10 |
gsfTrackMap_(0),
|
55 |
sixie |
1.11 |
trackerTrackMap_(0),
|
56 |
sixie |
1.12 |
barrelSuperClusterMap_(0),
|
57 |
|
|
endcapSuperClusterMap_(0)
|
58 |
loizides |
1.1 |
{
|
59 |
|
|
// Constructor.
|
60 |
|
|
}
|
61 |
|
|
|
62 |
loizides |
1.5 |
//--------------------------------------------------------------------------------------------------
|
63 |
loizides |
1.1 |
FillerElectrons::~FillerElectrons()
|
64 |
|
|
{
|
65 |
|
|
// Destructor.
|
66 |
loizides |
1.6 |
|
67 |
|
|
delete electrons_;
|
68 |
loizides |
1.1 |
}
|
69 |
|
|
|
70 |
loizides |
1.5 |
//--------------------------------------------------------------------------------------------------
|
71 |
bendavid |
1.42 |
void FillerElectrons::BookDataBlock(TreeWriter &tws)
|
72 |
loizides |
1.1 |
{
|
73 |
loizides |
1.10 |
// Add electron branch to our tree and get our maps.
|
74 |
loizides |
1.1 |
|
75 |
loizides |
1.29 |
tws.AddBranch(mitName_,&electrons_);
|
76 |
|
|
OS()->add<mithep::ElectronArr>(electrons_,mitName_);
|
77 |
loizides |
1.10 |
|
78 |
loizides |
1.29 |
if (!gsfTrackMapName_.empty()) {
|
79 |
|
|
gsfTrackMap_ = OS()->get<TrackMap>(gsfTrackMapName_);
|
80 |
|
|
if (gsfTrackMap_)
|
81 |
|
|
AddBranchDep(mitName_,gsfTrackMap_->GetBrName());
|
82 |
|
|
}
|
83 |
|
|
if (!trackerTrackMapName_.empty()) {
|
84 |
|
|
trackerTrackMap_ = OS()->get<TrackMap>(trackerTrackMapName_);
|
85 |
|
|
if (trackerTrackMap_)
|
86 |
|
|
AddBranchDep(mitName_,trackerTrackMap_->GetBrName());
|
87 |
|
|
}
|
88 |
|
|
if (!barrelSuperClusterMapName_.empty()) {
|
89 |
|
|
barrelSuperClusterMap_ = OS()->get<SuperClusterMap>(barrelSuperClusterMapName_);
|
90 |
|
|
if (barrelSuperClusterMap_)
|
91 |
|
|
AddBranchDep(mitName_,barrelSuperClusterMap_->GetBrName());
|
92 |
|
|
}
|
93 |
|
|
if (!endcapSuperClusterMapName_.empty()) {
|
94 |
|
|
endcapSuperClusterMap_ = OS()->get<SuperClusterMap>(endcapSuperClusterMapName_);
|
95 |
|
|
if (endcapSuperClusterMap_)
|
96 |
|
|
AddBranchDep(mitName_,endcapSuperClusterMap_->GetBrName());
|
97 |
|
|
}
|
98 |
bendavid |
1.36 |
if (!pfSuperClusterMapName_.empty()) {
|
99 |
|
|
pfSuperClusterMap_ = OS()->get<SuperClusterMap>(pfSuperClusterMapName_);
|
100 |
|
|
if (pfSuperClusterMap_)
|
101 |
|
|
AddBranchDep(mitName_,pfSuperClusterMap_->GetBrName());
|
102 |
|
|
}
|
103 |
loizides |
1.1 |
}
|
104 |
|
|
|
105 |
loizides |
1.5 |
//--------------------------------------------------------------------------------------------------
|
106 |
loizides |
1.29 |
void FillerElectrons::FillDataBlock(const edm::Event &event, const edm::EventSetup &setup)
|
107 |
loizides |
1.1 |
{
|
108 |
|
|
// Fill electrons from edm collection into our collection.
|
109 |
|
|
|
110 |
bendavid |
1.26 |
electrons_->Delete();
|
111 |
loizides |
1.1 |
|
112 |
sixie |
1.11 |
Handle<reco::GsfElectronCollection> hElectronProduct;
|
113 |
loizides |
1.7 |
GetProduct(edmName_, hElectronProduct, event);
|
114 |
loizides |
1.1 |
|
115 |
loizides |
1.29 |
// handles to get the electron ID information
|
116 |
sixie |
1.13 |
Handle<edm::ValueMap<float> > eidLooseMap;
|
117 |
|
|
GetProduct(eIDCutBasedLooseName_, eidLooseMap, event);
|
118 |
|
|
Handle<edm::ValueMap<float> > eidTightMap;
|
119 |
|
|
GetProduct(eIDCutBasedTightName_, eidTightMap, event);
|
120 |
bendavid |
1.43 |
|
121 |
|
|
edm::Handle<reco::VertexCollection> hVertex;
|
122 |
|
|
event.getByLabel(pvEdmName_, hVertex);
|
123 |
|
|
const reco::VertexCollection *pvCol = hVertex.product();
|
124 |
|
|
|
125 |
|
|
edm::Handle<reco::VertexCollection> hVertexBS;
|
126 |
|
|
event.getByLabel(pvBSEdmName_, hVertexBS);
|
127 |
|
|
const reco::VertexCollection *pvBSCol = hVertexBS.product();
|
128 |
|
|
|
129 |
|
|
edm::Handle<reco::TrackCollection> hGeneralTracks;
|
130 |
|
|
event.getByLabel("generalTracks", hGeneralTracks);
|
131 |
|
|
//const reco::VertexCollection *trackCol = hGeneralTracks.product();
|
132 |
bendavid |
1.45 |
|
133 |
|
|
edm::Handle<std::vector<mitedm::DecayPart> > hConversions;
|
134 |
|
|
event.getByLabel("mvfConversionRemoval", hConversions);
|
135 |
|
|
|
136 |
|
|
mitedm::ConversionMatcher convMatcher;
|
137 |
bendavid |
1.43 |
|
138 |
|
|
edm::ESHandle<TransientTrackBuilder> hTransientTrackBuilder;
|
139 |
|
|
setup.get<TransientTrackRecord>().get("TransientTrackBuilder",hTransientTrackBuilder);
|
140 |
|
|
const TransientTrackBuilder *transientTrackBuilder = hTransientTrackBuilder.product();
|
141 |
bendavid |
1.19 |
|
142 |
bendavid |
1.44 |
GsfVertexTrackCompatibilityEstimator gsfEstimator;
|
143 |
|
|
|
144 |
bendavid |
1.43 |
//Get Magnetic Field from event setup, taking value at (0,0,0)
|
145 |
|
|
edm::ESHandle<MagneticField> magneticField;
|
146 |
|
|
setup.get<IdealMagneticFieldRecord>().get(magneticField);
|
147 |
|
|
const double bfield = magneticField->inTesla(GlobalPoint(0.,0.,0.)).z();
|
148 |
|
|
|
149 |
sixie |
1.11 |
const reco::GsfElectronCollection inElectrons = *(hElectronProduct.product());
|
150 |
loizides |
1.29 |
// loop over electrons
|
151 |
sixie |
1.11 |
for (reco::GsfElectronCollection::const_iterator iM = inElectrons.begin();
|
152 |
loizides |
1.1 |
iM != inElectrons.end(); ++iM) {
|
153 |
sixie |
1.13 |
|
154 |
loizides |
1.29 |
// the index and Ref are needed for the eID association Map
|
155 |
sixie |
1.13 |
unsigned int iElectron = iM - inElectrons.begin();
|
156 |
|
|
reco::GsfElectronRef eRef(hElectronProduct, iElectron);
|
157 |
|
|
|
158 |
loizides |
1.8 |
mithep::Electron *outElectron = electrons_->AddNew();
|
159 |
bendavid |
1.31 |
|
160 |
|
|
outElectron->SetPtEtaPhi(iM->pt(),iM->eta(),iM->phi());
|
161 |
sixie |
1.12 |
|
162 |
bendavid |
1.40 |
outElectron->SetCharge(iM->charge());
|
163 |
|
|
outElectron->SetScPixCharge(iM->scPixCharge());
|
164 |
|
|
|
165 |
loizides |
1.30 |
outElectron->SetESuperClusterOverP(iM->eSuperClusterOverP());
|
166 |
|
|
outElectron->SetESeedClusterOverPout(iM->eSeedClusterOverPout());
|
167 |
|
|
outElectron->SetPIn(iM->trackMomentumAtVtx().R());
|
168 |
loizides |
1.29 |
outElectron->SetPOut(iM->trackMomentumOut().R());
|
169 |
loizides |
1.30 |
outElectron->SetDeltaEtaSuperClusterTrackAtVtx(iM->deltaEtaSuperClusterTrackAtVtx());
|
170 |
|
|
outElectron->SetDeltaEtaSeedClusterTrackAtCalo(iM->deltaEtaSeedClusterTrackAtCalo());
|
171 |
|
|
outElectron->SetDeltaPhiSuperClusterTrackAtVtx(iM->deltaPhiSuperClusterTrackAtVtx());
|
172 |
|
|
outElectron->SetDeltaPhiSeedClusterTrackAtCalo(iM->deltaPhiSeedClusterTrackAtCalo());
|
173 |
|
|
outElectron->SetIsEnergyScaleCorrected(iM->isEnergyScaleCorrected());
|
174 |
|
|
outElectron->SetIsMomentumCorrected(iM->isMomentumCorrected());
|
175 |
bendavid |
1.36 |
outElectron->SetNumberOfClusters(iM->basicClustersSize());
|
176 |
loizides |
1.30 |
outElectron->SetClassification(iM->classification());
|
177 |
bendavid |
1.37 |
outElectron->SetFBrem(iM->fbrem());
|
178 |
|
|
|
179 |
loizides |
1.38 |
// pflow electron stuff
|
180 |
bendavid |
1.41 |
outElectron->SetIsEcalDriven(iM->ecalDrivenSeed());
|
181 |
|
|
outElectron->SetIsTrackerDriven(iM->trackerDrivenSeed());
|
182 |
bendavid |
1.37 |
outElectron->SetMva(iM->mva());
|
183 |
|
|
|
184 |
loizides |
1.29 |
// shower shape variables
|
185 |
bendavid |
1.37 |
outElectron->SetE15(iM->e1x5());
|
186 |
|
|
outElectron->SetE25Max(iM->e2x5Max());
|
187 |
|
|
outElectron->SetE55(iM->e5x5());
|
188 |
|
|
outElectron->SetCovEtaEta(iM->sigmaEtaEta());
|
189 |
|
|
outElectron->SetCoviEtaiEta(iM->sigmaIetaIeta());
|
190 |
|
|
outElectron->SetHadronicOverEm(iM->hcalOverEcal());
|
191 |
|
|
outElectron->SetHcalDepth1OverEcal(iM->hcalDepth1OverEcal());
|
192 |
|
|
outElectron->SetHcalDepth2OverEcal(iM->hcalDepth2OverEcal());
|
193 |
sixie |
1.12 |
|
194 |
loizides |
1.38 |
// fill isolation variables for both cone sizes
|
195 |
bendavid |
1.37 |
outElectron->SetEcalRecHitIsoDr04(iM->dr04EcalRecHitSumEt());
|
196 |
|
|
outElectron->SetHcalDepth1TowerSumEtDr04(iM->dr04HcalDepth1TowerSumEt());
|
197 |
|
|
outElectron->SetHcalDepth2TowerSumEtDr04(iM->dr04HcalDepth2TowerSumEt());
|
198 |
|
|
outElectron->SetTrackIsolationDr04(iM->dr04TkSumPt());
|
199 |
|
|
outElectron->SetEcalRecHitIsoDr03(iM->dr03EcalRecHitSumEt());
|
200 |
|
|
outElectron->SetHcalTowerSumEtDr03(iM->dr03HcalTowerSumEt());
|
201 |
|
|
outElectron->SetHcalDepth1TowerSumEtDr03(iM->dr03HcalDepth1TowerSumEt());
|
202 |
|
|
outElectron->SetHcalDepth2TowerSumEtDr03(iM->dr03HcalDepth2TowerSumEt());
|
203 |
|
|
outElectron->SetTrackIsolationDr03(iM->dr03TkSumPt());
|
204 |
|
|
|
205 |
loizides |
1.38 |
// fiducial flags
|
206 |
bendavid |
1.37 |
outElectron->SetIsEB(iM->isEB());
|
207 |
|
|
outElectron->SetIsEE(iM->isEE());
|
208 |
|
|
outElectron->SetIsEBEEGap(iM->isEBEEGap());
|
209 |
|
|
outElectron->SetIsEBEtaGap(iM->isEBEtaGap());
|
210 |
|
|
outElectron->SetIsEBPhiGap(iM->isEBPhiGap());
|
211 |
|
|
outElectron->SetIsEEDeeGap(iM->isEEDeeGap());
|
212 |
|
|
outElectron->SetIsEERingGap(iM->isEERingGap());
|
213 |
sixie |
1.12 |
|
214 |
loizides |
1.38 |
// gsf-tracker match quality
|
215 |
bendavid |
1.37 |
outElectron->SetFracSharedHits(iM->shFracInnerHits());
|
216 |
sixie |
1.15 |
|
217 |
loizides |
1.29 |
// make proper links to Tracks and Super Clusters
|
218 |
loizides |
1.1 |
if (gsfTrackMap_ && iM->gsfTrack().isNonnull())
|
219 |
bendavid |
1.18 |
outElectron->SetGsfTrk(gsfTrackMap_->GetMit(refToPtr(iM->gsfTrack())));
|
220 |
loizides |
1.29 |
// make tracker track links, relinking from gsf track associations if configured and
|
221 |
|
|
// link is otherwise absent
|
222 |
bendavid |
1.37 |
if (trackerTrackMap_ && iM->closestCtfTrackRef().isNonnull()) {
|
223 |
bendavid |
1.36 |
outElectron->SetTrackerTrk(trackerTrackMap_->GetMit(refToPtr(iM->closestCtfTrackRef())));
|
224 |
bendavid |
1.19 |
}
|
225 |
loizides |
1.38 |
if (barrelSuperClusterMap_ && endcapSuperClusterMap_ &&
|
226 |
|
|
pfSuperClusterMap_ && iM->superCluster().isNonnull()) {
|
227 |
bendavid |
1.37 |
if(barrelSuperClusterMap_->HasMit(iM->superCluster())) {
|
228 |
sixie |
1.12 |
outElectron->SetSuperCluster(barrelSuperClusterMap_->GetMit(iM->superCluster()));
|
229 |
bendavid |
1.36 |
}
|
230 |
|
|
else if (endcapSuperClusterMap_->HasMit(iM->superCluster())) {
|
231 |
sixie |
1.12 |
outElectron->SetSuperCluster(endcapSuperClusterMap_->GetMit(iM->superCluster()));
|
232 |
|
|
}
|
233 |
bendavid |
1.36 |
else if (pfSuperClusterMap_->HasMit(iM->superCluster())) {
|
234 |
|
|
outElectron->SetSuperCluster(pfSuperClusterMap_->GetMit(iM->superCluster()));
|
235 |
|
|
}
|
236 |
|
|
else throw edm::Exception(edm::errors::Configuration, "FillerElectrons:FillDataBlock()\n")
|
237 |
|
|
<< "Error! SuperCluster reference in unmapped collection " << edmName_ << endl;
|
238 |
|
|
}
|
239 |
sixie |
1.13 |
|
240 |
bendavid |
1.43 |
//compute impact parameter with respect to PV
|
241 |
|
|
if (iM->gsfTrack().isNonnull()) {
|
242 |
|
|
const reco::TransientTrack &tt = transientTrackBuilder->build(iM->gsfTrack());
|
243 |
|
|
|
244 |
|
|
const std::pair<bool,Measurement1D> &d0pv = IPTools::absoluteTransverseImpactParameter(tt,pvCol->at(0));
|
245 |
|
|
if (d0pv.first) {
|
246 |
|
|
outElectron->SetD0PV(d0pv.second.value());
|
247 |
|
|
outElectron->SetD0PVErr(d0pv.second.error());
|
248 |
|
|
}
|
249 |
bendavid |
1.44 |
else {
|
250 |
|
|
outElectron->SetD0PV(-99.0);
|
251 |
|
|
}
|
252 |
|
|
|
253 |
bendavid |
1.43 |
|
254 |
|
|
const std::pair<bool,Measurement1D> &ip3dpv = IPTools::absoluteImpactParameter3D(tt,pvCol->at(0));
|
255 |
|
|
if (ip3dpv.first) {
|
256 |
|
|
outElectron->SetIp3dPV(ip3dpv.second.value());
|
257 |
|
|
outElectron->SetIp3dPVErr(ip3dpv.second.error());
|
258 |
|
|
}
|
259 |
bendavid |
1.44 |
else {
|
260 |
|
|
outElectron->SetIp3dPV(-99.0);
|
261 |
|
|
}
|
262 |
bendavid |
1.43 |
|
263 |
|
|
const std::pair<bool,Measurement1D> &d0pvbs = IPTools::absoluteTransverseImpactParameter(tt,pvBSCol->at(0));
|
264 |
|
|
if (d0pvbs.first) {
|
265 |
|
|
outElectron->SetD0PVBS(d0pvbs.second.value());
|
266 |
|
|
outElectron->SetD0PVBSErr(d0pvbs.second.error());
|
267 |
|
|
}
|
268 |
bendavid |
1.44 |
else {
|
269 |
|
|
outElectron->SetD0PVBS(-99.0);
|
270 |
|
|
}
|
271 |
bendavid |
1.43 |
|
272 |
|
|
const std::pair<bool,Measurement1D> &ip3dpvbs = IPTools::absoluteImpactParameter3D(tt,pvBSCol->at(0));
|
273 |
|
|
if (ip3dpvbs.first) {
|
274 |
|
|
outElectron->SetIp3dPVBS(ip3dpvbs.second.value());
|
275 |
|
|
outElectron->SetIp3dPVBSErr(ip3dpvbs.second.error());
|
276 |
|
|
}
|
277 |
bendavid |
1.44 |
else {
|
278 |
|
|
outElectron->SetIp3dPVBS(-99.0);
|
279 |
|
|
}
|
280 |
|
|
|
281 |
|
|
//compute compatibility with PV using full GSF state mixture (but skip in AOD)
|
282 |
|
|
if (iM->gsfTrack()->gsfExtra().isAvailable()) {
|
283 |
|
|
|
284 |
|
|
const std::pair<bool,double> &pvGsfCompat = gsfEstimator.estimate(pvCol->at(0),tt);
|
285 |
|
|
if (pvGsfCompat.first) {
|
286 |
|
|
outElectron->SetGsfPVCompatibility(pvGsfCompat.second);
|
287 |
|
|
}
|
288 |
|
|
else {
|
289 |
|
|
outElectron->SetGsfPVCompatibility(-99.0);
|
290 |
|
|
}
|
291 |
|
|
|
292 |
|
|
|
293 |
|
|
const std::pair<bool,double> &pvbsGsfCompat = gsfEstimator.estimate(pvBSCol->at(0),tt);
|
294 |
|
|
if (pvbsGsfCompat.first) {
|
295 |
|
|
outElectron->SetGsfPVBSCompatibility(pvbsGsfCompat.second);
|
296 |
|
|
}
|
297 |
|
|
else {
|
298 |
|
|
outElectron->SetGsfPVBSCompatibility(-99.0);
|
299 |
|
|
}
|
300 |
|
|
|
301 |
|
|
//compute signal vertex compatibility with full GSF state mixture excluding matching ckf track
|
302 |
|
|
//from vertex
|
303 |
|
|
if (iM->closestCtfTrackRef().isNonnull() && iM->closestCtfTrackRef()->extra().isAvailable()) {
|
304 |
|
|
const reco::TransientTrack &ttCkf = transientTrackBuilder->build(iM->closestCtfTrackRef());
|
305 |
|
|
|
306 |
|
|
const std::pair<bool,double> &pvGsfCompatMatched = gsfEstimator.estimate(pvCol->at(0),tt, ttCkf);
|
307 |
|
|
if (pvGsfCompatMatched.first) {
|
308 |
|
|
outElectron->SetGsfPVCompatibilityMatched(pvGsfCompatMatched.second);
|
309 |
|
|
}
|
310 |
|
|
else {
|
311 |
|
|
outElectron->SetGsfPVCompatibilityMatched(-99.0);
|
312 |
|
|
}
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
const std::pair<bool,double> &pvbsGsfCompatMatched = gsfEstimator.estimate(pvBSCol->at(0),tt, ttCkf);
|
316 |
|
|
if (pvbsGsfCompatMatched.first) {
|
317 |
|
|
outElectron->SetGsfPVBSCompatibilityMatched(pvbsGsfCompatMatched.second);
|
318 |
|
|
}
|
319 |
|
|
else {
|
320 |
|
|
outElectron->SetGsfPVBSCompatibilityMatched(-99.0);
|
321 |
|
|
}
|
322 |
|
|
|
323 |
|
|
if (verbose_>1) {
|
324 |
|
|
printf("gsf compat = %5f\n", pvGsfCompat.second);
|
325 |
|
|
printf("gsf compat matched = %5f\n", pvGsfCompatMatched.second);
|
326 |
|
|
}
|
327 |
|
|
}
|
328 |
|
|
else {
|
329 |
|
|
//no matching ckf track, so copy existing values
|
330 |
|
|
if (pvGsfCompat.first) {
|
331 |
|
|
outElectron->SetGsfPVCompatibilityMatched(pvGsfCompat.second);
|
332 |
|
|
}
|
333 |
|
|
else {
|
334 |
|
|
outElectron->SetGsfPVCompatibilityMatched(-99.0);
|
335 |
|
|
}
|
336 |
|
|
|
337 |
|
|
if (pvbsGsfCompat.first) {
|
338 |
|
|
outElectron->SetGsfPVBSCompatibilityMatched(pvbsGsfCompat.second);
|
339 |
|
|
}
|
340 |
|
|
else {
|
341 |
|
|
outElectron->SetGsfPVBSCompatibilityMatched(-99.0);
|
342 |
|
|
}
|
343 |
|
|
}
|
344 |
|
|
|
345 |
|
|
}
|
346 |
bendavid |
1.43 |
|
347 |
|
|
if (verbose_>1) {
|
348 |
|
|
printf("gsf track pt = %5f\n",iM->gsfTrack()->pt());
|
349 |
|
|
printf("gsf track mode pt = %5f\n",iM->gsfTrack()->ptMode());
|
350 |
|
|
printf("ttrack pt = %5f\n",tt.initialFreeState().momentum().perp());
|
351 |
|
|
//printf("ttrackgsf pt = %5f\n",ttgsf.innermostMeasurementState().globalMomentum().perp());
|
352 |
bendavid |
1.44 |
printf("ip3dpv reduced chisquared = %5f, probability = %5f\n", ip3dpv.second.value()/ip3dpv.second.error(), TMath::Prob(ip3dpv.second.value()/ip3dpv.second.error(),1));
|
353 |
|
|
//printf("gsf reduced chisquared = %5f, probability = %5f\n", pvGsfCompat.second/2, TMath::Prob(pvGsfCompat.second,2));
|
354 |
bendavid |
1.43 |
}
|
355 |
|
|
|
356 |
|
|
}
|
357 |
|
|
|
358 |
|
|
//fill conversion partner track info
|
359 |
|
|
ConversionFinder convFinder;
|
360 |
|
|
ConversionInfo convInfo = convFinder.getConversionInfo(*iM, hGeneralTracks, bfield);
|
361 |
|
|
outElectron->SetConvPartnerDCotTheta(convInfo.dcot());
|
362 |
|
|
outElectron->SetConvPartnerDist(convInfo.dist());
|
363 |
|
|
outElectron->SetConvPartnerRadius(convInfo.radiusOfConversion());
|
364 |
bendavid |
1.45 |
outElectron->SetConversionXYZ(convInfo.pointOfConversion().x(),convInfo.pointOfConversion().y(),convInfo.pointOfConversion().z());
|
365 |
|
|
reco::TrackRef convTrackRef = convInfo.conversionPartnerTk();
|
366 |
|
|
if (trackerTrackMap_ && convTrackRef.isNonnull()) {
|
367 |
|
|
outElectron->SetConvPartnerTrk(trackerTrackMap_->GetMit(refToPtr(convTrackRef)));
|
368 |
|
|
}
|
369 |
bendavid |
1.43 |
|
370 |
loizides |
1.29 |
// fill Electron ID information
|
371 |
sixie |
1.13 |
outElectron->SetPassLooseID((*eidLooseMap)[eRef]);
|
372 |
|
|
outElectron->SetPassTightID((*eidTightMap)[eRef]);
|
373 |
bendavid |
1.31 |
|
374 |
bendavid |
1.45 |
//fill additional conversion flag
|
375 |
|
|
outElectron->SetMatchesVertexConversion(convMatcher.matchesGoodConversion(*iM,hConversions));
|
376 |
|
|
|
377 |
bendavid |
1.31 |
if (verbose_>1) {
|
378 |
|
|
double recomass = sqrt(iM->energy()*iM->energy() - iM->p()*iM->p());
|
379 |
loizides |
1.32 |
printf(" mithep::Electron, pt=%5f, eta=%5f, phi=%5f, energy=%5f, p=%5f, mass=%5f\n",
|
380 |
|
|
outElectron->Pt(), outElectron->Eta(), outElectron->Phi(),
|
381 |
|
|
outElectron->E(), outElectron->P(), outElectron->Mass());
|
382 |
|
|
printf("reco::GsfElectron , pt=%5f, eta=%5f, phi=%5f, energy=%5f, p=%5f, mass=%5f\n",
|
383 |
|
|
iM->pt(), iM->eta(), iM->phi(), iM->energy(), iM->p(), recomass);
|
384 |
bendavid |
1.31 |
}
|
385 |
sixie |
1.12 |
}
|
386 |
loizides |
1.1 |
electrons_->Trim();
|
387 |
|
|
}
|