Esempio n. 1
0
void MakeTRDResMisAlignment(){
  // Create TClonesArray of residual misalignment objects for TRD
  //
  const char* macroname = "MakeTRDResMisAlignment.C";
  TClonesArray *array = new TClonesArray("AliAlignObjParams",1000);
  TClonesArray &alobj = *array;
   
  // 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
  }    

  // sigmas for the chambers
  Double_t chdx    = 0.002; // 20 microns
  Double_t chdy    = 0.003; // 30 microns
  Double_t chdz    = 0.007; // 70 microns
  Double_t chrx    = 0.0005 / 1000.0 / TMath::Pi()*180; // 0 mrad
  Double_t chry    = 0.0005 / 1000.0 / TMath::Pi()*180; // 0 mrad
  Double_t chrz    = 0.1    / 1000.0 / TMath::Pi()*180; // 0.1 mrad
  // Truncation for the chambers
  Double_t cutChdx = 3.0  * chdx;
  Double_t cutChdy = 3.0  * chdy;
  Double_t cutChdz = 0.14 * chdz;

  Int_t sActive[18]={1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1};
  Double_t dx=0.,dy=0.,dz=0.,rx=0.,ry=0.,rz=0.;

  Int_t j=0;
  UShort_t volid;
  const char* symname; 

  // create the supermodules' alignment objects
  for (Int_t iSect=0; iSect<18; iSect++) {
    TString sm_symname(Form("TRD/sm%02d",iSect));
    if( (TString(gSystem->Getenv("REALSETUP")) == 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++) {
    chId=-1;
    for (Int_t iSect = 0; iSect < 18; iSect++){
      for (Int_t iCh = 0; iCh < 5; iCh++) {
        dx = AliMathBase::TruncatedGaus(0.0,chdx,cutChdx); 
        dy = AliMathBase::TruncatedGaus(0.0,chdy,cutChdy); 
        dz = AliMathBase::TruncatedGaus(0.0,chdz,cutChdz); 
        rx = gRandom->Rndm() * 2.0*chrx - chrx;
        ry = gRandom->Rndm() * 2.0*chry - chry;
        rz = gRandom->Rndm() * 2.0*chrz - chrz;
        chId++;
        if ((iSect==13 || iSect==14 || iSect==15) && iCh==2) continue;
        volid = AliGeomManager::LayerToVolUID(iLayer,chId);
        if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue;
        symname = AliGeomManager::SymName(volid);
        new(alobj[j++]) AliAlignObjParams(symname,volid,dx,dy,dz,rx,ry,rz,kFALSE);
      }
    }
  }

  if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
    // save on file
    const char* filename = "TRDresidualMisalignment.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,"TRDAlignObjs","kSingleKey");
    f.Close();
  }
  else {
    // save in CDB 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,AliCDBRunRange::Infinity());
    storage->Put(array,id,md);
  }

  array->Delete();

}
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
  // 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
  //
  const char* macroname="MakeAllDETsFullMisAlignment.C";

  TString strStorage(CDBstorage);
  if(strStorage.IsNull()){
    gSystem->Setenv("TOCDB","kFALSE");
  }else{  
    gSystem->Setenv("TOCDB","kTRUE");
    gSystem->Setenv("STORAGE",strStorage.Data());
    gSystem->Setenv("ARVERSION",ALIROOT_VERSION);
  }
  if(partialGeom){
    gSystem->Setenv("REALSETUP","kTRUE");
  }else{
    gSystem->Setenv("REALSETUP","kFALSE");
  }

  // Load geometry from CDB updating it if we are producing the
  // alignment objects for the CDB
  AliCDBManager* cdb = AliCDBManager::Instance();
  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  cdb->SetRun(0);
  
  if(strStorage.IsNull()){ //if we produce the objects into a file
    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
  }else{ // if we produce the objects in a CDB storage
    // 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());
    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
    if(!entry) Fatal(macroname,"Couldn't load geometry data from CDB!");
    entry->SetOwner(0);
    TGeoManager* geom = (TGeoManager*) entry->GetObject();
    if (!geom) Fatal(macroname,"Couldn't find TGeoManager in the specified CDB entry!");
    AliGeomManager::SetGeometry(geom);
  }
   
  // run macro for non-sensitive modules
  // (presently generates only FRAME alignment objects)
  gSystem->Exec("aliroot -b -q $ALICE_ROOT/GRP/MakeSTRUCTFullMisAlignment.C");

  // run macros for sensitive modules
  TString sModules="ACORDE,EMCAL,FMD,HMPID,ITS,MUON,PMD,PHOS,T0,TRD,TPC,TOF,VZERO,ZDC";
  TObjArray *detArray = sModules.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;
}
Esempio n. 3
0
void MakeTRDFullMisAlignment(){
  // Create TClonesArray of full misalignment objects for TRD
  // Expects to read objects for FRAME
  // 
  TClonesArray *array = new TClonesArray("AliAlignObjParams",1000);
  const char* macroname = "MakeTRDFullMisAlignment.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;
  TString 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;
    }
    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
  }    
		  
  // load FRAME full misalignment objects (if needed, the macro
  // for FRAME has to be ran in advance) and apply them to geometry
  AliCDBPath fpath("GRP","Align","Data");
  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{
    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; j<nvols; j++)
  {
    AliAlignObj* alobj = (AliAlignObj*) arFrame->UncheckedAt(j);
    if (alobj->ApplyToGeometry() == kFALSE) flag = kFALSE;
  }
  if(!flag) Fatal(macroname,"Error in the application of FRAME objects");

  // Sigmas for the chambers
  Double_t smdx    = 0.3; // 3 mm
  Double_t smdy    = 0.3; // 3 mm
  Double_t smdz    = 0.3; // 3 mm
  Double_t smrx    = 0.4 / 1000.0 / TMath::Pi()*180; // 0.4 mrad
  Double_t smry    = 2.0 / 1000.0 / TMath::Pi()*180; // 2.0 mrad
  Double_t smrz    = 0.4 / 1000.0 / TMath::Pi()*180; // 0.4 mrad
  // Truncation for the chambers
  Double_t cutSmdx = 3.0 * smdx;
  Double_t cutSmdy = 3.0 * smdy;
  Double_t cutSmdz = 3.0 * smdz;

  // Sigmas for the chambers
  Double_t chdx    = 0.05;  // 0.5 mm
  Double_t chdy    = 0.1;   // 1.0 mm
  Double_t chdz    = 0.007; // 70  microns
  Double_t chrx    = 0.0005 / 1000.0 / TMath::Pi()*180; // 0 mrad
  Double_t chry    = 0.0005 / 1000.0 / TMath::Pi()*180; // 0 mrad
  Double_t chrz    = 0.3    / 1000.0 / TMath::Pi()*180; // 0.3 mrad
  // Truncation for the chambers
  Double_t cutChdx = 1.0  * chdx;
  Double_t cutChdy = 1.0  * chdy;
  Double_t cutChdz = 0.14 * chdz;

  Int_t sActive[18]={1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1};
  Double_t dx,dy,dz,rx,ry,rz;

  Int_t j=0;
  UShort_t volid;
  const char *symname;

  // create the supermodules' alignment objects
  for (int iSect; iSect<18; iSect++) {
    TString sm_symname(Form("TRD/sm%02d",iSect));
    dx = AliMathBase::TruncatedGaus(0.0,smdx,cutSmdx); 
    dy = AliMathBase::TruncatedGaus(0.0,smdy,cutSmdy); 
    dz = AliMathBase::TruncatedGaus(0.0,smdz,cutSmdz); 
    rx = gRandom->Rndm() * 2.0*smrx - smrx;
    ry = gRandom->Rndm() * 2.0*smry - smry;
    rz = gRandom->Rndm() * 2.0*smrz - smrz;
    if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue;
    new((*array)[j++]) AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kFALSE);
  }
  // apply supermodules' alignment objects
  Int_t smCounter=0;
  for(Int_t iSect=0; iSect<18; iSect++){
    if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue;
    AliAlignObjParams* smobj =
      (AliAlignObjParams*)array->UncheckedAt(smCounter++);
    if(!smobj->ApplyToGeometry()){
      Fatal(macroname,Form("application of full misalignment object for sector %d failed!",iSect));
      return;
    }
  }

  // create the chambers' alignment objects
  ran = new TRandom(4357);
  Int_t chId;
  for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) {
    chId=-1;
    for (Int_t iSect = 0; iSect < 18; iSect++){
      for (Int_t iCh = 0; iCh < 5; iCh++) {
        dx = AliMathBase::TruncatedGaus(0.0,chdx,cutChdx); 
        dy = AliMathBase::TruncatedGaus(0.0,chdy,cutChdy); 
        dz = AliMathBase::TruncatedGaus(0.0,chdz,cutChdz); 
        rx = gRandom->Rndm() * 2.0*chrx - chrx;
        ry = gRandom->Rndm() * 2.0*chry - chry;
        rz = gRandom->Rndm() * 2.0*chrz - chrz;
        chId++;
        if ((iSect==13 || iSect==14 || iSect==15) && iCh==2) continue;
        volid = AliGeomManager::LayerToVolUID(iLayer,chId);
        if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue;
        symname = AliGeomManager::SymName(volid);
        new((*array)[j++]) AliAlignObjParams(symname,volid,dx,dy,dz,rx,ry,rz,kFALSE);
      }
    }
  }

  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
    // save on file
    const char* filename = "TRDfullMisalignment.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,"TRDAlignObjs","kSingleKey");
    f.Close();
  }else{
    // save in CDB storage
    Info(macroname,"Saving alignment objects in CDB storage %s",
	 Storage.Data());
    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,AliCDBRunRange::Infinity());
    storage->Put(array,id,md);
  }

  array->Delete();
}
Esempio n. 4
0
//______________________________________________________________________________
void CopyCDB(Int_t runnr, const char* fromURI, const char* toURI)
{
  TString allowedObjects;

//  allowedObjects += " HLT/ConfigMUON/DecisionComponent";
//  allowedObjects += " HLT/ConfigMUON/FieldIntegrals";
//  allowedObjects += " HLT/ConfigMUON/HitReconstructor";
//  allowedObjects += " HLT/ConfigMUON/MansoTrackerFSM";
//  allowedObjects += " HLT/ConfigMUON/TriggerReconstructor";
  
  /*
   
  allowedObjects += " GRP/Geometry/Data";
  allowedObjects += " GRP/CTP/Config";
  allowedObjects += " GRP/GRP/LHCData";
  allowedObjects += " GRP/CTP/Scalers";
  allowedObjects += " GRP/GRP/Data";
  allowedObjects += " GRP/Calib/MeanVertexSPD";
  allowedObjects += " GRP/CTP/Aliases";

  allowedObjects += " MUON/Calib/GlobalTriggerCrateConfig";
  allowedObjects += " MUON/Calib/LocalTriggerBoardMasks";
  allowedObjects += " MUON/Calib/MappingData";
  allowedObjects += " MUON/Calib/RegionalTriggerConfig";
  allowedObjects += " MUON/Calib/TriggerLut";
   
  allowedObjects += " MUON/Calib/Config";
  allowedObjects += " MUON/Calib/Gains";
  allowedObjects += " MUON/Calib/GlobalTriggerCrateConfig";
  allowedObjects += " MUON/Calib/HV";
  allowedObjects += " MUON/Calib/LocalTriggerBoardMasks";
  allowedObjects += " MUON/Calib/MappingRunData";
  allowedObjects += " MUON/Calib/Neighbours";
  allowedObjects += " MUON/Calib/OccupancyMap";
  allowedObjects += " MUON/Calib/Pedestals";
  allowedObjects += " MUON/Calib/RecoParam";
  allowedObjects += " MUON/Calib/RegionalTriggerConfig";
  allowedObjects += " MUON/Calib/RejectList";
  allowedObjects += " MUON/Calib/TriggerDCS";
  allowedObjects += " MUON/Calib/TriggerEfficiency";
  allowedObjects += " MUON/Calib/TriggerLut";
  allowedObjects += " MUON/Calib/MappingData";

  allowedObjects += " MUON/Align/Data";

  allowedObjects += " GRP/Align/Data";
  allowedObjects += " ITS/Align/Data";
  allowedObjects += " VZERO/Align/Data";
  allowedObjects += " FMD/Align/Data";  
  allowedObjects += " T0/Align/Data";
  allowedObjects += " TPC/Align/Data";
  allowedObjects += " TRD/Align/Data";
  allowedObjects += " TOF/Align/Data";
  allowedObjects += " ACORDE/Align/Data";

  allowedObjects += " HLT/Calib/esdLayout";
  allowedObjects += " HLT/Calib/RecoParam";
  allowedObjects += " HLT/Calib/StreamerInfo";
  allowedObjects += " PHOS/Align/Data";
  allowedObjects += " EMCAL/Align/Data";
  allowedObjects += " HMPID/Align/Data";
   allowedObjects += " ZDC/Align/Data";
   allowedObjects += " PMD/Align/Data";
   
   
  
  allowedObjects += " GRP/Calib/MeanVertexTPC";
  allowedObjects += " GRP/Calib/CosmicTriggers";
  allowedObjects += " GRP/Calib/LHCClockPhase";
  allowedObjects += " GRP/CTP/CTPtiming";
  allowedObjects += " GRP/CTP/TimeAlign";
  allowedObjects += " GRP/Calib/RecoParam";
  allowedObjects += " GRP/CTP/Aliases";

  allowedObjects += " ITS/Calib/RecoParam";
  allowedObjects += " ITS/Calib/SPDNoisy";
  allowedObjects += " ITS/Calib/SPDDead";
  allowedObjects += " ITS/Calib/SPDSparseDead";
  allowedObjects += " ITS/Calib/CalibSDD";
  allowedObjects += " ITS/Calib/RespSDD";
  allowedObjects += " ITS/Calib/DriftSpeedSDD";
  allowedObjects += " ITS/Calib/DDLMapSDD";
  allowedObjects += " ITS/Calib/MapsTimeSDD";
  allowedObjects += " ITS/Calib/NoiseSSD";
  allowedObjects += " ITS/Calib/GainSSD";
  allowedObjects += " ITS/Calib/BadChannelsSSD";
  allowedObjects += " ITS/Calib/SPDFOEfficiency";
  
  allowedObjects += " ITS/Calib/SPDFONoise";
  
  allowedObjects += " TRIGGER/SPD/PITConditions";
  
  allowedObjects += " AD/Align/Data";
  */
  
  AliCDBManager* cdb = AliCDBManager::Instance();
  // determine dynamically the current year
  TString fromUri(fromURI);
  cdb->SetDefaultStorage(fromUri.Data());
  cdb->SetRun(runnr);
  cdb->SetDrain(toURI);
  TString toUri(toURI);
  
  AliCDBStorage *defaultStorage = cdb->GetDefaultStorage();
  defaultStorage->QueryCDB(runnr);
  TObjArray* allIdsForRun = defaultStorage->GetQueryCDBList();
  TIter next(allIdsForRun);
  AliCDBId* id = 0;
  while ((id = dynamic_cast<AliCDBId*>(next())))
  {
    TString path(id->GetPath());
    if ( !allowedObjects.Contains(path.Data() ) ) continue;

    cdb->Get(path,cdb->GetRun());
  }
  
}
Esempio n. 5
0
void MakeACORDEZeroMisAlignment(){
  // Create TClonesArray of zero misalignment objects for ACORDE
  //
  const char* macroname = "MakeACORDEZeroMisAlignment.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;
  
  //load geom from local file till ACORDE is not switched on by default in standard config-files
  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::LoadGeometry("geometry.root");  

  TClonesArray *array = new TClonesArray("AliAlignObjParams",64);
  TClonesArray &alobj = *array;
  
  TRandom *rnd = new TRandom(4321);
  Int_t j = 0;
  Double_t dx=0, dy=0, dz=0, dpsi=0, dtheta=0, dphi=0;

  // RS = local
  // sigma translation 
  // sigma rotation 
  
  TString symname;
  TString basename = "ACORDE/Array";
  Int_t iIndex=0;
  AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
  UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);

  for (Int_t imod=0; imod<60; imod++){
    symname = basename;
    symname += imod;    
    new(alobj[j++]) AliAlignObjParams(symname, volid, dx, dy, dz,dpsi, dtheta, dphi, kFALSE);
  }

  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
    // save on file
    const char* filename = "ACORDEZeroMisalignment.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,"ACORDEAlignObjs","kSingleKey");
    f.Close();
  }else{
    // save in CDB storage
    AliCDBMetaData* md = new AliCDBMetaData();
    md->SetResponsible("E. Cuautle & M. Rodriguez");
    md->SetComment("Zero misalignment for ACORDE");
    md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
    AliCDBId id("ACORDE/Align/Data",0,AliCDBRunRange::Infinity());
    storage->Put(array,id,md);
  }

  array->Delete();

}
Esempio n. 6
0
void MakeTOFResMisAlignment() {
  //
  // Create TClonesArray of residual misalignment objects for TOF
  //

  const char* macroname = "MakeTOFResMisAlignment.C";

  TClonesArray *array = new TClonesArray("AliAlignObjParams",2000);
  TClonesArray &alobj = *array;
   
  // 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;
  TString 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;
    }
    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 j=0;
  Int_t nSectors=18;

  //Produce objects for TOF supermodules
  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 
  Double_t smdx, smdy, smdz=0., dpsi=0., dtheta, dphi=0.;
  for(Int_t isect=0; isect<nSectors; isect++) {
    TString symname(Form("TOF/sm%02d",isect));
    new(alobj[j++]) AliAlignObjParams(symname.Data(),
				      dvoluid,
				      smdx, smdy, smdz, dpsi, dtheta, dphi, kFALSE);
  }

  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

  Int_t nstrA=15;
  Int_t nstrB=19;
  Int_t nstrC=19;
  Int_t nStrips=nstrA+2*nstrB+2*nstrC;

  Double_t cuty=0., cutz=0., cut=3*sigmatr;
  for (Int_t isect = 0; isect < nSectors; isect++) {
    for (Int_t istr = 1; istr <= nStrips; istr++) {
      //dy = rnd->Gaus(0.,sigmatr);
      //dz = rnd->Gaus(0.,sigmatr);
      //strId++;

      switch (istr) {
      case 25:
      case 29:
      case 63:
      case 67:
	cuty = sigmatr*0.6;
	dy  = AliMathBase::TruncatedGaus(0., sigmatr, cut, cuty);
	dz  = AliMathBase::TruncatedGaus(0., sigmatr, cut);
	strId++;
	break;
	/*
      case 38:
	cuty = sigmatr*2.5;
	cutz = sigmatr*2.5;
	dy  = AliMathBase::TruncatedGaus(0., sigmatr, cut, cuty);
	dz  = AliMathBase::TruncatedGaus(0., sigmatr, cut, cutz);
	strId++;
	break;
      case 54:
	cuty = sigmatr*2.5;
	cutz = sigmatr*2.5;
	dy  = AliMathBase::TruncatedGaus(0., sigmatr, cut, cuty);
	dz  = AliMathBase::TruncatedGaus(0., sigmatr, cutz, cut);
	strId++;
	break;
	*/
      default:
	dy = AliMathBase::TruncatedGaus(0., sigmatr, cut);
	dz = AliMathBase::TruncatedGaus(0., sigmatr, cut);
	strId++;
	break;
      }

      if ((isect==13 || isect==14 || isect==15) && (istr >= 39 && istr <= 53)) continue;
      new(alobj[j++]) AliAlignObjParams(AliGeomManager::SymName(idTOF,strId),
					AliGeomManager::LayerToVolUID(idTOF,strId),
					dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
    }
  }

  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
    // save on file
    const char* filename = "TOFresidualMisalignment.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,"TOFAlignObjs","kSingleKey");
    f.Close();
  } else {
    // save in CDB 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,AliCDBRunRange::Infinity());
    storage->Put(array,id,md);
  }

  array->Delete();

}