Updated names of the environment variables (no dollar sign). Gaussian distribution...
[u/mrichter/AliRoot.git] / TPC / MakeTPCZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakeTPCZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for TPC
3 //
4 if(!gGeoManager) TGeoManager::Import("geometry.root");
5 // needed for the constructors with local coordinates not to fail
6
7 TClonesArray *array = new TClonesArray("AliAlignObjAngles",100);
8 TClonesArray &alobj = *array;
9
10 AliAlignObjAngles o;
11 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
12 Int_t j = 0;
13
14 // RS = local
15 for (Int_t iLayer = AliAlignObj::kTPC1; iLayer <= AliAlignObj::kTPC2; iLayer++) {
16 for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) {
17
18 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
19 const char *symname = AliAlignObj::SymName(volid);
20 new(alobj[j]) AliAlignObjAngles(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
21 j++;
22 }
23 }
24
25
5bd470e1 26 if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
d3a9c52a 27 // save on file
28 TFile f("TPCzeroMisalignment.root","RECREATE");
29 if(!f) cerr<<"cannot open file for output\n";
30 f.cd();
31 f.WriteObject(array,"TPCAlignObjs","kSingleKey");
32 f.Close();
33 }else{
34 // save in CDB storage
5bd470e1 35 const char* Storage = gSystem->Getenv("STORAGE");
d3a9c52a 36 AliCDBManager* cdb = AliCDBManager::Instance();
37 AliCDBStorage* storage = cdb->GetStorage(Storage);
38 AliCDBMetaData* md = new AliCDBMetaData();
39 md->SetResponsible("Marian Ivanov");
40 md->SetComment("Zero misalignment for TPC");
5bd470e1 41 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
d3a9c52a 42 AliCDBId id("TPC/Align/Data",0,9999999);
43 storage->Put(array,id,md);
44 }
45
46 array->Delete();
47
48}
49