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("IlcAlignObjParams",20);

  Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
  IlcGeomManager::ELayerID iLayer = IlcGeomManager::kInvalidLayer;
  UShort_t dvoluid = IlcGeomManager::LayerToVolUID(iLayer,iIndex); //dummy vol id

  const char* basepath ="ILCM_1/B077_1/BSEGMO";
  TString segmpath;

  for(Int_t sm=0; sm<18; sm++){
    segmpath=basepath;
    segmpath+=sm;
    segmpath+="_1";
    cout<<segmpath.Data()<<endl;
    new((*array)[sm]) IlcAlignObjParams(segmpath.Data(),dvoluid,0.,0.,0.,0.,0.,0.,kTRUE);
  }

  if( TString(gSystem->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());
    IlcCDBManager* cdb = IlcCDBManager::Instance();
    IlcCDBStorage* storage = cdb->GetStorage(Storage.Data());
    if(!storage){
      Error(macroname,"Unable to open storage %s\n",Storage.Data());
      return;
    }
    IlcCDBMetaData* md = new IlcCDBMetaData();
    md->SetResponsible("Grosso Raffaele");
    md->SetComment("Zero misalignment for STRUCT: presently includes objects for FRAME");
    md->SetIlcRootVersion(gSystem->Getenv("ARVERSION"));
    IlcCDBId id("GRP/Align/Data",0,IlcCDBRunRange::Infinity());
    storage->Put(array,id,md);
  }

  array->Delete();

}
Esempio n. 2
0
addObjectDuringAODCreation() {

  // add an object to an aod and write it

  TFile *aodFile = TFile::Open("addAOD.root", "RECREATE");

    // create an IlcAOD object 
  IlcAODEvent *aod = new IlcAODEvent();
  aod->CreateStdContent();
  
  // add new information, we use IlcESDtracks for now
  TClonesArray *tracks = new TClonesArray("IlcESDtrack", 0);
  aod->AddObject(tracks);

  // go to the file
  aodFile->cd();
  
  // create the tree
  TTree *aodTree = new TTree("aodTree", "IlcAOD tree");
  aodTree->Branch(aod->GetList());

  for (Int_t iEvent = 0; iEvent < 10; ++iEvent) {
    // add (part of) standard information
    IlcAODHeader *header = aod->GetHeader();

    tracks->Delete(); // delete old objects
    tracks->Expand(iEvent+5/* just to make it a different number each time*/); // expand container (just for speed)
    
    // fill TClonesArray
    TClonesArray &rTracks = *tracks;
    for (Int_t i = 0; i< iEvent+5; i++) {
      new(rTracks[i]) IlcESDtrack();
    }

    // fill the tree for this event
    aodTree->Fill();
  } // end of event loop

  aodTree->GetUserInfo()->Add(aod);

  // write the tree to the specified file
  aodFile = aodTree->GetCurrentFile();
  aodFile->cd();
  aodTree->Write();



}
Esempio n. 3
0
void MakeMFTZeroMisAlignment(TString Storage = "alien://folder=/alice/cern.ch/user/a/auras/OCDB/") {

  // Create TClonesArray of zero misalignment objects for MFT

  const char* macroname = "MakeMFTZeroMisAlignment.C";

  TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
  TClonesArray &alobj = *array;

  Double_t dx=0, dy=0, dz=0, dpsi=0, dtheta=0, dphi=0;

  Int_t iIndex=0;
  AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
  UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);

  TString MFT("MFT");
  new (alobj[0]) AliAlignObjParams(MFT.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);

  // save in CDB 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("Antonio Uras");
  md->SetComment("Alignment objects for MFT zero-misalignment");
  md->SetAliRootVersion(gROOT->GetVersion());
  AliCDBId id("MFT/Align/Data",0,AliCDBRunRange::Infinity());
  storage->Put(array,id,md);

  array->Delete();

}
Esempio n. 4
0
void MergeSetsOfIlcgnObjs(const char* filename1, const char* filename2, const char* det="ITS")
{
  // example macro: building an array by merging the non-SSD entries
  // from one file (or OCDB entry) with the remaining SSD entries taken
  // from another file (or OCDB entry); the first two arguments can be local filenames
  // or URLs of the OCDB folders 
  //  
  const char* macroname = "MergeSetsOfIlcgnObjs";
  
  TClonesArray* array1 = 0;
  TClonesArray* array2 = 0;

  TString arName(det);
  arName+="AlignObjs";
  TString path(det);
  path+="/Align/Data";
  
  TString f1(filename1);
  TString f2(filename2);
  
  IlcCDBStorage* stor1 = 0;
  IlcCDBStorage* stor2 = 0;
  
  Bool_t fromOcdb1=kFALSE;
  Bool_t fromOcdb2=kFALSE;

  if(f1.Contains("alien://folder=") || f1.Contains("local://")) fromOcdb1=kTRUE;
  if(f2.Contains("alien://folder=") || f2.Contains("local://")) fromOcdb2=kTRUE;

  
  IlcCDBManager* cdb = IlcCDBManager::Instance();
  cdb->SetDefaultStorage("local://$ILC_ROOT/OCDB");
  cdb->SetRun(0);
  
  if(fromOcdb1){
    stor1 = cdb->GetStorage(f1.Data());
    IlcCDBEntry* entry = stor1->Get(path.Data(),0);
    array1 = (TClonesArray*) entry->GetObject();
  }else{
    TFile* filein1 = TFile::Open(f1.Data(),"READ");
    if(!filein1)
    {
      Info(macroname,Form("Unable to open file %s! Exiting ...", f1.Data()));
      return;
    }
    array1 = (TClonesArray*) filein1->Get(arName.Data());
  }
  if(array1){
    Info(macroname,Form("First array has %d entries", array1->GetEntriesFast()));
  }else{
    Info(macroname,"Unable to get first array! Exiting ...");
    return;
  }

  if(fromOcdb2){
    stor2 = cdb->GetStorage(f2.Data());
    IlcCDBEntry* entry = stor2->Get(path.Data(),0);
    array2 = (TClonesArray*) entry->GetObject();
  }else{
    TFile* filein2 = TFile::Open(f2.Data(),"READ");
    if(!filein2)
    {
      Info(macroname,Form("Unable to open file %s! Exiting ...", f2.Data()));
      return;
    }
    array2 = (TClonesArray*) filein2->Get(arName.Data());
  }
  if(array2){
    Info(macroname,Form("Second array has %d entries", array2->GetEntriesFast()));
  }else{
    Info(macroname,"Unable to get second array! Exiting ...");
    return;
  }


  TClonesArray *mergedArr = new TClonesArray("IlcAlignObjParams",3000);

  Info(macroname,"Merging objects for SPD and SDD from the first array ...");
  // SSD starts from 500
  for(Int_t i=0; i<500; i++)
  {
    (*mergedArr)[i] = (IlcAlignObjParams*) array1->UncheckedAt(i);
  }
  
  Info(macroname,"Merging objects for SSD from the second array ...");
  for(Int_t i=500; i<array2->GetEntriesFast(); i++)
  {
    (*mergedArr)[i] = (IlcAlignObjParams*) array2->UncheckedAt(i);
  }
  
  TString foutName("merged");
  foutName+=det;
  foutName+="Alignment.root";
  Info(macroname,Form("... in a single array into the file %s", foutName.Data()));
  TFile* fileout = TFile::Open(foutName.Data(),"RECREATE");
  fileout->cd();
  fileout->WriteObject(mergedArr,arName.Data(),"kSingleKey");
  fileout->Close();
  
  mergedArr->Delete();
  
}
Esempio n. 5
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();

}
Esempio n. 6
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. 7
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. 8
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();

}
Esempio n. 9
0
void MakeZDCFullMisAlignment(){
  // Create TClonesArray of full misalignment objects for ZDC
  //
  const char* macroname = "MakeZDCFullMisAlignment.C";

  TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
  TClonesArray &alobj = *array;

  Double_t dx=0., dy=2., dz=0.;
  Double_t dpsi=0., dtheta=0., dphi=0.;

  const char *ZDCCn="ZDC/NeutronZDC_C";
  const char *ZDCCp="ZDC/ProtonZDC_C";
  const char *ZDCAn="ZDC/NeutronZDC_A";
  const char *ZDCAp="ZDC/ProtonZDC_A";

  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(ZDCCn, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
  new(alobj[1]) AliAlignObjParams(ZDCCp, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
  new(alobj[2]) AliAlignObjParams(ZDCAn, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
  new(alobj[3]) AliAlignObjParams(ZDCAp, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);

  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
    // save in file
    const char* filename = "ZDCfullMisalignment.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,"ZDCAlignObjs","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("Chiara Oppedisano");
    md->SetComment("Alignment objects for ZDC full misalignment");
    md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
    AliCDBId id("ZDC/Align/Data",0,AliCDBRunRange::Infinity());
    storage->Put(array,id,md);
  }

  array->Delete();

}