Removing the tasks from the digitization (Ruben)
[u/mrichter/AliRoot.git] / ACORDE / MakeACORDEZeroMisAlignment.C
CommitLineData
5ade1308 1void MakeACORDEZeroMisAlignment(){\r
2 // Create TClonesArray of zero misalignment objects for ACORDE\r
3 //\r
4 const char* macroname = "MakeACORDEZeroMisAlignment.C";\r
5 // Activate CDB storage and load geometry from CDB\r
6 AliCDBManager* cdb = AliCDBManager::Instance();\r
79ea46fb 7 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");\r
5ade1308 8 cdb->SetRun(0);\r
9 \r
10 AliCDBStorage* storage;\r
11 \r
12 //load geom from local file till ACORDE is not switched on by default in standard config-files\r
13 if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){\r
14 TString Storage = gSystem->Getenv("STORAGE");\r
15 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {\r
16 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());\r
17 return;\r
18 }\r
19 storage = cdb->GetStorage(Storage.Data());\r
20 if(!storage){\r
21 Error(macroname,"Unable to open storage %s\n",Storage.Data());\r
22 return;\r
23 }\r
24 \r
25 AliCDBPath path("GRP","Geometry","Data");\r
26 AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());\r
27 if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");\r
28 entry->SetOwner(0);\r
29 TGeoManager* geom = (TGeoManager*) entry->GetObject();\r
30 AliGeomManager::SetGeometry(geom);\r
31 }else{\r
32 AliGeomManager::LoadGeometry(); //load geom from default CDB storage\r
33 \r
34 }\r
35 // AliGeomManager::LoadGeometry("geometry.root"); \r
36\r
37 TClonesArray *array = new TClonesArray("AliAlignObjParams",64);\r
38 TClonesArray &alobj = *array;\r
39 \r
40 TRandom *rnd = new TRandom(4321);\r
41 Int_t j = 0;\r
42 Double_t dx=0, dy=0, dz=0, dpsi=0, dtheta=0, dphi=0;\r
43\r
44 // RS = local\r
45 // sigma translation \r
46 // sigma rotation \r
47 \r
48 TString symname;\r
49 TString basename = "ACORDE/Array";\r
50 Int_t iIndex=0;\r
51 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;\r
52 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);\r
53\r
79ea46fb 54 for (Int_t imod=0; imod<60; imod++){\r
5ade1308 55 symname = basename;\r
56 symname += imod; \r
57 new(alobj[j++]) AliAlignObjParams(symname, volid, dx, dy, dz,dpsi, dtheta, dphi, kFALSE);\r
58 }\r
59\r
60 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){\r
61 // save on file\r
62 const char* filename = "ACORDEZeroMisalignment.root";\r
63 TFile f(filename,"RECREATE");\r
64 if(!f){\r
65 Error(macroname,"cannot open file for output\n");\r
66 return;\r
67 }\r
68 Info(macroname,"Saving alignment objects to the file %s", filename);\r
69 f.cd();\r
70 f.WriteObject(array,"ACORDEAlignObjs","kSingleKey");\r
71 f.Close();\r
72 }else{\r
73 // save in CDB storage\r
74 AliCDBMetaData* md = new AliCDBMetaData();\r
75 md->SetResponsible("E. Cuautle & M. Rodriguez");\r
76 md->SetComment("Zero misalignment for ACORDE");\r
77 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));\r
78 AliCDBId id("ACORDE/Align/Data",0,AliCDBRunRange::Infinity());\r
79 storage->Put(array,id,md);\r
80 }\r
81\r
82 array->Delete();\r
83\r
84}\r
85\r