/[PAMELA software]/eventviewer/flight/src/FEVdetector.cpp
ViewVC logotype

Diff of /eventviewer/flight/src/FEVdetector.cpp

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

revision 1.31 by mocchiut, Fri Oct 2 12:51:01 2009 UTC revision 1.36 by mocchiut, Fri Apr 13 08:07:30 2012 UTC
# Line 72  char* operator+( std::streampos&, char* Line 72  char* operator+( std::streampos&, char*
72  #include <color.h>  #include <color.h>
73  //  //
74  extern Bool_t existfile(TString);  extern Bool_t existfile(TString);
75    extern Bool_t NODB;
76  //  //
77    
78  using namespace std;  using namespace std;
# Line 116  void FEVdetector::checkctrlword(){ Line 117  void FEVdetector::checkctrlword(){
117    var.INFOS = 0;    var.INFOS = 0;
118    var.VINFOS = 0;    var.VINFOS = 0;
119    var.PALETTE = 0;    var.PALETTE = 0;
120      var.PATTRIG = 1;
121    if ( *ctrlword & (1<<0) ) {    if ( *ctrlword & (1<<0) ) {
122      var.PALETTE = 1;      var.PALETTE = 1;
123    };    };
# Line 143  void FEVdetector::checkctrlword(){ Line 145  void FEVdetector::checkctrlword(){
145    if ( *ctrlword & (1<<8) ) {    if ( *ctrlword & (1<<8) ) {
146      var.TOF = 1;      var.TOF = 1;
147    };    };
148      if ( *ctrlword & (1<<9) ) {
149        var.PATTRIG = 1;
150      };
151  }  }
152    
153  void FEVdetector::SetDDEC(TString de){  void FEVdetector::SetDDEC(TString de){
# Line 1102  TChain* FEVdetector::Load(TString file){ Line 1107  TChain* FEVdetector::Load(TString file){
1107      //    printf(" %s \n",ddec.Data());      //    printf(" %s \n",ddec.Data());
1108      if ( !L2 ){      if ( !L2 ){
1109        L2 = new PamLevel2("",file.Data(),ddec.Data());        L2 = new PamLevel2("",file.Data(),ddec.Data());
1110          if ( NODB ) L2->NoDBconnections();
1111        otr = L2->GetPamTree();        otr = L2->GetPamTree();
1112        //      printf(" l2 constructor\n");        //      printf(" l2 constructor\n");
1113        //      printf(" abst %u obt %u qtot %f \n",L2->GetOrbitalInfo()->absTime,L2->GetOrbitalInfo()->OBT,L2->GetCaloLevel2()->qtot);            //      printf(" abst %u obt %u qtot %f \n",L2->GetOrbitalInfo()->absTime,L2->GetOrbitalInfo()->OBT,L2->GetCaloLevel2()->qtot);    
# Line 1258  TChain* FEVdetector::Load(TString file){ Line 1264  TChain* FEVdetector::Load(TString file){
1264    //        //    
1265  }  }
1266    
1267    bool bit(int decimal, char pos)
1268    {
1269      return( (decimal>>pos)%2 );
1270    }
1271    //
1272    // THE PATTERN TRIGGER
1273    //
1274    void FEVdetector::ShowTRG(){
1275      //
1276      if ( level.file != 2 ) return;
1277      //
1278      if ( !var.TRG ) return;
1279      //
1280      int S11[8];
1281      S11[0] = 0;
1282      S11[1] = 0;
1283      S11[2] = 0;
1284      S11[3] = 0;
1285      S11[4] = 0;
1286      S11[5] = 0;
1287      S11[6] = 0;
1288      S11[7] = 0;
1289    
1290      int S12[6];
1291      S12[0] = 0;
1292      S12[1] = 0;
1293      S12[2] = 0;
1294      S12[3] = 0;
1295      S12[4] = 0;
1296      S12[5] = 0;
1297    
1298      int S21[2];
1299      S21[0] = 0;
1300      S21[1] = 0;
1301    
1302      int S22[2];
1303      S22[0] = 0;
1304      S22[1] = 0;
1305    
1306      int S31[3];
1307      S31[0] = 0;
1308      S31[1] = 0;
1309      S31[2] = 0;
1310    
1311      int S32[3];
1312      S32[0] = 0;
1313      S32[1] = 0;
1314      S32[2] = 0;
1315    
1316      //S3
1317      if ( bit(L2->GetTrigLevel2()->patterntrig[2],0) ) S31[0]++;
1318      if ( bit(L2->GetTrigLevel2()->patterntrig[2],1) ) S31[1]++;
1319      if ( bit(L2->GetTrigLevel2()->patterntrig[2],2) ) S31[2]++;
1320      if ( bit(L2->GetTrigLevel2()->patterntrig[2],3) ) S31[0]++;
1321      if ( bit(L2->GetTrigLevel2()->patterntrig[2],4) ) S31[1]++;
1322      if ( bit(L2->GetTrigLevel2()->patterntrig[2],5) ) S31[2]++;
1323      if ( bit(L2->GetTrigLevel2()->patterntrig[2],6) ) S32[0]++;
1324      if ( bit(L2->GetTrigLevel2()->patterntrig[2],7) ) S32[1]++;
1325      if ( bit(L2->GetTrigLevel2()->patterntrig[2],8) ) S32[2]++;
1326      if ( bit(L2->GetTrigLevel2()->patterntrig[2],9) ) S32[0]++;
1327      if ( bit(L2->GetTrigLevel2()->patterntrig[2],10) ) S32[1]++;
1328      if ( bit(L2->GetTrigLevel2()->patterntrig[2],11) ) S32[2]++;
1329      //S2
1330      if ( bit(L2->GetTrigLevel2()->patterntrig[3],0) ) S21[0]++;
1331      if ( bit(L2->GetTrigLevel2()->patterntrig[3],1) ) S21[1]++;
1332      if ( bit(L2->GetTrigLevel2()->patterntrig[3],2) ) S21[0]++;
1333      if ( bit(L2->GetTrigLevel2()->patterntrig[3],3) ) S21[1]++;
1334      if ( bit(L2->GetTrigLevel2()->patterntrig[3],4) ) S22[0]++;
1335      if ( bit(L2->GetTrigLevel2()->patterntrig[3],5) ) S22[1]++;
1336      if ( bit(L2->GetTrigLevel2()->patterntrig[3],6) ) S22[0]++;
1337      if ( bit(L2->GetTrigLevel2()->patterntrig[3],7) ) S22[1]++;
1338      //S12
1339      if ( bit(L2->GetTrigLevel2()->patterntrig[4],0) ) S12[0]++;
1340      if ( bit(L2->GetTrigLevel2()->patterntrig[4],1) ) S12[1]++;
1341      if ( bit(L2->GetTrigLevel2()->patterntrig[4],2) ) S12[2]++;
1342      if ( bit(L2->GetTrigLevel2()->patterntrig[4],3) ) S12[3]++;
1343      if ( bit(L2->GetTrigLevel2()->patterntrig[4],4) ) S12[4]++;
1344      if ( bit(L2->GetTrigLevel2()->patterntrig[4],5) ) S12[5]++;
1345      if ( bit(L2->GetTrigLevel2()->patterntrig[4],6) ) S12[0]++;
1346      if ( bit(L2->GetTrigLevel2()->patterntrig[4],7) ) S12[1]++;
1347      if ( bit(L2->GetTrigLevel2()->patterntrig[4],8) ) S12[2]++;
1348      if ( bit(L2->GetTrigLevel2()->patterntrig[4],9) ) S12[3]++;
1349      if ( bit(L2->GetTrigLevel2()->patterntrig[4],10) ) S12[4]++;
1350      if ( bit(L2->GetTrigLevel2()->patterntrig[4],11) ) S12[5]++;
1351      //S11
1352      if ( bit(L2->GetTrigLevel2()->patterntrig[5],0) ) S11[0]++;
1353      if ( bit(L2->GetTrigLevel2()->patterntrig[5],1) ) S11[1]++;
1354      if ( bit(L2->GetTrigLevel2()->patterntrig[5],2) ) S11[2]++;
1355      if ( bit(L2->GetTrigLevel2()->patterntrig[5],3) ) S11[3]++;
1356      if ( bit(L2->GetTrigLevel2()->patterntrig[5],4) ) S11[4]++;
1357      if ( bit(L2->GetTrigLevel2()->patterntrig[5],5) ) S11[5]++;
1358      if ( bit(L2->GetTrigLevel2()->patterntrig[5],6) ) S11[6]++;
1359      if ( bit(L2->GetTrigLevel2()->patterntrig[5],7) ) S11[7]++;
1360      if ( bit(L2->GetTrigLevel2()->patterntrig[5],8) ) S11[0]++;
1361      if ( bit(L2->GetTrigLevel2()->patterntrig[5],9) ) S11[1]++;
1362      if ( bit(L2->GetTrigLevel2()->patterntrig[5],10) ) S11[2]++;
1363      if ( bit(L2->GetTrigLevel2()->patterntrig[5],11) ) S11[3]++;
1364      if ( bit(L2->GetTrigLevel2()->patterntrig[5],12) ) S11[4]++;
1365      if ( bit(L2->GetTrigLevel2()->patterntrig[5],13) ) S11[5]++;
1366      if ( bit(L2->GetTrigLevel2()->patterntrig[5],14) ) S11[6]++;
1367      if ( bit(L2->GetTrigLevel2()->patterntrig[5],15) ) S11[7]++;
1368    
1369    
1370      //
1371      Int_t rj = 0;
1372      Float_t xs2x = var.xxvc;
1373      Float_t ys2x = var.yxvc + 0.36*var.sfy;
1374      Float_t xs2y = var.xyvc;
1375      Float_t ys2y = var.yyvc + 0.36*var.sfy;
1376      Float_t ws2 = 0.005;
1377      Float_t ws13 = 0.007;
1378      Int_t noadc;
1379      if ( var.bw ){
1380        noadc=12;
1381      } else {
1382        noadc=kRed;
1383      };
1384      //
1385      // S11  X-view
1386      //
1387      Float_t s11p = 0.051;
1388      TPolyLine *ftrg11x[8];
1389      for ( Int_t j=0; j<8; j++){
1390        Float_t nxc1[5]={ (s11p*j),       (s11p*j),               s11p*(j+1),     s11p*(j+1), (s11p*j)};
1391        Float_t nyc1[5]={ 0.,                       ws13,     ws13,   0.,  0.};
1392        Float_t nxc[5];    
1393        Float_t nyc[5];
1394        for (Int_t i = 0; i<5 ; i++) {
1395          nxc[i]= xs2x + (-0.204+nxc1[i])*var.sfx;
1396          nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
1397        };
1398        ftrg11x[j] = new TPolyLine(5,nxc,nyc);
1399        ftrg11x[j]->SetLineColor(noadc);
1400        ftrg11x[j]->SetLineWidth(S11[j]);
1401        if ( S11[j] )  ftrg11x[j]->Draw();
1402      };
1403      //
1404      // S12  Y-view
1405      //
1406      Float_t s12p = 0.055;
1407      TPolyLine *ftrg12y[6];
1408      rj = 6;
1409      for ( Int_t j=0; j<6; j++){
1410        rj--;
1411        Float_t nxc1[5]={ (s12p*j),       (s12p*j),               s12p*(j+1), s12p*(j+1),    (s12p*j)};
1412        Float_t nyc1[5]={      -ws13,     0.,  0., -ws13, -ws13};
1413        Float_t nxc[5];    
1414        Float_t nyc[5];
1415        for (Int_t i = 0; i<5 ; i++) {
1416          nxc[i]= xs2y + (-0.165+nxc1[i])*var.sfx;
1417          nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
1418        };
1419        ftrg12y[j] = new TPolyLine(5,nxc,nyc);
1420        ftrg12y[j]->SetLineColor(noadc);
1421        ftrg12y[j]->SetLineWidth(S12[rj]);
1422        if ( S12[rj] ) ftrg12y[j]->Draw();
1423      };
1424    
1425      
1426      //
1427      // S21  Y-view
1428      //
1429      Float_t s21p = 0.075;
1430      TPolyLine *ftrg21y[2];
1431      rj=2;
1432      for ( Int_t j=0; j<2; j++){
1433        rj--;
1434        Float_t nxc1[5]={ s21p*(j-1),       s21p*(j-1),               s21p*j,s21p*j,     s21p*(j-1)};
1435        Float_t nyc1[5]={ 0.,                ws2,     ws2,  0.,  0.};
1436        Float_t nxc[5];    
1437        Float_t nyc[5];
1438        for (Int_t i = 0; i<5 ; i++) {
1439          nxc[i]= xs2y + nxc1[i]*var.sfx;
1440          nyc[i] = ys2y + nyc1[i]*var.sfy;
1441          //      printf(" TRG i %i x %f y %f \n",i,nxc[i],nyc[i]);
1442        };
1443        ftrg21y[j] = new TPolyLine(5,nxc,nyc);
1444        ftrg21y[j]->SetLineColor(noadc);
1445        ftrg21y[j]->SetLineWidth(S21[j]);
1446        if ( S21[j]) ftrg21y[j]->Draw();
1447      };
1448    
1449      //
1450      // S22  X-view
1451      //
1452      Float_t s22p = 0.090;
1453      TPolyLine *ftrg22x[2];
1454      for ( Int_t j=0; j<2; j++){
1455        Float_t nxc1[5]={ s22p*(j-1),       s22p*(j-1),               s22p*j, s22p*j,     s22p*(j-1)};
1456        Float_t nyc1[5]={                -ws2,   0., 0.,  -ws2,  -ws2};
1457        Float_t nxc[5];    
1458        Float_t nyc[5];
1459        for (Int_t i = 0; i<5 ; i++) {
1460          nxc[i]= xs2x + nxc1[i]*var.sfx;
1461          nyc[i] = ys2x + nyc1[i]*var.sfy;
1462        };
1463        ftrg22x[j] = new TPolyLine(5,nxc,nyc);
1464        ftrg22x[j]->SetLineColor(noadc);
1465        ftrg22x[j]->SetLineWidth(S22[j]);
1466        if ( S22[j] ) ftrg22x[j]->Draw();
1467      };
1468      //
1469      // S31  X-view
1470      //
1471      Float_t s31p = 0.060;
1472      TPolyLine *ftrg31x[3];
1473      for ( Int_t j=0; j<3; j++){
1474        Float_t nxc1[5]={ (s31p*j),       (s31p*j),               s31p*(j+1), s31p*(j+1),       (s31p*j)};
1475        Float_t nyc1[5]={ 0.,                       ws13,     ws13,    0.,    0.};
1476        Float_t nxc[5];    
1477        Float_t nyc[5];
1478        for (Int_t i = 0; i<5 ; i++) {
1479          nxc[i]= xs2x + (-0.090+nxc1[i])*var.sfx;
1480          nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
1481        };
1482        ftrg31x[j] = new TPolyLine(5,nxc,nyc);
1483        ftrg31x[j]->SetLineColor(noadc);
1484        ftrg31x[j]->SetLineWidth(S31[j]);
1485        if ( S31[j] ) ftrg31x[j]->Draw();
1486      };
1487    
1488      //
1489      // S32  Y-view
1490      //
1491      Float_t s32p = 0.050;
1492      TPolyLine *ftrg32y[3];
1493      rj = 3;
1494      for ( Int_t j=0; j<3; j++){
1495        rj--;
1496        Float_t nxc1[5]={ (s32p*j),       (s32p*j),               s32p*(j+1),s32p*(j+1),     (s32p*j)};
1497        Float_t nyc1[5]={     -ws13,     0.,    0., -ws13, -ws13};
1498        Float_t nxc[5];    
1499        Float_t nyc[5];
1500        for (Int_t i = 0; i<5 ; i++) {
1501          nxc[i]= xs2y + (-0.075+nxc1[i])*var.sfx;
1502          nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
1503        };
1504        ftrg32y[j] = new TPolyLine(5,nxc,nyc);
1505        ftrg32y[j]->SetLineColor(noadc);
1506        ftrg32y[j]->SetLineWidth(S32[rj]);
1507        if ( S32[rj] ) ftrg32y[j]->Draw();
1508      }
1509    }
1510    
1511  void FEVdetector::DisplayEvent(){  void FEVdetector::DisplayEvent(){
1512    TLatex *text=new TLatex();    TLatex *text=new TLatex();
1513    stringstream testo;    stringstream testo;
# Line 1273  void FEVdetector::DisplayEvent(){ Line 1523  void FEVdetector::DisplayEvent(){
1523    thefigure->cd();          thefigure->cd();      
1524    ShowTOF();    ShowTOF();
1525    //    //
1526      // show pattern trigger if the case
1527      //
1528      thefigure->cd();
1529      if ( var.PATTRIG ){
1530        ShowTRG();
1531        thefigure->Modified();
1532        thefigure->Update();
1533      }
1534      //
1535    // show anticounters    // show anticounters
1536    //    //
1537    thefigure->cd();          thefigure->cd();      
# Line 1369  void FEVdetector::DisplayEvent(){ Line 1628  void FEVdetector::DisplayEvent(){
1628      testo3 << "S4: ";// << setprecision(2);      testo3 << "S4: ";// << setprecision(2);
1629      testo3 << var.s4sig << " [MIP]   TOF: #beta = ";      testo3 << var.s4sig << " [MIP]   TOF: #beta = ";
1630      testo3 << setprecision(3) << var.beta[4];      testo3 << setprecision(3) << var.beta[4];
1631        if ( level.file == 2 ){
1632          testo3 << " SVL cutoff: ";
1633          testo3 << setprecision(3) << L2->GetOrbitalInfo()->GetCutoffSVL();//quiquiqui
1634        }
1635      text->DrawLatex(0.33,txthi,testo3.str().c_str());            text->DrawLatex(0.33,txthi,testo3.str().c_str());      
1636      txthi -= 0.03;      txthi -= 0.03;
1637      testo3.str("");      testo3.str("");
# Line 2802  void FEVdetector::ShowTOF(){ Line 3065  void FEVdetector::ShowTOF(){
3065        memset(tdc,0,4*12*sizeof(Float_t));        memset(tdc,0,4*12*sizeof(Float_t));
3066        //              //      
3067        //        //
3068          Int_t myseq = 0;
3069        //      if ( repuntil == 0 || var.tofraw ){        //      if ( repuntil == 0 || var.tofraw ){
3070        if ( repuntil == 1 || var.tofraw ){        if ( repuntil == 1 || var.tofraw ){
3071          numtr = 0;          numtr = 0;
# Line 2809  void FEVdetector::ShowTOF(){ Line 3073  void FEVdetector::ShowTOF(){
3073          repeat = false;          repeat = false;
3074        } else {        } else {
3075          //          //
3076    //        printf(" deH_ \n");
3077          //          //
3078          if ( numtr >= (repuntiltr-1) ) repeat = false;          if ( numtr == 0 ){
3079          //  //          printf(" ques \n");
3080          //printf(" numtr is %i \n",numtr);            ptt = L2->GetToFLevel2()->GetToFTrkVar(0);
3081          // ptt = L2->GetToFLevel2()->GetToFTrkVar(numtr);                  myseq = 0;
3082          ptrack = L2->GetTrack(numtr);  //          printf(" que \n");
3083          ptt = ptrack->GetToFTrack();  
3084            } else {
3085              if ( numtr >= (repuntiltr-1) ) repeat = false;
3086              //
3087              printf(" numtr is %i \n",numtr);
3088              // ptt = L2->GetToFLevel2()->GetToFTrkVar(numtr);    
3089              ptrack = L2->GetTrack(numtr-1);
3090              ptt = ptrack->GetToFTrack();
3091              myseq = ptt->trkseqno + 1;
3092            };
3093        };        };
3094        //        //
3095        xp11[0] = 0.;        xp11[0] = 0.;
# Line 2829  void FEVdetector::ShowTOF(){ Line 3103  void FEVdetector::ShowTOF(){
3103        //        //
3104        ii = 2;        ii = 2;
3105        //        //
3106        Int_t myseq = ptt->trkseqno + 1;        //      Int_t myseq = ptt->trkseqno + 1;
3107        //        //
3108    //      printf(" qui \n");
3109        L2->GetToFLevel2()->GetMatrix(myseq,adc,tdc);        L2->GetToFLevel2()->GetMatrix(myseq,adc,tdc);
3110        //        //
3111        //      printf(" qua \n");  //      printf(" qua \n");
3112        //        //
3113        //       for ( Int_t i = 0; i<8; i++ ) {          //       for ( Int_t i = 0; i<8; i++ ) {  
3114        //        if ( adc[ch11a[i]][hb11a[i]] < 1000. ){        //        if ( adc[ch11a[i]][hb11a[i]] < 1000. ){
# Line 3126  void FEVdetector::ShowTOF(){ Line 3401  void FEVdetector::ShowTOF(){
3401        for (Int_t i = 0; i<5 ; i++) {        for (Int_t i = 0; i<5 ; i++) {
3402          nxc[i]= xs2y + nxc1[i]*var.sfx;          nxc[i]= xs2y + nxc1[i]*var.sfx;
3403          nyc[i] = ys2y + nyc1[i]*var.sfy;          nyc[i] = ys2y + nyc1[i]*var.sfy;
3404            //        printf(" TOF i %i x %f y %f \n",i,nxc[i],nyc[i]);
3405        };        };
3406        ftof21y[j] = new TPolyLine(5,nxc,nyc);        ftof21y[j] = new TPolyLine(5,nxc,nyc);
3407        ftof21y[j]->SetLineColor(1);        ftof21y[j]->SetLineColor(1);
# Line 6379  void FEVdetector::ShowCalo(Bool_t upd){ Line 6655  void FEVdetector::ShowCalo(Bool_t upd){
6655      //      //
6656      stringstream xvev;      stringstream xvev;
6657      stringstream yvev;          stringstream yvev;    
6658      for (Int_t ii = 0; ii < L2->GetCaloLevel2()->nstrip; ii++){      //    for (Int_t ii = 0; ii < L2->GetCaloLevel2()->nstrip; ii++){
6659        for (Int_t ii = 0; ii < L2->GetCaloLevel1()->istrip; ii++){
6660        Int_t colo;        Int_t colo;
6661        Int_t l;        Int_t l;
6662        Int_t m;        Int_t m;

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.36

  ViewVC Help
Powered by ViewVC 1.1.23