示例#1
0
void PrintHistograms(TString fname) {
    TH1D *h[4]; TH1D *he[4];
    double min[] = {-8.0,1.0,0.0,1400.0}; double max[] = {2.0,91.0,1.0,4000.0};
    double emin[] = {0.0,0.0,0.0,0.0}; double emax[] = {0.5,10.0,0.05,100.0};
    for (int i=0;i<4;i++) {
        stringstream ss; ss << i; TString name = "c" + TString(ss.str());
        h[i] = new TH1D(name,"TAGH timewalk: "+name+";"+name+";counters",100,min[i],max[i]);
        name = "e_c" + TString(ss.str());
        he[i] = new TH1D(name,"TAGH timewalk: "+name+";"+name+";counters"+";"+name+";counters",100,emin[i],emax[i]);
    }
    TH1D hChisq("Chisq","TAGH timewalk: chi-square / Ndf;chi-square / Ndf;counters",150,0.0,150.0);
    ifstream fin(fname);
    for (int i=0;i<274;i++) { // counters
        char sep;int n,ndf; double chisq,c[4],dc[4];
        fin >> n >> sep >> ndf >> sep >> chisq;
        for (int j=0;j<4;j++) fin >> sep >> c[j];
        for (int j=0;j<4;j++) fin >> sep >> dc[j];
        if (chisq==0.0) continue;
        for (int j=0;j<4;j++) h[j]->Fill(c[j]);
        for (int j=0;j<4;j++) he[j]->Fill(dc[j]);
        hChisq.Fill(chisq/ndf);
    }
    fin.close();
    for (int i=0;i<4;i++) {PrintHistogram(*h[i]);PrintHistogram(*he[i]);delete h[i];delete he[i];}
    PrintHistogram(hChisq);
}
示例#2
0
文件: bd.c 项目: akipta/hobbyutil
void PrintResults(void)
{
    int ix;
#ifdef DEBUG
    fprintf(ofp, "Debug dump of globals global struct:\n");
    fprintf(ofp, "  files_are_different = %d\n", globals.files_are_different);
    fprintf(ofp, "  file1_size          = %d\n", globals.file1_size);
    fprintf(ofp, "  file2_size          = %d\n", globals.file2_size);
    fprintf(ofp, "  compare_size        = %d\n", globals.compare_size);
    fprintf(ofp, "  filename1           = '%s'\n", globals.filename1);
    fprintf(ofp, "  filename2           = '%s'\n", globals.filename2);
    fprintf(ofp, "  rng_size            = %d\n", globals.rng_size);
    fprintf(ofp, "  rng_numel           = %d\n", globals.rng_numel);
    fprintf(ofp, "Debug dump of range array:\n");
    for (ix = 0; ix < globals.rng_numel; ix++) {
        fprintf(ofp, "  %8d %8d\n", globals.rng[ix].start, globals.rng[ix].end);
    }
#endif
    if (histogram) {
        PrintHistogram();
    } else {
        PrintHeader();
        PrintSeparator();
        for (ix = 0; ix < globals.rng_numel; ix++) {
            PrintRange(globals.rng[ix].start, globals.rng[ix].end);
        }
    }
}
int main(int argc, char **argv) {

    long *Histogram ;
    int P, q ;

    printf("Test PrintHistogram: ");
    P = 68 ; /* number of  processors >= 1 */

    Histogram = (long *) malloc((P+1)* sizeof(long)) ;

    if ( Histogram == NULL ){
        printf("Error\n") ;
        exit(1);
    }

    /* Initialise histogram*/
    for (q=0; q<P/2; q++) 
        Histogram[q] = q ;
    for (q=P/2; q<=P; q++) 
        Histogram[q] = 0 ;

    printf("\n");
    printf("*** Histogram for processor q should be q\n");
    PrintHistogram(0, P, Histogram) ;

    printf("OK\n") ;
    exit(0);

} /* end main */
示例#4
0
文件: bindexhist.c 项目: alecw/TS
int main(int argc, char *argv[]) 
{
	char *indexFileName=NULL;
	char *fastaFileName=NULL;
	int numThreads = 1;
	int whichStrand = 0;
	int space = NTSpace;
	int c;
	RGBinary rg;
	RGIndex index;

	while((c = getopt(argc, argv, "f:i:n:s:A:h")) >= 0) {
		switch(c) {
			case 'f': fastaFileName=strdup(optarg); break;
			case 'h': return PrintUsage();
			case 'i': indexFileName=strdup(optarg); break;
			case 's': whichStrand=atoi(optarg); break;
			case 'n': numThreads=atoi(optarg); break;
			case 'A': space=atoi(optarg); break;
			default: fprintf(stderr, "Unrecognized option: -%c\n", c); return 1;
		}
	}

	if(1 == argc || argc != optind) {
		return PrintUsage();
	}

	if(NULL == indexFileName) {
		PrintError(Name, "indexFileName", "Command line option", Exit, InputArguments);
	}
	if(NULL == fastaFileName) {
		PrintError(Name, "fastaFileName", "Command line option", Exit, InputArguments);
	}

	assert(whichStrand == BothStrands || whichStrand == ForwardStrand || whichStrand == ReverseStrand);

	/* Read in the rg binary file */
	RGBinaryReadBinary(&rg, space, fastaFileName);

	/* Read the index */
	RGIndexRead(&index, indexFileName);

	assert(index.space == rg.space);

	fprintf(stderr, "%s", BREAK_LINE);
	PrintHistogram(&index, 
			&rg, 
			whichStrand,
			numThreads);
	fprintf(stderr, "%s", BREAK_LINE);

	fprintf(stderr, "%s", BREAK_LINE);
	fprintf(stderr, "Cleaning up.\n");
	/* Delete the index */
	RGIndexDelete(&index);
	/* Delete the rg */
	RGBinaryDelete(&rg);
	fprintf(stderr, "%s", BREAK_LINE);
	fprintf(stderr, "Terminating successfully!\n");
	fprintf(stderr, "%s", BREAK_LINE);

	return 0;
}
示例#5
0
文件: parselog.c 项目: chutzimir/coda
static bool PrintRvmResEvent()
{
    int sum=0;
    SmonViceId Vice;
    unsigned long Time;
    unsigned long VolID;
    FileResStats FileRes;
    DirResStats DirRes;
    long lshsize;
    HistoElem *LogSizeHisto;
    long lmhsize;
    HistoElem *LogMaxHisto;
    ResConflictStats Conflicts;
    long shhsize;
    HistoElem *SuccHierHist;
    long fhhsize;
    HistoElem *FailHierHist;
    ResLogStats ResLog;
    long vlhsize;
    HistoElem *VarLogHisto;
    long lssize;
    HistoElem *LogSize;
    sum = ReadRvmResEvent(&Vice, &Time, &VolID, &FileRes, &DirRes,
			  &lshsize, &LogSizeHisto, 
			  &lmhsize, &LogMaxHisto, &Conflicts,
			  &shhsize, &SuccHierHist, 
			  &fhhsize, &FailHierHist, &ResLog,
			  &vlhsize, &VarLogHisto, &lssize, &LogSize);

    if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD RESOLUTION RECORD ****");

    printf("%-12s: ","SRVRVMRES");
    PrintViceId(&Vice);
    PrintDecimal(Time);
    PrintHex(VolID);

    printf("\nGeneral:\n");
    PrintDecimal(ResLog.NumWraps);
    PrintDecimal(ResLog.NumAdmGrows);
    PrintDecimal(ResLog.NumVAllocs);
    PrintDecimal(ResLog.NumVFrees);
    PrintDecimal(ResLog.Highest);

    printf("\nFile:\n");
    PrintDecimal(FileRes.Resolves);
    PrintDecimal(FileRes.NumSucc);
    PrintDecimal(FileRes.NumConf);
    PrintDecimal(FileRes.RuntForce);
    PrintDecimal(FileRes.WeakEq);
    printf("\n");
    PrintDecimal(FileRes.NumReg);
    PrintDecimal(FileRes.UsrResolver);
    PrintDecimal(FileRes.SuccUsrResolver);
    PrintDecimal(FileRes.PartialVSG);

    printf("\nDir:\n");
    PrintDecimal(DirRes.Resolves);
    PrintDecimal(DirRes.NumSucc);
    PrintDecimal(DirRes.NumConf);
    PrintDecimal(DirRes.NumNoWork);
    PrintDecimal(DirRes.Problems);
    PrintDecimal(DirRes.PartialVSG);
    printf("\n");

    PrintHistogram(lshsize,LogSizeHisto);
    PrintHistogram(lmhsize,LogMaxHisto);

    printf("Conflicts:\n");
    PrintDecimal(Conflicts.NameName);
    PrintDecimal(Conflicts.RemoveUpdate);
    PrintDecimal(Conflicts.UpdateUpdate);
    PrintDecimal(Conflicts.Rename);
    PrintDecimal(Conflicts.LogWrap);
    PrintDecimal(Conflicts.Other);
    printf("\n");

    PrintHistogram(shhsize,SuccHierHist);
    PrintHistogram(fhhsize,FailHierHist);

    PrintHistogram(vlhsize,VarLogHisto);
    PrintHistogram(lssize,LogSize);

    if (sum) return mtrue;
    else return mfalse;

}