4 #include <det/Detector.h>
5 #include <mdet/MDetector.h>
6 #include <mdet/Counter.h>
7 #include <mdet/Module.h>
8 #include <mdet/Scintillator.h>
9 #include <sdet/Station.h>
10 #include <utl/TimeStamp.h>
11 #include <utl/AugerUnits.h>
12 #include <utl/Point.h>
13 #include <utl/CoordinateSystemPtr.h>
14 #include <utl/ErrorLogger.h>
15 #include <utl/TransformationMatrix.h>
16 #include <utl/Transformation.h>
17 #include <utl/MathConstants.h>
19 #include <fwk/LocalCoordinateSystem.h>
20 #include <fwk/CentralConfig.h>
27 #include <TGeoManager.h>
28 #include <TGeoMaterial.h>
29 #include <TGeoMedium.h>
30 #include <TGeoMatrix.h>
31 #include <TGeoVolume.h>
32 #include <TVirtualGeoPainter.h>
39 namespace MuonCounterViewerAG {
46 std::ostringstream iStrScint;
52 fVolume = fManager->MakeBox(iStrScint.str().c_str(), fMedium, w /
utl::m / 2 , l /
utl::m / 2, h /
utl::m / 2);
72 auto_ptr<TGeoManager> geom(
new TGeoManager(
"counter",
"A muon counter."));
73 TGeoMaterial* matVacuum =
new TGeoMaterial(
"Vacuum", 0,0,0);
74 TGeoMedium* vacuum =
new TGeoMedium(
"Vacuum",1, matVacuum);
79 TGeoVolume *top = geom->MakeBox(
"TOP", vacuum, 1, 1, 1);
80 geom->SetTopVolume(top);
85 if (ic->GetId() != counterId)
89 const double groundHeight = 1 *
utl::cm;
90 TGeoVolume* ground = geom->MakeBox(
"ground", vacuum, 10 *
utl::m , 10 *
utl::m, groundHeight / 2);
91 TGeoTranslation* transGround =
new TGeoTranslation(0,0,
93 ground->SetLineColor(kOrange-1);
94 top->AddNode(ground, 1, transGround);
96 std::ostringstream iStrCounter;
97 iStrCounter<<
"counter" << c.
GetId();
98 TGeoVolume* cCenter = geom->MakeSphere(iStrCounter.str().c_str(),vacuum, 10*
utl::cm,12*
utl::cm);
103 cCenter->SetLineColor(kBlack);
104 top->AddNode(cCenter, 1, transCounter);
106 TGeoVolume* tank = geom->MakeTube(
"tank", vacuum, 0,
109 TGeoTranslation* transTank =
new TGeoTranslation(
114 tank->SetLineColor(41);
115 top->AddNode(tank, 1, transTank);
118 std::ostringstream iStrModule;
119 iStrModule <<
"module" << m.
GetId() <<
"_" << c.
GetId();
120 TGeoVolume* mCenter = geom->MakeSphere(iStrModule.str().c_str(),vacuum, 10*
utl::cm,12*
utl::cm);
125 mCenter->SetLineColor(kViolet);
126 top->AddNode(mCenter, 1, transModule);
144 xUnit = scintPol * xUnit;
145 yUnit = scintPol * yUnit;
146 zUnit = scintPol * zUnit;
161 TGeoRotation* rot =
new TGeoRotation();
162 rot->SetMatrix(rotMatrix);
177 rot->RegisterYourself();
180 TGeoVolume* v = s.
VisitShape(builder(geom.get(), vacuum)).GetVolume();
184 v->SetLineColor(kRed);
187 v->SetLineColor(kBlue);
189 top->AddNode(v, 1,
new TGeoCombiTrans(xxx /
utl::m, yyy /
utl::m, zzz /
utl::m, rot));
200 geom->GetGeomPainter()->SetTopVolume(top);
214 std::ostringstream iStrFile;
215 iStrFile <<
"CounterViewer_" << counterId <<
".C";
216 ofstream fout(iStrFile.str().c_str());
217 fout <<
"void CounterViewer_" << counterId <<
"() {" << endl;
218 top->SavePrimitive(fout);
264 MuonCounterViewer::Finish()
266 cout <<
"\n\n******************\n";
267 INFO(
"ROOT macro script created");
269 std::ostringstream iStrMessage;
270 iStrMessage <<
"From command line, execute: root CounterViewer_" << counterId <<
".C";
271 INFO(iStrMessage.str().c_str());
272 cout <<
"n******************\n\n";
Branch GetTopBranch() const
const Counter & GetCounter() const
The parent counter.
AreaKind GetAreaKind() const
bool is(const double a, const double b)
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Local system based on position and configured rotations.
#define INFO(message)
Macro for logging informational messages.
ScintillatorConstIterator ScintillatorsBegin() const
Begin iterator over the contained scitillators.
utl::Point GetPosition() const
void Init()
Initialise the registry.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
ModuleConstIterator ModulesEnd() const
Begin iterator for the Modules contained in the Counter.
Detector associated to muon detector hierarchy.
utl::Point GetPosition() const
Tank position.
Actual muon-sensitive objects.
Class representing a document branch.
double GetX(const CoordinateSystemPtr &coordinateSystem) const
V & VisitShape(V &v) const
Callback method for inspecting shape-aware properties.
double GetRadius() const
Radius of the tank (water only)
double GetHeight() const
Height of the tank (water only)
CounterConstIterator AllCountersBegin() const
Begin iterator over all the counters.
ScintillatorGroup::ConstIterator ScintillatorConstIterator
Scintillator handling.
void GetData(bool &b) const
Overloads of the GetData member template function.
Root detector of the muon detector hierarchy.
CounterGroup::ConstIterator CounterConstIterator
Defines a more meaningful (and shorter) type for iterators.
double GetY(const CoordinateSystemPtr &coordinateSystem) const
ResultFlag
Flag returned by module methods to the RunController.
CounterConstIterator AllCountersEnd() const
End iterator over all the counters.
ScintillatorConstIterator ScintillatorsEnd() const
End iterator over the contained scintillators.
const Module & GetModule() const
Retrieve the parent mdet::Module.
ModuleConstIterator ModulesBegin() const
Begin iterator for the Modules contained in the Counter.
TimeStamp GetCurrentSystemTime()
get current time as reported by system
Scint shape-aware builder.
const sdet::Station & GetAssociatedTank() const
Retrieve the associated tank.
ModuleGroup::ConstIterator ModuleConstIterator
Convenience typedef for const iterator over the contained Module instances.
int GetId() const
The id of this component.
double GetZ(const CoordinateSystemPtr &coordinateSystem) const