3 // Class AliMUONGeometryEnvelopeStore
4 // ----------------------------------
5 // Class for definititon of the temporary volume envelopes
6 // used in geometry construction
8 // Author: Ivana Hrivnacova, IPN Orsay
10 #include <TVirtualMC.h>
11 #include <TGeoMatrix.h>
12 #include <TObjArray.h>
14 #include <Riostream.h>
16 #include "AliMUONGeometryEnvelopeStore.h"
17 #include "AliMUONGeometryTransformStore.h"
18 #include "AliMUONGeometryEnvelope.h"
19 #include "AliMUONConstants.h"
21 ClassImp(AliMUONGeometryEnvelopeStore)
23 //______________________________________________________________________________
24 AliMUONGeometryEnvelopeStore::AliMUONGeometryEnvelopeStore(
25 AliMUONGeometryTransformStore* transforms)
27 fDETransforms(transforms),
32 // Standard constructor
34 fEnvelopes = new TObjArray(100);
38 //______________________________________________________________________________
39 AliMUONGeometryEnvelopeStore::AliMUONGeometryEnvelopeStore()
46 // Default constructor
50 //______________________________________________________________________________
51 AliMUONGeometryEnvelopeStore::AliMUONGeometryEnvelopeStore(const AliMUONGeometryEnvelopeStore& rhs)
54 Fatal("Copy constructor",
55 "Copy constructor is not implemented.");
58 //______________________________________________________________________________
59 AliMUONGeometryEnvelopeStore::~AliMUONGeometryEnvelopeStore()
63 // Add deleting rotation matrices
71 //______________________________________________________________________________
72 AliMUONGeometryEnvelopeStore&
73 AliMUONGeometryEnvelopeStore::operator = (const AliMUONGeometryEnvelopeStore& rhs)
75 // check assignement to self
76 if (this == &rhs) return *this;
79 "Assignment operator is not implemented.");
88 //______________________________________________________________________________
89 AliMUONGeometryEnvelope*
90 AliMUONGeometryEnvelopeStore::FindEnvelope(const TString& name) const
92 // Finds the envelope specified by name.
95 for (Int_t i=0; i<fEnvelopes->GetEntriesFast(); i++) {
96 AliMUONGeometryEnvelope* envelope
97 = (AliMUONGeometryEnvelope*)fEnvelopes->At(i);
99 if (envelope->GetName() == name) return envelope;
105 //______________________________________________________________________________
106 Bool_t AliMUONGeometryEnvelopeStore::AlignEnvelope(
107 AliMUONGeometryEnvelope* envelope) const
109 // Find transformation by the detection element Id (if not 0)
110 // (= unique ID of enevelope) and set it to the envelope.
111 // Return true if transformation is applied, false otherwise.
114 Int_t detElemId = envelope->GetUniqueID();
115 if (detElemId == 0) return false;
117 const TGeoCombiTrans* kTransform = fDETransforms->Get(detElemId);
119 Warning("AlignEnvelope", "Transformation not found.");
123 envelope->SetTransform(*kTransform);
131 //______________________________________________________________________________
132 void AliMUONGeometryEnvelopeStore::AddEnvelope(const TString& name,
137 // Adds the volume with the specified name and transformation
138 // to the list of envelopes.
142 cout << "... Adding ";
143 if (!isVirtual) cout << " non-";
144 cout << "virtual envelope " << name
145 << " id " << id << endl;
148 AliMUONGeometryEnvelope* envelope
149 = new AliMUONGeometryEnvelope(name, id, isVirtual, only);
151 if (fAlign) AlignEnvelope(envelope);
153 fEnvelopes->Add(envelope);
156 //______________________________________________________________________________
157 void AliMUONGeometryEnvelopeStore::AddEnvelope(const TString& name,
160 const TGeoTranslation& translation,
163 // Adds the volume with the specified name and transformation
164 // to the list of envelopes.
168 cout << "... Adding ";
169 if (!isVirtual) cout << " non-";
170 cout << "virtual envelope " << name
172 << " with translation" << endl;
175 AliMUONGeometryEnvelope* envelope
176 = new AliMUONGeometryEnvelope(name, id, isVirtual, only);
178 Bool_t aligned = false;
179 if (fAlign) aligned = AlignEnvelope(envelope);
182 envelope->SetTranslation(translation);
184 fEnvelopes->Add(envelope);
187 //______________________________________________________________________________
188 void AliMUONGeometryEnvelopeStore::AddEnvelope(const TString& name,
191 const TGeoTranslation& translation,
192 const TGeoRotation& rotation,
195 // Adds the volume with the specified name and transformation
196 // to the list of envelopes.
200 cout << "... Adding ";
201 if (!isVirtual) cout << " non-";
202 cout << "virtual envelope " << name
204 << " with translation and rotation" << endl;
208 cout << "Adding env... name: " << name;
210 const Double_t* xyz = translation.GetTranslation();
211 cout << " translation: " << xyz[0] << ", " << xyz[1] << ", " << xyz[2]
214 Double_t a1, a2, a3, a4, a5, a6;
215 rotation.GetAngles(a1, a2, a3, a4, a5, a6);
216 cout << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ", " << a5 << ", " << a6 << endl;
218 // fEnvelopes->Add(new TGeoCombiTrans(name, translation, rotation));
219 // would be nice to be so simple
221 AliMUONGeometryEnvelope* envelope
222 = new AliMUONGeometryEnvelope(name, id, isVirtual, only);
224 Bool_t aligned = false;
225 if (fAlign) aligned = AlignEnvelope(envelope);
228 envelope->SetRotation(rotation);
229 envelope->SetTranslation(translation);
232 fEnvelopes->Add(envelope);
235 //______________________________________________________________________________
236 void AliMUONGeometryEnvelopeStore::AddEnvelope(const TString& name,
239 const TGeoCombiTrans& transform,
242 // Adds the volume with the specified name and transformation
243 // to the list of envelopes.
247 cout << "... Adding ";
248 if (!isVirtual) cout << " non-";
249 cout << "virtual envelope " << name
251 << " with transformation" << endl;
254 // fEnvelopes->Add(new TGeoCombiTrans(name, translation, rotation));
255 // would be nice to be so simple
257 AliMUONGeometryEnvelope* envelope
258 = new AliMUONGeometryEnvelope(name, id, isVirtual, only);
260 Bool_t aligned = false;
261 if (fAlign) aligned = AlignEnvelope(envelope);
264 envelope->SetTransform(transform);
266 fEnvelopes->Add(envelope);
269 //______________________________________________________________________________
270 void AliMUONGeometryEnvelopeStore::AddEnvelope(const TString& name,
275 // Adds the volume with the specified name and transformation
276 // to the list of envelopes.
280 cout << "... Adding "
281 << " non-virtual envelope " << name
283 << " with copyNo " << copyNo << endl;
286 AliMUONGeometryEnvelope* envelope
287 = new AliMUONGeometryEnvelope(name, id, copyNo, only);
289 if (fAlign) AlignEnvelope(envelope);
291 fEnvelopes->Add(envelope);
294 //______________________________________________________________________________
295 void AliMUONGeometryEnvelopeStore::AddEnvelope(const TString& name,
298 const TGeoTranslation& translation,
301 // Adds the volume with the specified name and transformation
302 // to the list of envelopes.
306 cout << "... Adding "
307 << " non-virtual envelope " << name
309 << " with copyNo " << copyNo
310 << " with translation " << endl;
313 AliMUONGeometryEnvelope* envelope
314 = new AliMUONGeometryEnvelope(name, id, copyNo, only);
316 Bool_t aligned = false;
317 if (fAlign) aligned = AlignEnvelope(envelope);
320 envelope->SetTranslation(translation);
322 fEnvelopes->Add(envelope);
325 //______________________________________________________________________________
326 void AliMUONGeometryEnvelopeStore::AddEnvelope(const TString& name,
329 const TGeoTranslation& translation,
330 const TGeoRotation& rotation,
333 // Adds the volume with the specified name and transformation
334 // to the list of envelopes.
338 cout << "... Adding "
339 << " non-virtual envelope " << name
341 << " with copyNo " << copyNo
342 << " with translation and rotation" << endl;
345 // fEnvelopes->Add(new TGeoCombiTrans(name, translation, rotation));
346 // would be nice to be so simple
348 AliMUONGeometryEnvelope* envelope
349 = new AliMUONGeometryEnvelope(name, id, copyNo, only);
351 Bool_t aligned = false;
352 if (fAlign) aligned = AlignEnvelope(envelope);
355 envelope->SetRotation(rotation);
356 envelope->SetTranslation(translation);
359 fEnvelopes->Add(envelope);
362 //______________________________________________________________________________
363 void AliMUONGeometryEnvelopeStore::AddEnvelope(const TString& name,
366 const TGeoCombiTrans& transform,
369 // Adds the volume with the specified name and transformation
370 // to the list of envelopes.
374 cout << "... Adding "
375 << " non-virtual envelope " << name
377 << " with copyNo " << copyNo
378 << " with translation and rotation" << endl;
381 // fEnvelopes->Add(new TGeoCombiTrans(name, translation, rotation));
382 // would be nice to be so simple
384 AliMUONGeometryEnvelope* envelope
385 = new AliMUONGeometryEnvelope(name, id, copyNo, only);
387 Bool_t aligned = false;
388 if (fAlign) aligned = AlignEnvelope(envelope);
391 envelope->SetTransform(transform);
393 fEnvelopes->Add(envelope);
396 //______________________________________________________________________________
397 void AliMUONGeometryEnvelopeStore::AddEnvelopeConstituent(const TString& name,
398 const TString& envName, Int_t copyNo)
400 // Adds the volume with the specified name and transformation
401 // to the list of envelopes.
405 cout << "... Adding constituent " << name
406 << " to envelope " << envName
407 << " with copyNo " << copyNo << endl;
410 AliMUONGeometryEnvelope* envelope = FindEnvelope(envName);
417 envelope->AddConstituent(name, copyNo);
420 //______________________________________________________________________________
421 void AliMUONGeometryEnvelopeStore::AddEnvelopeConstituent(const TString& name,
422 const TString& envName, Int_t copyNo,
423 const TGeoTranslation& translation)
425 // Adds the volume with the specified name and transformation
426 // to the list of envelopes.
430 cout << "... Adding constituent " << name
431 << " to envelope " << envName
432 << " with copyNo " << copyNo
433 << " with translation" << endl;
436 AliMUONGeometryEnvelope* envelope = FindEnvelope(envName);
443 envelope->AddConstituent(name, copyNo, translation);
446 //______________________________________________________________________________
447 void AliMUONGeometryEnvelopeStore::AddEnvelopeConstituent(const TString& name,
448 const TString& envName, Int_t copyNo,
449 const TGeoTranslation& translation,
450 const TGeoRotation& rotation)
452 // Adds the volume with the specified name and transformation
453 // to the list of envelopes.
457 cout << "... Adding constituent " << name
458 << " to envelope " << envName
459 << " with copyNo " << copyNo
460 << " with translation and rotation" << endl;
463 AliMUONGeometryEnvelope* envelope = FindEnvelope(envName);
470 envelope->AddConstituent(name, copyNo, translation, rotation);
473 //______________________________________________________________________________
474 void AliMUONGeometryEnvelopeStore::AddEnvelopeConstituent(const TString& name,
475 const TString& envName, Int_t copyNo,
476 const TGeoCombiTrans& transform)
478 // Adds the volume with the specified name and transformation
479 // to the list of envelopes.
483 cout << "... Adding constituent " << name
484 << " to envelope " << envName
485 << " with copyNo " << copyNo
486 << " with translation and rotation" << endl;
489 AliMUONGeometryEnvelope* envelope = FindEnvelope(envName);
496 envelope->AddConstituent(name, copyNo, transform);
499 //______________________________________________________________________________
500 void AliMUONGeometryEnvelopeStore::AddEnvelopeConstituentParam(const TString& name,
501 const TString& envName, Int_t copyNo,
502 Int_t npar, Double_t* param)
504 // Adds the volume with the specified name and transformation
505 // to the list of envelopes.
509 cout << "... Adding parameterised constituent " << name
510 << " to envelope " << envName
511 << " with copyNo " << copyNo << endl;
514 AliMUONGeometryEnvelope* envelope = FindEnvelope(envName);
521 envelope->AddConstituentParam(name, copyNo, npar, param);
524 //______________________________________________________________________________
525 void AliMUONGeometryEnvelopeStore::AddEnvelopeConstituentParam(const TString& name,
526 const TString& envName, Int_t copyNo,
527 const TGeoTranslation& translation,
528 Int_t npar, Double_t* param)
530 // Adds the volume with the specified name and transformation
531 // to the list of envelopes.
535 cout << "... Adding parameterised constituent " << name
536 << " to envelope " << envName
537 << " with copyNo " << copyNo
538 << " with translation" << endl;
541 AliMUONGeometryEnvelope* envelope = FindEnvelope(envName);
548 envelope->AddConstituentParam(name, copyNo, translation, npar, param);
551 //______________________________________________________________________________
552 void AliMUONGeometryEnvelopeStore::AddEnvelopeConstituentParam(const TString& name,
553 const TString& envName, Int_t copyNo,
554 const TGeoTranslation& translation,
555 const TGeoRotation& rotation,
556 Int_t npar, Double_t* param)
558 // Adds the volume with the specified name and transformation
559 // to the list of envelopes.
563 cout << "... Adding parameterised constituent " << name
564 << " to envelope " << envName
565 << " with copyNo " << copyNo
566 << " with translation and rotation" << endl;
569 AliMUONGeometryEnvelope* envelope = FindEnvelope(envName);
576 envelope->AddConstituentParam(name, copyNo, translation, rotation, npar, param);
579 //______________________________________________________________________________
580 void AliMUONGeometryEnvelopeStore::AddEnvelopeConstituentParam(const TString& name,
581 const TString& envName, Int_t copyNo,
582 const TGeoCombiTrans& transform,
583 Int_t npar, Double_t* param)
585 // Adds the volume with the specified name and transformation
586 // to the list of envelopes.
590 cout << "... Adding parameterised constituent " << name
591 << " to envelope " << envName
592 << " with copyNo " << copyNo
593 << " with translation and rotation" << endl;
596 AliMUONGeometryEnvelope* envelope = FindEnvelope(envName);
603 envelope->AddConstituentParam(name, copyNo, transform, npar, param);