7 changed(
false), nRun(0), t_trackP(0), t_trackPx(0), t_trackPy(0),
8 t_trackPz(0), t_trackEta(0), t_trackPhi(0), t_trackPt(0), t_neu_iso(0),
9 t_charge_iso(0), t_emip(0), t_ehcal(0), t_trkL3mindr(0), t_ieta(0),
10 t_disthotcell(0), t_ietahotcell(0), t_eventweight(0), t_l1pt(0), t_l1eta(0),
11 t_l1phi(0), t_l3pt(0), t_l3eta(0), t_l3phi(0), t_leadingpt(0),
12 t_leadingeta(0), t_leadingphi(0) {
66 edm::LogInfo(
"IsoTrack") <<
"Parameters read from config file \n"
68 <<
"\t theTrackQuality " << theTrackQuality
85 edm::LogInfo(
"IsoTrack") << trigNames.size() <<
" triggers to be studied";
86 for (
unsigned int k=0;
k<trigNames.size(); ++
k)
87 edm::LogInfo(
"IsoTrack") <<
"Trigger[" <<
k <<
"] : " << trigNames[
k];
88 edm::LogInfo(
"IsoTrack") << drCuts.size() <<
" Delta R zones wrt trigger objects";
89 for (
unsigned int k=0;
k<drCuts.size(); ++
k)
151 reco::TrackCollection::const_iterator trkItr;
153 double flatPtWeight = 0.0;
157 flatPtWeight = genEventInfo->weight();
162 reco::PFJetCollection::const_iterator pfItr;
170 if (recVtxs->size()>0 && !((*recVtxs)[0].isFake())) {
171 leadPV =
math::XYZPoint( (*recVtxs)[0].
x(),(*recVtxs)[0].
y(), (*recVtxs)[0].
z() );
172 }
else if (beamSpotH.
isValid()) {
173 leadPV = beamSpotH->position();
176 edm::LogInfo(
"IsoTrack") <<
"Primary Vertex " << leadPV;
178 << beamSpotH->position();
199 if (!triggerEventHandle.
isValid()) {
203 triggerEvent = *(triggerEventHandle.
product());
209 if (triggerResults.isValid()) {
210 std::vector<std::string>
modules;
211 h_nHLT->Fill(triggerResults->size());
214 const std::vector<std::string> & triggerNames_ = triggerNames.
triggerNames();
215 for (
unsigned int iHLT=0; iHLT<triggerResults->size(); iHLT++) {
219 edm::LogInfo(
"IsoTrack") << iHLT <<
" " <<triggerNames_[iHLT];
222 if (triggerNames_[iHLT] ==
HLTNames[
i]) {
229 HLTNames.push_back(triggerNames_[iHLT]);
230 h_HLTAccept->GetXaxis()->SetBinLabel(ipos+1,triggerNames_[iHLT].c_str());
233 int hlt = triggerResults->accept(iHLT);
239 <<
" Event " <<
Event
242 if (triggerNames_[iHLT].
find(
trigNames[
i].c_str())!=std::string::npos) {
244 edm::LogInfo(
"IsoTrack") <<
"This is the trigger we are looking for " << triggerNames_[iHLT];
245 if (hlt > 0) ok =
true;
251 std::vector<math::XYZTLorentzVector> vec[3];
255 int prescale = preL1*preHLT;
257 edm::LogInfo(
"IsoTrack") << triggerNames_[iHLT] <<
" accept "
258 << hlt <<
" preL1 " << preL1 <<
" preHLT "
259 << preHLT <<
" preScale " << prescale;
260 std::pair<unsigned int, std::string> iRunTrig =
261 std::pair<unsigned int, std::string>(
Run,triggerNames_[iHLT]);
265 TrigList.insert(std::pair<std::pair<unsigned int, std::string>,
unsigned int>(iRunTrig,1));
266 TrigPreList.insert(std::pair<std::pair<unsigned int, std::string>, std::pair<int, int>>(iRunTrig,
prescales));
269 for (
unsigned int ifilter=0; ifilter<triggerEvent.
sizeFilters(); ++ifilter) {
270 std::vector<int>
Keys;
273 for (
unsigned int imodule=0; imodule<moduleLabels.size(); imodule++) {
274 if (label.find(moduleLabels[imodule]) != std::string::npos) {
277 for (
unsigned int ifiltrKey=0; ifiltrKey<triggerEvent.
filterKeys(ifilter).size(); ++ifiltrKey) {
278 Keys.push_back(triggerEvent.
filterKeys(ifilter)[ifiltrKey]);
281 if(label.find(
"hltSingleJet") != std::string::npos) {
282 vec[1].push_back(v4);
283 }
else if (label.find(
"hlt1PFJet") != std::string::npos) {
284 vec[2].push_back(v4);
286 vec[0].push_back(v4);
289 edm::LogInfo(
"IsoTrack") <<
"key " << ifiltrKey <<
" : pt "
290 << TO.
pt() <<
" eta " << TO.
eta()
291 <<
" phi " << TO.
phi() <<
" mass "
292 << TO.
mass() <<
" Id " << TO.
id();
299 for (
int j=0;
j<3;
j++) {
300 for (
unsigned int k=0;
k<vec[
j].size();
k++) {
302 << vec[
j][
k].pt() <<
" eta "
303 << vec[
j][
k].eta() <<
" phi "
308 double deta, dphi, dr;
312 for (
int lvl=1; lvl<3; lvl++) {
313 for (
unsigned int i=0;
i<vec[lvl].size();
i++) {
314 deta =
dEta(vec[0][0],vec[lvl][
i]);
315 dphi =
dPhi(vec[0][0],vec[lvl][i]);
316 dr =
dR(vec[0][0],vec[lvl][i]);
319 <<
" deta " << deta <<
" dphi "
320 << dphi <<
" dR " << dr;
323 mindRvec1 = vec[lvl][
i];
328 for(pfItr=pfJetsHandle->begin();pfItr!=pfJetsHandle->end(); pfItr++){
334 << pfItr->pt() <<
"/" << pfItr->eta()
335 <<
"/" << pfItr->phi();
339 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
341 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
342 unsigned int nTracks=0,nselTracks=0;
343 for (trkDetItr = trkCaloDirections.begin(),nTracks=0;
344 trkDetItr != trkCaloDirections.end(); trkDetItr++,nTracks++) {
345 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
348 trackinfo.SetPxPyPzE(pTrack->
px(), pTrack->
py(), pTrack->
pz(), pTrack->
p());
351 <<
" (pt/eta/phi/p) :" << pTrack->
pt()
352 <<
"/" << pTrack->
eta() <<
"/"
353 << pTrack->
phi() <<
"/" << pTrack->
p();
357 for (
unsigned int k=0;
k<vec[2].size(); ++
k) {
358 dr =
dR(vec[2][
k],v4);
361 mindRvec2 = vec[2][
k];
365 edm::LogInfo(
"IsoTrack") <<
"Closest L3 object at mindr :"
366 << mindR2 <<
" is " << mindRvec2;
367 double mindR =
dR(mindRvec1,v4);
369 unsigned int i1 =
drCuts.size();
370 for (
unsigned int ik=0; ik<
drCuts.size(); ++ik) {
375 unsigned int i2 =
drCuts.size();
376 for (
unsigned int ik=0; ik<
drCuts.size(); ++ik) {
377 if (mindR2 <
drCuts[ik]) {
385 if (trkDetItr->okHCAL) {
390 edm::LogInfo(
"IsoTrack") <<
"seltlk/okECAL/okHCAL : "<< selectTk
391 <<
"/" << trkDetItr->okECAL <<
"/"
392 << trkDetItr->okHCAL <<
" iEta "
393 << ieta <<
" Classify " << i1 <<
":"
395 if (selectTk && trkDetItr->okECAL && trkDetItr->okHCAL) {
397 int nRH_eMipDR=0, nNearTRKs=0;
398 double e1 =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
399 trkDetItr->pointHCAL, trkDetItr->pointECAL,
400 a_neutR1, trkDetItr->directionECAL, nRH_eMipDR);
401 double e2 =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
402 trkDetItr->pointHCAL, trkDetItr->pointECAL,
403 a_neutR2, trkDetItr->directionECAL, nRH_eMipDR);
404 double eMipDR =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
405 trkDetItr->pointHCAL, trkDetItr->pointECAL,
406 a_mipR, trkDetItr->directionECAL, nRH_eMipDR);
407 int ietaHotCell(-99), iphiHotCell(-99), nRecHitsCone(-999);
408 double distFromHotCell(-99.0);
409 std::vector<DetId> coneRecHitDetIds;
411 double eHcal =
spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL, trkDetItr->pointECAL,
412 a_coneR, trkDetItr->directionHCAL, nRecHitsCone,
413 coneRecHitDetIds, distFromHotCell,
414 ietaHotCell, iphiHotCell, gposHotCell);
417 double e_inCone = e2 - e1;
421 <<
" (pt/eta/phi/p) :" << pTrack->
pt()
422 <<
"/" << pTrack->
eta() <<
"/"
423 << pTrack->
phi() <<
"/"
424 << pTrack->
p() <<
"\n"
425 <<
" (MIP/neu_isol/charge_iso/HCAL_energy/iEta/distfromHcell/iEtaHcell) = "
426 << eMipDR <<
"/"<< e_inCone <<
"/"
427 << conehmaxNearP <<
"/" << eHcal
428 <<
"/" << ieta <<
"/" << distFromHotCell
429 <<
"/" <<ietaHotCell;
438 t_emip->push_back(eMipDR);
450 edm::LogInfo(
"IsoTrack") <<
"selected tracks = " << nselTracks
451 <<
"\nevent weight is = " << flatPtWeight
452 <<
"\n L1 trigger object : pt/eta/phi "
453 << vec[0][0].pt() <<
"/" << vec[0][0].eta()
454 <<
"/" << vec[0][0].phi()
455 <<
"\n L3 trigger object : pt/eta/phi "
456 << vec[2][0].pt() <<
"/" << vec[2][0].eta()
457 <<
"/"<< vec[2][0].phi();
473 edm::LogInfo(
"IsoTrack") <<
"New trigger menu found !!!";
475 for (
unsigned itrig=0; itrig<triggerNames_.size(); itrig++) {
477 if (triggerindx >=
n)
479 << triggerindx <<
" does not exist";
482 << triggerindx <<
" exists";
492 h_nHLT =
fs->
make<TH1I>(
"h_nHLT" ,
"size of trigger Names", 1000, 0, 1000);
493 h_HLTAccept =
fs->
make<TH1I>(
"h_HLTAccept",
"HLT Accepts for all runs", 1000, 0, 1000);
496 tree->Branch(
"Run",&
Run,
"Run/I");
497 tree->Branch(
"Event",&
Event,
"Event/I");
498 t_trackP =
new std::vector<double>();
507 t_emip =
new std::vector<double>();
508 t_ehcal =
new std::vector<double>();
510 t_ieta =
new std::vector<int>();
514 t_l1pt =
new std::vector<double>();
515 t_l1eta =
new std::vector<double>();
516 t_l1phi =
new std::vector<double>();
517 t_l3pt =
new std::vector<double>();
518 t_l3eta =
new std::vector<double>();
519 t_l3phi =
new std::vector<double>();
524 tree->Branch(
"t_trackP",
"std::vector<double>",&
t_trackP);
525 tree->Branch(
"t_trackPx",
"std::vector<double>",&t_trackPx);
526 tree->Branch(
"t_trackPy",
"std::vector<double>",&t_trackPy);
527 tree->Branch(
"t_trackPz",
"std::vector<double>",&t_trackPz);
528 tree->Branch(
"t_trackEta",
"std::vector<double>",&t_trackEta);
529 tree->Branch(
"t_trackPhi",
"vector<double>",&t_trackPhi);
530 tree->Branch(
"t_trackPt",
"std::vector<double>",&t_trackPt);
531 tree->Branch(
"t_neu_iso",
"std::vector<double>",&t_neu_iso);
532 tree->Branch(
"t_charge_iso",
"std::vector<double>",&t_charge_iso);
533 tree->Branch(
"t_emip",
"std::vector<double>",&t_emip);
534 tree->Branch(
"t_ehcal",
"std::vector<double>",&t_ehcal);
535 tree->Branch(
"t_trkL3mindr",
"std::vector<double>",&t_trkL3mindr);
536 tree->Branch(
"t_ieta",
"std::vector<int>",&t_ieta);
537 tree->Branch(
"t_disthotcell",
"std::vector<double>",&t_disthotcell);
538 tree->Branch(
"t_ietahotcell",
"std::vector<double>",&t_ietahotcell);
539 tree->Branch(
"t_eventweight",
"std::vector<double>",&t_eventweight);
540 tree->Branch(
"t_l1pt",
"std::vector<double>",&t_l1pt);
541 tree->Branch(
"t_l1eta",
"std::vector<double>",&t_l1eta);
542 tree->Branch(
"t_l1phi",
"std::vector<double>",&t_l1phi);
543 tree->Branch(
"t_l3pt",
"std::vector<double>",&t_l3pt);
544 tree->Branch(
"t_l3eta",
"std::vector<double>",&t_l3eta);
545 tree->Branch(
"t_l3phi",
"std::vector<double>",&t_l3phi);
546 tree->Branch(
"t_leadingpt",
"std::vector<double>",&t_leadingpt);
547 tree->Branch(
"t_leadingeta",
"std::vector<double>",&t_leadingeta);
548 tree->Branch(
"t_leadingphi",
"std::vector<double>",&t_leadingphi);
553 unsigned int preL1, preHLT;
554 std::map<std::pair<unsigned int, std::string>,
unsigned int>::iterator itr;
555 std::map<std::pair<unsigned int, std::string>,
const std::pair<int, int>>::iterator itrPre;
564 preL1 = (itrPre->second).
first;
565 preHLT = (itrPre->second).
second;
566 g_Accepts->Fill((itr->first).first, itr->second);
567 g_PreL1->Fill((itr->first).first, preL1);
568 g_PreHLT->Fill((itr->first).first, preHLT);
569 g_Pre->Fill((itr->first).first, preL1*preHLT);
577 char hname[100], htit[100];
578 sprintf(hname,
"h_HLTAccepts_%i", iRun.
run());
579 sprintf(htit,
"HLT Accepts for Run No %i", iRun.
run());
580 TH1I *hnew =
fs->
make<TH1I>(hname, htit, 1000, 0, 1000);
605 return (vec1.eta()-vec2.eta());
613 return reco::deltaR(vec1.eta(),vec1.phi(),vec2.eta(),vec2.phi());
617 return (vec1.pt()-vec2.pt());
621 return (
std::abs(vec1.r()-vec2.r()));
625 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
HLTConfigProvider hltConfig_
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)
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
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
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) const
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
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
double py() const
y coordinate of momentum vector
std::vector< std::string > trigNames
IsoTrackCalib(const edm::ParameterSet &)