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="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("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(); }