]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HMPID/MakeHMPIDFullMisAlignment.C
A simple readme file for all the files stored in this dir.
[u/mrichter/AliRoot.git] / HMPID / MakeHMPIDFullMisAlignment.C
1 void MakeHMPIDFullMisAlignment(){
2   // Create TClonesArray of full misalignment objects for HMPID
3   //
4   Float_t sigmaTrans=0.1; // 1mm
5   Float_t sigmaRot=0.001*180/TMath::Pi(); // 1 mrad
6   Float_t dX, dY, dX;          Float_t dPsi, dTheta, dPhi;   //displacements
7
8   TClonesArray *pCA = new TClonesArray("AliAlignObjMatrix",10);
9   
10   TRandom *pRnd   = new TRandom(4357);
11
12   AliAlignObjMatrix o;
13  
14   Int_t idHMPID =  AliAlignObj::kHMPID;
15   for (Int_t iCh = 0; iCh < 7; iCh++) {
16     dX     = (pRnd->Uniform()-0.5)*sigmaTrans;    dY     = (pRnd->Uniform()-0.5)*sigmaTrans;    dZ     = (pRnd->Uniform()-0.5)*sigmaTrans;
17     dPsi   = (pRnd->Uniform()-0.5)*sigmaRot;    dTheta = (pRnd->Uniform()-0.5)*sigmaRot;    dPhi   = (pRnd->Uniform()-0.5)*sigmaRot;
18     new((*pCA)[iCh]) AliAlignObjMatrix(AliAlignObj::SymName(idHMPID,iCh),
19        AliAlignObj::LayerToVolUID(idHMPID,iCh),dX,dY,dZ,dPsi,dTheta,dPhi,kTRUE);
20   }
21
22 //   pCA->Print();
23   
24   if(!gSystem->Getenv("$TOCDB")){
25     // save on file
26     TFile f("HMPIDfullMisalignment.root","RECREATE");
27     if(!f) cerr<<"cannot open file for output\n";
28     f.cd();
29     f.WriteObject(pCA,"HMPIDAlignObjs","kSingleKey");
30     f.Close();
31   }else{
32     // save in CDB storage
33     const char* Storage = gSystem->Getenv("$STORAGE");
34     AliCDBManager* cdb = AliCDBManager::Instance();
35     AliCDBStorage* storage = cdb->GetStorage(Storage);
36     AliCDBMetaData *pMeta= new AliCDBMetaData();  
37     pMeta->SetResponsible("HMPID Expert");
38     pMeta->SetComment("Full alignment objects for HMPID produced with sigmaTrans=1mm and sigmaRot=1mrad");
39     pMeta->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
40     AliCDBId id("HMPID/Align/Data",0,9999999);
41     storage->Put(pCA,id,pMeta);
42   }
43   
44   pCA->Delete();
45 }