/* History of cvs commits:
*
* $Log$
+ * Revision 1.6 2007/08/28 13:12:18 hristov
+ * AliAlignObjAngles becomes AliAlignObjParams (Raffaele)
+ *
+ * Revision 1.5 2007/07/10 12:41:38 kharlov
+ * Added a new class AliPHOSSurvet1 which read survey data from EDMS files
+ *
+ * Revision 1.4 2007/05/17 17:34:54 kharlov
+ * Merging differences if v1.2 and 1.3
+ *
+ * Revision 1.3 2007/05/17 17:13:32 kharlov
+ * Coding convensions satisfied (T.Pocheptsov)
+ *
+ * Revision 1.1 2007/04/19 15:47:20 kharlov
+ * Add misalignment of strip units with AliPHOSSurvey class
+ *
*/
// Objects of this class read txt file with survey (photogrammetry) data
-// and convert the data into AliAlignObjAngles of alignable PHOS volumes.
+// and convert the data into AliAlignObjParams of alignable PHOS volumes.
// It can be used as a base class, you need to override GetStripTransformation.
// AliPHOSSurvey inherits TObject only to use AliLog "functions".
// Author: Timur Pocheptsov (JINR)
#include <TString.h>
#include <TMath.h>
+#include "AliSurveyObj.h"
+
#include "AliPHOSEMCAGeometry.h"
-#include "AliAlignObjAngles.h"
+#include "AliAlignObjParams.h"
#include "AliPHOSGeometry.h"
#include "AliPHOSSurvey.h"
#include "AliLog.h"
//____________________________________________________________________________
AliPHOSSurvey::AliPHOSSurvey()
- : fStripData()
+ : fStrNum(0),
+ fStripData(0)
{
//Default constructor.
}
namespace {
- struct Strip_t {
- Double_t fX1;
- Double_t fZ1;
- Double_t fX2;
- Double_t fZ2;
+ struct AliPHOSStripCoords {
+ Double_t fX1; //x coordinate of the first strip point
+ Double_t fZ1; //z coordinate of the first strip point
+ Double_t fX2; //x coordinate of the second strip point
+ Double_t fZ2; //z coordinate of the second strip point
};
}
//____________________________________________________________________________
AliPHOSSurvey::AliPHOSSurvey(const TString &txtFileName)
- : fStripData()
+ : fStrNum(0),
+ fStripData(0)
{
//Read survey data from txt file.
const AliPHOSGeometry *phosGeom = AliPHOSGeometry::GetInstance("IHEP", "IHEP");
return;
}
- AliPHOSEMCAGeometry * emcaGeom = phosGeom->GetEMCAGeometry();
- const Int_t strNum = emcaGeom->GetNStripX() * emcaGeom->GetNStripZ();
- const Float_t *strip = emcaGeom->GetStripHalfSize();
- const Float_t *cell = emcaGeom->GetSteelCellHalfSize();
-
- std::vector<Strip_t> idealStrips(strNum);
- for (Int_t ix = 0, stripNumber = 0; ix < emcaGeom->GetNStripX(); ++ix) {
- for (Int_t iz = 0; iz < emcaGeom->GetNStripZ(); ++iz) {
- Strip_t &str = idealStrips[stripNumber++];
- str.fX1 = ix * 2 * strip[0];
- str.fX2 = str.fX1 + 14 * cell[0];
- str.fZ1 = iz * 2 * strip[2];
- str.fZ2 = str.fZ1 + 2 * cell[2];
- }
- }
+ AliPHOSEMCAGeometry * emcaGeom = phosGeom->GetEMCAGeometry();
+ fStrNum = emcaGeom->GetNStripX() * emcaGeom->GetNStripZ();
Int_t dummyInt = 0;
Double_t dummyY = 0.;
- std::vector<Double_t> xReal(strNum * 2), zReal(strNum * 2);
- for (Int_t i = 0; i < strNum * 2; ++i) {
+ Double_t *xReal = new Double_t[fStrNum * 2];//2
+ Double_t *zReal = new Double_t[fStrNum * 2];//3
+
+ for (Int_t i = 0; i < fStrNum * 2; ++i) {
+ xReal[i] = 0.;
+ zReal[i] = 0.;
+ }
+
+ for (Int_t i = 0; i < fStrNum * 2; ++i) {
if (!inputFile) {
AliError("Error while reading input file.");
+ delete [] xReal;
+ delete [] zReal;
return;
}
inputFile>>dummyInt>>xReal[i]>>dummyY>>zReal[i];
zReal[i] *= 0.1;
}
- std::vector<Strip_t> realStrips(strNum);
- for (Int_t j = 0, stripNumber = 0; j < emcaGeom->GetNStripX() * 2; j += 2) {
- for (Int_t i = 0; i < emcaGeom->GetNStripZ(); ++i) {
- Strip_t &str = realStrips[stripNumber++];
- str.fX1 = xReal[i + j * emcaGeom->GetNStripZ()];
- str.fZ1 = zReal[i + j * emcaGeom->GetNStripZ()];
- str.fX2 = xReal[i + (j + 1) * emcaGeom->GetNStripZ()];
- str.fZ2 = zReal[i + (j + 1) * emcaGeom->GetNStripZ()];
- }
- }
+ InitStripData(xReal, zReal);
- fStripData.resize(strNum);
- for (Int_t i = 0; i < strNum; ++i) {
- const Strip_t &real = realStrips[i];
- const Strip_t &ideal = idealStrips[i];
- Transformation_t &t = fStripData[i];
- t.fTheta = TMath::ATan((real.fZ2 - real.fZ1) / (real.fX2 - real.fX1)) -
- TMath::ATan((ideal.fZ2 - ideal.fZ1) / (ideal.fX2 - ideal.fX1));
- t.fTheta *= TMath::RadToDeg();
- t.fXShift = (real.fX1 + real.fX2) / 2 - (ideal.fX1 + ideal.fX2) / 2;
- t.fZShift = (real.fZ1 + real.fZ2) / 2 - (ideal.fZ1 + ideal.fZ2) / 2;
- t.fYShift = 0., t.fPsi = 0., t.fPhi = 0.;
- }
+ delete [] zReal;
+ delete [] xReal;
+}
+
+//____________________________________________________________________________
+AliPHOSSurvey::~AliPHOSSurvey()
+{
+ delete [] fStripData;
}
//____________________________________________________________________________
-void AliPHOSSurvey::CreateAliAlignObjAngles(TClonesArray &array)
+void AliPHOSSurvey::CreateAliAlignObjParams(TClonesArray &array)
{
- //Create AliAlignObjAngles.
+ //Create AliAlignObjParams.
const AliPHOSGeometry * phosGeom = AliPHOSGeometry::GetInstance("IHEP", "IHEP");
if (!phosGeom) {
AliError("Cannot obtain AliPHOSGeometry instance.");
AliPHOSEMCAGeometry * emcaGeom = phosGeom->GetEMCAGeometry();
Int_t arrayInd = array.GetEntries(), iIndex = 0;
- AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
- UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
+ AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
+ UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
for (Int_t module = 1; module <= phosGeom->GetNModules(); ++module) {
for (Int_t i = 0, stripNum = 0; i < emcaGeom->GetNStripX(); ++i) {
for (Int_t j = 0; j < emcaGeom->GetNStripZ(); ++j) {
TString stripName(TString::Format("PHOS/Module%d/Strip_%d_%d", module, i, j));
- Transformation_t t(GetStripTransformation(stripNum++, module));
+ AliPHOSStripDelta t(GetStripTransformation(stripNum++, module));
new(array[arrayInd])
- AliAlignObjAngles(
+ AliAlignObjParams(
stripName.Data(), volid,
t.fXShift, t.fYShift, t.fZShift,
-t.fPsi, -t.fTheta, -t.fPhi,
- kFALSE
+ false
);
++arrayInd;
}
//Create null shifts and rotations.
const AliPHOSEMCAGeometry * emcaGeom = phosGeom->GetEMCAGeometry();
Int_t arrayInd = array.GetEntries(), iIndex = 0;
- AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
- UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
+ AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
+ UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
for (Int_t module = 1; module <= phosGeom->GetNModules(); ++module)
for (Int_t i = 0; i < emcaGeom->GetNStripX(); ++i)
for (Int_t j = 0; j < emcaGeom->GetNStripZ(); ++j) {
TString stripName(TString::Format("PHOS/Module%d/Strip_%d_%d", module, i, j));
- new(array[arrayInd]) AliAlignObjAngles(stripName.Data(), volid, 0., 0., 0., 0., 0., 0., kTRUE);
+ new(array[arrayInd]) AliAlignObjParams(stripName.Data(), volid, 0., 0., 0., 0., 0., 0., true);
++arrayInd;
}
}
//____________________________________________________________________________
-AliPHOSSurvey::Transformation_t AliPHOSSurvey::GetStripTransformation(Int_t stripIndex, Int_t module)const
+AliPHOSSurvey::AliPHOSStripDelta AliPHOSSurvey::GetStripTransformation(Int_t stripIndex, Int_t module)const
{
//Strip 'stripIndex' transformation.
- const Transformation_t t = {0., 0., 0., 0., 0., 0.};
- if (module != 3 || !fStripData.size())
+ AliPHOSStripDelta t = {0., 0., 0., 0., 0., 0.};
+ if (module != 3 || !fStripData)
return t;
return fStripData[stripIndex];
}
+
+//____________________________________________________________________________
+void AliPHOSSurvey::InitStripData(const Double_t *xReal, const Double_t *zReal)
+{
+ const AliPHOSGeometry *phosGeom = AliPHOSGeometry::GetInstance("IHEP", "IHEP");
+ AliPHOSEMCAGeometry * emcaGeom = phosGeom->GetEMCAGeometry();
+ const Float_t *strip = emcaGeom->GetStripHalfSize();
+ const Float_t *cell = emcaGeom->GetAirCellHalfSize();
+
+ AliPHOSStripCoords *idealStrips = new AliPHOSStripCoords[fStrNum];//1
+ for (Int_t ix = 0, stripNumber = 0; ix < emcaGeom->GetNStripX(); ++ix) {
+ for (Int_t iz = 0; iz < emcaGeom->GetNStripZ(); ++iz) {
+ AliPHOSStripCoords &str = idealStrips[stripNumber++];
+ str.fX1 = ix * 2 * strip[0];
+ str.fX2 = str.fX1 + 14 * cell[0];
+ str.fZ1 = iz * 2 * strip[2];
+ str.fZ2 = str.fZ1 + 2 * cell[2];
+ }
+ }
+
+ AliPHOSStripCoords *realStrips = new AliPHOSStripCoords[fStrNum];//4
+ for (Int_t j = 0, stripNumber = 0; j < emcaGeom->GetNStripX() * 2; j += 2) {
+ for (Int_t i = 0; i < emcaGeom->GetNStripZ(); ++i) {
+ AliPHOSStripCoords &str = realStrips[stripNumber++];
+ str.fX1 = xReal[i + j * emcaGeom->GetNStripZ()];
+ str.fZ1 = zReal[i + j * emcaGeom->GetNStripZ()];
+ str.fX2 = xReal[i + (j + 1) * emcaGeom->GetNStripZ()];
+ str.fZ2 = zReal[i + (j + 1) * emcaGeom->GetNStripZ()];
+ }
+ }
+
+ fStripData = new AliPHOSStripDelta[fStrNum];
+
+ for (Int_t i = 0; i < fStrNum; ++i) {
+ const AliPHOSStripCoords &real = realStrips[i];
+ const AliPHOSStripCoords &ideal = idealStrips[i];
+ AliPHOSStripDelta &t = fStripData[i];
+ t.fTheta = TMath::ATan((real.fZ2 - real.fZ1) / (real.fX2 - real.fX1)) -
+ TMath::ATan((ideal.fZ2 - ideal.fZ1) / (ideal.fX2 - ideal.fX1));
+ t.fTheta *= TMath::RadToDeg();
+ t.fXShift = (real.fX1 + real.fX2) / 2 - (ideal.fX1 + ideal.fX2) / 2;
+ t.fZShift = (real.fZ1 + real.fZ2) / 2 - (ideal.fZ1 + ideal.fZ2) / 2;
+ t.fYShift = 0., t.fPsi = 0., t.fPhi = 0.;
+ }
+
+ delete [] realStrips;
+ delete [] idealStrips;
+}