35 const boost::shared_ptr<PFEnergyCalibration>& thePFEnergyCalibration,
36 double sumPtTrackIsoForPhoton,
37 double sumPtTrackIsoSlopeForPhoton
43 thePFEnergyCalibration_(thePFEnergyCalibration),
44 sumPtTrackIsoForPhoton_(sumPtTrackIsoForPhoton),
45 sumPtTrackIsoSlopeForPhoton_(sumPtTrackIsoSlopeForPhoton),
46 nlost(0.0), nlayers(0.0),
47 chi2(0.0), STIP(0.0), del_phi(0.0),HoverPt(0.0), EoverPt(0.0), track_pt(0.0),
49 CrysPhi_(0.0), CrysEta_(0.0), VtxZ_(0.0), ClusPhi_(0.0), ClusEta_(0.0),
50 ClusR9_(0.0), Clus5x5ratio_(0.0), PFCrysEtaCrack_(0.0), logPFClusE_(0.0), e3x3_(0.0),
51 CrysIPhi_(0), CrysIEta_(0),
52 CrysX_(0.0), CrysY_(0.0),
54 eSeed_(0.0), e1x3_(0.0),e3x1_(0.0), e1x5_(0.0), e2x5Top_(0.0), e2x5Bottom_(0.0), e2x5Left_(0.0), e2x5Right_(0.0),
55 etop_(0.0), ebottom_(0.0), eleft_(0.0), eright_(0.0),
57 PFPhoEta_(0.0), PFPhoPhi_(0.0), PFPhoR9_(0.0), PFPhoR9Corr_(0.0), SCPhiWidth_(0.0), SCEtaWidth_(0.0),
58 PFPhoEt_(0.0), RConv_(0.0), PFPhoEtCorr_(0.0), PFPhoE_(0.0), PFPhoECorr_(0.0), MustE_(0.0), E3x3_(0.0),
59 dEta_(0.0), dPhi_(0.0), LowClusE_(0.0), RMSAll_(0.0), RMSMust_(0.0), nPFClus_(0.0),
60 TotPS1_(0.0), TotPS2_(0.0),
62 x0inner_(0.0), x0middle_(0.0), x0outer_(0.0),
63 excluded_(0.0), Mustache_EtRatio_(0.0), Mustache_Et_out_(0.0)
79 TFile *XO_File =
new TFile(X0_Map.c_str(),
"READ");
80 X0_sum=(TH2D*)XO_File->Get(
"TrackerSum");
81 X0_inner = (TH2D*)XO_File->Get(
"Inner");
82 X0_middle = (TH2D*)XO_File->Get(
"Middle");
83 X0_outer = (TH2D*)XO_File->Get(
"Outer");
88 std::vector<bool>& active,
90 std::vector<reco::PFCandidatePhotonExtra>& pfPhotonExtraCandidates,
91 std::vector<reco::PFCandidate>
92 &tempElectronCandidates
111 std::vector<bool>::const_iterator actIter = active.begin();
113 bool isActive =
true;
116 if(elements.
size() != active.size()) {
124 std::vector<unsigned int> elemsToLock;
125 elemsToLock.resize(0);
127 for( ; ele != elements.
end(); ++ele, ++actIter ) {
133 float photonEnergy_ = 0.;
137 float RawEcalEne = 0.;
140 float ps1TotEne = 0.;
141 float ps2TotEne = 0.;
143 bool hasConvTrack=
false;
144 bool hasSingleleg=
false;
145 std::vector<unsigned int> AddClusters(0);
147 std::multimap<unsigned int, unsigned int>ClusterAddPS1;
148 std::multimap<unsigned int, unsigned int>ClusterAddPS2;
149 std::vector<reco::TrackRef>singleLegRef;
150 std::vector<float>MVA_values(0);
151 std::vector<float>MVALCorr;
152 std::vector<CaloCluster>PFClusters;
154 isActive = *(actIter);
167 elemsToLock.push_back(ele-elements.
begin());
169 std::multimap<double, unsigned int> ecalAssoPFClusters;
170 blockRef->associatedElements( ele-elements.
begin(),
179 if( ! ecalAssoPFClusters.size() ) {
187 for(std::multimap<double, unsigned int>::iterator itecal = ecalAssoPFClusters.begin();
188 itecal != ecalAssoPFClusters.end(); ++itecal) {
199 vector<double> ps1Ene(0);
200 vector<double> ps2Ene(0);
215 if( !( active[itecal->second] ) ) {
227 bool isClosest=
false;
228 std::multimap<double, unsigned int> Trackscheck;
229 blockRef->associatedElements( itecal->second,
234 for(std::multimap<double, unsigned int>::iterator track = Trackscheck.begin();
235 track != Trackscheck.end(); ++track) {
238 if( ! (active[track->second]) )
continue;
241 std::multimap<double, unsigned int> closecheck;
242 blockRef->associatedElements(track->second,
245 reco::PFBlockElement::ECAL,
247 if(closecheck.begin()->second ==itecal->second)isClosest=
true;
248 if(!hasSingleleg)mva_reject++;
251 if(mva_reject>0 && isClosest)useIt=
false;
253 if( !useIt )
continue;
258 elemsToLock.push_back(itecal->second);
261 std::multimap<double, unsigned int> PS1Elems;
262 std::multimap<double, unsigned int> PS2Elems;
264 blockRef->associatedElements( itecal->second,
270 blockRef->associatedElements( itecal->second,
277 for(std::multimap<double, unsigned int>::iterator iteps = PS1Elems.begin();
278 iteps != PS1Elems.end(); ++iteps) {
281 if( !(active[iteps->second]) )
continue;
284 std::multimap<double, unsigned int> ECALPS1check;
285 blockRef->associatedElements( iteps->second,
288 reco::PFBlockElement::ECAL,
290 if(itecal->second==ECALPS1check.begin()->second)
293 ps1Ene.
push_back( ps1ClusterRef->energy() );
294 ps1=ps1+ps1ClusterRef->energy();
296 elemsToLock.push_back(iteps->second);
299 for(std::multimap<double, unsigned int>::iterator iteps = PS2Elems.begin();
300 iteps != PS2Elems.end(); ++iteps) {
303 if( !(active[iteps->second]) )
continue;
306 std::multimap<double, unsigned int> ECALPS2check;
307 blockRef->associatedElements( iteps->second,
310 reco::PFBlockElement::ECAL,
312 if(itecal->second==ECALPS2check.begin()->second)
315 ps2Ene.
push_back( ps2ClusterRef->energy() );
316 ps2=ps2ClusterRef->energy()+ps2;
318 elemsToLock.push_back(iteps->second);
323 std::multimap<double, unsigned int> hcalElems;
324 blockRef->associatedElements( itecal->second,linkData,
329 for(std::multimap<double, unsigned int>::iterator ithcal = hcalElems.begin();
330 ithcal != hcalElems.end(); ++ithcal) {
332 if ( ! (active[ithcal->second] ) )
continue;
338 bool useHcal =
false;
339 if ( !useHcal )
continue;
347 std::multimap<double, unsigned int>
convTracks;
348 blockRef->associatedElements( itecal->second,
353 for(std::multimap<double, unsigned int>::iterator track = convTracks.begin();
354 track != convTracks.end(); ++track) {
357 if( ! (active[track->second]) )
continue;
376 for(
unsigned int i=0;
i<IsoTracks.size();
i++)
377 {
if(IsoTracks[
i]==track->second)included=
true;}
378 if(!included)IsoTracks.push_back(track->second);
383 elemsToLock.push_back(track->second);
387 for(
unsigned int ic=0; ic<singleLegRef.size(); ic++)
388 if(singleLegRef[ic]==t_ref)matched=
true;
395 std::multimap<double, unsigned int> moreClusters;
396 blockRef->associatedElements( track->second,
399 reco::PFBlockElement::ECAL,
402 float p_in=
sqrt(elements[track->second].trackRef()->innerMomentum().x() * elements[track->second].trackRef()->innerMomentum().x() +
403 elements[track->second].trackRef()->innerMomentum().y()*elements[track->second].trackRef()->innerMomentum().y()+
404 elements[track->second].trackRef()->innerMomentum().z()*elements[track->second].trackRef()->innerMomentum().z());
406 for(std::multimap<double, unsigned int>::iterator clust = moreClusters.begin();
407 clust != moreClusters.end(); ++clust)
409 if(!active[clust->second])
continue;
411 linked_E=linked_E+elements[clust->second].clusterRef()->energy();
413 if(linked_E/p_in>1.5)
break;
416 for(std::multimap<double, unsigned int>::iterator cluscheck = ecalAssoPFClusters.begin();
417 cluscheck != ecalAssoPFClusters.end(); ++cluscheck)
419 if(cluscheck->second==clust->second)included=
true;
421 if(!included)AddClusters.
push_back(clust->second);
429 elemsToLock.push_back(track->second);
435 std::multimap<double, unsigned int> moreClusters;
436 blockRef->associatedElements( track->second,
439 reco::PFBlockElement::ECAL,
442 float p_in=
sqrt(elements[track->second].trackRef()->innerMomentum().x() * elements[track->second].trackRef()->innerMomentum().x() +
443 elements[track->second].trackRef()->innerMomentum().y()*elements[track->second].trackRef()->innerMomentum().y()+
444 elements[track->second].trackRef()->innerMomentum().z()*elements[track->second].trackRef()->innerMomentum().z());
446 for(std::multimap<double, unsigned int>::iterator clust = moreClusters.begin();
447 clust != moreClusters.end(); ++clust)
449 if(!active[clust->second])
continue;
450 linked_E=linked_E+elements[clust->second].clusterRef()->energy();
451 if(linked_E/p_in>1.5)
break;
453 for(std::multimap<double, unsigned int>::iterator cluscheck = ecalAssoPFClusters.begin();
454 cluscheck != ecalAssoPFClusters.end(); ++cluscheck)
456 if(cluscheck->second==clust->second)included=
true;
458 if(!included)AddClusters.
push_back(clust->second);
464 std::multimap<double, unsigned int> moreTracks;
465 blockRef->associatedElements( track->second,
471 for(std::multimap<double, unsigned int>::iterator track2 = moreTracks.begin();
472 track2 != moreTracks.end(); ++track2) {
475 if( ! (active[track2->second]) )
continue;
477 if(track->second==track2->second)
continue;
481 elemsToLock.push_back(track2->second);
484 std::multimap<double, unsigned int> convEcal;
485 blockRef->associatedElements( track2->second,
488 reco::PFBlockElement::ECAL,
490 float p_in=
sqrt(elements[track->second].trackRef()->innerMomentum().x()*elements[track->second].trackRef()->innerMomentum().x()+
491 elements[track->second].trackRef()->innerMomentum().y()*elements[track->second].trackRef()->innerMomentum().y()+
492 elements[track->second].trackRef()->innerMomentum().z()*elements[track->second].trackRef()->innerMomentum().z());
496 for(std::multimap<double, unsigned int>::iterator itConvEcal = convEcal.begin();
497 itConvEcal != convEcal.end(); ++itConvEcal) {
499 if( ! (active[itConvEcal->second]) )
continue;
501 for(std::multimap<double, unsigned int>::iterator cluscheck = ecalAssoPFClusters.begin();
502 cluscheck != ecalAssoPFClusters.end(); ++cluscheck)
504 if(cluscheck->second==itConvEcal->second)included=
true;
506 linked_E=linked_E+elements[itConvEcal->second].clusterRef()->energy();
507 if(linked_E/p_in>1.5)
break;
508 if(!included){AddClusters.
push_back(itConvEcal->second);
515 std::multimap<double, unsigned int> hcalElems_conv;
516 blockRef->associatedElements( itecal->second,linkData,
521 for(std::multimap<double, unsigned int>::iterator ithcal2 = hcalElems_conv.begin();
522 ithcal2 != hcalElems_conv.end(); ++ithcal2) {
524 if ( ! (active[ithcal2->second] ) )
continue;
531 if ( !useHcal )
continue;
547 float addedCalibEne=0;
549 std::vector<double>AddedPS1(0);
550 std::vector<double>AddedPS2(0);
553 for(
unsigned int i=0;
i<AddClusters.size();
i++)
555 std::multimap<double, unsigned int> PS1Elems_conv;
556 std::multimap<double, unsigned int> PS2Elems_conv;
557 blockRef->associatedElements(AddClusters[
i],
562 blockRef->associatedElements( AddClusters[i],
568 for(std::multimap<double, unsigned int>::iterator iteps = PS1Elems_conv.begin();
569 iteps != PS1Elems_conv.end(); ++iteps)
571 if(!active[iteps->second])
continue;
572 std::multimap<double, unsigned int> PS1Elems_check;
573 blockRef->associatedElements(iteps->second,
576 reco::PFBlockElement::ECAL,
578 if(PS1Elems_check.begin()->second==AddClusters[
i])
582 AddedPS1.
push_back(ps1ClusterRef->energy());
583 addedps1=addedps1+ps1ClusterRef->energy();
584 elemsToLock.push_back(iteps->second);
588 for(std::multimap<double, unsigned int>::iterator iteps = PS2Elems_conv.begin();
589 iteps != PS2Elems_conv.end(); ++iteps) {
590 if(!active[iteps->second])
continue;
591 std::multimap<double, unsigned int> PS2Elems_check;
592 blockRef->associatedElements(iteps->second,
595 reco::PFBlockElement::ECAL,
598 if(PS2Elems_check.begin()->second==AddClusters[
i])
601 AddedPS2.
push_back(ps2ClusterRef->energy());
602 addedps2=addedps2+ps2ClusterRef->energy();
603 elemsToLock.push_back(iteps->second);
607 addedRawEne = AddclusterRef->energy()+addedRawEne;
611 elemsToLock.push_back(AddClusters[i]);
615 PFClusters.push_back(*clusterRef);
618 EE=LocCorr*clusterRef->energy()+addedCalibEne;
622 MVALCorr.push_back(LocCorr*clusterRef->energy());
628 RawEcalEne += clusterRef->energy()+addedRawEne;
629 photonX_ += EE * clusterRef->position().X();
630 photonY_ += EE * clusterRef->position().Y();
631 photonZ_ += EE * clusterRef->position().Z();
632 ps1TotEne += ps1+addedps1;
633 ps2TotEne += ps2+addedps2;
637 float Elec_rawEcal=0;
643 std::vector<double>AddedPS1(0);
644 std::vector<double>AddedPS2(0);
647 tempElectronCandidates,
655 for(std::vector<unsigned int>::const_iterator it =
665 unsigned int index=*it;
667 elements[
index].clusterRef();
669 Elec_rawEcal=Elec_rawEcal+
670 elements[
index].clusterRef()->energy();
671 std::multimap<double, unsigned int> PS1Elems;
672 std::multimap<double, unsigned int> PS2Elems;
674 blockRef->associatedElements(index,
678 blockRef->associatedElements( index,
685 for(std::multimap<double, unsigned int>::iterator iteps =
687 iteps != PS1Elems.end(); ++iteps)
689 std::multimap<double, unsigned int> Clustcheck; blockRef->associatedElements( iteps->second, linkData,
691 reco::PFBlockElement::ECAL,
693 if(Clustcheck.begin()->second==
index)
695 AddedPS1.push_back(elements[iteps->second].clusterRef()->energy());
696 Elec_totPs1=Elec_totPs1+elements[iteps->second].clusterRef()->energy();
700 for(std::multimap<double, unsigned int>::iterator iteps =
702 iteps != PS2Elems.end(); ++iteps)
704 std::multimap<double, unsigned int> Clustcheck; blockRef->associatedElements( iteps->second, linkData,
706 reco::PFBlockElement::ECAL,
708 if(Clustcheck.begin()->second==
index)
710 AddedPS2.push_back(elements[iteps->second].clusterRef()->energy());
711 Elec_totPs2=Elec_totPs2+elements[iteps->second].clusterRef()->energy();
717 energyEm(*clusterRef,AddedPS1,AddedPS2,
false);
718 PFClusters.push_back(*clusterRef);
721 EE=LocCorr*clusterRef->energy();
722 MVALCorr.push_back(LocCorr*clusterRef->energy());
727 MVALCorr.push_back(LocCorr*clusterRef->energy());
731 ElectronX += EE * clusterRef->position().X();
732 ElectronY += EE * clusterRef->position().Y();
733 ElectronZ += EE * clusterRef->position().Z();
747 photonEnergy_ += Elec_energy;
748 RawEcalEne += Elec_rawEcal;
749 photonX_ += ElectronX;
750 photonY_ += ElectronY;
751 photonZ_ += ElectronZ;
752 ps1TotEne += Elec_totPs1;
753 ps2TotEne += Elec_totPs2;
756 if( ! (photonEnergy_ > 0.) )
continue;
757 float sum_track_pt=0;
759 for(
unsigned int i=0;
i<IsoTracks.size();
i++)sum_track_pt=sum_track_pt+elements[IsoTracks[
i]].trackRef()->pt();
774 photonEnergy_* photonDirection.Y(),
775 photonEnergy_* photonDirection.Z(),
780 elemsToLock.resize(0);
810 for ( std::vector<reco::PFCandidate>::const_iterator ec=tempElectronCandidates.begin(); ec != tempElectronCandidates.end(); ++ec ){
811 for(
int i=0;
i<matches;
i++)
821 for(std::vector<unsigned int>::const_iterator it =
826 for(std::vector<unsigned int>::const_iterator it = elemsToLock.begin();
827 it != elemsToLock.end(); ++it)
834 if(elements[*it].convRef().isNonnull())
838 for(
unsigned int ic = 0; ic < ConversionsRef_.
size(); ic++)
840 if(ConversionsRef_[ic]==elements[*it].convRef())matched=
true;
842 if(!matched)ConversionsRef_.
push_back(elements[*it].convRef());
852 for(
unsigned int l=0;
l<MVALCorr.size(); ++
l)
865 GCorr * photonEnergy_ );
866 photonCand.
setP4(photonCorrMomentum);
869 std::multimap<float, unsigned int>OrderedClust;
870 for(
unsigned int i=0;
i<PFClusters.size(); ++
i){
872 OrderedClust.insert(make_pair(et,
i));
874 std::multimap<float, unsigned int>::reverse_iterator rit;
875 rit=OrderedClust.rbegin();
876 unsigned int highEindex=(*rit).second;
885 myExtra.setMustache_Et(MustacheEt);
886 myExtra.setExcludedClust(excluded);
887 if(fabs(photonCand.
eta()<1.4446))
890 myExtra.setMVAGlobalCorrE(GCorr * PFPhoECorr_);
891 else myExtra.setMVAGlobalCorrE(GCorr * photonEnergy_);
893 myExtra.SetPFPhotonRes(Res);
897 for(
unsigned int ic = 0; ic < MVA_values.size(); ic++)
899 myExtra.addSingleLegConvMva(MVA_values[ic]);
900 myExtra.addSingleLegConvTrackRef(singleLegRef[ic]);
903 for(
unsigned int ic = 0; ic < ConversionsRef_.
size(); ic++)
905 myExtra.addConversionRef(ConversionsRef_[ic]);
908 pfPhotonExtraCandidates.push_back(myExtra);
909 pfCandidates->push_back(photonCand);
911 elemsToLock.resize(0);
920 std::vector<reco::CaloCluster> PFClusters = _PFClusters;
934 std::vector<unsigned int>insideMust;
935 std::vector<unsigned int>outsideMust;
936 std::multimap<float, unsigned int>OrderedClust;
942 for(
unsigned int i=0;
i<insideMust.size(); ++
i){
944 OrderedClust.insert(make_pair(PFClusters[index].
energy(),index));
946 std::multimap<float, unsigned int>::iterator it;
947 it=OrderedClust.begin();
948 unsigned int lowEindex=(*it).second;
949 std::multimap<float, unsigned int>::reverse_iterator rit;
950 rit=OrderedClust.rbegin();
951 unsigned int highEindex=(*rit).second;
952 if(insideMust.size()>1){
953 dEta_=fabs(PFClusters[highEindex].
eta()-PFClusters[lowEindex].
eta());
954 dPhi_=asin(PFClusters[highEindex].
phi()-PFClusters[lowEindex].
phi());
963 std::vector<reco::CaloCluster>PFMustClusters;
964 if(insideMust.size()>2){
965 for(
unsigned int i=0;
i<insideMust.size(); ++
i){
966 unsigned int index=insideMust[
i];
967 if(index==lowEindex)
continue;
968 PFMustClusters.push_back(PFClusters[index]);
972 for(
unsigned int i=0;
i<insideMust.size(); ++
i){
973 unsigned int index=insideMust[
i];
974 PFMustClusters.push_back(PFClusters[index]);
981 for(
unsigned i=0;
i<eleInBlocks.size();
i++)
984 unsigned indexInBlock = eleInBlocks[
i].second;
1025 std::vector<CaloCluster> PFClusters = _PFClusters;
1039 std::vector<unsigned int>insideMust;
1040 std::vector<unsigned int>outsideMust;
1041 std::multimap<float, unsigned int>OrderedClust;
1047 for(
unsigned int i=0;
i<insideMust.size(); ++
i){
1049 OrderedClust.insert(make_pair(PFClusters[index].
energy(),index));
1051 std::multimap<float, unsigned int>::iterator it;
1052 it=OrderedClust.begin();
1053 unsigned int lowEindex=(*it).second;
1054 std::multimap<float, unsigned int>::reverse_iterator rit;
1055 rit=OrderedClust.rbegin();
1056 unsigned int highEindex=(*rit).second;
1057 if(insideMust.size()>1){
1058 dEta_=fabs(PFClusters[highEindex].
eta()-PFClusters[lowEindex].
eta());
1059 dPhi_=asin(PFClusters[highEindex].
phi()-PFClusters[lowEindex].
phi());
1068 std::vector<reco::CaloCluster>PFMustClusters;
1069 if(insideMust.size()>2){
1070 for(
unsigned int i=0;
i<insideMust.size(); ++
i){
1071 unsigned int index=insideMust[
i];
1072 if(index==lowEindex)
continue;
1073 PFMustClusters.push_back(PFClusters[index]);
1077 for(
unsigned int i=0;
i<insideMust.size(); ++
i){
1078 unsigned int index=insideMust[
i];
1079 PFMustClusters.push_back(PFClusters[index]);
1086 for(
unsigned i=0;
i<eleInBlocks.size();
i++)
1089 unsigned indexInBlock = eleInBlocks[
i].second;
1174 double PFClustPhiRMS=0;
1178 for(
unsigned int c=0;
c<PFClusters.size(); ++
c){
1179 delPhi2=(acos(
cos(PFPhoPhi-PFClusters[
c].
phi()))* acos(
cos(PFPhoPhi-PFClusters[
c].
phi())) )+delPhi2;
1180 delPhiSum=delPhiSum+ acos(
cos(PFPhoPhi-PFClusters[
c].
phi()))*PFClusters[
c].energy();
1181 ClusSum=ClusSum+PFClusters[
c].energy();
1183 double meandPhi=delPhiSum/ClusSum;
1184 PFClustPhiRMS=
sqrt(fabs(delPhi2/ClusSum - (meandPhi*meandPhi)));
1186 return PFClustPhiRMS;
1192 std::pair<double, double>ClusCoor=ClusterVar.
GetCrysCoor();
1193 std::pair<int, int>ClusIndex=ClusterVar.
GetCrysIndex();
1241 if(rightstrip>leftstrip)
e2x5Max_=rightstrip+centerstrip;
1242 else e2x5Max_=leftstrip+centerstrip;
1247 ClusPhi_=clusterRef->position().phi();
1248 ClusEta_=fabs(clusterRef->position().eta());
1249 EB=fabs(clusterRef->position().eta())/clusterRef->position().eta();
1279 LC_Var[22]=CrysIphiMod2;
1280 LC_Var[23]=CrysIetaMod5;
1281 LC_Var[24]=CrysIphiMod20;
1320 bool convtkfound=
false;
1326 chi2=elements[track_index].trackRef()->chi2()/elements[track_index].trackRef()->ndof();
1327 nlost=elements[track_index].trackRef()->trackerExpectedHitsInner().numberOfLostHits();
1328 nlayers=elements[track_index].trackRef()->hitPattern().trackerLayersWithMeasurement();
1329 track_pt=elements[track_index].trackRef()->pt();
1330 STIP=elements[track_index].trackRefPF()->STIP();
1334 std::multimap<double, unsigned int> ecalAssoTrack;
1339 std::multimap<double, unsigned int> hcalAssoTrack;
1344 if(ecalAssoTrack.size() > 0) {
1345 for(std::multimap<double, unsigned int>::iterator itecal = ecalAssoTrack.begin();
1346 itecal != ecalAssoTrack.end(); ++itecal) {
1347 linked_e=linked_e+elements[itecal->second].clusterRef()->energy();
1350 if(hcalAssoTrack.size() > 0) {
1351 for(std::multimap<double, unsigned int>::iterator ithcal = hcalAssoTrack.begin();
1352 ithcal != hcalAssoTrack.end(); ++ithcal) {
1353 linked_h=linked_h+elements[ithcal->second].clusterRef()->energy();
1356 EoverPt=linked_e/elements[track_index].trackRef()->pt();
1357 HoverPt=linked_h/elements[track_index].trackRef()->pt();
1358 GlobalVector rvtx(elements[track_index].trackRef()->innerPosition().
X()-primaryvtx.
x(),
1359 elements[track_index].trackRef()->innerPosition().Y()-primaryvtx.
y(),
1360 elements[track_index].trackRef()->innerPosition().Z()-primaryvtx.
z());
1361 double vtx_phi=rvtx.
phi();
1363 del_phi=fabs(
deltaPhi(vtx_phi, elements[track_index].trackRef()->innerMomentum().
Phi()));
1373 std::vector<reco::PFCandidate>&
1374 tempElectronCandidates,
1380 for ( std::vector<reco::PFCandidate>::const_iterator ec=tempElectronCandidates.begin(); ec != tempElectronCandidates.end(); ++ec )
1383 int mh=ec->gsfTrackRef()->trackerExpectedHitsInner().numberOfLostHits();
1392 if(seedRef.
isAvailable() && seedRef->isEcalDriven())
1399 if(PhotscRef==ElecscRef)
1406 for(
unsigned i=0;
i<eleInBlocks.size();
i++)
1409 unsigned indexInBlock = eleInBlocks[
i].second;
double GetResponse(const float *vector) const
virtual double energy() const GCC11_FINAL
energy
void setPs2Energy(float e2)
set corrected PS2 energy
Abstract base class for a PFBlock element (track, cluster...)
PhotonRef photonRef() const
void setPs1Energy(float e1)
set corrected PS1 energy
void MustacheClust(const std::vector< CaloCluster > &clusters, std::vector< unsigned int > &insideMust, std::vector< unsigned int > &outsideMust)
const GBRForest * ReaderLCEE_
void setFlag(Flags theFlag, bool value)
set a given flag
void set_mva_nothing_gamma(float mva)
set mva for gamma detection
void setPositionAtECALEntrance(const math::XYZPointF &pos)
set position at ECAL entrance
double y() const
y coordinate
Sin< T >::type sin(const T &t)
std::map< unsigned int, Link > LinkData
Geom::Phi< T > phi() const
Geom::Theta< T > theta() const
verbosityLevel verbosityLevel_
const edm::OwnVector< reco::PFBlockElement > & elements() const
const GBRForest * ReaderRes_
const LinkData & linkData() const
virtual void setVertex(const math::XYZPoint &p)
set vertex
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
std::vector< unsigned int > AddFromElectron_
const GBRForest * ReaderGCEEhR9_
double E5x5Element(int i, int j)
std::pair< double, double > GetCrysCoor()
double ClustersPhiRMS(const std::vector< reco::CaloCluster > &PFClusters, float PFPhoPhi)
std::vector< ElementInBlock > ElementsInBlocks
static int position[TOTALCHAMBERS][3]
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
void RunPFPhoton(const reco::PFBlockRef &blockRef, std::vector< bool > &active, std::auto_ptr< reco::PFCandidateCollection > &pfPhotonCandidates, std::vector< reco::PFCandidatePhotonExtra > &pfPhotonExtraCandidates, std::vector< reco::PFCandidate > &tempElectronCandidates)
void addLCorrClusEnergy(float LCorrE)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
bool isNonnull() const
Checks for non-null.
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
std::pair< double, double > GetCrysIndex()
TMVA::Reader * tmvaReader_
void addElementInBlock(const reco::PFBlockRef &blockref, unsigned elementIndex)
add an element to the current PFCandidate
float EvaluateResMVA(const reco::PFCandidate &, const std::vector< reco::CaloCluster > &PFClusters)
virtual reco::TrackRef trackRef() const
Cos< T >::type cos(const T &t)
double z() const
y coordinate
float EvaluateGCorrMVA(const reco::PFCandidate &, const std::vector< reco::CaloCluster > &PFClusters)
SuperClusterRef superClusterRef() const
float EvaluateLCorrMVA(reco::PFClusterRef clusterRef)
const GBRForest * ReaderLCEB_
const reco::Vertex * primaryVertex_
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
double sumPtTrackIsoSlopeForPhoton_
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
PFPhotonAlgo(std::string mvaweightfile, double mvaConvCut, bool useReg, std::string X0_Map, const reco::Vertex &primary, const boost::shared_ptr< PFEnergyCalibration > &thePFEnergyCalibration, double sumPtTrackIsoForPhoton, double sumPtTrackIsoSlopeForPhoton)
void setEcalEnergy(float eeRaw, float eeCorr)
set corrected Ecal energy
boost::shared_ptr< PFEnergyCalibration > thePFEnergyCalibration_
const GBRForest * ReaderGCEB_
void EarlyConversion(std::vector< reco::PFCandidate > &tempElectronCandidates, const reco::PFBlockElementSuperCluster *sc)
double x() const
x coordinate
virtual bool trackType(TrackType trType) const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
void associatedElements(unsigned i, const LinkData &linkData, std::multimap< double, unsigned > &sortedAssociates, reco::PFBlockElement::Type type=PFBlockElement::NONE, LinkTest test=LINKTEST_RECHIT) const
XYZPointD XYZPoint
point in space with cartesian internal representation
bool EvaluateSingleLegMVA(const reco::PFBlockRef &blockref, const reco::Vertex &primaryvtx, unsigned int track_index)
Particle reconstructed by the particle flow algorithm.
virtual void setP4(const LorentzVector &p4) GCC11_FINAL
set 4-momentum
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
size_type size() const
Size of the RefVector.
void setSuperClusterRef(const reco::SuperClusterRef &scRef)
const GBRForest * ReaderGCEElR9_
double sumPtTrackIsoForPhoton_
void FillMustacheVar(const std::vector< CaloCluster > &clusters)
volatile std::atomic< bool > shutdown_flag false
std::vector< int > match_ind
const ElementsInBlocks & elementsInBlocks() const
void setHcalEnergy(float ehRaw, float ehCorr)
set corrected Hcal energy
reco::SuperClusterRef superClusterRef() const
return a reference to the corresponding SuperCluster if any