| 1 | /** | 
| 2 | * \file ToFLevel2.cpp | 
| 3 | * \author Gianfranca DeRosa, Wolfgang Menn | 
| 4 | */ | 
| 5 |  | 
| 6 | #include <TObject.h> | 
| 7 | #include <ToFLevel2.h> | 
| 8 | #include <iostream> | 
| 9 | using namespace std; | 
| 10 | ClassImp(ToFPMT); | 
| 11 | ClassImp(ToFTrkVar); | 
| 12 | ClassImp(ToFLevel2); | 
| 13 |  | 
| 14 | ToFPMT::ToFPMT(){ | 
| 15 | pmt_id = 0; | 
| 16 | adc = 0.; | 
| 17 | tdc_tw = 0.; | 
| 18 | } | 
| 19 |  | 
| 20 | ToFPMT::ToFPMT(const ToFPMT &t){ | 
| 21 | pmt_id = t.pmt_id; | 
| 22 | adc = t.adc; | 
| 23 | tdc_tw = t.tdc_tw; | 
| 24 | } | 
| 25 |  | 
| 26 | void ToFPMT::Clear(){ | 
| 27 | pmt_id = 0; | 
| 28 | adc = 0.; | 
| 29 | tdc_tw = 0.; | 
| 30 | } | 
| 31 |  | 
| 32 |  | 
| 33 |  | 
| 34 | ToFTrkVar::ToFTrkVar() { | 
| 35 | trkseqno = 0; | 
| 36 | npmttdc = 0; | 
| 37 | npmtadc = 0; | 
| 38 | pmttdc = TArrayI(48); | 
| 39 | pmtadc = TArrayI(48); | 
| 40 | tdcflag = TArrayI(48); // gf: 30 Nov 2006 | 
| 41 | adcflag = TArrayI(48); // gf: 30 Nov 2006 | 
| 42 | dedx = TArrayF(48); | 
| 43 | // | 
| 44 | // | 
| 45 | memset(beta,  0, 13*sizeof(Float_t)); | 
| 46 | memset(xtofpos,  0, 3*sizeof(Float_t)); | 
| 47 | memset(ytofpos,  0, 3*sizeof(Float_t)); | 
| 48 | memset(xtr_tof,  0, 6*sizeof(Float_t)); | 
| 49 | memset(ytr_tof,  0, 6*sizeof(Float_t)); | 
| 50 | // | 
| 51 | }; | 
| 52 |  | 
| 53 | void ToFTrkVar::Clear() { | 
| 54 | trkseqno = 0; | 
| 55 | npmttdc = 0; | 
| 56 | npmtadc = 0; | 
| 57 | pmttdc.Reset(); | 
| 58 | pmtadc.Reset(); | 
| 59 | tdcflag.Reset(); // gf: 30 Nov 2006 | 
| 60 | adcflag.Reset(); // gf: 30 Nov 2006 | 
| 61 | dedx.Reset(); | 
| 62 | // | 
| 63 | memset(beta,  0, 13*sizeof(Float_t)); | 
| 64 | memset(xtofpos,  0, 3*sizeof(Float_t)); | 
| 65 | memset(ytofpos,  0, 3*sizeof(Float_t)); | 
| 66 | memset(xtr_tof,  0, 6*sizeof(Float_t)); | 
| 67 | memset(ytr_tof,  0, 6*sizeof(Float_t)); | 
| 68 | // | 
| 69 | }; | 
| 70 |  | 
| 71 | ToFTrkVar::ToFTrkVar(const ToFTrkVar &t){ | 
| 72 |  | 
| 73 | trkseqno = t.trkseqno; | 
| 74 | // | 
| 75 | npmttdc = t.npmttdc; | 
| 76 | npmtadc = t.npmtadc; | 
| 77 | (t.pmttdc).Copy(pmttdc); | 
| 78 | (t.pmtadc).Copy(pmtadc); | 
| 79 | (t.tdcflag).Copy(tdcflag); // gf: 30 Nov 2006 | 
| 80 | (t.adcflag).Copy(adcflag); // gf: 30 Nov 2006 | 
| 81 | (t.dedx).Copy(dedx); | 
| 82 | // | 
| 83 | memcpy(beta,t.beta,sizeof(beta)); | 
| 84 | memcpy(xtofpos,t.xtofpos,sizeof(xtofpos)); | 
| 85 | memcpy(ytofpos,t.ytofpos,sizeof(ytofpos)); | 
| 86 | memcpy(xtr_tof,t.xtr_tof,sizeof(xtr_tof)); | 
| 87 | memcpy(ytr_tof,t.ytr_tof,sizeof(ytr_tof)); | 
| 88 | // | 
| 89 | }; | 
| 90 |  | 
| 91 | ToFLevel2::ToFLevel2() { | 
| 92 | // | 
| 93 | //  PMT = new TClonesArray("ToFPMT",12); //ELENA | 
| 94 | //  ToFTrk = new TClonesArray("ToFTrkVar",2); //ELENA | 
| 95 | PMT = 0; //ELENA | 
| 96 | ToFTrk = 0; //ELENA | 
| 97 | // | 
| 98 | this->Clear(); | 
| 99 | // | 
| 100 | }; | 
| 101 |  | 
| 102 | void ToFLevel2::Set(){//ELENA | 
| 103 | if(!PMT)PMT = new TClonesArray("ToFPMT",12); //ELENA | 
| 104 | if(!ToFTrk)ToFTrk = new TClonesArray("ToFTrkVar",2); //ELENA | 
| 105 | }//ELENA | 
| 106 |  | 
| 107 | void ToFLevel2::Clear(){ | 
| 108 | // | 
| 109 | if(ToFTrk)ToFTrk->Delete(); //ELENA | 
| 110 | if(PMT)PMT->Delete(); //ELENA | 
| 111 | memset(tof_j_flag, 0, 6*sizeof(Int_t)); | 
| 112 | unpackError = 0; | 
| 113 | // | 
| 114 | }; | 
| 115 |  | 
| 116 | void ToFLevel2::Delete(){ //ELENA | 
| 117 | // | 
| 118 | if(ToFTrk){ | 
| 119 | ToFTrk->Delete(); //ELENA | 
| 120 | delete ToFTrk;  //ELENA | 
| 121 | } | 
| 122 | if(PMT){ | 
| 123 | PMT->Delete(); //ELENA | 
| 124 | delete PMT; //ELENA | 
| 125 | } //ELENA | 
| 126 | // | 
| 127 | }; //ELENA | 
| 128 |  | 
| 129 | ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t itrk){ | 
| 130 | // | 
| 131 | if(itrk >= ntrk()){ | 
| 132 | printf(" ToFLevel2 ERROR: track related variables set %i does not exists! \n",itrk); | 
| 133 | printf("                      stored track related variables = %i \n",ntrk()); | 
| 134 | return(NULL); | 
| 135 | } | 
| 136 | // | 
| 137 | if(!ToFTrk)return 0; //ELENA | 
| 138 | TClonesArray &t = *(ToFTrk); | 
| 139 | ToFTrkVar *toftrack = (ToFTrkVar*)t[itrk]; | 
| 140 | return toftrack; | 
| 141 | } | 
| 142 |  | 
| 143 | ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit){ | 
| 144 | // | 
| 145 | if(ihit >= npmt()){ | 
| 146 | printf(" ToFLevel2 ERROR: pmt variables set %i does not exists! \n",ihit); | 
| 147 | printf("                  stored pmt variables = %i \n",npmt()); | 
| 148 | return(NULL); | 
| 149 | } | 
| 150 | // | 
| 151 | if(!PMT)return 0; //ELENA | 
| 152 | TClonesArray &t = *(PMT); | 
| 153 | ToFPMT *tofpmt = (ToFPMT*)t[ihit]; | 
| 154 | return tofpmt; | 
| 155 | } | 
| 156 | //-------------------------------------- | 
| 157 | // | 
| 158 | // | 
| 159 | //-------------------------------------- | 
| 160 | /** | 
| 161 | * Method to get the plane ID (11 12 21 22 31 32) from the plane index (0 1 2 3 4 5) | 
| 162 | * @param Plane index (0,1,2,3,4,5). | 
| 163 | */ | 
| 164 | Int_t  ToFLevel2::GetToFPlaneID(Int_t ip){ | 
| 165 | if(ip>=0 && ip<6)return 10*((int)(ip/2+1.1))+(ip%2)+1; | 
| 166 | else return -1; | 
| 167 | }; | 
| 168 | /** | 
| 169 | * Method to get the plane index (0 1 2 3 4 5) from the plane ID (11 12 21 22 31 32) | 
| 170 | * @param plane Plane ID (11, 12, 21, 22, 31, 32) | 
| 171 | */ | 
| 172 | Int_t  ToFLevel2::GetToFPlaneIndex(Int_t plane_id){ | 
| 173 | if( | 
| 174 | plane_id == 11 || | 
| 175 | plane_id == 12 || | 
| 176 | plane_id == 21 || | 
| 177 | plane_id == 22 || | 
| 178 | plane_id == 31 || | 
| 179 | plane_id == 32 || | 
| 180 | false)return (Int_t)(plane_id/10)*2-1- plane_id%2; | 
| 181 | else return -1; | 
| 182 | }; | 
| 183 | /** | 
| 184 | * Method to know if a given ToF paddle was hit, that is there is a TDC signal | 
| 185 | * from both PMTs. The method uses the "tof_j_flag" variable. | 
| 186 | * @param plane Plane ID (11, 12, 21, 22, 31, 32) or Plane index (0,1,2,3,4,5). | 
| 187 | * @param paddle_id Paddle ID. | 
| 188 | * @return 1 if the paddle was hit. | 
| 189 | */ | 
| 190 | Bool_t ToFLevel2::HitPaddle(Int_t plane, Int_t paddle_id){  //<<< NEW | 
| 191 | Int_t ip = -1; | 
| 192 | if     (plane>=6             ) ip = GetToFPlaneIndex(plane); | 
| 193 | else if(plane>=0 && plane < 6) ip = plane; | 
| 194 | Int_t flag=0; | 
| 195 | if(ip != -1)flag = tof_j_flag[ip] & (int)pow(2.,(double)paddle_id); | 
| 196 | if( | 
| 197 | (ip == 0 && paddle_id < 8 && flag) || | 
| 198 | (ip == 1 && paddle_id < 6 && flag) || | 
| 199 | (ip == 2 && paddle_id < 2 && flag) || | 
| 200 | (ip == 3 && paddle_id < 2 && flag) || | 
| 201 | (ip == 4 && paddle_id < 3 && flag) || | 
| 202 | (ip == 5 && paddle_id < 3 && flag) || | 
| 203 | false) return true; | 
| 204 | else return false; | 
| 205 | }; | 
| 206 | /** | 
| 207 | * Method to get the number of hit paddles on a ToF plane. | 
| 208 | * @param plane Plane ID (11, 12, 21, 22, 31, 32) or Plane index (0,1,2,3,4,5). | 
| 209 | */ | 
| 210 | Int_t ToFLevel2::GetNHitPaddles(Int_t plane){ | 
| 211 | Int_t npad=0; | 
| 212 | for(Int_t i=0; i<8; i++)npad = npad + (int)HitPaddle(plane,i); | 
| 213 | return npad; | 
| 214 | }; | 
| 215 |  | 
| 216 |  | 
| 217 | //gf Apr 07 | 
| 218 | /** | 
| 219 | * Method to get the mean dEdx from a given ToF plane. This current version | 
| 220 | * is just summing up all PMT signals, which will not give proper results, | 
| 221 | *  and needs a revision. | 
| 222 | * @param notrack Track Number | 
| 223 | * @param plane Plane index (0,1,2,3,4,5) | 
| 224 | * @param adcflag in the plane (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; ) | 
| 225 | */ | 
| 226 | Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane, Int_t adcfl){ | 
| 227 |  | 
| 228 | Float_t dedx = 0.; | 
| 229 | Float_t PadEdx =0.; | 
| 230 | Int_t SatWarning; | 
| 231 | Int_t pad=-1; | 
| 232 | // | 
| 233 | ToFTrkVar *trk = GetToFTrkVar(notrack); | 
| 234 | if(!trk) return 0; //ELENA | 
| 235 | // | 
| 236 | for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ | 
| 237 | Int_t paddleid=ii; | 
| 238 | pad = GetPaddleid(plane,paddleid); | 
| 239 | GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning); | 
| 240 | dedx += PadEdx; | 
| 241 | }; | 
| 242 | // | 
| 243 | return(dedx); | 
| 244 | }; | 
| 245 |  | 
| 246 | /** | 
| 247 | * Method to fill the ADC_C 4x12 matrix with the dEdx values and the TDC 4x12 matrix | 
| 248 | * with the time-walk corrected TDC values. | 
| 249 | * @param notrack Track Number | 
| 250 | * @param adc  ADC_C matrix with dEdx values | 
| 251 | * @param tdc  TDC matrix | 
| 252 | */ | 
| 253 | void ToFLevel2::GetMatrix(Int_t notrack, Float_t adc[4][12], Float_t tdc[4][12]){ | 
| 254 | // | 
| 255 | for (Int_t aa=0; aa<4;aa++){ | 
| 256 | for (Int_t bb=0; bb<12;bb++){ | 
| 257 | adc[aa][bb] = 1000.; | 
| 258 | tdc[aa][bb] = 4095.; | 
| 259 | }; | 
| 260 | }; | 
| 261 | // | 
| 262 | Int_t pmt_id = 0; | 
| 263 | Int_t hh = 0; | 
| 264 | Int_t kk = 0; | 
| 265 | // | 
| 266 | ToFTrkVar *trk = GetToFTrkVar(notrack); | 
| 267 | if(!trk)return; //ELENA | 
| 268 | // | 
| 269 | for (Int_t i=0; i<trk->npmtadc; i++){ | 
| 270 | // | 
| 271 | pmt_id = (trk->pmtadc).At(i); | 
| 272 | // | 
| 273 | GetPMTIndex(pmt_id,hh,kk); | 
| 274 | adc[kk][hh] = (trk->dedx).At(i); | 
| 275 | // | 
| 276 | }; | 
| 277 | // | 
| 278 | for (Int_t i=0; i<npmt(); i++){ | 
| 279 | // | 
| 280 | ToFPMT *pmt = GetToFPMT(i); | 
| 281 | if(!pmt)break; //ELENA | 
| 282 | // | 
| 283 | GetPMTIndex(pmt->pmt_id,hh,kk); | 
| 284 | // | 
| 285 | tdc[kk][hh] = pmt->tdc_tw; | 
| 286 | // | 
| 287 | }; | 
| 288 | // | 
| 289 | return; | 
| 290 | }; | 
| 291 |  | 
| 292 |  | 
| 293 | /** | 
| 294 | * Method to get the plane index (0 - 5) for the PMT_ID as input | 
| 295 | * @param pmt_id  PMT_ID (0 - 47) | 
| 296 | */ | 
| 297 | Int_t ToFLevel2::GetPlaneIndex(Int_t pmt_id){ | 
| 298 | TString pmtname = GetPMTName(pmt_id); | 
| 299 | pmtname.Resize(3); | 
| 300 | if ( !strcmp(pmtname,"S11") ) return(0); | 
| 301 | if ( !strcmp(pmtname,"S12") ) return(1); | 
| 302 | if ( !strcmp(pmtname,"S21") ) return(2); | 
| 303 | if ( !strcmp(pmtname,"S22") ) return(3); | 
| 304 | if ( !strcmp(pmtname,"S31") ) return(4); | 
| 305 | if ( !strcmp(pmtname,"S32") ) return(5); | 
| 306 | return(-1); | 
| 307 | }; | 
| 308 |  | 
| 309 |  | 
| 310 | /** | 
| 311 | * Method to get the PMT_ID if the index (4,12) is given. We have 4 channels on | 
| 312 | * each of the 12 half-boards, this method decodes which PMT is cables to which | 
| 313 | * channel. | 
| 314 | * @param hh Channel | 
| 315 | * @param kk HalfBoard | 
| 316 | */ | 
| 317 | Int_t ToFLevel2::GetPMTid(Int_t hh, Int_t kk){ | 
| 318 | // | 
| 319 | short tof[4][24] = { | 
| 320 | {4, 4,  4,  4,  1,  1, 2, 2,  3,  3, 3, 3,  3,  3, 1, 1,  1,  1, 2, 3,  3, 3, 3,  4}, | 
| 321 | {1, 3,  5,  7, 10, 12, 2, 4,  2,  4, 6, 8, 10, 12, 1, 5,  3,  9, 7, 9, 11, 1, 5,  9}, | 
| 322 | {2, 2,  2,  2,  1,  1, 1, 1,  4,  4, 4, 4,  4,  4, 2, 1,  2,  1, 2, 2,  2, 3, 3,  4}, | 
| 323 | {6, 8, 12, 10,  8,  6, 4, 2, 12, 10, 8, 6,  4,  2, 9, 7, 11, 11, 5, 3,  1, 3, 7, 11} | 
| 324 | }; | 
| 325 | // | 
| 326 | Int_t ind = 0; | 
| 327 | Int_t k = 0; | 
| 328 | while (k < 24){ | 
| 329 | Int_t j = 0; | 
| 330 | while (j < 2){ | 
| 331 | Int_t ch = tof[2*j][k]     - 1; | 
| 332 | Int_t hb = tof[2*j + 1][k] - 1; | 
| 333 | /* tofEvent->tdc[ch][hb] */ | 
| 334 | if( ch == hh && hb == kk ){ | 
| 335 | ind = 2*k + j; | 
| 336 | break; | 
| 337 | }; | 
| 338 | j++; | 
| 339 | }; | 
| 340 | k++; | 
| 341 | }; | 
| 342 | return ind; | 
| 343 | }; | 
| 344 |  | 
| 345 |  | 
| 346 | /** | 
| 347 | * Method to get the PMT index if the PMT ID is given. This method is the | 
| 348 | * "reverse" of method "GetPMTid" | 
| 349 | * @param ind  PMT_ID (0 - 47) | 
| 350 | * @param hb   HalfBoard | 
| 351 | * @param ch   Channel | 
| 352 | */ | 
| 353 | void ToFLevel2::GetPMTIndex(Int_t ind, Int_t &hb, Int_t &ch){ | 
| 354 | // | 
| 355 | short tof[4][24] = { | 
| 356 | {4, 4,  4,  4,  1,  1, 2, 2,  3,  3, 3, 3,  3,  3, 1, 1,  1,  1, 2, 3,  3, 3, 3,  4}, | 
| 357 | {1, 3,  5,  7, 10, 12, 2, 4,  2,  4, 6, 8, 10, 12, 1, 5,  3,  9, 7, 9, 11, 1, 5,  9}, | 
| 358 | {2, 2,  2,  2,  1,  1, 1, 1,  4,  4, 4, 4,  4,  4, 2, 1,  2,  1, 2, 2,  2, 3, 3,  4}, | 
| 359 | {6, 8, 12, 10,  8,  6, 4, 2, 12, 10, 8, 6,  4,  2, 9, 7, 11, 11, 5, 3,  1, 3, 7, 11} | 
| 360 | }; | 
| 361 | // | 
| 362 | Int_t k = 0; | 
| 363 | while (k < 24){ | 
| 364 | Int_t j = 0; | 
| 365 | while (j < 2){ | 
| 366 | /* tofEvent->tdc[ch][hb] */ | 
| 367 | if( ind == 2*k + j ){ | 
| 368 | ch = tof[2*j][k]     - 1; | 
| 369 | hb = tof[2*j + 1][k] - 1; | 
| 370 | return; | 
| 371 | }; | 
| 372 | j++; | 
| 373 | }; | 
| 374 | k++; | 
| 375 | }; | 
| 376 | return; | 
| 377 | }; | 
| 378 |  | 
| 379 |  | 
| 380 |  | 
| 381 |  | 
| 382 | /// gf Apr 07 | 
| 383 |  | 
| 384 | /** | 
| 385 | * Method to get the dEdx from a given ToF paddle. | 
| 386 | * @param notrack Track Number | 
| 387 | * @param Paddle index (0,1,...,23). | 
| 388 | * @param adcflag in the paddle (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; ) | 
| 389 | * @param PadEdx dEdx from a given ToF paddle | 
| 390 | * @param SatWarning 1 if the PMT ios near saturation region (adcraw ~3000) | 
| 391 | */ | 
| 392 | void ToFLevel2::GetdEdxPaddle(Int_t notrack, Int_t paddleid, Int_t adcfl, Float_t &PadEdx, Int_t &SatWarning){ | 
| 393 |  | 
| 394 | PadEdx = 0.; | 
| 395 | SatWarning = 1000; | 
| 396 |  | 
| 397 | Float_t dEdx[48] = {0}; | 
| 398 | Int_t pmt_id = -1; | 
| 399 | Float_t adcraw[48]; | 
| 400 | // | 
| 401 | ToFTrkVar *trk = GetToFTrkVar(notrack); | 
| 402 | if(!trk) return; //ELENA | 
| 403 | // | 
| 404 |  | 
| 405 | Int_t pmtleft=-1; | 
| 406 | Int_t pmtright=-1; | 
| 407 | GetPaddlePMT(paddleid, pmtleft, pmtright); | 
| 408 |  | 
| 409 | adcraw[pmtleft] = 4095; | 
| 410 | adcraw[pmtright] = 4095; | 
| 411 |  | 
| 412 |  | 
| 413 | for (Int_t jj=0; jj<npmt(); jj++){ | 
| 414 |  | 
| 415 | ToFPMT *pmt = GetToFPMT(jj); | 
| 416 | if(!pmt)break; //ELENA | 
| 417 |  | 
| 418 | pmt_id = pmt->pmt_id; | 
| 419 | if(pmt_id==pmtleft){ | 
| 420 | adcraw[pmtleft] = pmt->adc; | 
| 421 | } | 
| 422 |  | 
| 423 | if(pmt_id==pmtright){ | 
| 424 | adcraw[pmtright] = pmt->adc; | 
| 425 | } | 
| 426 | } | 
| 427 |  | 
| 428 | for (Int_t i=0; i<trk->npmtadc; i++){ | 
| 429 |  | 
| 430 | if((trk->adcflag).At(i)==0 || adcfl==100){ | 
| 431 | if((trk->pmtadc).At(i) == pmtleft)dEdx[pmtleft] = (trk->dedx).At(i); | 
| 432 | if((trk->pmtadc).At(i) == pmtright)dEdx[pmtright] = (trk->dedx).At(i); | 
| 433 | }else{ | 
| 434 | if((trk->pmtadc).At(i) == pmtleft)dEdx[pmtleft] = 0.; | 
| 435 | if((trk->pmtadc).At(i) == pmtright)dEdx[pmtright] = 0.; | 
| 436 | } | 
| 437 | } | 
| 438 |  | 
| 439 | if( adcraw[pmtleft] >3000 || adcraw[pmtright] >3000)SatWarning=1; | 
| 440 |  | 
| 441 | if(dEdx[pmtleft]!=0 && dEdx[pmtright]!=0){ | 
| 442 | PadEdx = (dEdx[pmtleft]+dEdx[pmtright])*0.5; | 
| 443 | } | 
| 444 | if(dEdx[pmtleft]==0 && dEdx[pmtright]!=0){ | 
| 445 | PadEdx = dEdx[pmtright]; | 
| 446 | } | 
| 447 | if(dEdx[pmtleft]!=0 && dEdx[pmtright]==0){ | 
| 448 | PadEdx = dEdx[pmtleft]; | 
| 449 | } | 
| 450 |  | 
| 451 | return; | 
| 452 | }; | 
| 453 | // | 
| 454 |  | 
| 455 |  | 
| 456 | // gf Apr 07 | 
| 457 |  | 
| 458 | /** | 
| 459 | * Method to get the PMT name (like "S11_1A") if the PMT_ID is given. | 
| 460 | * Indexes of corresponding  plane, paddle and  pmt are also given as output. | 
| 461 | * @param ind  PMT_ID (0 - 47) | 
| 462 | * @param iplane plane index (0 - 5) | 
| 463 | * @param ipaddle paddle index (relative to the plane) | 
| 464 | * @param ipmt pmt index (0(A), 1(B)) | 
| 465 | */ | 
| 466 | TString ToFLevel2::GetPMTName(Int_t ind, Int_t &iplane, Int_t &ipaddle,Int_t &ipmt){ | 
| 467 |  | 
| 468 | TString pmtname = " "; | 
| 469 |  | 
| 470 | TString photoS[48] = { | 
| 471 | "S11_1A", "S11_1B", "S11_2A", "S11_2B", "S11_3A", "S11_3B", "S11_4A", | 
| 472 | "S11_4B", | 
| 473 | "S11_5A", "S11_5B", "S11_6A", "S11_6B", "S11_7A", "S11_7B", "S11_8A", | 
| 474 | "S11_8B", | 
| 475 | "S12_1A", "S12_1B", "S12_2A", "S12_2B", "S12_3A", "S12_3B", "S12_4A", | 
| 476 | "S12_4B", "S12_5A",  "S12_5B", "S12_6A", "S12_6B", | 
| 477 | "S21_1A", "S21_1B", "S21_2A", "S21_2B", | 
| 478 | "S22_1A", "S22_1B", "S22_2A", "S22_2B", | 
| 479 | "S31_1A", "S31_1B", "S31_2A", "S31_2B", "S31_3A", "S31_3B", | 
| 480 | "S32_1A", "S32_1B", "S32_2A", "S32_2B", "S32_3A", "S32_3B" | 
| 481 | }; | 
| 482 |  | 
| 483 |  | 
| 484 | pmtname = photoS[ind].Data(); | 
| 485 |  | 
| 486 | TString ss = pmtname(1,2); | 
| 487 | iplane  = (int)(atoi(ss.Data())/10)*2-3+atoi(ss.Data())%10; | 
| 488 | ss = pmtname(4); | 
| 489 | ipaddle = atoi(ss.Data())-1 ; | 
| 490 | if( pmtname.Contains("A") )ipmt=0; | 
| 491 | if( pmtname.Contains("B") )ipmt=1; | 
| 492 |  | 
| 493 | return pmtname; | 
| 494 | }; | 
| 495 | /** | 
| 496 | * Method to get the PMT name (like "S11_1A") if the PMT_ID is given | 
| 497 | * @param ind  PMT_ID (0 - 47) | 
| 498 | */ | 
| 499 | TString ToFLevel2::GetPMTName(Int_t ind){ | 
| 500 |  | 
| 501 | Int_t iplane  = -1; | 
| 502 | Int_t ipaddle = -1; | 
| 503 | Int_t ipmt    = -1; | 
| 504 | return GetPMTName(ind,iplane,ipaddle,ipmt); | 
| 505 |  | 
| 506 | }; | 
| 507 |  | 
| 508 |  | 
| 509 | // gf Apr 07 | 
| 510 | Int_t ToFLevel2::GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane){ | 
| 511 |  | 
| 512 | Double_t xt,yt,xl,xh,yl,yh; | 
| 513 |  | 
| 514 | Float_t tof11_x[8] = {-17.85,-12.75,-7.65,-2.55,2.55,7.65,12.75,17.85}; | 
| 515 | Float_t tof12_y[6] = { -13.75,-8.25,-2.75,2.75,8.25,13.75}; | 
| 516 | Float_t tof21_y[2] = { 3.75,-3.75}; | 
| 517 | Float_t tof22_x[2] = { -4.5,4.5}; | 
| 518 | Float_t tof31_x[3] = { -6.0,0.,6.0}; | 
| 519 | Float_t tof32_y[3] = { -5.0,0.0,5.0}; | 
| 520 |  | 
| 521 | //  S11 8 paddles  33.0 x 5.1 cm | 
| 522 | //  S12 6 paddles  40.8 x 5.5 cm | 
| 523 | //  S21 2 paddles  18.0 x 7.5 cm | 
| 524 | //  S22 2 paddles  15.0 x 9.0 cm | 
| 525 | //  S31 3 paddles  15.0 x 6.0 cm | 
| 526 | //  S32 3 paddles  18.0 x 5.0 cm | 
| 527 |  | 
| 528 | Int_t paddleidoftrack=-1; | 
| 529 | // | 
| 530 |  | 
| 531 | //--- S11 ------ | 
| 532 |  | 
| 533 | if(plane==0){ | 
| 534 | xt = xtr; | 
| 535 | yt = ytr; | 
| 536 | paddleidoftrack=-1; | 
| 537 | yl = -33.0/2. ; | 
| 538 | yh =  33.0/2. ; | 
| 539 | if ((yt>yl)&&(yt<yh)) { | 
| 540 | for (Int_t i1=0; i1<8;i1++){ | 
| 541 | xl = tof11_x[i1] - (5.1-0.4)/2. ; | 
| 542 | xh = tof11_x[i1] + (5.1-0.4)/2. ; | 
| 543 | if ((xt>xl)&&(xt<xh))  paddleidoftrack=i1; | 
| 544 | } | 
| 545 | } | 
| 546 | } | 
| 547 | //      cout<<"S11  "<<paddleidoftrack[0]<<"\n"; | 
| 548 |  | 
| 549 | //--- S12 ------- | 
| 550 | if(plane==1){ | 
| 551 | xt = xtr; | 
| 552 | yt = ytr; | 
| 553 | paddleidoftrack=-1; | 
| 554 | xl = -40.8/2. ; | 
| 555 | xh =  40.8/2. ; | 
| 556 |  | 
| 557 | if ((xt>xl)&&(xt<xh)) { | 
| 558 | for (Int_t i1=0; i1<6;i1++){ | 
| 559 | yl = tof12_y[i1] - (5.5-0.4)/2. ; | 
| 560 | yh = tof12_y[i1] + (5.5-0.4)/2. ; | 
| 561 | if ((yt>yl)&&(yt<yh))  paddleidoftrack=i1; | 
| 562 | } | 
| 563 | } | 
| 564 | } | 
| 565 |  | 
| 566 | //--- S21 ------ | 
| 567 |  | 
| 568 | if(plane==2){ | 
| 569 | xt = xtr; | 
| 570 | yt = ytr; | 
| 571 | paddleidoftrack=-1; | 
| 572 | xl = -18./2. ; | 
| 573 | xh =  18./2. ; | 
| 574 |  | 
| 575 | if ((xt>xl)&&(xt<xh)) { | 
| 576 | for (Int_t i1=0; i1<2;i1++){ | 
| 577 | yl = tof21_y[i1] - (7.5-0.4)/2. ; | 
| 578 | yh = tof21_y[i1] + (7.5-0.4)/2. ; | 
| 579 | if ((yt>yl)&&(yt<yh))  paddleidoftrack=i1; | 
| 580 | } | 
| 581 | } | 
| 582 | } | 
| 583 |  | 
| 584 | //--- S22 ------ | 
| 585 | if(plane==3){ | 
| 586 | xt = xtr; | 
| 587 | yt = ytr; | 
| 588 | paddleidoftrack=-1; | 
| 589 | yl = -15./2. ; | 
| 590 | yh =  15./2. ; | 
| 591 |  | 
| 592 | if ((yt>yl)&&(yt<yh)) { | 
| 593 | for (Int_t i1=0; i1<2;i1++){ | 
| 594 | xl = tof22_x[i1] - (9.0-0.4)/2. ; | 
| 595 | xh = tof22_x[i1] + (9.0-0.4)/2. ; | 
| 596 | if ((xt>xl)&&(xt<xh))  paddleidoftrack=i1; | 
| 597 | } | 
| 598 | } | 
| 599 | } | 
| 600 |  | 
| 601 | //--- S31 ------ | 
| 602 | if(plane==4){ | 
| 603 | xt = xtr; | 
| 604 | yt = ytr; | 
| 605 | paddleidoftrack=-1; | 
| 606 | yl = -15.0/2. ; | 
| 607 | yh =  15.0/2. ; | 
| 608 |  | 
| 609 | if ((yt>yl)&&(yt<yh)) { | 
| 610 | for (Int_t i1=0; i1<3;i1++){ | 
| 611 | xl = tof31_x[i1] - (6.0-0.4)/2. ; | 
| 612 | xh = tof31_x[i1] + (6.0-0.4)/2. ; | 
| 613 | if ((xt>xl)&&(xt<xh))  paddleidoftrack=i1; | 
| 614 | } | 
| 615 | } | 
| 616 | } | 
| 617 |  | 
| 618 | //---  S32 ------ | 
| 619 | if(plane==5){ | 
| 620 | xt = xtr; | 
| 621 | yt = ytr; | 
| 622 | paddleidoftrack=-1; | 
| 623 | xl = -18.0/2. ; | 
| 624 | xh =  18.0/2. ; | 
| 625 |  | 
| 626 | if ((xt>xl)&&(xt<xh)) { | 
| 627 | for (Int_t i1=0; i1<3;i1++){ | 
| 628 | yl = tof32_y[i1] - (5.0-0.4)/2. ; | 
| 629 | yh = tof32_y[i1] + (5.0-0.4)/2. ; | 
| 630 | if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; | 
| 631 | } | 
| 632 | } | 
| 633 | } | 
| 634 |  | 
| 635 | return paddleidoftrack; | 
| 636 |  | 
| 637 | } | 
| 638 |  | 
| 639 | // | 
| 640 |  | 
| 641 | // gf Apr 07 | 
| 642 |  | 
| 643 | void ToFLevel2::GetPMTPaddle(Int_t pmt_id, Int_t &plane, Int_t &paddle){ | 
| 644 |  | 
| 645 | plane = GetPlaneIndex(pmt_id); | 
| 646 |  | 
| 647 | if(plane == 0){ | 
| 648 | if(pmt_id==0 || pmt_id==1)paddle=0; | 
| 649 | if(pmt_id==2 || pmt_id==3)paddle=1; | 
| 650 | if(pmt_id==4 || pmt_id==5)paddle=2; | 
| 651 | if(pmt_id==6 || pmt_id==7)paddle=3; | 
| 652 | if(pmt_id==8 || pmt_id==9)paddle=4; | 
| 653 | if(pmt_id==10 || pmt_id==11)paddle=5; | 
| 654 | if(pmt_id==12 || pmt_id==13)paddle=6; | 
| 655 | if(pmt_id==14 || pmt_id==15)paddle=7; | 
| 656 | } | 
| 657 |  | 
| 658 | if(plane == 1){ | 
| 659 | if(pmt_id==16 || pmt_id==17)paddle=0; | 
| 660 | if(pmt_id==18 || pmt_id==19)paddle=1; | 
| 661 | if(pmt_id==20 || pmt_id==21)paddle=2; | 
| 662 | if(pmt_id==22 || pmt_id==23)paddle=3; | 
| 663 | if(pmt_id==24 || pmt_id==25)paddle=4; | 
| 664 | if(pmt_id==26 || pmt_id==27)paddle=5; | 
| 665 | } | 
| 666 |  | 
| 667 | if(plane == 2){ | 
| 668 | if(pmt_id==28 || pmt_id==29)paddle=0; | 
| 669 | if(pmt_id==30 || pmt_id==31)paddle=1; | 
| 670 | } | 
| 671 |  | 
| 672 | if(plane == 3){ | 
| 673 | if(pmt_id==32 || pmt_id==33)paddle=0; | 
| 674 | if(pmt_id==34 || pmt_id==35)paddle=1; | 
| 675 | } | 
| 676 |  | 
| 677 | if(plane == 4){ | 
| 678 | if(pmt_id==36 || pmt_id==37)paddle=0; | 
| 679 | if(pmt_id==38 || pmt_id==39)paddle=1; | 
| 680 | if(pmt_id==40 || pmt_id==41)paddle=2; | 
| 681 | } | 
| 682 |  | 
| 683 | if(plane == 5){ | 
| 684 | if(pmt_id==42 || pmt_id==43)paddle=0; | 
| 685 | if(pmt_id==44 || pmt_id==45)paddle=1; | 
| 686 | if(pmt_id==46 || pmt_id==47)paddle=2; | 
| 687 | } | 
| 688 | return; | 
| 689 | } | 
| 690 |  | 
| 691 | // | 
| 692 |  | 
| 693 | // gf Apr 07 | 
| 694 |  | 
| 695 | void ToFLevel2::GetPaddlePMT(Int_t paddle, Int_t &pmtleft, Int_t &pmtright){ | 
| 696 |  | 
| 697 | if(paddle==0){ | 
| 698 | pmtleft=0; | 
| 699 | pmtright=1; | 
| 700 | } | 
| 701 |  | 
| 702 | if(paddle==1){ | 
| 703 | pmtleft=2; | 
| 704 | pmtright=3; | 
| 705 | } | 
| 706 |  | 
| 707 | if(paddle==2){ | 
| 708 | pmtleft=4; | 
| 709 | pmtright=5; | 
| 710 | } | 
| 711 |  | 
| 712 | if(paddle==3){ | 
| 713 | pmtleft=6; | 
| 714 | pmtright=7; | 
| 715 | } | 
| 716 |  | 
| 717 | if(paddle==4){ | 
| 718 | pmtleft=8; | 
| 719 | pmtright=9; | 
| 720 | } | 
| 721 |  | 
| 722 | if(paddle==5){ | 
| 723 | pmtleft=10; | 
| 724 | pmtright=11; | 
| 725 | } | 
| 726 |  | 
| 727 | if(paddle==6){ | 
| 728 | pmtleft=12; | 
| 729 | pmtright=13; | 
| 730 | } | 
| 731 |  | 
| 732 | if(paddle==7){ | 
| 733 | pmtleft=14; | 
| 734 | pmtright=15; | 
| 735 | } | 
| 736 |  | 
| 737 | if(paddle==8){ | 
| 738 | pmtleft=16; | 
| 739 | pmtright=17; | 
| 740 | } | 
| 741 |  | 
| 742 | if(paddle==9){ | 
| 743 | pmtleft=18; | 
| 744 | pmtright=19; | 
| 745 | } | 
| 746 |  | 
| 747 | if(paddle==10){ | 
| 748 | pmtleft=20; | 
| 749 | pmtright=21; | 
| 750 | } | 
| 751 |  | 
| 752 | if(paddle==11){ | 
| 753 | pmtleft=22; | 
| 754 | pmtright=23; | 
| 755 | } | 
| 756 |  | 
| 757 | if(paddle==12){ | 
| 758 | pmtleft=24; | 
| 759 | pmtright=25; | 
| 760 | } | 
| 761 |  | 
| 762 | if(paddle==13){ | 
| 763 | pmtleft=26; | 
| 764 | pmtright=27; | 
| 765 | } | 
| 766 |  | 
| 767 | if(paddle==14){ | 
| 768 | pmtleft=28; | 
| 769 | pmtright=29; | 
| 770 | } | 
| 771 |  | 
| 772 | if(paddle==15){ | 
| 773 | pmtleft=30; | 
| 774 | pmtright=31; | 
| 775 | } | 
| 776 |  | 
| 777 | if(paddle==16){ | 
| 778 | pmtleft=32; | 
| 779 | pmtright=33; | 
| 780 | } | 
| 781 |  | 
| 782 | if(paddle==17){ | 
| 783 | pmtleft=34; | 
| 784 | pmtright=35; | 
| 785 | } | 
| 786 |  | 
| 787 | if(paddle==18){ | 
| 788 | pmtleft=36; | 
| 789 | pmtright=37; | 
| 790 | } | 
| 791 |  | 
| 792 | if(paddle==19){ | 
| 793 | pmtleft=38; | 
| 794 | pmtright=39; | 
| 795 | } | 
| 796 |  | 
| 797 | if(paddle==20){ | 
| 798 | pmtleft=40; | 
| 799 | pmtright=41; | 
| 800 | } | 
| 801 |  | 
| 802 | if(paddle==21){ | 
| 803 | pmtleft=42; | 
| 804 | pmtright=43; | 
| 805 | } | 
| 806 |  | 
| 807 | if(paddle==22){ | 
| 808 | pmtleft=44; | 
| 809 | pmtright=45; | 
| 810 | } | 
| 811 |  | 
| 812 | if(paddle==23){ | 
| 813 | pmtleft=46; | 
| 814 | pmtright=47; | 
| 815 | } | 
| 816 |  | 
| 817 | return; | 
| 818 | } | 
| 819 |  | 
| 820 | // | 
| 821 |  | 
| 822 |  | 
| 823 |  | 
| 824 | // // gf Apr 07 | 
| 825 |  | 
| 826 | void ToFLevel2::GetPaddleGeometry(Int_t plane, Int_t paddle, Float_t &xleft, Float_t &xright, Float_t &yleft, Float_t &yright){ | 
| 827 |  | 
| 828 | Int_t i1; | 
| 829 |  | 
| 830 | Float_t tof11_x[8] = {-17.85,-12.75,-7.65,-2.55,2.55,7.65,12.75,17.85}; | 
| 831 | Float_t tof12_y[6] = { -13.75,-8.25,-2.75,2.75,8.25,13.75}; | 
| 832 | Float_t tof21_y[2] = { 3.75,-3.75}; | 
| 833 | Float_t tof22_x[2] = { -4.5,4.5}; | 
| 834 | Float_t tof31_x[3] = { -6.0,0.,6.0}; | 
| 835 | Float_t tof32_y[3] = { -5.0,0.0,5.0}; | 
| 836 |  | 
| 837 | //  S11 8 paddles  33.0 x 5.1 cm | 
| 838 | //  S12 6 paddles  40.8 x 5.5 cm | 
| 839 | //  S21 2 paddles  18.0 x 7.5 cm | 
| 840 | //  S22 2 paddles  15.0 x 9.0 cm | 
| 841 | //  S31 3 paddles  15.0 x 6.0 cm | 
| 842 | //  S32 3 paddles  18.0 x 5.0 cm | 
| 843 |  | 
| 844 | if(plane==0) | 
| 845 | { | 
| 846 | for (i1=0; i1<8;i1++){ | 
| 847 | if(i1 == paddle){ | 
| 848 | xleft = tof11_x[i1] - 5.1/2.; | 
| 849 | xright = tof11_x[i1] + 5.1/2.; | 
| 850 | yleft = -33.0/2.; | 
| 851 | yright = 33.0/2.; | 
| 852 | } | 
| 853 | } | 
| 854 | } | 
| 855 |  | 
| 856 | if(plane==1) | 
| 857 | { | 
| 858 | for (i1=0; i1<6;i1++){ | 
| 859 | if(i1 == paddle){ | 
| 860 | xleft = -40.8/2.; | 
| 861 | xright = 40.8/2.; | 
| 862 | yleft = tof12_y[i1] - 5.5/2.; | 
| 863 | yright = tof12_y[i1] + 5.5/2.; | 
| 864 | } | 
| 865 | } | 
| 866 | } | 
| 867 |  | 
| 868 | if(plane==2) | 
| 869 | { | 
| 870 | for (i1=0; i1<2;i1++){ | 
| 871 | if(i1 == paddle){ | 
| 872 | xleft =  -18./2.; | 
| 873 | xright = 18./2.; | 
| 874 | yleft = tof21_y[i1] - 7.5/2.; | 
| 875 | yright = tof21_y[i1] + 7.5/2.; | 
| 876 | } | 
| 877 | } | 
| 878 | } | 
| 879 |  | 
| 880 | if(plane==3) | 
| 881 | { | 
| 882 | for (i1=0; i1<2;i1++){ | 
| 883 | if(i1 == paddle){ | 
| 884 | xleft = tof22_x[i1] - 9.0/2.; | 
| 885 | xright = tof22_x[i1] + 9.0/2.; | 
| 886 | yleft = -15./2.; | 
| 887 | yright = 15./2.; | 
| 888 | } | 
| 889 | } | 
| 890 | } | 
| 891 |  | 
| 892 |  | 
| 893 | if(plane==4) | 
| 894 | { | 
| 895 | for (i1=0; i1<3;i1++){ | 
| 896 | if(i1 == paddle){ | 
| 897 | xleft = tof31_x[i1] - 6.0/2.; | 
| 898 | xright = tof31_x[i1] + 6.0/2.; | 
| 899 | yleft = -15./2.; | 
| 900 | yright = 15./2.; | 
| 901 | } | 
| 902 | } | 
| 903 | } | 
| 904 |  | 
| 905 | if(plane==5) | 
| 906 | { | 
| 907 | for (i1=0; i1<3;i1++){ | 
| 908 | if(i1 == paddle){ | 
| 909 | xleft = -18.0/2.; | 
| 910 | xright = 18.0/2.; | 
| 911 | yleft = tof32_y[i1] - 5.0/2.; | 
| 912 | yright = tof32_y[i1] + 5.0/2.; | 
| 913 | } | 
| 914 | } | 
| 915 | } | 
| 916 | return; | 
| 917 | } | 
| 918 |  | 
| 919 | // gf Apr 07 | 
| 920 | /** | 
| 921 | * Method to get the paddle index (0,...23) if the plane ID and the paddle id in the plane is given. | 
| 922 | * This method is the | 
| 923 | * "reverse" of method "GetPaddlePlane" | 
| 924 | * @param plane    (0 - 5) | 
| 925 | * @param paddle   (plane=0, paddle = 0,...5) | 
| 926 | * @param padid    (0 - 23) | 
| 927 | */ | 
| 928 | Int_t ToFLevel2::GetPaddleid(Int_t plane, Int_t paddle) | 
| 929 | { | 
| 930 |  | 
| 931 | Int_t padid=-1; | 
| 932 | Int_t pads11=8; | 
| 933 | Int_t pads12=6; | 
| 934 | Int_t pads21=2; | 
| 935 | Int_t pads22=2; | 
| 936 | Int_t pads31=3; | 
| 937 | //  Int_t pads32=3; | 
| 938 |  | 
| 939 |  | 
| 940 | if(plane == 0){ | 
| 941 | padid=paddle; | 
| 942 | } | 
| 943 |  | 
| 944 | if(plane == 1){ | 
| 945 | padid=pads11+paddle; | 
| 946 | } | 
| 947 |  | 
| 948 | if(plane == 2){ | 
| 949 | padid=pads11+pads12+paddle; | 
| 950 | } | 
| 951 |  | 
| 952 | if(plane == 3){ | 
| 953 | padid=pads11+pads12+pads21+paddle; | 
| 954 | } | 
| 955 |  | 
| 956 | if(plane == 4){ | 
| 957 | padid=pads11+pads12+pads21+pads22+paddle; | 
| 958 | } | 
| 959 |  | 
| 960 | if(plane == 5){ | 
| 961 | padid=pads11+pads12+pads21+pads22+pads31+paddle; | 
| 962 | } | 
| 963 |  | 
| 964 | return padid; | 
| 965 |  | 
| 966 | } | 
| 967 |  | 
| 968 |  | 
| 969 | // gf Apr 07 | 
| 970 | /** | 
| 971 | * Method to get the plane ID and the paddle id in the plane if the paddle index (0,...23) is given. | 
| 972 | * This method is the | 
| 973 | * "reverse" of method "GetPaddleid" | 
| 974 | * @param pad      (0 - 23) | 
| 975 | * @param plane    (0 - 5) | 
| 976 | * @param paddle   (plane=0, paddle = 0,...5) | 
| 977 | */ | 
| 978 | void ToFLevel2::GetPaddlePlane(Int_t pad, Int_t &plane, Int_t &paddle) | 
| 979 | { | 
| 980 |  | 
| 981 | Int_t pads11=8; | 
| 982 | Int_t pads12=6; | 
| 983 | Int_t pads21=2; | 
| 984 | Int_t pads22=2; | 
| 985 | Int_t pads31=3; | 
| 986 | // Int_t pads32=3; | 
| 987 |  | 
| 988 | if(pad<8){ | 
| 989 | plane=0; | 
| 990 | paddle=pad; | 
| 991 | return; | 
| 992 | } | 
| 993 |  | 
| 994 | if(7<pad<14){ | 
| 995 | plane=1; | 
| 996 | paddle=pad-pads11; | 
| 997 | return; | 
| 998 | } | 
| 999 |  | 
| 1000 | if(13<pad<16){ | 
| 1001 | plane=2; | 
| 1002 | paddle=pad-pads11-pads12; | 
| 1003 | return; | 
| 1004 | } | 
| 1005 |  | 
| 1006 | if(15<pad<18){ | 
| 1007 | plane=3; | 
| 1008 | paddle=pad-pads11-pads12-pads21; | 
| 1009 | return; | 
| 1010 | } | 
| 1011 |  | 
| 1012 | if(17<pad<21){ | 
| 1013 | plane=4; | 
| 1014 | paddle=pad-pads11-pads12-pads21-pads22; | 
| 1015 | return; | 
| 1016 | } | 
| 1017 |  | 
| 1018 | if(20<pad<24){ | 
| 1019 | plane=5; | 
| 1020 | paddle=pad-pads11-pads12-pads21-pads22-pads31; | 
| 1021 | return; | 
| 1022 | } | 
| 1023 |  | 
| 1024 | } | 
| 1025 |  | 
| 1026 |  | 
| 1027 | Int_t ToFLevel2::GetNPaddle(Int_t plane){ | 
| 1028 |  | 
| 1029 | Int_t npaddle=-1; | 
| 1030 |  | 
| 1031 | Int_t pads11=8; | 
| 1032 | Int_t pads12=6; | 
| 1033 | Int_t pads21=2; | 
| 1034 | Int_t pads22=2; | 
| 1035 | Int_t pads31=3; | 
| 1036 | Int_t pads32=3; | 
| 1037 |  | 
| 1038 | if(plane==0)npaddle=pads11; | 
| 1039 | if(plane==1)npaddle=pads12; | 
| 1040 | if(plane==2)npaddle=pads21; | 
| 1041 | if(plane==3)npaddle=pads22; | 
| 1042 | if(plane==4)npaddle=pads31; | 
| 1043 | if(plane==5)npaddle=pads32; | 
| 1044 |  | 
| 1045 | return npaddle; | 
| 1046 |  | 
| 1047 | } | 
| 1048 |  | 
| 1049 | //////////////////////////////////////////////////// | 
| 1050 |  | 
| 1051 |  | 
| 1052 |  | 
| 1053 | /** | 
| 1054 | * Fills a struct cToFLevel2 with values from a ToFLevel2 object (to put data into a F77 common). | 
| 1055 | */ | 
| 1056 | void ToFLevel2::GetLevel2Struct(cToFLevel2 *l2) const{ | 
| 1057 |  | 
| 1058 | for(Int_t i=0;i<6;i++) | 
| 1059 | l2->tof_j_flag[i]=tof_j_flag[i]; | 
| 1060 |  | 
| 1061 | if(ToFTrk){ //ELENA | 
| 1062 | l2->ntoftrk = ToFTrk->GetEntries(); | 
| 1063 | for(Int_t j=0;j<l2->ntoftrk;j++){ | 
| 1064 | l2->toftrkseqno[j]= ((ToFTrkVar*)ToFTrk->At(j))->trkseqno; | 
| 1065 | l2->npmttdc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmttdc; | 
| 1066 | for(Int_t i=0;i<l2->npmttdc[j];i++){ | 
| 1067 | l2->pmttdc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmttdc.At(i); | 
| 1068 | l2->tdcflag[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->tdcflag.At(i); // gf: 30 Nov 2006 | 
| 1069 | } | 
| 1070 | for(Int_t i=0;i<13;i++) | 
| 1071 | l2->beta[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->beta[i]; | 
| 1072 |  | 
| 1073 | l2->npmtadc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmtadc; | 
| 1074 | for(Int_t i=0;i<l2->npmtadc[j];i++){ | 
| 1075 | l2->pmtadc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmtadc.At(i); | 
| 1076 | l2->adcflag[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->adcflag.At(i); // gf: 30 Nov 2006 | 
| 1077 | l2->dedx[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->dedx.At(i); | 
| 1078 | } | 
| 1079 | for(Int_t i=0;i<3;i++){ | 
| 1080 | l2->xtofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->xtofpos[i]; | 
| 1081 | l2->ytofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->ytofpos[i]; | 
| 1082 | } | 
| 1083 | for(Int_t i=0;i<6;i++){ | 
| 1084 | l2->xtr_tof[i][j]=((ToFTrkVar*)ToFTrk->At(j))->xtr_tof[i]; | 
| 1085 | l2->ytr_tof[i][j]=((ToFTrkVar*)ToFTrk->At(j))->ytr_tof[i]; | 
| 1086 | } | 
| 1087 | } | 
| 1088 | } //ELENA | 
| 1089 |  | 
| 1090 | if(PMT){ //ELENA | 
| 1091 | l2->npmt = PMT->GetEntries(); | 
| 1092 | for(Int_t j=0;j<l2->npmt;j++){ | 
| 1093 | l2->pmt_id[j] = ((ToFPMT*)PMT->At(j))->pmt_id; | 
| 1094 | l2->adc[j] =((ToFPMT*)PMT->At(j))->adc; | 
| 1095 | l2->tdc_tw[j] =((ToFPMT*)PMT->At(j))->tdc_tw; | 
| 1096 | } | 
| 1097 | } //ELENA | 
| 1098 | } |