]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/MakeITSZeroMisAlignment.C
Updated alignment macros and related changes (Raffaele)
[u/mrichter/AliRoot.git] / ITS / MakeITSZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakeITSZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for ITS
3 //
90dbf5fb 4 TClonesArray *array = new TClonesArray("AliAlignObjParams",4000);
d3a9c52a 5 TClonesArray &alobj = *array;
6fce62af 6 const char* macroname = "MakeITSZeroMisAlignment.C";
d3a9c52a 7
d3a9c52a 8
9 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0., globalZ=0.;
ae079791 10 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
d3a9c52a 11
12 Int_t j = 0;
13
90dbf5fb 14 new(alobj[j]) AliAlignObjParams("ITS", 0, dx, dy, globalZ, dpsi, dtheta, dphi, kTRUE);
d3a9c52a 15 j++;
16
ae079791 17 for ( Int_t l = AliGeomManager::kSPD1; l <= AliGeomManager::kSSD2; l++) {
d3a9c52a 18
ae079791 19 printf("%i modules in layer %i\n", AliGeomManager::LayerSize(l), l);
20 for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(l); iModule++) {
d3a9c52a 21
ae079791 22 iLayer = AliGeomManager::kInvalidLayer;
d3a9c52a 23
24 switch (l) {
25 case 1: {
ae079791 26 iLayer = AliGeomManager::kSPD1;
d3a9c52a 27 }; break;
28 case 2: {
ae079791 29 iLayer = AliGeomManager::kSPD2;
d3a9c52a 30 }; break;
31 case 3: {
ae079791 32 iLayer = AliGeomManager::kSDD1;
d3a9c52a 33 }; break;
34 case 4: {
ae079791 35 iLayer = AliGeomManager::kSDD2;
d3a9c52a 36 }; break;
37 case 5: {
ae079791 38 iLayer = AliGeomManager::kSSD1;
d3a9c52a 39 }; break;
40 case 6: {
ae079791 41 iLayer = AliGeomManager::kSSD2;
d3a9c52a 42 }; break;
43 default: Printf("Wrong layer index in ITS (%d) !",l);
44 };
ae079791 45 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iModule);
46 const char *symname = AliGeomManager::SymName(volid);
d3a9c52a 47
90dbf5fb 48 new(alobj[j]) AliAlignObjParams(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
d3a9c52a 49 j++;
50
51 }
52 }
53
a24be56b 54 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
d3a9c52a 55 // save on file
dfe9c69d 56 const char* filename = "ITSzeroMisalignment.root";
57 TFile f(filename,"RECREATE");
58 if(!f){
59 Error(macroname,"cannot open file for output\n");
60 return;
61 }
62 Info(macroname,"Saving alignment objects to the file %s", filename);
63 f.cd();
d3a9c52a 64 f.WriteObject(array,"ITSAlignObjs","kSingleKey");
65 f.Close();
66 }else{
67 // save in CDB storage
dfe9c69d 68 TString Storage = gSystem->Getenv("STORAGE");
69 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
70 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
71 return;
72 }
73 Info(macroname,"Saving alignment objects in CDB storage %s",
74 Storage.Data());
75 AliCDBManager* cdb = AliCDBManager::Instance();
76 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
77 if(!storage){
78 Error(macroname,"Unable to open storage %s\n",Storage.Data());
79 return;
80 }
d3a9c52a 81 AliCDBMetaData *md= new AliCDBMetaData();
82 md->SetResponsible("Ludovic Gaudichet");
83 md->SetComment("Alignment objects with zero ITS misalignment");
5bd470e1 84 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 85 AliCDBId id("ITS/Align/Data",0,AliCDBRunRange::Infinity());
d3a9c52a 86 storage->Put(array,id, md);
87 }
88
89 array->Delete();
90
91}
92
93