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
Changes from 5 commits
b4c7e04
5c153a7
9c507ed
af48bc7
14b4323
6dc9658
4af34f0
05d4b23
65e2dbd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
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 |
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 ("caloTowerMakerHLT", aDesc); | ||
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. The string should be the class name, at most starting with a lower-case 'c'. 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. you mean something like: |
||
desc.setComment ("Produce tower collection around L1 particle seed."); | ||
|
||
} |
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 ("L1HLTJetsMatching",desc); | ||
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. The string should be "L1THLTJetsMatching" or "l1tHLTJetsMatching" |
||
} |
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.