]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/MakeITSZeroMisAlignment.C
New include needed
[u/mrichter/AliRoot.git] / ITS / MakeITSZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakeITSZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for ITS
3 //
4 TClonesArray *array = new TClonesArray("AliAlignObjAngles",4000);
5 TClonesArray &alobj = *array;
6
7 if(!gGeoManager) TGeoManager::Import("geometry.root");
8 // needed for the constructors with local coordinates not to fail
9
10 AliAlignObjAngles a;
11
12 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0., globalZ=0.;
13 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
14
15 Int_t j = 0;
16
17 new(alobj[j]) AliAlignObjAngles("ITS", 0, dx, dy, globalZ, dpsi, dtheta, dphi, kTRUE);
18 j++;
19
20 for ( Int_t l = AliAlignObj::kSPD1; l <= AliAlignObj::kSSD2; l++) {
21
22 printf("%i modules in layer %i\n", AliAlignObj::LayerSize(l), l);
23 for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(l); iModule++) {
24
25 iLayer = AliAlignObj::kInvalidLayer;
26
27 switch (l) {
28 case 1: {
29 iLayer = AliAlignObj::kSPD1;
30 }; break;
31 case 2: {
32 iLayer = AliAlignObj::kSPD2;
33 }; break;
34 case 3: {
35 iLayer = AliAlignObj::kSDD1;
36 }; break;
37 case 4: {
38 iLayer = AliAlignObj::kSDD2;
39 }; break;
40 case 5: {
41 iLayer = AliAlignObj::kSSD1;
42 }; break;
43 case 6: {
44 iLayer = AliAlignObj::kSSD2;
45 }; break;
46 default: Printf("Wrong layer index in ITS (%d) !",l);
47 };
48 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
49 const char *symname = AliAlignObj::SymName(volid);
50
51 new(alobj[j]) AliAlignObjAngles(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
52 j++;
53
54 }
55 }
56
5bd470e1 57 if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
d3a9c52a 58 // save on file
59 TFile f("ITSzeroMisalignment.root","RECREATE");
60 if(!f) {cerr<<"cannot open file for output\n";}
61 f.WriteObject(array,"ITSAlignObjs","kSingleKey");
62 f.Close();
63 }else{
64 // save in CDB storage
5bd470e1 65 const char* Storage = gSystem->Getenv("STORAGE");
d3a9c52a 66 AliCDBManager *CDB = AliCDBManager::Instance();
67 AliCDBStorage* storage = CDB->GetStorage(Storage);
68 AliCDBMetaData *md= new AliCDBMetaData();
69 md->SetResponsible("Ludovic Gaudichet");
70 md->SetComment("Alignment objects with zero ITS misalignment");
5bd470e1 71 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
d3a9c52a 72 AliCDBId id("ITS/Align/Data",0,9999999);
73 storage->Put(array,id, md);
74 }
75
76 array->Delete();
77
78}
79
80