92 LogTrace(
"CSCSegAlgoST") <<
"[CSCSegAlgoST::run] Start building segments in chamber " <<
theChamber->
id();
95 std::vector<CSCSegment> segments_temp;
96 std::vector<CSCSegment> segments;
97 std::vector<ChamberHitContainer> rechits_clusters;
102 for(
int a = 0;
a<5; ++
a) {
103 for(
int b = 0;
b<5; ++
b) {
134 for(std::vector<ChamberHitContainer>::iterator sub_rechits = rechits_clusters.begin(); sub_rechits != rechits_clusters.end(); ++sub_rechits ) {
136 segments_temp.clear();
140 segments.insert( segments.end(), segments_temp.begin(), segments_temp.end() );
144 segments_temp.clear();
147 segments.swap(segments_temp);
160 segments_temp.clear();
163 segments.swap(segments_temp);
187 std::vector<CSCSegment> segments_temp;
188 std::vector<ChamberHitContainer> rechits_clusters;
194 int hit_nr_worst = -1;
197 for(std::vector<CSCSegment>::iterator it=segments.begin(); it != segments.end(); ++it) {
202 if( !use_brute_force ) {
204 float chisq = (*it).chi2();
205 int nhits = (*it).nRecHits();
212 globZ = globalPosition.
z();
218 std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
219 std::vector<CSCRecHit2D>::const_iterator iRH_worst;
222 float xdist_local_worst_sig = -99999.;
223 float xdist_local_2ndworst_sig = -99999.;
224 float xdist_local_sig = -99999.;
230 for ( std::vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); ++iRH) {
235 float loc_x_at_target;
244 LocalPoint localPositionRH = (*iRH).localPosition();
247 LocalError rerrlocal = (*iRH).localPositionError();
248 float xxerr = rerrlocal.
xx();
250 float target_z = globalPositionRH.
z();
253 loc_x_at_target = localPos.
x() + (segDir.
x()/fabs(segDir.
z())*( target_z - globZ ));
258 loc_x_at_target = localPos.
x() + ((-1)*segDir.
x()/fabs(segDir.
z())*( target_z - globZ ));
265 xdist_local_sig = fabs((localPositionRH.
x() -loc_x_at_target)/(xxerr));
267 if( xdist_local_sig > xdist_local_worst_sig ) {
268 xdist_local_2ndworst_sig = xdist_local_worst_sig;
269 xdist_local_worst_sig = xdist_local_sig;
272 hit_nr_worst = hit_nr;
274 else if(xdist_local_sig > xdist_local_2ndworst_sig) {
275 xdist_local_2ndworst_sig = xdist_local_sig;
284 if ( xdist_local_worst_sig / xdist_local_2ndworst_sig < 1.5 ) {
294 std::vector< CSCRecHit2D > buffer;
295 std::vector< std::vector< CSCRecHit2D > > reduced_segments;
296 std::vector< CSCRecHit2D > theseRecHits = (*it).specificRecHits();
297 float best_red_seg_prob = 0.0;
301 if(
ChiSquaredProbability((
double)(*it).chi2(),(double)((2*(*it).nRecHits())-4)) < chi2ndfProbMin ) {
303 buffer = theseRecHits;
307 if( use_brute_force ) {
308 for(
size_t bi = 0; bi < buffer.size(); ++bi) {
309 reduced_segments.push_back(buffer);
310 reduced_segments[bi].erase(reduced_segments[bi].
begin()+(bi),reduced_segments[bi].
begin()+(bi+1));
315 if( hit_nr_worst >= 0 && hit_nr_worst <=
int(buffer.size()) ) {
317 buffer.erase(buffer.begin()+(hit_nr_worst),buffer.begin()+(hit_nr_worst+1));
318 reduced_segments.push_back(buffer);
322 reduced_segments.push_back(buffer);
328 for(
size_t iSegment=0; iSegment<reduced_segments.size(); ++iSegment) {
331 for(
size_t m = 0;
m<reduced_segments[iSegment].size(); ++
m ) {
369 double oldchi2 = (*it).
chi2();
370 double olddof = 2 * (*it).nRecHits() - 4;
371 double newchi2 =
temp.chi2();
372 double newdof = 2 *
temp.nRecHits() - 4;
399 std::vector<ChamberHitContainer> rechits_clusters;
405 float dXclus_box = 0.0;
406 float dYclus_box = 0.0;
408 std::vector<const CSCRecHit2D*>
temp;
410 std::vector< ChamberHitContainer > seeds;
412 std::vector<float> running_meanX;
413 std::vector<float> running_meanY;
415 std::vector<float> seed_minX;
416 std::vector<float> seed_maxX;
417 std::vector<float> seed_minY;
418 std::vector<float> seed_maxY;
427 for(
unsigned int i = 0;
i < rechits.size(); ++
i) {
431 temp.push_back(rechits[
i]);
433 seeds.push_back(temp);
438 running_meanX.push_back( rechits[i]->localPosition().
x() );
439 running_meanY.push_back( rechits[i]->localPosition().
y() );
442 seed_minX.push_back( rechits[i]->localPosition().
x() );
443 seed_maxX.push_back( rechits[i]->localPosition().
x() );
444 seed_minY.push_back( rechits[i]->localPosition().
y() );
445 seed_maxY.push_back( rechits[i]->localPosition().
y() );
450 for(
size_t NNN = 0; NNN < seeds.size(); ++NNN) {
452 for(
size_t MMM = NNN+1; MMM < seeds.size(); ++MMM) {
453 if(running_meanX[MMM] == 999999. || running_meanX[NNN] == 999999. ) {
454 LogTrace(
"CSCSegment|CSC") <<
"[CSCSegAlgoST::clusterHits] ALARM! Skipping used seeds, this should not happen - inform CSC DPG";
464 if ( running_meanX[NNN] > running_meanX[MMM] ) dXclus_box = seed_minX[NNN] - seed_maxX[MMM];
465 else dXclus_box = seed_minX[MMM] - seed_maxX[NNN];
466 if ( running_meanY[NNN] > running_meanY[MMM] ) dYclus_box = seed_minY[NNN] - seed_maxY[MMM];
467 else dYclus_box = seed_minY[MMM] - seed_maxY[NNN];
475 running_meanX[MMM] = (running_meanX[NNN]*seeds[NNN].size() + running_meanX[MMM]*seeds[MMM].size()) / (seeds[NNN].
size()+seeds[MMM].size());
476 running_meanY[MMM] = (running_meanY[NNN]*seeds[NNN].size() + running_meanY[MMM]*seeds[MMM].size()) / (seeds[NNN].
size()+seeds[MMM].size());
479 if ( seed_minX[NNN] <= seed_minX[MMM] ) seed_minX[MMM] = seed_minX[NNN];
480 if ( seed_maxX[NNN] > seed_maxX[MMM] ) seed_maxX[MMM] = seed_maxX[NNN];
481 if ( seed_minY[NNN] <= seed_minY[MMM] ) seed_minY[MMM] = seed_minY[NNN];
482 if ( seed_maxY[NNN] > seed_maxY[MMM] ) seed_maxY[MMM] = seed_maxY[NNN];
485 seeds[MMM].insert(seeds[MMM].
end(),seeds[NNN].
begin(),seeds[NNN].
end());
488 running_meanX[NNN] = 999999.;
489 running_meanY[NNN] = 999999.;
501 for(
size_t NNN = 0; NNN < seeds.size(); ++NNN) {
502 if(running_meanX[NNN] == 999999.)
continue;
503 rechits_clusters.push_back(seeds[NNN]);
508 return rechits_clusters;
514 std::vector<ChamberHitContainer> rechits_chains;
517 std::vector<const CSCRecHit2D*>
temp;
519 std::vector< ChamberHitContainer > seeds;
521 std::vector <bool> usedCluster;
527 for(
unsigned int i = 0;
i < rechits.size(); ++
i) {
529 temp.push_back(rechits[
i]);
530 seeds.push_back(temp);
531 usedCluster.push_back(
false);
534 bool gangedME11a =
false;
540 for(
size_t NNN = 0; NNN < seeds.size(); ++NNN) {
541 for(
size_t MMM = NNN+1; MMM < seeds.size(); ++MMM) {
542 if(usedCluster[MMM] || usedCluster[NNN]){
556 bool goodToMerge =
isGoodToMerge(gangedME11a, seeds[NNN], seeds[MMM]);
562 seeds[MMM].insert(seeds[MMM].
end(),seeds[NNN].
begin(),seeds[NNN].
end());
565 usedCluster[NNN] =
true;
578 for(
size_t NNN = 0; NNN < seeds.size(); ++NNN) {
579 if(usedCluster[NNN])
continue;
580 rechits_chains.push_back(seeds[NNN]);
585 return rechits_chains;
589 for(
size_t iRH_new = 0;iRH_new<newChain.size();++iRH_new){
590 int layer_new = newChain[iRH_new]->cscDetId().layer()-1;
591 int middleStrip_new = newChain[iRH_new]->nStrips()/2;
592 int centralStrip_new = newChain[iRH_new]->channels(middleStrip_new);
593 int centralWire_new = newChain[iRH_new]->hitWire();
594 bool layerRequirementOK =
false;
595 bool stripRequirementOK =
false;
596 bool wireRequirementOK =
false;
597 bool goodToMerge =
false;
598 for(
size_t iRH_old = 0;iRH_old<oldChain.size();++iRH_old){
599 int layer_old = oldChain[iRH_old]->cscDetId().layer()-1;
600 int middleStrip_old = oldChain[iRH_old]->nStrips()/2;
601 int centralStrip_old = oldChain[iRH_old]->channels(middleStrip_old);
602 int centralWire_old = oldChain[iRH_old]->hitWire();
611 if(layer_new==layer_old+1 || layer_new==layer_old-1 ||
612 layer_new==layer_old+2 || layer_new==layer_old-2 ||
613 layer_new==layer_old+3 || layer_new==layer_old-3 ||
614 layer_new==layer_old+4 || layer_new==layer_old-4 ){
615 layerRequirementOK =
true;
621 if(centralStrip_new==centralStrip_old ||
622 centralStrip_new==centralStrip_old+1 || centralStrip_new==centralStrip_old-1 ||
623 centralStrip_new==centralStrip_old+2 || centralStrip_new==centralStrip_old-2){
624 stripRequirementOK =
true;
627 if(centralWire_new==centralWire_old ||
628 centralWire_new==centralWire_old+1 || centralWire_new==centralWire_old-1 ||
629 centralWire_new==centralWire_old+2 || centralWire_new==centralWire_old-2){
630 wireRequirementOK =
true;
634 if(centralStrip_new==centralStrip_old+1-allStrips || centralStrip_new==centralStrip_old-1-allStrips ||
635 centralStrip_new==centralStrip_old+2-allStrips || centralStrip_new==centralStrip_old-2-allStrips ||
636 centralStrip_new==centralStrip_old+1+allStrips || centralStrip_new==centralStrip_old-1+allStrips ||
637 centralStrip_new==centralStrip_old+2+allStrips || centralStrip_new==centralStrip_old-2+allStrips){
638 stripRequirementOK =
true;
641 if(layerRequirementOK && stripRequirementOK && wireRequirementOK){
653 double CSCSegAlgoST::theWeight(
double coordinate_1,
double coordinate_2,
double coordinate_3,
float layer_1,
float layer_2,
float layer_3) {
654 double sub_weight = 0;
656 ( (coordinate_2 - coordinate_3) / (layer_2 - layer_3) ) -
657 ( (coordinate_1 - coordinate_2) / (layer_1 - layer_2) )
669 std::vector<CSCSegment> segmentInChamber;
670 segmentInChamber.clear();
673 unsigned int thering = 999;
674 unsigned int thestation = 999;
677 std::vector<int> hits_onLayerNumber(6);
682 for(
int iarray = 0; iarray <6; ++iarray) {
684 hits_onLayerNumber[iarray] = 0;
727 int midlayer_pointer[6] = {0,0,2,3,3,4};
730 int n_layers_occupied_tot = 0;
731 int n_layers_processed = 0;
733 float min_weight_A = 99999.9;
734 float min_weight_noLx_A = 99999.9;
743 int best_noLx_pseg = -1;
744 int best_Layer_noLx = -1;
757 for(
size_t M = 0; M < rechits.size(); ++M) {
759 hits_onLayerNumber[ rechits[M]->cscDetId().layer()-1 ] += 1;
760 if(hits_onLayerNumber[ rechits[M]->cscDetId().layer()-1 ] == 1 ) n_layers_occupied_tot += 1;
762 PAhits_onLayer[rechits[M]->cscDetId().layer()-1] .push_back(rechits[M]);
773 for(
size_t i = 0;
i< hits_onLayerNumber.size(); ++
i){
775 tothits += hits_onLayerNumber[
i];
776 if (hits_onLayerNumber[
i] > maxhits) {
777 nextlayer = maxlayer;
780 maxhits = hits_onLayerNumber[
i];
782 else if (hits_onLayerNumber[
i] > nexthits) {
784 nexthits = hits_onLayerNumber[
i];
789 if (tothits > (
int)UpperLimit) {
790 if (n_layers_occupied_tot > 4) {
791 tothits = tothits - hits_onLayerNumber[maxlayer];
792 n_layers_occupied_tot = n_layers_occupied_tot - 1;
794 hits_onLayerNumber[maxlayer] = 0;
798 if (tothits > (
int)UpperLimit) {
799 if (n_layers_occupied_tot > 4) {
800 tothits = tothits - hits_onLayerNumber[nextlayer];
801 n_layers_occupied_tot = n_layers_occupied_tot - 1;
803 hits_onLayerNumber[nextlayer] = 0;
807 if (tothits > (
int)UpperLimit){
816 if ( segShower.
nRecHits() < 3 )
return segmentInChamber;
817 if ( segShower.
chi2() == -1 )
return segmentInChamber;
818 segmentInChamber.push_back(segShower);
819 return segmentInChamber;
824 CSCDetId id = rechits[0]->cscDetId();
825 edm::LogVerbatim(
"CSCSegment|CSC") <<
"[CSCSegAlgoST::buildSegments] No. of rechits in the cluster/chamber > " 826 << UpperLimit <<
" ... Segment finding canceled in CSC" <<
id;
827 return segmentInChamber;
834 if( rechits.size() > 0 ) {
835 thering = rechits[0]->cscDetId().ring();
836 thestation = rechits[0]->cscDetId().station();
844 return segmentInChamber;
851 for(
int layer = 0; layer < 6; ++layer) {
861 n_layers_processed += 1;
865 int orig_number_of_psegs =
Psegments.size();
877 if( orig_number_of_psegs == 0 ) {
915 if( orig_number_of_noL1_psegs == 0 ) {
936 for(
int pseg = 0; pseg < orig_number_of_psegs; ++pseg ) {
938 int pseg_pos = (pseg)+((
hit)*orig_number_of_psegs);
939 int pseg_noL1_pos = (pseg)+((
hit)*orig_number_of_noL1_psegs);
940 int pseg_noL2_pos = (pseg)+((
hit)*orig_number_of_noL2_psegs);
941 int pseg_noL3_pos = (pseg)+((
hit)*orig_number_of_noL3_psegs);
942 int pseg_noL4_pos = (pseg)+((
hit)*orig_number_of_noL4_psegs);
943 int pseg_noL5_pos = (pseg)+((
hit)*orig_number_of_noL5_psegs);
944 int pseg_noL6_pos = (pseg)+((
hit)*orig_number_of_noL6_psegs);
970 if (n_layers_processed != 2 && pseg < orig_number_of_noL1_psegs)
curv_noL1_A.push_back(
curv_noL1_A[ pseg_noL1_pos ]);
971 if (n_layers_processed != 2 && pseg < orig_number_of_noL2_psegs)
curv_noL2_A.push_back(
curv_noL2_A[ pseg_noL2_pos ]);
972 if (n_layers_processed != 3 && pseg < orig_number_of_noL3_psegs)
curv_noL3_A.push_back(
curv_noL3_A[ pseg_noL3_pos ]);
973 if (n_layers_processed != 4 && pseg < orig_number_of_noL4_psegs)
curv_noL4_A.push_back(
curv_noL4_A[ pseg_noL4_pos ]);
974 if (n_layers_processed != 5 && pseg < orig_number_of_noL5_psegs)
curv_noL5_A.push_back(
curv_noL5_A[ pseg_noL5_pos ]);
975 if (n_layers_processed != 6 && pseg < orig_number_of_noL6_psegs)
curv_noL6_A.push_back(
curv_noL6_A[ pseg_noL6_pos ]);
987 if (n_layers_processed != 2 && pseg < orig_number_of_noL1_psegs)
Psegments_noL1[ pseg_noL1_pos ].push_back(
PAhits_onLayer[ layer ][ hit ]);
988 if (n_layers_processed != 2 && pseg < orig_number_of_noL2_psegs)
Psegments_noL2[ pseg_noL2_pos ].push_back(
PAhits_onLayer[ layer ][ hit ]);
989 if (n_layers_processed != 3 && pseg < orig_number_of_noL3_psegs)
Psegments_noL3[ pseg_noL3_pos ].push_back(
PAhits_onLayer[ layer ][ hit ]);
990 if (n_layers_processed != 4 && pseg < orig_number_of_noL4_psegs)
Psegments_noL4[ pseg_noL4_pos ].push_back(
PAhits_onLayer[ layer ][ hit ]);
991 if (n_layers_processed != 5 && pseg < orig_number_of_noL5_psegs)
Psegments_noL5[ pseg_noL5_pos ].push_back(
PAhits_onLayer[ layer ][ hit ]);
992 if (n_layers_processed != 6 && pseg < orig_number_of_noL6_psegs)
Psegments_noL6[ pseg_noL6_pos ].push_back(
PAhits_onLayer[ layer ][ hit ]);
1005 float((*(
Psegments[ pseg_pos ].
end()-1))->cscDetId().layer()),
1006 float((*(
Psegments[ pseg_pos ].
end()-2))->cscDetId().layer()),
1007 float((*(
Psegments[ pseg_pos ].
end()-3))->cscDetId().layer())
1014 float((*(
Psegments[ pseg_pos ].
end()-1))->cscDetId().layer()),
1015 float((*(
Psegments[ pseg_pos ].
end()-2))->cscDetId().layer()),
1016 float((*(
Psegments[ pseg_pos ].
end()-3))->cscDetId().layer())
1021 if(
int(
Psegments[ pseg_pos ].
size()) == n_layers_occupied_tot) {
1025 (*(
Psegments[ pseg_pos ].
end()-midlayer_pointer[n_layers_occupied_tot-1] ))->localPosition().
x(),
1026 (*(
Psegments[ pseg_pos ].
end()-n_layers_occupied_tot ))->localPosition().
x(),
1027 float((*(
Psegments[ pseg_pos ].
end()-1))->cscDetId().layer()),
1028 float((*(
Psegments[ pseg_pos ].
end()-midlayer_pointer[n_layers_occupied_tot-1] ))->cscDetId().layer()),
1029 float((*(
Psegments[ pseg_pos ].
end()-n_layers_occupied_tot ))->cscDetId().layer())
1036 if (
weight_A[ pseg_pos ] < min_weight_A ) {
1037 min_weight_A =
weight_A[ pseg_pos ];
1040 best_pseg = pseg_pos ;
1050 if ( n_layers_occupied_tot > 3 ) {
1051 if (pseg < orig_number_of_noL1_psegs && (n_layers_processed != 2)) {
1081 (*(
Psegments_noL1[ pseg_noL1_pos ].
end()-midlayer_pointer[n_layers_occupied_tot-2] ))->localPosition().
x(),
1082 (*(
Psegments_noL1[ pseg_noL1_pos ].
end()-(n_layers_occupied_tot-1) ))->localPosition().
x(),
1084 float((*(
Psegments_noL1[ pseg_noL1_pos ].
end()-midlayer_pointer[n_layers_occupied_tot-2] ))->cscDetId().layer()),
1085 float((*(
Psegments_noL1[ pseg_noL1_pos ].
end()-(n_layers_occupied_tot-1) ))->cscDetId().layer())
1097 best_noLx_pseg = pseg_noL1_pos;
1098 best_Layer_noLx = 1;
1110 if ( n_layers_occupied_tot > 3 ) {
1111 if (pseg < orig_number_of_noL2_psegs && ( n_layers_processed != 2 )) {
1141 (*(
Psegments_noL2[ pseg_noL2_pos ].
end()-midlayer_pointer[n_layers_occupied_tot-2] ))->localPosition().
x(),
1142 (*(
Psegments_noL2[ pseg_noL2_pos ].
end()-(n_layers_occupied_tot-1) ))->localPosition().
x(),
1144 float((*(
Psegments_noL2[ pseg_noL2_pos ].
end()-midlayer_pointer[n_layers_occupied_tot-2] ))->cscDetId().layer()),
1145 float((*(
Psegments_noL2[ pseg_noL2_pos ].
end()-(n_layers_occupied_tot-1) ))->cscDetId().layer())
1157 best_noLx_pseg = pseg_noL2_pos;
1158 best_Layer_noLx = 2;
1170 if ( n_layers_occupied_tot > 3 ) {
1171 if (pseg < orig_number_of_noL3_psegs && ( n_layers_processed != 3 )) {
1201 (*(
Psegments_noL3[ pseg_noL3_pos ].
end()-midlayer_pointer[n_layers_occupied_tot-2] ))->localPosition().
x(),
1202 (*(
Psegments_noL3[ pseg_noL3_pos ].
end()-(n_layers_occupied_tot-1) ))->localPosition().
x(),
1204 float((*(
Psegments_noL3[ pseg_noL3_pos ].
end()-midlayer_pointer[n_layers_occupied_tot-2] ))->cscDetId().layer()),
1205 float((*(
Psegments_noL3[ pseg_noL3_pos ].
end()-(n_layers_occupied_tot-1) ))->cscDetId().layer())
1217 best_noLx_pseg = pseg_noL3_pos;
1218 best_Layer_noLx = 3;
1230 if ( n_layers_occupied_tot > 3 ) {
1231 if (pseg < orig_number_of_noL4_psegs && ( n_layers_processed != 4 )) {
1261 (*(
Psegments_noL4[ pseg_noL4_pos ].
end()-midlayer_pointer[n_layers_occupied_tot-2] ))->localPosition().
x(),
1262 (*(
Psegments_noL4[ pseg_noL4_pos ].
end()-(n_layers_occupied_tot-1) ))->localPosition().
x(),
1264 float((*(
Psegments_noL4[ pseg_noL4_pos ].
end()-midlayer_pointer[n_layers_occupied_tot-2] ))->cscDetId().layer()),
1265 float((*(
Psegments_noL4[ pseg_noL4_pos ].
end()-(n_layers_occupied_tot-1) ))->cscDetId().layer())
1277 best_noLx_pseg = pseg_noL4_pos;
1278 best_Layer_noLx = 4;
1290 if ( n_layers_occupied_tot > 4 ) {
1291 if (pseg < orig_number_of_noL5_psegs && ( n_layers_processed != 5 )) {
1321 (*(
Psegments_noL5[ pseg_noL5_pos ].
end()-midlayer_pointer[n_layers_occupied_tot-2] ))->localPosition().
x(),
1322 (*(
Psegments_noL5[ pseg_noL5_pos ].
end()-(n_layers_occupied_tot-1) ))->localPosition().
x(),
1324 float((*(
Psegments_noL5[ pseg_noL5_pos ].
end()-midlayer_pointer[n_layers_occupied_tot-2] ))->cscDetId().layer()),
1325 float((*(
Psegments_noL5[ pseg_noL5_pos ].
end()-(n_layers_occupied_tot-1) ))->cscDetId().layer())
1337 best_noLx_pseg = pseg_noL5_pos;
1338 best_Layer_noLx = 5;
1350 if ( n_layers_occupied_tot > 5 ) {
1351 if (pseg < orig_number_of_noL6_psegs && ( n_layers_processed != 6 )) {
1381 (*(
Psegments_noL6[ pseg_noL6_pos ].
end()-midlayer_pointer[n_layers_occupied_tot-2] ))->localPosition().
x(),
1382 (*(
Psegments_noL6[ pseg_noL6_pos ].
end()-(n_layers_occupied_tot-1) ))->localPosition().
x(),
1384 float((*(
Psegments_noL6[ pseg_noL6_pos ].
end()-midlayer_pointer[n_layers_occupied_tot-2] ))->cscDetId().layer()),
1385 float((*(
Psegments_noL6[ pseg_noL6_pos ].
end()-(n_layers_occupied_tot-1) ))->cscDetId().layer())
1397 best_noLx_pseg = pseg_noL6_pos;
1398 best_Layer_noLx = 6;
1434 int chosen_pseg = best_pseg;
1436 return segmentInChamber;
1441 float hit_drop_limit = -999999.999;
1444 switch ( n_layers_processed ) {
1456 if ((best_Layer_noLx < 1) || (best_Layer_noLx > 4)) {
1459 if ((best_Layer_noLx == 2) || (best_Layer_noLx == 3)) hit_drop_limit = hit_drop_limit * (1./2.);
1463 if ((best_Layer_noLx < 1) || (best_Layer_noLx > 5)) {
1466 if ((best_Layer_noLx == 2) || (best_Layer_noLx == 4)) hit_drop_limit = hit_drop_limit * (1./2.);
1467 if (best_Layer_noLx == 3) hit_drop_limit = hit_drop_limit * (1./3.);
1471 if ((best_Layer_noLx < 1) || (best_Layer_noLx > 6)) {
1474 if ((best_Layer_noLx == 2) || (best_Layer_noLx == 5)) hit_drop_limit = hit_drop_limit * (1./2.);
1475 if ((best_Layer_noLx == 3) || (best_Layer_noLx == 4)) hit_drop_limit = hit_drop_limit * (1./3.);
1480 LogTrace(
"CSCSegment|CSC") <<
"[CSCSegAlgoST::buildSegments] Unexpected number of layers with hits - please inform CSC DPG.";
1481 hit_drop_limit = 0.1;
1485 switch ( best_Layer_noLx ) {
1529 if( min_weight_A > 0. ) {
1530 if ( min_weight_noLx_A/min_weight_A < hit_drop_limit ) {
1535 chosen_pseg = best_noLx_pseg;
1550 for(
unsigned int iSegment=0; iSegment<
GoodSegments.size();++iSegment){
1574 LogTrace(
"CSCWeirdSegment") <<
"[CSCSegAlgoST::buildSegments] Segment ErrXX scaled and refit " << std::endl;
1581 LogTrace(
"CSCWeirdSegment") <<
"[CSCSegAlgoST::buildSegments] Segment ErrXY changed to match cond. number and refit " << std::endl;
1592 (segfit->
nhits()>3)){
1593 LogTrace(
"CSCWeirdSegment") <<
"[CSCSegAlgoST::buildSegments] Scale factor chi2uCorrection too big, pre-Prune and refit " << std::endl;
1618 segmentInChamber.push_back(
temp);
1620 return segmentInChamber;
1631 int SumCommonHits = 0;
1633 int nr_remaining_candidates;
1634 unsigned int nr_of_segment_candidates;
1636 nr_remaining_candidates = nr_of_segment_candidates = chosen_segments.size();
1639 GoodSegments.push_back( chosen_segments[ chosen_seg ] );
1641 float chosen_weight_temp = 999999.;
1642 int chosen_seg_temp = -1;
1645 while( nr_remaining_candidates > 0 ) {
1647 for(
unsigned int iCand=0; iCand < nr_of_segment_candidates; ++iCand) {
1649 if( chosen_weight[iCand] < 0. )
continue;
1652 for(
int ihits = 0; ihits <
int(chosen_segments[iCand].
size()); ++ihits ) {
1653 if( chosen_segments[iCand][ihits] == chosen_segments[chosen_seg][ihits]) {
1659 if(SumCommonHits>1) {
1660 chosen_weight[iCand] = -1.;
1661 nr_remaining_candidates -= 1;
1665 if( chosen_weight[ iCand ] < chosen_weight_temp ) {
1666 chosen_weight_temp = chosen_weight[ iCand ];
1667 chosen_seg_temp = iCand ;
1672 if( chosen_seg_temp > -1 )
GoodSegments.push_back( chosen_segments[ chosen_seg_temp ] );
1674 chosen_seg = chosen_seg_temp;
1676 chosen_weight_temp = 999999;
1677 chosen_seg_temp = -1;
1683 std::vector <unsigned int> BadCandidate;
1684 int SumCommonHits =0;
1686 BadCandidate.clear();
1687 for(
unsigned int iCand=0;iCand<
Psegments.size();++iCand) {
1689 for(
unsigned int iiCand=iCand+1;iiCand<
Psegments.size();++iiCand){
1693 LogTrace(
"CSCSegment|CSC") <<
"[CSCSegAlgoST::ChooseSegments2] ALARM!! Should not happen - please inform CSC DPG";
1702 if(SumCommonHits>1) {
1704 BadCandidate.push_back(iCand);
1708 BadCandidate.push_back(iiCand);
1715 for(
unsigned int isegm=0;isegm<
Psegments.size();++isegm) {
1719 for(
unsigned int ibad=0;ibad<BadCandidate.size();++ibad) {
1721 if(isegm == BadCandidate[ibad]) {
1738 for(std::vector<CSCSegment>::iterator it=segments.begin(); it != segments.end(); ++it) {
1739 std::vector<CSCSegment*> duplicateSegments;
1740 for(std::vector<CSCSegment>::iterator it2=segments.begin(); it2 != segments.end(); ++it2) {
1742 bool allShared =
true;
1744 allShared = it->sharesRecHits(*it2);
1751 duplicateSegments.push_back(&(*it2));
1754 it->setDuplicateSegments(duplicateSegments);
1768 <<
"\ncovariance matrix" 1772 <<
"\ntime = " << seg.
time();
double yweightPenaltyThreshold
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool preClustering_useChaining
LocalVector localdir() const
std::vector< ChamberHitContainer > Psegments_noL5
std::vector< float > curv_noL2_A
bool condpass1
Flag whether to 'improve' covariance matrix.
const CSCChamber * chamber() const
CSCDetId id() const
Get the (concrete) DetId.
void dumpSegment(const CSCSegment &seg) const
CSCSegment showerSeg(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
const CSCChamber * theChamber
std::vector< float > weight_noL4_A
std::vector< float > curv_noL6_A
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
std::vector< CSCSegment > run(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
void ChooseSegments2(int best_seg)
void ChooseSegments3(int best_seg)
LocalError localPositionError() const
std::vector< float > weight_noL3_B
const edm::ParameterSet & pset(void) const
std::vector< ChamberHitContainer > Psegments_noL1
CSCSegAlgoST(const edm::ParameterSet &ps)
Constructor.
bool isGoodToMerge(bool isME11a, ChamberHitContainer &newChain, ChamberHitContainer &oldChain)
std::vector< ChamberHitContainer > chosen_Psegments
std::vector< ChamberHitContainer > Psegments
ChamberHitContainer protoSegment
std::vector< std::vector< const CSCRecHit2D * > > clusterHits(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
std::vector< float > weight_noL3_A
virtual int degreesOfFreedom() const
Degrees of freedom of the segment fit.
std::string chamberTypeName() const
LocalPoint localPosition() const
LocalVector localDirection() const
Local direction.
CSCSegAlgoShowering * showering_
virtual ~CSCSegAlgoST()
Destructor.
const CSCChamberSpecs * specs() const
std::vector< ChamberHitContainer > Psegments_noLx
double curvePenaltyThreshold
std::vector< std::vector< const CSCRecHit2D * > > chainHits(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
std::vector< ChamberHitContainer > Psegments_noL4
std::vector< float > weight_A
std::vector< float > weight_noL1_B
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
std::vector< CSCSegment > buildSegments(const ChamberHitContainer &rechits)
float ChiSquaredProbability(double chiSquared, double nrDOF)
std::vector< CSCSegment > prune_bad_hits(const CSCChamber *aChamber, std::vector< CSCSegment > &segments)
std::vector< float > curv_noL5_A
std::vector< ChamberHitContainer > Psegments_noL6
bool gangedStrips() const
std::vector< const CSCRecHit2D * > ChamberHitContainer
Typedefs.
const std::vector< CSCRecHit2D > & specificRecHits() const
std::vector< ChamberHitContainer > Psegments_noL2
std::vector< float > weight_noL5_A
std::vector< float > weight_noL1_A
std::vector< float > curv_noL4_A
std::vector< float > weight_noL2_A
std::vector< float > chosen_weight_A
bool adjustCovariance(void)
AlgebraicSymMatrix parametersError() const
Covariance matrix of parameters()
ChamberHitContainer Psegments_hits
AlgebraicSymMatrix covarianceMatrix(void)
void findDuplicates(std::vector< CSCSegment > &segments)
std::vector< float > curv_noL1_A
void setScaleXError(double factor)
double theWeight(double coordinate_1, double coordinate_2, double coordinate_3, float layer_1, float layer_2, float layer_3)
Utility functions.
LocalPoint intercept() const
std::vector< float > curv_A
bool prePrun_
Chi^2 normalization for the initial fit.
double chi2() const
Chi2 of the segment fit.
std::vector< float > weight_noL5_B
std::vector< float > weight_B
float a_yweightPenaltyThreshold[5][5]
void ChooseSegments2a(std::vector< ChamberHitContainer > &best_segments, int best_seg)
std::vector< float > weight_noL6_A
std::vector< float > weight_noL2_B
std::vector< float > weight_noLx_A
std::vector< float > curv_noL3_A
std::vector< float > weight_noL6_B
void fit(bool condpass1=false, bool condpass2=false)
ChamberHitContainer PAhits_onLayer[6]
LocalError localDirectionError() const
Error on the local direction.
double scaleXError(void) const
std::vector< float > weight_noL4_B
std::vector< ChamberHitContainer > Psegments_noL3