31 #include "gsl/gsl_statistics.h" 65 OL1213 = pset.
getParameter<std::vector<double> >(
"OL_1213");
168 if (type == 3 )
estimatePtDT(seg, layers, ptmean, sptmean);
180 if (ptmean < 0.) charge = -1.0;
195 double chi2_dof = 9999.0;
196 unsigned int ini_seg = 0;
198 if ( type == 5 ) ini_seg = 1;
199 for (
size_t i = ini_seg ;
i < seg.size();
i++) {
200 double dof =
static_cast<double>(seg[
i]->degreesOfFreedom());
201 if ( chi2_dof < ( seg[
i]->
chi2()/dof ) )
continue;
202 chi2_dof = seg[
i]->chi2() /
dof ;
203 best_seg =
static_cast<int>(
i);
207 if ( type==1 || type==5 || type== 4) {
213 segPos = seg[
last]->localPosition();
219 polar *= fabs(ptmean)/polar.
perp();
222 int chargeI =
static_cast<int>(
charge);
225 p_err = (sptmean*sptmean)/(polar.mag()*polar.mag()*ptmean*ptmean) ;
226 mat = seg[
last]->parametersError().similarityT( seg[last]->projectionMatrix() );
229 mat[0][0] = mat[0][0]/fabs(
tan(mom.
theta()) );
230 mat[1][1] = mat[1][1]/fabs(
tan(mom.
theta()) );
231 mat[3][3] = 2.25*mat[3][3];
232 mat[4][4] = 2.25*mat[4][4];
235 mat[0][0] = mat[0][0]/fabs(
tan(mom.
theta()) );
236 mat[1][1] = mat[1][1]/fabs(
tan(mom.
theta()) );
237 mat[2][2] = 2.25*mat[2][2];
238 mat[3][3] = 2.25*mat[3][3];
239 mat[4][4] = 2.25*mat[4][4];
241 double dh = fabs( seg[last]->globalPosition().
eta() ) - 1.6 ;
242 if ( fabs(dh) < 0.1 && type == 1 ) {
243 mat[1][1] = 4.*mat[1][1];
244 mat[2][2] = 4.*mat[2][2];
245 mat[3][3] = 9.*mat[3][3];
246 mat[4][4] = 9.*mat[4][4];
259 segPos = seg[
last]->localPosition();
270 polar *= fabs(ptmean)/polar.
perp();
273 int chargeI =
static_cast<int>(
charge);
276 p_err = (sptmean*sptmean)/(polar.mag()*polar.mag()*ptmean*ptmean) ;
277 mat = seg[
last]->parametersError().similarityT( seg[last]->projectionMatrix() );
284 float Geta = gp.
eta();
286 std::cout <<
"Type " << type <<
" Nsegments " << layers.size() <<
" ";
287 std::cout <<
"pt " << ptmean <<
" errpt " << sptmean
288 <<
" eta " << Geta <<
" charge " << charge
313 for (
unsigned l=0;
l<seg.size();
l++) {
334 unsigned size = seg.size();
335 if (size < 2)
return;
343 std::vector<double> ptEstimate;
344 std::vector<double> sptEstimate;
353 int layer0 = layers[0];
354 segPos[0] = seg[0]->globalPosition();
355 float eta = fabs( segPos[0].
eta() );
371 unsigned idx1 =
size;
375 int layer1 = layers[idx1];
376 if (layer0 == layer1)
continue;
377 segPos[1] = seg[idx1]->globalPosition();
379 double dphi = segPos[0].
phi() - segPos[1].
phi();
381 double temp_dphi = dphi;
384 if (temp_dphi < 0.) {
385 temp_dphi = -1.0*temp_dphi;
390 if (temp_dphi < 0.0001 ) {
394 ptEstimate.push_back( pt*sign );
395 sptEstimate.push_back( spt );
398 if ( layer0 == 0 && temp_dphi >= 0.0001 ) {
407 else if ( layer1 == 2 ) {
413 else if ( layer1 == 3 ) {
424 ptEstimate.push_back( pt*sign );
425 sptEstimate.push_back( spt );
439 else if ( layer1 == 3 ) {
450 ptEstimate.push_back( pt*sign );
451 sptEstimate.push_back( spt );
455 if ( layer0 == 2 && temp_dphi > 0.0001 ) {
471 ptEstimate.push_back( pt*sign );
472 sptEstimate.push_back( spt );
476 if ( layer0 == 3 && temp_dphi > 0.0001 ) {
481 ptEstimate.push_back( pt*sign );
482 sptEstimate.push_back( spt );
489 if ( !ptEstimate.empty() )
weightedPt( ptEstimate, sptEstimate, thePt, theSpt);
502 unsigned size = seg.size();
503 if (size < 2)
return;
505 std::vector<double> ptEstimate;
506 std::vector<double> sptEstimate;
515 int layer0 = layers[0];
516 segPos[0] = seg[0]->globalPosition();
517 float eta = fabs(segPos[0].
eta());
526 for (
unsigned idx1 = 1; idx1 <
size ; ++idx1 ) {
528 int layer1 = layers[idx1];
529 segPos[1] = seg[idx1]->globalPosition();
534 double dphi = segPos[0].
phi() - segPos[1].
phi();
535 double temp_dphi = dphi;
540 if (temp_dphi < 0.) {
541 temp_dphi = -temp_dphi;
545 if (temp_dphi < 0.0001 ) {
549 ptEstimate.push_back( pt*sign );
550 sptEstimate.push_back( spt );
554 if (layer0 == -1 && temp_dphi > 0.0001 ) {
564 else if (layer1 == -3) {
578 ptEstimate.push_back( pt*sign );
579 sptEstimate.push_back( spt );
583 if (layer0 == -2 && temp_dphi > 0.0001 ) {
600 ptEstimate.push_back( pt*sign );
601 sptEstimate.push_back( spt );
605 if (layer0 == -3 && temp_dphi > 0.0001 ) {
612 ptEstimate.push_back( pt*sign );
613 sptEstimate.push_back( spt );
620 if (!ptEstimate.empty() )
weightedPt( ptEstimate, sptEstimate, thePt, theSpt);
631 int size = layers.size();
637 std::vector<int> layersCSC;
639 std::vector<int> layersDT;
642 for (
unsigned j = 0; j < layers.size(); ++j ) {
643 if ( layers[j] > -1 ) {
644 segCSC.push_back(seg[j]);
645 layersCSC.push_back(layers[j]);
648 segDT.push_back(seg[j]);
649 layersDT.push_back(layers[j]);
653 std::vector<double> ptEstimate;
654 std::vector<double> sptEstimate;
657 int layer0 = layers[0];
658 segPos[0] = seg[0]->globalPosition();
659 float eta = fabs(segPos[0].
eta());
662 if ( !segDT.empty() && !segCSC.empty() ) {
663 int layer1 = layers[size-1];
664 segPos[1] = seg[size-1]->globalPosition();
666 double dphi = segPos[0].
phi() - segPos[1].
phi();
667 double temp_dphi = dphi;
672 if (temp_dphi < 0.) {
673 temp_dphi = -temp_dphi;
677 if (temp_dphi < 0.0001 ) {
681 ptEstimate.push_back( thePt*sign );
682 sptEstimate.push_back( theSpt );
686 if ( layer0 == -1 && temp_dphi > 0.0001 ) {
694 else if ( layer1 == 2) {
705 ptEstimate.push_back(thePt*sign);
706 sptEstimate.push_back(theSpt);
709 if ( layer0 == -2 && temp_dphi > 0.0001 ) {
715 ptEstimate.push_back(thePt*sign);
716 sptEstimate.push_back(theSpt);
727 if ( segDT.size() > 1 ) {
729 ptEstimate.push_back(thePt);
730 sptEstimate.push_back(theSpt);
750 if (!ptEstimate.empty() )
weightedPt( ptEstimate, sptEstimate, thePt, theSpt);
764 double eta = segPos.
eta();
769 double cosDpsi = (gv.
x()*segPos.
x() + gv.
y()*segPos.
y());
770 cosDpsi /=
sqrt(segPos.
x()*segPos.
x() + segPos.
y()*segPos.
y());
771 cosDpsi /=
sqrt(gv.
x()*gv.
x() + gv.
y()*gv.
y());
773 double axb = ( segPos.
x()*gv.
y() ) - ( segPos.
y()*gv.
x() ) ;
774 double sign = (axb < 0.) ? 1.0 : -1.0;
776 double dpsi = fabs(acos(cosDpsi)) ;
777 if ( dpsi > 1.570796 ) {
778 dpsi = 3.141592 - dpsi;
781 if (fabs(dpsi) < 0.00005) {
786 if ( layers[0] == -1 ) {
788 if ( fabs(eta) < 0.3 ) {
794 if ( fabs(eta) >= 0.3 && fabs(eta) < 0.82 ) {
800 if ( fabs(eta) >= 0.82 && fabs(eta) < 1.2 ) {
806 if ( layers[0] == 1 ) {
808 if ( fabs(eta) > 0.92 && fabs(eta) < 1.16 ) {
814 if ( fabs(eta) >= 1.16 && fabs(eta) <= 1.6 ) {
820 if ( layers[0] == 0 ) {
822 if ( fabs(eta) > 1.6 ) {
829 if ( layers[0] == -2 ) {
831 if ( fabs(eta) < 0.25 ) {
837 if ( fabs(eta) >= 0.25 && fabs(eta) < 0.72 ) {
843 if ( fabs(eta) >= 0.72 && fabs(eta) < 1.04 ) {
849 if ( layers[0] == 2 ) {
851 if ( fabs(eta) > 0.95 && fabs(eta) <= 1.6 ) {
857 if ( fabs(eta) > 1.6 && fabs(eta) < 2.45 ) {
865 if ( layers[0] == -3 ) {
867 if ( fabs(eta) <= 0.22 ) {
873 if ( fabs(eta) > 0.22 && fabs(eta) <= 0.6 ) {
879 if ( fabs(eta) > 0.6 && fabs(eta) < 0.95 ) {
885 thePt = fabs(thePt)*
sign;
886 theSpt = fabs(theSpt);
894 if ( NShowers > 2 && thePt < 300. ) {
898 if ( NShowers == 2 && NShowerSegments > 11 && thePt < 150. ) {
902 if ( NShowers == 2 && NShowerSegments <= 11 && thePt < 50. ) {
906 if ( NShowers == 1 && NShowerSegments <= 5 && thePt < 10. ) {
922 int size = ptEstimate.size();
926 thePt = ptEstimate[0];
927 theSpt = sptEstimate[0];
935 for (
unsigned j = 0; j < ptEstimate.size(); j++ ) {
937 if ( ptEstimate[j] < 0. ) {
939 charge -= 1. * (ptEstimate[j]*ptEstimate[j]) / (sptEstimate[j]*sptEstimate[j] );
941 charge += 1. * (ptEstimate[j]*ptEstimate[j]) / (sptEstimate[j]*sptEstimate[j] );
953 double weightPtSum = 0.;
954 double sigmaSqr_sum = 0.;
958 for (
unsigned j = 0; j < ptEstimate.size(); ++j ) {
962 sigmaSqr_sum += 1.0 / (sptEstimate[j]*sptEstimate[j]);
963 weightPtSum += fabs(ptEstimate[j])/(sptEstimate[j]*sptEstimate[j]);
975 thePt = (charge*weightPtSum) / sigmaSqr_sum;
976 theSpt =
sqrt( 1.0 / sigmaSqr_sum ) ;
985 double h = fabs(eta);
986 double estPt = ( vPara[0] + vPara[1]*h + vPara[2]*h*
h ) / dPhi;
987 double estSPt = ( vPara[3] + vPara[4]*h + vPara[5]*h*
h ) * estPt;
988 std::vector<double> paraPt ;
989 paraPt.push_back( estPt );
990 paraPt.push_back( estSPt ) ;
1000 double oPhi = 1./dphi ;
1001 dphi = dphi /( 1. + t1/( oPhi + 10. ) ) ;
std::vector< double > OL2213
T getParameter(std::string const &) const
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
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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
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
std::vector< double > SME11
std::vector< double > SMB11
std::vector< double > OL_1232
std::vector< double > SMB_12S
std::vector< double > SME41
std::vector< double > OL_1213
std::vector< double > SMB_22S