9 #include "TDirectory.h" 11 #include "TLorentzVector.h" 12 #include "TInterpreter.h" 86 double dR(
double eta1,
double eta2,
double phi1,
double phi2);
100 double deltaR(
double eta1,
double eta2,
double phi1,
double phi2);
147 std::map< std::pair<unsigned int,std::string>,
int>
l1AlgoMap;
185 tok_L1extTauJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraTauJetSource_);
186 tok_L1extCenJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraCenJetSource_);
187 tok_L1extFwdJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraFwdJetSource_);
201 <<
"Parameters read from config file \n" 203 <<
"\t theTrackQuality " << theTrackQuality
213 <<
"\t a_coneR " << a_coneR
216 <<
"\t isItAOD " << isItAOD;
237 <<
"Run " <<
t_Run <<
" Event " <<
t_Event <<
" Luminosity " 239 <<
" starts ==========";
257 reco::TrackCollection::const_iterator trkItr;
269 for (
unsigned iGenJet = 0; iGenJet < genJets->size(); ++iGenJet) {
271 double genJetPt = genJet.
pt();
272 double genJetEta = genJet.
eta();
275 if (genJetEta>-2.5 && genJetEta<2.5) {
286 reco::PFJetCollection::const_iterator pfItr;
294 if (recVtxs->size()>0 && !((*recVtxs)[0].isFake())) {
295 leadPV =
math::XYZPoint( (*recVtxs)[0].
x(),(*recVtxs)[0].
y(), (*recVtxs)[0].
z() );
296 }
else if (beamSpotH.
isValid()) {
301 edm::LogInfo(
"IsoTrack") <<
"Primary Vertex " << leadPV;
315 for (rhitItr=hbhe->
begin();rhitItr!=hbhe->
end();rhitItr++) {
316 double rec_energy = rhitItr->energy();
317 int rec_ieta = rhitItr->id().ieta();
318 int rec_depth = rhitItr->id().depth();
319 int rec_zside = rhitItr->id().zside();
320 double num1_1 = rec_zside*(rec_ieta+0.2*(rec_depth-1));
322 edm::LogInfo(
"IsoTrack") <<
"detid/rechit/ieta/zside/depth/num " <<
" = " 323 << rhitItr->id() <<
"/" << rec_energy <<
"/" 324 << rec_ieta <<
"/" << rec_zside <<
"/" 325 << rec_depth <<
"/" << num1_1;
333 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
335 trkCaloDirections, ((
verbosity/100)%10>2));
336 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
337 for (trkDetItr = trkCaloDirections.begin();
338 trkDetItr != trkCaloDirections.end(); trkDetItr++) {
339 if (trkDetItr->okHCAL) {
341 int tk_ieta = detId.
ieta();
342 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
343 double tk_p = pTrack->
p();
345 for (
unsigned int k=1;
k<
pbin.size(); ++
k) {
364 edm::LogInfo(
"IsoTrack") <<
"\nL1 configuration code:" << l1ConfCode
365 <<
"\nNo valid L1 trigger configuration available." 366 <<
"\nSee text above for error code interpretation" 367 <<
"\nNo return here, in order to test each method" 368 <<
", protected against configuration error.";
373 std::cout <<
"menuName " << menuName << std::endl;
375 std::vector<int> algbits;
376 for (
CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end();
379 int algBitNumber = ( itAlgo->second ).algoBitNumber();
384 edm::LogInfo(
"IsoTrack") << algName <<
" "<< algBitNumber <<
" " 386 for (
unsigned int i=0;
i<
l1Names.size(); ++
i) {
387 if (algName.find(
l1Names[
i])!=std::string::npos){
389 edm::LogInfo(
"IsoTrack") <<
"match found" <<
" " << algName <<
" " 392 if (decision > 0) l1ok =
true;
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 " 413 << itr->eta() <<
" " << itr->phi();
417 for (itr = l1CenJetHandle->begin(); itr != l1CenJetHandle->end(); ++itr){
418 if (itr->pt()>ptTriggered) {
419 ptTriggered = itr->pt();
420 etaTriggered = itr->eta();
421 phiTriggered = itr->phi() ;
425 <<
" eta/phi " << itr->eta() <<
" " 430 for (itr = l1FwdJetHandle->begin(); itr != l1FwdJetHandle->end(); ++itr) {
431 if (itr->pt()>ptTriggered) {
432 ptTriggered = itr->pt();
433 etaTriggered = itr->eta();
434 phiTriggered = itr->phi() ;
437 edm::LogInfo(
"IsoTrack") <<
"forJ pt " << itr->pt() <<
" eta/phi " 438 << itr->eta() <<
" " << itr->phi();
441 edm::LogInfo(
"IsoTrack") <<
"jets pt/eta/phi = " << ptTriggered <<
"/" 442 << etaTriggered <<
"/" <<phiTriggered;
444 unsigned int nTracks(0),nselTracks(0);
445 for (trkDetItr = trkCaloDirections.begin(),
nTracks=0;
446 trkDetItr != trkCaloDirections.end(); trkDetItr++,
nTracks++) {
447 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
449 pTrack->
pz(), pTrack->
p());
455 << pTrack->
pt() <<
"/" << pTrack->
eta() <<
"/" 456 << pTrack->
phi() <<
"/" << pTrack->
p();
471 oneCutParameters.
maxDzPV = 100;
477 oneCutParameters.
maxDzPV = 100;
484 if (trkDetItr->okHCAL) {
489 edm::LogInfo(
"IsoTrack") <<
"qltyFlag|okECAL|okHCAL : " << qltyFlag <<
"|" 490 << trkDetItr->okECAL <<
"/" << trkDetItr->okHCAL;
491 t_qltyFlag = (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL);
494 for (
unsigned int k=1;
k<
pbin.size(); ++
k) {
503 for (
unsigned int k=1;
k<
pbin.size(); ++
k) {
509 int nRH_eMipDR(0), nNearTRKs(0), nRecHits(-999);
512 trkDetItr->pointHCAL,
513 trkDetItr->pointECAL,
514 a_mipR, trkDetItr->directionECAL,
517 std::vector<DetId> ids;
520 trkDetItr->directionHCAL,nRecHits,
522 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->
pt() <<
"/" << pTrack->
eta() <<
"/" 558 << pTrack->
phi() <<
"/" <<
t_p;
563 for (
unsigned int lll=0;lll<
t_DetIds->size();lll++) {
583 double prange[5] = {20,30,40,60,100};
584 for (
int k=0;
k<5; ++
k)
pbin.push_back(prange[
k]);
586 "Charge Isolation",
"MIP Cut",
"L1 Cut"};
587 for (
unsigned int k=0; k<
pbin.size(); ++
k) {
589 if (k == 0) sprintf (namp,
"all momentum");
590 else 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.);
615 tree =
fs->
make<TTree>(
"CalibTree",
"CalibTree");
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);
642 tree->Branch(
"t_HitEnergies",
"std::vector<double>", &t_HitEnergies);
643 tree->Branch(
"t_l1bits",
"std::vector<bool>", &t_l1bits);
662 std::cout <<
"menuName " << menuName << std::endl;;
663 for (
CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end();
666 int algBitNumber = ( itAlgo->second ).algoBitNumber();
667 l1AlgoMap.insert( std::pair<std::pair<unsigned int,std::string>,
int>( std::pair<unsigned int,std::string>(algBitNumber, algName) , 0) ) ;
669 std::map< std::pair<unsigned int,std::string>,
int>::iterator itr;
673 << (itr->first).second <<
" "<<itr->second;
696 return (vec1.eta()-vec2.eta());
701 double phi1 = vec1.phi();
702 if (phi1 < 0) phi1 += 2.0*
M_PI;
703 double phi2 = vec2.phi();
704 if (phi2 < 0) phi2 += 2.0*
M_PI;
705 double dphi = phi1-phi2;
707 else if (dphi < -
M_PI) dphi += 2.*
M_PI;
712 double deta =
dEta(vec1,vec2);
713 double dphi =
dPhi(vec1,vec2);
718 double deta = eta1-eta2;
719 if (phi1 < 0) phi1 += 2.0*
M_PI;
720 if (phi2 < 0) phi2 += 2.0*
M_PI;
721 double dphi = phi1-phi2;
723 else if (dphi < -
M_PI) dphi += 2.*
M_PI;
double p() const
momentum vector magnitude
T getParameter(std::string const &) const
virtual double pt() const final
transverse momentum
EventNumber_t event() const
std::vector< double > * t_HitEnergies
T getUntrackedParameter(std::string const &, T const &) const
const unsigned int nTracks(const reco::Vertex &sv)
const L1GtTriggerMenu * m_l1GtMenu
std::vector< unsigned int > * t_DetIds
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, std::string &theTrackQuality, bool debug=false)
HLTConfigProvider hltConfig_
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_L1extCenJet_
edm::EDGetTokenT< reco::GenJetCollection > tok_jets_
virtual double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void endRun(edm::Run const &, edm::EventSetup const &)
edm::InputTag triggerEvent_
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
std::vector< std::string > l1Names
const bool availableL1Configuration(int &errorCode, int &l1ConfCode) const
std::vector< HBHERecHit >::const_iterator const_iterator
int bunchCrossing() const
edm::LuminosityBlockNumber_t luminosityBlock() const
double phi() const
azimuthal angle of momentum vector
const bool decision(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
T * make(const Args &...args) const
make new ROOT object
edm::EDGetTokenT< reco::PFJetCollection > tok_pfjets_
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_
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
std::vector< std::string > trgnames
std::string theTrackQuality
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
double dR(double eta1, double eta2, double phi1, double phi2)
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes
double eta() const
pseudorapidity of momentum vector
void addDefault(ParameterSetDescription const &psetDescription)
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
std::map< std::pair< unsigned int, std::string >, int > l1AlgoMap
int ieta() const
get the cell ieta
Jets made from MC generator particles.
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)
std::vector< std::string > HLTNames
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_L1extFwdJet_
double pz() const
z coordinate of momentum vector
const_iterator end() const
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
double dEta(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
static TrackQuality qualityByName(const std::string &name)
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
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
edm::EDGetTokenT< GenEventInfoProduct > tok_ew_
spr::trackSelectionParameters selectionParameters
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
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
edm::InputTag theTriggerResultsLabel
edm::EDGetTokenT< reco::BeamSpot > tok_bs_
const Point & position() const
position
edm::EDGetTokenT< trigger::TriggerEvent > tok_trigEvt
double dPhi(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const L1GtTriggerMenu * ptrL1TriggerMenuEventSetup(int &errorCode)
return a pointer to the L1 trigger menu from event setup
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
T const * product() const
const_iterator begin() const
double py() const
y coordinate of momentum vector
static const bool useL1EventSetup(true)
std::vector< std::string > trigNames
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, bool useRaw=false, bool debug=false)
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
IsoTrackCalib(const edm::ParameterSet &)