#include <iostream.h>

#include "TFndZebini.h"

#include "TFndHStb.h"
#include "TMath.h"
#include "TFndConst.h"

ClassImp(TFndHStb);

 TFndHStb::TFndHStb(Int_t a, Int_t b, Int_t c, Int_t d) {
  Crown  = a; 
  Tube   = b;  
  PatchPanel = c;
  Tdc    = d;
  x_g = 0.;
  y_g = 0.;
  z_g = 0.;
  hmarker = new TMarker3DBox(x_g,y_g,z_g,0.1,0.1,0.1,0.,0.);
}

 TFndHStb::~TFndHStb() {
  delete hmarker;
  }

 void TFndHStb::MzBook() {

   Int_t *lq = &JFRDT;
   Int_t *iq = lq+8;

   Int_t jb;
   char* chid;

   Int_t nd;
   if(Crown == 1 || Crown == 2) {
     jb=-6;
     chid = "LOST";
     nd = 11;
     }
   else if(Crown == 3 || Crown == 4) {
     jb=-7;
     chid = "RIST";
     nd = 10;
     }
   else if(Crown == 5 || Crown == 6) {
     jb=-8;
     chid = "LEST";
     nd = 10;
     }
   else {
     cout << "wrong crown number " << endl;
     return;
     }

   Int_t nl=0;
   Int_t ns=0;
   Int_t iod=9;
   Int_t nz=0;
   Int_t lstb=0;

   Int_t name = *((int*)chid);
   mzbook_(&IXDST ,&lstb ,&JFGES ,&jb ,&name ,&nl ,&ns ,&nd ,&iod,&nz);

  *(iq+lstb) = Crown;
  *(iq+lstb+1) = Tube;
  for(Int_t i=2; i<nd-1; i++) *(iq+lstb+i) = 0;
  *(iq+lstb+nd-1) = Tdc;

  //  for(Int_t i=0; i<nd; i++) cout << "lstb+" << i << " = " << *(iq+lstb+i) << endl;

  }

 void TFndHStb::Draw(char *opt,Float_t size) {

  Double_t rad = TFndConst::kRADSTB[Crown-1]; 
  Double_t angle = (TMath::Pi()/202.)*(Tube+0.5*(Crown%2));
  x_c = rad*TMath::Cos(angle);
  y_c = rad*TMath::Sin(angle);
  z_c = 0.;
  x_l = 0.;
  y_l = 0.;
  z_l = 0.;
  x_g = x_c + x_l;
  y_g = y_c + y_l;
  z_g = z_c + z_l;  
  
  if (opt == "L"){
    x_g = x_g - x_c;
    y_g = y_g - y_c;
    z_g = z_g - z_c;
  }
  hmarker->SetLineColor(2);
  hmarker->SetFillColor(2);
  hmarker->SetFillStyle(1);

  //  cout << "dummy hits for run 33" << endl;
  //z_g = (TFndConst::kRADSTB[Crown-1])*cos(1.45);
  //if(y_g > 0) z_g = -z_g;
  //cout << "z_g " << z_g << ", y_g " << y_g << endl;
  hmarker->SetPosition(x_g,y_g,z_g);
  hmarker->SetSize(size,size,size);
  hmarker->Draw();
}

 void TFndHStb::Print() {
  cout << "STB Hit " << endl;
  cout << "TB  Crown " << Crown << endl;
  cout << "TB Number " << Tube << endl;
  cout << "PatchPanel Number " << PatchPanel << endl;
  cout << "TDC content " << Tdc << endl;
  printf("x %f, y %f, z %fn",x_g,y_g,z_g);
}

 void TFndHStb::Streamer(TBuffer &R__b) {
  // Stream an object of class TFndHStb.

  if (R__b.IsReading()) {
    Version_t R__v = R__b.ReadVersion(); if (R__v) { }
    TObject::Streamer(R__b);
    R__b >> Crown;
    R__b >> Tube;
    if(R__v > 2) R__b >> PatchPanel; 
    R__b >> Tdc;
    R__b >> x_c;
    R__b >> y_c;
    R__b >> z_c;
    if(R__v > 1) {
      R__b >> x_l;
      R__b >> y_l;
      R__b >> z_l;
      R__b >> x_g;
      R__b >> y_g;
      R__b >> z_g;
    } 
    R__b >> hmarker;
  } else {
    R__b.WriteVersion(TFndHStb::IsA());
    TObject::Streamer(R__b);
    R__b << Crown;
    R__b << Tube;
    R__b << PatchPanel;
    R__b << Tdc;
    R__b << x_c;
    R__b << y_c;
    R__b << z_c;
    R__b << x_l;
    R__b << y_l;
    R__b << z_l;
    R__b << x_g;
    R__b << y_g;
    R__b << z_g;
    R__b << hmarker;
  }
}




ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.