TridPmtPage Class Reference

#include <TridPmtPage.h>

Inheritance diagram for TridPmtPage:

TridPage PageABC List of all members.

Public Member Functions

 TridPmtPage ()
virtual ~TridPmtPage ()
virtual TObject * Init (Mint *mint, PageDisplay *pageDisplay, GuiBox &box)
virtual TridGLFrameCreateNewGLFrame (TridPage::ViewMode_t mode)
virtual void CreateModels ()
virtual void CreateSketches ()
virtual void CreateScenery ()
virtual void ModifySketches ()
TVector3 PmtToCoords (PlexPixelSpotId &spot, float &pmtSize)
TVector3 PixelToCoords (PlexPixelSpotId &spot, float &pixelSize)
void GetRackCoords_FD (int rackbay, char racklvl, char ew, float &x, float &y, float &w, float &h)
void GetRackCoords_ND (int rackbay, char racklvl, char ew, float &x, float &y, float &w, float &h)
void OffsetPmtIntoRack_FD (PlexPixelSpotId &spot, TVector3 &rackSpan, TVector3 &ioPos, float &pmtsize)
void OffsetPmtIntoRack_ND (PlexPixelSpotId &spot, TVector3 &rackSpan, TVector3 &ioPos, float &pmtsize)
void OffsetPixelIntoPmt (PlexPixelSpotId &spot, float pmtSize, TVector3 &pos, float &pixelSize)

Detailed Description

Definition at line 28 of file TridPmtPage.h.


Constructor & Destructor Documentation

TridPmtPage::TridPmtPage (  ) 

Definition at line 60 of file TridPmtPage.cxx.

References TridPage::fAutoPOV, TridPage::fFullPOV, TridPage::fViewMode, TridPage::fViewModesSupported, TridPage::fWindowName, TridPage::kView2D, TridPage::kView3D, and TridPOV::Set().

00061   :    TridPage()
00062 {    
00063   fViewModesSupported = kView2D | kView3D;
00064   fViewMode = kView2D;    // Default view.
00065   fWindowName = "TridPmt";
00066   fAutoPOV.Set(15.0, 0, 0, 10, 90, 0 );
00067   fFullPOV.Set(15.0, 0, 0, 10, 90, 0 );
00068 }

TridPmtPage::~TridPmtPage (  )  [virtual]

Definition at line 70 of file TridPmtPage.cxx.

00071 { 
00072 }


Member Function Documentation

void TridPmtPage::CreateModels (  )  [virtual]

Reimplemented from TridPage.

Definition at line 426 of file TridPmtPage.cxx.

References TridModelList::Clear(), TridModelMaker::CreatePmtModels(), TridPage::fMint, TridPage::fModels, TridPage::fTridControl, Mint::GetJobC(), JobC::Mom, and TridModelMaker::Prepare().

00427 {
00428   fModels.Clear();
00429   fTridControl->ClearPicked();
00430   fTridControl->ClearSelected();
00431 
00432   TridModelMaker maker;
00433   maker.Prepare(&(fMint->GetJobC().Mom));
00434   maker.CreatePmtModels(&(fMint->GetJobC().Mom),fModels);
00435 }

TridGLFrame * TridPmtPage::CreateNewGLFrame ( TridPage::ViewMode_t  mode  )  [virtual]

Reimplemented from TridPage.

Definition at line 82 of file TridPmtPage.cxx.

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

00083 {
00084   TridPOV min(0,                         0,-kDistEW,   0, 0,-180);
00085   TridPOV max(kRacksPerLevel*kSizeRack_x,0, kDistEW,1000,90, 180);
00086 
00087   if(mode==kView2D) {
00088     MSG("TriD",Msg::kDebug) << "Changing to 2D" << endl;
00089     return new TridFlatGLFrame(this,*fGuiBox,fTridControl,min,max);
00090   };
00091 
00092   MSG("TriD",Msg::kDebug) << "Changing to 3D" << endl;
00093   return new TridGLFrame(this,*fGuiBox,fTridControl,min,max);
00094 }

void TridPmtPage::CreateScenery (  )  [virtual]

Reimplemented from TridPage.

Definition at line 301 of file TridPmtPage.cxx.

References TridPage::fContext, TridPage::fGLFrame, Form(), TridPage::fTridControl, VldContext::GetDetector(), GetRackCoords_FD(), GetRackCoords_ND(), Detector::kCalDet, Detector::kFar, Detector::kNear, kRacksPerLevel, kSizeLevel_y, kSizeRack_x, kv_x(), kv_y(), kv_z(), TridSketch::SetDefaultColor(), TridSketchText::SetScale(), TridSketchText::SetThickness(), TridSketch::SetTransparency(), TridSketch::StartScenery(), and TridSketch::StopScenery().

00302 {
00303   TridSketch::StartScenery();
00304   TridSketch::SetDefaultColor(fTridControl->GetForegroundColor());
00305 
00306   // Put a black quad behind everything so mouse movement works better.
00307   //TridSketch* backplane = new TridSketchPlane
00308   // ( TVector3(0, -1.0, 0),
00309   //   kv_x, 100,
00310   //  kv_z, 100 
00311   //  );
00312   //backplane->SetColor(fTridControl->GetBackgroundColor());
00313   //fGLFrame->AddSketch(backplane);
00314 
00315   // Create the scenery.
00316   if(fContext.GetDetector()==Detector::kFar) 
00317   {
00318     const float kSizeRack_x = 2.0;
00319     const int   kRacksPerLevel = 16;
00320     const float kSizeLevel_y = 5.0;
00321 
00322     // Draw each rack.
00323     for(int iew = 0;iew<2;iew++) {
00324       char ew = iew?'W':'E';
00325       for(int ilvl = 0; ilvl <2; ilvl++) {
00326         char lvl = ilvl?'U':'L';
00327         float x,y,w,h;
00328         for(int bay = 1;bay<=16;bay++) {
00329           GetRackCoords_FD(bay,lvl,ew,x,y,w,h);
00330 
00331           TridSketch* l;
00332           l = new TridSketchLine( x,  0,y,   x+w, 0, y  ); fGLFrame->AddSketch(l);
00333           l = new TridSketchLine( x+w,0,y,   x+w, 0, y+h); fGLFrame->AddSketch(l);
00334           l = new TridSketchLine( x,  0,y+h, x+w, 0, y+h); fGLFrame->AddSketch(l);
00335           l = new TridSketchLine( x,  0,y+h, x,   0, y);   fGLFrame->AddSketch(l);
00336         }
00337       }
00338     }
00339     // Draw EW UD labels
00340     TridSketchText* txt;
00341     txt = new TridSketchText( TVector3(-1.2, 0, kSizeLevel_y),   kv_x, kv_y, "East Side");
00342     txt->SetScale(0.6);
00343     fGLFrame->AddSketch(txt);
00344     
00345     txt = new TridSketchText( TVector3(-1.2,0,-kSizeLevel_y),    kv_x, kv_y, "West Side");
00346     txt->SetScale(0.6);
00347     fGLFrame->AddSketch(txt);
00348 
00349     txt = new TridSketchText( TVector3(-0.3,0,kSizeLevel_y*0.5), kv_x, kv_y, "Lower");
00350     txt->SetScale(0.5);
00351     fGLFrame->AddSketch(txt);
00352 
00353     txt = new TridSketchText( TVector3(-0.3,0,kSizeLevel_y*1.5), kv_x, kv_y, "Upper");
00354     txt->SetScale(0.5);
00355     fGLFrame->AddSketch(txt);
00356 
00357     txt = new TridSketchText( TVector3(-0.3,0,-kSizeLevel_y*1.5), kv_x, kv_y, "Lower");
00358     txt->SetScale(0.5);
00359     fGLFrame->AddSketch(txt);
00360 
00361     txt = new TridSketchText( TVector3(-0.3,0,-kSizeLevel_y*0.5), kv_x, kv_y, "Upper");
00362     txt->SetScale(0.5);
00363     fGLFrame->AddSketch(txt);
00364 
00365     // Draw Rackbay labels
00366     for(int i=1;i<=kRacksPerLevel;i++) {
00367       txt = new TridSketchText( TVector3(kSizeRack_x*((float)i-0.5), 0, kSizeLevel_y * 2.1),
00368                                 -kv_z, kv_y, Form("Bay%d",i) );
00369       txt->SetScale(0.3);
00370       fGLFrame->AddSketch(txt);
00371 
00372       txt = new TridSketchText( TVector3(kSizeRack_x*((float)i-0.5), 0, -kSizeLevel_y * 2.1),
00373                                 -kv_z, kv_y, Form("Bay%d",i) );
00374       txt->SetScale(0.3);
00375       fGLFrame->AddSketch(txt);
00376     }
00377   } else if(fContext.GetDetector()==Detector::kCalDet) {
00378 
00379     // Draw each rack.
00380     for(int iew = 0;iew<2;iew++) {
00381       char ew = iew?'W':'E';
00382       char lvl = 'U';
00383       float x,y,w,h;
00384       for(int bay = 1;bay<=16;bay++) {
00385         GetRackCoords_FD(bay,lvl,ew,x,y,w,h);
00386         TridSketch* l;
00387         l = new TridSketchLine( x,  0,y,   x+w, 0, y  ); fGLFrame->AddSketch(l);
00388         l = new TridSketchLine( x+w,0,y,   x+w, 0, y+h); fGLFrame->AddSketch(l);
00389         l = new TridSketchLine( x,  0,y+h, x+w, 0, y+h); fGLFrame->AddSketch(l);
00390         l = new TridSketchLine( x,  0,y+h, x,   0, y);   fGLFrame->AddSketch(l);
00391       }
00392     }
00393     
00394 
00395   } else if(fContext.GetDetector()==Detector::kNear) {
00396     
00397     
00398     // Draw each rack.
00399     char ew = 'W';
00400     for(int ilvl = 0; ilvl <2; ilvl++) {
00401       char lvl = ilvl?'U':'L';
00402       float x,y,w,h;
00403       for(int bay = 1;bay<=13;bay++) {
00404         GetRackCoords_ND(bay,lvl,ew,x,y,w,h);
00405         TridSketch* l;
00406         l = new TridSketchLine( x,  0,y,   x+w, 0, y  ); fGLFrame->AddSketch(l);
00407         l = new TridSketchLine( x+w,0,y,   x+w, 0, y+h); fGLFrame->AddSketch(l);
00408         l = new TridSketchLine( x,  0,y+h, x+w, 0, y+h); fGLFrame->AddSketch(l);
00409         l = new TridSketchLine( x,  0,y+h, x,   0, y);   fGLFrame->AddSketch(l);
00410         TVector3 botcenter(x+(w/2.), 0.0, y+h-(h/10.));
00411         TridSketchText* txt = 
00412           new TridSketchText(botcenter,-kv_z,kv_y,
00413                              Form("Rack %c%02d",lvl,bay));
00414         txt->SetTransparency(0.3);
00415         txt->SetThickness(0.001);
00416         txt->SetScale(h/6.);
00417         fGLFrame->AddSketch(txt);
00418       }
00419     }
00420   }
00421 
00422   TridSketch::StopScenery();
00423 }

void TridPmtPage::CreateSketches (  )  [virtual]

Reimplemented from TridPage.

Definition at line 438 of file TridPmtPage.cxx.

References TridModelList::AssociateModel(), MuELoss::e, TridPage::fGLFrame, TridPage::fModels, TridModelPmt::fPixelSpot, TridModel::GetEarliestTime(), TridSketch::GetId(), TridModelList::GetIterator(), CalStripType::kNone, kv_x(), kv_y(), kv_z(), ModifySketches(), TridModelItr::Next(), PixelToCoords(), PmtToCoords(), TridSketch::SetColor(), PlexPixelSpotId::SetPixel(), TridSketch::SetTime(), and TridSketch::SetTransparency().

00439 {
00440   double meanx = 0;
00441   double meany = 0;
00442   double meanz = 0;
00443   double meann = 1e-9;
00444 
00445   TridModel* basemodel;
00446   TridModelItr itr = fModels.GetIterator();
00447   while( (basemodel = itr.Next()) ) {    
00448     // Make a new sketch for this model.
00449     TridModelPmt*   pmtModel = dynamic_cast<TridModelPmt*>(basemodel);
00450     TridModelPixel* pixelModel = dynamic_cast<TridModelPixel*>(basemodel);
00451 
00452     if(pmtModel) {
00453       // Draw the PMT.
00454       float pmtsize=0;
00455       TVector3 x1 = PmtToCoords(pmtModel->fPixelSpot, pmtsize);
00456       TVector3 pos = x1+TVector3(pmtsize*0.5,0,pmtsize*0.5);
00457       pos.SetY(-0.1);
00458       
00459       TridSketch* sk = new TridSketchPlane(pos, 
00460                                            kv_x, pmtsize*0.5,
00461                                            kv_z, pmtsize*0.5 );
00462       
00463       sk->SetTime(basemodel->GetEarliestTime());
00464       sk->SetColor(1,1,1);
00465       sk->SetTransparency(1);
00466       fModels.AssociateModel(basemodel,sk->GetId());   
00467 
00468       fGLFrame->AddSketch(sk);
00469     }
00470 
00471     if(pixelModel) {
00472       // Create drawing for an individual pixel.
00473       
00474       int pixel = pixelModel->fPixelSpot.GetPixel() +1;
00475 
00476       /*
00477        // The Pixel IDs are neurotic. Fix this up like Roy does 
00478       // it using the VA channel.
00479       if(pixelModel->fPixels==16) {
00480         // M16.
00481         static Int_t vach2pixel[18] = {0,0,15,1,16,2,11,5,12,6,7,9,8,10,3,14,4,13};
00482         
00483         Int_t vachan = pixelModel->GetDigit()->GetChannelId().GetVaChannel();
00484         if (vachan>=2 && vachan<=17) {
00485           pixel = vach2pixel[vachan];
00486         } 
00487       } else {
00488         // M64.
00489         pixel = pixelModel->fPixelSpot.GetPixel() +1;
00490       }
00491       */
00492 
00493       PlexPixelSpotId spot = pixelModel->fPixelSpot;
00494       spot.SetPixel(pixel);
00495 
00496       if(pixel>0) {
00497         TVector3 pos;
00498         float pixelsize=0;
00499         pos = PixelToCoords(spot,pixelsize);
00500         
00501         float sizex = 0.9 * pixelsize;     
00502         float sizez = 0.9 * pixelsize;
00503         
00504         // For fun, draw the height as number of PE.
00505         float sizey = 0.0001* pixelModel->GetTotalCharge(CalStripType::kNone);
00506         if(sizey<0) sizey=0;
00507         pos.SetY(sizey*0.5);
00508         
00509         TridSketch* sk = 
00510           new TridSketchBox( pos,
00511                              kv_x, sizex*0.5,
00512                              kv_y, sizey*0.5,
00513                              kv_z, sizez*0.5
00514                              );
00515         
00516         sk->SetTime(basemodel->GetEarliestTime());
00517         meanx += pos.x();
00518         meany += pos.y();
00519         meanz += pos.z();
00520         meann += 1;
00521         //float c = pixelModel->GetTotalCharge(CalDigitType::kPE)/20.;
00522         //sk->SetColor(GetColor(c));    
00523         //sk->SetTransparency(0.9);
00524         
00525         fModels.AssociateModel(basemodel,sk->GetId());  
00526         fGLFrame->AddSketch(sk);        
00527       }      
00528     }
00529   }
00530 
00531   ModifySketches();
00532   
00533   meanx = meanx/meann;
00534   meany = meany/meann;
00535   meanz = meanz/meann;
00536   fGLFrame->Update();
00537 }

void TridPmtPage::GetRackCoords_FD ( int  rackbay,
char  racklvl,
char  ew,
float &  x,
float &  y,
float &  w,
float &  h 
)

Definition at line 158 of file TridPmtPage.cxx.

References TridPage::fContext, VldContext::GetDetector(), Detector::kCalDet, kDistEW, kSizeLevel_y, kSizeRack_x, and kSizeRack_y.

Referenced by CreateScenery(), and PmtToCoords().

00160 {
00161   const float kSizeRack_x = 2.0;
00162   const float kSizeRack_y = 5.0;
00163   const float kSizeLevel_y = 5.0;
00164   const float kDistEW = kSizeLevel_y * 2; 
00165 
00166   xoff=yoff=0;
00167   w = kSizeRack_x;
00168   h = kSizeRack_y;
00169 
00170   // Move to correct rack bay.
00171   xoff += kSizeRack_x * (rackbay);
00172 
00173   // Caldet hack.
00174   if(fContext.GetDetector()==Detector::kCalDet) {
00175     xoff +=  kSizeRack_x;
00176   }
00177   
00178   // Move to correct level.
00179   if(racklvl == 'U') 
00180     yoff += kSizeLevel_y; 
00181 
00182   // choose E or W
00183    if(ew=='E') 
00184     yoff += 0;
00185   else 
00186     yoff -= kDistEW;
00187 }

void TridPmtPage::GetRackCoords_ND ( int  rackbay,
char  racklvl,
char  ew,
float &  x,
float &  y,
float &  w,
float &  h 
)

Definition at line 190 of file TridPmtPage.cxx.

References kSizeLevel_y, kSizeRack_x, and kSizeRack_y.

Referenced by CreateScenery(), and PmtToCoords().

00192 {
00193   
00194   const float kSizeRack_x = 4.0;
00195   const float kSizeRack_y = 1.8;
00196   const float kSizeLevel_y = kSizeRack_y*2.2;
00197    
00198   xoff = yoff = 0;
00199   w = kSizeRack_x;
00200   h = kSizeRack_y;
00201 
00202   if(ew=='E') return;
00203 
00204   // Move to correct rack bay.
00205   xoff += kSizeRack_x * (rackbay/2);
00206   yoff += kSizeRack_y * ((rackbay+1)%2);
00207 
00208   // Move to correct level.
00209   if(racklvl == 'U') 
00210     yoff -= kSizeLevel_y; 
00211 }

TObject * TridPmtPage::Init ( Mint mint,
PageDisplay pageDisplay,
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 75 of file TridPmtPage.cxx.

References TridPage::Init(), Msg::kDebug, and MSG.

00076 {
00077   MSG("TriD",Msg::kDebug) << "TridPmtPage: Init()\n";
00078   return TridPage::Init(mint, pageDisplay, box);
00079 }

void TridPmtPage::ModifySketches (  )  [virtual]

Reimplemented from TridPage.

Definition at line 540 of file TridPmtPage.cxx.

References TridPage::fColorHistogram, TridPage::fGLFrame, TridPage::fModels, TridPage::fTransHistogram, TridPage::fTridControl, TridModelList::GetIterator(), TridModelList::GetSketchNumber(), Msg::kError, MSG, TridModelItr::Next(), TridSketch::SetColor(), TridSketch::SetDrawn(), and TridSketch::SetTransparency().

Referenced by CreateSketches().

00541 {
00542   // Go through all models. Modify they sketches to match the current
00543   // transparency and color maps.
00544 
00545   fColorHistogram->Reset();
00546   fTransHistogram->Reset();
00547 
00548   TridModelItr itr = fModels.GetIterator();
00549   TridModel* model;
00550   while( (model = itr.Next()) ) {
00551     // Make a new sketch for this model.
00552 
00553     int sketchnum = fModels.GetSketchNumber(model);
00554     TridSketch* sketch = fGLFrame->FindSketch(sketchnum);
00555     
00556     // Special for PMT page: only use pixel models:
00557     if((sketch)&&(model)) {
00558      
00559       if(dynamic_cast<TridModelPixel*>(model)) {
00560         // Get color and trans as number between 0 and 1,
00561         // interpolated in our current scale.
00562         Double_t color_x = fTridControl->GetRangedModelColor(model);
00563         Double_t trans_x = fTridControl->GetRangedModelTrans(model);
00564 
00565         sketch->SetColor(fTridControl->GetColor(color_x));
00566         sketch->SetTransparency(trans_x);
00567 
00568         // Turn on/off the sketch.
00569         sketch->SetDrawn(true);
00570         if(color_x<0)
00571           if(!fTridControl->ShowColorUnderScale())
00572            sketch->SetDrawn(false);
00573         
00574         if(color_x>1)
00575           if(!fTridControl->ShowColorOverScale())
00576             sketch->SetDrawn(false);
00577 
00578         if(fTridControl->IsPicked(model)) {
00579           sketch->SetColor(1,1,1);
00580         }
00581 
00582         if(fTridControl->IsSelected(model)) {
00583           sketch->SetColor(1,1,1);
00584         }
00585 
00586         // Fill our histograms.
00587         fColorHistogram->Fill(color_x);
00588         fTransHistogram->Fill(trans_x);
00589       } else {
00590 
00591         // Get color and trans as number between 0 and 1,
00592         // interpolated in our current scale.
00593         Double_t color_x = fTridControl->GetRangedModelColor(model);
00594         //Double_t trans_x = fTridControl->GetRangedModelTrans(model);
00595         
00596         // Modify the sketch.   
00597         TVector3 color = (fTridControl->GetColor(color_x));
00598         color *=0.5;
00599         sketch->SetColor(color);
00600         sketch->SetTransparency(1.0);
00601         
00602         // Turn on/off the sketch.
00603         sketch->SetDrawn(true);
00604         if(color_x<0)
00605           if(!fTridControl->ShowColorUnderScale())
00606             sketch->SetDrawn(false);
00607         
00608         if(color_x>1)
00609           if(!fTridControl->ShowColorOverScale())
00610             sketch->SetDrawn(false);
00611         
00612         
00613         if(fTridControl->IsPicked(model)) {
00614           sketch->SetColor(1,0,0);
00615         }
00616         if(fTridControl->IsSelected(model)) {
00617           sketch->SetColor(0,1,0);
00618         }
00619       }
00620     } else {
00621       MSG("TriD",Msg::kError) << "Cannot find sketch or model, model number " << model
00622                               << "  ModelAdd: "     << model 
00623                               << "  SketchNumber: " << sketchnum
00624                               << "  SketchAddr:   " << sketch << endl;
00625     }
00626   }
00627 }

void TridPmtPage::OffsetPixelIntoPmt ( PlexPixelSpotId spot,
float  pmtSize,
TVector3 &  pos,
float &  pixelSize 
)

Definition at line 267 of file TridPmtPage.cxx.

References PlexMuxBoxId::GetElecType(), PlexPixelSpotId::GetPixel(), and ElecType::kVA.

Referenced by PixelToCoords().

00269 {
00270   float xoff = 0;
00271   float yoff = 0;
00272   if(spot.GetElecType()==ElecType::kVA) {
00273      pixelSize = pmtSize*0.25;
00274      
00275      // Find the pixel offset within the tube's space.
00276      int ix= (spot.GetPixel()-1) % 4;
00277      int iy = (spot.GetPixel()-1) / 4;
00278 
00279      xoff += float(ix)*pixelSize;
00280      yoff += float(iy)*pixelSize;     
00281 
00282   } else {
00283     pixelSize = pmtSize*0.125;
00284 
00285     // Find the pixel offset within the tube's space.
00286      int ix= (spot.GetPixel()-1) % 8;
00287      int iy = (spot.GetPixel()-1) / 8;
00288 
00289      xoff += float(ix)*pixelSize;
00290      yoff += float(iy)*pixelSize;     
00291   }
00292   
00293   // Move half a pixel to get to center.
00294   xoff += pixelSize*0.5;
00295   yoff += pixelSize*0.5;
00296   
00297   pos += TVector3(xoff,0,yoff);
00298 }

void TridPmtPage::OffsetPmtIntoRack_FD ( PlexPixelSpotId spot,
TVector3 &  rackSpan,
TVector3 &  ioPos,
float &  pmtsize 
)

Definition at line 214 of file TridPmtPage.cxx.

References PlexMuxBoxId::GetInRack(), PlexPixelSpotId::GetTube(), and TridPage::PlaceInBox().

Referenced by PmtToCoords().

00218 {
00219   float sizeMux_x = rackSpan.X()*0.9;
00220   float sizeMux_y = rackSpan.Z()/(8.2);
00221   
00222   float pmtSize_x = sizeMux_x/3.5;
00223   float pmtSize_y = sizeMux_y/1.2;
00224   pmtSize = (pmtSize_x>pmtSize_y)?pmtSize_y:pmtSize_x;
00225  
00226   float xoff = 0;
00227   float yoff = 0;
00228 
00229   // Offset into the mux box
00230   yoff += PlaceInBox(sizeMux_y,pmtSize,0,1);
00231   xoff += PlaceInBox(sizeMux_x,pmtSize,spot.GetTube(),3);
00232   
00233   // Move mux box to pos in rack.
00234   xoff += PlaceInBox(rackSpan.X(),sizeMux_x,0,1);
00235   yoff += PlaceInBox(rackSpan.Z(),sizeMux_y,(spot.GetInRack()),8);
00236 
00237   ioPos += TVector3(xoff,0,yoff);  
00238 }

void TridPmtPage::OffsetPmtIntoRack_ND ( PlexPixelSpotId spot,
TVector3 &  rackSpan,
TVector3 &  ioPos,
float &  pmtsize 
)

Definition at line 240 of file TridPmtPage.cxx.

References PlexMuxBoxId::GetInRack(), and TridPage::PlaceInBox().

Referenced by PmtToCoords().

00244 {
00245   float sizeAlner_x = rackSpan.X()*0.23;
00246   float sizeAlner_y = rackSpan.Z()*0.45;
00247 
00248   float pmtSize_x = sizeAlner_x;
00249   float pmtSize_y = sizeAlner_y;
00250   pmtSize = (pmtSize_x>pmtSize_y)?pmtSize_y:pmtSize_x;
00251     
00252   float xoff = 0;
00253   float yoff = 0;
00254 
00255   // Offset into the alner box (centers it)
00256   xoff += PlaceInBox(sizeAlner_x,pmtSize,0,1);
00257   yoff += PlaceInBox(sizeAlner_y,pmtSize,0,1);
00258   
00259   // Move mux box to pos in rack.
00260   xoff += PlaceInBox(rackSpan.X(),sizeAlner_x,(spot.GetInRack()%4),4);
00261   yoff += PlaceInBox(rackSpan.Z(),sizeAlner_y,(spot.GetInRack()/4),2);
00262 
00263   ioPos += TVector3(xoff,0,yoff);
00264 }

TVector3 TridPmtPage::PixelToCoords ( PlexPixelSpotId spot,
float &  pixelSize 
)

Definition at line 147 of file TridPmtPage.cxx.

References OffsetPixelIntoPmt(), and PmtToCoords().

Referenced by CreateSketches().

00149 {
00150   float pmtsize = 0;
00151   TVector3 v = PmtToCoords(spot,pmtsize);
00152   OffsetPixelIntoPmt(spot,pmtsize,v,pixelsize);
00153   
00154   return v;
00155 }

TVector3 TridPmtPage::PmtToCoords ( PlexPixelSpotId spot,
float &  pmtSize 
)

Definition at line 102 of file TridPmtPage.cxx.

References TridPage::fContext, VldContext::GetDetector(), PlexMuxBoxId::GetEastWest(), PlexMuxBoxId::GetRackBay(), GetRackCoords_FD(), GetRackCoords_ND(), PlexMuxBoxId::GetRackLevel(), Detector::kCalDet, Detector::kFar, Detector::kNear, OffsetPmtIntoRack_FD(), and OffsetPmtIntoRack_ND().

Referenced by CreateSketches(), and PixelToCoords().

00104 {
00105   float x,y,w,h;
00106   TVector3 v;
00107   TVector3 span;
00108 
00109   if(fContext.GetDetector()==Detector::kFar){
00110     GetRackCoords_FD(spot.GetRackBay(),
00111                      spot.GetRackLevel(),
00112                      spot.GetEastWest(),
00113                      x,y,w,h);
00114     v.SetXYZ(x,0,y);
00115     span.SetXYZ(w,0,h);
00116     OffsetPmtIntoRack_FD(spot,span,v,pmtsize);
00117   }
00118 
00119   else if(fContext.GetDetector()==Detector::kCalDet) {
00120 
00121     GetRackCoords_FD(spot.GetRackBay(),
00122                      spot.GetRackLevel(),
00123                      spot.GetEastWest(),
00124                      x,y,w,h);
00125     v.SetXYZ(x,0,y);
00126     span.SetXYZ(w,0,h);
00127     OffsetPmtIntoRack_FD(spot,span,v,pmtsize);
00128 
00129   }
00130 
00131   else if(fContext.GetDetector()==Detector::kNear) {
00132 
00133     GetRackCoords_ND(spot.GetRackBay(),
00134                      spot.GetRackLevel(),
00135                      spot.GetEastWest(),
00136                      x,y,w,h);
00137     v.SetXYZ(x,0,y);
00138     span.SetXYZ(w,0,h);
00139     OffsetPmtIntoRack_ND(spot,span,v,pmtsize);
00140 
00141   }
00142   
00143   return v;
00144 }


The documentation for this class was generated from the following files:
Generated on Fri Oct 10 22:46:38 2014 for loon by  doxygen 1.4.7