/[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.43 by pam-fi, Tue Jan 22 08:55:07 2008 UTC revision 1.44 by pam-fi, Wed Mar 5 17:00:19 2008 UTC
# Line 60  TrkTrack::TrkTrack(){ Line 60  TrkTrack::TrkTrack(){
60          ypu[ip]    = 0;            ypu[ip]    = 0;  
61    
62      };      };
63        
64  //     TrkParams::SetTrackingMode();  //     TrkParams::SetTrackingMode();
65  //     TrkParams::SetPrecisionFactor();  //     TrkParams::SetPrecisionFactor();
66  //     TrkParams::SetStepMin();  //     TrkParams::SetStepMin();
67      TrkParams::SetMiniDefault();      TrkParams::SetMiniDefault();
68      TrkParams::SetPFA();      TrkParams::SetPFA();
69    
70        int ngf = TrkParams::nGF;
71        for(int i=0; i<ngf; i++){
72            xGF[i] = 0.;
73            yGF[i] = 0.;
74        }
75    
76    
77  };  };
78  //--------------------------------------  //--------------------------------------
79  //  //
# Line 112  TrkTrack::TrkTrack(const TrkTrack& t){ Line 119  TrkTrack::TrkTrack(const TrkTrack& t){
119      TrkParams::SetMiniDefault();      TrkParams::SetMiniDefault();
120      TrkParams::SetPFA();      TrkParams::SetPFA();
121    
122        int ngf = TrkParams::nGF;
123        for(int i=0; i<ngf; i++){
124            xGF[i] = t.xGF[i];
125            yGF[i] = t.yGF[i];
126        }
127  };  };
128  //--------------------------------------  //--------------------------------------
129  //  //
# Line 152  void TrkTrack::Copy(TrkTrack& t){ Line 164  void TrkTrack::Copy(TrkTrack& t){
164          t.ypu[ip]      = ypu[ip];            t.ypu[ip]      = ypu[ip];  
165                            
166      };      };
167        int ngf = TrkParams::nGF;
168        for(int i=0; i<ngf; i++){
169            t.xGF[i] = xGF[i];
170            t.yGF[i] = yGF[i];
171        }
172    
173            
174  };  };
# Line 165  void TrkTrack::Copy(TrkTrack& t){ Line 182  void TrkTrack::Copy(TrkTrack& t){
182   * @param t pointer to an object of the class Trajectory,   * @param t pointer to an object of the class Trajectory,
183   * which z coordinates should be previously initialized by calling the proper constructor ( Trajectory::Trajectory(int n, float* zin) ).   * which z coordinates should be previously initialized by calling the proper constructor ( Trajectory::Trajectory(int n, float* zin) ).
184   * @return error flag.   * @return error flag.
185     *
186     * >>> OBSOLETE !!! use TrkTrack::DoTrack2(Trajectory* t) instead
187     *
188   */   */
189  int TrkTrack::DoTrack(Trajectory* t){  int TrkTrack::DoTrack(Trajectory* t){
190    
191        cout << " int TrkTrack::DoTrack(Trajectory* t) --->> OBSOLETE !!! "<<endl;
192        cout << " use int TrkTrack::DoTrack2(Trajectory* t)"<<endl;
193    
194      double *dxout = new double[t->npoint];      double *dxout = new double[t->npoint];
195      double *dyout = new double[t->npoint];      double *dyout = new double[t->npoint];
196      double *dzin = new double[t->npoint];      double *dzin = new double[t->npoint];
# Line 299  Float_t TrkTrack::GetDEDX(){ Line 322  Float_t TrkTrack::GetDEDX(){
322      return dedx;      return dedx;
323  };  };
324  /**  /**
325   * Returns 1 if the cluster on a tracker view includes bad strips.   * Returns 1 if the cluster on a tracker view includes bad strips
326     * (at least one bad strip among the four strip used by p.f.a.)
327   * @param ip plane (0-5)   * @param ip plane (0-5)
328   * @param iv view (0=x 1=y)   * @param iv view (0=x 1=y)
329   */   */
# Line 890  void TrkTrack::SetDeltaB(int id, double Line 914  void TrkTrack::SetDeltaB(int id, double
914  }  }
915    
916  /**  /**
917   * Returns 1 if the track is inside the magnet cavity   * Returns true if the track is inside the magnet cavity.
918   * Set the minimum number of steps for tracking precision   * @param toll Tolerance around the nominal volume (toll>0 define an inner fiducial volume)
919   */   */
920  Bool_t TrkTrack::IsInsideCavity(){  Bool_t TrkTrack::IsInsideCavity(float toll){
921      float xmagntop, ymagntop, xmagnbottom, ymagnbottom;  
922      xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*axv[0]/180.);  //     float xmagntop, ymagntop, xmagnbottom, ymagnbottom;
923      ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*ayv[0]/180.);  //     xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*axv[0]/180.);
924      xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*axv[5]/180.);  //     ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*ayv[0]/180.);
925      ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*ayv[5]/180.);  //     xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*axv[5]/180.);
926      if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH &&  //     ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*ayv[5]/180.);
927          ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH &&  //     if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH &&
928          xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH &&  //      ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH &&
929          ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true);  //      xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH &&
930      else return(false);  //      ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true);
931    //     else return(false);
932    
933        int ngf = TrkParams::nGF;
934        for(int i=0; i<ngf; i++){
935            //
936    //      cout << endl << TrkParams::GF_element[i];
937            if(
938                TrkParams::GF_element[i].CompareTo("CUF") &&
939                TrkParams::GF_element[i].CompareTo("T2")  &&
940                TrkParams::GF_element[i].CompareTo("T3")  &&
941                TrkParams::GF_element[i].CompareTo("T4")  &&
942                TrkParams::GF_element[i].CompareTo("T5")  &&
943                TrkParams::GF_element[i].CompareTo("CLF") &&
944                true)continue;
945            // apply condition only within the cavity
946    //      cout << " -- "<<xGF[i]<<" "<<yGF[i];
947            if(
948                xGF[i] <= TrkParams::xGF_min[i] + toll ||
949                xGF[i] >= TrkParams::xGF_max[i] - toll ||
950                yGF[i] <= TrkParams::yGF_min[i] + toll ||
951                yGF[i] >= TrkParams::yGF_max[i] - toll ||
952                false){
953                
954                return false;
955            }
956        }
957        return true;
958    
959    
960    }
961    /**
962     * Returns true if the track is inside the nominal acceptance, which is defined
963     * by the intersection among magnet cavity, silicon-plane sensitive area and
964     * ToF sensitive area (nominal values from the official document used to
965     * calculate the geometrical factor)
966     */
967    Bool_t TrkTrack::IsInsideAcceptance(){
968    
969        int ngf = TrkParams::nGF;
970        for(int i=0; i<ngf; i++){
971            if(
972                xGF[i] <= TrkParams::xGF_min[i] ||
973                xGF[i] >= TrkParams::xGF_max[i] ||
974                yGF[i] <= TrkParams::yGF_min[i] ||
975                yGF[i] >= TrkParams::yGF_max[i] ||
976                false)return false;
977        }
978        return true;
979    
980  }  }
981  /**  /**
982   * Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track.   * Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track.
# Line 1219  void TrkTrack::Clear(){ Line 1292  void TrkTrack::Clear(){
1292          dedx_y[ip] = 0;          dedx_y[ip] = 0;
1293    
1294      };      };
1295        int ngf = TrkParams::nGF;
1296        for(int i=0; i<ngf; i++){
1297            xGF[i] = 0.;
1298            yGF[i] = 0.;
1299        }
1300  //     if(clx)clx->Clear();  //     if(clx)clx->Clear();
1301  //     if(cly)cly->Clear();  //     if(cly)cly->Clear();
1302  //    clx.Clear();  //    clx.Clear();
# Line 1245  void TrkTrack::Delete(){ Line 1323  void TrkTrack::Delete(){
1323  //--------------------------------------  //--------------------------------------
1324  TrkSinglet::TrkSinglet(){  TrkSinglet::TrkSinglet(){
1325  //    cout << "TrkSinglet::TrkSinglet() " << GetUniqueID()<<endl;  //    cout << "TrkSinglet::TrkSinglet() " << GetUniqueID()<<endl;
1326      plane    = 0;  //     plane    = 0;
1327      coord[0] = 0;  //     coord[0] = 0;
1328      coord[1] = 0;  //     coord[1] = 0;
1329      sgnl     = 0;  //     sgnl     = 0;
1330    //     multmax  = 0;
1331  //    cls      = 0;  //    cls      = 0;
1332        Clear();
1333  };  };
1334  //--------------------------------------  //--------------------------------------
1335  //  //
# Line 1261  TrkSinglet::TrkSinglet(const TrkSinglet& Line 1341  TrkSinglet::TrkSinglet(const TrkSinglet&
1341      coord[0] = s.coord[0];      coord[0] = s.coord[0];
1342      coord[1] = s.coord[1];      coord[1] = s.coord[1];
1343      sgnl     = s.sgnl;      sgnl     = s.sgnl;
1344        multmax  = s.multmax;
1345  //      cls      = 0;//<<<<pointer  //      cls      = 0;//<<<<pointer
1346  //    cls      = TRef(s.cls);  //    cls      = TRef(s.cls);
1347  };  };
# Line 1271  TrkSinglet::TrkSinglet(const TrkSinglet& Line 1352  TrkSinglet::TrkSinglet(const TrkSinglet&
1352  void TrkSinglet::Dump(){  void TrkSinglet::Dump(){
1353      int i=0;      int i=0;
1354      cout << endl << "========== Singlet " ;      cout << endl << "========== Singlet " ;
1355      cout << endl << "plane    : " << plane;      cout << endl << "plane        : " << plane;
1356      cout << endl << "coord[2] : "; while( i<2 && cout << coord[i] << " ") i++;      cout << endl << "coord[2]     : "; while( i<2 && cout << coord[i] << " ") i++;
1357      cout << endl << "sgnl     : " << sgnl;      cout << endl << "sgnl         : " << sgnl;
1358        cout << endl << "max.strip    : ";
1359        cout << endl << "multiplicity : ";
1360  }  }
1361  //--------------------------------------  //--------------------------------------
1362  //  //
# Line 1286  void TrkSinglet::Clear(){ Line 1369  void TrkSinglet::Clear(){
1369      coord[0]=-999;      coord[0]=-999;
1370      coord[1]=-999;      coord[1]=-999;
1371      sgnl=0;      sgnl=0;
1372        multmax  = 0;
1373            
1374  }  }
1375  //--------------------------------------  //--------------------------------------
# Line 1396  Bool_t TrkLevel2::GetVKFlag(int iv, int Line 1480  Bool_t TrkLevel2::GetVKFlag(int iv, int
1480   * forced (see TrkLevel2::GetVKMask(int,int)) or   * forced (see TrkLevel2::GetVKMask(int,int)) or
1481   * for this event only (TrkLevel2::GetVKFlag(int,int)).   * for this event only (TrkLevel2::GetVKFlag(int,int)).
1482   * @param iv Tracker view (0-11)   * @param iv Tracker view (0-11)
1483   * @param ivk Viking-chip number (0-23)   * @param ivk Viking-chip number (0-23)
1484   */   */
1485  Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){  Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){
1486      return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) );      return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) );
# Line 1492  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1576  void TrkLevel2::SetFromLevel2Struct(cTrk
1576              //-----------------------------------------------------              //-----------------------------------------------------
1577              //-----------------------------------------------------              //-----------------------------------------------------
1578          };          };
1579            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1580            // evaluated coordinates (to define GF)
1581            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1582            int    ngf = TrkParams::nGF;
1583            float *zgf = TrkParams::zGF;
1584            Trajectory tgf = Trajectory(ngf,zgf);
1585            tgf.DoTrack2(t_track->al);//<<<< integrate the trajectory
1586            for(int ip=0; ip<ngf; ip++){
1587                t_track->xGF[ip] = tgf.x[ip];
1588                t_track->yGF[ip] = tgf.y[ip];
1589            }
1590            
1591  //      if(t_track->IsSaturated())t_track->Dump();  //      if(t_track->IsSaturated())t_track->Dump();
1592          new(t[i]) TrkTrack(*t_track);          new(t[i]) TrkTrack(*t_track);
1593          t_track->Clear();          t_track->Clear();
1594      };      };//end loop over track
1595    
1596  //  ----------------  //  ----------------
1597  //  *** SINGLETS ***  //  *** SINGLETS ***
# Line 1507  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1603  void TrkLevel2::SetFromLevel2Struct(cTrk
1603          t_singlet->coord[0] = l2->xs[i][0];          t_singlet->coord[0] = l2->xs[i][0];
1604          t_singlet->coord[1] = l2->xs[i][1];          t_singlet->coord[1] = l2->xs[i][1];
1605          t_singlet->sgnl     = l2->signlxs[i];          t_singlet->sgnl     = l2->signlxs[i];
1606            t_singlet->multmax = l2->multmaxsx[i];
1607            if(l2->sxbad[i]>0) t_singlet->multmax = -1*t_singlet->multmax;
1608          //-----------------------------------------------------          //-----------------------------------------------------
1609  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);
1610          //-----------------------------------------------------          //-----------------------------------------------------
# Line 1520  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1618  void TrkLevel2::SetFromLevel2Struct(cTrk
1618          t_singlet->coord[0] = l2->ys[i][0];          t_singlet->coord[0] = l2->ys[i][0];
1619          t_singlet->coord[1] = l2->ys[i][1];          t_singlet->coord[1] = l2->ys[i][1];
1620          t_singlet->sgnl     = l2->signlys[i];          t_singlet->sgnl     = l2->signlys[i];
1621            t_singlet->multmax  = l2->multmaxsy[i];
1622            if(l2->sybad[i]>0) t_singlet->multmax = -1*t_singlet->multmax;
1623          //-----------------------------------------------------          //-----------------------------------------------------
1624  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);
1625          //-----------------------------------------------------          //-----------------------------------------------------
1626          new(sy[i]) TrkSinglet(*t_singlet);          new(sy[i]) TrkSinglet(*t_singlet);
1627          t_singlet->Clear();          t_singlet->Clear();
1628      };      };
1629    
1630    
1631                    
1632      delete t_track;      delete t_track;
1633      delete t_singlet;      delete t_singlet;

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

  ViewVC Help
Powered by ViewVC 1.1.23