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