WCSimDisplayAB.cc

Go to the documentation of this file.
00001 #include "WCSimDisplayAB.hh"
00002 
00003 #include "WCSimRecoDigit.hh"
00004 #include "WCSimRecoRing.hh"
00005 #include "WCSimRecoEvent.hh"
00006 
00007 #include "WCSimTrueEvent.hh"
00008 #include "WCSimTrueTrack.hh"
00009 
00010 #include "WCSimGeometry.hh"
00011 
00012 #include "TCanvas.h"
00013 #include "TPad.h"
00014 #include "TH1.h"
00015 #include "TH2.h"
00016 #include "TMath.h"
00017 
00018 #include "TLine.h"
00019 #include "TBox.h"
00020 #include "TEllipse.h"
00021 #include "TMarker.h"
00022 #include "TPolyMarker.h"
00023 #include "TPolyLine.h"
00024 #include "TLegend.h"
00025 
00026 #include <iostream>
00027 #include <cmath>
00028 
00029 ClassImp(WCSimDisplayAB)
00030 
00031 WCSimDisplayAB::WCSimDisplayAB() :  WCSimDisplay(),
00032   fGeoType(-1),
00033   fCylRadius(0.0),
00034   fCylLength(0.0),
00035   fCylDiagonal(0.0),
00036   fMailBoxX(0.0),
00037   fMailBoxY(0.0),
00038   fMailBoxZ(0.0),
00039   fMailBoxDiagonal(0.0),
00040   fScale(1.0),
00041   wcCanvas(0),
00042   wcDisplay(0),
00043   wcLegend(0),
00044   wcCylEdgeSide(0),
00045   wcCylEdgeTop(0),
00046   wcCylEdgeBottom(0),  
00047   wcBoxEdgeSide(0),
00048   wcBoxEdgeTop(0),
00049   wcBoxEdgeBottom(0),
00050   wcBoxEdgeLine1(0),
00051   wcBoxEdgeLine2(0),
00052   wcBoxEdgeLine3(0),
00053   wcBoxEdgeLine4(0),
00054   wcTimeCanvas(0),
00055   wcTimeLegend(0),
00056   wcRecoLegend(0)
00057 {
00058   std::cout << " *** WCSimDisplayAB::WCSimDisplayAB() *** " << std::endl;
00059 
00060   this->Initialize();
00061 }
00062 
00063 WCSimDisplayAB::~WCSimDisplayAB()
00064 {
00065  
00066 }
00067 
00068 void WCSimDisplayAB::Initialize()
00069 {
00070   std::cout << " *** WCSimDisplayAB::Initialize() *** " << std::endl;
00071 
00072   this->BuildGeometry();
00073 }
00074 
00075 void WCSimDisplayAB::Reset()
00076 {
00077   std::cout << " *** WCSimDisplayAB::Reset() *** " << std::endl;
00078   
00079   if( wcCylEdgeSide )    delete wcCylEdgeSide;     wcCylEdgeSide = 0;
00080   if( wcCylEdgeTop )     delete wcCylEdgeTop;      wcCylEdgeTop = 0;
00081   if( wcCylEdgeBottom )  delete wcCylEdgeBottom;   wcCylEdgeBottom = 0;  
00082   if( wcBoxEdgeSide )    delete wcBoxEdgeSide;     wcBoxEdgeSide = 0;
00083   if( wcBoxEdgeTop )     delete wcBoxEdgeTop;      wcBoxEdgeTop = 0;
00084   if( wcBoxEdgeBottom )  delete wcBoxEdgeBottom;   wcBoxEdgeBottom = 0;
00085   if( wcBoxEdgeLine1 )   delete wcBoxEdgeLine1;    wcBoxEdgeLine1 = 0;
00086   if( wcBoxEdgeLine2 )   delete wcBoxEdgeLine2;    wcBoxEdgeLine2 = 0;  
00087   if( wcBoxEdgeLine3 )   delete wcBoxEdgeLine3;    wcBoxEdgeLine3 = 0;
00088   if( wcBoxEdgeLine4 )   delete wcBoxEdgeLine4;    wcBoxEdgeLine4 = 0;
00089 
00090   if( wcDisplay )     delete wcDisplay;      wcDisplay = 0;
00091   if( wcCanvas )      delete wcCanvas;       wcCanvas = 0;
00092   if( wcLegend )      delete wcLegend;       wcLegend = 0;
00093   if( wcTimeCanvas )  delete wcTimeCanvas;   wcTimeCanvas = 0;
00094   if( wcTimeLegend )  delete wcTimeLegend;   wcTimeLegend = 0;
00095   if( wcRecoLegend )   delete wcRecoLegend;    wcRecoLegend = 0;
00096 }
00097 
00098 void WCSimDisplayAB::ResetDisplay()
00099 {
00100   // delete all digits
00101   for( UInt_t i=0; i<wcDigits.size(); i++ ){
00102     delete (TMarker*)(wcDigits.at(i));
00103   }
00104   wcDigits.clear();
00105 
00106   for( UInt_t i=0; i<wcTimeDigits.size(); i++ ){
00107     delete (TMarker*)(wcTimeDigits.at(i));
00108   }
00109   wcTimeDigits.clear();
00110 
00111   for( UInt_t i=0; i<wcCommonDigits.size(); i++ ){
00112     delete (TMarker*)(wcCommonDigits.at(i));
00113   }
00114   wcCommonDigits.clear();
00115 
00116   // delete all rings
00117   for( UInt_t i=0; i<wcRings.size(); i++ ){
00118     delete (TPolyMarker*)(wcRings.at(i));
00119   }
00120   wcRings.clear();
00121 
00122   // reset event info
00123   fRunNumber = -1;
00124   fEventNumber = -1;
00125   fTriggerNumber = -1;
00126 
00127   // update display
00128   this->DrawNewDisplay();
00129 }
00130 
00131 void WCSimDisplayAB::BuildGeometry()
00132 {
00133   std::cout << " *** WCSimDisplayAB::BuildGeometry() *** " << std::endl;
00134   
00135   // Reset Display
00136   // =============
00137   this->Reset();
00138 
00139   // convert [cm] to [m]
00140   // ===================
00141   fScale = 0.01;
00142 
00143   // Look up Geometry
00144   // ================
00145   fGeoType = WCSimGeometry::Instance()->GetGeoType(); // assume cylindrical geometry    
00146 
00147   // Make TimeDisplay
00148   // ================
00149   fMakeTimeDisplay = 1; // find a way to pass this setting from outside
00150 
00151   // Cylindrical Detector
00152   // ====================
00153   if( fGeoType==WCSimGeometry::kCylinder ){
00154 
00155     // get detector dimensions from geometry tree
00156     fCylRadius = WCSimGeometry::Instance()->GetCylRadius();
00157     fCylLength = WCSimGeometry::Instance()->GetCylLength();
00158     fCylDiagonal = sqrt( fCylLength*fCylLength + 4.0*fCylRadius*fCylRadius );
00159 
00160     // calculate dimesions of event display
00161     fU = 2.0*TMath::Pi()*fCylRadius;
00162     fV = 2.0*fCylRadius + fCylLength + 2.0*fCylRadius;
00163 
00164     // calulate bin width for histogram
00165     binsWidth = 0.005*(fU+fV);
00166     binsU = (Int_t)(fU/binsWidth);
00167     binsV = (Int_t)(fV/binsWidth);
00168 
00169     // calculate dimensions of canvas
00170     canvasWidth = 800.0;
00171     canvasHeight = (fV/fU)*canvasWidth;
00172     canvasU = (Int_t)(canvasWidth);
00173     canvasV = (Int_t)(canvasHeight);
00174 
00175     // make canvas
00176     wcCanvas = new TCanvas("WCSimDisplay","WCSim Event Display",
00177                              canvasU, canvasV);
00178 
00179     // make histogram
00180     wcDisplay = new TH2D("wcDisplay","",binsU, -0.5*fU*fScale, +0.5*fU*fScale,
00181                                         binsV, -0.5*fV*fScale, +0.5*fV*fScale);
00182     wcDisplay->GetXaxis()->SetTitle("r * #theta (m)");
00183     wcDisplay->GetYaxis()->SetTitle("z (m)");  
00184 
00185     wcDisplay->GetXaxis()->SetTitleSize(0.06);
00186     wcDisplay->GetYaxis()->SetTitleSize(0.06);  
00187 
00188     wcDisplay->GetXaxis()->SetLabelSize(0.05);
00189     wcDisplay->GetYaxis()->SetLabelSize(0.05);
00190 
00191     wcDisplay->GetXaxis()->SetNdivisions(1007);
00192     wcDisplay->GetYaxis()->SetNdivisions(1007);
00193 
00194     wcDisplay->GetXaxis()->CenterTitle();
00195     wcDisplay->GetYaxis()->CenterTitle();
00196 
00197     // outline for side of detector
00198     wcCylEdgeSide = new TBox( -TMath::Pi()*fCylRadius*fScale, -0.5*fCylLength*fScale,
00199                               +TMath::Pi()*fCylRadius*fScale, +0.5*fCylLength*fScale );
00200     wcCylEdgeSide->SetFillStyle(0);
00201     wcCylEdgeSide->SetLineColor(1);
00202     wcCylEdgeSide->SetLineWidth(2);
00203 
00204     // outline for top face of detector
00205     wcCylEdgeTop = new TEllipse(0.0, +0.5*fCylLength*fScale+fCylRadius*fScale, fCylRadius*fScale);
00206     wcCylEdgeTop->SetFillStyle(0);
00207     wcCylEdgeTop->SetLineColor(1);
00208     wcCylEdgeTop->SetLineWidth(2);
00209 
00210     // outline for bottom face of detector
00211     wcCylEdgeBottom = new TEllipse(0.0, -0.5*fCylLength*fScale-fCylRadius*fScale, fCylRadius*fScale);
00212     wcCylEdgeBottom->SetFillStyle(0);
00213     wcCylEdgeBottom->SetLineColor(1);
00214     wcCylEdgeBottom->SetLineWidth(2);
00215 
00216     // coordinates for title box
00217     titleU = -0.5*fU;
00218     titleV = +0.55*fV;    
00219 
00220     // make legend (reco/true)
00221     this->MakeLegendRECO();
00222 
00223     // make legend (pulse height)
00224     this->MakeLegendQPE();
00225 
00226     // make time display canvas
00227     if( fMakeTimeDisplay ){  
00228       wcTimeCanvas = new TCanvas("WCSimTimeDisplay","WCSim Timing Display",
00229                                    canvasU, canvasV);    
00230 
00231       // make legend (timing)
00232       this->MakeLegendTIME();
00233     }
00234   }
00235 
00236   // MAILBOX GEOMETRY
00237   // ================
00238   if( fGeoType==WCSimGeometry::kMailBox ){
00239 
00240     // get detector dimensions from geometry tree
00241     fMailBoxX = WCSimGeometry::Instance()->GetMailBoxX();
00242     fMailBoxY = WCSimGeometry::Instance()->GetMailBoxY();
00243     fMailBoxZ = WCSimGeometry::Instance()->GetMailBoxZ();
00244     fMailBoxDiagonal = sqrt( fMailBoxX*fMailBoxX + fMailBoxY*fMailBoxY + fMailBoxZ*fMailBoxZ );
00245 
00246     // calculate dimesions of event display
00247     fU = 2.0*(fMailBoxX + fMailBoxY);
00248     fV = fMailBoxZ + 2.0*fMailBoxX;
00249 
00250     // calulate bin width for histogram
00251     binsWidth = 0.005*(fU+fV);
00252     binsU = (Int_t)(fU/binsWidth);
00253     binsV = (Int_t)(fV/binsWidth);
00254 
00255     // calculate dimensions of canvas
00256     canvasHeight = 800.0;
00257     canvasWidth = (fU/fV)*canvasHeight;
00258     canvasU = (Int_t)(canvasWidth);
00259     canvasV = (Int_t)(canvasHeight);
00260 
00261     // make canvas
00262     wcCanvas = new TCanvas("WCSimDisplay","WCSim Event Display",
00263                              canvasU, canvasV);
00264 
00265     // make histogram
00266     wcDisplay = new TH2D("wcDisplay","",binsU, -0.5*fU*fScale, +0.5*fU*fScale,
00267                                         binsV, -0.5*fV*fScale, +0.5*fV*fScale);
00268     wcDisplay->GetXaxis()->SetTitle("x,y (m)");
00269     wcDisplay->GetYaxis()->SetTitle("z (m)");  
00270 
00271     wcDisplay->GetXaxis()->SetTitleSize(0.06);
00272     wcDisplay->GetYaxis()->SetTitleSize(0.06);  
00273 
00274     wcDisplay->GetXaxis()->SetLabelSize(0.05);
00275     wcDisplay->GetYaxis()->SetLabelSize(0.05);
00276 
00277     wcDisplay->GetXaxis()->SetNdivisions(1007);
00278     wcDisplay->GetYaxis()->SetNdivisions(1007);
00279 
00280     wcDisplay->GetXaxis()->CenterTitle();
00281     wcDisplay->GetYaxis()->CenterTitle();
00282 
00283     // outline for side of detector
00284     wcBoxEdgeSide = new TBox( -(fMailBoxX+fMailBoxY)*fScale, -0.5*fMailBoxZ*fScale,
00285                               +(fMailBoxX+fMailBoxY)*fScale, +0.5*fMailBoxZ*fScale );
00286     wcBoxEdgeSide->SetFillStyle(0);
00287     wcBoxEdgeSide->SetLineColor(1);
00288     wcBoxEdgeSide->SetLineWidth(2);
00289 
00290     // outline for top face of detector
00291     wcBoxEdgeTop = new TBox( -0.5*fMailBoxY*fScale, +0.5*fMailBoxZ*fScale,
00292                              +0.5*fMailBoxY*fScale, +(0.5*fMailBoxZ+fMailBoxX)*fScale );
00293     wcBoxEdgeTop->SetFillStyle(0);
00294     wcBoxEdgeTop->SetLineColor(1);
00295     wcBoxEdgeTop->SetLineWidth(2);
00296 
00297     // outline for bottom face of detector
00298     wcBoxEdgeBottom = new TBox( -0.5*fMailBoxY*fScale, -0.5*fMailBoxZ*fScale,
00299                                 +0.5*fMailBoxY*fScale, -(0.5*fMailBoxZ+fMailBoxX)*fScale );
00300     wcBoxEdgeBottom->SetFillStyle(0);
00301     wcBoxEdgeBottom->SetLineColor(1);
00302     wcBoxEdgeBottom->SetLineWidth(2);
00303 
00304     // edges on side of detector
00305     wcBoxEdgeLine1 = new TLine( -(0.5*fMailBoxY+fMailBoxX)*fScale, -0.5*fMailBoxZ*fScale,
00306                                 -(0.5*fMailBoxY+fMailBoxX)*fScale, +0.5*fMailBoxZ*fScale );
00307     wcBoxEdgeLine1->SetLineColor(1);
00308     wcBoxEdgeLine1->SetLineWidth(2);
00309     wcBoxEdgeLine1->SetLineStyle(7);
00310 
00311     wcBoxEdgeLine2 = new TLine( -0.5*fMailBoxY*fScale, -0.5*fMailBoxZ*fScale,
00312                                 -0.5*fMailBoxY*fScale, +0.5*fMailBoxZ*fScale );
00313     wcBoxEdgeLine2->SetLineColor(1);
00314     wcBoxEdgeLine2->SetLineWidth(2);
00315     wcBoxEdgeLine2->SetLineStyle(7);
00316 
00317     wcBoxEdgeLine3 = new TLine( +0.5*fMailBoxY*fScale, -0.5*fMailBoxZ*fScale,
00318                                 +0.5*fMailBoxY*fScale, +0.5*fMailBoxZ*fScale );
00319     wcBoxEdgeLine3->SetLineColor(1);
00320     wcBoxEdgeLine3->SetLineWidth(2);
00321     wcBoxEdgeLine3->SetLineStyle(7);
00322 
00323     wcBoxEdgeLine4 = new TLine( +(0.5*fMailBoxY+fMailBoxX)*fScale, -0.5*fMailBoxZ*fScale,
00324                                 +(0.5*fMailBoxY+fMailBoxX)*fScale, +0.5*fMailBoxZ*fScale);
00325     wcBoxEdgeLine4->SetLineColor(1);
00326     wcBoxEdgeLine4->SetLineWidth(2);
00327     wcBoxEdgeLine4->SetLineStyle(7);
00328 
00329     // coordinates for title box
00330     titleU = -0.5*fU;
00331     titleV = +0.55*fV;    
00332 
00333     // make legend (reco/true)
00334     this->MakeLegendRECO();
00335 
00336     // make legend (pulse height)
00337     this->MakeLegendQPE();
00338 
00339     // make time display canvas
00340     if( fMakeTimeDisplay ){  
00341       wcTimeCanvas = new TCanvas("WCSimTimeDisplay","WCSim Timing Display",
00342                                    canvasU, canvasV);    
00343 
00344       // make legend (timing)
00345       this->MakeLegendTIME();
00346     }
00347 
00348   }
00349 
00350   // Draw Everything
00351   // ===============
00352 
00353   // draw space display
00354   if( wcCanvas ){
00355     wcCanvas->cd();
00356     wcDisplay->Draw();
00357     if( wcCylEdgeSide )   wcCylEdgeSide->Draw();
00358     if( wcCylEdgeTop )    wcCylEdgeTop->Draw();
00359     if( wcCylEdgeBottom ) wcCylEdgeBottom->Draw();    
00360     if( wcBoxEdgeSide )   wcBoxEdgeSide->Draw();
00361     if( wcBoxEdgeTop )    wcBoxEdgeTop->Draw();
00362     if( wcBoxEdgeBottom ) wcBoxEdgeBottom->Draw();
00363     if( wcBoxEdgeLine1 )  wcBoxEdgeLine1->Draw();
00364     if( wcBoxEdgeLine2 )  wcBoxEdgeLine2->Draw();
00365     if( wcBoxEdgeLine3 )  wcBoxEdgeLine3->Draw();
00366     if( wcBoxEdgeLine4 )  wcBoxEdgeLine4->Draw();
00367     wcLegend->Draw();
00368     wcRecoLegend->Draw();
00369     wcCanvas->Update();
00370   }
00371 
00372   // draw time display
00373   if( wcTimeCanvas ){
00374     wcTimeCanvas->cd();
00375     wcDisplay->Draw();    
00376     if( wcCylEdgeSide )   wcCylEdgeSide->Draw();
00377     if( wcCylEdgeTop )    wcCylEdgeTop->Draw();
00378     if( wcCylEdgeBottom ) wcCylEdgeBottom->Draw();    
00379     if( wcBoxEdgeSide )   wcBoxEdgeSide->Draw();
00380     if( wcBoxEdgeTop )    wcBoxEdgeTop->Draw();
00381     if( wcBoxEdgeBottom ) wcBoxEdgeBottom->Draw();   
00382     if( wcBoxEdgeLine1 )  wcBoxEdgeLine1->Draw();
00383     if( wcBoxEdgeLine2 )  wcBoxEdgeLine2->Draw();
00384     if( wcBoxEdgeLine3 )  wcBoxEdgeLine3->Draw();
00385     if( wcBoxEdgeLine4 )  wcBoxEdgeLine4->Draw();
00386     wcTimeLegend->Draw();
00387     wcRecoLegend->Draw();
00388     wcTimeCanvas->Update();
00389   }
00390 
00391   return;
00392 }
00393 
00394 void WCSimDisplayAB::DrawNewDisplay()
00395 {
00396   // Draw Everything
00397   // ===============
00398 
00399   // sanity check
00400   if( wcCanvas==0 ) return;
00401 
00402   // run/event info
00403   wcTitleString="";
00404   
00405   if( fRunNumber>=0 ){  
00406     wcTitleString.Append("Run: "); 
00407     wcTitleString+=fRunNumber;
00408     wcTitleString.Append("  ");
00409     wcTitleString.Append("Event: "); 
00410     wcTitleString+=fEventNumber;
00411     wcTitleString.Append("  ");
00412     wcTitleString.Append("SubEvent: "); 
00413     wcTitleString+=fTriggerNumber;
00414 
00415     wcTitleLatex.SetTextFont(42);
00416     wcTitleLatex.SetTextSize(0.04);
00417     wcTitleLatex.SetTextAlign(13);
00418   }
00419 
00420   // draw space display
00421   if( wcCanvas ){
00422     wcCanvas->cd();
00423     wcDisplay->Draw();    
00424     if( wcCylEdgeSide )   wcCylEdgeSide->Draw();
00425     if( wcCylEdgeTop )    wcCylEdgeTop->Draw();
00426     if( wcCylEdgeBottom ) wcCylEdgeBottom->Draw();    
00427     if( wcBoxEdgeSide )   wcBoxEdgeSide->Draw();
00428     if( wcBoxEdgeTop )    wcBoxEdgeTop->Draw();
00429     if( wcBoxEdgeBottom ) wcBoxEdgeBottom->Draw();   
00430     if( wcBoxEdgeLine1 )  wcBoxEdgeLine1->Draw();
00431     if( wcBoxEdgeLine2 )  wcBoxEdgeLine2->Draw();
00432     if( wcBoxEdgeLine3 )  wcBoxEdgeLine3->Draw();
00433     if( wcBoxEdgeLine4 )  wcBoxEdgeLine4->Draw();
00434     wcLegend->Draw();
00435     wcRecoLegend->Draw();
00436     wcTitleLatex.DrawLatex(titleU*fScale,
00437                            titleV*fScale,
00438                            wcTitleString.Data());
00439     wcCanvas->Update();
00440   }
00441 
00442   // draw time display
00443   if( wcTimeCanvas ){
00444     wcTimeCanvas->cd();
00445     wcDisplay->Draw();
00446     if( wcCylEdgeSide )   wcCylEdgeSide->Draw();
00447     if( wcCylEdgeTop )    wcCylEdgeTop->Draw();
00448     if( wcCylEdgeBottom ) wcCylEdgeBottom->Draw();    
00449     if( wcBoxEdgeSide )   wcBoxEdgeSide->Draw();
00450     if( wcBoxEdgeTop )    wcBoxEdgeTop->Draw();
00451     if( wcBoxEdgeBottom ) wcBoxEdgeBottom->Draw();   
00452     if( wcBoxEdgeLine1 )  wcBoxEdgeLine1->Draw();
00453     if( wcBoxEdgeLine2 )  wcBoxEdgeLine2->Draw();
00454     if( wcBoxEdgeLine3 )  wcBoxEdgeLine3->Draw();
00455     if( wcBoxEdgeLine4 )  wcBoxEdgeLine4->Draw();
00456     wcTimeLegend->Draw();
00457     wcRecoLegend->Draw();
00458     wcTitleLatex.DrawLatex(titleU*fScale,
00459                            titleV*fScale,
00460                            wcTitleString.Data());
00461     wcTimeCanvas->Update();
00462   }
00463 }
00464 
00465 void WCSimDisplayAB::UpdateDisplay()
00466 {
00467   // draw new display
00468   this->DrawNewDisplay();
00469 
00470   // space display
00471   if( wcCanvas ){
00472     wcCanvas->cd();
00473   
00474     for( UInt_t n=0; n<wcDigits.size(); n++ ){
00475       TMarker* marker = (TMarker*)(wcDigits.at(n));
00476       marker->Draw();
00477     }
00478 
00479    for( UInt_t n=0; n<wcCommonDigits.size(); n++ ){
00480       TMarker* marker = (TMarker*)(wcCommonDigits.at(n));
00481       marker->Draw();
00482     }
00483 
00484     for( UInt_t n=0; n<wcRings.size(); n++ ){
00485       TPolyMarker* polymarker = (TPolyMarker*)(wcRings.at(n));
00486       polymarker->Draw("C");
00487     }
00488 
00489     wcCanvas->Update();
00490   }
00491 
00492   // time display
00493   if( wcTimeCanvas ){
00494     wcTimeCanvas->cd();
00495 
00496     for( UInt_t n=0; n<wcTimeDigits.size(); n++ ){
00497       TMarker* marker = (TMarker*)(wcTimeDigits.at(n));
00498       marker->Draw();
00499     }
00500 
00501     for( UInt_t n=0; n<wcCommonDigits.size(); n++ ){
00502       TMarker* marker = (TMarker*)(wcCommonDigits.at(n));
00503       marker->Draw();
00504     }
00505 
00506     for( UInt_t n=0; n<wcRings.size(); n++ ){
00507       TPolyMarker* polymarker = (TPolyMarker*)(wcRings.at(n));
00508       polymarker->Draw("C");
00509     }
00510 
00511     wcTimeCanvas->Update();
00512   }
00513 }
00514 
00515 void WCSimDisplayAB::DrawDisplay(WCSimRecoEvent* myRecoEvent)
00516 {
00517   // Reset Display
00518   // =============
00519   this->ResetDisplay();
00520 
00521   // Check for Event  
00522   // ===============
00523   if( myRecoEvent==0 ) return;
00524 
00525   // Get Event Info
00526   // ==============
00527   fRunNumber = myRecoEvent->GetRun();
00528   fEventNumber = myRecoEvent->GetEvent();
00529   fTriggerNumber = myRecoEvent->GetTrigger();
00530 
00531   // Draw all digits
00532   // ================
00533   for( Int_t nDigit=0; nDigit<myRecoEvent->GetNDigits(); nDigit++ ){
00534     WCSimRecoDigit* myDigit = (WCSimRecoDigit*)(myRecoEvent->GetDigit(nDigit));
00535 
00536     Double_t Q = myDigit->GetQPEs();
00537     Double_t T = myDigit->GetTime();
00538     
00539     if( Q<GetPulseHeightCut() ) continue;
00540 
00541     Int_t region = myDigit->GetRegion();
00542     Double_t x = myDigit->GetX();
00543     Double_t y = myDigit->GetY();
00544     Double_t z = myDigit->GetZ();
00545 
00546     Double_t u = -99999.9;
00547     Double_t v = -99999.9;
00548 
00549     // convert XYZ to UV
00550     WCSimGeometry::Instance()->XYZtoUV( region,
00551                                         x, y, z,
00552                                         u, v );
00553 
00554     // create markers
00555     // ==============
00556     TMarker* marker = 0;      
00557     Int_t colourCode = 0;
00558 
00559     // create marker for space display
00560     marker = new TMarker(u*fScale,v*fScale,20); // 20: closed circles
00561     marker->SetMarkerSize(0.75);
00562 
00563     colourCode = this->QPEtoCOL(Q);
00564     marker->SetMarkerColor(colourCode);
00565       
00566     wcDigits.push_back(marker);
00567 
00568     // create marker for time display
00569     marker = new TMarker(u*fScale,v*fScale,20); // 20: closed circles
00570     marker->SetMarkerSize(0.75);
00571 
00572     colourCode = this->TIMEtoCOL(T);
00573     marker->SetMarkerColor(colourCode);
00574       
00575     wcTimeDigits.push_back(marker);
00576   }
00577 
00578   // Draw Display
00579   // ============
00580   this->DrawNewDisplay();
00581 
00582   // space display
00583   if( wcCanvas ){
00584     wcCanvas->cd();
00585 
00586     for( UInt_t n=0; n<wcDigits.size(); n++ ){
00587       TMarker* marker = (TMarker*)(wcDigits.at(n));
00588       marker->Draw();
00589     }
00590 
00591     for( UInt_t n=0; n<wcCommonDigits.size(); n++ ){
00592       TMarker* marker = (TMarker*)(wcCommonDigits.at(n));
00593       marker->Draw();
00594     }
00595 
00596     wcCanvas->Update();
00597   }
00598 
00599   // time display
00600   if( wcTimeCanvas ){
00601     wcTimeCanvas->cd();
00602 
00603     for( UInt_t n=0; n<wcTimeDigits.size(); n++ ){
00604       TMarker* marker = (TMarker*)(wcTimeDigits.at(n));
00605       marker->Draw();
00606     }
00607 
00608     for( UInt_t n=0; n<wcCommonDigits.size(); n++ ){
00609       TMarker* marker = (TMarker*)(wcCommonDigits.at(n));
00610       marker->Draw();
00611     }
00612 
00613     wcTimeCanvas->Update();
00614   }
00615 
00616   return;
00617 }
00618 
00619 void WCSimDisplayAB::DrawCleanDisplay(WCSimRecoEvent* myRecoEvent)
00620 {
00621   // Reset Display
00622   // =============
00623   this->ResetDisplay();
00624 
00625   // Check for Event  
00626   // ===============
00627   if( myRecoEvent==0 ) return;
00628 
00629   // Get Event Info
00630   // ==============
00631   fRunNumber = myRecoEvent->GetRun();
00632   fEventNumber = myRecoEvent->GetEvent();
00633   fTriggerNumber = myRecoEvent->GetTrigger();
00634 
00635   // Draw all digits
00636   // ===============
00637   for( Int_t nDigit=0; nDigit<myRecoEvent->GetNDigits(); nDigit++ ){
00638     WCSimRecoDigit* myDigit = (WCSimRecoDigit*)(myRecoEvent->GetDigit(nDigit));
00639 
00640     Int_t region = myDigit->GetRegion();
00641     Double_t x = myDigit->GetX();
00642     Double_t y = myDigit->GetY();
00643     Double_t z = myDigit->GetZ();
00644 
00645     Double_t u = -99999.9;
00646     Double_t v = -99999.9;
00647       
00648     // convert XYZ to UV
00649     WCSimGeometry::Instance()->XYZtoUV( region,
00650                                         x, y, z,
00651                                         u, v );
00652 
00653     // create marker
00654     // =============
00655     TMarker* marker = 0;
00656 
00657     // create marker for space display
00658     marker = new TMarker(u*fScale,v*fScale,24); // 24: open circles
00659     marker->SetMarkerSize(0.75);
00660     marker->SetMarkerColor(kGray);   
00661     wcDigits.push_back(marker);
00662 
00663     // create marker for time display
00664     marker = new TMarker(u*fScale,v*fScale,24); // 24: open circles
00665     marker->SetMarkerSize(0.75);
00666     marker->SetMarkerColor(kGray);
00667     wcTimeDigits.push_back(marker);
00668   }
00669 
00670   // Draw filtered digits
00671   // ====================
00672   for( Int_t nDigit=0; nDigit<myRecoEvent->GetNFilterDigits(); nDigit++ ){
00673     WCSimRecoDigit* myDigit = (WCSimRecoDigit*)(myRecoEvent->GetFilterDigit(nDigit));
00674 
00675     Double_t Q = myDigit->GetQPEs();
00676     Double_t T = myDigit->GetTime();
00677 
00678     if( Q<GetPulseHeightCut() ) continue;
00679 
00680     Int_t region = myDigit->GetRegion();
00681     Double_t x = myDigit->GetX();
00682     Double_t y = myDigit->GetY();
00683     Double_t z = myDigit->GetZ();
00684 
00685     Double_t u = -99999.9;
00686     Double_t v = -99999.9;
00687 
00688     // convert XYZ to UV
00689     WCSimGeometry::Instance()->XYZtoUV( region,
00690                                         x, y, z,
00691                                         u, v );
00692 
00693     // create markers
00694     // ==============
00695     TMarker* marker = 0;      
00696     Int_t colourCode = 0;
00697 
00698     // create marker for space display
00699     marker = new TMarker(u*fScale,v*fScale,20); // 20: closed circles
00700     marker->SetMarkerSize(0.75);
00701 
00702     colourCode = this->QPEtoCOL(Q);
00703     marker->SetMarkerColor(colourCode);
00704       
00705     wcDigits.push_back(marker);
00706 
00707     // create marker for time display
00708     marker = new TMarker(u*fScale,v*fScale,20); // 20: closed circles
00709     marker->SetMarkerSize(0.75);
00710 
00711     colourCode = this->TIMEtoCOL(T);
00712     marker->SetMarkerColor(colourCode);
00713       
00714     wcTimeDigits.push_back(marker);
00715   }
00716 
00717   // Draw Display
00718   // ============
00719   this->DrawNewDisplay();
00720 
00721   // space display
00722   if( wcCanvas ){
00723     wcCanvas->cd();
00724 
00725     for( UInt_t n=0; n<wcDigits.size(); n++ ){
00726       TMarker* marker = (TMarker*)(wcDigits.at(n));
00727       marker->Draw();
00728     }
00729 
00730     for( UInt_t n=0; n<wcCommonDigits.size(); n++ ){
00731       TMarker* marker = (TMarker*)(wcCommonDigits.at(n));
00732       marker->Draw();
00733     }
00734 
00735     wcCanvas->Update();
00736   }
00737 
00738   // time display
00739   if( wcTimeCanvas ){
00740     wcTimeCanvas->cd();
00741 
00742     for( UInt_t n=0; n<wcTimeDigits.size(); n++ ){
00743       TMarker* marker = (TMarker*)(wcTimeDigits.at(n));
00744       marker->Draw();
00745     }
00746 
00747     for( UInt_t n=0; n<wcCommonDigits.size(); n++ ){
00748       TMarker* marker = (TMarker*)(wcCommonDigits.at(n));
00749       marker->Draw();
00750     }
00751 
00752     wcTimeCanvas->Update();
00753   }
00754 
00755   return;
00756 }
00757 
00758 void WCSimDisplayAB::DrawTrueEvent(WCSimTrueEvent* myTrueEvent)
00759 { 
00760   // Check for Event  
00761   // ===============
00762   if( myTrueEvent==0 
00763    || myTrueEvent->GetNTracks()==0 ) return;
00764     
00765   // True Event
00766   // ==========
00767   Double_t evt_x0 = myTrueEvent->GetVtxX();
00768   Double_t evt_y0 = myTrueEvent->GetVtxY();
00769   Double_t evt_z0 = myTrueEvent->GetVtxZ();
00770         
00771   Double_t evt_px = myTrueEvent->GetDirX();
00772   Double_t evt_py = myTrueEvent->GetDirY();
00773   Double_t evt_pz = myTrueEvent->GetDirZ();
00774     
00775   // colour code (truth)
00776   Int_t evt_colourcode = 2; // red
00777 
00778   // draw true vertex
00779   this->DrawVertex(evt_x0, evt_y0, evt_z0,
00780                    evt_px, evt_py, evt_pz,
00781                    evt_colourcode);
00782 
00783 
00784   // Loop over True Tracks
00785   // =====================
00786   for( Int_t nTrack=0; nTrack<myTrueEvent->GetNTracks(); nTrack++ ){
00787     WCSimTrueTrack* myTrack = (WCSimTrueTrack*)(myTrueEvent->GetTrack(nTrack));
00788 
00789     // true vertex and direction
00790     Double_t x0 = myTrack->GetVtxX();
00791     Double_t y0 = myTrack->GetVtxY();
00792     Double_t z0 = myTrack->GetVtxZ();
00793         
00794     Double_t px = myTrack->GetDirX();
00795     Double_t py = myTrack->GetDirY();
00796     Double_t pz = myTrack->GetDirZ();
00797 
00798     Double_t angle = 42.0;
00799 
00800     // colour code (truth)
00801     Int_t colourcode = 2; // red
00802 
00803     // draw true ring
00804     this->DrawRing(x0, y0, z0,
00805                    px, py, pz,
00806                    angle, colourcode);
00807   }
00808 
00809   return;
00810 }
00811    
00812 void WCSimDisplayAB::DrawRecoEvent(WCSimRecoEvent* myRecoEvent)
00813 {  
00814   // Check for Event  
00815   // ===============
00816   if( myRecoEvent==0 
00817    || myRecoEvent->FoundVertex()==0
00818    || myRecoEvent->FoundDirection()==0 ) return;
00819 
00820   // Reconstructed Event
00821   // ===================
00822    Double_t evt_x0 = myRecoEvent->GetVtxX();
00823    Double_t evt_y0 = myRecoEvent->GetVtxY();
00824    Double_t evt_z0 = myRecoEvent->GetVtxZ();
00825 
00826    Double_t evt_px = myRecoEvent->GetDirX();
00827    Double_t evt_py = myRecoEvent->GetDirY();
00828    Double_t evt_pz = myRecoEvent->GetDirZ();   
00829 
00830    // colour code (reco)
00831    Int_t evt_colourcode = 1; // black
00832      
00833    // draw reconstructed vertex
00834    this->DrawVertex(evt_x0, evt_y0, evt_z0,
00835                     evt_px, evt_py, evt_pz,
00836                     evt_colourcode);     
00837 
00838   // Loop over Rings
00839   // ===============
00840   for( Int_t nRing=0; nRing<myRecoEvent->GetNRings(); nRing++ ){
00841     WCSimRecoRing* myRing = (WCSimRecoRing*)(myRecoEvent->GetRing(nRing));
00842 
00843     // reconstructed vertex and direction
00844     Double_t x0 = myRing->GetVtxX();
00845     Double_t y0 = myRing->GetVtxY();
00846     Double_t z0 = myRing->GetVtxZ();
00847 
00848     Double_t px = myRing->GetDirX();
00849     Double_t py = myRing->GetDirY();
00850     Double_t pz = myRing->GetDirZ();
00851 
00852     Double_t angle = myRing->GetAngle();
00853 
00854     // colour code (reco)
00855     Int_t colourcode = 1; // black
00856 
00857     // draw reconstructed ring
00858     this->DrawRing(x0, y0, z0,
00859                    px, py, pz,
00860                    angle, colourcode);
00861   }
00862 
00863   return;
00864 
00865 }
00866 
00867 void WCSimDisplayAB::DrawVertex(Double_t vx, Double_t vy, Double_t vz, Double_t px, Double_t py, Double_t pz, Int_t colourcode )
00868 {
00869   // draw reco/true vertex
00870   Double_t x = 0.0;
00871   Double_t y = 0.0;
00872   Double_t z = 0.0;
00873   Double_t u = -99999.9;
00874   Double_t v = -99999.9;
00875 
00876   Int_t region = -1;
00877 
00878   // project reconstructed vertex onto detector
00879   WCSimGeometry::Instance()->ProjectToFarEdge( vx, vy, vz,
00880                                                px, py, pz,
00881                                                x, y, z, 
00882                                                region );
00883 
00884   // convert XYZ to UV
00885   WCSimGeometry::Instance()->XYZtoUV( region,
00886                                       x, y, z,
00887                                       u, v );
00888 
00889   // create marker for vertex
00890   TMarker* marker = new TMarker(u*fScale,v*fScale,29);
00891   marker->SetMarkerSize(2.5);
00892   marker->SetMarkerColor(colourcode);
00893   
00894   // store marker
00895   wcCommonDigits.push_back(marker);
00896 
00897   // Draw on display
00898   if( wcCanvas ){
00899     wcCanvas->cd();
00900     marker->Draw();
00901     wcCanvas->Update();
00902   }
00903 
00904   // Draw on display
00905   if( wcTimeCanvas ){
00906     wcTimeCanvas->cd();
00907     marker->Draw();
00908     wcTimeCanvas->Update();
00909   }
00910 
00911   return;
00912 }
00913 
00914 void WCSimDisplayAB::DrawRing(Double_t vx, Double_t vy, Double_t vz, Double_t px, Double_t py, Double_t pz, Double_t angle, Int_t colourcode)
00915 {
00916   // draw ring
00917   Double_t xproj = 0.0;
00918   Double_t yproj = 0.0;
00919   Double_t zproj = 0.0;
00920 
00921   Double_t xring = 0.0;
00922   Double_t yring = 0.0;
00923   Double_t zring = 0.0;
00924 
00925   Double_t x = 0.0;
00926   Double_t y = 0.0;
00927   Double_t z = 0.0;
00928 
00929   Double_t nx = 0.0;
00930   Double_t ny = 0.0;
00931   Double_t nz = 0.0;
00932 
00933   Double_t u = -99999.9;
00934   Double_t v = -99999.9;
00935 
00936   Double_t radius = 0.0;
00937 
00938   Int_t region = -1;
00939 
00940   // project vertex onto edge of detector
00941   WCSimGeometry::Instance()->ProjectToFarEdge( vx, vy, vz,
00942                                                px, py, pz,
00943                                                xproj, yproj, zproj, 
00944                                                region );
00945 
00946   // draw ring from many markers...
00947   Int_t n_ring = 360;
00948 
00949   Double_t* u_ring = new Double_t[n_ring];
00950   Double_t* v_ring = new Double_t[n_ring];
00951 
00952   Double_t cone_angle = angle; // 42.0;        // both angles
00953   Double_t delta_omega = 360.0/double(n_ring); // in degrees
00954 
00955   for( Int_t n=0; n<n_ring; n++ ){
00956 
00957     WCSimGeometry::FindCircle( xproj, yproj, zproj,
00958                                vx, vy, vz,
00959                                cone_angle, n*delta_omega,
00960                                xring, yring, zring,
00961                                nx, ny, nz,
00962                                radius );
00963 
00964     WCSimGeometry::Instance()->ProjectToFarEdge( vx, vy, vz,
00965                                                  nx, ny, nz,
00966                                                  x, y, z,
00967                                                  region );
00968 
00969     WCSimGeometry::Instance()->XYZtoUV( region,
00970                                         x, y, z,
00971                                         u, v );
00972     u_ring[n] = u*fScale;
00973     v_ring[n] = v*fScale;
00974   }
00975 
00976   // create polymarker
00977   TPolyMarker* polymarker = new TPolyMarker(n_ring,u_ring,v_ring);
00978   polymarker->SetMarkerSize(0.4);
00979   polymarker->SetMarkerColor(colourcode);
00980   
00981   // store polymarker
00982   wcRings.push_back(polymarker);
00983 
00984   // draw on display
00985   if( wcCanvas ){
00986     wcCanvas->cd();
00987     polymarker->Draw("");
00988     wcCanvas->Update();
00989   }  
00990 
00991   // draw on display
00992   if( wcTimeCanvas ){
00993     wcTimeCanvas->cd();
00994     polymarker->Draw("");
00995     wcTimeCanvas->Update();
00996   }
00997 
00998   delete [] u_ring;
00999   delete [] v_ring;
01000 
01001   return;
01002 }
01003  
01004 void WCSimDisplayAB::MakeLegendRECO()
01005 {  
01006   if( wcRecoLegend ) return;
01007 
01008   wcRecoLegend = new TLegend(0.19,0.20,0.41,0.37);
01009   wcRecoLegend->SetLineColor(kWhite);
01010   wcRecoLegend->SetFillColor(kWhite);
01011   wcRecoLegend->SetFillStyle(0);
01012 
01013   TLegend* legend = wcRecoLegend;
01014   TMarker* marker = 0;
01015   TLine* line = 0;
01016 
01017   // true vertex
01018   marker = new TMarker(0.0,0.0,29);
01019   marker->SetMarkerSize(2.5);
01020   marker->SetMarkerColor(2); 
01021   legend->AddEntry(marker,"True Vertex","p");
01022   legDigits.push_back(marker);
01023 
01024   // reconstructed vertex
01025   marker = new TMarker(0.0,0.0,29);
01026   marker->SetMarkerSize(2.5);
01027   marker->SetMarkerColor(1); 
01028   legend->AddEntry(marker,"Reco Vertex","p");
01029   legDigits.push_back(marker);
01030 
01031   // true line
01032   line = new TLine(0.0,0.0,1.0,1.0);
01033   line->SetLineColor(2);
01034   line->SetLineWidth(3);
01035   legend->AddEntry(line,"True Ring","l");
01036   legRings.push_back(line);
01037 
01038   // reconstructed line
01039   line = new TLine(0.0,0.0,1.0,1.0);
01040   line->SetLineColor(1);
01041   line->SetLineWidth(3);
01042   legend->AddEntry(line,"Reco Ring","l");
01043   legRings.push_back(line);
01044 
01045   return;
01046 }
01047 
01048 void WCSimDisplayAB::PrintDisplay()
01049 {
01050   // print GIF
01051   if( fPrintGIF ) this->PrintDisplayGIF();
01052 
01053   // print EPS
01054   if( fPrintEPS ) this->PrintDisplayEPS();
01055 }
01056 
01057 void WCSimDisplayAB::PrintDisplayEPS()
01058 {
01059   // print space display
01060   if( wcCanvas ){
01061     TString outfile("wcdisplay");
01062     outfile.Append(".");
01063     outfile+=fRunNumber;
01064     outfile.Append(".");
01065     outfile+=fEventNumber;
01066     outfile.Append(".eps");
01067     wcCanvas->SaveAs(outfile.Data());
01068   }  
01069 
01070   // print time display
01071   if( wcTimeCanvas ){
01072     TString outfile("wcdisplay");
01073     outfile.Append(".");
01074     outfile+=fRunNumber;
01075     outfile.Append(".");
01076     outfile+=fEventNumber;
01077     outfile.Append(".timing.eps");
01078     wcTimeCanvas->SaveAs(outfile.Data());
01079   }
01080 }
01081 
01082 void WCSimDisplayAB::PrintDisplayGIF()
01083 {
01084   // print space display
01085   if( wcCanvas ){
01086     TString outfile("wcdisplay");
01087     outfile.Append(".");
01088     outfile+=fRunNumber;
01089     outfile.Append(".");
01090     outfile+=fEventNumber;
01091     outfile.Append(".gif");
01092     wcCanvas->SaveAs(outfile.Data());
01093   }  
01094 
01095   // print time display
01096   if( wcTimeCanvas ){
01097     TString outfile("wcdisplay");
01098     outfile.Append(".");
01099     outfile+=fRunNumber;
01100     outfile.Append(".");
01101     outfile+=fEventNumber;
01102     outfile.Append(".timing.gif");
01103     wcTimeCanvas->SaveAs(outfile.Data());
01104   }
01105 }
01106 
01107 Int_t WCSimDisplayAB::QPEtoCOL(Double_t Q)
01108 {
01109   Int_t colourCode = kWhite; 
01110 
01111   if( Q<0.8 )             colourCode = kYellow-7;
01112   if( Q>=0.8 && Q<1.5 )   colourCode = kCyan-7;
01113   if( Q>=1.5 && Q<2.5 )   colourCode = kCyan+1;
01114   if( Q>=2.5 && Q<5.0 )   colourCode = kBlue-4;
01115   if( Q>=5.0 && Q<10.0 )  colourCode = kBlue+1;
01116   if( Q>=10.0 && Q<15.0 ) colourCode = kMagenta+1;
01117   if( Q>=15.0 && Q<20.0 ) colourCode = kMagenta+2;
01118   if( Q>=20.0 && Q<30.0 ) colourCode = kRed-4;
01119   if( Q>=30.0 )           colourCode = kRed;
01120 
01121   return colourCode;
01122 }
01123 
01124 void WCSimDisplayAB::MakeLegendQPE()
01125 {
01126   if( wcLegend ) return;
01127 
01128   wcLegend = new TLegend(0.19,0.70,0.40,0.90);
01129   wcLegend->SetLineColor(kWhite);
01130   wcLegend->SetFillColor(kWhite);
01131   wcLegend->SetFillStyle(0);
01132 
01133   TLegend* legend = wcLegend;
01134   TMarker* marker = 0;
01135   Int_t colourCode = 0;
01136 
01137   colourCode = kYellow-7;
01138   marker = new TMarker(0.0,0.0,20);
01139   marker->SetMarkerSize(0.75);
01140   marker->SetMarkerColor(colourCode); 
01141   legend->AddEntry(marker,"<0.8 PEs","p");
01142   legDigits.push_back(marker);
01143 
01144   colourCode = kCyan-7;
01145   marker = new TMarker(0.0,0.0,20);
01146   marker->SetMarkerSize(0.75);
01147   marker->SetMarkerColor(colourCode); 
01148   legend->AddEntry(marker,"0.8 - 1.5 PEs","p");
01149   legDigits.push_back(marker);
01150 
01151   colourCode = kCyan+1;
01152   marker = new TMarker(0.0,0.0,20);
01153   marker->SetMarkerSize(0.75);
01154   marker->SetMarkerColor(colourCode); 
01155   legend->AddEntry(marker,"1.5 - 2.5 PEs","p");  
01156   legDigits.push_back(marker);
01157 
01158   colourCode = kBlue-4;
01159   marker = new TMarker(0.0,0.0,20);
01160   marker->SetMarkerSize(0.75);
01161   marker->SetMarkerColor(colourCode); 
01162   legend->AddEntry(marker,"2.5 - 5.0 PEs","p");  
01163   legDigits.push_back(marker);
01164 
01165   colourCode = kBlue+1;
01166   marker = new TMarker(0.0,0.0,20);
01167   marker->SetMarkerSize(0.75);
01168   marker->SetMarkerColor(colourCode); 
01169   legend->AddEntry(marker,"5.0 - 10.0 PEs","p");  
01170   legDigits.push_back(marker);
01171 
01172   colourCode = kMagenta+1;
01173   marker = new TMarker(0.0,0.0,20);
01174   marker->SetMarkerSize(0.75);
01175   marker->SetMarkerColor(colourCode); 
01176   legend->AddEntry(marker,"10.0 - 15.0 PEs","p");
01177   legDigits.push_back(marker);
01178 
01179   colourCode = kMagenta+2;
01180   marker = new TMarker(0.0,0.0,20);
01181   marker->SetMarkerSize(0.75);
01182   marker->SetMarkerColor(colourCode); 
01183   legend->AddEntry(marker,"15.0 - 20.0 PEs","p");  
01184   legDigits.push_back(marker);
01185 
01186   colourCode = kRed-4;
01187   marker = new TMarker(0.0,0.0,20);
01188   marker->SetMarkerSize(0.75);
01189   marker->SetMarkerColor(colourCode); 
01190   legend->AddEntry(marker,"20.0 - 30.0 PEs","p");  
01191   legDigits.push_back(marker);
01192 
01193   colourCode = kRed;
01194   marker = new TMarker(0.0,0.0,20);
01195   marker->SetMarkerSize(0.75);
01196   marker->SetMarkerColor(colourCode); 
01197   legend->AddEntry(marker,">30.0 PEs","p");
01198   legDigits.push_back(marker);
01199 
01200   return;
01201 }
01202 
01203 Int_t WCSimDisplayAB::TIMEtoCOL(Double_t T)
01204 {
01205   Int_t colourCode = kWhite; 
01206 
01207   Double_t fBaseT = 950.0;
01208 
01209   if( T-fBaseT<-10.0 )                      colourCode = 98;
01210   if( T-fBaseT>=-10.0  && T-fBaseT<10.0 )   colourCode = 98;
01211   if( T-fBaseT>=10.0   && T-fBaseT<30.0 )   colourCode = 94;
01212   if( T-fBaseT>=30.0   && T-fBaseT<50.0 )   colourCode = 89;
01213   if( T-fBaseT>=50.0   && T-fBaseT<100.0 )  colourCode = 85;
01214   if( T-fBaseT>=100.0  && T-fBaseT<150.0 )  colourCode = 80;
01215   if( T-fBaseT>=150.0  && T-fBaseT<200.0 )  colourCode = 75;
01216   if( T-fBaseT>=200.0  && T-fBaseT<300.0 )  colourCode = 70;
01217   if( T-fBaseT>=300.0  && T-fBaseT<450.0 )  colourCode = 65;
01218   if( T-fBaseT>=450.0  && T-fBaseT<650.0 )  colourCode = 55;
01219   if( T-fBaseT>=650.0 )                     colourCode = 55; 
01220   
01221   return colourCode;
01222 }
01223 
01224 void WCSimDisplayAB::MakeLegendTIME()
01225 {
01226   if( wcTimeLegend ) return;
01227 
01228   wcTimeLegend = new TLegend(0.19,0.70,0.40,0.90);
01229   wcTimeLegend->SetLineColor(kWhite);
01230   wcTimeLegend->SetFillColor(kWhite);
01231   wcTimeLegend->SetFillStyle(0);
01232 
01233   TLegend* legend = wcTimeLegend;
01234   TMarker* marker = 0;
01235   Int_t colourCode = 0;
01236 
01237   colourCode = 98;
01238   marker = new TMarker(0.0,0.0,20);
01239   marker->SetMarkerSize(0.75);
01240   marker->SetMarkerColor(colourCode); 
01241   legend->AddEntry(marker,"940 - 960 ns","p");
01242   legDigits.push_back(marker);
01243 
01244   colourCode = 94;
01245   marker = new TMarker(0.0,0.0,20);
01246   marker->SetMarkerSize(0.75);
01247   marker->SetMarkerColor(colourCode); 
01248   legend->AddEntry(marker,"960 - 980 ns","p");
01249   legDigits.push_back(marker);
01250 
01251   colourCode = 89;
01252   marker = new TMarker(0.0,0.0,20);
01253   marker->SetMarkerSize(0.75);
01254   marker->SetMarkerColor(colourCode); 
01255   legend->AddEntry(marker,"980 - 1000 ns","p");
01256   legDigits.push_back(marker);
01257 
01258   colourCode = 85;
01259   marker = new TMarker(0.0,0.0,20);
01260   marker->SetMarkerSize(0.75);
01261   marker->SetMarkerColor(colourCode); 
01262   legend->AddEntry(marker,"1000 - 1050 ns","p");
01263   legDigits.push_back(marker);
01264 
01265   colourCode = 80;
01266   marker = new TMarker(0.0,0.0,20);
01267   marker->SetMarkerSize(0.75);
01268   marker->SetMarkerColor(colourCode); 
01269   legend->AddEntry(marker,"1050 - 1100 ns","p");
01270   legDigits.push_back(marker);
01271 
01272   colourCode = 75;
01273   marker = new TMarker(0.0,0.0,20);
01274   marker->SetMarkerSize(0.75);
01275   marker->SetMarkerColor(colourCode); 
01276   legend->AddEntry(marker,"1100 - 1150 ns","p");
01277   legDigits.push_back(marker);
01278 
01279   colourCode = 70;
01280   marker = new TMarker(0.0,0.0,20);
01281   marker->SetMarkerSize(0.75);
01282   marker->SetMarkerColor(colourCode); 
01283   legend->AddEntry(marker,"1150 - 1250 ns","p");
01284   legDigits.push_back(marker);
01285 
01286   colourCode = 65;
01287   marker = new TMarker(0.0,0.0,20);
01288   marker->SetMarkerSize(0.75);
01289   marker->SetMarkerColor(colourCode); 
01290   legend->AddEntry(marker,"1250 - 1400 ns","p");
01291   legDigits.push_back(marker);
01292 
01293   colourCode = 55;
01294   marker = new TMarker(0.0,0.0,20);
01295   marker->SetMarkerSize(0.75);
01296   marker->SetMarkerColor(colourCode); 
01297   legend->AddEntry(marker,">1400 ns","p");
01298   legDigits.push_back(marker);
01299 
01300   return;
01301 }