31   return StatusCode::SUCCESS;
 
   36                                                 std::vector<TrigL2MuonSA::TrackPattern> &v_trackPatterns,
 
   44   if( !cscHits.empty() ){
 
   49       int hash_clusters[32]={0};      
 
   52       for(
unsigned int iclu=0; iclu<cscHits.size(); ++iclu){
 
   63     if(0<=module_hash && 32>module_hash){
 
   64       clusters[module_hash][cathodelayer].push_back( cscHit );        
 
   65       hash_clusters[module_hash]=1;
 
   73       int hashSPs[2]={999,999};
 
   76     bool found_segment=
false;
 
   77     for(
int ihash=0; ihash<2; ++ihash){
 
   78       if(found_segment) 
break;
 
   80       int hashSP=hashSPs[ihash];
 
   81       if(hashSP>32) 
continue;
 
   87         track.hashID_CSC = hashSP;
 
   93         bool &large_dphidz = 
track.large_dPhidZ;
 
   94         double &outerCorFactor =  
track.outerCorFactor;
 
   97         double tgcmid1z = tgcFitResult.
tgcMid1[3];
 
   98         double tgcmid2z = tgcFitResult.
tgcMid2[3];
 
   99         double phimiddle = tgcFitResult.
phi;
 
  100         double dPhidz = tgcFitResult.
dPhidZ;
 
  101         if( 0.75
e-6<std::abs(dPhidz) ) large_dphidz=
true;
 
  102         double tgcmidZ = (tgcmid1z+tgcmid2z)/2.;
 
  103         double outerz = outerSP->
Z;
 
  109         double CSCZ=cscsegment_ext.
z();
 
  110         double PhiAtCsc = phimiddle;
 
  114         superPoint->
Z = CSCZ;
 
  115         superPoint->
R = CSCSPR;
 
  121               << 
",CSCR=" << CSCSPR << 
",CSCZ=" << CSCZ 
 
  122               << 
",Slope=" << cscsegment_ext.
slopeRZ() << 
",Intercept=" << cscsegment_ext.
interceptRZ()
 
  123               << 
",nHitsEta=" << cscsegment_ext.
nHitEta() << 
",Chi2="<< cscsegment_ext.
chiSquare());
 
  126         double phiouter = phimiddle+std::abs(outerz-tgcmidZ)*dPhidz;
 
  148   ATH_MSG_DEBUG(
"################################## make_segment #####################################");
 
  150   std::vector<localCscHit> hits_loc_eta[4], hits_loc_phi[4],emp;
 
  152   for(
int i =0;
i<4;++
i){
 
  175   gToLocal=translation*rotPIamg*rotYamg*rotZamg;
 
  191   for (
unsigned int clyr=0; clyr<8; ++clyr) {
 
  192     for (
unsigned int ihit=0; ihit<
clusters[clyr].size(); ++ihit) {
 
  226   Amg::Vector3D seg_pos_loc, seg_dir_loc,seg_pos_loc_noip, seg_dir_loc_noip;
 
  228   local2dSegment seg2d_eta ,seg2d_phi, seg2d_eta_noip, seg2d_phi_noip;
 
  245   Amg::Vector3D seg_dir_noip = lToGlobal.rotation()*seg_dir_loc_noip;
 
  249   cscsegment.
set(seg_pos,seg_dir, seg2d_eta.
chi2, seg2d_phi.
chi2);
 
  252   cscsegment_noip.
set(seg_pos_noip,seg_dir_noip, seg2d_eta_noip.
chi2, seg2d_phi_noip.
chi2);
 
  269   std::vector<int> hit_lyr;
 
  273   for (
int i=0; 
i<4; ++
i ){
 
  274     if( 0==hits_loc[
i].
size() ) ++nohit;
 
  277   std::vector<local2dSegment> seg2d_4hitCollection,seg2d_3hitCollection;
 
  278   seg2d_4hitCollection.clear(); seg2d_3hitCollection.clear();
 
  279   std::vector<localCscHit> hits_loc_copy[4];
 
  280   for (
int i=0;
i<4;++
i) hits_loc_copy[
i] = hits_loc[
i];
 
  291   } 
else if(1==nohit) {
 
  302   for(
unsigned int iseg4=0; iseg4< seg2d_4hitCollection.size(); ++iseg4){
 
  304     if( std::abs( seg2d_4hitCollection[iseg4].
residual ) < std::abs(seg2d.
residual) ){
 
  305       seg2d=seg2d_4hitCollection[iseg4];
 
  310   for(
unsigned int iseg3=0; iseg3< seg2d_3hitCollection.size(); ++iseg3){
 
  312     if( std::abs( seg2d_3hitCollection[iseg3].
residual ) < std::abs(seg2d.
residual) ){
 
  313       seg2d=seg2d_3hitCollection[iseg3];
 
  328                                              std::vector<localCscHit>  hits_loc[4], 
 
  329                                              std::vector<local2dSegment> &seg2d_4hitCollection,
 
  333   std::vector<localCscHit> hit_fit;
 
  335   for (
unsigned int ihit0=0; ihit0<hits_loc[0].size(); ++ihit0) {
 
  336     for (
unsigned int ihit1=0; ihit1<hits_loc[1].size(); ++ihit1) {
 
  337       for (
unsigned int ihit2=0; ihit2<hits_loc[2].size(); ++ihit2) {
 
  338         for (
unsigned int ihit3=0; ihit3<hits_loc[3].size(); ++ihit3) {
 
  342           hit_fit.push_back(ip_loc);
 
  343           hit_fit.push_back(hits_loc[0][ihit0]);
 
  344           hit_fit.push_back(hits_loc[1][ihit1]);
 
  345           hit_fit.push_back(hits_loc[2][ihit2]);
 
  346           hit_fit.push_back(hits_loc[3][ihit3]);
 
  354             seg2d_tmp.
localHits.push_back(hits_loc[0][ihit0]);
 
  355             seg2d_tmp.
localHits.push_back(hits_loc[1][ihit1]);
 
  356             seg2d_tmp.
localHits.push_back(hits_loc[2][ihit2]);
 
  357             seg2d_tmp.
localHits.push_back(hits_loc[3][ihit3]);
 
  359             hits_loc[0][ihit0].enabled=
false;
 
  360             hits_loc[1][ihit1].enabled=
false;
 
  361             hits_loc[2][ihit2].enabled=
false;
 
  362             hits_loc[3][ihit3].enabled=
false;
 
  364             seg2d_4hitCollection.push_back(seg2d_tmp);
 
  375   std::vector<localCscHit> hit_loc_left[4];
 
  376   for (
unsigned int ilyr=0;ilyr<4; ++ilyr){
 
  377     for(
unsigned int ihit=0; ihit < hits_loc[ilyr].size(); ++ihit){
 
  379       if ( 
true==hits_loc[ilyr][ihit].enabled ){
 
  380         hit_loc_left[ilyr].push_back(hits_loc[ilyr][ihit]);
 
  385   for(
int ilyr=0; ilyr<4; ++ilyr) hits_loc[ilyr]=hit_loc_left[ilyr];
 
  396                                              const std::vector<localCscHit> hits_loc[4],
 
  397                                              std::vector<local2dSegment> &seg2d_3hitCollection,
 
  403   for (
int ilyr=0; ilyr<4; ++ilyr ){
 
  404     if( 0==hits_loc[ilyr].
size() ){
 
  412   std::vector<localCscHit> hit_fit;
 
  415   int hit_lyrA[4] = {1, 2, 3, 0};
 
  416   int hit_lyrB[4] = {2, 3, 0, 1};
 
  417   int hit_lyrC[4] = {3, 0, 1, 2};
 
  419   for(
int lyrcomb=0; lyrcomb<4; ++lyrcomb){
 
  421     if(0<=empty_lyr && empty_lyr!=lyrcomb) 
continue;
 
  423     for (
unsigned int ihitA=0; ihitA<hits_loc[hit_lyrA[lyrcomb]].size(); ++ihitA) {
 
  424       for (
unsigned int ihitB=0; ihitB<hits_loc[hit_lyrB[lyrcomb]].size(); ++ihitB) {
 
  425         for (
unsigned int ihitC=0; ihitC<hits_loc[hit_lyrC[lyrcomb]].size(); ++ihitC) {
 
  428           hit_fit.push_back(ip_loc);
 
  429           hit_fit.push_back(hits_loc[hit_lyrA[lyrcomb]][ihitA]);
 
  430           hit_fit.push_back(hits_loc[hit_lyrB[lyrcomb]][ihitB]);
 
  431           hit_fit.push_back(hits_loc[hit_lyrC[lyrcomb]][ihitC]);
 
  439             seg2d_tmp.
localHits.push_back(hits_loc[hit_lyrA[lyrcomb]][ihitA]);
 
  440             seg2d_tmp.
localHits.push_back(hits_loc[hit_lyrB[lyrcomb]][ihitB]);
 
  441             seg2d_tmp.
localHits.push_back(hits_loc[hit_lyrC[lyrcomb]][ihitC]);
 
  442             seg2d_3hitCollection.push_back(seg2d_tmp);
 
  476   for (
unsigned int ihit=0; ihit< hits_fit.size(); ++ihit) {
 
  479     double x= hits_fit[ihit].loc_z;
 
  480     double y= (measphi==0) ? hits_fit[ihit].loc_y : hits_fit[ihit].loc_x;
 
  481     double err= hits_fit[ihit].error;
 
  487     if( !hits_fit[ihit].isIP ){
 
  489     aver_res += 
w*hits_fit[ihit].residual;
 
  501   for (
unsigned int ihit=0; ihit< hits_fit.size(); ++ihit) {
 
  503     double x= hits_fit[ihit].loc_z;
 
  504     double y= (measphi==0) ? hits_fit[ihit].loc_y : hits_fit[ihit].loc_x;
 
  505     double err = hits_fit[ihit].error;
 
  507     Stt += 
w*(
x-Sx/
S)*(
x-Sx/
S);
 
  508     aStt += 
w*
y*(
x-Sx/
S);
 
  518     a = seg2d.
a = aStt/Stt;
 
  519     b = seg2d.
b = (Sy-Sx*
a)/
S;
 
  525   seg2d.
chi2  = Syy + 
a*
a*Sxx + 2*
b*
a*Sx + 
b*
b*
S - 2*
b*Sy - 2*
a*Sxy;
 
  540   int nhit_e=seg2d_eta.
nhit;
 
  541   int nhit_p=seg2d_phi.
nhit;
 
  542   double a_eta=seg2d_eta.
a;
 
  543   double b_eta=seg2d_eta.
b;
 
  544   double a_phi=seg2d_phi.
a;
 
  545   double b_phi=seg2d_phi.
b;
 
  546   double rzshift=seg2d_eta.
zshift;
 
  547   double phizshift=seg2d_phi.
zshift;
 
  554   ATH_MSG_DEBUG(
"rzshift=" << rzshift << 
" phizshift=" << phizshift << 
" diff=" << (rzshift-phizshift)
 
  555                 << 
" angle=" << ( 0.5*
M_PI - 
std::atan(a_phi) ) << 
" b_phi=" << b_phi  );
 
  558   double norm = std::sqrt( a_phi*a_phi + a_eta*a_eta + 1 );
 
  564                 << a_eta << 
" a_phi=" << a_phi << 
" chi2_eta=" << seg2d_eta.
chi2 << 
" chi2_phi=" << seg2d_phi.
chi2 );
 
  566   double aver_z=0.5*(rzshift+phizshift);
 
  585                                         const int hash_clusters[32])
 const 
  590   for(
unsigned int imod=0; imod<32;++imod){
 
  592     if( 0==hash_clusters[imod] ) 
continue;
 
  597     ATH_MSG_DEBUG(
"getModuleSP()::(phi,side) modlue:(" << phiMod << 
"," << stationeta << 
") tgcroad:(" << tgcFitResult.
phi << 
"," << 
side << 
")");
 
  598     if( std::abs(dphi)>
M_PI/8. || 
side != stationeta) 
continue;
 
  603       if(imod<16 && phibin>7){
 
  605       } 
else if( imod >=16  && phibin<7){
 
  611     } 
else if (7==phibin) {
 
  615       } 
else if( imod >=16  && 0== muroad.
LargeSmall){
 
  623   ATH_MSG_DEBUG(
"getModuleSP::Normal sector=" << mod_hashes[0] << 
" overlap sector=" << mod_hashes[1]);
 
  636   double a0=mu_seg->
px(), a1=mu_seg->
py(), a2=mu_seg->
pz();
 
  637   double b0=mu_seg->
x(), b1=mu_seg->
y(),b2=mu_seg->
z();
 
  638   double t = ( 
alpha-(
n(0)*b0+
n(1)*b1+
n(2)*b2) )/( 
n(0)*
a0+
n(1)*a1+
n(2)*a2 );
 
  644   cscsegment.
set(x0,
x1,
x2,
a0,a1,a2,chisquare, chisquare_phi);
 
  656   for(
unsigned int ilyr=0; ilyr<4; ++ilyr){
 
  657     for (
unsigned int ihit=0; ihit<localHits[ilyr].size(); ++ihit) {
 
  660                     << 
" x=" << locHit.
loc_x << 
" y=" << locHit.
loc_y << 
" z=" << locHit.
loc_z 
  695   double r = std::sqrt( 
x*
x + 
y*
y );
 
  714   double r = std::sqrt( 
x()*
x() + 
y()*
y() );
 
  728   bool eta_clean=
false;
 
  729   bool phi_clean=
false;
 
  734   return eta_clean && phi_clean;