/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
EvtDsp Class Reference

#include <EvtDsp.h>

Inheritance diagram for EvtDsp:
Inheritance graph
[legend]
Collaboration diagram for EvtDsp:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 EvtDsp (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Constructor.
virtual StatusCode initialize ()
 Overriding initialize and finalize.
virtual StatusCode finalize ()
virtual StatusCode initEngine ()
 IEvtDsp interface Initialize event display engine The real initialization method, only be called when needed.
virtual StatusCode plotAD (Detector det, double chrg[8][24], double time[8][24], const char *chrgunit=0, const char *timeunit=0, const char *info=0)
 Plot AD and print TLatex.
virtual StatusCode plotPool (DayaBay::Detector det, double chrg[9][24][2], double time[9][24][2], const char *chrgunit=0, const char *timeunit=0, const char *info=0)
 Plot pool.
virtual StatusCode pause ()
 A pause method for user.

Static Public Member Functions

static const InterfaceID & interfaceID ()
 Retrieve interface ID.

Protected Member Functions

virtual ~EvtDsp ()
 Standard destructor.

Private Member Functions

StatusCode initializeSite (Site::Site_t aSite)
 Prepare for aSite. Create canvas for it.
bool isActiveSite (Site::Site_t aSite)
 Check the active status of a site.
CLHEP::Hep2Vector poolProj (PoolPmtSensor pmtId, double x, double y, double z)
 Project 3d position to 2d plane.

Private Attributes

bool m_isEngineInit
map< Site::Site_t, TCanvas * > m_activeSite
 Keep track all active site.
double m_panelWid
 Canvas width for one AD panel.
double m_pmtDia
 Max AD PMT diameter, in user coordinate system.
vector< TEllipse * > m_circles
 circles and histograms used in one events They are created in plotAD and cleared after pause
vector< TH1D * > m_histos
vector< TLatex * > m_latex
IPmtGeomInfoSvcm_pmtGeoSvc
 Pool Geometry.
list __all__ = [ 'configure' ]

Detailed Description

Author:
Zhe Wang, Feb. 15, 2010

This code is one realization of IEvtDsp.

Definition at line 26 of file EvtDsp.h.


Constructor & Destructor Documentation

EvtDsp::EvtDsp ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Standard Constructor.

Definition at line 16 of file EvtDsp.cc.

  : GaudiTool( type, name, parent ),
    m_isEngineInit(false),
    m_panelWid(500),
    m_pmtDia(20)
{
  // declare my special interface                                                                              
  declareInterface<IEvtDsp>(this);
  // 
  m_activeSite.clear();
  m_circles.clear();
  m_histos.clear();
  m_latex.clear();
}
EvtDsp::~EvtDsp ( ) [protected, virtual]

Standard destructor.

Definition at line 34 of file EvtDsp.cc.

{
}

Member Function Documentation

StatusCode EvtDsp::initialize ( ) [virtual]

Overriding initialize and finalize.

Definition at line 38 of file EvtDsp.cc.

{
  MsgStream log(msgSvc(), name());
  log << MSG::DEBUG << "initializing ......" << endreq;
  
  // Get PmtGeoSvc
  StatusCode sc = service("PmtGeomInfoSvc",m_pmtGeoSvc);
  if(sc.isFailure()) {
    log << MSG::ERROR <<"Can't get PmtGeomInfoSvc"<<endreq;
    return sc;
  }

  return StatusCode::SUCCESS;
} 
StatusCode EvtDsp::finalize ( ) [virtual]

Definition at line 53 of file EvtDsp.cc.

{
  MsgStream log(msgSvc(), name());
  log << MSG::DEBUG << "finalizing ......" << endreq;

  return StatusCode::SUCCESS;
}
StatusCode EvtDsp::initEngine ( ) [virtual]

IEvtDsp interface Initialize event display engine The real initialization method, only be called when needed.

Initialize event display engine The real initialization method.

Only be called when needed.

Style here and there. Almost impossible to find.

Implements IEvtDsp.

Definition at line 63 of file EvtDsp.cc.

{
  MsgStream log(msgSvc(), name());

  // Only one application can be created.
  TApplication* pApp =  new TApplication("appKey",0,0);
  if( pApp!=0 ) {
    log << MSG::DEBUG << "Display engine initialized" << endreq;
  }
  gStyle->SetTitleH(0.1);

  m_pmtDia = 15;

  m_isEngineInit = true;

  return StatusCode::SUCCESS;
}
StatusCode EvtDsp::plotAD ( Detector  det,
double  chrg[8][24],
double  time[8][24],
const char *  chrgunit = 0,
const char *  timeunit = 0,
const char *  info = 0 
) [virtual]

Plot AD and print TLatex.

Plot AD.

Start to plot

Check engine

Check canvas status

Grab it

Got the right pad. If wrong, it means some preparation in initialization is not complete.

a local copy

Add a protection if cmin=cmax or tmin=tmax because there is only one hit. They will be used to calculated radius and color.

get color and radius depending on charge and time

Print the string

Fill charge and time historgram

Implements IEvtDsp.

Definition at line 84 of file EvtDsp.cc.

{
  MsgStream log(msgSvc(), name());
  log << MSG::DEBUG << "Plot AD ..." << endreq;

  Site::Site_t site=det.site();
  
  if( !m_isEngineInit ) initEngine();

  if( !isActiveSite(site) ) initializeSite(site);
  
  TCanvas* pCvs = m_activeSite[site];        // big mother pad 
  TVirtualPad* pPad = 0;                         // sub pad for one AD
  TVirtualPad* plotPad,*chrgPad,*timePad;    // sub sub pad for plot, charge and time
  
  DetectorId::DetectorId_t adNum = det.detectorId();

  if( adNum == DetectorId::kAD1 ) 
    {  pCvs->cd(1);   pPad=pCvs->GetPad(1);  }
  if( adNum == DetectorId::kAD2 )
    {  pCvs->cd(2);   pPad=pCvs->GetPad(2);  }
  if( adNum == DetectorId::kAD3 )
    {  pCvs->cd(3);   pPad=pCvs->GetPad(3);  }
  if( adNum == DetectorId::kAD4 )
    {  pCvs->cd(4);   pPad=pCvs->GetPad(4);  }

  plotPad = pPad->GetPad(1);
  chrgPad = pPad->GetPad(2);
  timePad = pPad->GetPad(3);

  double fchrg[8][24];
  double ftime[8][24];

  double cmin=InvalidChrg;
  double cmax=InvalidChrg;                                                              
  double tmin=InvalidTime;
  double tmax=InvalidTime;

  // Find max and min charge
  // Find earlist and latest time
  bool first=true;
  for(int ring=7;ring>=0;ring--) {
    for(int clmn=0;clmn<24;clmn++) {

      // get a local copy
      fchrg[ring][clmn]=chrg[ring][clmn];
      ftime[ring][clmn]=time[ring][clmn];

      // initialize min and max charge and time search
      if(first &&
         fchrg[ring][clmn] != InvalidChrg )  { 

        cmin=cmax=fchrg[ring][clmn];
        tmin=tmax=ftime[ring][clmn];

        first=false;
      }

      // get min and max
      if(fchrg[ring][clmn] != InvalidChrg )  {

        if(fchrg[ring][clmn]<cmin) cmin=fchrg[ring][clmn];
        if(fchrg[ring][clmn]>cmax) cmax=fchrg[ring][clmn];

        if(ftime[ring][clmn]<tmin) tmin=ftime[ring][clmn];
        if(ftime[ring][clmn]>tmax) tmax=ftime[ring][clmn];
      }

      log << MSG::VERBOSE << chrg[ring][clmn] << " " << time[ring][clmn]<< "; ";
    }
    log << MSG::VERBOSE << endreq;
  }

  if(cmin==cmax) cmin=cmax-1;
  if(tmin==tmax) tmin=tmax-1;

  log << MSG::DEBUG <<cmin<<" "<<cmax<<" "<<tmin<<" "<<tmax<<endreq;

  // root plot, event display
  pPad->cd(1);  
  // clear everything before draw new ones.
  plotPad->Clear();
  //
  double rmax=m_pmtDia/2;
  double rmin=2;
  double r;
  int clrmax=255;
  int clrmin=0;
  int color;

  for(int ring=0;ring<8;ring++) {
    for(int clmn=0;clmn<24;clmn++) {
      if( fchrg[ring][clmn]!=InvalidChrg )  {
        
        r=(rmax-rmin)*(fchrg[ring][clmn]-cmin)/(cmax-cmin)+rmin;
        color=(int)( (clrmax-clrmin)*(ftime[ring][clmn]-tmin)/(tmax-tmin)+clrmin );
        color=TColor::GetColor(clrmax-color,0,color);

        TEllipse* cir = new TEllipse((clmn+0.5)*m_pmtDia,
                                     (ring+0.5)*m_pmtDia,
                                     r);
        cir->SetFillColor(color);
        cir->SetLineColor(color);
        cir->Draw();
        m_circles.push_back(cir);

        // put down some explanation on canvas
        if(cmax==fchrg[ring][clmn]) {
          log << MSG::DEBUG<<"ring= "<<ring+1<<" clmn= "<<clmn+1<<" has max charge "<<cmax<<endl;
        }
        if(cmin==fchrg[ring][clmn]) {
          log << MSG::DEBUG<<"ring= "<<ring+1<<" clmn= "<<clmn+1<<" has min charge "<<cmin<<endl;
        }
        if(tmax==ftime[ring][clmn]) {
          log << MSG::DEBUG<<"ring= "<<ring+1<<" clmn= "<<clmn+1<<" has latest time "<<tmax<<endl;
        }
        if(tmin==ftime[ring][clmn]) {
          log << MSG::DEBUG<<"ring= "<<ring+1<<" clmn= "<<clmn+1<<" has earliest time "<<tmin<<endl;
        }
      }
    }
  }

  plotPad->Modified();
  plotPad->Update();

  if( info ) {
    TLatex* l = new TLatex;
    l->SetTextSize(0.1);
    l->DrawLatex(0.2,8.2*m_pmtDia,info);
    m_latex.push_back(l);
  }

  string chrgtitle = "Charge [";
  chrgtitle += chrgunit;
  chrgtitle += "]";
  TH1D * chrgHis = new TH1D("chrgHis",chrgtitle.c_str(),30,
                            cmin-(cmax-cmin)*0.05,cmax+(cmax-cmin)*0.05);
  chrgHis->SetLabelSize(0.1,"X");
  chrgHis->SetLabelSize(0.1,"Y");
  chrgHis->SetTitleSize(0.3);
  chrgHis->SetStats(false);
  //  chrgHis->GetXaxis()->SetTitle(chrgunit);
  //  chrgHis->GetXaxis()->SetTitleSize(0.08);

  string timetitle = "Time [";
  timetitle += timeunit;
  timetitle += "]";
  TH1D * timeHis = new TH1D("timeHis",timetitle.c_str(),30,
                            tmin-(tmax-tmin)*0.05,tmax+(tmax-tmin)*0.05);
  timeHis->SetLabelSize(0.1,"X");
  timeHis->SetLabelSize(0.1,"Y");
  timeHis->SetTitleSize(0.3);
  timeHis->SetStats(false);
  //  timeHis->GetXaxis()->SetTitle(timeunit);
  //  timeHis->GetXaxis()->SetTitleSize(0.08);

  for(int ring=0;ring<8;ring++) {
    for(int clmn=0;clmn<24;clmn++) {
      if(fchrg[ring][clmn]!=InvalidChrg) {
        chrgHis->Fill(fchrg[ring][clmn]);
        timeHis->Fill(ftime[ring][clmn]);
      }
    }
  }


  m_histos.push_back(chrgHis);
  pPad->cd(2);
  chrgHis->Draw();
  chrgPad->Modified();
  chrgPad->Update();

  m_histos.push_back(timeHis);
  pPad->cd(3);
  timeHis->Draw();
  timePad->Modified();
  timePad->Update();

  return StatusCode::SUCCESS;
}
StatusCode EvtDsp::plotPool ( DayaBay::Detector  det,
double  chrg[9][24][2],
double  time[9][24][2],
const char *  chrgunit = 0,
const char *  timeunit = 0,
const char *  info = 0 
) [virtual]

Plot pool.

Start to plot

Check engine

Check canvas status

Grab it

Got the right pad. If wrong, it means some preparation in initialization is not complete.

a local copy

Add a protection if cmin=cmax or tmin=tmax because there is only one hit. They will be used to calculated radius and color.

get color and radius depending on charge and time

get position

Print the string

Fill charge and time historgram

Implements IEvtDsp.

Definition at line 282 of file EvtDsp.cc.

{
  MsgStream log(msgSvc(), name());
  log << MSG::DEBUG << "Plot pool ..." << endreq;

  Site::Site_t site=det.site();

  if( !m_isEngineInit ) initEngine();

  if( !isActiveSite(site) ) initializeSite(site);

  TCanvas* pCvs = m_activeSite[site];        // big mother pad
  TVirtualPad* pPad = 0;                     // sub pad for one IWS or OWS
  TVirtualPad* plotPad,*chrgPad,*timePad;    // sub sub pad for plot, charge and time

  DetectorId::DetectorId_t detId = det.detectorId();

  if( site == Site::kSAB ) {
    log << MSG::ERROR << "SAB does not have water pool." << endreq;
  }
  if( site == Site::kDayaBay || site == Site::kLingAo ) {
    if( detId == DetectorId::kIWS ) 
      { pCvs->cd(3);   pPad=pCvs->GetPad(3); }
    if( detId == DetectorId::kOWS )
      { pCvs->cd(4);   pPad=pCvs->GetPad(4); }
  }
  if( site == Site::kFar || site == Site::kUnknown ) {
    if( detId == DetectorId::kIWS )
      { pCvs->cd(5);   pPad=pCvs->GetPad(5); }
    if( detId == DetectorId::kOWS )
      { pCvs->cd(6);   pPad=pCvs->GetPad(6); }
  }

  plotPad = pPad->GetPad(1);
  chrgPad = pPad->GetPad(2);
  timePad = pPad->GetPad(3);

  double pl_chrg[9][24][2];
  double pl_time[9][24][2];

  double cmin=InvalidChrg;
  double cmax=InvalidChrg;
  double tmin=InvalidTime;
  double tmax=InvalidTime;

  // Find max and min charge
  // Find earlist and latest time
  bool first=true;
  for(int wall=0; wall<9; wall++) {
    for(int spot=0; spot<24; spot++) {
      for(int inwd=0; inwd<2; inwd++) {

        // get a local copy
        pl_chrg[wall][spot][inwd]=chrg[wall][spot][inwd];
        pl_time[wall][spot][inwd]=time[wall][spot][inwd];

        // initialize min and max charge and time search
        if(first &&
           pl_chrg[wall][spot][inwd] != InvalidChrg ) {

          cmin=cmax=pl_chrg[wall][spot][inwd];
          tmin=tmax=pl_time[wall][spot][inwd];

          first=false;
        }

        // get min and max
        if(pl_chrg[wall][spot][inwd] != InvalidChrg ) {
          
          if(pl_chrg[wall][spot][inwd]<cmin) cmin=pl_chrg[wall][spot][inwd];
          if(pl_chrg[wall][spot][inwd]>cmax) cmax=pl_chrg[wall][spot][inwd];
          
          if(pl_time[wall][spot][inwd]<tmin) tmin=pl_time[wall][spot][inwd];
          if(pl_time[wall][spot][inwd]>tmax) tmax=pl_time[wall][spot][inwd];
        }
      }
    }
  }
  
  if(cmin==cmax) cmin=cmax-1;
  if(tmin==tmax) tmin=tmax-1;
  
  log << MSG::DEBUG <<cmin<<" "<<cmax<<" "<<tmin<<" "<<tmax<<endreq;
 
  // root plot, event display
  pPad->cd(1);
  // clear everything before draw new ones.
  plotPad->Clear();
  //
  double rmax=m_pmtDia/2;
  double rmin=2;
  double r;
  int clrmax=255;
  int clrmin=0;
  int color;

  IPmtGeomInfo * pmtgeo;
  CLHEP::Hep3Vector lp;

  for(int wall=0;wall<9;wall++) {
    for(int spot=0;spot<24;spot++) {
      for(int inwd=0;inwd<2;inwd++) {
        if( pl_chrg[wall][spot][inwd]!=InvalidChrg ) {

          r=(rmax-rmin)*(pl_chrg[wall][spot][inwd]-cmin)/(cmax-cmin)+rmin;
          color=(int)( (clrmax-clrmin)*(pl_time[wall][spot][inwd]-tmin)/(tmax-tmin)+clrmin );
          color=TColor::GetColor(clrmax-color,0,color);

          PoolPmtSensor pmtId(wall+1, spot+1, inwd, site, detId);
          pmtgeo = m_pmtGeoSvc->get( pmtId.fullPackedData() );
          if( pmtgeo == 0 ) {
            log << MSG::WARNING <<"Can't find geometry info for pool pmt: "
                <<wall<<"  "<<spot<<"  "<<inwd<<"  "<<site<<"  "<<detId<<endreq;
            continue;
          }

          lp = pmtgeo->localPosition();
          CLHEP::Hep2Vector proj = poolProj(pmtId, lp.x(), lp.y(), lp.z());
          /* Purely empirical constants */
          TEllipse* cir = new TEllipse( (proj.x()/49000+17.6/50)   * m_panelWid,
                                        (proj.y()/125000+17./130)  * m_panelWid,
                                        r);
          cir->SetFillColor(color);
          cir->SetLineColor(color);
          cir->Draw();
          m_circles.push_back(cir);
          
          // put down some explanation on canvas
          if(cmax==pl_chrg[wall][spot][inwd]) {
            log << MSG::DEBUG<<"wall= "<<wall+1<<" spot= "<<spot+1<<" has max charge "<<cmax<<endl;
          }
          if(cmin==pl_chrg[wall][spot][inwd]) {
            log << MSG::DEBUG<<"wall= "<<wall+1<<" spot= "<<spot+1<<" has min charge "<<cmin<<endl;
          }
          if(tmax==pl_time[wall][spot][inwd]) {
            log << MSG::DEBUG<<"wall= "<<wall+1<<" spot= "<<spot+1<<" has latest time "<<tmax<<endl;
          }
          if(tmin==pl_time[wall][spot][inwd]) {
            log << MSG::DEBUG<<"wall= "<<wall+1<<" spot= "<<spot+1<<" has earliest time "<<tmin<<endl;
          }
        }
      }
    }
  }
  
  plotPad->Modified();
  plotPad->Update();
  
  if( info ) {
    TLatex* l = new TLatex;
    l->SetTextSize(0.0395);
    l->DrawLatex(0.2,9*m_pmtDia,info);
    m_latex.push_back(l);
  }
  
  string chrgtitle = "Charge [";
  chrgtitle += chrgunit;
  chrgtitle += "]";
  TH1D * chrgHis = new TH1D("chrgHis",chrgtitle.c_str(),30,
                            cmin-(cmax-cmin)*0.05,cmax+(cmax-cmin)*0.05);
  chrgHis->SetLabelSize(0.1,"X");
  chrgHis->SetLabelSize(0.1,"Y");
  chrgHis->SetTitleSize(0.3);
  chrgHis->SetStats(false);
  //  chrgHis->GetXaxis()->SetTitle(chrgunit);
  //  chrgHis->GetXaxis()->SetTitleSize(0.08);
  string timetitle = "Time [";
  timetitle += timeunit;
  timetitle += "]";
  TH1D * timeHis = new TH1D("timeHis",timetitle.c_str(),30,
                            tmin-(tmax-tmin)*0.05,tmax+(tmax-tmin)*0.05);
  timeHis->SetLabelSize(0.1,"X");
  timeHis->SetLabelSize(0.1,"Y");
  timeHis->SetTitleSize(0.3);
  timeHis->SetStats(false);
  //  timeHis->GetXaxis()->SetTitle(timeunit);
  //  timeHis->GetXaxis()->SetTitleSize(0.08);

  for(int wall=0;wall<9;wall++) {
    for(int spot=0;spot<24;spot++) {
      for(int inwd=0;inwd<2;inwd++) {
        if(pl_chrg[wall][spot][inwd]!=InvalidChrg) {
          chrgHis->Fill(pl_chrg[wall][spot][inwd]);
          timeHis->Fill(pl_time[wall][spot][inwd]);
        }
      }
    }
  }

  m_histos.push_back(chrgHis);
  pPad->cd(2);
  chrgHis->Draw();
  chrgPad->Modified();
  chrgPad->Update();

  m_histos.push_back(timeHis);
  pPad->cd(3);
  timeHis->Draw();
  timePad->Modified();
  timePad->Update();

  return StatusCode::SUCCESS;
}
StatusCode EvtDsp::pause ( ) [virtual]

A pause method for user.

clean memory

clear each sub sub pads

Got the right pad. If wrong, it means some preparation in initialization is not complete.

Implements IEvtDsp.

Definition at line 504 of file EvtDsp.cc.

{
  MsgStream log(msgSvc(), name());
  
  if(m_activeSite.size() > 0) {
    log << MSG::INFO << "Press any key on canvas or double click on canvas to continue... "<<endreq;
    log << MSG::INFO << "Select 'File' -> 'Quit Root' to quit. "<<endreq;
    (m_activeSite.begin())->second->WaitPrimitive();
  }

  for(size_t n=0;n<m_circles.size();n++) {
    delete m_circles[n];
  }
  m_circles.clear();

  for(size_t n=0;n<m_histos.size();n++) {
    delete m_histos[n];
  }
  m_histos.clear();

  for(size_t n=0;n<m_latex.size();n++) {
    delete m_latex[n];
  }
  m_latex.clear();


  map< Site::Site_t, TCanvas* >::iterator it, itend = m_activeSite.end();
  for( it = m_activeSite.begin(); it != itend; ++it )  {
    TVirtualPad* pPad;                         // sub pad for one AD
    TVirtualPad* plotPad,*chrgPad,*timePad;    // sub sub pad for plot, charge and time

    for ( int i = 1; i<=4; i++ )  {
      (*it).second->cd(i);   pPad=(*it).second->GetPad(i);

      if( pPad != 0 ) {
        
        plotPad = pPad->GetPad(1);
        chrgPad = pPad->GetPad(2);
        timePad = pPad->GetPad(3);

        plotPad->Clear();
        chrgPad->Clear();
        timePad->Clear();
      }
    }
    (*it).second->Update();
  }

  return StatusCode::SUCCESS;
}
StatusCode EvtDsp::initializeSite ( Site::Site_t  aSite) [private]

Prepare for aSite. Create canvas for it.

AD panels

Fixed ratio

Definition at line 560 of file EvtDsp.cc.

{
  MsgStream log(msgSvc(), name());
  log << MSG::DEBUG << "Initializing site "<< Site::AsString(aSite) << endreq;

  int num_ad;
  int num_pool;
  int num_rpc;

  switch(aSite) {
  case Site::kSAB:
    {
      /* only two ADs */
      num_ad=2;
      num_pool=0;
      num_rpc=0;
      
      break;
    }
  case Site::kDayaBay:
    {
      /* two ADs and IWS and OWS */
      num_ad=2;
      num_pool=2;
      num_rpc=1;
      break;
    }
  case Site::kLingAo:
    {
      /* two ADs and IWS and OWS */
      num_ad=2;
      num_pool=2;
      num_rpc=1;
      break;
    }
  case Site::kFar:
    {
      /* four ADs and IWS and OWS */
      num_ad=4;
      num_pool=2;
      num_rpc=1;
      break;
    }
  default:
    {
      log << MSG::WARNING << "Unknown site. Attempt to use far site configuration to draw it." <<endreq;
      num_ad=4;
      num_pool=2;
      num_rpc=1;
      break;
    }
  }
   
  double wid_ad = m_panelWid;       // AD panel width
  double hei_ad = m_panelWid*0.4;   // AD panel height
  double wid_pl = m_panelWid*2/3;   // Pool panel width
  double hei_pl_nr = m_panelWid*0.7;// near Pool panel height
  double hei_pl_fr = m_panelWid;    // far Pool panel height

  double hei_pl = hei_pl_nr;        // Adjust pool height according to site
  if( aSite == Site::kFar || aSite == Site::kUnknown ) 
    { hei_pl = hei_pl_fr; }

  double wid_cvs  = 2 * wid_ad;
  double hei_cvs  = num_ad/2 * hei_ad + num_pool/2 * hei_pl;   

  string CavName = "Site: ";
  CavName += Site::AsString(aSite);
  TCanvas* pCanvas = new TCanvas("AD EvtDsp",CavName.c_str(),(int)wid_cvs,(int)hei_cvs);
  
  // Divide the canvas to hold several ADs and pools
  //     --------  1
  //     |      |
  //     --------  y_row_1
  //     |      |
  //     --------  y_row_2
  //     |      |
  //     |      |
  //     --------
  //     0      0.5

  // Calculate the y of each sub-panel
  double y_row_1 = 0;
  double y_row_2 = 0;
  if( aSite == Site::kDayaBay || aSite == Site::kLingAo ) {
    y_row_1 = 1 - hei_ad / hei_cvs;
  }
  if( aSite == Site::kFar || aSite == Site::kUnknown ) {
    y_row_2 = 1 - 2*hei_ad / hei_cvs;
  }
  
  // The first two AD pads
  TPad* adPad1 = new TPad("ad1Pad","AD1 pad",0,  y_row_1,  0.5,1);
  adPad1->Draw();
  adPad1->SetNumber(1);
  TPad* adPad2 = new TPad("ad2Pad","AD2 pad",0.5,y_row_1,  1,  1);
  adPad2->Draw();
  adPad2->SetNumber(2);
  
  if( aSite == Site::kDayaBay || aSite == Site::kLingAo ) {
    TPad* iwsPad = new TPad("iwsPad","IWS pad",0,   0, 0.5,y_row_1);
    iwsPad->Draw();
    iwsPad->SetNumber(3);
    TPad* owsPad = new TPad("owsPad","OWS pad",0.5,0,  1,y_row_1);
    owsPad->Draw();
    owsPad->SetNumber(4);
  }

  if( aSite == Site::kFar || aSite == Site::kUnknown ) {
    TPad* adPad3 = new TPad("ad3Pad","AD3 pad",0,  y_row_2,  0.5,y_row_1);
    adPad3->Draw();
    adPad3->SetNumber(3);
    TPad* adPad4 = new TPad("ad4Pad","AD4 pad",0.5,y_row_2,  1,  y_row_1);
    adPad4->Draw();
    adPad4->SetNumber(4);

    TPad* iwsPad = new TPad("iwsPad","IWS pad",0,   0,  0.5,y_row_1);
    iwsPad->Draw();
    iwsPad->SetNumber(5);
    TPad* owsPad = new TPad("owsPad","OWS pad",0.5, 0,  1,y_row_1);
    owsPad->Draw();
    owsPad->SetNumber(6);
  }
  
  // set user coordinate system
  for( int i=1; i<=num_ad; i++ )  {
    pCanvas->cd(i);
    TPad* plotPad = new TPad("plotPad","Plot pad",0,0.5,1,1);
    plotPad->Range(-0.2*m_pmtDia,-0.2*m_pmtDia,24.2*m_pmtDia,9.5*m_pmtDia);
    plotPad->Draw();
    plotPad->SetNumber(1); // first sub sub pad
    TPad* chrgPad = new TPad("chrgPad","Charge histo pad", 0.0,0.0,0.5,0.5);
    chrgPad->Draw();
    chrgPad->SetNumber(2); // second sub sub pad
    TPad* timePad = new TPad("timePad","Time histo pad"  , 0.5,0.0,1.0,0.5);
    timePad->Draw();
    timePad->SetNumber(3); // third sub sub pad
  }
  
  for( int i=num_ad+1; i<=num_ad+num_pool; i++ ) {
    pCanvas->cd(i);
    TPad* plotPad = new TPad("plotPad","Plot pad",0,0.3,1,1);
    plotPad->Range(-0.2*m_pmtDia,-0.2*m_pmtDia,24.2*m_pmtDia,9.5*m_pmtDia);
    plotPad->Draw();
    plotPad->SetNumber(1); // first sub sub pad
    TPad* chrgPad = new TPad("chrgPad","Charge histo pad", 0.0,0.0,0.5,0.3);
    chrgPad->Draw();
    chrgPad->SetNumber(2); // second sub sub pad
    TPad* timePad = new TPad("timePad","Time histo pad"  , 0.5,0.0,1.0,0.3);
    timePad->Draw();
    timePad->SetNumber(3); // third sub sub pad
  }

  pCanvas->Update();
  
  m_activeSite[aSite] = pCanvas;

  return StatusCode::SUCCESS;
}
bool EvtDsp::isActiveSite ( Site::Site_t  aSite) [private]

Check the active status of a site.

Definition at line 725 of file EvtDsp.cc.

{
  map< Site::Site_t, TCanvas* >::iterator it;

  it = m_activeSite.find( aSite );
  
  if( it != m_activeSite.end() ) 
    { return true; }
  else
    { return false; }
}
CLHEP::Hep2Vector EvtDsp::poolProj ( PoolPmtSensor  pmtId,
double  x,
double  y,
double  z 
) [private]

Project 3d position to 2d plane.

base z wall 9 z ~ -4653.7 (OWS) wall 9 z ~ -4233.4 (IWS)

Definition at line 738 of file EvtDsp.cc.

{
  // Check site and detId
  Site::Site_t site = pmtId.site();
  DetectorId::DetectorId_t detId = pmtId.detectorId();

  const double zOWS = -4653.7;
  const double zIWS = -4233.4;
  
  double zref;
  if( detId == DetectorId::kIWS )   zref = zIWS;
  if( detId == DetectorId::kOWS )   zref = zOWS;

  int wall = pmtId.wallNumber();
  
  double pi = 3.14159265;
  double theta = (wall-1)*pi/4;
  
  double projx = x + (z-zref)*cos(theta);
  double projy = y + (z-zref)*sin(theta);
  CLHEP::Hep2Vector proj(projx, projy);
  
  return proj;
}
static const InterfaceID& IEvtDsp::interfaceID ( ) [inline, static, inherited]

Retrieve interface ID.

Definition at line 26 of file IEvtDsp.h.

{ return IID_IEvtDsp; }

Member Data Documentation

bool EvtDsp::m_isEngineInit [private]

Definition at line 68 of file EvtDsp.h.

map< Site::Site_t, TCanvas* > EvtDsp::m_activeSite [private]

Keep track all active site.

One canvas for one site

Definition at line 78 of file EvtDsp.h.

double EvtDsp::m_panelWid [private]

Canvas width for one AD panel.

Definition at line 81 of file EvtDsp.h.

double EvtDsp::m_pmtDia [private]

Max AD PMT diameter, in user coordinate system.

Definition at line 83 of file EvtDsp.h.

vector<TEllipse*> EvtDsp::m_circles [private]

circles and histograms used in one events They are created in plotAD and cleared after pause

Definition at line 87 of file EvtDsp.h.

vector<TH1D*> EvtDsp::m_histos [private]

Definition at line 88 of file EvtDsp.h.

vector<TLatex*> EvtDsp::m_latex [private]

Definition at line 89 of file EvtDsp.h.

Pool Geometry.

Definition at line 92 of file EvtDsp.h.

list EvtDsp::__all__ = [ 'configure' ] [private]

Definition at line 18 of file __init__.py.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:06:33 for EvtDsp by doxygen 1.7.4