test
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  std::map<HcalDetId,float> fHBEnergySimHits;
633  std::map<HcalDetId,float> fHEEnergySimHits;
634  std::map<HcalDetId,float> fHOEnergySimHits;
635  std::map<HcalDetId,float> 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 
645  if (detId.subdet() == sdHcalBrl){
646  fHBEnergySimHits[detId] += simhits->energy();
647  }
648  if (detId.subdet() == sdHcalEC){
649  fHEEnergySimHits[detId] += simhits->energy();
650  }
651  if (detId.subdet() == sdHcalOut){
652  fHOEnergySimHits[detId] += simhits->energy();
653  }
654  if (detId.subdet() == sdHcalFwd){
655  fHFEnergySimHits[detId] += 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]);
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]);
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]);
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]);
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<TrackerTopologyRcd>().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 
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:452
type
Definition: HCALResponse.h:21
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
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:90
int i
Definition: DBlmapReader.cc:9
MonitorElement * mehCSCResRDPhi
tuple ret
prodAgent to be discontinued
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:462
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:54
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:42
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:18
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:276
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:36
ESHandle< TrackerGeometry > geometry
edm::EventID id() const
Definition: EventBase.h:59
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
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:37
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
virtual LocalPoint localPosition() const final
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
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_