61 edm::LogInfo(
"IsoTrack") <<
"Parameters read from config file \n"
63 <<
"\t theTrackQuality " << theTrackQuality
80 edm::LogInfo(
"IsoTrack") << trigNames.size() <<
" triggers to be studied";
81 for (
unsigned int k=0;
k<trigNames.size(); ++
k)
82 edm::LogInfo(
"IsoTrack") <<
"Trigger[" <<
k <<
"] : " << trigNames[
k];
83 edm::LogInfo(
"IsoTrack") << drCuts.size() <<
" Delta R zones wrt trigger objects";
84 for (
unsigned int k=0;
k<drCuts.size(); ++
k)
121 reco::TrackCollection::const_iterator trkItr;
123 double flatPtWeight = 0.0;
127 flatPtWeight = genEventInfo->weight();
132 reco::PFJetCollection::const_iterator pfItr;
140 if (recVtxs->size()>0 && !((*recVtxs)[0].isFake())) {
141 leadPV =
math::XYZPoint( (*recVtxs)[0].
x(),(*recVtxs)[0].
y(), (*recVtxs)[0].
z() );
142 }
else if (beamSpotH.
isValid()) {
143 leadPV = beamSpotH->position();
146 edm::LogInfo(
"IsoTrack") <<
"Primary Vertex " << leadPV;
148 << beamSpotH->position();
169 if (!triggerEventHandle.
isValid()) {
173 triggerEvent = *(triggerEventHandle.
product());
179 if (triggerResults.isValid()) {
180 std::vector<std::string>
modules;
181 h_nHLT->Fill(triggerResults->size());
184 const std::vector<std::string> & triggerNames_ = triggerNames.
triggerNames();
185 for (
unsigned int iHLT=0; iHLT<triggerResults->size(); iHLT++) {
189 edm::LogInfo(
"IsoTrack") << iHLT <<
" " <<triggerNames_[iHLT];
192 if (triggerNames_[iHLT] ==
HLTNames[
i]) {
199 HLTNames.push_back(triggerNames_[iHLT]);
200 h_HLTAccept->GetXaxis()->SetBinLabel(ipos+1,triggerNames_[iHLT].c_str());
203 int hlt = triggerResults->accept(iHLT);
209 <<
" Event " <<
Event
212 if (triggerNames_[iHLT].
find(
trigNames[
i].c_str())!=std::string::npos) {
214 edm::LogInfo(
"IsoTrack") <<
"This is the trigger we are looking for " << triggerNames_[iHLT];
215 if (hlt > 0) ok =
true;
221 std::vector<math::XYZTLorentzVector> vec[3];
225 int prescale = preL1*preHLT;
227 edm::LogInfo(
"IsoTrack") << triggerNames_[iHLT] <<
" accept "
228 << hlt <<
" preL1 " << preL1 <<
" preHLT "
229 << preHLT <<
" preScale " << prescale;
230 std::pair<unsigned int, std::string> iRunTrig =
231 std::pair<unsigned int, std::string>(
Run,triggerNames_[iHLT]);
235 TrigList.insert(std::pair<std::pair<unsigned int, std::string>,
unsigned int>(iRunTrig,1));
236 TrigPreList.insert(std::pair<std::pair<unsigned int, std::string>, std::pair<int, int>>(iRunTrig,
prescales));
239 for (
unsigned int ifilter=0; ifilter<triggerEvent.
sizeFilters(); ++ifilter) {
240 std::vector<int>
Keys;
243 for (
unsigned int imodule=0; imodule<moduleLabels.size(); imodule++) {
244 if (label.find(moduleLabels[imodule]) != std::string::npos) {
247 for (
unsigned int ifiltrKey=0; ifiltrKey<triggerEvent.
filterKeys(ifilter).size(); ++ifiltrKey) {
248 Keys.push_back(triggerEvent.
filterKeys(ifilter)[ifiltrKey]);
251 if(label.find(
"hltSingleJet") != std::string::npos) {
252 vec[1].push_back(v4);
253 }
else if (label.find(
"hlt1PFJet") != std::string::npos) {
254 vec[2].push_back(v4);
256 vec[0].push_back(v4);
259 edm::LogInfo(
"IsoTrack") <<
"key " << ifiltrKey <<
" : pt "
260 << TO.
pt() <<
" eta " << TO.
eta()
261 <<
" phi " << TO.
phi() <<
" mass "
262 << TO.
mass() <<
" Id " << TO.
id();
269 for (
int j=0;
j<3;
j++) {
270 for (
unsigned int k=0;
k<vec[
j].size();
k++) {
272 << vec[
j][
k].pt() <<
" eta "
273 << vec[
j][
k].eta() <<
" phi "
278 double deta, dphi, dr;
282 for (
int lvl=1; lvl<3; lvl++) {
283 for (
unsigned int i=0;
i<vec[lvl].size();
i++) {
284 deta =
dEta(vec[0][0],vec[lvl][
i]);
285 dphi =
dPhi(vec[0][0],vec[lvl][i]);
286 dr =
dR(vec[0][0],vec[lvl][i]);
289 <<
" deta " << deta <<
" dphi "
290 << dphi <<
" dR " << dr;
293 mindRvec1 = vec[lvl][
i];
298 for(pfItr=pfJetsHandle->begin();pfItr!=pfJetsHandle->end(); pfItr++){
304 << pfItr->pt() <<
"/" << pfItr->eta()
305 <<
"/" << pfItr->phi();
309 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
311 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
312 unsigned int nTracks=0,nselTracks=0;
313 for (trkDetItr = trkCaloDirections.begin(),nTracks=0;
314 trkDetItr != trkCaloDirections.end(); trkDetItr++,nTracks++) {
315 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
318 trackinfo.SetPxPyPzE(pTrack->
px(), pTrack->
py(), pTrack->
pz(), pTrack->
p());
321 <<
" (pt/eta/phi/p) :" << pTrack->
pt()
322 <<
"/" << pTrack->
eta() <<
"/"
323 << pTrack->
phi() <<
"/" << pTrack->
p();
327 for (
unsigned int k=0;
k<vec[2].size(); ++
k) {
328 dr =
dR(vec[2][
k],v4);
331 mindRvec2 = vec[2][
k];
335 edm::LogInfo(
"IsoTrack") <<
"Closest L3 object at mindr :"
336 << mindR2 <<
" is " << mindRvec2;
337 double mindR =
dR(mindRvec1,v4);
339 unsigned int i1 =
drCuts.size();
340 for (
unsigned int ik=0; ik<
drCuts.size(); ++ik) {
345 unsigned int i2 =
drCuts.size();
346 for (
unsigned int ik=0; ik<
drCuts.size(); ++ik) {
347 if (mindR2 <
drCuts[ik]) {
355 if (trkDetItr->okHCAL) {
360 edm::LogInfo(
"IsoTrack") <<
"seltlk/okECAL/okHCAL : "<< selectTk
361 <<
"/" << trkDetItr->okECAL <<
"/"
362 << trkDetItr->okHCAL <<
" iEta "
363 << ieta <<
" Classify " << i1 <<
":"
365 if (selectTk && trkDetItr->okECAL && trkDetItr->okHCAL) {
367 int nRH_eMipDR=0, nNearTRKs=0;
368 double e1 =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
369 trkDetItr->pointHCAL, trkDetItr->pointECAL,
370 a_neutR1, trkDetItr->directionECAL, nRH_eMipDR);
371 double e2 =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
372 trkDetItr->pointHCAL, trkDetItr->pointECAL,
373 a_neutR2, trkDetItr->directionECAL, nRH_eMipDR);
374 double eMipDR =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
375 trkDetItr->pointHCAL, trkDetItr->pointECAL,
376 a_mipR, trkDetItr->directionECAL, nRH_eMipDR);
377 int ietaHotCell(-99), iphiHotCell(-99), nRecHitsCone(-999);
378 double distFromHotCell(-99.0);
379 std::vector<DetId> coneRecHitDetIds;
381 double eHcal =
spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL, trkDetItr->pointECAL,
382 a_coneR, trkDetItr->directionHCAL, nRecHitsCone,
383 coneRecHitDetIds, distFromHotCell,
384 ietaHotCell, iphiHotCell, gposHotCell);
387 double e_inCone = e2 - e1;
391 <<
" (pt/eta/phi/p) :" << pTrack->
pt()
392 <<
"/" << pTrack->
eta() <<
"/"
393 << pTrack->
phi() <<
"/"
394 << pTrack->
p() <<
"\n"
395 <<
" (MIP/neu_isol/charge_iso/HCAL_energy/iEta/distfromHcell/iEtaHcell) = "
396 << eMipDR <<
"/"<< e_inCone <<
"/"
397 << conehmaxNearP <<
"/" << eHcal
398 <<
"/" << ieta <<
"/" << distFromHotCell
399 <<
"/" <<ietaHotCell;
408 t_emip->push_back(eMipDR);
420 edm::LogInfo(
"IsoTrack") <<
"selected tracks = " << nselTracks
421 <<
"\nevent weight is = " << flatPtWeight
422 <<
"\n L1 trigger object : pt/eta/phi "
423 << vec[0][0].pt() <<
"/" << vec[0][0].eta()
424 <<
"/" << vec[0][0].phi()
425 <<
"\n L3 trigger object : pt/eta/phi "
426 << vec[2][0].pt() <<
"/" << vec[2][0].eta()
427 <<
"/"<< vec[2][0].phi();
443 edm::LogInfo(
"IsoTrack") <<
"New trigger menu found !!!";
445 for (
unsigned itrig=0; itrig<triggerNames_.size(); itrig++) {
447 if (triggerindx >=
n)
449 << triggerindx <<
" does not exist";
452 << triggerindx <<
" exists";
462 h_nHLT =
fs->
make<TH1I>(
"h_nHLT" ,
"size of trigger Names", 1000, 0, 1000);
463 h_HLTAccept =
fs->
make<TH1I>(
"h_HLTAccept",
"HLT Accepts for all runs", 1000, 0, 1000);
466 tree->Branch(
"Run",&
Run,
"Run/I");
467 tree->Branch(
"Event",&
Event,
"Event/I");
468 t_trackP =
new std::vector<double>();
477 t_emip =
new std::vector<double>();
478 t_ehcal =
new std::vector<double>();
480 t_ieta =
new std::vector<int>();
484 t_l1pt =
new std::vector<double>();
485 t_l1eta =
new std::vector<double>();
486 t_l1phi =
new std::vector<double>();
487 t_l3pt =
new std::vector<double>();
488 t_l3eta =
new std::vector<double>();
489 t_l3phi =
new std::vector<double>();
494 tree->Branch(
"t_trackP",
"std::vector<double>",&
t_trackP);
495 tree->Branch(
"t_trackPx",
"std::vector<double>",&t_trackPx);
496 tree->Branch(
"t_trackPy",
"std::vector<double>",&t_trackPy);
497 tree->Branch(
"t_trackPz",
"std::vector<double>",&t_trackPz);
498 tree->Branch(
"t_trackEta",
"std::vector<double>",&t_trackEta);
499 tree->Branch(
"t_trackPhi",
"vector<double>",&t_trackPhi);
500 tree->Branch(
"t_trackPt",
"std::vector<double>",&t_trackPt);
501 tree->Branch(
"t_neu_iso",
"std::vector<double>",&t_neu_iso);
502 tree->Branch(
"t_charge_iso",
"std::vector<double>",&t_charge_iso);
503 tree->Branch(
"t_emip",
"std::vector<double>",&t_emip);
504 tree->Branch(
"t_ehcal",
"std::vector<double>",&t_ehcal);
505 tree->Branch(
"t_trkL3mindr",
"std::vector<double>",&t_trkL3mindr);
506 tree->Branch(
"t_ieta",
"std::vector<int>",&t_ieta);
507 tree->Branch(
"t_disthotcell",
"std::vector<double>",&t_disthotcell);
508 tree->Branch(
"t_ietahotcell",
"std::vector<double>",&t_ietahotcell);
509 tree->Branch(
"t_eventweight",
"std::vector<double>",&t_eventweight);
510 tree->Branch(
"t_l1pt",
"std::vector<double>",&t_l1pt);
511 tree->Branch(
"t_l1eta",
"std::vector<double>",&t_l1eta);
512 tree->Branch(
"t_l1phi",
"std::vector<double>",&t_l1phi);
513 tree->Branch(
"t_l3pt",
"std::vector<double>",&t_l3pt);
514 tree->Branch(
"t_l3eta",
"std::vector<double>",&t_l3eta);
515 tree->Branch(
"t_l3phi",
"std::vector<double>",&t_l3phi);
516 tree->Branch(
"t_leadingpt",
"std::vector<double>",&t_leadingpt);
517 tree->Branch(
"t_leadingeta",
"std::vector<double>",&t_leadingeta);
518 tree->Branch(
"t_leadingphi",
"std::vector<double>",&t_leadingphi);
523 unsigned int preL1, preHLT;
524 std::map<std::pair<unsigned int, std::string>,
unsigned int>::iterator itr;
525 std::map<std::pair<unsigned int, std::string>,
const std::pair<int, int>>::iterator itrPre;
534 preL1 = (itrPre->second).
first;
535 preHLT = (itrPre->second).
second;
536 g_Accepts->Fill((itr->first).first, itr->second);
537 g_PreL1->Fill((itr->first).first, preL1);
538 g_PreHLT->Fill((itr->first).first, preHLT);
539 g_Pre->Fill((itr->first).first, preL1*preHLT);
547 char hname[100], htit[100];
548 sprintf(hname,
"h_HLTAccepts_%i", iRun.
run());
549 sprintf(htit,
"HLT Accepts for Run No %i", iRun.
run());
550 TH1I *hnew =
fs->
make<TH1I>(hname, htit, 1000, 0, 1000);
575 return (vec1.eta()-vec2.eta());
583 return reco::deltaR(vec1.eta(),vec1.phi(),vec2.eta(),vec2.phi());
587 return (vec1.pt()-vec2.pt());
591 return (
std::abs(vec1.r()-vec2.r()));
595 return ((1/vec1.pt())-(1/vec2.pt()));
unsigned int size() const
number of trigger paths in trigger table
double p() const
momentum vector magnitude
std::vector< double > * t_ietahotcell
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)
std::vector< double > * t_l3eta
std::vector< double > * t_trackPhi
std::vector< double > * t_leadingeta
std::vector< double > * t_l1phi
const Keys & filterKeys(trigger::size_type index) const
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
int bunchCrossing() const
edm::LuminosityBlockNumber_t luminosityBlock() const
double phi() const
azimuthal angle of momentum vector
T * make(const Args &...args) const
make new ROOT object
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_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_trackPz
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
std::vector< double > * t_trackPy
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
std::vector< double > * t_l1pt
edm::EDGetTokenT< trigger::TriggerEvent > tok_trigEvt
double dR(double eta1, double eta2, double phi1, double phi2)
std::vector< double > drCuts
std::vector< std::string > HLTNames
double dinvPt(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
double eta() const
pseudorapidity of momentum vector
void addDefault(ParameterSetDescription const &psetDescription)
edm::Service< TFileService > fs
std::vector< double > * t_trkL3mindr
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
std::vector< double > * t_ehcal
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_l1eta
std::vector< double > * t_trackPt
double pz() const
z coordinate of momentum vector
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 &)
static TrackQuality qualityByName(const std::string &name)
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
std::vector< double > * t_eventweight
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_leadingphi
std::map< std::pair< unsigned int, std::string >, unsigned int > TrigList
std::vector< double > * t_neu_iso
std::vector< double > * t_l3phi
spr::trackSelectionParameters selectionParameters
std::vector< double > * t_emip
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::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
double py() const
y coordinate of momentum vector
std::vector< std::string > trigNames
std::vector< double > * t_trackPx
IsoTrackCalib(const edm::ParameterSet &)