From a24be56b08ef731a32c600e49534f4c4beb9370c Mon Sep 17 00:00:00 2001 From: hristov Date: Tue, 18 Sep 2007 06:18:25 +0000 Subject: [PATCH] Updated alignment macros and related changes (Raffaele) --- EMCAL/MakeEMCALFullMisAlignment.C | 4 +- EMCAL/MakeEMCALResMisAlignment.C | 4 +- EMCAL/MakeEMCALZeroMisAlignment.C | 2 +- FMD/AliFMDAlignFaker.cxx | 2 +- FMD/MakeFMDFullMisAlignment.C | 4 +- FMD/MakeFMDResMisAlignment.C | 4 +- FMD/MakeFMDZeroMisAlignment.C | 4 +- GRP/MakeSTRUCTFullMisAlignment.C | 70 +++++++++++++++++++++ GRP/MakeSTRUCTResMisAlignment.C | 62 +++++++++++++++++++ GRP/MakeSTRUCTZeroMisAlignment.C | 61 ++++++++++++++++++ GRP/UpdateCDBIdealGeom.C | 53 ++++++++-------- HMPID/MakeHMPIDFullMisAlignment.C | 2 +- HMPID/MakeHMPIDResMisAlignment.C | 2 +- HMPID/MakeHMPIDZeroMisAlignment.C | 2 +- ITS/MakeITSFullMisAlignment.C | 4 +- ITS/MakeITSResMisAlignment.C | 4 +- ITS/MakeITSZeroMisAlignment.C | 2 +- MUON/MakeMUONFullMisAlignment.C | 2 +- MUON/MakeMUONResMisAlignment.C | 2 +- MUON/MakeMUONZeroMisAlignment.C | 2 +- PHOS/MakePHOSFullMisAlignment.C | 2 +- PHOS/MakePHOSResMisAlignment.C | 2 +- PHOS/MakePHOSZeroMisAlignment.C | 2 +- PMD/MakePMDFullMisAlignment.C | 4 +- PMD/MakePMDResMisAlignment.C | 4 +- PMD/MakePMDZeroMisAlignment.C | 2 +- TOF/MakeTOFFullMisAlignment.C | 92 +++++++++++++--------------- TOF/MakeTOFResMisAlignment.C | 32 +++++----- TOF/MakeTOFZeroMisAlignment.C | 62 ++++++++++++++----- TPC/MakeTPCFullMisAlignment.C | 4 +- TPC/MakeTPCResMisAlignment.C | 4 +- TPC/MakeTPCZeroMisAlignment.C | 2 +- TRD/MakeTRDFullMisAlignment.C | 81 ++++++++++++------------ TRD/MakeTRDResMisAlignment.C | 20 ++++-- TRD/MakeTRDZeroMisAlignment.C | 19 ++++-- VZERO/MakeVZEROFullMisAlignment.C | 4 +- VZERO/MakeVZEROResMisAlignment.C | 4 +- VZERO/MakeVZEROZeroMisAlignment.C | 2 +- ZDC/MakeZDCFullMisAlignment.C | 2 +- ZDC/MakeZDCResMisAlignment.C | 2 +- ZDC/MakeZDCZeroMisAlignment.C | 2 +- macros/GetARversion.C | 27 ++++++++ macros/MakeAllDETsFullMisAlignment.C | 36 ++++------- macros/MakeAllDETsResMisAlignment.C | 36 ++++------- macros/MakeAllDETsZeroMisAlignment.C | 34 ++++------ 45 files changed, 497 insertions(+), 276 deletions(-) create mode 100644 GRP/MakeSTRUCTFullMisAlignment.C create mode 100644 GRP/MakeSTRUCTResMisAlignment.C create mode 100644 GRP/MakeSTRUCTZeroMisAlignment.C create mode 100644 macros/GetARversion.C diff --git a/EMCAL/MakeEMCALFullMisAlignment.C b/EMCAL/MakeEMCALFullMisAlignment.C index 6d4a60a6144..c89ac02f0fe 100644 --- a/EMCAL/MakeEMCALFullMisAlignment.C +++ b/EMCAL/MakeEMCALFullMisAlignment.C @@ -12,7 +12,7 @@ void MakeEMCALFullMisAlignment(){ AliCDBStorage* storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); @@ -75,7 +75,7 @@ void MakeEMCALFullMisAlignment(){ new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "EMCALfullMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/EMCAL/MakeEMCALResMisAlignment.C b/EMCAL/MakeEMCALResMisAlignment.C index 90d6e24ba1a..e0b465df65d 100644 --- a/EMCAL/MakeEMCALResMisAlignment.C +++ b/EMCAL/MakeEMCALResMisAlignment.C @@ -12,7 +12,7 @@ void MakeEMCALResMisAlignment(){ AliCDBStorage* storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); @@ -77,7 +77,7 @@ void MakeEMCALResMisAlignment(){ new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "EMCALresidualMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/EMCAL/MakeEMCALZeroMisAlignment.C b/EMCAL/MakeEMCALZeroMisAlignment.C index 0509ef086fd..f8e5d495bff 100644 --- a/EMCAL/MakeEMCALZeroMisAlignment.C +++ b/EMCAL/MakeEMCALZeroMisAlignment.C @@ -30,7 +30,7 @@ void MakeEMCALZeroMisAlignment(){ new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "EMCALzeroMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/FMD/AliFMDAlignFaker.cxx b/FMD/AliFMDAlignFaker.cxx index 7942d65e970..1eefe208c14 100644 --- a/FMD/AliFMDAlignFaker.cxx +++ b/FMD/AliFMDAlignFaker.cxx @@ -77,7 +77,7 @@ AliFMDAlignFaker::AliFMDAlignFaker(Int_t mask, const char* geo, fHalfRotMin(0,0,0), fHalfRotMax(0,0,0), fRunMin(0), - fRunMax(9999999), + fRunMax(AliCDBRunRange::Infinity()), fArray(0), fComment("") { diff --git a/FMD/MakeFMDFullMisAlignment.C b/FMD/MakeFMDFullMisAlignment.C index 5901041da88..9ae182e3d24 100644 --- a/FMD/MakeFMDFullMisAlignment.C +++ b/FMD/MakeFMDFullMisAlignment.C @@ -10,7 +10,7 @@ void MakeFMDFullMisAlignment(){ TString Storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); @@ -32,7 +32,7 @@ void MakeFMDFullMisAlignment(){ } gSystem->Load("libFMDutil.so"); - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file AliFMDAlignFaker faker(AliFMDAlignFaker::kAll, "geometry.root","FMDfullMisalignment.root"); }else{ diff --git a/FMD/MakeFMDResMisAlignment.C b/FMD/MakeFMDResMisAlignment.C index 15e2121faa2..1fb0081eacf 100644 --- a/FMD/MakeFMDResMisAlignment.C +++ b/FMD/MakeFMDResMisAlignment.C @@ -11,7 +11,7 @@ void MakeFMDResMisAlignment() TString Storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); @@ -33,7 +33,7 @@ void MakeFMDResMisAlignment() } gSystem->Load("libFMDutil.so"); - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file AliFMDAlignFaker faker(AliFMDAlignFaker::kAll, "geometry.root","FMDresidualMisalignment.root"); }else{ diff --git a/FMD/MakeFMDZeroMisAlignment.C b/FMD/MakeFMDZeroMisAlignment.C index 7ef9a67b4ee..b3048eddc64 100644 --- a/FMD/MakeFMDZeroMisAlignment.C +++ b/FMD/MakeFMDZeroMisAlignment.C @@ -11,7 +11,7 @@ void MakeFMDZeroMisAlignment() TString Storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); @@ -33,7 +33,7 @@ void MakeFMDZeroMisAlignment() } gSystem->Load("libFMDutil.so"); - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file AliFMDAlignFaker faker(AliFMDAlignFaker::kAll, "geometry.root","FMDAlignObjs.root"); }else{ diff --git a/GRP/MakeSTRUCTFullMisAlignment.C b/GRP/MakeSTRUCTFullMisAlignment.C new file mode 100644 index 00000000000..684c9935a29 --- /dev/null +++ b/GRP/MakeSTRUCTFullMisAlignment.C @@ -0,0 +1,70 @@ +void MakeSTRUCTFullMisAlignment(){ + // Create TClonesArray of full misalignment objects for all STRUCTures + // (presently this includes only FRAME) + // Full alignment objects for FRAME segments are built by + // averaging in each supermodule the values produced by the + // ANSYS finite-elements simulation + // + const char* macroname = "MakeSTRUCTFullMisAlignment.C"; + TClonesArray *array = new TClonesArray("AliAlignObjParams",20); + + // the following hardcoded values have been obtained by taking the output of the ANSYS simulation + // (finite elements simulation of deformations for given loads) and recalculating the avarege + // displacement of the center of each space-frame sector + ((*array)[0]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO0_1",0,0.13375,-0.0275,0,0,0,0,kTRUE); + ((*array)[1]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO1_1",0,0.25125,0.00125,0,0,0,0,kTRUE); + ((*array)[2]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO2_1",0,0.2325,-0.03625,0,0,0,0,kTRUE); + ((*array)[3]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO3_1",0,0.17,-0.14375,0,0,0,0,kTRUE); + ((*array)[4]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO4_1",0,0.1475,-0.2,0,0,0,0,kTRUE); + ((*array)[5]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO5_1",0,0.12625,-0.13375,0,0,0,0,kTRUE); + ((*array)[6]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO6_1",0,0.06375,-0.02125,0,0,0,0,kTRUE); + ((*array)[7]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO7_1",0,0.0475,0.015,0,0,0,0,kTRUE); + ((*array)[8]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO8_1",0,0.1775,-0.0175,0,0,0,0,kTRUE); + ((*array)[9]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO9_1",0,0.32375,-0.03125,0,0,0,0,kTRUE); + ((*array)[10]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO10_1",0,0.35125,-0.0325,0,0,0,0,kTRUE); + ((*array)[11]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO11_1",0,0.285,-0.105,0,0,0,0,kTRUE); + ((*array)[12]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO12_1",0,0.205,-0.24375,0,0,0,0,kTRUE); + ((*array)[13]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO13_1",0,0.1775,-0.32,0,0,0,0,kTRUE); + ((*array)[14]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO14_1",0,0.1525,-0.25375,0,0,0,0,kTRUE); + ((*array)[15]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO15_1",0,0.07625,-0.1225,0,0,0,0,kTRUE); + ((*array)[16]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO16_1",0,0.0075,-0.04875,0,0,0,0,kTRUE); + ((*array)[17]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO17_1",0,0.01375,-0.04125,0,0,0,0,kTRUE); + + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ + // save on file + const char* filename = "STRUCTfullMisalignment.root"; + TFile f(filename,"RECREATE"); + if(!f){ + Error(macroname,"cannot open file for output\n"); + return; + } + Info(macroname,"Saving alignment objects in %s", filename); + f.cd(); + f.WriteObject(array,"STRUCTAlignObjs","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + TString Storage = gSystem->Getenv("STORAGE"); + if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { + Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); + return; + } + Info(macroname,"Saving alignment objects in CDB storage %s",Storage.Data()); + AliCDBManager* cdb = AliCDBManager::Instance(); + AliCDBStorage* storage = cdb->GetStorage(Storage.Data()); + if(!storage){ + Error(macroname,"Unable to open storage %s\n",Storage.Data()); + return; + } + AliCDBMetaData* md = new AliCDBMetaData(); + md->SetResponsible("Grosso Raffaele"); + md->SetComment("Full misalignment for FRAME, including dead weight and full weight deformations derived from ANSYS finiteelements simulation: dispmap corrected excel worksheet from Werner Riegler"); + md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); + AliCDBId id("GRP/Align/Data",0,AliCDBRunRange::Infinity()); + storage->Put(array,id,md); + } + + array->Delete(); + +} + diff --git a/GRP/MakeSTRUCTResMisAlignment.C b/GRP/MakeSTRUCTResMisAlignment.C new file mode 100644 index 00000000000..8ac79edcd6d --- /dev/null +++ b/GRP/MakeSTRUCTResMisAlignment.C @@ -0,0 +1,62 @@ +void MakeSTRUCTResMisAlignment(){ + // Create TClonesArray of residual misalignment objects for all STRUCTures + // (presently this includes only FRAME) + // + const char* macroname = "MakeSTRUCTResMisAlignment.C"; + + TClonesArray *array = new TClonesArray("AliAlignObjParams",20); + + Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT + AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; + UShort_t dvoluid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy vol id + + const char* basepath ="ALIC_1/B077_1/BSEGMO"; + TString segmpath; + + for(Int_t sm=0; sm<18; sm++){ + segmpath=basepath; + segmpath+=sm; + segmpath+="_1"; + cout<Getenv("TOCDB")) != TString("kTRUE") ){ + // save on file + const char* filename = "STRUCTresMisalignment.root"; + TFile f(filename,"RECREATE"); + if(!f){ + Error(macroname,"cannot open file for output\n"); + return; + } + Info(macroname,"Saving alignment objects in %s", filename); + f.cd(); + f.WriteObject(array,"STRUCTAlignObjs","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + TString Storage = gSystem->Getenv("STORAGE"); + if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { + Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); + return; + } + Info(macroname,"Saving alignment objects in CDB storage %s",Storage.Data()); + AliCDBManager* cdb = AliCDBManager::Instance(); + AliCDBStorage* storage = cdb->GetStorage(Storage.Data()); + if(!storage){ + Error(macroname,"Unable to open storage %s\n",Storage.Data()); + return; + } + AliCDBMetaData* md = new AliCDBMetaData(); + md->SetResponsible("Grosso Raffaele"); + md->SetComment("Residual misalignment for STRUCT. Presently includes objects for FRAME."); + md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); + AliCDBId id("GRP/Align/Data",0,AliCDBRunRange::Infinity()); + storage->Put(array,id,md); + } + + array->Delete(); + +} + diff --git a/GRP/MakeSTRUCTZeroMisAlignment.C b/GRP/MakeSTRUCTZeroMisAlignment.C new file mode 100644 index 00000000000..0ebbe07c4a6 --- /dev/null +++ b/GRP/MakeSTRUCTZeroMisAlignment.C @@ -0,0 +1,61 @@ +void MakeSTRUCTZeroMisAlignment(){ + // Create TClonesArray of zero misalignment objects for all STRUCTures + // (presently this includes only FRAME) + // + const char* macroname = "MakeSTRUCTZeroMisAlignment.C"; + + TClonesArray *array = new TClonesArray("AliAlignObjParams",20); + + Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT + AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; + UShort_t dvoluid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy vol id + + const char* basepath ="ALIC_1/B077_1/BSEGMO"; + TString segmpath; + + for(Int_t sm=0; sm<18; sm++){ + segmpath=basepath; + segmpath+=sm; + segmpath+="_1"; + cout<Getenv("TOCDB")) != TString("kTRUE") ){ + // save on file + const char* filename = "STRUCTzeroMisalignment.root"; + TFile f(filename,"RECREATE"); + if(!f){ + Error(macroname,"cannot open file for output\n"); + return; + } + Info(macroname,"Saving alignment objects in %s", filename); + f.cd(); + f.WriteObject(array,"STRUCTAlignObjs","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + TString Storage = gSystem->Getenv("STORAGE"); + if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { + Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); + return; + } + Info(macroname,"Saving alignment objects in CDB storage %s",Storage.Data()); + AliCDBManager* cdb = AliCDBManager::Instance(); + AliCDBStorage* storage = cdb->GetStorage(Storage.Data()); + if(!storage){ + Error(macroname,"Unable to open storage %s\n",Storage.Data()); + return; + } + AliCDBMetaData* md = new AliCDBMetaData(); + md->SetResponsible("Grosso Raffaele"); + md->SetComment("Zero misalignment for STRUCT: presently includes objects for FRAME"); + md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); + AliCDBId id("GRP/Align/Data",0,AliCDBRunRange::Infinity()); + storage->Put(array,id,md); + } + + array->Delete(); + +} + diff --git a/GRP/UpdateCDBIdealGeom.C b/GRP/UpdateCDBIdealGeom.C index 159cfe1b7b6..ac7776d5bad 100644 --- a/GRP/UpdateCDBIdealGeom.C +++ b/GRP/UpdateCDBIdealGeom.C @@ -1,43 +1,40 @@ -void UpdateCDBIdealGeom(){ - // produce the ideal geometry with the current AliRoot and store it in the - // CDB +void UpdateCDBIdealGeom(const char* cdbUri, const char* cfgFile){ + // Produce the ideal geometry and store it in the specified CDB + // The second argument allows to specify the config file to be used + // in particular for giving the choice to generate either a full or + // a partial geometry. + // - AliCDBManager* man = AliCDBManager::Instance(); - man->SetDefaultStorage("local://$ALICE_ROOT"); - man->SetRun(0); + AliCDBManager* cdb = AliCDBManager::Instance(); + // we set the default storage to the repository because some dets require + // already at the time of geometry creation to find calibration objects in the cdb + if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT"); + AliCDBStorage* storage = cdb->GetStorage(cdbUri); + cdb->SetRun(0); AliCDBId id("GRP/Geometry/Data",0,AliCDBRunRange::Infinity()); AliCDBMetaData *md= new AliCDBMetaData(); - // Get root version + // Get root and AliRoot versions const char* rootv = gROOT->GetVersion(); + gROOT->ProcessLine(".L $ALICE_ROOT/macros/GetARversion.C"); + TString av(GetARversion()); - // Get AliRoot version from file to set it in the metadata of the entry - TFile *fv= TFile::Open("$ALICE_ROOT/CVS/Repository?filetype=raw","READ"); - Int_t size = fv->GetSize(); - char *buf = new Char_t[size]; - memset(buf, '\0', size); - fv->Seek(0); - char* alirootv; - if ( fv->ReadBuffer(buf, size) ) { - Printf("Error reading AliRoot version from file to buffer!"); - alirootv = ""; - } - if(buf=="AliRoot"){ - alirootv="HEAD"; - }else{ - alirootv = buf; - md->SetAliRootVersion(alirootv); - md->SetComment(Form("Geometry produced with root version %s and AliRoot version %s",rootv,alirootv)); - } + md->SetAliRootVersion(av.Data()); + md->SetComment(Form("Geometry produced with root version %s and AliRoot version %s",rootv,av.Data())); - gAlice->Init(); + gAlice->Init(cfgFile); if(!gGeoManager){ Printf("Unable to produce a valid geometry to be put in the CDB!"); return; } - Printf("Storing in CDB geometry produced with root version %s and AliRoot version %s",rootv,alirootv); - man->Put(gGeoManager,id,md); + Printf("Storing in CDB geometry produced with root version %s and AliRoot version %s",rootv,av.Data()); + storage->Put(gGeoManager,id,md); + // This is to allow macros lauched after this one in the same session to find the + // newly produced geometry. + storage->QueryCDB(cdb->GetRun()); } + + diff --git a/HMPID/MakeHMPIDFullMisAlignment.C b/HMPID/MakeHMPIDFullMisAlignment.C index 236ace0ab42..9b2ff3e16de 100644 --- a/HMPID/MakeHMPIDFullMisAlignment.C +++ b/HMPID/MakeHMPIDFullMisAlignment.C @@ -20,7 +20,7 @@ void MakeHMPIDFullMisAlignment(){ // pCA->Print(); const char* macroname = "MakeHMPIDResMisAlignment.C"; - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "HMPIDresidualMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/HMPID/MakeHMPIDResMisAlignment.C b/HMPID/MakeHMPIDResMisAlignment.C index 4f050d6bcf8..a66fba37207 100644 --- a/HMPID/MakeHMPIDResMisAlignment.C +++ b/HMPID/MakeHMPIDResMisAlignment.C @@ -19,7 +19,7 @@ void MakeHMPIDResMisAlignment(){ // pCA->Print(); const char* macroname = "MakeHMPIDResMisAlignment.C"; - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "HMPIDresidualMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/HMPID/MakeHMPIDZeroMisAlignment.C b/HMPID/MakeHMPIDZeroMisAlignment.C index c372b8b36a3..cbc1c22c513 100644 --- a/HMPID/MakeHMPIDZeroMisAlignment.C +++ b/HMPID/MakeHMPIDZeroMisAlignment.C @@ -12,7 +12,7 @@ void MakeHMPIDZeroMisAlignment(){ // pCA->Print(); const char* macroname = "MakeHMPIDZeroMisAlignment.C"; - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "HMPIDzeroMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/ITS/MakeITSFullMisAlignment.C b/ITS/MakeITSFullMisAlignment.C index 44ed65410a2..3cd15ff169c 100644 --- a/ITS/MakeITSFullMisAlignment.C +++ b/ITS/MakeITSFullMisAlignment.C @@ -12,7 +12,7 @@ void MakeITSFullMisAlignment(){ AliCDBStorage* storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); @@ -112,7 +112,7 @@ void MakeITSFullMisAlignment(){ } } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "ITSfullMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/ITS/MakeITSResMisAlignment.C b/ITS/MakeITSResMisAlignment.C index 4e11ac3c4ce..fcdabe1e32f 100644 --- a/ITS/MakeITSResMisAlignment.C +++ b/ITS/MakeITSResMisAlignment.C @@ -12,7 +12,7 @@ void MakeITSResMisAlignment(){ AliCDBStorage* storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); @@ -114,7 +114,7 @@ void MakeITSResMisAlignment(){ } } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "ITSresidualMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/ITS/MakeITSZeroMisAlignment.C b/ITS/MakeITSZeroMisAlignment.C index 7d112ae8373..b48a4501ae0 100644 --- a/ITS/MakeITSZeroMisAlignment.C +++ b/ITS/MakeITSZeroMisAlignment.C @@ -51,7 +51,7 @@ void MakeITSZeroMisAlignment(){ } } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "ITSzeroMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/MUON/MakeMUONFullMisAlignment.C b/MUON/MakeMUONFullMisAlignment.C index 448435affa4..61677fbd7cf 100644 --- a/MUON/MakeMUONFullMisAlignment.C +++ b/MUON/MakeMUONFullMisAlignment.C @@ -49,7 +49,7 @@ void MakeMUONFullMisAlignment() AliCDBStorage* storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); diff --git a/MUON/MakeMUONResMisAlignment.C b/MUON/MakeMUONResMisAlignment.C index 9ecdf626668..844c1d8836b 100644 --- a/MUON/MakeMUONResMisAlignment.C +++ b/MUON/MakeMUONResMisAlignment.C @@ -48,7 +48,7 @@ void MakeMUONResMisAlignment() AliCDBStorage* storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); diff --git a/MUON/MakeMUONZeroMisAlignment.C b/MUON/MakeMUONZeroMisAlignment.C index 28e3a6633db..88db417928b 100644 --- a/MUON/MakeMUONZeroMisAlignment.C +++ b/MUON/MakeMUONZeroMisAlignment.C @@ -46,7 +46,7 @@ void MakeMUONZeroMisAlignment() AliCDBStorage* storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); diff --git a/PHOS/MakePHOSFullMisAlignment.C b/PHOS/MakePHOSFullMisAlignment.C index 10081ca1576..0d67ef766d1 100644 --- a/PHOS/MakePHOSFullMisAlignment.C +++ b/PHOS/MakePHOSFullMisAlignment.C @@ -69,7 +69,7 @@ void MakePHOSFullMisAlignment(){ // ************************* 2nd step *************** const char* macroname = "MakePHOSFullMisAlignment.C"; - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "PHOSfullMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/PHOS/MakePHOSResMisAlignment.C b/PHOS/MakePHOSResMisAlignment.C index c58eeccefbe..cdf40c12250 100644 --- a/PHOS/MakePHOSResMisAlignment.C +++ b/PHOS/MakePHOSResMisAlignment.C @@ -65,7 +65,7 @@ void MakePHOSResMisAlignment(){ geodesicData.CreateAliAlignObjParams(alobj); const char* macroname = "MakePHOSResMisAlignment.C"; - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "PHOSresidualMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/PHOS/MakePHOSZeroMisAlignment.C b/PHOS/MakePHOSZeroMisAlignment.C index e15c2ae9022..edd78612766 100644 --- a/PHOS/MakePHOSZeroMisAlignment.C +++ b/PHOS/MakePHOSZeroMisAlignment.C @@ -63,7 +63,7 @@ void MakePHOSZeroMisAlignment(){ AliPHOSSurvey geodesicData; geodesicData.CreateNullObjects(alobj, phosGeom); - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "PHOSzeroMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/PMD/MakePMDFullMisAlignment.C b/PMD/MakePMDFullMisAlignment.C index ebf2c86ca2d..50245e5fc94 100644 --- a/PMD/MakePMDFullMisAlignment.C +++ b/PMD/MakePMDFullMisAlignment.C @@ -44,7 +44,7 @@ void MakePMDFullMisAlignment(){ AliCDBStorage* storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); @@ -126,7 +126,7 @@ void MakePMDFullMisAlignment(){ new(alobj[2]) AliAlignObjParams(Sector3, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE); new(alobj[3]) AliAlignObjParams(Sector4, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE); - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // Create a File to store the alignment data const char* filename = "PMDfullMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/PMD/MakePMDResMisAlignment.C b/PMD/MakePMDResMisAlignment.C index 5ed470c975c..4941e721b47 100644 --- a/PMD/MakePMDResMisAlignment.C +++ b/PMD/MakePMDResMisAlignment.C @@ -43,7 +43,7 @@ void MakePMDResMisAlignment(){ AliCDBStorage* storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); @@ -125,7 +125,7 @@ void MakePMDResMisAlignment(){ new(alobj[2]) AliAlignObjParams(Sector3, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE); new(alobj[3]) AliAlignObjParams(Sector4, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE); - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // Create a File to store the alignment data const char* filename = "PMDresidualMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/PMD/MakePMDZeroMisAlignment.C b/PMD/MakePMDZeroMisAlignment.C index 547011e3ad5..9931cbaa4a0 100644 --- a/PMD/MakePMDZeroMisAlignment.C +++ b/PMD/MakePMDZeroMisAlignment.C @@ -51,7 +51,7 @@ void MakePMDZeroMisAlignment(){ new(alobj[j++]) AliAlignObjParams(snSector.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // Create a File to store the alignment data const char* filename = "PMDzeroMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/TOF/MakeTOFFullMisAlignment.C b/TOF/MakeTOFFullMisAlignment.C index 3861fe05fe4..7fb6424bb02 100644 --- a/TOF/MakeTOFFullMisAlignment.C +++ b/TOF/MakeTOFFullMisAlignment.C @@ -11,9 +11,10 @@ void MakeTOFFullMisAlignment(){ cdb->SetRun(0); AliCDBStorage* storage; + TString Storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ - TString Storage = gSystem->Getenv("STORAGE"); + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ + Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); return; @@ -35,38 +36,25 @@ void MakeTOFFullMisAlignment(){ // load FRAME full misalignment objects (if needed, the macro // for FRAME has to be run in advance) and apply them to geometry - Info(macroname,"Loading FRAME alignment objects from CDB storage %s", - Storage.Data()); AliCDBPath fpath("GRP","Align","Data"); - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ + Info(macroname,"Loading FRAME alignment objects from CDB storage %s", + Storage.Data()); AliCDBEntry *eFrame = storage->Get(fpath.GetPath(),cdb->GetRun()); - if(!entry) Fatal(macroname,"Could not get the specified CDB entry!"); - TClonesArray* arFrame = (TClonesArray*) eFrame->GetObject(); - arFrame->Sort(); - Int_t nvols = arFrame->GetEntriesFast(); - Bool_t flag = kTRUE; - for(Int_t j=0; jUncheckedAt(j); - if (alobj->ApplyToGeometry() == kFALSE) flag = kFALSE; - } - if(!flag) - Fatal(macroname,"Error in the application of FRAME alignment objects"); }else{ AliCDBEntry *eFrame = cdb->Get(fpath.GetPath()); - if(!entry) Fatal(macroname,"Could not get the specified CDB entry!"); - TClonesArray* arFrame = (TClonesArray*) eFrame->GetObject(); - arFrame->Sort(); - Int_t nvols = arFrame->GetEntriesFast(); - Bool_t flag = kTRUE; - for(Int_t j=0; jUncheckedAt(j); - if (alobj->ApplyToGeometry() == kFALSE) flag = kFALSE; - } - if(!flag) - Fatal(macroname,"Error in the application of FRAME alignment objects"); } + if(!eFrame) Fatal(macroname,"Could not get the specified CDB entry!"); + TClonesArray* arFrame = (TClonesArray*) eFrame->GetObject(); + arFrame->Sort(); + Int_t nvols = arFrame->GetEntriesFast(); + Bool_t flag = kTRUE; + for(Int_t j=0; jUncheckedAt(j); + if (alobj->ApplyToGeometry() == kFALSE) flag = kFALSE; + } + if(!flag) Fatal(macroname,"Error in the application of FRAME alignment objects"); //Produce objects for TOF supermodules Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT @@ -74,52 +62,58 @@ void MakeTOFFullMisAlignment(){ UShort_t dvoluid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy vol id Int_t nSMTOF = 18; + Int_t sActive[18]={0,1,1,0,0,0,1,1,0,1,1,1,1,0,0,1,1,1}; Int_t j=0; - Double_t smdx, smdy, smdz, dpsi, dtheta, dphi; + Double_t smdx, smdy, smdz=0., dpsi=0., dtheta, dphi=0.; 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(Int_t i=0; iGaus(0.,sigmatr); smdy = rnd->Gaus(0.,sigmatr); - smdz =0; - dpsi = 0.; dtheta = rnd->Gaus(0.,sigmarot); - dphi = 0.; + if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue; new((*array)[j++]) AliAlignObjParams(symname.Data(), dvoluid, smdx, smdy, smdz, dpsi, dtheta, dphi, kFALSE); } // Apply objects for TOF supermodules - for(Int_t i=0; iUncheckedAt(i); + Int_t smCounter=0; + for(Int_t iSect=0; iSectGetenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue; + AliAlignObjParams* smobj = (AliAlignObjParams*)array->UncheckedAt(smCounter++); + Info(macroname,Form("Applying object for sector %d ",iSect)); if(!smobj->ApplyToGeometry()){ - cout<<"application of object "<Gaus(0.,sigmatr); sdz = rnds->Gaus(0.,sigmatr); - sdpsi = 0.; - sdtheta = 0.; - sdphi = 0.; - new((*array)[j++]) AliAlignObjParams(AliGeomManager::SymName(idTOF,i), AliGeomManager::LayerToVolUID(idTOF,i), sdx, sdy, sdz, sdpsi, sdtheta, sdphi, kFALSE); + strId++; + if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue; + new((*array)[j++]) AliAlignObjParams(AliGeomManager::SymName(idTOF,strId),AliGeomManager::LayerToVolUID(idTOF,strId), sdx, sdy, sdz, sdpsi, sdtheta, sdphi, kFALSE); + } } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save in file const char* filename = "TOFfullMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/TOF/MakeTOFResMisAlignment.C b/TOF/MakeTOFResMisAlignment.C index 35672865de6..dcbc32f2c0b 100644 --- a/TOF/MakeTOFResMisAlignment.C +++ b/TOF/MakeTOFResMisAlignment.C @@ -13,7 +13,7 @@ void MakeTOFResMisAlignment(){ AliCDBStorage* storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); @@ -35,27 +35,31 @@ void MakeTOFResMisAlignment(){ } AliGeomManager::ELayerID idTOF = AliGeomManager::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; + Int_t strId=-1; + Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.; TRandom *rnd = new TRandom(4357); Double_t sigmatr = 0.1; // sigma (in cm) for shift w.r.t. local ideal RS - for(i=0; iGaus(0.,sigmatr); dz = rnd->Gaus(0.,sigmatr); - dpsi = 0.; - dtheta = 0.; - dphi = 0.; - new(alobj[j]) AliAlignObjParams(AliGeomManager::SymName(idTOF,i), AliGeomManager::LayerToVolUID(idTOF,i), dx, dy, dz, dpsi, dtheta, dphi, kFALSE); - j++; + strId++; + if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue; + new(alobj[j++]) AliAlignObjParams(AliGeomManager::SymName(idTOF,strId),AliGeomManager::LayerToVolUID(idTOF,strId), dx, dy, dz, dpsi, dtheta, dphi, kFALSE); + } } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "TOFresidualMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/TOF/MakeTOFZeroMisAlignment.C b/TOF/MakeTOFZeroMisAlignment.C index e2d00e55e18..0d16e78f2e5 100644 --- a/TOF/MakeTOFZeroMisAlignment.C +++ b/TOF/MakeTOFZeroMisAlignment.C @@ -5,17 +5,58 @@ void MakeTOFZeroMisAlignment(){ TClonesArray &alobj = *array; const char* macroname = "MakeTOFZeroMisAlignment.C"; + // Activate CDB storage and load geometry from CDB + AliCDBManager* cdb = AliCDBManager::Instance(); + if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT"); + cdb->SetRun(0); + + AliCDBStorage* storage; + + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ + TString Storage = gSystem->Getenv("STORAGE"); + if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { + Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); + return; + } + storage = cdb->GetStorage(Storage.Data()); + if(!storage){ + Error(macroname,"Unable to open storage %s\n",Storage.Data()); + return; + } + AliCDBPath path("GRP","Geometry","Data"); + AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun()); + if(!entry) Fatal(macroname,"Could not get the specified CDB entry!"); + entry->SetOwner(0); + TGeoManager* geom = (TGeoManager*) entry->GetObject(); + AliGeomManager::SetGeometry(geom); + }else{ + AliGeomManager::LoadGeometry(); //load geom from default CDB storage + } + AliGeomManager::ELayerID idTOF = AliGeomManager::kTOF; - Int_t i; Int_t j=0; + Int_t strId=-1; Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.; - for(i=0; iGetenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue; + new(alobj[j++]) AliAlignObjParams(AliGeomManager::SymName(idTOF,strId), AliGeomManager::LayerToVolUID(idTOF,strId), dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + } } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "TOFzeroMisalignment.root"; TFile f(filename,"RECREATE"); @@ -29,19 +70,6 @@ void MakeTOFZeroMisAlignment(){ f.Close(); }else{ // save in CDB storage - TString Storage = gSystem->Getenv("STORAGE"); - if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { - Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); - return; - } - Info(macroname,"Saving alignment objects in CDB storage %s", - Storage.Data()); - AliCDBManager* cdb = AliCDBManager::Instance(); - AliCDBStorage* storage = cdb->GetStorage(Storage.Data()); - if(!storage){ - Error(macroname,"Unable to open storage %s\n",Storage.Data()); - return; - } AliCDBMetaData* md = new AliCDBMetaData(); md->SetResponsible("Silvia Arcelli"); md->SetComment("Zero misalignment for TOF"); diff --git a/TPC/MakeTPCFullMisAlignment.C b/TPC/MakeTPCFullMisAlignment.C index 427e90bfd2c..3160ba97d3d 100644 --- a/TPC/MakeTPCFullMisAlignment.C +++ b/TPC/MakeTPCFullMisAlignment.C @@ -9,7 +9,7 @@ void MakeTPCFullMisAlignment(){ AliCDBStorage* storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); @@ -59,7 +59,7 @@ void MakeTPCFullMisAlignment(){ } } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "TPCfullMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/TPC/MakeTPCResMisAlignment.C b/TPC/MakeTPCResMisAlignment.C index 2c2598bad53..617486c98f5 100644 --- a/TPC/MakeTPCResMisAlignment.C +++ b/TPC/MakeTPCResMisAlignment.C @@ -10,7 +10,7 @@ void MakeTPCResMisAlignment(){ AliCDBStorage* storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); @@ -60,7 +60,7 @@ void MakeTPCResMisAlignment(){ } } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "TPCresidualMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/TPC/MakeTPCZeroMisAlignment.C b/TPC/MakeTPCZeroMisAlignment.C index bb7febc662e..1fa5347ba17 100644 --- a/TPC/MakeTPCZeroMisAlignment.C +++ b/TPC/MakeTPCZeroMisAlignment.C @@ -20,7 +20,7 @@ void MakeTPCZeroMisAlignment(){ } } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "TPCzeroMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/TRD/MakeTRDFullMisAlignment.C b/TRD/MakeTRDFullMisAlignment.C index d60f2928926..4474c74b995 100644 --- a/TRD/MakeTRDFullMisAlignment.C +++ b/TRD/MakeTRDFullMisAlignment.C @@ -11,9 +11,10 @@ void MakeTRDFullMisAlignment(){ cdb->SetRun(0); AliCDBStorage* storage; + TString Storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ - TString Storage = gSystem->Getenv("STORAGE"); + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ + Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); return; @@ -35,38 +36,26 @@ void MakeTRDFullMisAlignment(){ // load FRAME full misalignment objects (if needed, the macro // for FRAME has to be ran in advance) and apply them to geometry - Info(macroname,"Loading FRAME alignment objects from CDB storage %s", - Storage.Data()); AliCDBPath fpath("GRP","Align","Data"); - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ - AliCDBEntry *eFrame = storage->Get(fpath.GetPath(),cdb->GetRun()); - if(!entry) Fatal(macroname,"Could not get the specified CDB entry!"); - TClonesArray* arFrame = (TClonesArray*) eFrame->GetObject(); - arFrame->Sort(); - Int_t nvols = arFrame->GetEntriesFast(); - Bool_t flag = kTRUE; - for(Int_t j=0; jUncheckedAt(j); - if (alobj->ApplyToGeometry() == kFALSE) flag = kFALSE; - } - if(!flag) - Fatal(macroname,"Error in the application of FRAME objects"); + AliCDBEntry *eFrame; + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ + Info(macroname,"Loading FRAME alignment objects from CDB storage %s", + Storage.Data()); + eFrame = storage->Get(fpath.GetPath(),cdb->GetRun()); }else{ - AliCDBEntry *eFrame = cdb->Get(fpath.GetPath()); - if(!entry) Fatal(macroname,"Could not get the specified CDB entry!"); - TClonesArray* arFrame = (TClonesArray*) eFrame->GetObject(); - arFrame->Sort(); - Int_t nvols = arFrame->GetEntriesFast(); - Bool_t flag = kTRUE; - for(Int_t j=0; jUncheckedAt(j); - if (alobj->ApplyToGeometry() == kFALSE) flag = kFALSE; - } - if(!flag) - Fatal(macroname,"Error in the application of FRAME objects"); + eFrame = cdb->Get(fpath.GetPath()); } + if(!eFrame) Fatal(macroname,"Could not get the specified CDB entry!"); + TClonesArray* arFrame = (TClonesArray*) eFrame->GetObject(); + arFrame->Sort(); + Int_t nvols = arFrame->GetEntriesFast(); + Bool_t flag = kTRUE; + for(Int_t j=0; jUncheckedAt(j); + if (alobj->ApplyToGeometry() == kFALSE) flag = kFALSE; + } + if(!flag) Fatal(macroname,"Error in the application of FRAME objects"); // sigmas for the supermodules @@ -86,6 +75,7 @@ void MakeTRDFullMisAlignment(){ Double_t chry=1.0/1000/TMath::Pi()*180; // 1 mrad Double_t chrz=0.7/1000/TMath::Pi()*180; // 0.7 mrad + Int_t sActive[18]={0,0,1,1,1,0,1,0,0,0,0,1,1,0,1,1,0,0}; Double_t dx,dy,dz,rx,ry,rz; Int_t j=0; @@ -94,8 +84,8 @@ void MakeTRDFullMisAlignment(){ const char *symname; // create the supermodules' alignment objects - for (int i; i<18; i++) { - TString sm_symname(Form("TRD/sm%02d",i)); + for (int iSect; iSect<18; iSect++) { + TString sm_symname(Form("TRD/sm%02d",iSect)); ran->Rannor(dx,rx); ran->Rannor(dy,ry); ran->Rannor(dz,rz); @@ -105,21 +95,28 @@ void MakeTRDFullMisAlignment(){ rx*=smrx; ry*=smry; rz*=smrz; + if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue; new((*array)[j++]) AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kFALSE); } - - for(Int_t k=0; k<18; k++){ - AliAlignObjParams* smobj = (AliAlignObjParams*)array->UncheckedAt(k); + // apply supermodules' alignment objects + Int_t smCounter=0; + for(Int_t iSect=0; iSect<18; iSect++){ + if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue; + AliAlignObjParams* smobj = + (AliAlignObjParams*)array->UncheckedAt(smCounter++); if(!smobj->ApplyToGeometry()){ - cout<<"application of object "<Rannor(dx,rx); ran->Rannor(dy,ry); ran->Rannor(dz,rz); @@ -129,13 +126,16 @@ void MakeTRDFullMisAlignment(){ rx*=chrx; ry*=chry; rz*=chrz; - volid = AliGeomManager::LayerToVolUID(iLayer,iModule); + chId++; + volid = AliGeomManager::LayerToVolUID(iLayer,chId); symname = AliGeomManager::SymName(volid); + if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue; new((*array)[j++]) AliAlignObjParams(symname,volid,dx,dy,dz,rx,ry,rz,kFALSE); } } + } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "TRDfullMisalignment.root"; TFile f(filename,"RECREATE"); @@ -162,4 +162,3 @@ void MakeTRDFullMisAlignment(){ array->Delete(); } - diff --git a/TRD/MakeTRDResMisAlignment.C b/TRD/MakeTRDResMisAlignment.C index b73d7e3b2ca..3c8df28de51 100644 --- a/TRD/MakeTRDResMisAlignment.C +++ b/TRD/MakeTRDResMisAlignment.C @@ -12,7 +12,7 @@ void MakeTRDResMisAlignment(){ AliCDBStorage* storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); @@ -41,6 +41,7 @@ void MakeTRDResMisAlignment(){ Double_t chry=0.3/1000/TMath::Pi()*180; // 0.3 mrad Double_t chrz=0.1/1000/TMath::Pi()*180; // 0.1 mrad + Int_t sActive[18]={0,0,1,1,1,0,1,0,0,0,0,1,1,0,1,1,0,0}; Double_t dx=0.,dy=0.,dz=0.,rx=0.,ry=0.,rz=0.; Int_t j=0; @@ -49,15 +50,19 @@ void MakeTRDResMisAlignment(){ const char* symname; // create the supermodules' alignment objects - for (int i; i<18; i++) { - TString sm_symname(Form("TRD/sm%02d",i)); + for (Int_t iSect=0; iSect<18; iSect++) { + TString sm_symname(Form("TRD/sm%02d",iSect)); + if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue; new((*array)[j++]) AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kTRUE); } // create the chambers' alignment objects + Int_t chId; for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) { - for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(iLayer); iModule++) { + chId=-1; + for (Int_t iSect = 0; iSect < 18; iSect++){ + for (Int_t iCh = 0; iCh < 5; iCh++) { ran->Rannor(dx,rx); ran->Rannor(dy,ry); ran->Rannor(dz,rz); @@ -67,13 +72,16 @@ void MakeTRDResMisAlignment(){ rx*=chrx; ry*=chry; rz*=chrz; - volid = AliGeomManager::LayerToVolUID(iLayer,iModule); + chId++; + volid = AliGeomManager::LayerToVolUID(iLayer,chId); symname = AliGeomManager::SymName(volid); + if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue; new(alobj[j++]) AliAlignObjParams(symname,volid,dx,dy,dz,rx,ry,rz,kFALSE); } } + } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "TRDresidualMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/TRD/MakeTRDZeroMisAlignment.C b/TRD/MakeTRDZeroMisAlignment.C index 6a81f23670e..f229c0e0c19 100644 --- a/TRD/MakeTRDZeroMisAlignment.C +++ b/TRD/MakeTRDZeroMisAlignment.C @@ -5,7 +5,7 @@ void MakeTRDZeroMisAlignment(){ TClonesArray *array = new TClonesArray("AliAlignObjParams",1000); TClonesArray &alobj = *array; - + Int_t sActive[18]={0,0,1,1,1,0,1,0,0,0,0,1,1,0,1,1,0,0}; Double_t dx=0.,dy=0.,dz=0.,rx=0.,ry=0.,rz=0.; Int_t j=0; @@ -13,21 +13,28 @@ void MakeTRDZeroMisAlignment(){ const char *symname; // create the supermodules' alignment objects - for (int i; i<18; i++) { - TString sm_symname(Form("TRD/sm%02d",i)); + for (Int_t iSect; iSect<18; iSect++) { + TString sm_symname(Form("TRD/sm%02d",iSect)); + if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue; new(alobj[j++]) AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kTRUE); } // create the chambers' alignment objects + Int_t chId; for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) { - for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(iLayer); iModule++) { - volid = AliGeomManager::LayerToVolUID(iLayer,iModule); + chId=-1; + for (Int_t iSect = 0; iSect < 18; iSect++){ + for (Int_t iCh = 0; iCh < 5; iCh++) { + chId++; + volid = AliGeomManager::LayerToVolUID(iLayer,chId); symname = AliGeomManager::SymName(volid); + if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue; new(alobj[j++]) AliAlignObjParams(symname,volid,dx,dy,dz,rx,ry,rz,kTRUE); } } + } - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "TRDzeroMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/VZERO/MakeVZEROFullMisAlignment.C b/VZERO/MakeVZEROFullMisAlignment.C index 6e3003541fa..edd963262a7 100644 --- a/VZERO/MakeVZEROFullMisAlignment.C +++ b/VZERO/MakeVZEROFullMisAlignment.C @@ -13,7 +13,7 @@ void MakeVZEROFullMisAlignment(){ AliCDBStorage* storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); @@ -63,7 +63,7 @@ void MakeVZEROFullMisAlignment(){ new(alobj[1]) AliAlignObjParams(V0left, volid, dx, dy, dz, dpsi, dtheta, dphi,kFALSE); - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "VZEROfullMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/VZERO/MakeVZEROResMisAlignment.C b/VZERO/MakeVZEROResMisAlignment.C index ec7214d572b..ccc7a6a8b0f 100644 --- a/VZERO/MakeVZEROResMisAlignment.C +++ b/VZERO/MakeVZEROResMisAlignment.C @@ -13,7 +13,7 @@ void MakeVZEROResMisAlignment(){ AliCDBStorage* storage; - if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); @@ -61,7 +61,7 @@ void MakeVZEROResMisAlignment(){ dphi = rnd->Gaus(0.,sigmarot); new(alobj[1]) AliAlignObjParams(V0left, volid, dx, dy, dz, dpsi, dtheta, dphi,kFALSE); - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "VZEROresidualMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/VZERO/MakeVZEROZeroMisAlignment.C b/VZERO/MakeVZEROZeroMisAlignment.C index 1fc782ea7b6..e41b4e7e739 100644 --- a/VZERO/MakeVZEROZeroMisAlignment.C +++ b/VZERO/MakeVZEROZeroMisAlignment.C @@ -17,7 +17,7 @@ void MakeVZEROZeroMisAlignment(){ TString V0left("VZERO/V0A"); new(alobj[1]) AliAlignObjParams(V0left.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE); - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "VZEROzeroMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/ZDC/MakeZDCFullMisAlignment.C b/ZDC/MakeZDCFullMisAlignment.C index e79f6eb3ed4..7db06f7ae8a 100644 --- a/ZDC/MakeZDCFullMisAlignment.C +++ b/ZDC/MakeZDCFullMisAlignment.C @@ -19,7 +19,7 @@ void MakeZDCFullMisAlignment(){ new(alobj[0]) AliAlignObjParams(ZDCn, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); new(alobj[1]) AliAlignObjParams(ZDCp, volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE); - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save in file const char* filename = "ZDCfullMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/ZDC/MakeZDCResMisAlignment.C b/ZDC/MakeZDCResMisAlignment.C index c9c42462e5f..ce1b4983139 100644 --- a/ZDC/MakeZDCResMisAlignment.C +++ b/ZDC/MakeZDCResMisAlignment.C @@ -19,7 +19,7 @@ void MakeZDCResMisAlignment(){ new(alobj[0]) AliAlignObjParams(ZDCn, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); new(alobj[1]) AliAlignObjParams(ZDCp, volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE); - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save in file const char* filename = "ZDCresidualMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/ZDC/MakeZDCZeroMisAlignment.C b/ZDC/MakeZDCZeroMisAlignment.C index 227b18d5305..5cbd2391ce1 100644 --- a/ZDC/MakeZDCZeroMisAlignment.C +++ b/ZDC/MakeZDCZeroMisAlignment.C @@ -19,7 +19,7 @@ void MakeZDCZeroMisAlignment(){ new(alobj[0]) AliAlignObjParams(ZDCn, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); new(alobj[1]) AliAlignObjParams(ZDCp, volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE); - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save in file const char* filename = "ZDCzeroMisalignment.root"; TFile f(filename,"RECREATE"); diff --git a/macros/GetARversion.C b/macros/GetARversion.C new file mode 100644 index 00000000000..ac5e2b40ff6 --- /dev/null +++ b/macros/GetARversion.C @@ -0,0 +1,27 @@ +const char* GetARversion(){ +//void GetARversion(){ + // Returns AliRoot version extracted from what is found in the + // $ALICE_ROOT/CVS/ directory + // + TString vAli; + const char* vFile = gSystem->ExpandPathName("$ALICE_ROOT/CVS/Tag"); + if(gSystem->AccessPathName(vFile)){ + vAli="HEAD"; + }else{ + TFile *fv= TFile::Open("$ALICE_ROOT/CVS/Tag?filetype=raw","READ"); + Int_t size = fv->GetSize(); + char *buf = new Char_t[size]; + memset(buf, '\0', size); + fv->Seek(0); + if ( fv->ReadBuffer(buf, size) ) { + Warning("GetARversion.C","Error reading AliRoot version from file to buffer!"); + vAli=""; + } + vAli = buf; + if(vAli.Contains('\n')) vAli.Remove(vAli.First('\n')); + if(vAli.Contains('v')) vAli.Remove(0,vAli.First('v')); + } + delete vFile; + return vAli.Data(); +} + diff --git a/macros/MakeAllDETsFullMisAlignment.C b/macros/MakeAllDETsFullMisAlignment.C index 4d2ed9f2a6d..04ab1967012 100644 --- a/macros/MakeAllDETsFullMisAlignment.C +++ b/macros/MakeAllDETsFullMisAlignment.C @@ -1,6 +1,4 @@ -const char* GetARversion(); - -void MakeAllDETsFullMisAlignment(Char_t* CDBstorage = "local://$HOME/Full"){ +void MakeAllDETsFullMisAlignment(Char_t* CDBstorage = "local://$HOME/FullMisAlignment", Bool_t partialGeom=kFALSE){ // 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 @@ -17,8 +15,14 @@ void MakeAllDETsFullMisAlignment(Char_t* CDBstorage = "local://$HOME/Full"){ }else{ gSystem->Setenv("TOCDB","kTRUE"); gSystem->Setenv("STORAGE",strStorage.Data()); + gROOT->ProcessLine(".L $ALICE_ROOT/macros/GetARversion.C"); gSystem->Setenv("ARVERSION",GetARversion()); } + if(partialGeom){ + gSystem->Setenv("PARTGEOM","kTRUE"); + }else{ + gSystem->Setenv("PARTGEOM","kFALSE"); + } // Load geometry from CDB updating it if we are producing the // alignment objects for the CDB @@ -32,7 +36,11 @@ void MakeAllDETsFullMisAlignment(Char_t* CDBstorage = "local://$HOME/Full"){ // update geometry in it Info(macroname,"Updating geometry in CDB storage %s",strStorage.Data()); gROOT->ProcessLine(".L $ALICE_ROOT/GRP/UpdateCDBIdealGeom.C"); - UpdateCDBIdealGeom(strStorage.Data()); + if(partialGeom){ + UpdateCDBIdealGeom(strStorage.Data(),"$ALICE_ROOT/macros/Config_PDC06.C"); + }else{ + UpdateCDBIdealGeom(strStorage.Data(),"$ALICE_ROOT/macros/Config.C"); + } // load the same geometry from given CDB storage AliCDBPath path("GRP","Geometry","Data"); AliCDBStorage* storage = cdb->GetStorage(strStorage.Data()); @@ -69,23 +77,3 @@ void MakeAllDETsFullMisAlignment(Char_t* CDBstorage = "local://$HOME/Full"){ return; } -const char* GetARversion(){ - // Get AliRoot version from $ALICE_ROOT/CVS/Repository file - // It's the best we can do without a GetVersion() method - TFile *fv= TFile::Open("$ALICE_ROOT/CVS/Repository?filetype=raw","READ"); - Int_t size = fv->GetSize(); - char *buf = new Char_t[size]; - memset(buf, '\0', size); - fv->Seek(0); - const char* alirootv; - if ( fv->ReadBuffer(buf, size) ) { - Printf("Error reading AliRoot version from file to buffer!"); - alirootv = ""; - } - if(buf=="AliRoot"){ - alirootv="HEAD"; - }else{ - alirootv = buf; - } - return alirootv; -} diff --git a/macros/MakeAllDETsResMisAlignment.C b/macros/MakeAllDETsResMisAlignment.C index 80646dfdaae..77f8f5df1b9 100644 --- a/macros/MakeAllDETsResMisAlignment.C +++ b/macros/MakeAllDETsResMisAlignment.C @@ -1,6 +1,4 @@ -const char* GetARversion(); - -void MakeAllDETsResMisAlignment(Char_t* CDBstorage = "local://$HOME/Residual"){ +void MakeAllDETsResMisAlignment(Char_t* CDBstorage = "local://$HOME/ResidualMisAlignment", Bool_t partialGeom=kFALSE){ // 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 @@ -17,8 +15,14 @@ void MakeAllDETsResMisAlignment(Char_t* CDBstorage = "local://$HOME/Residual"){ }else{ gSystem->Setenv("TOCDB","kTRUE"); gSystem->Setenv("STORAGE",strStorage.Data()); + gROOT->ProcessLine(".L $ALICE_ROOT/macros/GetARversion.C"); gSystem->Setenv("ARVERSION",GetARversion()); } + if(partialGeom){ + gSystem->Setenv("PARTGEOM","kTRUE"); + }else{ + gSystem->Setenv("PARTGEOM","kFALSE"); + } // Load geometry from CDB updating it if we are producing the // alignment objects for the CDB @@ -32,7 +36,11 @@ void MakeAllDETsResMisAlignment(Char_t* CDBstorage = "local://$HOME/Residual"){ // update geometry in it Info(macroname,"Updating geometry in CDB storage %s",strStorage.Data()); gROOT->ProcessLine(".L $ALICE_ROOT/GRP/UpdateCDBIdealGeom.C"); - UpdateCDBIdealGeom(strStorage.Data()); + if(partialGeom){ + UpdateCDBIdealGeom(strStorage.Data(),"$ALICE_ROOT/macros/Config_PDC06.C"); + }else{ + UpdateCDBIdealGeom(strStorage.Data(),"$ALICE_ROOT/macros/Config.C"); + } // load the same geometry from given CDB storage AliCDBPath path("GRP","Geometry","Data"); AliCDBStorage* storage = cdb->GetStorage(strStorage.Data()); @@ -69,23 +77,3 @@ void MakeAllDETsResMisAlignment(Char_t* CDBstorage = "local://$HOME/Residual"){ return; } -const char* GetARversion(){ - // Get AliRoot version from $ALICE_ROOT/CVS/Repository file - // It's the best we can do without a GetVersion() method - TFile *fv= TFile::Open("$ALICE_ROOT/CVS/Repository?filetype=raw","READ"); - Int_t size = fv->GetSize(); - char *buf = new Char_t[size]; - memset(buf, '\0', size); - fv->Seek(0); - const char* alirootv; - if ( fv->ReadBuffer(buf, size) ) { - Printf("Error reading AliRoot version from file to buffer!"); - alirootv = ""; - } - if(buf=="AliRoot"){ - alirootv="HEAD"; - }else{ - alirootv = buf; - } - return alirootv; -} diff --git a/macros/MakeAllDETsZeroMisAlignment.C b/macros/MakeAllDETsZeroMisAlignment.C index 37daf1dd174..bfd152fce45 100644 --- a/macros/MakeAllDETsZeroMisAlignment.C +++ b/macros/MakeAllDETsZeroMisAlignment.C @@ -1,6 +1,4 @@ -const char* GetARversion(); - -void MakeAllDETsZeroMisAlignment(Char_t* CDBstorage = "local://$ALICE_ROOT"){ +void MakeAllDETsZeroMisAlignment(Char_t* CDBstorage = "local://$HOME/ZeroMisAlignment", Bool_t partialGeom=kFALSE){ // 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 @@ -14,8 +12,14 @@ void MakeAllDETsZeroMisAlignment(Char_t* CDBstorage = "local://$ALICE_ROOT"){ }else{ gSystem->Setenv("TOCDB","kTRUE"); gSystem->Setenv("STORAGE",strStorage.Data()); + gROOT->ProcessLine(".L $ALICE_ROOT/macros/GetARversion.C"); gSystem->Setenv("ARVERSION",GetARversion()); } + if(partialGeom){ + gSystem->Setenv("PARTGEOM","kTRUE"); + }else{ + gSystem->Setenv("PARTGEOM","kFALSE"); + } // Load geometry from CDB updating it if we are producing the // alignment objects for the CDB @@ -29,7 +33,11 @@ void MakeAllDETsZeroMisAlignment(Char_t* CDBstorage = "local://$ALICE_ROOT"){ // update geometry in it Info(macroname,"Updating geometry in CDB storage %s",strStorage.Data()); gROOT->ProcessLine(".L $ALICE_ROOT/GRP/UpdateCDBIdealGeom.C"); + if(partialGeom){ + UpdateCDBIdealGeom(strStorage.Data(),"$ALICE_ROOT/macros/Config_PDC06.C"); + }else{ UpdateCDBIdealGeom(strStorage.Data(),"$ALICE_ROOT/macros/Config.C"); + } // load the same geometry from given CDB storage AliCDBPath path("GRP","Geometry","Data"); AliCDBStorage* storage = cdb->GetStorage(strStorage.Data()); @@ -66,23 +74,3 @@ void MakeAllDETsZeroMisAlignment(Char_t* CDBstorage = "local://$ALICE_ROOT"){ return; } -const char* GetARversion(){ - // Get AliRoot version from $ALICE_ROOT/CVS/Repository file - // It's the best we can do without a GetVersion() method - TFile *fv= TFile::Open("$ALICE_ROOT/CVS/Repository?filetype=raw","READ"); - Int_t size = fv->GetSize(); - char *buf = new Char_t[size]; - memset(buf, '\0', size); - fv->Seek(0); - const char* alirootv; - if ( fv->ReadBuffer(buf, size) ) { - Printf("Error reading AliRoot version from file to buffer!"); - alirootv = ""; - } - if(buf=="AliRoot"){ - alirootv="HEAD"; - }else{ - alirootv = buf; - } - return alirootv; -} -- 2.43.0