ROOT logo
/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/
//-----------------------------------------------------------------------------
/// \class AliMUONSurveyDetElem
/// Class for the survey processing of the ALICE DiMuon spectrometer 
///
/// This object provides the methods specific to the detection elements
///
/// \author Javier Castillo
//-----------------------------------------------------------------------------

#include "TGeoMatrix.h"

#include "AliLog.h"
#include "AliSurveyObj.h"

#include "AliMUONSurveyChamber.h"
#include "AliMUONSurveyDetElem.h"

/// \cond CLASSIMP
ClassImp(AliMUONSurveyDetElem)
/// \endcond

AliMUONSurveyDetElem::AliMUONSurveyDetElem(Int_t lDetElemId) 
  : AliMUONSurveyObj() 
  , fDetElemId(lDetElemId)
  , fSurveyChamber(0x0)
{
/// Constructor with detection element id
}

AliMUONSurveyDetElem::AliMUONSurveyDetElem(Int_t lDetElemId, AliMUONSurveyChamber *lSurveyChamber) 
  : AliMUONSurveyObj() /// Constructor with mother chamber provided
  , fDetElemId(lDetElemId)
  , fSurveyChamber(lSurveyChamber)
{
/// Constructor with mother chamber provided
}

AliMUONSurveyDetElem::~AliMUONSurveyDetElem() {
  /// Destructor
}

Int_t AliMUONSurveyDetElem::AddStickerTargets(TObjArray *pArray, TString stBaseName, Int_t lTargetMax) {
  /// Add a maximum of lTargetMax sticker targets with stBaseName from pArray of targets 
  return AliMUONSurveyObj::AddStickerTargets(pArray, stBaseName, lTargetMax);
}

Int_t AliMUONSurveyDetElem::AddStickerTargets(TString stBaseName, Int_t lTargetMax) {
  /// Add a maximum of lTargetMax sticker targets with stBaseName from internal SurveyObj
  if (!fSurveyChamber) {
    AliError("Pointer to mother chamber has not been set!");
    return 0;
  }
  if (!fSurveyChamber->GetSurveyObj() || !fSurveyChamber->GetSurveyObj()->GetData()) {
    AliError("Survey data is missing!");
    return 0;    
  }
  return AddStickerTargets(fSurveyChamber->GetSurveyObj()->GetData(),stBaseName,lTargetMax);
}

Int_t AliMUONSurveyDetElem::AddGButtonTargets(TObjArray *pArray, TString stBaseName, Int_t lTargetMax) {
  /// Add a maximum of lTargetMax global button targets with stBaseName from pArray of targets 
  return AliMUONSurveyObj::AddGButtonTargets(pArray, stBaseName, lTargetMax);
}

Int_t AliMUONSurveyDetElem::AddGButtonTargets(TString stBaseName, Int_t lTargetMax) {
  /// Add a maximum of lTargetMax sticker targets with stBaseName from internal SurveyObj
  if (!fSurveyChamber) {
    AliError("Pointer to mother chamber has not been set!");
    return 0;
  }
  if (!fSurveyChamber->GetSurveyObj() || !fSurveyChamber->GetSurveyObj()->GetData()) {
    AliError("Survey data is missing!");
    return 0;    
  }
  return AddGButtonTargets(fSurveyChamber->GetSurveyObj()->GetData(),stBaseName,lTargetMax);
}

void AliMUONSurveyDetElem::SetLocalTransformation(TGeoCombiTrans *localTrf, Bool_t ownerLocalTrf) {
  /// Set the geometry transformation of this detection element
  AliMUONSurveyObj::SetLocalTransformation(localTrf,ownerLocalTrf);
  if (!fSurveyChamber) {
    AliWarning("Pointer to mother chamber has not been set!");
    AliMUONSurveyObj::SetBaseTransformation(localTrf,ownerLocalTrf);
  } else {
    if (fSurveyChamber->GetLocalTrf()){
      if (fSurveyChamber->GetAlignTrf()){
	AliMUONSurveyObj::SetBaseTransformation(new TGeoCombiTrans((*(fSurveyChamber->GetLocalTrf()))*(*(fSurveyChamber->GetAlignTrf()))*(*localTrf)),kTRUE);
      } else {
	AliWarning("Mother chamber has not been aligned yet!");
	AliMUONSurveyObj::SetBaseTransformation(new TGeoCombiTrans((*(fSurveyChamber->GetLocalTrf()))*(*localTrf)),kTRUE);
      }
    } else {
      AliWarning("Mother chamber has no local transformation");
      AliMUONSurveyObj::SetBaseTransformation(localTrf,ownerLocalTrf);      
    }
  }
}

void AliMUONSurveyDetElem::PrintLocalTrf() {
  /// Print the local transformation
  printf("DetElem%d Th",fDetElemId);
  AliMUONSurveyObj::PrintLocalTrf();
}

void AliMUONSurveyDetElem::PrintAlignTrf() {
  /// Print the alignment transformation
  printf("DetElem%d d",fDetElemId);
  AliMUONSurveyObj::PrintAlignTrf();
}
 AliMUONSurveyDetElem.cxx:1
 AliMUONSurveyDetElem.cxx:2
 AliMUONSurveyDetElem.cxx:3
 AliMUONSurveyDetElem.cxx:4
 AliMUONSurveyDetElem.cxx:5
 AliMUONSurveyDetElem.cxx:6
 AliMUONSurveyDetElem.cxx:7
 AliMUONSurveyDetElem.cxx:8
 AliMUONSurveyDetElem.cxx:9
 AliMUONSurveyDetElem.cxx:10
 AliMUONSurveyDetElem.cxx:11
 AliMUONSurveyDetElem.cxx:12
 AliMUONSurveyDetElem.cxx:13
 AliMUONSurveyDetElem.cxx:14
 AliMUONSurveyDetElem.cxx:15
 AliMUONSurveyDetElem.cxx:16
 AliMUONSurveyDetElem.cxx:17
 AliMUONSurveyDetElem.cxx:18
 AliMUONSurveyDetElem.cxx:19
 AliMUONSurveyDetElem.cxx:20
 AliMUONSurveyDetElem.cxx:21
 AliMUONSurveyDetElem.cxx:22
 AliMUONSurveyDetElem.cxx:23
 AliMUONSurveyDetElem.cxx:24
 AliMUONSurveyDetElem.cxx:25
 AliMUONSurveyDetElem.cxx:26
 AliMUONSurveyDetElem.cxx:27
 AliMUONSurveyDetElem.cxx:28
 AliMUONSurveyDetElem.cxx:29
 AliMUONSurveyDetElem.cxx:30
 AliMUONSurveyDetElem.cxx:31
 AliMUONSurveyDetElem.cxx:32
 AliMUONSurveyDetElem.cxx:33
 AliMUONSurveyDetElem.cxx:34
 AliMUONSurveyDetElem.cxx:35
 AliMUONSurveyDetElem.cxx:36
 AliMUONSurveyDetElem.cxx:37
 AliMUONSurveyDetElem.cxx:38
 AliMUONSurveyDetElem.cxx:39
 AliMUONSurveyDetElem.cxx:40
 AliMUONSurveyDetElem.cxx:41
 AliMUONSurveyDetElem.cxx:42
 AliMUONSurveyDetElem.cxx:43
 AliMUONSurveyDetElem.cxx:44
 AliMUONSurveyDetElem.cxx:45
 AliMUONSurveyDetElem.cxx:46
 AliMUONSurveyDetElem.cxx:47
 AliMUONSurveyDetElem.cxx:48
 AliMUONSurveyDetElem.cxx:49
 AliMUONSurveyDetElem.cxx:50
 AliMUONSurveyDetElem.cxx:51
 AliMUONSurveyDetElem.cxx:52
 AliMUONSurveyDetElem.cxx:53
 AliMUONSurveyDetElem.cxx:54
 AliMUONSurveyDetElem.cxx:55
 AliMUONSurveyDetElem.cxx:56
 AliMUONSurveyDetElem.cxx:57
 AliMUONSurveyDetElem.cxx:58
 AliMUONSurveyDetElem.cxx:59
 AliMUONSurveyDetElem.cxx:60
 AliMUONSurveyDetElem.cxx:61
 AliMUONSurveyDetElem.cxx:62
 AliMUONSurveyDetElem.cxx:63
 AliMUONSurveyDetElem.cxx:64
 AliMUONSurveyDetElem.cxx:65
 AliMUONSurveyDetElem.cxx:66
 AliMUONSurveyDetElem.cxx:67
 AliMUONSurveyDetElem.cxx:68
 AliMUONSurveyDetElem.cxx:69
 AliMUONSurveyDetElem.cxx:70
 AliMUONSurveyDetElem.cxx:71
 AliMUONSurveyDetElem.cxx:72
 AliMUONSurveyDetElem.cxx:73
 AliMUONSurveyDetElem.cxx:74
 AliMUONSurveyDetElem.cxx:75
 AliMUONSurveyDetElem.cxx:76
 AliMUONSurveyDetElem.cxx:77
 AliMUONSurveyDetElem.cxx:78
 AliMUONSurveyDetElem.cxx:79
 AliMUONSurveyDetElem.cxx:80
 AliMUONSurveyDetElem.cxx:81
 AliMUONSurveyDetElem.cxx:82
 AliMUONSurveyDetElem.cxx:83
 AliMUONSurveyDetElem.cxx:84
 AliMUONSurveyDetElem.cxx:85
 AliMUONSurveyDetElem.cxx:86
 AliMUONSurveyDetElem.cxx:87
 AliMUONSurveyDetElem.cxx:88
 AliMUONSurveyDetElem.cxx:89
 AliMUONSurveyDetElem.cxx:90
 AliMUONSurveyDetElem.cxx:91
 AliMUONSurveyDetElem.cxx:92
 AliMUONSurveyDetElem.cxx:93
 AliMUONSurveyDetElem.cxx:94
 AliMUONSurveyDetElem.cxx:95
 AliMUONSurveyDetElem.cxx:96
 AliMUONSurveyDetElem.cxx:97
 AliMUONSurveyDetElem.cxx:98
 AliMUONSurveyDetElem.cxx:99
 AliMUONSurveyDetElem.cxx:100
 AliMUONSurveyDetElem.cxx:101
 AliMUONSurveyDetElem.cxx:102
 AliMUONSurveyDetElem.cxx:103
 AliMUONSurveyDetElem.cxx:104
 AliMUONSurveyDetElem.cxx:105
 AliMUONSurveyDetElem.cxx:106
 AliMUONSurveyDetElem.cxx:107
 AliMUONSurveyDetElem.cxx:108
 AliMUONSurveyDetElem.cxx:109
 AliMUONSurveyDetElem.cxx:110
 AliMUONSurveyDetElem.cxx:111
 AliMUONSurveyDetElem.cxx:112
 AliMUONSurveyDetElem.cxx:113
 AliMUONSurveyDetElem.cxx:114
 AliMUONSurveyDetElem.cxx:115
 AliMUONSurveyDetElem.cxx:116
 AliMUONSurveyDetElem.cxx:117
 AliMUONSurveyDetElem.cxx:118
 AliMUONSurveyDetElem.cxx:119
 AliMUONSurveyDetElem.cxx:120
 AliMUONSurveyDetElem.cxx:121
 AliMUONSurveyDetElem.cxx:122
 AliMUONSurveyDetElem.cxx:123