30 #include "gsl/gsl_statistics.h"
62 OL1213 = pset.
getParameter<std::vector<double> >(
"OL_1213");
192 double chi2_dof = 9999.0;
193 unsigned int ini_seg = 0;
197 for (
size_t i = ini_seg;
i < seg.size();
i++) {
198 double dof =
static_cast<double>(seg[
i]->degreesOfFreedom());
199 if (chi2_dof < (seg[
i]->
chi2() / dof))
201 chi2_dof = seg[
i]->chi2() /
dof;
202 best_seg =
static_cast<int>(
i);
205 if (type == 1 || type == 5 || type == 4) {
211 segPos = seg[
last]->localPosition();
217 polar *= fabs(ptmean) / polar.
perp();
220 int chargeI =
static_cast<int>(
charge);
223 p_err = (sptmean * sptmean) / (polar.mag() * polar.mag() * ptmean * ptmean);
224 mat = seg[
last]->parametersError().similarityT(seg[last]->projectionMatrix());
227 mat[0][0] = mat[0][0] / fabs(
tan(mom.
theta()));
228 mat[1][1] = mat[1][1] / fabs(
tan(mom.
theta()));
229 mat[3][3] = 2.25 * mat[3][3];
230 mat[4][4] = 2.25 * mat[4][4];
233 mat[0][0] = mat[0][0] / fabs(
tan(mom.
theta()));
234 mat[1][1] = mat[1][1] / fabs(
tan(mom.
theta()));
235 mat[2][2] = 2.25 * mat[2][2];
236 mat[3][3] = 2.25 * mat[3][3];
237 mat[4][4] = 2.25 * mat[4][4];
239 double dh = fabs(seg[last]->globalPosition().
eta()) - 1.6;
240 if (fabs(dh) < 0.1 && type == 1) {
241 mat[1][1] = 4. * mat[1][1];
242 mat[2][2] = 4. * mat[2][2];
243 mat[3][3] = 9. * mat[3][3];
244 mat[4][4] = 9. * mat[4][4];
256 segPos = seg[
last]->localPosition();
267 polar *= fabs(ptmean) / polar.
perp();
270 int chargeI =
static_cast<int>(
charge);
273 p_err = (sptmean * sptmean) / (polar.mag() * polar.mag() * ptmean * ptmean);
274 mat = seg[
last]->parametersError().similarityT(seg[last]->projectionMatrix());
281 float Geta = gp.
eta();
283 std::cout <<
"Type " << type <<
" Nsegments " << layers.size() <<
" ";
284 std::cout <<
"pt " << ptmean <<
" errpt " << sptmean <<
" eta " << Geta <<
" charge " << charge << std::endl;
306 for (
unsigned l = 0;
l < seg.size();
l++) {
325 const std::vector<int>&
layers,
328 unsigned size = seg.size();
338 std::vector<double> ptEstimate;
339 std::vector<double> sptEstimate;
348 int layer0 = layers[0];
349 segPos[0] = seg[0]->globalPosition();
350 float eta = fabs(segPos[0].
eta());
366 unsigned idx1 =
size;
370 int layer1 = layers[idx1];
371 if (layer0 == layer1)
373 segPos[1] = seg[idx1]->globalPosition();
375 double dphi = segPos[0].
phi() - segPos[1].
phi();
377 double temp_dphi = dphi;
380 if (temp_dphi < 0.) {
381 temp_dphi = -1.0 * temp_dphi;
386 if (temp_dphi < 0.0001) {
390 ptEstimate.push_back(pt * sign);
391 sptEstimate.push_back(spt);
394 if (layer0 == 0 && temp_dphi >= 0.0001) {
402 else if (layer1 == 2) {
408 else if (layer1 == 3) {
419 ptEstimate.push_back(pt * sign);
420 sptEstimate.push_back(spt);
433 else if (layer1 == 3) {
444 ptEstimate.push_back(pt * sign);
445 sptEstimate.push_back(spt);
449 if (layer0 == 2 && temp_dphi > 0.0001) {
468 ptEstimate.push_back(pt * sign);
469 sptEstimate.push_back(spt);
473 if (layer0 == 3 && temp_dphi > 0.0001) {
477 ptEstimate.push_back(pt * sign);
478 sptEstimate.push_back(spt);
484 if (!ptEstimate.empty())
485 weightedPt(ptEstimate, sptEstimate, thePt, theSpt);
495 const std::vector<int>&
layers,
498 unsigned size = seg.size();
502 std::vector<double> ptEstimate;
503 std::vector<double> sptEstimate;
512 int layer0 = layers[0];
513 segPos[0] = seg[0]->globalPosition();
514 float eta = fabs(segPos[0].
eta());
523 for (
unsigned idx1 = 1; idx1 <
size; ++idx1) {
524 int layer1 = layers[idx1];
525 segPos[1] = seg[idx1]->globalPosition();
530 double dphi = segPos[0].
phi() - segPos[1].
phi();
531 double temp_dphi = dphi;
536 if (temp_dphi < 0.) {
537 temp_dphi = -temp_dphi;
541 if (temp_dphi < 0.0001) {
545 ptEstimate.push_back(pt * sign);
546 sptEstimate.push_back(spt);
550 if (layer0 == -1 && temp_dphi > 0.0001) {
563 else if (layer1 == -3) {
584 ptEstimate.push_back(pt * sign);
585 sptEstimate.push_back(spt);
589 if (layer0 == -2 && temp_dphi > 0.0001) {
612 ptEstimate.push_back(pt * sign);
613 sptEstimate.push_back(spt);
617 if (layer0 == -3 && temp_dphi > 0.0001) {
628 ptEstimate.push_back(pt * sign);
629 sptEstimate.push_back(spt);
635 if (!ptEstimate.empty())
636 weightedPt(ptEstimate, sptEstimate, thePt, theSpt);
644 const std::vector<int>&
layers,
647 int size = layers.size();
653 std::vector<int> layersCSC;
655 std::vector<int> layersDT;
658 for (
unsigned j = 0;
j < layers.size(); ++
j) {
659 if (layers[
j] > -1) {
660 segCSC.push_back(seg[
j]);
661 layersCSC.push_back(layers[j]);
663 segDT.push_back(seg[
j]);
664 layersDT.push_back(layers[j]);
668 std::vector<double> ptEstimate;
669 std::vector<double> sptEstimate;
672 int layer0 = layers[0];
673 segPos[0] = seg[0]->globalPosition();
674 float eta = fabs(segPos[0].
eta());
677 if (!segDT.empty() && !segCSC.empty()) {
678 int layer1 = layers[size - 1];
679 segPos[1] = seg[size - 1]->globalPosition();
681 double dphi = segPos[0].
phi() - segPos[1].
phi();
682 double temp_dphi = dphi;
687 if (temp_dphi < 0.) {
688 temp_dphi = -temp_dphi;
692 if (temp_dphi < 0.0001) {
696 ptEstimate.push_back(thePt * sign);
697 sptEstimate.push_back(theSpt);
701 if (layer0 == -1 && temp_dphi > 0.0001) {
709 else if (layer1 == 2) {
720 ptEstimate.push_back(thePt * sign);
721 sptEstimate.push_back(theSpt);
724 if (layer0 == -2 && temp_dphi > 0.0001) {
730 ptEstimate.push_back(thePt * sign);
731 sptEstimate.push_back(theSpt);
742 if (segDT.size() > 1) {
744 ptEstimate.push_back(thePt);
745 sptEstimate.push_back(theSpt);
765 if (!ptEstimate.empty())
766 weightedPt(ptEstimate, sptEstimate, thePt, theSpt);
774 const std::vector<int>&
layers,
781 double eta = segPos.
eta();
786 double cosDpsi = (gv.
x() * segPos.
x() + gv.
y() * segPos.
y());
787 cosDpsi /=
sqrt(segPos.
x() * segPos.
x() + segPos.
y() * segPos.
y());
788 cosDpsi /=
sqrt(gv.
x() * gv.
x() + gv.
y() * gv.
y());
790 double axb = (segPos.
x() * gv.
y()) - (segPos.
y() * gv.
x());
791 double sign = (axb < 0.) ? 1.0 : -1.0;
793 double dpsi = fabs(acos(cosDpsi));
794 if (dpsi > 1.570796) {
795 dpsi = 3.141592 - dpsi;
798 if (fabs(dpsi) < 0.00005) {
803 if (layers[0] == -1) {
805 if (fabs(eta) < 0.3) {
811 if (fabs(eta) >= 0.3 && fabs(eta) < 0.82) {
817 if (fabs(eta) >= 0.82 && fabs(eta) < 1.2) {
823 if (layers[0] == 1) {
825 if (fabs(eta) > 0.92 && fabs(eta) < 1.16) {
831 if (fabs(eta) >= 1.16 && fabs(eta) <= 1.6) {
837 if (layers[0] == 0) {
839 if (fabs(eta) > 1.6) {
846 if (layers[0] == -2) {
848 if (fabs(eta) < 0.25) {
854 if (fabs(eta) >= 0.25 && fabs(eta) < 0.72) {
860 if (fabs(eta) >= 0.72 && fabs(eta) < 1.04) {
866 if (layers[0] == 2) {
868 if (fabs(eta) > 0.95 && fabs(eta) <= 1.6) {
874 if (fabs(eta) > 1.6 && fabs(eta) < 2.45) {
882 if (layers[0] == -3) {
884 if (fabs(eta) <= 0.22) {
890 if (fabs(eta) > 0.22 && fabs(eta) <= 0.6) {
896 if (fabs(eta) > 0.6 && fabs(eta) < 0.95) {
902 thePt = fabs(thePt) *
sign;
903 theSpt = fabs(theSpt);
910 if (NShowers > 2 && thePt < 300.) {
914 if (NShowers == 2 && NShowerSegments > 11 && thePt < 150.) {
918 if (NShowers == 2 && NShowerSegments <= 11 && thePt < 50.) {
922 if (NShowers == 1 && NShowerSegments <= 5 && thePt < 10.) {
935 const std::vector<double>& sptEstimate,
938 int size = ptEstimate.size();
942 thePt = ptEstimate[0];
943 theSpt = sptEstimate[0];
951 for (
unsigned j = 0;
j < ptEstimate.size();
j++) {
953 if (ptEstimate[
j] < 0.) {
956 charge -= 1. * (ptEstimate[
j] * ptEstimate[
j]) / (sptEstimate[
j] * sptEstimate[
j]);
959 charge += 1. * (ptEstimate[
j] * ptEstimate[
j]) / (sptEstimate[
j] * sptEstimate[
j]);
971 double weightPtSum = 0.;
972 double sigmaSqr_sum = 0.;
976 for (
unsigned j = 0;
j < ptEstimate.size(); ++
j) {
980 sigmaSqr_sum += 1.0 / (sptEstimate[
j] * sptEstimate[
j]);
981 weightPtSum += fabs(ptEstimate[
j]) / (sptEstimate[
j] * sptEstimate[
j]);
993 thePt = (charge * weightPtSum) / sigmaSqr_sum;
994 theSpt =
sqrt(1.0 / sigmaSqr_sum);
1002 double h = fabs(eta);
1003 double estPt = (vPara[0] + vPara[1] * h + vPara[2] * h *
h) / dPhi;
1004 double estSPt = (vPara[3] + vPara[4] * h + vPara[5] * h *
h) * estPt;
1005 std::vector<double> paraPt;
1006 paraPt.push_back(estPt);
1007 paraPt.push_back(estSPt);
1015 double oPhi = 1. / dphi;
1016 dphi = dphi / (1. + t1 / (oPhi + 10.));
std::vector< double > OL2213
std::vector< double > DT13_2
std::vector< double > SMB32
std::vector< double > CSC23_1
std::vector< double > SMB_30S
std::vector< double > SMB_21S
std::vector< double > DT14_2
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
std::vector< double > DT23_2
std::vector< double > DT34_1
std::vector< double > DT14_1
std::vector< double > SME_22S
std::vector< double > SMB22
std::vector< double > OL1232
std::vector< double > DT34_2
std::vector< double > CSC24
void estimatePtDT(const SegmentContainer &seg, const std::vector< int > &layers, double &pt, double &spt)
Estimate transverse momentum of track from DT measurements.
void weightedPt(const std::vector< double > &ptEstimate, const std::vector< double > &sptEstimate, double &ptAvg, double &sptAvg)
Compute weighted mean pt from different pt estimators.
std::vector< double > CSC23_2
std::vector< double > SMB20
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
std::vector< double > CSC14
std::vector< double > DT34
std::vector< double > CSC12_2
std::vector< double > CSC13_2
std::vector< double > CSC12_1
std::vector< double > SME12
std::vector< double > SME22
TrajectorySeed createSeed(int type, const SegmentContainer &seg, const std::vector< int > &layers, int NShower, int NShowerSeg)
Create a seed from set of segments.
MuonTransientTrackingRecHit::MuonRecHitContainer SegmentContainer
std::vector< double > SME21
void estimatePtOverlap(const SegmentContainer &seg, const std::vector< int > &layers, double &pt, double &spt)
Estimate transverse momentum of track from CSC + DT measurements.
std::vector< double > CSC13_3
MuonSeedCreator(const edm::ParameterSet &pset)
Constructor.
const MagneticField * BField
void estimatePtSingle(const SegmentContainer &seg, const std::vector< int > &layers, double &pt, double &spt)
Estimate transverse momentum of track from single segment.
std::vector< double > CSC34
void estimatePtCSC(const SegmentContainer &seg, const std::vector< int > &layers, double &pt, double &spt)
Estimate transverse momentum of track from CSC measurements.
std::vector< double > SME13
Geom::Theta< T > theta() const
std::vector< double > DT13
std::vector< double > CSC12_3
std::vector< double > SMB10
std::vector< double > CSC12
std::vector< double > DT12_2
std::vector< double > OL_1222
std::vector< double > OL1222
void estimatePtShowering(int &NShowers, int &NShowerSeg, double &pt, double &spt)
Estimate transverse momentum of track from showering segment.
std::vector< double > CSC23
std::vector< double > CSC13
std::vector< double > DT23_1
Tan< T >::type tan(const T &t)
std::vector< double > SMB30
std::vector< double > SMB_10S
std::vector< double > DT24_2
std::vector< double > SMB_31S
std::vector< double > SMB_32S
std::vector< double > DT12_1
std::vector< double > CSC14_3
std::vector< double > DT12
std::vector< double > SMB_20S
std::vector< double > SMB_11S
std::vector< double > OL1213
std::vector< double > getPt(const std::vector< double > &vParameters, double eta, double dPhi)
Compute pt from parameters.
CLHEP::HepVector AlgebraicVector
std::vector< double > SMB12
std::vector< double > SME_21S
T getParameter(std::string const &) const
std::vector< double > SME_12S
std::vector< double > OL2222
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
std::vector< double > SME_11S
std::vector< double > DT14
std::vector< double > DT13_1
std::vector< double > SME31
std::vector< double > DT24
std::vector< double > OL_2213
std::vector< double > DT23
std::vector< double > SME32
std::vector< double > CSC24_1
std::vector< double > SMB21
CLHEP::HepSymMatrix AlgebraicSymMatrix
std::vector< double > CSC01_1
double scaledPhi(double dphi, double t1)
Scale the dPhi from segment position.
~MuonSeedCreator()
Destructor.
std::vector< double > SME_13S
std::vector< double > OL_2222
std::vector< double > SMB31
std::vector< double > CSC03
std::vector< double > CSC02
std::vector< double > DT24_1
std::vector< double > CSC34_1
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
std::vector< double > SME11
std::vector< double > SMB11
std::vector< double > OL_1232
std::vector< double > SMB_12S
std::vector< double > SME41
tuple size
Write out results.
std::vector< double > OL_1213
std::vector< double > SMB_22S