New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RecoTauTag] migration to stage-2 L1 #13480
Merged
cmsbuild
merged 9 commits into
cms-sw:CMSSW_8_0_X
from
rmanzoni:CMSSW_8_0_0_patch1_stage_2_migration
Mar 1, 2016
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b4c7e04
migration to stage-2 L1 - HLT modules
rmanzoni 5c153a7
oops
rmanzoni 9c507ed
purge the last stage-1 remnants
rmanzoni af48bc7
don't add modules that won't be used anyways
rmanzoni 14b4323
clean up from unusel L1 Jets, fix stage-2 Tau collection
rmanzoni 6dc9658
fix descriptions
rmanzoni 4af34f0
update trigger::TriggerL1Tau
rmanzoni 05d4b23
make BX parameter tracked
rmanzoni 65e2dbd
make new modules available
rmanzoni File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
RecoTauTag/HLTProducers/interface/CaloTowerFromL1TCreatorForTauHLT.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#ifndef CaloTowerCreator_CaloTowerFromL1TCreatorForTauHLT_h | ||
#define CaloTowerCreator_CaloTowerFromL1TCreatorForTauHLT_h | ||
|
||
/** \class CaloTowerFromL1TCreatorForTauHLT | ||
* | ||
* Framework module that produces a collection | ||
* of calo towers in the region of interest for Tau HLT reconnstruction, | ||
* depending on tau type trigger: | ||
* Tau1 - take location of 1st L1 Tau | ||
* Tau2 - take location of 2nd L1 Tau; if does not exists, | ||
* take location of 1st Calo Tower | ||
* ETau - take L1 Tau candidate which is not collinear | ||
* to HLT (or L1) electron candidate. | ||
* | ||
* \author A. Nikitenko. IC. based on L. Lista and J. Mans | ||
* | ||
*/ | ||
|
||
#include "FWCore/Framework/interface/global/EDProducer.h" | ||
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
#include "DataFormats/CaloTowers/interface/CaloTower.h" | ||
#include "DataFormats/L1Trigger/interface/Tau.h" | ||
#include <string> | ||
|
||
namespace edm { | ||
class ParameterSet; | ||
} | ||
|
||
class CaloTowerFromL1TCreatorForTauHLT : public edm::global::EDProducer<> { | ||
public: | ||
/// constructor from parameter set | ||
CaloTowerFromL1TCreatorForTauHLT( const edm::ParameterSet & ); | ||
/// destructor | ||
~CaloTowerFromL1TCreatorForTauHLT(); | ||
/// | ||
static void fillDescriptions( edm::ConfigurationDescriptions& desc ); | ||
|
||
private: | ||
/// process one event | ||
void produce( edm::StreamID sid, edm::Event& evt, const edm::EventSetup& stp ) const override; | ||
|
||
/// bunch crossing | ||
const int mBX; | ||
/// verbosity | ||
const int mVerbose; | ||
/// label of source collection | ||
const edm::EDGetTokenT<CaloTowerCollection> mtowers_token; | ||
/// use only towers in cone mCone around L1 candidate for regional jet reco | ||
const double mCone; | ||
/// label of tau trigger type analysis | ||
const edm::EDGetTokenT<l1t::TauBxCollection> mTauTrigger_token; | ||
/// imitator of L1 seeds | ||
//edm::InputTag ml1seeds; | ||
/// ET threshold | ||
const double mEtThreshold; | ||
/// E threshold | ||
const double mEThreshold; | ||
// | ||
const int mTauId; | ||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef L1THLTTauMatching_H | ||
#define L1THLTTauMatching_H | ||
|
||
// user include files | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/global/EDProducer.h" | ||
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Utilities/interface/InputTag.h" | ||
#include "DataFormats/Common/interface/Handle.h" | ||
#include "DataFormats/L1Trigger/interface/Tau.h" | ||
#include "DataFormats/JetReco/interface/CaloJetCollection.h" | ||
#include "DataFormats/TauReco/interface/PFTauFwd.h" | ||
#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" | ||
|
||
|
||
#include <map> | ||
#include <vector> | ||
class L1THLTTauMatching: public edm::global::EDProducer<> { | ||
public: | ||
explicit L1THLTTauMatching(const edm::ParameterSet&); | ||
~L1THLTTauMatching(); | ||
virtual void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; | ||
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); | ||
|
||
private: | ||
|
||
const edm::EDGetTokenT<reco::PFTauCollection> jetSrc; | ||
const edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> tauTrigger; | ||
const double mEt_Min; | ||
|
||
}; | ||
#endif |
107 changes: 107 additions & 0 deletions
107
RecoTauTag/HLTProducers/src/CaloTowerFromL1TCreatorForTauHLT.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
// makes CaloTowerCandidates from CaloTowers | ||
// original author: L.Lista INFN, modifyed by: F.Ratnikov UMd | ||
// Author for regionality A. Nikitenko | ||
// Modified by S. Gennai | ||
|
||
#include "DataFormats/RecoCandidate/interface/RecoCaloTowerCandidate.h" | ||
#include "DataFormats/Common/interface/Handle.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "RecoTauTag/HLTProducers/interface/CaloTowerFromL1TCreatorForTauHLT.h" | ||
// Math | ||
#include "Math/GenVector/VectorUtil.h" | ||
#include <cmath> | ||
|
||
using namespace edm ; | ||
using namespace reco; | ||
using namespace std ; | ||
|
||
CaloTowerFromL1TCreatorForTauHLT::CaloTowerFromL1TCreatorForTauHLT( const ParameterSet & p ) | ||
: | ||
mBX (p.getUntrackedParameter<int> ("BX" , 0) ), | ||
mVerbose (p.getUntrackedParameter<int> ("verbose" , 0) ), | ||
mtowers_token (consumes<CaloTowerCollection> (p.getParameter<InputTag> ("towers" ))), | ||
mCone (p.getParameter<double> ("UseTowersInCone" ) ), | ||
mTauTrigger_token (consumes<l1t::TauBxCollection> (p.getParameter<InputTag> ("TauTrigger" ))), | ||
mEtThreshold (p.getParameter<double> ("minimumEt" ) ), | ||
mEThreshold (p.getParameter<double> ("minimumE" ) ), | ||
mTauId (p.getParameter<int> ("TauId" ) ) | ||
{ | ||
produces<CaloTowerCollection>(); | ||
} | ||
|
||
CaloTowerFromL1TCreatorForTauHLT::~CaloTowerFromL1TCreatorForTauHLT() { | ||
} | ||
|
||
void CaloTowerFromL1TCreatorForTauHLT::produce( StreamID sid, Event& evt, const EventSetup& stp ) const { | ||
edm::Handle<CaloTowerCollection> caloTowers; | ||
evt.getByToken( mtowers_token, caloTowers ); | ||
|
||
// imitate L1 seeds | ||
edm::Handle<l1t::TauBxCollection> jetsgen; | ||
evt.getByToken( mTauTrigger_token, jetsgen); | ||
|
||
std::auto_ptr<CaloTowerCollection> cands( new CaloTowerCollection ); | ||
cands->reserve( caloTowers->size() ); | ||
|
||
int idTau = 0; | ||
if (jetsgen.isValid()){ | ||
for (auto myL1Jet = jetsgen->begin(mBX); myL1Jet != jetsgen->end(mBX); myL1Jet++){ | ||
if(idTau == mTauId){ | ||
double Sum08 = 0.; | ||
unsigned idx = 0 ; | ||
for (; idx < caloTowers->size(); idx++) { | ||
const CaloTower* cal = &((*caloTowers) [idx]); | ||
bool isAccepted = false; | ||
if (mVerbose == 2) { | ||
edm::LogInfo("JetDebugInfo") << "CaloTowerFromL1TCreatorForTauHLT::produce-> " << idx | ||
<< " tower et/eta/phi/e: " << cal->et() << '/' | ||
<< cal->eta() << '/' | ||
<< cal->phi() << '/' | ||
<< cal->energy() | ||
<< " is..."; | ||
} | ||
if (cal->et() >= mEtThreshold && cal->energy() >= mEThreshold ) { | ||
math::PtEtaPhiELorentzVector p( cal->et(), cal->eta(), cal->phi(), cal->energy() ); | ||
double delta = ROOT::Math::VectorUtil::DeltaR((*myL1Jet).p4().Vect(), p); | ||
if(delta < mCone) { | ||
isAccepted = true; | ||
Sum08 += cal->et(); | ||
cands->push_back( *cal ); | ||
} | ||
} | ||
if (mVerbose == 2){ | ||
if (isAccepted) edm::LogInfo("JetDebugInfo") << "accepted \n"; | ||
else edm::LogInfo("JetDebugInfo") << "rejected \n"; | ||
} | ||
} | ||
} | ||
idTau++; | ||
} | ||
} | ||
else { | ||
edm::LogWarning("MissingProduct") << "L1Upgrade jet bx collection not found." << std::endl; | ||
} | ||
|
||
evt.put( cands ); | ||
|
||
} | ||
|
||
void CaloTowerFromL1TCreatorForTauHLT::fillDescriptions( edm::ConfigurationDescriptions & desc ) { | ||
|
||
edm::ParameterSetDescription aDesc; | ||
|
||
aDesc.add<edm::InputTag>("TauTrigger" , edm::InputTag("caloStage2Digis"))->setComment("L1 Tau collection for seeding" ); | ||
aDesc.add<edm::InputTag>("towers" , edm::InputTag("towerMaker" ))->setComment("Input tower collection" ); | ||
aDesc.add<int> ("TauId" , 0 )->setComment("Item from L1 Tau collection used for seeding. From 0 to 11" ); | ||
aDesc.add<double> ("UseTowersInCone", 0.8 )->setComment("Radius of cone around seed" ); | ||
aDesc.add<double> ("minimumE" , 0.8 )->setComment("Minimum tower energy" ); | ||
aDesc.add<double> ("minimumEt" , 0.5 )->setComment("Minimum tower ET" ); | ||
aDesc.addUntracked<int> ("verbose" , 0 )->setComment("Verbosity level; 0=silent" ); | ||
aDesc.addUntracked<int> ("BX" , 0 )->setComment("Set bunch crossing; 0 = in time, -1 = previous, 1 = following"); | ||
|
||
desc.add ("CaloTowerFromL1TCreatorForTauHLT", aDesc); | ||
desc.setComment ("Produce tower collection around L1 particle seed."); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#include "RecoTauTag/HLTProducers/interface/L1THLTTauMatching.h" | ||
#include "Math/GenVector/VectorUtil.h" | ||
#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" | ||
#include "FWCore/Utilities/interface/EDMException.h" | ||
#include "DataFormats/TauReco/interface/PFTau.h" | ||
|
||
// | ||
// class decleration | ||
// | ||
using namespace reco ; | ||
using namespace std ; | ||
using namespace edm ; | ||
using namespace trigger; | ||
|
||
L1THLTTauMatching::L1THLTTauMatching(const edm::ParameterSet& iConfig): | ||
jetSrc ( consumes<PFTauCollection> (iConfig.getParameter<InputTag>("JetSrc" ) ) ), | ||
tauTrigger( consumes<trigger::TriggerFilterObjectWithRefs>(iConfig.getParameter<InputTag>("L1TauTrigger") ) ), | ||
mEt_Min ( iConfig.getParameter<double> ("EtMin" ) ) | ||
{ | ||
produces<PFTauCollection>(); | ||
} | ||
L1THLTTauMatching::~L1THLTTauMatching(){ } | ||
|
||
void L1THLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm::EventSetup& iES) const | ||
{ | ||
|
||
auto_ptr<PFTauCollection> tauL2jets(new PFTauCollection); | ||
|
||
double deltaR = 1.0; | ||
double matchingR = 0.5; | ||
|
||
// Getting HLT jets to be matched | ||
edm::Handle<PFTauCollection > tauJets; | ||
iEvent.getByToken( jetSrc, tauJets ); | ||
|
||
edm::Handle<trigger::TriggerFilterObjectWithRefs> l1TriggeredTaus; | ||
iEvent.getByToken(tauTrigger,l1TriggeredTaus); | ||
|
||
l1t::TauVectorRef tauCandRefVec; | ||
l1TriggeredTaus->getObjects( trigger::TriggerL1TauJet,tauCandRefVec); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be trigger::TriggerL1Tau - see cms-l1t-offline#156 (comment) |
||
|
||
math::XYZPoint a(0.,0.,0.); | ||
|
||
for(unsigned int iL1Tau = 0; iL1Tau < tauCandRefVec.size(); iL1Tau++){ | ||
for(unsigned int iJet = 0; iJet < tauJets->size(); iJet++){ | ||
// Find the relative L2TauJets, to see if it has been reconstructed | ||
const PFTau & myJet = (*tauJets)[iJet]; | ||
deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect()); | ||
if(deltaR < matchingR ) { | ||
if(myJet.leadPFChargedHadrCand().isNonnull()){ | ||
a = myJet.leadPFChargedHadrCand()->vertex(); | ||
} | ||
PFTau myPFTau(std::numeric_limits<int>::quiet_NaN(), myJet.p4(), a); | ||
if(myJet.pt() > mEt_Min) { | ||
tauL2jets->push_back(myPFTau); | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
|
||
iEvent.put(tauL2jets); | ||
} | ||
|
||
void L1THLTTauMatching::fillDescriptions(edm::ConfigurationDescriptions& descriptions) | ||
{ | ||
edm::ParameterSetDescription desc; | ||
desc.add<edm::InputTag>("L1TauTrigger", edm::InputTag("hltL1sDoubleIsoTau40er" ))->setComment("Name of trigger filter" ); | ||
desc.add<edm::InputTag>("JetSrc" , edm::InputTag("hltSelectedPFTausTrackPt1MediumIsolationReg"))->setComment("Input collection of PFTaus"); | ||
desc.add<double> ("EtMin",0.0)->setComment("Minimal pT of PFTau to match"); | ||
descriptions.setComment("This module produces collection of PFTaus matched to L1 Taus / Jets passing a HLT filter (Only p4 and vertex of returned PFTaus are set)."); | ||
descriptions.add ("L1THLTTauMatching",desc); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes physics so must be tracked.