Ejemplo n.º 1
0
/*------------------------------ init_hist_19 ---------------------------------*/
int init_hist_19()
{
  int i, iboard, tmp_hist_offset;
  int hid, ilayer, ichip,istrip;
  char htitle[80];

  /* Book histograms for CSC wires */
  for (i=0; i<NMAXSCAN; i++)
    {
      tmp_hist_offset = STRIP_HIST_OFFSET + (i+1) * 10000;
      for (ilayer = 1; ilayer <= NLAYER; ilayer++)
		{
          hid = tmp_hist_offset + ilayer ;
          sprintf( htitle, "CLCT Strip occupancy, Layer %d Scan %d", ilayer, i+1);
          HBOOK1( hid, htitle, 80, 0.5, 80.5, 0.0);
		}

      /* Book cathode front-end board (CFEB) histograms */

      for (ilayer = 1; ilayer <= NLAYER; ilayer++)

		{
          for (iboard = 1; iboard <= NCFEB; iboard++)
			{
              ichip = NCFEB * (ilayer-1) + iboard;
              hid = tmp_hist_offset + 100 + ichip;
              sprintf( htitle, "CLCT  times  Layer %d Board %d", ilayer, iboard);
              HBOOK1( hid, htitle, 32, -0.5, 31.5, 0.0);

              hid = tmp_hist_offset + 200 + ichip;
              sprintf( htitle, "Strip cal.pulse: Layer %d Board %d", ilayer, iboard);
              HBOOK1( hid, htitle, 256, -0.5, 255.5, 0.0);
			}
		}

      for (ilayer = 0; ilayer < NLAYER; ilayer++)
		{
          for (istrip = 0; istrip < NSTRIP; istrip++)
			{
              hid = tmp_hist_offset +1000+ 100*(ilayer+1) +  istrip+1;
              sprintf( htitle, "CLCT time. Layer %d Strip %d", ilayer+1, istrip+1);
              HBOOK1( hid, htitle, 32, 0.5, 32.5, 0.0);

              hid = tmp_hist_offset + 2000 + 100 * (ilayer+1) + istrip + 1;
              sprintf( htitle, "Strip cal.stat.: Layer %d Strip %d ",
                       ilayer+1, istrip+1 );
              HBOOK1( hid, htitle, 128, 0.5, 128.5, 0.0);
			}
		}
    }
  return 0;
}
Ejemplo n.º 2
0
//----
// function to display PMT pulse (flash-ADC array arr[]) :
//
void ANTI2DBc::displ_a(char comm[], int id, int mf, const geant arr[]){
  integer i;
  geant tm,a(0.);
  geant tb,tbi;
  char name[80], buf[10];
  sprintf(buf, "%4d\n",id);
  strcpy(name,comm);
  strcat(name,buf);
  tb=geant(mf)*ANTI2DBc::fadcbw();
  tbi=ANTI2DBc::fadcbw();
  HBOOK1(2638,name,100,0.,100*tb,0.);
  for(i=1;i<=ANTI2C::ANFADC;i++){
    if(i%mf==0){
      a+=arr[i-1];
      tm=i*tbi-0.5*tb;
      HF1(2638,tm,a/geant(mf));
      a=0.;
    }
    else{
      a+=arr[i-1];
    }
  }
  HPRINT(2638);
  HDELET(2638);
  return ;
}
Ejemplo n.º 3
0
INT adc_summing_init(void)
{
   char name[80];

   /* book sum histo */
   strcpy(name, "ADC sum");
   HBOOK1(ADCSUM_ID_BASE, name, 500, 0.f, 10000.f, 0.f);

   return SUCCESS;
}
Ejemplo n.º 4
0
Archivo: adcsum.c Proyecto: UCNA/main
INT adc_summing_init(void)
{
#ifdef MANA_LITE
  printf("manalite: adc_summing_init: HBOOK disable\n");
#else
  /* book sum histo */
  HBOOK1(ADCSUM_ID_BASE, "ADC sum", 500, 0.f, 10000.f, 0.f); 
#endif
  return SUCCESS;
}
Ejemplo n.º 5
0
bool TraceGrabber::operator()(PixieFunctionParms<> &par)
{
  char traceName[] = "test trace";
  static unsigned int modRead = par.pif.GetNumberCards();

  const size_t size = PixieInterface::GetTraceLength();
  unsigned short trace[size];
   
  if (modRead != par.mod) {
    par.pif.AcquireTraces(par.mod);
    modRead = par.mod;
  }
  
  unsigned int nhis = 100 * (par.mod + 1) + par.ch;

  usleep(10);
  if (par.pif.ReadSglChanTrace(trace, size, par.mod, par.ch)) {
    HBOOK1(nhis,traceName,size,0,size,0);

    unsigned long sum = 0;
    unsigned long sumsq = 0;    
    
    for (size_t i=0; i < size; i++) {
      sum += trace[i];
      sumsq += trace[i] * trace[i];

      HF1(nhis, i, trace[i]);
    }
    printf("Trace ---- MOD/CHAN %2u / %2u AVER |-  %6.1f -| SIG %4.1f \n",
	   par.mod, par.ch, 
	   (float)sum / size,
	   (float)sqrt(size * sumsq - sum * sum) / size);

    return true;
  } else return false;
}
Ejemplo n.º 6
0
int test_24_begin(int pass)
  {
  int     hid, icfeb, ilayer, isegment;
  char    htitle[80];
  char *filename;

  for (ilayer = 0; ilayer < NLAYER; ilayer++) n_out_of_time[ilayer] = 0;
  first = _TRUE;

  if (pass == 0)
    {
    filename = malloc(strlen(datadir_translation) + 
		      strlen(test_24_file_el) + 1 );
    if (filename == NULL)
      {
      printf("malloc() failed on filename.\n");
      return 1;
      }
    sprintf(filename,"%s%s",datadir_translation,test_24_file_el);

/* Open result file in the temporary directory */
    fp = fopen(filename, "w");
    if(fp == NULL)
      {
      printf("File %s could not be opened.\n",filename);
      free(filename);
      return 1;
      }
    free(filename);

    fprintf(fp, "-------------------------------------------------------\n"); 
    fprintf(fp, "Results of test 24 (Chamber Gain Map) for %s\n", csc_name); 
    fprintf(fp, "-------------------------------------------------------\n\n"); 

/* Book histograms */
    printf("Booking pass 0 histograms for test 24\n");

    hid = 20;
    sprintf(htitle, "Peak time bin of strip with max 5-bin sum");
    HBOOK1(hid, htitle, 16, -0.5, 15.5, 0.0);

    hid = 21;
    sprintf(htitle, "Peak time bin of strip with max 5-bin sum > 100");
    HBOOK1(hid, htitle, 16, -0.5, 15.5, 0.0);

    hid = 22;
    sprintf(htitle, "Slope in stripwidths/layer_spacing");
    HBOOK1(hid, htitle, 100, -5., 5., 0.0);

    hid = 23;
    sprintf(htitle, "Track x in stripwidths");
    HBOOK1(hid, htitle, 100, -10., 90., 0.0);

    hid = 24;
    sprintf(htitle, "Peak of fitted Landau distr, ADC counts (5x5 sum)");
    HBOOK1(hid, htitle, 100, 0., 2000., 0.0);

    hid = 25;
    sprintf(htitle, "Chisq of fitted Landau distr");
    HBOOK1(hid, htitle, 100, 0., 10., 0.0);

    for (ilayer = 1; ilayer <= NLAYER; ilayer++)
      {
      hid = ilayer;
      sprintf(htitle, "L%d max 5-bin adc sum", ilayer);
      HBOOK1(hid, htitle, 100, 0., 4000, 0.0);

      hid = 10 + ilayer;
      sprintf(htitle, "L%d strip with max 5-bin sum", ilayer);
      HBOOK1(hid, htitle, 80, 0.5, 80.5, 0.0);

      for (isegment = 1; isegment <= nsegments; isegment++)
	{
        for (icfeb = 1; icfeb <= ncfebs; icfeb++)
	  {
          hid = 100 * ilayer + 10 * isegment + icfeb;
          sprintf(htitle, "L%d seg %d cfeb %d, Landau plot, 5x5 adc sum", 
		  ilayer, isegment, icfeb);
          HBOOK1(hid, htitle, 100, 0., 4000., 0.0);
	  }
	}
      }
    }
  else if (pass == 1)
    {
    }
  return 0;
  }
Ejemplo n.º 7
0
/*------------------------------ init_hist ---------------------------------*/
int init_hist( int scan_number)
  {
  int tmp_hist_offset;
  int adb, hid, ilayer, ifeb, iwire;
  // int ichip;
  char htitle[80];

  // since this histogramm will be needed only for a temporary purpose
  if (scan_number > 10) scan_number=10; 
  // 10 is just enough for debuging 
  /* Book histograms for CSC wires */
 
  tmp_hist_offset = WIRE_HIST_OFFSET + (scan_number-1) * 10000;

  HBOOK1(tmp_hist_offset+10, "chisq of erf fit", 100, 0., 20., 0.);
  HBOOK1(tmp_hist_offset, "Number of layers with hit wires", 
	 7, -0.5, 6.5, 0.0);

  for (ilayer=1; ilayer <= NLAYER; ilayer++)
    {
    hid = tmp_hist_offset + ilayer ;
    sprintf( htitle, "ALCT Wire occupancy, Layer %d", ilayer);
    HBOOK1( hid, htitle, nwires, 0.5, (float)nwires+0.5, 0.0);
    }

  /* Book anode front-end board (AFEB) histograms */

//  for (ifeb = 1; ifeb <= NAFEB; ifeb++)
  for (ifeb = 1; ifeb <= (nwires*3/8); ifeb++)
    {
//    for (ichip = 1; ichip <= NAFEB_CHIP; ichip++)
      {
//      adb = 6 * ifeb + ichip -6;   /* Front end board 2000 numbering */
	adb = ifeb;	// ALCT 2001 numbering
	hid = tmp_hist_offset + 100 + adb;
	sprintf( htitle, "ALCT Wire times: ADB %d", adb);
	HBOOK1( hid, htitle, 32, -0.5, 31.5, 0.0); 

	hid = tmp_hist_offset + 200 + adb;
	sprintf( htitle, "Wire cal: ADB %d", adb);
	HBOOK1( hid, htitle, 256, -0.5, 255.5, 0.0);
      }
    }

  hid = tmp_hist_offset + 300;
  sprintf( htitle, "Threshold vs Board number");
//  HBOOK1( hid, htitle, 24, -0.5, 23.5, 0.0); 
  HBOOK1( hid, htitle, nwires*3/8, -0.5, (float)(nwires*3/8)-0.5, 0.0); 

  sprintf( htitle, "Threshold for Board");
  HBOOK1( hid+1, htitle, 1200, -0.5, 119.5, 0.0);

  sprintf( htitle, "Noise vs Board number");
//  HBOOK1( hid+2, htitle, 24, -0.5, 23.5, 0.0); 
  HBOOK1( hid+2, htitle, nwires*3/8, -0.5, (float)(nwires*3/8)-0.5, 0.0); 

  sprintf( htitle, "Noise for Board ");
  HBOOK1( hid+3, htitle, 240, -0.5, 23.5, 0.0);

  sprintf( htitle, "Threshold vs Wire number");
//  HBOOK1( hid+4, htitle, 384, 0.5, 384.5, 0.0); 
  HBOOK1( hid+4, htitle, nwires*8, 0.5, nwires*8+0.5, 0.0); 

  sprintf( htitle, "Threshold for Wire");
  HBOOK1( hid+5, htitle, 1200, -0.5, 119.5, 0.0);

  sprintf( htitle, "Noise vs Wire number");
//  HBOOK1( hid+6, htitle, 384, 0.5, 384.5, 0.0); 
  HBOOK1( hid+6, htitle, nwires*8, 0.5, nwires*8+0.5, 0.0); 

  sprintf( htitle, "Noise for Wire");
  HBOOK1( hid+7, htitle, 240, -0.5, 23.5, 0.0);

  hid = tmp_hist_offset + 3000;
  sprintf( htitle, "Time for event");
  HBOOK1( hid, htitle, 10000, 0.5, 10000.5, 0.0);

  for (ilayer = 0; ilayer < NLAYER; ilayer++)
    {
    for (iwire = 0; iwire < nwires; iwire++)
      {
//      hid = tmp_hist_offset +1000+ 100*(ilayer+1) + iwire+1;
      hid = tmp_hist_offset +1000+ 120*(ilayer+1) + iwire+1;
      sprintf( htitle, "ALCT Layer %d Wire %d", ilayer+1,iwire+1);
      HBOOK1( hid, htitle, 32, 0.5, 32.5, 0.0);

//      hid = tmp_hist_offset + 2000 + 100 * (ilayer + 1) + (iwire + 1);
      hid = tmp_hist_offset + 2000 + 120 * (ilayer + 1) + (iwire + 1);
      sprintf( htitle, "Wire cal: Layer %d Wire %d ", ilayer+1,iwire+1 );
      HBOOK1( hid, htitle, 256, -0.5, 255.5, 0.0);
      }
    }

  return 0;
  }
Ejemplo n.º 8
0
thStatus thBookaHist(char *line, thHistSpecList **thHistNext)
{
  int nargs, nd, n, id;
  char *long_title;
  daVarStruct *(varp[2]),*testp,*weightp;
  int vind[2],tind,wind;
  thHistOpaque *histpars;
  char *args[20];
  /*  int type;
      thTokenType toktyp;
      int nd,n;
      */
  int userflag;			/* 0 for normal hist, 1 for user hist */
  
  {
    char *s;
    s = line;
    long_title = 0;
    while(*s != 0) {
      if(*s == HTITLECHAR){
	*s++ = 0;
	long_title = (char *) malloc(strlen(s)+1);
	strcpy(long_title,s);	/* Make sure to free this  */
	break;
      } else s++;
    }
  }
  if(!long_title) {
    long_title = (char *) malloc(strlen(line)+1);
    strcpy(long_title,line);
  }
  /* All between # and title char, comment char, or EOL is the weight */
  {
    char *s;
    if((s=strchr(line,WEIGHTCHAR))) {
      *s++=0;
      s = thSpaceStrip(s);
      if(thVarResolve(s,&weightp,&wind,0,0) != S_SUCCESS) {
	free(long_title);
	return(S_FAILURE);
      }
    } else {
      weightp = 0;
      wind = 0;
    }
  }
  
  nargs = thCommas(line,args);
  args[0] = thSpaceStrip(args[0]);
  
  userflag = 0;
  if(nargs >= 4 && nargs <=6) {
    nd = 1;
    if(nargs == 4) userflag = 1;
  } else if(nargs == 7) {
    nd = 2;
    userflag = 1;
  } else if(nargs >= 9 && nargs <= 10){
    nd = 2;
  } else {
    fprintf(stderr,"Incorrect number of arguments\n");
    free(long_title);
    return(S_FAILURE);
  }
  
  varp[1] = 0; vind[1] = 0;
  testp = 0; tind = 0;
  if(userflag) {
    varp[0] = 0; vind[0] = 0;
  } else {
    for(n=0;n<nd;n++){		/* Interpret the data sources */
      args[n+1] = thSpaceStrip(args[n+1]);
      if(thVarResolve(args[n+1],&varp[n],&vind[n],0,0) != S_SUCCESS) {
	free(long_title);
	return(S_FAILURE);
      }
    }				/* Data sources now defined */
    if((nd==1&&nargs==6)||(nd==2&&nargs==10)){
      args[nargs-1] = thSpaceStrip(args[nargs-1]);
      if(thVarResolve(args[nargs-1],&testp,&tind,1,0) != S_SUCCESS) {
	free(long_title);
	return(S_FAILURE);
      }
      if(testp->type != DAVARINT){
	fprintf(stderr,"Test flag %s must be an integer\n",args[nargs-1]);
	free(long_title);
	return(S_FAILURE);
      }
    } else {
/*      printf("Test is NULL\n");*/
      testp = NULL;
    }
  }
  /* Find/Create the variable to hold hist def stuff */
  {
    char *name;
    daVarStruct var;
    thHistSpecList *Hist;

    name = (char *) malloc(strlen(HISTSTR)+strlen(args[0])+2);
    strcpy(name,HISTSTR);
    strcat(name,".");
    strcat(name,args[0]);
    if(daVarLookup(name,&var)!=S_SUCCESS){
      var.name = name;
      var.size = 1;
      var.varptr = (void *) malloc(sizeof(DAINT));
      *((DAINT *) var.varptr) = ++thMaxID;
      var.type = DAVARINT;
      var.flag = DAVAR_READONLY | DAVAR_REPOINTOK;
      if(userflag)
	var.opaque = 0;
      else
	var.opaque = (void *) malloc(sizeof(thHistOpaque));
      var.whook = 0;
#ifndef NOHBOOK
      var.rhook = thHistRHandler;
#endif
      var.title = long_title;
/*      printf("Registering %s\n",var.name);*/
      daVarRegister((int) 0,&var); /* Create variable for histogram */
    }
    /* Make sure that we don't use an existing histogram id */
    while(HEXIST((id= *((DAINT *) var.varptr))) != 0) {
      *((DAINT *) var.varptr) = ++thMaxID;
      }
    id = *((DAINT *) var.varptr);
    if(!userflag) {
      histpars = var.opaque;
    }
    /* Perhaps we don't want to put the user hists in this list?? */
    Hist = *thHistNext = (thHistSpecList *) malloc(sizeof(thHistSpecList));
    Hist->next = (thHistSpecList *) NULL;
    if(daVarLookupP(name,&Hist->varname)!=S_SUCCESS){
      fprintf(stderr,"This can't happen\n");
      free(long_title);
      return(S_FAILURE);
    }
    free(name);
  }
  if(!userflag) {
    histpars->nd = nd;
    histpars->x = varp[0];
    histpars->xindex = vind[0];
    histpars->y = varp[1];
    histpars->yindex = vind[1];
    histpars->test = testp;
    histpars->testindex = tind;
    histpars->weight = weightp;
    histpars->weightindex = wind;
  }

  /* Data sources and test result now interpreted */
  {
    int nbinx,nbiny;
    double xlow,xhigh,ylow,yhigh;
    int ixargoffset, iyargoffset;

    if(userflag) {
      ixargoffset = 1;
    } else {
      ixargoffset = 1 + nd;
    }
    iyargoffset = ixargoffset + 3;
    if((thEvalImed(args[ixargoffset],0,&nbinx) != S_SUCCESS) ||
       (thEvalImed(args[ixargoffset+1],&xlow,0) != S_SUCCESS) ||
       (thEvalImed(args[ixargoffset+2],&xhigh,0) != S_SUCCESS))
      fprintf(stderr,"Error intrepreting histogram arguments\n");
    if(nd == 2){
      thEvalImed(args[iyargoffset],0,&nbiny);
      thEvalImed(args[iyargoffset+1],&ylow,0);
      thEvalImed(args[iyargoffset+2],&yhigh,0);
    }
    
    if(nd==1){
      HBOOK1(id,long_title,nbinx,(float) xlow,(float) xhigh,0.0);;
    } else {
      HBOOK2(id,long_title,nbinx,(float) xlow,(float) xhigh,nbiny,
	     (float) ylow,(float) yhigh,0.0);;
    }
  }
  /* Need to add to alias file */
  free(long_title);
  return(S_SUCCESS);
}
Ejemplo n.º 9
0
// Book some histograms
void RICHDB::bookhist(){
#ifdef __AMSDEBUG__
  dump();
  cout <<"RICH BOOKING"<<endl;
  HBOOK1(123456,"Error de los directos",50,-1.,1.,0.);
  HBOOK1(123457,"Error de los reflejados",50,-1.,1.,0.);
  HBOOK1(123000,"Generados",300,0.,100.,0.);
  HBOOK1(123001,"Radiador",300,0.,100.,0.);
  HBOOK1(123002,"Base",300,0.,100.,0.);
  HBOOK1(123003,"Detectados",300,0.,100.,0.);
  HBOOK1(123100,"LG TRAN",100,0.,1.,0.);
  HBOOK1(1231001,"f",100,0.,1.,0.);
  HBOOK1(1231002,"lglength",100,0.,6.,0.);
  HBOOK1(123100,"Numero de hits ",300,0.,50.,0.);
  HBOOK1(123100,"Numero de hits reflejados",300,0.,50.,0.);
  HBOOK1(123100,"Numero de hits sin reflejar",300,0.,50.,0.);
  HBOOK2(124000,"Posicion de los PMT",300,-70.,70.,300,-70.,70.,0.);
  HBOOK2(124010,"Posicion de los PMT",300,-60.,60.,300,-60.,60.,0.);
  HBOOK1(12345,"Probabilidad de scattering",2,0.,2.,0.);
  HBOOK1(12346,"Angulo ph",50,0.,3.141592,0.);
  HBOOK1(12347,"Angulo th",100,0.,2e-1,0.);
#endif 

}