16 printProvenanceInfo(
false), trackerHitAssociatorConfig_(iPSet, consumesCollector()),
count(0)
18 std::string MsgLoggerCat =
"GlobalRecHitsProducer_GlobalRecHitsProducer";
28 m_Prov.getUntrackedParameter<
bool>(
"GetAllProvenances");
30 m_Prov.getUntrackedParameter<
bool>(
"PrintProvenanceInfo");
75 produces<PGlobalRecHit>(
label);
80 <<
"\n===============================\n" 81 <<
"Initialized as EDProducer with parameter values:\n" 82 <<
" Name = " <<
fName <<
"\n" 83 <<
" Verbosity = " << verbosity <<
"\n" 84 <<
" Frequency = " << frequency <<
"\n" 85 <<
" Label = " << label <<
"\n" 86 <<
" GetProv = " << getAllProvenances <<
"\n" 87 <<
" PrintProv = " << printProvenanceInfo <<
"\n" 88 <<
" ECalEBSrc = " << ECalEBSrc_.label()
89 <<
":" << ECalEBSrc_.instance() <<
"\n" 90 <<
" ECalUncalEBSrc = " << ECalUncalEBSrc_.
label()
91 <<
":" << ECalUncalEBSrc_.
instance() <<
"\n" 92 <<
" ECalEESrc = " << ECalEESrc_.
label()
93 <<
":" << ECalUncalEESrc_.
instance() <<
"\n" 94 <<
" ECalUncalEESrc = " << ECalUncalEESrc_.
label()
95 <<
":" << ECalEESrc_.
instance() <<
"\n" 96 <<
" ECalESSrc = " << ECalESSrc_.
label()
97 <<
":" << ECalESSrc_.
instance() <<
"\n" 98 <<
" HCalSrc = " << HCalSrc_.
label()
99 <<
":" << HCalSrc_.
instance() <<
"\n" 100 <<
" SiStripSrc = " << SiStripSrc_.
label()
101 <<
":" << SiStripSrc_.
instance() <<
"\n" 102 <<
" SiPixelSrc = " << SiPxlSrc_.
label()
103 <<
":" << SiPxlSrc_.
instance() <<
"\n" 104 <<
" MuDTSrc = " << MuDTSrc_.
label()
105 <<
":" << MuDTSrc_.
instance() <<
"\n" 106 <<
" MuDTSimSrc = " << MuDTSimSrc_.
label()
107 <<
":" << MuDTSimSrc_.
instance() <<
"\n" 108 <<
" MuCSCSrc = " << MuCSCSrc_.
label()
109 <<
":" << MuCSCSrc_.
instance() <<
"\n" 110 <<
" MuRPCSrc = " << MuRPCSrc_.
label()
111 <<
":" << MuRPCSrc_.
instance() <<
"\n" 112 <<
" MuRPCSimSrc = " << MuRPCSimSrc_.
label()
113 <<
":" << MuRPCSimSrc_.
instance() <<
"\n" 114 <<
"===============================\n";
124 std::string MsgLoggerCat =
"GlobalRecHitsProducer_beginJob";
133 std::string MsgLoggerCat =
"GlobalRecHitsProducer_endJob";
136 <<
"Terminating having processed " <<
count <<
" events.";
143 std::string MsgLoggerCat =
"GlobalRecHitsProducer_produce";
154 <<
"Processing run " << nrun <<
", event " << nevt
155 <<
" (" <<
count <<
" events total)";
159 <<
"Processing run " << nrun <<
", event " << nevt
160 <<
" (" <<
count <<
" events total)";
170 std::vector<const edm::StableProvenance*> AllProv;
175 <<
"Number of Provenances = " << AllProv.size();
178 TString eventout(
"\nProvenance info:\n");
180 for (
unsigned int i = 0;
i < AllProv.size(); ++
i) {
181 eventout +=
"\n ******************************";
182 eventout +=
"\n Module : ";
184 eventout += AllProv[
i]->moduleLabel();
185 eventout +=
"\n ProductID : ";
187 eventout += AllProv[
i]->productID().id();
188 eventout +=
"\n ClassName : ";
190 eventout += AllProv[
i]->className();
191 eventout +=
"\n InstanceName : ";
193 eventout += AllProv[
i]->productInstanceName();
194 eventout +=
"\n BranchName : ";
196 eventout += AllProv[
i]->branchName();
198 eventout +=
"\n ******************************\n";
217 <<
"Done gathering data from event.";
224 <<
"Saving event contents:";
245 std::string MsgLoggerCat =
"GlobalRecHitsProducer_fillECal";
249 eventout =
"\nGathering info:";
266 if (!EcalUncalibRecHitEB.
isValid()) {
268 <<
"Unable to find EcalUncalRecHitEB in event!";
276 <<
"Unable to find EcalRecHitEB in event!";
282 if (!crossingFrame.
isValid()) {
284 <<
"Unable to find cal barrel crossingFrame in event!";
290 std::unique_ptr<MixCollection<PCaloHit> >
296 = barrelHits->begin();
297 hitItr != barrelHits->end();
302 uint32_t crystid = ebid.
rawId();
303 ebSimMap[crystid] += hitItr->energy();
313 EBUncalibRecHit->
begin();
314 uncalibRecHit != EBUncalibRecHit->
end();
321 if (myRecHit != EBRecHit->
end()) {
323 EBRE.push_back(myRecHit->energy());
329 eventout +=
"\n Number of EBRecHits collected:............ ";
330 eventout += nEBRecHits;
338 if (!EcalUncalibRecHitEE.
isValid()) {
340 <<
"Unable to find EcalUncalRecHitEE in event!";
348 <<
"Unable to find EcalRecHitEE in event!";
354 if (!crossingFrame.
isValid()) {
356 <<
"Unable to find cal endcap crossingFrame in event!";
362 std::unique_ptr<MixCollection<PCaloHit> >
368 = endcapHits->begin();
369 hitItr != endcapHits->end();
374 uint32_t crystid = eeid.
rawId();
375 eeSimMap[crystid] += hitItr->energy();
385 EEUncalibRecHit->
begin();
386 uncalibRecHit != EEUncalibRecHit->
end();
393 if (myRecHit != EERecHit->
end()) {
395 EERE.push_back(myRecHit->energy());
401 eventout +=
"\n Number of EERecHits collected:............ ";
402 eventout += nEERecHits;
412 <<
"Unable to find EcalRecHitES in event!";
418 if (!crossingFrame.
isValid()) {
420 <<
"Unable to find cal preshower crossingFrame in event!";
426 std::unique_ptr<MixCollection<PCaloHit> >
432 = preshowerHits->begin();
433 hitItr != preshowerHits->end();
438 uint32_t crystid = esid.
rawId();
439 esSimMap[crystid] += hitItr->energy();
458 eventout +=
"\n Number of ESRecHits collected:............ ";
459 eventout += nESRecHits;
470 std::string MsgLoggerCat =
"GlobalRecHitsProducer_storeECal";
473 TString eventout(
"\n nEBRecHits = ");
474 eventout +=
EBRE.size();
475 for (
unsigned int i = 0;
i <
EBRE.size(); ++
i) {
476 eventout +=
"\n (RE, SHE) = (";
482 eventout +=
"\n nEERecHits = ";
483 eventout +=
EERE.size();
484 for (
unsigned int i = 0;
i <
EERE.size(); ++
i) {
485 eventout +=
"\n (RE, SHE) = (";
491 eventout +=
"\n nESRecHits = ";
492 eventout +=
ESRE.size();
493 for (
unsigned int i = 0;
i <
ESRE.size(); ++
i) {
494 eventout +=
"\n (RE, SHE) = (";
513 std::string MsgLoggerCat =
"GlobalRecHitsProducer_fillHCal";
517 eventout =
"\nGathering info:";
524 <<
"Unable to find CaloGeometry in event!";
535 <<
"Unable to find hcalHits in event!";
544 for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin();
545 simhits != simhitResult->end();
549 uint32_t cellid = detId.
rawId();
552 fHBEnergySimHits[cellid] += simhits->energy();
555 fHEEnergySimHits[cellid] += simhits->energy();
558 fHOEnergySimHits[cellid] += simhits->energy();
561 fHFEnergySimHits[cellid] += simhits->energy();
566 Double_t maxHBEnergy = 0.;
567 Double_t maxHEEnergy = 0.;
568 Double_t maxHFEnergy = 0.;
570 Double_t maxHBPhi = -1000.;
571 Double_t maxHEPhi = -1000.;
572 Double_t maxHOPhi = -1000.;
573 Double_t maxHFPhi = -1000.;
575 Double_t maxHBEta = -1000.;
576 Double_t maxHEEta = -1000.;
577 Double_t maxHOEta = -1000.;
578 Double_t maxHFEta = -1000.;
580 Double_t
PI = 3.141592653589;
585 std::vector<edm::Handle<HBHERecHitCollection> >
hbhe;
587 if (!hbhe[0].isValid()) {
589 <<
"Unable to find any HBHERecHitCollections in event!";
592 std::vector<edm::Handle<HBHERecHitCollection> >::iterator ihbhe;
597 for (ihbhe = hbhe.begin(); ihbhe != hbhe.end(); ++ihbhe) {
601 jhbhe != (*ihbhe)->end(); ++jhbhe) {
611 if ( (jhbhe->energy()) > maxHBEnergy ) {
612 maxHBEnergy = jhbhe->energy();
626 if ( (jhbhe->energy()) > maxHEEnergy ) {
627 maxHEEnergy = jhbhe->energy();
635 jhbhe != (*ihbhe)->end(); ++jhbhe) {
648 float deltaphi = maxHBPhi - fPhi;
649 if (fPhi > maxHBPhi) { deltaphi = fPhi - maxHBPhi;}
650 if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
651 float deltaeta = fEta - maxHBEta;
652 Double_t
r =
sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
654 HBCalREC.push_back(jhbhe->energy());
656 HBCalSHE.push_back(fHBEnergySimHits[cell.rawId()]);
668 float deltaphi = maxHEPhi - fPhi;
669 if (fPhi > maxHEPhi) { deltaphi = fPhi - maxHEPhi;}
670 if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
671 float deltaeta = fEta - maxHEEta;
672 Double_t
r =
sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
674 HECalREC.push_back(jhbhe->energy());
676 HECalSHE.push_back(fHEEnergySimHits[cell.rawId()]);
683 eventout +=
"\n Number of HBRecHits collected:............ ";
688 eventout +=
"\n Number of HERecHits collected:............ ";
695 std::vector<edm::Handle<HFRecHitCollection> >
hf;
697 if (!hf[0].isValid()) {
699 <<
"Unable to find any HFRecHitCollections in event!";
702 std::vector<edm::Handle<HFRecHitCollection> >::iterator
ihf;
705 for (ihf = hf.begin(); ihf != hf.end(); ++
ihf) {
709 jhf != (*ihf)->end(); ++jhf) {
716 double fEta = cellGeometry->getPosition().eta () ;
717 double fPhi = cellGeometry->getPosition().phi () ;
718 if ( (jhf->energy()) > maxHFEnergy ) {
719 maxHFEnergy = jhf->energy();
727 jhf != (*ihf)->end(); ++jhf) {
736 double fEta = cellGeometry->getPosition().eta () ;
737 double fPhi = cellGeometry->getPosition().phi () ;
739 float deltaphi = maxHBPhi - fPhi;
740 if (fPhi > maxHFPhi) { deltaphi = fPhi - maxHFPhi;}
741 if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
742 float deltaeta = fEta - maxHFEta;
743 Double_t
r =
sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
747 HFCalSHE.push_back(fHFEnergySimHits[cell.rawId()]);
753 eventout +=
"\n Number of HFDigis collected:.............. ";
760 std::vector<edm::Handle<HORecHitCollection> >
ho;
762 if (!ho[0].isValid()) {
764 <<
"Unable to find any HORecHitCollections in event!";
767 std::vector<edm::Handle<HORecHitCollection> >::iterator iho;
770 for (iho = ho.begin(); iho != ho.end(); ++iho) {
773 jho != (*iho)->end(); ++jho) {
782 double fEta = cellGeometry->getPosition().eta () ;
783 double fPhi = cellGeometry->getPosition().phi () ;
785 float deltaphi = maxHOPhi - fPhi;
786 if (fPhi > maxHOPhi) { deltaphi = fPhi - maxHOPhi;}
787 if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
788 float deltaeta = fEta - maxHOEta;
789 Double_t
r =
sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
793 HOCalSHE.push_back(fHOEnergySimHits[cell.rawId()]);
799 eventout +=
"\n Number of HODigis collected:.............. ";
811 std::string MsgLoggerCat =
"GlobalRecHitsProducer_storeHCal";
814 TString eventout(
"\n nHBRecHits = ");
816 for (
unsigned int i = 0;
i <
HBCalREC.size(); ++
i) {
817 eventout +=
"\n (REC, R, SHE) = (";
825 eventout +=
"\n nHERecHits = ";
827 for (
unsigned int i = 0;
i <
HECalREC.size(); ++
i) {
828 eventout +=
"\n (REC, R, SHE) = (";
836 eventout +=
"\n nHFRecHits = ";
838 for (
unsigned int i = 0;
i <
HFCalREC.size(); ++
i) {
839 eventout +=
"\n (REC, R, SHE) = (";
847 eventout +=
"\n nHORecHits = ";
849 for (
unsigned int i = 0;
i <
HOCalREC.size(); ++
i) {
850 eventout +=
"\n (REC, R, SHE) = (";
879 std::string MsgLoggerCat =
"GlobalRecHitsProducer_fillTrk";
883 eventout =
"\nGathering info:";
888 if (!rechitsmatched.
isValid()) {
890 <<
"Unable to find stripmatchedrechits in event!";
900 <<
"Unable to find TrackerDigiGeometry in event!";
905 int nStripBrl = 0, nStripFwd = 0;
908 for (TrackerGeometry::DetContainer::const_iterator it = pDD->
dets().begin();
909 it != pDD->
dets().end(); ++it) {
911 uint32_t myid = ((*it)->geographicalId()).rawId();
912 DetId detid = ((*it)->geographicalId());
917 if (rechitmatchedMatch != rechitsmatched->
end()) {
923 for ( itermatched = rechitmatchedRangeIteratorBegin;
924 itermatched != rechitmatchedRangeIteratorEnd;
930 float mindist = 999999.;
931 float distx = 999999.;
932 float disty = 999999.;
933 float dist = 999999.;
934 std::pair<LocalPoint,LocalVector> closestPair;
937 float rechitmatchedx = position.
x();
938 float rechitmatchedy = position.
y();
948 std::pair<LocalPoint,LocalVector> hitPair;
950 for(std::vector<PSimHit>::const_iterator
m =
matched.begin();
954 distx = fabs(rechitmatchedx - hitPair.first.x());
955 disty = fabs(rechitmatchedy - hitPair.first.y());
956 dist =
sqrt(distx*distx+disty*disty);
960 closestPair = hitPair;
971 TIBL1RX.push_back(rechitmatchedx);
972 TIBL1RY.push_back(rechitmatchedy);
973 TIBL1SX.push_back(closestPair.first.x());
974 TIBL1SY.push_back(closestPair.first.y());
977 TIBL2RX.push_back(rechitmatchedx);
978 TIBL2RY.push_back(rechitmatchedy);
979 TIBL2SX.push_back(closestPair.first.x());
980 TIBL2SY.push_back(closestPair.first.y());
983 TIBL3RX.push_back(rechitmatchedx);
984 TIBL3RY.push_back(rechitmatchedy);
985 TIBL3SX.push_back(closestPair.first.x());
986 TIBL3SY.push_back(closestPair.first.y());
989 TIBL4RX.push_back(rechitmatchedx);
990 TIBL4RY.push_back(rechitmatchedy);
991 TIBL4SX.push_back(closestPair.first.x());
992 TIBL4SY.push_back(closestPair.first.y());
1003 TOBL1RX.push_back(rechitmatchedx);
1004 TOBL1RY.push_back(rechitmatchedy);
1005 TOBL1SX.push_back(closestPair.first.x());
1006 TOBL1SY.push_back(closestPair.first.y());
1009 TOBL2RX.push_back(rechitmatchedx);
1010 TOBL2RY.push_back(rechitmatchedy);
1011 TOBL2SX.push_back(closestPair.first.x());
1012 TOBL2SY.push_back(closestPair.first.y());
1015 TOBL3RX.push_back(rechitmatchedx);
1016 TOBL3RY.push_back(rechitmatchedy);
1017 TOBL3SX.push_back(closestPair.first.x());
1018 TOBL3SY.push_back(closestPair.first.y());
1021 TOBL4RX.push_back(rechitmatchedx);
1022 TOBL4RY.push_back(rechitmatchedy);
1023 TOBL4SX.push_back(closestPair.first.x());
1024 TOBL4SY.push_back(closestPair.first.y());
1035 TIDW1RX.push_back(rechitmatchedx);
1036 TIDW1RY.push_back(rechitmatchedy);
1037 TIDW1SX.push_back(closestPair.first.x());
1038 TIDW1SY.push_back(closestPair.first.y());
1041 TIDW2RX.push_back(rechitmatchedx);
1042 TIDW2RY.push_back(rechitmatchedy);
1043 TIDW2SX.push_back(closestPair.first.x());
1044 TIDW2SY.push_back(closestPair.first.y());
1047 TIDW3RX.push_back(rechitmatchedx);
1048 TIDW3RY.push_back(rechitmatchedy);
1049 TIDW3SX.push_back(closestPair.first.x());
1050 TIDW3SY.push_back(closestPair.first.y());
1061 TECW1RX.push_back(rechitmatchedx);
1062 TECW1RY.push_back(rechitmatchedy);
1063 TECW1SX.push_back(closestPair.first.x());
1064 TECW1SY.push_back(closestPair.first.y());
1067 TECW2RX.push_back(rechitmatchedx);
1068 TECW2RY.push_back(rechitmatchedy);
1069 TECW2SX.push_back(closestPair.first.x());
1070 TECW2SY.push_back(closestPair.first.y());
1073 TECW3RX.push_back(rechitmatchedx);
1074 TECW3RY.push_back(rechitmatchedy);
1075 TECW3SX.push_back(closestPair.first.x());
1076 TECW3SY.push_back(closestPair.first.y());
1079 TECW4RX.push_back(rechitmatchedx);
1080 TECW4RY.push_back(rechitmatchedy);
1081 TECW4SX.push_back(closestPair.first.x());
1082 TECW4SY.push_back(closestPair.first.y());
1085 TECW5RX.push_back(rechitmatchedx);
1086 TECW5RY.push_back(rechitmatchedy);
1087 TECW5SX.push_back(closestPair.first.x());
1088 TECW5SY.push_back(closestPair.first.y());
1091 TECW6RX.push_back(rechitmatchedx);
1092 TECW6RY.push_back(rechitmatchedy);
1093 TECW6SX.push_back(closestPair.first.x());
1094 TECW6SY.push_back(closestPair.first.y());
1097 TECW7RX.push_back(rechitmatchedx);
1098 TECW7RY.push_back(rechitmatchedy);
1099 TECW7SX.push_back(closestPair.first.x());
1100 TECW7SY.push_back(closestPair.first.y());
1103 TECW8RX.push_back(rechitmatchedx);
1104 TECW8RY.push_back(rechitmatchedy);
1105 TECW8SX.push_back(closestPair.first.x());
1106 TECW8SY.push_back(closestPair.first.y());
1116 eventout +=
"\n Number of BrlStripRecHits collected:...... ";
1117 eventout += nStripBrl;
1121 eventout +=
"\n Number of FrwdStripRecHits collected:..... ";
1122 eventout += nStripFwd;
1131 <<
"Unable to find SiPixelRecHitCollection in event!";
1140 <<
"Unable to find TrackerDigiGeometry in event!";
1145 int nPxlBrl = 0, nPxlFwd = 0;
1147 for (TrackerGeometry::DetContainer::const_iterator it = geom->
dets().begin();
1148 it != geom->
dets().end(); ++it) {
1150 uint32_t myid = ((*it)->geographicalId()).rawId();
1151 DetId detId = ((*it)->geographicalId());
1160 if (pixeldet == recHitColl->
end())
continue;
1168 for ( ; pixeliter != pixelrechitRangeIteratorEnd; ++pixeliter) {
1173 if ( !matched.empty() ) {
1175 float closest = 9999.9;
1178 float rechit_x = lp.
x();
1179 float rechit_y = lp.
y();
1185 for (std::vector<PSimHit>::const_iterator
m = matched.begin();
1186 m != matched.end(); ++
m) {
1188 float sim_x1 = (*m).entryPoint().x();
1189 float sim_x2 = (*m).exitPoint().x();
1190 float sim_xpos = 0.5*(sim_x1+sim_x2);
1192 float sim_y1 = (*m).entryPoint().y();
1193 float sim_y2 = (*m).exitPoint().y();
1194 float sim_ypos = 0.5*(sim_y1+sim_y2);
1196 float x_res = fabs(sim_xpos - rechit_x);
1197 float y_res = fabs(sim_ypos - rechit_y);
1199 float dist =
sqrt(x_res*x_res + y_res*y_res);
1201 if ( dist < closest ) {
1214 BRL1RX.push_back(rechit_x);
1215 BRL1RY.push_back(rechit_y);
1220 BRL2RX.push_back(rechit_x);
1221 BRL2RY.push_back(rechit_y);
1226 BRL3RX.push_back(rechit_x);
1227 BRL3RY.push_back(rechit_y);
1238 if (tTopo->
pxfDisk(myid) == 1) {
1239 if (tTopo->
pxfSide(myid) == 1) {
1245 if (tTopo->
pxfSide(myid) == 2) {
1252 if (tTopo->
pxfDisk(myid) == 2) {
1253 if (tTopo->
pxfSide(myid) == 1) {
1259 if (tTopo->
pxfSide(myid) == 2) {
1273 eventout +=
"\n Number of BrlPixelRecHits collected:...... ";
1274 eventout += nPxlBrl;
1278 eventout +=
"\n Number of FrwdPixelRecHits collected:..... ";
1279 eventout += nPxlFwd;
1290 std::string MsgLoggerCat =
"GlobalRecHitsProducer_storeTrk";
1295 TString eventout(
"\n nTIBL1 = ");
1297 for (
unsigned int i = 0;
i <
TIBL1RX.size(); ++
i) {
1298 eventout +=
"\n (RX, RY, SX, SY) = (";
1308 eventout +=
"\n nTIBL2 = ";
1310 for (
unsigned int i = 0;
i <
TIBL2RX.size(); ++
i) {
1311 eventout +=
"\n (RX, RY, SX, SY) = (";
1321 eventout +=
"\n nTIBL3 = ";
1323 for (
unsigned int i = 0;
i <
TIBL3RX.size(); ++
i) {
1324 eventout +=
"\n (RX, RY, SX, SY) = (";
1334 eventout +=
"\n nTIBL4 = ";
1336 for (
unsigned int i = 0;
i <
TIBL4RX.size(); ++
i) {
1337 eventout +=
"\n (RX, RY, SX, SY) = (";
1347 eventout +=
"\n nTOBL1 = ";
1349 for (
unsigned int i = 0;
i <
TOBL1RX.size(); ++
i) {
1350 eventout +=
"\n (RX, RY, SX, SY) = (";
1360 eventout +=
"\n nTOBL2 = ";
1362 for (
unsigned int i = 0;
i <
TOBL2RX.size(); ++
i) {
1363 eventout +=
"\n (RX, RY, SX, SY) = (";
1373 eventout +=
"\n nTOBL3 = ";
1375 for (
unsigned int i = 0;
i <
TOBL3RX.size(); ++
i) {
1376 eventout +=
"\n (RX, RY, SX, SY) = (";
1386 eventout +=
"\n nTOBL4 = ";
1388 for (
unsigned int i = 0;
i <
TOBL4RX.size(); ++
i) {
1389 eventout +=
"\n (RX, RY, SX, SY) = (";
1399 eventout +=
"\n nTIDW1 = ";
1401 for (
unsigned int i = 0;
i <
TIDW1RX.size(); ++
i) {
1402 eventout +=
"\n (RX, RY, SX, SY) = (";
1412 eventout +=
"\n nTIDW2 = ";
1414 for (
unsigned int i = 0;
i <
TIDW2RX.size(); ++
i) {
1415 eventout +=
"\n (RX, RY, SX, SY) = (";
1425 eventout +=
"\n nTIDW3 = ";
1427 for (
unsigned int i = 0;
i <
TIDW3RX.size(); ++
i) {
1428 eventout +=
"\n (RX, RY, SX, SY) = (";
1438 eventout +=
"\n nTECW1 = ";
1440 for (
unsigned int i = 0;
i <
TECW1RX.size(); ++
i) {
1441 eventout +=
"\n (RX, RY, SX, SY) = (";
1451 eventout +=
"\n nTECW2 = ";
1453 for (
unsigned int i = 0;
i <
TECW2RX.size(); ++
i) {
1454 eventout +=
"\n (RX, RY, SX, SY) = (";
1464 eventout +=
"\n nTECW3 = ";
1466 for (
unsigned int i = 0;
i <
TECW3RX.size(); ++
i) {
1467 eventout +=
"\n (RX, RY, SX, SY) = (";
1477 eventout +=
"\n nTECW4 = ";
1479 for (
unsigned int i = 0;
i <
TECW4RX.size(); ++
i) {
1480 eventout +=
"\n (RX, RY, SX, SY) = (";
1490 eventout +=
"\n nTECW5 = ";
1492 for (
unsigned int i = 0;
i <
TECW5RX.size(); ++
i) {
1493 eventout +=
"\n (RX, RY, SX, SY) = (";
1503 eventout +=
"\n nTECW6 = ";
1505 for (
unsigned int i = 0;
i <
TECW6RX.size(); ++
i) {
1506 eventout +=
"\n (RX, RY, SX, SY) = (";
1516 eventout +=
"\n nTECW7 = ";
1518 for (
unsigned int i = 0;
i <
TECW7RX.size(); ++
i) {
1519 eventout +=
"\n (RX, RY, SX, SY) = (";
1529 eventout +=
"\n nTECW8 = ";
1531 for (
unsigned int i = 0;
i <
TECW8RX.size(); ++
i) {
1532 eventout +=
"\n (RX, RY, SX, SY) = (";
1544 eventout +=
"\n nBRL1 = ";
1545 eventout +=
BRL1RX.size();
1546 for (
unsigned int i = 0;
i <
BRL1RX.size(); ++
i) {
1547 eventout +=
"\n (RX, RY, SX, SY) = (";
1557 eventout +=
"\n nBRL2 = ";
1558 eventout +=
BRL2RX.size();
1559 for (
unsigned int i = 0;
i <
BRL2RX.size(); ++
i) {
1560 eventout +=
"\n (RX, RY, SX, SY) = (";
1570 eventout +=
"\n nBRL3 = ";
1571 eventout +=
BRL3RX.size();
1572 for (
unsigned int i = 0;
i <
BRL3RX.size(); ++
i) {
1573 eventout +=
"\n (RX, RY, SX, SY) = (";
1583 eventout +=
"\n nFWD1p = ";
1585 for (
unsigned int i = 0;
i <
FWD1pRX.size(); ++
i) {
1586 eventout +=
"\n (RX, RY, SX, SY) = (";
1596 eventout +=
"\n nFWD1n = ";
1598 for (
unsigned int i = 0;
i <
FWD1nRX.size(); ++
i) {
1599 eventout +=
"\n (RX, RY, SX, SY) = (";
1609 eventout +=
"\n nFWD2p = ";
1611 for (
unsigned int i = 0;
i <
FWD2pRX.size(); ++
i) {
1612 eventout +=
"\n (RX, RY, SX, SY) = (";
1622 eventout +=
"\n nFWD2p = ";
1624 for (
unsigned int i = 0;
i <
FWD2nRX.size(); ++
i) {
1625 eventout +=
"\n (RX, RY, SX, SY) = (";
1675 std::string MsgLoggerCat =
"GlobalRecHitsProducer_fillMuon";
1679 eventout =
"\nGathering info:";
1686 <<
"Unable to find DTMuonGeometryRecord in event!";
1694 <<
"Unable to find dtsimHits in event!";
1698 std::map<DTWireId, edm::PSimHitContainer> simHitsPerWire =
1705 <<
"Unable to find dtRecHits in event!";
1709 std::map<DTWireId, std::vector<DTRecHit1DPair> > recHitsPerWire =
1713 int nDt =
compute(dtGeom.
product(), simHitsPerWire, recHitsPerWire, 1);
1716 eventout +=
"\n Number of DtMuonRecHits collected:........ ";
1735 <<
"Unable to find muo CSC crossingFrame in event!";
1742 hitItr !=
simHits.end(); ++hitItr)
1744 theMap[hitItr->detUnitId()].push_back(*hitItr);
1752 <<
"Unable to find CSCMuonGeometryRecord in event!";
1762 <<
"Unable to find CSC RecHits in event!";
1769 recHitItr != cscRecHits->end(); ++recHitItr) {
1771 int detId = (*recHitItr).cscDetId().rawId();
1774 std::map<int, edm::PSimHitContainer>::const_iterator mapItr =
1776 if (mapItr !=
theMap.end()) {
1777 simHits = mapItr->second;
1780 if (simHits.size() == 1) {
1793 eventout +=
"\n Number of CSCRecHits collected:........... ";
1798 std::map<double, int> mapsim, maprec;
1799 std::map<int, double> nmapsim, nmaprec;
1805 <<
"Unable to find RPCMuonGeometryRecord in event!";
1813 <<
"Unable to find RPCSimHit in event!";
1821 <<
"Unable to find RPCRecHit in event!";
1828 for (recIt = recHit->begin(); recIt != recHit->end(); ++recIt) {
1834 eventout +=
"\n Number of RPCRecHits collected:........... ";
1843 LocalPoint rhitlocal = (*recIt).localPosition();
1844 double rhitlocalx = rhitlocal.
x();
1845 maprec[rhitlocalx] = nrec;
1849 for (std::map<double,int>::iterator iter = maprec.begin();
1850 iter != maprec.end(); ++iter) {
1852 nmaprec[
i] = (*iter).first;
1855 edm::PSimHitContainer::const_iterator simIt;
1857 for (simIt = simHit->begin(); simIt != simHit->end(); simIt++) {
1858 int ptype = (*simIt).particleType();
1860 if (ptype == 13 || ptype == -13) {
1862 LocalPoint shitlocal = (*simIt).localPosition();
1863 double shitlocalx = shitlocal.
x();
1864 mapsim[shitlocalx] = nsim;
1869 for (std::map<double,int>::iterator iter = mapsim.begin();
1870 iter != mapsim.end(); ++iter) {
1872 nmapsim[
i] = (*iter).first;
1876 for (
int r = 0;
r < nsim;
r++) {
1878 RPCRHX.push_back(nmaprec[
r+1]);
1879 RPCSHX.push_back(nmapsim[
r+1]);
1884 eventout +=
"\n Number of RPCRecHits collected:........... ";
1896 std::string MsgLoggerCat =
"GlobalRecHitsProducer_storeMuon";
1901 TString eventout(
"\n nDT = ");
1902 eventout +=
DTRHD.size();
1903 for (
unsigned int i = 0;
i <
DTRHD.size(); ++
i) {
1904 eventout +=
"\n (RHD, SHD) = (";
1912 eventout +=
"\n nCSC = ";
1914 for (
unsigned int i = 0;
i <
CSCRHPHI.size(); ++
i) {
1915 eventout +=
"\n (rhphi, rhperp, shphi) = (";
1925 eventout +=
"\n nRPC = ";
1926 eventout +=
RPCRHX.size();
1927 for (
unsigned int i = 0;
i <
RPCRHX.size(); ++
i) {
1928 eventout +=
"\n (rhx, shx) = (";
1949 std::string MsgLoggerCat =
"GlobalRecHitsProducer_clear";
1953 <<
"Clearing event holders";
2106 std::pair<LocalPoint,LocalVector>
2114 LocalPoint localHit = plane.toLocal(globalpos);
2121 float scale = -localHit.
z() / dir.
z();
2133 return std::pair<LocalPoint,LocalVector>( projectedPos, localStripDir);
2137 std::map<DTWireId, std::vector<DTRecHit1DPair> >
2140 std::map<DTWireId, std::vector<DTRecHit1DPair> > ret;
2143 rechit != dt1DRecHitPairs->end(); rechit++) {
2144 ret[(*rechit).wireId()].push_back(*rechit);
2157 float xEntry = entryP.
x()-xwire;
2158 float xExit = exitP.
x()-xwire;
2161 return fabs(xEntry - (entryP.
z()*(xExit-xEntry))/(exitP.
z()-entryP.
z()));
2165 template <
typename type>
2169 const std::vector<type>& recHits,
2170 const float simHitDist) {
2172 const type* theBestRecHit =
nullptr;
2174 for(
typename std::vector<type>::const_iterator
recHit = recHits.begin();
2178 if(fabs(distTmp-simHitDist) < res) {
2179 res = fabs(distTmp-simHitDist);
2180 theBestRecHit = &(*recHit);
2184 return theBestRecHit;
2204 template <
typename type>
2212 std::map<DTWireId, std::vector<PSimHit> > simHitsPerWire = _simHitsPerWire;
2213 std::map<DTWireId, std::vector<type> > recHitsPerWire = _recHitsPerWire;
2216 for(
std::map<
DTWireId, std::vector<PSimHit> >::const_iterator wireAndSHits =
2217 simHitsPerWire.begin();
2218 wireAndSHits != simHitsPerWire.end();
2220 DTWireId wireId = (*wireAndSHits).first;
2221 std::vector<PSimHit> simHitsInCell = (*wireAndSHits).second;
2228 if (muSimHit==
nullptr) {
2235 if(simHitWireDist>2.1) {
2241 if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
2246 std::vector<type> recHits = recHitsPerWire[wireId];
2249 const type* theBestRecHit =
2256 DTRHD.push_back(recHitWireDist);
2257 DTSHD.push_back(simHitWireDist);
void putTIBL1RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
GlobalRecHitsProducer(const edm::ParameterSet &)
LocalPoint localPosition() const override
Return the 3-dimensional local position.
edm::InputTag ECalUncalEESrc_
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
T getParameter(std::string const &) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
EventNumber_t event() const
edm::EDGetTokenT< edm::PSimHitContainer > MuDTSimSrc_Token_
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::PCaloHitContainer > HCalSrc_Token_
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
const type * findBestRecHit(const DTLayer *layer, DTWireId wireId, const std::vector< type > &recHits, const float simHitDist)
float simHitDistFromWire(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
void putHFCalRecHits(const std::vector< float > &rec, const std::vector< float > &r, const std::vector< float > &she)
std::vector< PCaloHit > PCaloHitContainer
const_iterator end(bool update=false) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
TrackerHitAssociator::Config trackerHitAssociatorConfig_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > EEHits_Token_
unsigned int tibLayer(const DetId &id) const
void putHECalRecHits(const std::vector< float > &rec, const std::vector< float > &r, const std::vector< float > &she)
void putFWD1nRecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void putTOBL4RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
static const int sdHcalOut
edm::EDGetTokenT< EBUncalibratedRecHitCollection > ECalUncalEBSrc_Token_
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
void putHBCalRecHits(const std::vector< float > &rec, const std::vector< float > &r, const std::vector< float > &she)
std::pair< LocalPoint, LocalVector > projectHit(const PSimHit &hit, const StripGeomDetUnit *stripDet, const BoundPlane &plane)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< PSimHit > matched
void putTECW6RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
unsigned int pxfDisk(const DetId &id) const
void putBRL1RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void putTECW8RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void fillHCal(edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< EEUncalibratedRecHitCollection > ECalUncalEESrc_Token_
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
void putEECalRecHits(const std::vector< float > &re, const std::vector< float > &she)
void putTECW5RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
edm::EDGetTokenT< EERecHitCollection > ECalEESrc_Token_
Sin< T >::type sin(const T &t)
void putTECW7RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
Geom::Phi< T > phi() const
void putCSCRecHits(const std::vector< float > &rhphi, const std::vector< float > &rhperp, const std::vector< float > &shphi)
void putTECW2RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
constexpr uint32_t rawId() const
get the raw id
std::vector< T >::const_iterator const_iterator
void putTIDW1RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
unsigned long long EventNumber_t
virtual float strip(const LocalPoint &) const =0
void putRPCRecHits(const std::vector< float > &rhx, const std::vector< float > &shx)
void putTECW1RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
unsigned int tidWheel(const DetId &id) const
void getManyByType(std::vector< Handle< PROD >> &results) const
void storeMuon(PGlobalRecHit &)
LocalPoint localPosition() const override
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
const Plane & surface() const
The nominal surface of the GeomDet.
edm::InputTag MuRPCSimSrc_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > EBHits_Token_
void produce(edm::Event &, const edm::EventSetup &) override
void storeECal(PGlobalRecHit &)
std::map< int, edm::PSimHitContainer > theMap
void putBRL2RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
C::const_iterator const_iterator
constant access iterator type
edm::EDGetTokenT< CrossingFrame< PSimHit > > MuCSCHits_Token_
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
const DTTopology & specificTopology() const
Local3DPoint exitPoint() const
Exit point in the local Det frame.
void putTOBL1RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void putTIDW2RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
edm::InputTag SiStripSrc_
void putFWD2nRecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
const CSCChamberSpecs * specs() const
static const int sdPxlBrl
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > SiStripSrc_Token_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > ESHits_Token_
Local3DPoint localPosition() const
virtual float stripAngle(float strip) const =0
void putHOCalRecHits(const std::vector< float > &rec, const std::vector< float > &r, const std::vector< float > &she)
void putTECW3RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void putTOBL3RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void putTIBL2RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
Cos< T >::type cos(const T &t)
edm::InputTag ECalUncalEBSrc_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::map< uint32_t, float, std::less< uint32_t > > MapType
void plotResolution(const PSimHit &simHit, const CSCRecHit2D &recHit, const CSCLayer *layer, int chamberType)
const PSimHit * findMuSimHit(const edm::PSimHitContainer &hits)
Select the SimHit from a muon in a vector of SimHits.
void putEBCalRecHits(const std::vector< float > &re, const std::vector< float > &she)
void putBRL3RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
edm::InputTag MuDTSimSrc_
edm::EDGetTokenT< CSCRecHit2DCollection > MuCSCSrc_Token_
edm::EDGetTokenT< ESRecHitCollection > ECalESSrc_Token_
GlobalPoint getPosition(const DetId &id) const
edm::EDGetTokenT< DTRecHitCollection > MuDTSrc_Token_
void storeTrk(PGlobalRecHit &)
edm::EDGetTokenT< RPCRecHitCollection > MuRPCSrc_Token_
unsigned int pxbLayer(const DetId &id) const
const_iterator end() const
void putTIBL4RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
LocalVector localDirection() const
Obsolete. Same as momentumAtEntry().unit(), for backward compatibility.
int wire() const
Return the wire number.
void putESCalRecHits(const std::vector< float > &re, const std::vector< float > &she)
void putFWD1pRecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void fillMuon(edm::Event &, const edm::EventSetup &)
T const * product() const
void putDTRecHits(const std::vector< float > &rhd, const std::vector< float > &shd)
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
static const int sdHcalFwd
static const int sdHcalBrl
const_iterator find(id_type i, bool update=false) const
void storeHCal(PGlobalRecHit &)
void putTOBL2RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
~GlobalRecHitsProducer() override
ESHandle< TrackerGeometry > geometry
iterator find(key_type k)
edm::EDGetTokenT< SiPixelRecHitCollection > SiPxlSrc_Token_
static int position[264][3]
const TrackerGeomDet * idToDet(DetId) const override
unsigned int pxfSide(const DetId &id) const
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
LocalPoint localPosition() const final
LocalPoint localPosition() const override
std::vector< PSimHit > PSimHitContainer
static const int sdPxlFwd
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
DetId geographicalId() const
void fillTrk(edm::Event &, const edm::EventSetup &)
unsigned int tecWheel(const DetId &id) const
T const * product() const
int compute(const DTGeometry *dtGeom, const std::map< DTWireId, std::vector< PSimHit > > &simHitsPerWire, const std::map< DTWireId, std::vector< type > > &recHitsPerWire, int step)
Local3DPoint entryPoint() const
Entry point in the local Det frame.
edm::EDGetTokenT< edm::PSimHitContainer > MuRPCSimSrc_Token_
void putTECW4RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
static const int sdHcalEC
const CSCChamber * chamber() const
edm::EDGetTokenT< EBRecHitCollection > ECalEBSrc_Token_
void fillECal(edm::Event &, const edm::EventSetup &)
void putFWD2pRecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
const GeomDetUnit * stereoDet() const
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
const_iterator begin() const
void putTIDW3RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
unsigned int tobLayer(const DetId &id) const
void putTIBL3RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
std::map< DTWireId, std::vector< DTRecHit1DPair > > map1DRecHitsPerWire(const DTRecHitCollection *dt1DRecHitPairs)
void getAllStableProvenance(std::vector< StableProvenance const * > &provenances) const
DTWireId wireId() const
Return the wireId.