00001
00002
00003
00004
00005
00006
00007 #include "RecoParticleFlow/PFProducer/interface/PFPhotonAlgo.h"
00008 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementCluster.h"
00009 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
00010 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementSuperCluster.h"
00011
00012 #include "RecoParticleFlow/PFClusterTools/interface/PFEnergyCalibration.h"
00013 #include "DataFormats/Math/interface/deltaPhi.h"
00014 #include "DataFormats/Math/interface/deltaR.h"
00015
00016 #include <iomanip>
00017 #include <algorithm>
00018
00019 using namespace std;
00020 using namespace reco;
00021
00022
00023 PFPhotonAlgo::PFPhotonAlgo(std::string mvaweightfile,
00024 double mvaConvCut,
00025 const reco::Vertex& primary,
00026 const boost::shared_ptr<PFEnergyCalibration>& thePFEnergyCalibration) :
00027 isvalid_(false),
00028 verbosityLevel_(Silent),
00029 MVACUT(mvaConvCut),
00030 thePFEnergyCalibration_(thePFEnergyCalibration)
00031 {
00032 primaryVertex_=primary;
00033
00034 tmvaReader_ = new TMVA::Reader("!Color:Silent");
00035 tmvaReader_->AddVariable("del_phi",&del_phi);
00036 tmvaReader_->AddVariable("nlayers", &nlayers);
00037 tmvaReader_->AddVariable("chi2",&chi2);
00038 tmvaReader_->AddVariable("EoverPt",&EoverPt);
00039 tmvaReader_->AddVariable("HoverPt",&HoverPt);
00040 tmvaReader_->AddVariable("track_pt", &track_pt);
00041 tmvaReader_->AddVariable("STIP",&STIP);
00042 tmvaReader_->AddVariable("nlost", &nlost);
00043 tmvaReader_->BookMVA("BDT",mvaweightfile.c_str());
00044 }
00045
00046 void PFPhotonAlgo::RunPFPhoton(const reco::PFBlockRef& blockRef,
00047 std::vector<bool>& active,
00048 std::auto_ptr<PFCandidateCollection> &pfCandidates){
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 verbosityLevel_ = Chatty;
00061
00062
00063
00064 const edm::OwnVector< reco::PFBlockElement >& elements = blockRef->elements();
00065 edm::OwnVector< reco::PFBlockElement >::const_iterator ele = elements.begin();
00066 std::vector<bool>::const_iterator actIter = active.begin();
00067 PFBlock::LinkData linkData = blockRef->linkData();
00068 bool isActive = true;
00069
00070 if(elements.size() != active.size()) {
00071
00072
00073 return;
00074 }
00075
00076
00077
00078 std::vector<unsigned int> elemsToLock;
00079 elemsToLock.resize(0);
00080
00081 for( ; ele != elements.end(); ++ele, ++actIter ) {
00082
00083
00084 if( !( ele->type() == reco::PFBlockElement::SC ) ) continue;
00085
00086
00087 float photonEnergy_ = 0.;
00088 float photonX_ = 0.;
00089 float photonY_ = 0.;
00090 float photonZ_ = 0.;
00091 float RawEcalEne = 0.;
00092
00093
00094 float ps1TotEne = 0.;
00095 float ps2TotEne = 0.;
00096
00097 bool hasConvTrack=false;
00098 bool hasSingleleg=false;
00099 std::vector<unsigned int> AddClusters(0);
00100 std::vector<unsigned int> IsoTracks(0);
00101 std::multimap<unsigned int, unsigned int>ClusterAddPS1;
00102 std::multimap<unsigned int, unsigned int>ClusterAddPS2;
00103
00104 isActive = *(actIter);
00105
00106 const reco::PFBlockElementSuperCluster *sc = dynamic_cast<const reco::PFBlockElementSuperCluster*>(&(*ele));
00107
00108
00109 if (!(sc->fromPhoton()))continue;
00110
00111
00112
00113 if( !isActive ) {
00114
00115 continue;
00116 }
00117 elemsToLock.push_back(ele-elements.begin());
00118
00119 std::multimap<double, unsigned int> ecalAssoPFClusters;
00120 blockRef->associatedElements( ele-elements.begin(),
00121 linkData,
00122 ecalAssoPFClusters,
00123 reco::PFBlockElement::ECAL,
00124 reco::PFBlock::LINKTEST_ALL );
00125
00126
00127 if( ! ecalAssoPFClusters.size() ) {
00128
00129
00130 continue;
00131 }
00132
00133
00134
00135 for(std::multimap<double, unsigned int>::iterator itecal = ecalAssoPFClusters.begin();
00136 itecal != ecalAssoPFClusters.end(); ++itecal) {
00137
00138
00139 reco::PFClusterRef clusterRef = elements[itecal->second].clusterRef();
00140
00141
00142
00143
00144
00145
00146
00147 vector<double> ps1Ene(0);
00148 vector<double> ps2Ene(0);
00149 double ps1=0;
00150 double ps2=0;
00151 hasSingleleg=false;
00152 hasConvTrack=false;
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163 if( !( active[itecal->second] ) ) {
00164
00165 continue;
00166 }
00167
00168
00169
00170
00171 if ( false ) {
00172
00173 bool useIt = true;
00174 int mva_reject=0;
00175 bool isClosest=false;
00176 std::multimap<double, unsigned int> Trackscheck;
00177 blockRef->associatedElements( itecal->second,
00178 linkData,
00179 Trackscheck,
00180 reco::PFBlockElement::TRACK,
00181 reco::PFBlock::LINKTEST_ALL);
00182 for(std::multimap<double, unsigned int>::iterator track = Trackscheck.begin();
00183 track != Trackscheck.end(); ++track) {
00184
00185
00186 if( ! (active[track->second]) ) continue;
00187 hasSingleleg=EvaluateSingleLegMVA(blockRef, primaryVertex_, track->second);
00188
00189 std::multimap<double, unsigned int> closecheck;
00190 blockRef->associatedElements(track->second,
00191 linkData,
00192 closecheck,
00193 reco::PFBlockElement::ECAL,
00194 reco::PFBlock::LINKTEST_ALL);
00195 if(closecheck.begin()->second ==itecal->second)isClosest=true;
00196 if(!hasSingleleg)mva_reject++;
00197 }
00198
00199 if(mva_reject>0 && isClosest)useIt=false;
00200
00201 if( !useIt ) continue;
00202 }
00203
00204
00205
00206 elemsToLock.push_back(itecal->second);
00207
00208
00209 std::multimap<double, unsigned int> PS1Elems;
00210 std::multimap<double, unsigned int> PS2Elems;
00211
00212 blockRef->associatedElements( itecal->second,
00213 linkData,
00214 PS1Elems,
00215 reco::PFBlockElement::PS1,
00216 reco::PFBlock::LINKTEST_ALL );
00217
00218 blockRef->associatedElements( itecal->second,
00219 linkData,
00220 PS2Elems,
00221 reco::PFBlockElement::PS2,
00222 reco::PFBlock::LINKTEST_ALL );
00223
00224
00225 for(std::multimap<double, unsigned int>::iterator iteps = PS1Elems.begin();
00226 iteps != PS1Elems.end(); ++iteps) {
00227
00228
00229 if( !(active[iteps->second]) ) continue;
00230
00231
00232 std::multimap<double, unsigned int> ECALPS1check;
00233 blockRef->associatedElements( iteps->second,
00234 linkData,
00235 ECALPS1check,
00236 reco::PFBlockElement::ECAL,
00237 reco::PFBlock::LINKTEST_ALL );
00238 if(itecal->second==ECALPS1check.begin()->second)
00239 {
00240 reco::PFClusterRef ps1ClusterRef = elements[iteps->second].clusterRef();
00241 ps1Ene.push_back( ps1ClusterRef->energy() );
00242 ps1=ps1+ps1ClusterRef->energy();
00243
00244 elemsToLock.push_back(iteps->second);
00245 }
00246 }
00247 for(std::multimap<double, unsigned int>::iterator iteps = PS2Elems.begin();
00248 iteps != PS2Elems.end(); ++iteps) {
00249
00250
00251 if( !(active[iteps->second]) ) continue;
00252
00253
00254 std::multimap<double, unsigned int> ECALPS2check;
00255 blockRef->associatedElements( iteps->second,
00256 linkData,
00257 ECALPS2check,
00258 reco::PFBlockElement::ECAL,
00259 reco::PFBlock::LINKTEST_ALL );
00260 if(itecal->second==ECALPS2check.begin()->second)
00261 {
00262 reco::PFClusterRef ps2ClusterRef = elements[iteps->second].clusterRef();
00263 ps2Ene.push_back( ps2ClusterRef->energy() );
00264 ps2=ps2ClusterRef->energy()+ps2;
00265
00266 elemsToLock.push_back(iteps->second);
00267 }
00268 }
00269
00270
00271 std::multimap<double, unsigned int> hcalElems;
00272 blockRef->associatedElements( itecal->second,linkData,
00273 hcalElems,
00274 reco::PFBlockElement::HCAL,
00275 reco::PFBlock::LINKTEST_ALL );
00276
00277 for(std::multimap<double, unsigned int>::iterator ithcal = hcalElems.begin();
00278 ithcal != hcalElems.end(); ++ithcal) {
00279
00280 if ( ! (active[ithcal->second] ) ) continue;
00281
00282
00283
00284
00285
00286 bool useHcal = false;
00287 if ( !useHcal ) continue;
00288
00289
00290 }
00291
00292
00293
00294
00295 std::multimap<double, unsigned int> convTracks;
00296 blockRef->associatedElements( itecal->second,
00297 linkData,
00298 convTracks,
00299 reco::PFBlockElement::TRACK,
00300 reco::PFBlock::LINKTEST_ALL);
00301 for(std::multimap<double, unsigned int>::iterator track = convTracks.begin();
00302 track != convTracks.end(); ++track) {
00303
00304
00305 if( ! (active[track->second]) ) continue;
00306
00307
00308 const reco::PFBlockElementTrack * trackRef = dynamic_cast<const reco::PFBlockElementTrack*>((&elements[track->second]));
00309
00310
00311 mvaValue=-999;
00312 hasSingleleg=EvaluateSingleLegMVA(blockRef, primaryVertex_, track->second);
00313
00314 if(!hasSingleleg)
00315 {
00316 bool included=false;
00317
00318 for(unsigned int i=0; i<IsoTracks.size(); i++)
00319 {if(IsoTracks[i]==track->second)included=true;}
00320 if(!included)IsoTracks.push_back(track->second);
00321 }
00322
00323 if(hasSingleleg &&!(trackRef->trackType(reco::PFBlockElement::T_FROM_GAMMACONV)))
00324 {
00325 elemsToLock.push_back(track->second);
00326
00327 std::multimap<double, unsigned int> moreClusters;
00328 blockRef->associatedElements( track->second,
00329 linkData,
00330 moreClusters,
00331 reco::PFBlockElement::ECAL,
00332 reco::PFBlock::LINKTEST_ALL);
00333
00334 float p_in=sqrt(elements[track->second].trackRef()->innerMomentum().x() * elements[track->second].trackRef()->innerMomentum().x() +
00335 elements[track->second].trackRef()->innerMomentum().y()*elements[track->second].trackRef()->innerMomentum().y()+
00336 elements[track->second].trackRef()->innerMomentum().z()*elements[track->second].trackRef()->innerMomentum().z());
00337 float linked_E=0;
00338 for(std::multimap<double, unsigned int>::iterator clust = moreClusters.begin();
00339 clust != moreClusters.end(); ++clust)
00340 {
00341 if(!active[clust->second])continue;
00342
00343 linked_E=linked_E+elements[clust->second].clusterRef()->energy();
00344
00345 if(linked_E/p_in>1.5)break;
00346 bool included=false;
00347
00348 for(std::multimap<double, unsigned int>::iterator cluscheck = ecalAssoPFClusters.begin();
00349 cluscheck != ecalAssoPFClusters.end(); ++cluscheck)
00350 {
00351 if(cluscheck->second==clust->second)included=true;
00352 }
00353 if(!included)AddClusters.push_back(clust->second);
00354 }
00355 }
00356
00357
00358
00359 if( ! (trackRef->trackType(reco::PFBlockElement::T_FROM_GAMMACONV) ) ) continue;
00360 hasConvTrack=true;
00361 elemsToLock.push_back(track->second);
00362
00363 std::multimap<double, unsigned int> moreClusters;
00364 blockRef->associatedElements( track->second,
00365 linkData,
00366 moreClusters,
00367 reco::PFBlockElement::ECAL,
00368 reco::PFBlock::LINKTEST_ALL);
00369
00370 float p_in=sqrt(elements[track->second].trackRef()->innerMomentum().x() * elements[track->second].trackRef()->innerMomentum().x() +
00371 elements[track->second].trackRef()->innerMomentum().y()*elements[track->second].trackRef()->innerMomentum().y()+
00372 elements[track->second].trackRef()->innerMomentum().z()*elements[track->second].trackRef()->innerMomentum().z());
00373 float linked_E=0;
00374 for(std::multimap<double, unsigned int>::iterator clust = moreClusters.begin();
00375 clust != moreClusters.end(); ++clust)
00376 {
00377 if(!active[clust->second])continue;
00378 linked_E=linked_E+elements[clust->second].clusterRef()->energy();
00379 if(linked_E/p_in>1.5)break;
00380 bool included=false;
00381 for(std::multimap<double, unsigned int>::iterator cluscheck = ecalAssoPFClusters.begin();
00382 cluscheck != ecalAssoPFClusters.end(); ++cluscheck)
00383 {
00384 if(cluscheck->second==clust->second)included=true;
00385 }
00386 if(!included)AddClusters.push_back(clust->second);
00387 }
00388
00389
00390
00391
00392 std::multimap<double, unsigned int> moreTracks;
00393 blockRef->associatedElements( track->second,
00394 linkData,
00395 moreTracks,
00396 reco::PFBlockElement::TRACK,
00397 reco::PFBlock::LINKTEST_ALL);
00398
00399 for(std::multimap<double, unsigned int>::iterator track2 = moreTracks.begin();
00400 track2 != moreTracks.end(); ++track2) {
00401
00402
00403 if( ! (active[track2->second]) ) continue;
00404
00405 if(track->second==track2->second)continue;
00406
00407 const reco::PFBlockElementTrack * track2Ref = dynamic_cast<const reco::PFBlockElementTrack*>((&elements[track2->second]));
00408 if( ! (track2Ref->trackType(reco::PFBlockElement::T_FROM_GAMMACONV) ) ) continue;
00409 elemsToLock.push_back(track2->second);
00410
00411
00412 std::multimap<double, unsigned int> convEcal;
00413 blockRef->associatedElements( track2->second,
00414 linkData,
00415 convEcal,
00416 reco::PFBlockElement::ECAL,
00417 reco::PFBlock::LINKTEST_ALL);
00418 float p_in=sqrt(elements[track->second].trackRef()->innerMomentum().x()*elements[track->second].trackRef()->innerMomentum().x()+
00419 elements[track->second].trackRef()->innerMomentum().y()*elements[track->second].trackRef()->innerMomentum().y()+
00420 elements[track->second].trackRef()->innerMomentum().z()*elements[track->second].trackRef()->innerMomentum().z());
00421
00422
00423 float linked_E=0;
00424 for(std::multimap<double, unsigned int>::iterator itConvEcal = convEcal.begin();
00425 itConvEcal != convEcal.end(); ++itConvEcal) {
00426
00427 if( ! (active[itConvEcal->second]) ) continue;
00428 bool included=false;
00429 for(std::multimap<double, unsigned int>::iterator cluscheck = ecalAssoPFClusters.begin();
00430 cluscheck != ecalAssoPFClusters.end(); ++cluscheck)
00431 {
00432 if(cluscheck->second==itConvEcal->second)included=true;
00433 }
00434 linked_E=linked_E+elements[itConvEcal->second].clusterRef()->energy();
00435 if(linked_E/p_in>1.5)break;
00436 if(!included){AddClusters.push_back(itConvEcal->second);
00437 }
00438
00439
00440
00441
00442
00443 std::multimap<double, unsigned int> hcalElems_conv;
00444 blockRef->associatedElements( itecal->second,linkData,
00445 hcalElems_conv,
00446 reco::PFBlockElement::HCAL,
00447 reco::PFBlock::LINKTEST_ALL );
00448
00449 for(std::multimap<double, unsigned int>::iterator ithcal2 = hcalElems_conv.begin();
00450 ithcal2 != hcalElems_conv.end(); ++ithcal2) {
00451
00452 if ( ! (active[ithcal2->second] ) ) continue;
00453
00454
00455
00456
00457
00458 bool useHcal = true;
00459 if ( !useHcal ) continue;
00460
00461
00462
00463 }
00464
00465 }
00466
00467 }
00468
00469
00470
00471 }
00472
00473
00474
00475 float addedCalibEne=0;
00476 float addedRawEne=0;
00477 std::vector<double>AddedPS1(0);
00478 std::vector<double>AddedPS2(0);
00479 double addedps1=0;
00480 double addedps2=0;
00481 for(unsigned int i=0; i<AddClusters.size(); i++)
00482 {
00483 std::multimap<double, unsigned int> PS1Elems_conv;
00484 std::multimap<double, unsigned int> PS2Elems_conv;
00485 blockRef->associatedElements(AddClusters[i],
00486 linkData,
00487 PS1Elems_conv,
00488 reco::PFBlockElement::PS1,
00489 reco::PFBlock::LINKTEST_ALL );
00490 blockRef->associatedElements( AddClusters[i],
00491 linkData,
00492 PS2Elems_conv,
00493 reco::PFBlockElement::PS2,
00494 reco::PFBlock::LINKTEST_ALL );
00495
00496 for(std::multimap<double, unsigned int>::iterator iteps = PS1Elems_conv.begin();
00497 iteps != PS1Elems_conv.end(); ++iteps)
00498 {
00499 if(!active[iteps->second])continue;
00500 std::multimap<double, unsigned int> PS1Elems_check;
00501 blockRef->associatedElements(iteps->second,
00502 linkData,
00503 PS1Elems_check,
00504 reco::PFBlockElement::ECAL,
00505 reco::PFBlock::LINKTEST_ALL );
00506 if(PS1Elems_check.begin()->second==AddClusters[i])
00507 {
00508
00509 reco::PFClusterRef ps1ClusterRef = elements[iteps->second].clusterRef();
00510 AddedPS1.push_back(ps1ClusterRef->energy());
00511 addedps1=addedps1+ps1ClusterRef->energy();
00512 elemsToLock.push_back(iteps->second);
00513 }
00514 }
00515
00516 for(std::multimap<double, unsigned int>::iterator iteps = PS2Elems_conv.begin();
00517 iteps != PS2Elems_conv.end(); ++iteps) {
00518 if(!active[iteps->second])continue;
00519 std::multimap<double, unsigned int> PS2Elems_check;
00520 blockRef->associatedElements(iteps->second,
00521 linkData,
00522 PS2Elems_check,
00523 reco::PFBlockElement::ECAL,
00524 reco::PFBlock::LINKTEST_ALL );
00525
00526 if(PS2Elems_check.begin()->second==AddClusters[i])
00527 {
00528 reco::PFClusterRef ps2ClusterRef = elements[iteps->second].clusterRef();
00529 AddedPS2.push_back(ps2ClusterRef->energy());
00530 addedps2=addedps2+ps2ClusterRef->energy();
00531 elemsToLock.push_back(iteps->second);
00532 }
00533 }
00534 reco::PFClusterRef AddclusterRef = elements[AddClusters[i]].clusterRef();
00535 addedRawEne = AddclusterRef->energy()+addedRawEne;
00536 addedCalibEne = thePFEnergyCalibration_->energyEm(*AddclusterRef,AddedPS1,AddedPS2,false)+addedCalibEne;
00537 AddedPS2.clear();
00538 AddedPS1.clear();
00539 elemsToLock.push_back(AddClusters[i]);
00540 }
00541 AddClusters.clear();
00542 float EE = thePFEnergyCalibration_->energyEm(*clusterRef,ps1Ene,ps2Ene,false)+addedCalibEne;
00543
00544
00545 photonEnergy_ += EE;
00546 RawEcalEne += clusterRef->energy()+addedRawEne;
00547 photonX_ += EE * clusterRef->position().X();
00548 photonY_ += EE * clusterRef->position().Y();
00549 photonZ_ += EE * clusterRef->position().Z();
00550 ps1TotEne += ps1+addedps1;
00551 ps2TotEne += ps2+addedps2;
00552 }
00553
00554
00555 if( ! (photonEnergy_ > 0.) ) continue;
00556 float sum_track_pt=0;
00557
00558 for(unsigned int i=0; i<IsoTracks.size(); i++)sum_track_pt=sum_track_pt+elements[IsoTracks[i]].trackRef()->pt();
00559
00560
00561
00562 math::XYZVector photonPosition(photonX_,
00563 photonY_,
00564 photonZ_);
00565
00566 math::XYZVector photonDirection=photonPosition.Unit();
00567
00568 math::XYZTLorentzVector photonMomentum(photonEnergy_* photonDirection.X(),
00569 photonEnergy_* photonDirection.Y(),
00570 photonEnergy_* photonDirection.Z(),
00571 photonEnergy_ );
00572
00573 if(sum_track_pt>(2+ 0.001* photonMomentum.pt()))
00574 continue;
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585 reco::PFCandidate photonCand(0,photonMomentum, reco::PFCandidate::gamma);
00586
00587 photonCand.setPs1Energy(ps1TotEne);
00588 photonCand.setPs2Energy(ps2TotEne);
00589 photonCand.setEcalEnergy(RawEcalEne,photonEnergy_);
00590 photonCand.setHcalEnergy(0.,0.);
00591 photonCand.set_mva_nothing_gamma(1.);
00592 photonCand.setSuperClusterRef(sc->superClusterRef());
00593 if(hasConvTrack || hasSingleleg)photonCand.setFlag( reco::PFCandidate::GAMMA_TO_GAMMACONV, true);
00594
00595
00596
00597
00598
00599 isvalid_ = true;
00600
00601
00602
00603 for(std::vector<unsigned int>::const_iterator it = elemsToLock.begin();
00604 it != elemsToLock.end(); ++it)
00605 {
00606 if(active[*it])photonCand.addElementInBlock(blockRef,*it);
00607 active[*it] = false;
00608 }
00609 pfCandidates->push_back(photonCand);
00610
00611 elemsToLock.resize(0);
00612 hasConvTrack=false;
00613 hasSingleleg=false;
00614 }
00615
00616 return;
00617
00618 }
00619
00620 bool PFPhotonAlgo::EvaluateSingleLegMVA(const reco::PFBlockRef& blockref, const reco::Vertex& primaryvtx, unsigned int track_index)
00621 {
00622 bool convtkfound=false;
00623 const reco::PFBlock& block = *blockref;
00624 const edm::OwnVector< reco::PFBlockElement >& elements = block.elements();
00625
00626 PFBlock::LinkData linkData = block.linkData();
00627
00628 chi2=elements[track_index].trackRef()->chi2()/elements[track_index].trackRef()->ndof();
00629 nlost=elements[track_index].trackRef()->trackerExpectedHitsInner().numberOfLostHits();
00630 nlayers=elements[track_index].trackRef()->hitPattern().trackerLayersWithMeasurement();
00631 track_pt=elements[track_index].trackRef()->pt();
00632 STIP=elements[track_index].trackRefPF()->STIP();
00633
00634 float linked_e=0;
00635 float linked_h=0;
00636 std::multimap<double, unsigned int> ecalAssoTrack;
00637 block.associatedElements( track_index,linkData,
00638 ecalAssoTrack,
00639 reco::PFBlockElement::ECAL,
00640 reco::PFBlock::LINKTEST_ALL );
00641 std::multimap<double, unsigned int> hcalAssoTrack;
00642 block.associatedElements( track_index,linkData,
00643 hcalAssoTrack,
00644 reco::PFBlockElement::HCAL,
00645 reco::PFBlock::LINKTEST_ALL );
00646 if(ecalAssoTrack.size() > 0) {
00647 for(std::multimap<double, unsigned int>::iterator itecal = ecalAssoTrack.begin();
00648 itecal != ecalAssoTrack.end(); ++itecal) {
00649 linked_e=linked_e+elements[itecal->second].clusterRef()->energy();
00650 }
00651 }
00652 if(hcalAssoTrack.size() > 0) {
00653 for(std::multimap<double, unsigned int>::iterator ithcal = hcalAssoTrack.begin();
00654 ithcal != hcalAssoTrack.end(); ++ithcal) {
00655 linked_h=linked_h+elements[ithcal->second].clusterRef()->energy();
00656 }
00657 }
00658 EoverPt=linked_e/elements[track_index].trackRef()->pt();
00659 HoverPt=linked_h/elements[track_index].trackRef()->pt();
00660 GlobalVector rvtx(elements[track_index].trackRef()->innerPosition().X()-primaryvtx.x(),
00661 elements[track_index].trackRef()->innerPosition().Y()-primaryvtx.y(),
00662 elements[track_index].trackRef()->innerPosition().Z()-primaryvtx.z());
00663 double vtx_phi=rvtx.phi();
00664
00665 del_phi=fabs(deltaPhi(vtx_phi, elements[track_index].trackRef()->innerMomentum().Phi()));
00666 mvaValue = tmvaReader_->EvaluateMVA("BDT");
00667 if(mvaValue > MVACUT)convtkfound=true;
00668 return convtkfound;
00669 }