1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //-----------------------------------------------------------------------------
17 /// \class AliMUONSurveyChamber
18 /// Class for the survey processing of the ALICE DiMuon spectrometer
20 /// This object provides the methods specific to the chambers (frames)
22 /// \author Javier Castillo
23 //-----------------------------------------------------------------------------
26 #include <TClonesArray.h>
27 #include <TObjString.h>
32 #include "AliSurveyObj.h"
33 #include "AliSurveyPoint.h"
35 #include "AliMUONSurveyChamber.h"
36 #include "AliMUONSurveyDetElem.h"
39 ClassImp(AliMUONSurveyChamber)
42 AliMUONSurveyChamber::AliMUONSurveyChamber(Int_t lChamberId)
43 : AliMUONSurveyObj() /// Constructor with chamber id
44 , fChamberId(lChamberId)
49 fSurveyObj = new AliSurveyObj();
50 fSurveyDetElem = new TClonesArray("AliMUONSurveyDetElem",4);
53 AliMUONSurveyChamber::~AliMUONSurveyChamber() {
55 if (fSurveyObj) delete fSurveyObj;
56 if (fSurveyDetElem) fSurveyDetElem->Delete();
59 Int_t AliMUONSurveyChamber::AddSurveyDetElem(Int_t lDetElemId) {
60 /// Add a surveyed detection element to this chamber
61 if (!fSurveyDetElem) {
62 fSurveyDetElem = new TClonesArray("AliMUONSurveyDetElem",4);
65 new((*fSurveyDetElem)[fNDetElem++]) AliMUONSurveyDetElem(lDetElemId,this);
70 AliMUONSurveyDetElem* AliMUONSurveyChamber::GetDetElem(Int_t lDetElemIndex) {
71 /// Return AluMUONSurveyDetElem at lDetElemIndex
72 if (lDetElemIndex<0||(lDetElemIndex>=fNDetElem)) {
76 return (AliMUONSurveyDetElem*)fSurveyDetElem->At(lDetElemIndex);
80 Int_t AliMUONSurveyChamber::AddStickerTargets(TObjArray *pArray, TString stBaseName, Int_t lTargetMax) {
81 return AliMUONSurveyObj::AddStickerTargets(pArray, stBaseName, lTargetMax);
84 Int_t AliMUONSurveyChamber::AddStickerTargets(TString stBaseName, Int_t lTargetMax) {
85 /// Add a maximum of lTargetMax sticker targets with stBaseName from internal SurveyObj
86 if (!fSurveyObj || !fSurveyObj->GetData()) {
87 AliError("Survey data is missing!");
90 return AddStickerTargets(fSurveyObj->GetData(),stBaseName,lTargetMax);
93 Int_t AliMUONSurveyChamber::AddGButtonTargets(TObjArray *pArray, TString stBaseName, Int_t lTargetMax) {
94 return AliMUONSurveyObj::AddGButtonTargets(pArray, stBaseName, lTargetMax);
97 Int_t AliMUONSurveyChamber::AddGButtonTargets(TString stBaseName, Int_t lTargetMax) {
98 /// Add a maximum of lTargetMax global button targets with stBaseName from internal SurveyObj
99 if (!fSurveyObj || !fSurveyObj->GetData()) {
100 AliError("Survey data is missing!");
103 return AddGButtonTargets(fSurveyObj->GetData(),stBaseName,lTargetMax);
106 void AliMUONSurveyChamber::SetLocalTransformation(TGeoCombiTrans *localTrf, Bool_t ownerLocalTrf) {
107 AliMUONSurveyObj::SetLocalTransformation(localTrf,ownerLocalTrf);
108 AliMUONSurveyObj::SetBaseTransformation(localTrf,ownerLocalTrf);
111 void AliMUONSurveyChamber::PrintSurveyReport() {
112 /// Print the survey report information and data
113 printf("--> %d\n", fSurveyObj->GetEntries());
115 printf("Title: \"%s\"\n", fSurveyObj->GetReportTitle().Data());
116 printf("Date: \"%s\"\n", fSurveyObj->GetReportDate().Data());
117 printf("Detector: \"%s\"\n", fSurveyObj->GetDetector().Data());
118 printf("URL: \"%s\"\n", fSurveyObj->GetURL().Data());
119 printf("Number: \"%d\"\n", fSurveyObj->GetReportNumber());
120 printf("Version: \"%d\"\n", fSurveyObj->GetReportVersion());
121 printf("Observations: \"%s\"\n", fSurveyObj->GetObservations().Data());
122 printf("Coordinate System: \"%s\"\n", fSurveyObj->GetCoordSys().Data());
123 printf("Measurement Units: \"%s\"\n", fSurveyObj->GetUnits().Data());
124 printf("Nr Columns: \"%d\"\n", fSurveyObj->GetNrColumns());
126 TObjArray *colNames = fSurveyObj->GetColumnNames();
127 for (Int_t i = 0; i < colNames->GetEntries(); ++i)
128 printf(" Column %d --> \"%s\"\n", i, ((TObjString *) colNames->At(i))->GetString().Data());
130 // Get Array of surveyed points
132 TObjArray *points = fSurveyObj->GetData();
134 for (Int_t i = 0; i < points->GetEntries(); ++i)
135 printf(" Point %d --> \"%s\" %s \n", i, ((AliSurveyPoint *) points->At(i))->GetPointName().Data(), points->At(i)->GetName());
139 void AliMUONSurveyChamber::FillCPSTHistograms(TString baseNameC, TH2 *hCPSTc, TString baseNameA, TH2 *hCPSTa) {
140 /// Fill Chamber Plane Sticker Targest histograms for monitoring
141 if(baseNameC.IsNull()||!hCPSTc){
142 AliError("Need base name for points on side C and/or a histogram for them!");
145 AliMUONSurveyObj::FillSTHistograms(baseNameC,hCPSTc,baseNameA,hCPSTa);
148 void AliMUONSurveyChamber::FillDESTHistograms(TString baseNameC, TH2 *hDESTc, TString baseNameA, TH2 *hDESTa) {
149 /// Fill Detection Element Sticker Targest histograms for monitoring
150 for (Int_t iDE=0; iDE<GetNDetElem(); iDE++){
151 GetDetElem(iDE)->FillSTHistograms(baseNameC,hDESTc,baseNameA,hDESTa);
155 Double_t AliMUONSurveyChamber::GetMeanDetElemAlignResX() {
156 /// Return the average uncertainty of the det. elem. translations along x parameter
157 Double_t alignResX = 0.;
158 for (int iDE=0; iDE<GetNDetElem(); iDE++){
159 alignResX += GetDetElem(iDE)->GetAlignResX();
161 if (GetNDetElem()==0){
162 AliError("This Chamber has 0 detection elements!");
165 return alignResX/GetNDetElem();
168 Double_t AliMUONSurveyChamber::GetMeanDetElemAlignResY() {
169 /// Return the average uncertainty of the det. elem. translations along y parameter
170 Double_t alignResY = 0.;
171 for (int iDE=0; iDE<GetNDetElem(); iDE++){
172 alignResY += GetDetElem(iDE)->GetAlignResY();
174 if (GetNDetElem()==0){
175 AliError("This Chamber has 0 detection elements!");
178 return alignResY/GetNDetElem();