/[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.24 by mocchiut, Thu Dec 4 14:55:48 2008 UTC revision 1.27 by mocchiut, Wed Nov 25 09:38:30 2009 UTC
# Line 56  CaloLevel0::CaloLevel0(){ Line 56  CaloLevel0::CaloLevel0(){
56    clevel1 = &clevel1_;    clevel1 = &clevel1_;
57    clevel2 = &clevel2_;    clevel2 = &clevel2_;
58    //    //
59    //  extern struct FlEventi eventi_;
60    //   extern struct FlGruppo gruppo_;
61    //   extern struct FlGruppo2 gruppo2_;
62    //   extern struct FlGruppo4 gruppo4_;
63    //   extern struct FlTaglioen taglioen_;
64    //   extern struct FlAngolo angolo_;
65    //   extern struct FlWhere where_;
66    //   extern struct FlGeneral general_;
67    //   extern struct FlCh ch_;
68    //   extern struct FlCalofit calofit_;
69    //   extern struct FlPawcd pawcd_;
70    //   extern struct FlQuestd questd_;
71    //   eventi = &eventi_;
72    //   gruppo = &gruppo_;
73    //   gruppo2 = &gruppo2_;
74    //   gruppo4 = &gruppo4_;
75    //   taglioen = &taglioen_;
76    //   angolo = &angolo_;
77    //   where = &where_;
78    //   general = &general_;
79    //   ch = &ch_;
80    //   calofit = &calofit_;
81    //   pawcd = &pawcd_;
82    //   questd = &questd_;
83      //
84    trkseqno = 0;    trkseqno = 0;
85    ClearStructs();    ClearStructs();
86    //    //
# Line 75  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 1164  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 1173  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 1227  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 1341  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 1408  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];
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 1431  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 ( 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);
1469            pproblem = true;            pproblem = true;
1470            pe++;            pe++;
# Line 1720  Int_t CaloLevel0::Calibrate(Int_t ei){ Line 1752  Int_t CaloLevel0::Calibrate(Int_t ei){
1752            // CALOLEVEL1 CODING AND FILLING            // CALOLEVEL1 CODING AND FILLING
1753            //            //
1754            //            //
1755            // 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
1756            //            //
1757            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 ) ){
1758              clevel1->estrip[j4][m][l] = 0.;              clevel1->estrip[j4][m][l] = 0.;
1759            };            };
1760            //            //
# Line 1872  void CaloLevel0::GetCommonVar(){ Line 1904  void CaloLevel0::GetCommonVar(){
1904  void CaloLevel0::FillCommonVar(CaloLevel1 *c1, CaloLevel2 *ca){  void CaloLevel0::FillCommonVar(CaloLevel1 *c1, CaloLevel2 *ca){
1905    //    //
1906    ca->good = clevel2->good;    ca->good = clevel2->good;
1907    if ( clevel2->trigty == 2. ){  //   if ( clevel2->trigty == 2. ){
1908      ca->selftrigger = 1;  //     ca->selftrigger = 1;
1909    } else {  //   } else {
1910      ca->selftrigger = 0;  //     ca->selftrigger = 0;
1911    };  //   };
1912    //    //
1913    ca->selftrigger += (Int_t)clevel2->wartrig;    ca->selftrigger = (Int_t)clevel2->trigty + (Int_t)clevel2->wartrig;
1914    //    //
1915    memcpy(ca->perr,clevel2->perr,sizeof(clevel2->perr));    memcpy(ca->perr,clevel2->perr,sizeof(clevel2->perr));
1916    memcpy(ca->swerr,clevel2->swerr,sizeof(clevel2->swerr));    memcpy(ca->swerr,clevel2->swerr,sizeof(clevel2->swerr));

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.27

  ViewVC Help
Powered by ViewVC 1.1.23