First V0 MC Analysis from H.Ricaud
[u/mrichter/AliRoot.git] / TRD / MakeTRDZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakeTRDZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for TRD
3 //
6fce62af 4 const char* macroname = "MakeTRDZeroMisAlignment.C";
90dbf5fb 5 TClonesArray *array = new TClonesArray("AliAlignObjParams",1000);
d3a9c52a 6 TClonesArray &alobj = *array;
7
a24be56b 8 Int_t sActive[18]={0,0,1,1,1,0,1,0,0,0,0,1,1,0,1,1,0,0};
d3a9c52a 9 Double_t dx=0.,dy=0.,dz=0.,rx=0.,ry=0.,rz=0.;
10
11 Int_t j=0;
12 UShort_t volid;
13 const char *symname;
14
6fce62af 15 // create the supermodules' alignment objects
a24be56b 16 for (Int_t iSect; iSect<18; iSect++) {
17 TString sm_symname(Form("TRD/sm%02d",iSect));
18 if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue;
6fce62af 19 new(alobj[j++]) AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kTRUE);
20 }
21
22 // create the chambers' alignment objects
a24be56b 23 Int_t chId;
ae079791 24 for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) {
a24be56b 25 chId=-1;
26 for (Int_t iSect = 0; iSect < 18; iSect++){
27 for (Int_t iCh = 0; iCh < 5; iCh++) {
28 chId++;
29 volid = AliGeomManager::LayerToVolUID(iLayer,chId);
ae079791 30 symname = AliGeomManager::SymName(volid);
a24be56b 31 if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue;
90dbf5fb 32 new(alobj[j++]) AliAlignObjParams(symname,volid,dx,dy,dz,rx,ry,rz,kTRUE);
d3a9c52a 33 }
34 }
a24be56b 35 }
d3a9c52a 36
a24be56b 37 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
d3a9c52a 38 // save on file
dfe9c69d 39 const char* filename = "TRDzeroMisalignment.root";
40 TFile f(filename,"RECREATE");
41 if(!f){
42 Error(macroname,"cannot open file for output\n");
43 return;
44 }
45 Info(macroname,"Saving alignment objects to the file %s", filename);
d3a9c52a 46 f.cd();
47 f.WriteObject(array,"TRDAlignObjs","kSingleKey");
48 f.Close();
49 }else{
50 // save in CDB storage
dfe9c69d 51 TString Storage = gSystem->Getenv("STORAGE");
52 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
53 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
54 return;
55 }
56 Info(macroname,"Saving alignment objects in CDB storage %s",
57 Storage.Data());
d3a9c52a 58 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 59 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
60 if(!storage){
61 Error(macroname,"Unable to open storage %s\n",Storage.Data());
62 return;
63 }
d3a9c52a 64 AliCDBMetaData* md = new AliCDBMetaData();
65 md->SetResponsible("Dariusz Miskowiec");
66 md->SetComment("Zero misalignment for TRD");
5bd470e1 67 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 68 AliCDBId id("TRD/Align/Data",0,AliCDBRunRange::Infinity());
d3a9c52a 69 storage->Put(array,id,md);
70 }
71
72 array->Delete();
73
74}
75
76