|
|
Go to the documentation of this file.
9 #include "TDirectory.h"
11 #include "TLorentzVector.h"
12 #include "TInterpreter.h"
141 std::map<std::pair<unsigned int, std::string>,
int>
l1AlgoMap_;
147 verbosity_(iConfig.getUntrackedParameter<
int>(
"Verbosity", 0)),
149 theTrackQuality_(iConfig.getUntrackedParameter<
std::
string>(
"TrackQuality",
"highPurity")),
150 a_coneR_(iConfig.getUntrackedParameter<double>(
"ConeRadius", 34.98)),
151 a_charIsoR_(a_coneR_ + 28.9),
152 a_mipR_(iConfig.getUntrackedParameter<double>(
"ConeRadiusMIP", 14.0)),
188 tok_L1extTauJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraTauJetSource_);
189 tok_L1extCenJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraCenJetSource_);
190 tok_L1extFwdJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraFwdJetSource_);
192 edm::LogInfo(
"IsoTrack") <<
"Parameters read from config file \n"
201 <<
"\t isItAOD " << isItAOD;
215 std::vector<std::string>
seeds = {
216 "L1_SingleJet36",
"L1_SingleJet52",
"L1_SingleJet68",
"L1_SingleJet92",
"L1_SingleJet128"};
218 desc.addUntracked<
int>(
"Verbosity", 0);
219 desc.addUntracked<std::vector<std::string> >(
"L1Seed",
seeds);
221 desc.addUntracked<
double>(
"MinTrackPt", 10.0);
222 desc.addUntracked<
double>(
"MaxDxyPV", 0.02);
223 desc.addUntracked<
double>(
"MaxDzPV", 0.02);
224 desc.addUntracked<
double>(
"MaxChi2", 5.0);
225 desc.addUntracked<
double>(
"MaxDpOverP", 0.1);
226 desc.addUntracked<
int>(
"MinOuterHit", 4);
227 desc.addUntracked<
int>(
"MinLayerCrossed", 8);
228 desc.addUntracked<
int>(
"MaxInMiss", 0);
229 desc.addUntracked<
int>(
"MaxOutMiss", 0);
230 desc.addUntracked<
double>(
"ConeRadius", 34.98);
231 desc.addUntracked<
double>(
"ConeRadiusMIP", 14.0);
232 desc.addUntracked<
bool>(
"IsItAOD",
false);
233 descriptions.
add(
"isoTrackCalib",
desc);
241 <<
" Bunch " <<
iEvent.bunchCrossing() <<
" starts ==========";
271 for (
unsigned iGenJet = 0; iGenJet <
genJets->size(); ++iGenJet) {
273 double genJetPt = genJet.
pt();
274 double genJetEta = genJet.
eta();
277 if (genJetEta > -2.5 && genJetEta < 2.5) {
295 if (!recVtxs->empty() && !((*recVtxs)[0].isFake())) {
296 leadPV =
math::XYZPoint((*recVtxs)[0].
x(), (*recVtxs)[0].
y(), (*recVtxs)[0].
z());
297 }
else if (beamSpotH.
isValid()) {
302 edm::LogInfo(
"IsoTrack") <<
"Primary Vertex " << leadPV;
316 for (rhitItr =
hbhe->begin(); rhitItr !=
hbhe->end(); rhitItr++) {
317 double rec_energy = rhitItr->energy();
318 int rec_ieta = rhitItr->id().ieta();
319 int rec_depth = rhitItr->id().depth();
320 int rec_zside = rhitItr->id().zside();
321 double num1_1 = rec_zside * (rec_ieta + 0.2 * (rec_depth - 1));
323 edm::LogInfo(
"IsoTrack") <<
"detid/rechit/ieta/zside/depth/num "
324 <<
" = " << rhitItr->id() <<
"/" << rec_energy <<
"/" << rec_ieta <<
"/" << rec_zside
325 <<
"/" << rec_depth <<
"/" << num1_1;
333 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
335 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
336 for (trkDetItr = trkCaloDirections.begin(); trkDetItr != trkCaloDirections.end(); trkDetItr++) {
337 if (trkDetItr->okHCAL) {
339 int tk_ieta = detId.
ieta();
340 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
341 double tk_p = pTrack->
p();
343 for (
unsigned int k = 1;
k <
pbin.size(); ++
k) {
363 edm::LogInfo(
"IsoTrack") <<
"\nL1 configuration code:" << l1ConfCode
364 <<
"\nNo valid L1 trigger configuration available."
365 <<
"\nSee text above for error code interpretation"
366 <<
"\nNo return here, in order to test each method"
367 <<
", protected against configuration error.";
373 edm::LogInfo(
"IsoTrack") <<
"menuName " << menuName << std::endl;
375 std::vector<int> algbits;
376 for (
CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
378 int algBitNumber = (itAlgo->second).algoBitNumber();
383 edm::LogInfo(
"IsoTrack") << algName <<
" " << algBitNumber <<
" " << decision;
384 for (
unsigned int i = 0;
i <
l1Names_.size(); ++
i) {
385 if (algName.find(
l1Names_[
i]) != std::string::npos) {
388 <<
" " << algName <<
" " << decision;
400 l1extra::L1JetParticleCollection::const_iterator
itr;
401 double ptTriggered = -10;
402 double etaTriggered = -100;
403 double phiTriggered = -100;
405 for (
itr = l1TauHandle->begin();
itr != l1TauHandle->end(); ++
itr) {
406 if (
itr->pt() > ptTriggered) {
407 ptTriggered =
itr->pt();
408 etaTriggered =
itr->eta();
409 phiTriggered =
itr->phi();
412 edm::LogInfo(
"IsoTrack") <<
"tauJ pt " <<
itr->pt() <<
" eta/phi " <<
itr->eta() <<
" " <<
itr->phi();
416 for (
itr = l1CenJetHandle->begin();
itr != l1CenJetHandle->end(); ++
itr) {
417 if (
itr->pt() > ptTriggered) {
418 ptTriggered =
itr->pt();
419 etaTriggered =
itr->eta();
420 phiTriggered =
itr->phi();
423 edm::LogInfo(
"IsoTrack") <<
"cenJ pt " <<
itr->pt() <<
" eta/phi " <<
itr->eta() <<
" " <<
itr->phi();
427 for (
itr = l1FwdJetHandle->begin();
itr != l1FwdJetHandle->end(); ++
itr) {
428 if (
itr->pt() > ptTriggered) {
429 ptTriggered =
itr->pt();
430 etaTriggered =
itr->eta();
431 phiTriggered =
itr->phi();
434 edm::LogInfo(
"IsoTrack") <<
"forJ pt " <<
itr->pt() <<
" eta/phi " <<
itr->eta() <<
" " <<
itr->phi();
437 edm::LogInfo(
"IsoTrack") <<
"jets pt/eta/phi = " << ptTriggered <<
"/" << etaTriggered <<
"/" << phiTriggered;
439 unsigned int nTracks(0), nselTracks(0);
440 for (trkDetItr = trkCaloDirections.begin(),
nTracks = 0; trkDetItr != trkCaloDirections.end();
442 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
445 t_mindR1 =
deltaR(etaTriggered, v4.eta(), phiTriggered, v4.phi());
449 << pTrack->
eta() <<
"/" << pTrack->
phi() <<
"/" << pTrack->
p();
465 oneCutParameters.
maxDzPV = 100;
471 oneCutParameters.
maxDzPV = 100;
478 if (trkDetItr->okHCAL) {
483 edm::LogInfo(
"IsoTrack") <<
"qltyFlag|okECAL|okHCAL : " << qltyFlag <<
"|" << trkDetItr->okECAL <<
"/"
484 << trkDetItr->okHCAL;
485 t_qltyFlag = (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL);
488 for (
unsigned int k = 1;
k <
pbin.size(); ++
k) {
497 for (
unsigned int k = 1;
k <
pbin.size(); ++
k) {
503 int nRH_eMipDR(0), nNearTRKs(0), nRecHits(-999);
507 trkDetItr->pointHCAL,
508 trkDetItr->pointECAL,
510 trkDetItr->directionECAL,
514 std::vector<DetId> ids;
517 trkDetItr->pointHCAL,
518 trkDetItr->pointECAL,
520 trkDetItr->directionHCAL,
524 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
531 for (
unsigned int k = 1;
k <
pbin.size(); ++
k) {
539 for (
unsigned int k = 1;
k <
pbin.size(); ++
k) {
547 for (
unsigned int k = 1;
k <
pbin.size(); ++
k) {
558 << pTrack->
eta() <<
"/" << pTrack->
phi() <<
"/" <<
t_p;
562 for (
unsigned int lll = 0; lll <
t_DetIds->size(); lll++) {
582 double prange[5] = {20, 30, 40, 60, 100};
583 for (
int k = 0;
k < 5; ++
k)
584 pbin.push_back(prange[
k]);
585 std::string type[6] = {
"All",
"Trigger OK",
"Tree Selected",
"Charge Isolation",
"MIP Cut",
"L1 Cut"};
586 for (
unsigned int k = 0;
k <
pbin.size(); ++
k) {
589 sprintf(namp,
"all momentum");
591 sprintf(namp,
"p = %4.0f:%4.0f GeV",
pbin[
k - 1],
pbin[
k]);
592 sprintf(
name,
"TrackEta0%d",
k);
593 sprintf(
title,
"Track #eta for tracks with %s (%s)", namp,
type[0].c_str());
595 sprintf(
name,
"TrackEta1%d",
k);
596 sprintf(
title,
"Track #eta for tracks with %s (%s)", namp,
type[1].c_str());
598 sprintf(
name,
"TrackEta2%d",
k);
599 sprintf(
title,
"Track #eta for tracks with %s (%s)", namp,
type[2].c_str());
601 sprintf(
name,
"TrackEta3%d",
k);
602 sprintf(
title,
"Track #eta for tracks with %s (%s)", namp,
type[3].c_str());
604 sprintf(
name,
"TrackEta4%d",
k);
605 sprintf(
title,
"Track #eta for tracks with %s (%s)", namp,
type[4].c_str());
607 sprintf(
name,
"TrackEta5%d",
k);
608 sprintf(
title,
"Track #eta for tracks with %s (%s)", namp,
type[5].c_str());
611 h_jetpt[0] =
fs_->
make<TH1F>(
"Jetpt0",
"Jet p_T (All)", 500, 0., 2500.);
612 h_jetpt[1] =
fs_->
make<TH1F>(
"Jetpt1",
"Jet p_T (All Weighted)", 500, 0., 2500.);
613 h_jetpt[2] =
fs_->
make<TH1F>(
"Jetpt2",
"Jet p_T (|#eta| < 2.5)", 500, 0., 2500.);
614 h_jetpt[3] =
fs_->
make<TH1F>(
"Jetpt3",
"Jet p_T (|#eta| < 2.5 Weighted)", 500, 0., 2500.);
618 tree->Branch(
"t_Run", &
t_Run,
"t_Run/I");
628 tree->Branch(
"t_p", &
t_p,
"t_p/D");
639 t_DetIds =
new std::vector<unsigned int>();
642 tree->Branch(
"t_DetIds",
"std::vector<unsigned int>", &
t_DetIds);
644 tree->Branch(
"t_l1bits",
"std::vector<bool>", &
t_l1bits);
649 bool changed =
false;
660 for (
CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
662 int algBitNumber = (itAlgo->second).algoBitNumber();
663 l1AlgoMap_.insert(std::pair<std::pair<unsigned int, std::string>,
int>(
664 std::pair<unsigned int, std::string>(algBitNumber, algName), 0));
666 std::map<std::pair<unsigned int, std::string>,
int>::iterator
itr;
684 double phi1 =
vec1.phi();
687 double phi2 =
vec2.phi();
690 double dphi = phi1 - phi2;
693 else if (dphi < -
M_PI)
701 return std::sqrt(deta * deta + dphi * dphi);
710 double dphi = phi1 - phi2;
713 else if (dphi < -
M_PI)
715 return std::sqrt(deta * deta + dphi * dphi);
T const * product() const
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
Log< level::Info, false > LogInfo
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)
std::vector< std::pair< float, float > >::iterator itr
reco::TrackBase::TrackQuality minQuality
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_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
static const std::string kSharedResource
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
std::vector< Track > TrackCollection
collection of Tracks
T * make(const Args &... args) const
make new ROOT object