CMS 3D CMS Logo

CSCSegAlgoST Class Reference

This algorithm is based on the Minimum Spanning Tree (ST) approach for building endcap muon track segments out of the rechit's in a CSCChamber. More...

#include <RecoLocalMuon/CSCSegment/src/CSCSegAlgoST.h>

Inheritance diagram for CSCSegAlgoST:

CSCSegmentAlgorithm

List of all members.

Public Types

typedef std::deque< boolBoolContainer
typedef std::vector< const
CSCRecHit2D * > 
ChamberHitContainer
 Typedefs.
typedef std::vector
< std::vector< const
CSCRecHit2D * > > 
Segments

Public Member Functions

std::vector< CSCSegmentbuildSegments (ChamberHitContainer rechits)
 Build track segments in this chamber (this is where the actual segment-building algorithm hides.
std::vector< CSCSegmentbuildSegments2 (ChamberHitContainer rechits)
 Build track segments in this chamber (this is where the actual segment-building algorithm hides.
std::vector< std::vector
< const CSCRecHit2D * > > 
clusterHits (const CSCChamber *aChamber, ChamberHitContainer rechits)
 Build groups of rechits that are separated in x and y to save time on the segment finding.
 CSCSegAlgoST (const edm::ParameterSet &ps)
 Constructor.
std::vector< CSCSegmentprune_bad_hits (const CSCChamber *aChamber, std::vector< CSCSegment > segments)
 Remove bad hits from found segments based not only on chi2, but also on charge and further "low level" chamber information.
std::vector< CSCSegmentrun (const CSCChamber *aChamber, ChamberHitContainer rechits)
 Build segments for all desired groups of hits.
virtual ~CSCSegAlgoST ()
 Destructor.

Private Member Functions

AlgebraicSymMatrix calculateError (void) const
void ChooseSegments (void)
void ChooseSegments2 (int best_seg)
void ChooseSegments2a (std::vector< ChamberHitContainer > best_segments, int best_seg)
void ChooseSegments3 (std::vector< ChamberHitContainer > best_segments, std::vector< float > best_weight, int best_seg)
void ChooseSegments3 (int best_seg)
HepMatrix derivativeMatrix (void) const
void fillChiSquared (void)
void fillLocalDirection (void)
void fitSlopes (void)
void flipErrors (AlgebraicSymMatrix &) const
double theWeight (double coordinate_1, double coordinate_2, double coordinate_3, float layer_1, float layer_2, float layer_3)
 Utility functions.
AlgebraicSymMatrix weightMatrix (void) const

Private Attributes

float a_yweightPenaltyThreshold [5][5]
bool BrutePruning
std::vector< ChamberHitContainerchosen_Psegments
std::vector< float > chosen_weight_A
std::vector< float > curv_A
std::vector< float > curv_noL1_A
std::vector< float > curv_noL2_A
std::vector< float > curv_noL3_A
std::vector< float > curv_noL4_A
std::vector< float > curv_noL5_A
std::vector< float > curv_noL6_A
double curvePenalty
double curvePenaltyThreshold
bool debug
double dXclusBoxMax
double dYclusBoxMax
Segments GoodSegments
double hitDropLimit4Hits
double hitDropLimit5Hits
double hitDropLimit6Hits
int maxRecHitsInCluster
int minHitsPerSegment
const std::string myName
bool onlyBestSegment
ChamberHitContainer PAhits_onLayer [6]
bool preClustering
double protoChi2
LocalVector protoDirection
LocalPoint protoIntercept
ChamberHitContainer protoSegment
float protoSlope_u
float protoSlope_v
bool Pruning
std::vector< ChamberHitContainerPsegments
ChamberHitContainer Psegments_hits
std::vector< ChamberHitContainerPsegments_noL1
std::vector< ChamberHitContainerPsegments_noL2
std::vector< ChamberHitContainerPsegments_noL3
std::vector< ChamberHitContainerPsegments_noL4
std::vector< ChamberHitContainerPsegments_noL5
std::vector< ChamberHitContainerPsegments_noL6
std::vector< ChamberHitContainerPsegments_noLx
CSCSegAlgoShoweringshowering_
const CSCChambertheChamber
bool useShowering
std::vector< float > weight_A
std::vector< float > weight_B
std::vector< float > weight_noL1_A
std::vector< float > weight_noL1_B
std::vector< float > weight_noL2_A
std::vector< float > weight_noL2_B
std::vector< float > weight_noL3_A
std::vector< float > weight_noL3_B
std::vector< float > weight_noL4_A
std::vector< float > weight_noL4_B
std::vector< float > weight_noL5_A
std::vector< float > weight_noL5_B
std::vector< float > weight_noL6_A
std::vector< float > weight_noL6_B
std::vector< float > weight_noLx_A
double yweightPenalty
double yweightPenaltyThreshold


Detailed Description

This algorithm is based on the Minimum Spanning Tree (ST) approach for building endcap muon track segments out of the rechit's in a CSCChamber.


A CSCSegment is a RecSegment4D, and is built from CSCRecHit2D objects, each of which is a RecHit2DLocalPos.

This builds segments consisting of at least 3 hits. It is allowed for segments to have a common (only one) rechit.

The program is under construction/testing.

Authors:
S. Stoynev - NU I. Bloch - FNAL E. James - FNAL

Definition at line 32 of file CSCSegAlgoST.h.


Member Typedef Documentation

typedef std::deque<bool> CSCSegAlgoST::BoolContainer

Definition at line 41 of file CSCSegAlgoST.h.

typedef std::vector<const CSCRecHit2D*> CSCSegAlgoST::ChamberHitContainer

Typedefs.

Definition at line 39 of file CSCSegAlgoST.h.

typedef std::vector< std::vector<const CSCRecHit2D* > > CSCSegAlgoST::Segments

Definition at line 40 of file CSCSegAlgoST.h.


Constructor & Destructor Documentation

CSCSegAlgoST::CSCSegAlgoST ( const edm::ParameterSet ps  )  [explicit]

Constructor.

Definition at line 32 of file CSCSegAlgoST.cc.

References BrutePruning, curvePenalty, curvePenaltyThreshold, debug, dXclusBoxMax, dYclusBoxMax, edm::ParameterSet::getUntrackedParameter(), hitDropLimit4Hits, hitDropLimit5Hits, hitDropLimit6Hits, maxRecHitsInCluster, minHitsPerSegment, onlyBestSegment, preClustering, Pruning, showering_, useShowering, yweightPenalty, and yweightPenaltyThreshold.

00032                                                     : CSCSegmentAlgorithm(ps), myName("CSCSegAlgoST") {
00033         
00034   debug                  = ps.getUntrackedParameter<bool>("CSCDebug");
00035   //  minLayersApart         = ps.getUntrackedParameter<int>("minLayersApart");
00036   //  nSigmaFromSegment      = ps.getUntrackedParameter<double>("nSigmaFromSegment");
00037   minHitsPerSegment      = ps.getUntrackedParameter<int>("minHitsPerSegment");
00038   //  muonsPerChamberMax     = ps.getUntrackedParameter<int>("CSCSegmentPerChamberMax");      
00039   //  chi2Max                = ps.getUntrackedParameter<double>("chi2Max");
00040   dXclusBoxMax           = ps.getUntrackedParameter<double>("dXclusBoxMax");
00041   dYclusBoxMax           = ps.getUntrackedParameter<double>("dYclusBoxMax");
00042   preClustering          = ps.getUntrackedParameter<bool>("preClustering");
00043   Pruning                = ps.getUntrackedParameter<bool>("Pruning");
00044   BrutePruning           = ps.getUntrackedParameter<bool>("BrutePruning");
00045   // maxRecHitsInCluster is the maximal number of hits in a precluster that is being processed
00046   // This cut is intended to remove messy events. Currently nothing is returned if there are
00047   // more that maxRecHitsInCluster hits. It could be useful to return an estimate of the 
00048   // cluster position, which is available.
00049   maxRecHitsInCluster    = ps.getUntrackedParameter<int>("maxRecHitsInCluster");
00050   onlyBestSegment        = ps.getUntrackedParameter<bool>("onlyBestSegment");
00051 
00052   hitDropLimit4Hits      = ps.getUntrackedParameter<double>("hitDropLimit4Hits");
00053   hitDropLimit5Hits      = ps.getUntrackedParameter<double>("hitDropLimit5Hits");
00054   hitDropLimit6Hits      = ps.getUntrackedParameter<double>("hitDropLimit6Hits");
00055   
00056   yweightPenaltyThreshold      = ps.getUntrackedParameter<double>("yweightPenaltyThreshold");
00057   yweightPenalty               = ps.getUntrackedParameter<double>("yweightPenalty");
00058                                                                                          
00059   curvePenaltyThreshold        = ps.getUntrackedParameter<double>("curvePenaltyThreshold");
00060   curvePenalty                 = ps.getUntrackedParameter<double>("curvePenalty");
00061 
00062   useShowering = ps.getUntrackedParameter<bool>("useShowering");
00063   showering_   = new CSCSegAlgoShowering( ps );
00064   // std::cout<<"Constructor called..."<<std::endl;
00065 
00066 }

CSCSegAlgoST::~CSCSegAlgoST (  )  [virtual]

Destructor.

Definition at line 71 of file CSCSegAlgoST.cc.

References showering_.

00071                             {
00072   delete showering_;
00073 }


Member Function Documentation

std::vector< CSCSegment > CSCSegAlgoST::buildSegments ( ChamberHitContainer  rechits  ) 

Build track segments in this chamber (this is where the actual segment-building algorithm hides.

)

Definition at line 460 of file CSCSegAlgoST.cc.

Referenced by run().

00475                                            { // magic number 6: number of layers in CSC chamber - not gonna change :)
00476     PAhits_onLayer[iarray].clear();
00477     hits_onLayerNumber[iarray] = 0;    
00478   }
00479 
00480   chosen_Psegments.clear();
00481   chosen_weight_A.clear();
00482 
00483   Psegments.clear();
00484   Psegments_noLx.clear();
00485   Psegments_noL1.clear();
00486   Psegments_noL2.clear();
00487   Psegments_noL3.clear();
00488   Psegments_noL4.clear();
00489   Psegments_noL5.clear();
00490   Psegments_noL6.clear();
00491 
00492   Psegments_hits.clear();
00493   
00494   weight_A.clear();
00495   weight_noLx_A.clear();
00496   weight_noL1_A.clear();
00497   weight_noL2_A.clear();
00498   weight_noL3_A.clear();
00499   weight_noL4_A.clear();
00500   weight_noL5_A.clear();
00501   weight_noL6_A.clear();
00502 
00503   weight_B.clear();
00504   weight_noL1_B.clear();
00505   weight_noL2_B.clear();
00506   weight_noL3_B.clear();
00507   weight_noL4_B.clear();
00508   weight_noL5_B.clear();
00509   weight_noL6_B.clear();
00510 
00511   curv_A.clear();
00512   curv_noL1_A.clear();
00513   curv_noL2_A.clear();
00514   curv_noL3_A.clear();
00515   curv_noL4_A.clear();
00516   curv_noL5_A.clear();
00517   curv_noL6_A.clear();
00518 
00519   // definition of middle layer for n-hit segment
00520   int midlayer_pointer[6] = {0,0,2,3,3,4};
00521   
00522   // int n_layers_missed_tot = 0;
00523   int n_layers_occupied_tot = 0;
00524   int n_layers_processed = 0;
00525 
00526   float min_weight_A = 99999.9;
00527   float min_weight_noLx_A = 99999.9;
00528 
00529   float best_weight_B = -1.;
00530   float best_weight_noLx_B = -1.;
00531 
00532   float best_curv_A = -1.;
00533   float best_curv_noLx_A = -1.;
00534 
00535   int best_pseg = -1;
00536   int best_noLx_pseg = -1;
00537   int best_Layer_noLx = -1;
00538 
00539   //************************************************************************;    
00540   //***   Start segment building   *****************************************;    
00541   //************************************************************************;    
00542   
00543   // Determine how many layers with hits we have
00544   // Fill all hits into the layer hit container:
00545   
00546   // Have 2 standard arrays: one giving the number of hits per layer. 
00547   // The other the corresponding hits. 
00548   
00549   // Loop all available hits, count hits per layer and fill the hits into array by layer
00550   for(uint M = 0; M < rechits.size(); ++M) {
00551     // add hits to array per layer and count hits per layer:
00552     hits_onLayerNumber[ rechits[M]->cscDetId().layer()-1 ] += 1;
00553     if(hits_onLayerNumber[ rechits[M]->cscDetId().layer()-1 ] == 1 ) n_layers_occupied_tot += 1;
00554     // add hits to vector in array
00555     PAhits_onLayer[rechits[M]->cscDetId().layer()-1]    .push_back(rechits[M]);    
00556   }
00557  
00558   // We have now counted the hits per layer and filled pointers to the hits into an array
00559   
00560   int tothits = 0;
00561   int maxhits = 0;
00562   int nexthits = 0;
00563   int maxlayer = -1;
00564   int nextlayer = -1;
00565 
00566   for(uint i = 0; i< hits_onLayerNumber.size(); ++i){
00567     //std::cout<<"We have "<<hits_onLayerNumber[i]<<" hits on layer "<<i+1<<std::endl;
00568     tothits += hits_onLayerNumber[i];
00569     if (hits_onLayerNumber[i] > maxhits) {
00570       nextlayer = maxlayer;
00571       nexthits = maxhits;
00572       maxlayer = i;
00573       maxhits = hits_onLayerNumber[i];
00574     }
00575     else if (hits_onLayerNumber[i] > nexthits) {
00576       nextlayer = i;
00577       nexthits = hits_onLayerNumber[i];
00578     }
00579   }
00580 
00581 
00582   if (tothits > (int)UpperLimit) {
00583     if (n_layers_occupied_tot > 4) {
00584       tothits = tothits - hits_onLayerNumber[maxlayer];
00585       n_layers_occupied_tot = n_layers_occupied_tot - 1;
00586       PAhits_onLayer[maxlayer].clear();
00587       hits_onLayerNumber[maxlayer] = 0;
00588     }
00589   }
00590 
00591   if (tothits > (int)UpperLimit) {
00592     if (n_layers_occupied_tot > 4) {
00593       tothits = tothits - hits_onLayerNumber[nextlayer];
00594       n_layers_occupied_tot = n_layers_occupied_tot - 1;
00595       PAhits_onLayer[nextlayer].clear();
00596       hits_onLayerNumber[nextlayer] = 0;
00597     }
00598   }
00599 
00600   if (tothits > (int)UpperLimit){ 
00601 
00602   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00603   // Showering muon - returns nothing if chi2 == -1 (see comment in SegAlgoShowering)
00604   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
00605   if (useShowering) {
00606     CSCSegment segShower = showering_->showerSeg(theChamber, rechits);
00607 
00608     // Make sure have at least 3 hits...
00609     if ( segShower.nRecHits() < 3 ) return segmentInChamber;
00610     if ( segShower.chi2() == -1 ) return segmentInChamber;
00611 
00612     segmentInChamber.push_back(segShower);
00613     return segmentInChamber;  
00614 
00615   } else{
00616         LogDebug("CSC") <<"Number of rechits in the cluster/chamber > "<< UpperLimit<<
00617           " ... Segment finding in the cluster/chamber canceled! \n";
00618         //     std::cout<<"Number of rechits in the cluster/chamber > "<< UpperLimit<<
00619         //     " ... Segment finding in the cluster/chamber canceled! "<<std::endl;
00620         return segmentInChamber;  
00621         }
00622   }
00623 
00624   // Find out which station, ring and chamber we are in 
00625   // Used to choose station/ring dependant y-weight cuts
00626 
00627   if( rechits.size() > 0 ) {
00628     thering = rechits[0]->cscDetId().ring();
00629     thestation = rechits[0]->cscDetId().station();
00630     thecham = rechits[0]->cscDetId().chamber();
00631   }
00632 
00633   // std::cout<<"We are in Station/ring/chamber: "<<thestation <<" "<< thering<<" "<< thecham<<std::endl;
00634 
00635   // Cut-off parameter - don't reconstruct segments with less than X hits
00636   if( n_layers_occupied_tot < minHitsPerSegment ) { 
00637     return segmentInChamber;
00638   }
00639   
00640   // Start building all possible hit combinations:
00641 
00642   // loop over the six chamber layers and form segment candidates from the available hits:
00643 
00644   for(int layer = 0; layer < 6; ++layer) {
00645 
00646     // *****************************************************************
00647     // *** Set missed layer counter here (not currently implemented) ***
00648     // *****************************************************************
00649     // if( PAhits_onLayer[layer].size() == 0 ) {
00650     //   n_layers_missed_tot += 1;
00651     // }
00652 
00653     if( PAhits_onLayer[layer].size() > 0 ) {
00654       n_layers_processed += 1;
00655     }
00656 
00657     // Save the size of the protosegment before hits were added on the current layer
00658     int orig_number_of_psegs = Psegments.size();
00659     int orig_number_of_noL1_psegs = Psegments_noL1.size();
00660     int orig_number_of_noL2_psegs = Psegments_noL2.size();
00661     int orig_number_of_noL3_psegs = Psegments_noL3.size();
00662     int orig_number_of_noL4_psegs = Psegments_noL4.size();
00663     int orig_number_of_noL5_psegs = Psegments_noL5.size();
00664     int orig_number_of_noL6_psegs = Psegments_noL6.size();
00665 
00666     // loop over the hits on the layer and initiate protosegments or add hits to protosegments
00667     for(int hit = 0; hit < int(PAhits_onLayer[layer].size()); ++hit) { // loop all hits on the Layer number "layer"
00668 
00669       // create protosegments from all hits on the first layer with hits
00670       if( orig_number_of_psegs == 0 ) { // would be faster to turn this around - ask for "orig_number_of_psegs != 0"
00671 
00672         Psegments_hits.push_back(PAhits_onLayer[layer][hit]);
00673 
00674         Psegments.push_back(Psegments_hits); 
00675         Psegments_noL6.push_back(Psegments_hits); 
00676         Psegments_noL5.push_back(Psegments_hits); 
00677         Psegments_noL4.push_back(Psegments_hits); 
00678         Psegments_noL3.push_back(Psegments_hits); 
00679         Psegments_noL2.push_back(Psegments_hits); 
00680 
00681         // Initialize weights corresponding to this segment for first hit (with 0)
00682 
00683         curv_A.push_back(0.0);
00684         curv_noL6_A.push_back(0.0); 
00685         curv_noL5_A.push_back(0.0); 
00686         curv_noL4_A.push_back(0.0); 
00687         curv_noL3_A.push_back(0.0); 
00688         curv_noL2_A.push_back(0.0); 
00689 
00690         weight_A.push_back(0.0);
00691         weight_noL6_A.push_back(0.0); 
00692         weight_noL5_A.push_back(0.0); 
00693         weight_noL4_A.push_back(0.0); 
00694         weight_noL3_A.push_back(0.0); 
00695         weight_noL2_A.push_back(0.0); 
00696 
00697         weight_B.push_back(0.0);
00698         weight_noL6_B.push_back(0.0); 
00699         weight_noL5_B.push_back(0.0); 
00700         weight_noL4_B.push_back(0.0); 
00701         weight_noL3_B.push_back(0.0); 
00702         weight_noL2_B.push_back(0.0); 
00703     
00704         // reset array for next hit on next layer
00705         Psegments_hits    .clear();
00706       }
00707       else {
00708         if( orig_number_of_noL1_psegs == 0 ) {
00709 
00710           Psegments_hits.push_back(PAhits_onLayer[layer][hit]);
00711 
00712           Psegments_noL1.push_back(Psegments_hits); 
00713 
00714           // Initialize weight corresponding to this segment for first hit (with 0)
00715 
00716           curv_noL1_A.push_back(0.0);
00717 
00718           weight_noL1_A.push_back(0.0);
00719 
00720           weight_noL1_B.push_back(0.0);
00721     
00722           // reset array for next hit on next layer
00723           Psegments_hits    .clear();
00724 
00725         }
00726 
00727         // loop over the protosegments and create a new protosegments for each hit-1 on this layer
00728         
00729         for( int pseg = 0; pseg < orig_number_of_psegs; ++pseg ) { 
00730 
00731           int pseg_pos = (pseg)+((hit)*orig_number_of_psegs);
00732           int pseg_noL1_pos = (pseg)+((hit)*orig_number_of_noL1_psegs);
00733           int pseg_noL2_pos = (pseg)+((hit)*orig_number_of_noL2_psegs);
00734           int pseg_noL3_pos = (pseg)+((hit)*orig_number_of_noL3_psegs);
00735           int pseg_noL4_pos = (pseg)+((hit)*orig_number_of_noL4_psegs);
00736           int pseg_noL5_pos = (pseg)+((hit)*orig_number_of_noL5_psegs);
00737           int pseg_noL6_pos = (pseg)+((hit)*orig_number_of_noL6_psegs);
00738 
00739           // - Loop all psegs. 
00740           // - If not last hit, clone  existing protosegments  (PAhits_onLayer[layer].size()-1) times
00741           // - then add the new hits
00742 
00743           if( ! (hit == int(PAhits_onLayer[layer].size()-1)) ) { // not the last hit - prepare (copy) new protosegments for the following hits
00744             // clone psegs (to add next hits or last hit on layer):
00745 
00746             Psegments.push_back(Psegments[ pseg_pos ]); 
00747             if (n_layers_processed != 2 && pseg < orig_number_of_noL1_psegs) Psegments_noL1.push_back(Psegments_noL1[ pseg_noL1_pos ]); 
00748             if (n_layers_processed != 2 && pseg < orig_number_of_noL2_psegs) Psegments_noL2.push_back(Psegments_noL2[ pseg_noL2_pos ]); 
00749             if (n_layers_processed != 3 && pseg < orig_number_of_noL3_psegs) Psegments_noL3.push_back(Psegments_noL3[ pseg_noL3_pos ]); 
00750             if (n_layers_processed != 4 && pseg < orig_number_of_noL4_psegs) Psegments_noL4.push_back(Psegments_noL4[ pseg_noL4_pos ]); 
00751             if (n_layers_processed != 5 && pseg < orig_number_of_noL5_psegs) Psegments_noL5.push_back(Psegments_noL5[ pseg_noL5_pos ]); 
00752             if (n_layers_processed != 6 && pseg < orig_number_of_noL6_psegs) Psegments_noL6.push_back(Psegments_noL6[ pseg_noL6_pos ]); 
00753             // clone weight corresponding to this segment too
00754             weight_A.push_back(weight_A[ pseg_pos ]);
00755             if (n_layers_processed != 2 && pseg < orig_number_of_noL1_psegs) weight_noL1_A.push_back(weight_noL1_A[ pseg_noL1_pos ]);
00756             if (n_layers_processed != 2 && pseg < orig_number_of_noL2_psegs) weight_noL2_A.push_back(weight_noL2_A[ pseg_noL2_pos ]);
00757             if (n_layers_processed != 3 && pseg < orig_number_of_noL3_psegs) weight_noL3_A.push_back(weight_noL3_A[ pseg_noL3_pos ]);
00758             if (n_layers_processed != 4 && pseg < orig_number_of_noL4_psegs) weight_noL4_A.push_back(weight_noL4_A[ pseg_noL4_pos ]);
00759             if (n_layers_processed != 5 && pseg < orig_number_of_noL5_psegs) weight_noL5_A.push_back(weight_noL5_A[ pseg_noL5_pos ]);
00760             if (n_layers_processed != 6 && pseg < orig_number_of_noL6_psegs) weight_noL6_A.push_back(weight_noL6_A[ pseg_noL6_pos ]);
00761             // clone curvature variable corresponding to this segment too
00762             curv_A.push_back(curv_A[ pseg_pos ]);
00763             if (n_layers_processed != 2 && pseg < orig_number_of_noL1_psegs) curv_noL1_A.push_back(curv_noL1_A[ pseg_noL1_pos ]);
00764             if (n_layers_processed != 2 && pseg < orig_number_of_noL2_psegs) curv_noL2_A.push_back(curv_noL2_A[ pseg_noL2_pos ]);
00765             if (n_layers_processed != 3 && pseg < orig_number_of_noL3_psegs) curv_noL3_A.push_back(curv_noL3_A[ pseg_noL3_pos ]);
00766             if (n_layers_processed != 4 && pseg < orig_number_of_noL4_psegs) curv_noL4_A.push_back(curv_noL4_A[ pseg_noL4_pos ]);
00767             if (n_layers_processed != 5 && pseg < orig_number_of_noL5_psegs) curv_noL5_A.push_back(curv_noL5_A[ pseg_noL5_pos ]);
00768             if (n_layers_processed != 6 && pseg < orig_number_of_noL6_psegs) curv_noL6_A.push_back(curv_noL6_A[ pseg_noL6_pos ]);
00769             // clone "y"-weight corresponding to this segment too
00770             weight_B.push_back(weight_B[ pseg_pos ]);
00771             if (n_layers_processed != 2 && pseg < orig_number_of_noL1_psegs) weight_noL1_B.push_back(weight_noL1_B[ pseg_noL1_pos ]);
00772             if (n_layers_processed != 2 && pseg < orig_number_of_noL2_psegs) weight_noL2_B.push_back(weight_noL2_B[ pseg_noL2_pos ]);
00773             if (n_layers_processed != 3 && pseg < orig_number_of_noL3_psegs) weight_noL3_B.push_back(weight_noL3_B[ pseg_noL3_pos ]);
00774             if (n_layers_processed != 4 && pseg < orig_number_of_noL4_psegs) weight_noL4_B.push_back(weight_noL4_B[ pseg_noL4_pos ]);
00775             if (n_layers_processed != 5 && pseg < orig_number_of_noL5_psegs) weight_noL5_B.push_back(weight_noL5_B[ pseg_noL5_pos ]);
00776             if (n_layers_processed != 6 && pseg < orig_number_of_noL6_psegs) weight_noL6_B.push_back(weight_noL6_B[ pseg_noL6_pos ]);
00777           }
00778           // add hits to original pseg:
00779           Psegments[ pseg_pos ].push_back(PAhits_onLayer[ layer ][ hit ]);
00780           if (n_layers_processed != 2 && pseg < orig_number_of_noL1_psegs) Psegments_noL1[ pseg_noL1_pos ].push_back(PAhits_onLayer[ layer ][ hit ]);
00781           if (n_layers_processed != 2 && pseg < orig_number_of_noL2_psegs) Psegments_noL2[ pseg_noL2_pos ].push_back(PAhits_onLayer[ layer ][ hit ]);
00782           if (n_layers_processed != 3 && pseg < orig_number_of_noL3_psegs) Psegments_noL3[ pseg_noL3_pos ].push_back(PAhits_onLayer[ layer ][ hit ]);
00783           if (n_layers_processed != 4 && pseg < orig_number_of_noL4_psegs) Psegments_noL4[ pseg_noL4_pos ].push_back(PAhits_onLayer[ layer ][ hit ]);
00784           if (n_layers_processed != 5 && pseg < orig_number_of_noL5_psegs) Psegments_noL5[ pseg_noL5_pos ].push_back(PAhits_onLayer[ layer ][ hit ]);
00785           if (n_layers_processed != 6 && pseg < orig_number_of_noL6_psegs) Psegments_noL6[ pseg_noL6_pos ].push_back(PAhits_onLayer[ layer ][ hit ]);
00786             
00787           // calculate/update the weight (only for >2 hits on psegment):
00788 
00789           if( Psegments[ pseg_pos ].size() > 2 ) {
00790               
00791             // looks more exciting than it is. Here the weight is calculated. It is the difference in x of the last two and one but the last two hits, 
00792             // divided by the distance of the corresponding hits. Please refer to twiki page XXXX or CMS Note YYY (and use layer_distance)
00793 
00794             weight_A[ pseg_pos ] += theWeight(
00795                                               (*(Psegments[ pseg_pos ].end()-1 ))->localPosition().x(), 
00796                                               (*(Psegments[ pseg_pos ].end()-2 ))->localPosition().x(),
00797                                               (*(Psegments[ pseg_pos ].end()-3 ))->localPosition().x(),
00798                                               float((*(Psegments[ pseg_pos ].end()-1))->cscDetId().layer()),
00799                                               float((*(Psegments[ pseg_pos ].end()-2))->cscDetId().layer()),
00800                                               float((*(Psegments[ pseg_pos ].end()-3))->cscDetId().layer())
00801                                               );
00802 
00803             weight_B[ pseg_pos ] += theWeight(
00804                                               (*(Psegments[ pseg_pos ].end()-1 ))->localPosition().y(), 
00805                                               (*(Psegments[ pseg_pos ].end()-2 ))->localPosition().y(),
00806                                               (*(Psegments[ pseg_pos ].end()-3 ))->localPosition().y(),
00807                                               float((*(Psegments[ pseg_pos ].end()-1))->cscDetId().layer()),
00808                                               float((*(Psegments[ pseg_pos ].end()-2))->cscDetId().layer()),
00809                                               float((*(Psegments[ pseg_pos ].end()-3))->cscDetId().layer())
00810                                               );
00811 
00812             // if we have picked up the last hit go looking for pseg with the lowest (and second lowest?) weight
00813 
00814             if(int(Psegments[ pseg_pos ].size()) == n_layers_occupied_tot) {
00815 
00816               curv_A[ pseg_pos ] += theWeight(
00817                                               (*(Psegments[ pseg_pos ].end()-1 ))->localPosition().x(), 
00818                                               (*(Psegments[ pseg_pos ].end()-midlayer_pointer[n_layers_occupied_tot-1] ))->localPosition().x(),
00819                                               (*(Psegments[ pseg_pos ].end()-n_layers_occupied_tot ))->localPosition().x(),
00820                                               float((*(Psegments[ pseg_pos ].end()-1))->cscDetId().layer()),
00821                                               float((*(Psegments[ pseg_pos ].end()-midlayer_pointer[n_layers_occupied_tot-1] ))->cscDetId().layer()),
00822                                               float((*(Psegments[ pseg_pos ].end()-n_layers_occupied_tot ))->cscDetId().layer())
00823                                               );
00824 
00825               if (curv_A[ pseg_pos ] > curvePenaltyThreshold) weight_A[ pseg_pos ] = weight_A[ pseg_pos ] * curvePenalty;
00826 
00827               if (weight_B[ pseg_pos ] > a_yweightPenaltyThreshold[thestation][thering]) weight_A[ pseg_pos ] = weight_A[ pseg_pos ] * yweightPenalty;
00828                
00829               if (weight_A[ pseg_pos ] < min_weight_A ) {
00830                 min_weight_A = weight_A[ pseg_pos ];
00831                 best_weight_B = weight_B[ pseg_pos ];
00832                 best_curv_A = curv_A[ pseg_pos ];
00833                 best_pseg = pseg_pos ;
00834               }
00835 
00836             }
00837 
00838             // alternative: fill map with weight and pseg (which is already ordered)? Seems a very good tool to go looking for segments from. 
00839             // As I understand, the segments would be inserted according to their weight, so the list would "automatically" be sorted.
00840 
00841           }
00842 
00843           if ( n_layers_occupied_tot > 3 ) {
00844             if (pseg < orig_number_of_noL1_psegs && (n_layers_processed != 2)) {
00845               if(( Psegments_noL1[ pseg_noL1_pos ].size() > 2 ) ) {
00846                 
00847                 // looks more exciting than it is. Here the weight is calculated. It is the difference in x of the last two and one but the last two hits, 
00848                 // divided by the distance of the corresponding hits. Please refer to twiki page XXXX or CMS Note YYY (and use layer_distance)
00849                 
00850                 weight_noL1_A[ pseg_noL1_pos ] += theWeight(
00851                                                             (*(Psegments_noL1[ pseg_noL1_pos ].end()-1 ))->localPosition().x(), 
00852                                                             (*(Psegments_noL1[ pseg_noL1_pos ].end()-2 ))->localPosition().x(),
00853                                                             (*(Psegments_noL1[ pseg_noL1_pos ].end()-3 ))->localPosition().x(),
00854                                                             float((*(Psegments_noL1[ pseg_noL1_pos ].end()-1))->cscDetId().layer()),
00855                                                             float((*(Psegments_noL1[ pseg_noL1_pos ].end()-2))->cscDetId().layer()),
00856                                                             float((*(Psegments_noL1[ pseg_noL1_pos ].end()-3))->cscDetId().layer())
00857                                                             );
00858 
00859                 weight_noL1_B[ pseg_noL1_pos ] += theWeight(
00860                                                             (*(Psegments_noL1[ pseg_noL1_pos ].end()-1 ))->localPosition().y(), 
00861                                                             (*(Psegments_noL1[ pseg_noL1_pos ].end()-2 ))->localPosition().y(),
00862                                                             (*(Psegments_noL1[ pseg_noL1_pos ].end()-3 ))->localPosition().y(),
00863                                                             float((*(Psegments_noL1[ pseg_noL1_pos ].end()-1))->cscDetId().layer()),
00864                                                             float((*(Psegments_noL1[ pseg_noL1_pos ].end()-2))->cscDetId().layer()),
00865                                                             float((*(Psegments_noL1[ pseg_noL1_pos ].end()-3))->cscDetId().layer())
00866                                                             );
00867 
00868                 //if we have picked up the last hit go looking for pseg with the lowest (and second lowest?) weight
00869 
00870                 if(int(Psegments_noL1[ pseg_noL1_pos ].size()) == n_layers_occupied_tot -1 ) {
00871 
00872                   curv_noL1_A[ pseg_noL1_pos ] += theWeight(
00873                                                             (*(Psegments_noL1[ pseg_noL1_pos ].end()-1 ))->localPosition().x(), 
00874                                                             (*(Psegments_noL1[ pseg_noL1_pos ].end()-midlayer_pointer[n_layers_occupied_tot-2] ))->localPosition().x(),
00875                                                             (*(Psegments_noL1[ pseg_noL1_pos ].end()-(n_layers_occupied_tot-1) ))->localPosition().x(),
00876                                                             float((*(Psegments_noL1[ pseg_noL1_pos ].end()-1 ))->cscDetId().layer()),
00877                                                             float((*(Psegments_noL1[ pseg_noL1_pos ].end()-midlayer_pointer[n_layers_occupied_tot-2] ))->cscDetId().layer()),
00878                                                             float((*(Psegments_noL1[ pseg_noL1_pos ].end()-(n_layers_occupied_tot-1) ))->cscDetId().layer())
00879                                                             );
00880 
00881                   if (curv_noL1_A[ pseg_noL1_pos ] > curvePenaltyThreshold) weight_noL1_A[ pseg_noL1_pos ] = weight_noL1_A[ pseg_noL1_pos ] * curvePenalty;
00882 
00883                   if (weight_noL1_B[ pseg_noL1_pos ] > a_yweightPenaltyThreshold[thestation][thering]) 
00884                     weight_noL1_A[ pseg_noL1_pos ] = weight_noL1_A[ pseg_noL1_pos ] * yweightPenalty;
00885 
00886                   if (weight_noL1_A[ pseg_noL1_pos ] < min_weight_noLx_A ) {
00887                     min_weight_noLx_A = weight_noL1_A[ pseg_noL1_pos ];
00888                     best_weight_noLx_B = weight_noL1_B[ pseg_noL1_pos ];
00889                     best_curv_noLx_A = curv_noL1_A[ pseg_noL1_pos ];
00890                     best_noLx_pseg = pseg_noL1_pos;
00891                     best_Layer_noLx = 1;
00892                   }
00893 
00894                 }
00895 
00896                 // alternative: fill map with weight and pseg (which is already ordered)? Seems a very good tool to go looking for segments from. 
00897                 // As I understand, the segments would be inserted according to their weight, so the list would "automatically" be sorted.
00898                 
00899               }
00900             }
00901           }
00902 
00903           if ( n_layers_occupied_tot > 3 ) {
00904             if (pseg < orig_number_of_noL2_psegs && ( n_layers_processed != 2 )) {
00905               if(( Psegments_noL2[ pseg_noL2_pos ].size() > 2 )) {
00906               
00907                 // looks more exciting than it is. Here the weight is calculated. It is the difference in x of the last two and one but the last two hits, 
00908                 // divided by the distance of the corresponding hits. Please refer to twiki page XXXX or CMS Note YYY (and use layer_distance)
00909 
00910                 weight_noL2_A[ pseg_noL2_pos ] += theWeight(
00911                                                             (*(Psegments_noL2[ pseg_noL2_pos ].end()-1 ))->localPosition().x(), 
00912                                                             (*(Psegments_noL2[ pseg_noL2_pos ].end()-2 ))->localPosition().x(),
00913                                                             (*(Psegments_noL2[ pseg_noL2_pos ].end()-3 ))->localPosition().x(),
00914                                                             float((*(Psegments_noL2[ pseg_noL2_pos ].end()-1))->cscDetId().layer()),
00915                                                             float((*(Psegments_noL2[ pseg_noL2_pos ].end()-2))->cscDetId().layer()),
00916                                                             float((*(Psegments_noL2[ pseg_noL2_pos ].end()-3))->cscDetId().layer())
00917                                                             );
00918 
00919                 weight_noL2_B[ pseg_noL2_pos ] += theWeight(
00920                                                             (*(Psegments_noL2[ pseg_noL2_pos ].end()-1 ))->localPosition().y(), 
00921                                                             (*(Psegments_noL2[ pseg_noL2_pos ].end()-2 ))->localPosition().y(),
00922                                                             (*(Psegments_noL2[ pseg_noL2_pos ].end()-3 ))->localPosition().y(),
00923                                                             float((*(Psegments_noL2[ pseg_noL2_pos ].end()-1))->cscDetId().layer()),
00924                                                             float((*(Psegments_noL2[ pseg_noL2_pos ].end()-2))->cscDetId().layer()),
00925                                                             float((*(Psegments_noL2[ pseg_noL2_pos ].end()-3))->cscDetId().layer())
00926                                                             );
00927 
00928                 //if we have picked up the last hit go looking for pseg with the lowest (and second lowest?) weight
00929 
00930                 if(int(Psegments_noL2[ pseg_noL2_pos ].size()) == n_layers_occupied_tot -1 ) {
00931 
00932                   curv_noL2_A[ pseg_noL2_pos ] += theWeight(
00933                                                             (*(Psegments_noL2[ pseg_noL2_pos ].end()-1 ))->localPosition().x(), 
00934                                                             (*(Psegments_noL2[ pseg_noL2_pos ].end()-midlayer_pointer[n_layers_occupied_tot-2] ))->localPosition().x(),
00935                                                             (*(Psegments_noL2[ pseg_noL2_pos ].end()-(n_layers_occupied_tot-1) ))->localPosition().x(),
00936                                                             float((*(Psegments_noL2[ pseg_noL2_pos ].end()-1 ))->cscDetId().layer()),
00937                                                             float((*(Psegments_noL2[ pseg_noL2_pos ].end()-midlayer_pointer[n_layers_occupied_tot-2] ))->cscDetId().layer()),
00938                                                             float((*(Psegments_noL2[ pseg_noL2_pos ].end()-(n_layers_occupied_tot-1) ))->cscDetId().layer())
00939                                                             );
00940 
00941                   if (curv_noL2_A[ pseg_noL2_pos ] > curvePenaltyThreshold) weight_noL2_A[ pseg_noL2_pos ] = weight_noL2_A[ pseg_noL2_pos ] * curvePenalty;
00942 
00943                   if (weight_noL2_B[ pseg_noL2_pos ] > a_yweightPenaltyThreshold[thestation][thering]) 
00944                     weight_noL2_A[ pseg_noL2_pos ] = weight_noL2_A[ pseg_noL2_pos ] * yweightPenalty;
00945 
00946                   if (weight_noL2_A[ pseg_noL2_pos ] < min_weight_noLx_A ) {
00947                     min_weight_noLx_A = weight_noL2_A[ pseg_noL2_pos ];
00948                     best_weight_noLx_B = weight_noL2_B[ pseg_noL2_pos ];
00949                     best_curv_noLx_A = curv_noL2_A[ pseg_noL2_pos ];
00950                     best_noLx_pseg = pseg_noL2_pos;
00951                     best_Layer_noLx = 2;
00952                   }
00953 
00954                 }
00955 
00956                 // alternative: fill map with weight and pseg (which is already ordered)? Seems a very good tool to go looking for segments from. 
00957                 // As I understand, the segments would be inserted according to their weight, so the list would "automatically" be sorted.
00958 
00959               }
00960             }
00961           }
00962 
00963           if ( n_layers_occupied_tot > 3 ) {
00964             if (pseg < orig_number_of_noL3_psegs && ( n_layers_processed != 3 )) {
00965               if(( Psegments_noL3[ pseg_noL3_pos ].size() > 2 )) {
00966               
00967                 // looks more exciting than it is. Here the weight is calculated. It is the difference in x of the last two and one but the last two hits, 
00968                 // divided by the distance of the corresponding hits. Please refer to twiki page XXXX or CMS Note YYY (and use layer_distance)
00969 
00970                 weight_noL3_A[ pseg_noL3_pos ] += theWeight(
00971                                                             (*(Psegments_noL3[ pseg_noL3_pos ].end()-1 ))->localPosition().x(), 
00972                                                             (*(Psegments_noL3[ pseg_noL3_pos ].end()-2 ))->localPosition().x(),
00973                                                             (*(Psegments_noL3[ pseg_noL3_pos ].end()-3 ))->localPosition().x(),
00974                                                             float((*(Psegments_noL3[ pseg_noL3_pos ].end()-1))->cscDetId().layer()),
00975                                                             float((*(Psegments_noL3[ pseg_noL3_pos ].end()-2))->cscDetId().layer()),
00976                                                             float((*(Psegments_noL3[ pseg_noL3_pos ].end()-3))->cscDetId().layer())
00977                                                             );
00978 
00979                 weight_noL3_B[ pseg_noL3_pos ] += theWeight(
00980                                                             (*(Psegments_noL3[ pseg_noL3_pos ].end()-1 ))->localPosition().y(), 
00981                                                             (*(Psegments_noL3[ pseg_noL3_pos ].end()-2 ))->localPosition().y(),
00982                                                             (*(Psegments_noL3[ pseg_noL3_pos ].end()-3 ))->localPosition().y(),
00983                                                             float((*(Psegments_noL3[ pseg_noL3_pos ].end()-1))->cscDetId().layer()),
00984                                                             float((*(Psegments_noL3[ pseg_noL3_pos ].end()-2))->cscDetId().layer()),
00985                                                             float((*(Psegments_noL3[ pseg_noL3_pos ].end()-3))->cscDetId().layer())
00986                                                             );
00987 
00988                 //if we have picked up the last hit go looking for pseg with the lowest (and second lowest?) weight
00989 
00990                 if(int(Psegments_noL3[ pseg_noL3_pos ].size()) == n_layers_occupied_tot -1 ) {
00991 
00992                   curv_noL3_A[ pseg_noL3_pos ] += theWeight(
00993                                                             (*(Psegments_noL3[ pseg_noL3_pos ].end()-1 ))->localPosition().x(), 
00994                                                             (*(Psegments_noL3[ pseg_noL3_pos ].end()-midlayer_pointer[n_layers_occupied_tot-2] ))->localPosition().x(),
00995                                                             (*(Psegments_noL3[ pseg_noL3_pos ].end()-(n_layers_occupied_tot-1) ))->localPosition().x(),
00996                                                             float((*(Psegments_noL3[ pseg_noL3_pos ].end()-1 ))->cscDetId().layer()),
00997                                                             float((*(Psegments_noL3[ pseg_noL3_pos ].end()-midlayer_pointer[n_layers_occupied_tot-2] ))->cscDetId().layer()),
00998                                                             float((*(Psegments_noL3[ pseg_noL3_pos ].end()-(n_layers_occupied_tot-1) ))->cscDetId().layer())
00999                                                             );
01000 
01001                   if (curv_noL3_A[ pseg_noL3_pos ] > curvePenaltyThreshold) weight_noL3_A[ pseg_noL3_pos ] = weight_noL3_A[ pseg_noL3_pos ] * curvePenalty;
01002 
01003                   if (weight_noL3_B[ pseg_noL3_pos ] > a_yweightPenaltyThreshold[thestation][thering]) 
01004                     weight_noL3_A[ pseg_noL3_pos ] = weight_noL3_A[ pseg_noL3_pos ] * yweightPenalty;
01005 
01006                   if (weight_noL3_A[ pseg_noL3_pos ] < min_weight_noLx_A ) {
01007                     min_weight_noLx_A = weight_noL3_A[ pseg_noL3_pos ];
01008                     best_weight_noLx_B = weight_noL3_B[ pseg_noL3_pos ];
01009                     best_curv_noLx_A = curv_noL3_A[ pseg_noL3_pos ];
01010                     best_noLx_pseg = pseg_noL3_pos;
01011                     best_Layer_noLx = 3;
01012                   }
01013 
01014                 }
01015 
01016                 // alternative: fill map with weight and pseg (which is already ordered)? Seems a very good tool to go looking for segments from. 
01017                 // As I understand, the segments would be inserted according to their weight, so the list would "automatically" be sorted.
01018 
01019               }
01020             }
01021           }
01022 
01023           if ( n_layers_occupied_tot > 3 ) {
01024             if (pseg < orig_number_of_noL4_psegs && ( n_layers_processed != 4 )) {
01025               if(( Psegments_noL4[ pseg_noL4_pos ].size() > 2 )) {
01026               
01027                 // looks more exciting than it is. Here the weight is calculated. It is the difference in x of the last two and one but the last two hits, 
01028                 // divided by the distance of the corresponding hits. Please refer to twiki page XXXX or CMS Note YYY (and use layer_distance)
01029               
01030                 weight_noL4_A[ pseg_noL4_pos ] += theWeight(
01031                                                             (*(Psegments_noL4[ pseg_noL4_pos ].end()-1 ))->localPosition().x(), 
01032                                                             (*(Psegments_noL4[ pseg_noL4_pos ].end()-2 ))->localPosition().x(),
01033                                                             (*(Psegments_noL4[ pseg_noL4_pos ].end()-3 ))->localPosition().x(),
01034                                                             float((*(Psegments_noL4[ pseg_noL4_pos ].end()-1))->cscDetId().layer()),
01035                                                             float((*(Psegments_noL4[ pseg_noL4_pos ].end()-2))->cscDetId().layer()),
01036                                                             float((*(Psegments_noL4[ pseg_noL4_pos ].end()-3))->cscDetId().layer())
01037                                                             );
01038 
01039                 weight_noL4_B[ pseg_noL4_pos ] += theWeight(
01040                                                             (*(Psegments_noL4[ pseg_noL4_pos ].end()-1 ))->localPosition().y(), 
01041                                                             (*(Psegments_noL4[ pseg_noL4_pos ].end()-2 ))->localPosition().y(),
01042                                                             (*(Psegments_noL4[ pseg_noL4_pos ].end()-3 ))->localPosition().y(),
01043                                                             float((*(Psegments_noL4[ pseg_noL4_pos ].end()-1))->cscDetId().layer()),
01044                                                             float((*(Psegments_noL4[ pseg_noL4_pos ].end()-2))->cscDetId().layer()),
01045                                                             float((*(Psegments_noL4[ pseg_noL4_pos ].end()-3))->cscDetId().layer())
01046                                                             );
01047 
01048                 //if we have picked up the last hit go looking for pseg with the lowest (and second lowest?) weight
01049 
01050                 if(int(Psegments_noL4[ pseg_noL4_pos ].size()) == n_layers_occupied_tot -1 ) {
01051 
01052                   curv_noL4_A[ pseg_noL4_pos ] += theWeight(
01053                                                             (*(Psegments_noL4[ pseg_noL4_pos ].end()-1 ))->localPosition().x(), 
01054                                                             (*(Psegments_noL4[ pseg_noL4_pos ].end()-midlayer_pointer[n_layers_occupied_tot-2] ))->localPosition().x(),
01055                                                             (*(Psegments_noL4[ pseg_noL4_pos ].end()-(n_layers_occupied_tot-1) ))->localPosition().x(),
01056                                                             float((*(Psegments_noL4[ pseg_noL4_pos ].end()-1 ))->cscDetId().layer()),
01057                                                             float((*(Psegments_noL4[ pseg_noL4_pos ].end()-midlayer_pointer[n_layers_occupied_tot-2] ))->cscDetId().layer()),
01058                                                             float((*(Psegments_noL4[ pseg_noL4_pos ].end()-(n_layers_occupied_tot-1) ))->cscDetId().layer())
01059                                                             );
01060 
01061                   if (curv_noL4_A[ pseg_noL4_pos ] > curvePenaltyThreshold) weight_noL4_A[ pseg_noL4_pos ] = weight_noL4_A[ pseg_noL4_pos ] * curvePenalty;
01062 
01063                   if (weight_noL4_B[ pseg_noL4_pos ] > a_yweightPenaltyThreshold[thestation][thering]) 
01064                     weight_noL4_A[ pseg_noL4_pos ] = weight_noL4_A[ pseg_noL4_pos ] * yweightPenalty;
01065 
01066                   if (weight_noL4_A[ pseg_noL4_pos ] < min_weight_noLx_A ) {
01067                     min_weight_noLx_A = weight_noL4_A[ pseg_noL4_pos ];
01068                     best_weight_noLx_B = weight_noL4_B[ pseg_noL4_pos ];
01069                     best_curv_noLx_A = curv_noL4_A[ pseg_noL4_pos ];
01070                     best_noLx_pseg = pseg_noL4_pos;
01071                     best_Layer_noLx = 4;
01072                   }
01073 
01074                 }
01075 
01076                 // alternative: fill map with weight and pseg (which is already ordered)? Seems a very good tool to go looking for segments from. 
01077                 // As I understand, the segments would be inserted according to their weight, so the list would "automatically" be sorted.
01078 
01079               }
01080             }
01081           }
01082 
01083           if ( n_layers_occupied_tot > 4 ) {
01084             if (pseg < orig_number_of_noL5_psegs && ( n_layers_processed != 5 )) {
01085               if(( Psegments_noL5[ pseg_noL5_pos ].size() > 2 )){
01086               
01087                 // looks more exciting than it is. Here the weight is calculated. It is the difference in x of the last two and one but the last two hits, 
01088                 // divided by the distance of the corresponding hits. Please refer to twiki page XXXX or CMS Note YYY (and use layer_distance)
01089 
01090                 weight_noL5_A[ pseg_noL5_pos ] += theWeight(
01091                                                             (*(Psegments_noL5[ pseg_noL5_pos ].end()-1 ))->localPosition().x(), 
01092                                                             (*(Psegments_noL5[ pseg_noL5_pos ].end()-2 ))->localPosition().x(),
01093                                                             (*(Psegments_noL5[ pseg_noL5_pos ].end()-3 ))->localPosition().x(),
01094                                                             float((*(Psegments_noL5[ pseg_noL5_pos ].end()-1))->cscDetId().layer()),
01095                                                             float((*(Psegments_noL5[ pseg_noL5_pos ].end()-2))->cscDetId().layer()),
01096                                                             float((*(Psegments_noL5[ pseg_noL5_pos ].end()-3))->cscDetId().layer())
01097                                                             );
01098 
01099                 weight_noL5_B[ pseg_noL5_pos ] += theWeight(
01100                                                             (*(Psegments_noL5[ pseg_noL5_pos ].end()-1 ))->localPosition().y(), 
01101                                                             (*(Psegments_noL5[ pseg_noL5_pos ].end()-2 ))->localPosition().y(),
01102                                                             (*(Psegments_noL5[ pseg_noL5_pos ].end()-3 ))->localPosition().y(),
01103                                                             float((*(Psegments_noL5[ pseg_noL5_pos ].end()-1))->cscDetId().layer()),
01104                                                             float((*(Psegments_noL5[ pseg_noL5_pos ].end()-2))->cscDetId().layer()),
01105                                                             float((*(Psegments_noL5[ pseg_noL5_pos ].end()-3))->cscDetId().layer())
01106                                                             );
01107 
01108                 //if we have picked up the last hit go looking for pseg with the lowest (and second lowest?) weight
01109 
01110                 if(int(Psegments_noL5[ pseg_noL5_pos ].size()) == n_layers_occupied_tot -1 ) {
01111 
01112                   curv_noL5_A[ pseg_noL5_pos ] += theWeight(
01113                                                             (*(Psegments_noL5[ pseg_noL5_pos ].end()-1 ))->localPosition().x(), 
01114                                                             (*(Psegments_noL5[ pseg_noL5_pos ].end()-midlayer_pointer[n_layers_occupied_tot-2] ))->localPosition().x(),
01115                                                             (*(Psegments_noL5[ pseg_noL5_pos ].end()-(n_layers_occupied_tot-1) ))->localPosition().x(),
01116                                                             float((*(Psegments_noL5[ pseg_noL5_pos ].end()-1 ))->cscDetId().layer()),
01117                                                             float((*(Psegments_noL5[ pseg_noL5_pos ].end()-midlayer_pointer[n_layers_occupied_tot-2] ))->cscDetId().layer()),
01118                                                             float((*(Psegments_noL5[ pseg_noL5_pos ].end()-(n_layers_occupied_tot-1) ))->cscDetId().layer())
01119                                                             );
01120 
01121                   if (curv_noL5_A[ pseg_noL5_pos ] > curvePenaltyThreshold) weight_noL5_A[ pseg_noL5_pos ] = weight_noL5_A[ pseg_noL5_pos ] * curvePenalty;
01122 
01123                   if (weight_noL5_B[ pseg_noL5_pos ] > a_yweightPenaltyThreshold[thestation][thering]) 
01124                     weight_noL5_A[ pseg_noL5_pos ] = weight_noL5_A[ pseg_noL5_pos ] * yweightPenalty;
01125 
01126                   if (weight_noL5_A[ pseg_noL5_pos ] < min_weight_noLx_A ) {
01127                     min_weight_noLx_A = weight_noL5_A[ pseg_noL5_pos ];
01128                     best_weight_noLx_B = weight_noL5_B[ pseg_noL5_pos ];
01129                     best_curv_noLx_A = curv_noL5_A[ pseg_noL5_pos ];
01130                     best_noLx_pseg = pseg_noL5_pos;
01131                     best_Layer_noLx = 5;
01132                   }
01133 
01134                 }
01135 
01136                 // alternative: fill map with weight and pseg (which is already ordered)? Seems a very good tool to go looking for segments from. 
01137                 // As I understand, the segments would be inserted according to their weight, so the list would "automatically" be sorted.
01138 
01139               }
01140             }
01141           }
01142 
01143           if ( n_layers_occupied_tot > 5 ) {
01144             if (pseg < orig_number_of_noL6_psegs && ( n_layers_processed != 6 )) {
01145               if(( Psegments_noL6[ pseg_noL6_pos ].size() > 2 )){
01146               
01147                 // looks more exciting than it is. Here the weight is calculated. It is the difference in x of the last two and one but the last two hits, 
01148                 // divided by the distance of the corresponding hits. Please refer to twiki page XXXX or CMS Note YYY (and use layer_distance)
01149 
01150                 weight_noL6_A[ pseg_noL6_pos ] += theWeight(
01151                                                             (*(Psegments_noL6[ pseg_noL6_pos ].end()-1 ))->localPosition().x(), 
01152                                                             (*(Psegments_noL6[ pseg_noL6_pos ].end()-2 ))->localPosition().x(),
01153                                                             (*(Psegments_noL6[ pseg_noL6_pos ].end()-3 ))->localPosition().x(),
01154                                                             float((*(Psegments_noL6[ pseg_noL6_pos ].end()-1))->cscDetId().layer()),
01155                                                             float((*(Psegments_noL6[ pseg_noL6_pos ].end()-2))->cscDetId().layer()),
01156                                                             float((*(Psegments_noL6[ pseg_noL6_pos ].end()-3))->cscDetId().layer())
01157                                                             );
01158 
01159                 weight_noL6_B[ pseg_noL6_pos ] += theWeight(
01160                                                             (*(Psegments_noL6[ pseg_noL6_pos ].end()-1 ))->localPosition().y(), 
01161                                                             (*(Psegments_noL6[ pseg_noL6_pos ].end()-2 ))->localPosition().y(),
01162                                                             (*(Psegments_noL6[ pseg_noL6_pos ].end()-3 ))->localPosition().y(),
01163                                                             float((*(Psegments_noL6[ pseg_noL6_pos ].end()-1))->cscDetId().layer()),
01164                                                             float((*(Psegments_noL6[ pseg_noL6_pos ].end()-2))->cscDetId().layer()),
01165                                                             float((*(Psegments_noL6[ pseg_noL6_pos ].end()-3))->cscDetId().layer())
01166                                                             );
01167 
01168                 //if we have picked up the last hit go looking for pseg with the lowest (and second lowest?) weight
01169 
01170                 if(int(Psegments_noL6[ pseg_noL6_pos ].size()) == n_layers_occupied_tot -1 ) {
01171 
01172                   curv_noL6_A[ pseg_noL6_pos ] += theWeight(
01173                                                             (*(Psegments_noL6[ pseg_noL6_pos ].end()-1 ))->localPosition().x(), 
01174                                                             (*(Psegments_noL6[ pseg_noL6_pos ].end()-midlayer_pointer[n_layers_occupied_tot-2] ))->localPosition().x(),
01175                                                             (*(Psegments_noL6[ pseg_noL6_pos ].end()-(n_layers_occupied_tot-1) ))->localPosition().x(),
01176                                                             float((*(Psegments_noL6[ pseg_noL6_pos ].end()-1 ))->cscDetId().layer()),
01177                                                             float((*(Psegments_noL6[ pseg_noL6_pos ].end()-midlayer_pointer[n_layers_occupied_tot-2] ))->cscDetId().layer()),
01178                                                             float((*(Psegments_noL6[ pseg_noL6_pos ].end()-(n_layers_occupied_tot-1) ))->cscDetId().layer())
01179                                                             );
01180 
01181                   if (curv_noL6_A[ pseg_noL6_pos ] > curvePenaltyThreshold) weight_noL6_A[ pseg_noL6_pos ] = weight_noL6_A[ pseg_noL6_pos ] * curvePenalty;
01182 
01183                   if (weight_noL6_B[ pseg_noL6_pos ] > a_yweightPenaltyThreshold[thestation][thering]) 
01184                     weight_noL6_A[ pseg_noL6_pos ] = weight_noL6_A[ pseg_noL6_pos ] * yweightPenalty;
01185 
01186                   if (weight_noL6_A[ pseg_noL6_pos ] < min_weight_noLx_A ) {
01187                     min_weight_noLx_A = weight_noL6_A[ pseg_noL6_pos ];
01188                     best_weight_noLx_B = weight_noL6_B[ pseg_noL6_pos ];
01189                     best_curv_noLx_A = curv_noL6_A[ pseg_noL6_pos ];
01190                     best_noLx_pseg = pseg_noL6_pos;
01191                     best_Layer_noLx = 6;
01192                   }
01193 
01194                 }
01195 
01196                 // alternative: fill map with weight and pseg (which is already ordered)? Seems a very good tool to go looking for segments from. 
01197                 // As I understand, the segments would be inserted according to their weight, so the list would "automatically" be sorted.
01198 
01199               }
01200             }
01201           }
01202 
01203         }
01204       }
01205     }
01206   }
01207 
01208   //************************************************************************;    
01209   //***   End segment building   *******************************************;    
01210   //************************************************************************;    
01211 
01212   // Important part! Here segment(s) are actually chosen. All the good segments
01213   // could be chosen or some (best) ones only (in order to save time).
01214 
01215   // Check if there is a segment with n-1 hits that has a signifcantly better 
01216   // weight than the best n hit segment
01217 
01218   // IBL 070828: implicit assumption here is that there will always only be one segment per 
01219   // cluster - if there are >1 we will need to find out which segment the alternative n-1 hit 
01220   // protosegment belongs to!
01221 
01222 
01223   float chosen_weight = min_weight_A;
01224   float chosen_ywgt = best_weight_B;
01225   float chosen_curv = best_curv_A;
01226   int chosen_nlayers = n_layers_occupied_tot;
01227   int chosen_pseg = best_pseg;
01228   chosen_Psegments = (Psegments);
01229   chosen_weight_A = (weight_A);
01230 
01231   float hit_drop_limit = -999999.999;
01232 
01233   // define different weight improvement requirements depending on how many layers are in the segment candidate
01234   switch ( n_layers_processed ) {
01235   case 1 : 
01236     // do nothing;
01237     break;
01238   case 2 :
01239     // do nothing;
01240     break;
01241   case 3 : 
01242     // do nothing;
01243     break;
01244   case 4 : 
01245     hit_drop_limit =  hitDropLimit6Hits * (1./2.) * hitDropLimit4Hits;
01246     if ((best_Layer_noLx < 1) || (best_Layer_noLx > 4)) {
01247       //      std::cout<<"CSCSegAlgoST: For four layers, best_Layer_noLx = "<< best_Layer_noLx << std::endl;
01248     }
01249     if ((best_Layer_noLx == 2) || (best_Layer_noLx == 3)) hit_drop_limit = hit_drop_limit * (1./2.); 
01250     break;
01251   case 5 : 
01252     hit_drop_limit =  hitDropLimit6Hits * (2./3.) * hitDropLimit5Hits;
01253     if ((best_Layer_noLx < 1) || (best_Layer_noLx > 5)) {
01254       //      std::cout<<"CSCSegAlgoST: For five layers, best_Layer_noLx = "<< best_Layer_noLx << std::endl;
01255     }
01256     if ((best_Layer_noLx == 2) || (best_Layer_noLx == 4)) hit_drop_limit = hit_drop_limit * (1./2.); 
01257     if (best_Layer_noLx == 3) hit_drop_limit = hit_drop_limit * (1./3.); 
01258     break;
01259   case 6 : 
01260     hit_drop_limit =  hitDropLimit6Hits * (3./4.);
01261     if ((best_Layer_noLx < 1) || (best_Layer_noLx > 6)) {
01262       //      std::cout<<"CSCSegAlgoST: For six layers, best_Layer_noLx = "<< best_Layer_noLx << std::endl;
01263     }
01264     if ((best_Layer_noLx == 2) || (best_Layer_noLx == 5)) hit_drop_limit = hit_drop_limit * (1./2.); 
01265     if ((best_Layer_noLx == 3) || (best_Layer_noLx == 4)) hit_drop_limit = hit_drop_limit * (1./3.); 
01266     break;
01267     
01268   default : 
01269     // Fallback - should never occur.
01270     LogDebug("CSC") <<"CSCSegAlgoST: Unexpected number of layers with hits - please inform developers.\n";
01271     //     std::cout<<"CSCSegAlgoST: Unexpected number of layers with hits - please inform developers."<<std::endl;
01272     hit_drop_limit = 0.1;
01273   }
01274 
01275   // choose the NoLx collection (the one that contains the best N-1 candidate)
01276   switch ( best_Layer_noLx ) {
01277   case 1 : 
01278     Psegments_noLx.clear();
01279     Psegments_noLx = Psegments_noL1;
01280     weight_noLx_A.clear();
01281     weight_noLx_A = weight_noL1_A;
01282     break;
01283   case 2 :
01284     Psegments_noLx.clear();
01285     Psegments_noLx = Psegments_noL2;
01286     weight_noLx_A.clear();
01287     weight_noLx_A = weight_noL2_A;
01288     break;
01289   case 3 : 
01290     Psegments_noLx.clear();
01291     Psegments_noLx = Psegments_noL3;
01292     weight_noLx_A.clear();
01293     weight_noLx_A = weight_noL3_A;
01294     break;
01295   case 4 : 
01296     Psegments_noLx.clear();
01297     Psegments_noLx = Psegments_noL4;
01298     weight_noLx_A.clear();
01299     weight_noLx_A = weight_noL4_A;
01300     break;
01301   case 5 : 
01302     Psegments_noLx.clear();
01303     Psegments_noLx = Psegments_noL5;
01304     weight_noLx_A.clear();
01305     weight_noLx_A = weight_noL5_A;
01306     break;
01307   case 6 : 
01308     Psegments_noLx.clear();
01309     Psegments_noLx = Psegments_noL6;
01310     weight_noLx_A.clear();
01311     weight_noLx_A = weight_noL6_A;
01312     break;
01313     
01314   default : 
01315     // Fallback - should occur only for preclusters with only 3 layers with hits.
01316     Psegments_noLx.clear();
01317     weight_noLx_A.clear();
01318   }
01319   
01320    if ( min_weight_noLx_A/min_weight_A < hit_drop_limit ) {
01321      chosen_weight = min_weight_noLx_A;
01322      chosen_ywgt = best_weight_noLx_B;
01323      chosen_curv = best_curv_noLx_A;
01324      chosen_nlayers = n_layers_occupied_tot-1;
01325      chosen_pseg = best_noLx_pseg;
01326      chosen_Psegments.clear();
01327      chosen_weight_A.clear();
01328      chosen_Psegments = (Psegments_noLx);
01329      chosen_weight_A = (weight_noLx_A);
01330    }
01331 
01332   if(onlyBestSegment) {
01333     ChooseSegments2a( chosen_Psegments, chosen_pseg );
01334   }
01335   else {
01336     ChooseSegments3( chosen_Psegments, chosen_weight_A, chosen_pseg ); 
01337   }
01338 
01339   for(unsigned int iSegment=0; iSegment<GoodSegments.size();iSegment++){
01340     protoSegment = GoodSegments[iSegment];
01341     fitSlopes(); 
01342     fillChiSquared();
01343     fillLocalDirection();
01344     // calculate error matrix
01345     AlgebraicSymMatrix protoErrors = calculateError();   
01346     // but reorder components to match what's required by TrackingRecHit interface 
01347     // i.e. slopes first, then positions 
01348     flipErrors( protoErrors ); 
01349     //
01350     CSCSegment temp(protoSegment, protoIntercept, protoDirection, protoErrors, protoChi2);
01351     segmentInChamber.push_back(temp); 
01352   }
01353   return segmentInChamber;
01354 }
01355 

std::vector<CSCSegment> CSCSegAlgoST::buildSegments2 ( ChamberHitContainer  rechits  ) 

Build track segments in this chamber (this is where the actual segment-building algorithm hides.

)

AlgebraicSymMatrix CSCSegAlgoST::calculateError ( void   )  const [private]

Definition at line 1654 of file CSCSegAlgoST.cc.

Referenced by prune_bad_hits().

01659               ://www.phys.ufl.edu/~avery/fitting.html, part I
01660   int ierr;
01661   AlgebraicSymMatrix result = weights.similarityT(A);
01662   result.invert(ierr);
01663   
01664   // blithely assuming the inverting never fails...
01665   return result;
01666 }
01667 

void CSCSegAlgoST::ChooseSegments ( void   )  [private]

void CSCSegAlgoST::ChooseSegments2 ( int  best_seg  )  [private]

Definition at line 1415 of file CSCSegAlgoST.cc.

References int, LogDebug, Psegments, size, and weight_A.

01415                                                       :)
01416   std::vector <unsigned int> BadCandidate;
01417   int SumCommonHits =0;
01418   GoodSegments.clear();
01419   BadCandidate.clear();
01420   for(unsigned int iCand=0;iCand<Psegments.size();iCand++) {
01421     // skip here if segment was marked bad
01422     for(unsigned int iiCand=iCand+1;iiCand<Psegments.size();iiCand++){
01423       // skip here too if segment was marked bad
01424       SumCommonHits =0;
01425       if( Psegments[iCand].size() != Psegments[iiCand].size() ) {
01426         LogDebug("CSC") <<"CSCSegmentST::ChooseSegments2: ALARM!! THIS should not happen!!\n";
01427 //      std::cout<<"CSCSegmentST::ChooseSegments2: ALARM!! THIS should not happen!!"<<std::endl;
01428       }
01429       else {
01430         for( int ihits = 0; ihits < int(Psegments[iCand].size()); ++ihits ) { // iCand and iiCand NEED to have same nr of hits! (alsways have by construction)
01431           if( Psegments[iCand][ihits] == Psegments[iiCand][ihits]) {
01432             SumCommonHits++;
01433           }
01434         }
01435       }
01436       if(SumCommonHits>1) {
01437         if( weight_A[iCand]>weight_A[iiCand] ) { // use weight_A here
01438           BadCandidate.push_back(iCand);
01439           // rather mark segment bad by an array which is in sync with protosegments!! e.g. set weight = weight*1000 or have an addidional array or set it to weight *= -1
01440         }
01441         else{
01442           BadCandidate.push_back(iiCand);
01443           // rather mark segment bad by an array which is in sync with protosegments!! e.g. set weight = weight*1000 or have an addidional array or set it to weight *= -1
01444         }
01445       }
01446     }
01447   }
01448   bool discard;
01449   for(unsigned int isegm=0;isegm<Psegments.size();isegm++) {
01450     // For best results another iteration/comparison over Psegments 
01451     //should be applied here... It would make the program much slower.
01452     discard = false;
01453     for(unsigned int ibad=0;ibad<BadCandidate.size();ibad++) {
01454       // can save this loop if we used an array in sync with Psegments!!!!
01455       if(isegm == BadCandidate[ibad]) {
01456         discard = true;
01457       }
01458     }
01459     if(!discard) {
01460       GoodSegments.push_back( Psegments[isegm] );
01461     }
01462   }
01463 }
01464 

void CSCSegAlgoST::ChooseSegments2a ( std::vector< ChamberHitContainer best_segments,
int  best_seg 
) [private]

Definition at line 1357 of file CSCSegAlgoST.cc.

void CSCSegAlgoST::ChooseSegments3 ( std::vector< ChamberHitContainer best_segments,
std::vector< float >  best_weight,
int  best_seg 
) [private]

Definition at line 1363 of file CSCSegAlgoST.cc.

References GoodSegments, int, and size.

01371                                                :  
01372   GoodSegments.push_back( chosen_segments[ chosen_seg ] );
01373 
01374   float chosen_weight_temp = 999999.;
01375   int chosen_seg_temp = -1;
01376 
01377   // try to find further segment candidates:
01378   while( nr_remaining_candidates > 0 ) {
01379 
01380     for(unsigned int iCand=0; iCand < nr_of_segment_candidates; ++iCand) {
01381       //only compare current best to psegs that have not been marked bad:
01382       if( chosen_weight[iCand] < 0. ) continue;
01383       SumCommonHits = 0;
01384 
01385       for( int ihits = 0; ihits < int(chosen_segments[iCand].size()); ++ihits ) { // iCand and iiCand NEED to have same nr of hits! (always have by construction)
01386         if( chosen_segments[iCand][ihits] == chosen_segments[chosen_seg][ihits]) {
01387           SumCommonHits++;
01388         }
01389       }
01390 
01391       //mark a pseg bad:
01392       if(SumCommonHits>1) { // needs to be a card; should be investigated first
01393         chosen_weight[iCand] = -1.;
01394         nr_remaining_candidates -= 1;
01395       }
01396       else {
01397         // save the protosegment with the smallest weight
01398         if( chosen_weight[ iCand ] < chosen_weight_temp ) {
01399           chosen_weight_temp = chosen_weight[ iCand ];
01400           chosen_seg_temp = iCand ;
01401         }
01402       }
01403     }
01404 
01405     if( chosen_seg_temp > -1 ) GoodSegments.push_back( chosen_segments[ chosen_seg_temp ] );
01406 
01407     chosen_seg = chosen_seg_temp;
01408     // re-initialze temporary best parameters
01409     chosen_weight_temp = 999999;
01410     chosen_seg_temp = -1;
01411   }
01412 }
01413 

void CSCSegAlgoST::ChooseSegments3 ( int  best_seg  )  [private]

std::vector< std::vector< const CSCRecHit2D * > > CSCSegAlgoST::clusterHits ( const CSCChamber aChamber,
ChamberHitContainer  rechits 
)

Build groups of rechits that are separated in x and y to save time on the segment finding.

Definition at line 331 of file CSCSegAlgoST.cc.

References begin, dXclusBoxMax, dYclusBoxMax, end, i, LogDebug, size, pyDBSRunClass::temp, theChamber, x, and y.

Referenced by run().

00331                                                                                                                             {
00332   theChamber = aChamber; 
00333 
00334   std::vector<ChamberHitContainer> rechits_clusters; // this is a collection of groups of rechits
00335   //   const float dXclus_box_cut       = 4.; // seems to work reasonably 070116
00336   //   const float dYclus_box_cut       = 8.; // seems to work reasonably 070116
00337 
00338   float dXclus = 0.0;
00339   float dYclus = 0.0;
00340   float dXclus_box = 0.0;
00341   float dYclus_box = 0.0;
00342 
00343   std::vector<const CSCRecHit2D*> temp;
00344 
00345   std::vector< ChamberHitContainer > seeds;
00346 
00347   std::vector<float> running_meanX;
00348   std::vector<float> running_meanY;
00349 
00350   std::vector<float> seed_minX;
00351   std::vector<float> seed_maxX;
00352   std::vector<float> seed_minY;
00353   std::vector<float> seed_maxY;
00354 
00355   //std::cout<<"*************************************************************"<<std::endl;
00356   //std::cout<<"Called clusterHits in Chamber "<< theChamber->specs()->chamberTypeName()<<std::endl;
00357   //std::cout<<"*************************************************************"<<std::endl;
00358 
00359   // split rechits into subvectors and return vector of vectors:
00360   // Loop over rechits 
00361   // Create one seed per hit
00362   for(unsigned int i = 0; i < rechits.size(); ++i) {
00363 
00364     temp.clear();
00365 
00366     temp.push_back(rechits[i]);
00367 
00368     seeds.push_back(temp);
00369 
00370     // First added hit in seed defines the mean to which the next hit is compared
00371     // for this seed.
00372 
00373     running_meanX.push_back( rechits[i]->localPosition().x() );
00374     running_meanY.push_back( rechits[i]->localPosition().y() );
00375         
00376     // set min/max X and Y for box containing the hits in the precluster:
00377     seed_minX.push_back( rechits[i]->localPosition().x() );
00378     seed_maxX.push_back( rechits[i]->localPosition().x() );
00379     seed_minY.push_back( rechits[i]->localPosition().y() );
00380     seed_maxY.push_back( rechits[i]->localPosition().y() );
00381   }
00382     
00383   // merge clusters that are too close
00384   // measure distance between final "running mean"
00385   for(uint NNN = 0; NNN < seeds.size(); ++NNN) {
00386         
00387     for(uint MMM = NNN+1; MMM < seeds.size(); ++MMM) {
00388       if(running_meanX[MMM] == 999999. || running_meanX[NNN] == 999999. ) {
00389         LogDebug("CSC") << "CSCSegmentST::clusterHits: Warning: Skipping used seeds, this should happen - inform developers!\n";      
00390         //      std::cout<<"We should never see this line now!!!"<<std::endl;
00391         continue; //skip seeds that have been used 
00392       }
00393           
00394       // calculate cut criteria for simple running mean distance cut:
00395       dXclus = fabs(running_meanX[NNN] - running_meanX[MMM]);
00396       dYclus = fabs(running_meanY[NNN] - running_meanY[MMM]);
00397 
00398       // calculate minmal distance between precluster boxes containing the hits:
00399       if ( running_meanX[NNN] > running_meanX[MMM] ) dXclus_box = seed_minX[NNN] - seed_maxX[MMM];
00400       else                                           dXclus_box = seed_minX[MMM] - seed_maxX[NNN];
00401       if ( running_meanY[NNN] > running_meanY[MMM] ) dYclus_box = seed_minY[NNN] - seed_maxY[MMM];
00402       else                                           dYclus_box = seed_minY[MMM] - seed_maxY[NNN];
00403           
00404           
00405       if( dXclus_box < dXclusBoxMax && dYclus_box < dYclusBoxMax ) {
00406         // merge clusters!
00407         // merge by adding seed NNN to seed MMM and erasing seed NNN
00408             
00409         // calculate running mean for the merged seed:
00410         running_meanX[MMM] = (running_meanX[NNN]*seeds[NNN].size() + running_meanX[MMM]*seeds[MMM].size()) / (seeds[NNN].size()+seeds[MMM].size());
00411         running_meanY[MMM] = (running_meanY[NNN]*seeds[NNN].size() + running_meanY[MMM]*seeds[MMM].size()) / (seeds[NNN].size()+seeds[MMM].size());
00412             
00413         // update min/max X and Y for box containing the hits in the merged cluster:
00414         if ( seed_minX[NNN] <= seed_minX[MMM] ) seed_minX[MMM] = seed_minX[NNN];
00415         if ( seed_maxX[NNN] >  seed_maxX[MMM] ) seed_maxX[MMM] = seed_maxX[NNN];
00416         if ( seed_minY[NNN] <= seed_minY[MMM] ) seed_minY[MMM] = seed_minY[NNN];
00417         if ( seed_maxY[NNN] >  seed_maxY[MMM] ) seed_maxY[MMM] = seed_maxY[NNN];
00418             
00419         // add seed NNN to MMM (lower to larger number)
00420         seeds[MMM].insert(seeds[MMM].end(),seeds[NNN].begin(),seeds[NNN].end());
00421             
00422         // mark seed NNN as used (at the moment just set running mean to 999999.)
00423         running_meanX[NNN] = 999999.;
00424         running_meanY[NNN] = 999999.;
00425         // we have merged a seed (NNN) to the highter seed (MMM) - need to contimue to 
00426         // next seed (NNN+1)
00427         break;
00428       }
00429 
00430     }
00431   }
00432 
00433   // hand over the final seeds to the output
00434   // would be more elegant if we could do the above step with 
00435   // erasing the merged ones, rather than the 
00436   for(uint NNN = 0; NNN < seeds.size(); ++NNN) {
00437     if(running_meanX[NNN] == 999999.) continue; //skip seeds that have been marked as used up in merging
00438     rechits_clusters.push_back(seeds[NNN]);
00439   }
00440 
00441   //***************************************************************
00442 
00443       return rechits_clusters; 
00444 }
00445 

HepMatrix CSCSegAlgoST::derivativeMatrix ( void   )  const [private]

Definition at line 1626 of file CSCSegAlgoST.cc.

01632                                                                  {
01633     
01634     const CSCRecHit2D& hit = (**it);
01635     const CSCLayer* layer = theChamber->layer(hit.cscDetId().layer());
01636     GlobalPoint gp = layer->toGlobal(hit.localPosition());      
01637     LocalPoint lp = theChamber->toLocal(gp); 
01638     float z = lp.z();
01639     ++row;
01640     matrix(row, 1) = 1.;
01641     matrix(row, 3) = z;
01642     ++row;
01643     matrix(row, 2) = 1.;
01644     matrix(row, 4) = z;
01645   }
01646   return matrix;
01647 }
01648 

void CSCSegAlgoST::fillChiSquared ( void   )  [private]

Definition at line 1535 of file CSCSegAlgoST.cc.

References CSCRecHit2D::cscDetId(), CSCDetId::layer(), CSCChamber::layer(), CSCRecHit2D::localPosition(), CSCRecHit2D::localPositionError(), LogDebug, protoIntercept, protoSlope_u, protoSlope_v, theChamber, GeomDet::toGlobal(), GeomDet::toLocal(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), LocalError::xy(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by prune_bad_hits().

01539                                                                   {
01540     
01541     const CSCRecHit2D& hit = (**ih);
01542     const CSCLayer* layer  = theChamber->layer(hit.cscDetId().layer());
01543     GlobalPoint gp         = layer->toGlobal(hit.localPosition());
01544     LocalPoint lp          = theChamber->toLocal(gp);
01545     
01546     double u = lp.x();
01547     double v = lp.y();
01548     double z = lp.z();
01549     
01550     double du = protoIntercept.x() + protoSlope_u * z - u;
01551     double dv = protoIntercept.y() + protoSlope_v * z - v;
01552     
01553     HepMatrix IC(2,2);
01554     IC(1,1) = hit.localPositionError().xx();
01555     IC(1,2) = hit.localPositionError().xy();
01556     IC(2,2) = hit.localPositionError().yy();
01557     IC(2,1) = IC(1,2);
01558     
01559     // Invert covariance matrix
01560     int ierr = 0;
01561     IC.invert(ierr);
01562     if (ierr != 0) {
01563       LogDebug("CSC") << "CSCSegment::fillChiSquared: failed to invert covariance matrix=\n" << IC << "\n";
01564       //       std::cout << "CSCSegment::fillChiSquared: failed to invert covariance matrix=\n" << IC << "\n";
01565       
01566     }
01567     
01568     chsq += du*du*IC(1,1) + 2.*du*dv*IC(1,2) + dv*dv*IC(2,2);
01569   }
01570 
01571   protoChi2 = chsq;
01572 }
01573 /* fillLocalDirection

void CSCSegAlgoST::fillLocalDirection ( void   )  [private]

Definition at line 1577 of file CSCSegAlgoST.cc.

Referenced by prune_bad_hits().

01588         : Examine its direction and origin in global z: to point outward
01589   // the localDir should always have same sign as global z...
01590   
01591   double globalZpos    = ( theChamber->toGlobal( protoIntercept ) ).z();
01592   double globalZdir    = ( theChamber->toGlobal( localDir ) ).z();
01593   double directionSign = globalZpos * globalZdir;
01594   protoDirection       = (directionSign * localDir).unit();
01595 }
01596 /* weightMatrix

void CSCSegAlgoST::fitSlopes ( void   )  [private]

Definition at line 1471 of file CSCSegAlgoST.cc.

Referenced by prune_bad_hits().

01474                                                                   {
01475     const CSCRecHit2D& hit = (**ih);
01476     const CSCLayer* layer  = theChamber->layer(hit.cscDetId().layer());
01477     GlobalPoint gp         = layer->toGlobal(hit.localPosition());
01478     LocalPoint  lp         = theChamber->toLocal(gp); 
01479     // ptc: Local position of hit w.r.t. chamber
01480     double u = lp.x();
01481     double v = lp.y();
01482     double z = lp.z();
01483     // ptc: Covariance matrix of local errors 
01484     HepMatrix IC(2,2);
01485     IC(1,1) = hit.localPositionError().xx();
01486     IC(1,2) = hit.localPositionError().xy();
01487     IC(2,2) = hit.localPositionError().yy();
01488     IC(2,1) = IC(1,2); // since Cov is symmetric
01489     // ptc: Invert covariance matrix (and trap if it fails!)
01490     int ierr = 0;
01491     IC.invert(ierr); // inverts in place
01492     if (ierr != 0) {
01493       LogDebug("CSC") << "CSCSegment::fitSlopes: failed to invert covariance matrix=\n" << IC << "\n";      
01494       //       std::cout<< "CSCSegment::fitSlopes: failed to invert covariance matrix=\n" << IC << "\n"<<std::endl;
01495     }
01496     
01497     M(1,1) += IC(1,1);
01498     M(1,2) += IC(1,2);
01499     M(1,3) += IC(1,1) * z;
01500     M(1,4) += IC(1,2) * z;
01501     B(1)   += u * IC(1,1) + v * IC(1,2);
01502     
01503     M(2,1) += IC(2,1);
01504     M(2,2) += IC(2,2);
01505     M(2,3) += IC(2,1) * z;
01506     M(2,4) += IC(2,2) * z;
01507     B(2)   += u * IC(2,1) + v * IC(2,2);
01508     
01509     M(3,1) += IC(1,1) * z;
01510     M(3,2) += IC(1,2) * z;
01511     M(3,3) += IC(1,1) * z * z;
01512     M(3,4) += IC(1,2) * z * z;
01513     B(3)   += ( u * IC(1,1) + v * IC(1,2) ) * z;
01514     
01515     M(4,1) += IC(2,1) * z;
01516     M(4,2) += IC(2,2) * z;
01517     M(4,3) += IC(2,1) * z * z;
01518     M(4,4) += IC(2,2) * z * z;
01519     B(4)   += ( u * IC(2,1) + v * IC(2,2) ) * z;
01520   }
01521   HepVector p = solve(M, B);
01522   
01523   // Update member variables 
01524   // Note that origin has local z = 0
01525   protoIntercept = LocalPoint(p(1), p(2), 0.);
01526   protoSlope_u = p(3);
01527   protoSlope_v = p(4);
01528 }
01529 /* Method fillChiSquared

void CSCSegAlgoST::flipErrors ( AlgebraicSymMatrix a  )  const [private]

Definition at line 1670 of file CSCSegAlgoST.cc.

Referenced by prune_bad_hits().

std::vector< CSCSegment > CSCSegAlgoST::prune_bad_hits ( const CSCChamber aChamber,
std::vector< CSCSegment segments 
)

Remove bad hits from found segments based not only on chi2, but also on charge and further "low level" chamber information.

Definition at line 143 of file CSCSegAlgoST.cc.

References begin, BrutePruning, calculateError(), CSCSegment::chi2(), ChiSquaredProbability(), e, fillChiSquared(), fillLocalDirection(), fitSlopes(), flipErrors(), it, CSCChamber::layer(), m, CSCSegment::nRecHits(), protoChi2, protoDirection, protoIntercept, protoSegment, radius(), pyDBSRunClass::temp, theChamber, GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by run().

00143                                                                                                              {
00144   
00145   //   std::cout<<"*************************************************************"<<std::endl;
00146   //   std::cout<<"Called prune_bad_hits in Chamber "<< theChamber->specs()->chamberTypeName()<<std::endl;
00147   //   std::cout<<"*************************************************************"<<std::endl;
00148   
00149   std::vector<CSCSegment>          segments_temp;
00150   std::vector<ChamberHitContainer> rechits_clusters; // this is a collection of groups of rechits
00151   
00152   const float chi2ndfProbMin = 1.0e-4;
00153   bool   use_brute_force = BrutePruning;
00154 
00155   int hit_nr = 0;
00156   int hit_nr_worst = -1;
00157   int hit_nr_2ndworst = -1;
00158   
00159   for(std::vector<CSCSegment>::iterator it=segments.begin(); it != segments.end(); it++) {
00160     
00161     if( !use_brute_force ) {// find worst hit
00162       
00163       float chisq    = (*it).chi2();
00164       int nhits      = (*it).nRecHits();
00165       LocalPoint localPos = (*it).localPosition();
00166       LocalVector segDir = (*it).localDirection();
00167       const CSCChamber* cscchamber = theChamber;
00168       float globZ       ;
00169           
00170       GlobalPoint globalPosition = cscchamber->toGlobal(localPos);
00171       globZ = globalPosition.z();
00172       
00173       
00174       if( ChiSquaredProbability((double)chisq,(double)(2*nhits-4)) < chi2ndfProbMin  ) {
00175 
00176         // find (rough) "residuals" (NOT excluding the hit from the fit - speed!) of hits on segment
00177         std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
00178         std::vector<CSCRecHit2D>::const_iterator iRH_worst;
00179         float xdist_local       = -99999.;
00180 
00181         float xdist_local_worst_sig = -99999.;
00182         float xdist_local_2ndworst_sig = -99999.;
00183         float xdist_local_sig       = -99999.;
00184 
00185         hit_nr = 0;
00186         hit_nr_worst = -1;
00187         hit_nr_2ndworst = -1;
00188 
00189         for ( std::vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
00190           //mark "worst" hit:
00191           
00192           float z_at_target ;
00193           float radius      ;
00194           float loc_x_at_target ;
00195           float loc_y_at_target ;
00196           float loc_z_at_target ;
00197 
00198           z_at_target  = 0.;
00199           loc_x_at_target  = 0.;
00200           loc_y_at_target  = 0.;
00201           loc_z_at_target  = 0.;
00202           radius       = 0.;
00203           
00204           // set the z target in CMS global coordinates:
00205           const CSCLayer* csclayerRH = theChamber->layer((*iRH).cscDetId().layer());
00206           LocalPoint localPositionRH = (*iRH).localPosition();
00207           GlobalPoint globalPositionRH = csclayerRH->toGlobal(localPositionRH); 
00208           
00209           LocalError rerrlocal = (*iRH).localPositionError();  
00210           float xxerr = rerrlocal.xx();
00211           
00212           float target_z     = globalPositionRH.z();  // target z position in cm (z pos of the hit)
00213           
00214           if(target_z > 0.) {
00215             loc_x_at_target = localPos.x() + (segDir.x()/fabs(segDir.z())*( target_z - globZ ));
00216             loc_y_at_target = localPos.y() + (segDir.y()/fabs(segDir.z())*( target_z - globZ ));
00217             loc_z_at_target = target_z;
00218           }
00219           else {
00220             loc_x_at_target = localPos.x() + ((-1)*segDir.x()/fabs(segDir.z())*( target_z - globZ ));
00221             loc_y_at_target = localPos.y() + ((-1)*segDir.y()/fabs(segDir.z())*( target_z - globZ ));
00222             loc_z_at_target = target_z;
00223           }
00224           // have to transform the segments coordinates back to the local frame... how?!!!!!!!!!!!!
00225           
00226           xdist_local  = fabs(localPositionRH.x() - loc_x_at_target);
00227           xdist_local_sig  = fabs((localPositionRH.x() -loc_x_at_target)/(xxerr));
00228           
00229           if( xdist_local_sig > xdist_local_worst_sig ) {
00230             xdist_local_2ndworst_sig = xdist_local_worst_sig;
00231             xdist_local_worst_sig    = xdist_local_sig;
00232             iRH_worst            = iRH;
00233             hit_nr_2ndworst = hit_nr_worst;
00234             hit_nr_worst = hit_nr;
00235           }
00236           else if(xdist_local_sig > xdist_local_2ndworst_sig) {
00237             xdist_local_2ndworst_sig = xdist_local_sig;
00238             hit_nr_2ndworst = hit_nr;
00239           }
00240           ++hit_nr;
00241         }
00242 
00243         // reset worst hit number if certain criteria apply.
00244         // Criteria: 2nd worst hit must be at least a factor of
00245         // 1.5 better than the worst in terms of sigma:
00246         if ( xdist_local_worst_sig / xdist_local_2ndworst_sig < 1.5 ) {
00247           hit_nr_worst    = -1;
00248           hit_nr_2ndworst = -1;
00249         }
00250       }
00251     }
00252 
00253     // if worst hit was found, refit without worst hit and select if considerably better than original fit.
00254     // Can also use brute force: refit all n-1 hit segments and choose one over the n hit if considerably "better"
00255    
00256     std::vector< CSCRecHit2D > buffer;
00257     std::vector< std::vector< CSCRecHit2D > > reduced_segments;
00258     std::vector< CSCRecHit2D > theseRecHits = (*it).specificRecHits();
00259     float best_red_seg_prob = 0.0;
00260     // usefor chi2 1 diff   float best_red_seg_prob = 99999.;
00261     buffer.clear();
00262 
00263     if( ChiSquaredProbability((double)(*it).chi2(),(double)((2*(*it).nRecHits())-4)) < chi2ndfProbMin  ) {
00264         
00265       buffer = theseRecHits;
00266 
00267       // Dirty switch: here one can select to refit all possible subsets or just the one without the 
00268       // tagged worst hit:
00269       if( use_brute_force ) { // Brute force method: loop over all possible segments:
00270         for(uint bi = 0; bi < buffer.size(); bi++) {
00271           reduced_segments.push_back(buffer);
00272           reduced_segments[bi].erase(reduced_segments[bi].begin()+(bi),reduced_segments[bi].begin()+(bi+1));
00273         }
00274       }
00275       else { // More elegant but still biased: erase only worst hit
00276         // Comment: There is not a very strong correlation of the worst hit with the one that one should remove... 
00277         if( hit_nr_worst >= 0 && hit_nr_worst <= int(buffer.size())  ) {
00278           // fill segment in buffer, delete worst hit
00279           buffer.erase(buffer.begin()+(hit_nr_worst),buffer.begin()+(hit_nr_worst+1));
00280           reduced_segments.push_back(buffer);
00281         }
00282         else {
00283           // only fill segment in array, do not delete anything
00284           reduced_segments.push_back(buffer);
00285         }
00286       }
00287     }
00288       
00289     // Loop over the subsegments and fit (only one segment if "use_brute_force" is false):
00290     for(uint iSegment=0; iSegment<reduced_segments.size(); iSegment++) {
00291       // loop over hits on given segment and push pointers to hits into protosegment
00292       protoSegment.clear();
00293       for(uint m = 0; m<reduced_segments[iSegment].size(); ++m ) {
00294         protoSegment.push_back(&reduced_segments[iSegment][m]);
00295       }
00296       fitSlopes(); 
00297       fillChiSquared();
00298       fillLocalDirection();
00299       // calculate error matrix
00300       AlgebraicSymMatrix protoErrors = calculateError();   
00301       // but reorder components to match what's required by TrackingRecHit interface 
00302       // i.e. slopes first, then positions 
00303       flipErrors( protoErrors ); 
00304       //
00305       CSCSegment temp(protoSegment, protoIntercept, protoDirection, protoErrors, protoChi2);
00306 
00307       // replace n hit segment with n-1 hit segment, if segment probability is 1e3 better:
00308       if( ( ChiSquaredProbability((double)(*it).chi2(),(double)((2*(*it).nRecHits())-4)) 
00309             < 
00310             (1.e-3)*(ChiSquaredProbability((double)temp.chi2(),(double)(2*temp.nRecHits()-4))) )
00311           && 
00312           ( (ChiSquaredProbability((double)temp.chi2(),(double)(2*temp.nRecHits()-4))) 
00313             > best_red_seg_prob 
00314             )
00315           &&
00316           ( (ChiSquaredProbability((double)temp.chi2(),(double)(2*temp.nRecHits()-4))) > 1e-10 )
00317           ) {
00318         best_red_seg_prob = ChiSquaredProbability((double)temp.chi2(),(double)(2*temp.nRecHits()-4));
00319         // exchange current n hit segment (*it) with better n-1 hit segment:
00320         (*it) = temp;
00321       }
00322     }
00323   }
00324   
00325   return segments;
00326   
00327 }

std::vector< CSCSegment > CSCSegAlgoST::run ( const CSCChamber aChamber,
ChamberHitContainer  rechits 
)

Build segments for all desired groups of hits.

Definition at line 76 of file CSCSegAlgoST.cc.

References a, a_yweightPenaltyThreshold, b, buildSegments(), clusterHits(), preClustering, prune_bad_hits(), Pruning, theChamber, and yweightPenaltyThreshold.

00076                                                                                                {
00077 
00078   // Store chamber in temp memory
00079   theChamber = aChamber; 
00080   // pre-cluster rechits and loop over all sub clusters seperately
00081   std::vector<CSCSegment>          segments_temp;
00082   std::vector<CSCSegment>          segments;
00083   std::vector<ChamberHitContainer> rechits_clusters; // this is a collection of groups of rechits
00084 
00085   // Define yweight penalty depending on chamber. We fixed the relative ratios, but
00086   // they can be scaled by parameters:
00087   
00088   for(int a = 0; a<5; ++a) {
00089     for(int b = 0; b<5; ++b) {
00090       a_yweightPenaltyThreshold[a][b] = 0.0;
00091     }
00092   }
00093   
00094   a_yweightPenaltyThreshold[1][1] = yweightPenaltyThreshold * 10.20;
00095   a_yweightPenaltyThreshold[1][2] = yweightPenaltyThreshold * 14.00;
00096   a_yweightPenaltyThreshold[1][3] = yweightPenaltyThreshold * 20.40;
00097   a_yweightPenaltyThreshold[1][4] = yweightPenaltyThreshold * 10.20;
00098   a_yweightPenaltyThreshold[2][1] = yweightPenaltyThreshold *  7.60;
00099   a_yweightPenaltyThreshold[2][2] = yweightPenaltyThreshold * 20.40;
00100   a_yweightPenaltyThreshold[3][1] = yweightPenaltyThreshold *  7.60;
00101   a_yweightPenaltyThreshold[3][2] = yweightPenaltyThreshold * 20.40;
00102   a_yweightPenaltyThreshold[4][1] = yweightPenaltyThreshold *  6.75;
00103   
00104   if(preClustering) {
00105     // run a pre-clusterer on the given rechits to split obviously separated segment seeds:
00106     rechits_clusters = clusterHits( theChamber, rechits );
00107     // loop over the found clusters:
00108     for(std::vector<ChamberHitContainer>::iterator sub_rechits = rechits_clusters.begin(); sub_rechits !=  rechits_clusters.end(); ++sub_rechits ) {
00109       // clear the buffer for the subset of segments:
00110       segments_temp.clear();
00111       // build the subset of segments:
00112       segments_temp = buildSegments( (*sub_rechits) );
00113       // add the found subset of segments to the collection of all segments in this chamber:
00114       segments.insert( segments.end(), segments_temp.begin(), segments_temp.end() );
00115     }
00116     // this is the place to prune:
00117     if( Pruning ) {
00118       segments_temp.clear(); // segments_temp needed?!?!
00119       segments_temp = prune_bad_hits( theChamber, segments );
00120       segments.clear(); // segments_temp needed?!?!
00121       segments = segments_temp; // segments_temp needed?!?!
00122     }
00123     return segments;
00124   }
00125   else {
00126     segments = buildSegments(rechits);
00127     if( Pruning ) {
00128       segments_temp.clear(); // segments_temp needed?!?!
00129       segments_temp = prune_bad_hits( theChamber, segments );
00130       segments.clear(); // segments_temp needed?!?!
00131       segments = segments_temp; // segments_temp needed?!?!
00132     }
00133     return segments;
00134     //return buildSegments(rechits); 
00135   }
00136 }

double CSCSegAlgoST::theWeight ( double  coordinate_1,
double  coordinate_2,
double  coordinate_3,
float  layer_1,
float  layer_2,
float  layer_3 
) [private]

Utility functions.

Definition at line 447 of file CSCSegAlgoST.cc.

AlgebraicSymMatrix CSCSegAlgoST::weightMatrix ( void   )  const [private]

Definition at line 1600 of file CSCSegAlgoST.cc.

01606                                                                   {
01607     
01608     const CSCRecHit2D& hit = (**it);
01609     ++row;
01610     matrix(row, row)   = hit.localPositionError().xx();
01611     matrix(row, row+1) = hit.localPositionError().xy();
01612     ++row;
01613     matrix(row, row-1) = hit.localPositionError().xy();
01614     matrix(row, row)   = hit.localPositionError().yy();
01615   }
01616   int ierr;
01617   matrix.invert(ierr);
01618   return matrix;
01619 }
01620 


Member Data Documentation

float CSCSegAlgoST::a_yweightPenaltyThreshold[5][5] [private]

Definition at line 169 of file CSCSegAlgoST.h.

Referenced by run().

bool CSCSegAlgoST::BrutePruning [private]

Definition at line 161 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST(), and prune_bad_hits().

std::vector< ChamberHitContainer > CSCSegAlgoST::chosen_Psegments [private]

Definition at line 115 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::chosen_weight_A [private]

Definition at line 124 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::curv_A [private]

Definition at line 125 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::curv_noL1_A [private]

Definition at line 126 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::curv_noL2_A [private]

Definition at line 127 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::curv_noL3_A [private]

Definition at line 128 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::curv_noL4_A [private]

Definition at line 129 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::curv_noL5_A [private]

Definition at line 130 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::curv_noL6_A [private]

Definition at line 131 of file CSCSegAlgoST.h.

double CSCSegAlgoST::curvePenalty [private]

Definition at line 175 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST().

double CSCSegAlgoST::curvePenaltyThreshold [private]

Definition at line 174 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST().

bool CSCSegAlgoST::debug [private]

Definition at line 150 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST().

double CSCSegAlgoST::dXclusBoxMax [private]

Definition at line 156 of file CSCSegAlgoST.h.

Referenced by clusterHits(), and CSCSegAlgoST().

double CSCSegAlgoST::dYclusBoxMax [private]

Definition at line 157 of file CSCSegAlgoST.h.

Referenced by clusterHits(), and CSCSegAlgoST().

Segments CSCSegAlgoST::GoodSegments [private]

Definition at line 102 of file CSCSegAlgoST.h.

Referenced by ChooseSegments3().

double CSCSegAlgoST::hitDropLimit4Hits [private]

Definition at line 165 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST().

double CSCSegAlgoST::hitDropLimit5Hits [private]

Definition at line 166 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST().

double CSCSegAlgoST::hitDropLimit6Hits [private]

Definition at line 167 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST().

int CSCSegAlgoST::maxRecHitsInCluster [private]

Definition at line 158 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST().

int CSCSegAlgoST::minHitsPerSegment [private]

Definition at line 153 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST().

const std::string CSCSegAlgoST::myName [private]

Definition at line 100 of file CSCSegAlgoST.h.

bool CSCSegAlgoST::onlyBestSegment [private]

Definition at line 162 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST().

ChamberHitContainer CSCSegAlgoST::PAhits_onLayer[6] [private]

Definition at line 104 of file CSCSegAlgoST.h.

bool CSCSegAlgoST::preClustering [private]

Definition at line 159 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST(), and run().

double CSCSegAlgoST::protoChi2 [private]

Definition at line 146 of file CSCSegAlgoST.h.

Referenced by prune_bad_hits().

LocalVector CSCSegAlgoST::protoDirection [private]

Definition at line 147 of file CSCSegAlgoST.h.

Referenced by prune_bad_hits().

LocalPoint CSCSegAlgoST::protoIntercept [private]

Definition at line 145 of file CSCSegAlgoST.h.

Referenced by fillChiSquared(), and prune_bad_hits().

ChamberHitContainer CSCSegAlgoST::protoSegment [private]

Definition at line 142 of file CSCSegAlgoST.h.

Referenced by prune_bad_hits().

float CSCSegAlgoST::protoSlope_u [private]

Definition at line 143 of file CSCSegAlgoST.h.

Referenced by fillChiSquared().

float CSCSegAlgoST::protoSlope_v [private]

Definition at line 144 of file CSCSegAlgoST.h.

Referenced by fillChiSquared().

bool CSCSegAlgoST::Pruning [private]

Definition at line 160 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST(), and run().

std::vector< ChamberHitContainer > CSCSegAlgoST::Psegments [private]

Definition at line 107 of file CSCSegAlgoST.h.

Referenced by ChooseSegments2().

ChamberHitContainer CSCSegAlgoST::Psegments_hits [private]

Definition at line 105 of file CSCSegAlgoST.h.

std::vector< ChamberHitContainer > CSCSegAlgoST::Psegments_noL1 [private]

Definition at line 109 of file CSCSegAlgoST.h.

std::vector< ChamberHitContainer > CSCSegAlgoST::Psegments_noL2 [private]

Definition at line 110 of file CSCSegAlgoST.h.

std::vector< ChamberHitContainer > CSCSegAlgoST::Psegments_noL3 [private]

Definition at line 111 of file CSCSegAlgoST.h.

std::vector< ChamberHitContainer > CSCSegAlgoST::Psegments_noL4 [private]

Definition at line 112 of file CSCSegAlgoST.h.

std::vector< ChamberHitContainer > CSCSegAlgoST::Psegments_noL5 [private]

Definition at line 113 of file CSCSegAlgoST.h.

std::vector< ChamberHitContainer > CSCSegAlgoST::Psegments_noL6 [private]

Definition at line 114 of file CSCSegAlgoST.h.

std::vector< ChamberHitContainer > CSCSegAlgoST::Psegments_noLx [private]

Definition at line 108 of file CSCSegAlgoST.h.

CSCSegAlgoShowering* CSCSegAlgoST::showering_ [private]

Definition at line 176 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST(), and ~CSCSegAlgoST().

const CSCChamber* CSCSegAlgoST::theChamber [private]

Definition at line 101 of file CSCSegAlgoST.h.

Referenced by clusterHits(), fillChiSquared(), prune_bad_hits(), and run().

bool CSCSegAlgoST::useShowering [private]

Definition at line 163 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST().

std::vector< float > CSCSegAlgoST::weight_A [private]

Definition at line 116 of file CSCSegAlgoST.h.

Referenced by ChooseSegments2().

std::vector< float > CSCSegAlgoST::weight_B [private]

Definition at line 132 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::weight_noL1_A [private]

Definition at line 118 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::weight_noL1_B [private]

Definition at line 133 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::weight_noL2_A [private]

Definition at line 119 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::weight_noL2_B [private]

Definition at line 134 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::weight_noL3_A [private]

Definition at line 120 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::weight_noL3_B [private]

Definition at line 135 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::weight_noL4_A [private]

Definition at line 121 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::weight_noL4_B [private]

Definition at line 136 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::weight_noL5_A [private]

Definition at line 122 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::weight_noL5_B [private]

Definition at line 137 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::weight_noL6_A [private]

Definition at line 123 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::weight_noL6_B [private]

Definition at line 138 of file CSCSegAlgoST.h.

std::vector< float > CSCSegAlgoST::weight_noLx_A [private]

Definition at line 117 of file CSCSegAlgoST.h.

double CSCSegAlgoST::yweightPenalty [private]

Definition at line 172 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST().

double CSCSegAlgoST::yweightPenaltyThreshold [private]

Definition at line 171 of file CSCSegAlgoST.h.

Referenced by CSCSegAlgoST(), and run().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:26 2009 for CMSSW by  doxygen 1.5.4