AliRoot Core  edcc906 (edcc906)
MakeEMCALZeroMisAlignment.C
Go to the documentation of this file.
1 
12 #if !defined(__CINT__)
13 #include <TString.h>
14 #include <TFile.h>
15 #include <TClonesArray.h>
16 
17 #include "AliRun.h"
18 #include "AliAlignObjParams.h"
19 #include "AliEMCALGeometry.h"
20 #include "AliEMCALSurvey.h"
21 #include "AliCDBMetaData.h"
22 #include "AliCDBId.h"
23 #include "AliCDBEntry.h"
24 #include "AliCDBManager.h"
25 #include "AliCDBStorage.h"
26 #endif
27 
33 void MakeEMCALZeroMisAlignment(TString geoname = "EMCAL_COMPLETE12SMV1_DCAL_8SM")
34 {
35  //
36  const char* macroname = "MakeEMCALZeroMisAlignment.C";
37 
38  if(geoname=="")geoname=AliEMCALGeometry::GetDefaultGeometryName();
39 
41 
42  if(!geom)
43  {
44  Error("MakeEMCALZeroMisAlignment","Cannot obtain AliEMCALGeometry singleton\n");
45  return;
46  }
47 
48  TClonesArray *array = new TClonesArray("AliAlignObjParams",geom->GetNumberOfSuperModules());
49  TClonesArray &alobj = *array;
50 
51  /*
52  Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
53 
54  const TString fbasepath = "EMCAL/FullSupermodule";
55  const TString hbasepath = "EMCAL/HalfSupermodule";
56  TString pathstr;
57 
58  Int_t iIndex=0; // let all modules have index=0 in a layer with no LUT
59  AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
60  UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
61 
62  Int_t i;
63  Int_t j=0;
64 
65  for(i=0; i<10; i++){
66  pathstr=fbasepath;
67  pathstr+=(i+1);
68  new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
69  }
70 
71  for(i=0; i<2; i++){
72  pathstr=hbasepath;
73  pathstr+=(i+1);
74  new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
75  }
76  */
77 
78  AliEMCALSurvey emcalSurvey;
79  emcalSurvey.CreateNullObjects(alobj,geom);
80 
81  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") )
82  {
83  // save on file
84  const char* filename = "EMCALzeroMisalignment.root";
85  TFile f(filename,"RECREATE");
86 // if(!f)
87 // {
88 // Error(macroname,"cannot open file for output\n");
89 // return;
90 // }
91 
92  Info(macroname,"Saving alignment objects to the file %s", filename);
93  f.cd();
94  f.WriteObject(array,"EMCALAlignObjs","kSingleKey");
95  f.Close();
96  }
97  else
98  {
99  // save in CDB storage
100  TString storageName = gSystem->Getenv("STORAGE");
101  if(!storageName.BeginsWith("local://") && !storageName.BeginsWith("alien://"))
102  {
103  Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",storageName.Data());
104  return;
105  }
106 
107  Info(macroname,"Saving alignment objects in CDB storage %s",
108  storageName.Data());
110  AliCDBStorage* storage = cdb->GetStorage(storageName.Data());
111  if(!storage)
112  {
113  Error(macroname,"Unable to open storage %s\n",storageName.Data());
114  return;
115  }
116 
117  AliCDBMetaData* md = new AliCDBMetaData();
118  md->SetResponsible("Jennifer Klay");
119  md->SetComment("Zero misalignment for EMCAL");
120  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
121  AliCDBId id("EMCAL/Align/Data",0,AliCDBRunRange::Infinity());
122  storage->Put(array,id,md);
123  }
124 
125  array->Delete();
126 
127 }
128 
Bool_t Put(TObject *object, AliCDBId &id, AliCDBMetaData *metaData, const char *mirrors="", AliCDBManager::DataType type=AliCDBManager::kPrivate)
static const Char_t * GetDefaultGeometryName()
void SetComment(const char *comment)
Int_t GetNumberOfSuperModules(void) const
Read survey data and create alignement.
void SetResponsible(const char *yourName)
void MakeEMCALZeroMisAlignment(TString geoname="EMCAL_COMPLETE12SMV1_DCAL_8SM")
TObjArray * array
Definition: AnalyzeLaser.C:12
void SetAliRootVersion(const char *version)
TF1 * f
Definition: interpolTest.C:21
void CreateNullObjects(TClonesArray &alObj, const AliEMCALGeometry *geom) const
Create null shifts and rotations.
static AliEMCALGeometry * GetInstance()
static AliCDBManager * Instance(TMap *entryCache=NULL, Int_t run=-1)
TEveGeoShape * geom
Definition: tpc_tracks.C:10
static Int_t Infinity()
EMCal geometry, singleton.