| 1 |
// |
// |
| 2 |
// Given a calibration and a data file this program create an ntuple with LEVEL2 calorimeter variables - Emiliano Mocchiutti |
// Given a calibration and a data file this program create an ntuple with LEVEL2 calorimeter variables - Emiliano Mocchiutti |
| 3 |
// |
// |
| 4 |
// CaloLEVEL2.c version 4.00 (2005-11-29) |
// CaloLEVEL2.c version 4.01 (2006-01-11) |
| 5 |
// |
// |
| 6 |
// The only input needed is the path to the directory created by YODA for the data file you want to analyze. |
// The only input needed is the path to the directory created by YODA for the data file you want to analyze. |
| 7 |
// |
// |
| 8 |
// Changelog: |
// Changelog: |
| 9 |
// |
// |
| 10 |
|
// 4.00 - 4.01 (2006-01-11): Bugs: in Makefile (nothing to worry about) and here clevel1.trkchi2 never filled! fixed. Not really processing self trigger events! fixed. |
| 11 |
|
// Bug: not setting small values to zero after applying the cross-talk correction! fixed. |
| 12 |
|
// |
| 13 |
// 3.17 - 4.00 (2005-11-29): preparing for the final release, small changes in the makefile. |
// 3.17 - 4.00 (2005-11-29): preparing for the final release, small changes in the makefile. |
| 14 |
// |
// |
| 15 |
// 3.16 - 3.17 (2005-10-13): do not exclude all strips marked "bad" but only the ones with RMS>6. |
// 3.16 - 3.17 (2005-10-13): do not exclude all strips marked "bad" but only the ones with RMS>6. |
| 406 |
}; |
}; |
| 407 |
chdone[se] = 1; |
chdone[se] = 1; |
| 408 |
}; |
}; |
| 409 |
if ( clevel2.crc[se] == 0 && calib.good2 == 1 ){ |
if ( clevel2.crc[se] == 0 && (calib.good2 == 1 || clevel2.trigty == 2)){ |
| 410 |
pre = -1; |
pre = -1; |
| 411 |
if ( isRAW ){ |
if ( isRAW ){ |
| 412 |
for (Int_t nn = 0; nn < 96; nn++){ |
for (Int_t nn = 0; nn < 96; nn++){ |
| 511 |
// OK, now in estrip we have the energy deposit in MIP of all the strips for this event (at the end of loops of course) |
// OK, now in estrip we have the energy deposit in MIP of all the strips for this event (at the end of loops of course) |
| 512 |
// |
// |
| 513 |
// if ( clevel1.estrip[n][m][l] < evento.emin || calib.calgood[l][m][n] != 0 ) { |
// if ( clevel1.estrip[n][m][l] < evento.emin || calib.calgood[l][m][n] != 0 ) { |
| 514 |
if ( clevel1.estrip[n][m][l] < evento.emin || calib.calrms[l][m][n] > 26 ) { |
// if ( clevel1.estrip[n][m][l] < evento.emin || calib.calrms[l][m][n] > 26 ) { |
| 515 |
clevel1.estrip[n][m][l] = 0.; |
// clevel1.estrip[n][m][l] = 0.; |
| 516 |
}; |
// }; |
| 517 |
qpre[pre] += clevel1.estrip[n][m][l]; |
qpre[pre] += clevel1.estrip[n][m][l]; |
| 518 |
}; |
}; |
| 519 |
calib.sbase[l][m][pre] = evento.base[l][m][pre]; |
calib.sbase[l][m][pre] = evento.base[l][m][pre]; |
| 535 |
}; |
}; |
| 536 |
}; |
}; |
| 537 |
// |
// |
| 538 |
Int_t jj = -2; |
Int_t j4 = -4; |
| 539 |
Int_t jjj = -3; |
Int_t jjj = -3; |
| 540 |
for (Int_t j = 0 ; j < 98 ; j++){ |
Int_t jj = -2; |
| 541 |
|
for (Int_t j = 0 ; j < 100 ; j++){ |
| 542 |
jj++; |
jj++; |
| 543 |
jjj++; |
jjj++; |
| 544 |
|
j4++; |
| 545 |
if ( j < 96 ) ene[j] = clevel1.estrip[j][m][l]; |
if ( j < 96 ) ene[j] = clevel1.estrip[j][m][l]; |
| 546 |
if ( jj >= 0 && jj < 96 ){ |
if ( jj >= 0 && jj < 96 ){ |
| 547 |
if ( jj != 0 && jj != 32 && jj != 64 ) ene[jj-1] = ene[jj-1] - clevel1.estrip[jj][m][l] * 0.01581; |
if ( jj != 0 && jj != 32 && jj != 64 ) ene[jj-1] = ene[jj-1] - clevel1.estrip[jj][m][l] * 0.01581; |
| 551 |
if ( jjj != 0 && jjj != 32 && jjj != 64 ) clevel1.estrip[jjj-1][m][l] = clevel1.estrip[jjj-1][m][l] - ene[jjj] * 0.01581; |
if ( jjj != 0 && jjj != 32 && jjj != 64 ) clevel1.estrip[jjj-1][m][l] = clevel1.estrip[jjj-1][m][l] - ene[jjj] * 0.01581; |
| 552 |
if ( jjj != 31 && jjj != 63 && jjj != 95 ) clevel1.estrip[jjj+1][m][l] = clevel1.estrip[jjj+1][m][l] - ene[jjj] * 0.01581; |
if ( jjj != 31 && jjj != 63 && jjj != 95 ) clevel1.estrip[jjj+1][m][l] = clevel1.estrip[jjj+1][m][l] - ene[jjj] * 0.01581; |
| 553 |
}; |
}; |
| 554 |
|
if ( j4 >= 0 && j4 < 96 ){ |
| 555 |
|
if ( clevel1.estrip[j4][m][l]!=0. && ( clevel1.estrip[j4][m][l] < evento.emin || calib.calrms[l][m][j4] > 26 )){ |
| 556 |
|
clevel1.estrip[j4][m][l] = 0.; |
| 557 |
|
}; |
| 558 |
|
}; |
| 559 |
}; |
}; |
| 560 |
// |
// |
| 561 |
} else { |
} else { |
| 576 |
// |
// |
| 577 |
// all we need from the tracker is the state vector al_p and the boolean for good events: |
// all we need from the tracker is the state vector al_p and the boolean for good events: |
| 578 |
// |
// |
| 579 |
|
clevel1.trkchi2 = calib.trkchi2; |
| 580 |
if ( calib.good2 ){ |
if ( calib.good2 ){ |
| 581 |
for (Int_t e = 0; e<5 ; e++){ |
for (Int_t e = 0; e<5 ; e++){ |
| 582 |
clevel1.al_p[e][0] = calib.al_p[e][0]; |
clevel1.al_p[e][0] = calib.al_p[e][0]; |
| 592 |
}; |
}; |
| 593 |
// |
// |
| 594 |
// for each event generate level2 data (clevel2) calling the fortran routine and passing calibrated data (clevel1): |
// for each event generate level2 data (clevel2) calling the fortran routine and passing calibrated data (clevel1): |
| 595 |
// |
// |
| 596 |
cfillcalol2(clevel1,clevel2); |
cfillcalol2(clevel1,clevel2); |
| 597 |
// |
// |
| 598 |
// save in the class the level2 calorimeter informations |
// save in the class the level2 calorimeter informations |
| 1403 |
// ====> NOTICE: in the case of no tracks or not good tracker events the program will fill the ntuple with zero values; <==== |
// ====> NOTICE: in the case of no tracks or not good tracker events the program will fill the ntuple with zero values; <==== |
| 1404 |
// ====> in case of multiple tracks the program will calculate variables using the state vector and rigidity of the first track stored <==== |
// ====> in case of multiple tracks the program will calculate variables using the state vector and rigidity of the first track stored <==== |
| 1405 |
// |
// |
| 1406 |
|
printf("Event %i \n",i); |
| 1407 |
caloerr = calolevel2core(i,b,otr,tree,clevel2,evento,calib,calcalibfile); |
caloerr = calolevel2core(i,b,otr,tree,clevel2,evento,calib,calcalibfile); |
| 1408 |
// |
// |
| 1409 |
// |
// |