TridUVPage Class Reference

#include <TridUVPage.h>

Inheritance diagram for TridUVPage:
TridPage PageABC

List of all members.

Public Member Functions

 TridUVPage ()
virtual ~TridUVPage ()
virtual TObject * Init (Mint *mint, PageDisplay *pd, GuiBox &box)
TridGLFrameCreateNewGLFrame (TridPage::ViewMode_t mode)
virtual void CreateModels ()
virtual void CreateSketches ()
virtual void CreateScenery ()
virtual void ModifySketches ()
virtual void ChangeSketches ()

Protected Attributes

GuiToggledMenuItem fShowTracks
GuiToggledMenuItem fShowShowerBlobs
GuiToggledMenuItem fShowStrips
GuiToggledMenuItem fBestDemuxOnly

Detailed Description

Definition at line 23 of file TridUVPage.h.


Constructor & Destructor Documentation

TridUVPage::TridUVPage (  ) 

Definition at line 77 of file TridUVPage.cxx.

References TridPage::fViewMode, TridPage::fViewModesSupported, TridPage::fWindowName, TridPage::kView2D, and TridPage::kView3D.

00078   : TridPage(),
00079     fShowTracks(true),
00080     fShowShowerBlobs(true),
00081     fShowStrips(true),
00082     fBestDemuxOnly(true)
00083 {
00084   // Default view mode.
00085   fViewModesSupported = kView2D | kView3D;
00086   fViewMode = kView2D;
00087   fWindowName = "TridUV"; // Must be the same as the proxy name.
00088 }

TridUVPage::~TridUVPage (  )  [virtual]

Definition at line 90 of file TridUVPage.cxx.

References TridModelList::Clear(), and TridPage::fModels.

00091 {
00092   fModels.Clear();
00093   // This is now taken care of by the SigC::Ptr stuff.
00094   // if(fGLFrame) delete fGLFrame;
00095 }


Member Function Documentation

void TridUVPage::ChangeSketches ( void   )  [virtual]

Definition at line 464 of file TridUVPage.cxx.

References CreateScenery(), CreateSketches(), and TridPage::fGLFrame.

00465 {
00466   // Update display.
00467   fGLFrame->DeleteSketches();
00468   CreateSketches();
00469   CreateScenery();
00470   fGLFrame->Update();
00471 
00472 }

void TridUVPage::CreateModels (  )  [virtual]
TridGLFrame * TridUVPage::CreateNewGLFrame ( TridPage::ViewMode_t  mode  )  [virtual]

Reimplemented from TridPage.

Definition at line 118 of file TridUVPage.cxx.

References TridPage::fGuiBox, TridPage::fTridControl, Msg::kDebug, TridPage::kView2D, max, min, and MSG.

00119 {
00120   TridPOV min(0,   0, -4,   0,  0, -180);
00121   TridPOV max(30,  0, +4, 1000, 90, 180);
00122   
00123   if(mode==kView2D) {
00124     MSG("TriD",Msg::kDebug) << "Changing to 2D" << endl;
00125     return new TridFlatGLFrame(this,*fGuiBox,fTridControl,min,max,1.5);
00126   };
00127 
00128   MSG("TriD",Msg::kDebug) << "Changing to 3D" << endl;
00129   return new TridGLFrame(this,*fGuiBox,fTridControl,min,max);
00130 }

void TridUVPage::CreateScenery (  )  [virtual]

Reimplemented from TridPage.

Definition at line 317 of file TridUVPage.cxx.

References TridPage::fContext, TridPage::fGLFrame, TridPage::fTridControl, VldContext::GetDetector(), Detector::kFar, Detector::kNear, kNearOffsetU, kNearOffsetV, kSize_SM1_End, kSize_SM1_Start, kSize_SM2_End, kSize_SM2_Start, kv_x(), kv_y(), kv_z(), TridSketch::SetDefaultColor(), TridSketchText::SetScale(), TridSketch::StartScenery(), and TridSketch::StopScenery().

Referenced by ChangeSketches().

00318 {
00319   TridSketch::StartScenery();
00320   TridSketch::SetDefaultColor(fTridControl->GetForegroundColor());
00321 
00322   
00323   // Put a black quad behind everything so mouse movement works better.
00324   TridSketch* backplane = new TridSketchPlane
00325     ( TVector3(0.0, -1.0, 0.0),
00326       kv_x, 100.,
00327       kv_z, 100. 
00328       );
00329   backplane->SetColor(fTridControl->GetBackgroundColor());
00330   fGLFrame->AddSketch(backplane);
00331 
00332   // Line between views
00333   TridSketch* sk = new TridSketchLine( TVector3(kSize_SM1_Start,0,0), TVector3(kSize_SM2_End,0,0));
00334   fGLFrame->AddSketch(sk);
00335   
00336   // Labels
00337   TridSketchText* txt;
00338   txt = new TridSketchText( TVector3(-0.8,0,2.0), kv_x, kv_y, "U View");
00339   txt->SetScale(0.5);
00340   fGLFrame->AddSketch(txt);
00341 
00342   txt = new TridSketchText( TVector3(-0.8,0,-2.0), kv_x, kv_y, "V View");
00343   txt->SetScale(0.5);
00344   fGLFrame->AddSketch(txt);
00345 
00346   if(fContext.GetDetector()==Detector::kFar) {
00347     // SM 1 box.
00348     sk = new TridSketchLine( TVector3(kSize_SM1_Start, 0, -8), TVector3(kSize_SM1_Start,0,  8) ); fGLFrame->AddSketch(sk);    
00349     sk = new TridSketchLine( TVector3(kSize_SM1_End,   0, -8), TVector3(kSize_SM1_End,  0,  8) );  fGLFrame->AddSketch(sk);    
00350     sk = new TridSketchLine( TVector3(kSize_SM1_Start, 0,  8), TVector3(kSize_SM1_End,  0,  8) );      fGLFrame->AddSketch(sk);
00351     sk = new TridSketchLine( TVector3(kSize_SM1_Start, 0, -8), TVector3(kSize_SM1_End,  0, -8) );     fGLFrame->AddSketch(sk);
00352 
00353     // SM 2 box.
00354     sk = new TridSketchLine( TVector3(kSize_SM2_Start, 0, -8), TVector3(kSize_SM2_Start, 0, 8) ); fGLFrame->AddSketch(sk);
00355     sk = new TridSketchLine( TVector3(kSize_SM2_End,   0, -8), TVector3(kSize_SM2_End,  0, 8) );  fGLFrame->AddSketch(sk);
00356     sk = new TridSketchLine( TVector3(kSize_SM2_Start, 0, 8),  TVector3(kSize_SM2_End, 0, 8) );      fGLFrame->AddSketch(sk);
00357     sk = new TridSketchLine( TVector3(kSize_SM2_Start, 0,-8),  TVector3(kSize_SM2_End, 0, -8) );     fGLFrame->AddSketch(sk);  
00358   }
00359 
00360   else if(fContext.GetDetector()==Detector::kNear) {
00361     // Line at left
00362     fGLFrame->AddSketch(new TridSketchLine( TVector3(0,0,0), TVector3(0,0, 3.95) ) );
00363     fGLFrame->AddSketch(new TridSketchLine( TVector3(0,0,0), TVector3(0,0,-3.95) ) );
00364     // Line at spectrometer
00365     const float kspect = 7.1512;
00366     fGLFrame->AddSketch(new TridSketchLine( TVector3(kspect,0,0), TVector3(kspect,0, 3.95) ) );
00367     fGLFrame->AddSketch(new TridSketchLine( TVector3(kspect,0,0), TVector3(kspect,0,-3.95) ) );  
00368     // Fully instrumented region U
00369     const float fullu1 = -0.27;
00370     const float fullu2 =  2.57;
00371     const float fullv1 =  0.24;
00372     const float fullv2 =  -2.57;
00373 
00374     fGLFrame->AddSketch(new TridSketchLine( TVector3(0,0,kNearOffsetU+fullu1), TVector3(kspect,0,kNearOffsetU+fullu1) ) );
00375     fGLFrame->AddSketch(new TridSketchLine( TVector3(0,0,kNearOffsetU+fullu2), TVector3(kspect,0,kNearOffsetU+fullu2) ) ); 
00376     fGLFrame->AddSketch(new TridSketchLine( TVector3(0,0,kNearOffsetV+fullv1), TVector3(kspect,0,kNearOffsetV+fullv1) ) );
00377     fGLFrame->AddSketch(new TridSketchLine( TVector3(0,0,kNearOffsetV+fullv2), TVector3(kspect,0,kNearOffsetV+fullv2) ) );      
00378   }
00379 
00380   TridSketch::StopScenery();
00381 }

void TridUVPage::CreateSketches (  )  [virtual]

Reimplemented from TridPage.

Definition at line 149 of file TridUVPage.cxx.

References TridModelList::AssociateModel(), TridModelList::ClearAssociations(), TridPage::fAutoPOV, TridPage::fContext, TridPage::fFullPOV, TridPage::fGLFrame, TridPage::fModels, TridModelStrip::fStrip, VldContext::GetDetector(), TridModelShower::GetFirstPlane(), TridModelTrack::GetFirstPlane(), TridSketch::GetId(), TridModelList::GetIterator(), TridModelTrack::GetLastPlane(), TridModelShower::GetLastPlane(), TridModel::GetMeanTime(), PlexPlaneId::GetPlane(), PlexPlaneId::GetPlaneView(), UgliGeomHandle::GetScintPlnHandle(), UgliGeomHandle::GetStripHandle(), UgliStripHandle::GetTPos(), TridModelTrack::GetU(), TridModelShower::GetU(), TridModelShower::GetV(), TridModelTrack::GetV(), TridModelShower::GetWidth(), UgliPlnHandle::GetZ0(), UgliStripHandle::GlobalPos(), TridModelTrack::IsValid(), TridModelShower::IsValid(), UgliScintPlnHandle::IsValid(), Detector::kCalDet, Detector::kFar, kFarOffsetU, kFarOffsetV, Detector::kNear, kNearOffsetU, kNearOffsetV, kSize_Plane, kSize_SM_Gap, kSize_Strip, PlaneView::kU, PlaneView::kV, kv_x(), kv_z(), ModifySketches(), TridModelItr::Next(), TridPOV::Set(), TridSketch::SetColor(), and TridSketch::SetTime().

Referenced by ChangeSketches().

00150 {
00151   fModels.ClearAssociations();
00152 
00153   double meanplane = 0;
00154   double meann = 0;
00155 
00156   
00157   UgliGeomHandle ugli(fContext);
00158   
00159   Float_t offsetU = 0;
00160   Float_t offsetV = 0;
00161 
00162   
00163   switch(fContext.GetDetector()) {
00164   case Detector::kCalDet: 
00165     offsetU =  0.25;
00166     offsetV =  0.25;
00167     break;
00168   case Detector::kFar:
00169     offsetU =  kFarOffsetU;
00170     offsetV =  kFarOffsetV; 
00171     break;
00172   case Detector::kNear:
00173     offsetU = kNearOffsetU;
00174     offsetV = kNearOffsetV; 
00175     break;
00176   default: break;
00177   } 
00178 
00179   TridModel*   basemodel;
00180   TridModelItr itr = fModels.GetIterator();
00181   while( (basemodel = itr.Next()) ) {    
00182     // Make a new sketch for this model.
00183     
00185     // Track models.
00187     TridModelTrack* track = dynamic_cast<TridModelTrack*>(basemodel);    
00188     if(track) { 
00189       int first = track->GetFirstPlane();
00190       int last  = track->GetLastPlane();
00191       double lastu=0., lastv=0., lastz=0.;
00192  
00193       for(int plane = first; plane<=last; plane++) {
00194         if(track->IsValid(plane)) {
00195           UgliScintPlnHandle upln = ugli.GetScintPlnHandle(PlexPlaneId(fContext.GetDetector(),plane));  
00196           if(! upln.IsValid()) continue;
00197           double u = track->GetU(plane);
00198           double v = track->GetV(plane);
00199           double z = upln.GetZ0();
00200           
00201           if(plane!=first) {
00202             TridSketch* sk;
00203             // U view:
00204             sk = new TridSketchLine( TVector3(lastz, 0.1, offsetU + lastu),
00205                                      TVector3(z,     0.1, offsetU + u    ) );
00206             sk->SetColor(1,0,0);
00207             fGLFrame->AddSketch(sk);
00208             fModels.AssociateModel(track,sk->GetId());
00209                 
00210             // V view:
00211             sk = new TridSketchLine( TVector3(lastz, 0.1, offsetV + lastv),
00212                                      TVector3(z,     0.1, offsetV + v    ) );
00213             sk->SetColor(1,0,0);
00214             fGLFrame->AddSketch(sk);
00215             fModels.AssociateModel(track,sk->GetId());
00216           }
00217           
00218           lastu=u;
00219           lastv=v;
00220           lastz=z;
00221         }      
00222       } 
00223       
00224     }
00225 
00227     // Shower models.
00229     TridModelShower* shower = dynamic_cast<TridModelShower*>(basemodel);    
00230     if(shower) {
00231       int first = shower->GetFirstPlane();
00232       int last  = shower->GetLastPlane();
00233       for(int plane = first; plane<= last; plane++) {
00234         if(shower->IsValid(plane)) {
00235           float u = shower->GetU(plane);
00236           float v = shower->GetV(plane);
00237           float width = shower->GetWidth(plane);
00238           PlexPlaneId planeid(fContext.GetDetector(),plane); //use steel to avoid ugli errors in ND spect
00239           float z = ugli.GetScintPlnHandle(planeid).GetZ0();    
00240           
00241           float y1, y2;
00242           if(planeid.GetPlaneView()==PlaneView::kU) {
00243             y1 = offsetU + u + width;
00244             y2 = offsetU + u - width;
00245           } else {
00246             y1 = offsetV + v + width;
00247             y2 = offsetV + v - width;
00248           }
00249 
00250           //cout << "Shower plane " << plane << "  " << y1 << " " << y2 << endl;
00251           
00252           TridSketch* sk = new TridSketchLine( TVector3(z, 0.1, y1),
00253                                                TVector3(z, 0.1, y2) );
00254           sk->SetColor(0,0,1);
00255           fGLFrame->AddSketch(sk);
00256           fModels.AssociateModel(shower,sk->GetId());
00257         }
00258       }
00259     }
00260 
00262     // Strip models.
00264     TridModelStrip* model = dynamic_cast<TridModelStrip*>(basemodel);    
00265     if(model) {      
00266       PlexStripEndId seid = model->fStrip;
00267       PlaneView::PlaneView_t view = seid.GetPlaneView();
00268       
00269       // Find offset pos.
00270       Float_t x,y,w,h;
00271       x = y = 0;
00272       
00273       UgliStripHandle ustrip = ugli.GetStripHandle(seid);
00274       
00275       x += ustrip.GlobalPos(0).z();
00276       if(view == PlaneView::kV)
00277         y = offsetV + ustrip.GetTPos();
00278       else
00279         y = offsetU + ustrip.GetTPos(); 
00280 
00281       if((fContext.GetDetector()==Detector::kFar) && (seid.GetPlane()>249)) // Put it in SM 2.
00282         x += kSize_SM_Gap;
00283       
00284       // NB half-widths.
00285       w = kSize_Plane*2;
00286       h = kSize_Strip*2;
00287       
00288       meanplane += x;
00289       meann += 1.0;
00290       
00291       TVector3 pos(x,0.1,y);
00292       
00293       TridSketch* sk;
00294       sk = new TridSketchEllipse( pos,
00295                                   w*kv_x,
00296                                   h*kv_z, 
00297                                   6
00298                                   );
00299         
00300       sk->SetTime(model->GetMeanTime());
00301       fGLFrame->AddSketch(sk);
00302       fModels.AssociateModel(model,sk->GetId());   
00303     }
00304   }
00305 
00306   ModifySketches(); // Set colors and transparencies.
00307 
00308   // Set up automatic and default viewing coordinates.
00309   double zloc = 15;
00310   if(meann>0) zloc = meanplane/meann;
00311   fAutoPOV.Set(zloc, 0, 0, 9, 90, 0 );  
00312   fFullPOV.Set(15,   0, 0, 21, 90, 0 );  
00313 
00314 }

TObject * TridUVPage::Init ( Mint mint,
PageDisplay pd,
GuiBox box 
) [virtual]

Implement to fill box with whatever your page displays. If the page wishes to return a class to the initializer, then return an object which inherits from TObject, o.w. just return 0.

Reimplemented from TridPage.

Definition at line 97 of file TridUVPage.cxx.

References GuiToggledMenuItem::AddToMenu(), GuiToggledMenuItem::Connect(), fBestDemuxOnly, TridPage::fOptionsMenu, fShowShowerBlobs, fShowStrips, fShowTracks, Msg::kDebug, ModifySketches(), MSG, and TridPage::Update().

00098 { 
00099   TridPage::Init(mint,pd,box);
00100 
00101   // Add custom things for this view.
00102   fShowTracks.AddToMenu(fOptionsMenu,"Show Tracks");
00103   fShowTracks.Connect(slot_class(*this,&TridUVPage::ModifySketches));
00104   fShowShowerBlobs.AddToMenu(fOptionsMenu,"Show Showers");
00105   fShowShowerBlobs.Connect(slot_class(*this,&TridUVPage::ModifySketches));
00106   fShowStrips.AddToMenu(fOptionsMenu,"Show Strips");
00107   fShowStrips.Connect(slot_class(*this,&TridUVPage::ModifySketches));
00108 
00109   fBestDemuxOnly.AddToMenu(fOptionsMenu,"Best Demux Only");
00110   fBestDemuxOnly.Connect(slot_class(*(TridPage*)this,&TridPage::Update));
00111 
00112 
00113   MSG("TriD",Msg::kDebug) << "TridUVPage: Init()" << endl;
00114   
00115   return NULL;
00116 }

void TridUVPage::ModifySketches (  )  [virtual]

Reimplemented from TridPage.

Definition at line 383 of file TridUVPage.cxx.

References TridPage::fColorHistogram, TridPage::fGLFrame, TridPage::fModels, fShowShowerBlobs, fShowStrips, fShowTracks, TridPage::fTransHistogram, TridPage::fTridControl, TridModelList::GetModelFromSketch(), TridModel::GetSortKey(), Msg::kError, MSG, TridSketchListItr::Next(), and TridModel::Print().

Referenced by CreateSketches(), and Init().

00384 {
00385   // Go through all models. Modify they sketches to match the current
00386   // transparency and color maps.
00387 
00388   fColorHistogram->Reset();
00389   fTransHistogram->Reset();
00390 
00391   int nsketches =0;
00392 
00393   TridSketchListItr itr = fGLFrame->GetIterator();
00394   while( TridSketch* sketch = itr.Next() ) {
00395     int sketchnum = sketch->GetId();
00396     TridModel* model = fModels.GetModelFromSketch(sketchnum);
00397 
00398     if((sketch)&&(model)) {
00399       nsketches++;
00400 
00401       bool isToggled = false;
00402 
00403       // Get color and trans as number between 0 and 1,
00404       // interpolated in our current scale.
00405       Double_t color_x = fTridControl->GetRangedModelColor(model);
00406       Double_t trans_x = fTridControl->GetRangedModelTrans(model);
00407 
00408       // Modify the sketch.
00409       sketch->SetColor(fTridControl->GetColor(color_x));
00410       sketch->SetTransparency(trans_x);
00411 
00412       if(color_x>1)
00413         if(!fTridControl->ShowColorOverScale())
00414            sketch->SetDrawn(false);
00415 
00416       if(       dynamic_cast<TridModelStrip*>(model) )  {
00417         if(fShowStrips()) isToggled = true;
00418         // Fill our histograms.
00419         fColorHistogram->Fill(color_x);
00420         fTransHistogram->Fill(trans_x);      
00421       }
00422       else if(  dynamic_cast<TridModelTrack*>(model)  ) {
00423         if(fShowTracks()) isToggled = true;
00424         sketch->SetColor(1,0.3,0.3);
00425         sketch->SetTransparency(1.0);
00426       }
00427       else if( dynamic_cast<TridModelShower*>(model) )  {
00428         if(fShowShowerBlobs()) isToggled = true;
00429         sketch->SetColor(0.3,0.3,1);
00430         sketch->SetTransparency(0.5);
00431       }
00432 
00433       // Turn on/off the sketch.
00434       if(color_x<0)
00435         if(!fTridControl->ShowColorUnderScale())
00436           isToggled = false;
00437       sketch->SetDrawn(isToggled);
00438 
00439       // If picked, shine as white.
00440       if(fTridControl->IsPicked(model))
00441         sketch->SetColor(1,1,1);
00442 
00443       // Ditto selected.
00444       if(fTridControl->IsSelected(model))
00445         sketch->SetColor(1,1,1);
00446 
00447 
00448     } else {
00449       if(!(sketch->IsScenery())) {
00450         MSG("TriD",Msg::kError) << "Cannot find sketch or model "
00451                                 << "  ModelAdd: "     << model 
00452                                 << "  ModelKey: "     << ((model) ? (model->GetSortKey()) : 0)
00453                                 << "  SketchNumber: " << sketchnum
00454                                 << "  SketchAddr:   " << sketch << endl;
00455         if(sketch) sketch->Print();
00456         if(model) model->Print();
00457       }
00458     }
00459   }
00460 }


Member Data Documentation

Definition at line 48 of file TridUVPage.h.

Referenced by Init().

Definition at line 45 of file TridUVPage.h.

Referenced by Init(), and ModifySketches().

Definition at line 46 of file TridUVPage.h.

Referenced by Init(), and ModifySketches().

Definition at line 44 of file TridUVPage.h.

Referenced by Init(), and ModifySketches().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1