/Home/aooliver/hepsoft/lcdroot/LCDRootApps/PhUtil/src/LCDEventDisplay.cxx

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 // $Id: LCDEventDisplay.cxx,v 1.10 2001/12/22 01:19:23 masako Exp $
00003 // ----------------------------------------------------------------------------
00004 
00005 #include <iostream.h>
00006 
00007 #include "LCDEventDisplay.h"
00008 #include "TArrayD.h"
00009 
00010 #include "TPolyMarker3D.h"
00011 #include "TMarker3DBox.h"
00012 #include "TBRIK.h"
00013 #include "THelix.h"
00014 #include "TView.h"
00015 
00016 #include "LCDTrack.h"
00017 #include "LCDTracker_Hit.h"
00018 #include "LCDVXD_Hit.h"
00019 #include "LCDCluster.h"
00020 #include "LCDCalHit.h"
00021 #include "LCDCalHitUtil.h"
00022 
00023 #define N_BARREL 1  
00024 #define N_ENDCAP 0  
00025 ////////////////////////////////////////////////////////////
00026 //
00027 // LCDEventDisplay
00028 //
00029 ClassImp(LCDEventDisplay)
00030 
00031 LCDEventDisplay::LCDEventDisplay() {
00032   Init();
00033 }
00034 
00035 LCDEventDisplay::LCDEventDisplay(LCDGetParameters* gp) {
00036   Init();
00037   SetDetectorParameters(gp);
00038 }
00039 
00040 LCDEventDisplay::~LCDEventDisplay() {
00041 }
00042 
00043 void LCDEventDisplay::Init() {
00044   m_gp=0;
00045 
00046   m_COIL     =1;
00047   m_EMCAL    =1;
00048   m_EMCALHit =0;
00049   m_ENDCAL   =0;
00050   m_ENDCALHit=0;
00051   m_HDCAL    =1;
00052   m_HDCALHit =0;
00053   m_MUCAL    =1;
00054   m_MUCALHit =0;
00055   m_LMCAL    =0;
00056   m_LMCALHit =0;
00057   m_TRK      =1;
00058   m_TRKHit   =0;
00059   m_VXD      =0;
00060 
00061   m_Gismo=0;
00062 
00063   m_BW=0;
00064 
00065   m_Theta=-90.;
00066   m_Phi=0.;
00067 
00068   m_TrackList   = 0;
00069   m_ClusterList = 0;
00070   m_CalHitList  = 0;
00071   m_TrackerHitsList=0;
00072   m_VXDHitsList=0;
00073 
00074   pInnerVolume = pVolumes = new LCDDetectorVolume [20]; 
00075   nVolumes = 0;
00076 
00077   LCDDetectorVolume* pCur;     // the one we're working on
00078 
00079   nVolumes = N_BARREL + N_ENDCAP;
00080   pCur = pVolumes;
00081 
00082   for (Int_t i = 0; i < nVolumes; i++) {
00083     pCur->barrel = (i < N_BARREL);
00084 
00085     // Will be overwritten when appropriate
00086     pCur->iLenPerCm = 0.0;
00087     pCur->radLenPerCm = 0.0;
00088     pCur++;
00089   }
00090   pCur = pVolumes;
00091   pCur->volKind = VOL_AIR;
00092   pCur->innerR = 0;
00093   pCur->outerR = 0;
00094   pCur->innerZ = 0;
00095   pCur->outerZ = 0;
00096   pCur->pNextR = 0;
00097   pCur->pPrevR = 0;
00098   pCur->pNextZ = 0;
00099   pInnerVolume = pCur;
00100   pCur->field  = 0.0;
00101 
00102   m_canvas    =0;
00103   m_viewpad   =0;
00104   m_beampipe  =0;
00105   m_tracker   =0;
00106   m_barrel_EM =0;
00107   m_coil      =0;
00108   m_barrel_HAD=0;
00109   m_barrel_MU =0;
00110   m_endcap_EM =0;
00111   m_endcap_HAD=0;
00112   m_endcap_MU =0;
00113 
00114   node0=0;
00115   node1=0;
00116   node2=0;
00117   node3=0;
00118   node4=0;
00119   node5=0;
00120   node6=0;
00121   node7=0;
00122   node8=0;
00123   node9=0;
00124   node10=0;
00125   node11=0;
00126 
00127   m_threshold_em = 0.;
00128   m_threshold_hd = 0.;
00129 
00130 }
00131 
00132 void LCDEventDisplay::SetDetectorParameters(LCDGetParameters* gp) {
00133   m_gp = gp;
00134 
00135   LCDDetectorVolume* pCur;     // the one we're working on
00136 
00137   nVolumes = N_BARREL + N_ENDCAP;
00138   pCur = pVolumes;
00139 
00140   for (Int_t i = 0; i < nVolumes; i++) {
00141     pCur->barrel = (i < N_BARREL);
00142 
00143     // Will be overwritten when appropriate
00144     pCur->iLenPerCm = 0.0;
00145     pCur->radLenPerCm = 0.0;
00146     pCur++;
00147   }
00148 
00149   pCur = pVolumes;
00150   pCur->volKind = VOL_AIR;
00151   pCur->innerR = 0;
00152   pCur->outerR = m_gp->GetEMBarrelInnerR();
00153   pCur->innerZ = 0.0;
00154   pCur->outerZ = m_gp->GetEMBarrelOuterZ();
00155   pCur->pNextR = 0;
00156   pCur->pPrevR = 0;
00157   pCur->pNextZ = 0;
00158   pInnerVolume = pCur;
00159   pCur->field = m_gp->GetMagneticField();
00160 
00161 }
00162 
00163 void LCDEventDisplay::Delete() {
00164   if (m_canvas) {delete m_canvas; m_canvas=0; }
00165   if (m_viewpad){delete m_viewpad;m_viewpad=0;}
00166   if (m_TrackList   != 0) {
00167     m_TrackList->Delete();      delete m_TrackList;      m_TrackList=0;
00168   }
00169   if (m_ClusterList != 0) {
00170     m_ClusterList->Delete();    delete m_ClusterList;    m_ClusterList=0;
00171   }
00172   if (m_TrackerHitsList != 0) {
00173     m_TrackerHitsList->Delete();delete m_TrackerHitsList;m_TrackerHitsList=0;
00174   }
00175   if (m_VXDHitsList != 0) {
00176     m_VXDHitsList->Delete();    delete m_VXDHitsList;    m_VXDHitsList=0;
00177   }
00178   if (m_CalHitList  != 0) {
00179     m_CalHitList->Delete();     delete m_CalHitList;     m_CalHitList=0;
00180   }
00181   if (m_beampipe)  {delete m_beampipe;  m_beampipe=0;  }
00182   if (m_tracker)   {delete m_tracker;   m_tracker=0;   }
00183   if (m_barrel_EM) {delete m_barrel_EM; m_barrel_EM=0; }
00184   if (m_coil)      {delete m_coil;      m_coil=0;      }
00185   if (m_barrel_HAD){delete m_barrel_HAD;m_barrel_HAD=0;}
00186   if (m_barrel_MU) {delete m_barrel_MU; m_barrel_MU=0; }
00187   if (m_endcap_EM) {delete m_endcap_EM; m_endcap_EM=0; }
00188   if (m_endcap_HAD){delete m_endcap_HAD;m_endcap_HAD=0;}
00189   if (m_endcap_MU) {delete m_endcap_MU; m_endcap_MU=0; }
00190 
00191   if (node1) { delete node1;  node1=0; }
00192   if (node2) { delete node2;  node2=0; }
00193   if (node3) { delete node3;  node3=0; }
00194   if (node4) { delete node4;  node4=0; }
00195   if (node5) { delete node5;  node5=0; }
00196   if (node6) { delete node6;  node6=0; }
00197   if (node7) { delete node7;  node7=0; }
00198   if (node8) { delete node8;  node8=0; }
00199   if (node9) { delete node9;  node9=0; }
00200   if (node10){ delete node10; node10=0;}
00201   if (node11){ delete node11; node10=0;}
00202 }
00203 
00204 void LCDEventDisplay::Draw(LCDEvent* event) {
00205   if (m_canvas==0)
00206     m_canvas = new TCanvas("c1","LCD Event Display",500,500);
00207   m_canvas->cd();
00208   
00209   if (m_viewpad==0) 
00210     m_viewpad = new TPad("viewpad","LCD Display",0.05,0.05,0.95,0.95,1);
00211   m_viewpad->Draw();
00212   m_viewpad->SetTheta(m_Theta);
00213   m_viewpad->SetPhi(m_Phi);
00214   m_viewpad->cd();
00215   
00216   // delete the old stuff
00217   if (m_TrackList   == 0) {
00218     m_TrackList   = new TClonesArray("THelix",100);
00219   } else {
00220     m_TrackList->Delete();
00221   }
00222   if (m_ClusterList == 0) {
00223     m_ClusterList = new TClonesArray("TMarker3DBox",1000);
00224   } else {
00225     m_ClusterList->Delete();
00226   }
00227   if (m_TrackerHitsList == 0) {
00228     m_TrackerHitsList = new TObjArray();
00229   } else {
00230     m_TrackerHitsList->Delete();
00231   }
00232   if (m_VXDHitsList == 0) {
00233     m_VXDHitsList = new TObjArray();
00234   } else {
00235     m_VXDHitsList->Delete();
00236   }
00237   if (m_CalHitList  == 0) {
00238     m_CalHitList  = new TClonesArray("TMarker3DBox",5000);
00239   } else {
00240     m_CalHitList->Delete();
00241   }
00242 
00243   //  Get detector size
00244   Double_t CoilrInner  = m_gp -> GetCoilInnerR();            
00245   Double_t CoilrOuter  = CoilrInner + m_gp->GetCoilThick();
00246   Double_t CoilLength  = m_gp->GetCoilOuterZ();               
00247   Double_t EMbrInner   = m_gp->GetEMBarrelInnerR();
00248   Double_t EMbrOuter   = m_gp->GetEMBarrelOuterR();
00249   Double_t EMbLength   = m_gp->GetEMBarrelOuterZ();
00250   Double_t HADbrInner  = m_gp->GetHADBarrelInnerR();
00251   Double_t HADbrOuter  = m_gp->GetHADBarrelOuterR();
00252   Double_t HADbLength  = m_gp->GetHADBarrelOuterZ();
00253   Double_t MUbrInner   = m_gp->GetMUBarrelInnerR(); 
00254   Double_t MUbrOuter   = m_gp->GetMUBarrelOuterR(); 
00255   Double_t MUbLength   = m_gp->GetMUBarrelOuterZ(); 
00256   Double_t EMeInnerZ   = m_gp->GetEMEndcapInnerZ();
00257   Double_t HADeInnerZ  = m_gp->GetHADEndcapInnerZ();
00258   Double_t MUeInnerZ   = m_gp->GetMUEndcapInnerZ();
00259   Double_t MUeOuterZ   = MUeInnerZ 
00260                    + (m_gp->GetMUEndcapLayer()*m_gp->GetMUEndcapThick());
00261   Double_t EndInnerR = m_gp->GetEndcapInnerR();
00262 
00263   //  Define some volumes
00264   if (m_beampipe == 0)
00265     m_beampipe   = new TTUBE("BMPP","TUBE","void",
00266                              0.7,0.8,EMbLength);
00267   if (m_tracker == 0)
00268     m_tracker    = new TTUBE("TRK","TUBE","void",
00269                              10,EMbrInner,EMeInnerZ);
00270   if (m_barrel_EM == 0)
00271     m_barrel_EM  = new TTUBE("BEM","TUBE","void",
00272                              EMbrInner,EMbrOuter,EMbLength);
00273   if (m_coil == 0)
00274     m_coil       = new TTUBE("COIL","TUBE","void",
00275                              CoilrInner,CoilrOuter,CoilLength);
00276   if (m_barrel_HAD == 0)
00277     m_barrel_HAD = new TTUBE("BHAD","TUBE","void",
00278                              HADbrInner,HADbrOuter,HADbLength);
00279   if (m_barrel_MU == 0)
00280     m_barrel_MU  = new TTUBE("BMU","TUBE","void",
00281                              MUbrInner,MUbrOuter,MUbLength);
00282 
00283   if (m_endcap_EM == 0)
00284     m_endcap_EM  = new TTUBE("EEM","TUBE","void",
00285                              EndInnerR,EMbrInner,(EMbLength-EMeInnerZ)/2.);
00286   if (m_endcap_HAD == 0)
00287     m_endcap_HAD = new TTUBE("EHD","TUBE","void",
00288                              EndInnerR,HADbrInner,(HADbLength-HADeInnerZ)/2.);
00289 
00290   if (m_endcap_MU == 0)
00291     m_endcap_MU  = new TTUBE("EMU","TUBE","void",
00292                              EndInnerR,MUbrOuter,(MUeOuterZ-MUeInnerZ)/2.);
00293 
00294   
00295   //  Set shapes attributes
00296   if (m_BW == 0){
00297     m_beampipe  ->SetLineColor(kBlack);
00298     m_tracker   ->SetLineColor(kGreen);
00299     m_barrel_EM ->SetLineColor(kMagenta);
00300     m_coil      ->SetLineColor(kYellow);
00301     m_barrel_HAD->SetLineColor(kBlue);
00302     m_barrel_MU ->SetLineColor(kGreen);
00303     m_endcap_EM ->SetLineColor(kMagenta);
00304     m_endcap_HAD->SetLineColor(kBlue);
00305     m_endcap_MU ->SetLineColor(kGreen);
00306   }
00307   
00308   // Draw this geometry in the current canvas
00309   //  Build the geometry hierarchy
00310   if (node0 == 0)
00311     node0 = new TNode("NODE0","NODE0","BMPP",0,0,0);
00312   if (node1 == 0 && m_EMCAL == 0 && m_EMCALHit == 0)
00313     node1 = new TNode("NODE1","NODE1","TRK" ,0,0,0);
00314   if ((m_EMCAL || m_EMCALHit) && node2 == 0)
00315     node2 = new TNode("NODE2","NODE2","BEM" ,0,0,0);
00316   if (m_COIL && node3 == 0) 
00317     node3 = new TNode("NODE3","NODE3","COIL",0,0,0);
00318   if ((m_HDCAL || m_HDCALHit) && node4 == 0 )
00319     node4 = new TNode("NODE4","NODE4","BHAD",0,0,0);
00320   if ((m_MUCAL || m_MUCALHit) && node5 == 0 ) 
00321     node5 = new TNode("NODE5","NODE5","BMU" ,0,0,0);
00322 
00323   Double_t center;
00324   if ((m_EMCAL||m_EMCALHit)&&(m_EMCAL||m_EMCALHit)&&node6==0){
00325     center = (EMbLength+EMeInnerZ)/2.;
00326     node6 = new TNode("NODE6","NODE6","EEM" ,0,0,-center);
00327     node7 = new TNode("NODE7","NODE7","EEM" ,0,0, center);
00328   }
00329   if ((m_HDCAL||m_HDCALHit)&&(m_HDCAL||m_HDCALHit)&&node8==0){
00330     center = (HADbLength+HADeInnerZ)/2.;
00331     node8 = new TNode("NODE8","NODE8","EHD" ,0,0,-center);
00332     node9 = new TNode("NODE9","NODE9","EHD" ,0,0, center);
00333   }
00334   if ((m_MUCAL||m_MUCALHit)&&(m_MUCAL||m_MUCALHit)&&node10==0){
00335     center = (MUeOuterZ+MUeInnerZ)/2.;
00336     node10 = new TNode("NODE10","NODE10","EMU" ,0,0,-center);
00337     node11 = new TNode("NODE11","NODE11","EMU" ,0,0, center);
00338   }
00339   
00340   node0->cd();
00341 
00342   Double_t BField  = m_gp->GetMagneticField();
00343   Double_t ptor = 333.567/ BField;
00344   Double_t xyz0[3], v0[3], range[2];
00345   Double_t baxis[]={0.0,0.0,1.0};
00346   
00347   LCDTrack* track;
00348   TVector3 pos0;
00349   TVector3 mom0;
00350   Double_t pt;
00351   Double_t r;
00352   Double_t w;
00353   Double_t vt;
00354   Double_t vz;
00355   Int_t    charge;
00356   Double_t decrS;
00357   TVector3 pPos;
00358   LCDDetectorVolume*  pCur;
00359   LCDSwimTraj::PropagateRet status;
00360   THelix* tH;
00361 
00362   Float_t energy;
00363   Float_t phi   ;
00364   Float_t theta ;
00365   Float_t rt    ;
00366   
00367   Float_t x,dx=0.0;
00368   Float_t y,dy=0.0;
00369   Float_t z,dz=0.0;
00370 
00371   TMarker3DBox* clus;
00372 
00373   // VXD hits
00374   if (m_VXD) {
00375     Int_t nVXDHits = event->VXD()->GetEntries();
00376     if (nVXDHits != 0) {
00377       TArrayD vx(3*nVXDHits);
00378       LCDVXD_Hit* hV;
00379       for (Int_t vxd=0 ; vxd < nVXDHits; vxd++) {
00380         hV = (LCDVXD_Hit*)event->VXD()->At(vxd);
00381         vx.AddAt(hV->GetPosition()[0],3*vxd+0);
00382         vx.AddAt(hV->GetPosition()[1],3*vxd+1);
00383         vx.AddAt(hV->GetPosition()[2],3*vxd+2);
00384       }
00385       TPolyMarker3D* VXDHits = new TPolyMarker3D(nVXDHits,vx.GetArray(),6);
00386       //if (m_BW == 0) VXDHits->SetMarkerColor(41);
00387       if (m_BW == 0) VXDHits->SetMarkerColor(kMagenta);
00388       VXDHits->SetMarkerSize(1);
00389       VXDHits->Draw("same");
00390       m_VXDHitsList->Add(VXDHits);
00391     }
00392   }
00393   
00394   // Tracker hits     
00395   if (m_TRKHit) {
00396     Int_t nTrkHits = event->Tracker()->GetEntries();   
00397     if (nTrkHits != 0) {
00398       TArrayD tx(3*nTrkHits);
00399       for (Int_t trk=0; trk<nTrkHits; trk++) {
00400         LCDTracker_Hit* hT = (LCDTracker_Hit*)event->Tracker()->At(trk);
00401         tx.AddAt(hT->GetPosition()[0],3*trk+0);
00402         tx.AddAt(hT->GetPosition()[1],3*trk+1);
00403         tx.AddAt(hT->GetPosition()[2],3*trk+2);
00404       }
00405       TPolyMarker3D* TrackerHits = new TPolyMarker3D(nTrkHits,tx.GetArray(),7);
00406       if (m_BW == 0) TrackerHits->SetMarkerColor(kYellow);
00407       TrackerHits->SetMarkerSize(1);
00408       TrackerHits->Draw("same");
00409       m_TrackerHitsList->Add(TrackerHits);
00410     }
00411   }
00412   
00413   LCDCalHitUtil chutil(m_gp);
00414   // Cal Hit
00415   LCDCalHit*  cE;
00416   Int_t       sysid;
00417   Int_t       fcol;
00418   Double_t    eHit;
00419 
00420   Int_t jcal = 0;
00421   Int_t nCal = 0;
00422 
00423   // EMCALHit
00424   if (m_EMCALHit) {
00425     nCal = event->EMCAL()->GetEntries();
00426     if (nCal > 0) {
00427       for (int i_em=0; i_em<nCal; i_em++) {
00428         cE = (LCDCalHit*)event->EMCAL()->At(i_em);
00429         phi   = chutil.GetPhi(cE);
00430         theta = chutil.GetTheta(cE);
00431         eHit  = chutil.GetEtot(cE);
00432         sysid=cE->GetTower()->GetSystem();
00433         switch(sysid) {
00434         case 10: // EM Barrel
00435           if (eHit < m_threshold_em) continue;
00436           fcol=kGreen;
00437           rt = chutil.GetR(cE)*TMath::Sin(theta);
00438           dx = m_gp->GetEMphiSeg()/2.0*rt;
00439           dy = m_gp->GetEMThetaSeg()/2.0*rt;
00440           dz = m_gp->GetEMBarrelThick()/2.0;
00441           //rt*= (1.0 + dz/rt);
00442           x  = rt*TMath::Cos(phi);
00443           y  = rt*TMath::Sin(phi);
00444           z  = rt*TMath::Cos(theta)/TMath::Sin(theta);
00445           break;
00446         case 11: // EM EndCap
00447           if (m_ENDCALHit == 0) continue;
00448           if (eHit < m_threshold_em) continue;
00449           fcol=29;
00450           rt = chutil.GetR(cE)*TMath::Sin(theta);
00451           dx = m_gp->GetEMphiSeg()/2.0*rt;
00452           dy = m_gp->GetEMThetaSeg()/2.0*rt;
00453           dz = m_gp->GetEMBarrelThick()/2.0;
00454           //rt*= (1.0 + dz/rt);
00455           x  = rt*TMath::Cos(phi);
00456           y  = rt*TMath::Sin(phi);
00457           z  = rt*TMath::Cos(theta)/TMath::Sin(theta);
00458           break;
00459         default:
00460           continue;
00461           break;
00462         }
00463         theta*=180.0/TMath::Pi();
00464         phi  *=180.0/TMath::Pi();
00465         clus = new((*m_CalHitList)[jcal++])
00466           TMarker3DBox(x,y,z,dx,dy,dz,theta,phi);
00467         clus->SetLineColor(fcol);
00468         clus->Draw("same");
00469       }
00470     }
00471   }
00472 
00473   // HADCALHit
00474   if (m_HDCALHit) {
00475     nCal = event->HADCAL()->GetEntries();
00476     if (nCal > 0) {
00477       for (int i_em=0; i_em<nCal; i_em++) {
00478         cE = (LCDCalHit*)event->HADCAL()->At(i_em);
00479         phi   = chutil.GetPhi(cE);
00480         theta = chutil.GetTheta(cE);
00481         eHit  = chutil.GetEtot(cE);
00482         sysid=cE->GetTower()->GetSystem();
00483         switch(sysid) {
00484         case 12: // HAD Barrel
00485           if (eHit < m_threshold_hd) continue;
00486           fcol=kBlue;
00487           rt = chutil.GetR(cE)*TMath::Sin(theta);
00488           dx = m_gp->GetHADphiSeg()/2.0*rt;
00489           dy = m_gp->GetHADThetaSeg()/2.0*rt;
00490           dz = m_gp->GetHADBarrelThick()/2.0;
00491           //rt*= (1.0 + dz/rt);
00492           x  = rt*TMath::Cos(phi);
00493           y  = rt*TMath::Sin(phi);
00494           z  = rt*TMath::Cos(theta)/TMath::Sin(theta);
00495           break;
00496         case 13: // HAD EndCap
00497           if (m_ENDCALHit == 0) continue;
00498           if (eHit < m_threshold_hd) continue;
00499           fcol=38;
00500           rt = chutil.GetR(cE)*TMath::Sin(theta);
00501           dx = m_gp->GetHADphiSeg()/2.0*rt;
00502           dy = m_gp->GetHADThetaSeg()/2.0*rt;
00503           dz = m_gp->GetHADBarrelThick()/2.0;
00504           //rt*= (1.0 + dz/rt);
00505           x  = rt*TMath::Cos(phi);
00506           y  = rt*TMath::Sin(phi);
00507           z  = rt*TMath::Cos(theta)/TMath::Sin(theta);
00508           break;
00509         default:
00510           continue;
00511           break;
00512         }
00513         theta*=180.0/TMath::Pi();
00514         phi  *=180.0/TMath::Pi();
00515         clus = new((*m_CalHitList)[jcal++])
00516           TMarker3DBox(x,y,z,dx,dy,dz,theta,phi);
00517         clus->SetLineColor(fcol);
00518         clus->Draw("same");
00519       }
00520     }
00521   }
00522 
00523   // MUCALHit
00524   if (m_MUCALHit) {
00525     nCal = event->MUCAL()->GetEntries();
00526     if (nCal > 0) {
00527       for (int i_em=0; i_em<nCal; i_em++) {
00528         cE = (LCDCalHit*)event->MUCAL()->At(i_em);
00529         phi   = chutil.GetPhi(cE);
00530         theta = chutil.GetTheta(cE);
00531         eHit  = chutil.GetEtot(cE);
00532         sysid=cE->GetTower()->GetSystem();
00533         switch(sysid) {
00534         case 14: // MU Barrel
00535           fcol=kBlue;
00536           rt = chutil.GetR(cE)*TMath::Sin(theta);
00537           dx = m_gp->GetMUphiSeg()/2.0*rt;
00538           dy = m_gp->GetMUThetaSeg()/2.0*rt;
00539           dz = m_gp->GetMUBarrelThick()/2.0;
00540           //rt*= (1.0 + dz/rt);
00541           x  = rt*TMath::Cos(phi);
00542           y  = rt*TMath::Sin(phi);
00543           z  = rt*TMath::Cos(theta)/TMath::Sin(theta);
00544           break;
00545         case 15: // MU EndCap
00546           if (m_ENDCALHit == 0) continue;
00547           fcol=38;
00548           rt = chutil.GetR(cE)*TMath::Sin(theta);
00549           dx = m_gp->GetMUphiSeg()/2.0*rt;
00550           dy = m_gp->GetMUThetaSeg()/2.0*rt;
00551           dz = m_gp->GetMUBarrelThick()/2.0;
00552           //rt*= (1.0 + dz/rt);
00553           x  = rt*TMath::Cos(phi);
00554           y  = rt*TMath::Sin(phi);
00555           z  = rt*TMath::Cos(theta)/TMath::Sin(theta);
00556           break;
00557         default:
00558           continue;
00559           break;
00560         }
00561         theta*=180.0/TMath::Pi();
00562         phi  *=180.0/TMath::Pi();
00563         clus = new((*m_CalHitList)[jcal++])
00564           TMarker3DBox(x,y,z,dx,dy,dz,theta,phi);
00565         clus->SetLineColor(fcol);
00566         clus->Draw("same");
00567 
00568       }
00569     }
00570   }
00571   
00572   // Tracks
00573   if (m_TRK) {
00574     int nTracks = event->Tracks()->GetEntries();   
00575     int jtrk=0;
00576     for (int itrk=0; itrk < nTracks; itrk++){
00577       track = (LCDTrack*)event->Tracks()->At(itrk);
00578       pos0=track->GetPositionVector(0.0);
00579       mom0=track->GetMomentumVector(0.0);
00580       charge = (Int_t)(track->GetCharge());
00581       if (m_Gismo) charge*=-1; //Gismo bug workaround...
00582       
00583       if (pos0.Perp() > EMbrInner ) continue;
00584       if (TMath::Abs(pos0.Z()) > EMeInnerZ ) continue;
00585     
00586       pt = mom0.Pt();
00587       r  = ptor * pt;
00588       w  = pt / r ;
00589       vt = r * w;
00590       vz = mom0.Z()* ptor * w;
00591     
00592       v0[0] = vt* mom0.X() / pt;
00593       v0[1] = vt* mom0.Y() / pt;
00594       v0[2] = vz;
00595     
00596       w *= charge;
00597     
00598       traj.SetParticleParams(pos0, mom0, charge);
00599     
00600       pCur = (LCDDetectorVolume *) pInnerVolume;
00601       status= traj.HelixToCyl(pCur, &decrS);
00602 
00603       pos0.GetXYZ(xyz0);
00604       
00605       pPos=traj.GetNewPos();
00606       if (status == LCDSwimTraj::INTERSECT_ZPLUS) {
00607         range[0] = pos0[2]; range[1] = EMeInnerZ;
00608       } else if (status == LCDSwimTraj::INTERSECT_ZMINUS){
00609         range[1] = pos0[2]; range[0] =-EMeInnerZ;
00610       } else if (pPos.Z() < pos0[2]){
00611         range[0] = pPos.Z(); range[1] = pos0[2];
00612       } else if (pPos.Z() > pos0[2]){
00613         range[1] = pPos.Z(); range[0] = pos0[2];
00614       } else {
00615         range[0] = pos0[2]; range[1] = pos0[2];
00616       }
00617 
00618       tH = new((*m_TrackList)[jtrk++]) 
00619         THelix(xyz0, v0, w, range, kHelixZ, baxis);
00620 
00621       if (m_BW==0) tH->SetLineColor(kCyan);
00622       tH->Draw("same");
00623       
00624     }
00625   }
00626   
00627   // Cluster
00628   LCDCluster* cls;
00629   if (m_EMCAL || m_HDCAL || m_MUCAL || m_LMCAL) {
00630     Int_t nCluster = event->ClusterLst()->GetEntries();
00631     Int_t jClus=0;
00632     Double_t csphi,snphi,csthe,snthe;
00633     for (int iClus=0; iClus<nCluster; iClus++) {
00634       cls = (LCDCluster*)event->ClusterLst()->At(iClus);
00635 
00636       phi    = cls->GetEnergyPhi();
00637       theta  = cls->GetEnergyTheta();
00638       rt     = cls->GetEnergyR()*TMath::Sin(theta);
00639 
00640       csphi = TMath::Cos(phi);
00641       snphi = TMath::Sin(phi);
00642       csthe = TMath::Cos(theta);
00643       snthe = TMath::Sin(theta);
00644 
00645       x  = rt*csphi;
00646       y  = rt*snphi;
00647       z  = rt*csthe/snthe;
00648 
00649       if (m_EMCAL == 0) {
00650         if (cls->GetSystem() == 0) continue; //Barrel Hit
00651         dx = m_gp->GetEMphiSeg()/2.0*rt;
00652         dy = m_gp->GetEMThetaSeg()/2.0*rt;
00653       }
00654       if (m_HDCAL == 0) {
00655         if (cls->GetSystem() == 1) continue; //Not EM Cluster
00656         dx = m_gp->GetHADphiSeg()/2.0*rt;
00657         dy = m_gp->GetHADThetaSeg()/2.0*rt;
00658       }
00659       if (m_MUCAL == 0) {
00660         if (cls->GetSystem() == 2) continue; //Not EM Cluster
00661         dx = m_gp->GetMUphiSeg()/2.0*rt;
00662         dy = m_gp->GetMUThetaSeg()/2.0*rt;
00663       }
00664       if (m_LMCAL == 0) {
00665         if (cls->GetSystem() == 3) continue; //Not EM Cluster
00666         dx = m_gp->GetLUMphiSeg()/2.0*rt;
00667         dy = m_gp->GetLUMThetaSeg()/2.0*rt;
00668       }
00669       if (m_ENDCAL == 0) {
00670         if (cls->GetBarEnd() != 0) continue; //Endcap Hit
00671         switch(cls->GetSystem()) {
00672         case 0:
00673           dx = m_gp->GetMUphiSeg()/2.0*rt;
00674           dy = m_gp->GetMUThetaSeg()/2.0*rt;
00675           break;
00676         case 1:
00677           dx = m_gp->GetHADphiSeg()/2.0*rt;
00678           dy = m_gp->GetHADThetaSeg()/2.0*rt;
00679           break;
00680         case 2:
00681           dx = m_gp->GetMUphiSeg()/2.0*rt;
00682           dy = m_gp->GetMUThetaSeg()/2.0*rt;
00683           break;
00684         case 3:
00685           dx = m_gp->GetLUMphiSeg()/2.0*rt;
00686           dy = m_gp->GetLUMThetaSeg()/2.0*rt;
00687           break;
00688         }
00689       }
00690 
00691       energy = cls->GetEnergy();        
00692       energy=TMath::Power(energy,0.5);
00693 
00694       Double_t ddx=energy*snthe*csphi;
00695       Double_t ddy=energy*snthe*snphi;
00696       Double_t ddz=energy*csthe      ;
00697       x+=ddx;
00698       y+=ddy;
00699       z+=ddz;
00700 
00701       theta*=180.0/TMath::Pi();
00702       phi  *=180.0/TMath::Pi();
00703 
00704       clus = new((*m_ClusterList)[jClus++])
00705         TMarker3DBox(x,y,z,dx,dy,energy,theta,phi);
00706 
00707       if (m_BW == 0) {
00708         if (cls->GetBarEnd() == 0) {//Barrel
00709           if (cls->GetSystem() == 0) {//Em
00710             clus->SetLineColor(kRed);
00711           } else {
00712             clus->SetLineColor(kYellow);
00713           }
00714         } else {//Endcap
00715           clus->SetLineColor(45);
00716         }
00717       }
00718 
00719       clus->Draw("same"); 
00720     
00721     }
00722   }
00723   
00724   node0->Draw("same");
00725 
00726   m_canvas->Update();
00727   //m_viewpad->x3d();
00728 }

Generated on Tue Jul 18 18:33:59 2006 for LCDROOT by  doxygen 1.4.6