1 void MakeITSFullMisAlignment(){
2 // Create TClonesArray of full misalignment objects for ITS
4 TClonesArray *array = new TClonesArray("AliAlignObjAngles",4000);
5 TClonesArray &alobj = *array;
7 if(!gGeoManager) TGeoManager::Import("geometry.root");
8 // needed for the constructors with local coordinates not to fail
10 Double_t globalZ = 0.015; // in cm, = 150 microns
11 Double_t mecanicalPrec = 0.0020;
13 Double_t resFact = 0.;
14 Double_t spdXY = 0.0015*resFact;
15 Double_t sddXYZ = 0.0030*resFact;
16 Double_t ssdXY = 0.0020*resFact;
19 Double_t spdZ = 0.002;
20 Double_t ssdZ = 0.010;
23 TRandom *rnd = new TRandom(65416087);
26 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
29 new(alobj[j++]) AliAlignObjAngles("ITS", 0, dx, dy, globalZ, dpsi, dtheta, dphi, kTRUE);
31 for ( Int_t l = AliAlignObj::kSPD1; l <= AliAlignObj::kSSD2; l++) {
33 printf("%i modules in layer %i\n", AliAlignObj::LayerSize(l), l);
34 for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(l); iModule++) {
36 dpsi = rnd->Gaus(0., rot);
37 dtheta = rnd->Gaus(0., rot);
38 dphi = rnd->Gaus(0., rot);
40 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
43 iLayer = AliAlignObj::kSPD1;
44 dx = rnd->Gaus(0., spdXY + mecanicalPrec);
45 dy = rnd->Gaus(0., spdXY + mecanicalPrec);
46 dz = rnd->Gaus(0., spdZ + mecanicalPrec);
49 iLayer = AliAlignObj::kSPD2;
50 dx = rnd->Gaus(0., spdXY + mecanicalPrec);
51 dy = rnd->Gaus(0., spdXY + mecanicalPrec);
52 dz = rnd->Gaus(0., spdZ + mecanicalPrec);
55 iLayer = AliAlignObj::kSDD1;
56 dx = rnd->Gaus(0., sddXYZ + mecanicalPrec);
57 dy = rnd->Gaus(0., sddXYZ + mecanicalPrec);
58 dz = rnd->Gaus(0., sddXYZ + mecanicalPrec);
61 iLayer = AliAlignObj::kSDD2;
62 dx = rnd->Gaus(0., sddXYZ + mecanicalPrec);
63 dy = rnd->Gaus(0., sddXYZ + mecanicalPrec);
64 dz = rnd->Gaus(0., sddXYZ + mecanicalPrec);
67 iLayer = AliAlignObj::kSSD1;
68 dx = rnd->Gaus(0., ssdXY + mecanicalPrec);
69 dy = rnd->Gaus(0., ssdXY + mecanicalPrec);
70 dz = rnd->Gaus(0., ssdZ + mecanicalPrec);
73 iLayer = AliAlignObj::kSSD2;
74 dx = rnd->Gaus(0., ssdXY + mecanicalPrec);
75 dy = rnd->Gaus(0., ssdXY + mecanicalPrec);
76 dz = rnd->Gaus(0., ssdZ + mecanicalPrec);
78 default: Printf("Wrong layer index in ITS (%d) !",l);
80 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
81 const char *symname = AliAlignObj::SymName(volid);
83 new(alobj[j++]) AliAlignObjAngles(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
88 if(!gSystem->Getenv("$TOCDB")){
90 TFile f("ITSfullMisalignment.root","RECREATE");
91 if(!f) {cerr<<"cannot open file for output\n";}
92 f.WriteObject(array,"ITSAlignObjs","kSingleKey");
95 // save in CDB storage
96 const char* Storage = gSystem->Getenv("$STORAGE");
97 AliCDBManager *CDB = AliCDBManager::Instance();
98 AliCDBStorage* storage = CDB->GetStorage(Storage);
99 AliCDBMetaData *md= new AliCDBMetaData();
100 md->SetResponsible("Ludovic Gaudichet");
101 md->SetComment("Alignment objects with actual ITS misalignment");
102 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
103 AliCDBId id("ITS/Align/Data",0,9999999);
104 storage->Put(array,id, md);