From d3a9c52a8e655e35c86c18170ff4c8eacc2c7196 Mon Sep 17 00:00:00 2001 From: hristov Date: Wed, 7 Feb 2007 08:25:02 +0000 Subject: [PATCH] Full set of updated misalignment macros (Raffaele) --- EMCAL/MakeEMCALFullMisAlignment.C | 17 ++- EMCAL/MakeEMCALResMisAlignment.C | 17 ++- EMCAL/MakeEMCALZeroMisAlignment.C | 60 ++++++++++ FMD/MakeFMDZeroMisAlignment.C | 26 +++++ HMPID/MakeHMPIDZeroMisAlignment.C | 38 +++++++ ITS/MakeITSFullMisAlignment.C | 2 + ITS/MakeITSResMisAlignment.C | 6 +- ITS/MakeITSZeroMisAlignment.C | 80 ++++++++++++++ MUON/MakeMUONZeroMisAlignment.C | 73 +++++++++++++ PHOS/MakePHOSZeroMisAlignment.C | 66 +++++++++++ PMD/MakePMDFullMisAlignment.C | 8 +- PMD/MakePMDResMisAlignment.C | 8 +- PMD/MakePMDZeroMisAlignment.C | 79 ++++++++++++++ T0/MakeT0FullMisAlignment.C | 54 +++++---- T0/MakeT0ResMisAlignment.C | 42 +++---- T0/MakeT0ZeroMisAlignment.C | 54 +++++++++ TOF/MakeTOFFullMisAlignment.C | 158 ++++++++++++++++++++++++--- TOF/MakeTOFResMisAlignment.C | 2 +- TOF/MakeTOFZeroMisAlignment.C | 37 ++++--- TPC/MakeTPCFullMisAlignment.C | 24 ++-- TPC/MakeTPCResMisAlignment.C | 6 +- TPC/MakeTPCZeroMisAlignment.C | 49 +++++++++ TRD/MakeTRDFullMisAlignment.C | 54 +++++++-- TRD/MakeTRDResMisAlignment.C | 6 +- TRD/MakeTRDZeroMisAlignment.C | 51 +++++++++ VZERO/MakeVZEROFullMisAlignment.C | 8 +- VZERO/MakeVZEROResMisAlignment.C | 4 +- VZERO/MakeVZEROZeroMisAlignment.C | 46 ++++++++ ZDC/MakeZDCZeroMisAlignment.C | 48 ++++++++ macros/MakeAllDETsResMisAlignment.C | 2 +- macros/MakeAllDETsZeroMisAlignment.C | 43 ++++++++ 31 files changed, 1037 insertions(+), 131 deletions(-) create mode 100644 EMCAL/MakeEMCALZeroMisAlignment.C create mode 100644 FMD/MakeFMDZeroMisAlignment.C create mode 100644 HMPID/MakeHMPIDZeroMisAlignment.C create mode 100644 ITS/MakeITSZeroMisAlignment.C create mode 100644 MUON/MakeMUONZeroMisAlignment.C create mode 100644 PHOS/MakePHOSZeroMisAlignment.C create mode 100644 PMD/MakePMDZeroMisAlignment.C create mode 100644 T0/MakeT0ZeroMisAlignment.C create mode 100644 TPC/MakeTPCZeroMisAlignment.C create mode 100644 TRD/MakeTRDZeroMisAlignment.C create mode 100644 VZERO/MakeVZEROZeroMisAlignment.C create mode 100644 ZDC/MakeZDCZeroMisAlignment.C create mode 100644 macros/MakeAllDETsZeroMisAlignment.C diff --git a/EMCAL/MakeEMCALFullMisAlignment.C b/EMCAL/MakeEMCALFullMisAlignment.C index ca502270552..563cf1600e4 100644 --- a/EMCAL/MakeEMCALFullMisAlignment.C +++ b/EMCAL/MakeEMCALFullMisAlignment.C @@ -17,15 +17,16 @@ void MakeEMCALFullMisAlignment(){ // null shifts and rotations const TString basepath = "EMCAL/FullSupermodule"; + const TString hbasepath = "EMCAL/HalfSupermodule"; TString pathstr; Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); //dummy volume identity Int_t i; + Int_t j=0; for(i=0; i<10; i++){ - dx = rnd->Gaus(0.,sigmatr); dy = rnd->Gaus(0.,sigmatr); dz = rnd->Gaus(0.,sigmatr); @@ -35,7 +36,19 @@ void MakeEMCALFullMisAlignment(){ pathstr=basepath; pathstr+=(i+1); cout<Gaus(0.,sigmatr); + dy = rnd->Gaus(0.,sigmatr); + dz = rnd->Gaus(0.,sigmatr); + dpsi = rnd->Gaus(0.,sigmarot); + dtheta = rnd->Gaus(0.,sigmarot); + dphi = rnd->Gaus(0.,sigmarot); + pathstr=hbasepath; + pathstr+=(i+1); + new(alobj[j++]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); } if(!gSystem->Getenv("$TOCDB")){ diff --git a/EMCAL/MakeEMCALResMisAlignment.C b/EMCAL/MakeEMCALResMisAlignment.C index 7fe39f1786b..8f16e8efe72 100644 --- a/EMCAL/MakeEMCALResMisAlignment.C +++ b/EMCAL/MakeEMCALResMisAlignment.C @@ -12,6 +12,7 @@ void MakeEMCALResMisAlignment(){ Double_t dx, dy, dz, dpsi, dtheta, dphi; const TString basepath = "EMCAL/FullSupermodule"; + const TString hbasepath = "EMCAL/HalfSupermodule"; TString pathstr; Int_t iIndex=0; // let all modules have index=0 in a layer with no LUT @@ -19,6 +20,7 @@ void MakeEMCALResMisAlignment(){ UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); Int_t i; + Int_t j=0; // RS = local // sigma translation = 1mm @@ -26,6 +28,7 @@ void MakeEMCALResMisAlignment(){ TRandom *rnd = new TRandom(4321); Double_t sigmatr = 0.1; // max shift in cm w.r.t. local RS Double_t sigmarot = 0.1; // max rot in degrees w.r.t. local RS + for(i=0; i<10; i++){ dx = rnd->Gaus(0.,sigmatr); dy = rnd->Gaus(0.,sigmatr); @@ -35,7 +38,19 @@ void MakeEMCALResMisAlignment(){ dphi = rnd->Gaus(0.,sigmarot); pathstr=basepath; pathstr+=(i+1); - new(alobj[i]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE); + new(alobj[j++]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE); + } + + for(i=0; i<2; i++){ + dx = rnd->Gaus(0.,sigmatr); + dy = rnd->Gaus(0.,sigmatr); + dz = rnd->Gaus(0.,sigmatr); + dpsi = rnd->Gaus(0.,sigmarot); + dtheta = rnd->Gaus(0.,sigmarot); + dphi = rnd->Gaus(0.,sigmarot); + pathstr=hbasepath; + pathstr+=(i+1); + new(alobj[j++]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); } if(!gSystem->Getenv("$TOCDB")){ diff --git a/EMCAL/MakeEMCALZeroMisAlignment.C b/EMCAL/MakeEMCALZeroMisAlignment.C new file mode 100644 index 00000000000..5e9d194a846 --- /dev/null +++ b/EMCAL/MakeEMCALZeroMisAlignment.C @@ -0,0 +1,60 @@ +void MakeEMCALZeroMisAlignment(){ + // Create TClonesArray of zero misalignment objects for EMCAL + // + TClonesArray *array = new TClonesArray("AliAlignObjAngles",10); + TClonesArray &alobj = *array; + + if(!gGeoManager) TGeoManager::Import("geometry.root"); + // needed for the constructors with local coordinates not to fail + + AliAlignObjAngles a; + + Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.; + + const TString fbasepath = "EMCAL/FullSupermodule"; + const TString hbasepath = "EMCAL/HalfSupermodule"; + TString pathstr; + + Int_t iIndex=0; // let all modules have index=0 in a layer with no LUT + AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; + UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); + + Int_t i; + Int_t j=0; + + for(i=0; i<10; i++){ + pathstr=fbasepath; + pathstr+=(i+1); + new(alobj[j++]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + } + + for(i=0; i<2; i++){ + pathstr=hbasepath; + pathstr+=(i+1); + new(alobj[j++]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + } + + if(!gSystem->Getenv("$TOCDB")){ + // save on file + TFile f("EMCALzeroMisalignment.root","RECREATE"); + if(!f) cerr<<"cannot open file for output\n"; + f.cd(); + f.WriteObject(array,"EMCALAlignObjs","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + const char* Storage = gSystem->Getenv("$STORAGE"); + AliCDBManager* cdb = AliCDBManager::Instance(); + AliCDBStorage* storage = cdb->GetStorage(Storage); + AliCDBMetaData* md = new AliCDBMetaData(); + md->SetResponsible("Jennifer Clay"); + md->SetComment("Zero misalignment for EMCAL"); + md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); + AliCDBId id("EMCAL/Align/Data",0,9999999); + storage->Put(array,id,md); + } + + array->Delete(); + +} + diff --git a/FMD/MakeFMDZeroMisAlignment.C b/FMD/MakeFMDZeroMisAlignment.C new file mode 100644 index 00000000000..db21d2df8dc --- /dev/null +++ b/FMD/MakeFMDZeroMisAlignment.C @@ -0,0 +1,26 @@ +void MakeFMDZeroMisAlignment() +{ + // Create TClonesArray of zero-misalignment objects for FMD + // + if(!gGeoManager) TGeoManager::Import("geometry.root"); + + gSystem->Load("libFMDutil.so"); + if(!gSystem->Getenv("$TOCDB")){ + // save on file + AliFMDAlignFaker faker(AliFMDAlignFaker::kAll, "geometry.root","FMDAlignObjs.root"); + }else{ + // save in CDB storage + const char* Storage = gSystem->Getenv("$STORAGE"); + AliFMDAlignFaker faker(AliFMDAlignFaker::kAll, "geometry.root", Storage); + } + + // fRunMax should be changed in the constructor + + faker.SetSensorDisplacement(0., 0., 0., 0., 0., 0.); + faker.SetSensorRotation(0., 0., 0., 0., 0., 0.); + faker.SetHalfDisplacement(0., 0., 0., 0., 0., 0.); + faker.SetHalfRotation(0., 0., 0., 0., 0., 0.); + faker.Exec(); + + +} diff --git a/HMPID/MakeHMPIDZeroMisAlignment.C b/HMPID/MakeHMPIDZeroMisAlignment.C new file mode 100644 index 00000000000..981ecadb6d8 --- /dev/null +++ b/HMPID/MakeHMPIDZeroMisAlignment.C @@ -0,0 +1,38 @@ +void MakeHMPIDZeroMisAlignment(){ + // Create TClonesArray of zero misalignment objects for HMPID + // + TClonesArray *pCA = new TClonesArray("AliAlignObjMatrix",10); + + AliAlignObjMatrix o; + + Double_t dX=0.,dY=0.,dZ=0.,dPsi=0.,dTheta=0.,dPhi=0.; + + Int_t idHMPID = AliAlignObj::kHMPID; + for (Int_t iCh = 0; iCh < 7; iCh++) { + new((*pCA)[iCh]) AliAlignObjMatrix(AliAlignObj::SymName(idHMPID,iCh),AliAlignObj::LayerToVolUID(idHMPID,iCh),dX,dY,dZ,dPsi,dTheta,dPhi,kTRUE); + } + +// pCA->Print(); + + if(!gSystem->Getenv("$TOCDB")){ + // save on file + TFile f("HMPIDzeroMisalignment.root","RECREATE"); + if(!f) cerr<<"cannot open file for output\n"; + f.cd(); + f.WriteObject(pCA,"HMPIDAlignObjs","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + const char* Storage = gSystem->Getenv("$STORAGE"); + AliCDBManager* cdb = AliCDBManager::Instance(); + AliCDBStorage* storage = cdb->GetStorage(Storage); + AliCDBMetaData *pMeta= new AliCDBMetaData(); + pMeta->SetResponsible("HMPID Expert"); + pMeta->SetComment("Zero alignment objects for HMPID"); + pMeta->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); + AliCDBId id("HMPID/Align/Data",0,9999999); + storage->Put(pCA,id,pMeta); + } + + pCA->Delete(); +} diff --git a/ITS/MakeITSFullMisAlignment.C b/ITS/MakeITSFullMisAlignment.C index acd3010fb70..cf64e03ee27 100644 --- a/ITS/MakeITSFullMisAlignment.C +++ b/ITS/MakeITSFullMisAlignment.C @@ -27,6 +27,8 @@ void MakeITSFullMisAlignment(){ Int_t j = 0; new(alobj[j++]) AliAlignObjAngles("ITS", 0, dx, dy, globalZ, dpsi, dtheta, dphi, kTRUE); + AliAlignObjAngles* its_alobj = (AliAlignObjAngles*) array->UncheckedAt(0); + its_alobj->ApplyToGeometry(); for ( Int_t l = AliAlignObj::kSPD1; l <= AliAlignObj::kSSD2; l++) { diff --git a/ITS/MakeITSResMisAlignment.C b/ITS/MakeITSResMisAlignment.C index bd647bac630..891777c6645 100644 --- a/ITS/MakeITSResMisAlignment.C +++ b/ITS/MakeITSResMisAlignment.C @@ -25,8 +25,10 @@ void MakeITSResMisAlignment(){ Int_t j = 0; - new(alobj[j]) AliAlignObjAngles("ITS", 0, dx, dy, globalZ, dpsi, dtheta, dphi, kTRUE); - j++; + new(alobj[j++]) AliAlignObjAngles("ITS", 0, dx, dy, globalZ, dpsi, dtheta, dphi, kTRUE); + AliAlignObjAngles* its_alobj = (AliAlignObjAngles*) array->UncheckedAt(0); + its_alobj->ApplyToGeometry(); + for ( Int_t l = AliAlignObj::kSPD1; l <= AliAlignObj::kSSD2; l++) { diff --git a/ITS/MakeITSZeroMisAlignment.C b/ITS/MakeITSZeroMisAlignment.C new file mode 100644 index 00000000000..af0360bd8e9 --- /dev/null +++ b/ITS/MakeITSZeroMisAlignment.C @@ -0,0 +1,80 @@ +void MakeITSZeroMisAlignment(){ + // Create TClonesArray of zero misalignment objects for ITS + // + TClonesArray *array = new TClonesArray("AliAlignObjAngles",4000); + TClonesArray &alobj = *array; + + if(!gGeoManager) TGeoManager::Import("geometry.root"); + // needed for the constructors with local coordinates not to fail + + AliAlignObjAngles a; + + Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0., globalZ=0.; + AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; + + Int_t j = 0; + + new(alobj[j]) AliAlignObjAngles("ITS", 0, dx, dy, globalZ, dpsi, dtheta, dphi, kTRUE); + j++; + + for ( Int_t l = AliAlignObj::kSPD1; l <= AliAlignObj::kSSD2; l++) { + + printf("%i modules in layer %i\n", AliAlignObj::LayerSize(l), l); + for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(l); iModule++) { + + iLayer = AliAlignObj::kInvalidLayer; + + switch (l) { + case 1: { + iLayer = AliAlignObj::kSPD1; + }; break; + case 2: { + iLayer = AliAlignObj::kSPD2; + }; break; + case 3: { + iLayer = AliAlignObj::kSDD1; + }; break; + case 4: { + iLayer = AliAlignObj::kSDD2; + }; break; + case 5: { + iLayer = AliAlignObj::kSSD1; + }; break; + case 6: { + iLayer = AliAlignObj::kSSD2; + }; break; + default: Printf("Wrong layer index in ITS (%d) !",l); + }; + UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule); + const char *symname = AliAlignObj::SymName(volid); + + new(alobj[j]) AliAlignObjAngles(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + j++; + + } + } + + if(!gSystem->Getenv("$TOCDB")){ + // save on file + TFile f("ITSzeroMisalignment.root","RECREATE"); + if(!f) {cerr<<"cannot open file for output\n";} + f.WriteObject(array,"ITSAlignObjs","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + const char* Storage = gSystem->Getenv("$STORAGE"); + AliCDBManager *CDB = AliCDBManager::Instance(); + AliCDBStorage* storage = CDB->GetStorage(Storage); + AliCDBMetaData *md= new AliCDBMetaData(); + md->SetResponsible("Ludovic Gaudichet"); + md->SetComment("Alignment objects with zero ITS misalignment"); + md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); + AliCDBId id("ITS/Align/Data",0,9999999); + storage->Put(array,id, md); + } + + array->Delete(); + +} + + diff --git a/MUON/MakeMUONZeroMisAlignment.C b/MUON/MakeMUONZeroMisAlignment.C new file mode 100644 index 00000000000..6f4c92432ec --- /dev/null +++ b/MUON/MakeMUONZeroMisAlignment.C @@ -0,0 +1,73 @@ +void MakeMUONZeroMisAlignment(Bool_t volpaths = false, + Bool_t transforms = false, + Bool_t svmaps = false) +// Macro for generating the geometry data files: +// (volpath.dat, transform.dat, svmap.dat) +// and local CDB storage with zero, residual and full misalignment +// +// The generated files do not replace the existing ones +// but have different names (with extension ".out"). +// +// Author: I. Hrivnacova, IPN Orsay +// +{ + // Initialize + gAlice->Init("$ALICE_ROOT/MUON/Config.C"); + cout << "Init done " << endl; + + // Get MUON detector + AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON"); + if (!muon) { + AliFatal("MUON detector not defined."); + return 0; + } + + // Get geometry builder + AliMUONGeometryBuilder* builder = muon ->GetGeometryBuilder(); + + if (volpaths) { + cout << "Generating volpath file ..." << endl; + builder->GetTransformer()->WriteVolumePaths("volpath.dat.out"); + } + + if (transforms) { + cout << "Generating transformation file ..." << endl; + builder->GetTransformer()->WriteTransformations("transform.dat.out"); + } + + if (svmaps) { + cout << "Generating svmaps file ..." << endl; + builder->WriteSVMaps(); + } + + cout << "Generating residual misalignment data in MUON/ZeroMisAlignCDB/Data..." << endl; + + AliMUONGeometryMisAligner misAligner(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); + AliMUONGeometryTransformer* newTransform + = misAligner.MisAlign(builder->GetTransformer(), true); + TClonesArray* array = newTransform->GetMisAlignmentData(); + + if(!gSystem->Getenv("$TOCDB")){ + // Create a File to store the alignment data + TFile f("MUONresidualMisalignment.root","RECREATE"); + if(!f) {cerr<<"cannot open file for output\n";} + + f.cd(); + f.WriteObject(array,"MUONAlignObjs ","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + const char* Storage = gSystem->Getenv("$STORAGE"); + AliCDBManager* cdbManager = AliCDBManager::Instance(); + AliCDBStorage* storage = cdbManager->GetStorage(Storage); + AliCDBMetaData* cdbData = new AliCDBMetaData(); + cdbData->SetResponsible("Dimuon Offline project"); + cdbData->SetComment("MUON alignment objects with residual misalignment"); + cdbData->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); + AliCDBId id("MUON/Align/Data", 0, 9999999); + storage->Put(array, id, cdbData); + } + + delete newTransform; +} + diff --git a/PHOS/MakePHOSZeroMisAlignment.C b/PHOS/MakePHOSZeroMisAlignment.C new file mode 100644 index 00000000000..fb87b20a853 --- /dev/null +++ b/PHOS/MakePHOSZeroMisAlignment.C @@ -0,0 +1,66 @@ +void MakePHOSZeroMisAlignment(){ + // Create TClonesArray of zero misalignment objects for PHOS + // + TClonesArray *array = new TClonesArray("AliAlignObjAngles",11); + TClonesArray &alobj = *array; + + AliAlignObjAngles a; + + Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.; + + Int_t iIndex=0; // let all modules have index=0 in a layer with no LUT + AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; + UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); + + // Alignment for 5 PHOS modules + new(alobj[0]) AliAlignObjAngles("PHOS/Module1", + volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + new(alobj[1]) AliAlignObjAngles("PHOS/Module2", + volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + new(alobj[2]) AliAlignObjAngles("PHOS/Module3", + volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + new(alobj[3]) AliAlignObjAngles("PHOS/Module4", + volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + new(alobj[4]) AliAlignObjAngles("PHOS/Module5", + volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + + // Alignment for PHOS cradle + new(alobj[5]) AliAlignObjAngles("PHOS/Cradle0", + volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + new(alobj[6]) AliAlignObjAngles("PHOS/Cradle1", + volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + + // Alignment for cradle wheels + new(alobj[7]) AliAlignObjAngles("PHOS/Wheel0", + volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + new(alobj[8]) AliAlignObjAngles("PHOS/Wheel1", + volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + new(alobj[9]) AliAlignObjAngles("PHOS/Wheel2", + volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + new(alobj[10]) AliAlignObjAngles("PHOS/Wheel3", + volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + + + if(!gSystem->Getenv("$TOCDB")){ + // save on file + TFile f("PHOSzeroMisalignment.root","RECREATE"); + if(!f) cerr<<"cannot open file for output\n"; + f.cd(); + f.WriteObject(array,"PHOSAlignObjs","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + const char* Storage = gSystem->Getenv("$STORAGE"); + AliCDBManager *CDB = AliCDBManager::Instance(); + AliCDBStorage* storage = CDB->GetStorage(Storage); + AliCDBMetaData *md= new AliCDBMetaData(); + md->SetResponsible("Yuri Kharlov"); + md->SetComment("Zero misalignment objects"); + md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); + AliCDBId id("PHOS/Align/Data",0,9999999); + storage->Put(array,id, md); + } + + array->Delete(); + +} diff --git a/PMD/MakePMDFullMisAlignment.C b/PMD/MakePMDFullMisAlignment.C index 62becb67133..36bcd6a38bb 100644 --- a/PMD/MakePMDFullMisAlignment.C +++ b/PMD/MakePMDFullMisAlignment.C @@ -42,10 +42,10 @@ void MakePMDFullMisAlignment(){ Float_t max_rot=0.1; TString path; - const char *Sector1="/ALIC_1/EPM1_1"; - const char *Sector2="/ALIC_1/EPM2_1"; - const char *Sector3="/ALIC_1/EPM3_1"; - const char *Sector4="/ALIC_1/EPM4_1"; + const char *Sector1="PMD/Sector1"; + const char *Sector2="PMD/Sector2"; + const char *Sector3="PMD/Sector3"; + const char *Sector4="PMD/Sector4"; //Sectors 1 and 4 diff --git a/PMD/MakePMDResMisAlignment.C b/PMD/MakePMDResMisAlignment.C index fcc8ad5d318..06bc9add6c8 100644 --- a/PMD/MakePMDResMisAlignment.C +++ b/PMD/MakePMDResMisAlignment.C @@ -41,10 +41,10 @@ void MakePMDResMisAlignment(){ Float_t max_rot=0.1; TString path; - const char *Sector1="/ALIC_1/EPM1_1"; - const char *Sector2="/ALIC_1/EPM2_1"; - const char *Sector3="/ALIC_1/EPM3_1"; - const char *Sector4="/ALIC_1/EPM4_1"; + const char *Sector1="PMD/Sector1"; + const char *Sector2="PMD/Sector2"; + const char *Sector3="PMD/Sector3"; + const char *Sector4="PMD/Sector4"; //Sectors 1 and 4 diff --git a/PMD/MakePMDZeroMisAlignment.C b/PMD/MakePMDZeroMisAlignment.C new file mode 100644 index 00000000000..93d4f0dabde --- /dev/null +++ b/PMD/MakePMDZeroMisAlignment.C @@ -0,0 +1,79 @@ +void MakePMDZeroMisAlignment(){ + // Create TClonesArray of zero misalignment objects for PMD + // + // Macro to randomly displace the 4 sectors of the PMD + // in each plane. Each sector (to be misaligned) + // of PMD houses the following : + // (a) 6 modules of preshower plane + // (b) 6 modules of veto plane + // (c) The FEE boards on back plane of each module + // (d) 6 modules of convertor plates + // The clustering is done module-wise + // The actual amount displacement will be provided + // by the survey data and has to be converted into + // displacement in x,y,z,theta, phi and psi + + + // Now specify the path of the module to be misaligned + // as followed in the PMD geant + + /* + _____________ + | | | + | 1 | 3 | + | |________| + |____|___| | + | | 2 | + | 4 | | + |________|____| + + // Misalignment Matrix is expected to be + // same for sectors 1 and 4 + // and for the sectors 2 and 3 + // As these will be mounted on the same + // Steel plate + */ + + if(!gGeoManager) TGeoManager::Import("geometry.root"); + // needed for the constructors with local coordinates not to fail + + //Create a TClonesArray of Align Object to store displacement Angles + TClonesArray *array = new TClonesArray("AliAlignObjAngles",10); + TClonesArray &alobj = *array; + + AliAlignObjAngles o; + + Int_t iIndex=0; // let all modules have index=0 in a layer with no LUT + AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; + UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); + Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.; + Int_t i, j=0; + + for(i=1; i<=4; i++){ + TString snSector(Form("PMD/Sector%d",i)); + new(alobj[j++]) AliAlignObjAngles(snSector.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + } + + if(!gSystem->Getenv("$TOCDB")){ + // Create a File to store the alignment data + TFile f("PMDzeroMisalignment.root","RECREATE"); + if(!f) {cerr<<"cannot open file for output\n";} + + f.cd(); + f.WriteObject(array,"PMDAlignObjs ","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + const char* Storage = gSystem->Getenv("$STORAGE"); + AliCDBManager* cdb = AliCDBManager::Instance(); + AliCDBStorage* storage = cdb->GetStorage(Storage); + AliCDBMetaData* md = new AliCDBMetaData(); + md->SetResponsible(""); + md->SetComment("Zero misalignment for PMD"); + md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); + AliCDBId id("PMD/Align/Data",0,9999999); + storage->Put(array,id,md); + } + array->Delete(); + +} diff --git a/T0/MakeT0FullMisAlignment.C b/T0/MakeT0FullMisAlignment.C index 0adebfb58ee..67b08cddeca 100644 --- a/T0/MakeT0FullMisAlignment.C +++ b/T0/MakeT0FullMisAlignment.C @@ -1,7 +1,7 @@ void MakeT0FullMisAlignment(){ // Create TClonesArray of full misalignment objects for T0 // - TClonesArray *array = new TClonesArray("AliAlignObjAngles",10); + TClonesArray *array = new TClonesArray("AliAlignObjAngles",30); TClonesArray &alobj = *array; if(!gGeoManager) TGeoManager::Import("geometry.root"); @@ -10,38 +10,35 @@ void MakeT0FullMisAlignment(){ Double_t dx, dy, dz, dpsi, dtheta, dphi; TRandom *rnd = new TRandom(4321); - Double_t sigmatr = 0.05; // max shift in cm w.r.t. RS - Double_t sigmarot = 0.3; // max rot in degrees w.r.t. RS + Double_t sigmatr = 0.05; // sigma for shifts in cm + Double_t sigmarot = 0.3; // sigma for tilts in degrees - // null shifts and rotations + TString symName, sn; - const char *T0right="/ALIC_1/0STR_1"; - const char *T0left="/ALIC_1/0STL_1"; - - Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT + Int_t iIndex=0; AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); - dx = rnd->Gaus(0.,sigmatr); - dy = rnd->Gaus(0.,sigmatr); - dz = rnd->Gaus(0.,sigmatr); - dpsi = rnd->Gaus(0.,sigmarot); - dtheta = rnd->Gaus(0.,sigmarot); - dphi = rnd->Gaus(0.,sigmarot); - cout<Gaus(0.,sigmatr); - dy = rnd->Gaus(0.,sigmatr); - dz = rnd->Gaus(0.,sigmatr); - dpsi = rnd->Gaus(0.,sigmarot); - dtheta = rnd->Gaus(0.,sigmarot); - dphi = rnd->Gaus(0.,sigmarot); - cout<Gaus(0.,sigmatr); + dy = rnd->Gaus(0.,sigmatr); + dz = rnd->Gaus(0.,sigmatr); + dpsi = rnd->Gaus(0.,sigmarot); + dtheta = rnd->Gaus(0.,sigmarot); + dphi = rnd->Gaus(0.,sigmarot); + + new(alobj[j++]) AliAlignObjAngles(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + } + if(!gSystem->Getenv("$TOCDB")){ // save on file TFile f("T0fullMisalignment.root","RECREATE"); @@ -52,7 +49,6 @@ void MakeT0FullMisAlignment(){ }else{ // save in CDB storage const char* Storage = gSystem->Getenv("$STORAGE"); - // save in CDB storage AliCDBManager* cdb = AliCDBManager::Instance(); AliCDBStorage* storage = cdb->GetStorage(Storage); AliCDBMetaData* md = new AliCDBMetaData(); diff --git a/T0/MakeT0ResMisAlignment.C b/T0/MakeT0ResMisAlignment.C index c86428ba8f6..49c4f62c7cb 100644 --- a/T0/MakeT0ResMisAlignment.C +++ b/T0/MakeT0ResMisAlignment.C @@ -1,7 +1,7 @@ void MakeT0ResMisAlignment(){ // Create TClonesArray of residual misalignment objects for T0 // - TClonesArray *array = new TClonesArray("AliAlignObjAngles",10); + TClonesArray *array = new TClonesArray("AliAlignObjAngles",30); TClonesArray &alobj = *array; if(!gGeoManager) TGeoManager::Import("geometry.root"); @@ -14,30 +14,32 @@ void MakeT0ResMisAlignment(){ Double_t sigmatr = 0.05; // max shift in cm Double_t sigmarot = 0.3; // max rot in degrees - const char *T0right="/ALIC_1/0STR_1"; - const char *T0left="/ALIC_1/0STL_1"; + TString symName, sn; Int_t iIndex=0; AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); - dx = rnd->Gaus(0.,sigmatr); - dy = rnd->Gaus(0.,sigmatr); - dz = rnd->Gaus(0.,sigmatr); - dpsi = rnd->Gaus(0.,sigmarot); - dtheta = rnd->Gaus(0.,sigmarot); - dphi = rnd->Gaus(0.,sigmarot); - cout<Gaus(0.,sigmatr); - dy = rnd->Gaus(0.,sigmatr); - dz = rnd->Gaus(0.,sigmatr); - dpsi = rnd->Gaus(0.,sigmarot); - dtheta = rnd->Gaus(0.,sigmarot); - dphi = rnd->Gaus(0.,sigmarot); - cout<Gaus(0.,sigmatr); + dy = rnd->Gaus(0.,sigmatr); + dz = rnd->Gaus(0.,sigmatr); + dpsi = rnd->Gaus(0.,sigmarot); + dtheta = rnd->Gaus(0.,sigmarot); + dphi = rnd->Gaus(0.,sigmarot); + + new(alobj[j++]) AliAlignObjAngles(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + } + if(!gSystem->Getenv("$TOCDB")){ // save on file TFile f("T0residualMisalignment.root","RECREATE"); diff --git a/T0/MakeT0ZeroMisAlignment.C b/T0/MakeT0ZeroMisAlignment.C new file mode 100644 index 00000000000..c684c56fb9f --- /dev/null +++ b/T0/MakeT0ZeroMisAlignment.C @@ -0,0 +1,54 @@ +void MakeT0ZeroMisAlignment(){ + // Create TClonesArray of zero misalignment objects for T0 + // + TClonesArray *array = new TClonesArray("AliAlignObjAngles",10); + TClonesArray &alobj = *array; + + AliAlignObjAngles a; + + Double_t dx=0, dy=0, dz=0, dpsi=0, dtheta=0, dphi=0; + + TString symName, sn; + + Int_t iIndex=0; + AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; + UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); + + Int_t j=0; + for (Int_t imod=0; imod<24; imod++) + { + if (imod < 12){ + sn="T0/C/PMT"; + }else{ + sn="T0/A/PMT"; + } + symName = sn; + symName += imod+1; + + new(alobj[j++]) AliAlignObjAngles(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + } + + if(!gSystem->Getenv("$TOCDB")){ + // save on file + TFile f("T0zeroMisalignment.root","RECREATE"); + if(!f) cerr<<"cannot open file for output\n"; + f.cd(); + f.WriteObject(array,"T0ZeroObjs","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + const char* Storage = gSystem->Getenv("$STORAGE"); + AliCDBManager* cdb = AliCDBManager::Instance(); + AliCDBStorage* storage = cdb->GetStorage(Storage); + AliCDBMetaData* md = new AliCDBMetaData(); + md->SetResponsible("Tomasz Malkiewicz"); + md->SetComment("Zero misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS"); + md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); + AliCDBId id("T0/Align/Data",0,9999999); + storage->Put(array,id,md); + } + + array->Delete(); + +} + diff --git a/TOF/MakeTOFFullMisAlignment.C b/TOF/MakeTOFFullMisAlignment.C index 85d71fde69b..dae74df76ab 100644 --- a/TOF/MakeTOFFullMisAlignment.C +++ b/TOF/MakeTOFFullMisAlignment.C @@ -1,38 +1,160 @@ void MakeTOFFullMisAlignment(){ // Create TClonesArray of full misalignment objects for TOF // - TClonesArray *array = new TClonesArray("AliAlignObjAngles",100); + TClonesArray *array = new TClonesArray("AliAlignObjAngles",2000); TClonesArray &alobj = *array; - if(!gGeoManager) TGeoManager::Import("geometry.root"); //needed for - // the constructors with local coordinates not to fail + if(!gGeoManager) TGeoManager::Import("/home/rgrosso/Prove/AliRoot/geometry.root"); AliAlignObjAngles a; - - Int_t nSMTOF = 18; + Double_t sfdpsi=0.,sfdtheta=0.,sfdphi=0.; Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; - UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); + UShort_t dvoluid = AliAlignObj::LayerToVolUID(iLayer,iIndex); //dummy vol id + + // FRAME part !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + const char* basepath ="ALIC_1/B077_1/BSEGMO"; + TString segmpath; + + // for dead weight !!!! carefull: in mm + ifstream dw_file("/home/rgrosso/MacroAllineamento010207/disp_deadweight.txt", ios::in); + if(!dw_file) {cerr<<"cannot open dead weight file for input\n"; return;} + TArrayD dwdx(36); + TArrayD dwdy(36); + TArrayD dwdz(36); + TArrayD dwdrot(36); + // for additional load + ifstream orig_file("/home/rgrosso/MacroAllineamento010207/disp_full.txt", ios::in); +// ifstream orig_file("disp_full_nohmpid.txt", ios::in); + if(!orig_file) {cerr<<"cannot open file for input\n"; return;} + TArrayD adx(36); + TArrayD ady(36); + TArrayD adz(36); + TArrayD adrot(36); + // avarage displacements + Double_t mean_dx[18]; + Double_t mean_dy[18]; + Double_t idx[18]; + Double_t idy[18]; + Double_t newx[18]; + Double_t newy[18]; + + string buffer; + Int_t point; + Double_t dx,dy,dz,drot; + + // fill in from file the array for dead weight deformations + dw_file>>point>>dx>>dy>>dz>>drot; + dwdx.AddAt(dx,point-1);dwdy.AddAt(dy,point-1);dwdz.AddAt(dz,point-1);dwdrot.AddAt(drot,point-1); + while(getline(dw_file,buffer)) + { + dw_file>>point>>dx>>dy>>dz>>drot; + dwdx.AddAt(dx,point-1);dwdy.AddAt(dy,point-1);dwdz.AddAt(dz,point-1);dwdrot.AddAt(drot,point-1); + } + + // fill in from file the array for remaining load deformations + orig_file>>point>>dx>>dy>>dz>>drot; + adx.AddAt(dx,point-1);ady.AddAt(dy,point-1);adz.AddAt(dz,point-1);adrot.AddAt(drot,point-1); + while(getline(orig_file,buffer)) + { + orig_file>>point>>dx>>dy>>dz>>drot; + adx.AddAt(dx,point-1);ady.AddAt(dy,point-1);adz.AddAt(dz,point-1);adrot.AddAt(drot,point-1); + } + + //calculate the displacement of the center of the sm neglecting rotations, + //thus as average of the four surrounding point for dw + other load + // Prepare also to plot with respect to ideal circle. + Double_t cx=0.5; //just for plotting + Double_t cy=0.5; + Double_t rr=0.3; + Double_t kk = TMath::Pi()*20./180.; + Double_t scale = 100./4000.; + TPolyMarker* iddu = new TPolyMarker(18,newx,newy); + TPolyMarker* disp = new TPolyMarker(18,newx,newy); + + Int_t sm,outc,outclw; //outer number counterclock and clockwise + for(sm=0; sm<18; sm++){ + outc=5-sm; + if(outc<1) outc+=18; + outclw=outc-1; + if(outclw<1) outclw+=18; + mean_dx[sm]=0.125*(adx[outc-1]+adx[outclw-1]+adx[outc+18-1]+adx[outclw+18-1]+dwdx[outc-1]+dwdx[outclw-1]+dwdx[outc+18-1]+dwdx[outclw+18-1]); + mean_dy[sm]=0.125*(ady[outc-1]+ady[outclw-1]+ady[outc+18-1]+ady[outclw+18-1]+dwdy[outc-1]+dwdy[outclw-1]+dwdy[outc+18-1]+dwdy[outclw+18-1]); + idx[sm]=cx+rr*TMath::Sin(sm*kk); + idy[sm]=cy+rr*TMath::Cos(sm*kk); + newx[sm]=idx[sm]+scale*mean_dx[sm]; + newy[sm]=idy[sm]+scale*mean_dy[sm]; + iddu->SetPoint(sm,idx[sm],idy[sm]); + disp->SetPoint(sm,newx[sm],newy[sm]); + + segmpath=basepath; + segmpath+=sm; + segmpath+="_1"; + cout<UncheckedAt(k); + if(!smobj->ApplyToGeometry()){ + cout<<"application of object "<Export("/home/rgrosso/MacroAllineamento010207/geom_misalBSEGMO.root"); + gGeoManager=0x0; + TGeoManager::Import("/home/rgrosso/MacroAllineamento010207/geom_misalBSEGMO.root"); + + // TOF part !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + Int_t nSMTOF = 18; Int_t i; - Int_t j=0; - Double_t dx, dy, dz, dpsi, dtheta, dphi; + Int_t j=18; + Double_t tofdx, tofdy, tofdz, dpsi, dtheta, dphi; TRandom *rnd = new TRandom(2345); Double_t sigmatr = 0.4; // max shift in cm w.r.t. local ideal RS Double_t sigmarot = 0.06; // max rot in deg w.r.t. local ideal RS (~ 1 mrad) - + for(i=0; i<18; i++) { - Char_t path[100]; - sprintf(path,"TOF/sm%02d",i); - dx = rnd->Gaus(0.,sigmatr); - dy = 0; - dz = rnd->Gaus(0.,sigmatr); + TString symname(Form("TOF/sm%02d",i)); + tofdx = rnd->Gaus(0.,sigmatr); + tofdy = 0; + tofdz = rnd->Gaus(0.,sigmatr); dpsi = 0; dtheta = rnd->Gaus(0.,sigmarot); dphi = 0.; - new(alobj[j]) AliAlignObjAngles(path, volid, dx, dy, dz, dpsi, dtheta, dphi,kFALSE); - alobj[j]->Print(); - j++; + new(alobj[j++]) AliAlignObjAngles(symname.Data(), dvoluid, tofdx, tofdy, tofdz, dpsi, dtheta, dphi, kFALSE); + } + for(Int_t k=18; k<36; k++){ + AliAlignObjAngles* smobj = (AliAlignObjAngles*)array->UncheckedAt(k); + if(!smobj->ApplyToGeometry()){ + cout<<"application of object "<Export("/home/rgrosso/MacroAllineamento010207/geom_misalBSEGMO_tofSM.root"); + + + gGeoManager=0x0; + TGeoManager::Import("/home/rgrosso/MacroAllineamento010207/geom_misalBSEGMO_tofSM.root"); + // tof strips as in residual + AliAlignObj::ELayerID idTOF = AliAlignObj::kTOF; + + Double_t sdx=0.; + Double_t sdy=0.; + Double_t sdz=0.; + Double_t sdpsi, sdtheta, sdphi; + TRandom *rnds = new TRandom(4357); + sigmatr = 0.1; // max shift in cm w.r.t. local ideal RS + + for(i=0; iGaus(0.,sigmatr); + sdz = rnds->Gaus(0.,sigmatr); + sdpsi = 0.; + sdtheta = 0.; + sdphi = 0.; + new(alobj[j++]) AliAlignObjAngles(AliAlignObj::SymName(idTOF,i), AliAlignObj::LayerToVolUID(idTOF,i), sdx, sdy, sdz, sdpsi, sdtheta, sdphi, kFALSE); } if(!gSystem->Getenv("$TOCDB")){ @@ -49,7 +171,7 @@ void MakeTOFFullMisAlignment(){ AliCDBStorage* storage = cdb->GetStorage(Storage); AliCDBMetaData* md = new AliCDBMetaData(); md->SetResponsible("Silvia Arcelli"); - md->SetComment("Full misalignment for TOF"); + md->SetComment("Full misalignment for TOF and FRAME"); md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); AliCDBId id("TOF/Align/Data",0,9999999); storage->Put(array,id,md); diff --git a/TOF/MakeTOFResMisAlignment.C b/TOF/MakeTOFResMisAlignment.C index 5197d24208c..9205201f46c 100644 --- a/TOF/MakeTOFResMisAlignment.C +++ b/TOF/MakeTOFResMisAlignment.C @@ -4,7 +4,7 @@ void MakeTOFResMisAlignment(){ TClonesArray *array = new TClonesArray("AliAlignObjAngles",2000); TClonesArray &alobj = *array; - if(!gGeoManager) TGeoManager::Import("geometry.root"); + if(!gGeoManager) TGeoManager::Import("/home/rgrosso/Prove/AliRoot/geometry.root"); // needed for the constructors with local coordinates not to fail AliAlignObjAngles a; diff --git a/TOF/MakeTOFZeroMisAlignment.C b/TOF/MakeTOFZeroMisAlignment.C index 05b0df51a1e..c7e8fe0b204 100644 --- a/TOF/MakeTOFZeroMisAlignment.C +++ b/TOF/MakeTOFZeroMisAlignment.C @@ -1,7 +1,6 @@ void MakeTOFZeroMisAlignment(){ - // Create TClonesArray of zero misalignment objects for TOF - + // TClonesArray *array = new TClonesArray("AliAlignObjAngles",2000); TClonesArray &alobj = *array; @@ -16,22 +15,28 @@ void MakeTOFZeroMisAlignment(){ Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.; for(i=0; iGetStorage(Storage); - AliCDBMetaData* md = new AliCDBMetaData(); - md->SetResponsible("Silvia Arcelli"); - md->SetComment("Zero misalignment for TOF"); - md->SetAliRootVersion("HEAD"); - AliCDBId id("TOF/Align/Data",0,9999999); - storage->Put(array,id,md); + if(!gSystem->Getenv("$TOCDB")){ + // save on file + TFile f("TOFzeroMisalignment.root","RECREATE"); + if(!f) cerr<<"cannot open file for output\n"; + f.cd(); + f.WriteObject(array,"TOFAlignObjs","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + const char* Storage = gSystem->Getenv("$STORAGE"); + AliCDBManager* cdb = AliCDBManager::Instance(); + AliCDBStorage* storage = cdb->GetStorage(Storage); + AliCDBMetaData* md = new AliCDBMetaData(); + md->SetResponsible("Silvia Arcelli"); + md->SetComment("Zero misalignment for TOF"); + md->SetAliRootVersion("HEAD"); + AliCDBId id("TOF/Align/Data",0,9999999); + storage->Put(array,id,md); + } array->Delete(); diff --git a/TPC/MakeTPCFullMisAlignment.C b/TPC/MakeTPCFullMisAlignment.C index db6c149b57e..84a7c9a5562 100644 --- a/TPC/MakeTPCFullMisAlignment.C +++ b/TPC/MakeTPCFullMisAlignment.C @@ -10,25 +10,27 @@ void MakeTPCFullMisAlignment(){ TRandom *rnd = new TRandom(4357); AliAlignObjAngles o; Int_t j = 0; + Double_t dx, dy, dz, dpsi, dtheta, dphi; + // RS = local - // sigma translation = 1mm - // sigma rotation = 1mrad + // sigma translation = 0.1 mm + // sigma rotation = 0.1 mrad Float_t sigmatr=0.01; - Float_t sigmarot = 0.06; + Float_t sigmarot = 0.006; + for (Int_t iLayer = AliAlignObj::kTPC1; iLayer <= AliAlignObj::kTPC2; iLayer++) { for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) { - Double_t dx = (rnd->Uniform()-0.5)*sigmatr; - Double_t dy = (rnd->Uniform()-0.5)*sigmatr; - Double_t dz = (rnd->Uniform()-0.5)*sigmatr; - Double_t dpsi = (rnd->Uniform()-0.5)*sigmarot; - Double_t dtheta = (rnd->Uniform()-0.5)*sigmarot; - Double_t dphi = (rnd->Uniform()-0.5)*sigmarot; + dx = (rnd->Uniform()-0.5)*sigmatr; + dy = (rnd->Uniform()-0.5)*sigmatr; + dz = (rnd->Uniform()-0.5)*sigmatr; + dpsi = (rnd->Uniform()-0.5)*sigmarot; + dtheta = (rnd->Uniform()-0.5)*sigmarot; + dphi = (rnd->Uniform()-0.5)*sigmarot; UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule); const char *symname = AliAlignObj::SymName(volid); - new(alobj[j]) AliAlignObjAngles(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE); - j++; + new(alobj[j++]) AliAlignObjAngles(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE); } } diff --git a/TPC/MakeTPCResMisAlignment.C b/TPC/MakeTPCResMisAlignment.C index 658fb17bfa1..3b1d7ffea61 100644 --- a/TPC/MakeTPCResMisAlignment.C +++ b/TPC/MakeTPCResMisAlignment.C @@ -13,10 +13,10 @@ void MakeTPCResMisAlignment(){ Int_t j = 0; // RS = local - // sigma translation = 0.1mm - // sigma rotation = 1mrad + // sigma translation = 0.1 mm + // sigma rotation = 0.1 mrad Float_t sigmatr=0.01; - Float_t sigmarot = 0.06; + Float_t sigmarot = 0.006; for (Int_t iLayer = AliAlignObj::kTPC1; iLayer <= AliAlignObj::kTPC2; iLayer++) { for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) { diff --git a/TPC/MakeTPCZeroMisAlignment.C b/TPC/MakeTPCZeroMisAlignment.C new file mode 100644 index 00000000000..6e63c9c2378 --- /dev/null +++ b/TPC/MakeTPCZeroMisAlignment.C @@ -0,0 +1,49 @@ +void MakeTPCZeroMisAlignment(){ + // Create TClonesArray of zero misalignment objects for TPC + // + if(!gGeoManager) TGeoManager::Import("geometry.root"); + // needed for the constructors with local coordinates not to fail + + TClonesArray *array = new TClonesArray("AliAlignObjAngles",100); + TClonesArray &alobj = *array; + + AliAlignObjAngles o; + Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.; + Int_t j = 0; + + // RS = local + for (Int_t iLayer = AliAlignObj::kTPC1; iLayer <= AliAlignObj::kTPC2; iLayer++) { + for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) { + + UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule); + const char *symname = AliAlignObj::SymName(volid); + new(alobj[j]) AliAlignObjAngles(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + j++; + } + } + + + if(!gSystem->Getenv("$TOCDB")){ + // save on file + TFile f("TPCzeroMisalignment.root","RECREATE"); + if(!f) cerr<<"cannot open file for output\n"; + f.cd(); + f.WriteObject(array,"TPCAlignObjs","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + const char* Storage = gSystem->Getenv("$STORAGE"); + AliCDBManager* cdb = AliCDBManager::Instance(); + AliCDBStorage* storage = cdb->GetStorage(Storage); + AliCDBMetaData* md = new AliCDBMetaData(); + md->SetResponsible("Marian Ivanov"); + md->SetComment("Zero misalignment for TPC"); + md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); + AliCDBId id("TPC/Align/Data",0,9999999); + storage->Put(array,id,md); + } + + array->Delete(); + +} + diff --git a/TRD/MakeTRDFullMisAlignment.C b/TRD/MakeTRDFullMisAlignment.C index 5fc6403e83d..0c146e1308b 100644 --- a/TRD/MakeTRDFullMisAlignment.C +++ b/TRD/MakeTRDFullMisAlignment.C @@ -4,15 +4,21 @@ void MakeTRDFullMisAlignment(){ TClonesArray *array = new TClonesArray("AliAlignObjAngles",1000); TClonesArray &alobj = *array; - if(!gGeoManager) TGeoManager::Import("geometry.root"); - // needed for the constructors with local coordinates not to fail - AliAlignObjAngles a; + // sigmas for the supermodules + Double_t smdx=0.3; // 3 mm + Double_t smdy=0.3; // 3 mm + Double_t smdz=0.3; // 3 mm + Double_t smrx=0.4/1000/TMath::Pi()*180; // 0.4 mrad + Double_t smry=2.0/1000/TMath::Pi()*180; // 2 mrad + Double_t smrz=0.4/1000/TMath::Pi()*180; // 0.4 mrad + + // sigmas for the chambers - Double_t chdx=1; // 1 cm - Double_t chdy=1; // 1 cm - Double_t chdz=1; // 1 cm + Double_t chdx=0.1; // 1 mm + Double_t chdy=0.1; // 1 mm + Double_t chdz=0.1; // 1 mm Double_t chrx=1.0/1000/TMath::Pi()*180; // 1 mrad Double_t chry=1.0/1000/TMath::Pi()*180; // 1 mrad Double_t chrz=0.7/1000/TMath::Pi()*180; // 0.7 mrad @@ -22,14 +28,42 @@ void MakeTRDFullMisAlignment(){ Int_t j=0; TRandom *ran = new TRandom(4357); UShort_t volid; - const char *path; + const char *symname; + + TGeoManager::Import("/home/rgrosso/MacroAllineamento010207/geom_misalBSEGMO.root"); // geometry where the BSEGMO volumes have been misaligned + // create the supermodules' alignment objects + for (int i; i<18; i++) { + TString sm_symname(Form("TRD/sm%02d",i)); + ran->Rannor(dx,rx); + ran->Rannor(dy,ry); + ran->Rannor(dz,rz); + dx*=smdx; + dy*=smdy; + dz*=smdz; + rx*=smrx; + ry*=smry; + rz*=smrz; + new(alobj[j++]) AliAlignObjAngles(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kFALSE); + } + + for(Int_t k=0; k<18; k++){ + AliAlignObjAngles* smobj = (AliAlignObjAngles*)array->UncheckedAt(k); + if(!smobj->ApplyToGeometry()){ + cout<<"application of object "<Export("/home/rgrosso/MacroAllineamento010207/geom_misalBSEGMO_trdSM.root"); + gGeoManager=0x0; + TGeoManager::Import("/home/rgrosso/MacroAllineamento010207/geom_misalBSEGMO_trdSM.root"); // create the chambers' alignment objects + ran = new TRandom(4357); for (Int_t iLayer = AliAlignObj::kTRD1; iLayer <= AliAlignObj::kTRD6; iLayer++) { for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) { - ran.Rannor(dx,rx); - ran.Rannor(dy,ry); - ran.Rannor(dz,rz); + ran->Rannor(dx,rx); + ran->Rannor(dy,ry); + ran->Rannor(dz,rz); dx*=chdx; dy*=chdy; dz*=chdz; diff --git a/TRD/MakeTRDResMisAlignment.C b/TRD/MakeTRDResMisAlignment.C index 507fe5bf4c2..a5a38c0f3b6 100644 --- a/TRD/MakeTRDResMisAlignment.C +++ b/TRD/MakeTRDResMisAlignment.C @@ -10,9 +10,9 @@ void MakeTRDResMisAlignment(){ AliAlignObjAngles a; // sigmas for the chambers - Double_t chdx=0.02; // 200 microns - Double_t chdy=0.03; // 300 microns - Double_t chdz=0.07; // 700 microns + Double_t chdx=0.002; // 20 microns + Double_t chdy=0.003; // 30 microns + Double_t chdz=0.007; // 70 microns Double_t chrx=0.3/1000/TMath::Pi()*180; // 0.3 mrad Double_t chry=0.3/1000/TMath::Pi()*180; // 0.3 mrad Double_t chrz=0.1/1000/TMath::Pi()*180; // 0.1 mrad diff --git a/TRD/MakeTRDZeroMisAlignment.C b/TRD/MakeTRDZeroMisAlignment.C new file mode 100644 index 00000000000..c1112e565a6 --- /dev/null +++ b/TRD/MakeTRDZeroMisAlignment.C @@ -0,0 +1,51 @@ +void MakeTRDZeroMisAlignment(){ + // Create TClonesArray of zero misalignment objects for TRD + // + TClonesArray *array = new TClonesArray("AliAlignObjAngles",1000); + TClonesArray &alobj = *array; + + if(!gGeoManager) TGeoManager::Import("geometry.root"); + // needed for the constructors with local coordinates not to fail + + AliAlignObjAngles a; + + Double_t dx=0.,dy=0.,dz=0.,rx=0.,ry=0.,rz=0.; + + Int_t j=0; + UShort_t volid; + const char *symname; + + // create the chambers' alignment objects + for (Int_t iLayer = AliAlignObj::kTRD1; iLayer <= AliAlignObj::kTRD6; iLayer++) { + for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) { + volid = AliAlignObj::LayerToVolUID(iLayer,iModule); + symname = AliAlignObj::SymName(volid); + new(alobj[j++]) AliAlignObjAngles(symname,volid,dx,dy,dz,rx,ry,rz,kTRUE); + } + } + + if(!gSystem->Getenv("$TOCDB")){ + // save on file + TFile f("TRDzeroMisalignment.root","RECREATE"); + if(!f) cerr<<"cannot open file for output\n"; + f.cd(); + f.WriteObject(array,"TRDAlignObjs","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + const char* Storage = gSystem->Getenv("$STORAGE"); + AliCDBManager* cdb = AliCDBManager::Instance(); + AliCDBStorage* storage = cdb->GetStorage(Storage); + AliCDBMetaData* md = new AliCDBMetaData(); + md->SetResponsible("Dariusz Miskowiec"); + md->SetComment("Zero misalignment for TRD"); + md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); + AliCDBId id("TRD/Align/Data",0,9999999); + storage->Put(array,id,md); + } + + array->Delete(); + +} + + diff --git a/VZERO/MakeVZEROFullMisAlignment.C b/VZERO/MakeVZEROFullMisAlignment.C index cf1d6832776..d5c649faf52 100644 --- a/VZERO/MakeVZEROFullMisAlignment.C +++ b/VZERO/MakeVZEROFullMisAlignment.C @@ -11,13 +11,13 @@ void MakeVZEROFullMisAlignment(){ Double_t dx, dy, dz, dpsi, dtheta, dphi; TRandom *rnd = new TRandom(4321); - Double_t sigmatr = 0.1; // max shift in cm w.r.t. RS - Double_t sigmarot = 0.5; // max rot in degrees w.r.t. RS + Double_t sigmatr = 0.1; // max shift in cm + Double_t sigmarot = 0.5; // max rot in degrees // null shifts and rotations - const char *V0right="/ALIC_1/VZERO_1/V0RI_1"; - const char *V0left="/ALIC_1/VZERO_1/V0LE_1"; + const char *V0right="VZERO/V0C"; + const char *V0left="VZERO/V0A"; Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; diff --git a/VZERO/MakeVZEROResMisAlignment.C b/VZERO/MakeVZEROResMisAlignment.C index 672993111c0..3ffa15292ff 100644 --- a/VZERO/MakeVZEROResMisAlignment.C +++ b/VZERO/MakeVZEROResMisAlignment.C @@ -14,8 +14,8 @@ void MakeVZEROResMisAlignment(){ Double_t sigmatr = 0.1; // max shift in cm Double_t sigmarot = 0.5; // max rot in degrees - const char *V0right="/ALIC_1/VZERO_1/V0RI_1"; - const char *V0left="/ALIC_1/VZERO_1/V0LE_1"; + const char *V0right="VZERO/V0C"; + const char *V0left="VZERO/V0A"; Int_t iIndex=0; AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; diff --git a/VZERO/MakeVZEROZeroMisAlignment.C b/VZERO/MakeVZEROZeroMisAlignment.C new file mode 100644 index 00000000000..c8f537d48df --- /dev/null +++ b/VZERO/MakeVZEROZeroMisAlignment.C @@ -0,0 +1,46 @@ +void MakeVZEROZeroMisAlignment(){ + // Create TClonesArray of zero misalignment objects for VZERO + // + if(!gGeoManager) TGeoManager::Import("geometry.root"); + // needed for the constructors with local coordinates not to fail + + TClonesArray *array = new TClonesArray("AliAlignObjAngles",10); + TClonesArray &alobj = *array; + + AliAlignObjAngles a; + + Double_t dx, dy, dz, dpsi, dtheta, dphi; + + Int_t iIndex=0; + AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; + UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); + + TString V0right("VZERO/V0C"); + new(alobj[0]) AliAlignObjAngles(V0right.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + TString V0left("VZERO/V0A"); + new(alobj[1]) AliAlignObjAngles(V0left.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE); + + if(!gSystem->Getenv("$TOCDB")){ + // save on file + TFile f("V0zeroMisalignment.root","RECREATE"); + if(!f) cerr<<"cannot open file for output\n"; + f.cd(); + f.WriteObject(array,"V0ZeroAlObjs ","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + const char* Storage = gSystem->Getenv("$STORAGE"); + AliCDBManager* cdb = AliCDBManager::Instance(); + AliCDBStorage* storage = cdb->GetStorage(Storage); + AliCDBMetaData* md = new AliCDBMetaData(); + md->SetResponsible("Brigitte Cheynis"); + md->SetComment("Alignment objects for V0 zero-misalignment"); + md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); + AliCDBId id("VZERO/Align/Data",0,9999999); + storage->Put(array,id,md); + } + + array->Delete(); + +} + diff --git a/ZDC/MakeZDCZeroMisAlignment.C b/ZDC/MakeZDCZeroMisAlignment.C new file mode 100644 index 00000000000..2e27bba9aa6 --- /dev/null +++ b/ZDC/MakeZDCZeroMisAlignment.C @@ -0,0 +1,48 @@ +void MakeZDCZeroMisAlignment(){ + // Create TClonesArray of zero misalignment objects for ZDC + // + if(!gGeoManager) TGeoManager::Import("geometry.root"); + // needed for the constructors with local coordinates not to fail + + TClonesArray *array = new TClonesArray("AliAlignObjAngles",10); + TClonesArray &alobj = *array; + + AliAlignObjAngles a; + + Double_t dx=0., dy=0., dz=0.; + Double_t dpsi=0., dtheta=0., dphi=0.; + + const char *ZDCn="ZDC/NeutronZDC"; + const char *ZDCp="ZDC/ProtonZDC"; + + UShort_t iIndex=0; + AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; + UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); + + new(alobj[0]) AliAlignObjAngles(ZDCn, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + new(alobj[1]) AliAlignObjAngles(ZDCp, volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE); + + if(!gSystem->Getenv("$TOCDB")){ + // save in file + TFile f("ZDCzeroMisalignment.root","RECREATE"); + if(!f) cerr<<"cannot open file for output\n"; + f.cd(); + f.WriteObject(array,"ZDCZeroAlObjs ","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + const char* Storage = gSystem->Getenv("$STORAGE"); + AliCDBManager* cdb = AliCDBManager::Instance(); + AliCDBStorage* storage = cdb->GetStorage(Storage); + AliCDBMetaData* md = new AliCDBMetaData(); + md->SetResponsible("Chiara Oppedisano"); + md->SetComment("Alignment objects for ZDC zero misalignment"); + md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); + AliCDBId id("ZDC/Align/Data",0,9999999); + storage->Put(array,id,md); + } + + array->Delete(); + +} + diff --git a/macros/MakeAllDETsResMisAlignment.C b/macros/MakeAllDETsResMisAlignment.C index 35218af2bf4..261f801895b 100644 --- a/macros/MakeAllDETsResMisAlignment.C +++ b/macros/MakeAllDETsResMisAlignment.C @@ -25,7 +25,7 @@ void MakeAllDETsResMisAlignment(Char_t* CDBstorage = "local://$HOME/Residual"){ TGeoManager::Import("geometry.root"); } - TString dets="EMCAL,FMD,ITS,MUON,PHOS,PMD,HMPID,T0,TOF,TPC,TRD,VZERO,ZDC"; + TString dets="EMCAL,FMD,HMPID,ITS,MUON,PHOS,PMD,T0,TOF,TPC,TRD,VZERO,ZDC"; TObjArray *detArray = dets.Tokenize(','); TIter iter(detArray); TObjString *ostr; diff --git a/macros/MakeAllDETsZeroMisAlignment.C b/macros/MakeAllDETsZeroMisAlignment.C new file mode 100644 index 00000000000..698293934de --- /dev/null +++ b/macros/MakeAllDETsZeroMisAlignment.C @@ -0,0 +1,43 @@ +void MakeAllDETsZeroMisAlignment(Char_t* CDBstorage = "local://$HOME/Zero"){ + // Make zero misalignment objects for all detectors + // Pass different "CDBstorage" argument if needed (e.g. to fill + // conditions' data base on alien) or set it to null string to have + // the objects saved locally on file + // + TString strStorage(CDBstorage); + if(strStorage.IsNull()){ + gSystem->Setenv("$TOCDB","kFALSE"); + }else{ + gSystem->Setenv("$TOCDB","kTRUE"); + gSystem->Setenv("$STORAGE",strStorage.Data()); + gSystem->Setenv("$ARVERSION","v4-04-Release"); + } + + // if not already present, create geometry file needed by those detectors + // producing their objects in the local RS + if(gSystem->AccessPathName("./geometry.root")){ + gAlice->Init(); + gGeoManager->Export("geometry.root"); + }else{ + TGeoManager::Import("geometry.root"); + } + + TString dets="EMCAL,FMD,HMPID,ITS,MUON,PMD,PHOS,T0,TRD,TPC,TOF,VZERO,ZDC"; + TObjArray *detArray = dets.Tokenize(','); + TIter iter(detArray); + TObjString *ostr; + TString exec_det_macro; + + while((ostr = (TObjString*) iter.Next())){ + TString str(ostr->String()); + exec_det_macro="aliroot -b -q $ALICE_ROOT/"; + exec_det_macro+=str; + exec_det_macro+="/Make"; + exec_det_macro+=str; + exec_det_macro+="ZeroMisAlignment.C"; + + gSystem->Exec(exec_det_macro.Data()); + } + + return; +} -- 2.39.3