New version of the HMPID DA without the usage of trees (Levente)
[u/mrichter/AliRoot.git] / HMPID / MakeHMPIDZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakeHMPIDZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for HMPID
3 //
4 TClonesArray *pCA = new TClonesArray("AliAlignObjMatrix",10);
5
d3a9c52a 6 Double_t dX=0.,dY=0.,dZ=0.,dPsi=0.,dTheta=0.,dPhi=0.;
7
ae079791 8 Int_t idHMPID = AliGeomManager::kHMPID;
d3a9c52a 9 for (Int_t iCh = 0; iCh < 7; iCh++) {
ae079791 10 new((*pCA)[iCh]) AliAlignObjMatrix(AliGeomManager::SymName(idHMPID,iCh),AliGeomManager::LayerToVolUID(idHMPID,iCh),dX,dY,dZ,dPsi,dTheta,dPhi,kTRUE);
d3a9c52a 11 }
12
13// pCA->Print();
dfe9c69d 14 const char* macroname = "MakeHMPIDZeroMisAlignment.C";
a24be56b 15 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
d3a9c52a 16 // save on file
dfe9c69d 17 const char* filename = "HMPIDzeroMisalignment.root";
18 TFile f(filename,"RECREATE");
19 if(!f){
20 Error(macroname,"cannot open file for output\n");
21 return;
22 }
23 Info(macroname,"Saving alignment objects to the file %s", filename);
d3a9c52a 24 f.cd();
25 f.WriteObject(pCA,"HMPIDAlignObjs","kSingleKey");
26 f.Close();
27 }else{
28 // save in CDB storage
dfe9c69d 29 TString Storage = gSystem->Getenv("STORAGE");
30 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
31 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
32 return;
33 }
34 Info(macroname,"Saving alignment objects in CDB storage %s",
35 Storage.Data());
d3a9c52a 36 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 37 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
38 if(!storage){
39 Error(macroname,"Unable to open storage %s\n",Storage.Data());
40 return;
41 }
d3a9c52a 42 AliCDBMetaData *pMeta= new AliCDBMetaData();
43 pMeta->SetResponsible("HMPID Expert");
44 pMeta->SetComment("Zero alignment objects for HMPID");
5bd470e1 45 pMeta->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 46 AliCDBId id("HMPID/Align/Data",0,AliCDBRunRange::Infinity());
d3a9c52a 47 storage->Put(pCA,id,pMeta);
48 }
49
50 pCA->Delete();
51}