Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

GeoStripVolume.cxx

Go to the documentation of this file.
00001 
00002 // $Id: GeoStripVolume.cxx,v 1.12 2008/01/09 06:38:11 schubert Exp $
00003 //
00004 // GeoStripVolume
00005 //
00006 // GeoStripVolume is a strip volume
00007 // Basic shape is a box volume of polystyrene medium
00008 // placed as a node inside a coextrusion box shell
00009 //
00010 // Author:  S. Kasahara 07/04
00012 
00013 #include <iostream>
00014 using namespace std;
00015 #include <TGeoCompositeShape.h> // used for split strips
00016 #include <TGeoMatrix.h>
00017 #include <TGeoManager.h>
00018 
00019 #include "GeoGeometry/Geo.h"
00020 #include "GeoGeometry/GeoStripVolume.h"
00021 #include "GeoGeometry/GeoGeometry.h"
00022 #include "GeoGeometry/GeoMediumMap.h"
00023 #include "GeoGeometry/GeoMedium.h"
00024 
00025 ClassImp(GeoStripVolume)
00026 
00027 //_____________________________________________________________________________
00028 GeoStripVolume::GeoStripVolume(GeoGeometry* geo, const char* name,
00029                                Float_t totallen, Float_t leneastpart,
00030                                Float_t lenwestpart, Float_t wlsleneast,
00031                                Float_t wlslenwest, Float_t wlslenbypass,
00032                                Bool_t isvetoshield) 
00033   : GeoVolume(geo,name,0), 
00034     fTotalLen(totallen),fLenEastPart(leneastpart),fLenWestPart(lenwestpart),
00035     fWlsLenEast(wlsleneast), fWlsLenWest(wlslenwest),
00036     fWlsLenBypass(wlslenbypass),fWidth(0),fThick(0),fMirrorMask(0),
00037     fIsVetoShield(isvetoshield) {
00038 
00039   UpdateGlobalManager();
00040 
00041   const GeoMediumMap& medMap = fGeoGeometry -> GetMediumMap();
00042   
00043   if ( fIsVetoShield ) SetMedium(medMap.GetMedium(Geo::kVSStpTiO2));
00044   else SetMedium(medMap.GetMedium(Geo::kStpTiO2));
00045   
00046   Double_t scale = Geo::GetScale(fGeoGeometry->GetAppType());
00047   fWidth = scale*Geo::kStripWidth;
00048   fThick = scale*Geo::kStripThick;
00049    
00050   if ( fGeoGeometry->GetVldRange().GetDetectorMask() == Detector::kNear )
00051     fMirrorMask = StripEnd::kEast;
00052   
00053   // Build strip shape according to full pstyrene + coextrusion dimensions
00054   TGeoShape* shape = BuildStripShape();
00055 
00056   SetShape(shape);
00057 
00058   // Because shape was unknown at time of TGeoVolume construction, volume
00059   // was added to run-time list of volumes. Remove and add to normal list
00060   gGeoManager -> GetListOfGVolumes() -> Remove(this);
00061   Int_t index = gGeoManager->GetListOfVolumes() -> GetEntriesFast();
00062   gGeoManager -> GetListOfVolumes() -> AddAtAndExpand(this,index);
00063 
00064   // Activate pstyrene insert visiblity only by default
00065   this -> SetLineColor(kYellow);
00066   this -> SetVisibility(kFALSE); 
00067   this -> VisibleDaughters(kTRUE);
00068   
00069   // Build pstyrene only volume and insert this as node in full strip volume
00070   this -> AddPstyreneNodes();
00071 }
00072 
00073 //_____________________________________________________________________________
00074 void GeoStripVolume::Print(Option_t* /* option */) const {
00075    // print to cout
00076 
00077   UpdateGlobalManager();
00078 
00079   cout << "GeoStripVolume::Print\n"
00080        << GetName() << endl;
00081   cout << "Length, Total " << fTotalLen << ", East " << fLenEastPart
00082        << ", West " << fLenWestPart << endl;
00083   cout << "Width " << fWidth << " Thick " << fThick << endl;
00084   cout << "Wls Length, East " << fWlsLenEast << ", West " << fWlsLenWest
00085        << ", Bypass " << fWlsLenBypass << endl;
00086   
00087 }
00088 
00089 //_____________________________________________________________________________
00090 TGeoShape* GeoStripVolume::BuildStripShape() const {
00091   // Private method used to build shape for this strip.  
00092   // If strip is split, shape will be a composite shape consisting of 
00093   // a TGeoBBox for the total length - TGeoBBox for the hole region.  If 
00094   // strip is whole, shape will be a TGeoBBox.
00095 
00096   UpdateGlobalManager();
00097   
00098   TGeoShape* shape = 0;
00099 
00100   if ( IsSplit() ) {
00101     // strip is split
00102     std::string boxname = std::string(GetName())+"_box";
00103     new TGeoBBox(boxname.c_str(),0.5*fTotalLen,0.5*fWidth,0.5*fThick);
00104     Float_t lengap = fTotalLen-fLenEastPart-fLenWestPart;
00105     std::string gapname = std::string(GetName())+"_gap";
00106     new TGeoBBox(gapname.c_str(),0.5*lengap,0.5*fWidth,0.5*fThick);
00107     Float_t xgap = 0.5*(fLenEastPart-fLenWestPart);
00108     TGeoTranslation* trGap = new TGeoTranslation(gapname.c_str(),xgap,0,0);
00109     trGap -> RegisterYourself();
00110 
00111     std::string compdef = boxname + "-" + gapname + ":" + gapname;
00112     shape = new TGeoCompositeShape(GetName(),compdef.c_str());
00113   }
00114   else {
00115     shape = new TGeoBBox(GetName(),0.5*fTotalLen,0.5*fWidth,0.5*fThick);
00116   }     
00117 
00118   return shape;
00119 
00120 } 
00121 
00122 //_____________________________________________________________________________
00123 void GeoStripVolume::AddPstyreneNodes() {
00124   // Private method used to insert pstyrene nodes for this strip.
00125 
00126   UpdateGlobalManager();
00127 
00128   const GeoMediumMap& medMap = fGeoGeometry -> GetMediumMap();
00129 
00130   Geo::EDetComponent detcomp = Geo::kStpScint;
00131   if ( fIsVetoShield ) detcomp = Geo::kVSStpScint;
00132 
00133   Float_t scale = Geo::GetScale(fGeoGeometry->GetAppType());
00134   Float_t coexthick = Geo::kCoexThick*scale;
00135   std::string stripname = std::string(GetName());
00136   Float_t pstythick = fThick - 2.*coexthick;
00137   Float_t pstywidth = fWidth - 2.*coexthick;
00138 
00139   if ( IsSplit() ) {
00140     // strip is split
00141     std::string pstyeastname = stripname+"_pstyeast";
00142     std::string pstywestname = stripname+"_pstywest";
00143 
00144     TGeoVolume* eastvol = gGeoManager -> MakeBox(pstyeastname.c_str(),
00145                   medMap.GetMedium(detcomp),
00146                   0.5*fLenEastPart-coexthick,0.5*pstywidth,0.5*pstythick);
00147     TGeoVolume* westvol = gGeoManager -> MakeBox(pstywestname.c_str(),
00148                   medMap.GetMedium(detcomp),
00149                   0.5*fLenWestPart-coexthick,0.5*pstywidth,0.5*pstythick);
00150     eastvol -> SetLineColor(kCyan); 
00151     eastvol -> SetVisibility(kTRUE);
00152     westvol -> SetLineColor(kCyan); 
00153     westvol -> SetVisibility(kTRUE);
00154     Float_t xeast = 0.5*(-fTotalLen+fLenEastPart); // east(-)
00155     Float_t xwest = 0.5*(fTotalLen-fLenWestPart); // west(+)
00156     this->AddNode(eastvol,1,
00157                   new TGeoTranslation(pstyeastname.c_str(),xeast,0,0));
00158     this->AddNode(westvol,1,
00159                   new TGeoTranslation(pstywestname.c_str(),xwest,0,0));
00160   }
00161   else {
00162     std::string pstyname = stripname+"_psty";
00163     TGeoVolume* vol = gGeoManager -> MakeBox(pstyname.c_str(),
00164                   medMap.GetMedium(detcomp),
00165                   0.5*fTotalLen-coexthick,0.5*pstywidth,0.5*pstythick);
00166     vol -> SetLineColor(kCyan);
00167     vol -> SetVisibility(kTRUE);
00168     this -> AddNode(vol,1,gGeoIdentity);
00169   }     
00170 
00171   return;
00172 
00173 } 
00174 
00175 //_____________________________________________________________________________
00176 Float_t GeoStripVolume::GetWlsLen(StripEnd::StripEnd_t end) const {
00177    // Return length of wls (east,west, or total)
00178 
00179   UpdateGlobalManager();
00180 
00181   switch(end) {
00182 
00183   case (StripEnd::kEast): return fWlsLenEast;
00184 
00185   case (StripEnd::kWest): return fWlsLenWest;
00186 
00187   case (StripEnd::kWhole): {      
00188     if ( !fWlsLenBypass ) {
00189       return fWlsLenEast + fWlsLenWest + fTotalLen;
00190     }
00191     else {
00192       return fWlsLenEast + fWlsLenWest + fWlsLenBypass 
00193            + fLenEastPart + fLenWestPart;
00194     }
00195   }    
00196   default: return 0;
00197 
00198   } // end of switch
00199 }
00200 
00201 //_____________________________________________________________________________
00202 Float_t GeoStripVolume::GetLenPart(StripEnd::StripEnd_t end) const {
00203    // Return length of strip (east,west, or total)
00204 
00205   UpdateGlobalManager();
00206 
00207   switch(end) {
00208 
00209   case (StripEnd::kEast): return fLenEastPart;
00210 
00211   case (StripEnd::kWest): return fLenWestPart;
00212 
00213   case (StripEnd::kWhole): return fTotalLen;
00214 
00215   default: return 0;
00216 
00217   } // end of switch
00218   
00219 }
00220 

Generated on Mon Feb 15 11:06:45 2010 for loon by  doxygen 1.3.9.1