--- calo/flight/FUTILITIES/macros/FCaloADC2MIP.cxx 2006/03/22 15:07:47 1.1.1.1 +++ calo/flight/FUTILITIES/macros/FCaloADC2MIP.cxx 2006/06/30 12:08:13 1.3 @@ -1,12 +1,14 @@ // //- Emiliano Mocchiutti // -// FCaloADC2MIP.c version 1.01 (2006-03-20) +// FCaloADC2MIP.c version 1.02 (2006-03-31) // // The only input needed is // // Changelog: // +// 1.01 - 1.02 (2006-03-31): Added FCaloALIG2DAT and FCaloREADALIG to create and read the calorimeter alignment data file. +// // 1.00 - 1.01 (2006-03-20): First flight version, read single yoda file. // // 0.00 - 1.00 (2006-03-20): Clone of CaloADC2MIP v4r01. @@ -3027,3 +3029,70 @@ }; fclose(f); } + +void FCaloALIG2DAT(TString txtple){ +// clevel1_.xalig = 121.1; +// clevel1_.yalig = 119.8; +// clevel1_.zalig = -263.1; + char value[256]; + Int_t ixalig; + Int_t iyalig; + Int_t izalig; + Int_t iemip; + Float_t xalig; + Float_t yalig; + Float_t zalig; + Float_t emip; + // + FILE *f; + f = fopen(txtple.Data(),"wb"); + // + printf("\n Insert parameters in microns \n"); + printf("\n Insert the x alignment parameter: \n"); + cin.getline(value,256); + ixalig = atoi(value); + xalig = (Float_t)ixalig/1000.; + fwrite(&xalig,sizeof(xalig),1,f); + printf(" xalig = %f mm\n",xalig); + // + printf("\n Insert the y alignment parameter: \n"); + cin.getline(value,256); + iyalig = atoi(value); + yalig = (Float_t)iyalig/1000.; + fwrite(&yalig,sizeof(yalig),1,f); + printf(" yalig = %f mm\n",yalig); + // + printf("\n Insert the z alignment parameter: \n"); + cin.getline(value,256); + izalig = atoi(value); + zalig = (Float_t)izalig/1000.; + fwrite(&zalig,sizeof(zalig),1,f); + printf(" zalig = %f mm\n",zalig); + // + printf("\n Insert the signal/noise threshold (times 1000): \n"); + cin.getline(value,256); + iemip = atoi(value); + emip = (Float_t)iemip/1000.; + fwrite(&emip,sizeof(emip),1,f); + printf(" emip = %f mip \n",emip); + // + fclose(f); +} + +void FCaloREADALIG(TString txtple){ + FILE *f; + f = fopen(txtple.Data(),"rb"); + Float_t mip = 0.; + fread(&mip,sizeof(mip),1,f); + printf(" xalig = %f \n",mip); + mip = 0.; + fread(&mip,sizeof(mip),1,f); + printf(" yalig = %f \n",mip); + mip = 0.; + fread(&mip,sizeof(mip),1,f); + printf(" zalig = %f \n",mip); + mip = 0.; + fread(&mip,sizeof(mip),1,f); + printf(" signal threshold = %f \n",mip); + fclose(f); +}