From a8eae9f4a2d73c32837fd8d4610ce1da51de0e74 Mon Sep 17 00:00:00 2001 From: Sebastian Brommer Date: Tue, 16 Apr 2024 10:24:12 +0200 Subject: [PATCH] PR to adress review comments (#3) * remove comments, set constants constant * remove CASTOR cleaner and merger * Remove single generator customize function. It is not used anymore since the generator step is splitted in 3 steps. * remove unneeded filters * optimize embedding correction calculation * optimize selector loops * format cpp code with scram build code-format --------- Co-authored-by: cwinter --- .../MCEmbeddingTools/plugins/CaloCleaner.cc | 26 +--- .../MCEmbeddingTools/plugins/CaloCleaner.h | 6 +- .../plugins/CollectionMerger.cc | 20 +-- .../plugins/CollectionMerger.h | 2 +- .../plugins/DYToElElGenFilter.cc | 82 ----------- .../plugins/DYToElTauGenFilter.cc | 133 ------------------ .../plugins/DYToMuMuGenFilter.cc | 84 ----------- .../plugins/DYToMuTauGenFilter.cc | 133 ------------------ .../plugins/DYToTauTauGenFilter.cc | 121 ---------------- .../plugins/DoubleCollectionMerger.cc | 18 +-- .../plugins/DoubleCollectionMerger.h | 2 +- .../EmbeddingHltPixelVerticesProducer.cc | 30 ---- .../plugins/EmbeddingLHEProducer.cc | 73 +++------- .../plugins/MuMuForEmbeddingSelector.cc | 22 ++- .../plugins/MuonDetCleaner.cc | 10 +- .../MCEmbeddingTools/plugins/MuonDetCleaner.h | 5 +- .../plugins/TrackMergeremb.cc | 27 +--- .../MCEmbeddingTools/plugins/TrackMergeremb.h | 7 +- .../plugins/TrackerCleaner.cc | 2 - .../python/DYToElElGenFilter_cfi.py | 7 - .../python/DYToElTauGenFilter_cfi.py | 6 - .../python/DYToMuMuGenFilter_cfi.py | 5 - .../python/DYToMuTauGenFilter_cfi.py | 6 - .../python/DYToTauTauGenFilter_cfi.py | 6 - .../MCEmbeddingTools/python/customisers.py | 66 --------- 25 files changed, 45 insertions(+), 854 deletions(-) delete mode 100644 TauAnalysis/MCEmbeddingTools/plugins/DYToElElGenFilter.cc delete mode 100644 TauAnalysis/MCEmbeddingTools/plugins/DYToElTauGenFilter.cc delete mode 100644 TauAnalysis/MCEmbeddingTools/plugins/DYToMuMuGenFilter.cc delete mode 100644 TauAnalysis/MCEmbeddingTools/plugins/DYToMuTauGenFilter.cc delete mode 100644 TauAnalysis/MCEmbeddingTools/plugins/DYToTauTauGenFilter.cc delete mode 100644 TauAnalysis/MCEmbeddingTools/python/DYToElElGenFilter_cfi.py delete mode 100644 TauAnalysis/MCEmbeddingTools/python/DYToElTauGenFilter_cfi.py delete mode 100644 TauAnalysis/MCEmbeddingTools/python/DYToMuMuGenFilter_cfi.py delete mode 100644 TauAnalysis/MCEmbeddingTools/python/DYToMuTauGenFilter_cfi.py delete mode 100644 TauAnalysis/MCEmbeddingTools/python/DYToTauTauGenFilter_cfi.py diff --git a/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.cc b/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.cc index 482ebd8632658..af279da3cc966 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.cc @@ -1,7 +1,6 @@ #include "TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.h" #include "DataFormats/EcalRecHit/interface/EcalRecHit.h" -#include "DataFormats/HcalRecHit/interface/CastorRecHit.h" #include "DataFormats/HcalRecHit/interface/HBHERecHit.h" #include "DataFormats/HcalRecHit/interface/HFRecHit.h" #include "DataFormats/HcalRecHit/interface/HORecHit.h" @@ -11,7 +10,6 @@ typedef CaloCleaner EcalRecHitColCleaner; typedef CaloCleaner HBHERecHitColCleaner; typedef CaloCleaner HFRecHitColCleaner; typedef CaloCleaner HORecHitColCleaner; -typedef CaloCleaner CastorRecHitColCleaner; typedef CaloCleaner ZDCRecHitColCleaner; template @@ -28,7 +26,6 @@ CaloCleaner::CaloCleaner(const edm::ParameterSet &iConfig) edm::ParameterSet parameters = iConfig.getParameter("TrackAssociatorParameters"); edm::ConsumesCollector iC = consumesCollector(); parameters_.loadParameters(parameters, iC); - // trackAssociator_.useDefaultPropagator(); } template @@ -49,8 +46,6 @@ void CaloCleaner::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) // Fill the correction map for (edm::View::const_iterator iMuon = muons.begin(); iMuon != muons.end(); ++iMuon) { - // get the basic informaiton like fill reco mouon does - // RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc const reco::Track *track = nullptr; if (iMuon->track().isNonnull()) track = iMuon->track().get(); @@ -68,7 +63,6 @@ void CaloCleaner::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) for (auto input_ : inputs_) { std::unique_ptr recHitCollection_output(new RecHitCollection()); edm::Handle recHitCollection; - // iEvent.getByToken(input_.second[0], recHitCollection); iEvent.getByToken(input_.second, recHitCollection); for (typename RecHitCollection::const_iterator recHit = recHitCollection->begin(); recHit != recHitCollection->end(); @@ -83,14 +77,6 @@ void CaloCleaner::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) } else { recHitCollection_output->push_back(*recHit); } - /* For the inveted collection - if (correction_map[recHit->detid().rawId()] > 0){ - float new_energy = correction_map[recHit->detid().rawId()]; - if (new_energy < 0) new_energy =0; - T newRecHit(*recHit); - newRecHit.setEnergy(new_energy); - recHitCollection_output->push_back(newRecHit); - }*/ } // Save the new collection recHitCollection_output->sort(); @@ -104,8 +90,7 @@ void CaloCleaner::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) template void CaloCleaner::fill_correction_map(TrackDetMatchInfo *, std::map *) { - assert(0); // CV: make sure general function never gets called; - // always use template specializations + assert(0); } template <> @@ -120,7 +105,6 @@ void CaloCleaner::fill_correction_map(TrackDetMatchInfo *info, std:: for (std::vector::const_iterator hit = info->crossedEcalRecHits.begin(); hit != info->crossedEcalRecHits.end(); hit++) { - // (*cor_map) [(*hit)->detid().rawId()] +=(*hit)->energy(); (*cor_map)[(*hit)->detid().rawId()] = (*hit)->energy(); } } @@ -149,14 +133,9 @@ void CaloCleaner::fill_correction_map(TrackDetMatchInfo *info, std::ma return; // No corrections for HF } -template <> -void CaloCleaner::fill_correction_map(TrackDetMatchInfo *info, std::map *cor_map) { - return; // No corrections for Castor -} - template <> void CaloCleaner::fill_correction_map(TrackDetMatchInfo *info, std::map *cor_map) { - return; // No corrections for Castor + return; // No corrections for ZDC } DEFINE_FWK_MODULE(EcalRecHitColCleaner); @@ -164,5 +143,4 @@ DEFINE_FWK_MODULE(HBHERecHitColCleaner); DEFINE_FWK_MODULE(HORecHitColCleaner); // no need for cleaning outside of tracker, so just a copy of the old collection DEFINE_FWK_MODULE(HFRecHitColCleaner); -DEFINE_FWK_MODULE(CastorRecHitColCleaner); DEFINE_FWK_MODULE(ZDCRecHitColCleaner); diff --git a/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.h b/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.h index 7438d09bda3de..7a57c8d67fc49 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.h +++ b/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.h @@ -1,14 +1,12 @@ /** \class CaloCleaner * * Clean collections of calorimeter recHits - * (detectors supported at the moment: EB/EE, HB/HE and HO) + * (detectors supported: EB/EE, HB/HE and HO) * * \author Tomasz Maciej Frueboes; * Christian Veelken, LLR - * - * - * * Clean Up from STefan Wayand, KIT + * Clean Up from Christian Winter & Sebastian Brommer, KIT */ #ifndef TauAnalysis_MCEmbeddingTools_CaloCleaner_H #define TauAnalysis_MCEmbeddingTools_CaloCleaner_H diff --git a/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.cc b/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.cc index 293e683c9a0fa..5f1629f0eaa48 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.cc @@ -51,7 +51,6 @@ typedef CollectionMerger, EcalRecHit> EcalRecH typedef CollectionMerger, HBHERecHit> HBHERecHitColMerger; typedef CollectionMerger, HFRecHit> HFRecHitColMerger; typedef CollectionMerger, HORecHit> HORecHitColMerger; -typedef CollectionMerger, CastorRecHit> CastorRecHitColMerger; typedef CollectionMerger, ZDCRecHit> ZDCRecHitColMerger; typedef CollectionMerger>, DTRecHit1DPair> DTRecHitColMerger; @@ -67,7 +66,6 @@ CollectionMerger::CollectionMerger(const edm::ParameterSet &iConfig) { willconsume(iConfig); for (const auto &toproduce : inputs_) { std::string alias(iConfig.getParameter("@module_label")); - // std::cout<::fill_output_obj_seed(edm::Event &iEvent, edm::Handle track_new_col; iEvent.getByToken(inputs_fixtrackcol_, track_new_col); - std::map - simple_track_to_track_map; // I didn't find a more elegant way, so just build a good old fassion std::map + std::map simple_track_to_track_map; for (unsigned abc = 0; abc < track_new_col->size(); ++abc) { reco::TrackRef trackRef(track_new_col, abc); simple_track_to_track_map[((*track_ref_map)[trackRef])[0]] = trackRef; @@ -285,8 +282,7 @@ template void CollectionMerger::fill_output_obj(edm::Event &iEvent, std::unique_ptr &output, std::vector> &inputCollections) { - assert(0); // CV: make sure general function never gets called; - // always use template specializations + assert(0); } // Start with the Tracker collections @@ -306,7 +302,6 @@ void CollectionMerger, SiStripCluster>::fil fill_output_obj_tracker(output, inputCollections); } -// Next are the Calo entries template <> void CollectionMerger, EcalRecHit>::fill_output_obj( edm::Event &iEvent, @@ -339,14 +334,6 @@ void CollectionMerger, HORecHit>::fill_output_ob fill_output_obj_calo(output, inputCollections); } -template <> -void CollectionMerger, CastorRecHit>::fill_output_obj( - edm::Event &iEvent, - std::unique_ptr &output, - std::vector> &inputCollections) { - fill_output_obj_calo(output, inputCollections); -} - template <> void CollectionMerger, ZDCRecHit>::fill_output_obj( edm::Event &iEvent, @@ -355,7 +342,6 @@ void CollectionMerger, ZDCRecHit>::fill_output_ fill_output_obj_calo(output, inputCollections); } -// Here the Muon Chamber template <> void CollectionMerger>, DTRecHit1DPair>::fill_output_obj( edm::Event &iEvent, @@ -380,7 +366,6 @@ void CollectionMerger>, RPCRec fill_output_obj_muonchamber(output, inputCollections); } -// Here Electron Seeds template <> void CollectionMerger, reco::ElectronSeed>::fill_output_obj( edm::Event &iEvent, @@ -399,7 +384,6 @@ DEFINE_FWK_MODULE(EcalRecHitColMerger); DEFINE_FWK_MODULE(HBHERecHitColMerger); DEFINE_FWK_MODULE(HFRecHitColMerger); DEFINE_FWK_MODULE(HORecHitColMerger); -DEFINE_FWK_MODULE(CastorRecHitColMerger); DEFINE_FWK_MODULE(ZDCRecHitColMerger); DEFINE_FWK_MODULE(DTRecHitColMerger); diff --git a/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.h b/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.h index 9835cd3349aa0..a6ce870072870 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.h +++ b/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.h @@ -3,6 +3,7 @@ * \author Stefan Wayand; * Christian Veelken, LLR * + * Clean Up from Christian Winter & Sebastian Brommer, KIT */ #ifndef TauAnalysis_MCEmbeddingTools_CollectionMerger_H #define TauAnalysis_MCEmbeddingTools_CollectionMerger_H @@ -35,7 +36,6 @@ #include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h" #include "DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h" -// #include "TauAnalysis/MCEmbeddingTools/interface/embeddingAuxFunctions.h" #include #include #include diff --git a/TauAnalysis/MCEmbeddingTools/plugins/DYToElElGenFilter.cc b/TauAnalysis/MCEmbeddingTools/plugins/DYToElElGenFilter.cc deleted file mode 100644 index 453de52082d35..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/plugins/DYToElElGenFilter.cc +++ /dev/null @@ -1,82 +0,0 @@ -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/Candidate/interface/LeafCandidate.h" -#include "DataFormats/HepMCCandidate/interface/GenParticle.h" -#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "FWCore/Framework/interface/stream/EDFilter.h" -#include "FWCore/Utilities/interface/StreamID.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -class DYToElElGenFilter : public edm::stream::EDFilter<> { -public: - explicit DYToElElGenFilter(const edm::ParameterSet &); - ~DYToElElGenFilter() override; - - static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); - -private: - void beginStream(edm::StreamID) override; - bool filter(edm::Event &, const edm::EventSetup &) override; - void endStream() override; - - edm::InputTag inputTag_; - edm::EDGetTokenT genParticleCollection_; - - edm::Handle gen_handle; - - // virtual void beginRun(edm::Run const&, edm::EventSetup const&) override; - // virtual void endRun(edm::Run const&, edm::EventSetup const&) override; - // virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; - // virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; - - // ----------member data --------------------------- -}; - -DYToElElGenFilter::DYToElElGenFilter(const edm::ParameterSet &iConfig) { - inputTag_ = iConfig.getParameter("inputTag"); - genParticleCollection_ = consumes(inputTag_); -} - -DYToElElGenFilter::~DYToElElGenFilter() {} - -bool DYToElElGenFilter::filter(edm::Event &iEvent, const edm::EventSetup &iSetup) { - iEvent.getByToken(genParticleCollection_, gen_handle); - - for (unsigned int i = 0; i < gen_handle->size(); i++) { - const reco::GenParticle gen_particle = (*gen_handle)[i]; - // Check if Z Boson decayed into two leptons - if (gen_particle.pdgId() == 23 && gen_particle.numberOfDaughters() == 2) { - // Check if daugther particles are Electrons - if (std::abs(gen_particle.daughter(0)->pdgId()) == 11 && std::abs(gen_particle.daughter(1)->pdgId()) == 11 && - std::abs(gen_particle.daughter(0)->eta()) < 2.6 && std::abs(gen_particle.daughter(1)->eta()) < 2.6 && - gen_particle.daughter(0)->pt() > 7 && gen_particle.daughter(1)->pt() > 7) { - edm::LogPrint("") << "Electron Event ! "; - return true; - } else { - return false; - } - } - } - return false; -} -// ------------ method called once each stream before processing any runs, lumis or events ------------ -void DYToElElGenFilter::beginStream(edm::StreamID) {} - -// ------------ method called once each stream after processing all runs, lumis and events ------------ -void DYToElElGenFilter::endStream() {} - -// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void DYToElElGenFilter::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { - // The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters - edm::ParameterSetDescription desc; - desc.setUnknown(); - descriptions.addDefault(desc); -} - -DEFINE_FWK_MODULE(DYToElElGenFilter); diff --git a/TauAnalysis/MCEmbeddingTools/plugins/DYToElTauGenFilter.cc b/TauAnalysis/MCEmbeddingTools/plugins/DYToElTauGenFilter.cc deleted file mode 100644 index ddd9c79569f5b..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/plugins/DYToElTauGenFilter.cc +++ /dev/null @@ -1,133 +0,0 @@ -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/Candidate/interface/LeafCandidate.h" -#include "DataFormats/HepMCCandidate/interface/GenParticle.h" -#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "FWCore/Framework/interface/stream/EDFilter.h" -#include "FWCore/Utilities/interface/StreamID.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -class DYToElTauGenFilter : public edm::stream::EDFilter<> { -public: - explicit DYToElTauGenFilter(const edm::ParameterSet &); - ~DYToElTauGenFilter() override; - - static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); - -private: - void beginStream(edm::StreamID) override; - bool filter(edm::Event &, const edm::EventSetup &) override; - void endStream() override; - bool leptondecay(const reco::Candidate *d, int depth); - bool electrondecay(const reco::Candidate *d, int depth); - - edm::InputTag inputTag_; - edm::EDGetTokenT genParticleCollection_; - edm::Handle gen_handle; -}; - -DYToElTauGenFilter::DYToElTauGenFilter(const edm::ParameterSet &iConfig) { - inputTag_ = iConfig.getParameter("inputTag"); - genParticleCollection_ = consumes(inputTag_); -} - -DYToElTauGenFilter::~DYToElTauGenFilter() {} - -bool DYToElTauGenFilter::leptondecay(const reco::Candidate *d, int depth) { - // returns true if the event has an leptonic decay - // Debug Output - // std::cout << std::string(4*depth, '-') << "---Hadroncheck-" << std::endl; - // std::cout << std::string(4*depth, '-') << "| Depth " << depth << std::endl; - // std::cout << std::string(4*depth, '-') << "| ID: " << d->pdgId() << std::endl; - // std::cout << std::string(4*depth, '-') << "| Status: " << d->status() << std::endl; - // std::cout << std::string(4*depth, '-') << "| NDaughters: " << d->numberOfDaughters()<< std::endl; - bool check = false; - if (d->status() != 1) { - if (d->numberOfDaughters() == 3) { - if (std::abs(d->daughter(0)->pdgId()) == 14 || std::abs(d->daughter(1)->pdgId()) == 14 || - std::abs(d->daughter(2)->pdgId()) == 14 || std::abs(d->daughter(0)->pdgId()) == 12 || - std::abs(d->daughter(1)->pdgId()) == 12 || std::abs(d->daughter(2)->pdgId()) == 12) - check = true; - } else if (d->numberOfDaughters() > 3) - return false; - if (d->numberOfDaughters() < 4) { - for (unsigned int k = 0; k < d->numberOfDaughters(); k++) { - // std::cout << std::string(4*depth, '-') << "| Daughter Number " << k << std::endl; - int new_depth = depth + 1; - if (leptondecay(d->daughter(k), new_depth) == true) - check = true; - } - } - } - return check; -} -bool DYToElTauGenFilter::electrondecay(const reco::Candidate *d, int depth) { - // returns true if the event has an electron decay - bool check = false; - if (d->status() != 1) { - if (d->numberOfDaughters() == 3) { - if (std::abs(d->daughter(0)->pdgId()) == 12 || std::abs(d->daughter(1)->pdgId()) == 12 || - std::abs(d->daughter(2)->pdgId()) == 12) - check = true; - } else if (d->numberOfDaughters() > 3) - return false; - if (d->numberOfDaughters() < 4) { - for (unsigned int k = 0; k < d->numberOfDaughters(); k++) { - int new_depth = depth + 1; - if (electrondecay(d->daughter(k), new_depth) == true) - check = true; - } - } - } - return check; -} - -bool DYToElTauGenFilter::filter(edm::Event &iEvent, const edm::EventSetup &iSetup) { - iEvent.getByToken(genParticleCollection_, gen_handle); - - for (unsigned int i = 0; i < gen_handle->size(); i++) { - const reco::GenParticle gen_particle = (*gen_handle)[i]; - // Check if Z Boson decayed into two leptons - if (gen_particle.pdgId() == 23 && gen_particle.numberOfDaughters() == 2) { - // Check if daugther particles are taus - // From Generator: Mu.Pt > 18 && Had.Pt > 25 && Mu.Eta < 2.1 - if (std::abs(gen_particle.daughter(0)->pdgId()) == 15 && std::abs(gen_particle.daughter(0)->eta()) < 2.1 && - gen_particle.daughter(0)->pt() > 25 && gen_particle.daughter(1)->pt() > 18) { - bool had_1 = !DYToElTauGenFilter::leptondecay(gen_particle.daughter(0), 1); - bool el_2 = DYToElTauGenFilter::electrondecay(gen_particle.daughter(1), 1); - bool had_2 = !DYToElTauGenFilter::leptondecay(gen_particle.daughter(1), 1); - bool el_1 = DYToElTauGenFilter::electrondecay(gen_particle.daughter(0), 1); - - std::cout << had_1 << " & " << el_2 << " / " << had_2 << " & " << el_1 << " |" << std::endl; - if ((had_1 && el_2) || (had_2 && el_1)) { - std::cout << "Hadronic Decay Check was positive" << std::endl; - return true; - } - std::cout << "Hadronic Decay Check was negative" << std::endl; - } - return false; - } - } - return false; -} -// ------------ method called once each stream before processing any runs, lumis or events ------------ -void DYToElTauGenFilter::beginStream(edm::StreamID) {} - -// ------------ method called once each stream after processing all runs, lumis and events ------------ -void DYToElTauGenFilter::endStream() {} - -// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void DYToElTauGenFilter::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { - // The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters - edm::ParameterSetDescription desc; - desc.setUnknown(); - descriptions.addDefault(desc); -} - -DEFINE_FWK_MODULE(DYToElTauGenFilter); diff --git a/TauAnalysis/MCEmbeddingTools/plugins/DYToMuMuGenFilter.cc b/TauAnalysis/MCEmbeddingTools/plugins/DYToMuMuGenFilter.cc deleted file mode 100644 index 40c04b2052774..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/plugins/DYToMuMuGenFilter.cc +++ /dev/null @@ -1,84 +0,0 @@ -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/Candidate/interface/LeafCandidate.h" -#include "DataFormats/HepMCCandidate/interface/GenParticle.h" -#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "FWCore/Framework/interface/stream/EDFilter.h" -#include "FWCore/Utilities/interface/StreamID.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -class DYToMuMuGenFilter : public edm::stream::EDFilter<> { -public: - explicit DYToMuMuGenFilter(const edm::ParameterSet &); - - static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); - -private: - bool filter(edm::Event &, const edm::EventSetup &) override; - - edm::InputTag inputTag_; - edm::EDGetTokenT genParticleCollection_; - - edm::Handle gen_handle; - - // ----------member data --------------------------- -}; - -DYToMuMuGenFilter::DYToMuMuGenFilter(const edm::ParameterSet &iConfig) { - inputTag_ = iConfig.getParameter("inputTag"); - genParticleCollection_ = consumes(inputTag_); -} - -bool DYToMuMuGenFilter::filter(edm::Event &iEvent, const edm::EventSetup &iSetup) { - iEvent.getByToken(genParticleCollection_, gen_handle); - - for (unsigned int i = 0; i < gen_handle->size(); i++) { - const reco::GenParticle gen_particle = (*gen_handle)[i]; - // Check if Z Boson decayed into two leptons - if (gen_particle.pdgId() == 23 && gen_particle.numberOfDaughters() == 2) { - // Debug output - // std::cout << "pdgId" << gen_particle.pdgId() << std::endl; - // std::cout << "nDau" << gen_particle.numberOfDaughters() << std::endl; - // std::cout << "Dau1" << gen_particle->daughters->at(0).pdgId() << std::endl; - // std::cout << "Dau2" << gen_particle.numberOfDaughters() << std::endl; - // std::cout << "Dau1 " << gen_particle.daughter(0)->pdgId() << std::endl; - // std::cout << "Dau2 " << gen_particle.daughter(1)->pdgId() << std::endl; - // std::cout << gen_particle.daughter(1)->pdgId()+gen_particle.daughter(0)->pdgId() << std::endl; - - // Check if daugther particles are muons - if (std::abs(gen_particle.daughter(0)->pdgId()) == 13 && std::abs(gen_particle.daughter(0)->eta()) < 2.6 && - std::abs(gen_particle.daughter(1)->eta()) < 2.6 && gen_particle.daughter(0)->pt() > 7 && - gen_particle.daughter(1)->pt() > 7) { - // std::cout << "pdgId" << gen_particle.pdgId() << std::endl; - // std::cout << "nDau" << gen_particle.numberOfDaughters() << std::endl; - // std::cout << "Dau1 " << gen_particle.daughter(0)->pdgId() << std::endl; - // std::cout << "Dau1 pt " << gen_particle.daughter(0)->pt() << std::endl; - // std::cout << "Dau1 pt " << gen_particle.daughter(0)->eta() << std::endl; - // std::cout << "Dau2 " << gen_particle.daughter(1)->pdgId() << std::endl; - // std::cout << "Dau2 pt " << gen_particle.daughter(1)->pt() << std::endl; - // std::cout << "Dau2 pt " << gen_particle.daughter(1)->eta() << std::endl; - // std::cout << gen_particle.daughter(1)->pdgId()+gen_particle.daughter(0)->pdgId() << std::endl; - return true; - } else { - return false; - } - } - } - return false; -} - -// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void DYToMuMuGenFilter::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { - // The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters - edm::ParameterSetDescription desc; - desc.setUnknown(); - descriptions.addDefault(desc); -} - -DEFINE_FWK_MODULE(DYToMuMuGenFilter); diff --git a/TauAnalysis/MCEmbeddingTools/plugins/DYToMuTauGenFilter.cc b/TauAnalysis/MCEmbeddingTools/plugins/DYToMuTauGenFilter.cc deleted file mode 100644 index 545bb090d7d99..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/plugins/DYToMuTauGenFilter.cc +++ /dev/null @@ -1,133 +0,0 @@ -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/Candidate/interface/LeafCandidate.h" -#include "DataFormats/HepMCCandidate/interface/GenParticle.h" -#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "FWCore/Framework/interface/stream/EDFilter.h" -#include "FWCore/Utilities/interface/StreamID.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -class DYToMuTauGenFilter : public edm::stream::EDFilter<> { -public: - explicit DYToMuTauGenFilter(const edm::ParameterSet &); - ~DYToMuTauGenFilter() override; - - static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); - -private: - void beginStream(edm::StreamID) override; - bool filter(edm::Event &, const edm::EventSetup &) override; - void endStream() override; - bool leptondecay(const reco::Candidate *d, int depth); - bool muondecay(const reco::Candidate *d, int depth); - - edm::InputTag inputTag_; - edm::EDGetTokenT genParticleCollection_; - edm::Handle gen_handle; -}; - -DYToMuTauGenFilter::DYToMuTauGenFilter(const edm::ParameterSet &iConfig) { - inputTag_ = iConfig.getParameter("inputTag"); - genParticleCollection_ = consumes(inputTag_); -} - -DYToMuTauGenFilter::~DYToMuTauGenFilter() {} - -bool DYToMuTauGenFilter::leptondecay(const reco::Candidate *d, int depth) { - // returns true if the event has an leptonic decay - // Debug Output - // std::cout << std::string(4*depth, '-') << "---Hadroncheck-" << std::endl; - // std::cout << std::string(4*depth, '-') << "| Depth " << depth << std::endl; - // std::cout << std::string(4*depth, '-') << "| ID: " << d->pdgId() << std::endl; - // std::cout << std::string(4*depth, '-') << "| Status: " << d->status() << std::endl; - // std::cout << std::string(4*depth, '-') << "| NDaughters: " << d->numberOfDaughters()<< std::endl; - bool check = false; - if (d->status() != 1) { - if (d->numberOfDaughters() == 3) { - if (std::abs(d->daughter(0)->pdgId()) == 14 || std::abs(d->daughter(1)->pdgId()) == 14 || - std::abs(d->daughter(2)->pdgId()) == 14 || std::abs(d->daughter(0)->pdgId()) == 12 || - std::abs(d->daughter(1)->pdgId()) == 12 || std::abs(d->daughter(2)->pdgId()) == 12) - check = true; - } else if (d->numberOfDaughters() > 3) - return false; - if (d->numberOfDaughters() < 4) { - for (unsigned int k = 0; k < d->numberOfDaughters(); k++) { - // std::cout << std::string(4*depth, '-') << "| Daughter Number " << k << std::endl; - int new_depth = depth + 1; - if (leptondecay(d->daughter(k), new_depth) == true) - check = true; - } - } - } - return check; -} -bool DYToMuTauGenFilter::muondecay(const reco::Candidate *d, int depth) { - // returns true if the event has an muon decay - bool check = false; - if (d->status() != 1) { - if (d->numberOfDaughters() == 3) { - if (std::abs(d->daughter(0)->pdgId()) == 14 || std::abs(d->daughter(1)->pdgId()) == 14 || - std::abs(d->daughter(2)->pdgId()) == 14) - check = true; - } else if (d->numberOfDaughters() > 3) - return false; - if (d->numberOfDaughters() < 4) { - for (unsigned int k = 0; k < d->numberOfDaughters(); k++) { - int new_depth = depth + 1; - if (muondecay(d->daughter(k), new_depth) == true) - check = true; - } - } - } - return check; -} - -bool DYToMuTauGenFilter::filter(edm::Event &iEvent, const edm::EventSetup &iSetup) { - iEvent.getByToken(genParticleCollection_, gen_handle); - - for (unsigned int i = 0; i < gen_handle->size(); i++) { - const reco::GenParticle gen_particle = (*gen_handle)[i]; - // Check if Z Boson decayed into two leptons - if (gen_particle.pdgId() == 23 && gen_particle.numberOfDaughters() == 2) { - // Check if daugther particles are taus - // From Generator: Mu.Pt > 18 && Had.Pt > 25 && Mu.Eta < 2.1 - if (std::abs(gen_particle.daughter(0)->pdgId()) == 15 && std::abs(gen_particle.daughter(0)->eta()) < 2.1 && - gen_particle.daughter(0)->pt() > 25 && gen_particle.daughter(1)->pt() > 18) { - bool had_1 = !DYToMuTauGenFilter::leptondecay(gen_particle.daughter(0), 1); - bool mu_2 = DYToMuTauGenFilter::muondecay(gen_particle.daughter(1), 1); - bool had_2 = !DYToMuTauGenFilter::leptondecay(gen_particle.daughter(1), 1); - bool mu_1 = DYToMuTauGenFilter::muondecay(gen_particle.daughter(0), 1); - - std::cout << had_1 << " & " << mu_2 << " / " << had_2 << " & " << mu_1 << " |" << std::endl; - if ((had_1 && mu_2) || (had_2 && mu_1)) { - std::cout << "Hadronic Decay Check was positive" << std::endl; - return true; - } - std::cout << "Hadronic Decay Check was negative" << std::endl; - } - return false; - } - } - return false; -} -// ------------ method called once each stream before processing any runs, lumis or events ------------ -void DYToMuTauGenFilter::beginStream(edm::StreamID) {} - -// ------------ method called once each stream after processing all runs, lumis and events ------------ -void DYToMuTauGenFilter::endStream() {} - -// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void DYToMuTauGenFilter::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { - // The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters - edm::ParameterSetDescription desc; - desc.setUnknown(); - descriptions.addDefault(desc); -} - -DEFINE_FWK_MODULE(DYToMuTauGenFilter); diff --git a/TauAnalysis/MCEmbeddingTools/plugins/DYToTauTauGenFilter.cc b/TauAnalysis/MCEmbeddingTools/plugins/DYToTauTauGenFilter.cc deleted file mode 100644 index bece7750fc4bc..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/plugins/DYToTauTauGenFilter.cc +++ /dev/null @@ -1,121 +0,0 @@ -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/Candidate/interface/LeafCandidate.h" -#include "DataFormats/HepMCCandidate/interface/GenParticle.h" -#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "FWCore/Framework/interface/stream/EDFilter.h" -#include "FWCore/Utilities/interface/StreamID.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -class DYToTauTauGenFilter : public edm::stream::EDFilter<> { -public: - explicit DYToTauTauGenFilter(const edm::ParameterSet &); - ~DYToTauTauGenFilter() override; - - static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); - -private: - void beginStream(edm::StreamID) override; - bool filter(edm::Event &, const edm::EventSetup &) override; - void endStream() override; - - edm::InputTag inputTag_; - edm::EDGetTokenT genParticleCollection_; - - edm::Handle gen_handle; - - // virtual void beginRun(edm::Run const&, edm::EventSetup const&) override; - // virtual void endRun(edm::Run const&, edm::EventSetup const&) override; - // virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; - // virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; - - // ----------member data --------------------------- -}; - -DYToTauTauGenFilter::DYToTauTauGenFilter(const edm::ParameterSet &iConfig) { - inputTag_ = iConfig.getParameter("inputTag"); - genParticleCollection_ = consumes(inputTag_); -} - -DYToTauTauGenFilter::~DYToTauTauGenFilter() {} - -bool photoncheck(const reco::Candidate *d, int depth) { - // Debug Output - // std::cout << std::string(4*depth, '-') << "-----------------" << std::endl; - // std::cout << std::string(4*depth, '-') << "| Depth " << depth << std::endl; - // std::cout << std::string(4*depth, '-') << "| ID: " << d->pdgId() << std::endl; - // std::cout << std::string(4*depth, '-') << "| Status: " << d->status() << std::endl; - // std::cout << std::string(4*depth, '-') << "| NDaughters: " << d->numberOfDaughters()<< std::endl; - bool check = false; - if (d->status() != 1) { - if (d->numberOfDaughters() == 3) { - if (std::abs(d->daughter(0)->pdgId()) == 14 || std::abs(d->daughter(1)->pdgId()) == 14 || - std::abs(d->daughter(2)->pdgId()) == 14 || std::abs(d->daughter(0)->pdgId()) == 12 || - std::abs(d->daughter(1)->pdgId()) == 12 || std::abs(d->daughter(2)->pdgId()) == 12) { - check = true; - } - } else if (d->numberOfDaughters() > 3) - return false; - if (d->numberOfDaughters() < 4) { - for (unsigned int k = 0; k < d->numberOfDaughters(); k++) { - // std::cout << std::string(4*depth, '-') << "| Daughter Number " << k << std::endl; - int new_depth = depth + 1; - if (photoncheck(d->daughter(k), new_depth) == true) - check = true; - } - } - } - return check; -} - -bool DYToTauTauGenFilter::filter(edm::Event &iEvent, const edm::EventSetup &iSetup) { - iEvent.getByToken(genParticleCollection_, gen_handle); - - for (unsigned int i = 0; i < gen_handle->size(); i++) { - const reco::GenParticle gen_particle = (*gen_handle)[i]; - // Check if Z Boson decayed into two leptons - if (gen_particle.pdgId() == 23 && gen_particle.numberOfDaughters() == 2) { - // Debug output - // std::cout << "pdgId" << gen_particle.pdgId() << std::endl; - // std::cout << "nDau" << gen_particle.numberOfDaughters() << std::endl; - // std::cout << "Dau1 " << gen_particle.daughter(0)->pdgId() << std::endl; - // std::cout << "Dau2 " << gen_particle.daughter(1)->pdgId() << std::endl; - // std::cout << gen_particle.daughter(1)->pdgId()+gen_particle.daughter(0)->pdgId() << std::endl; - - // Check if daugther particles are taus - if (std::abs(gen_particle.daughter(0)->pdgId()) == 15 && std::abs(gen_particle.daughter(0)->eta()) < 2.3 && - std::abs(gen_particle.daughter(1)->eta()) < 2.3 && - ((gen_particle.daughter(0)->pt() > 30 && gen_particle.daughter(1)->pt() > 35) || - (gen_particle.daughter(0)->pt() > 35 && gen_particle.daughter(1)->pt() > 30))) { - if (!photoncheck(gen_particle.daughter(0), 1) && !photoncheck(gen_particle.daughter(1), 1)) { - // std::cout << "Hadronic Decay Check was positive" << std::endl; - return true; - } - // std::cout << "Hadronic Decay Check was negative" << std::endl; - } - return false; - } - } - return false; -} -// ------------ method called once each stream before processing any runs, lumis or events ------------ -void DYToTauTauGenFilter::beginStream(edm::StreamID) {} - -// ------------ method called once each stream after processing all runs, lumis and events ------------ -void DYToTauTauGenFilter::endStream() {} - -// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void DYToTauTauGenFilter::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { - // The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters - edm::ParameterSetDescription desc; - desc.setUnknown(); - descriptions.addDefault(desc); -} - -DEFINE_FWK_MODULE(DYToTauTauGenFilter); diff --git a/TauAnalysis/MCEmbeddingTools/plugins/DoubleCollectionMerger.cc b/TauAnalysis/MCEmbeddingTools/plugins/DoubleCollectionMerger.cc index 0781333476b91..a2eb74544b976 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/DoubleCollectionMerger.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/DoubleCollectionMerger.cc @@ -25,11 +25,9 @@ DoubleCollectionMerger::DoubleCollectionMerger(const edm::Parame inputs2_[inCollection.instance()].push_back(consumes(inCollection)); } for (const auto &toproduce : inputs1_) { - // std::cout<(toproduce.first); } for (const auto &toproduce : inputs2_) { - // std::cout<(toproduce.first); } } @@ -41,16 +39,11 @@ DoubleCollectionMerger::~DoubleCollectionMerger() { template void DoubleCollectionMerger::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) { - // std::cout << "DoubleCollectionMerger::produce" << std::endl; for (auto input_ : inputs1_) { - // std::cout << "input_.first()=" << input_.first << std::endl; - // std::cout << "input_.second.size()=" << input_.second.size() << std::endl; std::unique_ptr output(new MergeCollection1()); std::vector> inputCollections; inputCollections.resize(input_.second.size()); for (unsigned id = 0; id < input_.second.size(); id++) { - // std::cout << "input_.second[id]=" << input_.second[id] << std::endl; - // std::cout << "input_.second[id]=" << id << std::endl; iEvent.getByToken(input_.second[id], inputCollections[id]); } fill_output_obj(output, inputCollections); @@ -58,14 +51,10 @@ void DoubleCollectionMerger::produce(edm::Event &iEvent, const e } for (auto input_ : inputs2_) { - // std::cout << "input_.first()=" << input_.first << std::endl; - // std::cout << "input_.second.size()=" << input_.second.size() << std::endl; std::unique_ptr output(new MergeCollection2()); std::vector> inputCollections; inputCollections.resize(input_.second.size()); for (unsigned id = 0; id < input_.second.size(); id++) { - // std::cout << "input_.second[id]=" << input_.second[id] << std::endl; - // std::cout << "input_.second[id]=" << id << std::endl; iEvent.getByToken(input_.second[id], inputCollections[id]); } fill_output_obj(output, inputCollections); @@ -73,19 +62,16 @@ void DoubleCollectionMerger::produce(edm::Event &iEvent, const e } } -// Here some overloaded functions, which are needed such that the right merger function is called for the indivudal Collections template void DoubleCollectionMerger::fill_output_obj( std::unique_ptr &output, std::vector> &inputCollections) { - assert(0); // CV: make sure general function never gets called; - // always use template specializations + assert(0); } template void DoubleCollectionMerger::fill_output_obj( std::unique_ptr &output, std::vector> &inputCollections) { - assert(0); // CV: make sure general function never gets called; - // always use template specializations + assert(0); } template diff --git a/TauAnalysis/MCEmbeddingTools/plugins/DoubleCollectionMerger.h b/TauAnalysis/MCEmbeddingTools/plugins/DoubleCollectionMerger.h index 9bfd81c5d2d03..89fbd4af7b9c6 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/DoubleCollectionMerger.h +++ b/TauAnalysis/MCEmbeddingTools/plugins/DoubleCollectionMerger.h @@ -2,6 +2,7 @@ * * \author Per Ahrens * + * Clean Up from Christian Winter & Sebastian Brommer, KIT */ #ifndef TauAnalysis_MCEmbeddingTools_DoubleCollectionMerger_H #define TauAnalysis_MCEmbeddingTools_DoubleCollectionMerger_H @@ -15,7 +16,6 @@ #include "DataFormats/Common/interface/DetSetVectorNew.h" #include "DataFormats/Common/interface/SortedCollection.h" -// #include "TauAnalysis/MCEmbeddingTools/interface/embeddingAuxFunctions.h" #include #include #include diff --git a/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingHltPixelVerticesProducer.cc b/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingHltPixelVerticesProducer.cc index 5ebbfe2589b96..0569afd397315 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingHltPixelVerticesProducer.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingHltPixelVerticesProducer.cc @@ -52,7 +52,6 @@ class EmbeddingHltPixelVerticesProducer : public edm::stream::EDProducer<> { void produce(edm::Event &, const edm::EventSetup &) override; void endStream() override; edm::InputTag vertexPositionLabel; - // edm::InputTag generalTracks; // ----------member data --------------------------- }; @@ -61,10 +60,6 @@ EmbeddingHltPixelVerticesProducer::EmbeddingHltPixelVerticesProducer(const edm:: vertexPositionLabel = edm::InputTag("externalLHEProducer", "vertexPosition"); consumes(vertexPositionLabel); produces(); - - // generalTracks = iConfig.getParameter("TrackLabel"); - // consumes(generalTracks); - // consumes(generalTracks); } EmbeddingHltPixelVerticesProducer::~EmbeddingHltPixelVerticesProducer() {} @@ -75,38 +70,13 @@ void EmbeddingHltPixelVerticesProducer::produce(edm::Event &iEvent, const edm::E std::unique_ptr embeddingVertex(new reco::VertexCollection); Handle vertex_position; iEvent.getByLabel(vertexPositionLabel, vertex_position); - // edm::LogPrint("") << "externalLHEProducer Vertex (" << vertex_position.product()->x() << "," << vertex_position.product()->y() << "," << vertex_position.product()->z() << ")"; math::XYZPoint genVertex = math::XYZPoint(vertex_position.product()->x(), vertex_position.product()->y(), vertex_position.product()->z()); math::Error<3>::type Error; - // additionally, get the general Tracks: - // edm::Handle tks; - // iEvent.getByLabel(generalTracks, tks); - // edm::LogPrint("") << "Loaded " << tks->size() << " tracks:"; - - // edm::Handle tks_ref; - // iEvent.getByLabel(generalTracks, tks_ref); - // std::vector > tks_base_; - // tks_base_.push_back(edm::RefToBase(tks_ref)); - // reco::Vertex saveVertex = reco::Vertex(genVertex, Error); // Try to produce an nonfake Vertex - // constructor for a valid vertex, with all data - // Vertex( const Point &, const Error &, double chi2, double ndof, size_t size ); // Need at least 5 ndof so the vertex Quality is considered good reco::Vertex saveVertex = reco::Vertex(genVertex, Error, 1.0, 6.0, 6); - - // for (auto track: *tks) - //{ - // edm::LogPrint("") << track.vertex(); - // saveVertex.add(track, 0.5); - //} - // if (saveVertex.isFake()) edm::LogPrint("") << " The produced Vertex is fake"; - // else edm::LogPrint("") << " The produced Vertex is not fake"; - // edm::LogPrint("") << "Vertex Properties: " << saveVertex.isFake() << " / " << saveVertex.ndof() << " / " << abs(saveVertex.z()) << " / " << abs(saveVertex.position().Rho()); - // if (!saveVertex.isFake() && saveVertex.ndof() >= 4.0 && abs(saveVertex.z()) <= 24.0 && abs(saveVertex.position().Rho()) <= 2.0) - // edm::LogPrint("") << "The Vertex is a goodOfflineVertex"; embeddingVertex->push_back(saveVertex); - // iEvent.put(std::move(embeddingVertex), "embeddingVertex"); iEvent.put(std::move(embeddingVertex)); } diff --git a/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingLHEProducer.cc b/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingLHEProducer.cc index 526aeee4bf22f..26935821447a7 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingLHEProducer.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingLHEProducer.cc @@ -56,10 +56,6 @@ #include "FWCore/Utilities/interface/RandomNumberGenerator.h" #include "FWCore/Utilities/interface/StreamID.h" -// -// class declaration -// - namespace CLHEP { class HepRandomEngine; } @@ -98,9 +94,9 @@ class EmbeddingLHEProducer : public edm::one::EDProducer vertexCollection_; int particleToEmbed_; bool mirror_, rotate180_, InitialRecoCorrection_; - const double tauMass_ = 1.77682; - const double muonMass_ = 0.1057; - const double elMass_ = 0.00051; + static constexpr double tauMass_ = 1.77682; + static constexpr double muonMass_ = 0.1057; + static constexpr double elMass_ = 0.00051; const int embeddingParticles[3]{11, 13, 15}; std::ofstream file; @@ -227,24 +223,6 @@ void EmbeddingLHEProducer::beginRunProduce(edm::Run &run, edm::EventSetup const // set number of processes: 1 for Z to tau tau heprup.resize(1); - // Process independent information - - // beam particles ID (two protons) - // heprup.IDBMUP.first = 2212; - // heprup.IDBMUP.second = 2212; - - // beam particles energies (both 6.5 GeV) - // heprup.EBMUP.first = 6500.; - // heprup.EBMUP.second = 6500.; - - // take default pdf group for both beamparticles - // heprup.PDFGUP.first = -1; - // heprup.PDFGUP.second = -1; - - // take certan pdf set ID (same as in officially produced DYJets LHE files) - // heprup.PDFSUP.first = -1; - // heprup.PDFSUP.second = -1; - // master switch for event weight iterpretation (same as in officially produced DYJets LHE files) heprup.IDWTUP = 3; @@ -276,13 +254,9 @@ void EmbeddingLHEProducer::fill_lhe_from_mumu(TLorentzVector &positiveLepton, TLorentzVector Z = positiveLepton + negativeLepton; int leptonPDGID = particleToEmbed_; - // double tau_ctau = 0.00871100; //cm - double tau_ctau0 = 8.71100e-02; // mm (for Pythia) - double tau_ctau_p = - tau_ctau0 * CLHEP::RandExponential::shoot(engine); // return -std::log(HepRandom::getTheEngine()->flat()); - // replaces tau = process[iNow].tau0() * rndmPtr->exp(); from pythia8212/src/ProcessContainer.cc which is not initialized for ProcessLevel:all = off mode (no beam particle mode) + static constexpr double tau_ctau0 = 8.71100e-02; // mm (for Pythia) + double tau_ctau_p = tau_ctau0 * CLHEP::RandExponential::shoot(engine); double tau_ctau_n = tau_ctau0 * CLHEP::RandExponential::shoot(engine); - // std::cout<<"tau_ctau P: "< 60. && diLeptonMass < 122.) { - // std::cout << "DiLeptonMass " << diLeptonMass << std::endl; - float zmass = 91.1876; + static constexpr float zmass = 91.1876; float correction_deviation = 5.; // to ensure only a correction that drops corresponding to a Gaussian with mean zmass and std. dev. 5 GeV double EmbeddingCorrection = 1.138; // value derived by function fitting to fold embedded mass spectrum back to original selection when using mu -> mu embedding - EmbeddingCorrection = - EmbeddingCorrection / + EmbeddingCorrection /= (EmbeddingCorrection - (EmbeddingCorrection - 1.) * exp(-pow((diLeptonMass - zmass), 2.) / (2. * pow(correction_deviation, 2.)))); EmbeddingCorrection = ((diLeptonMass + (EmbeddingCorrection - 1.) * zmass) / (diLeptonMass * EmbeddingCorrection)); - double correctedpositiveLeptonEnergy = std::sqrt( - muonMass_ * muonMass_ + EmbeddingCorrection * positiveLepton.Px() * EmbeddingCorrection * positiveLepton.Px() + - EmbeddingCorrection * positiveLepton.Py() * EmbeddingCorrection * positiveLepton.Py() + - EmbeddingCorrection * positiveLepton.Pz() * EmbeddingCorrection * positiveLepton.Pz()); - double correctednegativeLeptonEnergy = std::sqrt( - muonMass_ * muonMass_ + EmbeddingCorrection * negativeLepton.Px() * EmbeddingCorrection * negativeLepton.Px() + - EmbeddingCorrection * negativeLepton.Py() * EmbeddingCorrection * negativeLepton.Py() + - EmbeddingCorrection * negativeLepton.Pz() * EmbeddingCorrection * negativeLepton.Pz()); - positiveLepton.SetPxPyPzE(EmbeddingCorrection * positiveLepton.Px(), - EmbeddingCorrection * positiveLepton.Py(), - EmbeddingCorrection * positiveLepton.Pz(), - correctedpositiveLeptonEnergy); - negativeLepton.SetPxPyPzE(EmbeddingCorrection * negativeLepton.Px(), - EmbeddingCorrection * negativeLepton.Py(), - EmbeddingCorrection * negativeLepton.Pz(), - correctednegativeLeptonEnergy); - + double correctedpositiveLeptonEnergy = + std::sqrt((pow(muonMass_, 2) / pow(EmbeddingCorrection, 2)) + pow(positiveLepton.Px(), 2) + + pow(positiveLepton.Py(), 2) + pow(positiveLepton.Pz(), 2)); + double correctednegativeLeptonEnergy = + std::sqrt((pow(muonMass_, 2) / pow(EmbeddingCorrection, 2)) + pow(negativeLepton.Px(), 2) + + pow(negativeLepton.Py(), 2) + pow(negativeLepton.Pz(), 2)); + positiveLepton.SetE(correctedpositiveLeptonEnergy); + negativeLepton.SetE(correctednegativeLeptonEnergy); + positiveLepton *= EmbeddingCorrection; + negativeLepton *= EmbeddingCorrection; edm::LogInfo("TauEmbedding") << "MuMinus after. Pt: " << negativeLepton.Pt() << " Mass: " << negativeLepton.M(); - // std::cout << " MuMinus after. Pt: " << negativeLepton.Pt() << " Mass: " << negativeLepton.M() << " Energy: " << negativeLepton.E() << std::endl; } return; } diff --git a/TauAnalysis/MCEmbeddingTools/plugins/MuMuForEmbeddingSelector.cc b/TauAnalysis/MCEmbeddingTools/plugins/MuMuForEmbeddingSelector.cc index dd110d25e22ef..2bceab1cf15ef 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/MuMuForEmbeddingSelector.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/MuMuForEmbeddingSelector.cc @@ -59,7 +59,7 @@ class MuMuForEmbeddingSelector : public edm::stream::EDProducer<> { edm::EDGetTokenT> theMETLabel_; edm::EDGetTokenT> thePuppiMETLabel_; bool use_zmass = false; - double ZMass = 91.0; + static constexpr double zmass = 91.1876; }; // @@ -109,7 +109,7 @@ void MuMuForEmbeddingSelector::produce(edm::Event &iEvent, const edm::EventSetup const reco::CompositeCandidate *chosenZCand = nullptr; const reco::CompositeCandidate *chosenZCand_zmass = nullptr; const reco::CompositeCandidate *chosenZCand_largest = nullptr; - double massDifference = -1.0; + double massDifference = 9999; edm::Handle beamSpot; iEvent.getByToken(theBeamSpotLabel_, beamSpot); edm::Handle vertex; @@ -121,12 +121,10 @@ void MuMuForEmbeddingSelector::produce(edm::Event &iEvent, const edm::EventSetup // get primary vertex reco::Vertex::Point posVtx; reco::Vertex::Error errVtx; - std::vector::const_iterator vertexIt = vertex->begin(); - std::vector::const_iterator vertexEnd = vertex->end(); - for (; vertexIt != vertexEnd; ++vertexIt) { - if (vertexIt->isValid() && !vertexIt->isFake()) { - posVtx = vertexIt->position(); - errVtx = vertexIt->error(); + for (const auto &vtx : *vertex) { + if (vtx.isValid() && !vtx.isFake()) { + posVtx = vtx.position(); + errVtx = vtx.error(); break; } } @@ -135,8 +133,8 @@ void MuMuForEmbeddingSelector::produce(edm::Event &iEvent, const edm::EventSetup for (edm::View::const_iterator iZCand = ZmumuCandidates.begin(); iZCand != ZmumuCandidates.end(); ++iZCand) { - if (std::abs(ZMass - iZCand->mass()) < massDifference || massDifference < 0) { - massDifference = std::abs(ZMass - iZCand->mass()); + if (std::abs(zmass - iZCand->mass()) < massDifference) { + massDifference = std::abs(zmass - iZCand->mass()); chosenZCand_zmass = &(*iZCand); } } @@ -152,10 +150,8 @@ void MuMuForEmbeddingSelector::produce(edm::Event &iEvent, const edm::EventSetup } } if (use_zmass) { - // edm::LogDebug("MuMuForEmbeddingSelector") << "Using Z mass candidate" << chosenZCand_zmass->mass(); chosenZCand = chosenZCand_zmass; } else { - // edm::LogDebug("MuMuForEmbeddingSelector") << "Using largest mass candidate" << chosenZCand_largest->mass(); chosenZCand = chosenZCand_largest; } @@ -181,8 +177,6 @@ void MuMuForEmbeddingSelector::produce(edm::Event &iEvent, const edm::EventSetup iEvent.put(std::make_unique(met->at(0).phi()), "initialMETphi"); iEvent.put(std::make_unique(puppimet->at(0).et()), "initialPuppiMETEt"); iEvent.put(std::make_unique(puppimet->at(0).phi()), "initialPuppiMETphi"); - // edm::LogDebug("MuMuForEmbeddingSelector") << "PuppiMet: " << puppimet->at(0).et() << " phi: " << puppimet->at(0).phi(); - // edm::LogDebug("MuMuForEmbeddingSelector") << "MET: " << met->at(0).et() << " phi: " << met->at(0).phi(); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ diff --git a/TauAnalysis/MCEmbeddingTools/plugins/MuonDetCleaner.cc b/TauAnalysis/MCEmbeddingTools/plugins/MuonDetCleaner.cc index f32b9aac2a1f9..c315286497d1b 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/MuonDetCleaner.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/MuonDetCleaner.cc @@ -92,8 +92,8 @@ void MuonDetCleaner::produce(edm::Event &iEvent, edm::EventSetup const & // inspired from Muon Identification algorithm: https://github.com/cms-sw/cmssw/blob/3b943c0dbbdf4494cd66064a5a147301f38af295/RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc#L911 // and the MuonShowerDigiFiller: https://github.com/cms-sw/cmssw/blob/29909891e150c9781f4ade2a6f7b5beb0bd67a6e/RecoMuon/MuonIdentification/interface/MuonShowerDigiFiller.h & https://github.com/cms-sw/cmssw/blob/29909891e150c9781f4ade2a6f7b5beb0bd67a6e/RecoMuon/MuonIdentification/src/MuonShowerDigiFiller.cc for (const auto &chamber : info.chambers) { - if (chamber.id.subdetId() == MuonSubdetId::RPC) //&& rpcHitHandle_.isValid()) - continue; // Skip RPC chambers, they are taken care of below) + if (chamber.id.subdetId() == MuonSubdetId::RPC) + continue; reco::MuonChamberMatch matchedChamber; @@ -193,7 +193,6 @@ void MuonDetCleaner::produce(edm::Event &iEvent, edm::EventSetup const & iEvent.getByToken(input_.second, RecHitinput); for (typename RecHitCollection::const_iterator recHit = RecHitinput->begin(); recHit != RecHitinput->end(); ++recHit) { // loop over the basic rec hit collection (DT CSC or RPC) - // if (find(vetoHits.begin(),vetoHits.end(),getRawDetId(*recHit)) == vetoHits.end()) continue; // For the invertec selcetion if (find(vetoHits.begin(), vetoHits.end(), getRawDetId(*recHit)) != vetoHits.end()) continue; // If the hit is not in the T1 detId(getRawDetId(*recHit)); @@ -269,7 +268,6 @@ bool MuonDetCleaner::checkrecHit(const TrackingRecHit &re else if (hit_type == typeid(CSCRecHit2D)) { return true; } - // else {std::cout<<"else "<::checkrecHit(const TrackingRecHit } else if (hit_type == typeid(DTSLRecSegment2D)) { return true; } - // else {std::cout<<"else "<::checkrecHit(const TrackingRecHit &recH if (hit_type == typeid(RPCRecHit)) { return true; } // This should be the default one (which are included in the global (outer) muon track) - // else {std::cout<<"else "<::checkrecHit(const TrackingRecHit &rec if (hit_type == typeid(CSCSegment)) { return true; } // This should be the default one (which are included in the global (outer) muon track) - // else {std::cout<<"else "<::checkrecHit(const TrackingRecH } else if (hit_type == typeid(DTSLRecSegment2D)) { return true; } - // else {std::cout<<"else "<::produce(edm::Event &iEvent, const edm::EventSetup &iSet } // end instance } -// Here some overloaded functions, which are needed such that the right merger function is called for the indivudal Collections template void TrackMergeremb::willproduce(std::string instance, std::string alias) { produces(instance); @@ -125,10 +124,8 @@ void TrackMergeremb::merg_and_put( std::unique_ptr outTracks_refs = std::make_unique(); auto rTrackExtras = iEvent.getRefBeforePut(); - // auto rHits = iEvent.getRefBeforePut(); std::vector trackRefColl; - // std::vector trackRefColl; for (auto akt_collection : to_merge) { edm::Handle track_col_in; @@ -206,12 +203,10 @@ void TrackMergeremb::merg_and_put( edm::Handle track_new_col; iEvent.getByToken(inputs_fixtrackcol_, track_new_col); - std::map - simple_track_to_track_map; // I didn't find a more elegant way, so just build a good old fassion std::map + std::map simple_track_to_track_map; for (unsigned abc = 0; abc < track_new_col->size(); ++abc) { reco::TrackRef trackRef(track_new_col, abc); - simple_track_to_track_map[trackRef] = - trackRef; // catch the case, where a seed ctf track could already be updated, such that the update doesn't happen again + simple_track_to_track_map[trackRef] = trackRef; simple_track_to_track_map[((*track_ref_map)[trackRef])[0]] = trackRef; } @@ -344,8 +339,7 @@ void TrackMergeremb::merg_and_put(edm::Event &iEvent, edm::Handle track_new_col; iEvent.getByToken(inputs_fixtrackcol_, track_new_col); - std::map - simple_track_to_track_map; // I didn't find a more elegant way, so just build a good old fassion std::map + std::map simple_track_to_track_map; for (unsigned abc = 0; abc < track_new_col->size(); ++abc) { reco::TrackRef trackRef(track_new_col, abc); simple_track_to_track_map[trackRef] = @@ -368,7 +362,6 @@ void TrackMergeremb::merg_and_put(edm::Event &iEvent, reco::MuonRef muRefnew(outputMuonsRefProd, new_idx); if (it->track().isNonnull()) { - // std::cout<<"pfmerge tr: "<trackRef().id()<< " "<< it->trackRef().key()<< " " << simple_track_to_track_map[it->trackRef()].id() << " " << simple_track_to_track_map[it->trackRef()].key() <back().setTrack(simple_track_to_track_map[it->track()]); } } @@ -415,7 +408,6 @@ void TrackMergeremb::merg_and_put(edm::Event &iEvent, template <> void TrackMergeremb::willproduce(std::string instance, std::string alias) { produces(instance); - // std::cout<<"Produce PF Collection: "< @@ -439,8 +431,7 @@ void TrackMergeremb::merg_and_put( edm::Handle track_new_col; iEvent.getByToken(inputs_fixtrackcol_, track_new_col); - std::map - simple_track_to_track_map; // I didn't find a more elegant way, so just build a good old fassion std::map + std::map simple_track_to_track_map; for (unsigned abc = 0; abc < track_new_col->size(); ++abc) { reco::TrackRef trackRef(track_new_col, abc); simple_track_to_track_map[trackRef] = @@ -453,8 +444,7 @@ void TrackMergeremb::merg_and_put( edm::Handle gsftrack_new_col; iEvent.getByToken(inputs_fixgsftrackcol_, gsftrack_new_col); - std::map - simple_gsftrack_to_gsftrack_map; // I didn't find a more elegant way, so just build a good old fassion std::map + std::map simple_gsftrack_to_gsftrack_map; for (unsigned abc = 0; abc < gsftrack_new_col->size(); ++abc) { reco::GsfTrackRef gsfTrackRef(gsftrack_new_col, abc); simple_gsftrack_to_gsftrack_map[((*gsftrack_ref_map)[gsfTrackRef])[0]] = gsfTrackRef; @@ -465,8 +455,7 @@ void TrackMergeremb::merg_and_put( edm::Handle muon_new_col; iEvent.getByToken(inputs_fixmucol_, muon_new_col); - std::map - simple_mu_to_mu_map; // I didn't find a more elegant way, so just build a good old fassion std::map + std::map simple_mu_to_mu_map; for (unsigned abc = 0; abc < muon_new_col->size(); ++abc) { reco::MuonRef muRef(muon_new_col, abc); simple_mu_to_mu_map[(*muon_ref_map)[muRef]] = muRef; @@ -483,9 +472,7 @@ void TrackMergeremb::merg_and_put( iEvent.getByToken(akt_collection, track_col_in); for (reco::PFCandidateCollection::const_iterator it = track_col_in->begin(); it != track_col_in->end(); ++it) { outTracks->push_back(reco::PFCandidate(*it)); - // if (fabs(it->pdgId()) == 13){ if (it->trackRef().isNonnull() && outTracks->back().charge()) { - // std::cout<<"pfmerge tr: "<trackRef().id()<< " "<< it->trackRef().key()<< " " << simple_track_to_track_map[it->trackRef()].id() << " " << simple_track_to_track_map[it->trackRef()].key() <back().setTrackRef(simple_track_to_track_map[it->trackRef()]); } if (it->gsfTrackRef().isNonnull()) { @@ -495,7 +482,6 @@ void TrackMergeremb::merg_and_put( const reco::SuperClusterRef &pfScRef(it->superClusterRef()); float dx, dy, dz, dr; - // float drMin = std::numeric_limits::infinity(); float drMin = 10.0; // also used as treshold for matching reco::SuperClusterRef ccrefMin; for (auto sc = bSc; sc != eSc; ++sc) { @@ -511,7 +497,6 @@ void TrackMergeremb::merg_and_put( } } if (it->muonRef().isNonnull()) { - // std::cout<<"pfmerge mu: "<muonRef().id()<< " "<< it->muonRef().key()<< " " << simple_mu_to_mu_map[it->muonRef()].id() << " " << simple_mu_to_mu_map[it->muonRef()].key() <back().setMuonRef(simple_mu_to_mu_map[it->muonRef()]); } } diff --git a/TauAnalysis/MCEmbeddingTools/plugins/TrackMergeremb.h b/TauAnalysis/MCEmbeddingTools/plugins/TrackMergeremb.h index b3305102622a6..051e84bd9a904 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/TrackMergeremb.h +++ b/TauAnalysis/MCEmbeddingTools/plugins/TrackMergeremb.h @@ -3,11 +3,7 @@ * * \author Stefan Wayand; * Christian Veelken, LLR - * - * - * - * - * + * Clean Up from Christian Winter & Sebastian Brommer, KIT */ #ifndef TauAnalysis_MCEmbeddingTools_TrackMergeremb_H #define TauAnalysis_MCEmbeddingTools_TrackMergeremb_H @@ -65,7 +61,6 @@ class TrackMergeremb : public edm::stream::EDProducer<> { std::map>> inputs_; std::map>>> inputs_qual_; - // typedef edm::ValueMap TrackToTrackMapnew; typedef edm::ValueMap TrackToTrackMapnew; typedef edm::ValueMap GsfTrackToTrackMapnew; diff --git a/TauAnalysis/MCEmbeddingTools/plugins/TrackerCleaner.cc b/TauAnalysis/MCEmbeddingTools/plugins/TrackerCleaner.cc index 261f0d89c64ca..d9a219a560fdf 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/TrackerCleaner.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/TrackerCleaner.cc @@ -48,7 +48,6 @@ void TrackerCleaner::produce(edm::Event &iEvent, const edm::EventSetup &iSetu if (!iMuon->isGlobalMuon()) continue; const reco::Track *mutrack = iMuon->globalTrack().get(); - // reco::Track *mutrack = new reco::Track(*(iMuon->innerTrack() )); for (trackingRecHit_iterator hitIt = mutrack->recHitsBegin(); hitIt != mutrack->recHitsEnd(); ++hitIt) { const TrackingRecHit &murechit = **hitIt; if (!(murechit).isValid()) @@ -78,7 +77,6 @@ void TrackerCleaner::produce(edm::Event &iEvent, const edm::EventSetup &iSetu idx++; if (vetodClusters[idx - 1]) continue; - // if (!vetodClusters[idx-1]) continue; for inverted selction spc.push_back(*clustIt); } } diff --git a/TauAnalysis/MCEmbeddingTools/python/DYToElElGenFilter_cfi.py b/TauAnalysis/MCEmbeddingTools/python/DYToElElGenFilter_cfi.py deleted file mode 100644 index ca816bf1eaf72..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/python/DYToElElGenFilter_cfi.py +++ /dev/null @@ -1,7 +0,0 @@ -import FWCore.ParameterSet.Config as cms - - -dyToElElGenFilter = cms.EDFilter("DYToElElGenFilter", - inputTag = cms.InputTag("genParticles"), - #filter = cms.bool(True) - ) diff --git a/TauAnalysis/MCEmbeddingTools/python/DYToElTauGenFilter_cfi.py b/TauAnalysis/MCEmbeddingTools/python/DYToElTauGenFilter_cfi.py deleted file mode 100644 index a48d967386197..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/python/DYToElTauGenFilter_cfi.py +++ /dev/null @@ -1,6 +0,0 @@ -import FWCore.ParameterSet.Config as cms - - -dyToElTauGenFilter = cms.EDFilter("DYToElTauGenFilter", - inputTag = cms.InputTag("genParticles"), - filter = cms.bool(True)) diff --git a/TauAnalysis/MCEmbeddingTools/python/DYToMuMuGenFilter_cfi.py b/TauAnalysis/MCEmbeddingTools/python/DYToMuMuGenFilter_cfi.py deleted file mode 100644 index 7e4bc2d936324..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/python/DYToMuMuGenFilter_cfi.py +++ /dev/null @@ -1,5 +0,0 @@ -import FWCore.ParameterSet.Config as cms - - -dYToMuMuGenFilter = cms.EDFilter("DYToMuMuGenFilter", - inputTag = cms.InputTag("prunedGenParticles")) diff --git a/TauAnalysis/MCEmbeddingTools/python/DYToMuTauGenFilter_cfi.py b/TauAnalysis/MCEmbeddingTools/python/DYToMuTauGenFilter_cfi.py deleted file mode 100644 index 39aa66546d2ed..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/python/DYToMuTauGenFilter_cfi.py +++ /dev/null @@ -1,6 +0,0 @@ -import FWCore.ParameterSet.Config as cms - - -dyToMuTauGenFilter = cms.EDFilter("DYToMuTauGenFilter", - inputTag = cms.InputTag("genParticles"), - filter = cms.bool(True)) diff --git a/TauAnalysis/MCEmbeddingTools/python/DYToTauTauGenFilter_cfi.py b/TauAnalysis/MCEmbeddingTools/python/DYToTauTauGenFilter_cfi.py deleted file mode 100644 index c3e547327f8e0..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/python/DYToTauTauGenFilter_cfi.py +++ /dev/null @@ -1,6 +0,0 @@ -import FWCore.ParameterSet.Config as cms - - -dyToTauTauGenFilter = cms.EDFilter("DYToTauTauGenFilter", - inputTag = cms.InputTag("genParticles"), - filter = cms.bool(True)) diff --git a/TauAnalysis/MCEmbeddingTools/python/customisers.py b/TauAnalysis/MCEmbeddingTools/python/customisers.py index ecde79c05c6f9..3cce2db3c0f5e 100644 --- a/TauAnalysis/MCEmbeddingTools/python/customisers.py +++ b/TauAnalysis/MCEmbeddingTools/python/customisers.py @@ -206,9 +206,6 @@ def __init__( to_bemanipulate.append( module_manipulate(module_name="hfreco", manipulator_name="HFRecHit") ) -to_bemanipulate.append( - module_manipulate(module_name="castorreco", manipulator_name="CastorRecHit") -) to_bemanipulate.append( @@ -569,69 +566,6 @@ def keepSimulated(process, processname="SIMembedding"): ret_vstring.append(entry) return ret_vstring - -def customiseGenerator(process, changeProcessname=True, reselect=False): - if reselect: - dataTier = "RESELECT" - else: - dataTier = "SELECT" - if changeProcessname: - process._Process__name = "SIMembedding" - - ## here correct the vertex collection - - process.load("TauAnalysis.MCEmbeddingTools.EmbeddingVertexCorrector_cfi") - process.VtxSmeared = process.VtxCorrectedToInput.clone() - print( - "Correcting Vertex in genEvent to one from input. Replaced 'VtxSmeared' with the Corrector." - ) - process.load("TauAnalysis.MCEmbeddingTools.EmbeddingBeamSpotOnline_cfi") - process.hltOnlineBeamSpot = process.onlineEmbeddingBeamSpotProducer.clone() - print( - "Setting online beam spot in HLTSchedule to the one from input data. Replaced 'hltOnlineBeamSpot' with the offline beam spot." - ) - - # Remove BeamSpot Production, use the one from selected data instead. - process.reconstruction.remove(process.offlineBeamSpot) - - # Disable noise simulation - process.mix.digitizers.castor.doNoise = cms.bool(False) - - process.mix.digitizers.ecal.doESNoise = cms.bool(False) - process.mix.digitizers.ecal.doENoise = cms.bool(False) - - process.mix.digitizers.hcal.doNoise = cms.bool(False) - process.mix.digitizers.hcal.doThermalNoise = cms.bool(False) - process.mix.digitizers.hcal.doHPDNoise = cms.bool(False) - - process.mix.digitizers.pixel.AddNoisyPixels = cms.bool(False) - process.mix.digitizers.pixel.AddNoise = cms.bool(False) - - process.mix.digitizers.strip.Noise = cms.bool(False) - - # Replace HLT vertexing with vertex taken from LHE step - process.load("TauAnalysis.MCEmbeddingTools.EmbeddingHltPixelVerticesProducer_cfi") - process.hltPixelVertices = process.embeddingHltPixelVertices.clone() - process.offlinePrimaryVertices = process.embeddingHltPixelVertices.clone() - process.firstStepPrimaryVerticesUnsorted = process.embeddingHltPixelVertices.clone() - process.firstStepPrimaryVerticesPreSplitting = ( - process.embeddingHltPixelVertices.clone() - ) - - process = customisoptions(process) - ##process = fix_input_tags(process) - - return modify_outputModules( - process, - [keepSelected(dataTier), keepCleaned(dataTier), keepSimulated(process)], - ["AODSIMoutput"], - ) - - -def customiseGenerator_Reselect(process): - return customiseGenerator(process, reselect=True) - - def customiseGenerator_preHLT(process, changeProcessname=True, reselect=False): if reselect: dataTier = "RESELECT"