9 #include "TDirectory.h" 11 #include "TLorentzVector.h" 12 #include "TInterpreter.h" 100 double deltaR(
double eta1,
double eta2,
double phi1,
double phi2);
142 std::map< std::pair<unsigned int,std::string>,
int>
l1AlgoMap_;
148 verbosity_(iConfig.getUntrackedParameter<
int>(
"Verbosity",0)),
151 a_coneR_(iConfig.getUntrackedParameter<double>(
"ConeRadius",34.98)),
153 a_mipR_(iConfig.getUntrackedParameter<double>(
"ConeRadiusMIP",14.0)),
190 tok_L1extTauJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraTauJetSource_);
191 tok_L1extCenJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraCenJetSource_);
192 tok_L1extFwdJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraFwdJetSource_);
195 <<
"Parameters read from config file \n" 210 <<
"\t isItAOD " << isItAOD;
227 std::vector<std::string> seeds = {
"L1_SingleJet36",
"L1_SingleJet52",
228 "L1_SingleJet68",
"L1_SingleJet92",
232 desc.
addUntracked<std::vector<std::string> >(
"L1Seed", seeds);
246 descriptions.
add(
"isoTrackCalib",desc);
256 <<
"Run " <<
t_Run <<
" Event " <<
t_Event <<
" Luminosity " 258 <<
" starts ==========";
276 reco::TrackCollection::const_iterator trkItr;
288 for (
unsigned iGenJet = 0; iGenJet < genJets->size(); ++iGenJet) {
290 double genJetPt = genJet.
pt();
291 double genJetEta = genJet.
eta();
294 if (genJetEta>-2.5 && genJetEta<2.5) {
305 reco::PFJetCollection::const_iterator pfItr;
313 if (!recVtxs->empty() && !((*recVtxs)[0].isFake())) {
314 leadPV =
math::XYZPoint( (*recVtxs)[0].
x(),(*recVtxs)[0].
y(), (*recVtxs)[0].
z() );
315 }
else if (beamSpotH.
isValid()) {
320 edm::LogInfo(
"IsoTrack") <<
"Primary Vertex " << leadPV;
334 for (rhitItr=hbhe->
begin();rhitItr!=hbhe->
end();rhitItr++) {
335 double rec_energy = rhitItr->energy();
336 int rec_ieta = rhitItr->id().ieta();
337 int rec_depth = rhitItr->id().depth();
338 int rec_zside = rhitItr->id().zside();
339 double num1_1 = rec_zside*(rec_ieta+0.2*(rec_depth-1));
341 edm::LogInfo(
"IsoTrack") <<
"detid/rechit/ieta/zside/depth/num " <<
" = " 342 << rhitItr->id() <<
"/" << rec_energy <<
"/" 343 << rec_ieta <<
"/" << rec_zside <<
"/" 344 << rec_depth <<
"/" << num1_1;
352 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
355 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
356 for (trkDetItr = trkCaloDirections.begin();
357 trkDetItr != trkCaloDirections.end(); trkDetItr++) {
358 if (trkDetItr->okHCAL) {
360 int tk_ieta = detId.
ieta();
361 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
362 double tk_p = pTrack->
p();
364 for (
unsigned int k=1;
k<
pbin.size(); ++
k) {
383 edm::LogInfo(
"IsoTrack") <<
"\nL1 configuration code:" << l1ConfCode
384 <<
"\nNo valid L1 trigger configuration available." 385 <<
"\nSee text above for error code interpretation" 386 <<
"\nNo return here, in order to test each method" 387 <<
", protected against configuration error.";
393 edm::LogInfo(
"IsoTrack") <<
"menuName " << menuName << std::endl;
395 std::vector<int> algbits;
396 for (
CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end();
399 int algBitNumber = ( itAlgo->second ).algoBitNumber();
404 edm::LogInfo(
"IsoTrack") << algName <<
" "<< algBitNumber <<
" " 407 if (algName.find(
l1Names_[
i])!=std::string::npos){
409 edm::LogInfo(
"IsoTrack") <<
"match found" <<
" " << algName <<
" " 412 if (decision > 0) l1ok =
true;
420 l1extra::L1JetParticleCollection::const_iterator itr;
421 double ptTriggered = -10;
422 double etaTriggered = -100;
423 double phiTriggered = -100;
425 for(itr = l1TauHandle->begin(); itr != l1TauHandle->end(); ++itr) {
426 if(itr->pt()>ptTriggered){
427 ptTriggered = itr->pt();
428 etaTriggered = itr->eta();
429 phiTriggered = itr->phi() ;
432 edm::LogInfo(
"IsoTrack") <<
"tauJ pt " << itr->pt() <<
" eta/phi " 433 << itr->eta() <<
" " << itr->phi();
437 for (itr = l1CenJetHandle->begin(); itr != l1CenJetHandle->end(); ++itr){
438 if (itr->pt()>ptTriggered) {
439 ptTriggered = itr->pt();
440 etaTriggered = itr->eta();
441 phiTriggered = itr->phi() ;
445 <<
" eta/phi " << itr->eta() <<
" " 450 for (itr = l1FwdJetHandle->begin(); itr != l1FwdJetHandle->end(); ++itr) {
451 if (itr->pt()>ptTriggered) {
452 ptTriggered = itr->pt();
453 etaTriggered = itr->eta();
454 phiTriggered = itr->phi() ;
457 edm::LogInfo(
"IsoTrack") <<
"forJ pt " << itr->pt() <<
" eta/phi " 458 << itr->eta() <<
" " << itr->phi();
461 edm::LogInfo(
"IsoTrack") <<
"jets pt/eta/phi = " << ptTriggered <<
"/" 462 << etaTriggered <<
"/" <<phiTriggered;
464 unsigned int nTracks(0),nselTracks(0);
465 for (trkDetItr = trkCaloDirections.begin(),
nTracks=0;
466 trkDetItr != trkCaloDirections.end(); trkDetItr++,
nTracks++) {
467 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
469 pTrack->
pz(), pTrack->
p());
475 << pTrack->
pt() <<
"/" << pTrack->
eta() <<
"/" 476 << pTrack->
phi() <<
"/" << pTrack->
p();
491 oneCutParameters.
maxDzPV = 100;
497 oneCutParameters.
maxDzPV = 100;
504 if (trkDetItr->okHCAL) {
509 edm::LogInfo(
"IsoTrack") <<
"qltyFlag|okECAL|okHCAL : " << qltyFlag <<
"|" 510 << trkDetItr->okECAL <<
"/" << trkDetItr->okHCAL;
511 t_qltyFlag = (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL);
514 for (
unsigned int k=1;
k<
pbin.size(); ++
k) {
523 for (
unsigned int k=1;
k<
pbin.size(); ++
k) {
529 int nRH_eMipDR(0), nNearTRKs(0), nRecHits(-999);
532 trkDetItr->pointHCAL,
533 trkDetItr->pointECAL,
534 a_mipR_, trkDetItr->directionECAL,
537 std::vector<DetId> ids;
540 trkDetItr->directionHCAL,nRecHits,
542 for (
unsigned int k=0;
k<ids.size(); ++
k) {
550 for (
unsigned int k=1;
k<
pbin.size(); ++
k) {
558 for (
unsigned int k=1;
k<
pbin.size(); ++
k) {
566 for (
unsigned int k=1;
k<
pbin.size(); ++
k) {
577 << pTrack->
pt() <<
"/" << pTrack->
eta() <<
"/" 578 << pTrack->
phi() <<
"/" <<
t_p;
583 for (
unsigned int lll=0;lll<
t_DetIds->size();lll++) {
603 double prange[5] = {20,30,40,60,100};
604 for (
int k=0;
k<5; ++
k)
pbin.push_back(prange[
k]);
606 "Charge Isolation",
"MIP Cut",
"L1 Cut"};
607 for (
unsigned int k=0; k<
pbin.size(); ++
k) {
609 if (k == 0) sprintf (namp,
"all momentum");
610 else sprintf (namp,
"p = %4.0f:%4.0f GeV",
pbin[k-1],
pbin[k]);
611 sprintf (name,
"TrackEta0%d", k);
612 sprintf (title,
"Track #eta for tracks with %s (%s)",namp,type[0].c_str());
614 sprintf (name,
"TrackEta1%d", k);
615 sprintf (title,
"Track #eta for tracks with %s (%s)",namp,type[1].c_str());
617 sprintf (name,
"TrackEta2%d", k);
618 sprintf (title,
"Track #eta for tracks with %s (%s)",namp,type[2].c_str());
620 sprintf (name,
"TrackEta3%d", k);
621 sprintf (title,
"Track #eta for tracks with %s (%s)",namp,type[3].c_str());
623 sprintf (name,
"TrackEta4%d", k);
624 sprintf (title,
"Track #eta for tracks with %s (%s)",namp,type[4].c_str());
626 sprintf (name,
"TrackEta5%d", k);
627 sprintf (title,
"Track #eta for tracks with %s (%s)",namp,type[5].c_str());
630 h_jetpt[0] =
fs_->
make<TH1F>(
"Jetpt0",
"Jet p_T (All)", 500,0.,2500.);
631 h_jetpt[1] =
fs_->
make<TH1F>(
"Jetpt1",
"Jet p_T (All Weighted)", 500,0.,2500.);
632 h_jetpt[2] =
fs_->
make<TH1F>(
"Jetpt2",
"Jet p_T (|#eta| < 2.5)", 500,0.,2500.);
633 h_jetpt[3] =
fs_->
make<TH1F>(
"Jetpt3",
"Jet p_T (|#eta| < 2.5 Weighted)", 500,0.,2500.);
637 tree->Branch(
"t_Run", &
t_Run,
"t_Run/I");
647 tree->Branch(
"t_p", &
t_p,
"t_p/D");
658 t_DetIds =
new std::vector<unsigned int>();
661 tree->Branch(
"t_DetIds",
"std::vector<unsigned int>", &
t_DetIds);
662 tree->Branch(
"t_HitEnergies",
"std::vector<double>", &t_HitEnergies);
663 tree->Branch(
"t_l1bits",
"std::vector<bool>", &t_l1bits);
668 bool changed =
false;
678 for (
CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end();
681 int algBitNumber = ( itAlgo->second ).algoBitNumber();
682 l1AlgoMap_.insert( std::pair<std::pair<unsigned int,std::string>,
int>( std::pair<unsigned int,std::string>(algBitNumber, algName) , 0) ) ;
684 std::map< std::pair<unsigned int,std::string>,
int>::iterator itr;
688 << (itr->first).second <<
" "<<itr->second;
698 return (vec1.eta()-vec2.eta());
703 double phi1 = vec1.phi();
704 if (phi1 < 0) phi1 += 2.0*
M_PI;
705 double phi2 = vec2.phi();
706 if (phi2 < 0) phi2 += 2.0*
M_PI;
707 double dphi = phi1-phi2;
709 else if (dphi < -
M_PI) dphi += 2.*
M_PI;
714 double deta =
dEta(vec1,vec2);
715 double dphi =
dPhi(vec1,vec2);
720 double deta = eta1-eta2;
721 if (phi1 < 0) phi1 += 2.0*
M_PI;
722 if (phi2 < 0) phi2 += 2.0*
M_PI;
723 double dphi = phi1-phi2;
725 else if (dphi < -
M_PI) dphi += 2.*
M_PI;
static const std::string kSharedResource
double p() const
momentum vector magnitude
void beginRun(edm::Run const &, edm::EventSetup const &) override
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)
T getParameter(std::string const &) const
EventNumber_t event() const
spr::trackSelectionParameters selectionParameters_
std::vector< double > * t_HitEnergies
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
const unsigned int nTracks(const reco::Vertex &sv)
const L1GtTriggerMenu * m_l1GtMenu
const edm::EDGetTokenT< GenEventInfoProduct > tok_ew_
std::vector< unsigned int > * t_DetIds
double eta() const final
momentum pseudorapidity
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
HLTConfigProvider hltConfig_
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_L1extCenJet_
std::map< std::pair< unsigned int, std::string >, int > l1AlgoMap_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
const bool availableL1Configuration(int &errorCode, int &l1ConfCode) const
const edm::EDGetTokenT< reco::BeamSpot > tok_bs_
std::vector< GenJet > GenJetCollection
collection of GenJet objects
std::vector< Track > TrackCollection
collection of Tracks
std::vector< HBHERecHit >::const_iterator const_iterator
int bunchCrossing() const
edm::LuminosityBlockNumber_t luminosityBlock() const
double phi() const
azimuthal angle of momentum vector
double pt() const final
transverse momentum
const bool decision(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
std::vector< Vertex > VertexCollection
collection of Vertex objects
T * make(const Args &...args) const
make new ROOT object
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
double px() const
x coordinate of momentum vector
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_L1extTauJet_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
const std::string theTrackQuality_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
static const bool useL1EventSetup(false)
double eta() const
pseudorapidity of momentum vector
std::vector< double > pbin
static const bool useL1GtTriggerMenuLite(true)
edm::Service< TFileService > fs_
double deltaR(double eta1, double eta2, double phi1, double phi2)
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
std::vector< bool > * t_l1bits
std::vector< double > vec1
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
double pt() const
track transverse momentum
int ieta() const
get the cell ieta
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
Jets made from MC generator particles.
const edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
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)
~IsoTrackCalib() override
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_L1extFwdJet_
const edm::EDGetTokenT< reco::GenJetCollection > tok_jets_
double pz() const
z coordinate of momentum vector
const_iterator end() const
double dEta(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
static TrackQuality qualityByName(const std::string &name)
XYZPointD XYZPoint
point in space with cartesian internal representation
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< PFJet > PFJetCollection
collection of PFJet 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
reco::TrackBase::TrackQuality minQuality
void endRun(edm::Run const &, edm::EventSetup const &) override
void analyze(const edm::Event &, const edm::EventSetup &) override
const Point & position() const
position
double dR(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
double dPhi(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
const edm::EDGetTokenT< reco::PFJetCollection > tok_pfjets_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const L1GtTriggerMenu * ptrL1TriggerMenuEventSetup(int &errorCode)
return a pointer to the L1 trigger menu from event setup
T const * product() const
const std::vector< std::string > l1Names_
const_iterator begin() const
double py() const
y coordinate of momentum vector
IsoTrackCalib(const edm::ParameterSet &)