12 fName(
""),
verbosity(0), frequency(0), vtxunit(0),
13 getAllProvenances(
false), printProvenanceInfo(
false),
14 G4VtxSrc_Token_( consumes<edm::
SimVertexContainer>((iPSet.getParameter<edm::InputTag>(
"G4VtxSrc"))) ),
15 G4TrkSrc_Token_( consumes<edm::
SimTrackContainer>(iPSet.getParameter<edm::InputTag>(
"G4TrkSrc")) ),
18 std::string MsgLoggerCat =
"GlobalHitsProdHist_GlobalHitsProdHist";
28 m_Prov.getUntrackedParameter<
bool>(
"GetAllProvenances");
30 m_Prov.getUntrackedParameter<
bool>(
"PrintProvenanceInfo");
64 <<
"\n===============================\n"
65 <<
"Initialized as EDProducer with parameter values:\n"
66 <<
" Name = " <<
fName <<
"\n"
67 <<
" Verbosity = " << verbosity <<
"\n"
68 <<
" Frequency = " << frequency <<
"\n"
69 <<
" VtxUnit = " << vtxunit <<
"\n"
70 <<
" GetProv = " << getAllProvenances <<
"\n"
71 <<
" PrintProv = " << printProvenanceInfo <<
"\n"
72 <<
" PxlBrlLowSrc = " << PxlBrlLowSrc_.label()
73 <<
":" << PxlBrlLowSrc_.instance() <<
"\n"
74 <<
" PxlBrlHighSrc = " << PxlBrlHighSrc_.
label()
75 <<
":" << PxlBrlHighSrc_.
instance() <<
"\n"
76 <<
" PxlFwdLowSrc = " << PxlFwdLowSrc_.
label()
77 <<
":" << PxlBrlLowSrc_.instance() <<
"\n"
78 <<
" PxlFwdHighSrc = " << PxlFwdHighSrc_.
label()
79 <<
":" << PxlBrlHighSrc_.
instance() <<
"\n"
80 <<
" SiTIBLowSrc = " << SiTIBLowSrc_.
label()
81 <<
":" << SiTIBLowSrc_.
instance() <<
"\n"
82 <<
" SiTIBHighSrc = " << SiTIBHighSrc_.
label()
83 <<
":" << SiTIBHighSrc_.
instance() <<
"\n"
84 <<
" SiTOBLowSrc = " << SiTOBLowSrc_.
label()
85 <<
":" << SiTOBLowSrc_.
instance() <<
"\n"
86 <<
" SiTOBHighSrc = " << SiTOBHighSrc_.
label()
87 <<
":" << SiTOBHighSrc_.
instance() <<
"\n"
88 <<
" SiTIDLowSrc = " << SiTIDLowSrc_.
label()
89 <<
":" << SiTIDLowSrc_.
instance() <<
"\n"
90 <<
" SiTIDHighSrc = " << SiTIDHighSrc_.
label()
91 <<
":" << SiTIDHighSrc_.
instance() <<
"\n"
92 <<
" SiTECLowSrc = " << SiTECLowSrc_.
label()
93 <<
":" << SiTECLowSrc_.
instance() <<
"\n"
94 <<
" SiTECHighSrc = " << SiTECHighSrc_.
label()
95 <<
":" << SiTECHighSrc_.
instance() <<
"\n"
96 <<
" MuonCscSrc = " << MuonCscSrc_.
label()
97 <<
":" << MuonCscSrc_.
instance() <<
"\n"
98 <<
" MuonDtSrc = " << MuonDtSrc_.
label()
99 <<
":" << MuonDtSrc_.
instance() <<
"\n"
100 <<
" MuonRpcSrc = " << MuonRpcSrc_.
label()
101 <<
":" << MuonRpcSrc_.
instance() <<
"\n"
102 <<
" ECalEBSrc = " << ECalEBSrc_.
label()
103 <<
":" << ECalEBSrc_.
instance() <<
"\n"
104 <<
" ECalEESrc = " << ECalEESrc_.
label()
105 <<
":" << ECalEESrc_.
instance() <<
"\n"
106 <<
" ECalESSrc = " << ECalESSrc_.
label()
107 <<
":" << ECalESSrc_.
instance() <<
"\n"
108 <<
" HCalSrc = " << HCalSrc_.
label()
109 <<
":" << HCalSrc_.
instance() <<
"\n"
110 <<
"===============================\n";
118 sprintf(hname,
"hMCRGP1");
120 sprintf(htitle,
"RawGenParticles");
121 hMCRGP[0] =
new TH1F(hname,htitle,100,0.,5000.);
122 sprintf(hname,
"hMCRGP2");
124 hMCRGP[1] =
new TH1F(hname,htitle,100,0.,500.);
125 for (Int_t
i = 0;
i < 2; ++
i) {
126 hMCRGP[
i]->GetXaxis()->SetTitle(
"Number of Raw Generated Particles");
127 hMCRGP[
i]->GetYaxis()->SetTitle(
"Count");
131 sprintf(hname,
"hMCG4Vtx1");
133 sprintf(htitle,
"G4 Vertices");
134 hMCG4Vtx[0] =
new TH1F(hname,htitle,100,0.,50000.);
135 sprintf(hname,
"hMCG4Vtx2");
137 hMCG4Vtx[1] =
new TH1F(hname,htitle,100,-0.5,99.5);
138 for (Int_t
i = 0;
i < 2; ++
i) {
139 hMCG4Vtx[
i]->GetXaxis()->SetTitle(
"Number of Vertices");
140 hMCG4Vtx[
i]->GetYaxis()->SetTitle(
"Count");
144 sprintf(hname,
"hMCG4Trk1");
146 sprintf(htitle,
"G4 Tracks");
147 hMCG4Trk[0] =
new TH1F(hname,htitle,150,0.,15000.);
148 sprintf(hname,
"hMCG4Trk2");
150 hMCG4Trk[1] =
new TH1F(hname,htitle,150,-0.5,99.5);
151 for (Int_t
i = 0;
i < 2; ++
i) {
152 hMCG4Trk[
i]->GetXaxis()->SetTitle(
"Number of Tracks");
153 hMCG4Trk[
i]->GetYaxis()->SetTitle(
"Count");
157 sprintf(hname,
"hGeantVtxX1");
159 sprintf(htitle,
"Geant vertex x/micrometer");
160 hGeantVtxX[0] =
new TH1F(hname,htitle,100,-8000000.,8000000.);
161 sprintf(hname,
"hGeantVtxX2");
163 hGeantVtxX[1] =
new TH1F(hname,htitle,100,-50.,50.);
164 for (Int_t
i = 0;
i < 2; ++
i) {
165 hGeantVtxX[
i]->GetXaxis()->SetTitle(
"x of Vertex (um)");
170 sprintf(hname,
"hGeantVtxY1");
172 sprintf(htitle,
"Geant vertex y/micrometer");
173 hGeantVtxY[0] =
new TH1F(hname,htitle,100,-8000000,8000000.);
174 sprintf(hname,
"hGeantVtxY2");
176 hGeantVtxY[1] =
new TH1F(hname,htitle,100,-50.,50.);
177 for (Int_t
i = 0;
i < 2; ++
i) {
178 hGeantVtxY[
i]->GetXaxis()->SetTitle(
"y of Vertex (um)");
183 sprintf(hname,
"hGeantVtxZ1");
185 sprintf(htitle,
"Geant vertex z/millimeter");
186 hGeantVtxZ[0] =
new TH1F(hname,htitle,100,-11000.,11000.);
187 sprintf(hname,
"hGeantVtxZ2");
189 hGeantVtxZ[1] =
new TH1F(hname,htitle,100,-250.,250.);
190 for (Int_t
i = 0;
i < 2; ++
i) {
191 hGeantVtxZ[
i]->GetXaxis()->SetTitle(
"z of Vertex (mm)");
196 sprintf(hname,
"hGeantTrkPt");
198 sprintf(htitle,
"Geant track pt/GeV");
200 hGeantTrkPt->GetXaxis()->SetTitle(
"pT of Track (GeV)");
204 sprintf(hname,
"hGeantTrkE");
206 sprintf(htitle,
"Geant track E/GeV");
207 hGeantTrkE =
new TH1F(hname,htitle,100,0.,5000.);
208 hGeantTrkE->GetXaxis()->SetTitle(
"E of Track (GeV)");
213 sprintf(hname,
"hCaloEcal1");
215 sprintf(htitle,
"Ecal hits");
216 hCaloEcal[0] =
new TH1F(hname,htitle,100,0.,10000.);
217 sprintf(hname,
"hCaloEcal2");
219 hCaloEcal[1] =
new TH1F(hname,htitle,100,-0.5,99.5);
221 sprintf(hname,
"hCaloEcalE1");
223 sprintf(htitle,
"Ecal hits, energy/GeV");
224 hCaloEcalE[0] =
new TH1F(hname,htitle,100,0.,10.);
225 sprintf(hname,
"hCaloEcalE2");
227 hCaloEcalE[1] =
new TH1F(hname,htitle,100,0.,0.1);
229 sprintf(hname,
"hCaloEcalToF1");
231 sprintf(htitle,
"Ecal hits, ToF/ns");
233 sprintf(hname,
"hCaloEcalToF2");
237 for (Int_t
i = 0;
i < 2; ++
i) {
238 hCaloEcal[
i]->GetXaxis()->SetTitle(
"Number of Hits");
241 hCaloEcalE[
i]->GetXaxis()->SetTitle(
"Energy of Hits (GeV)");
244 hCaloEcalToF[
i]->GetXaxis()->SetTitle(
"Time of Flight of Hits (ns)");
249 sprintf(hname,
"hCaloEcalPhi");
251 sprintf(htitle,
"Ecal hits, phi/rad");
253 hCaloEcalPhi->GetXaxis()->SetTitle(
"Phi of Hits (rad)");
257 sprintf(hname,
"hCaloEcalEta");
259 sprintf(htitle,
"Ecal hits, eta");
265 sprintf(hname,
"hCaloPreSh1");
267 sprintf(htitle,
"PreSh hits");
268 hCaloPreSh[0] =
new TH1F(hname,htitle,100,0.,10000.);
269 sprintf(hname,
"hCaloPreSh2");
271 hCaloPreSh[1] =
new TH1F(hname,htitle,100,-0.5,99.5);
273 sprintf(hname,
"hCaloPreShE1");
275 sprintf(htitle,
"PreSh hits, energy/GeV");
276 hCaloPreShE[0] =
new TH1F(hname,htitle,100,0.,10.);
277 sprintf(hname,
"hCaloPreShE2");
279 hCaloPreShE[1] =
new TH1F(hname,htitle,100,0.,0.1);
281 sprintf(hname,
"hCaloPreShToF1");
283 sprintf(htitle,
"PreSh hits, ToF/ns");
285 sprintf(hname,
"hCaloPreShToF2");
289 for (Int_t
i = 0;
i < 2; ++
i) {
290 hCaloPreSh[
i]->GetXaxis()->SetTitle(
"Number of Hits");
293 hCaloPreShE[
i]->GetXaxis()->SetTitle(
"Energy of Hits (GeV)");
296 hCaloPreShToF[
i]->GetXaxis()->SetTitle(
"Time of Flight of Hits (ns)");
301 sprintf(hname,
"hCaloPreShPhi");
303 sprintf(htitle,
"PreSh hits, phi/rad");
309 sprintf(hname,
"hCaloPreShEta");
311 sprintf(htitle,
"PreSh hits, eta");
318 sprintf(hname,
"hCaloHcal1");
320 sprintf(htitle,
"Hcal hits");
321 hCaloHcal[0] =
new TH1F(hname,htitle,100,0.,10000.);
322 sprintf(hname,
"hCaloHcal2");
324 hCaloHcal[1] =
new TH1F(hname,htitle,100,-0.5,99.5);
326 sprintf(hname,
"hCaloHcalE1");
328 sprintf(htitle,
"Hcal hits, energy/GeV");
329 hCaloHcalE[0] =
new TH1F(hname,htitle,100,0.,10.);
330 sprintf(hname,
"hCaloHcalE2");
332 hCaloHcalE[1] =
new TH1F(hname,htitle,100,0.,0.1);
334 sprintf(hname,
"hCaloHcalToF1");
336 sprintf(htitle,
"Hcal hits, ToF/ns");
338 sprintf(hname,
"hCaloHcalToF2");
342 for (Int_t
i = 0;
i < 2; ++
i) {
343 hCaloHcal[
i]->GetXaxis()->SetTitle(
"Number of Hits");
346 hCaloHcalE[
i]->GetXaxis()->SetTitle(
"Energy of Hits (GeV)");
349 hCaloHcalToF[
i]->GetXaxis()->SetTitle(
"Time of Flight of Hits (ns)");
354 sprintf(hname,
"hCaloHcalPhi");
356 sprintf(htitle,
"Hcal hits, phi/rad");
358 hCaloHcalPhi->GetXaxis()->SetTitle(
"Phi of Hits (rad)");
362 sprintf(hname,
"hCaloHcalEta");
364 sprintf(htitle,
"Hcal hits, eta");
371 sprintf(hname,
"hTrackerPx1");
373 sprintf(htitle,
"Pixel hits");
374 hTrackerPx[0] =
new TH1F(hname,htitle,100,0.,10000.);
375 sprintf(hname,
"hTrackerPx2");
377 hTrackerPx[1] =
new TH1F(hname,htitle,100,-0.5,99.5);
378 for (Int_t
i = 0;
i < 2; ++
i) {
379 hTrackerPx[
i]->GetXaxis()->SetTitle(
"Number of Pixel Hits");
384 sprintf(hname,
"hTrackerPxPhi");
386 sprintf(htitle,
"Pixel hits phi/rad");
392 sprintf(hname,
"hTrackerPxEta");
394 sprintf(htitle,
"Pixel hits eta");
400 sprintf(hname,
"hTrackerPxBToF");
402 sprintf(htitle,
"Pixel barrel hits, ToF/ns");
404 hTrackerPxBToF->GetXaxis()->SetTitle(
"Time of Flight of Hits (ns)");
408 sprintf(hname,
"hTrackerPxBR");
410 sprintf(htitle,
"Pixel barrel hits, R/cm");
416 sprintf(hname,
"hTrackerPxFToF");
418 sprintf(htitle,
"Pixel forward hits, ToF/ns");
420 hTrackerPxFToF->GetXaxis()->SetTitle(
"Time of Flight of Hits (ns)");
424 sprintf(hname,
"hTrackerPxFZ");
426 sprintf(htitle,
"Pixel forward hits, Z/cm");
432 sprintf(hname,
"hTrackerSi1");
434 sprintf(htitle,
"Silicon hits");
435 hTrackerSi[0] =
new TH1F(hname,htitle,100,0.,10000.);
436 sprintf(hname,
"hTrackerSi2");
438 hTrackerSi[1] =
new TH1F(hname,htitle,100,-0.5,99.5);
439 for (Int_t
i = 0;
i < 2; ++
i) {
440 hTrackerSi[
i]->GetXaxis()->SetTitle(
"Number of Silicon Hits");
445 sprintf(hname,
"hTrackerSiPhi");
447 sprintf(htitle,
"Silicon hits phi/rad");
453 sprintf(hname,
"hTrackerSiEta");
455 sprintf(htitle,
"Silicon hits eta");
461 sprintf(hname,
"hTrackerSiBToF");
463 sprintf(htitle,
"Silicon barrel hits, ToF/ns");
465 hTrackerSiBToF->GetXaxis()->SetTitle(
"Time of Flight of Hits (ns)");
469 sprintf(hname,
"hTrackerSiBR");
471 sprintf(htitle,
"Silicon barrel hits, R/cm");
477 sprintf(hname,
"hTrackerSiFToF");
479 sprintf(htitle,
"Silicon forward hits, ToF/ns");
481 hTrackerSiFToF->GetXaxis()->SetTitle(
"Time of Flight of Hits (ns)");
485 sprintf(hname,
"hTrackerSiFZ");
487 sprintf(htitle,
"Silicon forward hits, Z/cm");
494 sprintf(hname,
"hMuon1");
496 sprintf(htitle,
"Muon hits");
497 hMuon[0] =
new TH1F(hname,htitle,100,0.,10000.);
498 sprintf(hname,
"hMuon2");
500 hMuon[1] =
new TH1F(hname,htitle,100,-0.5,99.5);
501 for (Int_t
i = 0;
i < 2; ++
i) {
502 hMuon[
i]->GetXaxis()->SetTitle(
"Number of Muon Hits");
503 hMuon[
i]->GetYaxis()->SetTitle(
"Count");
507 sprintf(hname,
"hMuonPhi");
509 sprintf(htitle,
"Muon hits phi/rad");
510 hMuonPhi =
new TH1F(hname,htitle,100,-3.2,3.2);
511 hMuonPhi->GetXaxis()->SetTitle(
"Phi of Hits (rad)");
512 hMuonPhi->GetYaxis()->SetTitle(
"Count");
515 sprintf(hname,
"hMuonEta");
517 sprintf(htitle,
"Muon hits eta");
518 hMuonEta =
new TH1F(hname,htitle,100,-3.5,3.5);
519 hMuonEta->GetXaxis()->SetTitle(
"Eta of Hits");
520 hMuonEta->GetYaxis()->SetTitle(
"Count");
523 sprintf(hname,
"hMuonCscToF1");
525 sprintf(htitle,
"Muon CSC hits, ToF/ns");
526 hMuonCscToF[0] =
new TH1F(hname,htitle,100,0.,250.);
527 sprintf(hname,
"hMuonCscToF2");
529 hMuonCscToF[1] =
new TH1F(hname,htitle,100,0.,50.);
530 for (Int_t
i = 0;
i < 2; ++
i) {
531 hMuonCscToF[
i]->GetXaxis()->SetTitle(
"Time of Flight of Hits (ns)");
536 sprintf(hname,
"hMuonCscZ");
538 sprintf(htitle,
"Muon CSC hits, Z/cm");
539 hMuonCscZ =
new TH1F(hname,htitle,200,-1500.,1500.);
540 hMuonCscZ->GetXaxis()->SetTitle(
"Z of Hits (cm)");
541 hMuonCscZ->GetYaxis()->SetTitle(
"Count");
544 sprintf(hname,
"hMuonDtToF1");
546 sprintf(htitle,
"Muon DT hits, ToF/ns");
547 hMuonDtToF[0] =
new TH1F(hname,htitle,100,0.,250.);
548 sprintf(hname,
"hMuonDtToF2");
550 hMuonDtToF[1] =
new TH1F(hname,htitle,100,0.,50.);
551 for (Int_t
i = 0;
i < 2; ++
i) {
552 hMuonDtToF[
i]->GetXaxis()->SetTitle(
"Time of Flight of Hits (ns)");
557 sprintf(hname,
"hMuonDtR");
559 sprintf(htitle,
"Muon DT hits, R/cm");
560 hMuonDtR =
new TH1F(hname,htitle,100,0.,1500.);
561 hMuonDtR->GetXaxis()->SetTitle(
"R of Hits (cm)");
562 hMuonDtR->GetYaxis()->SetTitle(
"Count");
565 sprintf(hname,
"hMuonRpcFToF1");
567 sprintf(htitle,
"Muon RPC forward hits, ToF/ns");
569 sprintf(hname,
"hMuonRpcFToF2");
572 for (Int_t
i = 0;
i < 2; ++
i) {
573 hMuonRpcFToF[
i]->GetXaxis()->SetTitle(
"Time of Flight of Hits (ns)");
578 sprintf(hname,
"hMuonRpcFZ");
580 sprintf(htitle,
"Muon RPC forward hits, Z/cm");
581 hMuonRpcFZ =
new TH1F(hname,htitle,201,-1500.,1500.);
582 hMuonRpcFZ->GetXaxis()->SetTitle(
"Z of Hits (cm)");
586 sprintf(hname,
"hMuonRpcBToF1");
588 sprintf(htitle,
"Muon RPC barrel hits, ToF/ns");
590 sprintf(hname,
"hMuonRpcBToF2");
593 for (Int_t
i = 0;
i < 2; ++
i) {
594 hMuonRpcBToF[
i]->GetXaxis()->SetTitle(
"Time of Flight of Hits (ns)");
599 sprintf(hname,
"hMuonRpcBR");
601 sprintf(htitle,
"Muon RPC barrel hits, R/cm");
602 hMuonRpcBR =
new TH1F(hname,htitle,100,0.,1500.);
603 hMuonRpcBR->GetXaxis()->SetTitle(
"R of Hits (cm)");
624 std::string MsgLoggerCat =
"GlobalHitsProdHist_endJob";
627 <<
"Terminating having processed " <<
count <<
" events.";
634 std::string MsgLoggerCat =
"GlobalHitsProdHist_produce";
640 int nrun = iEvent.
id().
run();
645 <<
"Processing run " << nrun <<
", event " << nevt
646 <<
" (" <<
count <<
" events total)";
650 <<
"Processing run " << nrun <<
", event " << nevt
651 <<
" (" <<
count <<
" events total)";
658 std::vector<const edm::Provenance*> AllProv;
663 <<
"Number of Provenances = " << AllProv.size();
666 TString eventout(
"\nProvenance info:\n");
668 for (
unsigned int i = 0;
i < AllProv.size(); ++
i) {
669 eventout +=
"\n ******************************";
670 eventout +=
"\n Module : ";
671 eventout += AllProv[
i]->moduleLabel();
672 eventout +=
"\n ProductID : ";
673 eventout += AllProv[
i]->productID().id();
674 eventout +=
"\n ClassName : ";
675 eventout += AllProv[
i]->className();
676 eventout +=
"\n InstanceName : ";
677 eventout += AllProv[
i]->productInstanceName();
678 eventout +=
"\n BranchName : ";
679 eventout += AllProv[
i]->branchName();
681 eventout +=
"\n ******************************\n";
702 <<
"Done gathering data from event.";
710 std::string MsgLoggerCat =
"GlobalHitsProdHist_endRun";
718 <<
"\nStoring histograms.";
721 std::map<std::string, TH1F*>::iterator iter;
725 std::auto_ptr<TH1F> hist1D(iter->second);
726 eventout +=
"\n Storing histogram " +
histName_[
i];
730 eventoutw +=
"\n Unable to find histogram with name " +
histName_[
i];
746 std::string MsgLoggerCat =
"GlobalHitsProdHist_fillG4MC";
750 eventout =
"\nGathering info:";
756 std::vector<edm::Handle<edm::HepMCProduct> > AllHepMCEvt;
761 for (
unsigned int i = 0;
i < AllHepMCEvt.size(); ++
i) {
762 HepMCEvt = AllHepMCEvt[
i];
769 <<
"Unable to find HepMCProduct in event!";
772 eventout +=
"\n Using HepMCProduct: ";
775 const HepMC::GenEvent* MCEvt = HepMCEvt->GetEvent();
779 eventout +=
"\n Number of Raw Particles collected:......... ";
796 if (!G4VtxContainer.
isValid()) {
798 <<
"Unable to find SimVertex in event!";
802 edm::SimVertexContainer::const_iterator itVtx;
803 for (itVtx = G4VtxContainer->begin(); itVtx != G4VtxContainer->end();
809 itVtx->position().y(),
810 itVtx->position().z(),
811 itVtx->position().e());
814 G4Vtx1.GetCoordinates(G4Vtx);
828 eventout +=
"\n Number of G4Vertices collected:............ ";
840 if (!G4TrkContainer.
isValid()) {
842 <<
"Unable to find SimTrack in event!";
846 edm::SimTrackContainer::const_iterator itTrk;
847 for (itTrk = G4TrkContainer->begin(); itTrk != G4TrkContainer->end();
853 itTrk->momentum().y(),
854 itTrk->momentum().z(),
855 itTrk->momentum().e());
857 G4Trk1.GetCoordinates(G4Trk);
860 Fill(
sqrt(G4Trk[0]*G4Trk[0]+G4Trk[1]*G4Trk[1]));
865 eventout +=
"\n Number of G4Tracks collected:.............. ";
883 std::string MsgLoggerCat =
"GlobalHitsProdHist_fillTrk";
887 eventout =
"\nGathering info:";
892 if (!theTrackerGeometry.
isValid()) {
894 <<
"Unable to find TrackerDigiGeometryRecord in event!";
900 edm::PSimHitContainer::const_iterator itHit;
909 if (!PxlBrlLowContainer.
isValid()) {
911 <<
"Unable to find TrackerHitsPixelBarrelLowTof in event!";
917 if (!PxlBrlHighContainer.
isValid()) {
919 <<
"Unable to find TrackerHitsPixelBarrelHighTof in event!";
923 thePxlBrlHits.insert(thePxlBrlHits.end(),PxlBrlLowContainer->begin(),
924 PxlBrlLowContainer->end());
925 thePxlBrlHits.insert(thePxlBrlHits.end(),PxlBrlHighContainer->begin(),
926 PxlBrlHighContainer->end());
930 for (itHit = thePxlBrlHits.begin(); itHit != thePxlBrlHits.end(); ++itHit) {
935 DetId theDetUnitId(itHit->detUnitId());
936 int detector = theDetUnitId.
det();
937 int subdetector = theDetUnitId.subdetId();
947 <<
"Unable to get GeomDetUnit from PxlBrlHits for Hit " <<
i;
966 <<
"PxlBrl PSimHit " << i
967 <<
" is expected to be (det,subdet) = ("
969 <<
"); value returned is: ("
970 << detector <<
"," << subdetector <<
")";
976 eventout +=
"\n Number of Pixel Barrel Hits collected:..... ";
989 if (!PxlFwdLowContainer.
isValid()) {
991 <<
"Unable to find TrackerHitsPixelEndcapLowTof in event!";
997 if (!PxlFwdHighContainer.
isValid()) {
999 <<
"Unable to find TrackerHitsPixelEndcapHighTof in event!";
1003 thePxlFwdHits.insert(thePxlFwdHits.end(),PxlFwdLowContainer->begin(),
1004 PxlFwdLowContainer->end());
1005 thePxlFwdHits.insert(thePxlFwdHits.end(),PxlFwdHighContainer->begin(),
1006 PxlFwdHighContainer->end());
1010 for (itHit = thePxlFwdHits.begin(); itHit != thePxlFwdHits.end(); ++itHit) {
1015 DetId theDetUnitId(itHit->detUnitId());
1016 int detector = theDetUnitId.
det();
1017 int subdetector = theDetUnitId.subdetId();
1027 <<
"Unable to get GeomDetUnit from PxlFwdHits for Hit " <<
i;;
1038 hTrackerPxFZ->Fill(bSurface.toGlobal(itHit->localPosition()).
z());
1046 <<
"PxlFwd PSimHit " << i
1047 <<
" is expected to be (det,subdet) = ("
1049 <<
"); value returned is: ("
1050 << detector <<
"," << subdetector <<
")";
1056 eventout +=
"\n Number of Pixel Forward Hits collected:.... ";
1073 if (!SiTIBLowContainer.
isValid()) {
1075 <<
"Unable to find TrackerHitsTIBLowTof in event!";
1081 if (!SiTIBHighContainer.
isValid()) {
1083 <<
"Unable to find TrackerHitsTIBHighTof in event!";
1089 if (!SiTOBLowContainer.
isValid()) {
1091 <<
"Unable to find TrackerHitsTOBLowTof in event!";
1097 if (!SiTOBHighContainer.
isValid()) {
1099 <<
"Unable to find TrackerHitsTOBHighTof in event!";
1103 theSiBrlHits.insert(theSiBrlHits.end(),SiTIBLowContainer->begin(),
1104 SiTIBLowContainer->end());
1105 theSiBrlHits.insert(theSiBrlHits.end(),SiTIBHighContainer->begin(),
1106 SiTIBHighContainer->end());
1107 theSiBrlHits.insert(theSiBrlHits.end(),SiTOBLowContainer->begin(),
1108 SiTOBLowContainer->end());
1109 theSiBrlHits.insert(theSiBrlHits.end(),SiTOBHighContainer->begin(),
1110 SiTOBHighContainer->end());
1114 for (itHit = theSiBrlHits.begin(); itHit != theSiBrlHits.end(); ++itHit) {
1119 DetId theDetUnitId(itHit->detUnitId());
1120 int detector = theDetUnitId.
det();
1121 int subdetector = theDetUnitId.subdetId();
1124 if ((detector ==
dTrk) &&
1133 <<
"Unable to get GeomDetUnit from SiBrlHits for Hit " <<
i;
1152 <<
"SiBrl PSimHit " << i
1153 <<
" is expected to be (det,subdet) = ("
1155 <<
" || " <<
sdSiTOB <<
"); value returned is: ("
1156 << detector <<
"," << subdetector <<
")";
1162 eventout +=
"\n Number of Silicon Barrel Hits collected:... ";
1175 if (!SiTIDLowContainer.
isValid()) {
1177 <<
"Unable to find TrackerHitsTIDLowTof in event!";
1183 if (!SiTIDHighContainer.
isValid()) {
1185 <<
"Unable to find TrackerHitsTIDHighTof in event!";
1191 if (!SiTECLowContainer.
isValid()) {
1193 <<
"Unable to find TrackerHitsTECLowTof in event!";
1199 if (!SiTECHighContainer.
isValid()) {
1201 <<
"Unable to find TrackerHitsTECHighTof in event!";
1205 theSiFwdHits.insert(theSiFwdHits.end(),SiTIDLowContainer->begin(),
1206 SiTIDLowContainer->end());
1207 theSiFwdHits.insert(theSiFwdHits.end(),SiTIDHighContainer->begin(),
1208 SiTIDHighContainer->end());
1209 theSiFwdHits.insert(theSiFwdHits.end(),SiTECLowContainer->begin(),
1210 SiTECLowContainer->end());
1211 theSiFwdHits.insert(theSiFwdHits.end(),SiTECHighContainer->begin(),
1212 SiTECHighContainer->end());
1216 for (itHit = theSiFwdHits.begin(); itHit != theSiFwdHits.end(); ++itHit) {
1221 DetId theDetUnitId(itHit->detUnitId());
1222 int detector = theDetUnitId.
det();
1223 int subdetector = theDetUnitId.subdetId();
1226 if ((detector ==
dTrk) &&
1235 <<
"Unable to get GeomDetUnit from SiFwdHits Hit " <<
i;
1246 hTrackerSiFZ->Fill(bSurface.toGlobal(itHit->localPosition()).
z());
1254 <<
"SiFwd PSimHit " << i
1255 <<
" is expected to be (det,subdet) = ("
1257 <<
" || " <<
sdSiTEC <<
"); value returned is: ("
1258 << detector <<
"," << subdetector <<
")";
1264 eventout +=
"\n Number of Silicon Forward Hits collected:.. ";
1283 std::string MsgLoggerCat =
"GlobalHitsProdHist_fillMuon";
1287 eventout =
"\nGathering info:";
1290 edm::PSimHitContainer::const_iterator itHit;
1298 if (!theCSCGeometry.
isValid()) {
1300 <<
"Unable to find MuonGeometryRecord for the CSCGeometry in event!";
1308 if (!MuonCSCContainer.
isValid()) {
1310 <<
"Unable to find MuonCSCHits in event!";
1316 for (itHit = MuonCSCContainer->begin(); itHit != MuonCSCContainer->end();
1322 DetId theDetUnitId(itHit->detUnitId());
1323 int detector = theDetUnitId.
det();
1324 int subdetector = theDetUnitId.subdetId();
1327 if ((detector ==
dMuon) &&
1335 <<
"Unable to get GeomDetUnit from theCSCMuon for hit " <<
i;
1347 hMuonCscZ->Fill(bSurface.toGlobal(itHit->localPosition()).
z());
1349 hMuonPhi->Fill(bSurface.toGlobal(itHit->localPosition()).
phi());
1351 hMuonEta->Fill(bSurface.toGlobal(itHit->localPosition()).
eta());
1355 <<
"MuonCsc PSimHit " << i
1356 <<
" is expected to be (det,subdet) = ("
1358 <<
"); value returned is: ("
1359 << detector <<
"," << subdetector <<
")";
1365 eventout +=
"\n Number of CSC muon Hits collected:......... ";
1377 if (!theDTGeometry.
isValid()) {
1379 <<
"Unable to find MuonGeometryRecord for the DTGeometry in event!";
1387 if (!MuonDtContainer.
isValid()) {
1389 <<
"Unable to find MuonDTHits in event!";
1395 for (itHit = MuonDtContainer->begin(); itHit != MuonDtContainer->end();
1401 DetId theDetUnitId(itHit->detUnitId());
1402 int detector = theDetUnitId.
det();
1403 int subdetector = theDetUnitId.subdetId();
1406 if ((detector ==
dMuon) &&
1411 DTWireId wireId(itHit->detUnitId());
1414 const DTLayer *theDet = theDTMuon.
layer(wireId.layerId());
1418 <<
"Unable to get GeomDetUnit from theDtMuon for hit " <<
i;
1425 const BoundPlane& bSurface = theDet->surface();
1430 hMuonDtR->Fill(bSurface.toGlobal(itHit->localPosition()).
perp());
1432 hMuonPhi->Fill(bSurface.toGlobal(itHit->localPosition()).
phi());
1434 hMuonEta->Fill(bSurface.toGlobal(itHit->localPosition()).
eta());
1438 <<
"MuonDt PSimHit " << i
1439 <<
" is expected to be (det,subdet) = ("
1441 <<
"); value returned is: ("
1442 << detector <<
"," << subdetector <<
")";
1448 eventout +=
"\n Number of DT muon Hits collected:.......... ";
1461 if (!theRPCGeometry.
isValid()) {
1463 <<
"Unable to find MuonGeometryRecord for the RPCGeometry in event!";
1471 if (!MuonRPCContainer.
isValid()) {
1473 <<
"Unable to find MuonRPCHits in event!";
1479 int RPCBrl =0, RPCFwd = 0;
1480 for (itHit = MuonRPCContainer->begin(); itHit != MuonRPCContainer->end();
1486 DetId theDetUnitId(itHit->detUnitId());
1487 int detector = theDetUnitId.
det();
1488 int subdetector = theDetUnitId.subdetId();
1491 if ((detector ==
dMuon) &&
1495 RPCDetId RPCId(itHit->detUnitId());
1498 int region = RPCId.
region();
1505 <<
"Unable to get GeomDetUnit from theRPCMuon for hit " <<
i;
1521 hMuonRpcFZ->Fill(bSurface.toGlobal(itHit->localPosition()).
z());
1523 hMuonPhi->Fill(bSurface.toGlobal(itHit->localPosition()).
phi());
1525 hMuonEta->Fill(bSurface.toGlobal(itHit->localPosition()).
eta());
1533 hMuonRpcBR->Fill(bSurface.toGlobal(itHit->localPosition()).
perp());
1535 hMuonPhi->Fill(bSurface.toGlobal(itHit->localPosition()).
phi());
1537 hMuonEta->Fill(bSurface.toGlobal(itHit->localPosition()).
eta());
1541 <<
"Invalid region for RPC Muon hit" <<
i;
1546 <<
"MuonRpc PSimHit " << i
1547 <<
" is expected to be (det,subdet) = ("
1549 <<
"); value returned is: ("
1550 << detector <<
"," << subdetector <<
")";
1556 eventout +=
"\n Number of RPC muon Hits collected:......... ";
1558 eventout +=
"\n RPC Barrel muon Hits:............ ";
1560 eventout +=
"\n RPC Forward muon Hits:........... ";
1567 if (
hMuon[1])
hMuon[1]->Fill((
float)nMuonHits);
1578 std::string MsgLoggerCat =
"GlobalHitsProdHist_fillECal";
1582 eventout =
"\nGathering info:";
1587 if (!theCaloGeometry.
isValid()) {
1589 <<
"Unable to find CaloGeometryRecord in event!";
1595 edm::PCaloHitContainer::const_iterator itHit;
1606 <<
"Unable to find EcalHitsEB in event!";
1614 <<
"Unable to find EcalHitsEE in event!";
1618 theECalHits.insert(theECalHits.end(),EBContainer->begin(),
1619 EBContainer->end());
1620 theECalHits.insert(theECalHits.end(),EEContainer->begin(),
1621 EEContainer->end());
1625 for (itHit = theECalHits.begin(); itHit != theECalHits.end(); ++itHit) {
1630 DetId theDetUnitId(itHit->id());
1631 int detector = theDetUnitId.
det();
1632 int subdetector = theDetUnitId.subdetId();
1635 if ((detector ==
dEcal) &&
1641 getSubdetectorGeometry(theDetUnitId)->
getGeometry(theDetUnitId);
1645 <<
"Unable to get CaloCellGeometry from ECalHits for Hit " <<
i;
1663 <<
"ECal PCaloHit " << i
1664 <<
" is expected to be (det,subdet) = ("
1666 <<
" || " <<
sdEcalFwd <<
"); value returned is: ("
1667 << detector <<
"," << subdetector <<
")";
1673 eventout +=
"\n Number of ECal Hits collected:............. ";
1686 if (!PreShContainer.
isValid()) {
1688 <<
"Unable to find EcalHitsES in event!";
1694 for (itHit = PreShContainer->begin();
1695 itHit != PreShContainer->end(); ++itHit) {
1700 DetId theDetUnitId(itHit->id());
1701 int detector = theDetUnitId.
det();
1702 int subdetector = theDetUnitId.subdetId();
1705 if ((detector ==
dEcal) &&
1710 getSubdetectorGeometry(theDetUnitId)->
getGeometry(theDetUnitId);
1714 <<
"Unable to get CaloCellGeometry from PreShContainer for Hit "
1733 <<
"PreSh PCaloHit " << i
1734 <<
" is expected to be (det,subdet) = ("
1736 <<
"); value returned is: ("
1737 << detector <<
"," << subdetector <<
")";
1743 eventout +=
"\n Number of PreSh Hits collected:............ ";
1759 std::string MsgLoggerCat =
"GlobalHitsProdHist_fillHCal";
1763 eventout =
"\nGathering info:";
1768 if (!theCaloGeometry.
isValid()) {
1770 <<
"Unable to find CaloGeometryRecord in event!";
1776 edm::PCaloHitContainer::const_iterator itHit;
1784 if (!HCalContainer.
isValid()) {
1786 <<
"Unable to find HCalHits in event!";
1792 for (itHit = HCalContainer->begin();
1793 itHit != HCalContainer->end(); ++itHit) {
1798 DetId theDetUnitId(itHit->id());
1799 int detector = theDetUnitId.
det();
1800 int subdetector = theDetUnitId.subdetId();
1803 if ((detector ==
dHcal) &&
1811 getSubdetectorGeometry(theDetUnitId)->
getGeometry(theDetUnitId);
1815 <<
"Unable to get CaloCellGeometry from HCalContainer for Hit " <<
i;
1833 <<
"HCal PCaloHit " << i
1834 <<
" is expected to be (det,subdet) = ("
1837 <<
"); value returned is: ("
1838 << detector <<
"," << subdetector <<
")";
1844 eventout +=
"\n Number of HCal Hits collected:............. ";
edm::InputTag SiTECHighSrc_
void getManyByType(std::vector< Handle< PROD > > &results) const
T getParameter(std::string const &) const
EventNumber_t event() const
edm::EDGetTokenT< edm::PSimHitContainer > PxlFwdHighSrc_Token_
T getUntrackedParameter(std::string const &, T const &) const
void getAllProvenance(std::vector< Provenance const * > &provenances) const
edm::EDGetTokenT< edm::PSimHitContainer > SiTECHighSrc_Token_
edm::InputTag SiTIDLowSrc_
std::map< std::string, TH1F * > histMap_
std::vector< PCaloHit > PCaloHitContainer
virtual void beginJob() override
static const int sdMuonRPCRgnFwdn
edm::EDGetTokenT< edm::PSimHitContainer > PxlBrlHighSrc_Token_
static const int sdHcalOut
static const int sdMuonDT
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
edm::InputTag SiTECLowSrc_
edm::EDGetTokenT< edm::PSimHitContainer > PxlBrlLowSrc_Token_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< edm::PSimHitContainer > SiTOBHighSrc_Token_
Geom::Phi< T > phi() const
edm::InputTag MuonRpcSrc_
static const int sdEcalPS
static const int sdMuonRPC
edm::EDGetTokenT< edm::PSimHitContainer > MuonRpcSrc_Token_
edm::InputTag MuonCscSrc_
const Plane & surface() const
The nominal surface of the GeomDet.
void fillHCal(edm::Event &, const edm::EventSetup &)
edm::InputTag SiTIBLowSrc_
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
edm::EDGetTokenT< edm::PCaloHitContainer > ECalESSrc_Token_
std::vector< std::string > histName_
void fillG4MC(edm::Event &)
edm::InputTag PxlFwdHighSrc_
static const int sdPxlBrl
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
static const int sdMuonCSC
static const int sdEcalFwd
virtual void endRunProduce(edm::Run &, const edm::EventSetup &) override
edm::InputTag SiTOBHighSrc_
virtual void produce(edm::Event &, const edm::EventSetup &) override
virtual ~GlobalHitsProdHist()
static const int sdEcalBrl
BranchDescription const & product() const
edm::EDGetTokenT< edm::SimTrackContainer > G4TrkSrc_Token_
static const int sdMuonRPCRgnFwdp
void fillTrk(edm::Event &, const edm::EventSetup &)
static const int sdMuonRPCRgnBrl
edm::EDGetTokenT< edm::PSimHitContainer > SiTIDLowSrc_Token_
edm::EDGetTokenT< edm::PSimHitContainer > SiTIDHighSrc_Token_
edm::EDGetTokenT< edm::PSimHitContainer > SiTOBLowSrc_Token_
edm::InputTag SiTIBHighSrc_
edm::EDGetTokenT< edm::PCaloHitContainer > ECalEBSrc_Token_
edm::EDGetTokenT< edm::PCaloHitContainer > ECalEESrc_Token_
edm::EDGetTokenT< edm::PSimHitContainer > SiTIBHighSrc_Token_
edm::EDGetTokenT< edm::PSimHitContainer > SiTIBLowSrc_Token_
edm::InputTag PxlFwdLowSrc_
std::vector< SimVertex > SimVertexContainer
static const int sdHcalFwd
edm::EDGetTokenT< edm::PCaloHitContainer > HCalSrc_Token_
void fillECal(edm::Event &, const edm::EventSetup &)
static const int sdHcalBrl
edm::EDGetTokenT< edm::PSimHitContainer > SiTECLowSrc_Token_
virtual void endJob() override
edm::EDGetTokenT< edm::PSimHitContainer > MuonCscSrc_Token_
edm::EDGetTokenT< edm::PSimHitContainer > MuonDtSrc_Token_
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
edm::EDGetTokenT< edm::SimVertexContainer > G4VtxSrc_Token_
T perp() const
Magnitude of transverse component.
edm::InputTag PxlBrlHighSrc_
void fillMuon(edm::Event &, const edm::EventSetup &)
const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
edm::InputTag PxlBrlLowSrc_
void put(std::auto_ptr< PROD > product)
Put a new product.
std::vector< PSimHit > PSimHitContainer
static const int sdPxlFwd
edm::InputTag SiTOBLowSrc_
volatile std::atomic< bool > shutdown_flag false
edm::EDGetTokenT< edm::PSimHitContainer > PxlFwdLowSrc_Token_
Detector det() const
get the detector field from this detid
GlobalHitsProdHist(const edm::ParameterSet &)
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
std::vector< SimTrack > SimTrackContainer
static const int sdHcalEC
edm::InputTag SiTIDHighSrc_
Provenance const * provenance() const
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.