Updated histogram limits (PHOS energy)
[u/mrichter/AliRoot.git] / TRD / MakeTRDZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakeTRDZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for TRD
3 //
6fce62af 4 const char* macroname = "MakeTRDZeroMisAlignment.C";
90dbf5fb 5 TClonesArray *array = new TClonesArray("AliAlignObjParams",1000);
d3a9c52a 6 TClonesArray &alobj = *array;
7
a24be56b 8 Int_t sActive[18]={0,0,1,1,1,0,1,0,0,0,0,1,1,0,1,1,0,0};
d3a9c52a 9 Double_t dx=0.,dy=0.,dz=0.,rx=0.,ry=0.,rz=0.;
10
11 Int_t j=0;
12 UShort_t volid;
13 const char *symname;
14
6fce62af 15 // create the supermodules' alignment objects
a24be56b 16 for (Int_t iSect; iSect<18; iSect++) {
17 TString sm_symname(Form("TRD/sm%02d",iSect));
18 if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue;
6fce62af 19 new(alobj[j++]) AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kTRUE);
20 }
21
22 // create the chambers' alignment objects
a24be56b 23 Int_t chId;
ae079791 24 for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) {
a24be56b 25 chId=-1;
26 for (Int_t iSect = 0; iSect < 18; iSect++){
27 for (Int_t iCh = 0; iCh < 5; iCh++) {
28 chId++;
5be6574e 29 if ((iSect==13 || iSect==14 || iSect==15) && iCh==2) continue;
a24be56b 30 volid = AliGeomManager::LayerToVolUID(iLayer,chId);
5be6574e 31 symname = AliGeomManager::SymName(volid);
a24be56b 32 if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue;
5be6574e 33 new(alobj[j++]) AliAlignObjParams(symname,volid,dx,dy,dz,rx,ry,rz,kTRUE);
34 }
d3a9c52a 35 }
36 }
37
a24be56b 38 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
d3a9c52a 39 // save on file
dfe9c69d 40 const char* filename = "TRDzeroMisalignment.root";
41 TFile f(filename,"RECREATE");
42 if(!f){
43 Error(macroname,"cannot open file for output\n");
44 return;
45 }
46 Info(macroname,"Saving alignment objects to the file %s", filename);
d3a9c52a 47 f.cd();
48 f.WriteObject(array,"TRDAlignObjs","kSingleKey");
49 f.Close();
50 }else{
51 // save in CDB storage
dfe9c69d 52 TString Storage = gSystem->Getenv("STORAGE");
53 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
54 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
55 return;
56 }
57 Info(macroname,"Saving alignment objects in CDB storage %s",
58 Storage.Data());
d3a9c52a 59 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 60 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
61 if(!storage){
62 Error(macroname,"Unable to open storage %s\n",Storage.Data());
63 return;
64 }
d3a9c52a 65 AliCDBMetaData* md = new AliCDBMetaData();
66 md->SetResponsible("Dariusz Miskowiec");
67 md->SetComment("Zero misalignment for TRD");
5bd470e1 68 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 69 AliCDBId id("TRD/Align/Data",0,AliCDBRunRange::Infinity());
d3a9c52a 70 storage->Put(array,id,md);
71 }
72
73 array->Delete();
74
75}
76
77