76 << trigNames.size() <<
" triggers:";
77 for (
unsigned int k=0;
k<trigNames.size(); ++
k)
79 edm::LogInfo(
"IsoTrack") <<
"TrackQuality " << theTrackQuality <<
" Minpt "
94 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};
95 int etaBins[
nEtaBin+1] = {1, 7, 13, 17, 23};
96 int pvBins[
nPVBin+1] = {1, 2, 3, 5, 100};
106 edm::LogInfo(
"IsoTrack") <<
"Event starts====================================";
107 int RunNo = iEvent.
id().
run();
108 int EvtNo = iEvent.
id().
event();
115 std::string newNames[5]={
"HLT",
"PixelTracks_Multiplicity",
"HLT_Physics_",
"HLT_JetE",
"HLT_ZeroBias"};
117 for (
int i=0;
i<5; ++
i) newAccept[
i] = 0;
123 edm::LogInfo(
"IsoTrack") <<
"RunNo " << RunNo <<
" EvtNo " << EvtNo
124 <<
" Lumi " << Lumi <<
" Bunch " << Bunch
125 <<
" mybxlumi " << mybxlumi;
134 }
else if (!triggerEventHandle.
isValid()) {
138 triggerEvent = *(triggerEventHandle.
product());
144 if (triggerResults.
isValid()) {
145 h_nHLT->Fill(triggerResults->size());
146 h_nHLTvsRN->Fill(RunNo, triggerResults->size());
149 const std::vector<std::string> & triggerNames_ = triggerNames.
triggerNames();
150 for (
unsigned int iHLT=0; iHLT<triggerResults->size(); iHLT++) {
164 if (ipos <= h_HLTAccept->GetNbinsX())
165 h_HLTAccept->GetXaxis()->SetBinLabel(ipos,newtriggerName.c_str());
168 edm::LogInfo(
"IsoTrack") <<
"Wrong trigger " << RunNo <<
" Event "
169 << EvtNo <<
" Hlt " << iHLT;
173 int hlt = triggerResults->accept(iHLT);
179 if (newtriggerName.find(
trigNames[
i].c_str())!=std::string::npos) {
182 if (hlt > 0) ok =
true;
185 for (
int i=0;
i<5; ++
i) {
186 if (newtriggerName.find(newNames[
i].c_str())!=std::string::npos) {
189 <<
" : " << newtriggerName;
190 if (hlt > 0) newAccept[
i] = 1;
194 int iflg(0), indx(1);
195 for (
int i=0;
i<5; ++
i) {
196 iflg += (indx*newAccept[
i]); indx *= 2;
228 int ntrk(0), ngoodPV(0), nPV(-1);
229 for (
unsigned int ind=0; ind<recVtxs->size(); ind++) {
230 if (!((*recVtxs)[ind].isFake()) && (*recVtxs)[ind].ndof() > 4) ngoodPV++;
238 edm::LogInfo(
"IsoTrack") <<
"Number of vertices: " << recVtxs->size()
239 <<
" Good " << ngoodPV <<
" Bin " << nPV;
246 reco::TrackCollection::const_iterator trkItr;
247 for (trkItr=trkCollection->begin(); trkItr != trkCollection->end(); ++trkItr,++ntrk) {
249 double pt1 = pTrack->
pt();
250 double p1 = pTrack->
p();
251 double eta1 = pTrack->
momentum().eta();
252 double phi1 = pTrack->
momentum().phi();
255 if (quality)
fillTrack(1, pt1,p1,eta1,phi1);
259 std::vector<spr::propagatedTrackID> trkCaloDets;
261 std::vector<spr::propagatedTrackID>::const_iterator trkDetItr;
262 for (trkDetItr = trkCaloDets.begin(),ntrk=0; trkDetItr != trkCaloDets.end(); trkDetItr++,ntrk++) {
263 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
264 double pt1 = pTrack->
pt();
265 double p1 = pTrack->
p();
266 double eta1 = pTrack->
momentum().eta();
267 double phi1 = pTrack->
momentum().phi();
269 edm::LogInfo(
"IsoTrack") <<
"track: p " << p1 <<
" pt " << pt1
270 <<
" eta " << eta1 <<
" phi " << phi1
271 <<
" okEcal " << trkDetItr->okECAL;
285 std::pair<double, bool> e7x7P, e11x11P, e15x15P;
286 const DetId isoCell = trkDetItr->detIdECAL;
287 e7x7P =
spr::eECALmatrix(isoCell,barrelRecHitsHandle,endcapRecHitsHandle, *theEcalChStatus, geo, caloTopology,sevlv.
product(),3,3, 0.030, 0.150,
tMinE_,
tMaxE_, ((
verbosity/10000)%10 > 0));
288 e11x11P =
spr::eECALmatrix(isoCell,barrelRecHitsHandle,endcapRecHitsHandle, *theEcalChStatus, geo, caloTopology,sevlv.
product(),5,5, 0.030, 0.150,
tMinE_,
tMaxE_, ((
verbosity/10000)%10 > 0));
289 e15x15P =
spr::eECALmatrix(isoCell,barrelRecHitsHandle,endcapRecHitsHandle, *theEcalChStatus, geo, caloTopology,sevlv.
product(),7,7, 0.030, 0.150,
tMinE_,
tMaxE_, ((
verbosity/10000)%10 > 0));
293 double h3x3(0), h5x5(0), h7x7(0);
296 edm::LogInfo(
"IsoTrack") <<
"Accepted Tracks reaching Ecal maxNearP31x31 "
297 << maxNearP31x31 <<
" e11x11P "
298 << e11x11P.first <<
" e15x15P "
299 << e15x15P.first <<
" okHCAL "
300 << trkDetItr->okHCAL;
302 if (trkDetItr->okHCAL) {
305 const DetId ClosestCell(trkDetItr->detIdHCAL);
306 ieta = ((
HcalDetId)(ClosestCell)).ietaAbs();
307 h3x3 =
spr::eHCALmatrix(theHBHETopology, ClosestCell, hbhe,1,1,
false,
true, 0.7, 0.8, -100.0, -100.0,
tMinH_,
tMaxH_, ((
verbosity/10000)%10 > 0));
308 h5x5 =
spr::eHCALmatrix(theHBHETopology, ClosestCell, hbhe,2,2,
false,
true, 0.7, 0.8, -100.0, -100.0,
tMinH_,
tMaxH_, ((
verbosity/10000)%10 > 0) );
309 h7x7 =
spr::eHCALmatrix(theHBHETopology, ClosestCell, hbhe,3,3,
false,
true, 0.7, 0.8, -100.0, -100.0,
tMinH_,
tMaxH_, ((
verbosity/10000)%10 > 0) );
312 edm::LogInfo(
"IsoTrack") <<
"Tracks Reaching Hcal maxNearHcalP7x7/h5x5/h7x7 "
313 << maxNearHcalP7x7 <<
"/" << h5x5 <<
"/" << h7x7;
315 if (maxNearP31x31 < 0) {
317 fillEnergy(0,ieta,p1,e7x7P.first,h3x3,e11x11P.first,h5x5);
318 if (maxNearHcalP7x7 < 0) {
320 fillEnergy(1,ieta,p1,e7x7P.first,h3x3,e11x11P.first,h5x5);
321 if (e11x11P.second && e15x15P.second && (e15x15P.first-e11x11P.first)<2.0) {
323 fillEnergy(2,ieta,p1,e7x7P.first,h3x3,e11x11P.first,h5x5);
324 if (h7x7-h5x5 < 2.0) {
326 fillEnergy(3,ieta,p1,e7x7P.first,h3x3,e11x11P.first,h5x5);
329 fillEnergy(nPV+4,ieta,p1,e7x7P.first,h3x3,e11x11P.first,h5x5);
343 h_nHLT =
fs->
make<TH1I>(
"h_nHLT" ,
"size of trigger Names", 1000, 0, 1000);
344 h_HLTAccept =
fs->
make<TH1I>(
"h_HLTAccept",
"HLT Accepts for all runs", 500, 0, 500);
345 for (
int i=1;
i<=500; ++
i) h_HLTAccept->GetXaxis()->SetBinLabel(
i,
" ");
346 h_nHLTvsRN =
fs->
make<TH2I>(
"h_nHLTvsRN" ,
"size of trigger Names vs RunNo", 2168, 190949, 193116, 100, 400, 500);
347 h_HLTCorr =
fs->
make<TH1I>(
"h_HLTCorr",
"Correlation among different paths", 100, 0, 100);
348 h_numberPV =
fs->
make<TH1I>(
"h_numberPV",
"Number of Primary Vertex", 100, 0, 100);
349 h_goodPV =
fs->
make<TH1I>(
"h_goodPV",
"Number of good Primary Vertex", 100, 0, 100);
350 h_goodRun =
fs->
make<TH1I>(
"h_goodRun",
"Number of accepted events for Run", 4000, 190000, 1940000);
351 char hname[50], htit[400];
352 std::string CollectionNames[2] = {
"Reco",
"Propagated"};
353 for (
unsigned int i=0;
i<2;
i++) {
354 sprintf(hname,
"h_nTrk_%s", CollectionNames[
i].c_str());
355 sprintf(htit,
"Number of %s tracks", CollectionNames[
i].c_str());
358 std::string TrkNames[8] = {
"All",
"Quality",
"NoIso",
"okEcal",
"EcalCharIso",
"HcalCharIso",
"EcalNeutIso",
"HcalNeutIso"};
359 for (
unsigned int i=0;
i<8+
nPVBin;
i++) {
361 sprintf(hname,
"h_pt_%s", TrkNames[
i].c_str());
362 sprintf(htit,
"p_{T} of %s tracks", TrkNames[
i].c_str());
364 sprintf(hname,
"h_pt_%s_%d", TrkNames[7].c_str(),
i-8);
365 sprintf(htit,
"p_{T} of %s tracks (PV=%d:%d)", TrkNames[7].c_str(),
pvBin[
i-8],
pvBin[
i-7]-1);
367 h_pt[
i] =
fs->
make<TH1D>(hname, htit, 400, 0, 200.0);
371 sprintf(hname,
"h_p_%s", TrkNames[
i].c_str());
372 sprintf(htit,
"Momentum of %s tracks", TrkNames[
i].c_str());
374 sprintf(hname,
"h_p_%s_%d", TrkNames[7].c_str(),
i-8);
375 sprintf(htit,
"Momentum of %s tracks (PV=%d:%d)", TrkNames[7].c_str(),
pvBin[
i-8],
pvBin[
i-7]-1);
377 h_p[
i] =
fs->
make<TH1D>(hname, htit, 400, 0, 200.0);
381 sprintf(hname,
"h_eta_%s", TrkNames[
i].c_str());
382 sprintf(htit,
"Eta of %s tracks", TrkNames[
i].c_str());
384 sprintf(hname,
"h_eta_%s_%d", TrkNames[7].c_str(),
i-8);
385 sprintf(htit,
"Eta of %s tracks (PV=%d:%d)", TrkNames[7].c_str(),
pvBin[
i-8],
pvBin[
i-7]-1);
391 sprintf(hname,
"h_phi_%s", TrkNames[
i].c_str());
392 sprintf(htit,
"Phi of %s tracks", TrkNames[
i].c_str());
394 sprintf(hname,
"h_phi_%s_%d", TrkNames[7].c_str(),
i-8);
395 sprintf(htit,
"Phi of %s tracks (PV=%d:%d)", TrkNames[7].c_str(),
pvBin[
i-8],
pvBin[
i-7]-1);
397 h_phi[
i] =
fs->
make<TH1D>(hname, htit, 100, -3.15, 3.15);
401 for (
unsigned int i=0;
i<2;
i++) {
402 sprintf(hname,
"h_maxNearP_%s", IsolationNames[
i].c_str());
403 sprintf(htit,
"Energy in ChargeIso region for %s", IsolationNames[
i].c_str());
407 sprintf(hname,
"h_ene1_%s", IsolationNames[
i].c_str());
408 sprintf(htit,
"Energy in smaller cone for %s", IsolationNames[
i].c_str());
412 sprintf(hname,
"h_ene2_%s", IsolationNames[
i].c_str());
413 sprintf(htit,
"Energy in bigger cone for %s", IsolationNames[
i].c_str());
417 sprintf(hname,
"h_ediff_%s", IsolationNames[
i].c_str());
418 sprintf(htit,
"Energy in NeutralIso region for %s", IsolationNames[
i].c_str());
422 std::string energyNames[6]={
"E_{7x7}",
"H_{3x3}",
"(E_{7x7}+H_{3x3})",
423 "E_{11x11}",
"H_{5x5}",
"{E_{11x11}+H_{5x5})"};
425 for (
int ip=0; ip<
nPBin; ++ip) {
426 for (
int ie=0; ie<
nEtaBin; ++ie) {
427 for (
int j=0;
j<6; ++
j) {
428 sprintf(hname,
"h_energy_%d_%d_%d_%d",
i, ip, ie,
j);
430 sprintf(htit,
"%s/p (p=%4.1f:%4.1f; i#eta=%d:%d) for tracks with %s",
432 (
etaBin[ie+1]-1), TrkNames[
i+4].c_str());
434 sprintf(htit,
"%s/p (p=%4.1f:%4.1f; i#eta=%d:%d, PV=%d:%d) for tracks with %s",
437 TrkNames[7].c_str());
451 char hname[100], htit[400];
454 sprintf(hname,
"h_HLTAccepts_%i", iRun.
run());
455 sprintf(htit,
"HLT Accepts for Run No %i", iRun.
run());
456 TH1I *hnew =
fs->
make<TH1I>(hname, htit, 500, 0, 500);
457 for (
int i=1;
i<=500; ++
i) hnew->GetXaxis()->SetBinLabel(
i,
" ");
485 h_ediff[
i]->Fill(eneutIso2-eneutIso1);
489 double enHcal1,
double enEcal2,
double enHcal2) {
492 if (p >=
pBin[
i] && p <
pBin[
i+1]) { ip =
i;
break; }
497 if (ip >= 0 && ie >= 0 && enEcal1 > 0.02 && enHcal1 > 0.1) {
498 h_energy[flag][ip][ie][0]->Fill(enEcal1/p);
499 h_energy[flag][ip][ie][1]->Fill(enHcal1/p);
500 h_energy[flag][ip][ie][2]->Fill((enEcal1+enHcal1)/p);
501 h_energy[flag][ip][ie][3]->Fill(enEcal2/p);
502 h_energy[flag][ip][ie][4]->Fill(enHcal2/p);
503 h_energy[flag][ip][ie][5]->Fill((enEcal2+enHcal2)/p);
509 int length = str.length();
510 for (
int i=0;
i<length-2;
i++){
511 if (str[
i]==
'_' && str[
i+1]==
'v' && isdigit(str.at(
i+2))) {
513 truncated_str = str.substr(0,z);
516 return(truncated_str);
void fillEnergy(int, int, double, double, double, double, double)
double p() const
momentum vector magnitude
EventNumber_t event() const
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
T getUntrackedParameter(std::string const &, T const &) const
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
edm::InputTag triggerEvent_
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, std::string &theTrackQuality, bool debug=false)
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
The single EDProduct to be saved for each event (AOD case)
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
edm::Service< TFileService > fs
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
std::vector< TH1I * > h_HLTAccepts
std::vector< std::string > trigNames
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, bool useRaw=false, bool debug=false)
int bunchCrossing() const
edm::LuminosityBlockNumber_t luminosityBlock() const
T * make(const Args &...args) const
make new ROOT object
const Vector & momentum() const
track momentum vector
Strings const & triggerNames() const
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::string theTrackQuality
spr::trackSelectionParameters selectionParameters
void fillIsolation(int, double, double, double)
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
edm::InputTag theTriggerResultsLabel
double chargeIsolationEcal(unsigned int trkIndex, std::vector< spr::propagatedTrackID > &vdetIds, const CaloGeometry *geo, const CaloTopology *caloTopology, int ieta, int iphi, bool debug=false)
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
void fillTrack(int, double, double, double, double)
std::string truncate_str(const std::string &)
double pt() const
track transverse momentum
virtual void endRun(edm::Run const &, edm::EventSetup const &)
Abs< T >::type abs(const T &t)
LuminosityBlock const & getLuminosityBlock() const
HLTConfigProvider hltConfig_
static std::string const triggerResults
static TrackQuality qualityByName(const std::string &name)
T const * product() const
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
T const * product() const
edm::EDGetTokenT< LumiDetails > tok_lumi
bool quality(const TrackQuality) const
Track quality.
Geom::Phi< T > phi() const
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes
reco::TrackBase::TrackQuality minQuality
std::vector< std::string > HLTNames
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
StudyHLT(const edm::ParameterSet &)
double chargeIsolationHcal(unsigned int trkIndex, std::vector< spr::propagatedTrackID > &vdetIds, const HcalTopology *topology, int ieta, int iphi, bool debug=false)
TH1D * h_energy[nPVBin+4][nPBin][nEtaBin][6]
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)