| 1 |
/** |
| 2 |
* \file ToFViewer.cpp |
| 3 |
* \author Elena Vannuccini |
| 4 |
*/ |
| 5 |
#include <ToFViewer.h> |
| 6 |
|
| 7 |
|
| 8 |
#define COLO 5 |
| 9 |
#define LCOL 13 // color of tof-volume lines |
| 10 |
|
| 11 |
|
| 12 |
void GetToFPaddlePosition(Int_t iplane, Int_t ipaddle,Float_t &cornerx, Float_t &cornery, Float_t &cornerz,Float_t &dx, Float_t &dy, Float_t &dz){ |
| 13 |
|
| 14 |
if(iplane==0){ |
| 15 |
cornerx = -NTOF11*DXTOF11/2.+ipaddle*DXTOF11; |
| 16 |
cornery = -DYTOF11/2.; |
| 17 |
cornerz = ZTOF11 - DTTOF11/2.; |
| 18 |
dx = DXTOF11; |
| 19 |
dy = DYTOF11; |
| 20 |
dz = DTTOF11; |
| 21 |
} |
| 22 |
if(iplane==1){ |
| 23 |
cornery = -NTOF12*DYTOF12/2.+ipaddle*DYTOF12; |
| 24 |
cornerx = -DXTOF12/2.; |
| 25 |
cornerz = ZTOF12 - DTTOF12/2.; |
| 26 |
dx = DXTOF12; |
| 27 |
dy = DYTOF12; |
| 28 |
dz = DTTOF12; |
| 29 |
} |
| 30 |
if(iplane==2){ |
| 31 |
cornery = -NTOF21*DYTOF21/2.+(NTOF21-ipaddle-1)*DYTOF21; |
| 32 |
cornerx = -DXTOF21/2.; |
| 33 |
cornerz = ZTOF21 - DTTOF21/2.; |
| 34 |
dx = DXTOF21; |
| 35 |
dy = DYTOF21; |
| 36 |
dz = DTTOF21; |
| 37 |
} |
| 38 |
if(iplane==3){ |
| 39 |
cornerx = -NTOF22*DXTOF22/2.+ipaddle*DXTOF22; |
| 40 |
cornery = -DYTOF22/2.; |
| 41 |
cornerz = ZTOF22 - DTTOF22/2.; |
| 42 |
dx = DXTOF22; |
| 43 |
dy = DYTOF22; |
| 44 |
dz = DTTOF22; |
| 45 |
} |
| 46 |
if(iplane==4){ |
| 47 |
cornerx = -NTOF31*DXTOF31/2.+ipaddle*DXTOF31; |
| 48 |
cornery = -DYTOF31/2.; |
| 49 |
cornerz = ZTOF31 - DTTOF31/2.; |
| 50 |
dx = DXTOF31; |
| 51 |
dy = DYTOF31; |
| 52 |
dz = DTTOF31; |
| 53 |
} |
| 54 |
if(iplane==5){ |
| 55 |
cornery = -NTOF32*DYTOF32/2.+ipaddle*DYTOF32; |
| 56 |
cornerx = -DXTOF32/2.; |
| 57 |
cornerz = ZTOF32 - DTTOF32/2.; |
| 58 |
dx = DXTOF32; |
| 59 |
dy = DYTOF32; |
| 60 |
dz = DTTOF32; |
| 61 |
} |
| 62 |
|
| 63 |
} |
| 64 |
|
| 65 |
/** |
| 66 |
* ToF volume (projections) constructor |
| 67 |
*/ |
| 68 |
GToFVolume::GToFVolume(){ |
| 69 |
|
| 70 |
// ==================================== TOF-11 |
| 71 |
for ( Int_t j=0; j<NTOF11; j++){ |
| 72 |
Float_t corner = -NTOF11*DXTOF11/2.+j*DXTOF11; |
| 73 |
ftof11x[j] = new TBox(corner,ZTOF11-DTTOF11/2.,corner+DXTOF11,ZTOF11+DTTOF11/2.); |
| 74 |
ftof11x[j]->SetFillStyle(0); |
| 75 |
ftof11x[j]->SetLineColor(LCOL); |
| 76 |
// ftof11x[j]->SetLineWidth(1); |
| 77 |
}; |
| 78 |
ftof11y = new TBox(-DYTOF11/2.,ZTOF11-DTTOF11/2.,DYTOF11/2.,ZTOF11+DTTOF11/2.); |
| 79 |
ftof11y->SetFillStyle(0); |
| 80 |
ftof11y->SetLineColor(LCOL); |
| 81 |
// ftof11y->SetLineWidth(1); |
| 82 |
ftof11t = new TBox(-NTOF11*DXTOF11/2.,-DYTOF11/2.,+NTOF11*DXTOF11/2.,+DYTOF11/2.); |
| 83 |
ftof11t->SetFillStyle(0); |
| 84 |
ftof11t->SetLineColor(LCOL); |
| 85 |
|
| 86 |
// ==================================== TOF-12 |
| 87 |
for ( Int_t j=0; j<NTOF12; j++){ |
| 88 |
Float_t corner = -NTOF12*DYTOF12/2.+j*DYTOF12; |
| 89 |
ftof12y[j] = new TBox(corner,ZTOF12-DTTOF12/2.,corner+DYTOF12,ZTOF12+DTTOF12/2.); |
| 90 |
ftof12y[j]->SetFillStyle(0); |
| 91 |
ftof12y[j]->SetLineColor(LCOL); |
| 92 |
// ftof12y[j]->SetLineWidth(1); |
| 93 |
}; |
| 94 |
ftof12x = new TBox(-DXTOF12/2.,ZTOF12-DTTOF12/2.,DXTOF12/2.,ZTOF12+DTTOF12/2.); |
| 95 |
ftof12x->SetFillStyle(0); |
| 96 |
ftof12x->SetLineColor(LCOL); |
| 97 |
// ftof12x->SetLineWidth(1); |
| 98 |
ftof12t = new TBox(-DXTOF12/2.,-NTOF12*DYTOF12/2.,+DXTOF12/2.,+NTOF12*DYTOF12/2.); |
| 99 |
ftof12t->SetFillStyle(0); |
| 100 |
ftof12t->SetLineColor(LCOL); |
| 101 |
// ==================================== TOF-21 |
| 102 |
for ( Int_t j=0; j<NTOF21; j++){ |
| 103 |
Float_t corner = -NTOF21*DYTOF21/2.+j*DYTOF21; |
| 104 |
ftof21y[j] = new TBox(corner,ZTOF21-DTTOF21/2.,corner+DYTOF21,ZTOF21+DTTOF21/2.); |
| 105 |
ftof21y[j]->SetFillStyle(0); |
| 106 |
ftof21y[j]->SetLineColor(LCOL); |
| 107 |
// ftof21y[j]->SetLineWidth(1); |
| 108 |
}; |
| 109 |
ftof21x = new TBox(-DXTOF21/2.,ZTOF21-DTTOF21/2.,DXTOF21/2.,ZTOF21+DTTOF21/2.); |
| 110 |
ftof21x->SetFillStyle(0); |
| 111 |
ftof21x->SetLineColor(LCOL); |
| 112 |
// ftof21x->SetLineWidth(1); |
| 113 |
ftof21t = new TBox(-DXTOF21/2.,-NTOF21*DYTOF21/2.,+DXTOF21/2.,+NTOF21*DYTOF21/2.); |
| 114 |
ftof21t->SetFillStyle(0); |
| 115 |
ftof21t->SetLineColor(LCOL); |
| 116 |
// ==================================== TOF-22 |
| 117 |
for ( Int_t j=0; j<NTOF22; j++){ |
| 118 |
Float_t corner = -NTOF22*DXTOF22/2.+j*DXTOF22; |
| 119 |
ftof22x[j] = new TBox(corner,ZTOF22-DTTOF22/2.,corner+DXTOF22,ZTOF22+DTTOF22/2.); |
| 120 |
ftof22x[j]->SetFillStyle(0); |
| 121 |
ftof22x[j]->SetLineColor(LCOL); |
| 122 |
// ftof22x[j]->SetLineWidth(1); |
| 123 |
}; |
| 124 |
ftof22y = new TBox(-DYTOF22/2.,ZTOF22-DTTOF22/2.,DYTOF22/2.,ZTOF22+DTTOF22/2.); |
| 125 |
ftof22y->SetFillStyle(0); |
| 126 |
ftof22y->SetLineColor(LCOL); |
| 127 |
// ftof22y->SetLineWidth(1); |
| 128 |
ftof22t = new TBox(-NTOF22*DXTOF22/2.,-DYTOF22/2.,+NTOF22*DXTOF22/2.,+DYTOF22/2.); |
| 129 |
ftof22t->SetFillStyle(0); |
| 130 |
ftof22t->SetLineColor(LCOL); |
| 131 |
// ==================================== TOF-31 |
| 132 |
for ( Int_t j=0; j<NTOF31; j++){ |
| 133 |
Float_t corner = -NTOF31*DXTOF31/2.+j*DXTOF31; |
| 134 |
ftof31x[j] = new TBox(corner,ZTOF31-DTTOF31/2.,corner+DXTOF31,ZTOF31+DTTOF31/2.); |
| 135 |
ftof31x[j]->SetFillStyle(0); |
| 136 |
ftof31x[j]->SetLineColor(LCOL); |
| 137 |
// ftof31x[j]->SetLineWidth(1); |
| 138 |
}; |
| 139 |
ftof31y = new TBox(-DYTOF31/2.,ZTOF31-DTTOF31/2.,DYTOF31/2.,ZTOF31+DTTOF31/2.); |
| 140 |
ftof31y->SetFillStyle(0); |
| 141 |
ftof31y->SetLineColor(LCOL); |
| 142 |
// ftof31y->SetLineWidth(1); |
| 143 |
ftof31t = new TBox(-NTOF31*DXTOF31/2.,-DYTOF31/2.,+NTOF31*DXTOF31/2.,+DYTOF31/2.); |
| 144 |
ftof31t->SetFillStyle(0); |
| 145 |
ftof31t->SetLineColor(LCOL); |
| 146 |
// ==================================== TOF-32 |
| 147 |
for ( Int_t j=0; j<NTOF32; j++){ |
| 148 |
Float_t corner = -NTOF32*DYTOF32/2.+j*DYTOF32; |
| 149 |
ftof32y[j] = new TBox(corner,ZTOF32-DTTOF32/2.,corner+DYTOF32,ZTOF32+DTTOF32/2.); |
| 150 |
ftof32y[j]->SetFillStyle(0); |
| 151 |
ftof32y[j]->SetLineColor(LCOL); |
| 152 |
// ftof32y[j]->SetLineWidth(1); |
| 153 |
}; |
| 154 |
ftof32x = new TBox(-DXTOF32/2.,ZTOF32-DTTOF32/2.,DXTOF32/2.,ZTOF32+DTTOF32/2.); |
| 155 |
ftof32x->SetFillStyle(0); |
| 156 |
ftof32x->SetLineColor(LCOL); |
| 157 |
// ftof32x->SetLineWidth(1); |
| 158 |
ftof32t = new TBox(-DXTOF32/2.,-NTOF32*DYTOF32/2.,+DXTOF32/2.,+NTOF32*DYTOF32/2.); |
| 159 |
ftof32t->SetFillStyle(0); |
| 160 |
ftof32t->SetLineColor(LCOL); |
| 161 |
} |
| 162 |
// |
| 163 |
void GToFVolume::DrawProjectionX(){ |
| 164 |
for(Int_t ip=0; ip<NTOF11; ip++)ftof11x[ip]->Draw();//S11 |
| 165 |
ftof12x->Draw(); //S12 |
| 166 |
ftof21x->Draw(); //S21 |
| 167 |
for(Int_t ip=0; ip<NTOF22; ip++)ftof22x[ip]->Draw();//S22 |
| 168 |
for(Int_t ip=0; ip<NTOF31; ip++)ftof31x[ip]->Draw();//S31 |
| 169 |
ftof32x->Draw(); //S32 |
| 170 |
} |
| 171 |
// |
| 172 |
void GToFVolume::DrawProjectionY(){ |
| 173 |
ftof11y->Draw(); //S11 |
| 174 |
for(Int_t ip=0; ip<NTOF12; ip++)ftof12y[ip]->Draw();//S12 |
| 175 |
for(Int_t ip=0; ip<NTOF21; ip++)ftof21y[ip]->Draw();//S21 |
| 176 |
ftof22y->Draw(); //S22 |
| 177 |
ftof31y->Draw(); //S31 |
| 178 |
for(Int_t ip=0; ip<NTOF32; ip++)ftof32y[ip]->Draw();//S32 |
| 179 |
} |
| 180 |
// |
| 181 |
void GToFVolume::DrawProjectionT(){ |
| 182 |
ftof11t->Draw(); //S11 |
| 183 |
ftof12t->Draw(); //S12 |
| 184 |
ftof21t->Draw(); //S21 |
| 185 |
ftof22t->Draw(); //S22 |
| 186 |
ftof31t->Draw(); //S31 |
| 187 |
ftof32t->Draw(); //S32 |
| 188 |
} |
| 189 |
// |
| 190 |
void GToFVolume::Delete(){ |
| 191 |
for(Int_t ip=0; ip<NTOF11; ip++)ftof11x[ip]->Delete();//S11 |
| 192 |
ftof11y->Delete(); //S11 |
| 193 |
ftof11t->Delete(); //S11 |
| 194 |
for(Int_t ip=0; ip<NTOF12; ip++)ftof12y[ip]->Delete();//S12 |
| 195 |
ftof12x->Delete(); //S12 |
| 196 |
ftof12t->Delete(); //S12 |
| 197 |
for(Int_t ip=0; ip<NTOF21; ip++)ftof21y[ip]->Delete();//S21 |
| 198 |
ftof21x->Delete(); //S21 |
| 199 |
ftof21t->Delete(); //S21 |
| 200 |
for(Int_t ip=0; ip<NTOF22; ip++)ftof22x[ip]->Delete();//S22 |
| 201 |
ftof22y->Delete(); //S22 |
| 202 |
ftof22t->Delete(); //S22 |
| 203 |
for(Int_t ip=0; ip<NTOF31; ip++)ftof31x[ip]->Delete();//S31 |
| 204 |
ftof31y->Delete(); //S31 |
| 205 |
ftof31t->Delete(); //S31 |
| 206 |
for(Int_t ip=0; ip<NTOF32; ip++)ftof32y[ip]->Delete();//S32 |
| 207 |
ftof32x->Delete(); //S32 |
| 208 |
ftof32t->Delete(); //S32 |
| 209 |
}; |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
//=============================================================== |
| 216 |
// |
| 217 |
// |
| 218 |
//=============================================================== |
| 219 |
|
| 220 |
|
| 221 |
/** |
| 222 |
* Constructor |
| 223 |
*/ |
| 224 |
GToFLevel2::GToFLevel2(){ |
| 225 |
|
| 226 |
for(Int_t ipa=0; ipa<24; ipa++) tofmip[ipa]=0; |
| 227 |
for(Int_t ipa=0; ipa<24; ipa++) toftdc[ipa]=0; |
| 228 |
|
| 229 |
HitX = new TClonesArray("GToFHit"); |
| 230 |
HitY = new TClonesArray("GToFHit"); |
| 231 |
|
| 232 |
} |
| 233 |
|
| 234 |
/** |
| 235 |
* Constructor |
| 236 |
*/ |
| 237 |
GToFLevel2::GToFLevel2(ToFLevel2* l2){ |
| 238 |
|
| 239 |
for(Int_t ipa=0; ipa<24; ipa++) tofmip[ipa]=0; |
| 240 |
for(Int_t ipa=0; ipa<24; ipa++) toftdc[ipa]=0; |
| 241 |
|
| 242 |
HitX = new TClonesArray("GToFHit"); |
| 243 |
HitY = new TClonesArray("GToFHit"); |
| 244 |
SetLevel2(l2); |
| 245 |
|
| 246 |
}; |
| 247 |
|
| 248 |
/** |
| 249 |
* Constructor |
| 250 |
*/ |
| 251 |
GToFLevel2::GToFLevel2(PamLevel2* l2){ |
| 252 |
|
| 253 |
for(Int_t ipa=0; ipa<24; ipa++) tofmip[ipa]=0; |
| 254 |
for(Int_t ipa=0; ipa<24; ipa++) toftdc[ipa]=0; |
| 255 |
|
| 256 |
HitX = new TClonesArray("GToFHit"); |
| 257 |
HitY = new TClonesArray("GToFHit"); |
| 258 |
SetLevel2(l2->GetToFLevel2()); |
| 259 |
|
| 260 |
}; |
| 261 |
|
| 262 |
void GToFLevel2::SetLevel2(ToFLevel2* l2){ |
| 263 |
|
| 264 |
TClonesArray &hx = *HitX; //Int_t nhx =0; |
| 265 |
TClonesArray &hy = *HitY; //Int_t nhy =0; |
| 266 |
|
| 267 |
// cout<<"ToF event: "<<l2->npmt()<<" hit PMTs \n"; |
| 268 |
// -------------------------------------------- |
| 269 |
// fill a matrix with energy-release per paddle |
| 270 |
// -------------------------------------------- |
| 271 |
// (<0 if both PMTs have been hit) |
| 272 |
for(Int_t ih=0; ih<l2->npmt(); ih++){//loop over hit PMTs (ADC||TDC) |
| 273 |
|
| 274 |
ToFPMT *pmt = l2->GetToFPMT(ih); |
| 275 |
|
| 276 |
Float_t mip = 70; |
| 277 |
Bool_t twice = false; |
| 278 |
if( tofmip[(int)(pmt->pmt_id/2)]!=0 )twice = true; |
| 279 |
tofmip[(int)(pmt->pmt_id/2)] += (Float_t)pmt->adc/mip; |
| 280 |
if( twice )tofmip[(int)(pmt->pmt_id/2)] = -tofmip[(int)(pmt->pmt_id/2)]/2.; |
| 281 |
|
| 282 |
if( (Float_t)pmt->tdc < 4095 ) toftdc[(int)(pmt->pmt_id/2)]=1; |
| 283 |
|
| 284 |
} |
| 285 |
|
| 286 |
// -------------------------------------------- |
| 287 |
// loop over paddles |
| 288 |
// -------------------------------------------- |
| 289 |
Int_t nhitx = 0; |
| 290 |
Int_t nhity = 0; |
| 291 |
for(Int_t ipa=0; ipa<24; ipa++){ |
| 292 |
if(tofmip[ipa]!=0){ |
| 293 |
Int_t iplane = -1; |
| 294 |
Int_t ipaddle = -1; |
| 295 |
Int_t ipmt = -1; |
| 296 |
Int_t id = ipa*2; |
| 297 |
|
| 298 |
GetPMTName(id,iplane,ipaddle,ipmt); |
| 299 |
// cout << GetPMTName(id,iplane,ipaddle,ipmt) << " "<< tofmip[ipa] << " "<<l2->HitPaddle(iplane,ipaddle)<< endl; |
| 300 |
|
| 301 |
if( iplane==0 || iplane==3 || iplane==4 ){ |
| 302 |
|
| 303 |
GToFHit hitx = GToFHit(id,(Int_t)(l2->HitPaddle(iplane,ipaddle)),tofmip[ipa],toftdc[ipa]); |
| 304 |
new((hx[nhitx])) GToFHit(&hitx); // << PADDLE HIT X |
| 305 |
nhitx++; |
| 306 |
|
| 307 |
} |
| 308 |
if( iplane==1 || iplane==2 || iplane==5 ){ |
| 309 |
|
| 310 |
GToFHit hity = GToFHit(id,(Int_t)(l2->HitPaddle(iplane,ipaddle)),tofmip[ipa],toftdc[ipa]); |
| 311 |
new((hy[nhity])) GToFHit(&hity); // << PADDLE HIT X |
| 312 |
nhity++; |
| 313 |
|
| 314 |
} |
| 315 |
} |
| 316 |
} |
| 317 |
|
| 318 |
} |
| 319 |
|
| 320 |
void GToFLevel2::Delete(){ |
| 321 |
HitX->Delete(); |
| 322 |
HitY->Delete(); |
| 323 |
} |
| 324 |
void GToFLevel2::Clear(){ |
| 325 |
HitX->Clear("C"); |
| 326 |
HitY->Clear("C"); |
| 327 |
} |
| 328 |
|
| 329 |
void GToFLevel2::DrawProjectionX(){ |
| 330 |
TClonesArray &s = *(HitX); |
| 331 |
// cout<<"ToF: X paddles: "<<HitX->GetEntries()<<endl; |
| 332 |
// for(Int_t is=0; is<HitX->GetEntries(); is++){ |
| 333 |
// ((GToFHit*)s[is])->Draw(); |
| 334 |
// }; |
| 335 |
for(Int_t is=0; is<HitX->GetEntries(); is++){ |
| 336 |
// ((TBox*)s[is])->Draw(); |
| 337 |
((GToFHit*)s[is])->DrawProjectionX(); |
| 338 |
}; |
| 339 |
} |
| 340 |
|
| 341 |
void GToFLevel2::DrawProjectionY(){ |
| 342 |
TClonesArray &s = *(HitY); |
| 343 |
// cout<<"ToF: Y paddles: "<<HitY->GetEntries()<<endl; |
| 344 |
// for(Int_t is=0; is<HitY->GetEntries(); is++){ |
| 345 |
// ((GToFHit*)s[is])->Draw(); |
| 346 |
// }; |
| 347 |
for(Int_t is=0; is<HitY->GetEntries(); is++){ |
| 348 |
// ((TBox*)s[is])->Draw(); |
| 349 |
((GToFHit*)s[is])->DrawProjectionY(); |
| 350 |
}; |
| 351 |
}; |
| 352 |
|
| 353 |
TString GToFLevel2::GetPMTName(Int_t ind, Int_t &iplane, Int_t &ipaddle, Int_t &ipmt){ |
| 354 |
|
| 355 |
TString pmtname = " "; |
| 356 |
|
| 357 |
TString photoS[48] = { |
| 358 |
"S11_1A", "S11_1B", "S11_2A", "S11_2B", "S11_3A", "S11_3B", "S11_4A", "S11_4B", |
| 359 |
"S11_5A", "S11_5B", "S11_6A", "S11_6B", "S11_7A", "S11_7B", "S11_8A", "S11_8B", |
| 360 |
"S12_1A", "S12_1B", "S12_2A", "S12_2B", "S12_3A", "S12_3B", "S12_4A", "S12_4B", "S12_5A", "S12_5B", "S12_6A", "S12_6B", |
| 361 |
"S21_1A", "S21_1B", "S21_2A", "S21_2B", |
| 362 |
"S22_1A", "S22_1B", "S22_2A", "S22_2B", |
| 363 |
"S31_1A", "S31_1B", "S31_2A", "S31_2B", "S31_3A", "S31_3B", |
| 364 |
"S32_1A", "S32_1B", "S32_2A", "S32_2B", "S32_3A", "S32_3B" |
| 365 |
}; |
| 366 |
|
| 367 |
|
| 368 |
pmtname = photoS[ind].Data(); |
| 369 |
|
| 370 |
TString ss = pmtname(1,2); |
| 371 |
iplane = (int)(atoi(ss.Data())/10)*2-3+atoi(ss.Data())%10; |
| 372 |
ss = pmtname(4); |
| 373 |
ipaddle = atoi(ss.Data())-1 ; |
| 374 |
if( pmtname.Contains("A") )ipmt=0; |
| 375 |
if( pmtname.Contains("B") )ipmt=1; |
| 376 |
|
| 377 |
return pmtname; |
| 378 |
}; |
| 379 |
//=============================================================== |
| 380 |
// |
| 381 |
// |
| 382 |
//=============================================================== |
| 383 |
GToFTrack::GToFTrack(){ |
| 384 |
for(Int_t i=0; i<6; i++){ |
| 385 |
ttof_x[i]=NULL; |
| 386 |
ttof_y[i]=NULL; |
| 387 |
ttof_t[i]=NULL; |
| 388 |
} |
| 389 |
} |
| 390 |
GToFTrack::GToFTrack(ToFTrkVar* track){ |
| 391 |
for(Int_t i=0; i<6; i++){ |
| 392 |
ttof_x[i]=NULL; |
| 393 |
ttof_y[i]=NULL; |
| 394 |
ttof_t[i]=NULL; |
| 395 |
} |
| 396 |
Set(track); |
| 397 |
} |
| 398 |
GToFTrack::GToFTrack(PamTrack* track){ |
| 399 |
|
| 400 |
for(Int_t i=0; i<6; i++){ |
| 401 |
ttof_x[i]=NULL; |
| 402 |
ttof_y[i]=NULL; |
| 403 |
ttof_t[i]=NULL; |
| 404 |
} |
| 405 |
Set(track->GetToFTrack()); |
| 406 |
} |
| 407 |
|
| 408 |
void GToFTrack::Set(ToFTrkVar* track){ |
| 409 |
|
| 410 |
|
| 411 |
if(!track)return; |
| 412 |
|
| 413 |
// cout << "ToF track : seqno "<<track->trkseqno<<endl; |
| 414 |
// Dump(track); |
| 415 |
ToFLevel2 *l2 = new ToFLevel2(); |
| 416 |
|
| 417 |
/// ---- copiata dalla classe... per la disperazione |
| 418 |
// TString pmtname = " "; |
| 419 |
// TString photoS[48] = { |
| 420 |
// "S11_1A", "S11_1B", "S11_2A", "S11_2B", "S11_3A", "S11_3B", "S11_4A", |
| 421 |
// "S11_4B", |
| 422 |
// "S11_5A", "S11_5B", "S11_6A", "S11_6B", "S11_7A", "S11_7B", "S11_8A", |
| 423 |
// "S11_8B", |
| 424 |
// "S12_1A", "S12_1B", "S12_2A", "S12_2B", "S12_3A", "S12_3B", "S12_4A", |
| 425 |
// "S12_4B", "S12_5A", "S12_5B", "S12_6A", "S12_6B", |
| 426 |
// "S21_1A", "S21_1B", "S21_2A", "S21_2B", |
| 427 |
// "S22_1A", "S22_1B", "S22_2A", "S22_2B", |
| 428 |
// "S31_1A", "S31_1B", "S31_2A", "S31_2B", "S31_3A", "S31_3B", |
| 429 |
// "S32_1A", "S32_1B", "S32_2A", "S32_2B", "S32_3A", "S32_3B" |
| 430 |
// }; |
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
// cout << " %%%%%%%%%%%%%%%%%%%% npmttdc "<<track->npmttdc<<endl; |
| 435 |
|
| 436 |
int pmtids[48]; for (int id=0; id<48; id++)pmtids[id]=0; |
| 437 |
|
| 438 |
// cout << endl<< "n. tdc hits :"<<track->npmttdc; |
| 439 |
// cout << endl<< "PMTs :"; |
| 440 |
// for(Int_t ip=0; ip< track->npmttdc; ip++)cout << " "<< track->pmttdc[ip]; |
| 441 |
// cout << endl<< "n. adc hits :"<<track->npmtadc; |
| 442 |
// cout << endl<< "PMTs :"; |
| 443 |
// for(Int_t ip=0; ip< track->npmtadc; ip++)cout << " "<< track->pmtadc[ip]; |
| 444 |
// cout << endl; |
| 445 |
for(Int_t ip=0; ip< track->npmtadc; ip++)if( track->pmtadc[ip]>=0 && track->pmtadc[ip]<48 )pmtids[track->pmtadc[ip]] = 1; |
| 446 |
for(Int_t ip=0; ip< track->npmttdc; ip++)if( track->pmttdc[ip]>=0 && track->pmttdc[ip]<48 )pmtids[track->pmttdc[ip]] = 1; |
| 447 |
|
| 448 |
for (int id=0; id<48; id++) { |
| 449 |
// for(Int_t ip=0; ip< track->npmtadc; ip++){///XX |
| 450 |
|
| 451 |
// cout << id << " - "<<pmtids[id]<<endl; |
| 452 |
// continue; |
| 453 |
// if(track->adcflag[ip] == 1)continue; |
| 454 |
if(pmtids[id]==0)continue; |
| 455 |
|
| 456 |
Int_t iplane = -1; |
| 457 |
Int_t ipaddle = -1; |
| 458 |
Int_t ipmt = -1; |
| 459 |
// Int_t ind = id; //track->pmtadc[ip];///XX |
| 460 |
// cout << l2->GetPMTName(id,iplane,ipaddle,ipmt) <<endl; |
| 461 |
l2->GetPMTName(id,iplane,ipaddle,ipmt); |
| 462 |
|
| 463 |
Float_t cornerx =0; |
| 464 |
Float_t cornery =0; |
| 465 |
Float_t cornerz =0; |
| 466 |
Float_t dx =0; |
| 467 |
Float_t dy =0; |
| 468 |
Float_t dz =0; |
| 469 |
GetToFPaddlePosition(iplane,ipaddle,cornerx,cornery,cornerz,dx,dy,dz); |
| 470 |
Float_t tofres = 1.; //cm |
| 471 |
Int_t fillstylex = 0; |
| 472 |
Int_t fillstyley = 0; |
| 473 |
if( iplane==0 || iplane==3 || iplane==4 ){ |
| 474 |
cornery = track->ytofpos[(Int_t)(iplane/2)] - tofres/2.; |
| 475 |
dy = tofres; |
| 476 |
fillstyley = 1; |
| 477 |
// cout << track->ytofpos[(Int_t)(iplane/2)] << " " << (Int_t)(iplane/2) << endl; |
| 478 |
} |
| 479 |
if( iplane==1 || iplane==2 || iplane==5 ){ |
| 480 |
cornerx = track->xtofpos[(Int_t)(iplane/2)] - tofres/2.; |
| 481 |
dx = tofres; |
| 482 |
fillstylex = 1; |
| 483 |
// cout << track->xtofpos[(Int_t)(iplane/2)] << " "<<(Int_t)(iplane/2)<<endl; |
| 484 |
} |
| 485 |
Int_t col =2; |
| 486 |
if( iplane==0 || iplane==1 )col=2; |
| 487 |
if( iplane==2 || iplane==3 )col=46; |
| 488 |
if( iplane==4 || iplane==5 )col=45; |
| 489 |
// cout << cornerx << " "<<cornery << " "<<cornerz << " "<<dx<<" "<<dy<<" "<<dz << endl; |
| 490 |
if(!ttof_x[iplane]){ |
| 491 |
// printf(" iplane %i x %f %f %f %f \n",iplane,cornerx,cornerz,cornerx+dx,cornerz+dz); |
| 492 |
ttof_x[iplane]= new TBox(cornerx,cornerz,cornerx+dx,cornerz+dz); |
| 493 |
ttof_x[iplane]->SetFillStyle(fillstylex); |
| 494 |
ttof_x[iplane]->SetFillColor(col); |
| 495 |
ttof_x[iplane]->SetLineColor(col); |
| 496 |
ttof_x[iplane]->SetLineWidth(1); |
| 497 |
} |
| 498 |
if(!ttof_y[iplane]){ |
| 499 |
// printf(" iplane %i y %f %f %f %f \n",iplane,cornery,cornerz,cornery+dy,cornerz+dz); |
| 500 |
ttof_y[iplane]= new TBox(cornery,cornerz,cornery+dy,cornerz+dz); |
| 501 |
ttof_y[iplane]->SetFillStyle(fillstyley); |
| 502 |
ttof_y[iplane]->SetFillColor(col); |
| 503 |
ttof_y[iplane]->SetLineColor(col); |
| 504 |
ttof_y[iplane]->SetLineWidth(1); |
| 505 |
} |
| 506 |
if(!ttof_t[iplane]){ |
| 507 |
// printf(" iplane %i t %f %f %f %f \n",iplane,cornerx,cornery,cornerx+dx,cornery+dy); |
| 508 |
ttof_t[iplane]= new TBox(cornerx,cornery,cornerx+dx,cornery+dy); |
| 509 |
ttof_t[iplane]->SetFillStyle(0); |
| 510 |
ttof_t[iplane]->SetFillColor(col); |
| 511 |
ttof_t[iplane]->SetLineColor(col); |
| 512 |
ttof_t[iplane]->SetLineWidth(1); |
| 513 |
} |
| 514 |
} |
| 515 |
delete l2; |
| 516 |
|
| 517 |
|
| 518 |
}; |
| 519 |
void GToFTrack::DrawProjectionX(){ |
| 520 |
for(Int_t i=0; i<6; i++)if(ttof_x[i])ttof_x[i]->Draw(); |
| 521 |
}; |
| 522 |
void GToFTrack::DrawProjectionY(){ |
| 523 |
for(Int_t i=0; i<6; i++)if(ttof_y[i])ttof_y[i]->Draw(); |
| 524 |
}; |
| 525 |
void GToFTrack::DrawProjectionT(){ |
| 526 |
for(Int_t i=0; i<6; i++)if(ttof_t[i])ttof_t[i]->Draw(); |
| 527 |
}; |
| 528 |
void GToFTrack::Delete(){ |
| 529 |
for(Int_t i=0; i<6; i++){ |
| 530 |
if( ttof_x[i] )ttof_x[i]->Delete(); |
| 531 |
if( ttof_y[i] )ttof_y[i]->Delete(); |
| 532 |
if( ttof_t[i] )ttof_t[i]->Delete(); |
| 533 |
// if( ttof_x[i] )cout << ttof_x[i]<<endl; |
| 534 |
// if( ttof_y[i] )cout << ttof_y[i]<<endl; |
| 535 |
// if( ttof_t[i] )cout << ttof_t[i]<<endl; |
| 536 |
} |
| 537 |
}; |
| 538 |
void GToFTrack::Dump(ToFTrkVar *tof){ |
| 539 |
|
| 540 |
cout << endl<< "n. tdc hits :"<<tof->npmttdc; |
| 541 |
cout << endl<< "PMTs :"; |
| 542 |
for(Int_t ip=0; ip< tof->npmttdc; ip++)cout << " "<< tof->pmttdc[ip]; |
| 543 |
cout << endl<< "n. adc hits :"<<tof->npmtadc; |
| 544 |
cout << endl<< "PMTs :"; |
| 545 |
for(Int_t ip=0; ip< tof->npmtadc; ip++)cout << " "<< tof->pmtadc[ip]; |
| 546 |
cout << endl<< "dedx :"; |
| 547 |
for(Int_t ib=0; ib< tof->npmtadc; ib++)cout << " "<< tof->dedx[ib]; |
| 548 |
cout << endl<< "beta :"; |
| 549 |
for(Int_t ib=0; ib<13 ; ib++)cout << " "<< tof->beta[ib]; |
| 550 |
cout << endl<< "xtofpos :"; |
| 551 |
for(Int_t ib=0; ib<3 ; ib++)cout << " "<< tof->xtofpos[ib]; |
| 552 |
cout << endl<< "ytofpos :"; |
| 553 |
for(Int_t ib=0; ib<3 ; ib++)cout << " "<<tof->ytofpos[ib]; |
| 554 |
cout << endl; |
| 555 |
} |
| 556 |
|
| 557 |
|
| 558 |
//=============================================================== |
| 559 |
// |
| 560 |
// |
| 561 |
//=============================================================== |
| 562 |
GToFHit::GToFHit(){ |
| 563 |
adchit_x = NULL; |
| 564 |
tdchit_x = NULL; |
| 565 |
adchit_y = NULL; |
| 566 |
tdchit_y = NULL; |
| 567 |
} |
| 568 |
|
| 569 |
GToFHit::GToFHit(Int_t id_pmt, Int_t ishit, Float_t w, Float_t tdc){ |
| 570 |
|
| 571 |
//--------------------------------------- |
| 572 |
// retrieve paddle positions |
| 573 |
//--------------------------------------- |
| 574 |
Int_t iplane = -1; |
| 575 |
Int_t ipaddle = -1; |
| 576 |
Int_t ipmt = -1; |
| 577 |
Int_t id = id_pmt; |
| 578 |
GToFLevel2 temp = GToFLevel2(); |
| 579 |
temp.GetPMTName(id,iplane,ipaddle,ipmt); |
| 580 |
// cout << id << " #### "<< temp.GetPMTName(id,iplane,ipaddle,ipmt) <<endl;; |
| 581 |
|
| 582 |
Float_t cornerx =0; |
| 583 |
Float_t cornery =0; |
| 584 |
Float_t cornerz =0; |
| 585 |
Float_t dx =0; |
| 586 |
Float_t dy =0; |
| 587 |
Float_t dz =0; |
| 588 |
if(iplane==0){ |
| 589 |
cornerx = -NTOF11*DXTOF11/2.+ipaddle*DXTOF11; |
| 590 |
cornery = -DYTOF11/2.; |
| 591 |
cornerz = ZTOF11 - DTTOF11/2.; |
| 592 |
dx = DXTOF11; |
| 593 |
dy = DYTOF11; |
| 594 |
dz = DTTOF11; |
| 595 |
} |
| 596 |
if(iplane==1){ |
| 597 |
cornery = -NTOF12*DYTOF12/2.+ipaddle*DYTOF12; |
| 598 |
cornerx = -DXTOF12/2.; |
| 599 |
cornerz = ZTOF12 - DTTOF12/2.; |
| 600 |
dx = DXTOF12; |
| 601 |
dy = DYTOF12; |
| 602 |
dz = DTTOF12; |
| 603 |
} |
| 604 |
if(iplane==2){ |
| 605 |
cornery = -NTOF21*DYTOF21/2.+(NTOF21-ipaddle-1)*DYTOF21; |
| 606 |
cornerx = -DXTOF21/2.; |
| 607 |
cornerz = ZTOF21 - DTTOF21/2.; |
| 608 |
dx = DXTOF21; |
| 609 |
dy = DYTOF21; |
| 610 |
dz = DTTOF21; |
| 611 |
} |
| 612 |
if(iplane==3){ |
| 613 |
cornerx = -NTOF22*DXTOF22/2.+ipaddle*DXTOF22; |
| 614 |
cornery = -DYTOF22/2.; |
| 615 |
cornerz = ZTOF22 - DTTOF22/2.; |
| 616 |
dx = DXTOF22; |
| 617 |
dy = DYTOF22; |
| 618 |
dz = DTTOF22; |
| 619 |
} |
| 620 |
if(iplane==4){ |
| 621 |
cornerx = -NTOF31*DXTOF31/2.+ipaddle*DXTOF31; |
| 622 |
cornery = -DYTOF31/2.; |
| 623 |
cornerz = ZTOF31 - DTTOF31/2.; |
| 624 |
dx = DXTOF31; |
| 625 |
dy = DYTOF31; |
| 626 |
dz = DTTOF31; |
| 627 |
} |
| 628 |
if(iplane==5){ |
| 629 |
cornery = -NTOF32*DYTOF32/2.+ipaddle*DYTOF32; |
| 630 |
cornerx = -DXTOF32/2.; |
| 631 |
cornerz = ZTOF32 - DTTOF32/2.; |
| 632 |
dx = DXTOF32; |
| 633 |
dy = DYTOF32; |
| 634 |
dz = DTTOF32; |
| 635 |
} |
| 636 |
|
| 637 |
adchit_x = new TBox(cornerx,cornerz,cornerx+dx,cornerz+dz); |
| 638 |
adchit_y = new TBox(cornery,cornerz,cornery+dy,cornerz+dz); |
| 639 |
|
| 640 |
tdchit_x = new TBox(cornerx,cornerz,cornerx+dx,cornerz+dz); |
| 641 |
tdchit_y = new TBox(cornery,cornerz,cornery+dy,cornerz+dz); |
| 642 |
|
| 643 |
//set color according to w |
| 644 |
Int_t colo = 0; |
| 645 |
Float_t ww = fabs(w); |
| 646 |
if ( ww > 0.7 ) colo = 38; |
| 647 |
if ( ww > 2. ) colo = 4; |
| 648 |
if ( ww > 10. ) colo = 3; |
| 649 |
if ( ww > 100. ) colo = 2; |
| 650 |
if ( ww > 500. ) colo = 6; |
| 651 |
|
| 652 |
if(w<0){ // both PMT hit |
| 653 |
adchit_x->SetFillStyle(1001); |
| 654 |
adchit_x->SetFillColor(colo); |
| 655 |
adchit_y->SetFillStyle(1001); |
| 656 |
adchit_y->SetFillColor(colo); |
| 657 |
}else{ // single PMT hit |
| 658 |
adchit_x->SetFillStyle(3356); |
| 659 |
adchit_x->SetFillColor(colo); |
| 660 |
adchit_y->SetFillStyle(3356); |
| 661 |
adchit_y->SetFillColor(colo); |
| 662 |
} |
| 663 |
|
| 664 |
tdchit_x->SetFillStyle(0); |
| 665 |
tdchit_x->SetLineColor(LCOL); |
| 666 |
tdchit_y->SetFillStyle(0); |
| 667 |
tdchit_y->SetLineColor(LCOL); |
| 668 |
if(ishit){ |
| 669 |
tdchit_x->SetLineWidth(1); |
| 670 |
tdchit_x->SetLineColor(1); |
| 671 |
tdchit_y->SetLineWidth(1); |
| 672 |
tdchit_y->SetLineColor(1); |
| 673 |
} |
| 674 |
if(tdc>0){ |
| 675 |
tdchit_x->SetLineWidth(1); |
| 676 |
tdchit_x->SetLineColor(1); |
| 677 |
tdchit_x->SetLineStyle(7); |
| 678 |
tdchit_y->SetLineWidth(1); |
| 679 |
tdchit_y->SetLineColor(1); |
| 680 |
tdchit_y->SetLineStyle(7); |
| 681 |
} |
| 682 |
|
| 683 |
|
| 684 |
} |
| 685 |
|
| 686 |
GToFHit::GToFHit( GToFHit* gc ){ |
| 687 |
adchit_x = new TBox(*(gc->adchit_x)); |
| 688 |
adchit_y = new TBox(*(gc->adchit_y)); |
| 689 |
tdchit_x = new TBox(*(gc->tdchit_x)); |
| 690 |
tdchit_y = new TBox(*(gc->tdchit_y)); |
| 691 |
}; |
| 692 |
|
| 693 |
void GToFHit::Delete(){ |
| 694 |
adchit_x->Delete(); |
| 695 |
adchit_y->Delete(); |
| 696 |
tdchit_x->Delete(); |
| 697 |
tdchit_y->Delete(); |
| 698 |
}; |
| 699 |
|
| 700 |
void GToFHit::DrawProjectionX(){ |
| 701 |
adchit_x->Draw(); |
| 702 |
tdchit_x->Draw(); |
| 703 |
}; |
| 704 |
void GToFHit::DrawProjectionY(){ |
| 705 |
adchit_y->Draw(); |
| 706 |
tdchit_y->Draw(); |
| 707 |
}; |
| 708 |
|
| 709 |
|
| 710 |
ClassImp(GToFVolume); |
| 711 |
ClassImp(GToFLevel2); |
| 712 |
ClassImp(GToFTrack); |
| 713 |
ClassImp(GToFHit); |