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 // $Id: DQMHcalIsoTrackAlCaReco.cc,v 1.9 2011/03/01 21:21:29 safronov Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
25 
27 
30 
33 
35 
39 
45 
48 
52 
56 
59 
61 
62 #include <fstream>
63 
64 #include "TH1F.h"
65 
67 public:
70 
71 
72 private:
73 
75 
76  virtual void beginJob() ;
77  virtual void analyze(const edm::Event&, const edm::EventSetup&);
78  virtual void endJob() ;
79 
80  std::string folderName_;
82  std::string outRootFileName_;
84  std::string l1FilterTag_;
85  std::vector<std::string> hltFilterTag_;
88  double pThr_;
89  double heLow_;
90  double heUp_;
91 
98 
103 
105 
108 
113 
115 
119 
122 
125 
128 
129  int nTotal;
133 
134  std::pair<int, int> towerIndex(double eta, double phi);
135 
136 };
137 
138 std::pair<int,int> DQMHcalIsoTrackAlCaReco::towerIndex(double eta, double phi)
139 {
140  int ieta = 0;
141  int iphi = 0;
142  for (int i=1; i<21; i++)
143  {
144  if (fabs(eta)<=(i*0.087)&&fabs(eta)>(i-1)*0.087) ieta=int(fabs(eta)/eta)*i;
145  }
146  if (fabs(eta)>1.740&&fabs(eta)<=1.830) ieta=int(fabs(eta)/eta)*21;
147  if (fabs(eta)>1.830&&fabs(eta)<=1.930) ieta=int(fabs(eta)/eta)*22;
148  if (fabs(eta)>1.930&&fabs(eta)<=2.043) ieta=int(fabs(eta)/eta)*23;
149  if (fabs(eta)>2.043&&fabs(eta)<=2.172) ieta=int(fabs(eta)/eta)*24;
150 
151  double delta=phi+0.174532925;
152  if (delta<0) delta=delta+2*acos(-1);
153  if (fabs(eta)<1.740)
154  {
155  for (int i=0; i<72; i++)
156  {
157  if (delta<(i+1)*0.087266462&&delta>i*0.087266462) iphi=i;
158  }
159  }
160  else
161  {
162  for (int i=0; i<36; i++)
163  {
164  if (delta<2*(i+1)*0.087266462&&delta>2*i*0.087266462) iphi=2*i;
165  }
166  }
167 
168  return std::pair<int,int>(ieta,iphi);
169 }
170 
171 
173 
174 {
175  folderName_ = iConfig.getParameter<std::string>("folderName");
176  saveToFile_=iConfig.getParameter<bool>("saveToFile");
177  outRootFileName_=iConfig.getParameter<std::string>("outputRootFileName");
178  hltEventTag_=iConfig.getParameter<edm::InputTag>("hltTriggerEventLabel");
179  l1FilterTag_=iConfig.getParameter<std::string>("l1FilterLabel");
180  hltFilterTag_=iConfig.getParameter<std::vector<std::string> >("hltL3FilterLabels");
181  nameLength_=iConfig.getUntrackedParameter<int>("filterNameLength",27);
182  l1nameLength_=iConfig.getUntrackedParameter<int>("l1filterNameLength",11);
183  arITrLabel_=iConfig.getParameter<edm::InputTag>("alcarecoIsoTracksLabel");
184  recoTrLabel_=iConfig.getParameter<edm::InputTag>("recoTracksLabel");
185  pThr_=iConfig.getUntrackedParameter<double>("pThrL3",0);
186  heLow_=iConfig.getUntrackedParameter<double>("lowerHighEnergyCut",40);
187  heUp_=iConfig.getUntrackedParameter<double>("upperHighEnergyCut",60);
188 
189  nTotal=0;
190  nHLTL3accepts=0;
191 }
192 
194 {}
195 
197 {
198 
199  nTotal++;
200 
202  iEvent.getByLabel(hltEventTag_,trEv);
203 
205  iEvent.getByLabel(arITrLabel_,recoIsoTracks);
206 
207  const trigger::TriggerObjectCollection& TOCol(trEv->getObjects());
208 
209  const trigger::size_type nFilt(trEv->sizeFilters());
210 
211  //get coordinates of L1 trigger
212  trigger::Keys KEYSl1;
213  for (trigger::size_type iFilt=0; iFilt!=nFilt; iFilt++)
214  {
215  if ((trEv->filterTag(iFilt).label()).substr(0,l1nameLength_)==l1FilterTag_) KEYSl1=trEv->filterKeys(iFilt);
216  }
217 
218  trigger::size_type nRegl1=KEYSl1.size();
219 
220  double etaTrigl1=-10000;
221  double phiTrigl1=-10000;
222  double ptMaxl1=0;
223  for (trigger::size_type iReg=0; iReg<nRegl1; iReg++)
224  {
225  const trigger::TriggerObject& TObj(TOCol[KEYSl1[iReg]]);
226  if (TObj.pt()>ptMaxl1)
227  {
228  etaTrigl1=TObj.eta();
229  phiTrigl1=TObj.phi();
230  ptMaxl1=TObj.pt();
231  }
232  }
233 
234  //get coordinates of hlt objects
235  std::vector<double> trigEta;
236  std::vector<double> trigPhi;
237 
238  trigger::Keys KEYS;
239  for (unsigned l=0; l<hltFilterTag_.size(); l++)
240  {
241  for (trigger::size_type iFilt=0; iFilt!=nFilt; iFilt++)
242  {
243  if ((trEv->filterTag(iFilt).label()).substr(0,nameLength_)==hltFilterTag_[l])
244  {
245  KEYS=trEv->filterKeys(iFilt);
246  }
247  }
248 
249  trigger::size_type nReg=KEYS.size();
250 
251  //checks with IsoTrack trigger results
252  for (trigger::size_type iReg=0; iReg<nReg; iReg++)
253  {
254  const trigger::TriggerObject& TObj(TOCol[KEYS[iReg]]);
255  if (TObj.p()<pThr_) continue;
256  hl3eta->Fill(TObj.eta(),1);
257  hl3AbsEta->Fill(fabs(TObj.eta()),1);
258  hl3phi->Fill(TObj.phi(),1);
259 
260  if (recoIsoTracks->size()>0)
261  {
262  double minRecoL3dist=1000;
263  reco::IsolatedPixelTrackCandidateCollection::const_iterator mrtr;
264  for (reco::IsolatedPixelTrackCandidateCollection::const_iterator rtrit=recoIsoTracks->begin(); rtrit!=recoIsoTracks->end(); rtrit++)
265  {
266  double R=deltaR(rtrit->eta(),rtrit->phi(),TObj.eta(),TObj.phi());
267  if (R<minRecoL3dist)
268  {
269  mrtr=rtrit;
270  minRecoL3dist=R;
271  }
272  }
273  hOffL3TrackMatch->Fill(minRecoL3dist,1);
274  if (minRecoL3dist<0.02) hOffL3TrackPtRat->Fill(TObj.pt()/mrtr->pt(),1);
275  }
276 
277  hl3Pt->Fill(TObj.pt(),1);
278  trigEta.push_back(TObj.eta());
279  trigPhi.push_back(TObj.phi());
280  }
281  }
282 
283  //general distributions
284  for (reco::IsolatedPixelTrackCandidateCollection::const_iterator itr=recoIsoTracks->begin(); itr!=recoIsoTracks->end(); itr++)
285  {
286  bool match=false;
287  for (unsigned int l=0; l<trigEta.size(); l++)
288  {
289  if (deltaR(itr->eta(),itr->phi(),trigEta[l],trigPhi[l])<0.02) match=true;
290  }
291  if (match)
292  {
293  hOffEtaFP->Fill(itr->eta(),1);
294  hOffPhiFP->Fill(itr->phi(),1);
295  }
296 
297  hOffEta->Fill(itr->eta(),1);
298  hOffPhi->Fill(itr->phi(),1);
299 
300  hOffAbsEta->Fill(fabs(itr->eta()),1);
301 
302  hL1jetMatch->Fill(deltaR(itr->eta(), itr->phi(), etaTrigl1, phiTrigl1),1);
303 
304  if (fabs(itr->eta())<1.479)
305  {
306  hDeposEcalInnerEB->Fill(itr->energyIn(),1);
307  hDeposEcalOuterEB->Fill(itr->energyOut(),1);
308  }
309  else
310  {
311  hDeposEcalInnerEE->Fill(itr->energyIn(),1);
312  hDeposEcalOuterEE->Fill(itr->energyOut(),1);
313  }
314 
315  hTracksSumP->Fill(itr->sumPtPxl(),1);
316  if (itr->maxPtPxl()==-10) hTracksMaxP->Fill(0,1);
317  else hTracksMaxP->Fill(itr->maxPtPxl(),1);
318 
319  if (fabs(itr->eta())<0.5) hOffP_0005->Fill(itr->p(),1);
320  if (fabs(itr->eta())>0.5&&fabs(itr->eta())<1.0) hOffP_0510->Fill(itr->p(),1);
321  if (fabs(itr->eta())>1.0&&fabs(itr->eta())<1.5) hOffP_1015->Fill(itr->p(),1);
322  if (fabs(itr->eta())<1.5&&fabs(itr->eta())<2.0) hOffP_1520->Fill(itr->p(),1);
323 
324  hOffP->Fill(itr->p(),1);
325 
326  std::pair<int,int> TI=towerIndex(itr->eta(),itr->phi());
327  hOccupancyFull->Fill(TI.first,TI.second,1);
328  if (itr->p()>heLow_&&itr->p()<heUp_) hOccupancyHighEn->Fill(TI.first,TI.second,1);
329  }
330 
331 }
332 
334 {
337 
338  hl3Pt=dbe_->book1D("hl3Pt","pT of hlt L3 objects",1000,0,1000);
339  hl3Pt->setAxisTitle("pT(GeV)",1);
340 
341  hl3eta=dbe_->book1D("hl3eta","eta of hlt L3 objects",16,-2,2);
342  hl3eta->setAxisTitle("eta",1);
343  hl3AbsEta=dbe_->book1D("hl3AbsEta","|eta| of hlt L3 objects",8,0,2);
344  hl3AbsEta->setAxisTitle("eta",1);
345  hl3phi=dbe_->book1D("hl3phi","phi of hlt L3 objects",16,-3.2,3.2);
346  hl3phi->setAxisTitle("phi",1);
347  hOffEta=dbe_->book1D("hOffEta","eta of alcareco objects",100,-2,2);
348  hOffEta->setAxisTitle("eta",1);
349  hOffPhi=dbe_->book1D("hOffPhi","phi of alcareco objects",100,-3.2,3.2);
350  hOffPhi->setAxisTitle("phi",1);
351  hOffP=dbe_->book1D("hOffP","p of alcareco objects",1000,0,1000);
352  hOffP->setAxisTitle("E(GeV)",1);
353  hOffP_0005=dbe_->book1D("hOffP_0005","p of alcareco objects, |eta|<0.5",1000,0,1000);
354  hOffP_0005->setAxisTitle("E(GeV)",1);
355  hOffP_0510=dbe_->book1D("hOffP_0510","p of alcareco objects, 0.5<|eta|<1.0",1000,0,1000);
356  hOffP_0510->setAxisTitle("E(GeV)",1);
357  hOffP_1015=dbe_->book1D("hOffP_1015","p of alcareco objects, 1.0<|eta|<1.5",1000,0,1000);
358  hOffP_1015->setAxisTitle("E(GeV)",1);
359  hOffP_1520=dbe_->book1D("hOffP_1520","p of alcareco objects, 1.5<|eta|<2.0",1000,0,1000);
360  hOffP_1520->setAxisTitle("E(GeV)",1);
361  hOffEtaFP=dbe_->book1D("hOffEtaFP","eta of alcareco objects, FP",16,-2,2);
362  hOffEtaFP->setAxisTitle("eta",1);
363  hOffAbsEta=dbe_->book1D("hOffAbsEta","|eta| of alcareco objects",8,0,2);
364  hOffAbsEta->setAxisTitle("|eta|",1);
365  hOffPhiFP=dbe_->book1D("hOffPhiFP","phi of alcareco objects, FP",16,-3.2,3.2);
366  hOffPhiFP->setAxisTitle("phi",1);
367  hTracksSumP=dbe_->book1D("hTracksSumP","summary p of tracks in the isolation cone",100,0,20);
368  hTracksSumP->setAxisTitle("E(GeV)");
369  hTracksMaxP=dbe_->book1D("hTracksMaxP","maximum p among tracks in the isolation cone",100,0,20);
370  hTracksMaxP->setAxisTitle("E(GeV)");
371  hDeposEcalInnerEE=dbe_->book1D("hDeposEcalInnerEE","ecal energy deposition in inner cone around track, EE",20,0,20);
372  hDeposEcalInnerEE->setAxisTitle("E(GeV)");
373  hDeposEcalOuterEE=dbe_->book1D("hDeposEcalOuterEE","ecal energy deposition in outer cone around track, EE",100,0,100);
374  hDeposEcalInnerEB=dbe_->book1D("hDeposEcalInnerEB","ecal energy deposition in inner cone around track, EB",20,0,20);
375  hDeposEcalInnerEB->setAxisTitle("E(GeV)");
376  hDeposEcalOuterEB=dbe_->book1D("hDeposEcalOuterEB","ecal energy deposition in outer cone around track, EB",100,0,100);
377  hDeposEcalOuterEB->setAxisTitle("E(GeV)");
378  hOccupancyFull=dbe_->book2D("hOccupancyFull","number of tracks per tower, full energy range",48,-25,25,73,0,73);
379  hOccupancyFull->setAxisTitle("ieta",1);
380  hOccupancyFull->setAxisTitle("iphi",2);
381  hOccupancyFull->getTH2F()->SetOption("colz");
382  hOccupancyFull->getTH2F()->SetStats(kFALSE);
383  hOccupancyHighEn=dbe_->book2D("hOccupancyHighEn","number of tracks per tower, high energy tracks",48,-25,25,73,0,73);
384  hOccupancyHighEn->setAxisTitle("ieta",1);
385  hOccupancyHighEn->setAxisTitle("iphi",2);
386  hOccupancyHighEn->getTH2F()->SetOption("colz");
387  hOccupancyHighEn->getTH2F()->SetStats(kFALSE);
388  hOffL3TrackMatch=dbe_->book1D("hOffL3TrackMatch","Distance from L3 object to offline track",40,0,0.2);
389  hOffL3TrackMatch->setAxisTitle("R(eta,phi)",1);
390  hOffL3TrackPtRat=dbe_->book1D("hOffL3TrackPtRat","Ratio of pT: L3/offline",500,0,3);
391  hOffL3TrackPtRat->setAxisTitle("ratio L3/offline",1);
392 
393  hL1jetMatch=dbe_->book1D("hL1jetMatch","dR(eta,phi) from leading L1 jet to offline track",100,0,5);
394 
395 }
396 
398 
399 if(dbe_)
400  {
402  }
403 }
404 
dbl * delta
Definition: mlp_gen.cc:36
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:717
float phi() const
Definition: TriggerObject.h:60
DQMHcalIsoTrackAlCaReco(const edm::ParameterSet &)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2113
std::pair< int, int > towerIndex(double eta, double phi)
float eta() const
Definition: TriggerObject.h:59
T eta() const
uint16_t size_type
void Fill(long long x)
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:24
int iEvent
Definition: GenABIO.cc:243
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
virtual void analyze(const edm::Event &, const edm::EventSetup &)
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:83
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:845
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:429
Definition: DDAxes.h:10