/[PAMELA software]/DarthVader/TrackerLevel2/src/TrkLevel2.cpp
ViewVC logotype

Diff of /DarthVader/TrackerLevel2/src/TrkLevel2.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.41 by pam-fi, Tue Nov 27 11:43:50 2007 UTC revision 1.43 by pam-fi, Tue Jan 22 08:55:07 2008 UTC
# Line 727  void TrkTrack::SetFromMiniStruct(cMini2t Line 727  void TrkTrack::SetFromMiniStruct(cMini2t
727   */   */
728  Bool_t TrkTrack::EvaluateClusterPositions(){  Bool_t TrkTrack::EvaluateClusterPositions(){
729            
730  //     cout << "void TrkTrack::GetClusterPositions() "<<endl;  //     cout << "void TrkTrack::GetClusterositions() "<<endl;
731    
732      TrkParams::Load( );      TrkParams::Load( );
733      if( !TrkParams::IsLoaded() )return false;      if( !TrkParams::IsLoaded() )return false;
# Line 895  void TrkTrack::SetDeltaB(int id, double Line 895  void TrkTrack::SetDeltaB(int id, double
895   */   */
896  Bool_t TrkTrack::IsInsideCavity(){  Bool_t TrkTrack::IsInsideCavity(){
897      float xmagntop, ymagntop, xmagnbottom, ymagnbottom;      float xmagntop, ymagntop, xmagnbottom, ymagnbottom;
898      xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*axv[0]/180.);      xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*axv[0]/180.);
899      ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*ayv[0]/180.);      ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*ayv[0]/180.);
900      xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*axv[5]/180.);      xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*axv[5]/180.);
901      ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*ayv[5]/180.);      ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*ayv[5]/180.);
902      if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH &&      if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH &&
903          ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH &&          ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH &&
904          xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH &&          xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH &&
# Line 970  void TrkTrack::SetYGood(int ip, int clid Line 970  void TrkTrack::SetYGood(int ip, int clid
970      if(bad)ygood[ip]=-ygood[ip];      if(bad)ygood[ip]=-ygood[ip];
971  };  };
972    
973    /**
974     * \brief Average X
975     * Average value of <xv>, evaluated from the first to the last hit x view.
976     */
977    Float_t TrkTrack::GetXav(){
978    
979        int first_plane = -1;
980        int last_plane  = -1;
981        for(Int_t ip=0; ip<6; ip++){
982            if( XGood(ip) && first_plane == -1 )first_plane = ip;
983            if( XGood(ip) && first_plane != -1 )last_plane = ip;
984        }
985        if( first_plane == -1 || last_plane == -1){
986            return -100;
987        }
988        if( last_plane-first_plane+1 ==0 )return -100;
989    
990        Float_t av = 0;    
991        for(int ip=first_plane; ip<=last_plane; ip++)av+=xv[ip];
992        
993        return (av/(last_plane-first_plane+1));    
994    }
995    /**
996     * \brief Average Y
997     * Average value of <yv>, evaluated from the first to the last hit x view.
998     */
999    Float_t TrkTrack::GetYav(){
1000    
1001        int first_plane = -1;
1002        int last_plane  = -1;
1003        for(Int_t ip=0; ip<6; ip++){
1004            if( XGood(ip) && first_plane == -1 )first_plane = ip;
1005            if( XGood(ip) && first_plane != -1 )last_plane = ip;
1006        }
1007        if( first_plane == -1 || last_plane == -1){
1008            return -100;
1009        }
1010        if( last_plane-first_plane+1 ==0 )return -100;
1011    
1012        Float_t av = 0;    
1013        for(int ip=first_plane; ip<=last_plane; ip++)av+=yv[ip];
1014    
1015        return (av/(last_plane-first_plane+1));    
1016    }
1017    /**
1018     * \brief Average Z
1019     * Average value of <zv>, evaluated from the first to the last hit x view.
1020     */
1021    Float_t TrkTrack::GetZav(){
1022    
1023        int first_plane = -1;
1024        int last_plane  = -1;
1025        for(Int_t ip=0; ip<6; ip++){
1026            if( XGood(ip) && first_plane == -1 )first_plane = ip;
1027            if( XGood(ip) && first_plane != -1 )last_plane = ip;
1028        }
1029        if( first_plane == -1 || last_plane == -1){
1030            return -100;
1031        }
1032        if( last_plane-first_plane+1 ==0 )return -100;
1033    
1034        Float_t av = 0;    
1035        for(int ip=first_plane; ip<=last_plane; ip++)av+=zv[ip];
1036        
1037        return (av/(last_plane-first_plane+1));    
1038    }
1039    
1040    /**
1041     * \brief Number of column traversed
1042     */
1043    Int_t TrkTrack::GetNColumns(){
1044        int sensors[] = {0,0,0,0,0,0};
1045        for(int ip=0; ip<6; ip++){
1046            int sensorid = GetLadder(ip)+3*GetSensor(ip);    
1047            if(XGood(ip)||YGood(ip))
1048                if(sensorid>=0 && sensorid<6)sensors[sensorid]=1;
1049        }
1050        int nsensors=0;
1051        for(int is=0; is<6; is++)nsensors += sensors[is];
1052        return nsensors;
1053    };
1054    /**
1055     * \brief Give the maximum energy release
1056     */
1057    Float_t TrkTrack::GetDEDX_max(int ip, int iv){
1058        Float_t max=0;
1059        int pfrom = 0;
1060        int pto   = 6;
1061        int vfrom = 0;
1062        int vto   = 2;
1063        if(ip>=0&&ip<6){
1064            pfrom = ip;
1065            pto   = ip+1;
1066        }
1067        if(iv>=0&&iv<2){
1068            vfrom = iv;
1069            vto   = iv+1;
1070        }
1071        for(int i=pfrom; i<pto; i++)
1072            for(int j=0; j<vto; j++)
1073                if(GetDEDX(i,j)>max)max=GetDEDX(i,j);
1074    
1075        return max;
1076    
1077    };
1078    
1079    /**
1080     * \brief Give the minimum energy release
1081     */
1082    Float_t TrkTrack::GetDEDX_min(int ip, int iv){
1083        Float_t min=100000000;
1084        int pfrom = 0;
1085        int pto   = 6;
1086        int vfrom = 0;
1087        int vto   = 2;
1088        if(ip>=0&&ip<6){
1089            pfrom = ip;
1090            pto   = ip+1;
1091        }
1092        if(iv>=0&&iv<2){
1093            vfrom = iv;
1094            vto   = iv+1;
1095        }
1096        for(int i=pfrom; i<pto; i++)
1097            for(int j=0; j<vto; j++)
1098                if(GetDEDX(i,j)<min)min=GetDEDX(i,j);
1099    
1100        return min;
1101    
1102    };
1103    
1104    /**
1105     * \brief Give the maximum spatial residual release
1106     */
1107    Float_t TrkTrack::GetResidual_max(int ip, int iv){
1108        Float_t max=0;
1109        int pfrom = 0;
1110        int pto   = 6;
1111        int vfrom = 0;
1112        int vto   = 2;
1113        if(ip>=0&&ip<6){
1114            pfrom = ip;
1115            pto   = ip+1;
1116        }
1117        if(iv>=0&&iv<2){
1118            vfrom = iv;
1119            vto   = iv+1;
1120        }
1121        for(int i=pfrom; i<pto; i++){
1122            for(int j=0; j<vto; j++){
1123                if(j==0 && XGood(i) && fabs(xm[i]-xv[i])>fabs(max))max=xv[i]-xm[i];
1124                if(j==1 && YGood(i) && fabs(ym[i]-yv[i])>fabs(max))max=yv[i]-ym[i];
1125            }
1126        }
1127        return max;
1128    
1129    };
1130    
1131    
1132    /**
1133     * \brief Give the maximum multiplicity on the x view
1134     */
1135    Int_t TrkTrack::GetClusterX_Multiplicity_max(){
1136        int max=0;
1137        for(int ip=0; ip<6; ip++)
1138            if(GetClusterX_Multiplicity(ip)>max)max=GetClusterX_Multiplicity(ip);
1139        return max;
1140    };
1141    /**
1142     * \brief Give the minimum multiplicity on the x view
1143     */
1144    Int_t TrkTrack::GetClusterX_Multiplicity_min(){
1145        int min=50;
1146        for(int ip=0; ip<6; ip++)
1147            if(GetClusterX_Multiplicity(ip)<min)min=GetClusterX_Multiplicity(ip);
1148        return min;
1149    };
1150    /**
1151     * \brief Give the maximum multiplicity on the x view
1152     */
1153    Int_t TrkTrack::GetClusterY_Multiplicity_max(){
1154        int max=0;
1155        for(int ip=0; ip<6; ip++)
1156            if(GetClusterY_Multiplicity(ip)>max)max=GetClusterY_Multiplicity(ip);
1157        return max;
1158    };
1159    /**
1160     * \brief Give the minimum multiplicity on the x view
1161     */
1162    Int_t TrkTrack::GetClusterY_Multiplicity_min(){
1163        int min=50;
1164        for(int ip=0; ip<6; ip++)
1165            if(GetClusterY_Multiplicity(ip)<min)min=GetClusterY_Multiplicity(ip);
1166        return min;
1167    };
1168    
1169    /**
1170     * \brief Give the minimum seed on the x view
1171     */
1172    Float_t TrkTrack::GetClusterX_Seed_min(){
1173        Float_t min=100000;
1174        for(int ip=0; ip<6; ip++)
1175            if(XGood(ip) && GetClusterX_Seed(ip)<min)min=GetClusterX_Seed(ip);
1176        return min;
1177    };
1178    /**
1179     * \brief Give the minimum seed on the x view
1180     */
1181    Float_t TrkTrack::GetClusterY_Seed_min(){
1182        Float_t min=100000;
1183        for(int ip=0; ip<6; ip++)
1184            if(YGood(ip) && GetClusterY_Seed(ip)<min)min=GetClusterY_Seed(ip);
1185        return min;
1186    };
1187    
1188    
1189  //--------------------------------------  //--------------------------------------
1190  //  //
1191  //  //
# Line 1485  TRefArray *TrkLevel2::GetTracks_NFitSort Line 1701  TRefArray *TrkLevel2::GetTracks_NFitSort
1701  TrkTrack *TrkLevel2::GetStoredTrack(int is){  TrkTrack *TrkLevel2::GetStoredTrack(int is){
1702    
1703      if(is >= this->ntrk()){      if(is >= this->ntrk()){
1704          cout << "** TrkLevel2 ** Track "<< is << "doen not exits! " << endl;          cout << "TrkTrack *TrkLevel2::GetStoredTrack(int) >> Track "<< is << "doen not exits! " << endl;
1705          cout << "                Stored tracks ntrk() = "<< this->ntrk() << endl;          cout << "Stored tracks ntrk() = "<< this->ntrk() << endl;
1706          return 0;          return 0;
1707      }      }
1708      if(!Track){      if(!Track){
# Line 1507  TrkTrack *TrkLevel2::GetStoredTrack(int Line 1723  TrkTrack *TrkLevel2::GetStoredTrack(int
1723  TrkSinglet *TrkLevel2::GetSingletX(int is){  TrkSinglet *TrkLevel2::GetSingletX(int is){
1724    
1725          if(is >= this->nclsx()){          if(is >= this->nclsx()){
1726                  cout << "** TrkLevel2 ** Singlet "<< is << "doen not exits! " << endl;                  cout << "TrkSinglet *TrkLevel2::GetSingletX(int) >> Singlet "<< is << "doen not exits! " << endl;
1727                  cout << "                Stored x-singlets nclsx() = "<< this->nclsx() << endl;                  cout << "Stored x-singlets nclsx() = "<< this->nclsx() << endl;
1728                  return 0;                  return 0;
1729          }          }
1730          if(!SingletX)return 0;          if(!SingletX)return 0;
# Line 1527  TrkSinglet *TrkLevel2::GetSingletX(int i Line 1743  TrkSinglet *TrkLevel2::GetSingletX(int i
1743  TrkSinglet *TrkLevel2::GetSingletY(int is){  TrkSinglet *TrkLevel2::GetSingletY(int is){
1744    
1745          if(is >= this->nclsy()){          if(is >= this->nclsy()){
1746                  cout << "** TrkLevel2 ** Singlet "<< is << "doen not exits! " << endl;                  cout << "TrkSinglet *TrkLevel2::GetSingletY(int) >> Singlet "<< is << "doen not exits! " << endl;
1747                  cout << "                Stored y-singlets nclsy() = "<< this->nclsx() << endl;                  cout << "Stored y-singlets nclsx() = "<< this->nclsx() << endl;
1748                  return 0;                  return 0;
1749          }          }
1750          if(!SingletY)return 0;          if(!SingletY)return 0;
# Line 1548  TrkSinglet *TrkLevel2::GetSingletY(int i Line 1764  TrkSinglet *TrkLevel2::GetSingletY(int i
1764  TrkTrack *TrkLevel2::GetTrack(int it){  TrkTrack *TrkLevel2::GetTrack(int it){
1765            
1766          if(it >= this->GetNTracks()){          if(it >= this->GetNTracks()){
1767                  cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl;                  cout << "TrkTrack *TrkLevel2::GetTrack(int) >> Track "<< it << "does not exits! " << endl;
1768                  cout << "                Physical tracks GetNTracks() = "<< this->ntrk() << endl;                  cout << "Physical tracks GetNTracks() = "<< this->ntrk() << endl;
1769                  return 0;                  return 0;
1770          }          }
1771                    
# Line 1586  Int_t TrkLevel2::GetNTracks(){ Line 1802  Int_t TrkLevel2::GetNTracks(){
1802  TrkTrack *TrkLevel2::GetTrackImage(int it){  TrkTrack *TrkLevel2::GetTrackImage(int it){
1803    
1804      if(it >= this->GetNTracks()){      if(it >= this->GetNTracks()){
1805          cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl;          cout << "TrkTrack *TrkLevel2::GetTrackImage(int) >> Track "<< it << "does not exits! " << endl;
1806          cout << "                Physical tracks GetNTracks() = "<< this->ntrk() << endl;          cout << "Physical tracks GetNTracks() = "<< this->ntrk() << endl;
1807          return 0;          return 0;
1808      }      }
1809                    
# Line 1596  TrkTrack *TrkLevel2::GetTrackImage(int i Line 1812  TrkTrack *TrkLevel2::GetTrackImage(int i
1812      TrkTrack *track = (TrkTrack*)sorted->At(it);      TrkTrack *track = (TrkTrack*)sorted->At(it);
1813                    
1814      if(!track->HasImage()){      if(!track->HasImage()){
1815          cout << "** TrkLevel2 ** Track "<< it << "does not have image! " << endl;          cout << "TrkTrack *TrkLevel2::GetTrackImage(int) >> Track "<< it << "does not have image! " << endl;
1816          return 0;          return 0;
1817      }      }
1818      if(!Track)return 0;      if(!Track)return 0;

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.43

  ViewVC Help
Powered by ViewVC 1.1.23