Loaders removed from the reconstruction code (C.Cheshkov)
[u/mrichter/AliRoot.git] / VZERO / MakeVZEROFullMisAlignment.C
CommitLineData
1895a097 1void MakeVZEROFullMisAlignment(){
2 // Create TClonesArray of full misalignment objects for VZERO
3 //
dfe9c69d 4 if(!AliGeomManager::GetGeometry()){
5 if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
6 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
7 AliCDBManager::Instance()->SetRun(0);
8 AliGeomManager::LoadGeometry();
9 }
1895a097 10 // needed for the constructors with local coordinates not to fail
11
12 TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
13 TClonesArray &alobj = *array;
14
15 AliAlignObjAngles a;
16
17 Double_t dx, dy, dz, dpsi, dtheta, dphi;
18 TRandom *rnd = new TRandom(4321);
d3a9c52a 19 Double_t sigmatr = 0.1; // max shift in cm
20 Double_t sigmarot = 0.5; // max rot in degrees
1895a097 21
22 // null shifts and rotations
23
d3a9c52a 24 const char *V0right="VZERO/V0C";
25 const char *V0left="VZERO/V0A";
1895a097 26
27 Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
ae079791 28 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
29 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
1895a097 30
31 dx = rnd->Gaus(0.,sigmatr);
32 dy = rnd->Gaus(0.,sigmatr);
33 dz = rnd->Gaus(0.,sigmatr);
34 dpsi = rnd->Gaus(0.,sigmarot);
35 dtheta = rnd->Gaus(0.,sigmarot);
36 dphi = rnd->Gaus(0.,sigmarot);
37 new(alobj[0]) AliAlignObjAngles(V0right, volid, dx, dy, dz, dpsi, dtheta,
38 dphi, kFALSE);
39 dx = rnd->Gaus(0.,sigmatr);
40 dy = rnd->Gaus(0.,sigmatr);
41 dz = rnd->Gaus(0.,sigmatr);
42 dpsi = rnd->Gaus(0.,sigmarot);
43 dtheta = rnd->Gaus(0.,sigmarot);
44 dphi = rnd->Gaus(0.,sigmarot);
45 new(alobj[1]) AliAlignObjAngles(V0left, volid, dx, dy, dz, dpsi, dtheta,
46 dphi,kFALSE);
47
dfe9c69d 48 const char* macroname = "MakeVZEROFullMisAlignment.C";
5bd470e1 49 if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
1895a097 50 // save on file
dfe9c69d 51 const char* filename = "VZEROfullMisalignment.root";
52 TFile f(filename,"RECREATE");
53 if(!f){
54 Error(macroname,"cannot open file for output\n");
55 return;
56 }
57 Info(macroname,"Saving alignment objects to the file %s", filename);
1895a097 58 f.cd();
dfe9c69d 59 f.WriteObject(array,"VZEROAlignObjs","kSingleKey");
1895a097 60 f.Close();
61 }else{
62 // save in CDB storage
dfe9c69d 63 TString Storage = gSystem->Getenv("STORAGE");
64 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
65 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
66 return;
67 }
68 Info(macroname,"Saving alignment objects in CDB storage %s",
69 Storage.Data());
1895a097 70 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 71 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
72 if(!storage){
73 Error(macroname,"Unable to open storage %s\n",Storage.Data());
74 return;
75 }
1895a097 76 AliCDBMetaData* md = new AliCDBMetaData();
77 md->SetResponsible("Brigitte Cheynis");
78 md->SetComment("Alignment objects for V0 full misalignment");
5bd470e1 79 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 80 AliCDBId id("VZERO/Align/Data",0,AliCDBRunRange::Infinity());
1895a097 81 storage->Put(array,id,md);
82 }
83
84 array->Delete();
85
86}
87