CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DQMHcalIsoTrackAlCaReco.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: DQMOffline/CalibCalo
4 // Class: DQMHcalIsoTrackAlCaReco
5 //
13 //
14 // Original Author: Grigory SAFRONOV
15 // Created: Tue Oct 14 16:10:31 CEST 2008
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
24 
26 
29 
32 
34 
38 
44 
47 
51 
55 
58 
60 
61 #include <fstream>
62 
63 #include "TH1F.h"
64 
66 public:
69 
70 
71 private:
72 
74 
75  virtual void beginJob() override ;
76  virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
77  virtual void endJob() override ;
78 
84  std::vector<std::string> hltFilterTag_;
87  double pThr_;
88  double heLow_;
89  double heUp_;
90 
97 
102 
104 
107 
112 
114 
118 
121 
124 
127 
128  int nTotal;
132 
133  std::pair<int, int> towerIndex(double eta, double phi);
134 
135 };
136 
137 std::pair<int,int> DQMHcalIsoTrackAlCaReco::towerIndex(double eta, double phi)
138 {
139  int ieta = 0;
140  int iphi = 0;
141  for (int i=1; i<21; i++)
142  {
143  if (fabs(eta)<=(i*0.087)&&fabs(eta)>(i-1)*0.087) ieta=int(fabs(eta)/eta)*i;
144  }
145  if (fabs(eta)>1.740&&fabs(eta)<=1.830) ieta=int(fabs(eta)/eta)*21;
146  if (fabs(eta)>1.830&&fabs(eta)<=1.930) ieta=int(fabs(eta)/eta)*22;
147  if (fabs(eta)>1.930&&fabs(eta)<=2.043) ieta=int(fabs(eta)/eta)*23;
148  if (fabs(eta)>2.043&&fabs(eta)<=2.172) ieta=int(fabs(eta)/eta)*24;
149 
150  double delta=phi+0.174532925;
151  if (delta<0) delta=delta+2*acos(-1);
152  if (fabs(eta)<1.740)
153  {
154  for (int i=0; i<72; i++)
155  {
156  if (delta<(i+1)*0.087266462&&delta>i*0.087266462) iphi=i;
157  }
158  }
159  else
160  {
161  for (int i=0; i<36; i++)
162  {
163  if (delta<2*(i+1)*0.087266462&&delta>2*i*0.087266462) iphi=2*i;
164  }
165  }
166 
167  return std::pair<int,int>(ieta,iphi);
168 }
169 
170 
172 
173 {
174  folderName_ = iConfig.getParameter<std::string>("folderName");
175  saveToFile_=iConfig.getParameter<bool>("saveToFile");
176  outRootFileName_=iConfig.getParameter<std::string>("outputRootFileName");
177  hltEventTag_= consumes<trigger::TriggerEvent>(iConfig.getParameter<edm::InputTag>("hltTriggerEventLabel"));
178  l1FilterTag_=iConfig.getParameter<std::string>("l1FilterLabel");
179  hltFilterTag_=iConfig.getParameter<std::vector<std::string> >("hltL3FilterLabels");
180  nameLength_=iConfig.getUntrackedParameter<int>("filterNameLength",27);
181  l1nameLength_=iConfig.getUntrackedParameter<int>("l1filterNameLength",11);
182  arITrLabel_= consumes<reco::IsolatedPixelTrackCandidateCollection>(iConfig.getParameter<edm::InputTag>("alcarecoIsoTracksLabel"));
183  recoTrLabel_=iConfig.getParameter<edm::InputTag>("recoTracksLabel");
184  pThr_=iConfig.getUntrackedParameter<double>("pThrL3",0);
185  heLow_=iConfig.getUntrackedParameter<double>("lowerHighEnergyCut",40);
186  heUp_=iConfig.getUntrackedParameter<double>("upperHighEnergyCut",60);
187 
188  nTotal=0;
189  nHLTL3accepts=0;
190 }
191 
193 {}
194 
196 {
197 
198  nTotal++;
199 
201  iEvent.getByToken(hltEventTag_,trEv);
202 
204  iEvent.getByToken(arITrLabel_,recoIsoTracks);
205 
206  const trigger::TriggerObjectCollection& TOCol(trEv->getObjects());
207 
208  const trigger::size_type nFilt(trEv->sizeFilters());
209 
210  //get coordinates of L1 trigger
211  trigger::Keys KEYSl1;
212  for (trigger::size_type iFilt=0; iFilt!=nFilt; iFilt++)
213  {
214  if ((trEv->filterTag(iFilt).label()).substr(0,l1nameLength_)==l1FilterTag_) KEYSl1=trEv->filterKeys(iFilt);
215  }
216 
217  trigger::size_type nRegl1=KEYSl1.size();
218 
219  double etaTrigl1=-10000;
220  double phiTrigl1=-10000;
221  double ptMaxl1=0;
222  for (trigger::size_type iReg=0; iReg<nRegl1; iReg++)
223  {
224  const trigger::TriggerObject& TObj(TOCol[KEYSl1[iReg]]);
225  if (TObj.pt()>ptMaxl1)
226  {
227  etaTrigl1=TObj.eta();
228  phiTrigl1=TObj.phi();
229  ptMaxl1=TObj.pt();
230  }
231  }
232 
233  //get coordinates of hlt objects
234  std::vector<double> trigEta;
235  std::vector<double> trigPhi;
236 
237  trigger::Keys KEYS;
238  for (unsigned l=0; l<hltFilterTag_.size(); l++)
239  {
240  for (trigger::size_type iFilt=0; iFilt!=nFilt; iFilt++)
241  {
242  if ((trEv->filterTag(iFilt).label()).substr(0,nameLength_)==hltFilterTag_[l])
243  {
244  KEYS=trEv->filterKeys(iFilt);
245  }
246  }
247 
248  trigger::size_type nReg=KEYS.size();
249 
250  //checks with IsoTrack trigger results
251  for (trigger::size_type iReg=0; iReg<nReg; iReg++)
252  {
253  const trigger::TriggerObject& TObj(TOCol[KEYS[iReg]]);
254  if (TObj.p()<pThr_) continue;
255  hl3eta->Fill(TObj.eta(),1);
256  hl3AbsEta->Fill(fabs(TObj.eta()),1);
257  hl3phi->Fill(TObj.phi(),1);
258 
259  if (recoIsoTracks->size()>0)
260  {
261  double minRecoL3dist=1000;
262  reco::IsolatedPixelTrackCandidateCollection::const_iterator mrtr;
263  for (reco::IsolatedPixelTrackCandidateCollection::const_iterator rtrit=recoIsoTracks->begin(); rtrit!=recoIsoTracks->end(); rtrit++)
264  {
265  double R=deltaR(rtrit->eta(),rtrit->phi(),TObj.eta(),TObj.phi());
266  if (R<minRecoL3dist)
267  {
268  mrtr=rtrit;
269  minRecoL3dist=R;
270  }
271  }
272  hOffL3TrackMatch->Fill(minRecoL3dist,1);
273  if (minRecoL3dist<0.02) hOffL3TrackPtRat->Fill(TObj.pt()/mrtr->pt(),1);
274  }
275 
276  hl3Pt->Fill(TObj.pt(),1);
277  trigEta.push_back(TObj.eta());
278  trigPhi.push_back(TObj.phi());
279  }
280  }
281 
282  //general distributions
283  for (reco::IsolatedPixelTrackCandidateCollection::const_iterator itr=recoIsoTracks->begin(); itr!=recoIsoTracks->end(); itr++)
284  {
285  bool match=false;
286  for (unsigned int l=0; l<trigEta.size(); l++)
287  {
288  if (deltaR(itr->eta(),itr->phi(),trigEta[l],trigPhi[l])<0.02) match=true;
289  }
290  if (match)
291  {
292  hOffEtaFP->Fill(itr->eta(),1);
293  hOffPhiFP->Fill(itr->phi(),1);
294  }
295 
296  hOffEta->Fill(itr->eta(),1);
297  hOffPhi->Fill(itr->phi(),1);
298 
299  hOffAbsEta->Fill(fabs(itr->eta()),1);
300 
301  hL1jetMatch->Fill(deltaR(itr->eta(), itr->phi(), etaTrigl1, phiTrigl1),1);
302 
303  if (fabs(itr->eta())<1.479)
304  {
305  hDeposEcalInnerEB->Fill(itr->energyIn(),1);
306  hDeposEcalOuterEB->Fill(itr->energyOut(),1);
307  }
308  else
309  {
310  hDeposEcalInnerEE->Fill(itr->energyIn(),1);
311  hDeposEcalOuterEE->Fill(itr->energyOut(),1);
312  }
313 
314  hTracksSumP->Fill(itr->sumPtPxl(),1);
315  if (itr->maxPtPxl()==-10) hTracksMaxP->Fill(0,1);
316  else hTracksMaxP->Fill(itr->maxPtPxl(),1);
317 
318  if (fabs(itr->eta())<0.5) hOffP_0005->Fill(itr->p(),1);
319  if (fabs(itr->eta())>0.5&&fabs(itr->eta())<1.0) hOffP_0510->Fill(itr->p(),1);
320  if (fabs(itr->eta())>1.0&&fabs(itr->eta())<1.5) hOffP_1015->Fill(itr->p(),1);
321  if (fabs(itr->eta())<1.5&&fabs(itr->eta())<2.0) hOffP_1520->Fill(itr->p(),1);
322 
323  hOffP->Fill(itr->p(),1);
324 
325  std::pair<int,int> TI=towerIndex(itr->eta(),itr->phi());
326  hOccupancyFull->Fill(TI.first,TI.second,1);
327  if (itr->p()>heLow_&&itr->p()<heUp_) hOccupancyHighEn->Fill(TI.first,TI.second,1);
328  }
329 
330 }
331 
333 {
336 
337  hl3Pt=dbe_->book1D("hl3Pt","pT of hlt L3 objects",1000,0,1000);
338  hl3Pt->setAxisTitle("pT(GeV)",1);
339 
340  hl3eta=dbe_->book1D("hl3eta","eta of hlt L3 objects",16,-2,2);
341  hl3eta->setAxisTitle("eta",1);
342  hl3AbsEta=dbe_->book1D("hl3AbsEta","|eta| of hlt L3 objects",8,0,2);
343  hl3AbsEta->setAxisTitle("eta",1);
344  hl3phi=dbe_->book1D("hl3phi","phi of hlt L3 objects",16,-3.2,3.2);
345  hl3phi->setAxisTitle("phi",1);
346  hOffEta=dbe_->book1D("hOffEta","eta of alcareco objects",100,-2,2);
347  hOffEta->setAxisTitle("eta",1);
348  hOffPhi=dbe_->book1D("hOffPhi","phi of alcareco objects",100,-3.2,3.2);
349  hOffPhi->setAxisTitle("phi",1);
350  hOffP=dbe_->book1D("hOffP","p of alcareco objects",1000,0,1000);
351  hOffP->setAxisTitle("E(GeV)",1);
352  hOffP_0005=dbe_->book1D("hOffP_0005","p of alcareco objects, |eta|<0.5",1000,0,1000);
353  hOffP_0005->setAxisTitle("E(GeV)",1);
354  hOffP_0510=dbe_->book1D("hOffP_0510","p of alcareco objects, 0.5<|eta|<1.0",1000,0,1000);
355  hOffP_0510->setAxisTitle("E(GeV)",1);
356  hOffP_1015=dbe_->book1D("hOffP_1015","p of alcareco objects, 1.0<|eta|<1.5",1000,0,1000);
357  hOffP_1015->setAxisTitle("E(GeV)",1);
358  hOffP_1520=dbe_->book1D("hOffP_1520","p of alcareco objects, 1.5<|eta|<2.0",1000,0,1000);
359  hOffP_1520->setAxisTitle("E(GeV)",1);
360  hOffEtaFP=dbe_->book1D("hOffEtaFP","eta of alcareco objects, FP",16,-2,2);
361  hOffEtaFP->setAxisTitle("eta",1);
362  hOffAbsEta=dbe_->book1D("hOffAbsEta","|eta| of alcareco objects",8,0,2);
363  hOffAbsEta->setAxisTitle("|eta|",1);
364  hOffPhiFP=dbe_->book1D("hOffPhiFP","phi of alcareco objects, FP",16,-3.2,3.2);
365  hOffPhiFP->setAxisTitle("phi",1);
366  hTracksSumP=dbe_->book1D("hTracksSumP","summary p of tracks in the isolation cone",100,0,20);
367  hTracksSumP->setAxisTitle("E(GeV)");
368  hTracksMaxP=dbe_->book1D("hTracksMaxP","maximum p among tracks in the isolation cone",100,0,20);
369  hTracksMaxP->setAxisTitle("E(GeV)");
370  hDeposEcalInnerEE=dbe_->book1D("hDeposEcalInnerEE","ecal energy deposition in inner cone around track, EE",20,0,20);
371  hDeposEcalInnerEE->setAxisTitle("E(GeV)");
372  hDeposEcalOuterEE=dbe_->book1D("hDeposEcalOuterEE","ecal energy deposition in outer cone around track, EE",100,0,100);
373  hDeposEcalInnerEB=dbe_->book1D("hDeposEcalInnerEB","ecal energy deposition in inner cone around track, EB",20,0,20);
374  hDeposEcalInnerEB->setAxisTitle("E(GeV)");
375  hDeposEcalOuterEB=dbe_->book1D("hDeposEcalOuterEB","ecal energy deposition in outer cone around track, EB",100,0,100);
376  hDeposEcalOuterEB->setAxisTitle("E(GeV)");
377  hOccupancyFull=dbe_->book2D("hOccupancyFull","number of tracks per tower, full energy range",48,-25,25,73,0,73);
378  hOccupancyFull->setAxisTitle("ieta",1);
379  hOccupancyFull->setAxisTitle("iphi",2);
380  hOccupancyFull->getTH2F()->SetOption("colz");
381  hOccupancyFull->getTH2F()->SetStats(kFALSE);
382  hOccupancyHighEn=dbe_->book2D("hOccupancyHighEn","number of tracks per tower, high energy tracks",48,-25,25,73,0,73);
383  hOccupancyHighEn->setAxisTitle("ieta",1);
384  hOccupancyHighEn->setAxisTitle("iphi",2);
385  hOccupancyHighEn->getTH2F()->SetOption("colz");
386  hOccupancyHighEn->getTH2F()->SetStats(kFALSE);
387  hOffL3TrackMatch=dbe_->book1D("hOffL3TrackMatch","Distance from L3 object to offline track",40,0,0.2);
388  hOffL3TrackMatch->setAxisTitle("R(eta,phi)",1);
389  hOffL3TrackPtRat=dbe_->book1D("hOffL3TrackPtRat","Ratio of pT: L3/offline",500,0,3);
390  hOffL3TrackPtRat->setAxisTitle("ratio L3/offline",1);
391 
392  hL1jetMatch=dbe_->book1D("hL1jetMatch","dR(eta,phi) from leading L1 jet to offline track",100,0,5);
393 
394 }
395 
397 
398 if(dbe_)
399  {
401  }
402 }
403 
dbl * delta
Definition: mlp_gen.cc:36
edm::EDGetTokenT< trigger::TriggerEvent > hltEventTag_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
float phi() const
Definition: TriggerObject.h:58
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
DQMHcalIsoTrackAlCaReco(const edm::ParameterSet &)
std::pair< int, int > towerIndex(double eta, double phi)
float eta() const
Definition: TriggerObject.h:57
T eta() const
uint16_t size_type
void Fill(long long x)
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
int iEvent
Definition: GenABIO.cc:243
virtual void endJob() override
edm::EDGetTokenT< reco::IsolatedPixelTrackCandidateCollection > arITrLabel_
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2296
virtual void beginJob() override
std::vector< std::string > hltFilterTag_
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
std::vector< size_type > Keys
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
TH2F * getTH2F(void) const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
Definition: DDAxes.h:10