]> git.uio.no Git - u/mrichter/AliRoot.git/blob - GRP/MakeSTRUCTResMisAlignment.C
Fixing CONSTANT_EXPRESSION_RESULT Coverity defect
[u/mrichter/AliRoot.git] / GRP / MakeSTRUCTResMisAlignment.C
1 void 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
13   const char* basepath ="ALIC_1/B077_1/BSEGMO";
14   TString segmpath;
15
16   for(Int_t sm=0; sm<18; sm++){
17     segmpath=basepath;
18     segmpath+=sm;
19     segmpath+="_1";
20     cout<<segmpath.Data()<<endl;
21     new((*array)[sm]) AliAlignObjParams(segmpath.Data(),dvoluid,0.,0.,0.,0.,0.,0.,kTRUE);
22   }
23
24
25   if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
26     // save on file
27     const char* filename = "STRUCTresMisalignment.root";
28     TFile f(filename,"RECREATE");
29     if(!f){
30       Error(macroname,"cannot open file for output\n");
31       return;
32     }
33     Info(macroname,"Saving alignment objects in %s", filename);
34     f.cd();
35     f.WriteObject(array,"STRUCTAlignObjs","kSingleKey");
36     f.Close();
37   }else{
38     // save in CDB storage
39     TString Storage = gSystem->Getenv("STORAGE");
40     if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
41       Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
42       return;
43     }
44     Info(macroname,"Saving alignment objects in CDB storage %s",Storage.Data());
45     AliCDBManager* cdb = AliCDBManager::Instance();
46     AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
47     if(!storage){
48       Error(macroname,"Unable to open storage %s\n",Storage.Data());
49       return;
50     }
51     AliCDBMetaData* md = new AliCDBMetaData();
52     md->SetResponsible("Grosso Raffaele");
53     md->SetComment("Residual misalignment for STRUCT. Presently includes objects for FRAME.");
54     md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
55     AliCDBId id("GRP/Align/Data",0,AliCDBRunRange::Infinity());
56     storage->Put(array,id,md);
57   }
58
59   array->Delete();
60
61 }
62