possiblity to read ESD friends and TPC outer check (Jacek)
[u/mrichter/AliRoot.git] / EMCAL / MakeEMCALZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakeEMCALZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for EMCAL
3 //
6fce62af 4 const char* macroname = "MakeEMCALZeroMisAlignment.C";
937d0661 5 const AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaultGeometryName(),"");
289cc8a7 6 if(!geom) {
7 Error("MakeEMCALZeroMisAlignment","Cannot obtain AliEMCALGeometry singleton\n");
8 return;
9 }
d3a9c52a 10
289cc8a7 11 TClonesArray *array = new TClonesArray("AliAlignObjParams",geom->GetNumberOfSuperModules());
12 TClonesArray &alobj = *array;
13
14 /*
d3a9c52a 15 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
16
17 const TString fbasepath = "EMCAL/FullSupermodule";
18 const TString hbasepath = "EMCAL/HalfSupermodule";
19 TString pathstr;
20
21 Int_t iIndex=0; // let all modules have index=0 in a layer with no LUT
ae079791 22 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
23 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
d3a9c52a 24
25 Int_t i;
26 Int_t j=0;
27
28 for(i=0; i<10; i++){
29 pathstr=fbasepath;
30 pathstr+=(i+1);
90dbf5fb 31 new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
d3a9c52a 32 }
33
34 for(i=0; i<2; i++){
35 pathstr=hbasepath;
36 pathstr+=(i+1);
90dbf5fb 37 new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
d3a9c52a 38 }
289cc8a7 39 */
40
41 AliEMCALSurvey emcalSurvey;
42 emcalSurvey.CreateNullObjects(alobj,geom);
d3a9c52a 43
a24be56b 44 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
d3a9c52a 45 // save on file
dfe9c69d 46 const char* filename = "EMCALzeroMisalignment.root";
47 TFile f(filename,"RECREATE");
48 if(!f){
49 Error(macroname,"cannot open file for output\n");
50 return;
51 }
52 Info(macroname,"Saving alignment objects to the file %s", filename);
d3a9c52a 53 f.cd();
54 f.WriteObject(array,"EMCALAlignObjs","kSingleKey");
55 f.Close();
56 }else{
57 // save in CDB storage
dfe9c69d 58 TString Storage = gSystem->Getenv("STORAGE");
59 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
60 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
61 return;
62 }
63 Info(macroname,"Saving alignment objects in CDB storage %s",
64 Storage.Data());
d3a9c52a 65 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 66 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
67 if(!storage){
68 Error(macroname,"Unable to open storage %s\n",Storage.Data());
69 return;
70 }
d3a9c52a 71 AliCDBMetaData* md = new AliCDBMetaData();
289cc8a7 72 md->SetResponsible("Jennifer Klay");
d3a9c52a 73 md->SetComment("Zero misalignment for EMCAL");
5bd470e1 74 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 75 AliCDBId id("EMCAL/Align/Data",0,AliCDBRunRange::Infinity());
d3a9c52a 76 storage->Put(array,id,md);
77 }
78
79 array->Delete();
80
81}
82