9 hltPrescaleProvider_(iConfig, consumesCollector(), *this),
10 nRun(0), t_trackP(0), t_trackPx(0), t_trackPy(0),
11 t_trackPz(0), t_trackEta(0), t_trackPhi(0), t_trackPt(0), t_neu_iso(0),
12 t_charge_iso(0), t_emip(0), t_ehcal(0), t_trkL3mindr(0), t_ieta(0),
13 t_disthotcell(0), t_ietahotcell(0), t_eventweight(0), t_l1pt(0), t_l1eta(0),
14 t_l1phi(0), t_l3pt(0), t_l3eta(0), t_l3phi(0), t_leadingpt(0),
15 t_leadingeta(0), t_leadingphi(0) {
69 edm::LogInfo(
"IsoTrack") <<
"Parameters read from config file \n"
71 <<
"\t theTrackQuality " << theTrackQuality
88 edm::LogInfo(
"IsoTrack") << trigNames.size() <<
" triggers to be studied";
89 for (
unsigned int k=0;
k<trigNames.size(); ++
k)
90 edm::LogInfo(
"IsoTrack") <<
"Trigger[" <<
k <<
"] : " << trigNames[
k];
91 edm::LogInfo(
"IsoTrack") << drCuts.size() <<
" Delta R zones wrt trigger objects";
92 for (
unsigned int k=0;
k<drCuts.size(); ++
k)
156 reco::TrackCollection::const_iterator trkItr;
158 double flatPtWeight = 0.0;
162 flatPtWeight = genEventInfo->weight();
167 reco::PFJetCollection::const_iterator pfItr;
175 if (recVtxs->size()>0 && !((*recVtxs)[0].isFake())) {
176 leadPV =
math::XYZPoint( (*recVtxs)[0].
x(),(*recVtxs)[0].
y(), (*recVtxs)[0].
z() );
177 }
else if (beamSpotH.
isValid()) {
178 leadPV = beamSpotH->position();
181 edm::LogInfo(
"IsoTrack") <<
"Primary Vertex " << leadPV;
183 << beamSpotH->position();
204 if (!triggerEventHandle.
isValid()) {
208 triggerEvent = *(triggerEventHandle.
product());
214 if (triggerResults.isValid()) {
215 std::vector<std::string>
modules;
216 h_nHLT->Fill(triggerResults->size());
219 const std::vector<std::string> & triggerNames_ = triggerNames.
triggerNames();
220 for (
unsigned int iHLT=0; iHLT<triggerResults->size(); iHLT++) {
222 unsigned int triggerindx = hltConfig.
triggerIndex(triggerNames_[iHLT]);
223 const std::vector<std::string>& moduleLabels(hltConfig.
moduleLabels(triggerindx));
224 edm::LogInfo(
"IsoTrack") << iHLT <<
" " <<triggerNames_[iHLT];
227 if (triggerNames_[iHLT] ==
HLTNames[
i]) {
234 HLTNames.push_back(triggerNames_[iHLT]);
235 h_HLTAccept->GetXaxis()->SetBinLabel(ipos+1,triggerNames_[iHLT].c_str());
238 int hlt = triggerResults->accept(iHLT);
244 <<
" Event " <<
Event
247 if (triggerNames_[iHLT].
find(
trigNames[
i].c_str())!=std::string::npos) {
249 edm::LogInfo(
"IsoTrack") <<
"This is the trigger we are looking for " << triggerNames_[iHLT];
250 if (hlt > 0) ok =
true;
256 std::vector<math::XYZTLorentzVector> vec[3];
260 int prescale = preL1*preHLT;
262 edm::LogInfo(
"IsoTrack") << triggerNames_[iHLT] <<
" accept "
263 << hlt <<
" preL1 " << preL1 <<
" preHLT "
264 << preHLT <<
" preScale " << prescale;
265 std::pair<unsigned int, std::string> iRunTrig =
266 std::pair<unsigned int, std::string>(
Run,triggerNames_[iHLT]);
270 TrigList.insert(std::pair<std::pair<unsigned int, std::string>,
unsigned int>(iRunTrig,1));
271 TrigPreList.insert(std::pair<std::pair<unsigned int, std::string>, std::pair<int, int>>(iRunTrig,
prescales));
274 for (
unsigned int ifilter=0; ifilter<triggerEvent.
sizeFilters(); ++ifilter) {
275 std::vector<int>
Keys;
278 for (
unsigned int imodule=0; imodule<moduleLabels.size(); imodule++) {
279 if (label.find(moduleLabels[imodule]) != std::string::npos) {
282 for (
unsigned int ifiltrKey=0; ifiltrKey<triggerEvent.
filterKeys(ifilter).size(); ++ifiltrKey) {
283 Keys.push_back(triggerEvent.
filterKeys(ifilter)[ifiltrKey]);
286 if(label.find(
"hltSingleJet") != std::string::npos) {
287 vec[1].push_back(v4);
288 }
else if (label.find(
"hlt1PFJet") != std::string::npos) {
289 vec[2].push_back(v4);
291 vec[0].push_back(v4);
294 edm::LogInfo(
"IsoTrack") <<
"key " << ifiltrKey <<
" : pt "
295 << TO.
pt() <<
" eta " << TO.
eta()
296 <<
" phi " << TO.
phi() <<
" mass "
297 << TO.
mass() <<
" Id " << TO.
id();
304 for (
int j=0;
j<3;
j++) {
305 for (
unsigned int k=0;
k<vec[
j].size();
k++) {
307 << vec[
j][
k].pt() <<
" eta "
308 << vec[
j][
k].eta() <<
" phi "
313 double deta, dphi, dr;
317 for (
int lvl=1; lvl<3; lvl++) {
318 for (
unsigned int i=0;
i<vec[lvl].size();
i++) {
319 deta =
dEta(vec[0][0],vec[lvl][
i]);
320 dphi =
dPhi(vec[0][0],vec[lvl][i]);
321 dr =
dR(vec[0][0],vec[lvl][i]);
324 <<
" deta " << deta <<
" dphi "
325 << dphi <<
" dR " << dr;
328 mindRvec1 = vec[lvl][
i];
333 for(pfItr=pfJetsHandle->begin();pfItr!=pfJetsHandle->end(); pfItr++){
339 << pfItr->pt() <<
"/" << pfItr->eta()
340 <<
"/" << pfItr->phi();
344 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
346 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
347 unsigned int nTracks=0,nselTracks=0;
348 for (trkDetItr = trkCaloDirections.begin(),nTracks=0;
349 trkDetItr != trkCaloDirections.end(); trkDetItr++,nTracks++) {
350 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
353 trackinfo.SetPxPyPzE(pTrack->
px(), pTrack->
py(), pTrack->
pz(), pTrack->
p());
356 <<
" (pt/eta/phi/p) :" << pTrack->
pt()
357 <<
"/" << pTrack->
eta() <<
"/"
358 << pTrack->
phi() <<
"/" << pTrack->
p();
362 for (
unsigned int k=0;
k<vec[2].size(); ++
k) {
363 dr =
dR(vec[2][
k],v4);
366 mindRvec2 = vec[2][
k];
370 edm::LogInfo(
"IsoTrack") <<
"Closest L3 object at mindr :"
371 << mindR2 <<
" is " << mindRvec2;
372 double mindR =
dR(mindRvec1,v4);
374 unsigned int i1 =
drCuts.size();
375 for (
unsigned int ik=0; ik<
drCuts.size(); ++ik) {
380 unsigned int i2 =
drCuts.size();
381 for (
unsigned int ik=0; ik<
drCuts.size(); ++ik) {
382 if (mindR2 <
drCuts[ik]) {
390 if (trkDetItr->okHCAL) {
395 edm::LogInfo(
"IsoTrack") <<
"seltlk/okECAL/okHCAL : "<< selectTk
396 <<
"/" << trkDetItr->okECAL <<
"/"
397 << trkDetItr->okHCAL <<
" iEta "
398 << ieta <<
" Classify " << i1 <<
":"
400 if (selectTk && trkDetItr->okECAL && trkDetItr->okHCAL) {
402 int nRH_eMipDR=0, nNearTRKs=0;
403 double e1 =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
404 trkDetItr->pointHCAL, trkDetItr->pointECAL,
405 a_neutR1, trkDetItr->directionECAL, nRH_eMipDR);
406 double e2 =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
407 trkDetItr->pointHCAL, trkDetItr->pointECAL,
408 a_neutR2, trkDetItr->directionECAL, nRH_eMipDR);
409 double eMipDR =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
410 trkDetItr->pointHCAL, trkDetItr->pointECAL,
411 a_mipR, trkDetItr->directionECAL, nRH_eMipDR);
412 int ietaHotCell(-99), iphiHotCell(-99), nRecHitsCone(-999);
413 double distFromHotCell(-99.0);
414 std::vector<DetId> coneRecHitDetIds;
416 double eHcal =
spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL, trkDetItr->pointECAL,
417 a_coneR, trkDetItr->directionHCAL, nRecHitsCone,
418 coneRecHitDetIds, distFromHotCell,
419 ietaHotCell, iphiHotCell, gposHotCell);
422 double e_inCone = e2 - e1;
426 <<
" (pt/eta/phi/p) :" << pTrack->
pt()
427 <<
"/" << pTrack->
eta() <<
"/"
428 << pTrack->
phi() <<
"/"
429 << pTrack->
p() <<
"\n"
430 <<
" (MIP/neu_isol/charge_iso/HCAL_energy/iEta/distfromHcell/iEtaHcell) = "
431 << eMipDR <<
"/"<< e_inCone <<
"/"
432 << conehmaxNearP <<
"/" << eHcal
433 <<
"/" << ieta <<
"/" << distFromHotCell
434 <<
"/" <<ietaHotCell;
443 t_emip->push_back(eMipDR);
455 edm::LogInfo(
"IsoTrack") <<
"selected tracks = " << nselTracks
456 <<
"\nevent weight is = " << flatPtWeight
457 <<
"\n L1 trigger object : pt/eta/phi "
458 << vec[0][0].pt() <<
"/" << vec[0][0].eta()
459 <<
"/" << vec[0][0].phi()
460 <<
"\n L3 trigger object : pt/eta/phi "
461 << vec[2][0].pt() <<
"/" << vec[2][0].eta()
462 <<
"/"<< vec[2][0].phi();
478 edm::LogInfo(
"IsoTrack") <<
"New trigger menu found !!!";
479 const unsigned int n(hltConfig.
size());
480 for (
unsigned itrig=0; itrig<triggerNames_.size(); itrig++) {
481 unsigned int triggerindx = hltConfig.
triggerIndex(triggerNames_[itrig]);
482 if (triggerindx >=
n)
484 << triggerindx <<
" does not exist";
487 << triggerindx <<
" exists";
497 h_nHLT =
fs->
make<TH1I>(
"h_nHLT" ,
"size of trigger Names", 1000, 0, 1000);
498 h_HLTAccept =
fs->
make<TH1I>(
"h_HLTAccept",
"HLT Accepts for all runs", 1000, 0, 1000);
501 tree->Branch(
"Run",&
Run,
"Run/I");
502 tree->Branch(
"Event",&
Event,
"Event/I");
503 t_trackP =
new std::vector<double>();
512 t_emip =
new std::vector<double>();
513 t_ehcal =
new std::vector<double>();
515 t_ieta =
new std::vector<int>();
519 t_l1pt =
new std::vector<double>();
520 t_l1eta =
new std::vector<double>();
521 t_l1phi =
new std::vector<double>();
522 t_l3pt =
new std::vector<double>();
523 t_l3eta =
new std::vector<double>();
524 t_l3phi =
new std::vector<double>();
529 tree->Branch(
"t_trackP",
"std::vector<double>",&
t_trackP);
530 tree->Branch(
"t_trackPx",
"std::vector<double>",&t_trackPx);
531 tree->Branch(
"t_trackPy",
"std::vector<double>",&t_trackPy);
532 tree->Branch(
"t_trackPz",
"std::vector<double>",&t_trackPz);
533 tree->Branch(
"t_trackEta",
"std::vector<double>",&t_trackEta);
534 tree->Branch(
"t_trackPhi",
"vector<double>",&t_trackPhi);
535 tree->Branch(
"t_trackPt",
"std::vector<double>",&t_trackPt);
536 tree->Branch(
"t_neu_iso",
"std::vector<double>",&t_neu_iso);
537 tree->Branch(
"t_charge_iso",
"std::vector<double>",&t_charge_iso);
538 tree->Branch(
"t_emip",
"std::vector<double>",&t_emip);
539 tree->Branch(
"t_ehcal",
"std::vector<double>",&t_ehcal);
540 tree->Branch(
"t_trkL3mindr",
"std::vector<double>",&t_trkL3mindr);
541 tree->Branch(
"t_ieta",
"std::vector<int>",&t_ieta);
542 tree->Branch(
"t_disthotcell",
"std::vector<double>",&t_disthotcell);
543 tree->Branch(
"t_ietahotcell",
"std::vector<double>",&t_ietahotcell);
544 tree->Branch(
"t_eventweight",
"std::vector<double>",&t_eventweight);
545 tree->Branch(
"t_l1pt",
"std::vector<double>",&t_l1pt);
546 tree->Branch(
"t_l1eta",
"std::vector<double>",&t_l1eta);
547 tree->Branch(
"t_l1phi",
"std::vector<double>",&t_l1phi);
548 tree->Branch(
"t_l3pt",
"std::vector<double>",&t_l3pt);
549 tree->Branch(
"t_l3eta",
"std::vector<double>",&t_l3eta);
550 tree->Branch(
"t_l3phi",
"std::vector<double>",&t_l3phi);
551 tree->Branch(
"t_leadingpt",
"std::vector<double>",&t_leadingpt);
552 tree->Branch(
"t_leadingeta",
"std::vector<double>",&t_leadingeta);
553 tree->Branch(
"t_leadingphi",
"std::vector<double>",&t_leadingphi);
558 unsigned int preL1, preHLT;
559 std::map<std::pair<unsigned int, std::string>,
unsigned int>::iterator itr;
560 std::map<std::pair<unsigned int, std::string>,
const std::pair<int, int>>::iterator itrPre;
569 preL1 = (itrPre->second).
first;
570 preHLT = (itrPre->second).
second;
571 g_Accepts->Fill((itr->first).first, itr->second);
572 g_PreL1->Fill((itr->first).first, preL1);
573 g_PreHLT->Fill((itr->first).first, preHLT);
574 g_Pre->Fill((itr->first).first, preL1*preHLT);
582 char hname[100], htit[100];
583 sprintf(hname,
"h_HLTAccepts_%i", iRun.
run());
584 sprintf(htit,
"HLT Accepts for Run No %i", iRun.
run());
585 TH1I *hnew =
fs->
make<TH1I>(hname, htit, 1000, 0, 1000);
610 return (vec1.eta()-vec2.eta());
618 return reco::deltaR(vec1.eta(),vec1.phi(),vec2.eta(),vec2.phi());
622 return (vec1.pt()-vec2.pt());
626 return (
std::abs(vec1.r()-vec2.r()));
630 return ((1/vec1.pt())-(1/vec2.pt()));
unsigned int size() const
number of trigger paths in trigger table
double p() const
momentum vector magnitude
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
std::vector< double > * t_trackP
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, std::string &theTrackQuality, bool debug=false)
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
The single EDProduct to be saved for each event (AOD case)
trigger::size_type sizeFilters() const
std::vector< double > * t_trackEta
std::vector< double > * t_l3pt
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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)
const Keys & filterKeys(trigger::size_type index) const
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
int bunchCrossing() const
std::vector< double > * t_eventweight
edm::LuminosityBlockNumber_t luminosityBlock() const
double phi() const
azimuthal angle of momentum vector
T * make(const Args &...args) const
make new ROOT object
std::vector< double > * t_trackPhi
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
double deltaR(const T1 &t1, const T2 &t2)
double px() const
x coordinate of momentum vector
std::vector< double > * t_leadingeta
std::vector< double > * t_disthotcell
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes
Strings const & triggerNames() const
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
std::vector< double > * t_leadingphi
std::vector< TH1I * > h_HLTAccepts
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
std::vector< int > * t_ieta
Single trigger physics object (e.g., an isolated muon)
U second(std::pair< T, U > const &p)
std::string theTrackQuality
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
std::vector< double > * t_l1pt
edm::EDGetTokenT< trigger::TriggerEvent > tok_trigEvt
std::vector< double > * t_trackPt
std::vector< double > * t_trackPy
double dR(double eta1, double eta2, double phi1, double phi2)
std::vector< double > drCuts
std::vector< std::string > HLTNames
std::vector< double > * t_ehcal
double dinvPt(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
std::vector< double > * t_trackPx
double eta() const
pseudorapidity of momentum vector
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< double > * t_ietahotcell
edm::Service< TFileService > fs
edm::EDGetTokenT< reco::BeamSpot > tok_bs_
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
const TriggerObjectCollection & getObjects() const
std::vector< double > vec1
double pt() const
track transverse momentum
int ieta() const
get the cell ieta
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
Abs< T >::type abs(const T &t)
HLTPrescaleProvider hltPrescaleProvider_
edm::EDGetTokenT< reco::PFJetCollection > tok_pf_
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)
edm::EDGetTokenT< LumiDetails > tok_lumi
LuminosityBlock const & getLuminosityBlock() const
static std::string const triggerResults
std::vector< double > * t_l1phi
double pz() const
z coordinate of momentum vector
std::vector< double > * t_emip
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
double dP(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
double deltaPhi(double phi1, double phi2)
const edm::InputTag filterTag(trigger::size_type index) const
std::vector< double > * t_charge_iso
double dEta(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
std::vector< double > * t_l3phi
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 &)
T const * product() const
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 debug=false)
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< size_type > Keys
edm::EDGetTokenT< GenEventInfoProduct > tok_ew_
T const * product() const
std::pair< int, int > prescaleValues(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
Combined L1T (pair.first) and HLT (pair.second) prescales per HLT path.
std::vector< double > * t_trackPz
std::map< std::pair< unsigned int, std::string >, unsigned int > TrigList
HLTConfigProvider const & hltConfigProvider() const
spr::trackSelectionParameters selectionParameters
std::vector< double > * t_l3eta
reco::TrackBase::TrackQuality minQuality
edm::InputTag theTriggerResultsLabel
double dPhi(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
volatile std::atomic< bool > shutdown_flag false
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
double dPt(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
std::vector< double > * t_l1eta
std::map< std::pair< unsigned int, std::string >, const std::pair< int, int > > TrigPreList
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
std::vector< double > * t_leadingpt
std::vector< double > * t_trkL3mindr
std::vector< double > * t_neu_iso
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
double py() const
y coordinate of momentum vector
std::vector< std::string > trigNames
IsoTrackCalib(const edm::ParameterSet &)