130 std::vector<TrajectorySeed> rawSeeds;
131 std::vector<float> etaOfSeed;
132 std::vector<float> phiOfSeed;
133 std::vector<int> nSegOnSeed;
156 std::cout <<
"*** Number of DT segments is: " << DTlist4.size() + DTlist3.size() + DTlist2.size() + DTlist1.size()
158 std::cout <<
"In MB1: " << DTlist1.size() << std::endl;
159 std::cout <<
"In MB2: " << DTlist2.size() << std::endl;
160 std::cout <<
"In MB3: " << DTlist3.size() << std::endl;
161 std::cout <<
"In MB4: " << DTlist4.size() << std::endl;
194 std::cout <<
"*** Number of CSC segments is " 195 << CSClist4F.size() + CSClist3F.size() + CSClist2F.size() + CSClist1F.size() + CSClist0F.size() +
196 CSClist4B.size() + CSClist3B.size() + CSClist2B.size() + CSClist1B.size() + CSClist0B.size()
198 std::cout <<
"In ME11: " << CSClist0F.size() + CSClist0B.size() << std::endl;
199 std::cout <<
"In ME12: " << CSClist1F.size() + CSClist1B.size() << std::endl;
200 std::cout <<
"In ME2 : " << CSClist2F.size() + CSClist2B.size() << std::endl;
201 std::cout <<
"In ME3 : " << CSClist3F.size() + CSClist3B.size() << std::endl;
202 std::cout <<
"In ME4 : " << CSClist4F.size() + CSClist4B.size() << std::endl;
213 for (SegmentContainer::iterator it = DTlist1.begin(); it != DTlist1.end(); ++it) {
216 if (usedDTlist1[index] ==
true)
220 if ((*it)->dimension() != 4)
228 float eta_temp = gp.
eta();
229 float phi_temp = gp.
phi();
230 bool showeringBefore =
false;
233 showeringBefore =
true;
235 if (showeringBefore) {
241 protoTrack.push_back(*it);
244 layers.push_back(-1);
248 3, protoTrack, DTlist2, usedDTlist2, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
249 layers.push_back(-2);
253 3, protoTrack, DTlist3, usedDTlist3, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
254 layers.push_back(-3);
258 3, protoTrack, DTlist4, usedDTlist4, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
259 layers.push_back(-4);
264 if (eta_temp > 0.8) {
266 2, protoTrack, CSClist1F, usedCSClist1F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
271 2, protoTrack, CSClist2F, usedCSClist2F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
276 2, protoTrack, CSClist3F, usedCSClist3F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
280 }
else if (eta_temp < -0.8) {
282 2, protoTrack, CSClist1B, usedCSClist1B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
287 2, protoTrack, CSClist2B, usedCSClist2B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
292 2, protoTrack, CSClist3B, usedCSClist3B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
320 if (layers.size() < 2) {
323 if (layers[layers.size() - 1] > 0) {
330 rawSeeds.push_back(thisSeed);
331 etaOfSeed.push_back(eta_temp);
332 phiOfSeed.push_back(phi_temp);
333 nSegOnSeed.push_back(protoTrack.size());
336 usedDTlist1[
index] =
true;
341 for (SegmentContainer::iterator it = DTlist2.begin(); it != DTlist2.end(); ++it) {
344 if (usedDTlist2[index] ==
true)
348 if ((*it)->dimension() != 4)
356 float eta_temp = gp.
eta();
357 float phi_temp = gp.
phi();
358 bool showeringBefore =
false;
361 showeringBefore =
true;
363 if (showeringBefore) {
369 protoTrack.push_back(*it);
372 layers.push_back(-2);
376 3, protoTrack, DTlist3, usedDTlist3, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
377 layers.push_back(-3);
381 3, protoTrack, DTlist4, usedDTlist4, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
382 layers.push_back(-4);
387 if (eta_temp > 0.8) {
389 2, protoTrack, CSClist1F, usedCSClist1F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
394 2, protoTrack, CSClist2F, usedCSClist2F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
399 2, protoTrack, CSClist3F, usedCSClist3F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
403 }
else if (eta_temp < -0.8) {
405 2, protoTrack, CSClist1B, usedCSClist1B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
410 2, protoTrack, CSClist2B, usedCSClist2B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
415 2, protoTrack, CSClist3B, usedCSClist3B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
443 if (layers.size() < 2) {
446 if (layers[layers.size() - 1] > 0) {
453 rawSeeds.push_back(thisSeed);
454 etaOfSeed.push_back(eta_temp);
455 phiOfSeed.push_back(phi_temp);
456 nSegOnSeed.push_back(protoTrack.size());
459 usedDTlist2[
index] =
true;
464 for (SegmentContainer::iterator it = DTlist3.begin(); it != DTlist3.end(); ++it) {
467 if (usedDTlist3[index] ==
true)
471 if ((*it)->dimension() != 4)
479 float eta_temp = gp.
eta();
480 float phi_temp = gp.
phi();
481 bool showeringBefore =
false;
484 showeringBefore =
true;
486 if (showeringBefore) {
492 protoTrack.push_back(*it);
495 layers.push_back(-3);
499 3, protoTrack, DTlist4, usedDTlist4, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
500 layers.push_back(-4);
505 if (eta_temp > 0.8) {
507 2, protoTrack, CSClist1F, usedCSClist1F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
512 2, protoTrack, CSClist2F, usedCSClist2F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
517 2, protoTrack, CSClist3F, usedCSClist3F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
521 }
else if (eta_temp < -0.8) {
523 2, protoTrack, CSClist1B, usedCSClist1B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
528 2, protoTrack, CSClist2B, usedCSClist2B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
533 2, protoTrack, CSClist3B, usedCSClist3B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
560 if (layers.size() < 2) {
563 if (layers[layers.size() - 1] > 0) {
571 rawSeeds.push_back(thisSeed);
572 etaOfSeed.push_back(eta_temp);
573 phiOfSeed.push_back(phi_temp);
574 nSegOnSeed.push_back(protoTrack.size());
577 usedDTlist3[
index] =
true;
589 for (SegmentContainer::iterator it = CSClist0B.begin(); it != CSClist0B.end(); ++it) {
592 if (usedCSClist0B[index] ==
true)
602 float eta_temp = gp.
eta();
603 float phi_temp = gp.
phi();
604 bool showeringBefore =
false;
607 showeringBefore =
true;
609 if (showeringBefore) {
615 protoTrack.push_back(*it);
622 1, protoTrack, CSClist1B, usedCSClist1B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
627 1, protoTrack, CSClist2B, usedCSClist2B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
632 1, protoTrack, CSClist3B, usedCSClist3B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
637 1, protoTrack, CSClist4B, usedCSClist4B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
655 if (layers.size() < 2) {
658 if (fabs(gp.
eta()) > 1.7) {
666 rawSeeds.push_back(thisSeed);
667 etaOfSeed.push_back(eta_temp);
668 phiOfSeed.push_back(phi_temp);
669 nSegOnSeed.push_back(protoTrack.size());
672 usedCSClist0B[
index] =
true;
677 for (SegmentContainer::iterator it = CSClist1B.begin(); it != CSClist1B.end(); ++it) {
680 if (usedCSClist1B[index] ==
true)
690 float eta_temp = gp.
eta();
691 float phi_temp = gp.
phi();
692 bool showeringBefore =
false;
695 showeringBefore =
true;
697 if (showeringBefore) {
703 protoTrack.push_back(*it);
710 1, protoTrack, CSClist2B, usedCSClist2B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
715 1, protoTrack, CSClist3B, usedCSClist3B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
720 1, protoTrack, CSClist4B, usedCSClist4B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
738 if (layers.size() < 2) {
744 rawSeeds.push_back(thisSeed);
745 etaOfSeed.push_back(eta_temp);
746 phiOfSeed.push_back(phi_temp);
747 nSegOnSeed.push_back(protoTrack.size());
750 usedCSClist1B[
index] =
true;
755 for (SegmentContainer::iterator it = CSClist2B.begin(); it != CSClist2B.end(); ++it) {
758 if (usedCSClist2B[index] ==
true)
763 double dof =
static_cast<double>((*it)->degreesOfFreedom());
764 if (((*it)->chi2() /
dof) > 20000.0)
769 float eta_temp = gp.
eta();
770 float phi_temp = gp.
phi();
771 bool showeringBefore =
false;
774 showeringBefore =
true;
776 if (showeringBefore) {
782 protoTrack.push_back(*it);
789 1, protoTrack, CSClist3B, usedCSClist3B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
794 1, protoTrack, CSClist4B, usedCSClist4B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
812 if (layers.size() < 2) {
819 rawSeeds.push_back(thisSeed);
820 etaOfSeed.push_back(eta_temp);
821 phiOfSeed.push_back(phi_temp);
822 nSegOnSeed.push_back(protoTrack.size());
824 usedCSClist2B[
index] =
true;
829 for (SegmentContainer::iterator it = CSClist3B.begin(); it != CSClist3B.end(); ++it) {
832 if (usedCSClist3B[index] ==
true)
837 double dof =
static_cast<double>((*it)->degreesOfFreedom());
838 if (((*it)->chi2() /
dof) > 20000.0)
843 float eta_temp = gp.
eta();
844 float phi_temp = gp.
phi();
845 bool showeringBefore =
false;
848 showeringBefore =
true;
850 if (showeringBefore) {
856 protoTrack.push_back(*it);
863 1, protoTrack, CSClist4B, usedCSClist4B, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
881 usedCSClist3B[
index] =
true;
883 if (layers.size() < 2)
888 rawSeeds.push_back(thisSeed);
889 etaOfSeed.push_back(eta_temp);
890 phiOfSeed.push_back(phi_temp);
891 nSegOnSeed.push_back(protoTrack.size());
902 for (SegmentContainer::iterator it = CSClist0F.begin(); it != CSClist0F.end(); ++it) {
905 if (usedCSClist0F[index] ==
true)
915 float eta_temp = gp.
eta();
916 float phi_temp = gp.
phi();
917 bool showeringBefore =
false;
920 showeringBefore =
true;
922 if (showeringBefore) {
928 protoTrack.push_back(*it);
935 1, protoTrack, CSClist1F, usedCSClist1F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
940 1, protoTrack, CSClist2F, usedCSClist2F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
945 1, protoTrack, CSClist3F, usedCSClist3F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
950 1, protoTrack, CSClist4F, usedCSClist4F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
968 if (layers.size() < 2) {
971 if (fabs(gp.
eta()) > 1.7) {
978 rawSeeds.push_back(thisSeed);
979 etaOfSeed.push_back(eta_temp);
980 phiOfSeed.push_back(phi_temp);
981 nSegOnSeed.push_back(protoTrack.size());
984 usedCSClist0F[
index] =
true;
989 for (SegmentContainer::iterator it = CSClist1F.begin(); it != CSClist1F.end(); ++it) {
992 if (usedCSClist1F[index] ==
true)
1002 float eta_temp = gp.
eta();
1003 float phi_temp = gp.
phi();
1004 bool showeringBefore =
false;
1007 showeringBefore =
true;
1009 if (showeringBefore) {
1015 protoTrack.push_back(*it);
1018 layers.push_back(1);
1022 1, protoTrack, CSClist2F, usedCSClist2F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
1023 layers.push_back(2);
1024 if (showeringBefore)
1027 1, protoTrack, CSClist3F, usedCSClist3F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
1028 layers.push_back(3);
1029 if (showeringBefore)
1032 1, protoTrack, CSClist4F, usedCSClist4F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
1033 layers.push_back(4);
1034 if (showeringBefore)
1050 if (layers.size() < 2) {
1057 rawSeeds.push_back(thisSeed);
1058 etaOfSeed.push_back(eta_temp);
1059 phiOfSeed.push_back(phi_temp);
1060 nSegOnSeed.push_back(protoTrack.size());
1063 usedCSClist1F[
index] =
true;
1068 for (SegmentContainer::iterator it = CSClist2F.begin(); it != CSClist2F.end(); ++it) {
1071 if (usedCSClist2F[index] ==
true)
1076 double dof =
static_cast<double>((*it)->degreesOfFreedom());
1077 if (((*it)->chi2() /
dof) > 20000.0)
1082 float eta_temp = gp.
eta();
1083 float phi_temp = gp.
phi();
1084 bool showeringBefore =
false;
1087 showeringBefore =
true;
1089 if (showeringBefore) {
1095 protoTrack.push_back(*it);
1098 layers.push_back(2);
1102 1, protoTrack, CSClist3F, usedCSClist3F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
1103 layers.push_back(3);
1104 if (showeringBefore)
1107 1, protoTrack, CSClist4F, usedCSClist4F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
1108 layers.push_back(4);
1109 if (showeringBefore)
1125 if (layers.size() < 2) {
1132 rawSeeds.push_back(thisSeed);
1133 etaOfSeed.push_back(eta_temp);
1134 phiOfSeed.push_back(phi_temp);
1135 nSegOnSeed.push_back(protoTrack.size());
1138 usedCSClist2F[
index] =
true;
1143 for (SegmentContainer::iterator it = CSClist3F.begin(); it != CSClist3F.end(); ++it) {
1146 if (usedCSClist3F[index] ==
true)
1151 double dof =
static_cast<double>((*it)->degreesOfFreedom());
1152 if (((*it)->chi2() /
dof) > 20000.0)
1157 float eta_temp = gp.
eta();
1158 float phi_temp = gp.
phi();
1159 bool showeringBefore =
false;
1162 showeringBefore =
true;
1164 if (showeringBefore) {
1170 protoTrack.push_back(*it);
1173 layers.push_back(2);
1177 1, protoTrack, CSClist4F, usedCSClist4F, eta_temp, phi_temp, layers[layers.size() - 1], showeringBefore))
1178 layers.push_back(4);
1179 if (showeringBefore)
1195 usedCSClist3F[
index] =
true;
1197 if (layers.size() < 2)
1203 rawSeeds.push_back(thisSeed);
1204 etaOfSeed.push_back(eta_temp);
1205 phiOfSeed.push_back(phi_temp);
1206 nSegOnSeed.push_back(protoTrack.size());
1214 std::cout <<
"*** CLEAN UP " << std::endl;
1216 std::cout <<
"Number of seeds BEFORE " << rawSeeds.size() << std::endl;
1221 goodSeeds = theSeeds.size();
1227 std::cout <<
"Number of seeds AFTER " << goodSeeds << std::endl;
1248 bool& showeringBefore) {
1250 int scanlayer = (lastLayer < 0) ? (lastLayer - 1) : (lastLayer + 1);
1253 showeringBefore =
true;
1264 if (lastLayer == 0 || lastLayer == 1) {
1265 if (fabs(eta_last) < 2.1) {
1270 }
else if (lastLayer == 2) {
1276 }
else if (type == 2) {
1279 if (lastLayer == -1) {
1288 if (lastLayer == -1) {
1290 }
else if (lastLayer == -2) {
1298 if (showeringBefore && maxdPhi > 0.03)
1301 showeringBefore =
false;
1304 float eta_temp = eta_last;
1305 float phi_temp = phi_last;
1309 int best_match =
index;
1310 float best_R =
sqrt((maxdEta * maxdEta) + (maxdPhi * maxdPhi));
1311 float best_chi2 = 200;
1312 int best_dimension = 2;
1317 for (SegmentContainer::iterator it = segs.begin(); it != segs.end(); ++it) {
1323 double dh = fabs(gp2.
eta() - eta_temp);
1324 double df = fabs(gp2.
phi() - phi_temp);
1325 double dR =
sqrt((dh * dh) + (df * df));
1328 bool case1 = (dh < maxdEta && df < maxdPhi) ?
true :
false;
1330 bool case2 = (((*it)->dimension() != 4) && (dh < 0.5) && (df < maxdPhi)) ?
true :
false;
1331 if (!case1 && !case2)
1336 if (NRechits < best_nhits)
1338 best_nhits = NRechits;
1341 if ((*it)->dimension() < best_dimension)
1343 best_dimension = (*it)->dimension();
1350 double dof =
static_cast<double>((*it)->degreesOfFreedom());
1352 if ((*it)->chi2() / dof < 0.001 && NRechits < 6 && type == 1)
1354 if ((*it)->chi2() / dof > best_chi2)
1356 best_chi2 = (*it)->chi2() /
dof;
1359 if ((*it)->dimension() != 4) {
1365 phi_last = gp2.
phi();
1366 eta_last = gp2.
eta();
1375 for (SegmentContainer::iterator it = segs.begin(); it != segs.end(); ++it) {
1377 if (index != best_match)
1379 protoTrack.push_back(*it);
1380 usedSeg[best_match] =
true;
1391 int& NShoweringSegments) {
1392 bool showering =
false;
1396 double nChi2 = 9999.;
1398 std::vector<int> badtag;
1400 double aveEta = 0.0;
1401 for (SegmentContainer::iterator it = segs.begin(); it != segs.end(); ++it) {
1404 double dh = gp.
eta() - eta_last;
1405 double df = gp.
phi() - phi_last;
1406 double dR =
sqrt((dh * dh) + (df * df));
1408 double dof =
static_cast<double>((*it)->degreesOfFreedom());
1409 double nX2 = (*it)->chi2() /
dof;
1412 DetId geoId = (*it)->geographicalId();
1418 badtag.push_back(index);
1419 aveEta += fabs(gp.
eta());
1422 if (rh < 6 && !isDT)
1424 if (rh < 12 && isDT)
1430 if (layer != 0 && layer != 1 && layer != -1) {
1436 aveEta = aveEta /
static_cast<double>(nSeg);
1437 bool isME11A = (aveEta >= 2.1 && layer == 0) ?
true :
false;
1438 bool isME12 = (aveEta > 1.2 && aveEta <= 1.65 && layer == 1) ?
true :
false;
1439 bool isME11 = (aveEta > 1.65 && aveEta <= 2.1 && layer == 0) ?
true :
false;
1440 bool is1stLayer = (layer == -1 || layer == 0 || isME12 || isME11 || isME11A) ?
true :
false;
1442 NShoweringSegments += nSeg;
1444 if (nSeg > 3 && !isME11A)
1446 if (nSeg > 6 && isME11A)
1451 if (showering && !is1stLayer) {
1452 for (std::vector<int>::iterator it = badtag.begin(); it != badtag.end(); ++it) {
1453 usedSeg[*it] =
true;
1454 if ((*it) != theOrigin)
1464 double dHdTheta = 0.0;
1465 double dThetadR = 0.0;
1466 double etaErr = 1.0;
1468 if (gp.
perp() != 0) {
1469 dHdTheta = (gp.
mag() + gp.
z()) / gp.
perp();
1470 dThetadR = gp.
z() / gp.
perp2();
1471 etaErr = 0.25 * (dHdTheta * dThetadR) * (dHdTheta * dThetadR) * rErr;
bool debug
group the seeds
T getParameter(std::string const &) const
double etaError(const GlobalPoint gp, double rErr)
calculate the eta error from global R error
#define case2(par1, par2)
MuonTransientTrackingRecHit::MuonRecHitContainer SegmentContainer
SegmentContainer ShoweringSegments
float maxPhiResolutionCSC
bool IdentifyShowering(SegmentContainer &segs, BoolContainer &usedSeg, float &eta_last, float &phi_last, int layer, int &NShoweringSegments)
identify the showering layer
int build(edm::Event &event, const edm::EventSetup &eventSetup, TrajectorySeedCollection &seeds)
Build seed collection.
bool foundMatchingSegment(int type, SegmentContainer &protoTrack, SegmentContainer &segments, BoolContainer &usedSeg, float &eta_temp, float &phi_temp, int &lastLayer, bool &showeringBefore)
Find segment which matches protoTrack for endcap only.
Geom::Phi< T > phi() const
TrajectorySeed createSeed(int type, const SegmentContainer &seg, const std::vector< int > &layers, int NShower, int NShowerSeg)
Create a seed from set of segments.
bool isDT(GeomDetEnumerators::SubDetector m)
MuonDetLayerMeasurements * muonMeasurements
MuonSeedCleaner * muonSeedClean_
const MagneticField * BField
edm::InputTag theCSCSegmentLabel
Name of the CSC segment collection.
std::deque< bool > BoolContainer
edm::InputTag theDTSegmentLabel
Name of the DT segment collection.
std::vector< int > ShoweringLayers
std::vector< TrajectorySeed > TrajectorySeedCollection
MuonRecHitContainer recHits(const DetLayer *layer, const edm::Event &iEvent)
returns the rechits which are on the layer
bool enableCSCMeasurement
void setBField(const MagneticField *theField)
Cache Magnetic Field for current event.
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
int NRecHitsFromSegment(const TrackingRecHit &rhit)
const std::vector< const DetLayer * > & allDTLayers() const
return the DT DetLayers (barrel), inside-out
const std::vector< const DetLayer * > & forwardCSCLayers() const
return the forward (+Z) CSC DetLayers, inside-out
float maxEtaResolutionCSC
MuonSeedBuilder(const edm::ParameterSet &, edm::ConsumesCollector &)
Constructor.
MuonServiceProxy * theService
~MuonSeedBuilder()
Destructor.
std::vector< TrajectorySeed > seedCleaner(const edm::EventSetup &eventSetup, std::vector< TrajectorySeed > &seeds)
Cache pointer to geometry.
const std::vector< const DetLayer * > & backwardCSCLayers() const
return the backward (-Z) CSC DetLayers, inside-out
MuonSeedCreator * muonSeedCreate_
Create seed according to region (CSC, DT, Overlap)
const MuonDetLayerGeometry * muonLayers