Bug in area evaluation for reconstruction of ring. Important for PbPb events (high...
[u/mrichter/AliRoot.git] / HMPID / MakeHMPIDFullMisAlignment.C
CommitLineData
d3da6dc4 1void 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
ae079791 12 Int_t idHMPID = AliGeomManager::kHMPID;
d3da6dc4 13 for (Int_t iCh = 0; iCh < 7; iCh++) {
14 dX = (pRnd->Uniform()-0.5)*sigmaTrans; dY = (pRnd->Uniform()-0.5)*sigmaTrans; dZ = (pRnd->Uniform()-0.5)*sigmaTrans;
15 dPsi = (pRnd->Uniform()-0.5)*sigmaRot; dTheta = (pRnd->Uniform()-0.5)*sigmaRot; dPhi = (pRnd->Uniform()-0.5)*sigmaRot;
ae079791 16 new((*pCA)[iCh]) AliAlignObjMatrix(AliGeomManager::SymName(idHMPID,iCh),
17 AliGeomManager::LayerToVolUID(idHMPID,iCh),dX,dY,dZ,dPsi,dTheta,dPhi,kTRUE);
d3da6dc4 18 }
19
20// pCA->Print();
dfe9c69d 21
22 const char* macroname = "MakeHMPIDResMisAlignment.C";
a24be56b 23 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
d3da6dc4 24 // save on file
dfe9c69d 25 const char* filename = "HMPIDresidualMisalignment.root";
26 TFile f(filename,"RECREATE");
27 if(!f){
28 Error(macroname,"cannot open file for output\n");
29 return;
30 }
31 Info(macroname,"Saving alignment objects to the file %s", filename);
d3da6dc4 32 f.cd();
33 f.WriteObject(pCA,"HMPIDAlignObjs","kSingleKey");
34 f.Close();
35 }else{
36 // save in CDB storage
dfe9c69d 37 TString Storage = gSystem->Getenv("STORAGE");
38 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
39 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
40 return;
41 }
42 Info(macroname,"Saving alignment objects in CDB storage %s",
43 Storage.Data());
d3da6dc4 44 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 45 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
46 if(!storage){
47 Error(macroname,"Unable to open storage %s\n",Storage.Data());
48 return;
49 }
d3da6dc4 50 AliCDBMetaData *pMeta= new AliCDBMetaData();
51 pMeta->SetResponsible("HMPID Expert");
52 pMeta->SetComment("Full alignment objects for HMPID produced with sigmaTrans=1mm and sigmaRot=1mrad");
5bd470e1 53 pMeta->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 54 AliCDBId id("HMPID/Align/Data",0,AliCDBRunRange::Infinity());
d3da6dc4 55 storage->Put(pCA,id,pMeta);
56 }
57
58 pCA->Delete();
59}