Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plugins/Analysis/eta_ntuple/cern_c.c
Go to the documentation of this file.
1 
2 /**********************************************************/
3 /* cern_c.c */
4 /* */
5 /* Basically a copy of clas_cern.c from the CLAS software */
6 /* */
7 /* These are just C wrappers for FORTRAN routines in */
8 /* cernlib. */
9 /**********************************************************/
10 
11 
12 
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <string.h>
16 
17 #include "cern_c.h"
18 
19 
20 
21 
22 void hlimit(int size)
23 {
24  hlimit_(&size);
25 }
26 
27 void hlimap(int size,char *name)
28 {
29  hlimap_(&size,name,strlen(name));
30 }
31 
32 float hstati(int id, int icase, char *choice, int num){
33  return(hstati_(&id, &icase, choice, &num, strlen(choice)));
34 }
35 
36 float hx(int id, float x){
37  return(hx_(&id, &x));
38 }
39 
40 void hxi(int id, float x, int *bin){
41  hxi_(&id, &x, bin);
42 }
43 
44 float hsum(int id){
45  return(hsum_(&id));
46 }
47 
48 void hrput(int id, char *file, char *opt)
49 {
50  hrput_(&id,file,opt,strlen(file),strlen(opt));
51 }
52 
53 
54 void hf1(int id, float data, float weight)
55 {
56  hf1_(&id,&data,&weight);
57 }
58 
59 void hbarx(int id){
60  hbarx_(&id);
61 }
62 
63 void hf1e(int id, float data, float weight, float error)
64 {
65  hf1e_(&id,&data,&weight, &error);
66 }
67 
68 void hf2(int id,float data1,float data2,float weight)
69 {
70  hf2_(&id,&data1,&data2,&weight);
71 }
72 
73 void hdelet(int id)
74 {
75  hdelet_(&id);
76 }
77 
78 void hrin( int id, int icycle , int iofset )
79 {
80  hrin_( &id, &icycle, &iofset);
81 }
82 
83 void hfn(int id, float data[])
84 {
85  hfn_(&id,&data[0]);
86 }
87 
88 void hfnov(int id, float data[])
89 {
90  hfnov_(&id,&data[0]);
91 }
92 
93 void hfnt(int id)
94 {
95  hfnt_(&id);
96 }
97 
98 void hfithn(int id, char *chfun, char *chopt, int np, float par[],
99  float step[], float pmin[], float pmax[], float sigpar[], float *chi2)
100 {
101  hfithn_(&id, chfun, chopt, &np, par, step, pmin, pmax, sigpar, chi2,
102  strlen(chfun), strlen(chopt));
103 
104 }
105 
106 void hunpak(int histo,float contents[],char choice[], int num)
107 {
108  hunpak_(&histo,contents,choice,&num,strlen(choice));
109 }
110 
111 void hidopt( int id, char *chopt)
112 {
113  hidopt_( &id, chopt , strlen( chopt));
114 }
115 
116 void hpak(int histo,float contents[])
117 {
118  hpak_(&histo,contents);
119 }
120 
121 void hrget( int id, char *chfile, char *chopt)
122 {
123  hrget_( &id, chfile, chopt, strlen(chfile), strlen(chopt));
124 }
125 
126 void hldir(char dir[],char flag[])
127 {
128  hldir_(dir,flag,strlen(dir),strlen(flag));
129 }
130 
131 void hmdir(char dir[],char flag[])
132 {
133  hmdir_(dir,flag,strlen(dir),strlen(flag));
134 }
135 
136 void hcdir(char dir[],char flag[])
137 {
138  hcdir_(dir,flag,strlen(dir),strlen(flag));
139 }
140 
141 /*
142 void hplzon(int x, int y, int num, char *opt)
143 {
144  hplzon_(&x, &y, &num, opt, strlen(opt));
145 }
146 
147 void hplcon(int histonum, int x, int y)
148 {
149  hplcon_(&histonum, &x, &y);
150 }
151 */
152 
153 void hropen(int lun, char *name, const char*filename, const char*status, int stor,
154  int istat)
155 {
156  hropen_(&lun, name, filename, status, &stor, &istat, strlen(name),
157  strlen(filename), strlen(status));
158  /*warning the value of istat will be lost*/
159  return;
160 }
161 
162 void hrout(int num, int icycle, char*opt)
163 {
164  hrout_(&num, &icycle, opt, strlen(opt));
165  return;
166 }
167 
168 void hrend(char*filename)
169 {
170  hrend_(filename, strlen(filename));
171  return;
172 }
173 
174 
175 void hreset(int no, char* opt)
176 {
177  hreset_(&no, opt, strlen(opt));
178  return;
179 }
180 
181 void hbook2(int no, char*name, int xbins, float xmin, float xmax, int ybins,
182  float ymin, float ymax, float weight)
183 {
184  hbook2_(&no, name, &xbins, &xmin, &xmax, &ybins,&ymin, &ymax, &weight, strlen(name));
185 }
186 
187 
188 void hbook1(int no, char*name, int nbins, float min, float max, float v)
189 {
190  hbook1_(&no, name, &nbins, &min, &max, &v, strlen(name));
191 }
192 
193 void hbnt(int id,char *CHTITL,char *CHOPT)
194 {
195  hbnt_(&id,CHTITL,CHOPT,strlen(CHTITL),strlen(CHOPT));
196 }
197 
198 void hbname(int id, const char *CHBLOK,void *VAR, const char *CHFORM)
199 {
200  hbname_(&id,CHBLOK,VAR,CHFORM,strlen(CHBLOK),strlen(CHFORM));
201 }
202 
203 /* assume CHTAGS is space padded such that each tag is strlen(CHTAGS)/NVAR characters */
204 void hbookn(int id, char *CHTITL,int NVAR, char *CHRZPA,int NWBUFF,char*CHTAGS)
205 {
206  if(((strlen(CHTAGS)/NVAR)*NVAR)!=strlen(CHTAGS)){
207  fprintf(stderr,"%s:%d Bad string length passed to hbookn()\n",__FILE__,__LINE__);
208  }
209  hbookn_(&id,CHTITL,&NVAR,CHRZPA,&NWBUFF,CHTAGS,strlen(CHTITL),strlen(CHRZPA),strlen(CHTAGS)/NVAR);
210 }
211 
212 void hfill(int no, float xvalue, float yvalue, float weight)
213 {
214  hfill_(&no, &xvalue, &yvalue, &weight);
215 }
216 
217 /* Wrapper for hbook histogram operations subroutine */
218 void hopera(int id1,char *oper,int id2, int id3,float scale1,float scale2){
219 
220  hopera_(&id1,oper,&id2,&id3,&scale1,&scale2,strlen(oper));
221 
222 }
223 
224 /* Minuit routines */
225 void mninit(int IRD,int IWR,int ISAV){
226  mninit_(&IRD,&IWR,&ISAV);
227 }
228 
229 void mnseti(char *CTITLE){
230  mnseti_(CTITLE,strlen(CTITLE));
231 }
232 
233 void mnparm(int NUM,char *CHNAM,double STVAL,double STEP,double BND1,double BND2,int *IERR){
234  int err;
235  mnparm_(&NUM,CHNAM,&STVAL,&STEP,&BND1,&BND2,&err,strlen(CHNAM));
236  if(IERR)*IERR=err;
237 }
238 
239 void mnpars(char *CHSTR,int *ICOND){
240  int cond;
241  mnpars_(CHSTR,&cond,strlen(CHSTR));
242  if(ICOND)*ICOND=cond;
243 }
244 
245 void mnexcm(void *FCN,char *CHCOM,double ARGLIS[],int NARG,int *IERRFLAG,void *FUTIL){
246  int err;
247  mnexcm_(FCN,CHCOM,ARGLIS,NARG,&err,FUTIL,strlen(CHCOM));
248  if(IERRFLAG)*IERRFLAG=err;
249 }
250 
251 void mncomd(void *FCN,char *CHSTR,int *ICONDN,void *FUTIL){
252  int cond;
253  mncomd_(FCN,CHSTR,&cond,FUTIL,strlen(CHSTR));
254  if(ICONDN)*ICONDN=cond;
255 }
256 
257 void mnpout(int NUM,char *CHNAM,double *VAL,double *ERROR,double *BND1,double *BND2,int *IVARBL)
258 {
259  mnpout_(&NUM,CHNAM,VAL,ERROR,BND1,BND2,IVARBL);
260 }
261 
262 void mnerrs(int NUM, double *EPLUS, double *EMINUS,double *EPARAB, double *GLOBCC)
263 {
264  mnerrs_(&NUM,EPLUS,EMINUS,EPARAB,GLOBCC);
265 }
float hstati(int id, int icase, char *choice, int num)
void hbname(int id, const char *CHBLOK, void *VAR, const char *CHFORM)
void hmdir(char dir[], char flag[])
void mnparm(int NUM, char *CHNAM, double STVAL, double STEP, double BND1, double BND2, int *IERR)
void hrput(int id, char *file, char *opt)
void hropen(int lun, char *name, char *filename, char *status, int stor, int istat)
float hx(int id, float x)
void hreset(int no, char *opt)
void hbookn(int id, char *CHTITL, int NVAR, char *CHRZPA, int NWBUFF, char *CHTAGS)
void hfnt(int id)
Double_t x[NCHANNELS]
Definition: st_tw_resols.C:39
void hlimit(int size)
TString filename
void hopera(int id1, char *oper, int id2, int id3, float scale1, float scale2)
void hbarx(int id)
long int flag
Definition: grkuta.cc:73
void hbnt(int id, char *CHTITL, char *CHOPT)
void hfithn(int id, char *chfun, char *chopt, int np, float par[], float step[], float pmin[], float pmax[], float sigpar[], float *chi2)
float hx_(int *id, float *x)
float hstati_(int *id, int *icase, char *choice, int *num, int choicesize)
#define ERROR
Definition: mc2coda.h:7
void hf2(int id, float data1, float data2, float weight)
void hrin(int id, int icycle, int iofset)
void hfnov(int id, float data[])
static pthread_cond_t cond
void hf1e(int id, float data, float weight, float error)
void hf1(int id, float data, float weight)
void hfn(int id, float data[])
void hunpak(int histo, float contents[], char choice[], int num)
void mnpout(int NUM, char *CHNAM, double *VAL, double *ERROR, double *BND1, double *BND2, int *IVARBL)
void hrout(int num, int icycle, char *opt)
void mnseti(char *CTITLE)
void mninit(int IRD, int IWR, int ISAV)
void hxi(int id, float x, int *bin)
void hdelet(int id)
void hlimap(int size, char *name)
void mnpars(char *CHSTR, int *ICOND)
void hidopt(int id, char *chopt)
float hsum(int id)
void hbook1(int no, char *name, int nbins, float min, float max, float v)
void hrend(char *filename)
void mnexcm(void *FCN, char *CHCOM, double ARGLIS[], int NARG, int *IERRFLAG, void *FUTIL)
void mnerrs(int NUM, double *EPLUS, double *EMINUS, double *EPARAB, double *GLOBCC)
Double_t ymin
Definition: bcal_hist_eff.C:89
void hldir(char dir[], char flag[])
void mncomd(void *FCN, char *CHSTR, int *ICONDN, void *FUTIL)
Double_t ymax
Definition: bcal_hist_eff.C:91
void hpak(int histo, float contents[])
TDirectory * dir
Definition: bcal_hist_eff.C:31
void hcdir(char dir[], char flag[])
void hbook2(int no, char *name, int xbins, float xmin, float xmax, int ybins, float ymin, float ymax, float weight)
void hrget(int id, char *chfile, char *chopt)
void hfill(int no, float xvalue, float yvalue, float weight)