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