/[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.21 by pam-fi, Wed Aug 22 07:03:45 2007 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                    
21  }  }
22  //--------------------------------------  //--------------------------------------
# Line 239  Bool_t TrkCluster::IsBad(Int_t nbad){ Line 240  Bool_t TrkCluster::IsBad(Int_t nbad){
240      il = indmax;      il = indmax;
241      ir = indmax;      ir = indmax;
242      for(Int_t i=1; i<nbad; i++){      for(Int_t i=1; i<nbad; i++){
243          if (ir == CLlength && il == 0)break;          if (ir == CLlength-1 && il == 0)break;
244          else if (ir == CLlength && il != 0)il--;          else if (ir == CLlength-1 && il != 0)il--;
245          else if (ir != CLlength && il == 0)ir++;          else if (ir != CLlength-1 && il == 0)ir++;
246          else{          else{
247              if(clsignal[il-1] > clsignal[ir+1])il--;              if(clsignal[il-1] > clsignal[ir+1])il--;
248              else ir++;              else ir++;
# Line 264  Bool_t TrkCluster::IsSaturated(Int_t nba Line 265  Bool_t TrkCluster::IsSaturated(Int_t nba
265      il = indmax;      il = indmax;
266      ir = indmax;      ir = indmax;
267      for(Int_t i=1; i<nbad; i++){      for(Int_t i=1; i<nbad; i++){
268          if (ir == CLlength && il == 0)break;          if (ir == CLlength-1 && il == 0)break;
269          else if (ir == CLlength && il != 0)il--;          else if (ir == CLlength-1 && il != 0)il--;
270          else if (ir != CLlength && il == 0)ir++;          else if (ir != CLlength-1 && il == 0)ir++;
271          else{          else{
272              if(clsignal[il-1] > clsignal[ir+1])il--;              if(clsignal[il-1] > clsignal[ir+1])il--;
273              else ir++;              else ir++;
# Line 291  void TrkCluster::Dump(){ Line 292  void TrkCluster::Dump(){
292      cout << "Position of maximun "<< maxs <<endl;      cout << "Position of maximun "<< maxs <<endl;
293      cout << "Multiplicity        "<< GetMultiplicity() <<endl;      cout << "Multiplicity        "<< GetMultiplicity() <<endl;
294      cout << "Tot signal          "<< GetSignal() << " (ADC channels)"<<endl ;      cout << "Tot signal          "<< GetSignal() << " (ADC channels)"<<endl ;
295      cout << "Signal/Noise        "<< GetSignalToNoise();      cout << "Signal/Noise        "<< GetSignalToNoise()<<endl;
296      cout <<endl<< "Strip signals       ";      cout << "COG                 "<< GetCOG(0)<<endl;;
297        cout << "Strip signals       ";
298      for(Int_t i =0; i<CLlength; i++)cout << " " <<clsignal[i];      for(Int_t i =0; i<CLlength; i++)cout << " " <<clsignal[i];
299      cout <<endl<< "Strip sigmas        ";      cout <<endl<< "Strip sigmas        ";
300      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 389  Float_t TrkCluster::GetCOG(Float_t angle
389  //  //
390  //--------------------------------------  //--------------------------------------
391  /**  /**
392   * 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 with the maximum signal (TrkCluster::maxs), by applying the non-linear ETA-algorythm.
393   *  @param neta  Number of strips to evaluate ETA.   *  @param neta  Number of strips to evaluate ETA.
394   *  @param angle Projected angle between particle track and detector plane.   *  @param angle Projected (effective) angle between particle track and detector plane.
395   * 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.
396   */   */
397  Float_t TrkCluster::GetETA(Int_t neta, float angle){  Float_t TrkCluster::GetETA(Int_t neta, float angle, bool landi){
398                    
399  //    cout << "GetETA(neta,angle) "<< neta << " "<< angle;  //    cout << "GetETA(neta,angle) "<< neta << " "<< angle;
400  //      LoadPfaParam();  //      LoadPfaParam();
# Line 406  Float_t TrkCluster::GetETA(Int_t neta, f Line 408  Float_t TrkCluster::GetETA(Int_t neta, f
408      float ax = angle;      float ax = angle;
409      int ic = 1;      int ic = 1;
410      GetLevel1Struct();      GetLevel1Struct();
411      if(neta == 0)      return pfaeta_(&ic,&ax);      if(     neta == 0 && !landi) return pfaeta_(&ic,&ax);
412      else if(neta == 2) return pfaeta2_(&ic,&ax);      else if(neta == 0 && landi ) return pfaetal_(&ic,&ax);
413      else if(neta == 3) return pfaeta3_(&ic,&ax);      else if(neta == 2          ) return pfaeta2_(&ic,&ax);
414      else if(neta == 4) return pfaeta4_(&ic,&ax);      else if(neta == 3          ) return pfaeta3_(&ic,&ax);
415        else if(neta == 4          ) return pfaeta4_(&ic,&ax);
416      else cout << "ETA"<<neta<<" not implemented\n";      else cout << "ETA"<<neta<<" not implemented\n";
417      return 0;      return 0;
418            
419  };  };
420    
421    /**
422     * Evaluates the cluster position, in pitch units, relative to the strip with
423     * the maximum signal (TrkCluster::maxs), by applying the PFA set as default (see TrkParams).
424     *  @param angle Projected (effective) angle between particle track and detector plane.
425     */
426    Float_t TrkCluster::GetPositionPU(float angle){
427    
428        if( TrkParams::GetPFA() == 0  )return GetETA(0,angle,false);
429        if( TrkParams::GetPFA() == 1  )return 0.;
430        if( TrkParams::GetPFA() == 2  )return GetETA(2,angle,false);
431        if( TrkParams::GetPFA() == 3  )return GetETA(3,angle,false);
432        if( TrkParams::GetPFA() == 4  )return GetETA(4,angle,false);
433        if( TrkParams::GetPFA() == 5  )return GetETA(0,angle,true);
434        if( TrkParams::GetPFA() == 6  )return 0.;
435        if( TrkParams::GetPFA() == 7  )return 0.;
436        if( TrkParams::GetPFA() == 8  )return 0.;
437        if( TrkParams::GetPFA() == 9  )return 0.;
438        if( TrkParams::GetPFA() == 10 )return GetCOG(0);
439        if( TrkParams::GetPFA() == 11 )return GetCOG(1);
440        if( TrkParams::GetPFA() == 12 )return GetCOG(2);
441        if( TrkParams::GetPFA() == 13 )return GetCOG(3);
442        if( TrkParams::GetPFA() == 14 )return GetCOG(4);
443        
444        return 0.;
445        
446    }
447    
448  //--------------------------------------  //--------------------------------------
449  //  //
450  //  //
# Line 431  TrkLevel1::TrkLevel1(){ Line 461  TrkLevel1::TrkLevel1(){
461              cnn[j][i]=0;              cnn[j][i]=0;
462          };          };
463      };      };
464        TrkParams::SetTrackingMode();
465        TrkParams::SetPrecisionFactor();
466        TrkParams::SetStepMin();
467        TrkParams::SetPFA();
468  }  }
469  //--------------------------------------  //--------------------------------------
470  //  //
# Line 463  void TrkLevel1::Dump(){ Line 497  void TrkLevel1::Dump(){
497      for(int i=0; i<this->nclstr(); i++)     ((TrkCluster *)t[i])->Dump();      for(int i=0; i<this->nclstr(); i++)     ((TrkCluster *)t[i])->Dump();
498            
499  }  }
500    /**
501     * \brief Dump processing status
502     */
503    void TrkLevel1::StatusDump(int view){
504        cout << "DSP n. "<<view+1<<" (level1-)status: "<<hex<<showbase<<good[view]<<dec<<endl;    
505    };
506    /**
507     * \brief Check event status
508     *
509     * Check the event status, according to a flag-mask given as input.
510     * Return true if the view passes the check.
511     *
512     * @param view View number (0-11)
513     * @param flagmask Mask of flags to check (eg. flagmask=0x111 no missing packet,
514     *  no crc error, no software alarm)
515     *
516     * @see TrkLevel2 class definition to know how the status flag is defined
517     *
518     */
519    Bool_t TrkLevel1::StatusCheck(int view, int flagmask){
520    
521        if( view<0 || view >= 12)return false;
522        return !(good[view]&flagmask);
523    
524    };
525    
526    
527  //--------------------------------------  //--------------------------------------
528  //  //
529  //  //
# Line 500  void TrkLevel1::SetFromLevel1Struct(cTrk Line 561  void TrkLevel1::SetFromLevel1Struct(cTrk
561              t_cl->clsigma  = new Float_t[t_cl->CLlength];              t_cl->clsigma  = new Float_t[t_cl->CLlength];
562              t_cl->cladc    = new Int_t[t_cl->CLlength];              t_cl->cladc    = new Int_t[t_cl->CLlength];
563              t_cl->clbad    = new Bool_t[t_cl->CLlength];              t_cl->clbad    = new Bool_t[t_cl->CLlength];
564    
565              Int_t index = 0;              Int_t index = 0;
566              for(Int_t is = from; is < to; is++ ){              for(Int_t is = from; is < to; is++ ){
567                  t_cl->clsignal[index] = (Float_t) l1->clsignal[is];                  t_cl->clsignal[index] = (Float_t) l1->clsignal[is];
# Line 873  float* TrkLevel1::GetPfaAbs(TString pfa, Line 935  float* TrkLevel1::GetPfaAbs(TString pfa,
935   * Method to call the F77 routine that performs level1->level2 processing.   * Method to call the F77 routine that performs level1->level2 processing.
936   * 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
937   * 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  
938   * NB If the TrkLevel1 object is readout from a tree, and the   * NB If the TrkLevel1 object is readout from a tree, and the
939   * TrkLevel1::ProcessEvent(int pfa) is used to reprocess the event, attention   * TrkLevel1::ProcessEvent(int pfa) is used to reprocess the event, attention
940   * should be payed to the fact that single clusters (clusters not associated   * should be payed to the fact that single clusters (clusters not associated
941   * 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
942   * level0 data.   * from level0 data.
943   */   */
944  int TrkLevel1::ProcessEvent(int pfa){  //int TrkLevel1::ProcessEvent(int pfa){
945    int TrkLevel1::ProcessEvent(){
946    
947  //    cout << "int TrkLevel1::ProcessEvent()" << endl;  //    cout << "int TrkLevel1::ProcessEvent()" << endl;
948      TrkParams::Load( );      TrkParams::Load( );
# Line 899  int TrkLevel1::ProcessEvent(int pfa){ Line 950  int TrkLevel1::ProcessEvent(int pfa){
950    
951      GetLevel1Struct();      GetLevel1Struct();
952    
953      analysisflight_(&pfa);  //    analysisflight_(&pfa);
954    //    TrkParams::SetPFA(pfa);
955        analysisflight_();
956    
957      return 1;      return 1;
958    

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

  ViewVC Help
Powered by ViewVC 1.1.23