151 edm::LogError(
"")<<
"Error! Can't get ElectronCollection by label. ";
259 std::cout <<
"Error!!! HLT is missing!" << std::endl;
357 const int n1 = sc1->size();
358 const int n2 = sc2->size();
362 for (
int i=0;
i<5; ++
i) {
373 std::vector<double> ETsc1;
374 std::vector<reco::SuperCluster>::const_iterator
sc;
375 for (sc = sc1->begin(); sc != sc1->end(); ++
sc) {
377 double scEt = mySc.
energy()/(cosh(mySc.
eta()));
378 ETsc1.push_back(scEt);
381 int *sorted1 =
new int[n1];
382 double *et1 =
new double[n1];
383 for (
int i=0;
i<n1; ++
i) {
387 TMath::Sort(n1, et1, sorted1,
true);
389 std::vector<double> ETsc2;
390 for (sc = sc2->begin(); sc != sc2->end(); ++
sc) {
392 double scEt = mySc.
energy()/(cosh(mySc.
eta()));
393 ETsc2.push_back(scEt);
396 int *sorted2 =
new int[n2];
397 double *et2 =
new double[n2];
398 for (
int i=0;
i<n2; ++
i) {
402 TMath::Sort(n2, et2, sorted2,
true);
405 for(
int probeSc = 0; probeSc < n1; ++probeSc)
409 if (probeSc >= 5)
break;
411 int sc_index = sorted1[probeSc];
412 std::vector<reco::SuperCluster>::const_iterator
413 Rprobe = sc1->begin() + sc_index;
422 for(
int probeSc = 0; probeSc < n2; ++probeSc)
426 if (probeSc >= 5)
break;
428 int sc_index = sorted2[probeSc];
429 std::vector<reco::SuperCluster>::const_iterator
430 Rprobe = sc2->begin() + sc_index;
438 delete [] sorted1;
delete [] sorted2;
439 delete [] et1;
delete [] et2;
445 reco::TrackCollection::const_iterator tr;
446 const int ntracks = ctf->size();
454 for (
int i=0;
i<20; ++
i) {
462 std::vector<double> ETtrack;
463 for (tr = ctf->begin(); tr != ctf->end(); ++tr) {
465 double scEt = mySc.
pt();
466 ETtrack.push_back(scEt);
468 int *sortedTr =
new int[ntracks];
469 double *etTr =
new double[ntracks];
470 for (
int i=0;
i<ntracks; ++
i) {
471 etTr[
i] = ETtrack[
i];
474 TMath::Sort(ntracks, etTr, sortedTr,
true);
476 for(
int probeSc = 0; probeSc < ntracks; ++probeSc)
480 if (probeSc >= 20)
break;
482 int sc_index = sortedTr[probeSc];
483 std::vector<reco::Track>::const_iterator
484 Rprobe = ctf->begin() + sc_index;
497 delete [] sortedTr;
delete [] etTr;
503 pat::MuonCollection::const_iterator
muon;
504 const int nmuons = pMuons->size();
506 for (
int i=0;
i<4; ++
i) {
514 std::vector<double> ETmuons;
515 for (muon = pmuon->begin(); muon != pmuon->end(); ++
muon) {
517 double scEt = mySc.
track()->pt();
518 ETmuons.push_back(scEt);
520 int *sortedMu =
new int[nmuons];
521 double *etMu =
new double[nmuons];
522 for (
int i=0;
i<nmuons; ++
i) {
523 etMu[
i] = ETmuons[
i];
526 TMath::Sort(nmuons, etMu, sortedMu,
true);
528 for(
int probeSc = 0; probeSc < nmuons; ++probeSc)
532 if (probeSc >= 4)
break;
534 int sc_index = sortedMu[probeSc];
535 std::vector<pat::Muon>::const_iterator
536 Rprobe = pmuon->begin() + sc_index;
549 delete [] sortedMu;
delete [] etMu;
551 if (n1+n2+ntracks == 0) {
552 std::cout <<
"Return: no sc in this event" << std::endl;
558 const int MAX_PROBES = 4;
559 for(
int i =0;
i < MAX_PROBES;
i++){
618 std::vector<pat::ElectronRef> UniqueElectrons;
626 for(pat::ElectronCollection::const_iterator
627 elec = electrons->begin(); elec != electrons->end();++elec) {
630 pat::ElectronCollection::const_iterator BestDuplicate = elec;
632 for(pat::ElectronCollection::const_iterator
633 elec2 = electrons->begin();
634 elec2 != electrons->end(); ++elec2)
638 if( elec->superCluster() == elec2->superCluster())
640 if(fabs(BestDuplicate->eSuperClusterOverP()-1.)
641 >= fabs(elec2->eSuperClusterOverP()-1.))
643 BestDuplicate = elec2;
649 if(BestDuplicate == elec) UniqueElectrons.push_back(electronRef);
666 std::vector<double> ETs;
667 std::vector<pat::ElectronRef>::const_iterator elec;
668 for (elec = UniqueElectrons.begin(); elec != UniqueElectrons.end(); ++elec) {
671 double probeEt = probeEle->caloEnergy()/(cosh(probeEle->caloPosition().eta()));
672 ETs.push_back(probeEt);
683 TMath::Sort(elec_1_duplicate_removal, et, sorted,
true);
690 if (probeIt >= MAX_PROBES)
break;
692 int elec_index = sorted[probeIt];
693 std::vector<pat::ElectronRef>::const_iterator
694 Rprobe = UniqueElectrons.begin() + elec_index;
698 double probeEt = probeEle->caloEnergy()/(cosh(probeEle->caloPosition().eta()));
703 if(fabs(probeEle->caloPosition().eta()) <
BarrelMaxEta ||
717 probeEle->classification();
718 double ProbeTIP = probeEle->gsfTrack()->d0();
727 probeEle->dr04IsolationVariables().hcalDepth1TowerSumEt +
728 probeEle->dr04IsolationVariables().hcalDepth2TowerSumEt;
730 probe_iso_user[probeIt] = probeEle->dr04IsolationVariables().tkSumPt;
733 probeEle->dr03IsolationVariables().hcalDepth1TowerSumEt +
734 probeEle->dr03IsolationVariables().hcalDepth2TowerSumEt;
736 double hOverE = probeEle->hadronicOverEm();
737 double deltaPhiIn = probeEle->deltaPhiSuperClusterTrackAtVtx();
738 double deltaEtaIn = probeEle->deltaEtaSuperClusterTrackAtVtx();
739 double eOverP = probeEle->eSuperClusterOverP();
740 double pin = probeEle->trackMomentumAtVtx().R();
741 double pout = probeEle->trackMomentumOut().R();
742 double sigmaee = probeEle->scSigmaEtaEta();
743 double sigma_IetaIeta = probeEle->scSigmaIEtaIEta();
745 if( fabs (probeEle->caloPosition().eta()) > 1.479 ) {
746 sigmaee = sigmaee - 0.02*(fabs(probeEle->caloPosition().eta()) -2.3);
750 double e5x5, e2x5, e1x5;
751 e5x5 = probeEle->scE5x5();
752 e1x5 = probeEle->scE1x5();
753 e2x5 = probeEle->scE2x5Max();
901 histofile =
new TFile(filename_histo,
"RECREATE");
904 probe_tree =
new TTree(
"probe_tree",
"Tree to store probe variables");
911 "probe_ele_vertex_x[4]/D");
913 "probe_ele_vertex_y[4]/D");
915 "probe_ele_vertex_z[4]/D");
1021 "ctf_track_tip_bs[20]/D");
1039 std::cout <<
"Empty tree: no output..." << std::endl;
edm::EDGetTokenT< pat::MuonCollection > pMuonsToken_
T getUntrackedParameter(std::string const &, T const &) const
double probe_ele_phi_for_tree[4]
edm::InputTag HLTCollectionE31_
edm::EDGetTokenT< trigger::TriggerEvent > HLTCollectionE31Token_
double probe_ecal_iso_user[4]
double sc_multi5x5_eta[5]
edm::EDGetTokenT< reco::CaloMETCollection > MetCollectionToken_
double probe_sc_eta_for_tree[4]
int elec_1_duplicate_removal
bool getByToken(EDGetToken token, Handle< PROD > &result) const
int probe_sc_pass_fiducial_cut[4]
edm::InputTag HLTTriggerResultsE31_
std::vector< Track > TrackCollection
collection of Tracks
double probe_ele_eta_for_tree[4]
double probe_hcal_isolation_value[4]
double probe_ele_sihih[4]
double phi() const
azimuthal angle of momentum vector
int probe_charge_for_tree[4]
double probe_ele_Xvertex_for_tree[4]
reco::TrackRef track() const override
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
edm::EDGetTokenT< edm::TriggerResults > HLTTriggerResultsE29Token_
edm::EDGetTokenT< reco::METCollection > tcMetCollectionToken_
double eta() const
pseudorapidity of cluster centroid
edm::EDGetTokenT< pat::ElectronCollection > ElectronCollectionToken_
int probe_classification_index_for_tree[4]
double probe_ele_et_for_tree[4]
edm::EDGetTokenT< reco::SuperClusterCollection > corHybridscToken_
GenPurposeSkimmerData(const edm::ParameterSet &)
double sc_multi5x5_phi[5]
edm::EDGetTokenT< reco::TrackCollection > ctfTracksToken_
#define DEFINE_FWK_MODULE(type)
double eta() const
pseudorapidity of momentum vector
std::vector< Electron > ElectronCollection
edm::EDGetTokenT< reco::SuperClusterCollection > multi5x5scToken_
double probe_ele_Zvertex_for_tree[4]
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
double pt() const
track transverse momentum
~GenPurposeSkimmerData() override
double energy() const
cluster energy
double probe_isolation_value[4]
double vz() const
z coordinate of the reference point on track
void analyze(const edm::Event &, const edm::EventSetup &) override
double ctf_track_tip_bs[20]
T const * product() const
edm::EDGetTokenT< reco::BeamSpot > offlineBeamSpotToken_
XYZPointD XYZPoint
point in space with cartesian internal representation
et
define resolution functions of each parameter
std::vector< Muon > MuonCollection
edm::EDGetTokenT< edm::TriggerResults > HLTTriggerResultsE31Token_
double probe_ele_Yvertex_for_tree[4]
double probe_sc_phi_for_tree[4]
double vy() const
y coordinate of the reference point on track
double probe_ecal_isolation_value[4]
double probe_sc_et_for_tree[4]
edm::EDGetTokenT< reco::PFMETCollection > pfMetCollectionToken_
edm::EDGetTokenT< trigger::TriggerEvent > HLTCollectionE29Token_
edm::InputTag HLTTriggerResultsE29_
const Point & position() const
position
double phi() const
azimuthal angle of cluster centroid
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
double probe_hcal_iso_user[4]
Analysis-level muon class.
edm::EDGetTokenT< pat::METCollection > t1MetCollectionToken_
edm::InputTag HLTCollectionE29_
edm::EDGetTokenT< pat::METCollection > mcMetCollectionToken_
double vx() const
x coordinate of the reference point on track
edm::InputTag MetCollectionTag_