/[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.13 by pam-fi, Mon Feb 5 16:01:51 2007 UTC revision 1.17 by pam-fi, Mon May 14 11:03:05 2007 UTC
# Line 313  void TrkCluster::Dump(){ Line 313  void TrkCluster::Dump(){
313  /**  /**
314   * Method to fill a level1 struct with only one cluster (done to use F77 p.f.a. routines on a cluster basis).   * Method to fill a level1 struct with only one cluster (done to use F77 p.f.a. routines on a cluster basis).
315   */   */
316  cTrkLevel1* TrkCluster::GetLevel1Struct(){  void TrkCluster::GetLevel1Struct(cTrkLevel1* l1){
317                                    
318  //    cTrkLevel1* l1 = new cTrkLevel1;  //    cTrkLevel1* l1 = new cTrkLevel1;
319    
320      cTrkLevel1* l1 = &level1event_ ;  //    cTrkLevel1* l1 = &level1event_ ;
321                    
322      l1->nclstr1 = 1;      l1->nclstr1 = 1;
323      l1->view[0] = view;      l1->view[0] = view;
# Line 335  cTrkLevel1* TrkCluster::GetLevel1Struct( Line 335  cTrkLevel1* TrkCluster::GetLevel1Struct(
335          l1->clbad[i] = clbad[i];          l1->clbad[i] = clbad[i];
336      };      };
337            
338      return l1;  //    return l1;
339  };  };
340  //--------------------------------------  //--------------------------------------
341  //  //
# Line 397  Float_t TrkCluster::GetETA(Int_t neta, f Line 397  Float_t TrkCluster::GetETA(Int_t neta, f
397  //    cout << "GetETA(neta,angle) "<< neta << " "<< angle;  //    cout << "GetETA(neta,angle) "<< neta << " "<< angle;
398  //      LoadPfaParam();  //      LoadPfaParam();
399    
400        TrkParams::Load(4);
401        if( !TrkParams::IsLoaded(4) ){
402            cout << "int Trajectory::DoTrack2(float* al) --- ERROR --- p.f.a. parameters  not loaded"<<endl;
403            return 0;
404        }
405    
406      float ax = angle;      float ax = angle;
407      int ic = 1;      int ic = 1;
408      GetLevel1Struct();      GetLevel1Struct();
# Line 425  TrkLevel1::TrkLevel1(){ Line 431  TrkLevel1::TrkLevel1(){
431              cnn[j][i]=0;              cnn[j][i]=0;
432          };          };
433      };      };
434        TrkParams::SetTrackingMode();
435        TrkParams::SetPrecisionFactor();
436        TrkParams::SetStepMin();
437        TrkParams::SetPFA();
438  }  }
439  //--------------------------------------  //--------------------------------------
440  //  //
# Line 466  void TrkLevel1::Dump(){ Line 476  void TrkLevel1::Dump(){
476   */   */
477  void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1, Bool_t full){  void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1, Bool_t full){
478    
479    //    cout << "void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1, Bool_t full)"<<endl;
480        
481        Clear();
482      //  ---------------      //  ---------------
483      //  *** CLUSTER ***      //  *** CLUSTER ***
484      //  ---------------      //  ---------------
# Line 522  void TrkLevel1::SetFromLevel1Struct(cTrk Line 535  void TrkLevel1::SetFromLevel1Struct(cTrk
535   * Fills a struct cTrkLevel1 with values from a TrkLevel1 object (to put data into a F77 common).   * Fills a struct cTrkLevel1 with values from a TrkLevel1 object (to put data into a F77 common).
536   */   */
537    
538  cTrkLevel1* TrkLevel1::GetLevel1Struct() {  void TrkLevel1::GetLevel1Struct(cTrkLevel1* l1) {
539            
540      cTrkLevel1 *l1=0;  //    cTrkLevel1* l1 = &level1event_ ;
541      //      
542      for(Int_t i=0; i<12 ; i++){      for(Int_t i=0; i<12 ; i++){
543          l1->good[i] = good[i];          l1->good[i] = good[i];
544          for(Int_t j=0; j<24 ; j++){          for(Int_t j=0; j<24 ; j++){
545              l1->cnev[j][i]    = cn[j][i];              l1->cnev[j][i]    = cn[j][i]  ;
546  //          l1->cnrmsev[j][i] = cnrms[j][i];              l1->cnnev[j][i]   = cnn[j][i] ;
547              l1->cnnev[j][i]   = cnn[j][i];              l1->cnrmsev[j][i] = 0. ;
548          };          };
549            l1->fshower[i] = 0;
550      };      };
551        
552  //  *** CLUSTERS ***      l1->nclstr1=0;
553        l1->totCLlength=0;
554        Int_t index=0;
555      if(Cluster){      if(Cluster){
556          l1->nclstr1 =  Cluster->GetEntries();          Int_t i=0;
557          for(Int_t i=0;i<l1->nclstr1;i++){          for(Int_t ii=0;ii<Cluster->GetEntries();ii++){
558                        TrkCluster *clu = GetCluster(ii);
559              l1->view[i]     = ((TrkCluster *)Cluster->At(i))->view;              // ----------------------------------------
560              l1->maxs[i]     = ((TrkCluster *)Cluster->At(i))->maxs;              // attenzione!!
561              // COMPLETARE //              // se il cluster non e` salvato (view = 0)
562              // COMPLETARE //              // DEVE essere escluso dal common F77
563              // COMPLETARE //              // ----------------------------------------
564              // COMPLETARE //              if(clu->view != 0 ){
565              // COMPLETARE //                  l1->view[i]     = clu->view;
566              // COMPLETARE //                  l1->ladder[i]   = clu->GetLadder();
567                            l1->maxs[i]     = clu->maxs;
568                    l1->mult[i]     = clu->GetMultiplicity();
569                    l1->dedx[i]     = clu->GetSignal();
570                    l1->indstart[i] = index+1;
571                    l1->indmax[i]   = l1->indstart[i] + clu->indmax;
572                    l1->totCLlength += clu->CLlength;
573                    for(Int_t iw=0; iw < clu->CLlength; iw++){
574                        l1->clsignal[index] = clu->clsignal[iw];
575                        l1->clsigma[index]  = clu->clsigma[iw];
576                        l1->cladc[index]    = clu->cladc[iw];
577                        l1->clbad[index]    = clu->clbad[iw];
578                        index++;
579                    }
580                    i++;
581                }
582          }          }
583          // COMPLETARE //          l1->nclstr1 =  i;      
         // COMPLETARE //  
         // COMPLETARE //  
         // COMPLETARE //  
         // COMPLETARE //  
         // COMPLETARE //  
584      }      }
585      return l1;  
586    //    return l1;
587  }  }
588  //--------------------------------------  //--------------------------------------
589  //  //
# Line 608  TrkCluster *TrkLevel1::GetCluster(int is Line 634  TrkCluster *TrkLevel1::GetCluster(int is
634  //  //
635  //  //
636  //--------------------------------------  //--------------------------------------
637  /**  // /**
638   * Load Position-Finding-Algorythm parameters (call the F77 routine).  //  * Load Position-Finding-Algorythm parameters (call the F77 routine).
639   *  //  *
640   */  //  */
641  int TrkLevel1::LoadPfaParam(TString path){  // int TrkLevel1::LoadPfaParam(TString path){
642                    
643      if( strcmp(path_.path,path.Data()) ){  //     if( path.IsNull() ){
644          cout <<"Loading p.f.a. param::eters\n";  //      path = gSystem->Getenv("PAM_CALIB");
645          strcpy(path_.path,path.Data());  //      if(path.IsNull()){
646          path_.pathlen = path.Length();  //          cout << " TrkLevel1::LoadPfaParam() ==> No PAMELA environment variables defined "<<endl;
647          path_.error   = 0;  //          return 0;
648          return readetaparam_();  //      }
649      }    //      path.Append("/trk-param/eta_param-0/");
650      return 0;  //     }
651  }  
652    //     strcpy(path_.path,path.Data());
653    //     path_.pathlen = path.Length();
654    //     path_.error   = 0;
655    //     cout <<"Loading p.f.a. parameters: "<<path<<endl;
656    //     return readetaparam_();
657    // }
658    
659    // /**
660    //  * Load magnetic field parameters (call the F77 routine).
661    //  *
662    //  */
663    // int TrkLevel1::LoadFieldParam(TString path){
664            
665    // //    if( strcmp(path_.path,path.Data()) ){
666    //     if( path.IsNull() ){
667    //      path = gSystem->Getenv("PAM_CALIB");
668    //      if(path.IsNull()){
669    //          cout << " TrkLevel1::LoadFieldParam() ==> No PAMELA environment variables defined "<<endl;
670    //          return 0;
671    //      }
672    //      path.Append("/trk-param/field_param-0/");
673    //     }
674    //     cout <<"Loading magnetic field "<<path<<endl;
675    //     strcpy(path_.path,path.Data());
676    //     path_.pathlen = path.Length();
677    //     path_.error   = 0;
678    //     return readb_();
679    // //    }      
680    // //    return 0;
681    // }
682    // /**
683    //  * Load magnetic field parameters (call the F77 routine).
684    //  *
685    //  */
686    // int TrkLevel1::LoadChargeParam(TString path){
687            
688    // //    if( strcmp(path_.path,path.Data()) ){
689    //     if( path.IsNull() ){
690    //      path = gSystem->Getenv("PAM_CALIB");
691    //      if(path.IsNull()){
692    //          cout << " TrkLevel1::LoadChargeParam() ==> No PAMELA environment variables defined "<<endl;
693    //          return 0;
694    //      }
695    //      path.Append("/trk-param/charge_param-1/");
696    //     }
697    //     cout <<"Loading charge-correlation parameters: "<<path<<endl;
698    //     strcpy(path_.path,path.Data());
699    //     path_.pathlen = path.Length();
700    //     path_.error   = 0;
701    //     return readchargeparam_();
702    // //    }      
703    // //    return 0;
704    // }
705    // /**
706    //  * Load magnetic field parameters (call the F77 routine).
707    //  *
708    //  */
709    // int TrkLevel1::LoadAlignmentParam(TString path){
710            
711    // //    if( strcmp(path_.path,path.Data()) ){
712    //     if( path.IsNull() ){
713    //      path = gSystem->Getenv("PAM_CALIB");
714    //      if(path.IsNull()){
715    //          cout << " TrkLevel1::LoadAlignmentParam() ==> No PAMELA environment variables defined "<<endl;
716    //          return 0;
717    //      }
718    //      path.Append("/trk-param/align_param-0/");
719    //     }
720    //     cout <<"Loading alignment parameters: "<<path<<endl;
721    //     strcpy(path_.path,path.Data());
722    //     path_.pathlen = path.Length();
723    //     path_.error   = 0;
724    //     return readalignparam_();
725    // //    }      
726    // //    return 0;
727    // }
728    // /**
729    //  * Load magnetic field parameters (call the F77 routine).
730    //  *
731    //  */
732    // int TrkLevel1::LoadMipParam(TString path){
733            
734    // //    if( strcmp(path_.path,path.Data()) ){
735    //     if( path.IsNull() ){
736    //      path = gSystem->Getenv("PAM_CALIB");
737    //      if(path.IsNull()){
738    //          cout << " TrkLevel1::LoadMipParam() ==> No PAMELA environment variables defined "<<endl;
739    //          return 0;
740    //      }
741    //      path.Append("/trk-param/mip_param-0/");
742    //     }
743    //     cout <<"Loading ADC-to-MIP conversion parameters: "<<path<<endl;
744    //     strcpy(path_.path,path.Data());
745    //     path_.pathlen = path.Length();
746    //     path_.error   = 0;
747    //     return readmipparam_();
748    // //    }      
749    // //    return 0;
750    // }
751    // /**
752    //  * Load magnetic field parameters (call the F77 routine).
753    //  *
754    //  */
755    // int TrkLevel1::LoadVKMaskParam(TString path){
756            
757    // //    if( strcmp(path_.path,path.Data()) ){
758    //     if( path.IsNull() ){
759    //      path = gSystem->Getenv("PAM_CALIB");
760    //      if(path.IsNull()){
761    //          cout << " TrkLevel1::LoadVKMaskParam() ==> No PAMELA environment variables defined "<<endl;
762    //          return 0;
763    //      }
764    //      path.Append("/trk-param/mask_param-1/");
765    //     }
766    //     cout <<"Loading VK-mask parameters: "<<path<<endl;
767    //     strcpy(path_.path,path.Data());
768    //     path_.pathlen = path.Length();
769    //     path_.error   = 0;
770    //     return readvkmask_();
771    // //    }      
772    // //    return 0;
773    // }
774    
775    // /**
776    //  * Load all (default) parameters. Environment variable must be defined.
777    //  *
778    //  */
779    // int TrkLevel1::LoadParams(){
780    
781    //     int result=0;
782        
783    //     result = result * LoadFieldParam();
784    //     result = result * LoadPfaParam();
785    //     result = result * LoadChargeParam();
786    //     result = result * LoadAlignmentParam();
787    //     result = result * LoadMipParam();
788    //     result = result * LoadVKMaskParam();
789    
790    //     return result;
791    // }
792    
793    
794    
795    int TrkLevel1::GetPfaNbinsAngle(){
796        TrkParams::Load(4);
797        if( !TrkParams::IsLoaded(4) ){
798            cout << "int TrkLevel1::GetPfaNbinsAngle() --- ERROR --- p.f.a. parameters  not loaded"<<endl;
799            return 0;
800        }
801        return pfa_.nangbin;
802    };
803    
804    int TrkLevel1::GetPfaNbinsETA(){
805        TrkParams::Load(4);
806        if( !TrkParams::IsLoaded(4) ){
807            cout << "int TrkLevel1::GetPfaNbinsETA() --- ERROR --- p.f.a. parameters  not loaded"<<endl;
808            return 0;
809        }
810        return pfa_.netaval;
811    };
812    
813  /**  /**
814   *   *
815   *   *
816   */   */
817  float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang){  float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang){
818    
819        TrkParams::Load(4);
820        if( !TrkParams::IsLoaded(4) ){
821            cout << "float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang) --- ERROR --- p.f.a. parameters  not loaded"<<endl;
822            return 0;
823        }
824        
825      int nbins = GetPfaNbinsETA();      int nbins = GetPfaNbinsETA();
826      if(!nbins)return 0;      if(!nbins)return 0;
# Line 655  float* TrkLevel1::GetPfaCoord(TString pf Line 847  float* TrkLevel1::GetPfaCoord(TString pf
847    
848  float* TrkLevel1::GetPfaAbs(TString pfa, int nang){  float* TrkLevel1::GetPfaAbs(TString pfa, int nang){
849        
850        TrkParams::Load(4);
851        if( !TrkParams::IsLoaded(4) ){
852            cout << "float* TrkLevel1::GetPfaAbs(TString pfa, int nang) --- ERROR --- p.f.a. parameters  not loaded"<<endl;
853            return 0;
854        }
855    
856      int nbins = GetPfaNbinsETA();      int nbins = GetPfaNbinsETA();
857      if(!nbins)return 0;      if(!nbins)return 0;
858    
# Line 673  float* TrkLevel1::GetPfaAbs(TString pfa, Line 871  float* TrkLevel1::GetPfaAbs(TString pfa,
871    
872      return fcorr;      return fcorr;
873    
   
874  };  };
875    
876    /**
877     * Method to call the F77 routine that performs level1->level2 processing.
878     * The level2 output is stored in a common block, which can be retrieved
879     * by mean of the method TrkLevel2::SetFromLevel2Struct().
880     * NB If the TrkLevel1 object is readout from a tree, and the
881     * TrkLevel1::ProcessEvent(int pfa) is used to reprocess the event, attention
882     * should be payed to the fact that single clusters (clusters not associated
883     * with any track) might not be stored. Full reprocessing should be done from
884     * level0 data.
885     */
886    int TrkLevel1::ProcessEvent(int pfa){
887    
888    //    cout << "int TrkLevel1::ProcessEvent()" << endl;
889        TrkParams::Load( );
890        if( !TrkParams::IsLoaded() )return 0;
891    
892        GetLevel1Struct();
893    
894    //    analysisflight_(&pfa);
895        TrkParams::SetPFA(pfa);
896        analysisflight_();
897    
898        return 1;
899    
900    }
901    
902    
903  ClassImp(TrkLevel1);  ClassImp(TrkLevel1);

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.23