|
|
Go to the documentation of this file.
9 #include "TDirectory.h"
11 #include "TLorentzVector.h"
12 #include "TInterpreter.h"
142 std::map<std::pair<unsigned int, std::string>,
int>
l1AlgoMap_;
148 verbosity_(iConfig.getUntrackedParameter<
int>(
"Verbosity", 0)),
150 theTrackQuality_(iConfig.getUntrackedParameter<
std::
string>(
"TrackQuality",
"highPurity")),
151 a_coneR_(iConfig.getUntrackedParameter<double>(
"ConeRadius", 34.98)),
152 a_charIsoR_(a_coneR_ + 28.9),
153 a_mipR_(iConfig.getUntrackedParameter<double>(
"ConeRadiusMIP", 14.0)),
189 tok_L1extTauJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraTauJetSource_);
190 tok_L1extCenJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraCenJetSource_);
191 tok_L1extFwdJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraFwdJetSource_);
209 tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
210 tok_magField_ = esConsumes<MagneticField, IdealMagneticFieldRecord>();
220 std::vector<std::string>
seeds = {
221 "L1_SingleJet36",
"L1_SingleJet52",
"L1_SingleJet68",
"L1_SingleJet92",
"L1_SingleJet128"};
223 desc.addUntracked<
int>(
"Verbosity", 0);
224 desc.addUntracked<std::vector<std::string> >(
"L1Seed",
seeds);
226 desc.addUntracked<
double>(
"MinTrackPt", 10.0);
227 desc.addUntracked<
double>(
"MaxDxyPV", 0.02);
228 desc.addUntracked<
double>(
"MaxDzPV", 0.02);
229 desc.addUntracked<
double>(
"MaxChi2", 5.0);
230 desc.addUntracked<
double>(
"MaxDpOverP", 0.1);
231 desc.addUntracked<
int>(
"MinOuterHit", 4);
232 desc.addUntracked<
int>(
"MinLayerCrossed", 8);
233 desc.addUntracked<
int>(
"MaxInMiss", 0);
234 desc.addUntracked<
int>(
"MaxOutMiss", 0);
235 desc.addUntracked<
double>(
"ConeRadius", 34.98);
236 desc.addUntracked<
double>(
"ConeRadiusMIP", 14.0);
237 desc.addUntracked<
bool>(
"IsItAOD",
false);
238 descriptions.
add(
"isoTrackCalib",
desc);
246 <<
iEvent.luminosityBlock() <<
" Bunch " <<
iEvent.bunchCrossing()
247 <<
" starts ==========";
268 for (
unsigned iGenJet = 0; iGenJet <
genJets->size(); ++iGenJet) {
270 double genJetPt = genJet.
pt();
271 double genJetEta = genJet.
eta();
274 if (genJetEta > -2.5 && genJetEta < 2.5) {
292 if (!recVtxs->empty() && !((*recVtxs)[0].isFake())) {
293 leadPV =
math::XYZPoint((*recVtxs)[0].
x(), (*recVtxs)[0].
y(), (*recVtxs)[0].
z());
294 }
else if (beamSpotH.
isValid()) {
313 for (rhitItr =
hbhe->begin(); rhitItr !=
hbhe->end(); rhitItr++) {
314 double rec_energy = rhitItr->energy();
315 int rec_ieta = rhitItr->id().ieta();
316 int rec_depth = rhitItr->id().depth();
317 int rec_zside = rhitItr->id().zside();
318 double num1_1 = rec_zside * (rec_ieta + 0.2 * (rec_depth - 1));
321 <<
" = " << rhitItr->id() <<
"/" << rec_energy <<
"/" << rec_ieta <<
"/" << rec_zside
322 <<
"/" << rec_depth <<
"/" << num1_1;
330 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
332 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
333 for (trkDetItr = trkCaloDirections.begin(); trkDetItr != trkCaloDirections.end(); trkDetItr++) {
334 if (trkDetItr->okHCAL) {
336 int tk_ieta = detId.
ieta();
337 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
338 double tk_p = pTrack->
p();
340 for (
unsigned int k = 1;
k <
pbin.size(); ++
k) {
361 <<
"\nNo valid L1 trigger configuration available."
362 <<
"\nSee text above for error code interpretation"
363 <<
"\nNo return here, in order to test each method"
364 <<
", protected against configuration error.";
372 std::vector<int> algbits;
373 for (
CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
375 int algBitNumber = (itAlgo->second).algoBitNumber();
380 edm::LogVerbatim(
"IsoTrack") << algName <<
" " << algBitNumber <<
" " << decision;
381 for (
unsigned int i = 0;
i <
l1Names_.size(); ++
i) {
382 if (algName.find(
l1Names_[
i]) != std::string::npos) {
385 <<
" " << algName <<
" " << decision;
397 l1extra::L1JetParticleCollection::const_iterator itr;
398 double ptTriggered = -10;
399 double etaTriggered = -100;
400 double phiTriggered = -100;
402 for (itr = l1TauHandle->begin(); itr != l1TauHandle->end(); ++itr) {
403 if (itr->pt() > ptTriggered) {
404 ptTriggered = itr->pt();
405 etaTriggered = itr->eta();
406 phiTriggered = itr->phi();
409 edm::LogVerbatim(
"IsoTrack") <<
"tauJ pt " << itr->pt() <<
" eta/phi " << itr->eta() <<
" " << itr->phi();
413 for (itr = l1CenJetHandle->begin(); itr != l1CenJetHandle->end(); ++itr) {
414 if (itr->pt() > ptTriggered) {
415 ptTriggered = itr->pt();
416 etaTriggered = itr->eta();
417 phiTriggered = itr->phi();
420 edm::LogVerbatim(
"IsoTrack") <<
"cenJ pt " << itr->pt() <<
" eta/phi " << itr->eta() <<
" "
425 for (itr = l1FwdJetHandle->begin(); itr != l1FwdJetHandle->end(); ++itr) {
426 if (itr->pt() > ptTriggered) {
427 ptTriggered = itr->pt();
428 etaTriggered = itr->eta();
429 phiTriggered = itr->phi();
432 edm::LogVerbatim(
"IsoTrack") <<
"forJ pt " << itr->pt() <<
" eta/phi " << itr->eta() <<
" " << itr->phi();
435 edm::LogVerbatim(
"IsoTrack") <<
"jets pt/eta/phi = " << ptTriggered <<
"/" << etaTriggered <<
"/"
438 unsigned int nTracks(0), nselTracks(0);
439 for (trkDetItr = trkCaloDirections.begin(),
nTracks = 0; trkDetItr != trkCaloDirections.end();
441 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
444 t_mindR1 =
deltaR(etaTriggered, v4.eta(), phiTriggered, v4.phi());
448 << pTrack->
eta() <<
"/" << pTrack->
phi() <<
"/" << pTrack->
p();
464 oneCutParameters.
maxDzPV = 100;
470 oneCutParameters.
maxDzPV = 100;
477 if (trkDetItr->okHCAL) {
482 edm::LogVerbatim(
"IsoTrack") <<
"qltyFlag|okECAL|okHCAL : " << qltyFlag <<
"|" << trkDetItr->okECAL <<
"/"
483 << trkDetItr->okHCAL;
484 t_qltyFlag = (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL);
487 for (
unsigned int k = 1;
k <
pbin.size(); ++
k) {
496 for (
unsigned int k = 1;
k <
pbin.size(); ++
k) {
502 int nRH_eMipDR(0), nNearTRKs(0), nRecHits(-999);
506 trkDetItr->pointHCAL,
507 trkDetItr->pointECAL,
509 trkDetItr->directionECAL,
513 std::vector<DetId> ids;
516 trkDetItr->pointHCAL,
517 trkDetItr->pointECAL,
519 trkDetItr->directionHCAL,
523 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
530 for (
unsigned int k = 1;
k <
pbin.size(); ++
k) {
538 for (
unsigned int k = 1;
k <
pbin.size(); ++
k) {
546 for (
unsigned int k = 1;
k <
pbin.size(); ++
k) {
557 << pTrack->
eta() <<
"/" << pTrack->
phi() <<
"/" <<
t_p;
561 for (
unsigned int lll = 0; lll <
t_DetIds->size(); lll++) {
581 double prange[5] = {20, 30, 40, 60, 100};
582 for (
int k = 0;
k < 5; ++
k)
583 pbin.push_back(prange[
k]);
584 std::string type[6] = {
"All",
"Trigger OK",
"Tree Selected",
"Charge Isolation",
"MIP Cut",
"L1 Cut"};
585 for (
unsigned int k = 0;
k <
pbin.size(); ++
k) {
588 sprintf(namp,
"all momentum");
590 sprintf(namp,
"p = %4.0f:%4.0f GeV",
pbin[
k - 1],
pbin[
k]);
591 sprintf(
name,
"TrackEta0%d",
k);
592 sprintf(
title,
"Track #eta for tracks with %s (%s)", namp,
type[0].c_str());
594 sprintf(
name,
"TrackEta1%d",
k);
595 sprintf(
title,
"Track #eta for tracks with %s (%s)", namp,
type[1].c_str());
597 sprintf(
name,
"TrackEta2%d",
k);
598 sprintf(
title,
"Track #eta for tracks with %s (%s)", namp,
type[2].c_str());
600 sprintf(
name,
"TrackEta3%d",
k);
601 sprintf(
title,
"Track #eta for tracks with %s (%s)", namp,
type[3].c_str());
603 sprintf(
name,
"TrackEta4%d",
k);
604 sprintf(
title,
"Track #eta for tracks with %s (%s)", namp,
type[4].c_str());
606 sprintf(
name,
"TrackEta5%d",
k);
607 sprintf(
title,
"Track #eta for tracks with %s (%s)", namp,
type[5].c_str());
610 h_jetpt[0] =
fs_->
make<TH1F>(
"Jetpt0",
"Jet p_T (All)", 500, 0., 2500.);
611 h_jetpt[1] =
fs_->
make<TH1F>(
"Jetpt1",
"Jet p_T (All Weighted)", 500, 0., 2500.);
612 h_jetpt[2] =
fs_->
make<TH1F>(
"Jetpt2",
"Jet p_T (|#eta| < 2.5)", 500, 0., 2500.);
613 h_jetpt[3] =
fs_->
make<TH1F>(
"Jetpt3",
"Jet p_T (|#eta| < 2.5 Weighted)", 500, 0., 2500.);
617 tree->Branch(
"t_Run", &
t_Run,
"t_Run/I");
627 tree->Branch(
"t_p", &
t_p,
"t_p/D");
638 t_DetIds =
new std::vector<unsigned int>();
641 tree->Branch(
"t_DetIds",
"std::vector<unsigned int>", &
t_DetIds);
643 tree->Branch(
"t_l1bits",
"std::vector<bool>", &
t_l1bits);
648 bool changed =
false;
659 for (
CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
661 int algBitNumber = (itAlgo->second).algoBitNumber();
662 l1AlgoMap_.insert(std::pair<std::pair<unsigned int, std::string>,
int>(
663 std::pair<unsigned int, std::string>(algBitNumber, algName), 0));
665 std::map<std::pair<unsigned int, std::string>,
int>::iterator itr;
668 edm::LogVerbatim(
"IsoTrack") <<
" ********** " << (itr->first).
first <<
" " << (itr->first).second <<
" "
683 double phi1 =
vec1.phi();
686 double phi2 =
vec2.phi();
689 double dphi = phi1 - phi2;
692 else if (dphi < -
M_PI)
700 return std::sqrt(deta * deta + dphi * dphi);
709 double dphi = phi1 - phi2;
712 else if (dphi < -
M_PI)
714 return std::sqrt(deta * deta + dphi * dphi);
static const bool useL1EventSetup(true)
std::vector< T >::const_iterator const_iterator
Jets made from MC generator particles.
const edm::EDGetTokenT< reco::GenJetCollection > tok_jets_
std::vector< double > vec1
std::vector< GenJet > GenJetCollection
collection of GenJet objects
void beginRun(edm::Run const &, edm::EventSetup const &) override
const edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
void endRun(edm::Run const &, edm::EventSetup const &) override
double p() const
momentum vector magnitude
IsoTrackCalib(const edm::ParameterSet &)
std::vector< double > pbin
std::vector< Vertex > VertexCollection
collection of Vertex objects
void getL1GtRunCache(const edm::Run &, const edm::EventSetup &, const bool, const bool)
get all the run-constant quantities for L1 trigger and cache them
std::vector< unsigned int > * t_DetIds
std::vector< bool > * t_l1bits
static const bool useL1GtTriggerMenuLite(true)
TrackQuality
track quality
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
double px() const
x coordinate of momentum vector
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
T getUntrackedParameter(std::string const &, T const &) const
const bool decision(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
double pt() const final
transverse momentum
const std::vector< std::string > l1Names_
const edm::EDGetTokenT< reco::BeamSpot > tok_bs_
~IsoTrackCalib() override
std::map< std::pair< unsigned int, std::string >, int > l1AlgoMap_
double pt() const
track transverse momentum
#define DEFINE_FWK_MODULE(type)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::Service< TFileService > fs_
double py() const
y coordinate of momentum vector
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
double dPhi(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
const edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
HLTConfigProvider hltConfig_
const Point & position() const
position
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
double phi() const
azimuthal angle of momentum vector
const bool availableL1Configuration(int &errorCode, int &l1ConfCode) const
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_L1extFwdJet_
double deltaR(double eta1, double eta2, double phi1, double phi2)
constexpr int ieta() const
get the cell ieta
XYZPointD XYZPoint
point in space with cartesian internal representation
double eta() const final
momentum pseudorapidity
double dEta(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
double eta() const
pseudorapidity of momentum vector
const edm::EDGetTokenT< reco::PFJetCollection > tok_pfjets_
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_L1extTauJet_
double eCone_hcal(const CaloGeometry *geo, edm::Handle< T > &hits, const GlobalPoint &hpoint1, const GlobalPoint &point1, double dR, const GlobalVector &trackMom, int &nRecHits, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, int detOnly=-1, int useRaw=0, bool debug=false)
reco::TrackBase::TrackQuality minQuality
bool getData(T &iHolder) const
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
static TrackQuality qualityByName(const std::string &name)
spr::trackSelectionParameters selectionParameters_
std::vector< double > * t_HitEnergies
void analyze(const edm::Event &, const edm::EventSetup &) override
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
std::vector< PFJet > PFJetCollection
collection of PFJet objects
double dR(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
const edm::EDGetTokenT< GenEventInfoProduct > tok_ew_
Log< level::Info, true > LogVerbatim
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
static const std::string kSharedResource
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_magField_
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_L1extCenJet_
T getParameter(std::string const &) const
const std::string theTrackQuality_
double pz() const
z coordinate of momentum vector
double eCone_ecal(const CaloGeometry *geo, edm::Handle< T > &barrelhits, edm::Handle< T > &endcaphits, const GlobalPoint &hpoint1, const GlobalPoint &point1, double dR, const GlobalVector &trackMom, int &nRecHits, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false)
const L1GtTriggerMenu * m_l1GtMenu
const L1GtTriggerMenu * ptrL1TriggerMenuEventSetup(int &errorCode)
return a pointer to the L1 trigger menu from event setup
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
std::vector< Track > TrackCollection
collection of Tracks
T * make(const Args &... args) const
make new ROOT object