--- /dev/null
+void MakeEMCALFullMisAlignment(){
+ // Create TClonesArray of full 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, dy, dz, dpsi, dtheta, dphi;
+ 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
+
+ // null shifts and rotations
+
+ const TString basepath = "ALIC_1/XEN1_1/SMOD_";
+ 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;
+
+ for(i=0; i<10; 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=basepath;
+ pathstr+=(i+1);
+ cout<<pathstr<<" "<<dx<<" "<<dy<<" "<<dz<<" "<<dpsi<<" "<<dtheta<<" "<<dphi<<"\n";
+ new(alobj[i]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+ }
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("EMCALfullMisalignment.root","RECREATE");
+ if(!f) cerr<<"cannot open file for output\n";
+ f.cd();
+ f.WriteObject(array,"T0FullObjs ","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("Full misalignment for EMCAL");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("EMCAL/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+
+ array->Delete();
+
+}
+
--- /dev/null
+void MakeEMCALResMisAlignment(){
+ // Create TClonesArray of residual 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, dy, dz, dpsi, dtheta, dphi;
+
+ const TString basepath = "ALIC_1/XEN1_1/SMOD_";
+ 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;
+
+ // RS = local
+ // sigma translation = 1mm
+ // sigma rotation = 0.1 degree
+ 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);
+ dz = rnd->Gaus(0.,sigmatr);
+ dpsi = rnd->Gaus(0.,sigmarot);
+ dtheta = rnd->Gaus(0.,sigmarot);
+ dphi = rnd->Gaus(0.,sigmarot);
+ pathstr=basepath;
+ pathstr+=(i+1);
+ new(alobj[i]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+ }
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("EMCALresidualMisalignment.root","RECREATE");
+ if(!f) cerr<<"cannot open file for output\n";
+ f.cd();
+ f.WriteObject(array,"T0ResidualObjs ","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("Residual misalignment for EMCAL, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("EMCAL/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+
+ array->Delete();
+
+}
+
--- /dev/null
+void MakeFMDFullMisAlignment(){
+ // Create TClonesArray of full misalignment objects for FMD
+ //
+ if(!gGeoManager) TGeoManager::Import("geometry.root");
+ // needed for the constructors with local coordinates not to fail
+
+ gSystem->Load("libFMDutil.so");
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ AliFMDAlignFaker faker(AliFMDAlignFaker::kAll, "geometry.root","FMDfullMisalignment.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.005, -0.005, -0.005, 0.005, 0.005, 0.005);
+ faker.SetSensorRotation(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5);
+ faker.SetHalfDisplacement(-0.25, -0.25, -0.25, 0.25, 0.25, 0.25);
+ faker.SetHalfRotation(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5);
+ faker.Exec();
+
+}
--- /dev/null
+void MakeFMDResMisAlignment()
+{
+ // Create TClonesArray of residual 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","");
+ }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.005, -0.005, -0.005, 0.005, 0.005, 0.005);
+ faker.SetSensorRotation(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5);
+ faker.SetHalfDisplacement(-0.25, -0.25, -0.25, 0.25, 0.25, 0.25);
+ faker.SetHalfRotation(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5);
+ faker.Exec();
+
+
+}
--- /dev/null
+void MakeITSFullMisAlignment(){
+ // Create TClonesArray of full 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
+
+ Double_t globalZ = 0.005; // in cm, = 50 microns
+ Double_t resFact = 0.7;
+ Double_t spdXY = 0.0015*resFact;
+ Double_t sddXYZ = 0.0030*resFact;
+ Double_t ssdXY = 0.0020*resFact;
+ Double_t rot = 0.018;
+
+ Double_t spdZ = 0.002;
+ Double_t ssdZ = 0.010;
+
+ TRandom *rnd = new TRandom(65416087);
+ AliAlignObjAngles a;
+
+ Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
+
+ Int_t j = 0;
+ new(alobj[j]) AliAlignObjAngles("ALIC_1/ITSV_1", 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++) {
+
+ dpsi = rnd->Gaus(0., rot);
+ dtheta = rnd->Gaus(0., rot);
+ dphi = rnd->Gaus(0., rot);
+
+ AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
+ switch (l) {
+ case 1: {
+ iLayer = AliAlignObj::kSPD1;
+ dx = rnd->Gaus(0., spdXY);
+ dy = rnd->Gaus(0., spdXY);
+ dz = rnd->Gaus(0., spdZ);
+ }; break;
+ case 2: {
+ iLayer = AliAlignObj::kSPD2;
+ dx = rnd->Gaus(0., spdXY);
+ dy = rnd->Gaus(0., spdXY);
+ dz = rnd->Gaus(0., spdZ);
+ }; break;
+ case 3: {
+ iLayer = AliAlignObj::kSDD1;
+ dx = rnd->Gaus(0., sddXYZ);
+ dy = rnd->Gaus(0., sddXYZ);
+ dz = rnd->Gaus(0., sddXYZ);
+ }; break;
+ case 4: {
+ iLayer = AliAlignObj::kSDD2;
+ dx = rnd->Gaus(0., sddXYZ);
+ dy = rnd->Gaus(0., sddXYZ);
+ dz = rnd->Gaus(0., sddXYZ);
+ }; break;
+ case 5: {
+ iLayer = AliAlignObj::kSSD1;
+ dx = rnd->Gaus(0., ssdXY);
+ dy = rnd->Gaus(0., ssdXY);
+ dz = rnd->Gaus(0., ssdZ);
+ }; break;
+ case 6: {
+ iLayer = AliAlignObj::kSSD2;
+ dx = rnd->Gaus(0., ssdXY);
+ dy = rnd->Gaus(0., ssdXY);
+ dz = rnd->Gaus(0., ssdZ);
+ }; break;
+ default: Printf("Wrong layer index in ITS (%d) !",l);
+ };
+ UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
+ const char *path = AliAlignObj::SymName(volid);
+
+ new(alobj[j]) AliAlignObjAngles(path, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+ j++;
+
+ }
+ }
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("ITSfullMisalignment.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 actual ITS misalignment");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("ITS/Align/Data",0,9999999);
+ storage->Put(array,id, md);
+ }
+
+ array->Delete();
+
+}
+
+
--- /dev/null
+void MakeITSResMisAlignment(){
+ // Create TClonesArray of residual 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
+
+ Double_t globalZ = 0.005; // in cm, = 50 microns
+ Double_t resFact = 0.7;
+ Double_t spdXY = 0.0015*resFact;
+ Double_t sddXYZ = 0.0030*resFact;
+ Double_t ssdXY = 0.0020*resFact;
+ Double_t rot = 0.018;
+
+ Double_t spdZ = 0.002;
+ Double_t ssdZ = 0.010;
+
+ TRandom *rnd = new TRandom(65416087);
+ AliAlignObjAngles a;
+
+ Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
+ AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
+
+ Int_t j = 0;
+ new(alobj[j]) AliAlignObjAngles("ALIC_1/ITSV_1", 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++) {
+
+ dpsi = rnd->Gaus(0., rot);
+ dtheta = rnd->Gaus(0., rot);
+ dphi = rnd->Gaus(0., rot);
+
+ iLayer = AliAlignObj::kInvalidLayer;
+
+ switch (l) {
+ case 1: {
+ iLayer = AliAlignObj::kSPD1;
+ dx = rnd->Gaus(0., spdXY);
+ dy = rnd->Gaus(0., spdXY);
+ dz = rnd->Gaus(0., spdZ);
+ }; break;
+ case 2: {
+ iLayer = AliAlignObj::kSPD2;
+ dx = rnd->Gaus(0., spdXY);
+ dy = rnd->Gaus(0., spdXY);
+ dz = rnd->Gaus(0., spdZ);
+ }; break;
+ case 3: {
+ iLayer = AliAlignObj::kSDD1;
+ dx = rnd->Gaus(0., sddXYZ);
+ dy = rnd->Gaus(0., sddXYZ);
+ dz = rnd->Gaus(0., sddXYZ);
+ }; break;
+ case 4: {
+ iLayer = AliAlignObj::kSDD2;
+ dx = rnd->Gaus(0., sddXYZ);
+ dy = rnd->Gaus(0., sddXYZ);
+ dz = rnd->Gaus(0., sddXYZ);
+ }; break;
+ case 5: {
+ iLayer = AliAlignObj::kSSD1;
+ dx = rnd->Gaus(0., ssdXY);
+ dy = rnd->Gaus(0., ssdXY);
+ dz = rnd->Gaus(0., ssdZ);
+ }; break;
+ case 6: {
+ iLayer = AliAlignObj::kSSD2;
+ dx = rnd->Gaus(0., ssdXY);
+ dy = rnd->Gaus(0., ssdXY);
+ dz = rnd->Gaus(0., ssdZ);
+ }; break;
+ default: Printf("Wrong layer index in ITS (%d) !",l);
+ };
+ UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
+ const char *path = AliAlignObj::SymName(volid);
+
+ new(alobj[j]) AliAlignObjAngles(path, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+ j++;
+
+ }
+ }
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("ITSresidualMisalignment.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 actual ITS misalignment");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("ITS/Align/Data",0,9999999);
+ storage->Put(array,id, md);
+ }
+
+ array->Delete();
+
+}
+
+
--- /dev/null
+void MakeMUONFullMisAlignment(Bool_t volpaths = true,
+ Bool_t transforms = true,
+ Bool_t svmaps = true)
+// Macro for generating the geometry data files:
+// (volpath.dat, transform.dat, svmap.dat)
+// and local CDB storage with 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 full misalignment data in MUON/FullMisAlignCDB/Data..." << endl;
+
+ AliMUONGeometryMisAligner misAligner(0.0, 0.03, 0.0, 0.03, 0.0, 0.03);
+ 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("MUONfullMisalignment.root","RECREATE");
+ if(!f) {cerr<<"cannot open file for output\n";}
+
+ f.cd();
+ f.WriteObject(array,"MUONAlignObjs ","kSingleKey");
+ f.Close();
+ array->Delete();
+ }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 full misalignment");
+ cdbData->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("MUON/Align/Data", 0, 9999999);
+ storage->Put(array, id, cdbData);
+
+ delete newTransform;
+ }
+
+
+}
--- /dev/null
+void MakeMUONResMisAlignment(Bool_t volpaths = true,
+ Bool_t transforms = true,
+ Bool_t svmaps = true)
+// 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/ResMisAlignCDB/Data..." << endl;
+
+ AliMUONGeometryMisAligner misAligner(0.0, 0.004, 0.0, 0.003, 0.0, 0.0023);
+ 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;
+}
+
--- /dev/null
+void MakePHOSFullMisAlignment(){
+ // Create TClonesArray of full misalignment objects for PHOS
+ //
+ TClonesArray *array = new TClonesArray("AliAlignObjAngles",11);
+ TClonesArray &alobj = *array;
+
+ AliAlignObjAngles a;
+
+ Double_t dpsi=0., dtheta=0., dphi=0.;
+ Double_t displacement = 10;
+
+ 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("/ALIC_1/PHOS_1",
+ volid, -20., -10., 0., dpsi, dtheta, 5, kTRUE);
+ new(alobj[1]) AliAlignObjAngles("/ALIC_1/PHOS_2",
+ volid, -10., 0., -10., dpsi, dtheta, 2, kTRUE);
+ new(alobj[2]) AliAlignObjAngles("/ALIC_1/PHOS_3",
+ volid, 5., -10., 10., dpsi, dtheta, 0, kTRUE);
+ new(alobj[3]) AliAlignObjAngles("/ALIC_1/PHOS_4",
+ volid, +10., -0., -10., dpsi, dtheta, 2, kTRUE);
+ new(alobj[4]) AliAlignObjAngles("/ALIC_1/PHOS_5",
+ volid, +20., -10., 0., dpsi, dtheta, 5, kTRUE);
+
+ // Alignment for PHOS cradle
+ new(alobj[5]) AliAlignObjAngles("/ALIC_1/PCRA_0",
+ volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
+ new(alobj[6]) AliAlignObjAngles("/ALIC_1/PCRA_1",
+ volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
+
+ // Alignment for cradle wheels
+ new(alobj[7]) AliAlignObjAngles("/ALIC_1/PWHE_0",
+ volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
+ new(alobj[8]) AliAlignObjAngles("/ALIC_1/PWHE_1",
+ volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
+ new(alobj[9]) AliAlignObjAngles("/ALIC_1/PWHE_2",
+ volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
+ new(alobj[10]) AliAlignObjAngles("/ALIC_1/PWHE_3",
+ volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
+
+ // ************************* 2nd step ***************
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("PHOSfullMisalignment.root","RECREATE");
+ if(!f) cerr<<"cannot open file for output\n";
+ f.cd();
+ f.WriteObject(array,"PHOSFullObjs ","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("Alignment objects for fully misaligned geometry");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("PHOS/Align/Data",0,9999999);
+ storage->Put(array,id, md);
+ }
+
+ array->Delete();
+
+}
--- /dev/null
+void MakePHOSResMisAlignment(){
+ // Create TClonesArray of residual misalignment objects for PHOS
+ //
+ TClonesArray *array = new TClonesArray("AliAlignObjAngles",11);
+ TClonesArray &alobj = *array;
+
+ AliAlignObjAngles a;
+
+ Double_t dpsi=0., dtheta=0., dphi=0.;
+ Double_t displacement = 0.2;
+
+ 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("/ALIC_1/PHOS_1",
+ volid, -0.20, -0.1, +0.0, dpsi, dtheta, 0.2, kTRUE);
+ new(alobj[1]) AliAlignObjAngles("/ALIC_1/PHOS_2",
+ volid, -0.10, +0.0, -0.2, dpsi, dtheta, 0.2, kTRUE);
+ new(alobj[2]) AliAlignObjAngles("/ALIC_1/PHOS_3",
+ volid, 0.05, -0.1, 0.2, dpsi, dtheta, 0.0, kTRUE);
+ new(alobj[3]) AliAlignObjAngles("/ALIC_1/PHOS_4",
+ volid, +0.10, -0.0, -0.1, dpsi, dtheta, 0.1, kTRUE);
+ new(alobj[4]) AliAlignObjAngles("/ALIC_1/PHOS_5",
+ volid, +0.20, -0.1, 0.1, dpsi, dtheta, 0.2, kTRUE);
+
+ // Alignment for PHOS cradle
+ new(alobj[5]) AliAlignObjAngles("/ALIC_1/PCRA_0",
+ volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
+ new(alobj[6]) AliAlignObjAngles("/ALIC_1/PCRA_1",
+ volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
+
+ // Alignment for cradle wheels
+ new(alobj[7]) AliAlignObjAngles("/ALIC_1/PWHE_0",
+ volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
+ new(alobj[8]) AliAlignObjAngles("/ALIC_1/PWHE_1",
+ volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
+ new(alobj[9]) AliAlignObjAngles("/ALIC_1/PWHE_2",
+ volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
+ new(alobj[10]) AliAlignObjAngles("/ALIC_1/PWHE_3",
+ volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
+
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("PHOSresidualMisalignment.root","RECREATE");
+ if(!f) cerr<<"cannot open file for output\n";
+ f.cd();
+ f.WriteObject(array,"PHOSResidualObjs ","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("Alignment objects for slightly misaligned geometry (residual misalignment");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("PHOS/Align/Data",0,9999999);
+ storage->Put(array,id, md);
+ }
+
+ array->Delete();
+
+}
--- /dev/null
+void MakePMDFullMisAlignment(){
+ // Create TClonesArray of full 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
+
+ Float_t max_trans=0.1;
+ 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";
+
+
+ //Sectors 1 and 4
+ Double_t dx14, dy14, dz14; // Misalignment in X,Y and Z
+ Double_t dpsi14, dtheta14, dphi14; // Angular displacements
+ //Sectors 2 and 3
+ Double_t dx23, dy23, dz23; // Misalignment in X,Y and Z
+ Double_t dpsi23, dtheta23, dphi23; // Angular displacements
+
+
+
+ // At present give some random shifts
+ // generated by random numbers
+ // max_trans : Maximun shifts in X,Y,Z in centimeters
+ // max_rot : Maximum shifts in angles in degrees
+ // Double_t max_trans, max_rot;
+
+
+ TRandom *rnd = new TRandom(4357);
+
+ // For sectors 1 and 4
+ // Translation displacement
+ dx14 = (rnd->Uniform()-0.5)*max_trans;
+ dy14 = (rnd->Uniform()-0.5)*max_trans;
+ dz14 = (rnd->Uniform()-0.5)*max_trans;
+ //Rotation angles
+ dpsi14 = (rnd->Uniform()-0.5)*max_rot;
+ dtheta14 = (rnd->Uniform()-0.5)*max_rot;
+ dphi14 = (rnd->Uniform()-0.5)*max_rot;
+
+ // For sectors 2 and 3
+ // Translation displacement
+ dx23 = (rnd->Uniform()-0.5)*max_trans;
+ dy23 = (rnd->Uniform()-0.5)*max_trans;
+ dz23 = (rnd->Uniform()-0.5)*max_trans;
+ //Rotation angles
+ dpsi23 = (rnd->Uniform()-0.5)*max_rot;
+ dtheta23 = (rnd->Uniform()-0.5)*max_rot;
+ dphi23 = (rnd->Uniform()-0.5)*max_rot;
+
+
+ //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);
+
+ new(alobj[0]) AliAlignObjAngles(Sector1, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE);
+ new(alobj[1]) AliAlignObjAngles(Sector2, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE);
+ new(alobj[2]) AliAlignObjAngles(Sector3, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
+ new(alobj[3]) AliAlignObjAngles(Sector4, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // Create a File to store the alignment data
+ TFile f("PMDfullMisalignment.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("Full misalignment for PMD, produced with sigmatr=0.1 and sigmarot=0.1 in the local RS");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("PMD/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+ array->Delete();
+
+}
--- /dev/null
+void MakePMDResMisAlignment(){
+ // Create TClonesArray of residual 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
+
+ Float_t max_trans=0.1;
+ 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";
+
+
+ //Sectors 1 and 4
+ Double_t dx14, dy14, dz14; // Misalignment in X,Y and Z
+ Double_t dpsi14, dtheta14, dphi14; // Angular displacements
+ //Sectors 2 and 3
+ Double_t dx23, dy23, dz23; // Misalignment in X,Y and Z
+ Double_t dpsi23, dtheta23, dphi23; // Angular displacements
+
+
+
+ // At present give some random shifts
+ // generated by random numbers
+ // max_trans : Maximun shifts in X,Y,Z in centimeters
+ // max_rot : Maximum shifts in angles in degrees
+ // Double_t max_trans, max_rot;
+
+
+ TRandom *rnd = new TRandom(4357);
+
+ // For sectors 1 and 4
+ // Translation displacement
+ dx14 = (rnd->Uniform()-0.5)*max_trans;
+ dy14 = (rnd->Uniform()-0.5)*max_trans;
+ dz14 = (rnd->Uniform()-0.5)*max_trans;
+ //Rotation angles
+ dpsi14 = (rnd->Uniform()-0.5)*max_rot;
+ dtheta14 = (rnd->Uniform()-0.5)*max_rot;
+ dphi14 = (rnd->Uniform()-0.5)*max_rot;
+
+ // For sectors 2 and 3
+ // Translation displacement
+ dx23 = (rnd->Uniform()-0.5)*max_trans;
+ dy23 = (rnd->Uniform()-0.5)*max_trans;
+ dz23 = (rnd->Uniform()-0.5)*max_trans;
+ //Rotation angles
+ dpsi23 = (rnd->Uniform()-0.5)*max_rot;
+ dtheta23 = (rnd->Uniform()-0.5)*max_rot;
+ dphi23 = (rnd->Uniform()-0.5)*max_rot;
+
+
+ //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);
+
+ new(alobj[0]) AliAlignObjAngles(Sector1, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE);
+ new(alobj[1]) AliAlignObjAngles(Sector2, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE);
+ new(alobj[2]) AliAlignObjAngles(Sector3, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
+ new(alobj[3]) AliAlignObjAngles(Sector4, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // Create a File to store the alignment data
+ TFile f("PMDresidualMisalignment.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("Residual misalignment for PMD, produced with sigmatr=0.1 and sigmarot=0.1 in the local RS");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("PMD/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+ array->Delete();
+
+}
--- /dev/null
+void MakeRICHFullMisAlignment(){
+ // Create TClonesArray of full misalignment objects for RICH
+ //
+ Float_t sigmaTrans=0.1; // 1mm
+ Float_t sigmaRot=0.001*180/TMath::Pi(); // 1 mrad
+ Float_t dX, dY, dX; Float_t dPsi, dTheta, dPhi; //displacements
+
+ TClonesArray *pCA = new TClonesArray("AliAlignObjMatrix",10);
+
+ TRandom *pRnd = new TRandom(4357);
+
+ AliAlignObjMatrix o;
+
+ Int_t idRICH = AliAlignObj::kRICH;
+ for (Int_t iCh = 0; iCh < 7; iCh++) {
+ dX = (pRnd->Uniform()-0.5)*sigmaTrans; dY = (pRnd->Uniform()-0.5)*sigmaTrans; dZ = (pRnd->Uniform()-0.5)*sigmaTrans;
+ dPsi = (pRnd->Uniform()-0.5)*sigmaRot; dTheta = (pRnd->Uniform()-0.5)*sigmaRot; dPhi = (pRnd->Uniform()-0.5)*sigmaRot;
+ new((*pCA)[iCh]) AliAlignObjMatrix(AliAlignObj::SymName(idRICH,iCh),
+ AliAlignObj::LayerToVolUID(idRICH,iCh),dX,dY,dZ,dPsi,dTheta,dPhi,kTRUE);
+ }
+
+// pCA->Print();
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("RICHfullMisalignment.root","RECREATE");
+ if(!f) cerr<<"cannot open file for output\n";
+ f.cd();
+ f.WriteObject(pCA,"RICHAlignObjs","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("RICH Expert");
+ pMeta->SetComment("Full alignment objects for RICH produced with sigmaTrans=1mm and sigmaRot=1mrad");
+ pMeta->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("RICH/Align/Data",0,9999999);
+ storage->Put(pCA,id,pMeta);
+ }
+
+ pCA->Delete();
+}
--- /dev/null
+void MakeRICHResMisAlignment(){
+ // Create TClonesArray of residual misalignment objects for RICH
+ //
+ Float_t sigmaTrans=0.1; // 1mm
+ Float_t sigmaRot=0.001*180/TMath::Pi(); // 1 mrad
+ Float_t dX, dY, dX; Float_t dPsi, dTheta, dPhi; //displacements
+
+ TClonesArray *pCA = new TClonesArray("AliAlignObjMatrix",10);
+
+ TRandom *pRnd = new TRandom(4357);
+
+ AliAlignObjMatrix o;
+
+ Int_t idRICH = AliAlignObj::kRICH;
+ for (Int_t iCh = 0; iCh < 7; iCh++) {
+ dX = (pRnd->Uniform()-0.5)*sigmaTrans; dY = (pRnd->Uniform()-0.5)*sigmaTrans; dZ = (pRnd->Uniform()-0.5)*sigmaTrans;
+ dPsi = (pRnd->Uniform()-0.5)*sigmaRot; dTheta = (pRnd->Uniform()-0.5)*sigmaRot; dPhi = (pRnd->Uniform()-0.5)*sigmaRot;
+ new((*pCA)[iCh]) AliAlignObjMatrix(AliAlignObj::SymName(idRICH,iCh),AliAlignObj::LayerToVolUID(idRICH,iCh),dX,dY,dZ,dPsi,dTheta,dPhi,kTRUE);
+ }
+
+// pCA->Print();
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("RICHresidualMisalignment.root","RECREATE");
+ if(!f) cerr<<"cannot open file for output\n";
+ f.cd();
+ f.WriteObject(pCA,"RICHAlignObjs","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("RICH Expert");
+ pMeta->SetComment("Residual alignment objects for RICH produced with sigmaTrans=1mm and sigmaRot=1mrad");
+ pMeta->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("RICH/Align/Data",0,9999999);
+ storage->Put(pCA,id,pMeta);
+ }
+
+ pCA->Delete();
+}
--- /dev/null
+void MakeSTARTFullMisAlignment(){
+ // Create TClonesArray of full misalignment objects for T0
+ //
+ TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
+ TClonesArray &alobj = *array;
+
+ if(!gGeoManager) TGeoManager::Import("geometry.root");
+
+ AliAlignObjAngles a;
+
+ 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
+
+ // null shifts and rotations
+
+ 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
+ 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<<dx<<" "<<dy<<" "<<dz<<" "<<dpsi<<" "<<dtheta<<" "<<dphi<<"\n";
+ new(alobj[0]) AliAlignObjAngles(T0right, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+ 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<<dx<<" "<<dy<<" "<<dz<<" "<<dpsi<<" "<<dtheta<<" "<<dphi<<"\n";
+ new(alobj[1]) AliAlignObjAngles(T0left, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+
+ // just save in a file you will send me
+ // or you will put in your afs public dir ...
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("T0fullMisalignment.root","RECREATE");
+ if(!f) cerr<<"cannot open file for output\n";
+ f.cd();
+ f.WriteObject(array,"T0FullObjs ","kSingleKey");
+ f.Close();
+ }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();
+ md->SetResponsible("Tomasz Malkiewicz");
+ md->SetComment("Full misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("START/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+
+ array->Delete();
+
+}
+
--- /dev/null
+void MakeSTARTResMisAlignment(){
+ // Create TClonesArray of residual misalignment objects for T0
+ //
+ 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, dy, dz, dpsi, dtheta, dphi;
+ TRandom *rnd = new TRandom(4321);
+ 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";
+
+ 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<<dx<<" "<<dy<<" "<<dz<<" "<<dpsi<<" "<<dtheta<<" "<<dphi<<"\n";
+ new(alobj[0]) AliAlignObjAngles(T0right, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+ 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<<dx<<" "<<dy<<" "<<dz<<" "<<dpsi<<" "<<dtheta<<" "<<dphi<<"\n";
+ new(alobj[1]) AliAlignObjAngles(T0left, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("T0residualMisalignment.root","RECREATE");
+ if(!f) cerr<<"cannot open file for output\n";
+ f.cd();
+ f.WriteObject(array,"T0ResidualObjs ","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("Residual misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("START/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+
+ array->Delete();
+
+}
+
--- /dev/null
+void MakeTOFFullMisAlignment(){
+ // Create TClonesArray of full misalignment objects for TOF
+ //
+ TClonesArray *array = new TClonesArray("AliAlignObjAngles",100);
+ TClonesArray &alobj = *array;
+
+ if(!gGeoManager) TGeoManager::Import("geometry.root"); //needed for
+ // the constructors with local coordinates not to fail
+
+ AliAlignObjAngles a;
+
+ Int_t nSMTOF = 18;
+ 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;
+ Double_t dx, dy, dz, 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,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1/FTOA_0",i,i);
+ dx = rnd->Gaus(0.,sigmatr);
+ dy = 0;
+ dz = 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++;
+ }
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("TOFfullMisalignment.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("Full misalignment for TOF");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("TOF/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+
+ array->Delete();
+
+}
+
+
--- /dev/null
+void MakeTOFResMisAlignment(){
+ // Create TClonesArray of residual misalignment objects for TOF
+ //
+ 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
+
+ AliAlignObjAngles a;
+
+ AliAlignObj::ELayerID idTOF = AliAlignObj::kTOF;
+ Int_t i;
+ Int_t j=0;
+ Double_t dx=0.;
+ Double_t dy=0.;
+ Double_t dz=0.;
+ Double_t dpsi, dtheta, dphi;
+ TRandom *rnd = new TRandom(4357);
+ Double_t sigmatr = 0.1; // max shift in cm w.r.t. local ideal RS
+
+ for(i=0; i<AliAlignObj::LayerSize(idTOF); i++) {
+ dx = 0;
+ dy = rnd->Gaus(0.,sigmatr);
+ dz = rnd->Gaus(0.,sigmatr);
+ dpsi = 0.;
+ dtheta = 0.;
+ dphi = 0.;
+ new(alobj[j]) AliAlignObjAngles(AliAlignObj::SymName(idTOF,i), AliAlignObj::LayerToVolUID(idTOF,i), dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+ j++;
+ }
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("TOFresidualMisalignment.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("Residual misalignment for TOF, sigmatr=1mm in the local RS");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("TOF/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+
+ array->Delete();
+
+}
+
+
--- /dev/null
+void MakeTPCFullMisAlignment(){
+ // Create TClonesArray of full 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;
+
+ TRandom *rnd = new TRandom(4357);
+ AliAlignObjAngles o;
+ Int_t j = 0;
+ // RS = local
+ // sigma translation = 1mm
+ // sigma rotation = 1mrad
+ Float_t sigmatr=0.01;
+ Float_t sigmarot = 0.06;
+ for (Int_t iLayer = AliAlignObj::kTPC1; iLayer <= AliAlignObj::kTPC2; iLayer++) {
+ for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) {
+
+ Float_t dx = (rnd->Uniform()-0.5)*sigmatr;
+ Float_t dy = (rnd->Uniform()-0.5)*sigmatr;
+ Float_t dz = (rnd->Uniform()-0.5)*sigmatr;
+ Float_t dpsi = (rnd->Uniform()-0.5)*sigmarot;
+ Float_t dtheta = (rnd->Uniform()-0.5)*sigmarot;
+ Float_t dphi = (rnd->Uniform()-0.5)*sigmarot;
+
+ UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
+ const char *path = AliAlignObj::SymName(volid);
+ new(alobj[j]) AliAlignObjAngles(path, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+ j++;
+ }
+ }
+
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("TPCfullMisalignment.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("Full misalignment for TPC, sigmatr=0.01 and sigmarot=0.6 in the local RS");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("TPC/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+
+ array->Delete();
+
+}
+
--- /dev/null
+void MakeTPCResMisAlignment(){
+ // Create TClonesArray of residual 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;
+
+ TRandom *rnd = new TRandom(4357);
+ AliAlignObjAngles o;
+ Double_t dx, dy, dz, dpsi, dtheta, dphi;
+ Int_t j = 0;
+
+ // RS = local
+ // sigma translation = 0.1mm
+ // sigma rotation = 1mrad
+ Float_t sigmatr=0.01;
+ Float_t sigmarot = 0.06;
+ for (Int_t iLayer = AliAlignObj::kTPC1; iLayer <= AliAlignObj::kTPC2; iLayer++) {
+ for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) {
+
+ 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 *path = AliAlignObj::SymName(volid);
+ new(alobj[j]) AliAlignObjAngles(path, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+ j++;
+ }
+ }
+
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("TPCresidualMisalignment.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("Residual misalignment for TPC, sigmatr=0.01 and sigmarot=0.6 in the local RS");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("TPC/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+
+ array->Delete();
+
+}
+
--- /dev/null
+void MakeTRDFullMisAlignment(){
+ // Create TClonesArray of full 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;
+
+ // sigmas for the chambers
+ Double_t chdx=1; // 1 cm
+ Double_t chdy=1; // 1 cm
+ Double_t chdz=1; // 1 cm
+ 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
+
+ Double_t dx,dy,dz,rx,ry,rz;
+
+ Int_t j=0;
+ TRandom *ran = new TRandom(4357);
+ UShort_t volid;
+ const char *path;
+
+ //generate the paths for the 18 supermodules
+ Double_t r=325.;
+ Double_t phi;
+ Int_t isec;
+ TString ts0;
+ TString* sm_path = new TString[18];
+ TRegexp regexp(".*BTRD[0-9][^/]*");
+
+ // 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++) {
+ ran.Rannor(dx,rx);
+ ran.Rannor(dy,ry);
+ ran.Rannor(dz,rz);
+ dx*=chdx;
+ dy*=chdy;
+ dz*=chdz;
+ rx*=chrx;
+ ry*=chry;
+ rz*=chrz;
+ volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
+ path = AliAlignObj::SymName(volid);
+ new(alobj[j++]) AliAlignObjAngles(path,volid,dx,dy,dz,rx,ry,rz,kFALSE);
+ }
+ }
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("TRDfullMisalignment.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("Full misalignment for TRD");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("TRD/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+
+ array->Delete();
+
+}
+
+
--- /dev/null
+void MakeTRDResMisAlignment(){
+ // Create TClonesArray of residual 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;
+
+ // sigmas for the supermodules
+ Double_t smdx=3; // 300 microns
+ Double_t smdy=3; // 300 microns
+ Double_t smdz=3; // 300 microns
+ 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=0.02; // 200 microns
+ Double_t chdy=0.03; // 300 microns
+ Double_t chdz=0.07; // 700 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
+
+ Double_t dx,dy,dz,rx,ry,rz;
+
+ Int_t j=0;
+ TRandom *ran = new TRandom(4357);
+ UShort_t volid;
+ const char *path;
+
+ //generate the paths for the 18 supermodules
+ Double_t r=325.;
+ Double_t phi;
+ Int_t isec;
+ TString ts0;
+ TString* sm_path = new TString[18];
+ TRegexp regexp(".*BTRD[0-9][^/]*");
+
+ for (isec=0; isec<18; isec++) {
+ phi=(isec+0.5)/18*2*TMath::Pi();
+ gGeoManager->FindNode(r*cos(phi),r*sin(phi),0.);
+ ts0 = gGeoManager->GetPath();
+ sm_path[isec] = ts0(regexp);
+ sm_path[isec] +='\0';
+ }
+
+ // create the supermodules' alignment objects
+ for (int i; i<18; 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_path[i].Data(),0,dx,dy,dz,rx,ry,rz,kFALSE);
+ }
+
+ // 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++) {
+ ran.Rannor(dx,rx);
+ ran.Rannor(dy,ry);
+ ran.Rannor(dz,rz);
+ dx*=chdx;
+ dy*=chdy;
+ dz*=chdz;
+ rx*=chrx;
+ ry*=chry;
+ rz*=chrz;
+ volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
+ path = AliAlignObj::SymName(volid);
+ new(alobj[j++]) AliAlignObjAngles(path,volid,dx,dy,dz,rx,ry,rz,kFALSE);
+ }
+ }
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("TRDresidualMisalignment.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("Residual misalignment for TRD");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("TRD/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+
+ array->Delete();
+
+}
+
+
--- /dev/null
+void MakeVZEROFullMisAlignment(){
+ // Create TClonesArray of full 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;
+ 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
+
+ // null shifts and rotations
+
+ const char *V0right="/ALIC_1/VZERO_1/V0RI_1";
+ const char *V0left="/ALIC_1/VZERO_1/V0LE_1";
+
+ 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);
+
+ 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);
+ new(alobj[0]) AliAlignObjAngles(V0right, volid, dx, dy, dz, dpsi, dtheta,
+ dphi, kFALSE);
+ 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);
+ new(alobj[1]) AliAlignObjAngles(V0left, volid, dx, dy, dz, dpsi, dtheta,
+ dphi,kFALSE);
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("V0fullMisalignment.root","RECREATE");
+ if(!f) cerr<<"cannot open file for output\n";
+ f.cd();
+ f.WriteObject(array,"V0FullObjs ","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 full misalignment");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("VZERO/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+
+ array->Delete();
+
+}
+
--- /dev/null
+void MakeVZEROResMisAlignment(){
+ // Create TClonesArray of residual 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;
+ TRandom *rnd = new TRandom(4321);
+ 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";
+
+ 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);
+ new(alobj[0]) AliAlignObjAngles(V0right, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+ 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);
+ new(alobj[1]) AliAlignObjAngles(V0left, volid, dx, dy, dz, dpsi, dtheta, dphi,kFALSE);
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save on file
+ TFile f("V0residualMisalignment.root","RECREATE");
+ if(!f) cerr<<"cannot open file for output\n";
+ f.cd();
+ f.WriteObject(array,"V0ResidualObjs ","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 residual misalignment");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("VZERO/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+
+ array->Delete();
+
+}
+
--- /dev/null
+void MakeZDCFullMisAlignment(){
+ // Create TClonesArray of full 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=2., dz=0.;
+ Double_t dpsi=0., dtheta=0., dphi=0.;
+
+ const char *ZDC_N="ALIC_1/ZDC_1/ZNEU_1";
+ const char *ZDC_P="ALIC_1/ZDC_1/ZPRO_1";
+
+ 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);
+
+ new(alobj[0]) AliAlignObjAngles(ZDC_N, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
+ new(alobj[1]) AliAlignObjAngles(ZDC_P, volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE);
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save in file
+ TFile f("ZDCfullMisalignment.root","RECREATE");
+ if(!f) cerr<<"cannot open file for output\n";
+ f.cd();
+ f.WriteObject(array,"ZDCFullObjs ","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 full misalignment");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("ZDC/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+
+ array->Delete();
+
+}
+
--- /dev/null
+void MakeZDCResMisAlignment(){
+ // Create TClonesArray of residual 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.05, dz=0.;
+ Double_t dpsi=0., dtheta=0., dphi=0.;
+
+ const char *ZDC_N="ALIC_1/ZDC_1/ZNEU_1";
+ const char *ZDC_P="ALIC_1/ZDC_1/ZPRO_1";
+
+ UShort_t iIndex=0;
+ AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
+ UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
+
+ new(alobj[0]) AliAlignObjAngles(ZDC_N, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
+ new(alobj[1]) AliAlignObjAngles(ZDC_P, volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE);
+
+ if(!gSystem->Getenv("$TOCDB")){
+ // save in file
+ TFile f("ZDCresidualMisalignment.root","RECREATE");
+ if(!f) cerr<<"cannot open file for output\n";
+ f.cd();
+ f.WriteObject(array,"ZDCResidualObjs ","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 residual misalignment");
+ md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+ AliCDBId id("ZDC/Align/Data",0,9999999);
+ storage->Put(array,id,md);
+ }
+
+ array->Delete();
+
+}
+
--- /dev/null
+void MakeAllDETsFullMisAlignment(Char_t* CDBstorage = "local://$HOME/Full"){
+ // Make full 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
+ // This macro defines the default name and place for the detector-macros
+ // in charge of producing the full misalignment objects as
+ // $ALICE_ROOT/DET/MakeDETFullMisAlignment.C
+ //
+ 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,ITS,MUON,PHOS,PMD,RICH,START,TOF,TPC,TRD,VZERO,ZDC";
+// TString dets = "ABSO,DIPO,FMD,FRAME,HALL,ITS,MAG,MUON,PHOS,PIPE,PMD,RICH,SHIL,START,TOF,TPC,TRD,ZDC,EMCAL,CRT,VZERO";
+ 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+="FullMisAlignment.C";
+
+ gSystem->Exec(exec_det_macro.Data());
+ }
+
+ return;
+}
--- /dev/null
+void MakeAllDETsResMisAlignment(Char_t* CDBstorage = "local://$HOME/Residual"){
+ // Make residual 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
+ // This macro defines the default name and place for the detector-macros
+ // in charge of producing the full misalignment objects as
+ // $ALICE_ROOT/DET/MakeDETResidualMisAlignment.C
+ //
+ 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,ITS,MUON,PHOS,PMD,RICH,START,TOF,TPC,TRD,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+="ResMisAlignment.C";
+
+ gSystem->Exec(exec_det_macro.Data());
+ }
+
+ return;
+}