7 |
|
|
8 |
|
using namespace std; |
9 |
|
|
10 |
+ |
class TRootSuperCluster; |
11 |
+ |
|
12 |
|
class TRootElectron : public TRootParticle |
13 |
|
{ |
14 |
|
|
45 |
|
,superClusterRawEnergy_(-9999.) |
46 |
|
,preshowerEnergy_(-9999.) |
47 |
|
,caloPosition_(-9999.,-9999.,-9999.) |
48 |
+ |
,scIndex_() |
49 |
|
,scRef_() |
50 |
|
,clusterAlgo_(-9999) |
51 |
|
,caloConeSize_(-9999.) |
72 |
|
,idCutBasedCategorizedTight_(-1) |
73 |
|
,idLikelihood_(-9999.) |
74 |
|
,idNeuralNet_(-9999.) |
75 |
+ |
,isAlsoPhoton_(false) |
76 |
|
{;} |
77 |
|
|
78 |
|
TRootElectron(const TRootElectron& electron) : |
106 |
|
,superClusterRawEnergy_(electron.superClusterRawEnergy_) |
107 |
|
,preshowerEnergy_(electron.preshowerEnergy_) |
108 |
|
,caloPosition_(electron.caloPosition_) |
109 |
+ |
,scIndex_(electron.scIndex_) |
110 |
|
,scRef_(electron.scRef_) |
111 |
|
,clusterAlgo_(electron.clusterAlgo_) |
112 |
|
,caloConeSize_(electron.caloConeSize_) |
133 |
|
,idCutBasedCategorizedTight_(electron.idCutBasedCategorizedTight_) |
134 |
|
,idLikelihood_(electron.idLikelihood_) |
135 |
|
,idNeuralNet_(electron.idNeuralNet_) |
136 |
+ |
,isAlsoPhoton_(electron.isAlsoPhoton_) |
137 |
|
{;} |
138 |
|
|
139 |
|
TRootElectron(Double_t px, Double_t py, Double_t pz, Double_t e) : |
167 |
|
,superClusterRawEnergy_(-9999.) |
168 |
|
,preshowerEnergy_(-9999.) |
169 |
|
,caloPosition_(-9999.,-9999.,-9999.) |
170 |
+ |
,scIndex_() |
171 |
|
,scRef_() |
172 |
|
,clusterAlgo_(-9999) |
173 |
|
,caloConeSize_(-9999.) |
194 |
|
,idCutBasedCategorizedTight_(-1) |
195 |
|
,idLikelihood_(-9999.) |
196 |
|
,idNeuralNet_(-9999.) |
197 |
+ |
,isAlsoPhoton_(false) |
198 |
|
{;} |
199 |
|
|
200 |
|
TRootElectron(Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vtx_x, Double_t vtx_y, Double_t vtx_z) : |
228 |
|
,superClusterRawEnergy_(-9999.) |
229 |
|
,preshowerEnergy_(-9999.) |
230 |
|
,caloPosition_(-9999.,-9999.,-9999.) |
231 |
+ |
,scIndex_() |
232 |
|
,scRef_() |
233 |
|
,clusterAlgo_(-9999) |
234 |
|
,caloConeSize_(-9999.) |
255 |
|
,idCutBasedCategorizedTight_(-1) |
256 |
|
,idLikelihood_(-9999.) |
257 |
|
,idNeuralNet_(-9999.) |
258 |
+ |
,isAlsoPhoton_(false) |
259 |
|
{;} |
260 |
|
|
261 |
|
TRootElectron(Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vtx_x, Double_t vtx_y, Double_t vtx_z, Int_t type, Float_t charge) : |
289 |
|
,superClusterRawEnergy_(-9999.) |
290 |
|
,preshowerEnergy_(-9999.) |
291 |
|
,caloPosition_(-9999.,-9999.,-9999.) |
292 |
+ |
,scIndex_() |
293 |
|
,scRef_() |
294 |
|
,clusterAlgo_(-9999) |
295 |
|
,caloConeSize_(-9999.) |
316 |
|
,idCutBasedCategorizedTight_(-1) |
317 |
|
,idLikelihood_(-9999.) |
318 |
|
,idNeuralNet_(-9999.) |
319 |
+ |
,isAlsoPhoton_(false) |
320 |
|
{;} |
321 |
|
|
322 |
|
TRootElectron(const TLorentzVector &momentum) : |
350 |
|
,superClusterRawEnergy_(-9999.) |
351 |
|
,preshowerEnergy_(-9999.) |
352 |
|
,caloPosition_(-9999.,-9999.,-9999.) |
353 |
+ |
,scIndex_() |
354 |
|
,scRef_() |
355 |
|
,clusterAlgo_(-9999) |
356 |
|
,caloConeSize_(-9999.) |
377 |
|
,idCutBasedCategorizedTight_(-1) |
378 |
|
,idLikelihood_(-9999.) |
379 |
|
,idNeuralNet_(-9999.) |
380 |
+ |
,isAlsoPhoton_(false) |
381 |
|
{;} |
382 |
|
|
383 |
|
TRootElectron(const TLorentzVector &momentum, const TVector3 &vertex, Int_t type, Float_t charge) : |
411 |
|
,superClusterRawEnergy_(-9999.) |
412 |
|
,preshowerEnergy_(-9999.) |
413 |
|
,caloPosition_(-9999.,-9999.,-9999.) |
414 |
+ |
,scIndex_() |
415 |
|
,scRef_() |
416 |
|
,clusterAlgo_(-9999) |
417 |
|
,caloConeSize_(-9999.) |
438 |
|
,idCutBasedCategorizedTight_(-1) |
439 |
|
,idLikelihood_(-9999.) |
440 |
|
,idNeuralNet_(-9999.) |
441 |
+ |
,isAlsoPhoton_(false) |
442 |
|
{;} |
443 |
|
|
444 |
|
~TRootElectron() {;} |
475 |
|
Float_t superClusterRawEnergy() const { return superClusterRawEnergy_ ;} |
476 |
|
Float_t preshowerEnergy() const { return preshowerEnergy_ ;} |
477 |
|
TVector3 caloPosition() const { return caloPosition_ ;} |
478 |
+ |
map<Int_t,Int_t> scIndexMap() const { return scIndex_; } |
479 |
|
map<Int_t,TRef> scRef() const { return scRef_ ;} |
480 |
+ |
Int_t nSuperClusters() const { return scRef_.size();} |
481 |
+ |
|
482 |
+ |
// Get index in TCloneArray of the supercluster associated by default |
483 |
+ |
// Default SC collection for electron producer defined in |
484 |
+ |
// RecoEgamma/EgammaElectronProducers/python/pixelMatchGsfElectrons_cfi |
485 |
+ |
Int_t scIndex() |
486 |
+ |
{ |
487 |
+ |
// 0=island or multi5x5, 1=hybrid |
488 |
+ |
//if ( clusterAlgo_== 0 ) return scIndexOfType(122); |
489 |
+ |
if ( clusterAlgo_== 0 ) return scIndexOfType(322); |
490 |
+ |
else if ( clusterAlgo_== 1 ) return scIndexOfType(211); |
491 |
+ |
else return -1; |
492 |
+ |
} |
493 |
+ |
|
494 |
+ |
// Get ith element in map scIndex_ |
495 |
+ |
Int_t scIndexAt(UInt_t index) |
496 |
+ |
{ |
497 |
+ |
if ( index>=scIndex_.size()) |
498 |
+ |
{ |
499 |
+ |
return -1; |
500 |
+ |
} |
501 |
+ |
else |
502 |
+ |
{ |
503 |
+ |
map<Int_t,Int_t>::iterator it=scIndex_.begin(); |
504 |
+ |
for (UInt_t i=0; i<index; ++i) it++; |
505 |
+ |
return ( (*it).second ); |
506 |
+ |
} |
507 |
+ |
} |
508 |
+ |
|
509 |
+ |
// Get index in TCloneArray of the seed supercluster of type "type" |
510 |
+ |
Int_t scIndexOfType(Int_t type) |
511 |
+ |
{ |
512 |
+ |
map<Int_t,Int_t>::iterator it=scIndex_.find(type); |
513 |
+ |
return ( it ==scIndex_.end() ? -1 : (*it).second ); |
514 |
+ |
} |
515 |
+ |
|
516 |
+ |
// Get supercluster associated by default |
517 |
+ |
// Default SC collection for electron producer defined in |
518 |
+ |
// RecoEgamma/EgammaElectronProducers/python/pixelMatchGsfElectrons_cfi |
519 |
+ |
TRootSuperCluster* superCluster() |
520 |
+ |
{ |
521 |
+ |
// 0=island or multi5x5, 1=hybrid |
522 |
+ |
//if ( clusterAlgo_== 0 ) return superClusterOfType(122); |
523 |
+ |
if ( clusterAlgo_== 0 ) return superClusterOfType(322); |
524 |
+ |
else if ( clusterAlgo_== 1 ) return superClusterOfType(211); |
525 |
+ |
else return 0; |
526 |
+ |
} |
527 |
+ |
|
528 |
+ |
// Get ith element in map scRef_ |
529 |
+ |
TRootSuperCluster* superClusterAt(UInt_t index) |
530 |
+ |
{ |
531 |
+ |
if ( index>=scRef_.size()) |
532 |
+ |
{ |
533 |
+ |
return 0; |
534 |
+ |
} |
535 |
+ |
else |
536 |
+ |
{ |
537 |
+ |
map<Int_t,TRef>::iterator it=scRef_.begin(); |
538 |
+ |
for (UInt_t i=0; i<index; ++i) it++; |
539 |
+ |
return ( (TRootSuperCluster*)(*it).second.GetObject() ); |
540 |
+ |
} |
541 |
+ |
} |
542 |
+ |
|
543 |
+ |
// Get the seed supercluster of type "type" |
544 |
+ |
TRootSuperCluster* superClusterOfType(Int_t type) |
545 |
+ |
{ |
546 |
+ |
map<Int_t,TRef>::iterator it=scRef_.find(type); |
547 |
+ |
return ( it ==scRef_.end() ? 0 : (TRootSuperCluster*) (*it).second.GetObject() ); |
548 |
+ |
} |
549 |
+ |
|
550 |
|
Int_t clusterAlgo() const { return clusterAlgo_ ;} |
551 |
|
Float_t caloConeSize() const { return caloConeSize_ ;} |
552 |
|
Float_t e2x2() const { return e2x2_ ;} |
553 |
|
Float_t e3x3() const { return e3x3_ ;} |
554 |
|
Float_t e5x5() const { return e5x5_ ;} |
555 |
|
Float_t eMax() const { return eMax_ ;} |
556 |
+ |
Float_t r19() const { return ( e3x3_ == 0. ? -1. : eMax_/e3x3_ ); } // ratio of Emax/E(3x3) |
557 |
+ |
// FIXME - Check definition of r9... include preshowerEnergy as in SimplePhotonAnalyzer.cc ? |
558 |
+ |
Float_t r9() const { return ( superClusterRawEnergy_ == 0. ? -1. : e3x3_/superClusterRawEnergy_ ); } // ratio of E(3x3)/ESC |
559 |
|
Float_t isoR01_sumPt() const { return isoR01_sumPt_ ;} |
560 |
|
Int_t isoR01_nTracks() const { return isoR01_nTracks_ ;} |
561 |
|
Float_t isoR02_sumPt() const { return isoR02_sumPt_ ;} |
575 |
|
Int_t idCutBasedCategorizedTight() const { return idCutBasedCategorizedTight_ ;} |
576 |
|
Float_t idLikelihood() const { return idLikelihood_ ;} |
577 |
|
Float_t idNeuralNet() const { return idNeuralNet_ ;} |
578 |
< |
|
578 |
> |
Bool_t isAlsoPhoton() const { return isAlsoPhoton_; } |
579 |
> |
|
580 |
|
/* TODO - isBarrel / isEndcap / isCrack |
581 |
|
if (fabs (eta) <= 1.4442) { |
582 |
|
localElectron.setPosition (1); |
624 |
|
void setPreshowerEnergy(Float_t preshowerEnergy) { preshowerEnergy_ = preshowerEnergy; } |
625 |
|
void setCaloPosition(TVector3 caloPosition) { caloPosition_ = caloPosition; } |
626 |
|
void setCaloPosition(Double_t x, Double_t y, Double_t z) { caloPosition_.SetXYZ(x, y ,z); } |
627 |
< |
void setSCRef(map<Int_t,TRef> scRef) { scRef_ = scRef; } |
627 |
> |
void setSCIndex(Int_t type, Int_t index) { scIndex_[type]=index; } |
628 |
> |
void setSCRef(Int_t type, TObject* superCluster) { scRef_[type]=superCluster; } |
629 |
|
void setClusterAlgo(Int_t clusterAlgo) { clusterAlgo_ = clusterAlgo; } |
630 |
|
void setCaloConeSize(Float_t caloConeSize) { caloConeSize_ = caloConeSize; } |
631 |
|
void setE2x2(Float_t e2x2) { e2x2_ = e2x2; } |
651 |
|
void setIDCutBasedCategorizedTight(Int_t idCutBasedCategorizedTight) { idCutBasedCategorizedTight_ = idCutBasedCategorizedTight; } |
652 |
|
void setIDLikelihood(Float_t idLikelihood) { idLikelihood_ = idLikelihood; } |
653 |
|
void setIDNeuralNet(Float_t idNeuralNet) { idNeuralNet_ = idNeuralNet; } |
654 |
< |
|
655 |
< |
friend std::ostream& operator<< (std::ostream& stream, const TRootElectron& electron) { |
656 |
< |
stream << "TRootElectron - Charge=" << electron.charge() << " (Et,eta,phi)=("<< electron.Et() <<","<< electron.Eta() <<","<< electron.Phi() << ")" |
654 |
> |
void setIsAlsoPhoton(Bool_t isAlsoPhoton) { isAlsoPhoton_ = isAlsoPhoton; } |
655 |
> |
|
656 |
> |
friend std::ostream& operator<< (std::ostream& stream, const TRootElectron& electron) |
657 |
> |
{ |
658 |
> |
stream << "TRootElectron - Charge=" << electron.charge() << " (E,Et,eta,phi)=("<< electron.Energy() <<","<< electron.Et() <<","<< electron.Eta() <<","<< electron.Phi() << ")" |
659 |
|
<< " vertex(x,y,z)=("<< electron.vx() <<","<< electron.vy() <<","<< electron.vz() << ")"; |
660 |
|
return stream; |
661 |
|
}; |
662 |
|
|
663 |
+ |
void Print() |
664 |
+ |
{ |
665 |
+ |
std::cout << "TRootElectron - Charge=" << this->charge() << " (E,Et,eta,phi)=("<< this->Energy() <<","<< this->Et() <<","<< this->Eta() <<","<< this->Phi() << ")" |
666 |
+ |
<< " vertex=("<< this->vx() <<","<< this->vy() <<","<< this->vz() << ")" |
667 |
+ |
<< " caloPosition=(" << this->caloPosition().X() << "," << this->caloPosition().Y() << "," << this->caloPosition().Z() << ")" << endl |
668 |
+ |
<< " trackMomentum=" << this->trackMomentum() << "+-" << this->trackMomentumError() << " nPixels=" << this->pixelLayersWithMeasurement() |
669 |
+ |
<< " nStrips=" << this->stripLayersWithMeasurement() << " d0=" << this->d0() << "+-" << this->d0Error()<< " dsz=" << this->dsz() << "+-" << this->dszError() << endl |
670 |
+ |
<< " algo=" << this->clusterAlgo() << " nBC=" << this->nbClusters() << " caloEnergy=" << this->caloEnergy() << "+-" << this->caloEnergyError() |
671 |
+ |
<< " scRawEnergy=" << this->superClusterRawEnergy() << " preshEnergy=" << this->preshowerEnergy() |
672 |
+ |
<< " E2x2=" << this->e2x2() <<" E3x3=" << this->e3x3() <<" E5x5=" << this->e5x5() <<" Emax=" << this->eMax() |
673 |
+ |
<< " R19=" << this->r19() <<" R9=" << this->r9() << endl |
674 |
+ |
<<" H/E=" << this->hadOverEm() <<" deltaEtaIn=" << this->deltaEtaIn() <<" deltaPhiIn=" << this->deltaPhiIn() <<" deltaEtaOut=" << this->deltaEtaOut() <<" deltaPhiOut=" << this->deltaPhiOut() <<" E/p in=" << this->energySuperClusterOverPin() <<" E/p out=" << this->energySeedClusterOverPout() << endl |
675 |
+ |
<< " iso03 ecal="<< this->isoR03_emEt() << " hcal=" << this->isoR03_hadEt() << " tracker=" << this->isoR03_sumPt() << " ntracks=" << this->isoR03_nTracks() |
676 |
+ |
<< " iso05 ecal="<< this->isoR05_emEt() << " hcal=" << this->isoR05_hadEt() << " tracker=" << this->isoR05_sumPt() << " ntracks=" << this->isoR05_nTracks() << endl |
677 |
+ |
<<" ID: Fixed-Threshold(Loose,Tight,HighEnergy)=(" << this->idCutBasedFixedThresholdLoose() << "," << this->idCutBasedFixedThresholdTight() << "," << this->idCutBasedFixedThresholdHighEnergy() << ")" |
678 |
+ |
<<" Categorized(Loose,Tight)=(" << this->idCutBasedCategorizedLoose() << "," << this->idCutBasedCategorizedTight() << ")" |
679 |
+ |
<<" LH=" << this->idLikelihood() << " NN=" << this->idNeuralNet() << " isAlsoPhoton=" << this->isAlsoPhoton(); |
680 |
+ |
}; |
681 |
+ |
|
682 |
|
|
683 |
|
private: |
684 |
|
|
756 |
|
Float_t superClusterRawEnergy_; |
757 |
|
Float_t preshowerEnergy_; |
758 |
|
TVector3 caloPosition_; // SuperCluster centroid position |
759 |
+ |
map<Int_t,Int_t> scIndex_; // indexes of the seed SuperClusters (one per SC tytpe) |
760 |
|
map<Int_t,TRef> scRef_; // references to the seed SuperClusters (one per SC tytpe) |
761 |
|
|
762 |
|
|
789 |
|
Int_t isoR05_nTracks_; // Tracks multiplicity in a DR=0.5 cone around the electron |
790 |
|
|
791 |
|
|
792 |
< |
// pat::Electron ID (cf https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideElectronID) |
792 |
> |
// Electron ID (cf https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideElectronID) |
793 |
|
// By default in 2.2.X, only cut based identification is available in pat (https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCutBasedElectronID |
794 |
|
Int_t idCutBasedFixedThresholdLoose_; // Simple cut based ID (aka 'robust') - Loose Thresholds on H/E, DeltaEta, DeltaPhi, SigmaEtaEta |
795 |
|
Int_t idCutBasedFixedThresholdTight_; // Simple cut based ID (default in EWK group) - Tight Thresholds on H/E, DeltaEta, DeltaPhi, SigmaEtaEta |
796 |
< |
Int_t idCutBasedFixedThresholdHighEnergy_; // Simple cut based ID - Thresholds optimized for high energy electron (~TeV) |
796 |
> |
Int_t idCutBasedFixedThresholdHighEnergy_; // Simple cut based ID - Thresholds optimized for high energy electron (~TeV) - not activated by default in 2.2.X |
797 |
|
Int_t idCutBasedCategorizedLoose_; // Category based ID - Different loose thresholds on H/E, DeltaEta, DeltaPhi, SigmaEtaEta, eSeedOverPin for differents regions in the E/p vs fBrem plane |
798 |
|
Int_t idCutBasedCategorizedTight_; // Category based ID - Different tight thresholds on H/E, DeltaEta, DeltaPhi, SigmaEtaEta, eSeedOverPin for differents regions in the E/p vs fBrem plane |
799 |
|
Float_t idLikelihood_; // Lieklihood ID - not activated by default in 2.2.X |
800 |
|
Float_t idNeuralNet_; // NN ID - not activated by default in 2.2.X |
801 |
|
|
802 |
< |
|
689 |
< |
// Matched genParticle |
690 |
< |
TLorentzVector momentumMCElectron_; |
691 |
< |
TVector3 vertexMCElectron_; |
692 |
< |
Int_t pdgIdMCElectron_; |
802 |
> |
Bool_t isAlsoPhoton_; // is electron also a photon ? |
803 |
|
|
804 |
|
// needed ? |
805 |
|
//Float_t sigmaEtaEta_; |
806 |
|
//Float_t sigmaPhiPhi_; |
807 |
|
|
808 |
|
|
809 |
< |
ClassDef (TRootElectron,3); |
809 |
> |
ClassDef (TRootElectron,5); |
810 |
|
|
811 |
|
}; |
812 |
|
|