/* * hddm_r.c - DO NOT EDIT THIS FILE * * This file was generated automatically by hddm-c from the file * rest.xml * This c file contains the i/o interface to the c structures * described in the data model (from rest.xml). * * The hddm data model tool set was written by * Richard Jones, University of Connecticut. * * For more information see the following web site * * http://zeus.phys.uconn.edu/halld/datamodel/doc */ int hddm_r_nullTarget=0; #define HDDM_NULL (void*)&hddm_r_nullTarget #include "hddm_r.h" r_HDDM_t* make_r_HDDM() { int size = sizeof(r_HDDM_t); r_HDDM_t* p = (r_HDDM_t*)MALLOC(size,"r_HDDM_t"); p->reconstructedPhysicsEvent = (r_ReconstructedPhysicsEvent_t*)&hddm_r_nullTarget; return p; } r_ReconstructedPhysicsEvent_t* make_r_ReconstructedPhysicsEvent() { int size = sizeof(r_ReconstructedPhysicsEvent_t); r_ReconstructedPhysicsEvent_t* p = (r_ReconstructedPhysicsEvent_t*)MALLOC(size,"r_ReconstructedPhysicsEvent_t"); p->eventNo = 0; p->runNo = 0; p->comments = (r_Comments_t*)&hddm_r_nullTarget; p->reactions = (r_Reactions_t*)&hddm_r_nullTarget; p->taggerHits = (r_TaggerHits_t*)&hddm_r_nullTarget; p->calorimeterClusters = (r_CalorimeterClusters_t*)&hddm_r_nullTarget; p->chargedTracks = (r_ChargedTracks_t*)&hddm_r_nullTarget; p->startHits = (r_StartHits_t*)&hddm_r_nullTarget; p->tofPoints = (r_TofPoints_t*)&hddm_r_nullTarget; p->RFtime = (r_RFtime_t*)&hddm_r_nullTarget; p->trigger = (r_Trigger_t*)&hddm_r_nullTarget; return p; } r_Comments_t* make_r_Comments(int n) { int i; int rep = (n > 1) ? n-1 : 0; int size = sizeof(r_Comments_t) + rep * sizeof(r_Comment_t); r_Comments_t* p = (r_Comments_t*)MALLOC(size,"r_Comments_t"); p->mult = 0; for (i=0; iin[i]; pp->text = (string_t)&hddm_r_nullTarget; } return p; } r_Reactions_t* make_r_Reactions(int n) { int i; int rep = (n > 1) ? n-1 : 0; int size = sizeof(r_Reactions_t) + rep * sizeof(r_Reaction_t); r_Reactions_t* p = (r_Reactions_t*)MALLOC(size,"r_Reactions_t"); p->mult = 0; for (i=0; iin[i]; pp->Ebeam = 0; pp->jtag = (string_t)&hddm_r_nullTarget; pp->targetType = (Particle_t)0; pp->type = 0; pp->weight = 0; pp->vertices = (r_Vertices_t*)&hddm_r_nullTarget; } return p; } r_Vertices_t* make_r_Vertices(int n) { int i; int rep = (n > 1) ? n-1 : 0; int size = sizeof(r_Vertices_t) + rep * sizeof(r_Vertex_t); r_Vertices_t* p = (r_Vertices_t*)MALLOC(size,"r_Vertices_t"); p->mult = 0; for (i=0; iin[i]; pp->origin = (r_Origin_t*)&hddm_r_nullTarget; pp->products = (r_Products_t*)&hddm_r_nullTarget; } return p; } r_Origin_t* make_r_Origin() { int size = sizeof(r_Origin_t); r_Origin_t* p = (r_Origin_t*)MALLOC(size,"r_Origin_t"); p->t = 0; p->vx = 0; p->vy = 0; p->vz = 0; return p; } r_Products_t* make_r_Products(int n) { int i; int rep = (n > 1) ? n-1 : 0; int size = sizeof(r_Products_t) + rep * sizeof(r_Product_t); r_Products_t* p = (r_Products_t*)MALLOC(size,"r_Products_t"); p->mult = 0; for (i=0; iin[i]; pp->id = 0; pp->parentId = 0; pp->pdgtype = 0; pp->momentum = (r_Momentum_t*)&hddm_r_nullTarget; } return p; } r_Momentum_t* make_r_Momentum() { int size = sizeof(r_Momentum_t); r_Momentum_t* p = (r_Momentum_t*)MALLOC(size,"r_Momentum_t"); p->E = 0; p->px = 0; p->py = 0; p->pz = 0; return p; } r_TaggerHits_t* make_r_TaggerHits(int n) { int i; int rep = (n > 1) ? n-1 : 0; int size = sizeof(r_TaggerHits_t) + rep * sizeof(r_TaggerHit_t); r_TaggerHits_t* p = (r_TaggerHits_t*)MALLOC(size,"r_TaggerHits_t"); p->mult = 0; for (i=0; iin[i]; pp->E = 0; pp->jtag = (string_t)&hddm_r_nullTarget; pp->t = 0; } return p; } r_CalorimeterClusters_t* make_r_CalorimeterClusters(int n) { int i; int rep = (n > 1) ? n-1 : 0; int size = sizeof(r_CalorimeterClusters_t) + rep * sizeof(r_CalorimeterCluster_t); r_CalorimeterClusters_t* p = (r_CalorimeterClusters_t*)MALLOC(size,"r_CalorimeterClusters_t"); p->mult = 0; for (i=0; iin[i]; pp->E = 0; pp->Eerr = 0; pp->Ezcorr = 0; pp->jtag = (string_t)&hddm_r_nullTarget; pp->t = 0; pp->terr = 0; pp->tzcorr = 0; pp->x = 0; pp->xerr = 0; pp->xycorr = 0; pp->xzcorr = 0; pp->y = 0; pp->yerr = 0; pp->yzcorr = 0; pp->z = 0; pp->zerr = 0; } return p; } r_ChargedTracks_t* make_r_ChargedTracks(int n) { int i; int rep = (n > 1) ? n-1 : 0; int size = sizeof(r_ChargedTracks_t) + rep * sizeof(r_ChargedTrack_t); r_ChargedTracks_t* p = (r_ChargedTracks_t*)MALLOC(size,"r_ChargedTracks_t"); p->mult = 0; for (i=0; iin[i]; pp->candidateId = 0; pp->jtag = (string_t)&hddm_r_nullTarget; pp->ptype = (Particle_t)0; pp->trackFit = (r_TrackFit_t*)&hddm_r_nullTarget; pp->dEdxDC = (r_DEdxDC_t*)&hddm_r_nullTarget; } return p; } r_TrackFit_t* make_r_TrackFit() { int size = sizeof(r_TrackFit_t); r_TrackFit_t* p = (r_TrackFit_t*)MALLOC(size,"r_TrackFit_t"); p->Ndof = 0; p->chisq = 0; p->e11 = 0; p->e12 = 0; p->e13 = 0; p->e14 = 0; p->e15 = 0; p->e22 = 0; p->e23 = 0; p->e24 = 0; p->e25 = 0; p->e33 = 0; p->e34 = 0; p->e35 = 0; p->e44 = 0; p->e45 = 0; p->e55 = 0; p->px = 0; p->py = 0; p->pz = 0; p->t0 = 0; p->t0det = 0; p->t0err = 0; p->x0 = 0; p->y0 = 0; p->z0 = 0; return p; } r_DEdxDC_t* make_r_DEdxDC() { int size = sizeof(r_DEdxDC_t); r_DEdxDC_t* p = (r_DEdxDC_t*)MALLOC(size,"r_DEdxDC_t"); p->NsampleCDC = 0; p->NsampleFDC = 0; p->dEdxCDC = 0; p->dEdxFDC = 0; p->dxCDC = 0; p->dxFDC = 0; return p; } r_StartHits_t* make_r_StartHits(int n) { int i; int rep = (n > 1) ? n-1 : 0; int size = sizeof(r_StartHits_t) + rep * sizeof(r_StartHit_t); r_StartHits_t* p = (r_StartHits_t*)MALLOC(size,"r_StartHits_t"); p->mult = 0; for (i=0; iin[i]; pp->dE = 0; pp->jtag = (string_t)&hddm_r_nullTarget; pp->sector = 0; pp->t = 0; } return p; } r_TofPoints_t* make_r_TofPoints(int n) { int i; int rep = (n > 1) ? n-1 : 0; int size = sizeof(r_TofPoints_t) + rep * sizeof(r_TofPoint_t); r_TofPoints_t* p = (r_TofPoints_t*)MALLOC(size,"r_TofPoints_t"); p->mult = 0; for (i=0; iin[i]; pp->dE = 0; pp->dEerr = 0; pp->dEtcorr = 0; pp->dExcorr = 0; pp->dEycorr = 0; pp->jtag = (string_t)&hddm_r_nullTarget; pp->t = 0; pp->terr = 0; pp->x = 0; pp->xerr = 0; pp->xtcorr = 0; pp->xycorr = 0; pp->y = 0; pp->yerr = 0; pp->ytcorr = 0; pp->z = 0; pp->zerr = 0; } return p; } r_RFtime_t* make_r_RFtime() { int size = sizeof(r_RFtime_t); r_RFtime_t* p = (r_RFtime_t*)MALLOC(size,"r_RFtime_t"); p->jtag = (string_t)&hddm_r_nullTarget; p->tsync = 0; p->tsyncerr = 0; return p; } r_Trigger_t* make_r_Trigger() { int size = sizeof(r_Trigger_t); r_Trigger_t* p = (r_Trigger_t*)MALLOC(size,"r_Trigger_t"); p->L1a = 0; p->L1b = 0; p->L1c = 0; p->jtag = (string_t)&hddm_r_nullTarget; return p; } char HDDM_r_DocumentString[] = "\n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" "\n" ; #ifndef _FILE_OFFSET_BITS # define _FILE_OFFSET_BITS 64 #endif static off_t xdr_getpos64(XDR *xdrs) { if (xdrs->x_base == 0) { return ftello((FILE *)xdrs->x_private); } off_t pos = xdr_getpos(xdrs); return pos; } static bool_t xdr_setpos64(XDR *xdrs, off_t pos) { if (xdrs->x_base == 0) { return ((fseeko((FILE *)xdrs->x_private, pos, 0) < 0)? FALSE : TRUE); } return xdr_setpos(xdrs,pos); } static r_HDDM_t* unpack_r_HDDM(XDR* xdrs, popNode* pop) { r_HDDM_t* this1 = (r_HDDM_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); this1 = make_r_HDDM(); { int p; void* (*ptr) = (void**) &this1->reconstructedPhysicsEvent; for (p = 0; p < pop->popListLength; p++) { popNode* pnode = pop->popList[p]; if (pnode) { int kid = pnode->inParent; ptr[kid] = pnode->unpacker(xdrs,pnode); } else { unsigned int skip; xdr_u_int(xdrs,&skip); xdr_setpos64(xdrs,xdr_getpos64(xdrs)+skip); } } } xdr_setpos64(xdrs,start+size); } return this1; } static r_ReconstructedPhysicsEvent_t* unpack_r_ReconstructedPhysicsEvent(XDR* xdrs, popNode* pop) { r_ReconstructedPhysicsEvent_t* this1 = (r_ReconstructedPhysicsEvent_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); this1 = make_r_ReconstructedPhysicsEvent(); { int p; void* (*ptr) = (void**) &this1->comments; xdr_int(xdrs,&this1->eventNo); xdr_int(xdrs,&this1->runNo); for (p = 0; p < pop->popListLength; p++) { popNode* pnode = pop->popList[p]; if (pnode) { int kid = pnode->inParent; ptr[kid] = pnode->unpacker(xdrs,pnode); } else { unsigned int skip; xdr_u_int(xdrs,&skip); xdr_setpos64(xdrs,xdr_getpos64(xdrs)+skip); } } } xdr_setpos64(xdrs,start+size); } return this1; } static r_Comments_t* unpack_r_Comments(XDR* xdrs, popNode* pop) { r_Comments_t* this1 = (r_Comments_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); int m; unsigned int mult; xdr_u_int(xdrs,&mult); this1 = make_r_Comments(mult); this1->mult = mult; for (m = 0; m < mult; m++ ) { this1->in[m].text = 0; xdr_string(xdrs, &this1->in[m].text, 1000000); } xdr_setpos64(xdrs,start+size); } return this1; } static r_Reactions_t* unpack_r_Reactions(XDR* xdrs, popNode* pop) { r_Reactions_t* this1 = (r_Reactions_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); int m; unsigned int mult; xdr_u_int(xdrs,&mult); this1 = make_r_Reactions(mult); this1->mult = mult; for (m = 0; m < mult; m++ ) { int p; void* (*ptr) = (void**) &this1->in[m].vertices; xdr_float(xdrs,&this1->in[m].Ebeam); this1->in[m].jtag = 0; xdr_string(xdrs, &this1->in[m].jtag, 1000000); xdr_int(xdrs,(int*)&this1->in[m].targetType); xdr_int(xdrs,&this1->in[m].type); xdr_float(xdrs,&this1->in[m].weight); for (p = 0; p < pop->popListLength; p++) { popNode* pnode = pop->popList[p]; if (pnode) { int kid = pnode->inParent; ptr[kid] = pnode->unpacker(xdrs,pnode); } else { unsigned int skip; xdr_u_int(xdrs,&skip); xdr_setpos64(xdrs,xdr_getpos64(xdrs)+skip); } } } xdr_setpos64(xdrs,start+size); } return this1; } static r_Vertices_t* unpack_r_Vertices(XDR* xdrs, popNode* pop) { r_Vertices_t* this1 = (r_Vertices_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); int m; unsigned int mult; xdr_u_int(xdrs,&mult); this1 = make_r_Vertices(mult); this1->mult = mult; for (m = 0; m < mult; m++ ) { int p; void* (*ptr) = (void**) &this1->in[m].origin; for (p = 0; p < pop->popListLength; p++) { popNode* pnode = pop->popList[p]; if (pnode) { int kid = pnode->inParent; ptr[kid] = pnode->unpacker(xdrs,pnode); } else { unsigned int skip; xdr_u_int(xdrs,&skip); xdr_setpos64(xdrs,xdr_getpos64(xdrs)+skip); } } } xdr_setpos64(xdrs,start+size); } return this1; } static r_Origin_t* unpack_r_Origin(XDR* xdrs, popNode* pop) { r_Origin_t* this1 = (r_Origin_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); this1 = make_r_Origin(); { xdr_float(xdrs,&this1->t); xdr_float(xdrs,&this1->vx); xdr_float(xdrs,&this1->vy); xdr_float(xdrs,&this1->vz); } xdr_setpos64(xdrs,start+size); } return this1; } static r_Products_t* unpack_r_Products(XDR* xdrs, popNode* pop) { r_Products_t* this1 = (r_Products_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); int m; unsigned int mult; xdr_u_int(xdrs,&mult); this1 = make_r_Products(mult); this1->mult = mult; for (m = 0; m < mult; m++ ) { int p; void* (*ptr) = (void**) &this1->in[m].momentum; xdr_int(xdrs,&this1->in[m].id); xdr_int(xdrs,&this1->in[m].parentId); xdr_int(xdrs,&this1->in[m].pdgtype); for (p = 0; p < pop->popListLength; p++) { popNode* pnode = pop->popList[p]; if (pnode) { int kid = pnode->inParent; ptr[kid] = pnode->unpacker(xdrs,pnode); } else { unsigned int skip; xdr_u_int(xdrs,&skip); xdr_setpos64(xdrs,xdr_getpos64(xdrs)+skip); } } } xdr_setpos64(xdrs,start+size); } return this1; } static r_Momentum_t* unpack_r_Momentum(XDR* xdrs, popNode* pop) { r_Momentum_t* this1 = (r_Momentum_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); this1 = make_r_Momentum(); { xdr_float(xdrs,&this1->E); xdr_float(xdrs,&this1->px); xdr_float(xdrs,&this1->py); xdr_float(xdrs,&this1->pz); } xdr_setpos64(xdrs,start+size); } return this1; } static r_TaggerHits_t* unpack_r_TaggerHits(XDR* xdrs, popNode* pop) { r_TaggerHits_t* this1 = (r_TaggerHits_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); int m; unsigned int mult; xdr_u_int(xdrs,&mult); this1 = make_r_TaggerHits(mult); this1->mult = mult; for (m = 0; m < mult; m++ ) { xdr_float(xdrs,&this1->in[m].E); this1->in[m].jtag = 0; xdr_string(xdrs, &this1->in[m].jtag, 1000000); xdr_float(xdrs,&this1->in[m].t); } xdr_setpos64(xdrs,start+size); } return this1; } static r_CalorimeterClusters_t* unpack_r_CalorimeterClusters(XDR* xdrs, popNode* pop) { r_CalorimeterClusters_t* this1 = (r_CalorimeterClusters_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); int m; unsigned int mult; xdr_u_int(xdrs,&mult); this1 = make_r_CalorimeterClusters(mult); this1->mult = mult; for (m = 0; m < mult; m++ ) { xdr_float(xdrs,&this1->in[m].E); xdr_float(xdrs,&this1->in[m].Eerr); xdr_float(xdrs,&this1->in[m].Ezcorr); this1->in[m].jtag = 0; xdr_string(xdrs, &this1->in[m].jtag, 1000000); xdr_float(xdrs,&this1->in[m].t); xdr_float(xdrs,&this1->in[m].terr); xdr_float(xdrs,&this1->in[m].tzcorr); xdr_float(xdrs,&this1->in[m].x); xdr_float(xdrs,&this1->in[m].xerr); xdr_float(xdrs,&this1->in[m].xycorr); xdr_float(xdrs,&this1->in[m].xzcorr); xdr_float(xdrs,&this1->in[m].y); xdr_float(xdrs,&this1->in[m].yerr); xdr_float(xdrs,&this1->in[m].yzcorr); xdr_float(xdrs,&this1->in[m].z); xdr_float(xdrs,&this1->in[m].zerr); } xdr_setpos64(xdrs,start+size); } return this1; } static r_ChargedTracks_t* unpack_r_ChargedTracks(XDR* xdrs, popNode* pop) { r_ChargedTracks_t* this1 = (r_ChargedTracks_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); int m; unsigned int mult; xdr_u_int(xdrs,&mult); this1 = make_r_ChargedTracks(mult); this1->mult = mult; for (m = 0; m < mult; m++ ) { int p; void* (*ptr) = (void**) &this1->in[m].trackFit; xdr_int(xdrs,&this1->in[m].candidateId); this1->in[m].jtag = 0; xdr_string(xdrs, &this1->in[m].jtag, 1000000); xdr_int(xdrs,(int*)&this1->in[m].ptype); for (p = 0; p < pop->popListLength; p++) { popNode* pnode = pop->popList[p]; if (pnode) { int kid = pnode->inParent; ptr[kid] = pnode->unpacker(xdrs,pnode); } else { unsigned int skip; xdr_u_int(xdrs,&skip); xdr_setpos64(xdrs,xdr_getpos64(xdrs)+skip); } } } xdr_setpos64(xdrs,start+size); } return this1; } static r_TrackFit_t* unpack_r_TrackFit(XDR* xdrs, popNode* pop) { r_TrackFit_t* this1 = (r_TrackFit_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); this1 = make_r_TrackFit(); { xdr_int(xdrs,&this1->Ndof); xdr_float(xdrs,&this1->chisq); xdr_float(xdrs,&this1->e11); xdr_float(xdrs,&this1->e12); xdr_float(xdrs,&this1->e13); xdr_float(xdrs,&this1->e14); xdr_float(xdrs,&this1->e15); xdr_float(xdrs,&this1->e22); xdr_float(xdrs,&this1->e23); xdr_float(xdrs,&this1->e24); xdr_float(xdrs,&this1->e25); xdr_float(xdrs,&this1->e33); xdr_float(xdrs,&this1->e34); xdr_float(xdrs,&this1->e35); xdr_float(xdrs,&this1->e44); xdr_float(xdrs,&this1->e45); xdr_float(xdrs,&this1->e55); xdr_float(xdrs,&this1->px); xdr_float(xdrs,&this1->py); xdr_float(xdrs,&this1->pz); xdr_float(xdrs,&this1->t0); xdr_int(xdrs,&this1->t0det); xdr_float(xdrs,&this1->t0err); xdr_float(xdrs,&this1->x0); xdr_float(xdrs,&this1->y0); xdr_float(xdrs,&this1->z0); } xdr_setpos64(xdrs,start+size); } return this1; } static r_DEdxDC_t* unpack_r_DEdxDC(XDR* xdrs, popNode* pop) { r_DEdxDC_t* this1 = (r_DEdxDC_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); this1 = make_r_DEdxDC(); { xdr_int(xdrs,&this1->NsampleCDC); xdr_int(xdrs,&this1->NsampleFDC); xdr_float(xdrs,&this1->dEdxCDC); xdr_float(xdrs,&this1->dEdxFDC); xdr_float(xdrs,&this1->dxCDC); xdr_float(xdrs,&this1->dxFDC); } xdr_setpos64(xdrs,start+size); } return this1; } static r_StartHits_t* unpack_r_StartHits(XDR* xdrs, popNode* pop) { r_StartHits_t* this1 = (r_StartHits_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); int m; unsigned int mult; xdr_u_int(xdrs,&mult); this1 = make_r_StartHits(mult); this1->mult = mult; for (m = 0; m < mult; m++ ) { xdr_float(xdrs,&this1->in[m].dE); this1->in[m].jtag = 0; xdr_string(xdrs, &this1->in[m].jtag, 1000000); xdr_int(xdrs,&this1->in[m].sector); xdr_float(xdrs,&this1->in[m].t); } xdr_setpos64(xdrs,start+size); } return this1; } static r_TofPoints_t* unpack_r_TofPoints(XDR* xdrs, popNode* pop) { r_TofPoints_t* this1 = (r_TofPoints_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); int m; unsigned int mult; xdr_u_int(xdrs,&mult); this1 = make_r_TofPoints(mult); this1->mult = mult; for (m = 0; m < mult; m++ ) { xdr_float(xdrs,&this1->in[m].dE); xdr_float(xdrs,&this1->in[m].dEerr); xdr_float(xdrs,&this1->in[m].dEtcorr); xdr_float(xdrs,&this1->in[m].dExcorr); xdr_float(xdrs,&this1->in[m].dEycorr); this1->in[m].jtag = 0; xdr_string(xdrs, &this1->in[m].jtag, 1000000); xdr_float(xdrs,&this1->in[m].t); xdr_float(xdrs,&this1->in[m].terr); xdr_float(xdrs,&this1->in[m].x); xdr_float(xdrs,&this1->in[m].xerr); xdr_float(xdrs,&this1->in[m].xtcorr); xdr_float(xdrs,&this1->in[m].xycorr); xdr_float(xdrs,&this1->in[m].y); xdr_float(xdrs,&this1->in[m].yerr); xdr_float(xdrs,&this1->in[m].ytcorr); xdr_float(xdrs,&this1->in[m].z); xdr_float(xdrs,&this1->in[m].zerr); } xdr_setpos64(xdrs,start+size); } return this1; } static r_RFtime_t* unpack_r_RFtime(XDR* xdrs, popNode* pop) { r_RFtime_t* this1 = (r_RFtime_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); this1 = make_r_RFtime(); { this1->jtag = 0; xdr_string(xdrs, &this1->jtag, 1000000); xdr_float(xdrs,&this1->tsync); xdr_float(xdrs,&this1->tsyncerr); } xdr_setpos64(xdrs,start+size); } return this1; } static r_Trigger_t* unpack_r_Trigger(XDR* xdrs, popNode* pop) { r_Trigger_t* this1 = (r_Trigger_t*)HDDM_NULL; unsigned int size; if (! xdr_u_int(xdrs,&size)) { return this1; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(xdrs); this1 = make_r_Trigger(); { xdr_bool(xdrs,&this1->L1a); xdr_bool(xdrs,&this1->L1b); xdr_bool(xdrs,&this1->L1c); this1->jtag = 0; xdr_string(xdrs, &this1->jtag, 1000000); } xdr_setpos64(xdrs,start+size); } return this1; } r_HDDM_t* read_r_HDDM(r_iostream_t* fp) { r_HDDM_t* nextEvent = unpack_r_HDDM(fp->xdrs,fp->popTop); return (nextEvent == HDDM_NULL)? 0 : nextEvent; } int skip_r_HDDM(r_iostream_t* fp, int nskip) { int skipped; for (skipped=0; skipped < nskip; ++skipped) { unsigned int size; if (! xdr_u_int(fp->xdrs,&size)) { return skipped; } else if (size == 1) { fprintf(stderr,"hddm error - " "compressed data found in input stream.\n" "Compression/decompression is not supported " "by the hddm c i/o interface.\n"); fprintf(stderr,"You must use the c++ " "interface to read this file.\n"); exit(9); } else if (size > 0) { off_t start = xdr_getpos64(fp->xdrs); if (xdr_setpos64(fp->xdrs,start+size) != 0) { fp->lerrno = errno; return skipped; } } } return skipped; } static int pack_r_HDDM(XDR* xdrs, r_HDDM_t* this1); static int pack_r_ReconstructedPhysicsEvent(XDR* xdrs, r_ReconstructedPhysicsEvent_t* this1); static int pack_r_Comments(XDR* xdrs, r_Comments_t* this1); static int pack_r_Reactions(XDR* xdrs, r_Reactions_t* this1); static int pack_r_Vertices(XDR* xdrs, r_Vertices_t* this1); static int pack_r_Origin(XDR* xdrs, r_Origin_t* this1); static int pack_r_Products(XDR* xdrs, r_Products_t* this1); static int pack_r_Momentum(XDR* xdrs, r_Momentum_t* this1); static int pack_r_TaggerHits(XDR* xdrs, r_TaggerHits_t* this1); static int pack_r_CalorimeterClusters(XDR* xdrs, r_CalorimeterClusters_t* this1); static int pack_r_ChargedTracks(XDR* xdrs, r_ChargedTracks_t* this1); static int pack_r_TrackFit(XDR* xdrs, r_TrackFit_t* this1); static int pack_r_DEdxDC(XDR* xdrs, r_DEdxDC_t* this1); static int pack_r_StartHits(XDR* xdrs, r_StartHits_t* this1); static int pack_r_TofPoints(XDR* xdrs, r_TofPoints_t* this1); static int pack_r_RFtime(XDR* xdrs, r_RFtime_t* this1); static int pack_r_Trigger(XDR* xdrs, r_Trigger_t* this1); static int pack_r_HDDM(XDR* xdrs, r_HDDM_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); { if (this1->reconstructedPhysicsEvent != (r_ReconstructedPhysicsEvent_t*)&hddm_r_nullTarget) { if (pack_r_ReconstructedPhysicsEvent(xdrs,this1->reconstructedPhysicsEvent) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_ReconstructedPhysicsEvent(XDR* xdrs, r_ReconstructedPhysicsEvent_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); { xdr_int(xdrs,&this1->eventNo); xdr_int(xdrs,&this1->runNo); if (this1->comments != (r_Comments_t*)&hddm_r_nullTarget) { if (pack_r_Comments(xdrs,this1->comments) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } if (this1->reactions != (r_Reactions_t*)&hddm_r_nullTarget) { if (pack_r_Reactions(xdrs,this1->reactions) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } if (this1->taggerHits != (r_TaggerHits_t*)&hddm_r_nullTarget) { if (pack_r_TaggerHits(xdrs,this1->taggerHits) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } if (this1->calorimeterClusters != (r_CalorimeterClusters_t*)&hddm_r_nullTarget) { if (pack_r_CalorimeterClusters(xdrs,this1->calorimeterClusters) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } if (this1->chargedTracks != (r_ChargedTracks_t*)&hddm_r_nullTarget) { if (pack_r_ChargedTracks(xdrs,this1->chargedTracks) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } if (this1->startHits != (r_StartHits_t*)&hddm_r_nullTarget) { if (pack_r_StartHits(xdrs,this1->startHits) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } if (this1->tofPoints != (r_TofPoints_t*)&hddm_r_nullTarget) { if (pack_r_TofPoints(xdrs,this1->tofPoints) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } if (this1->RFtime != (r_RFtime_t*)&hddm_r_nullTarget) { if (pack_r_RFtime(xdrs,this1->RFtime) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } if (this1->trigger != (r_Trigger_t*)&hddm_r_nullTarget) { if (pack_r_Trigger(xdrs,this1->trigger) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_Comments(XDR* xdrs, r_Comments_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); xdr_u_int(xdrs,&this1->mult); for (m = 0; m < this1->mult; m++) { xdr_string(xdrs,&this1->in[m].text, 1000000); FREE(this1->in[m].text); } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_Reactions(XDR* xdrs, r_Reactions_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); xdr_u_int(xdrs,&this1->mult); for (m = 0; m < this1->mult; m++) { xdr_float(xdrs,&this1->in[m].Ebeam); xdr_string(xdrs,&this1->in[m].jtag, 1000000); FREE(this1->in[m].jtag); xdr_int(xdrs,(int*)&this1->in[m].targetType); xdr_int(xdrs,&this1->in[m].type); xdr_float(xdrs,&this1->in[m].weight); if (this1->in[m].vertices != (r_Vertices_t*)&hddm_r_nullTarget) { if (pack_r_Vertices(xdrs,this1->in[m].vertices) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_Vertices(XDR* xdrs, r_Vertices_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); xdr_u_int(xdrs,&this1->mult); for (m = 0; m < this1->mult; m++) { if (this1->in[m].origin != (r_Origin_t*)&hddm_r_nullTarget) { if (pack_r_Origin(xdrs,this1->in[m].origin) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } if (this1->in[m].products != (r_Products_t*)&hddm_r_nullTarget) { if (pack_r_Products(xdrs,this1->in[m].products) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_Origin(XDR* xdrs, r_Origin_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); { xdr_float(xdrs,&this1->t); xdr_float(xdrs,&this1->vx); xdr_float(xdrs,&this1->vy); xdr_float(xdrs,&this1->vz); } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_Products(XDR* xdrs, r_Products_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); xdr_u_int(xdrs,&this1->mult); for (m = 0; m < this1->mult; m++) { xdr_int(xdrs,&this1->in[m].id); xdr_int(xdrs,&this1->in[m].parentId); xdr_int(xdrs,&this1->in[m].pdgtype); if (this1->in[m].momentum != (r_Momentum_t*)&hddm_r_nullTarget) { if (pack_r_Momentum(xdrs,this1->in[m].momentum) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_Momentum(XDR* xdrs, r_Momentum_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); { xdr_float(xdrs,&this1->E); xdr_float(xdrs,&this1->px); xdr_float(xdrs,&this1->py); xdr_float(xdrs,&this1->pz); } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_TaggerHits(XDR* xdrs, r_TaggerHits_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); xdr_u_int(xdrs,&this1->mult); for (m = 0; m < this1->mult; m++) { xdr_float(xdrs,&this1->in[m].E); xdr_string(xdrs,&this1->in[m].jtag, 1000000); FREE(this1->in[m].jtag); xdr_float(xdrs,&this1->in[m].t); } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_CalorimeterClusters(XDR* xdrs, r_CalorimeterClusters_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); xdr_u_int(xdrs,&this1->mult); for (m = 0; m < this1->mult; m++) { xdr_float(xdrs,&this1->in[m].E); xdr_float(xdrs,&this1->in[m].Eerr); xdr_float(xdrs,&this1->in[m].Ezcorr); xdr_string(xdrs,&this1->in[m].jtag, 1000000); FREE(this1->in[m].jtag); xdr_float(xdrs,&this1->in[m].t); xdr_float(xdrs,&this1->in[m].terr); xdr_float(xdrs,&this1->in[m].tzcorr); xdr_float(xdrs,&this1->in[m].x); xdr_float(xdrs,&this1->in[m].xerr); xdr_float(xdrs,&this1->in[m].xycorr); xdr_float(xdrs,&this1->in[m].xzcorr); xdr_float(xdrs,&this1->in[m].y); xdr_float(xdrs,&this1->in[m].yerr); xdr_float(xdrs,&this1->in[m].yzcorr); xdr_float(xdrs,&this1->in[m].z); xdr_float(xdrs,&this1->in[m].zerr); } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_ChargedTracks(XDR* xdrs, r_ChargedTracks_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); xdr_u_int(xdrs,&this1->mult); for (m = 0; m < this1->mult; m++) { xdr_int(xdrs,&this1->in[m].candidateId); xdr_string(xdrs,&this1->in[m].jtag, 1000000); FREE(this1->in[m].jtag); xdr_int(xdrs,(int*)&this1->in[m].ptype); if (this1->in[m].trackFit != (r_TrackFit_t*)&hddm_r_nullTarget) { if (pack_r_TrackFit(xdrs,this1->in[m].trackFit) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } if (this1->in[m].dEdxDC != (r_DEdxDC_t*)&hddm_r_nullTarget) { if (pack_r_DEdxDC(xdrs,this1->in[m].dEdxDC) < 0) { return -1; } } else { int zero=0; xdr_int(xdrs,&zero); } } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_TrackFit(XDR* xdrs, r_TrackFit_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); { xdr_int(xdrs,&this1->Ndof); xdr_float(xdrs,&this1->chisq); xdr_float(xdrs,&this1->e11); xdr_float(xdrs,&this1->e12); xdr_float(xdrs,&this1->e13); xdr_float(xdrs,&this1->e14); xdr_float(xdrs,&this1->e15); xdr_float(xdrs,&this1->e22); xdr_float(xdrs,&this1->e23); xdr_float(xdrs,&this1->e24); xdr_float(xdrs,&this1->e25); xdr_float(xdrs,&this1->e33); xdr_float(xdrs,&this1->e34); xdr_float(xdrs,&this1->e35); xdr_float(xdrs,&this1->e44); xdr_float(xdrs,&this1->e45); xdr_float(xdrs,&this1->e55); xdr_float(xdrs,&this1->px); xdr_float(xdrs,&this1->py); xdr_float(xdrs,&this1->pz); xdr_float(xdrs,&this1->t0); xdr_int(xdrs,&this1->t0det); xdr_float(xdrs,&this1->t0err); xdr_float(xdrs,&this1->x0); xdr_float(xdrs,&this1->y0); xdr_float(xdrs,&this1->z0); } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_DEdxDC(XDR* xdrs, r_DEdxDC_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); { xdr_int(xdrs,&this1->NsampleCDC); xdr_int(xdrs,&this1->NsampleFDC); xdr_float(xdrs,&this1->dEdxCDC); xdr_float(xdrs,&this1->dEdxFDC); xdr_float(xdrs,&this1->dxCDC); xdr_float(xdrs,&this1->dxFDC); } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_StartHits(XDR* xdrs, r_StartHits_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); xdr_u_int(xdrs,&this1->mult); for (m = 0; m < this1->mult; m++) { xdr_float(xdrs,&this1->in[m].dE); xdr_string(xdrs,&this1->in[m].jtag, 1000000); FREE(this1->in[m].jtag); xdr_int(xdrs,&this1->in[m].sector); xdr_float(xdrs,&this1->in[m].t); } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_TofPoints(XDR* xdrs, r_TofPoints_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); xdr_u_int(xdrs,&this1->mult); for (m = 0; m < this1->mult; m++) { xdr_float(xdrs,&this1->in[m].dE); xdr_float(xdrs,&this1->in[m].dEerr); xdr_float(xdrs,&this1->in[m].dEtcorr); xdr_float(xdrs,&this1->in[m].dExcorr); xdr_float(xdrs,&this1->in[m].dEycorr); xdr_string(xdrs,&this1->in[m].jtag, 1000000); FREE(this1->in[m].jtag); xdr_float(xdrs,&this1->in[m].t); xdr_float(xdrs,&this1->in[m].terr); xdr_float(xdrs,&this1->in[m].x); xdr_float(xdrs,&this1->in[m].xerr); xdr_float(xdrs,&this1->in[m].xtcorr); xdr_float(xdrs,&this1->in[m].xycorr); xdr_float(xdrs,&this1->in[m].y); xdr_float(xdrs,&this1->in[m].yerr); xdr_float(xdrs,&this1->in[m].ytcorr); xdr_float(xdrs,&this1->in[m].z); xdr_float(xdrs,&this1->in[m].zerr); } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_RFtime(XDR* xdrs, r_RFtime_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); { xdr_string(xdrs,&this1->jtag, 1000000); FREE(this1->jtag); xdr_float(xdrs,&this1->tsync); xdr_float(xdrs,&this1->tsyncerr); } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } static int pack_r_Trigger(XDR* xdrs, r_Trigger_t* this1) { int m=0; unsigned int size=0; off_t base,start,end; base = xdr_getpos64(xdrs); xdr_u_int(xdrs,&size); start = xdr_getpos64(xdrs); { xdr_bool(xdrs,&this1->L1a); xdr_bool(xdrs,&this1->L1b); xdr_bool(xdrs,&this1->L1c); xdr_string(xdrs,&this1->jtag, 1000000); FREE(this1->jtag); } FREE(this1); end = xdr_getpos64(xdrs); xdr_setpos64(xdrs,base); size = end-start; xdr_u_int(xdrs,&size); xdr_setpos64(xdrs,end); return size; } int flush_r_HDDM(r_HDDM_t* this1,r_iostream_t* fp) { if (this1 == 0) { return 0; } else if (fp == 0) { XDR* xdrs = (XDR*)malloc(sizeof(XDR)); int max_buffer_size = 1000000; char* dump = (char*)malloc(max_buffer_size); xdrmem_create(xdrs,dump,max_buffer_size,XDR_ENCODE); pack_r_HDDM(xdrs,this1); xdr_destroy(xdrs); free(xdrs); free(dump); } else if (fp->iomode == HDDM_STREAM_OUTPUT) { if (pack_r_HDDM(fp->xdrs,this1) < 0) { fp->lerrno = errno; return -1; } } return 0; } static int getTag(char* d, char* tag) { int level; char* token; char line[500]; strncpy(line,d,500); line[499] = 0; level = index(line,'<')-line; if (level < 500 && (token = strtok(line+level+1," >"))) { strncpy(tag,token,500); return level/2; } return -1; } static char* getEndTag(char* d, char* tag) { char line[500]; char endTag[510]; strncpy(line,d,500); line[499] = 0; if (strstr(strtok(line,"\n"),"/>") == 0) { sprintf(endTag,"",tag); } else { strcpy(endTag,"/>"); } return strstr(d,endTag); } static void collide(char* b, char* c) { char btag[500]; getTag(b,btag); b = index(b,'<'); c = index(c,'<'); *(index(b,'\n')) = 0; *(index(c,'\n')) = 0; fprintf(stderr,"HDDM warning: "); fprintf(stderr,"tag %s in input file ", btag); fprintf(stderr,"does not match c header hddm_r.h\n"); fprintf(stderr," input file: %s\n", b); fprintf(stderr," c header: %s\n", c); fprintf(stderr," === Tag %s will be ignored,", btag); fprintf(stderr," rebuild to cure the problem ===\n"); *(index(b,0)) = '\n'; *(index(c,0)) = '\n'; } static popNode* matches(char* b, char* c) { char btag[500]; char ctag[500]; int blevel, clevel; int ptrSeqNo = 0; blevel = getTag(b,btag); while ((clevel = getTag(c,ctag)) == blevel) { if ((clevel == blevel) && (strcmp(ctag,btag) == 0)) { popNode* this1 = (popNode*)malloc(sizeof(popNode)); int len = index(c+1,'\n') - c; if (strncmp(c,b,len) != 0) { collide(b,c); return 0; } else if (strcmp(btag,"HDDM") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_HDDM; } else if (strcmp(btag,"reconstructedPhysicsEvent") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_ReconstructedPhysicsEvent; } else if (strcmp(btag,"comment") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_Comments; } else if (strcmp(btag,"reaction") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_Reactions; } else if (strcmp(btag,"vertex") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_Vertices; } else if (strcmp(btag,"origin") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_Origin; } else if (strcmp(btag,"product") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_Products; } else if (strcmp(btag,"momentum") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_Momentum; } else if (strcmp(btag,"taggerHit") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_TaggerHits; } else if (strcmp(btag,"calorimeterCluster") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_CalorimeterClusters; } else if (strcmp(btag,"chargedTrack") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_ChargedTracks; } else if (strcmp(btag,"trackFit") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_TrackFit; } else if (strcmp(btag,"dEdxDC") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_DEdxDC; } else if (strcmp(btag,"startHit") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_StartHits; } else if (strcmp(btag,"tofPoint") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_TofPoints; } else if (strcmp(btag,"RFtime") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_RFtime; } else if (strcmp(btag,"trigger") == 0) { this1->unpacker = (void*(*)(XDR*,popNode*))unpack_r_Trigger; } this1->inParent = ptrSeqNo; this1->popListLength = 0; c = index(c+1,'\n'); b = index(b+1,'\n'); while (getTag(b,btag) > blevel) { this1->popList[this1->popListLength++] = matches(b,c); if (this1->popListLength > 99) { fprintf(stderr,"hddm error - popList overflow.\n"); fprintf(stderr,"Increase MAX_POPLIST_LENGTH and recompile.\n"); exit(9); } b = getEndTag(b,btag); b = index(b+1,'\n'); } return this1; } else { c = getEndTag(c,ctag); c = index(c+1,'\n'); ++ptrSeqNo; } } return 0; } r_iostream_t* open_r_HDDM(char* filename) { r_iostream_t* fp = (r_iostream_t*)malloc(sizeof(r_iostream_t)); char* p; char* head; char* nullfilename=""; if (filename) { fp->fd = fopen(filename,"r"); } else { fp->fd = fdopen(0,"r"); filename = nullfilename; } if (fp->fd == 0) { free(fp); return 0; } fp->iomode = HDDM_STREAM_INPUT; head = (char*)malloc(1000000); *head = 0; for (p = head; strstr(head,"") == 0; p += strlen(p)) { if (p-head < 999000) { fgets(p,1000,fp->fd); } else { break; } } fp->popTop = matches(head,HDDM_r_DocumentString); free(head); if (fp->popTop == 0 || fp->popTop->popListLength == 0) { fprintf(stderr,"HDDM Error: "); fprintf(stderr,"input template model "); fprintf(stderr,"does not match c header."); fprintf(stderr," Please recompile.\n"); exit(9); } fp->filename = (char*)malloc(strlen(filename) + 1); strcpy(fp->filename,filename); fp->xdrs = (XDR*)malloc(sizeof(XDR)); xdrstdio_create(fp->xdrs,fp->fd,XDR_DECODE); return fp; } r_iostream_t* init_r_HDDM(char* filename) { int len; char* head; char* nullfilename=""; r_iostream_t* fp = (r_iostream_t*)malloc(sizeof(r_iostream_t)); if (filename) { fp->fd = fopen(filename,"w"); } else { fp->fd = fdopen(1,"w"); filename = nullfilename; } if (fp->fd == 0) { free(fp); return 0; } fp->iomode = HDDM_STREAM_OUTPUT; len = strlen(HDDM_r_DocumentString); head = (char*)malloc(len+1); strcpy(head,HDDM_r_DocumentString); if (fwrite(head,1,len,fp->fd) != len) { fprintf(stderr,"HDDM Error: "); fprintf(stderr,"error writing to "); fprintf(stderr,"output file %s\n",filename); exit(9); } fp->filename = (char*)malloc(strlen(filename) + 1); strcpy(fp->filename,filename); fp->popTop = 0; fp->xdrs = (XDR*)malloc(sizeof(XDR)); xdrstdio_create(fp->xdrs,fp->fd,XDR_ENCODE); free(head); return fp; } static void popaway(popNode* p) { if (p) { int n; for (n = 0; n < p->popListLength; n++) { popaway(p->popList[n]); } free(p); } } void close_r_HDDM(r_iostream_t* fp) { xdr_destroy(fp->xdrs); free(fp->xdrs); fclose(fp->fd); free(fp->filename); popaway(fp->popTop); free(fp); }