| 18 |
**/ |
**/ |
| 19 |
CaloStrip::CaloStrip() { |
CaloStrip::CaloStrip() { |
| 20 |
c1 = 0; |
c1 = 0; |
| 21 |
|
debug = false; |
| 22 |
this->Clear(); |
this->Clear(); |
| 23 |
}; |
}; |
| 24 |
|
|
| 27 |
**/ |
**/ |
| 28 |
CaloStrip::CaloStrip(Bool_t mechalig) { |
CaloStrip::CaloStrip(Bool_t mechalig) { |
| 29 |
c1 = 0; |
c1 = 0; |
| 30 |
|
debug = false; |
| 31 |
this->Clear(); |
this->Clear(); |
| 32 |
if ( mechalig ){ |
if ( mechalig ){ |
| 33 |
ismech = true; |
ismech = true; |
| 46 |
**/ |
**/ |
| 47 |
CaloStrip::CaloStrip(CaloLevel1 *calo) { |
CaloStrip::CaloStrip(CaloLevel1 *calo) { |
| 48 |
c1 = calo->GetCaloLevel1(); |
c1 = calo->GetCaloLevel1(); |
| 49 |
|
debug = false; |
| 50 |
this->Clear(); |
this->Clear(); |
| 51 |
ismech = false; |
ismech = false; |
| 52 |
UseStandardAlig(); |
UseStandardAlig(); |
| 57 |
**/ |
**/ |
| 58 |
CaloStrip::CaloStrip(CaloLevel1 *calo, Bool_t mechalig) { |
CaloStrip::CaloStrip(CaloLevel1 *calo, Bool_t mechalig) { |
| 59 |
c1 = calo->GetCaloLevel1(); |
c1 = calo->GetCaloLevel1(); |
| 60 |
|
debug = false; |
| 61 |
this->Clear(); |
this->Clear(); |
| 62 |
if ( mechalig ){ |
if ( mechalig ){ |
| 63 |
ismech = true; |
ismech = true; |
| 74 |
/** |
/** |
| 75 |
* Clear variables |
* Clear variables |
| 76 |
**/ |
**/ |
| 77 |
void CaloStrip::Clear() { |
void CaloStrip::Clear(Option_t *t) { |
| 78 |
fE = 0.; |
fE = 0.; |
| 79 |
fX = 0.; |
fX = 0.; |
| 80 |
fY = 0.; |
fY = 0.; |
| 122 |
// |
// |
| 123 |
// determine where I can find calorimeter ADC to MIP conversion file |
// determine where I can find calorimeter ADC to MIP conversion file |
| 124 |
// |
// |
| 125 |
printf(" Querying DB for calorimeter parameters files...\n"); |
if ( debug ) printf(" Querying DB for calorimeter parameters files...\n"); |
| 126 |
// |
// |
| 127 |
// |
// |
| 128 |
// |
// |
| 134 |
aligfile << glparam->PATH.Data() << "/"; |
aligfile << glparam->PATH.Data() << "/"; |
| 135 |
aligfile << glparam->NAME.Data(); |
aligfile << glparam->NAME.Data(); |
| 136 |
// |
// |
| 137 |
printf("\n Using parameter file: \n %s \n",aligfile.str().c_str()); |
if (debug) printf("\n Using parameter file: \n %s \n",aligfile.str().c_str()); |
| 138 |
f = fopen(aligfile.str().c_str(),"rb"); |
f = fopen(aligfile.str().c_str(),"rb"); |
| 139 |
if ( f ){ |
if ( f ){ |
| 140 |
// |
// |
| 147 |
// |
// |
| 148 |
}; |
}; |
| 149 |
dbc->Close(); |
dbc->Close(); |
| 150 |
|
delete dbc; |
| 151 |
|
dbc = 0; |
| 152 |
}; |
}; |
| 153 |
if ( !UXal ){ |
if ( !UXal ){ |
| 154 |
// |
// |
| 319 |
}; |
}; |
| 320 |
|
|
| 321 |
/** |
/** |
| 322 |
|
* Given a point in the space or a strip it returns the Silicon sensor number. Numbering goes like this: |
| 323 |
|
* |
| 324 |
|
* y ^ |
| 325 |
|
* | |
| 326 |
|
* | 6 7 8 |
| 327 |
|
* | 3 4 5 |
| 328 |
|
* | 0 1 2 |
| 329 |
|
* | -----------> x |
| 330 |
|
* |
| 331 |
|
**/ |
| 332 |
|
Int_t CaloStrip::GetSiSensor() { |
| 333 |
|
// |
| 334 |
|
// fX fY fZ // fView fPlane |
| 335 |
|
// |
| 336 |
|
Float_t deadsi = 0.096; |
| 337 |
|
Float_t dead = 0.05; |
| 338 |
|
Float_t sidim = 8.00; |
| 339 |
|
// Float_t stripdim = 0.244; |
| 340 |
|
Float_t sensitarea = 7.808; |
| 341 |
|
// |
| 342 |
|
Float_t xoffset = 0.; |
| 343 |
|
Float_t yoffset = 0.; |
| 344 |
|
// |
| 345 |
|
if ( (fView-1) == 0 && !((fPlane-1)%2) ){ |
| 346 |
|
xoffset = +0.05; |
| 347 |
|
yoffset = 0.0; |
| 348 |
|
}; |
| 349 |
|
if ( (fView-1) == 0 && ((fPlane-1)%2) ){ |
| 350 |
|
xoffset = -0.05; |
| 351 |
|
yoffset = -0.20; |
| 352 |
|
}; |
| 353 |
|
if ( (fView-1) == 1 && !((fPlane-1)%2) ){ |
| 354 |
|
xoffset = +0.10; |
| 355 |
|
yoffset = -0.05; |
| 356 |
|
}; |
| 357 |
|
if ( (fView-1) == 1 && ((fPlane-1)%2) ){ |
| 358 |
|
xoffset = -0.10; |
| 359 |
|
yoffset = -0.15; |
| 360 |
|
}; |
| 361 |
|
// |
| 362 |
|
Int_t iind = -1; |
| 363 |
|
Int_t jind = -1; |
| 364 |
|
// |
| 365 |
|
for (Int_t i = 0; i < 3; i++){ |
| 366 |
|
if ( (fX+xoffset+12.1) >= (deadsi+(sidim+dead)*i) && (fX+xoffset+12.1) <= (sensitarea+deadsi+(sidim+dead)*i) ){ |
| 367 |
|
iind = i; |
| 368 |
|
break; |
| 369 |
|
}; |
| 370 |
|
}; |
| 371 |
|
// |
| 372 |
|
for (Int_t j = 0; j < 3; j++){ |
| 373 |
|
if ( (fY+yoffset+12.1) >= (deadsi+(sidim+dead)*j) && (fY+yoffset+12.1) <= (sensitarea+deadsi+(sidim+dead)*j) ){ |
| 374 |
|
jind = j; |
| 375 |
|
break; |
| 376 |
|
}; |
| 377 |
|
}; |
| 378 |
|
// |
| 379 |
|
Int_t sensor = -1; |
| 380 |
|
if ( iind != -1 && jind != -1 ){ |
| 381 |
|
sensor = iind + jind * 3; |
| 382 |
|
}; |
| 383 |
|
// |
| 384 |
|
// printf(" View %i Plane %i x %f y %f z %f xoffset %f yoffset %f iind %i jind %i \n",fView,fPlane,fX,fY,fZ,xoffset,yoffset,iind,jind); |
| 385 |
|
// |
| 386 |
|
return(sensor); |
| 387 |
|
// |
| 388 |
|
}; |
| 389 |
|
|
| 390 |
|
/** |
| 391 |
* CaloLevel1 constructor |
* CaloLevel1 constructor |
| 392 |
**/ |
**/ |
| 393 |
CaloLevel1::CaloLevel1() { |
CaloLevel1::CaloLevel1() { |
| 401 |
/** |
/** |
| 402 |
* Clear the CaloLevel1 object |
* Clear the CaloLevel1 object |
| 403 |
**/ |
**/ |
| 404 |
void CaloLevel1::Clear() { |
void CaloLevel1::Clear(Option_t *t) { |
| 405 |
// |
// |
| 406 |
istrip = 0; |
istrip = 0; |
| 407 |
estrip.Reset(); |
estrip.Reset(); |
| 439 |
* Given estrip entry returns energy plus view, plane and strip numbers |
* Given estrip entry returns energy plus view, plane and strip numbers |
| 440 |
**/ |
**/ |
| 441 |
Float_t CaloLevel1::DecodeEstrip(Int_t entry, Int_t &view, Int_t &plane, Int_t &strip){ |
Float_t CaloLevel1::DecodeEstrip(Int_t entry, Int_t &view, Int_t &plane, Int_t &strip){ |
| 442 |
|
Bool_t sat = false; |
| 443 |
|
Float_t mip=this->DecodeEstrip(entry,view,plane,strip,sat); |
| 444 |
|
return(mip); |
| 445 |
|
}; |
| 446 |
|
|
| 447 |
|
/** |
| 448 |
|
* Given estrip entry returns energy plus view, plane, strip numbers and saturation info |
| 449 |
|
**/ |
| 450 |
|
Float_t CaloLevel1::DecodeEstrip(Int_t entry, Int_t &view, Int_t &plane, Int_t &strip, Bool_t &saturated){ |
| 451 |
// |
// |
| 452 |
if ( entry>istrip ) return(0.); |
if ( entry>istrip ){ |
| 453 |
|
// |
| 454 |
|
printf(" ERROR: problems decoding entry %i, it seems that number of entries is %i\n",entry,istrip); |
| 455 |
|
// |
| 456 |
|
return(0.); |
| 457 |
|
}; |
| 458 |
// |
// |
| 459 |
// printf(" num lim %f \n",std::numeric_limits<Float_t>::max()); |
// printf(" num lim %f \n",std::numeric_limits<Float_t>::max()); |
| 460 |
// printf(" estrip.At(%i) = %i \n",entry,estrip.At(entry)); |
// printf(" estrip.At(%i) = %i \n",entry,estrip.At(entry)); |
| 496 |
// |
// |
| 497 |
strip = (Int_t)truncf((Float_t)((eval - fbi*1000000000 -plom*10000000)/100000)); |
strip = (Int_t)truncf((Float_t)((eval - fbi*1000000000 -plom*10000000)/100000)); |
| 498 |
// |
// |
| 499 |
Float_t mip = ((Float_t)(eval - fbi*1000000000 -plom*10000000 -strip*100000))/tim; |
Double_t mip = (Double_t)(((Float_t)(eval - fbi*1000000000 -plom*10000000 -strip*100000))/tim); |
| 500 |
// |
// |
| 501 |
if ( mip > 0. && mip < 99999. ) return(mip); |
saturated = false; |
| 502 |
|
if ( mip > 5000. ){ |
| 503 |
|
mip -= 5000.; |
| 504 |
|
saturated = true; |
| 505 |
|
}; |
| 506 |
|
if ( mip > 0. && mip < 99999. ) return((Float_t)mip); |
| 507 |
// |
// |
| 508 |
printf(" WARNING: problems decoding value %i at entry %i \n",estrip.At(entry),entry); |
printf(" ERROR: problems decoding value %i at entry %i \n",estrip.At(entry),entry); |
| 509 |
// |
// |
| 510 |
view = -1; |
view = -1; |
| 511 |
plane = -1; |
plane = -1; |
| 517 |
* Returns energy released on plane nplane (where 0<= nplane <= 43, 0 = 1Y, 1 = 1X, 2 = 2Y, 3 = 2X, etc. etc.). |
* Returns energy released on plane nplane (where 0<= nplane <= 43, 0 = 1Y, 1 = 1X, 2 = 2Y, 3 = 2X, etc. etc.). |
| 518 |
*/ |
*/ |
| 519 |
Float_t CaloLevel1::qtotpl(Int_t nplane){ |
Float_t CaloLevel1::qtotpl(Int_t nplane){ |
| 520 |
|
Bool_t sat = false; |
| 521 |
|
Float_t mip = this->qtotpl(nplane,sat); |
| 522 |
|
return(mip); |
| 523 |
|
}; |
| 524 |
|
|
| 525 |
|
/* |
| 526 |
|
* Returns energy released on plane nplane (where 0<= nplane <= 43, 0 = 1Y, 1 = 1X, 2 = 2Y, 3 = 2X, etc. etc.). |
| 527 |
|
*/ |
| 528 |
|
Float_t CaloLevel1::qtotpl(Int_t nplane, Bool_t &sat){ |
| 529 |
// |
// |
| 530 |
|
sat = false; |
| 531 |
Int_t sview = 1; |
Int_t sview = 1; |
| 532 |
if ( nplane%2 ) sview = 0; |
if ( nplane%2 ) sview = 0; |
| 533 |
// |
// |
| 534 |
Int_t splane = nplane-(sview+1)/2; |
// Int_t splane = nplane-(sview+1)/2; |
| 535 |
|
Int_t splane = (nplane+sview-1)/2; |
| 536 |
// |
// |
| 537 |
Float_t totmip = qtotpl(sview,splane); |
Float_t totmip = qtotpl(sview,splane,sat); |
| 538 |
// |
// |
| 539 |
return(totmip); |
return(totmip); |
| 540 |
// |
// |
| 544 |
* Returns energy released on view "view" (0 = X, 1 = Y) and plane "plane" ( 0 <= plane <= 21 ). |
* Returns energy released on view "view" (0 = X, 1 = Y) and plane "plane" ( 0 <= plane <= 21 ). |
| 545 |
*/ |
*/ |
| 546 |
Float_t CaloLevel1::qtotpl(Int_t sview, Int_t splane){ |
Float_t CaloLevel1::qtotpl(Int_t sview, Int_t splane){ |
| 547 |
|
Bool_t sat = false; |
| 548 |
|
Float_t mip = this->qtotpl(sview,splane,sat); |
| 549 |
|
return(mip); |
| 550 |
|
}; |
| 551 |
|
|
| 552 |
|
/* |
| 553 |
|
* Returns energy released on view "view" (0 = X, 1 = Y) and plane "plane" ( 0 <= plane <= 21 ). |
| 554 |
|
*/ |
| 555 |
|
Float_t CaloLevel1::qtotpl(Int_t sview, Int_t splane, Bool_t &sat){ |
| 556 |
// |
// |
| 557 |
Int_t view = -1; |
Int_t view = -1; |
| 558 |
Int_t plane = -1; |
Int_t plane = -1; |
| 559 |
Int_t strip = -1; |
Int_t strip = -1; |
| 560 |
|
Bool_t lsat = false; |
| 561 |
|
sat = false; |
| 562 |
// |
// |
| 563 |
Float_t mip = 0.; |
Float_t mip = 0.; |
| 564 |
Float_t totmip = 0.; |
Float_t totmip = 0.; |
| 567 |
// |
// |
| 568 |
for (Int_t i = 0; i<istrip; i++ ){ |
for (Int_t i = 0; i<istrip; i++ ){ |
| 569 |
// |
// |
| 570 |
mip = DecodeEstrip(i,view,plane,strip); |
mip = DecodeEstrip(i,view,plane,strip,lsat); |
| 571 |
// |
// |
| 572 |
if ( view == sview && splane == plane ) totmip += mip; |
if ( view == sview && splane == plane ){ |
| 573 |
|
if ( lsat ) sat = true; |
| 574 |
|
totmip += mip; |
| 575 |
|
//printf(" totmip %f mip %f \n",totmip,mip); |
| 576 |
|
}; |
| 577 |
// |
// |
| 578 |
// entry are ordered by strip, plane and view number. Go out if you pass the input strip |
// entry are ordered by strip, plane and view number. Go out if you pass the input strip |
| 579 |
// |
// |