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

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

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

revision 1.16 by pam-fi, Fri Apr 27 10:39:57 2007 UTC revision 1.26 by pam-fi, Tue Mar 12 11:02:03 2013 UTC
# Line 16  extern "C" { Line 16  extern "C" {
16      float pfaeta2_(int*,float*);      float pfaeta2_(int*,float*);
17      float pfaeta3_(int*,float*);      float pfaeta3_(int*,float*);
18      float pfaeta4_(int*,float*);      float pfaeta4_(int*,float*);
19        float pfaetal_(int*,float*);
20        float digsat_(int*);
21        int   npfastrips_(int*,float*);
22                    
23  }  }
24  //--------------------------------------  //--------------------------------------
# Line 94  void TrkCluster::Clear(){ Line 97  void TrkCluster::Clear(){
97   * strips, around maxs, having a significant signal.   * strips, around maxs, having a significant signal.
98   * @param nstrip   Maximum number of strips.   * @param nstrip   Maximum number of strips.
99   * @param cut      Inclusion cut ( s > cut*sigma ).   * @param cut      Inclusion cut ( s > cut*sigma ).
100     * @param force    Falg to force the PFA strip-inclusion pattern (nstrip>0)
101   * If nstrip<=0 only the inclusion cut is used to determine the cluster size.   * If nstrip<=0 only the inclusion cut is used to determine the cluster size.
102   */   */
103  Float_t TrkCluster::GetSignal(Int_t nstrip, Float_t cut){  Float_t TrkCluster::GetSignal(Int_t nstrip, Float_t cut, Bool_t force){
104            
105      if(CLlength<=0)return 0;      if(CLlength<=0)return 0;
106    
107      Float_t s = 0;      Float_t s = 0;
108            
109        //-----------------------------------
110        // inlcude strips with s > cut*sigma
111        //-----------------------------------
112    
113      if( nstrip<=0 ){      if( nstrip<=0 ){
114  //          for(Int_t is = 0; is < CLlength; is++){  //          for(Int_t is = 0; is < CLlength; is++){
115  //              Float_t scut = cut*clsigma[is];  //              Float_t scut = cut*clsigma[is];
# Line 120  Float_t TrkCluster::GetSignal(Int_t nstr Line 128  Float_t TrkCluster::GetSignal(Int_t nstr
128          return s;          return s;
129      };      };
130            
131        //---------------------------------------------------
132        // inlcude strips with s > cut*sigma, up to nstrip.
133        // strips are included in order of decreasing signal
134        //---------------------------------------------------
135        if( !force ){
136    
137            Int_t il = indmax;
138            Int_t ir = indmax;
139            Int_t inc = 0;
140            
141            if( clsignal[indmax] < cut*clsigma[indmax] ) return 0;
142            
143            while ( inc < nstrip ){
144                Float_t sl = -100000;
145                Float_t sr = -100000;
146                if( il >= 0       ) sl = clsignal[il];
147                if( ir < CLlength ) sr = clsignal[ir];
148                if( sl == sr && inc == 0 ){
149                    s += clsignal[il]; //cout << inc<<" - "<< clsignal[il]<<" "<<s<<endl;
150                    il--;
151                    ir++;
152                }else if ( sl >= sr && sl > cut*clsigma[il] && inc !=0 ){
153                    s += sl;//cout << inc<<" - "<< clsignal[il]<<" "<<s<<endl;
154                    il--;
155                }else if ( sl < sr && sr > cut*clsigma[ir] ){
156                    s += sr;//cout << inc<<" - " << clsignal[ir]<<" "<<s<<endl;
157                    ir++;
158                }else break;
159                
160                inc++;
161            }
162            return s;
163    
164        }else{
165        //---------------------------------------------------
166        // evaluate signal using a fixed number of strips,
167        // following the PFA inclusion patters
168        //---------------------------------------------------
169    //     --> signal of the central strip
170            Float_t sc = clsignal[indmax];
171    //     signal of adjacent strips
172            Float_t sl1 = -9999.;
173            Float_t sl2 = -9999.;
174            Float_t sr1 = -9999.;
175            Float_t sr2 = -9999.;
176            if(indmax-1>=0) sl1 = clsignal[indmax-1];
177            if(indmax-2>=0) sl2 = clsignal[indmax-2];
178            if(indmax+1<CLlength) sr1 = clsignal[indmax+1];
179            if(indmax+2<CLlength) sr2 = clsignal[indmax+2];
180    
181            if(nstrip==1){
182                s = sc;
183            }else if(nstrip==2){
184                if( sl1>sr1 && sl1+sc!=0 )s = (sl1+sc);
185                if( sl1<sr1 && sr1+sc!=0 )s = (sc+sr1);
186                if( sl1==sr1 && sl1 != -9999.){
187                    if( clsigma[indmax-1] < clsigma[indmax+1] &&  sl1+sc!=0 )s = (sl1+sc);
188                    if( clsigma[indmax-1] > clsigma[indmax+1] &&  sc+sr1!=0 )s = (sc+sr1);
189                }
190            }else if(nstrip==3){
191                s = (sl1+sc+sr1);
192            }else if(nstrip==4){
193                if( sl2>sr2 && sl2+sl1+sc+sr1!=0 )s = (sl2+sl1+sc+sr1);
194                if( sl2<sr2 && sl1+sc+sr1+sr2!=0 )s = (sl1+sc+sr1+sr2);
195                if( sl2==sr2 && sl2 != -9999.){
196                    if( clsigma[indmax-2] < clsigma[indmax+2] &&  sl2+sl1+sc+sr1!=0 )s = (sl2+sl1+sc+sr1);
197                    if( clsigma[indmax-2] > clsigma[indmax+2] &&  sl1+sc+sr1+sr2!=0 )s = (sl1+sc+sr1+sr2);
198                }
199            }else if(nstrip==5){
200                s = (sl1+sc+sr1);
201                if(sl2 != -9999.)s += sl2;
202                if(sr2 != -9999.)s += sr2;
203            }else{
204                cout << "Float_t TrkCluster::GetSignal("<<nstrip<<","<<cut<<","<<force<<")- not implemented"<<endl;  
205            }
206            
207      Int_t il = indmax;      }
     Int_t ir = indmax;  
     Int_t inc = 0;  
208    
209      if( clsignal[indmax] < cut*clsigma[indmax] ) return 0;      return 0.;
210    
     while ( inc < nstrip ){  
         Float_t sl = -100000;  
         Float_t sr = -100000;  
         if( il >= 0       ) sl = clsignal[il];  
         if( ir < CLlength ) sr = clsignal[ir];  
         if( sl == sr && inc == 0 ){  
             s += clsignal[il]; //cout << inc<<" - "<< clsignal[il]<<" "<<s<<endl;  
             il--;  
             ir++;  
         }else if ( sl >= sr && sl > cut*clsigma[il] && inc !=0 ){  
             s += sl;//cout << inc<<" - "<< clsignal[il]<<" "<<s<<endl;  
             il--;  
         }else if ( sl < sr && sr > cut*clsigma[ir] ){  
             s += sr;//cout << inc<<" - " << clsignal[ir]<<" "<<s<<endl;  
             ir++;  
         }else break;  
           
         inc++;  
     }  
     return s;  
211  };  };
212    
213    
# Line 239  Bool_t TrkCluster::IsBad(Int_t nbad){ Line 300  Bool_t TrkCluster::IsBad(Int_t nbad){
300      il = indmax;      il = indmax;
301      ir = indmax;      ir = indmax;
302      for(Int_t i=1; i<nbad; i++){      for(Int_t i=1; i<nbad; i++){
303          if (ir == CLlength && il == 0)break;          if (ir == CLlength-1 && il == 0)break;
304          else if (ir == CLlength && il != 0)il--;          else if (ir == CLlength-1 && il != 0)il--;
305          else if (ir != CLlength && il == 0)ir++;          else if (ir != CLlength-1 && il == 0)ir++;
306          else{          else{
307              if(clsignal[il-1] > clsignal[ir+1])il--;              if(clsignal[il-1] > clsignal[ir+1])il--;
308              else ir++;              else ir++;
# Line 264  Bool_t TrkCluster::IsSaturated(Int_t nba Line 325  Bool_t TrkCluster::IsSaturated(Int_t nba
325      il = indmax;      il = indmax;
326      ir = indmax;      ir = indmax;
327      for(Int_t i=1; i<nbad; i++){      for(Int_t i=1; i<nbad; i++){
328          if (ir == CLlength && il == 0)break;          if (ir == CLlength-1 && il == 0)break;
329          else if (ir == CLlength && il != 0)il--;          else if (ir == CLlength-1 && il != 0)il--;
330          else if (ir != CLlength && il == 0)ir++;          else if (ir != CLlength-1 && il == 0)ir++;
331          else{          else{
332              if(clsignal[il-1] > clsignal[ir+1])il--;              if(clsignal[il-1] > clsignal[ir+1])il--;
333              else ir++;              else ir++;
# Line 291  void TrkCluster::Dump(){ Line 352  void TrkCluster::Dump(){
352      cout << "Position of maximun "<< maxs <<endl;      cout << "Position of maximun "<< maxs <<endl;
353      cout << "Multiplicity        "<< GetMultiplicity() <<endl;      cout << "Multiplicity        "<< GetMultiplicity() <<endl;
354      cout << "Tot signal          "<< GetSignal() << " (ADC channels)"<<endl ;      cout << "Tot signal          "<< GetSignal() << " (ADC channels)"<<endl ;
355      cout << "Signal/Noise        "<< GetSignalToNoise();      cout << "Signal/Noise        "<< GetSignalToNoise()<<endl;
356      cout <<endl<< "Strip signals       ";      cout << "COG                 "<< GetCOG(0)<<endl;;
357        cout << "Strip signals       ";
358      for(Int_t i =0; i<CLlength; i++)cout << " " <<clsignal[i];      for(Int_t i =0; i<CLlength; i++)cout << " " <<clsignal[i];
359      cout <<endl<< "Strip sigmas        ";      cout <<endl<< "Strip sigmas        ";
360      for(Int_t i =0; i<CLlength; i++)cout << " " <<clsigma[i];      for(Int_t i =0; i<CLlength; i++)cout << " " <<clsigma[i];
# Line 387  Float_t TrkCluster::GetCOG(Float_t angle Line 449  Float_t TrkCluster::GetCOG(Float_t angle
449  //  //
450  //--------------------------------------  //--------------------------------------
451  /**  /**
452   * Evaluates the cluster position, in strips, relative to the strip with the maximum signal (TrkCluster::maxs), by applying the non-linear ETA-algorythm.   * Evaluates the cluster position, in pitch units, relative to the strip
453     *  with the maximum signal (TrkCluster::maxs), by applying the non-linear
454     *  ETA-algorythm.
455   *  @param neta  Number of strips to evaluate ETA.   *  @param neta  Number of strips to evaluate ETA.
456   *  @param angle Projected angle between particle track and detector plane.   *  @param angle Projected (effective) angle between particle track and detector plane.
457     *  @landi flag to apply Landi correction
458   * Implemented values of neta are 2,3,4. If neta=0, ETA2, ETA3 and ETA4 are applied according to the angle.   * Implemented values of neta are 2,3,4. If neta=0, ETA2, ETA3 and ETA4 are applied according to the angle.
459   */   */
460  Float_t TrkCluster::GetETA(Int_t neta, float angle){  Float_t TrkCluster::GetETA(Int_t neta, float angle, bool landi){
461                    
462  //    cout << "GetETA(neta,angle) "<< neta << " "<< angle;  //    cout << "GetETA(neta,angle) "<< neta << " "<< angle;
463  //      LoadPfaParam();  //      LoadPfaParam();
464    
465      TrkParams::Load(4);      TrkParams::Load(4);
466      if( !TrkParams::IsLoaded(4) ){      if( !TrkParams::IsLoaded(4) ){
467          cout << "int Trajectory::DoTrack2(float* al) --- ERROR --- p.f.a. parameters  not loaded"<<endl;          cout << "Float_t TrkCluster::GetETA(Int_t neta, float angle, bool landi) --- ERROR --- p.f.a. parameters  not loaded"<<endl;
468          return 0;          return 0;
469      }      }
470    
471      float ax = angle;      float ax = angle;
472      int ic = 1;      int ic = 1;
473      GetLevel1Struct();      GetLevel1Struct();
474      if(neta == 0)      return pfaeta_(&ic,&ax);      if(     neta == 0 && !landi) return pfaeta_(&ic,&ax);
475      else if(neta == 2) return pfaeta2_(&ic,&ax);      else if(neta == 0 && landi ) return pfaetal_(&ic,&ax);
476      else if(neta == 3) return pfaeta3_(&ic,&ax);      else if(neta == 2          ) return pfaeta2_(&ic,&ax);
477      else if(neta == 4) return pfaeta4_(&ic,&ax);      else if(neta == 3          ) return pfaeta3_(&ic,&ax);
478      else cout << "ETA"<<neta<<" not implemented\n";      else if(neta == 4          ) return pfaeta4_(&ic,&ax);
479        else cout << "TrkCluster::GetETA("<<neta<<","<<angle<<","<<landi<<") not implemented\n";
480      return 0;      return 0;
481            
482  };  };
483    
484    /**
485     * Evaluates the cluster position, in pitch units, relative to the strip
486     *  with the maximum signal (TrkCluster::maxs), by applying the digital
487     *  algorithm for saturated clusters.
488     *
489     *  @return The cluster position (0 also if if no saturated strip is found).
490     */
491    Float_t TrkCluster::GetDigSat() {
492    
493      GetLevel1Struct();
494      int ic = 1;
495      return digsat_(&ic);
496    
497    }
498    
499    /**
500     * Evaluates the cluster position, in pitch unit, relative to the strip with
501     * the maximum signal (TrkCluster::maxs), by applying the PFA set as default (see TrkParams).
502     *  @param angle Projected (effective) angle between particle track and detector plane.
503     */
504    Float_t TrkCluster::GetPositionPU(float angle){
505    
506        if     ( TrkParams::GetPFA() == 0  )return GetETA(0,angle,false);
507        else if( TrkParams::GetPFA() == 2  )return GetETA(2,angle,false);
508        else if( TrkParams::GetPFA() == 3  )return GetETA(3,angle,false);
509        else if( TrkParams::GetPFA() == 4  )return GetETA(4,angle,false);
510        else if( TrkParams::GetPFA() == 5  )return GetETA(0,angle,true);
511        else if( TrkParams::GetPFA() == 10 )return GetCOG(0);
512        else if( TrkParams::GetPFA() == 11 )return GetCOG(1);
513        else if( TrkParams::GetPFA() == 12 )return GetCOG(2);
514        else if( TrkParams::GetPFA() == 13 )return GetCOG(3);
515        else if( TrkParams::GetPFA() == 14 )return GetCOG(4);
516        else cout << "  TrkCluster::GetPositionPU(float "<<angle<<") -- WARNING -- PFA="<<TrkParams::GetPFA()<<" not implemented"<<endl;
517        
518        return 0.;
519        
520    }
521    
522    /**
523     * Give the number of strip used to evaluate the cluster coordinate
524     * according to the p.f.a.
525     * It returns 0 when the COG is used (in this case the number of strip used
526     * equals the multiplicity).
527     */
528    Int_t TrkCluster::GetPFAstrips(float angle){
529    
530        float ax = angle;
531        int ic = 1;
532        GetLevel1Struct();
533        return npfastrips_(&ic,&ax);
534    
535    }
536    
537  //--------------------------------------  //--------------------------------------
538  //  //
539  //  //
# Line 431  TrkLevel1::TrkLevel1(){ Line 550  TrkLevel1::TrkLevel1(){
550              cnn[j][i]=0;              cnn[j][i]=0;
551          };          };
552      };      };
553    //     TrkParams::SetTrackingMode();
554    //     TrkParams::SetPrecisionFactor();
555    //     TrkParams::SetStepMin();
556        TrkParams::SetMiniDefault();
557        TrkParams::SetPFA();
558  }  }
559  //--------------------------------------  //--------------------------------------
560  //  //
# Line 463  void TrkLevel1::Dump(){ Line 587  void TrkLevel1::Dump(){
587      for(int i=0; i<this->nclstr(); i++)     ((TrkCluster *)t[i])->Dump();      for(int i=0; i<this->nclstr(); i++)     ((TrkCluster *)t[i])->Dump();
588            
589  }  }
590    /**
591     * \brief Dump processing status
592     */
593    void TrkLevel1::StatusDump(int view){
594        cout << "DSP n. "<<view+1<<" (level1-)status: "<<hex<<showbase<<good[view]<<dec<<endl;    
595    };
596    /**
597     * \brief Check event status
598     *
599     * Check the event status, according to a flag-mask given as input.
600     * Return true if the view passes the check.
601     *
602     * @param view View number (0-11)
603     * @param flagmask Mask of flags to check (eg. flagmask=0x111 no missing packet,
604     *  no crc error, no software alarm)
605     *
606     * @see TrkLevel2 class definition to know how the status flag is defined
607     *
608     */
609    Bool_t TrkLevel1::StatusCheck(int view, int flagmask){
610    
611        if( view<0 || view >= 12)return false;
612        return !(good[view]&flagmask);
613    
614    };
615    
616    
617  //--------------------------------------  //--------------------------------------
618  //  //
619  //  //
# Line 500  void TrkLevel1::SetFromLevel1Struct(cTrk Line 651  void TrkLevel1::SetFromLevel1Struct(cTrk
651              t_cl->clsigma  = new Float_t[t_cl->CLlength];              t_cl->clsigma  = new Float_t[t_cl->CLlength];
652              t_cl->cladc    = new Int_t[t_cl->CLlength];              t_cl->cladc    = new Int_t[t_cl->CLlength];
653              t_cl->clbad    = new Bool_t[t_cl->CLlength];              t_cl->clbad    = new Bool_t[t_cl->CLlength];
654    
655              Int_t index = 0;              Int_t index = 0;
656              for(Int_t is = from; is < to; is++ ){              for(Int_t is = from; is < to; is++ ){
657                  t_cl->clsignal[index] = (Float_t) l1->clsignal[is];                  t_cl->clsignal[index] = (Float_t) l1->clsignal[is];
# Line 626  TrkCluster *TrkLevel1::GetCluster(int is Line 778  TrkCluster *TrkLevel1::GetCluster(int is
778      TrkCluster *cluster = (TrkCluster*)t[is];      TrkCluster *cluster = (TrkCluster*)t[is];
779      return cluster;      return cluster;
780  }  }
 //--------------------------------------  
 //  
 //  
 //--------------------------------------  
 // /**  
 //  * Load Position-Finding-Algorythm parameters (call the F77 routine).  
 //  *  
 //  */  
 // int TrkLevel1::LoadPfaParam(TString path){  
           
 //     if( path.IsNull() ){  
 //      path = gSystem->Getenv("PAM_CALIB");  
 //      if(path.IsNull()){  
 //          cout << " TrkLevel1::LoadPfaParam() ==> No PAMELA environment variables defined "<<endl;  
 //          return 0;  
 //      }  
 //      path.Append("/trk-param/eta_param-0/");  
 //     }  
781    
 //     strcpy(path_.path,path.Data());  
 //     path_.pathlen = path.Length();  
 //     path_.error   = 0;  
 //     cout <<"Loading p.f.a. parameters: "<<path<<endl;  
 //     return readetaparam_();  
 // }  
782    
783  // /**  // int TrkLevel1::GetPfaNbinsAngle(){
784  //  * Load magnetic field parameters (call the F77 routine).  //     TrkParams::Load(4);
785  //  *  //     if( !TrkParams::IsLoaded(4) ){
786  //  */  //      cout << "int TrkLevel1::GetPfaNbinsAngle() --- ERROR --- p.f.a. parameters  not loaded"<<endl;
787  // int TrkLevel1::LoadFieldParam(TString path){  //      return 0;
           
 // //    if( strcmp(path_.path,path.Data()) ){  
 //     if( path.IsNull() ){  
 //      path = gSystem->Getenv("PAM_CALIB");  
 //      if(path.IsNull()){  
 //          cout << " TrkLevel1::LoadFieldParam() ==> No PAMELA environment variables defined "<<endl;  
 //          return 0;  
 //      }  
 //      path.Append("/trk-param/field_param-0/");  
788  //     }  //     }
789  //     cout <<"Loading magnetic field "<<path<<endl;  //     return pfa_.nangbin;
790  //     strcpy(path_.path,path.Data());  // };
791  //     path_.pathlen = path.Length();  
792  //     path_.error   = 0;  // int TrkLevel1::GetPfaNbinsETA(){
793  //     return readb_();  //     TrkParams::Load(4);
794  // //    }        //     if( !TrkParams::IsLoaded(4) ){
795  // //    return 0;  //      cout << "int TrkLevel1::GetPfaNbinsETA() --- ERROR --- p.f.a. parameters  not loaded"<<endl;
796  // }  //      return 0;
 // /**  
 //  * Load magnetic field parameters (call the F77 routine).  
 //  *  
 //  */  
 // int TrkLevel1::LoadChargeParam(TString path){  
           
 // //    if( strcmp(path_.path,path.Data()) ){  
 //     if( path.IsNull() ){  
 //      path = gSystem->Getenv("PAM_CALIB");  
 //      if(path.IsNull()){  
 //          cout << " TrkLevel1::LoadChargeParam() ==> No PAMELA environment variables defined "<<endl;  
 //          return 0;  
 //      }  
 //      path.Append("/trk-param/charge_param-1/");  
 //     }  
 //     cout <<"Loading charge-correlation parameters: "<<path<<endl;  
 //     strcpy(path_.path,path.Data());  
 //     path_.pathlen = path.Length();  
 //     path_.error   = 0;  
 //     return readchargeparam_();  
 // //    }        
 // //    return 0;  
 // }  
 // /**  
 //  * Load magnetic field parameters (call the F77 routine).  
 //  *  
 //  */  
 // int TrkLevel1::LoadAlignmentParam(TString path){  
           
 // //    if( strcmp(path_.path,path.Data()) ){  
 //     if( path.IsNull() ){  
 //      path = gSystem->Getenv("PAM_CALIB");  
 //      if(path.IsNull()){  
 //          cout << " TrkLevel1::LoadAlignmentParam() ==> No PAMELA environment variables defined "<<endl;  
 //          return 0;  
 //      }  
 //      path.Append("/trk-param/align_param-0/");  
 //     }  
 //     cout <<"Loading alignment parameters: "<<path<<endl;  
 //     strcpy(path_.path,path.Data());  
 //     path_.pathlen = path.Length();  
 //     path_.error   = 0;  
 //     return readalignparam_();  
 // //    }        
 // //    return 0;  
 // }  
 // /**  
 //  * Load magnetic field parameters (call the F77 routine).  
 //  *  
 //  */  
 // int TrkLevel1::LoadMipParam(TString path){  
           
 // //    if( strcmp(path_.path,path.Data()) ){  
 //     if( path.IsNull() ){  
 //      path = gSystem->Getenv("PAM_CALIB");  
 //      if(path.IsNull()){  
 //          cout << " TrkLevel1::LoadMipParam() ==> No PAMELA environment variables defined "<<endl;  
 //          return 0;  
 //      }  
 //      path.Append("/trk-param/mip_param-0/");  
 //     }  
 //     cout <<"Loading ADC-to-MIP conversion parameters: "<<path<<endl;  
 //     strcpy(path_.path,path.Data());  
 //     path_.pathlen = path.Length();  
 //     path_.error   = 0;  
 //     return readmipparam_();  
 // //    }        
 // //    return 0;  
 // }  
 // /**  
 //  * Load magnetic field parameters (call the F77 routine).  
 //  *  
 //  */  
 // int TrkLevel1::LoadVKMaskParam(TString path){  
           
 // //    if( strcmp(path_.path,path.Data()) ){  
 //     if( path.IsNull() ){  
 //      path = gSystem->Getenv("PAM_CALIB");  
 //      if(path.IsNull()){  
 //          cout << " TrkLevel1::LoadVKMaskParam() ==> No PAMELA environment variables defined "<<endl;  
 //          return 0;  
 //      }  
 //      path.Append("/trk-param/mask_param-1/");  
797  //     }  //     }
798  //     cout <<"Loading VK-mask parameters: "<<path<<endl;  //     return pfa_.netaval;
799  //     strcpy(path_.path,path.Data());  // };
 //     path_.pathlen = path.Length();  
 //     path_.error   = 0;  
 //     return readvkmask_();  
 // //    }        
 // //    return 0;  
 // }  
800    
801  // /**  // /**
802  //  * Load all (default) parameters. Environment variable must be defined.  //  *
803  //  *  //  *
804  //  */  //  */
805  // int TrkLevel1::LoadParams(){  // float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang){
   
 //     int result=0;  
       
 //     result = result * LoadFieldParam();  
 //     result = result * LoadPfaParam();  
 //     result = result * LoadChargeParam();  
 //     result = result * LoadAlignmentParam();  
 //     result = result * LoadMipParam();  
 //     result = result * LoadVKMaskParam();  
   
 //     return result;  
 // }  
   
806    
807    //     TrkParams::Load(4);
808  int TrkLevel1::GetPfaNbinsAngle(){  //     if( !TrkParams::IsLoaded(4) ){
809      TrkParams::Load(4);  //      cout << "float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang) --- ERROR --- p.f.a. parameters  not loaded"<<endl;
810      if( !TrkParams::IsLoaded(4) ){  //      return 0;
811          cout << "int TrkLevel1::GetPfaNbinsAngle() --- ERROR --- p.f.a. parameters  not loaded"<<endl;  //     }
         return 0;  
     }  
     return pfa_.nangbin;  
 };  
   
 int TrkLevel1::GetPfaNbinsETA(){  
     TrkParams::Load(4);  
     if( !TrkParams::IsLoaded(4) ){  
         cout << "int TrkLevel1::GetPfaNbinsETA() --- ERROR --- p.f.a. parameters  not loaded"<<endl;  
         return 0;  
     }  
     return pfa_.netaval;  
 };  
   
 /**  
  *  
  *  
  */  
 float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang){  
   
     TrkParams::Load(4);  
     if( !TrkParams::IsLoaded(4) ){  
         cout << "float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang) --- ERROR --- p.f.a. parameters  not loaded"<<endl;  
         return 0;  
     }  
812        
813      int nbins = GetPfaNbinsETA();  //     int nbins = GetPfaNbinsETA();
814      if(!nbins)return 0;  //     if(!nbins)return 0;
815    
816      float *fcorr = new float [nbins];  //     float *fcorr = new float [nbins];
817    
818      if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){  //     if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){
819          for(int ib=0; ib<nbins; ib++){  //      for(int ib=0; ib<nbins; ib++){
820              fcorr[ib] = pfa_.feta2[nang][nladder][nview][ib];  //          fcorr[ib] = pfa_.feta2[nang][nladder][nview][ib];
821              cout << pfa_.eta2[nang][ib] << " - " <<  pfa_.feta2[nang][nladder][nview][ib]<<endl;;  //          cout << pfa_.eta2[nang][ib] << " - " <<  pfa_.feta2[nang][nladder][nview][ib]<<endl;;
822          }  //      }
823      }else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){  //     }else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){
824          for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta3[nang][nladder][nview][ib];  //      for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta3[nang][nladder][nview][ib];
825      }else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){  //     }else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){
826          for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta4[nang][nladder][nview][ib];  //      for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta4[nang][nladder][nview][ib];
827      }else{  //     }else{
828          cout << pfa<<" pfa parameters not implemented "<<endl;  //      cout << pfa<<" pfa parameters not implemented "<<endl;
829          return 0;  //      return 0;
830      }      //     }    
831    
832      return fcorr;  //     return fcorr;
833    
834  };  // };
835    
836  float* TrkLevel1::GetPfaAbs(TString pfa, int nang){  // float* TrkLevel1::GetPfaAbs(TString pfa, int nang){
837        
838      TrkParams::Load(4);  //     TrkParams::Load(4);
839      if( !TrkParams::IsLoaded(4) ){  //     if( !TrkParams::IsLoaded(4) ){
840          cout << "float* TrkLevel1::GetPfaAbs(TString pfa, int nang) --- ERROR --- p.f.a. parameters  not loaded"<<endl;  //      cout << "float* TrkLevel1::GetPfaAbs(TString pfa, int nang) --- ERROR --- p.f.a. parameters  not loaded"<<endl;
841          return 0;  //      return 0;
842      }  //     }
843    
844      int nbins = GetPfaNbinsETA();  //     int nbins = GetPfaNbinsETA();
845      if(!nbins)return 0;  //     if(!nbins)return 0;
846    
847      float *fcorr = new float [nbins];  //     float *fcorr = new float [nbins];
848    
849      if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){  //     if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){
850          for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta2[nang][ib];  //      for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta2[nang][ib];
851      }else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){  //     }else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){
852          for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta3[nang][ib];  //      for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta3[nang][ib];
853      }else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){  //     }else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){
854          for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta4[nang][ib];  //      for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta4[nang][ib];
855      }else{  //     }else{
856          cout << pfa<<" pfa parameters not implemented "<<endl;  //      cout << pfa<<" pfa parameters not implemented "<<endl;
857          return 0;  //      return 0;
858      }      //     }    
859    
860      return fcorr;  //     return fcorr;
861    
862  };  // };
863    
864  /**  /**
865   * Method to call the F77 routine that performs level1->level2 processing.   * Method to call the F77 routine that performs level1->level2 processing.
866   * The level2 output is stored in a common block, which can be retrieved   * The level2 output is stored in a common block, which can be retrieved
867   * by mean of the method TrkLevel2::SetFromLevel2Struct().   * by mean of the method TrkLevel2::SetFromLevel2Struct().
  * @param pfa Position finding algorythm used to reconstruct the track  
  * Implemented algorythms:  
  * 0  ETA (default)  
  * 1  ---  
  * 2  ETA2  
  * 3  ETA3  
  * 4  ETA4  
  * 10 COG  
  * 11 COG1  
  * 12 COG2  
  * 13 COG3  
  * 14 COG4  
868   * NB If the TrkLevel1 object is readout from a tree, and the   * NB If the TrkLevel1 object is readout from a tree, and the
869   * TrkLevel1::ProcessEvent(int pfa) is used to reprocess the event, attention   * TrkLevel1::ProcessEvent(int pfa) is used to reprocess the event, attention
870   * should be payed to the fact that single clusters (clusters not associated   * should be payed to the fact that single clusters (clusters not associated
871   * with any track) might not be stored. Full reprocessing should be done from   * with any track) might not be stored. Full reprocessing should be done starting
872   * level0 data.   * from level0 data.
873   */   */
874  int TrkLevel1::ProcessEvent(int pfa){  //int TrkLevel1::ProcessEvent(int pfa){
875    int TrkLevel1::ProcessEvent(){
876    
877  //    cout << "int TrkLevel1::ProcessEvent()" << endl;  //    cout << "int TrkLevel1::ProcessEvent()" << endl;
878      TrkParams::Load( );      TrkParams::Load( );
# Line 899  int TrkLevel1::ProcessEvent(int pfa){ Line 880  int TrkLevel1::ProcessEvent(int pfa){
880    
881      GetLevel1Struct();      GetLevel1Struct();
882    
883      analysisflight_(&pfa);  //    analysisflight_(&pfa);
884    //    TrkParams::SetPFA(pfa);
885        analysisflight_();
886    
887      return 1;      return 1;
888    

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.26

  ViewVC Help
Powered by ViewVC 1.1.23