]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSurveyChamber.cxx
Adding the array of the recosntruction parameters (Marian)
[u/mrichter/AliRoot.git] / MUON / AliMUONSurveyChamber.cxx
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 //-----------------------------------------------------------------------------
17 /// \class AliMUONSurveyChamber
18 /// Class for the survey processing of the ALICE DiMuon spectrometer 
19 ///
20 /// This object provides the methods specific to the chambers (frames)
21 ///
22 /// \author Javier Castillo
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
38 /// \cond CLASSIMP
39 ClassImp(AliMUONSurveyChamber)
40 /// \endcond
41
42 AliMUONSurveyChamber::AliMUONSurveyChamber(Int_t lChamberId) 
43   : AliMUONSurveyObj() /// Constructor with chamber id
44   , fChamberId(lChamberId)
45   , fNDetElem(0)
46   , fSurveyObj(0x0)
47   , fSurveyDetElem(0x0)
48 {
49   fSurveyObj = new AliSurveyObj();
50   fSurveyDetElem = new TClonesArray("AliMUONSurveyDetElem",4);
51 }
52
53 AliMUONSurveyChamber::~AliMUONSurveyChamber() {
54   /// Destructor
55   if (fSurveyObj) delete fSurveyObj;
56   if (fSurveyDetElem) fSurveyDetElem->Delete();
57 }
58
59 Int_t AliMUONSurveyChamber::AddSurveyDetElem(Int_t lDetElemId) {
60   
61   if (!fSurveyDetElem) {
62     fSurveyDetElem = new TClonesArray("AliMUONSurveyDetElem",4);
63     fNDetElem=0;
64   }
65   new((*fSurveyDetElem)[fNDetElem++]) AliMUONSurveyDetElem(lDetElemId,this);
66
67   return fNDetElem;
68 }
69
70 AliMUONSurveyDetElem* AliMUONSurveyChamber::GetDetElem(Int_t lDetElemIndex) {
71   if (lDetElemIndex<0||(lDetElemIndex>=fNDetElem)) {
72     return 0x0;
73   }
74   else {
75     return (AliMUONSurveyDetElem*)fSurveyDetElem->At(lDetElemIndex);
76   }
77 }
78
79 Int_t AliMUONSurveyChamber::AddStickerTargets(TObjArray *pArray, TString stBaseName, Int_t lTargetMax) {
80   return AliMUONSurveyObj::AddStickerTargets(pArray, stBaseName, lTargetMax);
81 }
82
83 Int_t AliMUONSurveyChamber::AddStickerTargets(TString stBaseName, Int_t lTargetMax) {
84   if (!fSurveyObj || !fSurveyObj->GetData()) {
85     AliError("Survey data is missing!");
86     return 0;    
87   }
88   return AddStickerTargets(fSurveyObj->GetData(),stBaseName,lTargetMax);
89 }
90
91 Int_t AliMUONSurveyChamber::AddGButtonTargets(TObjArray *pArray, TString stBaseName, Int_t lTargetMax) {
92   return AliMUONSurveyObj::AddGButtonTargets(pArray, stBaseName, lTargetMax);
93 }
94
95 Int_t AliMUONSurveyChamber::AddGButtonTargets(TString stBaseName, Int_t lTargetMax) {
96   if (!fSurveyObj || !fSurveyObj->GetData()) {
97     AliError("Survey data is missing!");
98     return 0;    
99   }
100   return AddGButtonTargets(fSurveyObj->GetData(),stBaseName,lTargetMax);
101 }
102
103 void AliMUONSurveyChamber::SetLocalTransformation(TGeoCombiTrans *localTrf, Bool_t ownerLocalTrf) {
104   AliMUONSurveyObj::SetLocalTransformation(localTrf,ownerLocalTrf);
105   AliMUONSurveyObj::SetBaseTransformation(localTrf,ownerLocalTrf);
106 }
107
108 void AliMUONSurveyChamber::PrintSurveyReport() {
109
110   printf("--> %d\n", fSurveyObj->GetEntries());
111
112   printf("Title: \"%s\"\n", fSurveyObj->GetReportTitle().Data());
113   printf("Date: \"%s\"\n", fSurveyObj->GetReportDate().Data());
114   printf("Detector: \"%s\"\n", fSurveyObj->GetDetector().Data());
115   printf("URL: \"%s\"\n", fSurveyObj->GetURL().Data());
116   printf("Number: \"%d\"\n", fSurveyObj->GetReportNumber());
117   printf("Version: \"%d\"\n", fSurveyObj->GetReportVersion());
118   printf("Observations: \"%s\"\n", fSurveyObj->GetObservations().Data());
119   printf("Coordinate System: \"%s\"\n", fSurveyObj->GetCoordSys().Data());
120   printf("Measurement Units: \"%s\"\n", fSurveyObj->GetUnits().Data());
121   printf("Nr Columns: \"%d\"\n", fSurveyObj->GetNrColumns());
122
123   TObjArray *colNames = fSurveyObj->GetColumnNames();
124   for (Int_t i = 0; i < colNames->GetEntries(); ++i)
125     printf("  Column %d --> \"%s\"\n", i, ((TObjString *) colNames->At(i))->GetString().Data());
126
127   // Get Array of surveyed points
128   printf("Points:\n");
129   TObjArray *points = fSurveyObj->GetData();
130   
131   for (Int_t i = 0; i < points->GetEntries(); ++i)
132     printf("  Point %d --> \"%s\"  %s \n", i, ((AliSurveyPoint *) points->At(i))->GetPointName().Data(), points->At(i)->GetName());
133
134 }
135
136 void AliMUONSurveyChamber::FillCPSTHistograms(TString baseNameC, TH2 *hCPSTc, TString baseNameA, TH2 *hCPSTa) {
137   if(baseNameC.IsNull()||!hCPSTc){
138     AliError("Need base name for points on side C and/or a histogram for them!");
139     return;
140   }
141   AliMUONSurveyObj::FillSTHistograms(baseNameC,hCPSTc,baseNameA,hCPSTa);
142 }
143
144 void AliMUONSurveyChamber::FillDESTHistograms(TString baseNameC, TH2 *hDESTc, TString baseNameA, TH2 *hDESTa) {
145   for (Int_t iDE=0; iDE<GetNDetElem(); iDE++){
146     GetDetElem(iDE)->FillSTHistograms(baseNameC,hDESTc,baseNameA,hDESTa);
147   }
148 }
149
150 Double_t AliMUONSurveyChamber::GetMeanDetElemAlignResX() {
151   Double_t alignResX = 0.;
152   for (int iDE=0; iDE<GetNDetElem(); iDE++){
153     alignResX += GetDetElem(iDE)->GetAlignResX();
154   }
155   if (GetNDetElem()==0){
156     AliError("This Chamber has 0 detection elements!");
157     return 0.;
158   }
159   return alignResX/GetNDetElem();
160 }
161
162 Double_t AliMUONSurveyChamber::GetMeanDetElemAlignResY() {
163   Double_t alignResY = 0.;
164   for (int iDE=0; iDE<GetNDetElem(); iDE++){
165     alignResY += GetDetElem(iDE)->GetAlignResY();
166   }
167   if (GetNDetElem()==0){
168     AliError("This Chamber has 0 detection elements!");
169     return 0.;
170   }
171   return alignResY/GetNDetElem();
172 }