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();

}
void MakeLHCClockPhaseEntry(const char *cdbStorage = "local://$ILC_ROOT/OCDB")
{
  // Example macro to put in OCDB the default (=0) LHC-clock phase
  // It is valid fro runs from 0 to inf
  // The timestamp range is also inf (we store the first and last value for
  // each beam)
  IlcCDBManager *man = IlcCDBManager::Instance();
  man->SetDefaultStorage(cdbStorage);

  IlcLHCClockPhase phaseObj;

  phaseObj.AddPhaseB1DP(0,0.);
  phaseObj.AddPhaseB2DP(0,0.);

  phaseObj.AddPhaseB1DP(2147483647,0.);
  phaseObj.AddPhaseB2DP(2147483647,0.);

  IlcCDBMetaData* metadata = new IlcCDBMetaData();
  metadata->SetResponsible("Cvetan Cheshkov");
  metadata->SetComment("Default LHC-clock phase object");
  IlcCDBId id("GRP/Calib/LHCClockPhase",0,IlcCDBRunRange::Infinity());

  man->Put(&phaseObj,id,metadata);

  return;
}
Exemplo n.º 3
0
void CreateMeanVertex(Double_t xmed=0., Double_t ymed=0., Double_t sigx=0.005,Double_t sigy=0.005, Double_t sigz=5.3){
  Double_t resolx=35./10000.;
  Double_t resoly=35./10000.;
  Double_t sigma[3],position[3];
  position[0]=xmed;
  position[1]=ymed;
  position[2]=0.;
  sigma[0]=TMath::Sqrt(sigx*sigx+resolx*resolx);
  sigma[1]=TMath::Sqrt(sigy*sigy+resoly*resoly);
  sigma[2]=sigz;
  IlcESDVertex *vave=new IlcESDVertex(position,sigma,"vtxmean");
  vave->PrintStatus();

  IlcCDBManager* man = IlcCDBManager::Instance();
  man->SetDefaultStorage("local://$ILC_ROOT/OCDB");
  
  IlcCDBId id("GRP/Calib/MeanVertex", 0, IlcCDBRunRange::Infinity());
  IlcCDBMetaData md;
  
  md.SetResponsible("*****@*****.**");
  md.SetComment("Default mean vertex position");
  md.SetIlcRootVersion("Default mean vertex position");
  
  man->Put(vave, id, &md);
  
  man->Destroy();

//  TFile *outf=new TFile("IlcESDMeanVertex.root","recreate");
// outf->cd();
//  vave->Write();
//  outf->Close();
}