00001
00002
00003 #include "TPadRpcParam.h"
00004 #include "TGo4Log.h"
00005
00006 #include "TGo4Version.h"
00007 #if __GO4BUILDVERSION__ > 40502
00008 #include "go4iostream.h"
00009 #else
00010 #include "Riostream.h"
00011 #endif
00012
00013 #include "MBSUNPACK/TMbsCrateEvent.h"
00014
00015 #define NB_DIGITS_PAD_INDEXES 5
00016 #define NB_DIGITS_PAD_OFFSETS 9
00017
00018
00019 #define DEBUG 0
00020 #define TDC_FOR_OFFSET_CAEN -1
00021 #define CH_FOR_OFFSET_CAEN -1
00022 #define TDC_FOR_OFFSET_VFTX -1
00023 #define CH_FOR_OFFSET_VFTX -1
00024
00025 #define TDC_FOR_DIAMOND_CAEN -1
00026 #define CH_FOR_DIAMOND_CAEN -1
00027 #define TDC_FOR_DIAMOND_VFTX -1
00028 #define CH_FOR_DIAMOND_VFTX -1
00029
00030 #define RATE_INT_DURATION -1
00031 #define RATE_INT_STEP -1
00032
00033 #define TDC_PAD 0
00034 #define RPC_NAME_PAD ""
00035 #define RPC_POSX_PAD 0.0
00036 #define RPC_POSY_PAD 0.0
00037 #define RPC_POSZ_PAD 0.0
00038 #define NB_PADS_X 0 // Nb of pads along X axis for the beam profile monitor
00039 #define NB_PADS_Y 0 // Nb of pads along Y axis for the beam profile monitor
00040 #define PAD_SIZE_X 0
00041 #define PAD_SIZE_Y 0
00042 #define ORIENTATION 0
00043 #define TRIGGER_SELECTION -1
00044
00045 #define NOISY_PAD 0
00046 #define DEAD_PAD 0
00047 #define PADS_TOT_TDC 0
00048 #define PADS_TOT_CHA 0
00049 #define PADS_TIME_TDC 0
00050 #define PADS_TIME_CHA 0
00051
00052 #define PADS_OFFSET 0
00053 #define PADS_TOT_GAIN 1
00054 #define PADS_TOT_OFFS 0
00055
00056
00057 #define MATCHING_OFFSET 0
00058
00059
00060 TPadRpcParam::TPadRpcParam(const char* name) : TGo4Parameter(name)
00061 {
00062 ReadOptions();
00063 if( 0 < uNbPadsX && 0 < uNbPadsY )
00064 {
00065
00066 PrintOptions();
00067 }
00068 }
00069
00070
00071 TPadRpcParam::~TPadRpcParam()
00072 {
00073 }
00074
00075 Bool_t TPadRpcParam::ReadOptions(){
00076
00077 uDebug = DEBUG;
00078 iOffsetTdcCaen = TDC_FOR_OFFSET_CAEN;
00079 iOffsetChannelCaen = CH_FOR_OFFSET_CAEN;
00080 iOffsetTdcVFTX = TDC_FOR_OFFSET_VFTX;
00081 iOffsetChannelVFTX = CH_FOR_OFFSET_VFTX;
00082
00083 iDiamondTdcCaen = TDC_FOR_DIAMOND_VFTX;
00084 iDiamondChannelCaen = CH_FOR_DIAMOND_CAEN;
00085 iDiamondTdcVFTX = TDC_FOR_DIAMOND_VFTX;
00086 iDiamondChannelVFTX = CH_FOR_DIAMOND_VFTX;
00087
00088 iRateIntegrationDuration = RATE_INT_DURATION;
00089 iRateIntegrationStep = RATE_INT_STEP;
00090
00091
00092 uTdcTypePad = TDC_PAD;
00093 sPadRpcName = RPC_NAME_PAD;
00094 dPadRpcPosX = RPC_POSX_PAD;
00095 dPadRpcPosY = RPC_POSY_PAD;
00096 dPadRpcPosZ = RPC_POSZ_PAD;
00097 uNbPadsX = NB_PADS_X;
00098 uNbPadsY = NB_PADS_Y;
00099 dPadSizeX = PAD_SIZE_X;
00100 dPadSizeY = PAD_SIZE_Y;
00101 uOrientation = ORIENTATION;
00102 iTriggerSelection = TRIGGER_SELECTION;
00103
00104 for( Int_t iPadX = 0; iPadX < NB_PADS_MAX_X; iPadX ++)
00105 for( Int_t iPadY = 0; iPadY < NB_PADS_MAX_Y; iPadY ++)
00106 {
00107 uTdcPadType[iPadY][iPadX] = TDC_PAD;
00108 uTdcPadNoisy[iPadY][iPadX] = NOISY_PAD;
00109 uTdcPadDead[iPadY][iPadX] = DEAD_PAD;
00110 uTdcPadTime[iPadY][iPadX] = PADS_TIME_TDC;
00111 uChannelPadTime[iPadY][iPadX] = PADS_TIME_CHA;
00112 uTdcPadTot[iPadY][iPadX] = PADS_TOT_TDC;
00113 uChannelPadTot[iPadY][iPadX] = PADS_TOT_CHA;
00114
00115 dOffsetList[iPadY][iPadX] = PADS_OFFSET;
00116 dToTGainList[iPadY][iPadX] = PADS_TOT_GAIN;
00117 dTotOffsetList[iPadY][iPadX] = PADS_TOT_OFFS;
00118
00119 dOffsetMatching[iPadY][iPadX] = MATCHING_OFFSET;
00120 }
00121
00122 TString sOptionFileName = "./PadRpc_options.txt";
00123 TString sName = GetName();
00124
00125
00126 Bool_t bFilenameFound = kFALSE;
00127 fstream optionFilenameFile("./Option_files.txt", ios::in);
00128
00129 if( optionFilenameFile.fail() == true)
00130 {
00131 cout<<"************************************************************************"<<endl;
00132 cout<<" File with option filename for TPadRpcParam "<<GetName()<<" not found: using the default value ";
00133 cout<<sOptionFileName<<endl;
00134 }
00135 else
00136 {
00137 TString line;
00138
00139
00140 while( !optionFilenameFile.eof() )
00141 {
00142 line.ReadLine(optionFilenameFile, kFALSE);
00143
00144 if(line(0) == '#' || line(0) == '*'||
00145 (line(0) == '/' && line(1) == '/') )
00146 {
00147
00148 ;
00149 }
00150 else if( line.Contains("padrpc")==kTRUE)
00151 {
00152 sOptionFileName = ((TString)line(11, line.Sizeof()-11 ));
00153 cout<<"************************************************************************"<<endl;
00154 cout<<"Using "<<sOptionFileName<<" as source for the options of TPadRpcParam "<<GetName()<<" step"<<endl;
00155 bFilenameFound = kTRUE;
00156 break;
00157 }
00158 }
00159 if( optionFilenameFile.eof() && kFALSE == bFilenameFound )
00160 {
00161 cout<<"************************************************************************"<<endl;
00162 cout<<"Field for TPadRpcParam "<<GetName()<<" step not found in File with option filename => Using "<<sOptionFileName<<endl;
00163 }
00164 }
00165
00166 fstream setupFile(sOptionFileName, ios::in);
00167
00168
00169 if( setupFile.fail() == true)
00170 {
00171 TGo4Log::Error("TPadRpcParam %s: Setup file %s can not be opened or is missing.", GetName(), sOptionFileName.Data());
00172 TGo4Log::Error("=> Using default values!");
00173 }
00174 else
00175 {
00176 TGo4Log::Info("TPadRpcParam %s: Load Setup file %s.", GetName(), sOptionFileName.Data());
00177 TString line;
00178
00179
00180 while( !setupFile.eof() )
00181 {
00182 line.ReadLine(setupFile, kFALSE);
00183 if(1 == uDebug)
00184 cout<<line<<endl;
00185
00186 if(line(0) == '#' || line(0) == '*')
00187 {
00188
00189 ;
00190 }
00191 else if(line.Contains("debug")==kTRUE)
00192 {
00193 uDebug = ((TString)line(5,10)).Atoi();
00194 if(1 == uDebug)
00195 cout<<"Debug ON!!!!!!"<<endl;
00196 }
00197 else if(line.Contains("tdcoffscaen")==kTRUE)
00198 {
00199 iOffsetTdcCaen = ((TString)line(12,10)).Atoi();
00200 if( iOffsetTdcCaen > MAX_1290)
00201 {
00202 cout<<"Error: CAEN tdc for offset higher than max allowed -> replaced by default value: ";
00203 cout<<TDC_FOR_OFFSET_CAEN<<endl;
00204 iOffsetTdcCaen = TDC_FOR_OFFSET_CAEN;
00205 }
00206 }
00207 else if(line.Contains("chaoffscaen")==kTRUE)
00208 {
00209 iOffsetChannelCaen = ((TString)line(12,10)).Atoi();
00210 if( iOffsetChannelCaen > T1290Data::NumChan)
00211 {
00212 cout<<"Error: CAEN channel for offset higher than max allowed -> replaced by default value: ";
00213 cout<<CH_FOR_OFFSET_CAEN<<endl;
00214 iOffsetChannelCaen = CH_FOR_OFFSET_CAEN;
00215 }
00216 }
00217 else if(line.Contains("tdcoffsvftx")==kTRUE)
00218 {
00219 iOffsetTdcVFTX = ((TString)line(12,10)).Atoi();
00220 if( iOffsetTdcVFTX > MAX_FPGA_TDC)
00221 {
00222 cout<<"Error: VFTX tdc for offset higher than max allowed -> replaced by default value: ";
00223 cout<<TDC_FOR_OFFSET_VFTX<<endl;
00224 iOffsetTdcVFTX = TDC_FOR_OFFSET_VFTX;
00225 }
00226 }
00227 else if(line.Contains("chaoffsvftx")==kTRUE)
00228 {
00229 iOffsetChannelVFTX = ((TString)line(12,10)).Atoi();
00230 if( iOffsetChannelVFTX > FPGA_TDC_NBCHAN)
00231 {
00232 cout<<"Error: VFTX channel for offset higher than max allowed -> replaced by default value: ";
00233 cout<<CH_FOR_OFFSET_VFTX<<endl;
00234 iOffsetChannelVFTX = CH_FOR_OFFSET_VFTX;
00235 }
00236 }
00237 else if(line.Contains("tdcdiamcaen")==kTRUE)
00238 {
00239 iDiamondTdcCaen = ((TString)line(12,10)).Atoi();
00240 if( iDiamondTdcCaen > MAX_1290)
00241 {
00242 cout<<"Error: CAEN tdc for diamond higher than max allowed -> replaced by default value: ";
00243 cout<<TDC_FOR_DIAMOND_CAEN<<endl;
00244 iDiamondTdcCaen = TDC_FOR_DIAMOND_CAEN;
00245 }
00246 }
00247 else if(line.Contains("chadiamcaen")==kTRUE)
00248 {
00249 iDiamondChannelCaen = ((TString)line(12,10)).Atoi();
00250 if( iDiamondChannelCaen > T1290Data::NumChan)
00251 {
00252 cout<<"Error: CAEN channel for diamond higher than max allowed -> replaced by default value: ";
00253 cout<<CH_FOR_DIAMOND_CAEN<<endl;
00254 iDiamondChannelCaen = CH_FOR_DIAMOND_CAEN;
00255 }
00256 }
00257 else if(line.Contains("tdcdiamvftx")==kTRUE)
00258 {
00259 iDiamondTdcVFTX = ((TString)line(12,10)).Atoi();
00260 if( iDiamondTdcVFTX > MAX_FPGA_TDC)
00261 {
00262 cout<<"Error: VFTX tdc for diamond higher than max allowed -> replaced by default value: ";
00263 cout<<TDC_FOR_DIAMOND_VFTX<<endl;
00264 iDiamondTdcVFTX = TDC_FOR_DIAMOND_VFTX;
00265 }
00266 }
00267 else if(line.Contains("chadiamvftx")==kTRUE)
00268 {
00269 iDiamondChannelVFTX = ((TString)line(12,10)).Atoi();
00270 if( iDiamondChannelVFTX > FPGA_TDC_NBCHAN)
00271 {
00272 cout<<"Error: VFTX channel for diamond higher than max allowed -> replaced by default value: ";
00273 cout<<CH_FOR_DIAMOND_VFTX<<endl;
00274 iDiamondChannelVFTX = CH_FOR_DIAMOND_VFTX;
00275 }
00276 }
00277 else if(line.Contains("rateintdur")==kTRUE)
00278 {
00279 iRateIntegrationDuration = ((TString)line(11,10)).Atoi();
00280 }
00281 else if(line.Contains("ratestep")==kTRUE)
00282 {
00283 iRateIntegrationStep = ((TString)line(11,10)).Atoi();
00284 if( iRateIntegrationStep < 2 )
00285 {
00286 cout<<"Rate step size smaller than Go4 minimal Hist. update step of 2s, set step size to 2s"<<endl;
00287 iRateIntegrationStep = 2;
00288 }
00289 if( iRateIntegrationDuration < iRateIntegrationStep )
00290 {
00291 cout<<"Rate step size smaller than rate integration size, set step size to integration size"<<endl;
00292 iRateIntegrationStep = iRateIntegrationDuration;
00293 }
00294 }
00295 else if(line.Contains("tdctypepad")==kTRUE)
00296 {
00297 uTdcTypePad = ((TString)line(13,10)).Atoi();
00298 }
00299 else if(line.Contains("padrpcname")==kTRUE)
00300 {
00301 sPadRpcName = ((TString)line(13,20));
00302 }
00303 else if(line.Contains("padrpcposx")==kTRUE)
00304 {
00305 dPadRpcPosX = ((TString)line(13,10)).Atof();
00306 }
00307 else if(line.Contains("padrpcposy")==kTRUE)
00308 {
00309 dPadRpcPosY = ((TString)line(13,10)).Atof();
00310 }
00311 else if(line.Contains("padrpcposz")==kTRUE)
00312 {
00313 dPadRpcPosZ = ((TString)line(13,10)).Atof();
00314 }
00315 else if(line.Contains("nbpadsx")==kTRUE)
00316 {
00317 uNbPadsX = ((TString)line(9,10)).Atoi();
00318 if( uNbPadsX > NB_PADS_MAX_X)
00319 {
00320 cout<<"Error: nb pads on x axis higher than max allowed for Pad RPC "<<uNbPadsX;
00321 cout<<" -> replaced by max value: ";
00322 cout<<NB_PADS_MAX_X<<endl;
00323 uNbPadsX = NB_PADS_MAX_X;
00324 }
00325 }
00326 else if(line.Contains("nbpadsy")==kTRUE)
00327 {
00328 uNbPadsY = ((TString)line(9,10)).Atoi();
00329 if( uNbPadsY > NB_PADS_MAX_Y)
00330 {
00331 cout<<"Error: nb pads on y axis higher than max allowed for Pad RPC "<<uNbPadsY;
00332 cout<<" -> replaced by max value: ";
00333 cout<<NB_PADS_MAX_Y<<endl;
00334 uNbPadsY = NB_PADS_MAX_Y;
00335 }
00336 }
00337 else if(line.Contains("padsizex")==kTRUE)
00338 {
00339 dPadSizeX = ((TString)line(12,10)).Atof();
00340 }
00341 else if(line.Contains("padsizey")==kTRUE)
00342 {
00343 dPadSizeY = ((TString)line(12,10)).Atof();
00344 }
00345 else if(line.Contains("orientation")==kTRUE)
00346 {
00347 uOrientation = ((TString)line(13,10)).Atoi();
00348 }
00349 else if(line.Contains("triggsel")==kTRUE)
00350 {
00351 iTriggerSelection = ((TString)line(9,10)).Atoi();
00352 }
00353 else if(line.Contains("padtdctype")==kTRUE)
00354 {
00355 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00356 {
00357 if( line.Contains( Form("padtdctype%u", temp_indexY)) ==kTRUE)
00358 {
00359 line = line(16,NB_DIGITS_PAD_INDEXES*NB_PADS_MAX_X);;
00360 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00361 {
00362 uTdcPadType[temp_indexY][temp_indexX] = ((TString)line(0,5)).Atoi();
00363 line = line = line(NB_DIGITS_PAD_INDEXES,NB_DIGITS_PAD_INDEXES*NB_PADS_MAX_X);
00364 }
00365 }
00366 line.ReadLine(setupFile, kFALSE);
00367 }
00368 }
00369 else if(line.Contains("noisypad")==kTRUE)
00370 {
00371 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00372 {
00373 if( line.Contains( Form("noisypad%u", temp_indexY)) ==kTRUE)
00374 {
00375 line = line(16,NB_DIGITS_PAD_INDEXES*NB_PADS_MAX_X);;
00376 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00377 {
00378 uTdcPadNoisy[temp_indexY][temp_indexX] = ((TString)line(0,5)).Atoi();
00379 line = line = line(NB_DIGITS_PAD_INDEXES,NB_DIGITS_PAD_INDEXES*NB_PADS_MAX_X);
00380 }
00381 }
00382 line.ReadLine(setupFile, kFALSE);
00383 }
00384 }
00385 else if(line.Contains("deadpad")==kTRUE)
00386 {
00387 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00388 {
00389 if( line.Contains( Form("deadpad%u", temp_indexY)) ==kTRUE)
00390 {
00391 line = line(16,NB_DIGITS_PAD_INDEXES*NB_PADS_MAX_X);;
00392 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00393 {
00394 uTdcPadDead[temp_indexY][temp_indexX] = ((TString)line(0,5)).Atoi();
00395 line = line = line(NB_DIGITS_PAD_INDEXES,NB_DIGITS_PAD_INDEXES*NB_PADS_MAX_X);
00396 }
00397 }
00398 line.ReadLine(setupFile, kFALSE);
00399 }
00400 }
00401 else if(line.Contains("padtimetdc")==kTRUE)
00402 {
00403 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00404 {
00405 if( line.Contains( Form("padtimetdc%u", temp_indexY)) ==kTRUE)
00406 {
00407 line = line(16,NB_DIGITS_PAD_INDEXES*NB_PADS_MAX_X);;
00408 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00409 {
00410 uTdcPadTime[temp_indexY][temp_indexX] = ((TString)line(0,5)).Atoi();
00411 line = line = line(NB_DIGITS_PAD_INDEXES,NB_DIGITS_PAD_INDEXES*NB_PADS_MAX_X);
00412 }
00413 }
00414 line.ReadLine(setupFile, kFALSE);
00415 }
00416 }
00417 else if(line.Contains("padtimecha")==kTRUE)
00418 {
00419 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00420 {
00421 if( line.Contains( Form("padtimecha%u", temp_indexY)) ==kTRUE)
00422 {
00423 line = line(16,NB_DIGITS_PAD_INDEXES*NB_PADS_MAX_X);;
00424 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00425 {
00426 uChannelPadTime[temp_indexY][temp_indexX] = ((TString)line(0,5)).Atoi();
00427 line = line = line(NB_DIGITS_PAD_INDEXES,NB_DIGITS_PAD_INDEXES*NB_PADS_MAX_X);
00428 }
00429 }
00430 line.ReadLine(setupFile, kFALSE);
00431 }
00432 }
00433 else if(line.Contains("padtottdc")==kTRUE)
00434 {
00435 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00436 {
00437 if( line.Contains( Form("padtottdc%u", temp_indexY)) ==kTRUE)
00438 {
00439 line = line(16,NB_DIGITS_PAD_INDEXES*NB_PADS_MAX_X);;
00440 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00441 {
00442 uTdcPadTot[temp_indexY][temp_indexX] = ((TString)line(0,5)).Atoi();
00443 line = line = line(NB_DIGITS_PAD_INDEXES,NB_DIGITS_PAD_INDEXES*NB_PADS_MAX_X);
00444 }
00445 }
00446 line.ReadLine(setupFile, kFALSE);
00447 }
00448 }
00449 else if(line.Contains("padtotcha")==kTRUE)
00450 {
00451 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00452 {
00453 if( line.Contains( Form("padtotcha%u", temp_indexY)) ==kTRUE)
00454 {
00455 line = line(16,NB_DIGITS_PAD_INDEXES*NB_PADS_MAX_X);;
00456 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00457 {
00458 uChannelPadTot[temp_indexY][temp_indexX] = ((TString)line(0,5)).Atoi();
00459 line = line = line(NB_DIGITS_PAD_INDEXES,NB_DIGITS_PAD_INDEXES*NB_PADS_MAX_X);
00460 }
00461 }
00462 line.ReadLine(setupFile, kFALSE);
00463 }
00464 }
00465 else if(line.Contains("padsoffs")==kTRUE)
00466 {
00467 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00468 {
00469 if( line.Contains( Form("padsoffs%u", temp_indexY)) ==kTRUE)
00470 {
00471 line = line(16,NB_DIGITS_PAD_OFFSETS*NB_PADS_MAX_X);;
00472 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00473 {
00474 dOffsetList[temp_indexY][temp_indexX] = ((TString)line(0,5)).Atoi();
00475 line = line = line(NB_DIGITS_PAD_OFFSETS,NB_DIGITS_PAD_OFFSETS*NB_PADS_MAX_X);
00476 }
00477 }
00478 line.ReadLine(setupFile, kFALSE);
00479 }
00480 }
00481 else if(line.Contains("padtotgain")==kTRUE)
00482 {
00483 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00484 {
00485 if( line.Contains( Form("padtotgain%u", temp_indexY)) ==kTRUE)
00486 {
00487 line = line(16,NB_DIGITS_PAD_OFFSETS*NB_PADS_MAX_X);;
00488 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00489 {
00490 dToTGainList[temp_indexY][temp_indexX] = ((TString)line(0,5)).Atoi();
00491 line = line = line(NB_DIGITS_PAD_OFFSETS,NB_DIGITS_PAD_OFFSETS*NB_PADS_MAX_X);
00492 }
00493 }
00494 line.ReadLine(setupFile, kFALSE);
00495 }
00496 }
00497 else if(line.Contains("padtotoffs")==kTRUE)
00498 {
00499 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00500 {
00501 if( line.Contains( Form("padtotoffs%u", temp_indexY)) ==kTRUE)
00502 {
00503 line = line(16,NB_DIGITS_PAD_OFFSETS*NB_PADS_MAX_X);;
00504 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00505 {
00506 dTotOffsetList[temp_indexY][temp_indexX] = ((TString)line(0,5)).Atoi();
00507 line = line = line(NB_DIGITS_PAD_OFFSETS,NB_DIGITS_PAD_OFFSETS*NB_PADS_MAX_X);
00508 }
00509 }
00510 line.ReadLine(setupFile, kFALSE);
00511 }
00512 }
00513 else if(line.Contains("padmatchingoffs")==kTRUE)
00514 {
00515 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00516 {
00517 if( line.Contains( Form("padmatchingoffs%u", temp_indexY)) ==kTRUE)
00518 {
00519 line = line(16,NB_DIGITS_PAD_OFFSETS*NB_PADS_MAX_X);;
00520 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00521 {
00522 dOffsetMatching[temp_indexY][temp_indexX] = ((TString)line(0,5)).Atoi();
00523 line = line = line(NB_DIGITS_PAD_OFFSETS,NB_DIGITS_PAD_OFFSETS*NB_PADS_MAX_X);
00524 }
00525 }
00526 line.ReadLine(setupFile, kFALSE);
00527 }
00528 }
00529 }
00530 }
00531 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00532 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00533 if( 1 == uTdcPadType[temp_indexY][temp_indexX] )
00534 {
00535 uTdcPadTot[temp_indexY][temp_indexX] = uTdcPadTime[temp_indexY][temp_indexX];
00536 if( 1 == uChannelPadTime[temp_indexY][temp_indexX]%2)
00537 uChannelPadTot[temp_indexY][temp_indexX] = uChannelPadTime[temp_indexY][temp_indexX] - 1;
00538 else uChannelPadTot[temp_indexY][temp_indexX] = uChannelPadTime[temp_indexY][temp_indexX] + 1;
00539 }
00540
00541 return kTRUE;
00542 }
00543
00544
00545 Int_t TPadRpcParam::PrintOptions(){
00546 cout<<"****************** PAD RPC calibration parameters **********************"<<endl;
00547 cout<<"------------- Options for pad RPC ";
00548 cout.width(20);
00549 cout<<sPadRpcName<<" --------------"<<endl;
00550 cout<<"-------------------------------------------------"<<endl;
00551 if(1 == uDebug)
00552 cout<<" Debug ON!!!!!!"<<endl;
00553 else cout<<" Debug OFF"<<endl;
00554
00555 if( -1 < iOffsetTdcCaen && -1 < iOffsetChannelCaen &&
00556 -1 < iOffsetTdcVFTX && -1 < iOffsetChannelVFTX )
00557 {
00558 cout<<" Chan. used for time offset: "<<iOffsetChannelCaen;
00559 cout<<" in TDC "<<iOffsetTdcCaen<<" in CAEN"<<endl;
00560 cout<<" Chan. used for time offset: "<<iOffsetChannelVFTX;
00561 cout<<" in TDC "<<iOffsetTdcVFTX<<" in VFTX"<<endl;
00562 }
00563 if( -1 < iRateIntegrationDuration && -1 < iRateIntegrationStep)
00564 {
00565 cout<<" Rate hist. reset spacing: "<<iRateIntegrationDuration<<" s"<<endl;
00566 cout<<" Rate hist. update spacing: "<<iRateIntegrationStep<<" s"<<endl;
00567 }
00568 if( 0 == uTdcTypePad )
00569 {
00570 cout<<" TDC type: CAEN"<<endl;
00571 }
00572 else if( 1 == uTdcTypePad )
00573 {
00574 cout<<" TDC type: VFTX"<<endl;
00575 }
00576 else if( 2 == uTdcTypePad )
00577 {
00578 cout<<" TDC type: MIXED"<<endl;
00579 }
00580 cout<<" Position: X= "<<dPadRpcPosX;
00581 cout<<" Y= "<<dPadRpcPosY<<" Z= "<<dPadRpcPosZ;
00582 cout<<endl;
00583 cout<<" Nb pads on X axis: "<<uNbPadsX<<endl;
00584 cout<<" Nb pads on Y axis: "<<uNbPadsY<<endl;
00585 cout<<" Pad size in X (incl gap.): "<<dPadSizeX<<" cm"<<endl;
00586 cout<<" Pad size in Y (incl gap.): "<<dPadSizeY<<" cm"<<endl;
00587 if( 0 == uOrientation )
00588 {
00589 cout<<" RPC orientation: Horizontal"<<endl;
00590 }
00591 else if( 1 == uOrientation )
00592 {
00593 cout<<" RPC orientation: Vertical"<<endl;
00594 }
00595 if( -1 == iTriggerSelection )
00596 cout<<" Trigger selection: OFF"<<endl;
00597 else cout<<" Trigger selection: Trigger "<<iTriggerSelection<<endl;
00598 cout<<"-------------------------------------------------"<<endl;
00599 cout<<" X Pad#: |- ";
00600 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00601 {
00602 cout.width(NB_DIGITS_PAD_INDEXES - 1);
00603 cout<<temp_indexX<<" ";
00604 }
00605 if( 2 == uTdcTypePad )
00606 {
00607 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00608 {
00609 cout<<endl<<" Tdc Type row #"<<temp_indexY<<" |-> ";
00610 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00611 {
00612 cout.width(NB_DIGITS_PAD_INDEXES - 1);
00613 cout<<uTdcPadType[temp_indexY][temp_indexX]<<" ";
00614 }
00615 }
00616 }
00617 cout<<endl<<" ++++++++++++++++++++ ";
00618 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00619 {
00620 cout<<endl<<" Noisy Strip? row #"<<temp_indexY<<" |-> ";
00621 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00622 {
00623 cout.width(NB_DIGITS_PAD_INDEXES - 1);
00624 cout<<uTdcPadNoisy[temp_indexY][temp_indexX]<<" ";
00625 }
00626 }
00627 cout<<endl<<" ++++++++++++++++++++ ";
00628 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00629 {
00630 cout<<endl<<" Dead Strip? row #"<<temp_indexY<<" |-> ";
00631 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00632 {
00633 cout.width(NB_DIGITS_PAD_INDEXES - 1);
00634 cout<<uTdcPadDead[temp_indexY][temp_indexX]<<" ";
00635 }
00636 }
00637 cout<<endl<<" ++++++++++++++++++++ ";
00638 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00639 {
00640 cout<<endl<<" Time Tdc row #"<<temp_indexY<<" |-> ";
00641 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00642 {
00643 cout.width(NB_DIGITS_PAD_INDEXES - 1);
00644 cout<<uTdcPadTime[temp_indexY][temp_indexX]<<" ";
00645 }
00646 }
00647 cout<<endl<<" ++++++++++++++++++++ ";
00648 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00649 {
00650 cout<<endl<<" Time channel row #"<<temp_indexY<<" |-> ";
00651 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00652 {
00653 cout.width(NB_DIGITS_PAD_INDEXES - 1);
00654 cout<<uChannelPadTime[temp_indexY][temp_indexX]<<" ";
00655 }
00656 }
00657 cout<<endl<<" ++++++++++++++++++++ ";
00658 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00659 {
00660 cout<<endl<<" Tot Tdc row #"<<temp_indexY<<" |-> ";
00661 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00662 {
00663 cout.width(NB_DIGITS_PAD_INDEXES - 1);
00664 cout<<uTdcPadTot[temp_indexY][temp_indexX]<<" ";
00665 }
00666 }
00667 cout<<endl<<" ++++++++++++++++++++ ";
00668 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00669 {
00670 cout<<endl<<" Tot channel row #"<<temp_indexY<<" |-> ";
00671 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00672 {
00673 cout.width(NB_DIGITS_PAD_INDEXES - 1);
00674 cout<<uChannelPadTot[temp_indexY][temp_indexX]<<" ";
00675 }
00676 }
00677 cout<<endl;
00678 cout<<"-------------------------------------------------"<<endl;
00679 cout<<" X Pad#: |- ";
00680 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00681 {
00682 cout.width(NB_DIGITS_PAD_OFFSETS - 1);
00683 cout<<temp_indexX<<" ";
00684 }
00685 cout<<endl<<" ++++++++++++++++++++ ";
00686 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00687 {
00688 cout<<endl<<" Pad Offset #"<<temp_indexY<<" |-> ";
00689 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00690 {
00691 cout.width(NB_DIGITS_PAD_OFFSETS - 1);
00692 cout<<dOffsetList[temp_indexY][temp_indexX]<<" ";
00693 }
00694 }
00695 cout<<endl<<" ++++++++++++++++++++ ";
00696 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00697 {
00698 cout<<endl<<" Tot Gain #"<<temp_indexY<<" |-> ";
00699 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00700 {
00701 cout.width(NB_DIGITS_PAD_OFFSETS - 1);
00702 cout<<dToTGainList[temp_indexY][temp_indexX]<<" ";
00703 }
00704 }
00705 cout<<endl<<" ++++++++++++++++++++ ";
00706 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00707 {
00708 cout<<endl<<" Tot offset #"<<temp_indexY<<" |-> ";
00709 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00710 {
00711 cout.width(NB_DIGITS_PAD_OFFSETS - 1);
00712 cout<<dTotOffsetList[temp_indexY][temp_indexX]<<" ";
00713 }
00714 }
00715 cout<<endl;
00716 cout<<"-------------------------------------------------"<<endl;
00717 cout<<" X Pad#: |- ";
00718 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00719 {
00720 cout.width(NB_DIGITS_PAD_OFFSETS - 1);
00721 cout<<temp_indexX<<" ";
00722 }
00723 for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY; temp_indexY++)
00724 {
00725 cout<<endl<<" Matching Off #"<<temp_indexY<<" |-> ";
00726 for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX; temp_indexX++)
00727 {
00728 cout.width(NB_DIGITS_PAD_OFFSETS - 1);
00729 cout<<dOffsetMatching[temp_indexY][temp_indexX]<<" ";
00730 }
00731 }
00732 cout<<endl;
00733 cout<<"************************************************************************"<<endl;
00734
00735 return 0;
00736 }
00737