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