101 void fillTrack(
int,
double,
double,
double,
double);
103 void fillEnergy(
int,
int,
double,
double,
double,
double,
double);
162 : verbosity_(iConfig.getUntrackedParameter<
int>(
"verbosity", 0)),
165 labelMuon_(iConfig.getUntrackedParameter<
edm::
InputTag>(
"labelMuon")),
166 labelGenTrack_(iConfig.getUntrackedParameter<
edm::
InputTag>(
"labelTrack")),
167 theTrackQuality_(iConfig.getUntrackedParameter<
std::
string>(
"trackQuality",
"highPurity")),
168 minTrackP_(iConfig.getUntrackedParameter<double>(
"minTrackP", 1.0)),
169 maxTrackEta_(iConfig.getUntrackedParameter<double>(
"maxTrackEta", 2.5)),
170 tMinE_(iConfig.getUntrackedParameter<double>(
"timeMinCutECAL", -500.)),
171 tMaxE_(iConfig.getUntrackedParameter<double>(
"timeMaxCutECAL", 500.)),
172 tMinH_(iConfig.getUntrackedParameter<double>(
"timeMinCutHCAL", -500.)),
173 tMaxH_(iConfig.getUntrackedParameter<double>(
"timeMaxCutHCAL", 500.)),
174 isItAOD_(iConfig.getUntrackedParameter<
bool>(
"isItAOD",
false)),
175 vetoTrigger_(iConfig.getUntrackedParameter<
bool>(
"vetoTrigger",
false)),
176 doTree_(iConfig.getUntrackedParameter<
bool>(
"doTree",
false)),
177 vetoMuon_(iConfig.getUntrackedParameter<
bool>(
"vetoMuon",
false)),
178 vetoEcal_(iConfig.getUntrackedParameter<
bool>(
"vetoEcal",
false)),
179 cutMuon_(iConfig.getUntrackedParameter<double>(
"cutMuon", 0.001)),
180 cutEcal_(iConfig.getUntrackedParameter<double>(
"cutEcal", 2.0)),
181 cutRatio_(iConfig.getUntrackedParameter<double>(
"cutRatio", 0.90)),
182 puWeights_(iConfig.getUntrackedParameter<
std::
vector<double> >(
"puWeights")),
183 triggerEvent_(
edm::
InputTag(
"hltTriggerSummaryAOD",
"",
"HLT")),
184 theTriggerResultsLabel_(
edm::
InputTag(
"TriggerResults",
"",
"HLT")),
236 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};
238 int pvBins[
nPVBin_ + 1] = {1, 2, 3, 5, 100};
251 std::vector<std::string>
trig;
253 std::vector<std::string> newNames = {
"HLT",
"PixelTracks_Multiplicity",
"HLT_Physics_",
"HLT_JetE",
"HLT_ZeroBias"};
256 desc.addUntracked<
int>(
"verbosity", 0);
257 desc.addUntracked<std::vector<std::string> >(
"triggers",
trig);
258 desc.addUntracked<std::vector<std::string> >(
"newNames", newNames);
262 desc.addUntracked<
double>(
"minTrackPt", 1.0);
263 desc.addUntracked<
double>(
"maxDxyPV", 0.02);
264 desc.addUntracked<
double>(
"maxDzPV", 0.02);
265 desc.addUntracked<
double>(
"maxChi2", 5.0);
266 desc.addUntracked<
double>(
"maxDpOverP", 0.1);
267 desc.addUntracked<
int>(
"minOuterHit", 4);
268 desc.addUntracked<
int>(
"minLayerCrossed", 8);
269 desc.addUntracked<
int>(
"maxInMiss", 0);
270 desc.addUntracked<
int>(
"maxOutMiss", 0);
271 desc.addUntracked<
double>(
"minTrackP", 1.0);
272 desc.addUntracked<
double>(
"maxTrackEta", 2.6);
273 desc.addUntracked<
double>(
"timeMinCutECAL", -500.0);
274 desc.addUntracked<
double>(
"timeMaxCutECAL", 500.0);
275 desc.addUntracked<
double>(
"timeMinCutHCAL", -500.0);
276 desc.addUntracked<
double>(
"timeMaxCutHCAL", 500.0);
277 desc.addUntracked<
bool>(
"isItAOD",
false);
278 desc.addUntracked<
bool>(
"vetoTrigger",
false);
279 desc.addUntracked<
bool>(
"doTree",
false);
280 desc.addUntracked<
bool>(
"vetoMuon",
false);
281 desc.addUntracked<
double>(
"cutMuon", 0.001);
282 desc.addUntracked<
bool>(
"vetoEcal",
false);
283 desc.addUntracked<
double>(
"cutEcal", 2.0);
284 desc.addUntracked<
double>(
"cutRatio", 0.9);
285 desc.addUntracked<std::vector<double> >(
"puWeights",
weights);
286 descriptions.
add(
"studyCaloResponse",
desc);
291 int counter0[1000] = {0};
292 int counter1[1000] = {0};
293 int counter2[1000] = {0};
294 int counter3[1000] = {0};
295 int counter4[1000] = {0};
296 int counter5[1000] = {0};
297 int counter6[1000] = {0};
298 int counter7[1000] = {0};
300 edm::LogVerbatim(
"IsoTrack") <<
"Event starts====================================";
301 int RunNo =
iEvent.id().run();
302 int EvtNo =
iEvent.id().event();
304 int Bunch =
iEvent.bunchCrossing();
306 std::vector<int> newAccept(
newNames_.size() + 1, 0);
308 edm::LogVerbatim(
"IsoTrack") <<
"RunNo " << RunNo <<
" EvtNo " << EvtNo <<
" Lumi " <<
Lumi <<
" Bunch " << Bunch;
315 if (!triggerEventHandle.
isValid()) {
329 const std::vector<std::string>& triggerNames_ =
triggerNames.triggerNames();
330 for (
unsigned int iHLT = 0; iHLT <
triggerResults->size(); iHLT++) {
342 if (ipos <= h_HLTAccept->GetNbinsX())
343 h_HLTAccept->GetXaxis()->SetBinLabel(ipos, newtriggerName.c_str());
346 edm::LogVerbatim(
"IsoTrack") <<
"Wrong trigger " << RunNo <<
" Event " << EvtNo <<
" Hlt " << iHLT;
360 if (newtriggerName.find(
trigNames_[
i]) != std::string::npos) {
372 if (newtriggerName.find(
newNames_[
i]) != std::string::npos) {
381 int iflg(0), indx(1);
383 iflg += (indx * newAccept[
i]);
417 int ntrk(0), ngoodPV(0), nPV(-1);
418 int nvtxs = (
int)(recVtxs->size());
419 for (
int ind = 0; ind < nvtxs; ind++) {
420 if (!((*recVtxs)[ind].isFake()) && (*recVtxs)[ind].ndof() > 4)
437 edm::LogVerbatim(
"IsoTrack") <<
"Number of vertices: " << nvtxs <<
" Good " << ngoodPV <<
" Bin " << nPV
444 int npbin =
h_goodPV->FindBin(ngoodPV);
445 if (npbin > 0 && npbin <= (
int)(
puWeights_.size()))
462 double pt1 =
p.momentum().Rho();
463 double p1 =
p.momentum().R();
464 double eta1 =
p.momentum().Eta();
465 double phi1 =
p.momentum().Phi();
475 double phi0 = trk.phi();
478 double dPhi = phi0 - phi2;
495 reco::TrackCollection::const_iterator trkItr;
496 for (trkItr = trkCollection->begin(); trkItr != trkCollection->end(); ++trkItr, ++ntrk) {
498 double pt1 = pTrack->
pt();
499 double p1 = pTrack->
p();
501 double phi1 = pTrack->
momentum().phi();
508 ++counter0[(
int)(
p1)];
513 std::vector<spr::propagatedTrackID> trkCaloDets;
515 std::vector<spr::propagatedTrackID>::const_iterator trkDetItr;
516 for (trkDetItr = trkCaloDets.begin(), ntrk = 0; trkDetItr != trkCaloDets.end(); trkDetItr++, ntrk++) {
517 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
518 double pt1 = pTrack->
pt();
519 double p1 = pTrack->
p();
521 double phi1 = pTrack->
momentum().phi();
524 <<
" okEcal " << trkDetItr->okECAL;
527 bool vetoMuon(
false);
528 double chiGlobal(0),
dr(0);
529 bool goodGlob(
false);
531 if (muonEventHandle.
isValid()) {
532 for (reco::MuonCollection::const_iterator recMuon = muonEventHandle->begin();
533 recMuon != muonEventHandle->end();
535 if (((recMuon->isPFMuon()) && (recMuon->isGlobalMuon() || recMuon->isTrackerMuon())) &&
536 (recMuon->innerTrack()->validFraction() > 0.49)) {
537 chiGlobal = ((recMuon->globalTrack().isNonnull()) ? recMuon->globalTrack()->normalizedChi2() : 999);
538 goodGlob = (recMuon->isGlobalMuon() && chiGlobal < 3 &&
539 recMuon->combinedQuality().chi2LocalPosition < 12 && recMuon->combinedQuality().trkKink < 20);
543 recMuon->momentum().eta(),
544 recMuon->momentum().phi());
556 <<
":" << goodGlob <<
":" <<
dr;
559 double maxNearP31x31 =
570 std::pair<double, bool> e7x7P, e11x11P, e15x15P;
571 const DetId isoCell = trkDetItr->detIdECAL;
615 double maxNearHcalP7x7 =
618 double h3x3(0), h5x5(0), h7x7(0);
619 fillIsolation(0, maxNearP31x31, e11x11P.first, e15x15P.first);
621 edm::LogVerbatim(
"IsoTrack") <<
"Accepted Tracks reaching Ecal maxNearP31x31 " << maxNearP31x31 <<
" e11x11P "
622 << e11x11P.first <<
" e15x15P " << e15x15P.first <<
" okHCAL "
623 << trkDetItr->okHCAL;
626 if (trkDetItr->okHCAL) {
629 const DetId ClosestCell(trkDetItr->detIdHCAL);
674 double eByh = ((e11x11P.second) ? (e11x11P.first /
std::max(h3x3, 0.001)) : 0.0);
677 edm::LogVerbatim(
"IsoTrack") <<
"Tracks Reaching Hcal maxNearHcalP7x7/h5x5/h7x7 " << maxNearHcalP7x7 <<
"/"
678 << h5x5 <<
"/" << h7x7 <<
" eByh " << eByh <<
" notAnElec " << notAnElec;
697 if (maxNearP31x31 < 0 && notAnElec) {
700 if (maxNearHcalP7x7 < 0) {
703 if ((e11x11P.second) && (e15x15P.second) && (e15x15P.first - e11x11P.first) < 2.0) {
706 if (h7x7 - h5x5 < 2.0) {
719 ++counter7[(
int)(
p1)];
724 ++counter6[(
int)(
p1)];
729 ++counter5[(
int)(
p1)];
734 ++counter4[(
int)(
p1)];
739 ++counter3[(
int)(
p1)];
744 ++counter2[(
int)(
p1)];
749 ++counter1[(
int)(
p1)];
755 for (
int i = 0;
i < 1000; ++
i) {
779 h_nHLT =
fs_->
make<TH1I>(
"h_nHLT",
"size of trigger Names", 1000, 0, 1000);
780 h_HLTAccept =
fs_->
make<TH1I>(
"h_HLTAccept",
"HLT Accepts for all runs", 500, 0, 500);
781 for (
int i = 1;
i <= 500; ++
i)
783 h_nHLTvsRN =
fs_->
make<TH2I>(
"h_nHLTvsRN",
"size of trigger Names vs RunNo", 2168, 190949, 193116, 100, 400, 500);
784 h_HLTCorr =
fs_->
make<TH1I>(
"h_HLTCorr",
"Correlation among different paths", 100, 0, 100);
785 h_numberPV =
fs_->
make<TH1I>(
"h_numberPV",
"Number of Primary Vertex", 100, 0, 100);
786 h_goodPV =
fs_->
make<TH1I>(
"h_goodPV",
"Number of good Primary Vertex", 100, 0, 100);
787 h_goodRun =
fs_->
make<TH1I>(
"h_goodRun",
"Number of accepted events for Run", 4000, 190000, 1940000);
788 char hname[60], htit[200];
789 std::string CollectionNames[2] = {
"Reco",
"Propagated"};
790 for (
unsigned int i = 0;
i < 2;
i++) {
791 sprintf(hname,
"h_nTrk_%s", CollectionNames[
i].c_str());
792 sprintf(htit,
"Number of %s tracks", CollectionNames[
i].c_str());
796 "All",
"Quality",
"NoIso",
"okEcal",
"EcalCharIso",
"HcalCharIso",
"EcalNeutIso",
"HcalNeutIso"};
797 std::string particle[4] = {
"Electron",
"Pion",
"Kaon",
"Proton"};
798 for (
unsigned int i = 0;
i <=
nGen_ + 1;
i++) {
800 sprintf(hname,
"h_pt_%s", TrkNames[
i].c_str());
801 sprintf(htit,
"p_{T} of %s tracks", TrkNames[
i].c_str());
803 sprintf(hname,
"h_pt_%s_%d", TrkNames[7].c_str(),
i - 8);
804 sprintf(htit,
"p_{T} of %s tracks (PV=%d:%d)", TrkNames[7].c_str(),
pvBin_[
i - 8],
pvBin_[
i - 7] - 1);
806 sprintf(hname,
"h_pt_%s_%d", TrkNames[0].c_str(),
i -
nGen_);
807 sprintf(htit,
"p_{T} of %s Generator tracks", TrkNames[0].c_str());
809 sprintf(hname,
"h_pt_%s_%s", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
810 sprintf(htit,
"p_{T} of %s tracks (%s)", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
816 sprintf(hname,
"h_p_%s", TrkNames[
i].c_str());
817 sprintf(htit,
"Momentum of %s tracks", TrkNames[
i].c_str());
819 sprintf(hname,
"h_p_%s_%d", TrkNames[7].c_str(),
i - 8);
820 sprintf(htit,
"Momentum of %s tracks (PV=%d:%d)", TrkNames[7].c_str(),
pvBin_[
i - 8],
pvBin_[
i - 7] - 1);
822 sprintf(hname,
"h_p_%s_%d", TrkNames[0].c_str(),
i -
nGen_);
823 sprintf(htit,
"Momentum of %s Generator tracks", TrkNames[0].c_str());
825 sprintf(hname,
"h_p_%s_%s", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
826 sprintf(htit,
"Momentum of %s tracks (%s)", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
828 h_p[
i] =
fs_->
make<TH1D>(hname, htit, 400, 0, 200.0);
832 sprintf(hname,
"h_eta_%s", TrkNames[
i].c_str());
833 sprintf(htit,
"Eta of %s tracks", TrkNames[
i].c_str());
835 sprintf(hname,
"h_eta_%s_%d", TrkNames[7].c_str(),
i - 8);
836 sprintf(htit,
"Eta of %s tracks (PV=%d:%d)", TrkNames[7].c_str(),
pvBin_[
i - 8],
pvBin_[
i - 7] - 1);
838 sprintf(hname,
"h_eta_%s_%d", TrkNames[0].c_str(),
i -
nGen_);
839 sprintf(htit,
"Eta of %s Generator tracks", TrkNames[0].c_str());
841 sprintf(hname,
"h_eta_%s_%s", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
842 sprintf(htit,
"Eta of %s tracks (%s)", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
848 sprintf(hname,
"h_phi_%s", TrkNames[
i].c_str());
849 sprintf(htit,
"Phi of %s tracks", TrkNames[
i].c_str());
851 sprintf(hname,
"h_phi_%s_%d", TrkNames[7].c_str(),
i - 8);
852 sprintf(htit,
"Phi of %s tracks (PV=%d:%d)", TrkNames[7].c_str(),
pvBin_[
i - 8],
pvBin_[
i - 7] - 1);
854 sprintf(hname,
"h_phi_%s_%d", TrkNames[0].c_str(),
i -
nGen_);
855 sprintf(htit,
"Phi of %s Generator tracks", TrkNames[0].c_str());
857 sprintf(hname,
"h_phi_%s_%s", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
858 sprintf(htit,
"Phi of %s tracks (%s)", TrkNames[7].c_str(), particle[
i - 8 -
nPVBin_].c_str());
864 for (
unsigned int i = 0;
i < 2;
i++) {
865 sprintf(hname,
"h_maxNearP_%s", IsolationNames[
i].c_str());
866 sprintf(htit,
"Energy in ChargeIso region for %s", IsolationNames[
i].c_str());
870 sprintf(hname,
"h_ene1_%s", IsolationNames[
i].c_str());
871 sprintf(htit,
"Energy in smaller cone for %s", IsolationNames[
i].c_str());
875 sprintf(hname,
"h_ene2_%s", IsolationNames[
i].c_str());
876 sprintf(htit,
"Energy in bigger cone for %s", IsolationNames[
i].c_str());
880 sprintf(hname,
"h_ediff_%s", IsolationNames[
i].c_str());
881 sprintf(htit,
"Energy in NeutralIso region for %s", IsolationNames[
i].c_str());
886 "E_{7x7}",
"H_{3x3}",
"(E_{7x7}+H_{3x3})",
"E_{11x11}",
"H_{5x5}",
"{E_{11x11}+H_{5x5})"};
888 for (
int ip = 0; ip <
nPBin_; ++ip) {
889 for (
int ie = 0; ie <
nEtaBin_; ++ie) {
890 for (
int j = 0;
j < 6; ++
j) {
891 sprintf(hname,
"h_energy_%d_%d_%d_%d",
i, ip, ie,
j);
894 "%s/p (p=%4.1f:%4.1f; i#eta=%d:%d) for tracks with %s",
895 energyNames[
j].c_str(),
900 TrkNames[
i + 4].c_str());
903 "%s/p (p=%4.1f:%4.1f, i#eta=%d:%d, PV=%d:%d) for tracks with %s",
904 energyNames[
j].c_str(),
911 TrkNames[7].c_str());
914 "%s/p (p=%4.1f:%4.1f, i#eta=%d:%d %s) for tracks with %s",
915 energyNames[
j].c_str(),
921 TrkNames[7].c_str());
930 for (
int i = 0;
i < 8; ++
i) {
931 sprintf(hname,
"counter%d",
i);
932 sprintf(htit,
"Counter with cut %d",
i);
934 sprintf(hname,
"h_pTNew%d",
i);
935 sprintf(htit,
"Track momentum with cut %d",
i);
968 char hname[100], htit[400];
971 sprintf(hname,
"h_HLTAccepts_%i", iRun.
run());
972 sprintf(htit,
"HLT Accepts for Run No %i", iRun.
run());
973 TH1I* hnew =
fs_->
make<TH1I>(hname, htit, 500, 0, 500);
974 for (
int i = 1;
i <= 500; ++
i)
975 hnew->GetXaxis()->SetBinLabel(
i,
" ");
1024 int flag,
int ieta,
double p,
double enEcal1,
double enHcal1,
double enEcal2,
double enHcal2) {
1038 if (ip >= 0 && ie >= 0 && enEcal1 > 0.02 && enHcal1 > 0.1) {
1050 int length =
str.length();
1051 for (
int i = 0;
i < length - 2;
i++) {
1052 if (
str[
i] ==
'_' &&
str[
i + 1] ==
'v' && isdigit(
str.at(
i + 2))) {
1054 truncated_str =
str.substr(0,
z);
1057 return (truncated_str);
1065 reco::GenParticleCollection::const_iterator
p;
1066 double mindR(999.9);
1071 double dEta = pTrack->
eta() -
p->momentum().Eta();
1072 double phi1 = pTrack->
phi();
1073 double phi2 =
p->momentum().Phi();
1078 double dPhi = phi1 - phi2;