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 */ const char* macroname = "MakePMDFullMisAlignment.C"; // Activate CDB storage and load geometry from CDB AliCDBManager* cdb = AliCDBManager::Instance(); if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); 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 } Float_t max_trans=0.1; Float_t max_rot=0.1; const char *Sector1="PMD/Sector1"; const char *Sector2="PMD/Sector2"; const char *Sector3="PMD/Sector3"; const char *Sector4="PMD/Sector4"; //Sectors 1 and 4 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("AliAlignObjParams",10); TClonesArray &alobj = *array; Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex); new(alobj[0]) AliAlignObjParams(Sector1, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE); new(alobj[1]) AliAlignObjParams(Sector2, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE); 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( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // Create a File to store the alignment data const char* filename = "PMDfullMisalignment.root"; TFile f(filename,"RECREATE"); if(!f){ Error(macroname,"cannot open file for output\n"); return; } Info(macroname,"Saving alignment objects to the file %s", filename); f.cd(); f.WriteObject(array,"PMDAlignObjs","kSingleKey"); f.Close(); }else{ // save in CDB 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,AliCDBRunRange::Infinity()); storage->Put(array,id,md); } array->Delete(); }