/[PAMELA software]/DarthVader/CalorimeterLevel2/src/CaloLevel0.cpp
ViewVC logotype

Diff of /DarthVader/CalorimeterLevel2/src/CaloLevel0.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.25 by mocchiut, Fri Dec 12 16:18:17 2008 UTC revision 1.29 by mocchiut, Fri Jan 22 08:56:36 2010 UTC
# Line 100  CaloLevel0::CaloLevel0(){ Line 100  CaloLevel0::CaloLevel0(){
100    calopar4 = true;    calopar4 = true;
101    calopar5 = true;    calopar5 = true;
102    crosst = true;    crosst = true;
103      mask18 = false;
104    ftcalopar1 = 0;    ftcalopar1 = 0;
105    ttcalopar1 = 0;    ttcalopar1 = 0;
106    ftcalopar2 = 0;    ftcalopar2 = 0;
# Line 1189  Int_t CaloLevel0::Calibrate(Int_t ei){ Line 1190  Int_t CaloLevel0::Calibrate(Int_t ei){
1190    //    //
1191    clevel2->nsatstrip = 0.;    clevel2->nsatstrip = 0.;
1192    Int_t val = 0;    Int_t val = 0;
1193    Int_t del = 1100;    Int_t del = 1000;
1194    for (Int_t sec = 0; sec < 4; sec++){    for (Int_t sec = 0; sec < 4; sec++){
1195      for (Int_t dsec = 0; dsec < 7; dsec++){      for (Int_t dsec = 0; dsec < 7; dsec++){
1196        val = (Int_t)de->calselftrig[sec][dsec];        val = (Int_t)de->calselftrig[sec][dsec];
# Line 1198  Int_t CaloLevel0::Calibrate(Int_t ei){ Line 1199  Int_t CaloLevel0::Calibrate(Int_t ei){
1199      };      };
1200    };    };
1201    val = 0;    val = 0;
1202    del = 1100;    del = 1000;
1203    if ( clevel2->trigty != 2. ){    if ( clevel2->trigty < 2. ){
1204      Bool_t ck = false;      Bool_t ck = false;
1205      for (Int_t sec = 0; sec < 4; sec++){      for (Int_t sec = 0; sec < 4; sec++){
1206        val = (Int_t)de->calselftrig[sec][6];        val = (Int_t)de->calselftrig[sec][6];
1207        del = delay(val);        del = delay(val);
1208        if ( del < 1100 ){        if ( del < 1000 ){
1209          clevel2->wartrig = 0.;                clevel2->wartrig = 0.;      
1210          clevel2->trigty = 3.;          clevel2->trigty = 3.;
1211          ck = true;          ck = true;
1212          break;          break;
1213        };        };
1214      };      };
1215      if ( !ck ) clevel2->wartrig = 100.;            //    if ( !ck ) clevel2->wartrig = 100.;      
1216    } else {    } else {
1217      Bool_t ck = false;      Bool_t ck = false;
1218      for (Int_t sec = 0; sec < 4; sec++){      for (Int_t sec = 0; sec < 4; sec++){
1219        val = (Int_t)de->calselftrig[sec][6];        val = (Int_t)de->calselftrig[sec][6];
1220        del = delay(val);        del = delay(val);
1221        if ( del < 1100 ){        if ( del < 1000 ){
1222          clevel2->wartrig = 0.;                clevel2->wartrig = 0.;      
1223          ck = true;          ck = true;
1224        };        };
# Line 1252  Int_t CaloLevel0::Calibrate(Int_t ei){ Line 1253  Int_t CaloLevel0::Calibrate(Int_t ei){
1253    //    //
1254    Float_t ener0 = 0.;    Float_t ener0 = 0.;
1255    Float_t cbase0 = 0.;    Float_t cbase0 = 0.;
1256      Float_t totbase = 0.;
1257      Float_t totped = 0.;
1258    Bool_t pproblem = false;    Bool_t pproblem = false;
1259    Bool_t negbase = false;    Bool_t negbase = false;
1260    //    //
# Line 1366  Int_t CaloLevel0::Calibrate(Int_t ei){ Line 1369  Int_t CaloLevel0::Calibrate(Int_t ei){
1369          //          //
1370          pre = -1;          pre = -1;
1371          ener0 = 0.;          ener0 = 0.;
1372            totbase = 0.;
1373            totped = 0.;
1374          for (Int_t i = 0 ; i < 3 ; i++){          for (Int_t i = 0 ; i < 3 ; i++){
1375            ip[i] = 0;            ip[i] = 0;
1376            for (Int_t n = i*32 ; n < (i+1)*32 ; n++){                            for (Int_t n = i*32 ; n < (i+1)*32 ; n++){                
# Line 1433  Int_t CaloLevel0::Calibrate(Int_t ei){ Line 1438  Int_t CaloLevel0::Calibrate(Int_t ei){
1438              ener = dexyc[l][m][n];              ener = dexyc[l][m][n];
1439              ener0 += ener;              ener0 += ener;
1440              clevel1->estrip[n][m][l] = 0.;              clevel1->estrip[n][m][l] = 0.;
1441                totbase += de->base[l][m][pre]/96.;
1442                totped += fabs(calped[l][m][n]);
1443              if ( de->base[l][m][pre] < 0 ) negbase = true;              if ( de->base[l][m][pre] < 0 ) negbase = true;
1444              if ( base0>0 && base0 < 30000. ){              if ( base0>0 && base0 < 30000. ){
1445                //                //
# Line 1456  Int_t CaloLevel0::Calibrate(Int_t ei){ Line 1463  Int_t CaloLevel0::Calibrate(Int_t ei){
1463          };          };
1464          //          //
1465          // check if there were problems with 5.7 or glitches in the power supply          // check if there were problems with 5.7 or glitches in the power supply
1466          //          //
1467          if ( ((ener0 == 0. && cbase0 == 0.) || negbase ) && !pproblem && clevel2->perr[se] == 0){          //      if ( ((ener0 == 0. && cbase0 == 0.) || negbase || totbase > 196600. || totped < 1. ) && !pproblem && clevel2->perr[se] == 0){   // check pedestal and baseline values for one plane, if all zeros calibration is not valid (calorimeter power problems) [8th data reduction bug, fixed on 25/11/2009 by E.M.]
1468            if ( verbose ) printf(" L0 entry %i : calorimeter power problems! event marked as bad perr %f swerr %X view %i plane %i \n",ei,de->perror[se],de->stwerr[se],l,m);          if ( ((ener0 == 0. && cbase0 == 0.) || negbase || totbase > 32700. || totped < 1. ) && !pproblem && clevel2->perr[se] == 0){    // check pedestal and baseline values for one plane, if all zeros calibration is not valid (calorimeter power problems) [8th data reduction bug, fixed on 25/11/2009 by E.M.]
1469              if ( verbose ) printf(" L0 entry %i : calorimeter power problems! event marked as bad perr %f swerr %X view %i plane %i negbase %i totbase %f totped %f\n",ei,de->perror[se],de->stwerr[se],l,m, negbase, totbase, totped);
1470            pproblem = true;            pproblem = true;
1471            pe++;            pe++;
1472          };          };
# Line 1745  Int_t CaloLevel0::Calibrate(Int_t ei){ Line 1753  Int_t CaloLevel0::Calibrate(Int_t ei){
1753            // CALOLEVEL1 CODING AND FILLING            // CALOLEVEL1 CODING AND FILLING
1754            //            //
1755            //            //
1756            // NOTICE: THE FOLLOWING LINE EXCLUDE ALL STRIPS FOR WHICH THE RMS*4 IS GREATER THAN 26 !!! <=============== IMPORTANT! =================>            // NOTICE: THE FOLLOWING LINE EXCLUDE ALL STRIPS FOR WHICH THE RMS*4 IS GREATER THAN 26 !!! <=============== IMPORTANT! =================> // not true anymore, now it trust parameter files
1757            //            //
1758            if ( obadmask[l][m][j4] == 1 || clevel1->estrip[j4][m][l] <= clevel1->emin || clevel1->estrip[j4][m][l] <= memin[l][m][j4] || calrms[l][m][j4] > maxrms[l][m] ){            if ( obadmask[l][m][j4] == 1 || clevel1->estrip[j4][m][l] <= clevel1->emin || clevel1->estrip[j4][m][l] <= memin[l][m][j4] || calrms[l][m][j4] > maxrms[l][m] || (l==0 && m == 18 && mask18 ) ){
1759              clevel1->estrip[j4][m][l] = 0.;              clevel1->estrip[j4][m][l] = 0.;
1760            };            };
1761            //            //
1762              if ( debug ) printf(" STRIP: view %i plane %i strip %i energy: %f \n",l,m,j4,clevel1->estrip[j4][m][l]);
1763              //
1764            // code and save the energy for each strip in svstrip                // code and save the energy for each strip in svstrip    
1765            //            //
1766            if ( clevel1->estrip[j4][m][l] > clevel1->emin ){            if ( clevel1->estrip[j4][m][l] > clevel1->emin ){
1767              //              //
1768              Float_t savel1 = clevel1->estrip[j4][m][l];              Float_t savel1 = clevel1->estrip[j4][m][l];
1769                //
1770                if ( m == 18 && l == 0 ){
1771                  if ( debug ) printf(" Resetting plane 18X for variable calculation: view %i plane %i strip %i \n",l,m,j4);
1772                  clevel1->estrip[j4][m][l] = 0.; // SAVE STRIPS VALUE FOR PLANE 18 X but DO NOT USE IT FOR VARIABLE CALCULATION
1773                };
1774                if ( debug ) printf(" HIT STRIP: view %i plane %i strip %i energy: %f \n",l,m,j4,clevel1->estrip[j4][m][l]);
1775              //      if ( dexyc[l][m][j4] == 32767. ){              //      if ( dexyc[l][m][j4] == 32767. ){
1776              if ( dexyc[l][m][j4] > 32000. ){              if ( dexyc[l][m][j4] > 32000. ){
1777                savel1 += 5000.;                savel1 += 5000.;
# Line 1897  void CaloLevel0::GetCommonVar(){ Line 1913  void CaloLevel0::GetCommonVar(){
1913  void CaloLevel0::FillCommonVar(CaloLevel1 *c1, CaloLevel2 *ca){  void CaloLevel0::FillCommonVar(CaloLevel1 *c1, CaloLevel2 *ca){
1914    //    //
1915    ca->good = clevel2->good;    ca->good = clevel2->good;
1916    if ( clevel2->trigty == 2. ){  //   if ( clevel2->trigty == 2. ){
1917      ca->selftrigger = 1;  //     ca->selftrigger = 1;
1918    } else {  //   } else {
1919      ca->selftrigger = 0;  //     ca->selftrigger = 0;
1920    };  //   };
1921    //    //
1922    ca->selftrigger += (Int_t)clevel2->wartrig;    ca->selftrigger = (Int_t)clevel2->trigty + (Int_t)clevel2->wartrig;
1923    //    //
1924    memcpy(ca->perr,clevel2->perr,sizeof(clevel2->perr));    memcpy(ca->perr,clevel2->perr,sizeof(clevel2->perr));
1925    memcpy(ca->swerr,clevel2->swerr,sizeof(clevel2->swerr));    memcpy(ca->swerr,clevel2->swerr,sizeof(clevel2->swerr));

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.29

  ViewVC Help
Powered by ViewVC 1.1.23