示例#1
0
int
bin_gtcal (GEB_EVENT * GEB_event)
{

  /* declarations */

  int i;
  char str[128];
  CRYS_INTPTS *ptinp;
  GEBDATA *ptgd;

  /* prototypes */

  int GebTypeStr (int type, char str[]);

  /* prototypes */

  if (Pars.CurEvNo <= Pars.NumToPrint)
    printf ("entered bin_mode3:\n");

  for (i = 0; i < GEB_event->mult; i++)
    {

      if (GEB_event->ptgd[i]->type == GEB_TYPE_RAW)
        {

          if (Pars.CurEvNo <= Pars.NumToPrint)
            {
              GebTypeStr (GEB_event->ptgd[i]->type, str);
              printf ("bin_gtcal, %2i> %2i, %s, TS=%lli, 0x%llx\n", i, GEB_event->ptgd[i]->type, str,
                      GEB_event->ptgd[i]->timestamp, GEB_event->ptgd[i]->timestamp);
            }

          /* Shaofei, put your code here */

        };

    };

  /* done */

  if (Pars.CurEvNo <= Pars.NumToPrint)
    printf ("exit bin_gtcal\n");

  return (0);

}
示例#2
0
int bin_agod (GEB_EVENT * GEB_event)
{

	static unsigned long long lastTS = 0;

  /* declarations */

  char str[128];

  /* prototypes */

  int GebTypeStr (int type, char str[]);

  if (Pars.CurEvNo <= Pars.NumToPrint)
    printf ("entered bin_agod:\n");

  numAGOD = 0;

  /* loop through the coincidence event and fish out GEB_TYPE_AGOD data */

  for (int i = 0; i < GEB_event->mult; i++) {
    // look for analog marker 0x13 = 19
    if (GEB_event->ptgd[i]->type == 19) {
      if (Pars.CurEvNo <= Pars.NumToPrint) {
        GebTypeStr (GEB_event->ptgd[i]->type, str);
        //printf ("bin_template, %2i> %2i, %s, TS=%lli\n", i, GEB_event->ptgd[i]->type, str, GEB_event->ptgd[i]->timestamp);
      }
      AGODEvDecompose ((unsigned int *) GEB_event->ptinp[i], GEB_event->ptgd[i]->length / sizeof (unsigned int), &AGODEvent[numAGOD]);

      numAGOD++;
    }
  }

  // histogram incrementation 
  for (unsigned int i=0;i<numAGOD;i++) {
		h1_agod_dTS->Fill((long long)(AGODEvent[i].timestamp - lastTS));
		lastTS = AGODEvent[i].timestamp;
	  for (size_t j=0;j<AGODEvent[i].values.size();j++) {
		  h2_agod_en->Fill(AGODEvent[i].values[j],AGODEvent[i].channels[j]);
		  h1_agod_en->Fill(AGODEvent[i].values[j]);
	  }
  }

  // time differences 

  double dTg_agod;
  dTg_agod = 0.0;

  for(unsigned int i=0;i<numAGOD;i++) {
	//printf("AGOD: %d %d %d %d\n", i, numAGOD, ng, theAGODEvent[i].values.size());
	  if(ng > 0) {
		  for (size_t j=0;j<AGODEvent[i].values.size();j++) {
			  dTg_agod = double(DGSEvent[0].event_timestamp) - double(AGODEvent[i].timestamp);
			  h2_dTg_agod->Fill(dTg_agod,AGODEvent[i].channels[j]);
		  }
	  }
  }

  for(unsigned int i=0;i<numAGOD;i++) {
	  for(int j=0;j<ng;j++) {
		if (DGSEvent[j].tpe == GE) {
		  dTg_agod = double(DGSEvent[j].event_timestamp) - double(AGODEvent[i].timestamp);
		  for (size_t k=0;k<AGODEvent[i].values.size();k++) {
			  if ((AGODEvent[i].channels[k]==10)&&(dTg_agod>407)&(dTg_agod<420)) {
				  h2_g_agod->Fill(DGSEvent[j].ehi,AGODEvent[i].values[k]);
			  }
		  }
		}
	  }
  }

  /* done */

  if (Pars.CurEvNo <= Pars.NumToPrint)
	  printf ("exit bin_agod\n");

  return (0);

}