#include #include #include #include #include #include "fit_param.h" #define FLOAT_TYPE 1 #define INT_TYPE 2 #define SHORT_INT_TYPE 3 #define ARRAY_FLOAT_TYPE 4 #define ARRAY_INT_TYPE 5 #define ARRAY_SHORT_INT_TYPE 6 #define PI180 0.01745329252 std::string fit_param::numbers[MAX_NUMBER]; float fit_param::tres; float fit_param::tcoin; float fit_param::dlim; float fit_param::tlim; short int fit_param::nselall=0; float fit_param::gcon0; float fit_param::dw4hit; float fit_param::dwfit; float fit_param::clusgtheta0; float fit_param::clusgthetaplus; float fit_param::clusgthetaminus; float fit_param::clusgdirweight; short int fit_param::np; float * fit_param::cdwall; float * fit_param::gdiff; float fit_param::lastdiff; float * fit_param::gfrac; float * fit_param::clustheta0; float * fit_param::clusthetaplus; float * fit_param::clusthetaminus; float * fit_param::clusdirweight; float fit_param::lastfrac; float fit_param::bgrid; float fit_param::oc0; float fit_param::obgdiff; float fit_param::blastdiff; float fit_param::obgfrac; float fit_param::cbgfrac; float fit_param::obrmin; float fit_param::obrstop; float fit_param::bdwall; float fit_param::bdwfit; float fit_param::cgrid; float fit_param::tim0; float * fit_param::time; float * fit_param::rmin; float * fit_param::rstop; float fit_param::blastfrac; float fit_param::opangle; float fit_param::omangle; float fit_param::cc0; float fit_param::bc0; float fit_param::cpangle; float fit_param::bpangle; float fit_param::cmangle; float fit_param::bmangle; float fit_param::cbgdiff; float fit_param::cbrmin; float fit_param::cbrstop; // ************************************************************* // * identify up to two key words and read into appropriate * // * array or variable * // ************************************************************* char fit_param::parse(char *line,unsigned char length, const char *key1, const char *key2, const char *key3, char type,void *var) { unsigned char key_length1=strlen(key1),key_length2=strlen(key2); unsigned char key_length3=strlen(key3),pos1,pos2,pos3,ar,nl; // if array, find array position using for number words // adjust variable pointer accordingly (assume float or int) if ((type==ARRAY_FLOAT_TYPE) || (type==ARRAY_INT_TYPE) || (type==ARRAY_SHORT_INT_TYPE)) for(ar=0; ar0) { for(pos1=0; pos1=length) return(0); // return, if not found } else pos1=0; // check key2, if not an empty string if (key_length2>0) { for(pos2=0; pos2=length) return(0); // return, if not found } else pos2=0; // check key2, if not an empty string if (key_length3>0) { for(pos3=0; pos3=length) return(0); // return, if not found } else pos3=0; // reset string pointer to after both keywords if (pos1>pos2) { if (pos1>pos3) { line+=pos1; length-=pos1; } else { line+=pos3; length-=pos3; } } else { if (pos2>pos3) { line+=pos2; length-=pos2; } else { line+=pos3; length-=pos3; } } // find end of description for(pos1=0; (pos1=length) return(0); // eliminate empty spaces for(; (pos1=length) return(0); line+=pos1; length-=pos1; // check none for(pos3=0; pos3='0') && (line[pos1]<='9'))); pos1++); // end the string at the end of the number if (pos110) np=10; cdwall=new float[np]; time=new float[np]; gdiff=new float[np]; gfrac=new float[np]; rmin=new float[np]; rstop=new float[np]; clustheta0=new float[np]; clusthetaplus=new float[np]; clusthetaminus=new float[np]; clusdirweight=new float[np]; for(ar=0; ar0) printf("Initial Clusfit angle positive deviation: %8.2f deg\n", (acos(clusgtheta0-sqrt(0.5/clusgthetaminus))- acos(clusgtheta0))/PI180); else printf("Initial Clusfit angle positive deviation: none\n"); if (clusgthetaplus>0) printf("Initial Clusfit angle negative deviation: %8.2f deg\n", (acos(clusgtheta0)- acos(clusgtheta0+sqrt(0.5/clusgthetaplus)))/PI180); else printf("Initial Clusfit angle negative deviation: none\n"); } printf("Initial Clusfit angle goodness weight: %8.2f\n", clusgdirweight); printf("Number of Clusfit passes: %5d\n",np); for(ar=0; ar0) printf("%8.2f deg\n",(acos(clustheta0[ar]-sqrt(0.5/clusthetaminus[ar]))- acos(clustheta0[ar]))/PI180); else printf(" none\n"); printf("%s Clusfit angle negative deviation:",numbers[ar].c_str()); printspace(9-strlen(numbers[ar].c_str())); if (clusthetaplus[ar]>0) printf("%8.2f deg\n",(acos(clustheta0[ar])- acos(clustheta0[ar]+sqrt(0.5/clusthetaplus[ar])))/PI180); else printf(" none\n"); printf("%s Clusfit angle goodness weight:",numbers[ar].c_str()); printspace(14-strlen(numbers[ar].c_str())); printf("%6.2f\n",clusdirweight[ar]); } printf("\n"); printf("BONSAI Parameters\n"); printf("-------------------------------------------------------\n"); printf("BONSAI grid constant: %8.2f cm\n",bgrid); printf("Minimum wall distance for BONSAI vertex: %8.2f cm\n",bdwfit); printf("Wall distance to invoke fine search: %8.2f cm\n",bdwall); printf("Initial Cherenkov cone opening angle: %8.2f deg\n", acos(bc0)/PI180); if (bmangle>0) printf("Initial Cherenkov angle positive deviation:%8.2f deg\n", (acos(bc0-sqrt(0.5/bmangle))-acos(bc0))/PI180); else printf("Initial Cherenkov angle positive deviation: none\n"); if (bpangle>0) printf("Initial Cherenkov angle negative deviation:%8.2f deg\n", (acos(bc0)-acos(bc0+sqrt(0.5/bpangle)))/PI180); else printf("Initial Cherenkov angle negative deviation: none\n"); printf("Final minimum likelihood difference to skim:%7.2f\n",blastdiff); printf("Final likelihood skim fraction: %8.2f\n",blastfrac); printf("Coarse Search Parameters-------------------------------\n"); printf("Coarse search Cherenkov cone opening angle:%8.2f deg\n", acos(oc0)/PI180); if (omangle>0) printf("Coarse search positive angle deviation: %8.2f deg\n", (acos(oc0-sqrt(0.5/omangle))-acos(oc0))/PI180); else printf("Coarse search positive angle deviation: none\n"); if (opangle>0) printf("Coarse search negative angle deviation: %8.2f deg\n", (acos(oc0)-acos(oc0+sqrt(0.5/opangle)))/PI180); else printf("Coarse search negative angle deviation: none\n"); printf("Coarse search minimum likelihood diff to skim:%5.2f\n",obgdiff); printf("Coarse search likelihood skim fraction: %8.2f\n",obgfrac); printf("Coarse search start radius: %8.2f cm\n",obrmin); printf("Coarse search stop radius: %8.2f cm\n",obrstop); printf("Fine Search Parameters---------------------------------\n"); printf("Fine search Cherenkov cone opening angle: %8.2f deg\n", acos(cc0)/PI180); if (cmangle>0) printf("Fine search positive angle deviation: %8.2f deg\n", (acos(cc0-sqrt(0.5/cmangle))-acos(cc0))/PI180); else printf("Fine search positive angle deviation: none\n"); if (cpangle>0) printf("Fine search negative angle deviation: %8.2f deg\n", (acos(cc0)-acos(cc0+sqrt(0.5/cpangle)))/PI180); else printf("Fine search negative angle deviation: none"); printf("Fine search minimum likelihood diff to skim:%7.2f\n",cbgdiff); printf("Fine search likelihood skim fraction: %8.2f\n",cbgfrac); printf("Fine search search minimum radius: %8.2f cm\n",cbrmin); printf("Fine search search stop radius: %8.2f cm\n",cbrstop); }