LCOV - code coverage report
Current view: top level - MUON/MUONgeometry - AliMUONGeometryEnvelope.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 64 75 85.3 %
Date: 2016-06-14 17:26:59 Functions: 17 21 81.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : // $Id$
      17             : 
      18             : //-----------------------------------------------------------------------------
      19             : // Class AliMUONGeometryEnvelope
      20             : // -----------------------------
      21             : // Helper class for definititon of an assembly of volumes.
      22             : // Author: Ivana Hrivnacova, IPN Orsay
      23             : // 23/01/2004
      24             : //-----------------------------------------------------------------------------
      25             : 
      26             : #include <TGeoMatrix.h>
      27             : #include <TString.h>
      28             : #include <TObjArray.h>
      29             : 
      30             : #include "AliMUONGeometryEnvelope.h"
      31             : #include "AliMUONGeometryConstituent.h"
      32             : #include "AliLog.h"
      33             : 
      34             : /// \cond CLASSIMP
      35          18 : ClassImp(AliMUONGeometryEnvelope)
      36             : /// \endcond
      37             : 
      38             : //______________________________________________________________________________
      39             : AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name, 
      40             :                                                  Int_t id, 
      41             :                                                  Bool_t isVirtual,
      42             :                                                  const char* only)
      43        1332 :  : TNamed(name, name),
      44        1332 :    fIsVirtual(isVirtual),
      45        1332 :    fIsMANY(false),
      46        1332 :    fCopyNo(1),
      47        1332 :    fTransformation(0),
      48        1332 :    fConstituents(0)
      49        3996 : {
      50             : /// Standard constructor
      51             : 
      52        5328 :   if (TString(only) == TString("MANY")) fIsMANY = true;
      53             : 
      54             :   // Create the envelope transformation
      55        3996 :   fTransformation = new TGeoCombiTrans("");
      56        3996 :   fConstituents = new TObjArray(20);
      57             :   
      58             :   // Set id
      59        1332 :   SetUniqueID(id);
      60        2664 : }
      61             : 
      62             : 
      63             : //______________________________________________________________________________
      64             : AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name,   
      65             :                                                  Int_t id,
      66             :                                                  Int_t copyNo, 
      67             :                                                  const char* only)
      68          20 :  : TNamed(name, name),
      69          20 :    fIsVirtual(false),
      70          20 :    fIsMANY(false),
      71          20 :    fCopyNo(copyNo),
      72          20 :    fTransformation(0),
      73          20 :    fConstituents(0)
      74         100 : {
      75             : /// Standard constructor for a non virtual enevelope with a specified copy 
      76             : /// number
      77             : 
      78          80 :   if (TString(only) == TString("MANY")) fIsMANY = true;
      79             : 
      80             :   // Create the envelope transformation
      81          60 :   fTransformation = new TGeoCombiTrans("");
      82          60 :   fConstituents = new TObjArray(20);
      83             :   
      84             :   // Set id
      85          20 :   SetUniqueID(id);
      86          40 : }
      87             : 
      88             : 
      89             : //______________________________________________________________________________
      90             : AliMUONGeometryEnvelope::AliMUONGeometryEnvelope()
      91       16224 :  : TNamed(),
      92       16224 :    fIsVirtual(0),
      93       16224 :    fIsMANY(false),
      94       16224 :    fCopyNo(0),
      95       16224 :    fTransformation(0),
      96       16224 :    fConstituents(0)
      97       81120 : {
      98             : /// Default constructor
      99       32448 : }
     100             : 
     101             : //______________________________________________________________________________
     102             : AliMUONGeometryEnvelope::~AliMUONGeometryEnvelope() 
     103      105456 : {
     104             : /// Destructor
     105             : 
     106             :   // Add deleting rotation matrices 
     107             :   
     108       35152 :   delete fTransformation;
     109             :   
     110       17576 :   if (fConstituents) {
     111       17576 :     fConstituents->Delete();
     112       35152 :     delete fConstituents;
     113             :   }  
     114       52728 : }
     115             : 
     116             : //
     117             : // public methods
     118             : //
     119             : 
     120             : //______________________________________________________________________________
     121             : void  AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo) 
     122             : {
     123             : /// Add the volume with the specified name and transformation
     124             : /// to the list of envelopes.
     125             : 
     126           0 :   fConstituents->Add(new AliMUONGeometryConstituent(name, copyNo, 0, 0));
     127           0 : }
     128             : 
     129             : //______________________________________________________________________________
     130             : void  AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo, 
     131             :                                           const TGeoTranslation& translation)
     132             : {
     133             : /// Add the volume with the specified name and transformation
     134             : /// to the list of envelopes.
     135             : 
     136        4932 :   fConstituents
     137        3288 :     ->Add(new AliMUONGeometryConstituent(name, copyNo, translation, 0, 0));
     138        1644 : }
     139             : 
     140             : //______________________________________________________________________________
     141             : void  AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
     142             :                                           const TGeoTranslation& translation,
     143             :                                           const TGeoRotation& rotation)
     144             : {
     145             : /// Add the volume with the specified name and transformation
     146             : /// to the list of envelopes.
     147             : 
     148        1404 :   fConstituents
     149         936 :     ->Add(new AliMUONGeometryConstituent(
     150             :                      name, copyNo, translation, rotation, 0, 0));
     151         468 : }
     152             : 
     153             : //______________________________________________________________________________
     154             : void  AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
     155             :                                           const TGeoCombiTrans& transform )
     156             : {
     157             : /// Add the volume with the specified name and transformation
     158             : /// to the list of envelopes.
     159             : 
     160           0 :   fConstituents
     161           0 :     ->Add(new AliMUONGeometryConstituent(
     162             :                      name, copyNo, transform, 0, 0));
     163           0 : }
     164             : 
     165             : //______________________________________________________________________________
     166             : void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
     167             :                                   Int_t copyNo, Int_t npar, Double_t* param) 
     168             : {
     169             : /// Add the volume with the specified name and transformation
     170             : /// to the list of envelopes.
     171             : 
     172        3504 :   fConstituents
     173        2336 :     ->Add(new AliMUONGeometryConstituent(name, copyNo, npar, param));
     174        1168 : }
     175             : 
     176             : //______________________________________________________________________________
     177             : void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
     178             :                                   Int_t copyNo, const TGeoTranslation& translation,
     179             :                                   Int_t npar, Double_t* param)
     180             : {
     181             : /// Add the volume with the specified name and transformation
     182             : /// to the list of envelopes.
     183             : 
     184          96 :   fConstituents
     185          64 :     ->Add(new AliMUONGeometryConstituent(
     186             :                      name, copyNo, translation, npar, param));
     187          32 : }
     188             : 
     189             : //______________________________________________________________________________
     190             : void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
     191             :                                   Int_t copyNo, const TGeoTranslation& translation,
     192             :                                   const TGeoRotation& rotation, 
     193             :                                   Int_t npar, Double_t* param)
     194             : {
     195             : /// Add the volume with the specified name and transformation
     196             : /// to the list of envelopes.
     197             : 
     198           0 :   fConstituents
     199           0 :     ->Add(new AliMUONGeometryConstituent(
     200             :                      name, copyNo, translation, rotation, npar, param));
     201           0 : }
     202             : 
     203             : //______________________________________________________________________________
     204             : void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
     205             :                                   Int_t copyNo, 
     206             :                                   const TGeoCombiTrans& transform, 
     207             :                                   Int_t npar, Double_t* param)
     208             : {
     209             : /// Add the volume with the specified name and transformation
     210             : /// to the list of envelopes.
     211             : 
     212           0 :   fConstituents
     213           0 :     ->Add(new AliMUONGeometryConstituent(
     214             :                      name, copyNo, transform, npar, param));
     215           0 : }
     216             : 
     217             : //______________________________________________________________________________
     218             : void  AliMUONGeometryEnvelope::SetTranslation(const TGeoTranslation& translation)
     219             : {
     220             : /// Set the envelope position
     221             : 
     222        4038 :   fTransformation
     223        1346 :     ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
     224        1346 : }  
     225             : 
     226             : //______________________________________________________________________________
     227             : void  AliMUONGeometryEnvelope::SetRotation(const TGeoRotation& rotation)
     228             : {
     229             : /// Set the envelope rotation
     230             : 
     231        1668 :   TGeoRotation* rot = new TGeoRotation();
     232         834 :   rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix()));
     233             : 
     234         834 :   fTransformation->SetRotation(rot);
     235         834 : }  
     236             : 
     237             : //______________________________________________________________________________
     238             : void  AliMUONGeometryEnvelope::SetTransform(const TGeoCombiTrans& transform)
     239             : {
     240             : /// Set the envelope transformation
     241             : 
     242          18 :   fTransformation
     243           6 :     ->SetTranslation(const_cast<Double_t*>(transform.GetTranslation()));
     244             : 
     245           6 :   TGeoRotation* rot = new TGeoRotation();
     246           6 :   rot->SetMatrix(const_cast<Double_t*>(transform.GetRotationMatrix()));
     247             : 
     248           6 :   fTransformation->SetRotation(rot);
     249           6 : }  

Generated by: LCOV version 1.11