CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalRecHitsAnalyzer.cc
Go to the documentation of this file.
1 
8 using namespace std;
15 
17  fName(""), verbosity(0), frequency(0), label(""), getAllProvenances(false),
18  printProvenanceInfo(false), count(0)
19 {
20  std::string MsgLoggerCat = "GlobalRecHitsAnalyzer_GlobalRecHitsAnalyzer";
21 
22  // get information from parameter set
23  fName = iPSet.getUntrackedParameter<std::string>("Name");
24  verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
25  frequency = iPSet.getUntrackedParameter<int>("Frequency");
26  edm::ParameterSet m_Prov =
27  iPSet.getParameter<edm::ParameterSet>("ProvenanceLookup");
29  m_Prov.getUntrackedParameter<bool>("GetAllProvenances");
31  m_Prov.getUntrackedParameter<bool>("PrintProvenanceInfo");
32  hitsProducer = iPSet.getParameter<std::string>("hitsProducer");
33 
34  //get Labels to use to extract information
35  ECalEBSrc_ = iPSet.getParameter<edm::InputTag>("ECalEBSrc");
36  ECalUncalEBSrc_ = iPSet.getParameter<edm::InputTag>("ECalUncalEBSrc");
37  ECalEESrc_ = iPSet.getParameter<edm::InputTag>("ECalEESrc");
38  ECalUncalEESrc_ = iPSet.getParameter<edm::InputTag>("ECalUncalEESrc");
39  ECalESSrc_ = iPSet.getParameter<edm::InputTag>("ECalESSrc");
40  HCalSrc_ = iPSet.getParameter<edm::InputTag>("HCalSrc");
41  SiStripSrc_ = iPSet.getParameter<edm::InputTag>("SiStripSrc");
42  SiPxlSrc_ = iPSet.getParameter<edm::InputTag>("SiPxlSrc");
43  MuDTSrc_ = iPSet.getParameter<edm::InputTag>("MuDTSrc");
44  MuDTSimSrc_ = iPSet.getParameter<edm::InputTag>("MuDTSimSrc");
45  MuCSCSrc_ = iPSet.getParameter<edm::InputTag>("MuCSCSrc");
46  MuRPCSrc_ = iPSet.getParameter<edm::InputTag>("MuRPCSrc");
47  MuRPCSimSrc_ = iPSet.getParameter<edm::InputTag>("MuRPCSimSrc");
48 
49  conf_ = iPSet;
50 
51  // fix for consumes
52  ECalUncalEBSrc_Token_ = consumes<EBUncalibratedRecHitCollection>(iPSet.getParameter<edm::InputTag>("ECalUncalEBSrc"));
53  ECalUncalEESrc_Token_ = consumes<EEUncalibratedRecHitCollection>(iPSet.getParameter<edm::InputTag>("ECalUncalEESrc"));
54  ECalEBSrc_Token_ = consumes<EBRecHitCollection>(iPSet.getParameter<edm::InputTag>("ECalEBSrc"));
55  ECalEESrc_Token_ = consumes<EERecHitCollection>(iPSet.getParameter<edm::InputTag>("ECalEESrc"));
56  ECalESSrc_Token_ = consumes<ESRecHitCollection>(iPSet.getParameter<edm::InputTag>("ECalESSrc"));
57  HCalSrc_Token_ = consumes<edm::PCaloHitContainer>(iPSet.getParameter<edm::InputTag>("HCalSrc"));
58  SiStripSrc_Token_ = consumes<SiStripMatchedRecHit2DCollection>(iPSet.getParameter<edm::InputTag>("SiStripSrc"));
59  SiPxlSrc_Token_ = consumes<SiPixelRecHitCollection>(iPSet.getParameter<edm::InputTag>("SiPxlSrc"));
60 
61  MuDTSrc_Token_ = consumes<DTRecHitCollection>(iPSet.getParameter<edm::InputTag>("MuDTSrc"));
62  MuDTSimSrc_Token_ = consumes<edm::PSimHitContainer>(iPSet.getParameter<edm::InputTag>("MuDTSimSrc"));
63 
64  MuCSCSrc_Token_ = consumes<CSCRecHit2DCollection>(iPSet.getParameter<edm::InputTag>("MuCSCSrc"));
65  MuCSCHits_Token_ = consumes<CrossingFrame<PSimHit>>(edm::InputTag(std::string("mix"), iPSet.getParameter<std::string>("hitsProducer") + std::string("MuonCSCHits")));
66 
67  MuRPCSrc_Token_ = consumes<RPCRecHitCollection>(iPSet.getParameter<edm::InputTag>("MuRPCSrc"));
68  MuRPCSimSrc_Token_ = consumes<edm::PSimHitContainer>(iPSet.getParameter<edm::InputTag>("MuRPCSimSrc"));
69 
70  EBHits_Token_ = consumes<CrossingFrame<PCaloHit> >(edm::InputTag(std::string("mix"), iPSet.getParameter<std::string>("hitsProducer") + std::string("EcalHitsEB")));
71  EEHits_Token_ = consumes<CrossingFrame<PCaloHit> >(edm::InputTag(std::string("mix"), iPSet.getParameter<std::string>("hitsProducer") + std::string("EcalHitsEE")));
72  ESHits_Token_ = consumes<CrossingFrame<PCaloHit> >(edm::InputTag(std::string("mix"), iPSet.getParameter<std::string>("hitsProducer") + std::string("EcalHitsES")));
73 
74  // use value of first digit to determine default output level (inclusive)
75  // 0 is none, 1 is basic, 2 is fill output, 3 is gather output
76  verbosity %= 10;
77 
78  // create persistent object
79  // produces<PGlobalRecHit>(label);
80 
81  // print out Parameter Set information being used
82  if (verbosity >= 0) {
83  edm::LogInfo(MsgLoggerCat)
84  << "\n===============================\n"
85  << "Initialized as EDProducer with parameter values:\n"
86  << " Name = " << fName << "\n"
87  << " Verbosity = " << verbosity << "\n"
88  << " Frequency = " << frequency << "\n"
89  << " GetProv = " << getAllProvenances << "\n"
90  << " PrintProv = " << printProvenanceInfo << "\n"
91  << " ECalEBSrc = " << ECalEBSrc_.label()
92  << ":" << ECalEBSrc_.instance() << "\n"
93  << " ECalUncalEBSrc = " << ECalUncalEBSrc_.label()
94  << ":" << ECalUncalEBSrc_.instance() << "\n"
95  << " ECalEESrc = " << ECalEESrc_.label()
96  << ":" << ECalUncalEESrc_.instance() << "\n"
97  << " ECalUncalEESrc = " << ECalUncalEESrc_.label()
98  << ":" << ECalEESrc_.instance() << "\n"
99  << " ECalESSrc = " << ECalESSrc_.label()
100  << ":" << ECalESSrc_.instance() << "\n"
101  << " HCalSrc = " << HCalSrc_.label()
102  << ":" << HCalSrc_.instance() << "\n"
103  << " SiStripSrc = " << SiStripSrc_.label()
104  << ":" << SiStripSrc_.instance() << "\n"
105  << " SiPixelSrc = " << SiPxlSrc_.label()
106  << ":" << SiPxlSrc_.instance() << "\n"
107  << " MuDTSrc = " << MuDTSrc_.label()
108  << ":" << MuDTSrc_.instance() << "\n"
109  << " MuDTSimSrc = " << MuDTSimSrc_.label()
110  << ":" << MuDTSimSrc_.instance() << "\n"
111  << " MuCSCSrc = " << MuCSCSrc_.label()
112  << ":" << MuCSCSrc_.instance() << "\n"
113  << " MuRPCSrc = " << MuRPCSrc_.label()
114  << ":" << MuRPCSrc_.instance() << "\n"
115  << " MuRPCSimSrc = " << MuRPCSimSrc_.label()
116  << ":" << MuRPCSimSrc_.instance() << "\n"
117  << "===============================\n";
118  }
119 }
120 
122 
124  // Si Strip
125  string SiStripString[19] = {"TECW1", "TECW2", "TECW3", "TECW4", "TECW5",
126  "TECW6", "TECW7", "TECW8", "TIBL1", "TIBL2",
127  "TIBL3", "TIBL4", "TIDW1", "TIDW2", "TIDW3",
128  "TOBL1", "TOBL2", "TOBL3", "TOBL4"};
129  for(int i = 0; i<19; ++i) {
130  mehSiStripn[i]=0;
131  mehSiStripResX[i]=0;
132  mehSiStripResY[i]=0;
133  }
134  string hcharname, hchartitle;
135  iBooker.setCurrentFolder("GlobalRecHitsV/SiStrips");
136  for(int amend = 0; amend < 19; ++amend) {
137  hcharname = "hSiStripn_"+SiStripString[amend];
138  hchartitle= SiStripString[amend]+" rechits";
139  mehSiStripn[amend] = iBooker.book1D(hcharname,hchartitle,200,0.,200.);
140  mehSiStripn[amend]->setAxisTitle("Number of hits in "+
141  SiStripString[amend],1);
142  mehSiStripn[amend]->setAxisTitle("Count",2);
143  hcharname = "hSiStripResX_"+SiStripString[amend];
144  hchartitle= SiStripString[amend]+" rechit x resolution";
145  mehSiStripResX[amend] = iBooker.book1D(hcharname,hchartitle,200,-0.02,.02);
146  mehSiStripResX[amend]->setAxisTitle("X-resolution in "
147  +SiStripString[amend],1);
148  mehSiStripResX[amend]->setAxisTitle("Count",2);
149  hcharname = "hSiStripResY_"+SiStripString[amend];
150  hchartitle= SiStripString[amend]+" rechit y resolution";
151  mehSiStripResY[amend] = iBooker.book1D(hcharname,hchartitle,200,-0.02,.02);
152  mehSiStripResY[amend]->setAxisTitle("Y-resolution in "+
153  SiStripString[amend],1);
154  mehSiStripResY[amend]->setAxisTitle("Count",2);
155  }
156 
157 
158  //HCal
159  //string hcharname, hchartitle;
160  string HCalString[4]={"HB", "HE", "HF", "HO"};
161  float HCalnUpper[4]={3000.,3000.,3000.,3000.};
162  float HCalnLower[4]={0.,0.,0.,0.};
163  for(int j =0; j <4; ++j) {
164  mehHcaln[j]=0;
165  mehHcalRes[j]=0;
166  }
167 
168  iBooker.setCurrentFolder("GlobalRecHitsV/HCals");
169  for(int amend = 0; amend < 4; ++amend) {
170  hcharname = "hHcaln_"+HCalString[amend];
171  hchartitle= HCalString[amend]+" rechits";
172  mehHcaln[amend] = iBooker.book1D(hcharname,hchartitle, 1000, HCalnLower[amend],
173  HCalnUpper[amend]);
174  mehHcaln[amend]->setAxisTitle("Number of RecHits",1);
175  mehHcaln[amend]->setAxisTitle("Count",2);
176  hcharname = "hHcalRes_"+HCalString[amend];
177  hchartitle= HCalString[amend]+" rechit resolution";
178  mehHcalRes[amend] = iBooker.book1D(hcharname,hchartitle, 25, -2., 2.);
179  mehHcalRes[amend]->setAxisTitle("RecHit E - SimHit E",1);
180  mehHcalRes[amend]->setAxisTitle("Count",2);
181  }
182 
183 
184  //Ecal
185  string ECalString[3] = {"EB","EE", "ES"};
186  int ECalnBins[3] = {1000,3000,150};
187  float ECalnUpper[3] = {20000., 62000., 3000.};
188  float ECalnLower[3] = {0., 0., 0.};
189  int ECalResBins[3] = {200,200,200};
190  float ECalResUpper[3] = {1., 0.3, .0002};
191  float ECalResLower[3] = {-1., -0.3, -.0002};
192  for(int i =0; i<3; ++i) {
193  mehEcaln[i]=0;
194  mehEcalRes[i]=0;
195  }
196  iBooker.setCurrentFolder("GlobalRecHitsV/ECals");
197 
198  for(int amend = 0; amend < 3; ++amend) {
199  hcharname = "hEcaln_"+ECalString[amend];
200  hchartitle= ECalString[amend]+" rechits";
201  mehEcaln[amend] = iBooker.book1D(hcharname,hchartitle, ECalnBins[amend],
202  ECalnLower[amend], ECalnUpper[amend]);
203  mehEcaln[amend]->setAxisTitle("Number of RecHits",1);
204  mehEcaln[amend]->setAxisTitle("Count",2);
205  hcharname = "hEcalRes_"+ECalString[amend];
206  hchartitle= ECalString[amend]+" rechit resolution";
207  mehEcalRes[amend] = iBooker.book1D(hcharname,hchartitle,ECalResBins[amend],
208  ECalResLower[amend],
209  ECalResUpper[amend]);
210  mehEcalRes[amend]->setAxisTitle("RecHit E - SimHit E",1);
211  mehEcalRes[amend]->setAxisTitle("Count",2);
212  }
213 
214  //Si Pixels
215  string SiPixelString[7] = {"BRL1", "BRL2", "BRL3", "FWD1n", "FWD1p",
216  "FWD2n", "FWD2p"};
217  for(int j =0; j<7; ++j) {
218  mehSiPixeln[j]=0;
219  mehSiPixelResX[j]=0;
220  mehSiPixelResY[j]=0;
221  }
222 
223  iBooker.setCurrentFolder("GlobalRecHitsV/SiPixels");
224  for(int amend = 0; amend < 7; ++amend) {
225  hcharname = "hSiPixeln_"+SiPixelString[amend];
226  hchartitle= SiPixelString[amend]+" rechits";
227  mehSiPixeln[amend] = iBooker.book1D(hcharname,hchartitle,200,0.,200.);
228  mehSiPixeln[amend]->setAxisTitle("Number of hits in "+
229  SiPixelString[amend],1);
230  mehSiPixeln[amend]->setAxisTitle("Count",2);
231  hcharname = "hSiPixelResX_"+SiPixelString[amend];
232  hchartitle= SiPixelString[amend]+" rechit x resolution";
233  mehSiPixelResX[amend] = iBooker.book1D(hcharname,hchartitle,200,-0.02,.02);
234  mehSiPixelResX[amend]->setAxisTitle("X-resolution in "+
235  SiPixelString[amend],1);
236  mehSiPixelResX[amend]->setAxisTitle("Count",2);
237  hcharname = "hSiPixelResY_"+SiPixelString[amend];
238  hchartitle= SiPixelString[amend]+" rechit y resolution";
239 
240  mehSiPixelResY[amend] = iBooker.book1D(hcharname,hchartitle,200,-0.02,.02);
241  mehSiPixelResY[amend]->setAxisTitle("Y-resolution in "+
242  SiPixelString[amend],1);
243  mehSiPixelResY[amend]->setAxisTitle("Count",2);
244  }
245 
246  //Muons
247  iBooker.setCurrentFolder("GlobalRecHitsV/Muons");
248 
249  mehDtMuonn = 0;
250  mehCSCn = 0;
251  mehRPCn = 0;
252 
253  string n_List[3] = {"hDtMuonn", "hCSCn", "hRPCn"};
254  string hist_string[3] = {"Dt", "CSC", "RPC"};
255 
256  for(int amend=0; amend<3; ++amend) {
257  hchartitle = hist_string[amend]+" rechits";
258  if(amend==0) {
259  mehDtMuonn=iBooker.book1D(n_List[amend],hchartitle,50, 0., 500.);
260  mehDtMuonn->setAxisTitle("Number of Rechits",1);
261  mehDtMuonn->setAxisTitle("Count",2);
262  }
263  if(amend==1) {
264  mehCSCn=iBooker.book1D(n_List[amend],hchartitle,50, 0., 500.);
265  mehCSCn->setAxisTitle("Number of Rechits",1);
266  mehCSCn->setAxisTitle("Count",2);
267  }
268  if(amend==2){
269  mehRPCn=iBooker.book1D(n_List[amend],hchartitle,50, 0., 500.);
270  mehRPCn->setAxisTitle("Number of Rechits",1);
271  mehRPCn->setAxisTitle("Count",2);
272  }
273  }
274 
275  mehDtMuonRes=0;
276  mehCSCResRDPhi=0;
277  mehRPCResX=0;
278 
279  hcharname = "hDtMuonRes";
280  hchartitle = "DT wire distance resolution";
281  mehDtMuonRes = iBooker.book1D(hcharname, hchartitle, 200, -0.2, 0.2);
282  hcharname = "CSCResRDPhi";
283  hchartitle = "CSC perp*dphi resolution";
284  mehCSCResRDPhi = iBooker.book1D(hcharname, hchartitle, 200, -0.2, 0.2);
285  hcharname = "hRPCResX";
286  hchartitle = "RPC rechits x resolution";
287  mehRPCResX = iBooker.book1D(hcharname, hchartitle, 50, -5., 5.);
288 }
289 
290 
292  const edm::EventSetup& iSetup)
293 {
294  std::string MsgLoggerCat = "GlobalRecHitsAnalyzer_analyze";
295 
296  // keep track of number of events processed
297  ++count;
298 
299  // get event id information
300  edm::RunNumber_t nrun = iEvent.id().run();
301  edm::EventNumber_t nevt = iEvent.id().event();
302 
303  if (verbosity > 0) {
304  edm::LogInfo(MsgLoggerCat)
305  << "Processing run " << nrun << ", event " << nevt
306  << " (" << count << " events total)";
307  } else if (verbosity == 0) {
308  if (nevt%frequency == 0 || nevt == 1) {
309  edm::LogInfo(MsgLoggerCat)
310  << "Processing run " << nrun << ", event " << nevt
311  << " (" << count << " events total)";
312  }
313  }
314 
315  // look at information available in the event
316  if (getAllProvenances) {
317 
318  std::vector<const edm::Provenance*> AllProv;
319  iEvent.getAllProvenance(AllProv);
320 
321  if (verbosity >= 0)
322  edm::LogInfo(MsgLoggerCat)
323  << "Number of Provenances = " << AllProv.size();
324 
325  if (printProvenanceInfo && (verbosity >= 0)) {
326  TString eventout("\nProvenance info:\n");
327 
328  for (unsigned int i = 0; i < AllProv.size(); ++i) {
329  eventout += "\n ******************************";
330  eventout += "\n Module : ";
331  eventout += AllProv[i]->moduleLabel();
332  eventout += "\n ProductID : ";
333  eventout += AllProv[i]->productID().id();
334  eventout += "\n ClassName : ";
335  eventout += AllProv[i]->className();
336  eventout += "\n InstanceName : ";
337  eventout += AllProv[i]->productInstanceName();
338  eventout += "\n BranchName : ";
339  eventout += AllProv[i]->branchName();
340  }
341  eventout += "\n ******************************\n";
342  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
343  printProvenanceInfo = false;
344  }
345  getAllProvenances = false;
346  }
347 
348  // call fill functions
349  // gather Ecal information from event
350  fillECal(iEvent, iSetup);
351  // gather Hcal information from event
352  fillHCal(iEvent, iSetup);
353  // gather Track information from event
354  fillTrk(iEvent, iSetup);
355  // gather Muon information from event
356  fillMuon(iEvent, iSetup);
357 
358  if (verbosity > 0)
359  edm::LogInfo (MsgLoggerCat)
360  << "Done gathering data from event.";
361 
362  return;
363 }
364 
366  const edm::EventSetup& iSetup)
367 {
368  std::string MsgLoggerCat = "GlobalRecHitsAnalyzer_fillECal";
369 
370  TString eventout;
371  if (verbosity > 0)
372  eventout = "\nGathering info:";
373 
374  // extract crossing frame from event
375  edm::Handle<CrossingFrame<PCaloHit> > crossingFrame;
376 
378  //extract EB information
381  iEvent.getByToken(ECalUncalEBSrc_Token_, EcalUncalibRecHitEB);
382  bool validUncalibRecHitEB = true;
383  if (!EcalUncalibRecHitEB.isValid()) {
384  LogDebug(MsgLoggerCat)
385  << "Unable to find EcalUncalRecHitEB in event!";
386  validUncalibRecHitEB = false;
387  }
388 
389  edm::Handle<EBRecHitCollection> EcalRecHitEB;
390  iEvent.getByToken(ECalEBSrc_Token_, EcalRecHitEB);
391  bool validRecHitEB = true;
392  if (!EcalRecHitEB.isValid()) {
393  LogDebug(MsgLoggerCat)
394  << "Unable to find EcalRecHitEB in event!";
395  validRecHitEB = false;
396  }
397 
398  // loop over simhits
399  iEvent.getByToken(EBHits_Token_,crossingFrame);
400  bool validXFrame = true;
401  if (!crossingFrame.isValid()) {
402  LogDebug(MsgLoggerCat)
403  << "Unable to find cal barrel crossingFrame in event!";
404  validXFrame = false;
405  }
406 
407  MapType ebSimMap;
408  if (validXFrame) {
409  std::auto_ptr<MixCollection<PCaloHit> >
410  barrelHits(new MixCollection<PCaloHit>(crossingFrame.product()));
411 
412  // keep track of sum of simhit energy in each crystal
414  = barrelHits->begin();
415  hitItr != barrelHits->end();
416  ++hitItr) {
417 
418  EBDetId ebid = EBDetId(hitItr->id());
419 
420  uint32_t crystid = ebid.rawId();
421  ebSimMap[crystid] += hitItr->energy();
422  }
423  }
424 
425  int nEBRecHits = 0;
426  // loop over RecHits
427  if (validUncalibRecHitEB && validRecHitEB) {
428  const EBUncalibratedRecHitCollection *EBUncalibRecHit =
429  EcalUncalibRecHitEB.product();
430  const EBRecHitCollection *EBRecHit = EcalRecHitEB.product();
431 
433  EBUncalibRecHit->begin();
434  uncalibRecHit != EBUncalibRecHit->end();
435  ++uncalibRecHit) {
436 
437  EBDetId EBid = EBDetId(uncalibRecHit->id());
438 
439  EcalRecHitCollection::const_iterator myRecHit = EBRecHit->find(EBid);
440 
441  if (myRecHit != EBRecHit->end()) {
442  ++nEBRecHits;
443  mehEcalRes[1]->Fill(myRecHit->energy()-ebSimMap[EBid.rawId()]);
444  }
445  }
446 
447  if (verbosity > 1) {
448  eventout += "\n Number of EBRecHits collected:............ ";
449  eventout += nEBRecHits;
450  }
451  mehEcaln[1]->Fill((float)nEBRecHits);
452  }
453 
455  //extract EE information
458  iEvent.getByToken(ECalUncalEESrc_Token_, EcalUncalibRecHitEE);
459  bool validuncalibRecHitEE = true;
460  if (!EcalUncalibRecHitEE.isValid()) {
461  LogDebug(MsgLoggerCat)
462  << "Unable to find EcalUncalRecHitEE in event!";
463  validuncalibRecHitEE = false;
464  }
465 
466  edm::Handle<EERecHitCollection> EcalRecHitEE;
467  iEvent.getByToken(ECalEESrc_Token_, EcalRecHitEE);
468  bool validRecHitEE = true;
469  if (!EcalRecHitEE.isValid()) {
470  LogDebug(MsgLoggerCat)
471  << "Unable to find EcalRecHitEE in event!";
472  validRecHitEE = false;
473  }
474 
475  // loop over simhits
476  iEvent.getByToken(EEHits_Token_,crossingFrame);
477  validXFrame = true;
478  if (!crossingFrame.isValid()) {
479  LogDebug(MsgLoggerCat)
480  << "Unable to find cal endcap crossingFrame in event!";
481  validXFrame = false;
482  }
483 
484  MapType eeSimMap;
485  if (validXFrame) {
486  std::auto_ptr<MixCollection<PCaloHit> >
487  endcapHits(new MixCollection<PCaloHit>(crossingFrame.product()));
488 
489  // keep track of sum of simhit energy in each crystal
491  = endcapHits->begin();
492  hitItr != endcapHits->end();
493  ++hitItr) {
494 
495  EEDetId eeid = EEDetId(hitItr->id());
496 
497  uint32_t crystid = eeid.rawId();
498  eeSimMap[crystid] += hitItr->energy();
499  }
500  }
501 
502  int nEERecHits = 0;
503  if (validuncalibRecHitEE && validRecHitEE) {
504  // loop over RecHits
505  const EEUncalibratedRecHitCollection *EEUncalibRecHit =
506  EcalUncalibRecHitEE.product();
507  const EERecHitCollection *EERecHit = EcalRecHitEE.product();
508 
510  EEUncalibRecHit->begin();
511  uncalibRecHit != EEUncalibRecHit->end();
512  ++uncalibRecHit) {
513 
514  EEDetId EEid = EEDetId(uncalibRecHit->id());
515 
516  EcalRecHitCollection::const_iterator myRecHit = EERecHit->find(EEid);
517 
518  if (myRecHit != EERecHit->end()) {
519  ++nEERecHits;
520  mehEcalRes[0]->Fill(myRecHit->energy()-eeSimMap[EEid.rawId()]);
521  }
522  }
523 
524  if (verbosity > 1) {
525  eventout += "\n Number of EERecHits collected:............ ";
526  eventout += nEERecHits;
527  }
528  mehEcaln[0]->Fill((float)nEERecHits);
529  }
530 
532  //extract ES information
534  edm::Handle<ESRecHitCollection> EcalRecHitES;
535  iEvent.getByToken(ECalESSrc_Token_, EcalRecHitES);
536  bool validRecHitES = true;
537  if (!EcalRecHitES.isValid()) {
538  LogDebug(MsgLoggerCat)
539  << "Unable to find EcalRecHitES in event!";
540  validRecHitES = false;
541  }
542 
543  // loop over simhits
544  iEvent.getByToken(ESHits_Token_,crossingFrame);
545  validXFrame = true;
546  if (!crossingFrame.isValid()) {
547  LogDebug(MsgLoggerCat)
548  << "Unable to find cal preshower crossingFrame in event!";
549  validXFrame = false;
550  }
551 
552  MapType esSimMap;
553  if (validXFrame) {
554  std::auto_ptr<MixCollection<PCaloHit> >
555  preshowerHits(new MixCollection<PCaloHit>(crossingFrame.product()));
556 
557  // keep track of sum of simhit energy in each crystal
559  = preshowerHits->begin();
560  hitItr != preshowerHits->end();
561  ++hitItr) {
562 
563  ESDetId esid = ESDetId(hitItr->id());
564 
565  uint32_t crystid = esid.rawId();
566  esSimMap[crystid] += hitItr->energy();
567  }
568  }
569 
570  int nESRecHits = 0;
571  if (validRecHitES) {
572  // loop over RecHits
573  const ESRecHitCollection *ESRecHit = EcalRecHitES.product();
575  ESRecHit->begin();
576  recHit != ESRecHit->end();
577  ++recHit) {
578 
579  ESDetId ESid = ESDetId(recHit->id());
580 
581  ++nESRecHits;
582  mehEcalRes[2]->Fill(recHit->energy()-esSimMap[ESid.rawId()]);
583  }
584 
585  if (verbosity > 1) {
586  eventout += "\n Number of ESRecHits collected:............ ";
587  eventout += nESRecHits;
588  }
589  mehEcaln[2]->Fill(float(nESRecHits));
590  }
591 
592  if (verbosity > 0)
593  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
594 
595  return;
596 }
597 
599  const edm::EventSetup& iSetup)
600 {
601  std::string MsgLoggerCat = "GlobalRecHitsAnalyzer_fillHCal";
602 
603  TString eventout;
604  if (verbosity > 0)
605  eventout = "\nGathering info:";
606 
607  // get geometry
609  iSetup.get<CaloGeometryRecord>().get(geometry);
610  if (!geometry.isValid()) {
611  edm::LogWarning(MsgLoggerCat)
612  << "Unable to find CaloGeometry in event!";
613  return;
614  }
615 
616  // iterator to access containers
617  edm::PCaloHitContainer::const_iterator itHit;
618 
620  // extract simhit info
623  iEvent.getByToken(HCalSrc_Token_,hcalHits);
624  bool validhcalHits = true;
625  if (!hcalHits.isValid()) {
626  LogDebug(MsgLoggerCat)
627  << "Unable to find hcalHits in event!";
628  validhcalHits = false;
629  }
630 
631  MapType fHBEnergySimHits;
632  MapType fHEEnergySimHits;
633  MapType fHOEnergySimHits;
634  MapType fHFEnergySimHits;
635  if (validhcalHits) {
636  const edm::PCaloHitContainer *simhitResult = hcalHits.product();
637 
638  for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin();
639  simhits != simhitResult->end();
640  ++simhits) {
641 
642  HcalDetId detId(simhits->id());
643  uint32_t cellid = detId.rawId();
644 
645  if (detId.subdet() == sdHcalBrl){
646  fHBEnergySimHits[cellid] += simhits->energy();
647  }
648  if (detId.subdet() == sdHcalEC){
649  fHEEnergySimHits[cellid] += simhits->energy();
650  }
651  if (detId.subdet() == sdHcalOut){
652  fHOEnergySimHits[cellid] += simhits->energy();
653  }
654  if (detId.subdet() == sdHcalFwd){
655  fHFEnergySimHits[cellid] += simhits->energy();
656  }
657  }
658  }
659 
660  // max values to be used (HO is found in HB)
661  Double_t maxHBEnergy = 0.;
662  Double_t maxHEEnergy = 0.;
663  Double_t maxHFEnergy = 0.;
664 
665  Double_t maxHBPhi = -1000.;
666  Double_t maxHEPhi = -1000.;
667  Double_t maxHOPhi = -1000.;
668  Double_t maxHFPhi = -1000.;
669 
670 
671  Double_t PI = 3.141592653589;
672 
674  // get HBHE information
676  std::vector<edm::Handle<HBHERecHitCollection> > hbhe;
677  iEvent.getManyByType(hbhe);
678  bool validHBHE = true;
679  if (!hbhe[0].isValid()) {
680  LogDebug(MsgLoggerCat)
681  << "Unable to find any HBHERecHitCollections in event!";
682  validHBHE = false;
683  }
684 
685  if (validHBHE) {
686  std::vector<edm::Handle<HBHERecHitCollection> >::iterator ihbhe;
687 
688  int iHB = 0;
689  int iHE = 0;
690  for (ihbhe = hbhe.begin(); ihbhe != hbhe.end(); ++ihbhe) {
691 
692  // find max values
693  for (HBHERecHitCollection::const_iterator jhbhe = (*ihbhe)->begin();
694  jhbhe != (*ihbhe)->end(); ++jhbhe) {
695 
696  HcalDetId cell(jhbhe->id());
697 
698  if (cell.subdet() == sdHcalBrl) {
699 
700  const CaloCellGeometry* cellGeometry =
701  geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
702  double fPhi = cellGeometry->getPosition().phi () ;
703  if ( (jhbhe->energy()) > maxHBEnergy ) {
704  maxHBEnergy = jhbhe->energy();
705  maxHBPhi = fPhi;
706  maxHOPhi = maxHBPhi;
707  }
708  }
709 
710  if (cell.subdet() == sdHcalEC) {
711 
712  const CaloCellGeometry* cellGeometry =
713  geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
714  double fPhi = cellGeometry->getPosition().phi () ;
715  if ( (jhbhe->energy()) > maxHEEnergy ) {
716  maxHEEnergy = jhbhe->energy();
717  maxHEPhi = fPhi;
718  }
719  }
720  } // end find max values
721 
722  for (HBHERecHitCollection::const_iterator jhbhe = (*ihbhe)->begin();
723  jhbhe != (*ihbhe)->end(); ++jhbhe) {
724 
725  HcalDetId cell(jhbhe->id());
726 
727  if (cell.subdet() == sdHcalBrl) {
728 
729  ++iHB;
730 
731  const CaloCellGeometry* cellGeometry =
732  geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
733  double fPhi = cellGeometry->getPosition().phi () ;
734 
735  float deltaphi = maxHBPhi - fPhi;
736  if (fPhi > maxHBPhi) { deltaphi = fPhi - maxHBPhi;}
737  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
738 
739  mehHcalRes[0]->Fill(jhbhe->energy() -
740  fHBEnergySimHits[cell.rawId()]);
741  }
742 
743  if (cell.subdet() == sdHcalEC) {
744 
745  ++iHE;
746 
747  const CaloCellGeometry* cellGeometry =
748  geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
749  double fPhi = cellGeometry->getPosition().phi () ;
750 
751  float deltaphi = maxHEPhi - fPhi;
752  if (fPhi > maxHEPhi) { deltaphi = fPhi - maxHEPhi;}
753  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
754  mehHcalRes[1]->Fill(jhbhe->energy() -
755  fHEEnergySimHits[cell.rawId()]);
756  }
757  }
758  } // end loop through collection
759 
760 
761  if (verbosity > 1) {
762  eventout += "\n Number of HBRecHits collected:............ ";
763  eventout += iHB;
764  }
765 
766  if (verbosity > 1) {
767  eventout += "\n Number of HERecHits collected:............ ";
768  eventout += iHE;
769  }
770  mehHcaln[0]->Fill((float)iHB);
771  mehHcaln[1]->Fill((float)iHE);
772  }
773 
775  // get HF information
777  std::vector<edm::Handle<HFRecHitCollection> > hf;
778  iEvent.getManyByType(hf);
779  bool validHF = true;
780  if (!hf[0].isValid()) {
781  LogDebug(MsgLoggerCat)
782  << "Unable to find any HFRecHitCollections in event!";
783  validHF = false;
784  }
785  if (validHF) {
786  std::vector<edm::Handle<HFRecHitCollection> >::iterator ihf;
787 
788  int iHF = 0;
789  for (ihf = hf.begin(); ihf != hf.end(); ++ihf) {
790 
791  // find max values
792  for (HFRecHitCollection::const_iterator jhf = (*ihf)->begin();
793  jhf != (*ihf)->end(); ++jhf) {
794 
795  HcalDetId cell(jhf->id());
796 
797  if (cell.subdet() == sdHcalFwd) {
798 
799  const CaloCellGeometry* cellGeometry =
800  geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
801  double fPhi = cellGeometry->getPosition().phi () ;
802  if ( (jhf->energy()) > maxHFEnergy ) {
803  maxHFEnergy = jhf->energy();
804  maxHFPhi = fPhi;
805  }
806  }
807  } // end find max values
808 
809  for (HFRecHitCollection::const_iterator jhf = (*ihf)->begin();
810  jhf != (*ihf)->end(); ++jhf) {
811 
812  HcalDetId cell(jhf->id());
813 
814  if (cell.subdet() == sdHcalFwd) {
815 
816  ++iHF;
817 
818  const CaloCellGeometry* cellGeometry =
819  geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
820  double fPhi = cellGeometry->getPosition().phi () ;
821 
822  float deltaphi = maxHBPhi - fPhi;
823  if (fPhi > maxHFPhi) { deltaphi = fPhi - maxHFPhi;}
824  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
825 
826  mehHcalRes[2]->Fill(jhf->energy()-fHFEnergySimHits[cell.rawId()]);
827  }
828  }
829  } // end loop through collection
830 
831  if (verbosity > 1) {
832  eventout += "\n Number of HFDigis collected:.............. ";
833  eventout += iHF;
834  }
835  mehHcaln[2]->Fill((float)iHF);
836  }
837 
839  // get HO information
841  std::vector<edm::Handle<HORecHitCollection> > ho;
842  iEvent.getManyByType(ho);
843  bool validHO = true;
844  if (!ho[0].isValid()) {
845  LogDebug(MsgLoggerCat)
846  << "Unable to find any HORecHitCollections in event!";
847  validHO = false;
848  }
849 
850  if (validHO) {
851  std::vector<edm::Handle<HORecHitCollection> >::iterator iho;
852 
853  int iHO = 0;
854  for (iho = ho.begin(); iho != ho.end(); ++iho) {
855 
856  for (HORecHitCollection::const_iterator jho = (*iho)->begin();
857  jho != (*iho)->end(); ++jho) {
858 
859  HcalDetId cell(jho->id());
860 
861  if (cell.subdet() == sdHcalOut) {
862 
863  ++iHO;
864 
865  const CaloCellGeometry* cellGeometry =
866  geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
867  double fPhi = cellGeometry->getPosition().phi () ;
868 
869  float deltaphi = maxHOPhi - fPhi;
870  if (fPhi > maxHOPhi) { deltaphi = fPhi - maxHOPhi;}
871  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
872  mehHcalRes[3]->Fill(jho->energy()-fHOEnergySimHits[cell.rawId()]);
873  }
874  }
875  } // end loop through collection
876 
877  if (verbosity > 1) {
878  eventout += "\n Number of HODigis collected:.............. ";
879  eventout += iHO;
880  }
881  mehHcaln[3]->Fill((float)iHO);
882  }
883 
884  if (verbosity > 0)
885  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
886 
887  return;
888 }
889 
891  const edm::EventSetup& iSetup)
892 {
893  //Retrieve tracker topology from geometry
894  edm::ESHandle<TrackerTopology> tTopoHandle;
895  iSetup.get<IdealGeometryRecord>().get(tTopoHandle);
896  const TrackerTopology* const tTopo = tTopoHandle.product();
897 
898 
899  std::string MsgLoggerCat = "GlobalRecHitsAnalyzer_fillTrk";
900 
901  TString eventout;
902  if (verbosity > 0)
903  eventout = "\nGathering info:";
904 
905  // get strip information
907  iEvent.getByToken(SiStripSrc_Token_, rechitsmatched);
908  bool validstrip = true;
909  if (!rechitsmatched.isValid()) {
910  LogDebug(MsgLoggerCat)
911  << "Unable to find stripmatchedrechits in event!";
912  validstrip = false;
913  }
914 
915  TrackerHitAssociator associate(iEvent,conf_);
916 
918  iSetup.get<TrackerDigiGeometryRecord>().get(pDD);
919  if (!pDD.isValid()) {
920  edm::LogWarning(MsgLoggerCat)
921  << "Unable to find TrackerDigiGeometry in event!";
922  return;
923  }
924  const TrackerGeometry &tracker(*pDD);
925 
926  if (validstrip) {
927  int nStripBrl = 0, nStripFwd = 0;
928 
929  // loop over det units
930  for (TrackerGeometry::DetContainer::const_iterator it =
931  pDD->dets().begin();
932  it != pDD->dets().end(); ++it) {
933 
934  uint32_t myid = ((*it)->geographicalId()).rawId();
935  DetId detid = ((*it)->geographicalId());
936 
937  //loop over rechits-matched in the same subdetector
938  SiStripMatchedRecHit2DCollection::const_iterator rechitmatchedMatch = rechitsmatched->find(detid);
939 
940  if (rechitmatchedMatch != rechitsmatched->end()) {
941  SiStripMatchedRecHit2DCollection::DetSet rechitmatchedRange = *rechitmatchedMatch;
942  SiStripMatchedRecHit2DCollection::DetSet::const_iterator rechitmatchedRangeIteratorBegin = rechitmatchedRange.begin();
943  SiStripMatchedRecHit2DCollection::DetSet::const_iterator rechitmatchedRangeIteratorEnd = rechitmatchedRange.end();
944  SiStripMatchedRecHit2DCollection::DetSet::const_iterator itermatched = rechitmatchedRangeIteratorBegin;
945 
946  for ( itermatched = rechitmatchedRangeIteratorBegin;
947  itermatched != rechitmatchedRangeIteratorEnd;
948  ++itermatched) {
949 
950  SiStripMatchedRecHit2D const rechit = *itermatched;
951  LocalPoint position = rechit.localPosition();
952 
953  float mindist = 999999.;
954  float distx = 999999.;
955  float disty = 999999.;
956  float dist = 999999.;
957  std::pair<LocalPoint,LocalVector> closestPair;
958  matched.clear();
959 
960  float rechitmatchedx = position.x();
961  float rechitmatchedy = position.y();
962 
963  matched = associate.associateHit(rechit);
964 
965  if (!matched.empty()) {
966  //project simhit;
967  const GluedGeomDet* gluedDet =
968  (const GluedGeomDet*)tracker.idToDet(rechit.geographicalId());
969  const StripGeomDetUnit* partnerstripdet =
970  (StripGeomDetUnit*) gluedDet->stereoDet();
971  std::pair<LocalPoint,LocalVector> hitPair;
972 
973  for(std::vector<PSimHit>::const_iterator m = matched.begin();
974  m != matched.end(); m++){
975  //project simhit;
976  hitPair = projectHit((*m),partnerstripdet,gluedDet->surface());
977  distx = fabs(rechitmatchedx - hitPair.first.x());
978  disty = fabs(rechitmatchedy - hitPair.first.y());
979  dist = sqrt(distx*distx+disty*disty);
980 
981  if(dist < mindist){
982  mindist = dist;
983  closestPair = hitPair;
984  }
985  }
986 
987  // get TIB
988  if (detid.subdetId() == sdSiTIB) {
989 
990 
991  ++nStripBrl;
992 
993  if (tTopo->tibLayer(myid) == 1) {
994  mehSiStripResX[8]->Fill(rechitmatchedx-closestPair.first.x());
995  mehSiStripResY[8]->Fill(rechitmatchedy-closestPair.first.y());
996  }
997  if (tTopo->tibLayer(myid) == 2) {
998  mehSiStripResX[9]->Fill(rechitmatchedx-closestPair.first.x());
999  mehSiStripResY[9]->Fill(rechitmatchedy-closestPair.first.y());
1000  }
1001  if (tTopo->tibLayer(myid) == 3) {
1002  mehSiStripResX[10]->Fill(rechitmatchedx-closestPair.first.x());
1003  mehSiStripResY[10]->Fill(rechitmatchedy-closestPair.first.y());
1004 
1005  }
1006  if (tTopo->tibLayer(myid) == 4) {
1007  mehSiStripResX[11]->Fill(rechitmatchedx-closestPair.first.x());
1008  mehSiStripResY[11]->Fill(rechitmatchedy-closestPair.first.y());
1009  }
1010  }
1011 
1012  // get TOB
1013  if (detid.subdetId() == sdSiTOB) {
1014 
1015 
1016  ++nStripBrl;
1017 
1018  if (tTopo->tobLayer(myid) == 1) {
1019  mehSiStripResX[15]->Fill(rechitmatchedx-closestPair.first.x());
1020  mehSiStripResY[15]->Fill(rechitmatchedy-closestPair.first.y());
1021  }
1022  if (tTopo->tobLayer(myid) == 2) {
1023  mehSiStripResX[16]->Fill(rechitmatchedx-closestPair.first.x());
1024  mehSiStripResY[16]->Fill(rechitmatchedy-closestPair.first.y());
1025  }
1026  if (tTopo->tobLayer(myid) == 3) {
1027  mehSiStripResX[17]->Fill(rechitmatchedx-closestPair.first.x());
1028  mehSiStripResY[17]->Fill(rechitmatchedy-closestPair.first.y());
1029  }
1030  if (tTopo->tobLayer(myid) == 4) {
1031  mehSiStripResX[18]->Fill(rechitmatchedx-closestPair.first.x());
1032  mehSiStripResY[18]->Fill(rechitmatchedy-closestPair.first.y());
1033  }
1034  }
1035 
1036  // get TID
1037  if (detid.subdetId() == sdSiTID) {
1038 
1039 
1040  ++nStripFwd;
1041 
1042  if (tTopo->tidWheel(myid) == 1) {
1043  mehSiStripResX[12]->Fill(rechitmatchedx-closestPair.first.x());
1044  mehSiStripResY[12]->Fill(rechitmatchedy-closestPair.first.y());
1045  }
1046  if (tTopo->tidWheel(myid) == 2) {
1047  mehSiStripResX[13]->Fill(rechitmatchedx-closestPair.first.x());
1048  mehSiStripResY[13]->Fill(rechitmatchedy-closestPair.first.y());
1049  }
1050  if (tTopo->tidWheel(myid) == 3) {
1051  mehSiStripResX[14]->Fill(rechitmatchedx-closestPair.first.x());
1052  mehSiStripResY[14]->Fill(rechitmatchedy-closestPair.first.y());
1053  }
1054  }
1055 
1056  // get TEC
1057  if (detid.subdetId() == sdSiTEC) {
1058 
1059 
1060  ++nStripFwd;
1061 
1062  if (tTopo->tecWheel(myid) == 1) {
1063  mehSiStripResX[0]->Fill(rechitmatchedx-closestPair.first.x());
1064  mehSiStripResY[0]->Fill(rechitmatchedy-closestPair.first.y());
1065  }
1066  if (tTopo->tecWheel(myid) == 2) {
1067  mehSiStripResX[1]->Fill(rechitmatchedx-closestPair.first.x());
1068  mehSiStripResY[1]->Fill(rechitmatchedy-closestPair.first.y());
1069  }
1070  if (tTopo->tecWheel(myid) == 3) {
1071  mehSiStripResX[2]->Fill(rechitmatchedx-closestPair.first.x());
1072  mehSiStripResY[2]->Fill(rechitmatchedy-closestPair.first.y());
1073  }
1074  if (tTopo->tecWheel(myid) == 4) {
1075  mehSiStripResX[3]->Fill(rechitmatchedx-closestPair.first.x());
1076  mehSiStripResY[3]->Fill(rechitmatchedy-closestPair.first.y());
1077 
1078  }
1079  if (tTopo->tecWheel(myid) == 5) {
1080  mehSiStripResX[4]->Fill(rechitmatchedx-closestPair.first.x());
1081  mehSiStripResY[4]->Fill(rechitmatchedy-closestPair.first.y());
1082  }
1083  if (tTopo->tecWheel(myid) == 6) {
1084  mehSiStripResX[5]->Fill(rechitmatchedx-closestPair.first.x());
1085  mehSiStripResY[5]->Fill(rechitmatchedy-closestPair.first.y());
1086  }
1087  if (tTopo->tecWheel(myid) == 7) {
1088  mehSiStripResX[6]->Fill(rechitmatchedx-closestPair.first.x());
1089  mehSiStripResY[6]->Fill(rechitmatchedy-closestPair.first.y());
1090  }
1091  if (tTopo->tecWheel(myid) == 8) {
1092  mehSiStripResX[7]->Fill(rechitmatchedx-closestPair.first.x());
1093  mehSiStripResY[7]->Fill(rechitmatchedy-closestPair.first.y());
1094  }
1095  }
1096 
1097  } // end if matched empty
1098  }
1099  }
1100  } // end loop over det units
1101 
1102  if (verbosity > 1) {
1103  eventout += "\n Number of BrlStripRecHits collected:...... ";
1104  eventout += nStripBrl;
1105  }
1106 
1107  for(int i =8; i<12; ++i)
1108  {mehSiStripn[i]->Fill((float)nStripBrl);}
1109  for(int i =16; i<19; ++i)
1110  {mehSiStripn[i]->Fill((float)nStripBrl);}
1111 
1112  if (verbosity > 1) {
1113  eventout += "\n Number of FrwdStripRecHits collected:..... ";
1114  eventout += nStripFwd;
1115  }
1116  for(int i =0; i<8; ++i)
1117  {mehSiStripn[i]->Fill((float)nStripFwd);}
1118  for(int i =12; i<16; ++i)
1119  {mehSiStripn[i]->Fill((float)nStripFwd);}
1120  }
1121 
1122  // get pixel information
1123  //Get RecHits
1125  iEvent.getByToken(SiPxlSrc_Token_, recHitColl);
1126  bool validpixel = true;
1127  if (!recHitColl.isValid()) {
1128  LogDebug(MsgLoggerCat)
1129  << "Unable to find SiPixelRecHitCollection in event!";
1130  validpixel = false;
1131  }
1132 
1133  //Get event setup
1135  iSetup.get<TrackerDigiGeometryRecord>().get(geom);
1136  if (!geom.isValid()) {
1137  edm::LogWarning(MsgLoggerCat)
1138  << "Unable to find TrackerDigiGeometry in event!";
1139  return;
1140  }
1141 
1142  if (validpixel) {
1143  int nPxlBrl = 0, nPxlFwd = 0;
1144  //iterate over detunits
1145  for (TrackerGeometry::DetContainer::const_iterator it =
1146  geom->dets().begin();
1147  it != geom->dets().end(); ++it) {
1148 
1149  uint32_t myid = ((*it)->geographicalId()).rawId();
1150  DetId detId = ((*it)->geographicalId());
1151  int subid = detId.subdetId();
1152 
1153  if (! ((subid == sdPxlBrl) || (subid == sdPxlFwd))) continue;
1154 
1155  SiPixelRecHitCollection::const_iterator pixeldet = recHitColl->find(detId);
1156  if (pixeldet == recHitColl->end()) continue;
1157  SiPixelRecHitCollection::DetSet pixelrechitRange = *pixeldet;
1158  SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorBegin = pixelrechitRange.begin();
1159  SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorEnd = pixelrechitRange.end();
1160  SiPixelRecHitCollection::DetSet::const_iterator pixeliter = pixelrechitRangeIteratorBegin;
1161 
1162 
1163  std::vector<PSimHit> matched;
1164 
1165  //----Loop over rechits for this detId
1166  for ( ; pixeliter != pixelrechitRangeIteratorEnd; ++pixeliter) {
1167 
1168  matched.clear();
1169  matched = associate.associateHit(*pixeliter);
1170 
1171  if ( !matched.empty() ) {
1172 
1173  float closest = 9999.9;
1174  LocalPoint lp = pixeliter->localPosition();
1175  float rechit_x = lp.x();
1176  float rechit_y = lp.y();
1177 
1178  float sim_x = 0.;
1179  float sim_y = 0.;
1180 
1181  //loop over sim hits and fill closet
1182  for (std::vector<PSimHit>::const_iterator m = matched.begin();
1183  m != matched.end(); ++m) {
1184 
1185  float sim_x1 = (*m).entryPoint().x();
1186  float sim_x2 = (*m).exitPoint().x();
1187  float sim_xpos = 0.5*(sim_x1+sim_x2);
1188 
1189  float sim_y1 = (*m).entryPoint().y();
1190  float sim_y2 = (*m).exitPoint().y();
1191  float sim_ypos = 0.5*(sim_y1+sim_y2);
1192 
1193  float x_res = fabs(sim_xpos - rechit_x);
1194  float y_res = fabs(sim_ypos - rechit_y);
1195 
1196  float dist = sqrt(x_res*x_res + y_res*y_res);
1197 
1198  if ( dist < closest ) {
1199  closest = dist;
1200  sim_x = sim_xpos;
1201  sim_y = sim_ypos;
1202  }
1203  } // end sim hit loop
1204 
1205  // get Barrel pixels ***************Pixel STuff******************
1206  if (subid == sdPxlBrl) {
1207 
1208  ++nPxlBrl;
1209 
1210  if (tTopo->pxbLayer(myid) == 1) {
1211  mehSiPixelResX[0]->Fill(rechit_x-sim_x);
1212  mehSiPixelResY[0]->Fill(rechit_y-sim_y);
1213 
1214  }
1215  if (tTopo->pxbLayer(myid) == 2) {
1216  mehSiPixelResX[1]->Fill(rechit_x-sim_x);
1217  mehSiPixelResY[1]->Fill(rechit_y-sim_y);
1218  }
1219  if (tTopo->pxbLayer(myid) == 3) {
1220  mehSiPixelResX[2]->Fill(rechit_x-sim_x);
1221  mehSiPixelResY[2]->Fill(rechit_y-sim_y);
1222  }
1223  }
1224 
1225  // get Forward pixels
1226  if (subid == sdPxlFwd) {
1227 
1228  ++nPxlFwd;
1229 
1230  if (tTopo->pxfDisk(myid) == 1) {
1231  if (tTopo->pxfSide(myid) == 1) {
1232  mehSiPixelResX[3]->Fill(rechit_x-sim_x);
1233  mehSiPixelResY[3]->Fill(rechit_y-sim_y);
1234  }
1235  if (tTopo->pxfSide(myid) == 2) {
1236  mehSiPixelResX[4]->Fill(rechit_x-sim_x);
1237  mehSiPixelResY[4]->Fill(rechit_y-sim_y);
1238  }
1239  }
1240  if (tTopo->pxfDisk(myid) == 2) {
1241  if (tTopo->pxfSide(myid) == 1) {
1242  mehSiPixelResX[5]->Fill(rechit_x-sim_x);
1243  mehSiPixelResY[5]->Fill(rechit_y-sim_y);
1244  }
1245  if (tTopo->pxfSide(myid) == 2) {
1246  mehSiPixelResX[6]->Fill(rechit_x-sim_x);
1247  mehSiPixelResY[6]->Fill(rechit_y-sim_y);
1248  }
1249  }
1250  }
1251  } // end matched emtpy
1252  } // <-----end rechit loop
1253  } // <------ end detunit loop
1254 
1255 
1256  if (verbosity > 1) {
1257  eventout += "\n Number of BrlPixelRecHits collected:...... ";
1258  eventout += nPxlBrl;
1259  }
1260  for(int i=0; i<3; ++i) {
1261  mehSiPixeln[i]->Fill((float)nPxlBrl);
1262  }
1263 
1264  if (verbosity > 1) {
1265  eventout += "\n Number of FrwdPixelRecHits collected:..... ";
1266  eventout += nPxlFwd;
1267  }
1268 
1269  for(int i=3; i<7; ++i) {
1270  mehSiPixeln[i]->Fill((float)nPxlFwd);
1271  }
1272  }
1273 
1274  if (verbosity > 0)
1275  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1276 
1277  return;
1278 }
1279 
1281  const edm::EventSetup& iSetup)
1282 {
1283  std::string MsgLoggerCat = "GlobalRecHitsAnalyzer_fillMuon";
1284 
1285  TString eventout;
1286  if (verbosity > 0)
1287  eventout = "\nGathering info:";
1288 
1289  // get DT information
1291  iSetup.get<MuonGeometryRecord>().get(dtGeom);
1292  if (!dtGeom.isValid()) {
1293  edm::LogWarning(MsgLoggerCat)
1294  << "Unable to find DTMuonGeometryRecord in event!";
1295  return;
1296  }
1297 
1299  iEvent.getByToken(MuDTSimSrc_Token_, dtsimHits);
1300  bool validdtsim = true;
1301  if (!dtsimHits.isValid()) {
1302  LogDebug(MsgLoggerCat)
1303  << "Unable to find dtsimHits in event!";
1304  validdtsim = false;
1305  }
1306 
1308  iEvent.getByToken(MuDTSrc_Token_, dtRecHits);
1309  bool validdtrec = true;
1310  if (!dtRecHits.isValid()) {
1311  LogDebug(MsgLoggerCat)
1312  << "Unable to find dtRecHits in event!";
1313  validdtrec = false;
1314  }
1315 
1316  if (validdtsim && validdtrec) {
1317 
1318  std::map<DTWireId, edm::PSimHitContainer> simHitsPerWire =
1320 
1321  std::map<DTWireId, std::vector<DTRecHit1DPair> > recHitsPerWire =
1322  map1DRecHitsPerWire(dtRecHits.product());
1323 
1324  int nDt = compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 1);
1325 
1326  if (verbosity > 1) {
1327  eventout += "\n Number of DtMuonRecHits collected:........ ";
1328  eventout += nDt;
1329  }
1330  mehDtMuonn->Fill(float(nDt));
1331  }
1332 
1333  // get CSC Strip information
1334  // get map of sim hits
1335  theMap.clear();
1337 
1338  iEvent.getByToken(MuCSCHits_Token_,cf);
1339  bool validXFrame = true;
1340  if (!cf.isValid()) {
1341  LogDebug(MsgLoggerCat)
1342  << "Unable to find muo CSC crossingFrame in event!";
1343  validXFrame = false;
1344  }
1345  if (validXFrame) {
1347 
1348  // arrange the hits by detUnit
1349  for(MixCollection<PSimHit>::MixItr hitItr = simHits.begin();
1350  hitItr != simHits.end(); ++hitItr) {
1351  theMap[hitItr->detUnitId()].push_back(*hitItr);
1352  }
1353  }
1354 
1355  // get geometry
1357  iSetup.get<MuonGeometryRecord>().get(hGeom);
1358  if (!hGeom.isValid()) {
1359  edm::LogWarning(MsgLoggerCat)
1360  << "Unable to find CSCMuonGeometryRecord in event!";
1361  return;
1362  }
1363  const CSCGeometry *theCSCGeometry = &*hGeom;
1364 
1365  // get rechits
1367  iEvent.getByToken(MuCSCSrc_Token_, hRecHits);
1368  bool validCSC = true;
1369  if (!hRecHits.isValid()) {
1370  LogDebug(MsgLoggerCat)
1371  << "Unable to find CSC RecHits in event!";
1372  validCSC = false;
1373  }
1374 
1375  if (validCSC) {
1376  const CSCRecHit2DCollection *cscRecHits = hRecHits.product();
1377 
1378  int nCSC = 0;
1379  for (CSCRecHit2DCollection::const_iterator recHitItr = cscRecHits->begin();
1380  recHitItr != cscRecHits->end(); ++recHitItr) {
1381 
1382  int detId = (*recHitItr).cscDetId().rawId();
1383 
1385  std::map<int, edm::PSimHitContainer>::const_iterator mapItr =
1386  theMap.find(detId);
1387  if (mapItr != theMap.end()) {
1388  simHits = mapItr->second;
1389  }
1390 
1391  if (simHits.size() == 1) {
1392  ++nCSC;
1393 
1394  const GeomDetUnit* detUnit =
1395  theCSCGeometry->idToDetUnit(CSCDetId(detId));
1396  const CSCLayer *layer = dynamic_cast<const CSCLayer *>(detUnit);
1397 
1398  int chamberType = layer->chamber()->specs()->chamberType();
1399  plotResolution(simHits[0], *recHitItr, layer, chamberType);
1400  }
1401  }
1402 
1403  if (verbosity > 1) {
1404  eventout += "\n Number of CSCRecHits collected:........... ";
1405  eventout += nCSC;
1406  }
1407  mehCSCn->Fill((float)nCSC);
1408  }
1409 
1410  // get RPC information
1411  std::map<double, int> mapsim, maprec;
1412  std::map<int, double> nmapsim, nmaprec;
1413 
1415  iSetup.get<MuonGeometryRecord>().get(rpcGeom);
1416  if (!rpcGeom.isValid()) {
1417  edm::LogWarning(MsgLoggerCat)
1418  << "Unable to find RPCMuonGeometryRecord in event!";
1419  return;
1420  }
1421 
1423  iEvent.getByToken(MuRPCSimSrc_Token_, simHit);
1424  bool validrpcsim = true;
1425  if (!simHit.isValid()) {
1426  LogDebug(MsgLoggerCat)
1427  << "Unable to find RPCSimHit in event!";
1428  validrpcsim = false;
1429  }
1430 
1432  iEvent.getByToken(MuRPCSrc_Token_, recHit);
1433  bool validrpc = true;
1434  if (!simHit.isValid()) {
1435  LogDebug(MsgLoggerCat)
1436  << "Unable to find RPCRecHit in event!";
1437  validrpc = false;
1438  }
1439 
1440  if (validrpc) {
1441  int nRPC = 0;
1443  int nrec = 0;
1444  for (recIt = recHit->begin(); recIt != recHit->end(); ++recIt) {
1445  RPCDetId Rid = (RPCDetId)(*recIt).rpcId();
1446  const RPCRoll *roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(Rid));
1447  if (roll->isForward()) {
1448 
1449  if (verbosity > 1) {
1450  eventout +=
1451  "\n Number of RPCRecHits collected:........... ";
1452  eventout += nRPC;
1453  }
1454 
1455  if (verbosity > 0)
1456  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1457  return;
1458  }
1459  nrec = nrec + 1;
1460  LocalPoint rhitlocal = (*recIt).localPosition();
1461  double rhitlocalx = rhitlocal.x();
1462  maprec[rhitlocalx] = nrec;
1463  }
1464 
1465  int i = 0;
1466  for (std::map<double,int>::iterator iter = maprec.begin();
1467  iter != maprec.end(); ++iter) {
1468  i = i + 1;
1469  nmaprec[i] = (*iter).first;
1470  }
1471 
1472  int nsim = 0;
1473  if (validrpcsim) {
1474  edm::PSimHitContainer::const_iterator simIt;
1475  for (simIt = simHit->begin(); simIt != simHit->end(); simIt++) {
1476  int ptype = (*simIt).particleType();
1477  if (ptype == 13 || ptype == -13) {
1478  nsim = nsim + 1;
1479  LocalPoint shitlocal = (*simIt).localPosition();
1480  double shitlocalx = shitlocal.x();
1481  mapsim[shitlocalx] = nsim;
1482  }
1483  }
1484 
1485  i = 0;
1486  for (std::map<double,int>::iterator iter = mapsim.begin();
1487  iter != mapsim.end(); ++iter) {
1488  i = i + 1;
1489  nmapsim[i] = (*iter).first;
1490  }
1491  }
1492 
1493  if (nsim == nrec) {
1494  for (int r = 0; r < nsim; r++) {
1495  ++nRPC;
1496  mehRPCResX->Fill(nmaprec[r+1]-nmapsim[r+1]);
1497  }
1498  }
1499 
1500  if (verbosity > 1) {
1501  eventout += "\n Number of RPCRecHits collected:........... ";
1502  eventout += nRPC;
1503  }
1504  mehRPCn->Fill((float)nRPC);
1505  }
1506 
1507  if (verbosity > 0)
1508  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1509 
1510  return;
1511 }
1512 
1513 //needed by to do the residual for matched hits in SiStrip
1514 std::pair<LocalPoint,LocalVector>
1516  const StripGeomDetUnit* stripDet,
1517  const BoundPlane& plane)
1518 {
1519 
1520  const StripTopology& topol = stripDet->specificTopology();
1521  GlobalPoint globalpos= stripDet->surface().toGlobal(hit.localPosition());
1522  LocalPoint localHit = plane.toLocal(globalpos);
1523  //track direction
1524  LocalVector locdir=hit.localDirection();
1525  //rotate track in new frame
1526 
1527  GlobalVector globaldir= stripDet->surface().toGlobal(locdir);
1528  LocalVector dir=plane.toLocal(globaldir);
1529  float scale = -localHit.z() / dir.z();
1530 
1531  LocalPoint projectedPos = localHit + scale*dir;
1532 
1533  float selfAngle = topol.stripAngle( topol.strip( hit.localPosition()));
1534 
1535  // vector along strip in hit frame
1536  LocalVector stripDir( sin(selfAngle), cos(selfAngle), 0);
1537 
1538  LocalVector
1539  localStripDir(plane.toLocal(stripDet->surface().toGlobal(stripDir)));
1540 
1541  return std::pair<LocalPoint,LocalVector>( projectedPos, localStripDir);
1542 }
1543 
1544 // Return a map between DTRecHit1DPair and wireId
1545 std::map<DTWireId, std::vector<DTRecHit1DPair> >
1547  dt1DRecHitPairs) {
1548  std::map<DTWireId, std::vector<DTRecHit1DPair> > ret;
1549 
1550  for(DTRecHitCollection::const_iterator rechit = dt1DRecHitPairs->begin();
1551  rechit != dt1DRecHitPairs->end(); rechit++) {
1552  ret[(*rechit).wireId()].push_back(*rechit);
1553  }
1554 
1555  return ret;
1556 }
1557 
1558 // Compute SimHit distance from wire (cm)
1560  DTWireId wireId,
1561  const PSimHit& hit) {
1562  float xwire = layer->specificTopology().wirePosition(wireId.wire());
1563  LocalPoint entryP = hit.entryPoint();
1564  LocalPoint exitP = hit.exitPoint();
1565  float xEntry = entryP.x()-xwire;
1566  float xExit = exitP.x()-xwire;
1567 
1568  //FIXME: check...
1569  return fabs(xEntry - (entryP.z()*(xExit-xEntry))/(exitP.z()-entryP.z()));
1570 }
1571 
1572 // Find the RecHit closest to the muon SimHit
1573 template <typename type>
1574 const type*
1576  DTWireId wireId,
1577  const std::vector<type>& recHits,
1578  const float simHitDist) {
1579  float res = 99999;
1580  const type* theBestRecHit = 0;
1581  // Loop over RecHits within the cell
1582  for(typename std::vector<type>::const_iterator recHit = recHits.begin();
1583  recHit != recHits.end();
1584  recHit++) {
1585  float distTmp = recHitDistFromWire(*recHit, layer);
1586  if(fabs(distTmp-simHitDist) < res) {
1587  res = fabs(distTmp-simHitDist);
1588  theBestRecHit = &(*recHit);
1589  }
1590  } // End of loop over RecHits within the cell
1591 
1592  return theBestRecHit;
1593 }
1594 
1595 // Compute the distance from wire (cm) of a hits in a DTRecHit1DPair
1596 float
1598  const DTLayer* layer) {
1599  // Compute the rechit distance from wire
1600  return fabs(hitPair.localPosition(DTEnums::Left).x() -
1601  hitPair.localPosition(DTEnums::Right).x())/2.;
1602 }
1603 
1604 // Compute the distance from wire (cm) of a hits in a DTRecHit1D
1605 float
1607  const DTLayer* layer) {
1608  return fabs(recHit.localPosition().x() -
1609  layer->specificTopology().wirePosition(recHit.wireId().wire()));
1610 }
1611 
1612 template <typename type>
1614  const std::map<DTWireId, std::vector<PSimHit> >&
1615  _simHitsPerWire,
1616  const std::map<DTWireId, std::vector<type> >&
1617  _recHitsPerWire,
1618  int step) {
1619 
1620 std::map<DTWireId, std::vector<PSimHit> > simHitsPerWire = _simHitsPerWire;
1621 std::map<DTWireId, std::vector<type> > recHitsPerWire = _recHitsPerWire;
1622  int nDt = 0;
1623  // Loop over cells with a muon SimHit
1624  for(std::map<DTWireId, std::vector<PSimHit> >::const_iterator wireAndSHits =
1625  simHitsPerWire.begin();
1626  wireAndSHits != simHitsPerWire.end();
1627  wireAndSHits++) {
1628  DTWireId wireId = (*wireAndSHits).first;
1629  std::vector<PSimHit> simHitsInCell = (*wireAndSHits).second;
1630 
1631  // Get the layer
1632  const DTLayer* layer = dtGeom->layer(wireId);
1633 
1634  // Look for a mu hit in the cell
1635  const PSimHit* muSimHit = DTHitQualityUtils::findMuSimHit(simHitsInCell);
1636  if (muSimHit==0) {
1637  continue; // Skip this cell
1638  }
1639 
1640  // Find the distance of the simhit from the wire
1641  float simHitWireDist = simHitDistFromWire(layer, wireId, *muSimHit);
1642  // Skip simhits out of the cell
1643  if(simHitWireDist>2.1) {
1644  continue; // Skip this cell
1645  }
1646 
1647  // Look for RecHits in the same cell
1648  if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
1649  continue; // No RecHit found in this cell
1650  } else {
1651 
1652  std::vector<type> recHits = recHitsPerWire[wireId];
1653 
1654  // Find the best RecHit
1655  const type* theBestRecHit =
1656  findBestRecHit(layer, wireId, recHits, simHitWireDist);
1657 
1658  float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
1659 
1660  ++nDt;
1661 
1662  mehDtMuonRes->Fill(recHitWireDist-simHitWireDist);
1663 
1664  } // find rechits
1665  } // loop over simhits
1666 
1667  return nDt;
1668 }
1669 
1670 void
1672  const CSCRecHit2D & recHit,
1673  const CSCLayer * layer,
1674  int chamberType) {
1675  GlobalPoint simHitPos = layer->toGlobal(simHit.localPosition());
1676  GlobalPoint recHitPos = layer->toGlobal(recHit.localPosition());
1677 
1678  mehCSCResRDPhi->Fill(recHitPos.phi()-simHitPos.phi());
1679 }
1680 
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:39
edm::EDGetTokenT< SiPixelRecHitCollection > SiPxlSrc_Token_
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:439
type
Definition: HCALResponse.h:21
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
GlobalRecHitsAnalyzer(const edm::ParameterSet &)
T getUntrackedParameter(std::string const &, T const &) const
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
void getAllProvenance(std::vector< Provenance const * > &provenances) const
Definition: Event.cc:83
int i
Definition: DBlmapReader.cc:9
MonitorElement * mehCSCResRDPhi
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
std::vector< PCaloHit > PCaloHitContainer
int ihf
unsigned int tibLayer(const DetId &id) const
virtual float stripAngle(float strip) const =0
edm::EDGetTokenT< EBRecHitCollection > ECalEBSrc_Token_
static const int sdHcalOut
std::vector< PSimHit > matched
#define PI
edm::EDGetTokenT< ESRecHitCollection > ECalESSrc_Token_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
edm::EDGetTokenT< CrossingFrame< PCaloHit > > ESHits_Token_
MonitorElement * mehHcalRes[4]
unsigned int pxfDisk(const DetId &id) const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
static const int sdSiTID
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
edm::EDGetTokenT< CrossingFrame< PSimHit > > MuCSCHits_Token_
void fillMuon(const edm::Event &, const edm::EventSetup &)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
std::vector< EcalUncalibratedRecHit >::const_iterator const_iterator
T y() const
Definition: PV3DBase.h:63
static const PSimHit * findMuSimHit(const edm::PSimHitContainer &hits)
Select the SimHit from a muon in a vector of SimHits.
unsigned long long EventNumber_t
edm::EDGetTokenT< CrossingFrame< PCaloHit > > EEHits_Token_
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
unsigned int tidWheel(const DetId &id) const
float simHitDistFromWire(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
MonitorElement * mehEcalRes[3]
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
edm::EDGetTokenT< edm::PSimHitContainer > MuDTSimSrc_Token_
MonitorElement * mehSiStripn[19]
virtual float strip(const LocalPoint &) const =0
void Fill(long long x)
void plotResolution(const PSimHit &simHit, const CSCRecHit2D &recHit, const CSCLayer *layer, int chamberType)
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
Definition: DTGeometry.cc:110
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
std::map< int, edm::PSimHitContainer > theMap
std::map< DTWireId, std::vector< DTRecHit1DPair > > map1DRecHitsPerWire(const DTRecHitCollection *dt1DRecHitPairs)
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:230
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
edm::EDGetTokenT< EBUncalibratedRecHitCollection > ECalUncalEBSrc_Token_
static const int sdSiTIB
const CSCChamberSpecs * specs() const
Definition: CSCChamber.h:42
static const int sdPxlBrl
Local3DPoint localPosition() const
Definition: PSimHit.h:44
int compute(const DTGeometry *dtGeom, const std::map< DTWireId, std::vector< PSimHit > > &simHitsPerWire, const std::map< DTWireId, std::vector< type > > &recHitsPerWire, int step)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
T sqrt(T t)
Definition: SSEVec.h:48
edm::EDGetTokenT< CSCRecHit2DCollection > MuCSCSrc_Token_
T z() const
Definition: PV3DBase.h:64
MonitorElement * mehSiPixelResX[7]
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
int j
Definition: DBlmapReader.cc:9
MonitorElement * mehEcaln[3]
const type * findBestRecHit(const DTLayer *layer, DTWireId wireId, const std::vector< type > &recHits, const float simHitDist)
static const int sdSiTOB
MonitorElement * mehSiPixelResY[7]
MonitorElement * mehSiStripResY[19]
bool isValid() const
Definition: HandleBase.h:75
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
edm::EDGetTokenT< RPCRecHitCollection > MuRPCSrc_Token_
std::pair< LocalPoint, LocalVector > projectHit(const PSimHit &hit, const StripGeomDetUnit *stripDet, const BoundPlane &plane)
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:60
unsigned int pxbLayer(const DetId &id) const
const_iterator end() const
LocalVector localDirection() const
Obsolete. Same as momentumAtEntry().unit(), for backward compatibility.
Definition: PSimHit.h:52
int wire() const
Return the wire number.
Definition: DTWireId.h:56
Definition: DetId.h:18
edm::EDGetTokenT< CrossingFrame< PCaloHit > > EBHits_Token_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
T const * product() const
Definition: Handle.h:81
int chamberType() const
const T & get() const
Definition: EventSetup.h:55
edm::EDGetTokenT< edm::PCaloHitContainer > HCalSrc_Token_
T const * product() const
Definition: ESHandle.h:86
MonitorElement * mehSiPixeln[7]
static const int sdHcalFwd
tuple simHits
Definition: trackerHits.py:16
std::map< uint32_t, float, std::less< uint32_t > > MapType
static const int sdHcalBrl
void fillTrk(const edm::Event &, const edm::EventSetup &)
std::string const & label() const
Definition: InputTag.h:42
ESHandle< TrackerGeometry > geometry
edm::EventID id() const
Definition: EventBase.h:60
edm::EDGetTokenT< DTRecHitCollection > MuDTSrc_Token_
static const int sdSiTEC
iterator find(key_type k)
MonitorElement * mehHcaln[4]
iterator end()
Definition: DetSetNew.h:70
edm::EDGetTokenT< EEUncalibratedRecHitCollection > ECalUncalEESrc_Token_
static int position[264][3]
Definition: ReadPGInfo.cc:509
void fillECal(const edm::Event &, const edm::EventSetup &)
unsigned int pxfSide(const DetId &id) const
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
virtual const GeomDetUnit * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: CSCGeometry.cc:93
std::vector< PSimHit > PSimHitContainer
unsigned int RunNumber_t
static const int sdPxlFwd
DetId geographicalId() const
dbl *** dir
Definition: mlp_gen.cc:35
static std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
volatile std::atomic< bool > shutdown_flag false
LocalPoint localPosition() const
Definition: CSCRecHit2D.h:50
bool isValid() const
Definition: ESHandle.h:47
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
bool isForward() const
Definition: RPCRoll.cc:98
T x() const
Definition: PV3DBase.h:62
virtual LocalPoint localPosition() const
unsigned int tecWheel(const DetId &id) const
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
edm::EDGetTokenT< edm::PSimHitContainer > MuRPCSimSrc_Token_
MonitorElement * mehSiStripResX[19]
std::string const & instance() const
Definition: InputTag.h:43
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
static const int sdHcalEC
const CSCChamber * chamber() const
Definition: CSCLayer.h:52
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21
const_iterator begin() const
unsigned int tobLayer(const DetId &id) const
Definition: Run.h:41
virtual LocalPoint localPosition() const
virtual const TrackerGeomDet * idToDet(DetId) const
void fillHCal(const edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< EERecHitCollection > ECalEESrc_Token_
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:107
iterator begin()
Definition: DetSetNew.h:67
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > SiStripSrc_Token_