]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - EMCAL/MakeEMCALZeroMisAlignment.C
New classes (Markus)
[u/mrichter/AliRoot.git] / EMCAL / MakeEMCALZeroMisAlignment.C
... / ...
CommitLineData
1void MakeEMCALZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for EMCAL
3 //
4 const char* macroname = "MakeEMCALZeroMisAlignment.C";
5 const AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaultGeometryName(),"");
6 if(!geom) {
7 Error("MakeEMCALZeroMisAlignment","Cannot obtain AliEMCALGeometry singleton\n");
8 return;
9 }
10
11 TClonesArray *array = new TClonesArray("AliAlignObjParams",geom->GetNumberOfSuperModules());
12 TClonesArray &alobj = *array;
13
14 /*
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
22 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
23 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
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);
31 new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
32 }
33
34 for(i=0; i<2; i++){
35 pathstr=hbasepath;
36 pathstr+=(i+1);
37 new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
38 }
39 */
40
41 AliEMCALSurvey emcalSurvey;
42 emcalSurvey.CreateNullObjects(alobj,geom);
43
44 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
45 // save on file
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);
53 f.cd();
54 f.WriteObject(array,"EMCALAlignObjs","kSingleKey");
55 f.Close();
56 }else{
57 // save in CDB storage
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());
65 AliCDBManager* cdb = AliCDBManager::Instance();
66 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
67 if(!storage){
68 Error(macroname,"Unable to open storage %s\n",Storage.Data());
69 return;
70 }
71 AliCDBMetaData* md = new AliCDBMetaData();
72 md->SetResponsible("Jennifer Klay");
73 md->SetComment("Zero misalignment for EMCAL");
74 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
75 AliCDBId id("EMCAL/Align/Data",0,AliCDBRunRange::Infinity());
76 storage->Put(array,id,md);
77 }
78
79 array->Delete();
80
81}
82