Changeset 392 for trunk


Ignore:
Timestamp:
05/11/00 15:35:54 (24 years ago)
Author:
blanch
Message:
Functions to Set threshold_channel, trigger_multi and trigger_geometry, which are private members, are implemented.
The threshold_file option in MTrigger.card gives a file where program reads threshold value for each pixel.
Some Clear() functins have been implemented to clear trigger level by level.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Detector/include-MTrigger/MTrigger.cxx

    r375 r392  
    2828  FILE *unit_mtrig ;
    2929  Int_t endflag = 1  ;
     30  Int_t bthresholdpixel = FALSE;
    3031  char   datac[256] ;
    3132  char   dummy[50] ;
    32  
     33  char   input_thres[50];
     34  Int_t  i, ii ;
     35
    3336  Float_t threshold ;
    3437 
     
    9396        sscanf (datac, "%s %i", dummy, &trigger_geometry ) ;
    9497      }
     98      else if ( strncmp (datac, "threshold_file", 14 ) == 0 ) {
     99        sscanf (datac, "%s %s", dummy, input_thres ) ;
     100        bthresholdpixel=TRUE;
     101      }
    95102
    96103      if ( feof(unit_mtrig) != 0 ) {
     
    108115  cout << endl
    109116       << "[MTrigger]  Setting up the MTrigger with this values "<< endl ;
    110   cout << endl
    111        << "[MTrigger]    ChannelThreshold:   " << threshold << " mV"
    112        << endl ;
    113 
     117  if(bthresholdpixel){
     118    cout<<endl
     119        << "[MTrigger]    ChannelThreshold from file:   "<<input_thres
     120        <<endl;
     121  }
     122  else{
     123    cout << endl
     124         << "[MTrigger]    ChannelThreshold:   " << threshold << " mV"
     125         << endl ;
     126  }
    114127  cout << "[MTrigger]    Gate Length:        " << gate_leng  << " ns"
    115128       << endl ;
     
    129142  //   we have introduced individual thresholds for all pixels
    130143  //
    131   for (Int_t k=0; k<TRIGGER_PIXELS; k++ ) {
    132     chan_thres[k] = threshold ;
    133   }
     144  FILE *unit_thres;
     145
     146  if (bthresholdpixel == TRUE) {
     147    if ((unit_thres=fopen(input_thres, "r"))==0){
     148      cout<<"WARNING: not able to read ..."<<input_thres<<endl;
     149      cout<<"Threshold will be set to "<<threshold<<" for all pixels"<<endl;
     150      for (Int_t k=0; k<TRIGGER_PIXELS; k++ ) {
     151        chan_thres[k] = threshold ;
     152      }
     153    }
     154    else {
     155      for (i=0;i<TRIGGER_PIXELS;i++){
     156        fscanf(unit_thres, "%f",&chan_thres[i]);
     157      }
     158      fclose (unit_thres);
     159    }
     160  }
     161  else {
     162    for (Int_t k=0; k<TRIGGER_PIXELS; k++ ) {
     163      chan_thres[k] = threshold ;
     164    }
     165  }
     166
    134167
    135168  //
    136169  //    set up the response shape
    137170  //
    138   Int_t  i, ii ;
    139171     
    140172  Float_t   sigma ;
     
    151183    sing_resp[i] =
    152184      ampl_resp * expf(-0.5 * (x-x0)*(x-x0) / (sigma*sigma) ) ;
    153 
    154     //      cout << i << "  "
    155     //           << x << "  "
    156     //           << sing_resp[i]
    157     //           << endl ;
    158 
    159185 
    160186  }
     
    267293 
    268294  for ( i = 0 ; i < 5 ; i++) {
    269     SlicesFirst[i]  = 0 ;
    270     SlicesSecond[i] = 0 ;
     295    SlicesFirst[i]  = -50.0 ;
     296    SlicesSecond[i] = -50.0 ;
     297    PixelsFirst[i]  = -1;
     298    PixelsSecond[i] = -1;
    271299  }
    272300  cout << " end of MTrigger::MTrigger()" << endl ;
     
    305333  for ( ii=0 ; ii<TRIGGER_TIME_SLICES; ii++ ) {
    306334    sum_d_sig[ii] = 0. ; 
    307   }
    308 
    309   //
    310   //   set the information about the Different Level Triggers to zero
    311   //
    312 
    313   nZero = nFirst = nSecond = 0 ;
     335  }   
     336}
     337
     338void MTrigger::ClearZero() {
     339  //
     340  //   set the information about the Zero Level Trigger to zero
     341  //
     342
     343  Int_t i;
     344
     345  nZero = 0 ;
     346
     347  for (i=0 ; i<TRIGGER_TIME_SLICES; i++ ) {
     348    SlicesZero[i] = FALSE;
     349  }
     350 
     351}
     352
     353void MTrigger::ClearFirst() {
     354  //
     355  //   set the information about the First Level Trigger to zero
     356  //
     357
     358  Int_t i;
     359
     360  nFirst =  0 ;
    314361 
    315362  for ( i = 0 ; i < 5 ; i++) {
    316     SlicesZero[i]   = 0 ;
    317     SlicesFirst[i]  = 0 ;
    318     SlicesSecond[i] = 0 ;
    319   }
    320    
     363    SlicesFirst[i]  = -50.0 ;
     364    PixelsFirst[i]  = -1;
     365  }
    321366}
    322367
     
    496541  for ( Int_t i=0 ; i < TRIGGER_PIXELS; i++  ) {
    497542    if ( used [i] == TRUE ) {
    498       //cout << "Pixel " << i << " used"  ;
    499543       
    500544      for ( Int_t ii=1 ; ii<TRIGGER_TIME_SLICES; ii++ ) {
     
    505549    }
    506550  }
     551}
     552
     553void MTrigger::SetMultiplicity(Int_t multi){
     554  //=============================================================
     555  //
     556  //    It sets the private member trigger_multi
     557
     558  trigger_multi=multi;
     559}
     560
     561void MTrigger::SetTopology(Int_t topo){
     562  //=============================================================
     563  //
     564  //    It sets the private member trigger_geometry
     565
     566  trigger_geometry=topo;
     567}
     568
     569void MTrigger::SetThreshold(Float_t thres[]){
     570  //=============================================================
     571  //
     572  //    It sets the private member chan_thres[TRIGGER_PIXELS]
     573
     574  Int_t i;
     575
     576  for(i=0;i<TRIGGER_PIXELS;i++){
     577    chan_thres[i]=thres[i];
     578  }
     579}
     580
     581void MTrigger::ReadThreshold(char name[]){
     582  //=============================================================
     583  //
     584  //   It reads values for threshold of each pixel from file name
     585
     586  FILE *unit;
     587  Int_t i=0;
     588
     589  if ((unit=fopen(name, "r"))==0){
     590    cout<<"WARNING: not able to read ..."<<name<<endl;
     591  }
     592  else {
     593    while (i<TRIGGER_PIXELS){
     594      fscanf(unit, "%f",&chan_thres[i++]);
     595    }
     596    fclose (unit);
     597  }
     598       
    507599}
    508600
     
    538630
    539631      baseline[i] = baseline[i] / ( (Float_t ) TRIGGER_TIME_SLICES)  ;
    540 
    541       //   cout << "Pixel " << i << " baseline " << baseline[i] <<endl ;
    542632
    543633      //
     
    763853
    764854  Int_t iReturn = 0 ;  // Return value for this function
    765  
    766   if ( nZero > 1 ) {
    767     cout << " INFORMATION:  more than one Zero Level TRIGGER " << endl ;
    768   }
    769  
     855   
    770856  //   Definition of needed variables 
    771857  Bool_t Muster[TRIGGER_PIXELS] ;
     
    777863
    778864  if (trigger_geometry==0 &&  trigger_multi>7) {
    779     cout <<"You are lookiny for a topology that needs more than six neighbours of the same pixel"<<endl;
     865    cout <<"You are looking for a topology that needs more than six neighbours of the same pixel"<<endl;
    780866    cout <<" Topology   "<<trigger_geometry<<"   Multiplicity   "<<trigger_multi<<endl;;
    781867    return (kFALSE);
     
    822908            //
    823909            if ( d_sig [iPix][iSli] > 0. ) {
    824              
    825910              Muster[iPix] = kTRUE ;
    826911            }
     
    871956                //   A NN-Trigger is detected at time Slice
    872957                //
     958                PixelsFirst[nFirst] = j;  //  We save pixel that triggers
    873959                SlicesFirst[nFirst++] = iSli ; // We save time when it triggers
    874960                iReturn++ ;
     
    899985                //   A NN-Trigger is detected at time Slice
    900986                //
     987                PixelsFirst[nFirst] = j;  //  We save pixel that triggers
    901988                SlicesFirst[nFirst++] = iSli ; //  We save when it triggers
    902989                iReturn++ ;
     
    9761063                }
    9771064                if (closed_pack){
     1065                  PixelsFirst[nFirst] = j;  //  We save pixel that triggers
    9781066                  SlicesFirst[nFirst++] = iSli ; //  We save time when it triggers
    9791067                  iReturn++ ;
     
    10631151  return(return_val);
    10641152}
     1153
     1154Float_t MTrigger::GetFirstLevelTime( Int_t il ){
     1155
     1156  //=============================================================
     1157  //
     1158  //  It gives the time for the il trigger at first level
     1159
     1160  return((Float_t) ((Float_t) SlicesFirst[il]/((Float_t) SLICES_PER_NSEC)));
     1161}
     1162
     1163Int_t MTrigger::GetFirstLevelPixel( Int_t il ){
     1164
     1165  //=============================================================
     1166  //
     1167  //  It gives the pixel that triggers for the il trigger at first level
     1168  return(PixelsFirst[il]);
     1169}
Note: See TracChangeset for help on using the changeset viewer.