AliRoot Core  v5-06-30 (35d6c57)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONSurveyChamber.cxx
Go to the documentation of this file.
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 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
24 
25 
26 #include <TClonesArray.h>
27 #include <TObjString.h>
28 #include <TString.h>
29 #include <TH2.h>
30 
31 #include "AliLog.h"
32 #include "AliSurveyObj.h"
33 #include "AliSurveyPoint.h"
34 
35 #include "AliMUONSurveyChamber.h"
36 #include "AliMUONSurveyDetElem.h"
37 
41 
43  : AliMUONSurveyObj()
44  , fChamberId(lChamberId)
45  , fNDetElem(0)
46  , fSurveyObj(0x0)
47  , fSurveyDetElem(0x0)
48 {
50  fSurveyObj = new AliSurveyObj();
51  fSurveyDetElem = new TClonesArray("AliMUONSurveyDetElem",4);
52 }
53 
56  if (fSurveyObj) delete fSurveyObj;
57  if (fSurveyDetElem) fSurveyDetElem->Delete();
58 }
59 
60 Int_t AliMUONSurveyChamber::AddSurveyDetElem(Int_t lDetElemId) {
62  if (!fSurveyDetElem) {
63  fSurveyDetElem = new TClonesArray("AliMUONSurveyDetElem",4);
64  fNDetElem=0;
65  }
66  new((*fSurveyDetElem)[fNDetElem++]) AliMUONSurveyDetElem(lDetElemId,this);
67 
68  return fNDetElem;
69 }
70 
73  if (lDetElemIndex<0||(lDetElemIndex>=fNDetElem)) {
74  return 0x0;
75  }
76  else {
77  return (AliMUONSurveyDetElem*)fSurveyDetElem->At(lDetElemIndex);
78  }
79 }
80 
81 Int_t AliMUONSurveyChamber::AddStickerTargets(TObjArray *pArray, TString stBaseName, Int_t lTargetMax) {
83  return AliMUONSurveyObj::AddStickerTargets(pArray, stBaseName, lTargetMax);
84 }
85 
86 Int_t AliMUONSurveyChamber::AddStickerTargets(TString stBaseName, Int_t lTargetMax) {
88  if (!fSurveyObj || !fSurveyObj->GetData()) {
89  AliError("Survey data is missing!");
90  return 0;
91  }
92  return AddStickerTargets(fSurveyObj->GetData(),stBaseName,lTargetMax);
93 }
94 
95 Int_t AliMUONSurveyChamber::AddGButtonTargets(TObjArray *pArray, TString stBaseName, Int_t lTargetMax) {
97  return AliMUONSurveyObj::AddGButtonTargets(pArray, stBaseName, lTargetMax);
98 }
99 
100 Int_t AliMUONSurveyChamber::AddGButtonTargets(TString stBaseName, Int_t lTargetMax) {
102  if (!fSurveyObj || !fSurveyObj->GetData()) {
103  AliError("Survey data is missing!");
104  return 0;
105  }
106  return AddGButtonTargets(fSurveyObj->GetData(),stBaseName,lTargetMax);
107 }
108 
109 void AliMUONSurveyChamber::SetLocalTransformation(TGeoCombiTrans *localTrf, Bool_t ownerLocalTrf) {
110  AliMUONSurveyObj::SetLocalTransformation(localTrf,ownerLocalTrf);
111  AliMUONSurveyObj::SetBaseTransformation(localTrf,ownerLocalTrf);
112 }
113 
116  printf("--> %d\n", fSurveyObj->GetEntries());
117 
118  printf("Title: \"%s\"\n", fSurveyObj->GetReportTitle().Data());
119  printf("Date: \"%s\"\n", fSurveyObj->GetReportDate().Data());
120  printf("Detector: \"%s\"\n", fSurveyObj->GetDetector().Data());
121  printf("URL: \"%s\"\n", fSurveyObj->GetURL().Data());
122  printf("Number: \"%d\"\n", fSurveyObj->GetReportNumber());
123  printf("Version: \"%d\"\n", fSurveyObj->GetReportVersion());
124  printf("Observations: \"%s\"\n", fSurveyObj->GetObservations().Data());
125  printf("Coordinate System: \"%s\"\n", fSurveyObj->GetCoordSys().Data());
126  printf("Measurement Units: \"%s\"\n", fSurveyObj->GetUnits().Data());
127  printf("Nr Columns: \"%d\"\n", fSurveyObj->GetNrColumns());
128 
129  TObjArray *colNames = fSurveyObj->GetColumnNames();
130  for (Int_t i = 0; i < colNames->GetEntries(); ++i)
131  printf(" Column %d --> \"%s\"\n", i, ((TObjString *) colNames->At(i))->GetString().Data());
132 
133  // Get Array of surveyed points
134  printf("Points:\n");
135  TObjArray *points = fSurveyObj->GetData();
136 
137  for (Int_t i = 0; i < points->GetEntries(); ++i)
138  printf(" Point %d --> \"%s\" %s \n", i, ((AliSurveyPoint *) points->At(i))->GetPointName().Data(), points->At(i)->GetName());
139 
140 }
141 
142 void AliMUONSurveyChamber::FillCPSTHistograms(TString baseNameC, TH2 *hCPSTc, TString baseNameA, TH2 *hCPSTa) {
144  if(baseNameC.IsNull()||!hCPSTc){
145  AliError("Need base name for points on side C and/or a histogram for them!");
146  return;
147  }
148  AliMUONSurveyObj::FillSTHistograms(baseNameC,hCPSTc,baseNameA,hCPSTa);
149 }
150 
151 void AliMUONSurveyChamber::FillDESTHistograms(TString baseNameC, TH2 *hDESTc, TString baseNameA, TH2 *hDESTa) {
153  for (Int_t iDE=0; iDE<GetNDetElem(); iDE++){
154  GetDetElem(iDE)->FillSTHistograms(baseNameC,hDESTc,baseNameA,hDESTa);
155  }
156 }
157 
160  Double_t alignResX = 0.;
161  for (int iDE=0; iDE<GetNDetElem(); iDE++){
162  alignResX += GetDetElem(iDE)->GetAlignResX();
163  }
164  if (GetNDetElem()==0){
165  AliError("This Chamber has 0 detection elements!");
166  return 0.;
167  }
168  return alignResX/GetNDetElem();
169 }
170 
173  Double_t alignResY = 0.;
174  for (int iDE=0; iDE<GetNDetElem(); iDE++){
175  alignResY += GetDetElem(iDE)->GetAlignResY();
176  }
177  if (GetNDetElem()==0){
178  AliError("This Chamber has 0 detection elements!");
179  return 0.;
180  }
181  return alignResY/GetNDetElem();
182 }
void FillCPSTHistograms(TString baseNameC, TH2 *hCPSTc, TString baseNameA="", TH2 *hCPSTa=0)
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
virtual Int_t AddGButtonTargets(TObjArray *pArray, TString btBaseName, Int_t lTargetMax=9)
void FillSTHistograms(TString baseNameC, TH2 *hSTc, TString baseNameA="", TH2 *hSTa=0)
#define TObjArray
Int_t fNDetElem
Number of detection elements.
virtual void SetLocalTransformation(TGeoCombiTrans *localTrf, Bool_t ownerLocalTrf=kFALSE)
Set local transformation of geometrical element.
Int_t AddSurveyDetElem(Int_t lDetElemId)
Class for survey of detection elements of the muon spectrometer.
virtual Int_t AddStickerTargets(TString stBaseName, Int_t lTargetMax=9)
To be implemented in a concrete Chamber or DetElem class.
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
void FillDESTHistograms(TString baseNameC, TH2 *hCPSTc, TString baseNameA="", TH2 *hCPSTa=0)
Class for survey of chambers (frames) of the muon spectrometer.
void SetBaseTransformation(TGeoCombiTrans *baseTrf, Bool_t ownerBaseTrf=kFALSE)
Set transformation of geoemtrical element.
virtual Int_t AddStickerTargets(TObjArray *pArray, TString stBaseName, Int_t lTargetMax=9)
TClonesArray * fSurveyDetElem
Array of AliMUONSurveyDetElem.
Int_t GetNDetElem() const
Returns the number od detection elements of the chamber.
AliMUONSurveyDetElem * GetDetElem(Int_t lDetElemIndex)
virtual Int_t AddGButtonTargets(TString btBaseName, Int_t lTargetMax=9)
To be implemented in a concrete Chamber or DetElem class.
virtual void SetLocalTransformation(TGeoCombiTrans *localTrf, Bool_t ownerLocalTrf=kFALSE)
Set local transformation of geometrical element.
AliSurveyObj * fSurveyObj
Survey object containing the measurment.
Base class for survey of muon spectrometer.