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