98 void fillTrack(
int,
double,
double,
double,
double);
100 void fillEnergy(
int,
int,
double,
double,
double,
double,
double);
156 :
verbosity_(iConfig.getUntrackedParameter<
int>(
"verbosity", 0)),
160 minTrackP_(iConfig.getUntrackedParameter<double>(
"minTrackP", 1.0)),
161 maxTrackEta_(iConfig.getUntrackedParameter<double>(
"maxTrackEta", 2.5)),
162 tMinE_(iConfig.getUntrackedParameter<double>(
"timeMinCutECAL", -500.)),
163 tMaxE_(iConfig.getUntrackedParameter<double>(
"timeMaxCutECAL", 500.)),
164 tMinH_(iConfig.getUntrackedParameter<double>(
"timeMinCutHCAL", -500.)),
165 tMaxH_(iConfig.getUntrackedParameter<double>(
"timeMaxCutHCAL", 500.)),
169 puWeights_(iConfig.getUntrackedParameter<
std::vector<double> >(
"puWeights")),
219 double pBins[
nPBin_ + 1] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 9.0, 11.0, 15.0, 20.0, 25.0, 30.0, 40.0, 60.0, 100.0};
221 int pvBins[
nPVBin_ + 1] = {1, 2, 3, 5, 100};
234 std::vector<std::string>
trig;
236 std::vector<std::string> newNames = {
"HLT",
"PixelTracks_Multiplicity",
"HLT_Physics_",
"HLT_JetE",
"HLT_ZeroBias"};
241 desc.
addUntracked<std::vector<std::string> >(
"newNames", newNames);
262 descriptions.
add(
"studyHLT", desc);
267 int counter0[1000] = {0};
268 int counter1[1000] = {0};
269 int counter2[1000] = {0};
270 int counter3[1000] = {0};
271 int counter4[1000] = {0};
272 int counter5[1000] = {0};
273 int counter6[1000] = {0};
274 int counter7[1000] = {0};
276 edm::LogInfo(
"IsoTrack") <<
"Event starts====================================";
277 int RunNo = iEvent.
id().
run();
278 int EvtNo = iEvent.
id().
event();
282 std::vector<int> newAccept(
newNames_.size() + 1, 0);
290 edm::LogInfo(
"IsoTrack") <<
"RunNo " << RunNo <<
" EvtNo " << EvtNo <<
" Lumi " << Lumi <<
" Bunch " << Bunch
291 <<
" mybxlumi " << mybxlumi;
298 if (!triggerEventHandle.
isValid()) {
301 triggerEvent = *(triggerEventHandle.
product());
307 if (triggerResults.
isValid()) {
312 const std::vector<std::string>& triggerNames_ = triggerNames.
triggerNames();
313 for (
unsigned int iHLT = 0; iHLT < triggerResults->
size(); iHLT++) {
325 if (ipos <= h_HLTAccept->GetNbinsX())
326 h_HLTAccept->GetXaxis()->SetBinLabel(ipos, newtriggerName.c_str());
329 edm::LogInfo(
"IsoTrack") <<
"Wrong trigger " << RunNo <<
" Event " << EvtNo <<
" Hlt " << iHLT;
343 if (newtriggerName.find(
trigNames_[
i]) != std::string::npos) {
355 if (newtriggerName.find(
newNames_[
i]) != std::string::npos) {
364 int iflg(0), indx(1);
366 iflg += (indx * newAccept[
i]);
400 int ntrk(0), ngoodPV(0), nPV(-1);
401 int nvtxs = (
int)(recVtxs->size());
402 for (
int ind = 0; ind < nvtxs; ind++) {
403 if (!((*recVtxs)[ind].isFake()) && (*recVtxs)[ind].ndof() > 4)
420 edm::LogInfo(
"IsoTrack") <<
"Number of vertices: " << nvtxs <<
" Good " << ngoodPV <<
" Bin " << nPV
423 h_goodPV->Fill(ngoodPV, tr_eventWeight);
427 int npbin =
h_goodPV->FindBin(ngoodPV);
428 if (npbin > 0 && npbin <= (
int)(
puWeights_.size()))
442 double pt1 =
p.momentum().Rho();
443 double p1 =
p.momentum().R();
444 double eta1 =
p.momentum().Eta();
445 double phi1 =
p.momentum().Phi();
455 double phi0 = trk.phi();
458 double dPhi = phi0 - phi2;
461 else if (dPhi < -
M_PI)
463 double dR =
sqrt(dEta * dEta + dPhi * dPhi);
475 reco::TrackCollection::const_iterator trkItr;
476 for (trkItr = trkCollection->begin(); trkItr != trkCollection->end(); ++trkItr, ++ntrk) {
478 double pt1 = pTrack->
pt();
479 double p1 = pTrack->
p();
481 double phi1 = pTrack->
momentum().phi();
488 ++counter0[(
int)(p1)];
491 h_ntrk[0]->Fill(ntrk, tr_eventWeight);
493 std::vector<spr::propagatedTrackID> trkCaloDets;
495 std::vector<spr::propagatedTrackID>::const_iterator trkDetItr;
496 for (trkDetItr = trkCaloDets.begin(), ntrk = 0; trkDetItr != trkCaloDets.end(); trkDetItr++, ntrk++) {
497 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
498 double pt1 = pTrack->
pt();
499 double p1 = pTrack->
p();
501 double phi1 = pTrack->
momentum().phi();
503 edm::LogInfo(
"IsoTrack") <<
"track: p " << p1 <<
" pt " << pt1 <<
" eta " << eta1 <<
" phi " << phi1
504 <<
" okEcal " << trkDetItr->okECAL;
508 double maxNearP31x31 =
519 std::pair<double, bool> e7x7P, e11x11P, e15x15P;
520 const DetId isoCell = trkDetItr->detIdECAL;
564 double maxNearHcalP7x7 =
567 double h3x3(0), h5x5(0), h7x7(0);
568 fillIsolation(0, maxNearP31x31, e11x11P.first, e15x15P.first);
570 edm::LogInfo(
"IsoTrack") <<
"Accepted Tracks reaching Ecal maxNearP31x31 " << maxNearP31x31 <<
" e11x11P " 571 << e11x11P.first <<
" e15x15P " << e15x15P.first <<
" okHCAL " << trkDetItr->okHCAL;
573 int trackID =
trackPID(pTrack, genParticles);
574 if (trkDetItr->okHCAL) {
577 const DetId ClosestCell(trkDetItr->detIdHCAL);
578 ieta = ((
HcalDetId)(ClosestCell)).ietaAbs();
623 edm::LogInfo(
"IsoTrack") <<
"Tracks Reaching Hcal maxNearHcalP7x7/h5x5/h7x7 " << maxNearHcalP7x7 <<
"/" 624 << h5x5 <<
"/" << h7x7;
643 if (maxNearP31x31 < 0) {
645 fillEnergy(0, ieta, p1, e7x7P.first, h3x3, e11x11P.first, h5x5);
646 if (maxNearHcalP7x7 < 0) {
648 fillEnergy(1, ieta, p1, e7x7P.first, h3x3, e11x11P.first, h5x5);
649 if ((e11x11P.second) && (e15x15P.second) && (e15x15P.first - e11x11P.first) < 2.0) {
651 fillEnergy(2, ieta, p1, e7x7P.first, h3x3, e11x11P.first, h5x5);
652 if (h7x7 - h5x5 < 2.0) {
654 fillEnergy(3, ieta, p1, e7x7P.first, h3x3, e11x11P.first, h5x5);
657 fillEnergy(nPV + 4, ieta, p1, e7x7P.first, h3x3, e11x11P.first, h5x5);
660 fillTrack(nPVBin_ + trackID + 7, pt1, p1, eta1, phi1);
661 fillEnergy(nPVBin_ + trackID + 3, ieta, p1, e7x7P.first, h3x3, e11x11P.first, h5x5);
665 ++counter7[(
int)(p1)];
670 ++counter6[(
int)(p1)];
675 ++counter5[(
int)(p1)];
680 ++counter4[(
int)(p1)];
685 ++counter3[(
int)(p1)];
690 ++counter2[(
int)(p1)];
695 ++counter1[(
int)(p1)];
698 h_ntrk[1]->Fill(ntrk, tr_eventWeight);
701 for (
int i = 0;
i < 1000; ++
i) {
725 h_nHLT =
fs_->
make<TH1I>(
"h_nHLT",
"size of trigger Names", 1000, 0, 1000);
726 h_HLTAccept =
fs_->
make<TH1I>(
"h_HLTAccept",
"HLT Accepts for all runs", 500, 0, 500);
727 for (
int i = 1;
i <= 500; ++
i)
728 h_HLTAccept->GetXaxis()->SetBinLabel(
i,
" ");
729 h_nHLTvsRN =
fs_->
make<TH2I>(
"h_nHLTvsRN",
"size of trigger Names vs RunNo", 2168, 190949, 193116, 100, 400, 500);
730 h_HLTCorr =
fs_->
make<TH1I>(
"h_HLTCorr",
"Correlation among different paths", 100, 0, 100);
731 h_numberPV =
fs_->
make<TH1I>(
"h_numberPV",
"Number of Primary Vertex", 100, 0, 100);
732 h_goodPV =
fs_->
make<TH1I>(
"h_goodPV",
"Number of good Primary Vertex", 100, 0, 100);
733 h_goodRun =
fs_->
make<TH1I>(
"h_goodRun",
"Number of accepted events for Run", 4000, 190000, 1940000);
734 char hname[60], htit[200];
735 std::string CollectionNames[2] = {
"Reco",
"Propagated"};
736 for (
unsigned int i = 0;
i < 2;
i++) {
737 sprintf(hname,
"h_nTrk_%s", CollectionNames[
i].c_str());
738 sprintf(htit,
"Number of %s tracks", CollectionNames[
i].c_str());
742 "All",
"Quality",
"NoIso",
"okEcal",
"EcalCharIso",
"HcalCharIso",
"EcalNeutIso",
"HcalNeutIso"};
743 std::string particle[4] = {
"Electron",
"Pion",
"Kaon",
"Proton"};
744 for (
unsigned int i = 0;
i <=
nGen_ + 1;
i++) {
746 sprintf(hname,
"h_pt_%s", TrkNames[
i].c_str());
747 sprintf(htit,
"p_{T} of %s tracks", TrkNames[
i].c_str());
749 sprintf(hname,
"h_pt_%s_%d", TrkNames[7].c_str(),
i - 8);
750 sprintf(htit,
"p_{T} of %s tracks (PV=%d:%d)", TrkNames[7].c_str(),
pvBin_[
i - 8],
pvBin_[
i - 7] - 1);
752 sprintf(hname,
"h_pt_%s_%d", TrkNames[0].c_str(),
i -
nGen_);
753 sprintf(htit,
"p_{T} of %s Generator tracks", TrkNames[0].c_str());
755 sprintf(hname,
"h_pt_%s_%s", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
756 sprintf(htit,
"p_{T} of %s tracks (%s)", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
762 sprintf(hname,
"h_p_%s", TrkNames[
i].c_str());
763 sprintf(htit,
"Momentum of %s tracks", TrkNames[
i].c_str());
765 sprintf(hname,
"h_p_%s_%d", TrkNames[7].c_str(),
i - 8);
766 sprintf(htit,
"Momentum of %s tracks (PV=%d:%d)", TrkNames[7].c_str(),
pvBin_[
i - 8],
pvBin_[
i - 7] - 1);
768 sprintf(hname,
"h_p_%s_%d", TrkNames[0].c_str(),
i -
nGen_);
769 sprintf(htit,
"Momentum of %s Generator tracks", TrkNames[0].c_str());
771 sprintf(hname,
"h_p_%s_%s", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
772 sprintf(htit,
"Momentum of %s tracks (%s)", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
774 h_p[
i] =
fs_->
make<TH1D>(hname, htit, 400, 0, 200.0);
778 sprintf(hname,
"h_eta_%s", TrkNames[
i].c_str());
779 sprintf(htit,
"Eta of %s tracks", TrkNames[
i].c_str());
781 sprintf(hname,
"h_eta_%s_%d", TrkNames[7].c_str(),
i - 8);
782 sprintf(htit,
"Eta of %s tracks (PV=%d:%d)", TrkNames[7].c_str(),
pvBin_[
i - 8],
pvBin_[
i - 7] - 1);
784 sprintf(hname,
"h_eta_%s_%d", TrkNames[0].c_str(),
i -
nGen_);
785 sprintf(htit,
"Eta of %s Generator tracks", TrkNames[0].c_str());
787 sprintf(hname,
"h_eta_%s_%s", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
788 sprintf(htit,
"Eta of %s tracks (%s)", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
794 sprintf(hname,
"h_phi_%s", TrkNames[
i].c_str());
795 sprintf(htit,
"Phi of %s tracks", TrkNames[
i].c_str());
797 sprintf(hname,
"h_phi_%s_%d", TrkNames[7].c_str(),
i - 8);
798 sprintf(htit,
"Phi of %s tracks (PV=%d:%d)", TrkNames[7].c_str(),
pvBin_[
i - 8],
pvBin_[
i - 7] - 1);
800 sprintf(hname,
"h_phi_%s_%d", TrkNames[0].c_str(),
i -
nGen_);
801 sprintf(htit,
"Phi of %s Generator tracks", TrkNames[0].c_str());
803 sprintf(hname,
"h_phi_%s_%s", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
804 sprintf(htit,
"Phi of %s tracks (%s)", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
810 for (
unsigned int i = 0;
i < 2;
i++) {
811 sprintf(hname,
"h_maxNearP_%s", IsolationNames[
i].c_str());
812 sprintf(htit,
"Energy in ChargeIso region for %s", IsolationNames[
i].c_str());
816 sprintf(hname,
"h_ene1_%s", IsolationNames[
i].c_str());
817 sprintf(htit,
"Energy in smaller cone for %s", IsolationNames[
i].c_str());
821 sprintf(hname,
"h_ene2_%s", IsolationNames[
i].c_str());
822 sprintf(htit,
"Energy in bigger cone for %s", IsolationNames[
i].c_str());
826 sprintf(hname,
"h_ediff_%s", IsolationNames[
i].c_str());
827 sprintf(htit,
"Energy in NeutralIso region for %s", IsolationNames[
i].c_str());
832 "E_{7x7}",
"H_{3x3}",
"(E_{7x7}+H_{3x3})",
"E_{11x11}",
"H_{5x5}",
"{E_{11x11}+H_{5x5})"};
834 for (
int ip = 0; ip <
nPBin_; ++ip) {
835 for (
int ie = 0; ie <
nEtaBin_; ++ie) {
836 for (
int j = 0;
j < 6; ++
j) {
837 sprintf(hname,
"h_energy_%d_%d_%d_%d",
i, ip, ie,
j);
840 "%s/p (p=%4.1f:%4.1f; i#eta=%d:%d) for tracks with %s",
841 energyNames[
j].c_str(),
846 TrkNames[
i + 4].c_str());
847 }
else if (
i < 4 + nPVBin_) {
849 "%s/p (p=%4.1f:%4.1f, i#eta=%d:%d, PV=%d:%d) for tracks with %s",
850 energyNames[
j].c_str(),
857 TrkNames[7].c_str());
860 "%s/p (p=%4.1f:%4.1f, i#eta=%d:%d %s) for tracks with %s",
861 energyNames[
j].c_str(),
866 particle[
i - 4 - nPVBin_].c_str(),
867 TrkNames[7].c_str());
876 for (
int i = 0;
i < 8; ++
i) {
877 sprintf(hname,
"counter%d",
i);
878 sprintf(htit,
"Counter with cut %d",
i);
880 sprintf(hname,
"h_pTNew%d",
i);
881 sprintf(htit,
"Track momentum with cut %d",
i);
914 char hname[100], htit[400];
917 sprintf(hname,
"h_HLTAccepts_%i", iRun.
run());
918 sprintf(htit,
"HLT Accepts for Run No %i", iRun.
run());
919 TH1I* hnew =
fs_->
make<TH1I>(hname, htit, 500, 0, 500);
920 for (
int i = 1;
i <= 500; ++
i)
921 hnew->GetXaxis()->SetBinLabel(
i,
" ");
983 if (ip >= 0 && ie >= 0 && enEcal1 > 0.02 && enHcal1 > 0.1) {
995 int length = str.length();
996 for (
int i = 0;
i < length - 2;
i++) {
997 if (str[
i] ==
'_' && str[
i + 1] ==
'v' && isdigit(str.at(
i + 2))) {
999 truncated_str = str.substr(0, z);
1002 return (truncated_str);
1009 reco::GenParticleCollection::const_iterator
p;
1010 double mindR(999.9);
1011 for (p = genParticles->begin(), indx = 0; p != genParticles->end(); ++
p, ++indx) {
1013 int idx = (pdgId == 11) ? 1 : ((pdgId == 211) ? 2 : ((pdgId == 321) ? 3 : ((pdgId == 2212) ? 4 : 0)));
1015 double dEta = pTrack->
eta() - p->momentum().Eta();
1016 double phi1 = pTrack->
phi();
1017 double phi2 = p->momentum().Phi();
1022 double dPhi = phi1 - phi2;
1025 else if (dPhi < -
M_PI)
1027 double dR =
sqrt(dEta * dEta + dPhi * dPhi);
const edm::InputTag theTriggerResultsLabel_
static const std::string kSharedResource
void fillEnergy(int, int, double, double, double, double, double)
double p() const
momentum vector magnitude
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
EventNumber_t event() const
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
T getUntrackedParameter(std::string const &, T const &) const
std::vector< double > tr_TrkPt
std::vector< double > tr_H3x3
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
const std::string theTrackQuality_
const edm::InputTag triggerEvent_
void analyze(edm::Event const &, edm::EventSetup const &) override
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
The single EDProduct to be saved for each event (AOD case)
std::vector< double > tr_MaxNearP31X31
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrackQuality
track quality
std::vector< TH1I * > h_HLTAccepts
std::vector< std::string > tr_TrigName
std::vector< bool > tr_SE7x7P
bool accept() const
Has at least one path accepted the event?
edm::EDGetTokenT< GenEventInfoProduct > tok_ew_
std::vector< Track > TrackCollection
collection of Tracks
edm::EDGetTokenT< reco::GenParticleCollection > tok_parts_
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
const Vector & momentum() const
track momentum vector
std::vector< std::string > HLTNames_
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Strings const & triggerNames() const
std::vector< double > tr_TrkEta
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
void fillIsolation(int, double, double, double)
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
TH1D * h_energy[nPVBin_+8][nPBin_][nEtaBin_][6]
double chargeIsolationEcal(unsigned int trkIndex, std::vector< spr::propagatedTrackID > &vdetIds, const CaloGeometry *geo, const CaloTopology *caloTopology, int ieta, int iphi, bool debug=false)
#define DEFINE_FWK_MODULE(type)
double eta() const
pseudorapidity of momentum vector
std::vector< int > tr_iEta
spr::trackSelectionParameters selectionParameters_
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
void fillTrack(int, double, double, double, double)
std::vector< double > tr_MaxNearHcalP7x7
std::string truncate_str(const std::string &)
const std::vector< double > puWeights_
unsigned int size() const
Get number of paths stored.
double pt() const
track transverse momentum
static const int nEtaBin_
Abs< T >::type abs(const T &t)
HLTConfigProvider hltConfig_
std::vector< bool > tr_SE11x11P
static std::string const triggerResults
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< double > tr_FE11x11P
static TrackQuality qualityByName(const std::string &name)
edm::Service< TFileService > fs_
T const * product() const
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
std::vector< int > tr_TrkID
int trackPID(const reco::Track *, const edm::Handle< reco::GenParticleCollection > &)
const double maxTrackEta_
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)
edm::EDGetTokenT< LumiDetails > tok_lumi
bool quality(const TrackQuality) const
Track quality.
std::vector< double > tr_H7x7
void beginRun(edm::Run const &, edm::EventSetup const &) override
std::vector< double > tr_FE15x15P
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes
reco::TrackBase::TrackQuality minQuality
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
StudyHLT(const edm::ParameterSet &)
std::vector< double > tr_FE7x7P
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
std::vector< double > tr_TrkPhi
double chargeIsolationHcal(unsigned int trkIndex, std::vector< spr::propagatedTrackID > &vdetIds, const HcalTopology *topology, int ieta, int iphi, bool debug=false)
std::vector< double > tr_TrkP
T const * product() const
std::vector< bool > tr_SE15x15P
const std::vector< std::string > trigNames_
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
std::vector< double > tr_H5x5
void endRun(edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< trigger::TriggerEvent > tok_trigEvt
double eECALmatrix(const DetId &detId, edm::Handle< T > &hitsEB, edm::Handle< T > &hitsEE, const CaloGeometry *geo, const CaloTopology *caloTopology, int ieta, int iphi, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false)
const std::vector< std::string > newNames_
double eHCALmatrix(const HcalTopology *topology, const DetId &det, edm::Handle< T > &hits, int ieta, int iphi, bool includeHO=false, bool algoNew=true, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, int useRaw=0, bool debug=false)