CMS 3D CMS Logo

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