00001
00002
00003
00004
00005
00006
00007
00009
00010 #include <iostream>
00011 using namespace std;
00012
00013 #include "TGeoVolume.h"
00014
00015 #include "GeoGeometry/GeoShield.h"
00016 #include "GeoGeometry/GeoShieldGroup.h"
00017 #include "Conventions/PlaneView.h"
00018 #include "UgliGeometry/UgliDbiSteelPln.h"
00019 #include "MessageService/MsgService.h"
00020
00021 ClassImp(GeoShield)
00022
00023 CVSID("$Id: GeoShield.cxx,v 1.2 2007/03/01 17:13:57 rhatcher Exp $");
00024
00025
00026 GeoShield::GeoShield(GeoGeometry* geo) : fGeoGeometry(geo) {
00027
00028
00029 MSG("Geo",Msg::kDebug) << "GeoShield normal ctor @ " << this << endl;
00030
00031 }
00032
00033
00034 GeoShield::~GeoShield() {
00035
00036 MSG("Geo",Msg::kDebug) << "GeoShield dtor @ " << this << endl;
00037
00038
00039
00040
00041 GroupMapItr mapitr;
00042 for ( mapitr = fGroupMap.begin(); mapitr != fGroupMap.end(); mapitr++ ) {
00043 GeoShieldGroup* shieldgrp = mapitr -> second;
00044
00045 if ( shieldgrp ) delete shieldgrp; shieldgrp = 0;
00046 }
00047
00048 }
00049
00050
00051 void GeoShield::Print(Option_t* ) const {
00052
00053
00054 GroupMapConstItr mapitr;
00055 for ( mapitr=fGroupMap.begin(); mapitr != fGroupMap.end(); mapitr++ ) {
00056 GeoShieldGroup* shieldgrp = mapitr -> second;
00057 shieldgrp -> Print();
00058 }
00059
00060 }
00061
00062
00063 std::list<const TGeoVolume*>
00064 GeoShield::GetListOfVolumes(EGroupType shieldgrp) const {
00065
00066
00067 GroupMapConstItr mapitr;
00068 std::list<const TGeoVolume*> vollist;
00069
00070 mapitr = fGroupMap.find(shieldgrp);
00071 if ( mapitr != fGroupMap.end() ) {
00072 GeoShieldGroup* shieldgrp = mapitr->second;
00073 return (shieldgrp -> GetListOfVolumes());
00074 }
00075
00076 return vollist;
00077
00078 }
00079
00080
00081 const char* GeoShield::AsString(EGroupType shieldgrp) {
00082
00083
00084 switch (shieldgrp ) {
00085 case kFarInnerE:
00086 return "FarInnerE";
00087
00088 case kFarInnerW:
00089 return "FarInnerW";
00090
00091 case kFarOuterE:
00092 return "FarOuterE";
00093
00094 case kFarOuterW:
00095 return "FarOuterW";
00096
00097 case kFarTop:
00098 return "FarTop";
00099
00100 default:
00101 MSG("GeoShield",Msg::kWarning)
00102 << "GeoShield::AsString called with unknown shield group type "
00103 << (int)shieldgrp << "." << endl;
00104 return "UNKNOWN";
00105
00106 }
00107
00108 }
00109
00110
00111 GeoShield::EGroupType GeoShield::AddVolume(const TGeoVolume* vol,
00112 PlexPlaneId steelId,
00113 const UgliDbiSteelPln* stRow) {
00114
00115
00116
00117
00118 if ( !steelId.IsVetoShield() ) {
00119 MSG("Geo",Msg::kFatal)
00120 << "GeoShield::AddVolume called with non-vetoshield volume!" << endl;
00121 abort();
00122 }
00123
00124
00125 GeoShield::EGroupType shieldgrp = kUnknown;
00126 switch ( steelId.GetPlaneView() ) {
00127
00128 case PlaneView::kVSTopFlat:
00129 case PlaneView::kVSTopEastSlant:
00130 case PlaneView::kVSTopWestSlant:
00131 shieldgrp = kFarTop;
00132 break;
00133
00134 case PlaneView::kVSWallEastSlant:
00135 shieldgrp = kFarOuterE;
00136 break;
00137
00138 case PlaneView::kVSWallWestSlant:
00139 shieldgrp = kFarOuterW;
00140 break;
00141
00142 case PlaneView::kVSWallOnEdge:
00143 {
00144 Float_t x0 = stRow->GetX0();
00145 if ( TMath::Abs(x0) < 5. ) {
00146
00147 if ( x0 < 0. ) shieldgrp = kFarInnerE;
00148 else shieldgrp = kFarInnerW;
00149 }
00150 else {
00151
00152 if ( x0 < 0. ) shieldgrp = kFarOuterE;
00153 else shieldgrp = kFarOuterW;
00154 }
00155 }
00156 break;
00157
00158 default:
00159 MSG("Geo",Msg::kFatal) << "PlaneView "
00160 << PlaneView::AsString(steelId.GetPlaneView())
00161 << " unknown!. Abort." << endl;
00162 abort();
00163
00164 }
00165
00166 GeoShieldGroup* grp = fGroupMap[shieldgrp];
00167 if ( grp == 0 ) {
00168 grp = new GeoShieldGroup(fGeoGeometry,shieldgrp);
00169 fGroupMap[shieldgrp] = grp;
00170 }
00171 grp -> AddVolume(vol,stRow);
00172
00173 return shieldgrp;
00174
00175 }
00176
00177
00178 void GeoShield::BuildGroupNodes(TGeoVolume* hallVol) {
00179
00180
00181
00182
00183
00184 GroupMapConstItr mapitr;
00185 for ( mapitr=fGroupMap.begin(); mapitr!=fGroupMap.end(); mapitr++ ) {
00186 GeoShieldGroup* grp = mapitr -> second;
00187 grp -> BuildNode(hallVol);
00188 }
00189
00190 return;
00191
00192 }
00193