Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / GRP / MakeSTRUCTResMisAlignment.C
CommitLineData
a24be56b 1void MakeSTRUCTResMisAlignment(){
2 // Create TClonesArray of residual misalignment objects for all STRUCTures
3 // (presently this includes only FRAME)
4 //
5 const char* macroname = "MakeSTRUCTResMisAlignment.C";
6
7 TClonesArray *array = new TClonesArray("AliAlignObjParams",20);
8
9 Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
10 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
11 UShort_t dvoluid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy vol id
12
54395687 13 const char* baseSymName ="FRAME/Sector"; //base of symbolic name corresponding to base of path "ALIC_1/B077_1/BSEGMO";
14 TString symname;
a24be56b 15
16 for(Int_t sm=0; sm<18; sm++){
54395687 17 symname = baseSymName;
18 symname += sm;
19 cout<<symname.Data()<<endl;
20 new((*array)[sm]) AliAlignObjParams(symname.Data(),dvoluid,0.,0.,0.,0.,0.,0.,kTRUE);
a24be56b 21 }
22
a24be56b 23 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
24 // save on file
25 const char* filename = "STRUCTresMisalignment.root";
26 TFile f(filename,"RECREATE");
27 if(!f){
28 Error(macroname,"cannot open file for output\n");
29 return;
30 }
31 Info(macroname,"Saving alignment objects in %s", filename);
32 f.cd();
33 f.WriteObject(array,"STRUCTAlignObjs","kSingleKey");
34 f.Close();
35 }else{
36 // save in CDB storage
37 TString Storage = gSystem->Getenv("STORAGE");
38 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
39 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
40 return;
41 }
42 Info(macroname,"Saving alignment objects in CDB storage %s",Storage.Data());
43 AliCDBManager* cdb = AliCDBManager::Instance();
44 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
45 if(!storage){
46 Error(macroname,"Unable to open storage %s\n",Storage.Data());
47 return;
48 }
49 AliCDBMetaData* md = new AliCDBMetaData();
50 md->SetResponsible("Grosso Raffaele");
51 md->SetComment("Residual misalignment for STRUCT. Presently includes objects for FRAME.");
52 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
53 AliCDBId id("GRP/Align/Data",0,AliCDBRunRange::Infinity());
54 storage->Put(array,id,md);
55 }
56
57 array->Delete();
58
59}
60