/[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.31 by pam-fi, Wed Mar 28 09:22:28 2007 UTC revision 1.32 by pam-fi, Fri Apr 27 10:39:57 2007 UTC
# Line 12  using namespace std; Line 12  using namespace std;
12  extern "C" {      extern "C" {    
13      void dotrack_(int*, double*, double*, double*, double*, int*);      void dotrack_(int*, double*, double*, double*, double*, int*);
14      void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*);      void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*);
 //    int  readb_(const char*);  
 //    int  readb_();  
15       void mini2_(int*,int*,int*);       void mini2_(int*,int*,int*);
16       void guess_();       void guess_();
17       void gufld_(float*, float*);       void gufld_(float*, float*);
# Line 41  TrkTrack::TrkTrack(){ Line 39  TrkTrack::TrkTrack(){
39          zm[ip]     = 0;          zm[ip]     = 0;
40          resx[ip]   = 0;          resx[ip]   = 0;
41          resy[ip]   = 0;          resy[ip]   = 0;
42            tailx[ip]   = 0;
43            taily[ip]   = 0;
44          xv[ip]     = 0;          xv[ip]     = 0;
45          yv[ip]     = 0;          yv[ip]     = 0;
46          zv[ip]     = 0;          zv[ip]     = 0;
# Line 49  TrkTrack::TrkTrack(){ Line 49  TrkTrack::TrkTrack(){
49          dedx_x[ip] = 0;          dedx_x[ip] = 0;
50          dedx_y[ip] = 0;          dedx_y[ip] = 0;
51      };      };
52      clx = 0;  //    clx = 0;
53      cly = 0;  //    cly = 0;
54  //    clx = new TRefArray(6,0); //forse causa memory leak???  //    clx = new TRefArray(6,0); //forse causa memory leak???
55  //    cly = new TRefArray(6,0); //forse causa memory leak???  //    cly = new TRefArray(6,0); //forse causa memory leak???
56    //    clx = TRefArray(6,0);
57    //    cly = TRefArray(6,0);
58    
59  };  };
60  //--------------------------------------  //--------------------------------------
61  //  //
# Line 75  TrkTrack::TrkTrack(const TrkTrack& t){ Line 78  TrkTrack::TrkTrack(const TrkTrack& t){
78          zm[ip]     = t.zm[ip];          zm[ip]     = t.zm[ip];
79          resx[ip]   = t.resx[ip];          resx[ip]   = t.resx[ip];
80          resy[ip]   = t.resy[ip];          resy[ip]   = t.resy[ip];
81            tailx[ip]  = t.tailx[ip];
82            taily[ip]  = t.taily[ip];
83          xv[ip]     = t.xv[ip];          xv[ip]     = t.xv[ip];
84          yv[ip]     = t.yv[ip];          yv[ip]     = t.yv[ip];
85          zv[ip]     = t.zv[ip];          zv[ip]     = t.zv[ip];
# Line 83  TrkTrack::TrkTrack(const TrkTrack& t){ Line 88  TrkTrack::TrkTrack(const TrkTrack& t){
88          dedx_x[ip] = t.dedx_x[ip];          dedx_x[ip] = t.dedx_x[ip];
89          dedx_y[ip] = t.dedx_y[ip];          dedx_y[ip] = t.dedx_y[ip];
90      };      };
91      clx = 0;  //    clx = 0;
92      cly = 0;  //    cly = 0;
93      if(t.clx)clx = new TRefArray(*(t.clx));  //    if(t.clx)clx = new TRefArray(*(t.clx));
94      if(t.cly)cly = new TRefArray(*(t.cly));  //    if(t.cly)cly = new TRefArray(*(t.cly));
95            //    clx = TRefArray(t.clx);
96    //    cly = TRefArray(t.cly);
97    
98  };  };
99  //--------------------------------------  //--------------------------------------
100  //  //
# Line 111  void TrkTrack::Copy(TrkTrack& t){ Line 118  void TrkTrack::Copy(TrkTrack& t){
118          t.zm[ip]     = zm[ip];          t.zm[ip]     = zm[ip];
119          t.resx[ip]   = resx[ip];          t.resx[ip]   = resx[ip];
120          t.resy[ip]   = resy[ip];          t.resy[ip]   = resy[ip];
121            t.tailx[ip]  = tailx[ip];
122            t.taily[ip]  = taily[ip];
123          t.xv[ip]     = xv[ip];          t.xv[ip]     = xv[ip];
124          t.yv[ip]     = yv[ip];          t.yv[ip]     = yv[ip];
125          t.zv[ip]     = zv[ip];          t.zv[ip]     = zv[ip];
# Line 120  void TrkTrack::Copy(TrkTrack& t){ Line 129  void TrkTrack::Copy(TrkTrack& t){
129          t.dedx_y[ip] = dedx_y[ip];          t.dedx_y[ip] = dedx_y[ip];
130                            
131      };      };
132    
133    //    t.clx = TRefArray(clx);
134    //    t.cly = TRefArray(cly);
135            
136  };  };
137  //--------------------------------------  //--------------------------------------
# Line 233  Float_t TrkTrack::GetDeflection(){ Line 245  Float_t TrkTrack::GetDeflection(){
245          return def;          return def;
246  };  };
247  //  //
248  Float_t TrkTrack::GetDEDX(){  /**
249          Float_t dedx=0;   * Method to retrieve the dE/dx measured on a tracker view.
250  //      for(Int_t i=0; i<6; i++)dedx+=dedx_x[i]*xgood[i]+dedx_y[i]*ygood[i];   * @param ip plane (0-5)
251          for(Int_t i=0; i<6; i++)dedx+=dedx_x[i]*XGood(i)+dedx_y[i]*YGood(i);   * @param iv view (0=x 1=y)
252          dedx = dedx/(this->GetNX()+this->GetNY());   */
253          return dedx;  Float_t TrkTrack::GetDEDX(int ip, int iv){
254        if(iv==0 && ip>=0 && ip<6)return fabs(dedx_x[ip]);
255        else if(iv==1 && ip>=0 && ip<6)return fabs(dedx_y[ip]);
256        else {
257            cout << "TrkTrack::GetDEDX(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl;
258            return 0.;
259        }
260    }
261    /**
262     * Method to evaluate the dE/dx measured on a tracker plane.
263     * The two measurements on x- and y-view are averaged.
264     * @param ip plane (0-5)
265     */
266    Float_t TrkTrack::GetDEDX(int ip){
267        if( (Int_t)XGood(ip)+(Int_t)YGood(ip) == 0 ) return 0;
268        return (GetDEDX(ip,0)+GetDEDX(ip,1))/((Int_t)XGood(ip)+(Int_t)YGood(ip));
269  };  };
270    
271    /**
272     * Method to evaluate the dE/dx averaged over all planes.
273     */
274    Float_t TrkTrack::GetDEDX(){
275        Float_t dedx=0;
276        for(Int_t ip=0; ip<6; ip++)dedx+=GetDEDX(ip,0)*XGood(ip)+GetDEDX(ip,1)*YGood(ip);
277        dedx = dedx/(GetNX()+GetNY());
278        return dedx;
279    };
280    /**
281     * Returns 1 if the cluster on a tracker view includes bad strips.
282     * @param ip plane (0-5)
283     * @param iv view (0=x 1=y)
284     */
285    Bool_t TrkTrack::IsBad(int ip,int iv){
286        if(iv==0 && ip>=0 && ip<6)return (xgood[ip]<0) ;
287        else if(iv==1 && ip>=0 && ip<6)return (ygood[ip]<0) ;
288        else {
289            cout << "TrkTrack::IsBad(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl;
290            return 0.;
291        }
292    };
293    /**
294     * Returns 1 if the signal on a tracker view is saturated.
295     * @param ip plane (0-5)
296     * @param iv view (0=x 1=y)
297     */
298    Bool_t TrkTrack::IsSaturated(int ip,int iv){
299        if(iv==0 && ip>=0 && ip<6)return (dedx_x[ip]<0) ;
300        else if(iv==1 && ip>=0 && ip<6)return (dedx_y[ip]<0) ;
301        else {
302            cout << "TrkTrack::IsSaturated(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl;
303            return 0.;
304        }
305    };
306    /**
307     * Returns 1 if either the x or the y signal on a tracker plane is saturated.
308     * @param ip plane (0-5)
309     */
310    Bool_t TrkTrack::IsSaturated(int ip){
311        return (IsSaturated(ip,0)||IsSaturated(ip,1));
312    };
313    /**
314     * Returns 1 if there is at least a saturated signal along the track.
315     */
316    Bool_t TrkTrack::IsSaturated(){
317        for(int ip=0; ip<6; ip++)for(int iv=0; iv<2; iv++)if(IsSaturated(ip,iv))return true;
318        return false;
319    }
320    /**
321     * Returns the track "lever-arm" on the x view, defined as the distance (in planes) between
322     * the upper and lower x measurements (the maximum value of lever-arm is 6).
323     */
324    Int_t TrkTrack::GetLeverArmX(){
325        int first_plane = -1;
326        int last_plane  = -1;
327        for(Int_t ip=0; ip<6; ip++){
328            if( XGood(ip) && first_plane == -1 )first_plane = ip;
329            if( XGood(ip) && first_plane != -1 )last_plane = ip;
330        }
331        if( first_plane == -1 || last_plane == -1){
332            cout<< "Int_t TrkTrack::GetLeverArmX() -- XGood(ip) always false ??? "<<endl;
333            return 0;
334        }
335        return (last_plane-first_plane+1);
336    }
337    /**
338     * Returns the track "lever-arm" on the y view, defined as the distance (in planes) between
339     * the upper and lower y measurements (the maximum value of lever-arm is 6).
340     */
341    Int_t TrkTrack::GetLeverArmY(){
342        int first_plane = -1;
343        int last_plane  = -1;
344        for(Int_t ip=0; ip<6; ip++){
345            if( YGood(ip) && first_plane == -1 )first_plane = ip;
346            if( YGood(ip) && first_plane != -1 )last_plane = ip;
347        }
348        if( first_plane == -1 || last_plane == -1){
349            cout<< "Int_t TrkTrack::GetLeverArmY() -- YGood(ip) always false ??? "<<endl;
350            return 0;
351        }
352        return (last_plane-first_plane+1);
353    }
354  //--------------------------------------  //--------------------------------------
355  //  //
356  //  //
# Line 479  void TrkTrack::SetStepMin(int istepmin){ Line 589  void TrkTrack::SetStepMin(int istepmin){
589    
590    
591  /*  /*
592   * Method to retrieve the X-view clusters associated to the track.   * Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track.
593     * If no cluster is associated, ID=-1.
594   * @param ip Tracker plane (0-5)   * @param ip Tracker plane (0-5)
595   */   */
596  TrkCluster *TrkTrack::GetClusterX(int ip){  Int_t TrkTrack::GetClusterX_ID(int ip){
597      cout << " TrkCluster *TrkTrack::GetClusterX(int ip) -- momentaneamente fuori servizio --"<< endl;      return ((Int_t)fabs(xgood[ip]))%10000000-1;
     if(!clx)return NULL;  
     TrkCluster *pt = (TrkCluster*)(clx->At(ip));  
     return pt;  
598  };  };
599  /*  /*
600   * Method to retrieve the Y-view clusters associated to the track.   * Method to retrieve ID (0-xxx) of y-cluster (if any) associated to this track.
601     * If no cluster is associated, ID=-1.
602   * @param ip Tracker plane (0-5)   * @param ip Tracker plane (0-5)
603   */   */
604  TrkCluster *TrkTrack::GetClusterY(int ip){  Int_t TrkTrack::GetClusterY_ID(int ip){
605      cout << " TrkCluster *TrkTrack::GetClusterY(int ip) -- momentaneamente fuori servizio --"<< endl;      return ((Int_t)fabs(ygood[ip]))%10000000-1;
606      if(!cly)return NULL;  };
607      TrkCluster *pt = (TrkCluster*)(cly->At(ip));  /*
608      return pt;   * Method to retrieve the ladder (0-4, increasing x) traversed by the track on this plane.
609     * If no ladder is traversed (dead area) the metod retuns -1.
610     * @param ip Tracker plane (0-5)
611     */
612    Int_t TrkTrack::GetLadder(int ip){
613        if(XGood(ip))return (Int_t)fabs(xgood[ip]/100000000)-1;
614        if(YGood(ip))return (Int_t)fabs(ygood[ip]/100000000)-1;
615        return -1;
616    };
617    /*
618     * Method to retrieve the sensor (0-1, increasing y) traversed by the track on this plane.
619     * If no sensor is traversed (dead area) the metod retuns -1.
620     * @param ip Tracker plane (0-5)
621     */
622    Int_t TrkTrack::GetSensor(int ip){
623        if(XGood(ip))return (Int_t)((Int_t)fabs(xgood[ip]/10000000)%10)-1;
624        if(YGood(ip))return (Int_t)((Int_t)fabs(ygood[ip]/10000000)%10)-1;
625        return -1;
626  };  };
627    
628    
# Line 522  void TrkTrack::Clear(){ Line 648  void TrkTrack::Clear(){
648          zm[ip]     = 0;          zm[ip]     = 0;
649          resx[ip]   = 0;          resx[ip]   = 0;
650          resy[ip]   = 0;          resy[ip]   = 0;
651            tailx[ip]  = 0;
652            taily[ip]  = 0;
653          xv[ip]     = 0;          xv[ip]     = 0;
654          yv[ip]     = 0;          yv[ip]     = 0;
655          zv[ip]     = 0;          zv[ip]     = 0;
# Line 531  void TrkTrack::Clear(){ Line 659  void TrkTrack::Clear(){
659          dedx_y[ip] = 0;          dedx_y[ip] = 0;
660    
661      };      };
662      if(clx)clx->Clear();  //     if(clx)clx->Clear();
663      if(cly)cly->Clear();  //     if(cly)cly->Clear();
664    //    clx.Clear();
665    //    cly.Clear();
666  };  };
667  //--------------------------------------  //--------------------------------------
668  //  //
# Line 540  void TrkTrack::Clear(){ Line 670  void TrkTrack::Clear(){
670  //--------------------------------------  //--------------------------------------
671  void TrkTrack::Delete(){  void TrkTrack::Delete(){
672  //    cout << "TrkTrack::Delete()"<<endl;  //    cout << "TrkTrack::Delete()"<<endl;
673  //    Clear();      Clear();
674      if(clx)delete clx;  //    if(clx)delete clx;
675      if(cly)delete cly;  //    if(cly)delete cly;
676  };  };
677  //--------------------------------------  //--------------------------------------
678  //  //
# Line 572  TrkSinglet::TrkSinglet(const TrkSinglet& Line 702  TrkSinglet::TrkSinglet(const TrkSinglet&
702      coord[1] = s.coord[1];      coord[1] = s.coord[1];
703      sgnl     = s.sgnl;      sgnl     = s.sgnl;
704  //      cls      = 0;//<<<<pointer  //      cls      = 0;//<<<<pointer
705      cls      = TRef(s.cls);  //    cls      = TRef(s.cls);
706  };  };
707  //--------------------------------------  //--------------------------------------
708  //  //
# Line 605  void TrkSinglet::Clear(){ Line 735  void TrkSinglet::Clear(){
735  TrkLevel2::TrkLevel2(){  TrkLevel2::TrkLevel2(){
736    //    cout <<"TrkLevel2::TrkLevel2()"<<endl;    //    cout <<"TrkLevel2::TrkLevel2()"<<endl;
737      for(Int_t i=0; i<12 ; i++){      for(Int_t i=0; i<12 ; i++){
738                  good[i] = -1;          good[i] = -1;
739          };          VKmask[i] = 0;
740  // okkio!! memory-leak          VKflag[i] = 0;  
741  //     Track    = new TClonesArray("TrkTrack");      };
 //     SingletX = new TClonesArray("TrkSinglet");  
 //     SingletY = new TClonesArray("TrkSinglet");  
742      Track    = 0;      Track    = 0;
743      SingletX = 0;      SingletX = 0;
744      SingletY = 0;      SingletY = 0;
# Line 637  void TrkLevel2::Dump(){ Line 765  void TrkLevel2::Dump(){
765      cout << endl << "ntrk()   : " << this->ntrk() ;      cout << endl << "ntrk()   : " << this->ntrk() ;
766      cout << endl << "nclsx()  : " << this->nclsx();      cout << endl << "nclsx()  : " << this->nclsx();
767      cout << endl << "nclsy()  : " << this->nclsy();      cout << endl << "nclsy()  : " << this->nclsy();
 //     TClonesArray &t  = *Track;  
 //     TClonesArray &sx = *SingletX;  
 //     TClonesArray &sy = *SingletY;  
 //     for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();  
 //     for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump();  
 //     for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();  
768      if(Track){      if(Track){
769          TClonesArray &t  = *Track;          TClonesArray &t  = *Track;
770          for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();          for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();
# Line 661  void TrkLevel2::Dump(){ Line 783  void TrkLevel2::Dump(){
783  //  //
784  //--------------------------------------  //--------------------------------------
785  /**  /**
786   * Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common).   * The method returns false if the viking-chip was masked  
787     * either apriori ,on the basis of the mask read from the DB,
788     * or run-by-run, on the basis of the calibration parameters)
789     * @param iv Tracker view (0-11)
790     * @param ivk Viking-chip number (0-23)
791     */
792    Bool_t TrkLevel2::GetVKMask(int iv, int ivk){
793        Int_t whichbit = (Int_t)pow(2,ivk);
794        return (whichbit&VKmask[iv])!=0;    
795    }
796    /**
797     * The method returns false if the viking-chip was masked  
798     * for this event due to common-noise computation failure.
799     * @param iv Tracker view (0-11)
800     * @param ivk Viking-chip number (0-23)
801     */
802    Bool_t TrkLevel2::GetVKFlag(int iv, int ivk){
803        Int_t whichbit = (Int_t)pow(2,ivk);
804        return (whichbit&VKflag[iv])!=0;    
805    }
806    /**
807     * The method returns true if the viking-chip was masked, either
808     * forced (see TrkLevel2::GetVKMask(int,int)) or
809     * for this event only (TrkLevel2::GetVKFlag(int,int)).
810     * @param iv Tracker view (0-11)
811     * @param ivk Viking-chip number (0-23)
812   */   */
813  // void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2){  Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){
814        return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) );
815    };
816    
 //      //  temporary objects:  
 //     TrkSinglet* t_singlet = new TrkSinglet();  
 //     TrkTrack*   t_track   = new TrkTrack();  
   
 //      //  **** general variables ****  
 // //    good2 = l2->good2;  
 //     for(Int_t i=0; i<12 ; i++){  
 // //           crc[i] = l2->crc[i];  
 //              good[i] = l2->good[i];  
 //      };  
 //      //  *** TRACKS ***  
 //     if(!Track) Track = new TClonesArray("TrkTrack");  
 //     TClonesArray &t = *Track;  
 //     for(int i=0; i<l2->ntrk; i++){  
 //      t_track->seqno = i;// NBNBNBNB deve sempre essere = i  
 //      t_track->image = l2->image[i]-1;  
 //      //      cout << "track "<<i<<t_track->seqno << t_track->image<<endl;  
 //      t_track->chi2  = l2->chi2_nt[i];  
 //      t_track->nstep = l2->nstep_nt[i];  
 //      for(int it1=0;it1<5;it1++){  
 //          t_track->al[it1] = l2->al_nt[i][it1];  
 //          for(int it2=0;it2<5;it2++)  
 //              t_track->coval[it1][it2] = l2->coval[i][it2][it1];  
 //      };  
 //      for(int ip=0;ip<6;ip++){  
 //          t_track->xgood[ip]  = l2->xgood_nt[i][ip];  
 //          t_track->ygood[ip]  = l2->ygood_nt[i][ip];  
 //          t_track->xm[ip]     = l2->xm_nt[i][ip];  
 //          t_track->ym[ip]     = l2->ym_nt[i][ip];  
 //          t_track->zm[ip]     = l2->zm_nt[i][ip];  
 //          t_track->resx[ip]   = l2->resx_nt[i][ip];  
 //          t_track->resy[ip]   = l2->resy_nt[i][ip];  
 //          t_track->xv[ip]     = l2->xv_nt[i][ip];  
 //          t_track->yv[ip]     = l2->yv_nt[i][ip];  
 //          t_track->zv[ip]     = l2->zv_nt[i][ip];  
 //          t_track->axv[ip]    = l2->axv_nt[i][ip];  
 //          t_track->ayv[ip]    = l2->ayv_nt[i][ip];  
 //          t_track->dedx_x[ip] = l2->dedx_x[i][ip];  
 //          t_track->dedx_y[ip] = l2->dedx_y[i][ip];  
 // //                   t_track->clx[ip] = 0;  
 // //                   t_track->cly[ip] = 0;  
 //      };  
 //      new(t[i]) TrkTrack(*t_track);  
 //      t_track->Clear();  
 //     };  
 // //  *** SINGLETS ***  
 //     if(!SingletX)SingletX = new TClonesArray("TrkSinglet");  
 //     TClonesArray &sx = *SingletX;  
 //     for(int i=0; i<l2->nclsx; i++){  
 //      t_singlet->plane    = l2->planex[i];  
 //      t_singlet->coord[0] = l2->xs[i][0];  
 //      t_singlet->coord[1] = l2->xs[i][1];  
 //      t_singlet->sgnl     = l2->signlxs[i];  
 // //           t_singlet->cls      = 0;  
 //      new(sx[i]) TrkSinglet(*t_singlet);  
 //      t_singlet->Clear();  
 //     }  
 //     if(!SingletY)SingletY = new TClonesArray("TrkSinglet");  
 //     TClonesArray &sy = *SingletY;  
 //     for(int i=0; i<l2->nclsy; i++){  
 //      t_singlet->plane    = l2->planey[i];  
 //      t_singlet->coord[0] = l2->ys[i][0];  
 //      t_singlet->coord[1] = l2->ys[i][1];  
 //      t_singlet->sgnl     = l2->signlys[i];  
 // //           t_singlet->cls      = 0;  
 //      new(sy[i]) TrkSinglet(*t_singlet);  
 //      t_singlet->Clear();  
 //     };  
           
 //     delete t_track;  
 //     delete t_singlet;  
 // }  
817  //--------------------------------------  //--------------------------------------
818  //  //
819  //  //
# Line 750  void TrkLevel2::SetFromLevel2Struct(cTrk Line 827  void TrkLevel2::SetFromLevel2Struct(cTrk
827    
828  //    cout << "void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1)"<<endl;  //    cout << "void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1)"<<endl;
829      Clear();      Clear();
830    
831  //  temporary objects:  //  temporary objects:
832      TrkSinglet* t_singlet = new TrkSinglet();      TrkSinglet* t_singlet = new TrkSinglet();
833      TrkTrack*   t_track   = new TrkTrack();      TrkTrack*   t_track   = new TrkTrack();
# Line 759  void TrkLevel2::SetFromLevel2Struct(cTrk Line 837  void TrkLevel2::SetFromLevel2Struct(cTrk
837  //  -----------------  //  -----------------
838      for(Int_t i=0; i<12 ; i++){      for(Int_t i=0; i<12 ; i++){
839          good[i] = l2->good[i];          good[i] = l2->good[i];
840            VKmask[i]=0;
841            VKflag[i]=0;
842            for(Int_t ii=0; ii<24 ; ii++){
843                Int_t setbit = (Int_t)pow(2,ii);
844                if( l2->vkflag[ii][i]!=-1 )VKmask[i]=VKmask[i]|setbit;
845                if( l2->vkflag[ii][i]!=0  )VKflag[i]=VKflag[i]|setbit;
846            };
847      };      };
848  //  --------------  //  --------------
849  //  *** TRACKS ***  //  *** TRACKS ***
850  //  --------------  //  --------------
851      if(!Track) Track = new TClonesArray("TrkTrack");      if(!Track) Track = new TClonesArray("TrkTrack");
852      TClonesArray &t = *Track;      TClonesArray &t = *Track;
853      //-----------------------------------------------------  
     if( l1 && !t_track->clx )t_track->clx = new TRefArray(6,0);  
     if( l1 && !t_track->cly )t_track->cly = new TRefArray(6,0);  
     //-----------------------------------------------------  
854      for(int i=0; i<l2->ntrk; i++){      for(int i=0; i<l2->ntrk; i++){
 //      cout <<" TRACK "<<i<<" ------------------ "<<endl;  
855          t_track->seqno = i;// NBNBNBNB deve sempre essere = i          t_track->seqno = i;// NBNBNBNB deve sempre essere = i
856          t_track->image = l2->image[i]-1;          t_track->image = l2->image[i]-1;
857          t_track->chi2  = l2->chi2_nt[i];          t_track->chi2  = l2->chi2_nt[i];
# Line 781  void TrkLevel2::SetFromLevel2Struct(cTrk Line 862  void TrkLevel2::SetFromLevel2Struct(cTrk
862                  t_track->coval[it1][it2] = l2->coval[i][it2][it1];                  t_track->coval[it1][it2] = l2->coval[i][it2][it1];
863          };          };
864          for(int ip=0;ip<6;ip++){          for(int ip=0;ip<6;ip++){
865              t_track->xgood[ip]  = l2->cltrx[i][ip];//l2->xgood_nt[i][ip];              // ---------------------------------
866              t_track->ygood[ip]  = l2->cltry[i][ip];//l2->ygood_nt[i][ip];              // new implementation of xgood/ygood
867                // ---------------------------------
868                t_track->xgood[ip]  = l2->cltrx[i][ip]; //cluster ID
869                t_track->ygood[ip]  = l2->cltry[i][ip]; //cluster ID
870                t_track->xgood[ip] += 10000000*l2->ls[i][ip]; // ladder+sensor
871                t_track->ygood[ip] += 10000000*l2->ls[i][ip]; // ladder+sensor
872                if(l2->xbad[i][ip]>0)t_track->xgood[ip]=-t_track->xgood[ip];
873                if(l2->ybad[i][ip]>0)t_track->ygood[ip]=-t_track->ygood[ip];
874    //          if(l2->xbad[i][ip]>0 || l2->ybad[i][ip]>0){
875    //          if(l2->dedx_x[i][ip]<0 || l2->dedx_y[i][ip]<0){
876    //              cout << ip << " - "<< l2->cltrx[i][ip] << " "<<l2->cltry[i][ip]<<" "<<l2->ls[i][ip]<<endl;
877    //              cout << ip << " - "<<t_track->xgood[ip]<<" "<<t_track->ygood[ip]<<endl;
878    //              cout << ip << " - "<<t_track->GetClusterX_ID(ip)<<" "<<t_track->GetClusterY_ID(ip)<<" "<<t_track->GetLadder(ip)<<" "<<t_track->GetSensor(ip)<<endl;
879    //              cout << ip << " - "<<t_track->BadClusterX(ip)<<" "<<t_track->BadClusterY(ip)<<endl;
880    //              cout << ip << " - "<<t_track->SaturatedClusterX(ip)<<" "<<t_track->SaturatedClusterY(ip)<<endl;
881    //          }
882              t_track->xm[ip]     = l2->xm_nt[i][ip];              t_track->xm[ip]     = l2->xm_nt[i][ip];
883              t_track->ym[ip]     = l2->ym_nt[i][ip];              t_track->ym[ip]     = l2->ym_nt[i][ip];
884              t_track->zm[ip]     = l2->zm_nt[i][ip];              t_track->zm[ip]     = l2->zm_nt[i][ip];
885              t_track->resx[ip]   = l2->resx_nt[i][ip];              t_track->resx[ip]   = l2->resx_nt[i][ip];
886              t_track->resy[ip]   = l2->resy_nt[i][ip];              t_track->resy[ip]   = l2->resy_nt[i][ip];
887                t_track->tailx[ip]  = l2->tailx[i][ip];
888                t_track->taily[ip]  = l2->taily[i][ip];
889              t_track->xv[ip]     = l2->xv_nt[i][ip];              t_track->xv[ip]     = l2->xv_nt[i][ip];
890              t_track->yv[ip]     = l2->yv_nt[i][ip];              t_track->yv[ip]     = l2->yv_nt[i][ip];
891              t_track->zv[ip]     = l2->zv_nt[i][ip];              t_track->zv[ip]     = l2->zv_nt[i][ip];
# Line 795  void TrkLevel2::SetFromLevel2Struct(cTrk Line 893  void TrkLevel2::SetFromLevel2Struct(cTrk
893              t_track->ayv[ip]    = l2->ayv_nt[i][ip];              t_track->ayv[ip]    = l2->ayv_nt[i][ip];
894              t_track->dedx_x[ip] = l2->dedx_x[i][ip];              t_track->dedx_x[ip] = l2->dedx_x[i][ip];
895              t_track->dedx_y[ip] = l2->dedx_y[i][ip];              t_track->dedx_y[ip] = l2->dedx_y[i][ip];
 //          cout << " ip "<<ip<<" l2->cltrx[i][ip] "<< l2->cltrx[i][ip]<<endl;  
 //          cout << " ip "<<ip<<" l2->cltry[i][ip] "<< l2->cltry[i][ip]<<endl;  
896              //-----------------------------------------------------              //-----------------------------------------------------
897              //-----------------------------------------------------              //-----------------------------------------------------
 //          if(l1 && t_track->xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip);  
 //          if(l1 && t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip);  
             if(l2->xgood_nt[i][ip]){  
 //                  cout << " ip "<<ip<<" l2->cltrx[i][ip] "<< l2->cltrx[i][ip]<<endl;  
 //                  cout << " ip "<<ip<<" l2->cltrx[i][ip] "<< l2->cltrx[i][ip]<<" ";  
 //                  if( l1->GetCluster(l2->cltrx[i][ip]-1)->TestBit(l1->GetCluster(l2->cltrx[i][ip]-1)->kIsReferenced) )cout << ">> is referenced ";  
                 if(l1)t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip);  
 //                  cout << " --- "<<l1->GetCluster(l2->cltrx[i][ip]-1)->GetUniqueID()<<endl;  
 //              t_track->xgood[ip] = l2->cltrx[i][ip]; // WORK-AROUND *****  
             }else{  
                 if(l1)t_track->clx->RemoveAt(ip);  
             }  
             if(l2->ygood_nt[i][ip]){  
 //                  cout << " ip "<<ip<<" l2->cltry[i][ip] "<< l2->cltry[i][ip]<<endl;  
 //                  cout << " ip "<<ip<<" l2->cltry[i][ip] "<< l2->cltry[i][ip]<<" ";  
 //                  if( l1->GetCluster(l2->cltry[i][ip]-1)->TestBit(l1->GetCluster(l2->cltry[i][ip]-1)->kIsReferenced) )cout << ">> is referenced ";  
                 if(l1)t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip);  
 //                  cout << " --- "<<l1->GetCluster(l2->cltry[i][ip]-1)->GetUniqueID()<<endl;  
 //              t_track->ygood[ip] = l2->cltry[i][ip]; // WORK-AROUND *****  
             }else{  
                 if(l1)t_track->cly->RemoveAt(ip);  
             }  
898              //-----------------------------------------------------              //-----------------------------------------------------
899              //-----------------------------------------------------              //-----------------------------------------------------
900          };          };
901    //      if(t_track->IsSaturated())t_track->Dump();
902          new(t[i]) TrkTrack(*t_track);          new(t[i]) TrkTrack(*t_track);
903          t_track->Clear();          t_track->Clear();
904      };      };
905    
906  //  ----------------  //  ----------------
907  //  *** SINGLETS ***  //  *** SINGLETS ***
908  //  ----------------  //  ----------------
# Line 838  void TrkLevel2::SetFromLevel2Struct(cTrk Line 914  void TrkLevel2::SetFromLevel2Struct(cTrk
914          t_singlet->coord[1] = l2->xs[i][1];          t_singlet->coord[1] = l2->xs[i][1];
915          t_singlet->sgnl     = l2->signlxs[i];          t_singlet->sgnl     = l2->signlxs[i];
916          //-----------------------------------------------------          //-----------------------------------------------------
917          if(l1) t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);
918          //-----------------------------------------------------          //-----------------------------------------------------
919          new(sx[i]) TrkSinglet(*t_singlet);          new(sx[i]) TrkSinglet(*t_singlet);
920          t_singlet->Clear();          t_singlet->Clear();
# Line 851  void TrkLevel2::SetFromLevel2Struct(cTrk Line 927  void TrkLevel2::SetFromLevel2Struct(cTrk
927          t_singlet->coord[1] = l2->ys[i][1];          t_singlet->coord[1] = l2->ys[i][1];
928          t_singlet->sgnl     = l2->signlys[i];          t_singlet->sgnl     = l2->signlys[i];
929          //-----------------------------------------------------          //-----------------------------------------------------
930          if(l1) t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);
931          //-----------------------------------------------------          //-----------------------------------------------------
932          new(sy[i]) TrkSinglet(*t_singlet);          new(sy[i]) TrkSinglet(*t_singlet);
933          t_singlet->Clear();          t_singlet->Clear();
# Line 893  void TrkLevel2::GetLevel2Struct(cTrkLeve Line 969  void TrkLevel2::GetLevel2Struct(cTrkLeve
969                  l2->zm_nt[i][ip]    = ((TrkTrack *)Track->At(i))->zm[ip];                  l2->zm_nt[i][ip]    = ((TrkTrack *)Track->At(i))->zm[ip];
970                  l2->resx_nt[i][ip]  = ((TrkTrack *)Track->At(i))->resx[ip];                  l2->resx_nt[i][ip]  = ((TrkTrack *)Track->At(i))->resx[ip];
971                  l2->resy_nt[i][ip]  = ((TrkTrack *)Track->At(i))->resy[ip];                  l2->resy_nt[i][ip]  = ((TrkTrack *)Track->At(i))->resy[ip];
972                    l2->tailx[i][ip]  = ((TrkTrack *)Track->At(i))->tailx[ip];
973                    l2->taily[i][ip]  = ((TrkTrack *)Track->At(i))->taily[ip];
974                  l2->xv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->xv[ip];                  l2->xv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->xv[ip];
975                  l2->yv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->yv[ip];                  l2->yv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->yv[ip];
976                  l2->zv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->zv[ip];                  l2->zv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->zv[ip];
# Line 931  void TrkLevel2::GetLevel2Struct(cTrkLeve Line 1009  void TrkLevel2::GetLevel2Struct(cTrkLeve
1009  void TrkLevel2::Clear(){  void TrkLevel2::Clear(){
1010      for(Int_t i=0; i<12 ; i++){      for(Int_t i=0; i<12 ; i++){
1011          good[i] = -1;          good[i] = -1;
1012            VKflag[i] = 0;
1013            VKmask[i] = 0;
1014      };      };
1015  //    if(Track)Track->Clear("C");  //    if(Track)Track->Clear("C");
1016  //    if(SingletX)SingletX->Clear("C");  //    if(SingletX)SingletX->Clear("C");

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

  ViewVC Help
Powered by ViewVC 1.1.23