54 #ifndef ZeeCandidateFilter_H 55 #define ZeeCandidateFilter_H 256 Double_t dist1_D = 0.02 ;
257 Double_t dcot1_D = 0.02 ;
263 Double_t dist2_D = 0.02 ;
264 Double_t dcot2_D = 0.02 ;
276 if ( dataMagneticFieldSetUp_ ) {
287 Double_t BarrelMaxEta_D = 1.4442 ;
288 Double_t EndCapMinEta_D = 1.5660 ;
289 Double_t EndCapMaxEta_D = 2.5000 ;
307 if ( useHLTObjectETCut_ ) {
314 if ( useExtraTrigger_ ) {
319 if ( Int_t(
vHltpathExtra_.size()) != Int_t(vHltpathFilterExtra_.size()) ) {
320 std::cout <<
"ZeeCandidateFilter: ERROR IN Configuration: vHltpathExtra and vHltpathFilterExtra" <<
" should have the same dimensions " << std::endl;
369 std::cout <<
"ZeeCandidateFilter: Running Zee Filter..." << std::endl;
372 std::cout <<
"ZeeCandidateFilter: HLT Path " << hltpath_ << std::endl;
375 if ( useExtraTrigger_ ) {
376 for (Int_t itrig=0; itrig < (Int_t)
vHltpathExtra_.size(); ++itrig ) {
383 std::cout <<
"ZeeCandidateFilter: Trigger info will not be used here" << std::endl;
387 std::cout <<
"ZeeCandidateFilter: MET > " << METCut_ << std::endl;
390 if ( useEcalDrivenElectrons_ ) {
391 std::cout <<
"ZeeCandidateFilter: Electron Candidate(s) is required to be ecal driven" << std::endl;
395 std::cout <<
"ZeeCandidateFilter: At least one electron is required to match an HLT object with DR < " << electronMatched2HLT_DR_ << std::endl;
398 std::cout <<
"ZeeCandidateFilter: Electron Candidates NOT required to match HLT object " << std::endl;
401 if ( useValidFirstPXBHit1_ ) {
402 std::cout <<
"ZeeCandidateFilter: Electron Candidate #1 required to have a valid hit in 1st PXB layer " << std::endl;
405 if ( useValidFirstPXBHit2_ ) {
406 std::cout <<
"ZeeCandidateFilter: Electron Candidate #2 required to have a valid hit in 1st PXB layer " << std::endl;
409 if ( calculateValidFirstPXBHit1_ ) {
410 std::cout <<
"ZeeCandidateFilter: Info about whether there is a valid 1st layer PXB hit for electron candidate #1 will be stored: you can access that later by myElec.userInt(\"PassValidFirstPXBHit\")==1" << std::endl;
413 if ( calculateValidFirstPXBHit2_ ) {
414 std::cout <<
"ZeeCandidateFilter: Info about whether there is a valid 1st layer PXB hit for electron candidate #2 will be stored: you can access that later by myElec.userInt(\"PassValidFirstPXBHit\")==1" << std::endl;
417 if ( useExpectedMissingHits1_ ) {
418 std::cout <<
"ZeeCandidateFilter: Electron Candidate #1 is required to have less than " << maxNumberOfExpectedMissingHits1_ <<
" expected hits missing " << std::endl;
421 if ( useExpectedMissingHits2_ ) {
422 std::cout <<
"ZeeCandidateFilter: Electron Candidate #2 is required to have less than " << maxNumberOfExpectedMissingHits2_ <<
" expected hits missing " << std::endl;
425 if ( calculateExpectedMissingHits1_ ) {
426 std::cout <<
"ZeeCandidateFilter: Missing Hits from expected inner layers for electron candidate #1 will be calculated and stored: you can access them later by myElec.userInt(\"NumberOfExpectedMissingHits\")" << std::endl;
429 if ( calculateExpectedMissingHits2_ ) {
430 std::cout <<
"ZeeCandidateFilter: Missing Hits from expected inner layers for electron candidate #2 will be calculated and stored: you can access them later by myElec.userInt(\"NumberOfExpectedMissingHits\")" << std::endl;
433 if ( useConversionRejection1_ ) {
434 std::cout <<
"ZeeCandidateFilter: Electron Candidate #1 is required to pass EGAMMA Conversion Rejection criteria" << std::endl;
437 if ( useConversionRejection2_ ) {
438 std::cout <<
"ZeeCandidateFilter: Electron Candidate #2 is required to pass EGAMMA Conversion Rejection criteria" << std::endl;
441 if ( calculateConversionRejection1_ ) {
442 std::cout <<
"ZeeCandidateFilter: EGAMMA Conversion Rejection criteria for electron candidate #1 will be calculated and stored: you can access them later by demanding for a successful electron myElec.userInt(\"PassConversionRejection\")==1" << std::endl;
445 if ( calculateConversionRejection2_ ) {
446 std::cout <<
"ZeeCandidateFilter: EGAMMA Conversion Rejection criteria for electron candidate #2 will be calculated and stored: you can access them later by demanding for a successful electron myElec.userInt(\"PassConversionRejection\")==1" << std::endl;
449 if ( dataMagneticFieldSetUp_ ) {
450 std::cout <<
"ZeeCandidateFilter: Data Configuration for Magnetic Field DCS tag " <<
dcsTag_ << std::endl;
457 std::cout <<
"ZeeCandidateFilter: Fiducial Cut: " << std::endl;
459 std::cout <<
"ZeeCandidateFilter: EndcapMin: " << EndCapMinEta_ <<
" EndcapMax: " << EndCapMaxEta_ << std::endl;
466 produces<pat::CompositeCandidateCollection>(
"selectedZeeCandidates").setBranchAlias(
"selectedZeeCandidates");
490 std::cout <<
"FILTER-MSG: Begin Processing ... " 491 <<
"Run = " << iEvent.
run() <<
" " 502 Int_t passTrigger = 0;
508 UInt_t trigger_size = HLTResults->
size();
510 UInt_t trigger_position_extra;
512 if ( trigger_position < trigger_size ) {
513 passTrigger = (Int_t)HLTResults->
accept(trigger_position);
518 <<
" | " <<
"trigger_size = " << trigger_size
519 <<
" | " <<
"hltpath_ = " <<
hltpath_ 520 <<
" | " <<
"trigger_position = " << trigger_position
521 <<
" | " <<
"passTrigger = " << passTrigger
525 for (Int_t itrig=0; itrig < (Int_t)
vHltpathExtra_.size(); ++itrig ) {
528 if ( trigger_position_extra < trigger_size ) {
529 passTrigger = (Int_t)HLTResults->
accept(trigger_position_extra);
534 <<
" | " <<
"vHltpathExtra_[" << itrig <<
"] = " <<
vHltpathExtra_[itrig]
535 <<
" | " <<
"trigger_position_extra = " << trigger_position_extra
536 <<
" | " <<
"passTrigger = " << passTrigger
540 if ( passTrigger > 0 ) { break ; }
547 else {
std::cout <<
"TriggerResults are missing from this event.." << std::endl;
564 std::vector<Int_t> filterIndExtra;
572 Bool_t finalpathfound =
false;
574 if ( nF != filterInd ) {
575 finalpathfound =
true;
578 for (Int_t itrig=0; itrig < (Int_t)filterIndExtra.size(); ++itrig ) {
std::cout <<
"working on #" << itrig << std::endl;
std::cout <<
" ---> " << filterIndExtra[itrig] << std::endl;
579 if ( nF != filterIndExtra[itrig] ) {
580 finalpathfound =
true;
586 if ( ! finalpathfound ) {
std::cout <<
"No HLT Filter was not found in this event..." << std::endl;
625 const Int_t Nelecs = pElecs->size();
627 if ( Nelecs <= 1 ) {
std::cout <<
"No more than 1 electrons found in this event" << std::endl;
633 std::vector<Int_t> indices;
634 std::vector<Double_t> ETs;
637 for (pat::ElectronCollection::const_iterator elec = pElecs->begin(); elec != pElecs->end(); ++elec) {
638 Double_t sc_et = elec->caloEnergy()/TMath::CosH(elec->gsfTrack()->eta());
639 indices.push_back(counter);
640 ETs.push_back(sc_et);
641 myElectrons.push_back(*elec);
645 const Int_t event_elec_number = (Int_t)indices.size();
647 if ( event_elec_number <= 1 ) {
std::cout <<
"No more than 1 electrons in fiducial were found" << std::endl;
652 Int_t *sorted =
new Int_t[event_elec_number];
653 Double_t *
et =
new Double_t[event_elec_number];
655 for (Int_t
i=0;
i<event_elec_number; ++
i ) {
660 TMath::Sort(event_elec_number, et, sorted,
true);
663 Int_t max_et_index1 = sorted[0];
664 Int_t max_et_index2 = sorted[1];
666 if ( ( ETs[max_et_index1] <
ETCut_ ) || ( ETs[max_et_index2] <
ETCut_ ) ) {
753 const std::vector<reco::Vertex> Vtx = *(pVtx.
product());
755 Double_t pv_x = -999999.;
756 Double_t pv_y = -999999.;
757 Double_t pv_z = -999999.;
759 Double_t ele_tip_pv1 = -999999.;
760 Double_t ele_tip_pv2 = -999999.;
762 if ( !Vtx.empty() ) {
763 pv_x = Vtx[0].position().x();
764 pv_y = Vtx[0].position().y();
765 pv_z = Vtx[0].position().z();
773 maxETelec1.
addUserFloat(
"ele_tip_pv", Float_t(ele_tip_pv1));
778 maxETelec2.
addUserFloat(
"ele_tip_pv", Float_t(ele_tip_pv2));
883 maxETelec1.
addUserInt(
"NumberOfExpectedMissingHits",numberOfInnerHits);
899 maxETelec2.
addUserInt(
"NumberOfExpectedMissingHits",numberOfInnerHits);
918 Double_t currentToBFieldScaleFactor = 2.09237036221512717e-04;
919 Double_t current = (*dcsHandle)[0].magnetCurrent();
920 bfield = current*currentToBFieldScaleFactor;
937 Float_t dist = convInfo.
dist;
938 Float_t dcot = convInfo.
dcot;
942 std::cout <<
"Filter: for electron #1 the conversion says " << isConv << std::endl;
956 maxETelec1.
addUserInt(
"PassConversionRejection",0);
959 maxETelec1.
addUserInt(
"PassConversionRejection",1);
966 std::cout <<
"WARNING! Track Collection with input name: generalTracks was not found. Conversion Rejection for electron #1 is not going to be applied!!!" << std::endl;
988 Double_t currentToBFieldScaleFactor = 2.09237036221512717e-04;
989 Double_t current = (*dcsHandle)[0].magnetCurrent();
990 bfield = current*currentToBFieldScaleFactor;
1007 Float_t dist = convInfo.
dist;
1008 Float_t dcot = convInfo.
dcot;
1012 std::cout <<
"Filter: for electron #2 the conversion says " << isConv << std::endl;
1026 maxETelec2.
addUserInt(
"PassConversionRejection",0);
1029 maxETelec2.
addUserInt(
"PassConversionRejection",1);
1036 std::cout <<
"WARNING! Track Collection with input name: generalTracks was not found. Conversion Rejection for electron #2 is not going to be applied!!!" << std::endl;
1041 std::cout <<
"HLT matching starts" << std::endl;
1045 Double_t matched_dr_distance1 = 999999.;
1046 Int_t trigger_int_probe1 = 0;
1048 Double_t matched_dr_distance2 = 999999.;
1049 Int_t trigger_int_probe2 = 0;
1051 if ( finalpathfound ) {
1053 if ( nF != filterInd ) {
1056 const Int_t nK(KEYS.size());
1058 std::cout <<
"Found trig objects #" << nK << std::endl;
1060 for ( Int_t iTrig = 0; iTrig < nK; ++iTrig ) {
1075 if (
TMath::Abs(dr_ele_HLT1) < matched_dr_distance1 ) {
1076 matched_dr_distance1 = dr_ele_HLT1;
1079 if (
TMath::Abs(dr_ele_HLT2) < matched_dr_distance2 ) {
1080 matched_dr_distance2 = dr_ele_HLT2;
1089 for (Int_t itrig=0; itrig < (Int_t) filterIndExtra.size(); ++itrig ) {
1091 if ( filterIndExtra[itrig] == nF ) {
1095 std::cout <<
"working on #" << itrig << std::endl;
std::cout <<
" ---> " << filterIndExtra[itrig] << std::endl;
1098 const Int_t nK(KEYS.size());
1100 std::cout <<
"Found trig objects #" << nK << std::endl;
1102 for (Int_t iTrig = 0; iTrig <nK; ++iTrig ) {
1111 if (
TMath::Abs(dr_ele_HLT1) < matched_dr_distance1 ) {
1112 matched_dr_distance1 = dr_ele_HLT1;
1115 if (
TMath::Abs(dr_ele_HLT2) < matched_dr_distance2 ) {
1116 matched_dr_distance2 = dr_ele_HLT2;
1123 ++trigger_int_probe1;
1127 ++trigger_int_probe2;
1130 if ( ( trigger_int_probe1 == 0 ) && ( trigger_int_probe2 == 0 ) ) {
std::cout <<
"No electron could be matched to an HLT object with " << std::endl;
1138 maxETelec1.
addUserFloat(
"HLTMatchingDR", Float_t(matched_dr_distance1));
1139 maxETelec2.
addUserFloat(
"HLTMatchingDR", Float_t(matched_dr_distance2));
1151 std::cout <<
"HLT matching has finished" << std::endl;
1164 HLTPath[0 ] =
"HLT_Photon10_L1R" ;
1165 HLTPath[1 ] =
"HLT_Photon15_L1R" ;
1166 HLTPath[2 ] =
"HLT_Photon20_L1R" ;
1167 HLTPath[3 ] =
"HLT_Photon15_TrackIso_L1R" ;
1168 HLTPath[4 ] =
"HLT_Photon15_LooseEcalIso_L1R" ;
1169 HLTPath[5 ] =
"HLT_Photon30_L1R_8E29" ;
1170 HLTPath[6 ] =
"HLT_Photon30_L1R_8E29" ;
1171 HLTPath[7 ] =
"HLT_Ele10_LW_L1R" ;
1172 HLTPath[8 ] =
"HLT_Ele15_LW_L1R" ;
1173 HLTPath[9 ] =
"HLT_Ele20_LW_L1R" ;
1174 HLTPath[10] =
"HLT_Ele10_LW_EleId_L1R" ;
1175 HLTPath[11] =
"HLT_Ele15_SiStrip_L1R" ;
1176 HLTPath[12] =
"HLT_IsoTrackHB_8E29" ;
1177 HLTPath[13] =
"HLT_IsoTrackHE_8E29" ;
1178 HLTPath[14] =
"HLT_DiJetAve15U_8E29" ;
1179 HLTPath[15] =
"HLT_MET45" ;
1180 HLTPath[16] =
"HLT_L1MET20" ;
1181 HLTPath[17] =
"HLT_MET100" ;
1184 HLTFilterType[0 ]=
edm::InputTag(
"hltL1NonIsoHLTNonIsoSinglePhotonEt10HcalIsolFilter",
"",process) ;
1185 HLTFilterType[1 ]=
edm::InputTag(
"hltL1NonIsoHLTNonIsoSinglePhotonEt15HcalIsolFilter" ,
"",process) ;
1186 HLTFilterType[2 ]=
edm::InputTag(
"hltL1NonIsoHLTNonIsoSinglePhotonEt20HcalIsolFilter" ,
"",process) ;
1187 HLTFilterType[3 ]=
edm::InputTag(
"hltL1NonIsoSinglePhotonEt15HTITrackIsolFilter",
"",process) ;
1188 HLTFilterType[4 ]=
edm::InputTag(
"hltL1NonIsoSinglePhotonEt15LEIHcalIsolFilter",
"",process) ;
1189 HLTFilterType[5 ]=
edm::InputTag(
"hltL1NonIsoHLTNonIsoSinglePhotonEt15EtFilterESet308E29",
"",process) ;
1190 HLTFilterType[6 ]=
edm::InputTag(
"hltL1NonIsoHLTNonIsoSinglePhotonEt15HcalIsolFilter",
"",process) ;
1191 HLTFilterType[7 ]=
edm::InputTag(
"hltL1NonIsoHLTNonIsoSingleElectronLWEt10PixelMatchFilter",
"",process) ;
1192 HLTFilterType[8 ]=
edm::InputTag(
"hltL1NonIsoHLTNonIsoSingleElectronLWEt15PixelMatchFilter",
"",process) ;
1193 HLTFilterType[9 ]=
edm::InputTag(
"hltL1NonIsoHLTNonIsoSingleElectronLWEt15EtFilterESet20",
"",process) ;
1194 HLTFilterType[10]=
edm::InputTag(
"hltL1NonIsoHLTNonIsoSingleElectronLWEt10EleIdDphiFilter",
"",process) ;
1195 HLTFilterType[11]=
edm::InputTag(
"hltL1NonIsoHLTNonIsoSingleElectronSiStripEt15PixelMatchFilter",
"",process) ;
1196 HLTFilterType[12]=
edm::InputTag(
"hltIsolPixelTrackL3FilterHB8E29",
"",process) ;
1197 HLTFilterType[13]=
edm::InputTag(
"hltIsolPixelTrackL2FilterHE8E29",
"",process) ;
1198 HLTFilterType[14]=
edm::InputTag(
"hltL1sDiJetAve15U8E29",
"",process) ;
1200 Int_t triggerDecision = 0;
1201 UInt_t trigger_size = HLTResults->
size();
1203 for (Int_t
i=0;
i<18; ++
i ) {
1206 UInt_t trigger_position = triggerNames.
triggerIndex(HLTPath[
i]);
1207 Int_t passTrigger = 0;
1209 if ( trigger_position < trigger_size ) {
1210 passTrigger = (Int_t)HLTResults->
accept(trigger_position);
1213 if ( passTrigger > 0 ) {
1215 triggerDecision += (Int_t)(TMath::Power(2,i));
1218 const Int_t myfilterInd = pHLT->
filterIndex(HLTFilterType[i]);
1219 if ( myfilterInd != nF ) {
1220 triggerDecision += (Int_t)(TMath::Power(2,i));
1227 maxETelec1.
addUserInt(
"triggerDecision",triggerDecision);
1228 maxETelec2.
addUserInt(
"triggerDecision",triggerDecision);
1245 const pat::METCollection::const_iterator
met = pMet->begin();
1249 const pat::METCollection::const_iterator pfmet = pPfMet->begin();
1253 const pat::METCollection::const_iterator tcmet = pTcMet->begin();
1256 Double_t metEt = met->
et();
1277 zeeCandidate.
addDaughter(maxETelec1,
"electron1");
1278 zeeCandidate.
addDaughter(maxETelec2,
"electron2");
1286 selectedZeeCandidates->push_back(zeeCandidate);
1288 iEvent.
put(
std::move(selectedZeeCandidates),
"selectedZeeCandidates");
1297 <<
"FILTER-MSG: Event Accepted for Z Candidate" Analysis-level particle class.
Analysis-level MET class.
Bool_t useConversionRejection1_
Bool_t calculateValidFirstPXBHit1_
T getUntrackedParameter(std::string const &, T const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
EventAuxiliary const & eventAuxiliary() const override
double eta() const final
momentum pseudorapidity
trigger::size_type sizeFilters() const
Bool_t electronMatched2HLT_
Int_t maxNumberOfExpectedMissingHits2_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Bool_t calculateConversionRejection2_
edm::InputTag triggerCollectionTag_
Bool_t useValidFirstPXBHit2_
std::vector< MET > METCollection
bool accept() const
Has at least one path accepted the event?
const Keys & filterKeys(trigger::size_type index) const
Global3DPoint GlobalPoint
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
edm::LuminosityBlockNumber_t luminosityBlock() const
void addUserFloat(const std::string &label, float data, const bool overwrite=false)
Set user-defined float.
Bool_t useExpectedMissingHits1_
std::vector< edm::InputTag > vHltpathFilterExtra_
~ZeeCandidateFilter() override
edm::EDGetTokenT< edm::TriggerResults > triggerCollectionToken_
edm::EDGetTokenT< reco::TrackCollection > tracksToken_
Bool_t useExpectedMissingHits2_
edm::EDGetTokenT< pat::METCollection > pfMetCollectionToken_
ZeeCandidateFilter(const edm::ParameterSet &)
Single trigger physics object (e.g., an isolated muon)
Bool_t useValidFirstPXBHit1_
edm::EDGetTokenT< pat::METCollection > tcMetCollectionToken_
edm::EDGetTokenT< DcsStatusCollection > dcsToken_
#define DEFINE_FWK_MODULE(type)
std::vector< Electron > ElectronCollection
unsigned int triggerIndex(std::string const &name) const
double et() const final
transverse energy
const TriggerObjectCollection & getObjects() const
unsigned int size() const
Get number of paths stored.
Bool_t calculateExpectedMissingHits1_
Double_t electronMatched2HLT_DR_
edm::EDGetTokenT< pat::ElectronCollection > electronCollectionToken_
Bool_t calculateValidFirstPXBHit2_
Bool_t isInFiducial(Double_t eta)
Int_t maxNumberOfExpectedMissingHits1_
edm::EDGetTokenT< pat::METCollection > metCollectionToken_
void addUserInt(const std::string &label, int32_t data, const bool overwrite=false)
Set user-defined int.
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
Bool_t useSpikeRejection_
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
Bool_t filter(edm::Event &, const edm::EventSetup &) override
Bool_t useConversionRejection2_
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
edm::InputTag electronCollectionTag_
Double_t spikeCleaningSwissCrossCut_
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
std::vector< CompositeCandidate > CompositeCandidateCollection
T const * product() const
std::vector< size_type > Keys
Bool_t dataMagneticFieldSetUp_
Bool_t useEcalDrivenElectrons_
std::vector< std::string > vHltpathExtra_
math::XYZPoint caloPosition() const
Analysis-level electron class.
et
define resolution functions of each parameter
Bool_t useHLTObjectETCut_
edm::InputTag hltpathFilter_
static std::atomic< unsigned int > counter
static int position[264][3]
edm::EDGetTokenT< EcalRecHitCollection > eeRecHitsToken_
edm::EDGetTokenT< EcalRecHitCollection > ebRecHitsToken_
edm::EDGetTokenT< trigger::TriggerEvent > triggerEventToken_
Bool_t calculateExpectedMissingHits2_
reco::GsfTrackRef gsfTrack() const override
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
Bool_t calculateConversionRejection1_
edm::EDGetTokenT< std::vector< reco::Vertex > > PrimaryVerticesCollectionToken_
double phi() const final
momentum azimuthal angle
T const * product() const
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
EventNumber_t event() const
bool ecalDrivenSeed() const