]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New AliITSMisAligner class. It replaces MakeITS...MisAlignment.C macros and class...
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Apr 2009 16:26:53 +0000 (16:26 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Apr 2009 16:26:53 +0000 (16:26 +0000)
ITS/AliITSMisAligner.cxx [new file with mode: 0644]
ITS/AliITSMisAligner.h [new file with mode: 0644]
ITS/AliITSMisalignMaker.cxx [deleted file]
ITS/AliITSMisalignMaker.h [deleted file]
ITS/CMake_libITSbase.txt
ITS/ITSbaseLinkDef.h
ITS/MakeITSFullMisAlignment.C [deleted file]
ITS/MakeITSResMisAlignment.C [deleted file]
ITS/MakeITSZeroMisAlignment.C [deleted file]
ITS/libITSbase.pkg

diff --git a/ITS/AliITSMisAligner.cxx b/ITS/AliITSMisAligner.cxx
new file mode 100644 (file)
index 0000000..0f7ab7a
--- /dev/null
@@ -0,0 +1,1074 @@
+/**************************************************************************
+ * Copyright(c) 2007-2010, 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//========================================================================
+//
+// This class is a helper, producing ITS aligmnent objects.
+// It provides also some useful functions
+// See the parameters of the misalignment at the end of this script.
+//
+// Main author: L. Gaudichet
+// Contact: andrea.dainese@lnl.infn.it
+//
+//========================================================================
+
+#include <TClonesArray.h>
+#include <TMath.h>
+#include <TClass.h>
+#include <TGeoManager.h>
+#include "AliLog.h"
+#include "AliAlignObjParams.h"
+#include "AliITSMisAligner.h"
+#include "AliITSSurveyToAlign.h"
+#include "AliMathBase.h"
+
+ClassImp(AliITSMisAligner)
+  
+const Int_t AliITSMisAligner::fgkNLadders[AliITSMisAligner::kNLayers] = {20,40,14,22,34,38};
+const Int_t AliITSMisAligner::fgkNDetectors[AliITSMisAligner::kNLayers] = {4,4,6,8,22,25};
+
+const Double_t kRadToDeg = 180./TMath::Pi();
+
+//________________________________________________________________________
+AliITSMisAligner::AliITSMisAligner():
+    AliMisAligner(),
+    fRnd(),
+    fInd(0),
+    fAlignObjArray(NULL),
+    fStrSPD("ITS/SPD"),
+    fStrSDD("ITS/SDD"),
+    fStrSSD("ITS/SSD"),
+    fStrStave("/Stave"),
+    fStrHalfStave("/HalfStave"),
+    fStrLadder("/Ladder"),
+    fStrSector("/Sector"),
+    fStrSensor("/Sensor"),
+    fUnifSPDSector(kFALSE),
+    fUnifSPDHS(kFALSE),
+    fUnifSDDLadder(kFALSE),
+    fUnifSSDLadder(kFALSE),
+    fUnifSPDLadder(kFALSE),
+    fUnifSDDModule(kFALSE),
+    fUnifSSDModule(kFALSE)
+{
+    //
+    // defaul constructor
+    //
+    fRnd.SetSeed(38217945);
+    fAlignObjArray = new TClonesArray("AliAlignObjParams",4000);
+    for(Int_t ii=0; ii<6; ii++)
+    {
+       fWholeITS[ii]=0.;
+       fSPDSector[ii]=0.;
+       fSPDHB[ii]=0.;
+       fSPDBarrel[ii]=0.;
+       fSPDHS[ii]=0.;
+       fSPDLadder[ii]=0.;
+       fSDDLayer[ii]=0.;
+       fSDDBarrel[ii]=0.;
+       fSDDLadder[ii]=0.;
+       fSDDModule[ii]=0.;
+       fSSDBarrel[ii]=0.;
+       fSSDLayer[ii]=0.;
+       fSSDLadder[ii]=0.;
+       fSSDModule[ii]=0.;
+       fSPDLadderShiftT[ii]=0.;
+       fSPDLadderShiftB[ii]=0.;
+       fSDDLadderShift1[ii]=0.;
+       fSDDLadderShift2[ii]=0.;
+       fSSDLadderShift1[ii]=0.;
+       fSSDLadderShift2[ii]=0.;
+    }
+}
+
+//________________________________________________________________________
+AliITSMisAligner::AliITSMisAligner(const AliITSMisAligner &mAligner):
+    fRnd(mAligner.fRnd),
+    fInd(0),
+    fAlignObjArray(mAligner.fAlignObjArray),
+    fStrSPD("ITS/SPD"),
+    fStrSDD("ITS/SDD"),
+    fStrSSD("ITS/SSD"),
+    fStrStave("/Stave"),
+    fStrHalfStave("/HalfStave"),
+    fStrLadder("/Ladder"),
+    fStrSector("/Sector"),
+    fStrSensor("/Sensor"),
+    fUnifSPDSector(kFALSE),
+    fUnifSPDHS(kFALSE),
+    fUnifSDDLadder(kFALSE),
+    fUnifSSDLadder(kFALSE),
+    fUnifSPDLadder(kFALSE),
+    fUnifSDDModule(kFALSE),
+    fUnifSSDModule(kFALSE)
+{
+    //
+    // copy constructor
+    //
+}
+
+//________________________________________________________________________
+AliITSMisAligner &AliITSMisAligner::operator= (const AliITSMisAligner &mAligner)
+{
+    //
+    // assignment operator
+    //
+    fRnd = mAligner.fRnd,
+    fInd = 0;
+    fAlignObjArray = mAligner.fAlignObjArray;
+    fStrSPD = "ITS/SPD";
+    fStrSDD = "ITS/SDD";
+    fStrSSD = "ITS/SSD";
+    fStrStave = "/Stave";
+    fStrHalfStave = "/HalfStave";
+    fStrLadder = "/Ladder";
+    fStrSector = "/Sector";
+    fStrSensor = "/Sensor";
+    fUnifSPDSector = mAligner.fUnifSPDSector;
+    fUnifSPDHS = kFALSE;
+    fUnifSDDLadder = kFALSE;
+    fUnifSSDLadder = kFALSE;
+    fUnifSPDLadder = kFALSE;
+    fUnifSDDModule = kFALSE;
+    fUnifSSDModule = kFALSE;
+    return (*this);
+}
+
+//_______________________________________________________________________________________
+TClonesArray* AliITSMisAligner::MakeAlObjsArray() {
+    // Make the array of alignment objects, depending on the misalignment scenario (Zero, Residual, Full)
+    //
+
+    // Setting default values for ideal, residual or full misalignment
+    SetWholeITSMisAlignment();
+    SetSPDMisAlignment();
+    SetSDDMisAlignment();
+    SetSSDMisAlignment(); 
+
+    // Get array of alignment objects from survey (based on which we build later the SSD objects)
+    AliITSSurveyToAlign* s2a = new AliITSSurveyToAlign();
+    s2a->Run();
+    TClonesArray* surveyArray = dynamic_cast<TClonesArray*> (s2a->GetAlignObjsArray());
+    if(!surveyArray){
+       Printf("SSD survey array was not build! Probably you missed to connect to alien");
+       return 0;
+    }else{
+       Printf("survey array contains %d entries", surveyArray->GetEntriesFast());
+    }
+    (AliGeomManager::GetGeometry())->UnlockGeometry();
+
+    AddAlignObj("ITS",fWholeITS[0],fWholeITS[1],fWholeITS[2],fWholeITS[3],fWholeITS[4],fWholeITS[5],"fixed");
+
+    AddSectorAlignObj(1,5,fSPDSector[0],fSPDSector[1],fSPDSector[2],fSPDSector[3],fSPDSector[4],fSPDSector[5],
+           fSPDLadderShiftT[0],fSPDLadderShiftT[1],fSPDLadderShiftT[2],fSPDLadderShiftT[3],fSPDLadderShiftT[4],fSPDLadderShiftT[5],fUnifSPDSector);
+    AddSectorAlignObj(6,10,fSPDSector[0],fSPDSector[1],fSPDSector[2],fSPDSector[3],fSPDSector[4],fSPDSector[5],
+           fSPDLadderShiftB[0],fSPDLadderShiftB[1],fSPDLadderShiftB[2],fSPDLadderShiftB[3],fSPDLadderShiftB[4],fSPDLadderShiftB[5],fUnifSPDSector);
+
+    //=****************************************
+    // misalignment at the level of half-staves (SPD)/ladders (SDD,SSD) :
+    //=****************************************
+    AddAlignObj(0,-1,fSPDHS[0],fSPDHS[1],fSPDHS[2],fSPDHS[3],fSPDHS[4],fSPDHS[5],
+           0,0,0,0,0,0,fUnifSPDHS); // all SPD1 half-staves
+    AddAlignObj(1,-1,fSPDHS[0],fSPDHS[1],fSPDHS[2],fSPDHS[3],fSPDHS[4],fSPDHS[5],
+           0,0,0,0,0,0,fUnifSPDHS); // all SPD2 half-staves
+
+    AddAlignObj(2,-1,fSDDLadder[0],fSDDLadder[1],fSDDLadder[2],fSDDLadder[3],
+           fSDDLadder[4],fSDDLadder[5],fSDDLadderShift1[0],fSDDLadderShift1[1],fSDDLadderShift1[2],fSDDLadderShift1[3],fSDDLadderShift1[4],fSDDLadderShift1[5],fUnifSDDLadder); // all SDD1 ladders
+    AddAlignObj(3,-1,fSDDLadder[0],fSDDLadder[1],fSDDLadder[2],fSDDLadder[3],
+           fSDDLadder[4],fSDDLadder[5],fSDDLadderShift2[0],fSDDLadderShift2[1],fSDDLadderShift2[2],fSDDLadderShift2[3],fSDDLadderShift2[4],fSDDLadderShift2[5],fUnifSDDLadder); // all SDD2 ladders
+
+    // all SSD ladders
+    for(Int_t ii=0; ii<surveyArray->GetEntriesFast(); ii++)
+    {
+       AliAlignObjParams* aop = dynamic_cast<AliAlignObjParams*> (surveyArray->UncheckedAt(ii));
+//     if(!aop){
+//         Printf("Unexpected missing object at %d!", ii);
+//         continue;
+//     }
+       TString sName(aop->GetSymName());
+
+       // First we shift all SSD ladders by the same quantity to reproduce a barrel shift
+       ShiftAlignObj(*aop,fSSDBarrel[0],fSSDBarrel[1],fSSDBarrel[2],fSSDBarrel[3],fSSDBarrel[4],fSSDBarrel[5]);
+       if(sName.Contains("SSD4") && !sName.Contains("Sensor")){
+           // we correct with the factor 1.13 for the fact that, in the inner SSD layer, z lever arm is 45.135cm instead of 51cm
+           SmearAlignObj(*aop,fSSDLadder[0],fSSDLadder[1],fSSDLadder[2],fSSDLadder[3]*1.13,fSSDLadder[4]*1.13,fSSDLadder[5]);
+           new((*fAlignObjArray)[fInd++]) AliAlignObjParams(*aop);
+       }else if(sName.Contains("SSD5") && !sName.Contains("Sensor")){
+           SmearAlignObj(*aop,fSSDLadder[0],fSSDLadder[1],fSSDLadder[2],fSSDLadder[3],fSSDLadder[4],fSSDLadder[5]);
+           new((*fAlignObjArray)[fInd++]) AliAlignObjParams(*aop);
+       }
+       aop->ApplyToGeometry();
+    }
+
+    //=****************************************
+    // misalignment at the level of ladders (SPD)/modules (SDD,SSD) :
+    //=****************************************
+    AddAlignObj(0,fSPDLadder[0],fSPDLadder[1],fSPDLadder[2],fSPDLadder[3],fSPDLadder[4],fSPDLadder[5],fUnifSPDLadder);// all SPD1 ladders
+    AddAlignObj(1,fSPDLadder[0],fSPDLadder[1],fSPDLadder[2],fSPDLadder[3],fSPDLadder[4],fSPDLadder[5],fUnifSPDLadder);// all SPD2 ladders
+
+    AddAlignObj(2,fSDDModule[0],fSDDModule[1],fSDDModule[2],fSDDModule[3],fSDDModule[4],fSDDModule[5],fUnifSDDModule);// all SDD1 modules
+    AddAlignObj(3,fSDDModule[0],fSDDModule[1],fSDDModule[2],fSDDModule[3],fSDDModule[4],fSDDModule[5],fUnifSDDModule);// all SDD2 modules
+
+    // all SSD modules
+    for(Int_t ii=0; ii<surveyArray->GetEntriesFast(); ii++)
+    {
+       AliAlignObjParams* aop = dynamic_cast<AliAlignObjParams*> (surveyArray->UncheckedAt(ii));
+       TString sName(aop->GetSymName());
+       if(sName.Contains("SSD") && sName.Contains("Sensor"))
+       {
+           SmearAlignObj(*aop,fSSDModule[0],fSSDModule[1],fSSDModule[2],fSSDModule[3],fSSDModule[4],fSSDModule[5]);
+           new((*fAlignObjArray)[fInd++]) AliAlignObjParams(*aop);
+       }
+    }
+
+    return fAlignObjArray;
+}
+
+//_______________________________________________________________________________________
+void AliITSMisAligner::ShiftAlignObj(AliAlignObjParams &alObj, Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+{
+    // 
+    // Shift the parameters of the alignment object passed as first argument by the quantities defined by the arguments
+    //
+    Double_t shifts[3]; Double_t angles[3];
+    alObj.GetPars(shifts, angles);
+    alObj.SetPars(shifts[0]+dx, shifts[1]+dy, shifts[2]+dz, angles[0]+dpsi, angles[1]+dtheta, angles[2]+dphi);
+}
+
+//_______________________________________________________________________________________
+void AliITSMisAligner::SmearAlignObj(AliAlignObjParams &alObj, Double_t sx, Double_t sy, Double_t sz, Double_t spsi, Double_t stheta, Double_t sphi)
+{
+    // 
+    // Smear the parameters of the alignment object passed as first argument in the range defined by the subsequent arguments
+    //
+    Double_t shifts[3]; Double_t angles[3];
+    alObj.GetLocalPars(shifts, angles);
+    Double_t x = AliMathBase::TruncatedGaus(shifts[0], sx, 3.*sx);
+    Double_t y = AliMathBase::TruncatedGaus(shifts[1], sy, 3.*sy);
+    Double_t z = AliMathBase::TruncatedGaus(shifts[2], sz, 3.*sz);
+    Double_t psi = AliMathBase::TruncatedGaus(angles[0], spsi, 3.*spsi);
+    Double_t theta = AliMathBase::TruncatedGaus(angles[1], stheta, 3.*stheta);
+    Double_t phi = AliMathBase::TruncatedGaus(angles[2], sphi, 3.*sphi);
+    alObj.SetLocalPars(x, y, z, psi, theta, phi);
+}
+
+//_______________________________________________________________________________________
+void AliITSMisAligner::SetWholeITSMisAlignment()
+{
+    // Set misalignment for the whole ITS for the standar scenarios (zero, residual, full)
+    // To make custom misalignments set directly the misalignments at each level (methods "SetS?D*Pars")
+    //
+    if(TString(GetMisalType())=="ideal")
+    {
+       // overall ITS misalignment according to survey as reported by Werner Riegler (18/07/2008)
+       SetWholeITSPars(-0.12, -0.07, 0.29, 0., 0.03, 0.04);
+    }else if(TString(GetMisalType())=="residual"){
+       // overall ITS misalignment according to survey as reported by Werner Riegler (18/07/2008)
+       // no smearing added (would clash with vertex constraint)
+       SetWholeITSPars(-0.12, -0.07, 0.29, 0., 0.03, 0.04);
+    }else if(TString(GetMisalType())=="full"){
+       // overall ITS misalignment according to survey as reported by Werner Riegler (18/07/2008) plus smearing
+       Double_t sigmatrW = 0.01;
+       Double_t sigmarotW = 0.006;
+       SetWholeITSPars(AliMathBase::TruncatedGaus(-0.12,sigmatrW,3.*sigmatrW),
+               AliMathBase::TruncatedGaus(-0.07,sigmatrW,3.*sigmatrW),
+               AliMathBase::TruncatedGaus(0.29,sigmatrW,3.*sigmatrW),
+               AliMathBase::TruncatedGaus(0.,sigmarotW,3.*sigmarotW),
+               AliMathBase::TruncatedGaus(0.03,sigmarotW,3.*sigmarotW),
+               AliMathBase::TruncatedGaus(0.04,sigmarotW,3.*sigmarotW));
+    }
+}
+
+//_______________________________________________________________________________________
+void AliITSMisAligner::SetSPDMisAlignment()
+{
+    // Set misalignment for SPD alignable volumes for the standar scenarios (zero, residual, full)
+    // To make custom misalignments set directly the misalignments at each level (methods "SetSPD*Pars")
+    //
+    if(TString(GetMisalType())=="ideal")
+    {
+       // misalignment for SPD at all levels equal to zero (identical transformations)
+       SetSPDBarrelSigmas(0., 0., 0., 0., 0., 0.); 
+       SetSPDHBSigmas(0., 0., 0., 0., 0., 0.); 
+       SetSPDSectorSigmas(0., 0., 0., 0., 0., 0.); 
+       SetSPDHSSigmas(0., 0., 0., 0., 0., 0.); 
+       SetSPDLadderSigmas(0., 0., 0., 0., 0., 0.); 
+    }else if(TString(GetMisalType())=="residual"){
+       // misalignment at the level of SPD barrel and half-barrels left to zero
+       SetSPDBarrelSigmas(0., 0., 0., 0., 0., 0.); 
+       SetSPDHBSigmas(0., 0., 0., 0., 0., 0.); 
+       
+       // misalignment at the level of SPD sectors (source: A.Pepato)
+       SetSPDSectorSigmas( 0.0050/5., //  50 micron (~tangetial, i.e. rphi)
+               0.0100/5., // 100 micron (~radial)
+               0.0100/5., // 100 micron
+               0.0100/30.*kRadToDeg/5., // so as to have 100 micron difference at the two extremes
+               0.0100/30.*kRadToDeg/5., // so as to have 100 micron difference at the two extremes
+               0.0050/1.5*kRadToDeg/5.); // so as to have 50 micron difference at the two extremes
+       fUnifSPDSector=kFALSE;
+
+       // misalignment at the level of half-staves (SPD) (source: S.Moretto)
+       SetSPDHSSigmas( 0.0100/4., // 100 micron
+               0.0020/4., // 20 micron
+               0.0020/4., // 20 micron
+               0.0020/7.*kRadToDeg/4., // so as to have 20 micron difference at the two extremes
+               0.0050/7.*kRadToDeg/4., // so as to have 50 micron difference at the two extremes
+               0.0050/0.7*kRadToDeg/4.);// so as to have 50 micron difference at the two extremes
+       fUnifSPDHS=kFALSE;
+       
+       // misalignment at the level of ladders (SPD) (source: R.Santoro)
+       SetSPDLadderSigmas( 0.0010/5., // 10 micron
+               0.0050/5., // 50 micron
+               0.0010/5., // 10 micron
+               0.0001*kRadToDeg/5., // 0.1 mrad
+               0.0001*kRadToDeg/5., // 0.1 mrad
+               0.0001*kRadToDeg/5.);// 0.1 mrad
+       fUnifSPDLadder=kFALSE;
+
+    }else if(TString(GetMisalType())=="full"){
+       // misalignment at the level of SPD barrel (source: A.Pepato)
+       SetSPDBarrelSigmas( 0.1000, // 1 mm (very pessimistic)
+               0.1000, // 1 mm (very pessimistic)
+               0.1000, // 1 mm (very pessimistic)
+               0.0500/30.*kRadToDeg, // so as to have 500 micron difference at the two extremes
+               0.0500/30.*kRadToDeg, // so as to have 500 micron difference at the two extremes
+               0.0500/7.*kRadToDeg); // so as to have 500 micron difference at the two extremes
+
+       // misalignment at the level of SPD half-barrels (source: A.Pepato)
+       SetSPDHBSigmas( 0.0200, // 200 micron
+               0.0200, // 200 micron
+               0.0200, // 200 micron
+               0.0100/30.*kRadToDeg, // so as to have 100 micron difference at the two extremes
+               0.0100/30.*kRadToDeg, // so as to have 100 micron difference at the two extremes
+               0.0100/7.*kRadToDeg); // so as to have 100 micron difference at the two extremes
+
+       // misalignment at the level of SPD sectors (source: A.Pepato)
+       SetSPDSectorSigmas( 0.0050, //  50 micron (~tangetial, i.e. rphi)
+               0.0100, // 100 micron (~radial)
+               0.0100, // 100 micron
+               0.0100/30.*kRadToDeg, // so as to have 100 micron difference at the two extremes
+               0.0100/30.*kRadToDeg, // so as to have 100 micron difference at the two extremes
+               0.0050/1.5*kRadToDeg); // so as to have 50 micron difference at the two extremes
+       fUnifSPDSector=kTRUE;
+
+       // misalignment at the level of half-staves (SPD) (source: S.Moretto)
+       SetSPDHSSigmas( 0.0100, // 100 micron // normal to plane
+               0.0020, // 20 micron
+               0.0020, // 20 micron
+               0.0020/7.*kRadToDeg, // so as to have 20 micron difference at the two extremes
+               0.0050/7.*kRadToDeg, // so as to have 50 micron difference at the two extremes
+               0.0050/0.7*kRadToDeg); // so as to have 50 micron difference at the two extremes
+       fUnifSPDHS=kTRUE;
+       
+       // misalignment at the level of ladders (SPD) (source: R.Santoro)
+       SetSPDLadderSigmas( 0.0010, // 10 micron
+               0.0030, // 50 micron
+               0.0010, // 10 micron
+               0.0001*kRadToDeg, // 0.1 mrad
+               0.0001*kRadToDeg, // 0.1 mrad
+               0.0001*kRadToDeg); // 0.1 mrad
+       fUnifSPDLadder=kTRUE;
+       
+
+       // misalignment at the level of SPD barrel, half-barrels, and at the level
+       // of SPD sectors
+       Double_t shBtop[6], shBbot[6]; //top and bottom barrel shifts
+       for(Int_t ii=0; ii<6; ii++){
+           shBtop[ii] = AliMathBase::TruncatedGaus(0.,fSPDBarrel[ii]/3,fSPDBarrel[ii]);
+           shBbot[ii] = shBtop[ii];
+       }
+
+       for(Int_t ii=0; ii<6; ii++){
+           shBtop[ii] += AliMathBase::TruncatedGaus(0.,fSPDHB[ii]/3,fSPDHB[ii]);
+           shBbot[ii] += AliMathBase::TruncatedGaus(0.,fSPDHB[ii]/3,fSPDHB[ii]);
+       }
+       SetSPDLadderShiftT(shBtop);
+       SetSPDLadderShiftB(shBbot);
+    }
+}
+
+//_______________________________________________________________________________________
+void AliITSMisAligner::SetSDDMisAlignment() 
+{
+    // Set misalignment for SDD alignable volumes for the standar scenarios (zero, residual, full)
+    // To make custom misalignments set directly the misalignments at each level (methods "SetSDD*Pars")
+    //
+    if(TString(GetMisalType())=="ideal")
+    {
+       // misalignment for SDD at all levels equal to zero
+       SetSDDLayerSigmas(0., 0., 0., 0., 0., 0.);
+       SetSDDBarrelSigmas(0., 0., 0., 0., 0., 0.);
+       SetSDDLadderSigmas(0., 0., 0., 0., 0., 0.);
+       SetSDDModuleSigmas(0., 0., 0., 0., 0., 0.);
+    }else if(TString(GetMisalType())=="residual"){
+       // misalignment at the level of SDD and SSD layers(source: B.Giraudo)
+       SetSDDLayerSigmas(0., 0., 0., 0., 0., 0.);
+       SetSDDBarrelSigmas(0., 0., 0., 0., 0., 0.);
+       
+       // misalignment at the level of half-staves (SPD) (source: S.Moretto)
+       SetSDDLadderSigmas( 0.0005, // 5 micron
+               0.0005, // 5 micron
+               0.0005, // 5 micron
+               0.00, //  ?
+               0.00, //  ?
+               0.00); //  ?
+       fUnifSDDLadder=kFALSE;
+
+       // misalignment at the level of SDD modules(source: L.Gaudichet)
+       SetSDDModuleSigmas( 0.0045/5., // 45 micron
+               0.0045/5., // 45 micron
+               0.0105/5., // 105 micron
+               0.00, // ?
+               0.00, //  ?
+               0.00);//  ?
+       fUnifSDDModule=kFALSE;
+
+    }else if(TString(GetMisalType())=="full"){
+       // misalignment at the level of SDD layers(source: B.Giraudo)
+       SetSDDBarrelSigmas( 0.0020, // 20 micron
+               0.0020, // 20 micron
+               0.0020, // 20 micron
+               0.0020/52.*kRadToDeg,  // so as to have 20 micron difference at the two extremes
+               0.0020/52.*kRadToDeg,  // so as to have 20 micron difference at the two extremes
+               0.0020/20.*kRadToDeg); // so as to have 20 micron difference at the two extremes
+
+       SetSDDLayerSigmas( 0.0010, // 10 micron
+               0.0010, // 10 micron
+               0.0010, // 10 micron
+               0.0010/52.*kRadToDeg, // so as to have 10 micron difference at the two extremes
+               0.0010/52.*kRadToDeg, // so as to have 10 micron difference at the two extremes
+               0.0010/20.*kRadToDeg);  // so as to have 10 micron difference at the two extremes
+
+       // misalignment at the level of SDD ladders
+       SetSDDLadderSigmas( 0.0005, // 5 micron
+               0.0005, // 5 micron
+               0.0005, // 5 micron
+               0.00, //  ?
+               0.00, //  ?
+               0.00);//  ?
+       fUnifSDDLadder=kTRUE;
+
+       // misalignment at the level of SDD modules (source: L.Gaudichet)
+       SetSDDModuleSigmas( 0.0045, // 45 micron
+               0.0045, // 45 micron
+               0.0105, // 105 micron
+               0.00, // ?
+               0.00, //  ?
+               0.00);//  ?
+       fUnifSDDModule=kTRUE;
+    }
+
+  fSDDLadderShift1[0] = GetUnif(-fSDDBarrel[0],fSDDBarrel[0]);
+  fSDDLadderShift1[1] = GetUnif(-fSDDBarrel[1],fSDDBarrel[1]);
+  fSDDLadderShift1[2] = GetUnif(-fSDDBarrel[2],fSDDBarrel[2]);
+  fSDDLadderShift1[3] = GetUnif(-fSDDBarrel[3],fSDDBarrel[3]);
+  fSDDLadderShift1[4] = GetUnif(-fSDDBarrel[4],fSDDBarrel[4]);
+  fSDDLadderShift1[5] = GetUnif(-fSDDBarrel[5],fSDDBarrel[5]);
+  
+  for(Int_t ii=0; ii<6; ii++)
+      fSDDLadderShift2[ii] = fSDDLadderShift1[ii];
+
+  //  layer SDD1
+  fSDDLadderShift1[0] += GetUnif(-fSDDLayer[0],fSDDLayer[0]);
+  fSDDLadderShift1[1] += GetUnif(-fSDDLayer[1],fSDDLayer[1]);
+  fSDDLadderShift1[2] += GetUnif(-fSDDLayer[2],fSDDLayer[2]);
+  fSDDLadderShift1[3] += GetUnif(-fSDDLayer[3],fSDDLayer[3]);
+  fSDDLadderShift1[4] += GetUnif(-fSDDLayer[4],fSDDLayer[4]);
+  fSDDLadderShift1[5] += GetUnif(-fSDDLayer[5],fSDDLayer[5]);
+
+  //  layer SDD2
+  fSDDLadderShift2[0] += GetUnif(-fSDDLayer[0],fSDDLayer[0]);
+  fSDDLadderShift2[1] += GetUnif(-fSDDLayer[1],fSDDLayer[1]);
+  fSDDLadderShift2[2] += GetUnif(-fSDDLayer[2],fSDDLayer[2]);
+  fSDDLadderShift2[3] += GetUnif(-fSDDLayer[3],fSDDLayer[3]);
+  fSDDLadderShift2[4] += GetUnif(-fSDDLayer[4],fSDDLayer[4]);
+  fSDDLadderShift2[5] += GetUnif(-fSDDLayer[5],fSDDLayer[5]);
+
+}
+       
+//_______________________________________________________________________________________
+void AliITSMisAligner::SetSSDMisAlignment() 
+{
+    // Set misalignment for SSD alignable volumes for the standar scenarios (zero, residual, full)
+    // To make custom misalignments set directly the misalignments at each level (methods "SetSSD*Pars")
+    //
+    if(TString(GetMisalType())=="ideal"){
+
+       // zero misalignment at the level of SSD barrel
+       SetSSDBarrelPars(0.,0.,0.,0.,0.,0.);
+       // zero misalignment at the level of SSD ladders
+       SetSSDLadderSigmas(0.,0.,0.,0.,0.,0.);
+       // zero misalignment at the level of SSD modules
+       SetSSDModuleSigmas(0.,0.,0.,0.,0.,0.);
+       
+    }else if(TString(GetMisalType())=="residual"){
+
+       // zero misalignment at the level of SSD barrel
+       SetSSDBarrelPars(0.,0.,0.,0.,0.,0.);
+       // misalignment at the level of SSD ladders (source: M. Van Leeuwen)
+       // values set so that overall maximum displacement (combined effect of shift and rotation
+       // of the ladder) for any point of the ladder cannot exceed 10um in x, 100 um in y, 50um in z
+       SetSSDLadderSigmas( 0.0005, // 5 microns
+               0.0033, // 33 microns
+               0.0050, // 50 microns
+               0.000067*kRadToDeg, // 0.067 mrads
+               0.00001*kRadToDeg, // 0.01 mrads
+               0.001*kRadToDeg); // 1 mrad
+       fUnifSSDLadder=kTRUE;
+
+       // misalignment at the level of SSD modules (source: M. Van Leeuwen)
+       // values set so that overall maximum displacement (combined effect of shift and rotation
+       // of the ladder) for any point of the module cannot exceed 5um in x, 10 um in y, 5um in z
+       SetSSDModuleSigmas( 0.00025, // 2.5 microns
+               0.00034, // 3.4 microns
+               0.0005, // 5 microns
+               0.00017*kRadToDeg, // 0.17 mrads
+               0.000125*kRadToDeg, // 0.125 mrads
+               0.0001*kRadToDeg); // 0.1 mrads
+       fUnifSSDModule=kTRUE;
+
+    }else if(TString(GetMisalType())=="full"){
+       // misalignment at the level of SSD layers (source: B. Giraudo)
+       SetSSDBarrelPars( GetUnif(-0.0020,0.0020), // 20 micron
+               GetUnif(-0.0020,0.0020), // 20 micron
+               GetUnif(-0.0020,0.0020), // 20 micron
+               GetUnif(-0.0020/90.*kRadToDeg,0.0020), // so as to have 20 micron difference at the two extremes
+               GetUnif(-0.0020/90.*kRadToDeg,0.0020), // so as to have 20 micron difference at the two extremes
+               GetUnif(-0.0020/40.*kRadToDeg,0.0020));  // so as to have 20 micron difference at the two extremes
+       
+       // misalignment at the level of SSD ladders (source: M. Van Leeuwen)
+       // values set so that overall maximum displacement (combined effect of shift and rotation
+       // of the ladder) for any point of the ladder cannot exceed 20um in x, 100 um in y, 50um in z
+       SetSSDLadderSigmas( 0.0010, // 10 microns
+               0.0033, // 33 microns
+               0.0050, // 50 microns
+               0.000067*kRadToDeg, // 0.067 mrads
+               0.00002*kRadToDeg, // 0.02 mrads
+               0.001*kRadToDeg); // 1 mrad
+       fUnifSSDLadder=kTRUE;
+
+       // misalignment at the level of SSD modules (source: M. Van Leeuwen)
+       // values set so that overall maximum displacement (combined effect of shift and rotation
+       // of the ladder) for any point of the module cannot exceed 5um in x, 10 um in y, 5um in z
+       SetSSDModuleSigmas( 0.00025, // 2.5 microns
+               0.00034, // 3.4 microns
+               0.0005, // 5 microns
+               0.00017*kRadToDeg, // 0.17 mrads
+               0.000125*kRadToDeg, // 0.125 mrads
+               0.0001*kRadToDeg); // 0.1 mrads
+       fUnifSSDModule=kTRUE;
+    }
+
+
+  fSSDLadderShift1[0] = GetUnif(-fSSDBarrel[0],fSSDBarrel[0]);
+  fSSDLadderShift1[1] = GetUnif(-fSSDBarrel[1],fSSDBarrel[1]);
+  fSSDLadderShift1[2] = GetUnif(-fSSDBarrel[2],fSSDBarrel[2]);
+  fSSDLadderShift1[3] = GetUnif(-fSSDBarrel[3],fSSDBarrel[3]);
+  fSSDLadderShift1[4] = GetUnif(-fSSDBarrel[4],fSSDBarrel[4]);
+  fSSDLadderShift1[5] = GetUnif(-fSSDBarrel[5],fSSDBarrel[5]);
+  
+  /*
+  for(Int_t ii=0; ii<6; ii++)
+      fSSDLadderShift2[ii] = fSSDLadderShift1[ii];
+
+  //  layer SSD1
+  fSSDLadderShift1[0] += GetUnif(-fSSDLayer[0],fSSDLayer[0]);
+  fSSDLadderShift1[1] += GetUnif(-fSSDLayer[1],fSSDLayer[1]);
+  fSSDLadderShift1[2] += GetUnif(-fSSDLayer[2],fSSDLayer[2]);
+  fSSDLadderShift1[3] += GetUnif(-fSSDLayer[3],fSSDLayer[3]);
+  fSSDLadderShift1[4] += GetUnif(-fSSDLayer[4],fSSDLayer[4]);
+  fSSDLadderShift1[5] += GetUnif(-fSSDLayer[5],fSSDLayer[5]);
+
+  //  layer SSD2
+  fSSDLadderShift2[0] += GetUnif(-fSSDLayer[0],fSSDLayer[0]);
+  fSSDLadderShift2[1] += GetUnif(-fSSDLayer[1],fSSDLayer[1]);
+  fSSDLadderShift2[2] += GetUnif(-fSSDLayer[2],fSSDLayer[2]);
+  fSSDLadderShift2[3] += GetUnif(-fSSDLayer[3],fSSDLayer[3]);
+  fSSDLadderShift2[4] += GetUnif(-fSSDLayer[4],fSSDLayer[4]);
+  fSSDLadderShift2[5] += GetUnif(-fSSDLayer[5],fSSDLayer[5]);
+  */
+
+}
+
+//_______________________________________________________________________________________
+AliCDBMetaData* AliITSMisAligner::GetCDBMetaData() const {
+    // Returns the AliCDBMetaData to be associated with AliCDBEntry which will contain
+    // the array of alignment objects for ITS misalignment
+    // Presently "responsible" and "comment" are filled.
+    //
+  AliCDBMetaData* md = new AliCDBMetaData();
+  md->SetResponsible("Andrea Dainese");
+
+  if(TString(GetMisalType())=="ideal")
+    md->SetComment("Alignment objects for ITS ideal misalignment");
+  if(TString(GetMisalType())=="residual")
+    md->SetComment("Alignment objects for ITS residual misalignment");
+  if(TString(GetMisalType())=="full")
+    md->SetComment("Alignment objects for ITS full misalignment");
+  return md;
+}
+
+//________________________________________________________________________
+Bool_t AliITSMisAligner::AddAlignObj(char* name,Double_t dx,Double_t dy,Double_t dz,
+                               Double_t dpsi,Double_t dtheta,Double_t dphi,const char* distrib) {
+  //
+  // misalignment by symname
+  //
+  Double_t vx=0.,vy=0.,vz=0.,vpsi=0.,vtheta=0.,vphi=0.;
+
+  TString sdistrib(distrib);
+
+  if(sdistrib==TString("gaussian")) {
+    vx = AliMathBase::TruncatedGaus(0.,dx/3.,dx); // mean, sigma, max absolute value 
+    vy = AliMathBase::TruncatedGaus(0.,dy/3.,dy);
+    vz = AliMathBase::TruncatedGaus(0.,dz/3.,dz);
+    vpsi   = AliMathBase::TruncatedGaus(0.,dpsi/3.,  dpsi );
+    vtheta = AliMathBase::TruncatedGaus(0.,dtheta/3.,dtheta);
+    vphi   = AliMathBase::TruncatedGaus(0.,dphi/3.,  dphi);
+  }else if(sdistrib==TString("uniform")){ 
+    vx = fRnd.Uniform(-dx,dx);
+    vy = fRnd.Uniform(-dy,dy);
+    vz = fRnd.Uniform(-dz,dz);
+    vpsi = fRnd.Uniform(-dpsi,dpsi);
+    vtheta = fRnd.Uniform(-dtheta,dtheta);
+    vphi = fRnd.Uniform(-dphi,dphi);
+  }else if(sdistrib==TString("fixed")){
+    vx=dx;
+    vy=dy;
+    vz=dz;
+    vpsi=dpsi;
+    vtheta=dtheta;
+    vphi=dphi;
+  }else{
+    AliFatal(Form("Invalid string \"%s\" specifying the misalignment type for the volume \"%s\""));
+  }
+
+  new((*fAlignObjArray)[fInd]) AliAlignObjParams(name,0,vx,vy,vz,vpsi,vtheta,vphi,kFALSE);
+
+  AliAlignObjParams* itsalobj = (AliAlignObjParams*) fAlignObjArray->UncheckedAt(fInd);
+  itsalobj->ApplyToGeometry();
+
+  fInd++;
+
+  return kTRUE;
+}
+
+
+//________________________________________________________________________
+Bool_t AliITSMisAligner::AddAlignObj(Int_t lay,Double_t dx,Double_t dy,Double_t dz,
+                                Double_t dpsi,Double_t dtheta,Double_t dphi,Bool_t unif) {
+  //
+  // misalignment at the level of sensitive alignable volumes (SPD ladders/ SDD,SSD modules)
+  // done for all ladders/modules of the given layer
+  //
+  lay+=1; // layers are numbered from 1 to 6 in AliGeomManager
+
+  printf("LAYER %d  MODULES %d\n",lay,AliGeomManager::LayerSize(lay));
+
+  for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(lay); iModule++) {
+
+    Double_t vx,vy,vz,vpsi,vtheta,vphi;
+    
+    if(!unif) {
+      vx = AliMathBase::TruncatedGaus(0.,dx/3.,dx); // mean, sigma, max absolute value 
+      vy = AliMathBase::TruncatedGaus(0.,dy/3.,dy);
+      vz = AliMathBase::TruncatedGaus(0.,dz/3.,dz);
+      vpsi = AliMathBase::TruncatedGaus(0.,dpsi/3.,dpsi);
+      vtheta = AliMathBase::TruncatedGaus(0.,dtheta/3.,dtheta);
+      vphi = AliMathBase::TruncatedGaus(0.,dphi/3.,dphi);
+    } else {
+      vx = fRnd.Uniform(-dx,dx);
+      vy = fRnd.Uniform(-dy,dy);
+      vz = fRnd.Uniform(-dz,dz);
+      vpsi = fRnd.Uniform(-dpsi,dpsi);
+      vtheta = fRnd.Uniform(-dtheta,dtheta);
+      vphi = fRnd.Uniform(-dphi,dphi);
+    }
+    
+    UShort_t volid = AliGeomManager::LayerToVolUID(lay,iModule);
+    const char *symname = AliGeomManager::SymName(volid);
+    
+    new((*fAlignObjArray)[fInd]) AliAlignObjParams(symname,volid,vx,vy,vz,vpsi,vtheta,vphi,kFALSE);
+    fInd++; 
+  }
+
+  return kTRUE;
+}
+
+//________________________________________________________________________
+Bool_t AliITSMisAligner::AddAlignObj(Int_t lay,Int_t ladd,Double_t dx,Double_t dy,Double_t dz,
+                                      Double_t dpsi,Double_t dtheta,Double_t dphi,
+                                      Double_t xShift,Double_t yShift,Double_t zShift,
+                                      Double_t psiShift,Double_t thetaShift,Double_t phiShift,
+                                      Bool_t unif) {
+  //
+  // misalignment at the level of half-staves/ladders (ladd=-1 means that all ladders are scanned)
+  //
+  Double_t vx,vy,vz,vpsi,vtheta,vphi;
+  Double_t tr[3],rot[3];  
+  
+  Int_t laddMin = ladd;
+  Int_t laddMax = laddMin+1;
+  if (ladd<0) {
+    laddMin = 0;
+    laddMax = fgkNLadders[lay];
+  }
+
+  for (Int_t iLadd=laddMin; iLadd<laddMax; iLadd++) {
+
+    Int_t nHS = 1; 
+    if (lay<2) nHS = 2;
+    for (Int_t iHalfStave=0; iHalfStave<nHS; iHalfStave++) {
+      
+      if(!unif) {
+       vx = AliMathBase::TruncatedGaus(0.,dx/3.,dx); // mean, sigma, max absolute value 
+       vy = AliMathBase::TruncatedGaus(0.,dy/3.,dy);
+       vz = AliMathBase::TruncatedGaus(0.,dz/3.,dz);
+       vpsi = AliMathBase::TruncatedGaus(0.,dpsi/3.,dpsi);
+       vtheta = AliMathBase::TruncatedGaus(0.,dtheta/3.,dtheta);
+       vphi = AliMathBase::TruncatedGaus(0.,dphi/3.,dphi);
+      } else {
+       vx = fRnd.Uniform(-dx,dx);
+       vy = fRnd.Uniform(-dy,dy);
+       vz = fRnd.Uniform(-dz,dz);
+       vpsi = fRnd.Uniform(-dpsi,dpsi);
+       vtheta = fRnd.Uniform(-dtheta,dtheta);
+       vphi = fRnd.Uniform(-dphi,dphi);
+      }
+
+      TString name(GetHalfStaveLadderSymbName(lay,iLadd,iHalfStave));
+
+      // first apply half-stave / ladder level misalignment
+      AliAlignObjParams aaop(name.Data(),0,vx,vy,vz,vpsi,vtheta,vphi,kFALSE); // set them as local
+      aaop.GetPars(tr,rot); // global
+
+      // then, apply layer-level misalignment (only for SDD and SSD)
+      if(lay>1) {
+       tr[0] += xShift;
+       tr[1] += yShift;
+       tr[2] += zShift;
+       rot[0] += psiShift;
+       rot[1] += thetaShift;
+       rot[2] += phiShift;
+      }
+      new((*fAlignObjArray)[fInd]) AliAlignObjParams(name.Data(),0,tr[0],tr[1],tr[2],rot[0],rot[1],rot[2],kTRUE); // set them as global
+
+      AliAlignObjParams* itsalobj = (AliAlignObjParams*) fAlignObjArray->UncheckedAt(fInd);
+      itsalobj->ApplyToGeometry();
+      fInd++;
+    }
+  }
+  
+  return kTRUE;
+}
+
+
+//________________________________________________________________________
+Bool_t AliITSMisAligner::AddSectorAlignObj(Int_t sectMin,Int_t sectMax,
+                                      Double_t dx,Double_t dy,Double_t dz,
+                                      Double_t dpsi,Double_t dtheta,Double_t dphi,
+                                      Double_t xShift,Double_t yShift,Double_t zShift,
+                                      Double_t psiShift,Double_t thetaShift,Double_t phiShift,Bool_t unif) {
+  //
+  // misalignment at the level of SPD sectors and half-barrels
+  // 
+
+  if ((sectMin<1) || (sectMax>10)) return kFALSE;
+  Double_t vx,vy,vz,vpsi,vtheta,vphi;
+  Double_t tr[3],rot[3];  
+
+  for (Int_t iSect = sectMin-1; iSect<sectMax; iSect++) {
+
+    // first, apply sector level misalignment    
+    if(!unif) {
+       vx = AliMathBase::TruncatedGaus(0.,dx/3.,dx); // mean, sigma, max absolute value 
+       vy = AliMathBase::TruncatedGaus(0.,dy/3.,dy);
+       vz = AliMathBase::TruncatedGaus(0.,dz/3.,dz);
+       vpsi = AliMathBase::TruncatedGaus(0.,dpsi/3.,dpsi);
+       vtheta = AliMathBase::TruncatedGaus(0.,dtheta/3.,dtheta);
+       vphi = AliMathBase::TruncatedGaus(0.,dphi/3.,dphi);
+    } else {
+      vx = fRnd.Uniform(-dx,dx);
+      vy = fRnd.Uniform(-dy,dy);
+      vz = fRnd.Uniform(-dz,dz);
+      vpsi = fRnd.Uniform(-dpsi,dpsi);
+      vtheta = fRnd.Uniform(-dtheta,dtheta);
+      vphi = fRnd.Uniform(-dphi,dphi);
+    }
+
+    TString name(GetSymbName(0));
+    name += fStrSector;
+    name += iSect;
+
+
+    AliAlignObjParams aaop(name.Data(),0,vx,vy,vz,vpsi,vtheta,vphi,kFALSE); // set them as local
+    aaop.GetPars(tr,rot); // global
+
+    // then, apply half-barrel level misalignment
+    tr[0] += xShift;
+    tr[1] += yShift;
+    tr[2] += zShift;
+    rot[0] += psiShift;
+    rot[1] += thetaShift;
+    rot[2] += phiShift;
+
+    new((*fAlignObjArray)[fInd]) AliAlignObjParams(name.Data(),0,tr[0],tr[1],tr[2],rot[0],rot[1],rot[2],kTRUE); // set them as global
+
+    AliAlignObjParams* itsalobj = (AliAlignObjParams*) fAlignObjArray->UncheckedAt(fInd);
+    itsalobj->ApplyToGeometry();
+    fInd++;
+  }
+  return kTRUE;
+}
+
+//________________________________________________________________________
+const char* AliITSMisAligner::GetSymbName(Int_t layer) const {
+  //
+  // be careful : SPD0 and SPD1 are not physically separated 
+  //
+  TString name;
+  switch (layer) {
+  case 0:
+  case 1: name = fStrSPD; name += layer; break;
+  case 2:
+  case 3: name = fStrSDD; name += layer; break;
+  case 4:
+  case 5: name = fStrSSD; name += layer; break;
+  default: AliFatal("Wrong layer index");
+  }
+  return name.Data();
+}
+
+//________________________________________________________________________
+const char* AliITSMisAligner::GetSymbName(Int_t layer, Int_t ladder, Int_t det) const {
+  //
+  // symname from layer, ladder, detector
+  //
+  TString symname(GetHalfStaveLadderSymbName(layer,ladder,det));
+  if(layer<=2){
+    symname+="Ladder";
+  }else if(layer<=6){
+    symname+="Sensor";
+  }else{
+    AliError("Invalid layer!");
+    return 0;
+  }
+  symname+=det;
+  return symname.Data();
+}
+
+//________________________________________________________________________
+const char* AliITSMisAligner::GetSymbName(Int_t layer,Int_t ladd) const {
+  //
+  // Get logical names at the level of staves / ladders
+  //
+  TString name(GetSymbName(layer));
+  if (layer==0) { // SPD1
+
+    int sector = ladd/2;
+    name += fStrSector;
+    name += sector;
+    int stave = ladd-sector*2;
+    name += fStrStave;
+    name += stave;
+  }
+  else if (layer==1) { // SPD2
+
+    int sector = ladd/4;
+    name += fStrSector;
+    name += sector;
+    int stave = ladd-sector*4;
+    name += fStrStave;
+    name += stave;
+  }
+  else if (layer>=2 && layer<=5) { // SDD and SSD
+    name += fStrLadder;
+    name += ladd;
+  }
+  else {
+    AliFatal("Wrong layer index");
+  }
+  return name.Data();
+}
+
+//________________________________________________________________________
+const char* AliITSMisAligner::GetHalfStaveLadderSymbName(Int_t layer,Int_t ladd,Int_t halfStave) const {
+  //
+  // Get logical names at the level of half-staves (SPD) or ladders (SDD and SSD)
+  //
+  TString name(GetSymbName(layer));
+  if (layer==0) { // SPD1
+
+    int sector = ladd/2;
+    name += fStrSector;
+    name += sector;
+    int stave = ladd-sector*2;
+    name += fStrStave;
+    name += stave;
+    name += fStrHalfStave;
+    name += halfStave;
+  }
+  else if (layer==1) { // SPD2
+
+    int sector = ladd/4;
+    name += fStrSector;
+    name += sector;
+    int stave = ladd-sector*4;
+    name += fStrStave;
+    name += stave;
+    name += fStrHalfStave;
+    name += halfStave;
+  }
+  else if (layer>=2 && layer<=5) { // SDD and SSD
+    name += fStrLadder;
+    name += ladd;
+  } 
+  else {
+    AliFatal("Wrong layer index");
+  }
+  return name.Data();
+}
+
+//________________________________________________________________________
+const char* AliITSMisAligner::GetParentSymName(const char* symname) {
+  //
+  // symnane of parent volume
+  //
+  TString parent(symname);
+  // Give the symname of 
+  if(parent.BeginsWith('/')) parent.Remove(TString::kLeading,'/');
+  if(parent.EndsWith("/")) parent.Remove(TString::kTrailing,'/');
+  
+  if(!parent.CountChar('/')) AliErrorClass("Not a valid symbolic name");
+
+  Int_t layer,level;
+  GetLayerAndLevel(symname,layer,level);
+  if(level==1) return "ITS";
+  
+  parent.Remove(parent.Last('/'));
+  
+  if((layer==0 || layer==1) && level==2){
+    parent.Remove(parent.Last('/'));
+    parent[7]='0';
+  }
+    
+  return parent.Data(); 
+}
+
+//________________________________________________________________________
+Bool_t AliITSMisAligner::GetLayerAndLevel(const char* symname, Int_t &layer, Int_t &level) {
+  //
+  // given the symbolic name set layer and level
+  //
+  const char* basename[6] = {"ITS/SPD0/Sector","ITS/SPD1/Sector","ITS/SDD2/Ladder","ITS/SDD3/Ladder","ITS/SSD4/Ladder","ITS/SSD5/Ladder"};
+  TString strSym(symname);
+  if(strSym=="ITS"){
+    level=0;
+    layer=-1;
+    return kTRUE;
+  }
+  Int_t i;
+  for(i=0; i<6; i++){
+    if(strSym.BeginsWith(basename[i])) break;
+  }
+
+  if(i>=6){
+    AliErrorClass(Form("%s is not a valid symbolic name for an ITS alignable volume",strSym.Data()));
+    return kFALSE;
+  }
+  
+  layer=i;
+  //The part above could be replaced by just
+  // TString seventh = strSym[7];
+  // layer = seventh.Atoi();
+  // if we don't need to check the validity of the symname
+  
+  level=1;
+  switch(layer){
+    case 0:
+    case 1:
+      if(strSym.Contains("Stave")) level=2;
+      if(strSym.Contains("Ladder")) level=3;
+      break;
+    case 2:
+    case 3:
+    case 4:
+    case 5:
+      if(strSym.Contains("Sensor")) level=2;
+  }
+  
+  return kTRUE;
+}
+
+//________________________________________________________________________
+Int_t AliITSMisAligner::GetNSisters(const char* symname) {
+  //
+  // number of volumes on same level
+  //
+  Int_t layer,level;
+  if(!GetLayerAndLevel(symname,layer,level)) return -1;
+  if(level==0) return -1;
+  if(level==1) return GetNLadders(layer);
+  if(level==2) return GetNDetectors(layer);
+  AliErrorClass(Form("Invalid layer and level"));
+  return -1;
+}
+
+//________________________________________________________________________
+Int_t AliITSMisAligner::GetNDaughters(const char* symname) {
+  //
+  // number of daughter volumes
+  // 
+  Int_t layer,level;
+  if(!GetLayerAndLevel(symname,layer,level)) return -1;
+  if(level==0) {
+    Int_t nLadders = 0;
+    for(Int_t lay=0; lay<6; lay++) nLadders += GetNLadders(lay);
+    return nLadders;
+  }
+  if(level==1) return GetNDetectors(layer);
+  if(level==2){
+    AliWarningClass(Form("Volume %s is a sensitive volume and has no alignable dauthers",symname));
+    return -1;
+  }
+  AliErrorClass(Form("Invalid layer and level"));
+  return -1;
+}
+
+/*
+//________________________________________________________________________
+TString AliITSMisAligner::GetSymbName(Int_t layer,Int_t ladd,Int_t mod) const {
+
+  // Get logical names at the level of SPD ladders / SDD and SSD modules
+
+  Int_t halfStave = mod/2;
+  TString name = GetHalfStaveLadderSymbName(layer,ladd,halfStave);
+
+  if (layer<2) { // SPD
+    name += fStrLadder;
+    name += mod;
+  } 
+  else if (layer>=2 && layer<=5) { // SDD and SSD
+    name += fStrSensor;
+    name += mod;
+  }
+  else {
+    AliFatal("Wrong layer index");
+  }
+  return name;
+}
+*/
diff --git a/ITS/AliITSMisAligner.h b/ITS/AliITSMisAligner.h
new file mode 100644 (file)
index 0000000..098d3e7
--- /dev/null
@@ -0,0 +1,229 @@
+#ifndef ALIITSMISALIGNER_H
+#define ALIITSMISALIGNER_H
+
+// Class building the alignment objects for ITS (SPD, SDD, SSD)
+// It derives from AliMisAligner, thus providing the methods
+// MakeAlObjsArray (builds and returns the array of alignment objects)
+// and GetCDBMetaData (returns the metadata for the OCDB entry)
+//
+
+/* $Id$ */
+
+#include <TString.h>
+#include "AliMisAligner.h"
+#include <TRandom3.h>
+
+class TClonesArray;
+class AliAlignObjParams;
+
+//-------------------------------------------------------------------------
+class AliITSMisAligner : public AliMisAligner{
+    public:
+       AliITSMisAligner();
+       AliITSMisAligner(const AliITSMisAligner &mAligner);
+       AliITSMisAligner &operator= (const AliITSMisAligner &mAligner);
+       ~AliITSMisAligner() {};
+
+       TClonesArray* MakeAlObjsArray();
+       AliCDBMetaData* GetCDBMetaData() const;
+
+       void  SetSeed(Int_t seed) {fRnd.SetSeed(seed); return;}
+
+       void SetWholeITSPars(Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+       {
+           fWholeITS[0] = dx;   fWholeITS[1] = dy;     fWholeITS[2] = dz;
+           fWholeITS[3] = dpsi; fWholeITS[4] = dtheta; fWholeITS[5] = dphi;
+       }
+
+       void SetSPDSectorSigmas(Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+       {
+           fSPDSector[0] = dx;   fSPDSector[1] = dy;     fSPDSector[2] = dz;
+           fSPDSector[3] = dpsi; fSPDSector[4] = dtheta; fSPDSector[5] = dphi;
+       }
+
+       void SetSPDHSSigmas(Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+       {
+           fSPDHS[0] = dx;   fSPDHS[1] = dy;     fSPDHS[2] = dz;
+           fSPDHS[3] = dpsi; fSPDHS[4] = dtheta; fSPDHS[5] = dphi;
+       }
+
+       void SetSPDLadderSigmas(Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+       {
+           fSPDLadder[0] = dx;   fSPDLadder[1] = dy;     fSPDLadder[2] = dz;
+           fSPDLadder[3] = dpsi; fSPDLadder[4] = dtheta; fSPDLadder[5] = dphi;
+       }
+
+       void SetSPDHBSigmas(Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+       {
+           fSPDHB[0] = dx;   fSPDHB[1] = dy;     fSPDHB[2] = dz;
+           fSPDHB[3] = dpsi; fSPDHB[4] = dtheta; fSPDHB[5] = dphi;
+       }
+
+       void SetSPDBarrelSigmas(Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+       {
+           fSPDBarrel[0] = dx;   fSPDBarrel[1] = dy;     fSPDBarrel[2] = dz;
+           fSPDBarrel[3] = dpsi; fSPDBarrel[4] = dtheta; fSPDBarrel[5] = dphi;
+       }
+
+       void SetSDDLayerSigmas(Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+       {
+           fSDDLayer[0] = dx;   fSDDLayer[1] = dy;     fSDDLayer[2] = dz;
+           fSDDLayer[3] = dpsi; fSDDLayer[4] = dtheta; fSDDLayer[5] = dphi;
+       }
+
+       void SetSDDBarrelSigmas(Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+       {
+           fSDDBarrel[0] = dx;   fSDDBarrel[1] = dy;     fSDDBarrel[2] = dz;
+           fSDDBarrel[3] = dpsi; fSDDBarrel[4] = dtheta; fSDDBarrel[5] = dphi;
+       }
+
+       void SetSDDLadderSigmas(Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+       {
+           fSDDLadder[0] = dx;   fSDDLadder[1] = dy;     fSDDLadder[2] = dz;
+           fSDDLadder[3] = dpsi; fSDDLadder[4] = dtheta; fSDDLadder[5] = dphi;
+       }
+
+       void SetSDDModuleSigmas(Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+       {
+           fSDDModule[0] = dx;   fSDDModule[1] = dy;     fSDDModule[2] = dz;
+           fSDDModule[3] = dpsi; fSDDModule[4] = dtheta; fSDDModule[5] = dphi;
+       }
+
+       void SetSSDBarrelPars(Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+       {
+           fSSDBarrel[0] = dx;   fSSDBarrel[1] = dy;     fSSDBarrel[2] = dz;
+           fSSDBarrel[3] = dpsi; fSSDBarrel[4] = dtheta; fSSDBarrel[5] = dphi;
+       }
+
+       void SetSSDLadderSigmas(Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+       {
+           fSSDLadder[0] = dx;   fSSDLadder[1] = dy;     fSSDLadder[2] = dz;
+           fSSDLadder[3] = dpsi; fSSDLadder[4] = dtheta; fSSDLadder[5] = dphi;
+       }
+
+       void SetSSDModuleSigmas(Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+       {
+           fSSDModule[0] = dx;   fSSDModule[1] = dy;     fSSDModule[2] = dz;
+           fSSDModule[3] = dpsi; fSSDModule[4] = dtheta; fSSDModule[5] = dphi;
+       }
+
+       void SetSPDLadderShiftT(Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+       {
+           fSPDLadderShiftT[0] = dx;   fSPDLadderShiftT[1] = dy;     fSPDLadderShiftT[2] = dz;
+           fSPDLadderShiftT[3] = dpsi; fSPDLadderShiftT[4] = dtheta; fSPDLadderShiftT[5] = dphi;
+       }
+
+       void SetSPDLadderShiftB(Double_t dx, Double_t dy, Double_t dz, Double_t dpsi, Double_t dtheta, Double_t dphi)
+       {
+           fSPDLadderShiftB[0] = dx;   fSPDLadderShiftB[1] = dy;     fSPDLadderShiftB[2] = dz;
+           fSPDLadderShiftB[3] = dpsi; fSPDLadderShiftB[4] = dtheta; fSPDLadderShiftB[5] = dphi;
+       }
+
+       void SetSPDLadderShiftT(Double_t pars[6])
+       {
+           for(Int_t ii=0; ii<6; ii++)
+               fSPDLadderShiftT[ii] = pars[ii];
+       }
+
+       void SetSPDLadderShiftB(Double_t pars[6])
+       {
+           for(Int_t ii=0; ii<6; ii++)
+               fSPDLadderShiftB[ii] = pars[ii];
+       }
+
+       void  SetWholeITSMisAlignment();
+       void  SetSPDMisAlignment();
+       void  SetSDDMisAlignment();
+       void  SetSSDMisAlignment();
+
+       Double_t GetUnif(Double_t x1,Double_t x2) {return fRnd.Uniform(x1,x2);}
+
+       Bool_t AddAlignObj(char* name,Double_t dx,Double_t dy,Double_t dz,
+               Double_t dpsi,Double_t dtheta,Double_t dphi,
+               const char* distrib);
+
+       Bool_t AddAlignObj(Int_t lay,Double_t dx,Double_t dy,Double_t dz,
+               Double_t dpsi,Double_t dtheta,Double_t dphi,
+               Bool_t unif);
+
+       Bool_t AddAlignObj(Int_t lay,Int_t ladd,Double_t dx,Double_t dy,Double_t dz,
+               Double_t dpsi,Double_t dtheta,Double_t dphi,
+               Double_t xShift,Double_t yShift,Double_t zShift,
+               Double_t psiShift,Double_t thetaShift,Double_t phiShift,
+               Bool_t unif);
+
+       Bool_t AddSectorAlignObj(Int_t sectMin,Int_t sectMax,
+               Double_t dx,Double_t dy,Double_t dz,
+               Double_t dpsi,Double_t dtheta,Double_t dphi,
+               Double_t xShift,Double_t yShift,Double_t zShift,
+               Double_t psiShift,Double_t thetaShift,Double_t phiShift,
+               Bool_t unif);
+
+       void  ShiftAlignObj(AliAlignObjParams &alObj,Double_t dx,Double_t dy,Double_t dz,Double_t dpsi,Double_t dtheta,Double_t dphi);
+       void  SmearAlignObj(AliAlignObjParams &alObj,Double_t sx,Double_t sy,Double_t sz,Double_t spsi,Double_t stheta,Double_t sphi);
+
+       const char*  GetSymbName(Int_t layer) const;
+       const char*  GetSymbName(Int_t layer,Int_t ladd) const;
+       const char*  GetSymbName(Int_t layer,Int_t ladd,Int_t mod) const;
+       const char*  GetHalfStaveLadderSymbName(Int_t layer,Int_t ladd,Int_t halfStave) const;
+       static const char*  GetParentSymName(const char* symname) ;
+       // const char*  GetSistersSymName(const char* symname) const;
+       static Bool_t GetLayerAndLevel(const char* symname, Int_t &layer, Int_t &level);
+
+       static Int_t GetNLayers()             {return kNLayers;}
+       static Int_t GetNLadders(Int_t lay)   {return fgkNLadders[lay];}
+       static Int_t GetNDetectors(Int_t lay) {return fgkNDetectors[lay];}
+       static Int_t GetNSisters(const char* symname);
+       static Int_t GetNDaughters(const char* symname);
+
+    protected:
+       TRandom3     fRnd; // TRandom3 object
+       //TRandom     fRnd; // TRandom object
+       Int_t        fInd; // index of current AliAlignObjParams in fAlignObjArray
+       TClonesArray *fAlignObjArray; // array of AliAlignObjParams
+       TString      fStrSPD; // name of SPD
+       TString      fStrSDD; // name of SDD
+       TString      fStrSSD; // name of SSD
+       TString      fStrStave; // name of SPD stave
+       TString      fStrHalfStave; // name of SPD half-stave
+       TString      fStrLadder; // name of SPD ladder
+       TString      fStrSector; // name of SPD sector
+       TString      fStrSensor; // name of sensitive volume
+
+    private:
+       enum {kNLayers = 6}; // The number of layers.
+       static const Int_t  fgkNLadders[kNLayers];  // Array of the number of ladders/layer(layer)
+       static const Int_t  fgkNDetectors[kNLayers];// Array of the number of detector/ladder(layer)
+
+       // Parameters setting the misalignment at all SPD/SDD/SSD levels
+       Double_t fWholeITS[6];
+       Double_t fSPDSector[6];
+       Double_t fSPDHB[6];
+       Double_t fSPDBarrel[6];
+       Double_t fSPDHS[6];
+       Double_t fSPDLadder[6];
+       Double_t fSDDLayer[6];
+       Double_t fSDDBarrel[6];
+       Double_t fSDDLadder[6];
+       Double_t fSDDModule[6];
+       Double_t fSSDBarrel[6];
+       Double_t fSSDLayer[6];
+       Double_t fSSDLadder[6];
+       Double_t fSSDModule[6];
+
+       // Parameters setting common shifts (used for "full" misalignment)
+       Double_t fSPDLadderShiftT[6]; // for top half-barrel ladders
+       Double_t fSPDLadderShiftB[6]; // for bottom half-barrel ladders
+       Double_t fSDDLadderShift1[6];
+       Double_t fSDDLadderShift2[6];
+       Double_t fSSDLadderShift1[6];
+       Double_t fSSDLadderShift2[6];
+
+       // Choice between uniform (kTRUE) or gaussian (kFALSE) distribution in the smearing
+       Bool_t fUnifSPDSector, fUnifSPDHS, fUnifSDDLadder, fUnifSSDLadder, fUnifSPDLadder, fUnifSDDModule, fUnifSSDModule;
+
+       ClassDef(AliITSMisAligner,0)   //ITS MisAligner
+};
+
+
+#endif
diff --git a/ITS/AliITSMisalignMaker.cxx b/ITS/AliITSMisalignMaker.cxx
deleted file mode 100644 (file)
index 370af32..0000000
+++ /dev/null
@@ -1,526 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-2007, 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.                  *
- **************************************************************************/
-
-/* $Id$  */
-
-//========================================================================
-//
-// This class is a helper, producing ITS aligmnent objects.
-// It provides also some useful functions
-// See the parameters of the misalignment at the end of this script.
-//
-// Main author: L. Gaudichet
-// Contact: andrea.dainese@lnl.infn.it
-//
-//========================================================================
-
-#include <TRandom3.h>
-#include <TClonesArray.h>
-#include <TClass.h>
-
-
-#include "AliLog.h"
-#include "AliAlignObjParams.h"
-#include "AliITSMisalignMaker.h"
-
-
-ClassImp(AliITSMisalignMaker)
-  
-const Int_t AliITSMisalignMaker::fgkNLadders[AliITSMisalignMaker::kNLayers] = {20,40,14,22,34,38};
-const Int_t AliITSMisalignMaker::fgkNDetectors[AliITSMisalignMaker::kNLayers] = {4,4,6,8,22,25};
-
-
-//________________________________________________________________________
-AliITSMisalignMaker::AliITSMisalignMaker():
-  fRnd(),
-  fInd(0),
-  fAlobj(TClonesArray("AliAlignObjParams",4000)),
-  fStrSPD("ITS/SPD"),
-  fStrSDD("ITS/SDD"),
-  fStrSSD("ITS/SSD"),
-  fStrStave("/Stave"),
-  fStrHalfStave("/HalfStave"),
-  fStrLadder("/Ladder"),
-  fStrSector("/Sector"),
-  fStrSensor("/Sensor")
-{
-  //
-  // defaul constructor
-  //
-  fRnd.SetSeed(38217945);
-}
-//________________________________________________________________________
-Int_t AliITSMisalignMaker::AddAlignObj(char* name,Double_t dx,Double_t dy,Double_t dz,
-                               Double_t dpsi,Double_t dtheta,Double_t dphi,const char* distrib) {
-  //
-  // misalignment by symname
-  //
-  Double_t vx=0.,vy=0.,vz=0.,vpsi=0.,vtheta=0.,vphi=0.;
-
-  TString sdistrib(distrib);
-
-  if(sdistrib==TString("gaussian")) {
-    vx = GaussCut(0,dx/3.,dx); // mean, sigma, max absolute value 
-    vy = GaussCut(0,dy/3.,dy);
-    vz = GaussCut(0,dz/3.,dz);
-    vpsi   = GaussCut(0,dpsi/3.,  dpsi );
-    vtheta = GaussCut(0,dtheta/3.,dtheta);
-    vphi   = GaussCut(0,dphi/3.,  dphi);
-  }else if(sdistrib==TString("uniform")){ 
-    vx = fRnd.Uniform(-dx,dx);
-    vy = fRnd.Uniform(-dy,dy);
-    vz = fRnd.Uniform(-dz,dz);
-    vpsi = fRnd.Uniform(-dpsi,dpsi);
-    vtheta = fRnd.Uniform(-dtheta,dtheta);
-    vphi = fRnd.Uniform(-dphi,dphi);
-  }else if(sdistrib==TString("fixed")){
-    vx=dx;
-    vy=dy;
-    vz=dz;
-    vpsi=dpsi;
-    vtheta=dtheta;
-    vphi=dphi;
-  }else{
-    AliFatal(Form("Invalid string \"%s\" specifying the misalignment type for the volume \"%s\""));
-  }
-
-  new(fAlobj[fInd]) AliAlignObjParams(name,0,vx,vy,vz,vpsi,vtheta,vphi,kFALSE);
-
-  AliAlignObjParams* itsalobj = (AliAlignObjParams*) fAlobj.UncheckedAt(fInd);
-  itsalobj->ApplyToGeometry();
-
-  fInd++;
-
-  return kTRUE;
-}
-
-
-//________________________________________________________________________
-Int_t AliITSMisalignMaker::AddAlignObj(Int_t lay,Double_t dx,Double_t dy,Double_t dz,
-                                Double_t dpsi,Double_t dtheta,Double_t dphi,Bool_t unif) {
-  //
-  // misalignment at the level of ladders/modules
-  //
-  lay+=1; // layers are numbered from 1 to 6 in AliGeomManager
-
-  printf("LAYER %d  MODULES %d\n",lay,AliGeomManager::LayerSize(lay));
-
-  for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(lay); iModule++) {
-
-    Double_t vx,vy,vz,vpsi,vtheta,vphi;
-    
-    if(!unif) {
-      vx = GaussCut(0,dx/3.,dx); // mean, sigma, max absolute value 
-      vy = GaussCut(0,dy/3.,dy);
-      vz = GaussCut(0,dz/3.,dz);
-      vpsi   = GaussCut(0,dpsi/3.,  dpsi );
-      vtheta = GaussCut(0,dtheta/3.,dtheta);
-      vphi   = GaussCut(0,dphi/3.,  dphi);
-    } else {
-      vx = fRnd.Uniform(-dx,dx);
-      vy = fRnd.Uniform(-dy,dy);
-      vz = fRnd.Uniform(-dz,dz);
-      vpsi = fRnd.Uniform(-dpsi,dpsi);
-      vtheta = fRnd.Uniform(-dtheta,dtheta);
-      vphi = fRnd.Uniform(-dphi,dphi);
-    }
-    
-    UShort_t volid = AliGeomManager::LayerToVolUID(lay,iModule);
-    const char *symname = AliGeomManager::SymName(volid);
-    
-    new(fAlobj[fInd]) AliAlignObjParams(symname,volid,vx,vy,vz,vpsi,vtheta,vphi,kFALSE);
-    AliAlignObjParams* itsalobj = (AliAlignObjParams*) fAlobj.UncheckedAt(fInd);
-    itsalobj->ApplyToGeometry();
-    fInd++; 
-  }
-
-  return kTRUE;
-}
-
-//________________________________________________________________________
-Int_t AliITSMisalignMaker::AddAlignObj(Int_t lay,Int_t ladd,Double_t dx,Double_t dy,Double_t dz,
-                                      Double_t dpsi,Double_t dtheta,Double_t dphi,
-                                      Double_t xShift,Double_t yShift,Double_t zShift,
-                                      Double_t psiShift,Double_t thetaShift,Double_t phiShift,
-                                      Bool_t unif) {
-  //
-  // misalignment at the level of half-staves/ladders (ladd=-1 means that all ladders are scanned)
-  //
-  Double_t vx,vy,vz,vpsi,vtheta,vphi;
-  Double_t tr[3],rot[3];  
-  
-  Int_t laddMin = ladd;
-  Int_t laddMax = laddMin+1;
-  if (ladd<0) {
-    laddMin = 0;
-    laddMax = fgkNLadders[lay];
-  }
-
-  for (Int_t iLadd=laddMin; iLadd<laddMax; iLadd++) {
-
-    Int_t nHS = 1; 
-    if (lay<2) nHS = 2;
-    for (Int_t iHalfStave=0; iHalfStave<nHS; iHalfStave++) {
-      
-      if(!unif) {
-       vx = GaussCut(0,dx/3.,dx); // mean, sigma, max absolute value 
-       vy = GaussCut(0,dy/3.,dy);
-       vz = GaussCut(0,dz/3.,dz);
-       vpsi   = GaussCut(0,dpsi/3.,  dpsi );
-       vtheta = GaussCut(0,dtheta/3.,dtheta);
-       vphi   = GaussCut(0,dphi/3.,  dphi);
-      } else {
-       vx = fRnd.Uniform(-dx,dx);
-       vy = fRnd.Uniform(-dy,dy);
-       vz = fRnd.Uniform(-dz,dz);
-       vpsi = fRnd.Uniform(-dpsi,dpsi);
-       vtheta = fRnd.Uniform(-dtheta,dtheta);
-       vphi = fRnd.Uniform(-dphi,dphi);
-      }
-
-      TString name(GetHalfStaveLadderSymbName(lay,iLadd,iHalfStave));
-
-      // first apply half-stave / ladder level misalignment
-      AliAlignObjParams aaop(name.Data(),0,vx,vy,vz,vpsi,vtheta,vphi,kFALSE); // set them as local
-      aaop.GetPars(tr,rot); // global
-
-      // then, apply layer-level misalignment (only for SDD and SSD)
-      if(lay>1) {
-       tr[0] += xShift;
-       tr[1] += yShift;
-       tr[2] += zShift;
-       rot[0] += psiShift;
-       rot[1] += thetaShift;
-       rot[2] += phiShift;
-      }
-      new(fAlobj[fInd]) AliAlignObjParams(name.Data(),0,tr[0],tr[1],tr[2],rot[0],rot[1],rot[2],kTRUE); // set them as global
-
-      AliAlignObjParams* itsalobj = (AliAlignObjParams*) fAlobj.UncheckedAt(fInd);
-      itsalobj->ApplyToGeometry();
-      fInd++;
-    }
-  }
-  
-  return kTRUE;
-}
-
-
-//________________________________________________________________________
-Int_t AliITSMisalignMaker::AddSectorAlignObj(Int_t sectMin,Int_t sectMax,
-                                      Double_t dx,Double_t dy,Double_t dz,
-                                      Double_t dpsi,Double_t dtheta,Double_t dphi,
-                                      Double_t xShift,Double_t yShift,Double_t zShift,
-                                      Double_t psiShift,Double_t thetaShift,Double_t phiShift,Bool_t unif) {
-  //
-  // misalignment at the level of SPD sectors and half-barrels
-  // 
-
-  if ((sectMin<1) || (sectMax>10)) return kFALSE;
-  Double_t vx,vy,vz,vpsi,vtheta,vphi;
-  Double_t tr[3],rot[3];  
-
-  for (Int_t iSect = sectMin-1; iSect<sectMax; iSect++) {
-
-    // first, apply sector level misalignment    
-    if(!unif) {
-      vx = GaussCut(0,dx/3.,dx); // mean, sigma, max absolute value 
-      vy = GaussCut(0,dy/3.,dy);
-      vz = GaussCut(0,dz/3.,dz);
-      vpsi   = GaussCut(0,dpsi/3.,  dpsi );
-      vtheta = GaussCut(0,dtheta/3.,dtheta);
-      vphi   = GaussCut(0,dphi/3.,  dphi);
-    } else {
-      vx = fRnd.Uniform(-dx,dx);
-      vy = fRnd.Uniform(-dy,dy);
-      vz = fRnd.Uniform(-dz,dz);
-      vpsi = fRnd.Uniform(-dpsi,dpsi);
-      vtheta = fRnd.Uniform(-dtheta,dtheta);
-      vphi = fRnd.Uniform(-dphi,dphi);
-    }
-
-    TString name(GetSymbName(0));
-    name += fStrSector;
-    name += iSect;
-
-
-    AliAlignObjParams aaop(name.Data(),0,vx,vy,vz,vpsi,vtheta,vphi,kFALSE); // set them as local
-    aaop.GetPars(tr,rot); // global
-
-    // then, apply half-barrel level misalignment
-    tr[0] += xShift;
-    tr[1] += yShift;
-    tr[2] += zShift;
-    rot[0] += psiShift;
-    rot[1] += thetaShift;
-    rot[2] += phiShift;
-
-    new(fAlobj[fInd]) AliAlignObjParams(name.Data(),0,tr[0],tr[1],tr[2],rot[0],rot[1],rot[2],kTRUE); // set them as global
-
-    AliAlignObjParams* itsalobj = (AliAlignObjParams*) fAlobj.UncheckedAt(fInd);
-    itsalobj->ApplyToGeometry();
-    fInd++;
-  }
-  return kTRUE;
-}
-
-//________________________________________________________________________
-Double_t AliITSMisalignMaker::GaussCut(Double_t mean,Double_t sigma,Double_t absMax) {
-  //
-  // random from gaussian with cut on tails
-  //
-  Double_t val = fRnd.Gaus(mean,sigma);
-  while (TMath::Abs(val-mean)>absMax)
-    val = fRnd.Gaus(mean,sigma);
-  return val;
-}
-
-//________________________________________________________________________
-const char* AliITSMisalignMaker::GetSymbName(Int_t layer) const {
-  //
-  // be careful : SPD0 and SPD1 are not physically separated 
-  //
-  TString name;
-  switch (layer) {
-  case 0:
-  case 1: name = fStrSPD; name += layer; break;
-  case 2:
-  case 3: name = fStrSDD; name += layer; break;
-  case 4:
-  case 5: name = fStrSSD; name += layer; break;
-  default: AliFatal("Wrong layer index");
-  }
-  return name.Data();
-}
-
-//________________________________________________________________________
-const char* AliITSMisalignMaker::GetSymbName(Int_t layer, Int_t ladder, Int_t det) const {
-  //
-  // symname from layer, ladder, detector
-  //
-  TString symname(GetHalfStaveLadderSymbName(layer,ladder,det));
-  if(layer<=2){
-    symname+="Ladder";
-  }else if(layer<=6){
-    symname+="Sensor";
-  }else{
-    AliError("Invalid layer!");
-    return 0;
-  }
-  symname+=det;
-  return symname.Data();
-}
-
-//________________________________________________________________________
-const char* AliITSMisalignMaker::GetSymbName(Int_t layer,Int_t ladd) const {
-  //
-  // Get logical names at the level of staves / ladders
-  //
-  TString name(GetSymbName(layer));
-  if (layer==0) { // SPD1
-
-    int sector = ladd/2;
-    name += fStrSector;
-    name += sector;
-    int stave = ladd-sector*2;
-    name += fStrStave;
-    name += stave;
-  }
-  else if (layer==1) { // SPD2
-
-    int sector = ladd/4;
-    name += fStrSector;
-    name += sector;
-    int stave = ladd-sector*4;
-    name += fStrStave;
-    name += stave;
-  }
-  else if (layer>=2 && layer<=5) { // SDD and SSD
-    name += fStrLadder;
-    name += ladd;
-  }
-  else {
-    AliFatal("Wrong layer index");
-  }
-  return name.Data();
-}
-
-//________________________________________________________________________
-const char* AliITSMisalignMaker::GetHalfStaveLadderSymbName(Int_t layer,Int_t ladd,Int_t halfStave) const {
-  //
-  // Get logical names at the level of half-staves (SPD) or ladders (SDD and SSD)
-  //
-  TString name(GetSymbName(layer));
-  if (layer==0) { // SPD1
-
-    int sector = ladd/2;
-    name += fStrSector;
-    name += sector;
-    int stave = ladd-sector*2;
-    name += fStrStave;
-    name += stave;
-    name += fStrHalfStave;
-    name += halfStave;
-  }
-  else if (layer==1) { // SPD2
-
-    int sector = ladd/4;
-    name += fStrSector;
-    name += sector;
-    int stave = ladd-sector*4;
-    name += fStrStave;
-    name += stave;
-    name += fStrHalfStave;
-    name += halfStave;
-  }
-  else if (layer>=2 && layer<=5) { // SDD and SSD
-    name += fStrLadder;
-    name += ladd;
-  } 
-  else {
-    AliFatal("Wrong layer index");
-  }
-  return name.Data();
-}
-
-//________________________________________________________________________
-const char* AliITSMisalignMaker::GetParentSymName(const char* symname) {
-  //
-  // symnane of parent volume
-  //
-  TString parent(symname);
-  // Give the symname of 
-  if(parent.BeginsWith('/')) parent.Remove(TString::kLeading,'/');
-  if(parent.EndsWith("/")) parent.Remove(TString::kTrailing,'/');
-  
-  if(!parent.CountChar('/')) AliErrorClass("Not a valid symbolic name");
-
-  Int_t layer,level;
-  GetLayerAndLevel(symname,layer,level);
-  if(level==1) return "ITS";
-  
-  parent.Remove(parent.Last('/'));
-  
-  if((layer==0 || layer==1) && level==2){
-    parent.Remove(parent.Last('/'));
-    parent[7]='0';
-  }
-    
-  return parent.Data(); 
-}
-
-//________________________________________________________________________
-Bool_t AliITSMisalignMaker::GetLayerAndLevel(const char* symname, Int_t &layer, Int_t &level) {
-  //
-  // given the symbolic name set layer and level
-  //
-  const char* basename[6] = {"ITS/SPD0/Sector","ITS/SPD1/Sector","ITS/SDD2/Ladder","ITS/SDD3/Ladder","ITS/SSD4/Ladder","ITS/SSD5/Ladder"};
-  TString strSym(symname);
-  if(strSym=="ITS"){
-    level=0;
-    layer=-1;
-    return kTRUE;
-  }
-  Int_t i;
-  for(i=0; i<6; i++){
-    if(strSym.BeginsWith(basename[i])) break;
-  }
-
-  if(i>=6){
-    AliErrorClass(Form("%s is not a valid symbolic name for an ITS alignable volume",strSym.Data()));
-    return kFALSE;
-  }
-  
-  layer=i;
-  //The part above could be replaced by just
-  // TString seventh = strSym[7];
-  // layer = seventh.Atoi();
-  // if we don't need to check the validity of the symname
-  
-  level=1;
-  switch(layer){
-    case 0:
-    case 1:
-      if(strSym.Contains("Stave")) level=2;
-      if(strSym.Contains("Ladder")) level=3;
-      break;
-    case 2:
-    case 3:
-    case 4:
-    case 5:
-      if(strSym.Contains("Sensor")) level=2;
-  }
-  
-  return kTRUE;
-}
-
-//________________________________________________________________________
-Int_t AliITSMisalignMaker::GetNSisters(const char* symname) {
-  //
-  // number of volumes on same level
-  //
-  Int_t layer,level;
-  if(!GetLayerAndLevel(symname,layer,level)) return -1;
-  if(level==0) return -1;
-  if(level==1) return GetNLadders(layer);
-  if(level==2) return GetNDetectors(layer);
-  AliErrorClass(Form("Invalid layer and level"));
-  return -1;
-}
-
-//________________________________________________________________________
-Int_t AliITSMisalignMaker::GetNDaughters(const char* symname) {
-  //
-  // number of daughter volumes
-  // 
-  Int_t layer,level;
-  if(!GetLayerAndLevel(symname,layer,level)) return -1;
-  if(level==0) {
-    Int_t nLadders = 0;
-    for(Int_t lay=0; lay<6; lay++) nLadders += GetNLadders(lay);
-    return nLadders;
-  }
-  if(level==1) return GetNDetectors(layer);
-  if(level==2){
-    AliWarningClass(Form("Volume %s is a sensitive volume and has no alignable dauthers",symname));
-    return -1;
-  }
-  AliErrorClass(Form("Invalid layer and level"));
-  return -1;
-}
-
-/*
-//________________________________________________________________________
-TString AliITSMisalignMaker::GetSymbName(Int_t layer,Int_t ladd,Int_t mod) const {
-
-  // Get logical names at the level of SPD ladders / SDD and SSD modules
-
-  Int_t halfStave = mod/2;
-  TString name = GetHalfStaveLadderSymbName(layer,ladd,halfStave);
-
-  if (layer<2) { // SPD
-    name += fStrLadder;
-    name += mod;
-  } 
-  else if (layer>=2 && layer<=5) { // SDD and SSD
-    name += fStrSensor;
-    name += mod;
-  }
-  else {
-    AliFatal("Wrong layer index");
-  }
-  return name;
-}
-*/
-
diff --git a/ITS/AliITSMisalignMaker.h b/ITS/AliITSMisalignMaker.h
deleted file mode 100644 (file)
index 4aaf322..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-#ifndef ALIITSMISALIGNMAKER_H
-#define ALIITSMISALIGNMAKER_H
-/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/* $Id$  */
-//------------------------------------------------------------------------
-//
-// This class is a helper, producing ITS aligmnent objects.
-// It provides also some useful functions
-// See the parameters of the misalignment at the end of this script.
-//
-// Main author: L. Gaudichet
-// Contact: andrea.dainese@lnl.infn.it
-//
-//------------------------------------------------------------------------
-
-#include <TRandom3.h>
-#include <TString.h>
-#include <TClonesArray.h>
-
-
-//-------------------------------------------------------------------------
-class AliITSMisalignMaker : public TObject {
-  
-public:
-  AliITSMisalignMaker();
-  
-  ~AliITSMisalignMaker() {};
-  
-  TClonesArray* GetArray() {return &fAlobj;}
-
-  void  SetSeed(Int_t seed) {fRnd.SetSeed(seed); return;}
-
-  Double_t GetUnif(Double_t x1,Double_t x2) {return fRnd.Uniform(x1,x2);}
-  
-  Int_t AddAlignObj(char* name,Double_t dx,Double_t dy,Double_t dz,
-                   Double_t dpsi,Double_t dtheta,Double_t dphi,
-                   const char* distrib);
-
-  Int_t AddAlignObj(Int_t lay,Double_t dx,Double_t dy,Double_t dz,
-                   Double_t dpsi,Double_t dtheta,Double_t dphi,
-                   Bool_t unif);
-
-  Int_t AddAlignObj(Int_t lay,Int_t ladd,Double_t dx,Double_t dy,Double_t dz,
-                   Double_t dpsi,Double_t dtheta,Double_t dphi,
-                   Double_t xShift,Double_t yShift,Double_t zShift,
-                   Double_t psiShift,Double_t thetaShift,Double_t phiShift,
-                   Bool_t unif);
-
-  Int_t AddSectorAlignObj(Int_t sectMin,Int_t sectMax,
-                         Double_t dx,Double_t dy,Double_t dz,
-                         Double_t dpsi,Double_t dtheta,Double_t dphi,
-                         Double_t xShift,Double_t yShift,Double_t zShift,
-                         Double_t psiShift,Double_t thetaShift,Double_t phiShift,
-                         Bool_t unif);
-
-  const char*  GetSymbName(Int_t layer) const;
-  const char*  GetSymbName(Int_t layer,Int_t ladd) const;
-  const char*  GetSymbName(Int_t layer,Int_t ladd,Int_t mod) const;
-  const char*  GetHalfStaveLadderSymbName(Int_t layer,Int_t ladd,Int_t halfStave) const;
-  Double_t GaussCut(Double_t mean,Double_t sigma,Double_t cutn);
-  static const char*  GetParentSymName(const char* symname) ;
-  // const char*  GetSistersSymName(const char* symname) const;
-  static Bool_t GetLayerAndLevel(const char* symname, Int_t &layer, Int_t &level);
-  
-  static Int_t GetNLayers()             {return kNLayers;}
-  static Int_t GetNLadders(Int_t lay)   {return fgkNLadders[lay];}
-  static Int_t GetNDetectors(Int_t lay) {return fgkNDetectors[lay];}
-  static Int_t GetNSisters(const char* symname);
-  static Int_t GetNDaughters(const char* symname);
-
-protected:
-  TRandom3     fRnd; // TRandom object
-  Int_t        fInd; // index of current AliAlignObjParams in fAlobj
-  TClonesArray fAlobj; // array of AliAlignObjParams
-  TString      fStrSPD; // name of SPD
-  TString      fStrSDD; // name of SDD
-  TString      fStrSSD; // name of SSD
-  TString      fStrStave; // name of SPD stave
-  TString      fStrHalfStave; // name of SPD half-stave
-  TString      fStrLadder; // name of SPD ladder
-  TString      fStrSector; // name of SPD sector
-  TString      fStrSensor; // name of sensitive volume
-
-private:
-  enum {kNLayers = 6}; // The number of layers.
-  static const Int_t  fgkNLadders[kNLayers];  // Array of the number of ladders/layer(layer)
-  static const Int_t  fgkNDetectors[kNLayers];// Array of the number of detector/ladder(layer)
-
-  ClassDef(AliITSMisalignMaker,1)   //ITS Misalign Maker
-};
-
-
-#endif
index fefa3a840e64dd7d7e29971c79919ca07591b53d..9853d12b4cd79b0c3012a556cc76a640cb4ee3a4 100644 (file)
@@ -18,7 +18,7 @@ set(SRCS
                AliITSMap.cxx
                AliITSMapA1.cxx
                AliITSMapA2.cxx
-               AliITSMisalignMaker.cxx
+               AliITSMisAligner.cxx
                AliITSpList.cxx
                AliITSpListItem.cxx
                AliITSsegmentation.cxx
index ce5430fa959f3fc6cb400d83eaf3f8878d31318a..4ed30c2b995d5e90277a1f3a16e503fc94553e16 100644 (file)
@@ -40,7 +40,7 @@
 #pragma link C++ class  AliITSMap+;
 #pragma link C++ class  AliITSMapA1+;
 #pragma link C++ class  AliITSMapA2+;
-#pragma link C++ class  AliITSMisalignMaker+;
+#pragma link C++ class  AliITSMisAligner+;
 #pragma link C++ class  AliITSsegmentation+;
 #pragma link C++ class  AliITSsegmentationSPD+;
 #pragma link C++ class  AliITSsegmentationSDD+;
diff --git a/ITS/MakeITSFullMisAlignment.C b/ITS/MakeITSFullMisAlignment.C
deleted file mode 100644 (file)
index 65b7eeb..0000000
+++ /dev/null
@@ -1,404 +0,0 @@
-#if !defined(__CINT__) || defined(__MAKECINT__)
-#include <TError.h>
-#include <TFile.h>
-#include <TGeoManager.h>
-#include <TMath.h>
-#include <TString.h>
-#include <TSystem.h>
-#include "AliCDBPath.h"
-#include "AliCDBEntry.h"
-#include "AliCDBManager.h"
-#include "AliCDBStorage.h"
-#include "AliGeomManager.h"
-#include "AliITSMisalignMaker.h"
-#endif
-
-
-TRandom3 rnd;
-rnd.SetSeed(23457856);
-
-void MakeITSFullMisAlignment() {
-//========================================================================
-//
-// Macro for ITS full (realistic) misalignment
-//
-// Main author: L. Gaudichet
-// Contact: andrea.dainese@lnl.infn.it
-//
-//========================================================================
-
-
-  const char* macroname = "MakeITSFullMisAlignment.C";
-
-  // Activate CDB storage and load geometry from CDB
-  AliCDBManager* cdb = AliCDBManager::Instance();
-  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
-  cdb->SetRun(0);
-  
-  AliCDBStorage* storage = NULL;
-
-  if(TString(gSystem->Getenv("TOCDB")) == TString("kTRUE")){
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
-    AliCDBPath path("GRP","Geometry","Data");
-    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
-    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
-    entry->SetOwner(0);
-    TGeoManager* geom = (TGeoManager*) entry->GetObject();
-    AliGeomManager::SetGeometry(geom);
-  }else{
-    AliGeomManager::LoadGeometry("geometry.root"); //load geom from default CDB storage
-  }    
-
-  //   SETTINGS:
-  //   - tranformations are defined by the "maximum transformation" 
-  //     dx,dy,dz,dpsi,dtheta,dphi: then we take a Gaussian with sigma=dx/3
-  //     and we cut it at +- 3*sigma = dx 
-  //     (the option "unif" allows to sample from a uniform distr.)
-  //   - units are cm and deg
-  //   - transformations are defined in the local frame of the volume
-  //     being misaligned
-  //
-  const Float_t kRadToDeg = 180./TMath::Pi();
-
-
-  //=****************************************
-  // misalignment of the whole ITS according to survey as reported by Werner Riegler (18/07/2008)
-  // + 100um smearing for translations and 0.1mrad smearing for rotations
-  //=****************************************
-  Double_t sigmatrW = 0.01;
-  Double_t sigmarotW = 0.006;
-  Double_t its_dx     = AliMathBase::TruncatedGaus(-0.12,sigmatrW,3.*sigmatrW);
-  Double_t its_dy     = AliMathBase::TruncatedGaus(-0.07,sigmatrW,3.*sigmatrW);
-  Double_t its_dz     = AliMathBase::TruncatedGaus(0.29,sigmatrW,3.*sigmatrW);
-  Double_t its_dpsi   = AliMathBase::TruncatedGaus(0.,sigmarotW,3.*sigmarotW);
-  Double_t its_dtheta = AliMathBase::TruncatedGaus(0.03,sigmarotW,3.*sigmarotW);
-  Double_t its_dphi   = AliMathBase::TruncatedGaus(0.04,sigmarotW,3.*sigmarotW);
-  const char* unifits="fixed";
-
-  //=****************************************
-  // misalignment at the level of SPD sectors : source - A.Pepato
-  //=****************************************
-  Float_t spdsector_dx     = 0.0050; //  50 micron (~tangetial, i.e. rphi) 
-  Float_t spdsector_dy     = 0.0100; // 100 micron (~radial)
-  Float_t spdsector_dz     = 0.0100; // 100 micron
-  Float_t spdsector_dpsi   = 0.0100/30.*kRadToDeg;; // so as to have 100 micron difference at the two extremes
-  Float_t spdsector_dtheta = 0.0100/30.*kRadToDeg;; // so as to have 100 micron difference at the two extremes
-  Float_t spdsector_dphi   = 0.0050/1.5*kRadToDeg;; // so as to have 50 micron difference at the two extremes
-  Bool_t unifspdsector=kTRUE;
-
-  //=****************************************
-  // misalignment at the level of SPD half-barrels : source - A.Pepato
-  //=****************************************
-  Float_t spdhalfbarrel_dx     = 0.0200; // 200 micron  
-  Float_t spdhalfbarrel_dy     = 0.0200; // 200 micron 
-  Float_t spdhalfbarrel_dz     = 0.0200; // 200 micron
-  Float_t spdhalfbarrel_dpsi   = 0.0100/30.*kRadToDeg; // so as to have 100 micron difference at the two extremes
-  Float_t spdhalfbarrel_dtheta = 0.0100/30.*kRadToDeg; // so as to have 100 micron difference at the two extremes
-  Float_t spdhalfbarrel_dphi   = 0.0100/7.*kRadToDeg; // so as to have 100 micron difference at the two extremes
-
-  //=****************************************
-  // misalignment at the level of SPD barrel : source - A.Pepato
-  //=****************************************
-  Float_t spdbarrel_dx     = 0.1000; // 1 mm (very pessimistic)  
-  Float_t spdbarrel_dy     = 0.1000; // 1 mm (very pessimistic)
-  Float_t spdbarrel_dz     = 0.1000; // 1 mm (very pessimistic)
-  Float_t spdbarrel_dpsi   = 0.0500/30.*kRadToDeg; // so as to have 500 micron difference at the two extremes
-  Float_t spdbarrel_dtheta = 0.0500/30.*kRadToDeg; // so as to have 500 micron difference at the two extremes
-  Float_t spdbarrel_dphi   = 0.0500/7.*kRadToDeg; // so as to have 500 micron difference at the two extremes
-  
-
-  //=****************************************
-  // misalignment at the level of SDD and SSD layers: source - B.Giraudo
-  //=****************************************
-  Float_t sddlayer_dx     = 0.0010; // 10 micron
-  Float_t sddlayer_dy     = 0.0010; // 10 micron
-  Float_t sddlayer_dz     = 0.0010; // 10 micron
-  Float_t sddlayer_dpsi   = 0.0010/52.*kRadToDeg; // so as to have 10 micron difference at the two extremes
-  Float_t sddlayer_dtheta = 0.0010/52.*kRadToDeg; // so as to have 10 micron difference at the two extremes
-  Float_t sddlayer_dphi   = 0.0010/20.*kRadToDeg;  // so as to have 10 micron difference at the two extremes
-
-  Float_t ssdlayer_dx     = 0.0010; // 10 micron
-  Float_t ssdlayer_dy     = 0.0010; // 10 micron
-  Float_t ssdlayer_dz     = 0.0010; // 10 micron
-  Float_t ssdlayer_dpsi   = 0.0010/90.*kRadToDeg; // so as to have 10 micron difference at the two extremes
-  Float_t ssdlayer_dtheta = 0.0010/90.*kRadToDeg; // so as to have 10 micron difference at the two extremes
-  Float_t ssdlayer_dphi   = 0.0010/40.*kRadToDeg;  // so as to have 10 micron difference at the two extremes
-
-  Float_t sddbarrel_dx     = 0.0020; // 20 micron
-  Float_t sddbarrel_dy     = 0.0020; // 20 micron
-  Float_t sddbarrel_dz     = 0.0020; // 20 micron
-  Float_t sddbarrel_dpsi   = 0.0020/52.*kRadToDeg; // so as to have 20 micron difference at the two extremes
-  Float_t sddbarrel_dtheta = 0.0020/52.*kRadToDeg; // so as to have 20 micron difference at the two extremes
-  Float_t sddbarrel_dphi   = 0.0020/20.*kRadToDeg;  // so as to have 20 micron difference at the two extremes
-
-  Float_t ssdbarrel_dx     = 0.0020; // 20 micron
-  Float_t ssdbarrel_dy     = 0.0020; // 20 micron
-  Float_t ssdbarrel_dz     = 0.0020; // 20 micron
-  Float_t ssdbarrel_dpsi   = 0.0020/90.*kRadToDeg; // so as to have 20 micron difference at the two extremes
-  Float_t ssdbarrel_dtheta = 0.0020/90.*kRadToDeg; // so as to have 20 micron difference at the two extremes
-  Float_t ssdbarrel_dphi   = 0.0020/40.*kRadToDeg;  // so as to have 20 micron difference at the two extremes
-
-  //=****************************************
-  // misalignment at the level of half-staves (SPD) : source - S.Moretto
-  //                              ladders (SDD,SSD) : source -
-  //=****************************************
-  Float_t spdhalfstave_dx     = 0.0100; // 100 micron // normal to plane  
-  Float_t spdhalfstave_dy     = 0.0020; // 20 micron 
-  Float_t spdhalfstave_dz     = 0.0020; // 20 micron
-  Float_t spdhalfstave_dpsi   = 0.0020/7.*kRadToDeg; // so as to have 20 micron difference at the two extremes
-  Float_t spdhalfstave_dtheta = 0.0050/7.*kRadToDeg; // so as to have 50 micron difference at the two extremes
-  Float_t spdhalfstave_dphi   = 0.0050/0.7*kRadToDeg; // so as to have 50 micron difference at the two extremes
-  Bool_t unifspdhalfstave=kTRUE;
-
-  Float_t sddladder_dx     = 0.0005; // 5 micron  
-  Float_t sddladder_dy     = 0.0005; // 5 micron 
-  Float_t sddladder_dz     = 0.0005; // 5 micron
-  Float_t sddladder_dpsi   = 0.00; //  ?
-  Float_t sddladder_dtheta = 0.00; //  ?
-  Float_t sddladder_dphi   = 0.00; //  ?
-
-  Float_t ssdladder_dx     = 0.0005; // 5 micron  
-  Float_t ssdladder_dy     = 0.0005; // 5 micron 
-  Float_t ssdladder_dz     = 0.0005; // 5 micron
-  Float_t ssdladder_dpsi   = 0.00; //  ?
-  Float_t ssdladder_dtheta = 0.00; //  ?
-  Float_t ssdladder_dphi   = 0.00; //  ?
-
-
-  //=****************************************
-  // misalignment at the level of ladders (SPD) : source - R.Santoro
-  //                              modules (SDD) : source - L.Gaudichet
-  //                              modules (SSD) : source - 
-  //=****************************************
-  Float_t spdladder_dx     = 0.0010; // 10 micron  
-  Float_t spdladder_dy     = 0.0030; // 50 micron 
-  Float_t spdladder_dz     = 0.0010; // 10 micron
-  Float_t spdladder_dpsi   = 0.0001*kRadToDeg; // 0.1 mrad
-  Float_t spdladder_dtheta = 0.0001*kRadToDeg; // 0.1 mrad
-  Float_t spdladder_dphi   = 0.0001*kRadToDeg; // 0.1 mrad
-
-  Float_t sddmodule_dx     = 0.0045; // 45 micron  
-  Float_t sddmodule_dy     = 0.0045; // 45 micron 
-  Float_t sddmodule_dz     = 0.0105; // 105 micron
-  Float_t sddmodule_dpsi   = 0.00; // ?
-  Float_t sddmodule_dtheta = 0.00; //  ?
-  Float_t sddmodule_dphi   = 0.00; //  ?
-
-  Float_t ssdmodule_dx     = 0.0050; // 50 micron  
-  Float_t ssdmodule_dy     = 0.0050; // 50 micron 
-  Float_t ssdmodule_dz     = 0.0050; // 50 micron
-  Float_t ssdmodule_dpsi   = 0.00; // ?
-  Float_t ssdmodule_dtheta = 0.00; //  ?
-  Float_t ssdmodule_dphi   = 0.00; //  ?
-  //
-  // END SETTINGS
-
-
-  AliITSMisalignMaker alignMaker;
-
-  //=****************************************
-  // overall ITS misalignment :
-  //=****************************************
-
-  alignMaker.AddAlignObj("ITS",its_dx,its_dy,its_dz,its_dpsi,its_dtheta,its_dphi,unifits);
-
-  //=****************************************
-  // misalignment at the level of SPD barrel, half-barrels, and at the level
-  // of SPD sectors
-  //=****************************************
-
-  Double_t vx,vy,vz,vpsi,vtheta,vphi;
-  Double_t vxbarrel,vybarrel,vzbarrel,vpsibarrel,vthetabarrel,vphibarrel;
-
-  //   barrel
-  vxbarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dx/3,spdbarrel_dx);
-  vybarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dy/3,spdbarrel_dy);
-  vzbarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dz/3,spdbarrel_dz);
-  vpsibarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dpsi/3,spdbarrel_dpsi);
-  vthetabarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dtheta/3,spdbarrel_dtheta);
-  vphibarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dphi/3,spdbarrel_dphi);
-
-  //  top half-barrel
-  vx = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dx/3,spdhalfbarrel_dx);
-  vy = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dy/3,spdhalfbarrel_dy);
-  vz = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dz/3,spdhalfbarrel_dz);
-  vpsi = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dpsi/3,spdhalfbarrel_dpsi);
-  vtheta = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dtheta/3,spdhalfbarrel_dtheta);
-  vphi = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dphi/3,spdhalfbarrel_dphi);
-
-  vx += vxbarrel;
-  vy += vybarrel;
-  vz += vzbarrel;
-  vpsi += vpsibarrel;
-  vtheta += vthetabarrel;
-  vphi += vphibarrel;
-
-  alignMaker.AddSectorAlignObj(1,5,spdsector_dx,spdsector_dy,spdsector_dz,
-                              spdsector_dpsi,spdsector_dtheta,spdsector_dphi,
-                              vx,vy,vz,vpsi,vtheta,vphi,unifspdsector);
-
-  //  bottom half-barrel
-  vx = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dx/3,spdhalfbarrel_dx);
-  vy = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dy/3,spdhalfbarrel_dy);
-  vz = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dz/3,spdhalfbarrel_dz);
-  vpsi = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dpsi/3,spdhalfbarrel_dpsi);
-  vtheta = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dtheta/3,spdhalfbarrel_dtheta);
-  vphi = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dphi/3,spdhalfbarrel_dphi);
-
-  vx += vxbarrel;
-  vy += vybarrel;
-  vz += vzbarrel;
-  vpsi += vpsibarrel;
-  vtheta += vthetabarrel;
-  vphi += vphibarrel;
-
-  alignMaker.AddSectorAlignObj(6,10,spdsector_dx,spdsector_dy,spdsector_dz,
-                              spdsector_dpsi,spdsector_dtheta,spdsector_dphi,
-                              vx,vy,vz,vpsi,vtheta,vphi,unifspdsector);
-
-
-
-  //=****************************************
-  // misalignment at the level of half-staves (SPD)/ladders&layers (SDD,SSD) :
-  //=****************************************
-
-  // SPD
-  alignMaker.AddAlignObj(0,-1,spdhalfstave_dx,spdhalfstave_dy,spdhalfstave_dz,spdhalfstave_dpsi,spdhalfstave_dtheta,spdhalfstave_dphi,0,0,0,0,0,0,unifspdhalfstave); // all SPD1 half-staves
-  alignMaker.AddAlignObj(1,-1,spdhalfstave_dx,spdhalfstave_dy,spdhalfstave_dz,spdhalfstave_dpsi,spdhalfstave_dtheta,spdhalfstave_dphi,0,0,0,0,0,0,unifspdhalfstave); // all SPD2 half-staves
-
-  // SDD
-  //   barrel
-  vxbarrel = alignMaker.GetUnif(-sddbarrel_dx,sddbarrel_dx);
-  vybarrel = alignMaker.GetUnif(-sddbarrel_dy,sddbarrel_dy);
-  vzbarrel = alignMaker.GetUnif(-sddbarrel_dz,sddbarrel_dz);
-  vpsibarrel = alignMaker.GetUnif(-sddbarrel_dpsi,sddbarrel_dpsi);
-  vthetabarrel = alignMaker.GetUnif(-sddbarrel_dtheta,sddbarrel_dtheta);
-  vphibarrel = alignMaker.GetUnif(-sddbarrel_dphi,sddbarrel_dphi);
-
-  //  layer SDD1
-  vx = alignMaker.GetUnif(-sddlayer_dx,sddlayer_dx);
-  vy = alignMaker.GetUnif(-sddlayer_dy,sddlayer_dy);
-  vz = alignMaker.GetUnif(-sddlayer_dz,sddlayer_dz);
-  vpsi = alignMaker.GetUnif(-sddlayer_dpsi,sddlayer_dpsi);
-  vtheta = alignMaker.GetUnif(-sddlayer_dtheta,sddlayer_dtheta);
-  vphi = alignMaker.GetUnif(-sddlayer_dphi,sddlayer_dphi);
-
-  vx += vxbarrel;
-  vy += vybarrel;
-  vz += vzbarrel;
-  vpsi += vpsibarrel;
-  vtheta += vthetabarrel;
-  vphi += vphibarrel;
-
-  alignMaker.AddAlignObj(2,-1,sddladder_dx,sddladder_dy,sddladder_dz,sddladder_dpsi,sddladder_dtheta,sddladder_dphi,vx,vy,vz,vpsi,vtheta,vphi,kFALSE); // all SDD1 ladders
-
-  //  layer SDD2
-  vx = alignMaker.GetUnif(-sddlayer_dx,sddlayer_dx);
-  vy = alignMaker.GetUnif(-sddlayer_dy,sddlayer_dy);
-  vz = alignMaker.GetUnif(-sddlayer_dz,sddlayer_dz);
-  vpsi = alignMaker.GetUnif(-sddlayer_dpsi,sddlayer_dpsi);
-  vtheta = alignMaker.GetUnif(-sddlayer_dtheta,sddlayer_dtheta);
-  vphi = alignMaker.GetUnif(-sddlayer_dphi,sddlayer_dphi);
-
-  vx += vxbarrel;
-  vy += vybarrel;
-  vz += vzbarrel;
-  vpsi += vpsibarrel;
-  vtheta += vthetabarrel;
-  vphi += vphibarrel;
-
-  alignMaker.AddAlignObj(3,-1,sddladder_dx,sddladder_dy,sddladder_dz,sddladder_dpsi,sddladder_dtheta,sddladder_dphi,vx,vy,vz,vpsi,vtheta,vphi,kFALSE); // all SDD2 ladders
-
-  // SSD
-  //   barrel
-  vxbarrel = alignMaker.GetUnif(-ssdbarrel_dx,ssdbarrel_dx);
-  vybarrel = alignMaker.GetUnif(-ssdbarrel_dy,ssdbarrel_dy);
-  vzbarrel = alignMaker.GetUnif(-ssdbarrel_dz,ssdbarrel_dz);
-  vpsibarrel = alignMaker.GetUnif(-ssdbarrel_dpsi,ssdbarrel_dpsi);
-  vthetabarrel = alignMaker.GetUnif(-ssdbarrel_dtheta,ssdbarrel_dtheta);
-  vphibarrel = alignMaker.GetUnif(-ssdbarrel_dphi,ssdbarrel_dphi);
-
-  //  layer SSD1
-  vx = alignMaker.GetUnif(-ssdlayer_dx,ssdlayer_dx);
-  vy = alignMaker.GetUnif(-ssdlayer_dy,ssdlayer_dy);
-  vz = alignMaker.GetUnif(-ssdlayer_dz,ssdlayer_dz);
-  vpsi = alignMaker.GetUnif(-ssdlayer_dpsi,ssdlayer_dpsi);
-  vtheta = alignMaker.GetUnif(-ssdlayer_dtheta,ssdlayer_dtheta);
-  vphi = alignMaker.GetUnif(-ssdlayer_dphi,ssdlayer_dphi);
-
-  vx += vxbarrel;
-  vy += vybarrel;
-  vz += vzbarrel;
-  vpsi += vpsibarrel;
-  vtheta += vthetabarrel;
-  vphi += vphibarrel;
-
-  alignMaker.AddAlignObj(4,-1,ssdladder_dx,ssdladder_dy,ssdladder_dz,ssdladder_dpsi,ssdladder_dtheta,ssdladder_dphi,vx,vy,vz,vpsi,vtheta,vphi,kFALSE); // all SSD1 ladders
-
-  //  layer SSD2
-  vx = alignMaker.GetUnif(-ssdlayer_dx,ssdlayer_dx);
-  vy = alignMaker.GetUnif(-ssdlayer_dy,ssdlayer_dy);
-  vz = alignMaker.GetUnif(-ssdlayer_dz,ssdlayer_dz);
-  vpsi = alignMaker.GetUnif(-ssdlayer_dpsi,ssdlayer_dpsi);
-  vtheta = alignMaker.GetUnif(-ssdlayer_dtheta,ssdlayer_dtheta);
-  vphi = alignMaker.GetUnif(-ssdlayer_dphi,ssdlayer_dphi);
-
-  vx += vxbarrel;
-  vy += vybarrel;
-  vz += vzbarrel;
-  vpsi += vpsibarrel;
-  vtheta += vthetabarrel;
-  vphi += vphibarrel;
-
-  alignMaker.AddAlignObj(5,-1,ssdladder_dx,ssdladder_dy,ssdladder_dz,ssdladder_dpsi,ssdladder_dtheta,ssdladder_dphi,vx,vy,vz,vpsi,vtheta,vphi,kFALSE); // all SSD2 ladders
-
-  //=****************************************
-  // misalignment at the level of ladders (SPD)/modules (SDD,SSD) :
-  //=****************************************
-
-  alignMaker.AddAlignObj(0,spdladder_dx,spdladder_dy,spdladder_dz,spdladder_dpsi,spdladder_dtheta,spdladder_dphi,kFALSE); // all SPD1 ladders
-  alignMaker.AddAlignObj(1,spdladder_dx,spdladder_dy,spdladder_dz,spdladder_dpsi,spdladder_dtheta,spdladder_dphi,kFALSE); // all SPD2 ladders
-
-  alignMaker.AddAlignObj(2,sddmodule_dx,sddmodule_dy,sddmodule_dz,sddmodule_dpsi,sddmodule_dtheta,sddmodule_dphi,kFALSE); // all SDD1 modules
-  alignMaker.AddAlignObj(3,sddmodule_dx,sddmodule_dy,sddmodule_dz,sddmodule_dpsi,sddmodule_dtheta,sddmodule_dphi,kFALSE); // all SDD2 modules
-
-  alignMaker.AddAlignObj(4,ssdmodule_dx,ssdmodule_dy,ssdmodule_dz,ssdmodule_dpsi,ssdmodule_dtheta,ssdmodule_dphi,kFALSE); // all SSD1 modules
-  alignMaker.AddAlignObj(5,ssdmodule_dx,ssdmodule_dy,ssdmodule_dz,ssdmodule_dpsi,ssdmodule_dtheta,ssdmodule_dphi,kFALSE); // all SSD2 modules
-
-
-
-  if(TString(gSystem->Getenv("TOCDB")) != TString("kTRUE")){
-    // save on file
-    const char* filename = "ITSfullMisalignment.root";
-    TFile f(filename,"RECREATE");
-    if(!f.IsOpen()){
-      Error(macroname,"cannot open file for output\n");
-      return;
-    }
-    Info(macroname,"Saving alignment objects to the file %s",filename);
-    f.cd();
-    f.WriteObject(alignMaker.GetArray(),"ITSAlignObjs","kSingleKey");
-    f.Close();
-  }else{
-    // save in CDB storage
-    AliCDBMetaData *md= new AliCDBMetaData();
-    md->SetResponsible("Andrea Dainese");
-    md->SetComment("Alignment objects with actual ITS misalignment");
-    md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
-    AliCDBId id("ITS/Align/Data",0,AliCDBRunRange::Infinity());
-    storage->Put(alignMaker.GetArray(),id,md);
-  }
-
-
-  return;
-}
-
diff --git a/ITS/MakeITSResMisAlignment.C b/ITS/MakeITSResMisAlignment.C
deleted file mode 100644 (file)
index 6975255..0000000
+++ /dev/null
@@ -1,307 +0,0 @@
-#if !defined(__CINT__) || defined(__MAKECINT__)
-#include <TError.h>
-#include <TFile.h>
-#include <TGeoManager.h>
-#include <TMath.h>
-#include <TString.h>
-#include <TSystem.h>
-#include "AliCDBPath.h"
-#include "AliCDBEntry.h"
-#include "AliCDBManager.h"
-#include "AliCDBStorage.h"
-#include "AliGeomManager.h"
-#include "AliITSMisalignMaker.h"
-#endif
-
-
-TRandom3 rnd;
-rnd.SetSeed(98723456);
-
-void MakeITSResMisAlignment() {
-//========================================================================
-//
-// Steering macro for ITS residual (realistic) misalignment
-//
-// Main author: L. Gaudichet
-// Contact: andrea.dainese@lnl.infn.it
-//
-//========================================================================
-
-
-  const char* macroname = "MakeITSResMisAlignment.C";
-
-  // Activate CDB storage and load geometry from CDB
-  AliCDBManager* cdb = AliCDBManager::Instance();
-  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
-  cdb->SetRun(0);
-  
-  AliCDBStorage* storage = NULL;
-
-  if(TString(gSystem->Getenv("TOCDB")) == TString("kTRUE")){
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
-    AliCDBPath path("GRP","Geometry","Data");
-    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
-    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
-    entry->SetOwner(0);
-    TGeoManager* geom = (TGeoManager*) entry->GetObject();
-    AliGeomManager::SetGeometry(geom);
-  }else{
-    AliGeomManager::LoadGeometry("geometry.root"); //load geom from default CDB storage
-  }    
-
-  //   SETTINGS:
-  //   - tranformations are defined by the "maximum transformation" 
-  //     dx,dy,dz,dpsi,dtheta,dphi: then we take a Gaussian with sigma=dx/3
-  //     and we cut it at +- 3*sigma = dx 
-  //     (the option "unif" allows to sample from a uniform distr.)
-  //   - units are cm and deg
-  //   - transformations are defined in the local frame of the volume
-  //     being misaligned
-  //
-  const Float_t kRadToDeg = 180./TMath::Pi();
-
-
-  //=****************************************
-  // misalignment of the whole ITS according to survey as reported by Werner Riegler (18/07/2008)
-  // no smearing added (would clash with vertex constraint)
-  //=****************************************
-  Double_t its_dx     = -0.12;
-  Double_t its_dy     = -0.07;
-  Double_t its_dz     = 0.29;
-  Double_t its_dpsi   = 0.;
-  Double_t its_dtheta = 0.03;
-  Double_t its_dphi   = 0.04;
-  const char* unifits="fixed";
-
-  //=****************************************
-  // misalignment at the level of SPD sectors : source - A.Pepato
-  //=****************************************
-  Float_t spdsector_dx     = 0.0050/5.; //  50 micron (~tangetial, i.e. rphi) 
-  Float_t spdsector_dy     = 0.0100/5.; // 100 micron (~radial)
-  Float_t spdsector_dz     = 0.0100/5.; // 100 micron
-  Float_t spdsector_dpsi   = 0.0100/30.*kRadToDeg/5.; // so as to have 100 micron difference at the two extremes
-  Float_t spdsector_dtheta = 0.0100/30.*kRadToDeg/5.; // so as to have 100 micron difference at the two extremes
-  Float_t spdsector_dphi   = 0.0050/1.5*kRadToDeg/5.; // so as to have 50 micron difference at the two extremes
-  Bool_t unifspdsector=kFALSE;
-
-  //=****************************************
-  // misalignment at the level of SPD half-barrels : source - A.Pepato
-  //=****************************************
-  Float_t spdhalfbarrel_dx     = 0.000; // 200 micron  
-  Float_t spdhalfbarrel_dy     = 0.000; // 200 micron 
-  Float_t spdhalfbarrel_dz     = 0.000; // 200 micron
-  Float_t spdhalfbarrel_dpsi   = 0.000/30.*kRadToDeg; // so as to have 100 micron difference at the two extremes
-  Float_t spdhalfbarrel_dtheta = 0.000/30.*kRadToDeg; // so as to have 100 micron difference at the two extremes
-  Float_t spdhalfbarrel_dphi   = 0.000/7.*kRadToDeg; // so as to have 100 micron difference at the two extremes
-
-  //=****************************************
-  // misalignment at the level of SPD barrel : source - A.Pepato
-  //=****************************************
-  Float_t spdbarrel_dx     = 0.000; // 1 mm (very pessimistic)  
-  Float_t spdbarrel_dy     = 0.000; // 1 mm (very pessimistic)
-  Float_t spdbarrel_dz     = 0.000; // 1 mm (very pessimistic)
-  Float_t spdbarrel_dpsi   = 0.000/30.*kRadToDeg; // so as to have 500 micron difference at the two extremes
-  Float_t spdbarrel_dtheta = 0.000/30.*kRadToDeg; // so as to have 500 micron difference at the two extremes
-  Float_t spdbarrel_dphi   = 0.000/7.*kRadToDeg; // so as to have 500 micron difference at the two extremes
-  
-
-  //=****************************************
-  // misalignment at the level of SDD and SSD layers: source
-  //=****************************************
-  Float_t sddlayer_dx     = 0.0000; 
-  Float_t sddlayer_dy     = 0.0000; 
-  Float_t sddlayer_dz     = 0.0000; 
-  Float_t sddlayer_dpsi   = 0.0000;
-  Float_t sddlayer_dtheta = 0.0000; 
-  Float_t sddlayer_dphi   = 0.0000;
-
-  Float_t ssdlayer_dx     = 0.0000;
-  Float_t ssdlayer_dy     = 0.0000;
-  Float_t ssdlayer_dz     = 0.0000;
-  Float_t ssdlayer_dpsi   = 0.0000;
-  Float_t ssdlayer_dtheta = 0.0000;
-  Float_t ssdlayer_dphi   = 0.0000;
-  
-
-  //=****************************************
-  // misalignment at the level of half-staves (SPD) : source - S.Moretto
-  //                              ladders (SDD,SSD) : source -
-  //=****************************************
-  Float_t spdhalfstave_dx     = 0.0100/4.; // 100 micron  
-  Float_t spdhalfstave_dy     = 0.0020/4.; // 20 micron 
-  Float_t spdhalfstave_dz     = 0.0020/4.; // 20 micron
-  Float_t spdhalfstave_dpsi   = 0.0020/7.*kRadToDeg/4.; // so as to have 20 micron difference at the two extremes
-  Float_t spdhalfstave_dtheta = 0.0050/7.*kRadToDeg/4.; // so as to have 50 micron difference at the two extremes
-  Float_t spdhalfstave_dphi   = 0.0050/0.7*kRadToDeg/4.; // so as to have 50 micron difference at the two extremes
-  Bool_t unifspdhalfstave=kFALSE;
-
-  Float_t sddladder_dx     = 0.0005; // 5 micron  
-  Float_t sddladder_dy     = 0.0005; // 5 micron 
-  Float_t sddladder_dz     = 0.0005; // 5 micron
-  Float_t sddladder_dpsi   = 0.00; //  ?
-  Float_t sddladder_dtheta = 0.00; //  ?
-  Float_t sddladder_dphi   = 0.00; //  ?
-
-  Float_t ssdladder_dx     = 0.0005; // 5 micron  
-  Float_t ssdladder_dy     = 0.0005; // 5 micron 
-  Float_t ssdladder_dz     = 0.0005; // 5 micron
-  Float_t ssdladder_dpsi   = 0.00; //  ?
-  Float_t ssdladder_dtheta = 0.00; //  ?
-  Float_t ssdladder_dphi   = 0.00; //  ?
-
-
-  //=****************************************
-  // misalignment at the level of ladders (SPD) : source - R.Santoro
-  //                              modules (SDD) : source - L.Gaudichet
-  //                              modules (SSD) : source - 
-  //=****************************************
-  Float_t spdladder_dx     = 0.0010/5.; // 10 micron  
-  Float_t spdladder_dy     = 0.0050/5.; // 50 micron 
-  Float_t spdladder_dz     = 0.0010/5.; // 10 micron
-  Float_t spdladder_dpsi   = 0.0001*kRadToDeg/5.; // 0.1 mrad
-  Float_t spdladder_dtheta = 0.0001*kRadToDeg/5.; // 0.1 mrad
-  Float_t spdladder_dphi   = 0.0001*kRadToDeg/5.; // 0.1 mrad
-
-  Float_t sddmodule_dx     = 0.0045/5.; // 45 micron  
-  Float_t sddmodule_dy     = 0.0045/5.; // 45 micron 
-  Float_t sddmodule_dz     = 0.0105/5.; // 105 micron
-  Float_t sddmodule_dpsi   = 0.00; // ?
-  Float_t sddmodule_dtheta = 0.00; //  ?
-  Float_t sddmodule_dphi   = 0.00; //  ?
-
-  Float_t ssdmodule_dx     = 0.0050/5.; // 50 micron  
-  Float_t ssdmodule_dy     = 0.0050/5.; // 50 micron 
-  Float_t ssdmodule_dz     = 0.0050/5.; // 50 micron
-  Float_t ssdmodule_dpsi   = 0.00; // ?
-  Float_t ssdmodule_dtheta = 0.00; //  ?
-  Float_t ssdmodule_dphi   = 0.00; //  ?
-  //
-  // END SETTINGS
-
-  AliITSMisalignMaker alignMaker;
-
-  //=****************************************
-  // overall ITS misalignment :
-  //=****************************************
-
-  alignMaker.AddAlignObj("ITS",its_dx,its_dy,its_dz,its_dpsi,its_dtheta,its_dphi,unifits);
-
-
-  //=****************************************
-  // misalignment at the level of SPD barrel, half-barrels, and at the level
-  // of SPD sectors
-  //=****************************************
-
-  Double_t vx,vy,vz,vpsi,vtheta,vphi;
-  Double_t vxbarrel,vybarrel,vzbarrel,vpsibarrel,vthetabarrel,vphibarrel;
-
-  //   barrel
-  vxbarrel = AliMathBase::TruncatedGaus(0.,spdbarrel_dx/3,spdbarrel_dx);
-  vxbarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dx/3,spdbarrel_dx);
-  vybarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dy/3,spdbarrel_dy);
-  vzbarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dz/3,spdbarrel_dz);
-  vpsibarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dpsi/3,spdbarrel_dpsi);
-  vthetabarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dtheta/3,spdbarrel_dtheta);
-  vphibarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dphi/3,spdbarrel_dphi);
-
-  //  top half-barrel
-  vx = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dx/3,spdhalfbarrel_dx);
-  vy = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dy/3,spdhalfbarrel_dy);
-  vz = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dz/3,spdhalfbarrel_dz);
-  vpsi = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dpsi/3,spdhalfbarrel_dpsi);
-  vtheta = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dtheta/3,spdhalfbarrel_dtheta);
-  vphi = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dphi/3,spdhalfbarrel_dphi);
-
-  vx += vxbarrel;
-  vy += vybarrel;
-  vz += vzbarrel;
-  vpsi += vpsibarrel;
-  vtheta += vthetabarrel;
-  vphi += vphibarrel;
-
-  alignMaker.AddSectorAlignObj(1,5,spdsector_dx,spdsector_dy,spdsector_dz,
-                              spdsector_dpsi,spdsector_dtheta,spdsector_dphi,
-                              vx,vy,vz,vpsi,vtheta,vphi,unifspdsector);
-
-  //  bottom half-barrel
-  vx = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dx/3,spdhalfbarrel_dx);
-  vy = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dy/3,spdhalfbarrel_dy);
-  vz = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dz/3,spdhalfbarrel_dz);
-  vpsi = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dpsi/3,spdhalfbarrel_dpsi);
-  vtheta = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dtheta/3,spdhalfbarrel_dtheta);
-  vphi = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dphi/3,spdhalfbarrel_dphi);
-
-  vx += vxbarrel;
-  vy += vybarrel;
-  vz += vzbarrel;
-  vpsi += vpsibarrel;
-  vtheta += vthetabarrel;
-  vphi += vphibarrel;
-
-  alignMaker.AddSectorAlignObj(6,10,spdsector_dx,spdsector_dy,spdsector_dz,
-                              spdsector_dpsi,spdsector_dtheta,spdsector_dphi,
-                              vx,vy,vz,vpsi,vtheta,vphi,unifspdsector);
-
-
-  //=****************************************
-  // misalignment at the level of half-staves (SPD)/ladders (SDD,SSD) :
-  //=****************************************
-
-  alignMaker.AddAlignObj(0,-1,spdhalfstave_dx,spdhalfstave_dy,spdhalfstave_dz,spdhalfstave_dpsi,spdhalfstave_dtheta,spdhalfstave_dphi,0,0,0,0,0,0,unifspdhalfstave); // all SPD1 half-staves
-  alignMaker.AddAlignObj(1,-1,spdhalfstave_dx,spdhalfstave_dy,spdhalfstave_dz,spdhalfstave_dpsi,spdhalfstave_dtheta,spdhalfstave_dphi,0,0,0,0,0,0,unifspdhalfstave); // all SPD2 half-staves
-
-  alignMaker.AddAlignObj(2,-1,sddladder_dx,sddladder_dy,sddladder_dz,sddladder_dpsi,sddladder_dtheta,sddladder_dphi,0,0,0,0,0,0,kFALSE); // all SDD1 ladders
-  alignMaker.AddAlignObj(3,-1,sddladder_dx,sddladder_dy,sddladder_dz,sddladder_dpsi,sddladder_dtheta,sddladder_dphi,0,0,0,0,0,0,kFALSE); // all SDD2 ladders
-
-  alignMaker.AddAlignObj(4,-1,ssdladder_dx,ssdladder_dy,ssdladder_dz,ssdladder_dpsi,ssdladder_dtheta,ssdladder_dphi,0,0,0,0,0,0,kFALSE); // all SSD1 ladders
-  alignMaker.AddAlignObj(5,-1,ssdladder_dx,ssdladder_dy,ssdladder_dz,ssdladder_dpsi,ssdladder_dtheta,ssdladder_dphi,0,0,0,0,0,0,kFALSE); // all SSD2 ladders
-
-  //=****************************************
-  // misalignment at the level of ladders (SPD)/modules (SDD,SSD) :
-  //=****************************************
-
-  alignMaker.AddAlignObj(0,spdladder_dx,spdladder_dy,spdladder_dz,spdladder_dpsi,spdladder_dtheta,spdladder_dphi,kFALSE); // all SPD1 ladders
-  alignMaker.AddAlignObj(1,spdladder_dx,spdladder_dy,spdladder_dz,spdladder_dpsi,spdladder_dtheta,spdladder_dphi,kFALSE); // all SPD2 ladders
-
-  alignMaker.AddAlignObj(2,sddmodule_dx,sddmodule_dy,sddmodule_dz,sddmodule_dpsi,sddmodule_dtheta,sddmodule_dphi,kFALSE); // all SDD1 modules
-  alignMaker.AddAlignObj(3,sddmodule_dx,sddmodule_dy,sddmodule_dz,sddmodule_dpsi,sddmodule_dtheta,sddmodule_dphi,kFALSE); // all SDD2 modules
-
-  alignMaker.AddAlignObj(4,ssdmodule_dx,ssdmodule_dy,ssdmodule_dz,ssdmodule_dpsi,ssdmodule_dtheta,ssdmodule_dphi,kFALSE); // all SSD1 modules
-  alignMaker.AddAlignObj(5,ssdmodule_dx,ssdmodule_dy,ssdmodule_dz,ssdmodule_dpsi,ssdmodule_dtheta,ssdmodule_dphi,kFALSE); // all SSD2 modules
-
-
-  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
-    // save on file
-    const char* filename = "ITSresidualMisalignment.root";
-    TFile f(filename,"RECREATE");
-    if(!f.IsOpen()){
-      Error(macroname,"cannot open file for output\n");
-      return;
-    }
-    Info(macroname,"Saving alignment objects to the file %s",filename);
-    f.cd();
-    f.WriteObject(alignMaker.GetArray(),"ITSAlignObjs","kSingleKey");
-    f.Close();
-  }else{
-    // save in CDB storage
-    AliCDBMetaData *md= new AliCDBMetaData();
-    md->SetResponsible("Andrea Dainese");
-    md->SetComment("Alignment objects with residual ITS misalignment");
-    md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
-    AliCDBId id("ITS/Align/Data",0,AliCDBRunRange::Infinity());
-    storage->Put(alignMaker.GetArray(),id,md);
-  }
-
-
-  return;
-}
-
diff --git a/ITS/MakeITSZeroMisAlignment.C b/ITS/MakeITSZeroMisAlignment.C
deleted file mode 100644 (file)
index d61b64e..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-void MakeITSZeroMisAlignment(){
-  // Create TClonesArray of zero misalignment objects for ITS
-  //
-  TClonesArray *array = new TClonesArray("AliAlignObjParams",4000);
-  TClonesArray &alobj = *array;
-  const char* macroname = "MakeITSZeroMisAlignment.C";
-
-  // Activate CDB storage and load geometry from CDB
-  AliCDBManager* cdb = AliCDBManager::Instance();
-  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
-  cdb->SetRun(0);
-  
-  AliCDBStorage* storage = NULL;
-
-  if(TString(gSystem->Getenv("TOCDB")) == TString("kTRUE")){
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
-    AliCDBPath path("GRP","Geometry","Data");
-    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
-    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
-    entry->SetOwner(0);
-    TGeoManager* geom = (TGeoManager*) entry->GetObject();
-    AliGeomManager::SetGeometry(geom);
-  }else{
-    AliGeomManager::LoadGeometry("geometry.root"); //load geom from default CDB storage
-  }    
-
-  Int_t j = 0;
-
-  //=****************************************
-  // overall ITS misalignment according to survey as reported by Werner Riegler (18/07/2008) 
-  //=****************************************
-  Float_t its_dx     = -0.12;
-  Float_t its_dy     = -0.07;
-  Float_t its_dz     = 0.29;
-  Float_t its_dpsi   = 0.;  
-  Float_t its_dtheta = 0.03;
-  Float_t its_dphi   = 0.04;
-
-  new(alobj[j++]) AliAlignObjParams("ITS", 0, its_dx, its_dy, its_dz, its_dpsi, its_dtheta, its_dphi, kTRUE);
-
-  Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0., globalZ=0.;
-
-  for ( Int_t iLayer = AliGeomManager::kSPD1; iLayer <= AliGeomManager::kSSD2; iLayer++) {
-    
-    printf("%i modules in layer %i\n", AliGeomManager::LayerSize(iLayer), iLayer);
-    for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(iLayer); iModule++) {
-
-      UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iModule);
-      const char *symname = AliGeomManager::SymName(volid);
-
-      new(alobj[j++]) AliAlignObjParams(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
-
-    }
-  }
-
-  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
-    // save on file
-    const char* filename = "ITSzeroMisalignment.root";
-    TFile f(filename,"RECREATE");
-    if(!f){
-      Error(macroname,"cannot open file for output\n");
-      return;
-    }
-    Info(macroname,"Saving alignment objects to the file %s", filename);
-    f.cd();
-    f.WriteObject(array,"ITSAlignObjs","kSingleKey");
-    f.Close();
-  }else{
-    // save in CDB storage
-    Info(macroname,"Saving alignment objects in CDB storage %s", Storage.Data());
-    AliCDBMetaData *md= new AliCDBMetaData();
-    md->SetResponsible("Ludovic Gaudichet");
-    md->SetComment("Alignment objects with zero ITS misalignment");
-    md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
-    AliCDBId id("ITS/Align/Data",0,AliCDBRunRange::Infinity());
-    storage->Put(array,id, md);
-  }
-
-  array->Delete();
-
-}
-
-
index 508063986ada01dd48a9963cf26781f9be58d953..67b69ab38b5675f486a75c03319b560dd5995d25 100644 (file)
@@ -17,7 +17,7 @@ SRCS =        AliITSgeom.cxx \
                AliITSMap.cxx \
                AliITSMapA1.cxx \
                AliITSMapA2.cxx \
-               AliITSMisalignMaker.cxx \
+               AliITSMisAligner.cxx \
                AliITSpList.cxx \
                AliITSpListItem.cxx \
                AliITSsegmentation.cxx \