Beispiel #1
0
void
PrintAlignment()
{
  AliCDBManager* cdb   = AliCDBManager::Instance();
  cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  AliCDBEntry*   align = cdb->Get("FMD/Align/Data");
  if (!align) {
    Error("PrintAlignment","didn't alignment data from CDB");
    return;
  }
  
  TClonesArray* array = dynamic_cast<TClonesArray*>(align->GetObject());
  if (!array) {
    Warning("PrintAlignement", "Invalid align data from CDB");
    return;
  }
  Int_t nAlign = array->GetEntries();
  for (Int_t i = 0; i < nAlign; i++) {
    AliAlignObjParams* a = static_cast<AliAlignObjParams*>(array->At(i));
    Double_t ang[3];
    Double_t trans[3];
    a->GetAngles(ang);
    a->GetTranslation(trans);
    std::cout << a->GetVolPath() << "\n" 
	      << "  translation: "
	      << "(" << std::setw(12) << trans[0] 
	      << "," << std::setw(12) << trans[1] 
	      << "," << std::setw(12) << trans[2] << ")\n"
	      << "  rotation:    "
	      << "(" << std::setw(12) << ang[0] 
	      << "," << std::setw(12) << ang[1] 
	      << "," << std::setw(12) << ang[2]  << ")" << std::endl;
    // a->Print();
  }
}
Beispiel #2
0
Bool_t ChangeRunRange(const char* objectPath,
                      int run1=0, int run2=AliCDBRunRange::Infinity(),
                      const char* inputOCDB="alien://folder=/alice/data/2013/OCDB",
                      const char* outputOCDB="alien://folder=/alice/cern.ch/user/l/laphecet/OCDB2013") 
{
  AliCDBManager* man = AliCDBManager::Instance();
  
  man->SetDefaultStorage(inputOCDB);
  
  AliCDBEntry* e = man->Get(objectPath,AliCDBRunRange::Infinity());
  
  if (!e)
  {
    cout << Form("ERROR : could not get %s from %s",objectPath,inputOCDB) << endl;
    return kFALSE;
  }
  
  e->GetId().SetRunRange(run1,run2);
  
  AliCDBMetaData* md = e->GetMetaData();
  
  md->SetResponsible("L. Aphecetche and P. Pillot"); // to insure we have no $Id$ in the metadata fields (see https://savannah.cern.ch/bugs/?95527)
  
  man->SetDefaultStorage(outputOCDB);
 
  return man->Put(e->GetObject(),e->GetId(),e->GetMetaData());
}
Beispiel #3
0
void PatchCDB(const char* runlist, const char* runlist1400, const char* srcOCDBPath="alien://folder=/alice/data/2016/OCDB", const char* destOCDBPath="alien://folder=/alice/cern.ch/user/l/laphecet/OCDBCH3L")
{
    // function to patch the OCDB MUON/Calib/HV for the swap of CH3L Q2S1 and Q2S2
    // runlist = full list of runs where Chamber03Left/Quad2Sect1 has an HV problem (trips, too low, plus the 1400 V
    // below)
    // runlist1400 = list of runs where Chamber03Left/Quad2Sect1 was struggling at 1400 V
    // for the runs in runlist1400, the HV will be forced to zero for that sector
    // note that Chamber03Left/Quad2Sect1 = Chamber02Left/Quad1Sect0 in DCS alias world
     
  AliAnalysisTriggerScalers ts(runlist,srcOCDBPath);

  std::vector<int> vrunlist = ts.GetRunList();

  AliAnalysisTriggerScalers ts1400(runlist1400,srcOCDBPath);
  std::vector<int> vrunlist1400 = ts1400.GetRunList();

  AliCDBManager* man = AliCDBManager::Instance();

  TObjString sector2("MchHvLvLeft/Chamber02Left/Quad1Sect0.actual.vMon");
  TObjString sector1("MchHvLvLeft/Chamber02Left/Quad1Sect1.actual.vMon");

  for ( auto r : vrunlist )
  {
      man->SetDefaultStorage(srcOCDBPath);
      man->SetRun(r);
      std::cout << "Run " << r << std::endl;

      AliCDBEntry* entry = man->Get("MUON/Calib/HV");
      TMap* hvmap = static_cast<TMap*>(entry->GetObject()->Clone());

      TPair* p1 = hvmap->RemoveEntry(&sector2);

      if ( std::find(vrunlist1400.begin(),vrunlist1400.end(),r) != vrunlist1400.end() )
      {
        TObjArray* a1 = static_cast<TObjArray*>(p1->Value());
        AliDCSValue* first = static_cast<AliDCSValue*>(a1->First());
        AliDCSValue* last = static_cast<AliDCSValue*>(a1->Last());
        a1->Delete();
        a1->Add(new AliDCSValue(0.0f,first->GetTimeStamp()));
        a1->Add(new AliDCSValue(0.0f,last->GetTimeStamp()));
      }
      TPair* p2 = hvmap->RemoveEntry(&sector1);

      hvmap->Add(new TObjString(sector2),p2->Value());
      hvmap->Add(new TObjString(sector1),p1->Value());

      delete p1->Key();
      delete p2->Key();

      man->SetDefaultStorage(destOCDBPath);
      hvmap->SetUniqueID( hvmap->GetUniqueID() | ( 1 << 9 ) );
      AliMUONCDB::WriteToCDB(hvmap,"MUON/Calib/HV",r,r,"Patched for CH3L Quad2Sect1 vs 0 swapping","L. Aphecetche");
      man->ClearCache();
  }
}
AliTOFTriggerMask *
ReadCDBEntryTriggerMask(Int_t run, const Char_t *defaultStorage = "raw://", const Char_t *specificStorage = NULL)
{
  AliCDBManager *cdb = AliCDBManager::Instance();
  cdb->SetDefaultStorage(defaultStorage);
  if (specificStorage)
    cdb->SetSpecificStorage("TRIGGER/TOF/TriggerMask", specificStorage);
  cdb->SetRun(run);
  AliCDBEntry *cdbe = cdb->Get("TRIGGER/TOF/TriggerMask");
  AliTOFTriggerMask *triggerMaskObj = (AliTOFTriggerMask *)cdbe->GetObject();

  return triggerMaskObj;
}
Beispiel #5
0
//_____________________________________________________________________________
void    readCDB (TObject *task1,  Int_t runNumber) {

  Float_t zero_timecdb[24]={0};
  Float_t *timecdb = zero_timecdb;
  Float_t cfdvalue[24][5];
  for(Int_t i=0; i<24; i++)
    for (Int_t i0=0; i0<5; i0++)
      cfdvalue[i][i0] = 0;

  Float_t zero_shiftcdb[4]={0};
  Float_t *shiftcdb = zero_shiftcdb;
  AliT0CalibOffsetChannelsTask *mytask = (AliT0CalibOffsetChannelsTask*)task1;

  AliCDBManager* man = AliCDBManager::Instance();
  AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming");
  if (!entry) ::Fatal("AddTaskT0Calib", "CTP timing parameters are not found in OCDB !");
  AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject();
  Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0;

  AliCDBEntry *entry1 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign");
  if (!entry1) ::Fatal("AddTaskT0Calib", "CTP time-alignment is not found in OCDB !");
  AliCTPTimeParams *ctpTimeAlign = (AliCTPTimeParams*)entry1->GetObject();
  l1Delay += ((Float_t)ctpTimeAlign->GetDelayL1L0()*25.0);

  AliCDBEntry *entry4 = AliCDBManager::Instance()->Get("GRP/Calib/LHCClockPhase");
  if (!entry4) ::Fatal("AddTaskT0Calib", "LHC clock-phase shift is not found in OCDB !");
  AliLHCClockPhase *phase = (AliLHCClockPhase*)entry4->GetObject();
  Float_t fGRPdelays = l1Delay - phase->GetMeanPhase();

  AliCDBEntry* entryGRP = AliCDBManager::Instance()->Get("GRP/GRP/Data");
  AliGRPObject* grpData = dynamic_cast<AliGRPObject*>(entryGRP->GetObject());
  if (!grpData) {
    ::Error("AddTaskT0Calib","Failed to get GRP data for run %d",runNumber);
    return;
  }

  TString LHCperiod = grpData->GetLHCPeriod();
  Bool_t isLHC10b =  LHCperiod.Contains("LHC10b");
  Bool_t isLHC10c =  LHCperiod.Contains("LHC10c");
  //  AliCDBEntry* entryGRP = AliCDBManager::Instance()->Get("GRP/GRP/Data");
  // AliGRPObject* grpData = dynamic_cast<AliGRPObject*>(entryGRP->GetObject());
  UInt_t timeStart = grpData->GetTimeStart();
  UInt_t timeEnd = grpData->GetTimeEnd();
  mytask->SetStartEndTime(timeStart,timeEnd);
  cout<<"T0 start time  "<<timeStart<<" end time "<<timeEnd<<endl;

  ::Info("AddTaskT0Calib","LHCperiod:%s  --->  isLHC10b:%d isLHC10c:%d",
	 LHCperiod.Data(),(Int_t)isLHC10b, (Int_t)isLHC10c);

  if(isLHC10b || isLHC10c) mytask-> SetRefPMT(12,2);

  AliCDBEntry *entryCalib0 = man->Get("T0/Calib/Latency");
  if(!entryCalib0) {
    ::Error("AddTastT0Calib","Cannot find any AliCDBEntry for [Calib, Latency]!");
    return;
  }
  AliT0CalibLatency *calibda=(AliT0CalibLatency*)entryCalib0->GetObject();
  Float_t fLatencyL1 = calibda->GetLatencyL1();
  Float_t fLatencyHPTDC = calibda->GetLatencyHPTDC();

  AliCDBEntry *entryCalib1 = man->Get("T0/Calib/TimeDelay");
  if(!entryCalib1) {
    ::Error("AddTaskT0Calib","Cannot find any AliCDBEntry for [Calib, TimeDelay]!");
    return;
  }
  else
    {
      AliT0CalibTimeEq *clb = (AliT0CalibTimeEq*)entryCalib1->GetObject();
      timecdb = clb->GetTimeEq();
      for(Int_t i=0; i<24; i++)
        for (Int_t i0=0; i0<5; i0++){
          cfdvalue[i][i0] = clb->GetCFDvalue(i, i0);
        }
    }

  for (Int_t i=0; i<24; i++) {
    Float_t cfdmean = cfdvalue[i][0];
    if( cfdvalue[i][0] < 500 || cfdvalue[i][0] > 50000) cfdmean = ( 1000.*fLatencyHPTDC - 1000.*fLatencyL1 + 1000.*fGRPdelays)/24.4;
     mytask->SetCFDvalue(i, cfdmean);
    mytask->SetTimeEq(i, timecdb[i]);
  }

  AliCDBEntry *entryCalib2 = man->Get("T0/Calib/TimeAdjust");
  if(!entryCalib2) {
    ::Error("AddTaskT0Calib","Cannot find any AliCDBEntry for [Calib, TimeAdjust]!");
  }
 else
    {
      AliT0CalibSeasonTimeShift *clb1 = (AliT0CalibSeasonTimeShift*)entryCalib2->GetObject();
      shiftcdb = clb1->GetT0Means();
    }

  for (Int_t i=0; i<4; i++)  mytask->SetT0Means(i,shiftcdb[i]);
}
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();
}
Beispiel #7
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());
  }
  
}
Beispiel #8
0
Int_t retreiveCalibrationData(Int_t fRunNumber)
{
    AliCDBManager * man = AliCDBManager::Instance() ;
    man->SetDefaultStorage("raw://") ;
    //man->SetDefaultStorage("local://$ALICE_ROOT/OCDB") ;
    man->SetRun(fRunNumber) ;
    AliCDBEntry * bmEntry =  man->Get("PHOS/Calib/EmcBadChannels/") ;

    // Get the BCM for PHOS
    phosBcm = (AliPHOSEmcBadChannelsMap*)bmEntry->GetObject();
    if (!phosBcm)
    {
        std::cerr << "ERROR: Could not get the bad channel map for PHOS" << std::endl;
    }
    else
    {
        Int_t *tmpList = new Int_t[phosBcm->GetNumOfBadChannels()];
        phosBcm->BadChannelIds(tmpList);
        badChannels.resize(0);
        for(Int_t n = 0; n < phosBcm->GetNumOfBadChannels(); n++)
        {
            badChannels.push_back(tmpList[n]);
        }
    }

    // Get the gains for PHOS
    AliCDBPath path("PHOS","Calib","EmcGainPedestals");
    if (path.GetPath())
    {
        AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path);
        if (pEntry)
        {
            phosCalibData = (AliPHOSEmcCalibData*)pEntry->GetObject();

            if (!phosCalibData)
            {
                std::cerr << "ERROR: Could not get calibration data for PHOS" << std::endl;
                return -1;
            }
        }
        else
        {
            std::cerr << "ERROR:  Could not get CDB entry for PHOS calib data" << std::endl;
            return -1;
        }
    }
    AliCDBPath geompath("GRP","Geometry","Data");
    TGeoManager *geoManager = 0;
    if(path.GetPath())
    {
        //      HLTInfo("configure from entry %s", path.GetPath());
        AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(geompath/*,GetRunNo()*/);

        if (pEntry)
        {
            if(geoUtils)
            {
                delete geoUtils;
                geoUtils = 0;
            }
            if(!geoManager) geoManager = (TGeoManager*) pEntry->GetObject();

            if(geoManager)
            {
                geoUtils = new AliPHOSGeoUtils("PHOS", "noCPV");
                geom = new AliPHOSGeometry("PHOS", "noCPV");
            }
            else
            {
                std::cerr << "can not get gGeoManager from OCDB" << std::endl;
            }
        }
        else
        {
            std::cerr << "can not fetch object " <<  path.GetPath().Data() << " from OCDB" << std::endl;
        }
    }
    AliCDBPath recoPath("PHOS", "Calib", "RecoParam");

    if(recoPath.GetPath())
    {
//      HLTInfo("configure from entry %s", path.GetPath());
        AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(recoPath/*,GetRunNo()*/);
        if (pEntry)
        {

            TObjArray *paramArray = dynamic_cast<TObjArray*>(pEntry->GetObject());
            if(paramArray)
            {
                recoParam = dynamic_cast<AliPHOSRecoParam*>((paramArray)->At(0));
            }
            if(!recoParam)
            {
                std::cerr << "can not fetch object reconstruction parameters from " <<  recoPath.GetPath().Data() << std::endl;;
                return -1;
            }
        }
        else
        {
            std::cerr << "can not fetch object " << recoPath.GetPath().Data() <<  " from OCDB" << std::endl;
            return -1;
        }
    }
        createBadChannelMap();

    return 0;
}
Beispiel #9
0
void MakeSnapshot(Int_t run, const char* defStorage, TMap* specStorages, const char* snapshotFileName)
{
    AliCDBManager *cdb = AliCDBManager::Instance();
    cdb->SetDefaultStorage(defStorage);
    cdb->SetRun(run);

    TIter iter(specStorages->GetTable());
    TPair *pair = 0;
    while((pair = dynamic_cast<TPair*> (iter.Next()))){
	TObjString* caltype = dynamic_cast<TObjString*> (pair->Key());
	TObjString* specstor= dynamic_cast<TObjString*> (pair->Value());
	if (caltype && specstor)
	    //TString calType = caltype->GetString();
	    //TString specStor = specstor->GetString();
	    //cdb->SetSpecificStorage(calType.Data(),specStor.Data());
	    cdb->SetSpecificStorage(caltype->GetString().Data(),specstor->GetString().Data());
	else
	    //AliFatal("Error reading info for specific storage")
	    Printf("Error reading info for specific storage");
    }

    // ********************************** GRP ******************************************
    cdb->Get("GRP/CTP/Config");
    cdb->Get("GRP/Calib/LHCClockPhase");
    cdb->Get("GRP/GRP/Data");
    cdb->Get("GRP/Align/Data");
    cdb->Get("GRP/Calib/MeanVertexSPD");
    cdb->Get("GRP/Calib/MeanVertex");
    cdb->Get("GRP/Calib/MeanVertexTPC");
    cdb->Get("GRP/Calib/CosmicTriggers");
    cdb->Get("GRP/CTP/Scalers");
    cdb->Get("GRP/CTP/CTPtiming");
    cdb->Get("GRP/CTP/TimeAlign");
    cdb->Get("GRP/GRP/LHCData");
    cdb->Get("GRP/Calib/RecoParam");

    // ********************************** ALL ******************************************
    TString detStr = ("ITS TPC TRD TOF PHOS HMPID EMCAL MUON ZDC PMD T0 VZERO");
    //TString detStr = ("ITS MUON TPC");
    TObjArray *arr = detStr.Tokenize(' ');
    for (Int_t iDet=0; iDet<arr->GetEntries(); iDet++) {
	TObjString *detOStr = dynamic_cast<TObjString*>(arr->At(iDet));
	AliCDBManager::Instance()->GetAll(Form("%s/Calib/*",detOStr->GetString().Data()));
	AliCDBManager::Instance()->Get(Form("%s/Align/Data",detOStr->GetString().Data()));
    }

    // ******************************** TRIGGER ****************************************
    // Temporary fix - one has to define the correct policy in order
    // to load the trigger OCDB entries only for the detectors that
    // in the trigger or that are needed in order to put correct
    // information in ESD
    AliCDBManager::Instance()->GetAll("TRIGGER/*/*");

    // ********************************** HLT ******************************************
    // cdb->Get("HLT/ConfigHLT/esdLayout");
    // cdb->Get("HLT/Calib/StreamerInfo");

    TMap* entriesMap = const_cast<TMap*>(cdb->GetEntryCache());
    Printf("\nentriesMap has %d entries!\n", entriesMap->GetEntries());

    TList* entriesList = const_cast<TList*>(cdb->GetRetrievedIds());
    Printf("\nentriesList has %d entries!\n", entriesList->GetEntries());

    //TString filename(TString::Format("CDBsnapshot_Run%d.root",run));
    TString filename(snapshotFileName);
    TFile *f = new TFile(filename.Data(),"recreate");
    f->cd();
    f->WriteObject(entriesMap,"entriesMap");
    f->WriteObject(entriesList,"entriesList");
    f->Close();
    entriesMap->SetOwnerKeyValue(kFALSE,kFALSE);
    entriesList->SetOwner(kFALSE);
}
Beispiel #10
0
void sim() {
  Int_t nev = -1;
  Int_t run = 0;
	Int_t nskip = 0;
  const char *fname;
	//	char fnaneopt[1024];
  const char *esdname;
	const char *trgname;
  const char *embrun;
	const char *runtype;
  const char *fnameopt;
	
  if (gSystem->Getenv("DC_RUN")) {
    run = atoi(gSystem->Getenv("DC_RUN"));
  }
  if (gSystem->Getenv("DC_RAWFILE")) {
    fname = gSystem->Getenv("DC_RAWFILE");
  } else {
		printf("DC_RAWFILE is not set and is needed!!!");
		return;
	}
  if (gSystem->Getenv("DC_ESDFILE")) {
    esdname = gSystem->Getenv("DC_ESDFILE");
  } else {
		printf("DC_ESDFILE is not set and is needed!!!");
		return;
	}
  if (gSystem->Getenv("DC_NEVENTS")) {
    nev = atoi(gSystem->Getenv("DC_NEVENTS"));
		//    gSystem->Exec("echo ${DC_NEVENTS} > ${DC_NEVENTS}_${DC_NEVENTS}_0_${DC_NEVENTS}.stat"); // moved after selection!
  }
	if (gSystem->Getenv("DC_EEVENT")) {
		nskip = atoi(gSystem->Getenv("DC_EEVENT"));
	}
	if (gSystem->Getenv("DC_TRGNAME")) {
    trgname = gSystem->Getenv("DC_TRGNAME");
		printf("Looking for %s\n",trgname);
  } else {
		printf("DC_TRGNAME not set, will embedd in all events!!!");
		return;
	}
  if (gSystem->Getenv("CONFIG_EMBEDDING")) {
    embrun = gSystem->Getenv("CONFIG_EMBEDDING");
	} else {
		printf("CONFIG_EMBEDDING is not set and is needed");
		return;
	}
	if (gSystem->Getenv("CONFIG_RUN_TYPE")) {
    runtype = gSystem->Getenv("CONFIG_RUN_TYPE");
	} else {
		printf("CONFIG_RUN_TYPE is not set and is needed");
		return;
	}
	TString sfname(fname);
	
	printf("sim.C: running in %s mode on run %d for %d events and skipping %d esd events\n",embrun,run,nev,nskip);
	printf("sim.C: rawfile %s and esdfile %s \n",sfname.Data(),esdname);
	
  AliSimulation simulator;
  
  // BACKGROUND: Convert raw data to SDigits
  if (!(strcmp(embrun,"kBackground"))){
		
    AliCDBManager *cdbm = AliCDBManager::Instance();
    cdbm->SetDefaultStorage("alien://Folder=/alice/data/2011/OCDB");
    cdbm->SetRun(run);
		
		AliGRPManager grpM;
    grpM.ReadGRPEntry();
    grpM.SetMagField();
    printf("Field is locked now. It cannot be changed in Config.C\n");
		
    simulator.SetMakeSDigits("MUON ITS");
		
		// only physics events
		sfname += "?EventType=7";
		
		// select one trigger ...
		if (trgname){
			AliCDBEntry *grp_ctp = cdbm->Get("GRP/CTP/Config",run);
			AliTriggerConfiguration *trg_conf = (AliTriggerConfiguration *)grp_ctp->GetObject();
			trg_conf->Print();
			TObjArray trg_masks = trg_conf->GetClasses(); // Reference!!!
			std::vector<unsigned char> triggerconfs;
			for(Int_t iobj = 0; iobj < trg_masks.GetEntriesFast(); iobj++){
				AliTriggerClass *trg_class = (AliTriggerClass*)trg_masks.UncheckedAt(iobj);
				AliTriggerCluster *trg_clust = (AliTriggerCluster *)trg_class->GetCluster();
				//				printf("%s %s \n",trg_class->GetName(),trgname);
				if(TString(trg_class->GetName()).Contains(trgname)){
					printf("We will embed into events containing this trigger name(mask): %s(%d)\n",trg_class->GetName(),trg_class->GetMask());
					char triggerbuf[256];
					sprintf(triggerbuf, "?Trigger=%d", trg_class->GetMask());
					sfname += triggerbuf;
					//					triggerconfs.push_back(trg_class->GetMask());
				}
			}
			
			//			Int_t itrg = 0;
			//			printf("Number of Trigger Clusters including MUON: %d\n", (Int_t)triggerconfs.size());
			//    for(std::vector<unsigned char>::iterator it = triggerconfs.begin(); it < triggerconfs.end(); it++)
			//      printf("Trigger Mask %d for MUON: %d\n", itrg++, *it);
			//    filestring += "?EventType=7";
			//    char triggerbuf[256];
			//    Int_t triggerval = 0;
			//    for(std::vector<unsigned char>::iterator it = triggerconfs.begin(); it < triggerconfs.end(); it++)
			//      triggerval += *it;
			//    sprintf(triggerbuf, "?Trigger=%d", triggerval);
			//    filestring += triggerbuf; // This line does the trigger selection. It has to be uncommented if one wants to apply trigger selection
		}
		printf("Filename: %s\n", sfname.Data());
		
		Int_t iSelEvents = simulator.ConvertRaw2SDigits(sfname.Data(),esdname,nev,nskip);
		gSystem->Setenv("DC_NEVENTS",Form("%d",iSelEvents));
		gSystem->Exec("echo $DC_NEVENTS > selev.log");
		//			gSystem->Exec("echo ${DC_NEVENTS} > ${DC_NEVENTS}_${DC_NEVENTS}_0_${DC_NEVENTS}.stat"); // done in simrun.C
		gSystem->Exec("echo in sim.C $DC_NEVENTS");
		return;
	}
	
	// Signal: pure signal
	if (!(strcmp(embrun,"kSignal"))){
		
		if (!gSystem->Getenv("DC_NEVENTS")) {
			printf("DC_NEVENTS is not set and is needed at this step!!!");
			return;
		}
		
		AliCDBManager *cdbm = AliCDBManager::Instance();
		cdbm->SetDefaultStorage("alien://Folder=/alice/data/2011/OCDB");
		cdbm->SetRun(run);
		
		AliGRPManager grpM;
		grpM.ReadGRPEntry();
		grpM.SetMagField();
		printf("Field is locked now. It cannot be changed in Config.C\n");
		
		simulator.SetRunGeneration(kFALSE);
		simulator.SetMakeSDigits("");
		simulator.SetMakeDigitsFromHits("");
	}
	// MERGED: Simulate signal and merge with background
	if (!(strcmp(embrun,"kMerged"))){
		simulator.SetRunGeneration(kTRUE);
		simulator.SetMakeSDigits("MUON ITS");
		simulator.EmbedInto("Background/galice.root",1);
		// THE OCDB PART
		simulator.SetDefaultStorage("alien://Folder=/alice/data/2011/OCDB");
		
		// Read GRP Data from RAW
		simulator.SetSpecificStorage("GRP/GRP/Data","alien://Folder=/alice/data/2011/OCDB");
	}
	
	simulator.SetRunSimulation(kTRUE);
	simulator.SetMakeDigits("MUON ITS");
	simulator.SetRunHLT("");
	//  simulator.SetRunHLT("libAliHLTMUON.so chains=dHLT-sim");
	simulator.SetRunQA(":");
	//  simulator.SetRunQA("MUON:ALL");
	
	//  Mag.field from OCDB
	simulator.UseMagFieldFromGRP();
	
	// THE OCDB PART
	
	// MUON
	//	simulator.SetSpecificStorage("MUON/Calib/Gains","alien://Folder=/alice/simulation/2008/v4-15-Release/Ideal/");
		simulator.SetSpecificStorage("MUON/Align/Data","alien://Folder=/alice/simulation/2008/v4-15-Release/Full/");
	
	// MUON Trigger
	// 	simulator.SetSpecificStorage("MUON/Calib/GlobalTriggerCrateConfig","alien://folder=/alice/simulation/2008/v4-15-Release/Ideal");
	// 	simulator.SetSpecificStorage("MUON/Calib/LocalTriggerBoardMasks","alien://folder=/alice/simulation/2008/v4-15-Release/Ideal");
	// 	simulator.SetSpecificStorage("MUON/Calib/RegionalTriggerConfig","alien://folder=/alice/simulation/2008/v4-15-Release/Ideal");
	// 	simulator.SetSpecificStorage("MUON/Calib/TriggerEfficiency","alien://folder=/alice/simulation/2008/v4-15-Release/Full");
	
	// The rest
	
	simulator.Run(nev);
	
}