void MakeVZEROTimeDelaysEntryRun2()
{

  AliCDBManager *man = AliCDBManager::Instance();
  man->SetDefaultStorage("local://./OCDB");

  // Creation of the time delays OCDB object

  const Double_t timeShift[66] = {0.0 , 263.453366 , 263.554201 , 263.455896 , 263.705908 , 263.178068 , 263.260511 , 263.352692 , 263.371615 , 264.275609 , 263.022590 , 263.923256 , 263.477724 , 263.328535 , 263.338143 , 263.684347 , 263.636735 , 264.240256 , 264.704787 , 263.341181 , 265.875077 , 264.362158 , 264.009584 , 263.985062 , 264.507631 , 264.711630 , 264.702209 , 264.983539 , 265.156149 , 265.340929 , 265.185957 , 265.402229 , 267.060006 , 260.193899 , 260.831277 , 260.870380 , 260.231921 , 259.848971 , 263.069287 , 262.829099 , 261.297212 , 260.468547 , 260.962657 , 260.754787 , 260.782074 , 260.244392 , 263.248285 , 262.224661 , 259.936356 , 262.307604 , 262.698634 , 262.259535 , 262.425491 , 262.041006 , 264.711811 , 264.537483 , 262.019158 , 263.940932 , 263.309260 , 263.819921 , 264.324985 , 263.419804 , 265.954522 , 266.150658 , 263.942502 , 0.0};
  TH1F *delays = new TH1F("VZEROTimeDelays","VZERO Time delays",64,-0.5,63.5);
  delays->SetContent(timeShift);
	
  AliCDBMetaData *md= new AliCDBMetaData(); // metaData describing the object
  md->SetResponsible("Brigitte Cheynis");
  md->SetBeamPeriod(0);
  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
  md->SetComment("Time delays channel by channel for Run2");
  md->PrintMetaData();

  AliCDBId id("VZERO/Calib/TimeDelays",215011,AliCDBRunRange::Infinity());

  man->Put(delays, id, md);

  delete md;

}
Beispiel #2
0
void MakeADLightYieldsEntry(const char *outputCDB = "local://$ALICE_ROOT/../AliRoot/OCDB")
{

  AliCDBManager *man = AliCDBManager::Instance();
  man->SetDefaultStorage(outputCDB);

  // Creation of the light yields OCDB object
  const Double_t lightYieldCorr[18] = {0.0,
				       2.2e-4,2.2e-4,2.2e-4,2.2e-4, 2.2e-4,2.2e-4,2.2e-4,2.2e-4,
                                       2.4e-4,2.4e-4,2.6e-4,2.6e-4, 2.4e-4,2.4e-4,2.6e-4,2.6e-4,
				       0.0};

  TH1F *yields = new TH1F("ADLightYields", "AD Light Yields", 16, -0.5, 15.5);
  yields->SetContent(lightYieldCorr);

  AliCDBMetaData *md = new AliCDBMetaData(); // metaData describing the object
  md->SetResponsible("Michal Broz");
  md->SetBeamPeriod(0);
  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
  md->SetComment("Light Yields channel by channel");
  md->PrintMetaData();

  AliCDBId id("AD/Calib/LightYields", 0, AliCDBRunRange::Infinity());
  man->Put(yields, id, md);

  delete md;

}
Beispiel #3
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 #4
0
void MakeLHCClockPhaseEntry(const char *cdbStorage = "local://$ALICE_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)
  AliCDBManager *man = AliCDBManager::Instance();
  man->SetDefaultStorage(cdbStorage);

  AliLHCClockPhase phaseObj;

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

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

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

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

  return;
}
void MakeVZEROTimeDelaysEntry()
{

  AliCDBManager *man = AliCDBManager::Instance();
  man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");

  // Creation of the time delays OCDB object
  const Double_t timeShift[66] = {0.0 , 0.477957 , 0.0889999 , 0.757669 , 0.205439 , 0.239666 , -0.183705 , 0.442873 , -0.281366 , 0.260976 , 0.788995 , 0.974758 , 0.548532 , 0.495023 , 0.868472 , 0.661167 , 0.358307 , 0.221243 , 0.530179 , 1.26696 , 1.33082 , 1.27086 , 1.77133 , 1.10253 , 0.634806+0.885 , 2.14838 , 1.50212 , 1.59253 , 1.66122+0.740 , 1.16957 , 1.52056 , 1.47791 , 1.81905 , -1.94123 , -1.29124-0.350 , -2.16045 , -1.78939 , -3.11111 , -1.87178 , -1.57671-0.560 , -1.70311 , -1.81208 , -1.94475 , -2.53058+0.930 , -1.7042 , -2.08109 , -1.84416 , -0.61073 , -1.77145 , 0.16999 , -0.0585339 , 0.00401133 , 0.397726 , 0.851111 , 0.264187 , 0.59573 , -0.158263 , 0.584362 , 1.20835 , 0.927573 , 1.13895 , 0.64648 , 2.18747 , 1.68909 , 0.451194 , 0.0};
  TH1F *delays = new TH1F("VZEROTimeDelays","VZERO Time delays",64,-0.5,63.5);
  delays->SetContent(timeShift);
	
  AliCDBMetaData *md= new AliCDBMetaData(); // metaData describing the object
  md->SetResponsible("Brigitte Cheynis");
  md->SetBeamPeriod(0);
  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
  md->SetComment("Time delays channel by channel for year >= 2012");
  md->PrintMetaData();

  AliCDBId id("VZERO/Calib/TimeDelays",0,AliCDBRunRange::Infinity());

  man->Put(delays, id, md);

  delete md;

}
Beispiel #6
0
void MakeADTimeDelaysEntry(const char *outputCDB = "local://$ALICE_ROOT/../AliRoot/OCDB")
{

  AliCDBManager *man = AliCDBManager::Instance();
  man->SetDefaultStorage(outputCDB);

  // Creation of the time delays OCDB object
  //const Double_t timeShift[18] = {0.0, 203.2, 203.4, 203.5, 203.0, 203.4, 203.5, 203.1, 203.2, 194.2, 194.4, 194.5, 194.2, 194.7, 194.5, 194.3, 192.8, 0.0};
  const Double_t timeShift[18] = {0.0, 61.6091, 61.1891, 60.5191, 61.3591, 60.7691, 62.0291, 61.1091, 61.4591, 62.3491, 62.7891, 59.7791, 60.0991, 63.3091, 62.7691, 59.6491, 61.5091, 0.0};
  TH1F *delays = new TH1F("ADTimeDelays", "AD Time delays", 16, -0.5, 15.5);
  delays->SetContent(timeShift);
	
  AliCDBMetaData *md= new AliCDBMetaData(); // metaData describing the object
  md->SetResponsible("Michal Broz");
  md->SetBeamPeriod(0);
  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
  md->SetComment("Time delays channel by channel");
  md->PrintMetaData();

  AliCDBStorage *storLoc = man->GetDefaultStorage();
  AliCDBId id("AD/Calib/TimeDelays", 0, AliCDBRunRange::Infinity());

  man->Put(delays, id, md);

  delete md;

}
Beispiel #7
0
void MakeQAThresholdsEntry(const char* storageUri="local://$ALICE_ROOT/../AliRoot/OCDB", Int_t firstRun=0, Int_t lastRun=999999999)
{
  AliCDBManager *cdb = AliCDBManager::Instance();
  cdb->SetDefaultStorage(storageUri);
  // QAThresholds
  TObjArray* qaThrArray = new TObjArray();
  for (Int_t idet = 0; idet < AliDAQ::kNDetectors; idet++){
    TString detName = AliDAQ::OnlineName(idet);
    if (detName == "TRI" || detName == "HLT" || detName == "TST") continue;   // skipping TRI, HLT, TST since they do not produce QAThresholds
    Printf("Processing QAThreshold for detector %s",detName.Data()); 
    TString inFile(gSystem->ExpandPathName("$ALICE_ROOT/../AliRoot/GRP/ShuttleInput/"));
    inFile += "run000168322_";
    inFile += detName;
    inFile += "_DQM_QAThresholds";
    Printf("Opening QAThreshold file %s", inFile.Data());
    TFile dqmFile(inFile.Data(),"READ");
    if (dqmFile.IsOpen()) {
      AliQAThresholds* qaThr = dynamic_cast<AliQAThresholds*>(dqmFile.Get(detName.Data()));
      if (qaThr){
        Int_t qaThrId = qaThr->GetDetectorId();
        if (qaThrId != idet){
          Printf("ERROR: Expecting QA threshold for detector %s, but found that for detector %s, skipping",detName.Data(), AliDAQ::OnlineName(qaThrId));
          continue;
        }
        else{
          qaThrArray->AddAtAndExpand(qaThr, qaThrId);
        }
      }
      else {
        Printf("ERROR: No QAThresholds object found in the file for detector %s, skipping",detName.Data());
        continue;
      }
    }
    else {
      Printf("ERROR: Can't open QAThreshold file for detector %s, skipping",detName.Data());
      continue;					
    }
  }
  if (qaThrArray->GetEntries() > 0){
    AliCDBMetaData md;
    md.SetResponsible("Barthélémy von Haller");
    md.SetComment("QA Threshold TObjArray");
    AliCDBId id("GRP/Calib/QAThresholds", firstRun, lastRun);
    cdb->Put(qaThrArray, id, &md); 
  }
  else{
    Printf("No valid QAThresholds entries found, storing nothing in the OCDB");
  }

}
Beispiel #8
0
UpdateRecoParam(const Int_t runNumber)
{
  // Read the array of PHOS recoparam objects from OCDB and update
  // EMC fitter version to "v4".
  // Write the updated object to OCDB.
  // Yuri Kharlov. 9.12.2011
  //
  /* $Id$ */

  AliCDBManager::Instance()->SetDefaultStorage("raw://");
  AliCDBManager::Instance()->SetRun(runNumber);

  AliCDBEntry* cdbEntry = AliCDBManager::Instance()->Get("PHOS/Calib/RecoParam");
  AliCDBMetaData *md = cdbEntry->GetMetaData();
  cout << "Responsible: " << md->GetResponsible() << endl;
  cout << "MD Comment : " << md->GetComment() << endl;
  TObjArray* arrayRecoParam = (TObjArray*)cdbEntry->GetObject();

  cout << "N recoparam = " << arrayRecoParam->GetEntries() << endl;

  AliPHOSRecoParam *rp = 0;
  for (Int_t i=0; i<arrayRecoParam->GetEntries(); i++) {
    rp = (AliPHOSRecoParam*)arrayRecoParam->At(i);
    printf("RP %d: event specie = %d, fitter version = %s\n",
	   i,rp->GetEventSpecie(),rp->EMCFitterVersion());
    rp->SetEMCFitterVersion("v4");
  }

  // Writing new recoparam to OCDB

  AliCDBManager* cdb = AliCDBManager::Instance();
  cdb->SetDefaultStorage("local://OCDB");

  AliCDBMetaData *md= new AliCDBMetaData();
  md->SetResponsible("Yuri Kharlov");
  md->SetComment("PHOS recoparameters: EMC fitter version is updated to v4");
  AliCDBId id("PHOS/Calib/RecoParam",167690,AliCDBRunRange::Infinity());
  cdb->Put(arrayRecoParam,id, md);

}
Beispiel #9
0
void MakeLHCDataEntry(char* storageUri="local://$ALICE_ROOT/../AliRoot/OCDB", Int_t firstRun=0, Int_t lastRun=999999999)
{
  AliCDBManager *cdb = AliCDBManager::Instance();
  cdb->SetDefaultStorage(storageUri);

  // Get time start from the simulated LHCData file
  Double_t timeStart = 0.0;
  Double_t timeEnd = 1.0e+10;

  TString fileName(gSystem->ExpandPathName("$ALICE_ROOT/../AliRoot/GRP/ShuttleInput/testShuttle_GRP_run_number_testShuttle_data.txt"));
  Printf("Getting the file %s", fileName.Data());

  const Int_t fgknLHCDP = 9;   // number of dcs dps from LHC data
  const char* fgkLHCDataPoints[fgknLHCDP] = {
    "LHC_Beam_Energy",
    "LHC_MachineMode",
    "LHC_BeamMode",
    "LHC_Beams_Particle_Type",
    "BPTX_Phase_Shift_B1",
    "BPTX_Phase_Shift_B2",
    "LHC_Particle_Type_B1",
    "LHC_Particle_Type_B2",
    "LHC_Data_Quality_Flag"
  };

  AliGRPObject *grpobj = new AliGRPObject();
	// grpobj->SetBeamEnergyIsSqrtSHalfGeV(); // new format
  //
  //Getting the LHC Data from DCS FXS
  //
  AliLHCReader lhcReader;

  // Processing data to be put in AliGRPObject

		// Energy
		Printf("*************Energy ");
		TObjArray* energyArray = lhcReader.ReadSingleLHCDP(fileName.Data(),fgkLHCDataPoints[0]);
		if (energyArray){			
			Float_t energy = ProcessEnergy(energyArray,timeStart);
			if (energy != -1.) {
				grpobj->SetBeamEnergy(energy);
				grpobj->SetBeamEnergyIsSqrtSHalfGeV(kTRUE);
			}
			delete energyArray;
		}
		else {
			AliError("Energy not found in LHC Data file!!!");
		}	

  Double_t timeBeamModeEnd = timeEnd;        // max validity for Beam Mode 
  Double_t timeMachineModeEnd = timeEnd;     // max validity for Machine Mode
  Double_t timeBeamEnd = timeEnd;            // max validity for Beam Type
  Double_t timeBeamTypeEnd[2] = {timeEnd, timeEnd}; // max validity for Beam Type1,2
  Double_t timeBeamModeStart = -1;    // min validity for Beam Mode
  Double_t timeMachineModeStart = -1; // min validity for Machine Mode
  Double_t timeBeamStart = -1;        // min validity for Beam Type
  Double_t timeBeamTypeStart[2] = {-1,-1};        // min validity for Beam Type1,2
  Int_t indexBeamMode = -1;                  // index of measurement used to set Beam Mode
  Int_t indexMachineMode = -1;               // index of measurement used to set Machine Mode
  Int_t indexBeam = -1;                      // index of measurement used to set Beam Type
  Int_t indexBeamType[2] = {-1, -1};                      // index of measurement used to set Beam Type1,2
  Bool_t foundBeamModeStart = kFALSE;        // flag to be set in case an entry for the Beam Mode is found before (or at) SOR
  Bool_t foundMachineModeStart = kFALSE;     // flag to be set in case an entry for the Machine Mode is found before (or at) SOR
  Bool_t foundBeamStart = kFALSE;            // flag to be set in case an entry for the Beam Type is found before (or at) SOR
  Bool_t foundBeamTypeStart[2] = {kFALSE, kFALSE};            // flag to be set in case an entry for the Beam Type1,2 is found before (or at) SOR
  Bool_t flagBeamMode = kFALSE;  //flag set true if a changed occurred in BeamMode
  Bool_t flagMachineMode = kFALSE;  //flag set true if a changed occurred in MachineMode
  Bool_t flagBeam = kFALSE;  //flag set true if a changed occurred in BeamType
  Bool_t flagBeamType[2] = {kFALSE, kFALSE};  //flag set true if a changed occurred in BeamType1,2

  Double_t arrayTimes[5]={2.E9, 2.E9, 2.E9, 2.E9, 2.E9}; // array to keep track of the times of the possible changes of the LHC DPs; each entry set to Wed May 18 2033, 03:33:20 GMT (ALICE should not be running anymore...)
  // arrayTimes elements order correspond to the one used in the array of the strings fgkLHCDataPoints, i.e.:
  // arrayTimes[0] --> MachineMode
  // arrayTimes[1] --> BeamMode
  // arrayTimes[2] --> BeamType (when written together)
  // arrayTimes[3] --> BeamType1 (when written separate)
  // arrayTimes[4] --> BeamType2 (when written separate)

  // BeamMode
  Printf("*************BeamMode (LHCState) ");
  TObjArray* beamModeArray = lhcReader.ReadSingleLHCDP(fileName.Data(),fgkLHCDataPoints[2]);
  Int_t nBeamMode = -1;
  if (beamModeArray){	
    nBeamMode = beamModeArray->GetEntries();	
    if (nBeamMode==0){
      Printf("Found zero entries for the Beam Mode, leaving it empty");
    }
    else{
      for (Int_t iBeamMode = 0; iBeamMode<nBeamMode; iBeamMode++){
        AliDCSArray* beamMode = (AliDCSArray*)beamModeArray->At(iBeamMode);
        if (beamMode){
          if (beamMode->GetTimeStamp()<=timeStart && beamMode->GetTimeStamp()>=timeBeamModeStart){// taking always the very last entry: of two measurements have the same timestamp, the last one is taken
            timeBeamModeStart = beamMode->GetTimeStamp();
            indexBeamMode = iBeamMode;
            foundBeamModeStart = kTRUE;
          }
          else {
            break;

          }
        }
      }
      if (!foundBeamModeStart){
        Printf("No value for the Beam Mode found before start of run, the Beam Mode will remain empty");
      }
      else {
        AliDCSArray* beamMode = (AliDCSArray*)beamModeArray->At(indexBeamMode);
        TObjString* beamModeString = beamMode->GetStringArray(0);
        Printf(Form("LHC State (corresponding to BeamMode) = %s (set at %f)",(beamModeString->String()).Data(),beamMode->GetTimeStamp()));
        grpobj->SetLHCState(beamModeString->String());
        if (indexBeamMode < nBeamMode-1){
          AliDCSArray* beamMode1 = (AliDCSArray*)beamModeArray->At(indexBeamMode+1);
          if (beamMode1){
            if (beamMode1->GetTimeStamp()<=timeStart){
              Printf("ERROR: you did not choose the correct value! there is still something before (or at) SOR, but later than this!");
            }
            else if (beamMode1->GetTimeStamp()>timeStart && beamMode1->GetTimeStamp()<=timeEnd){
              timeBeamModeEnd = beamMode1->GetTimeStamp();
              TObjString* beamModeString1 = beamMode1->GetStringArray(0);
              TString bmString0 = beamModeString->String();
              TString bmString1 = beamModeString1->String();
              if (bmString0.CompareTo(bmString1.Data(),TString::kIgnoreCase) == -1){
                Printf("WARNING: The beam mode changed from %s to %s during the run at timestamp %f! Setting it to %s and keeping track of the time of the change to set MaxTimeLHCValidity afterward",bmString0.Data(), bmString1.Data(), timeBeamModeEnd, bmString0.Data());
                flagBeamMode = kTRUE;
                arrayTimes[1]=timeBeamModeEnd;

              }
            }
          }
          else {
            Printf("Invalid pointer for the first entry for Beam Mode after the first valid one, not considering anything after what has already been found");
          }
        }
      }
    }
    delete beamModeArray;
  }
  else{
    Printf("ERROR: Beam mode array not found in LHC Data file!!!");
  }
		
  // MachineMode
  Printf("*************MachineMode ");
  TObjArray* machineModeArray = lhcReader.ReadSingleLHCDP(fileName.Data(),fgkLHCDataPoints[1]);
  Int_t nMachineMode = -1;
  if (machineModeArray){
    nMachineMode = machineModeArray->GetEntries();
    if (nMachineMode==0){
      Printf("No Machine Mode found, leaving it empty");
    }
    else{
      for (Int_t iMachineMode = 0; iMachineMode<nMachineMode; iMachineMode++){
        AliDCSArray* machineMode = (AliDCSArray*)machineModeArray->At(iMachineMode);
        if (machineMode){
          if (machineMode->GetTimeStamp()<=timeStart && machineMode->GetTimeStamp()>=timeMachineModeStart){// taking always the very last entry: of two measurements have the same timestamp, the last one is taken
            timeMachineModeStart = machineMode->GetTimeStamp();
            indexMachineMode = iMachineMode;
            foundMachineModeStart = kTRUE;
          }
          else{
            break;
          }
        }
      }
      if (!foundMachineModeStart){
        Printf("No value for the Machine Mode found before start of run, the Machine Mode will remain empty");
      }
      else {
        AliDCSArray* machineMode = (AliDCSArray*)machineModeArray->At(indexMachineMode);
        TObjString* machineModeString = machineMode->GetStringArray(0);
        Printf(Form("MachineMode = %s (set at %f)",(machineModeString->String()).Data(),machineMode->GetTimeStamp()));
        grpobj->SetMachineMode(machineModeString->String());
        if (indexMachineMode < nMachineMode-1){
          AliDCSArray* machineMode1 = (AliDCSArray*)machineModeArray->At(indexMachineMode+1);
          if (machineMode1){
            if (machineMode1->GetTimeStamp()>timeStart && machineMode1->GetTimeStamp()<=timeEnd){
              timeMachineModeEnd = machineMode1->GetTimeStamp();
              TObjString* machineModeString1 = machineMode1->GetStringArray(0);
              TString mmString0 = machineModeString->String();
              TString mmString1 = machineModeString1->String();
              if (mmString0.CompareTo(mmString1.Data(),TString::kIgnoreCase) == -1){
                Printf("WARNING: The machine mode changed from %s to %s during the run at timestamp %f! Setting it to %s and keeping track of the time of the change to set MaxTimeLHCValidity afterward",mmString0.Data(),mmString1.Data(),timeMachineModeEnd,mmString0.Data());
                flagMachineMode = kTRUE;
                arrayTimes[0]=timeMachineModeEnd;
              }
            }
          }
          else {
            Printf("Invalid pointer for the first entry for Machine Mode after the first valid one, not considering anything after what has already been found");
          }
        }
      }
    }
    delete machineModeArray;
  }
  else{
    Printf("ERROR: Machine mode array not found in LHC Data file!!!");
  }

  // BeamType1 and BeamType2 - both put in the same string
  Printf("*************BeamType ");
  TObjArray* beamArray = lhcReader.ReadSingleLHCDP(fileName.Data(),fgkLHCDataPoints[3]);
  if (beamArray){			
    Int_t nBeam = beamArray->GetEntries();
    if (nBeam==0){
      Printf("No Beam Type found, leaving it empty");
    }
    else{
      for (Int_t iBeam = 0; iBeam<nBeam; iBeam++){
        AliDCSArray* beam = (AliDCSArray*)beamArray->At(iBeam);
        if (beam){
          if (beam->GetTimeStamp()<=timeStart && beam->GetTimeStamp()>=timeBeamStart){// taking always the very last entry: of two measurements have the same timestamp, the last one is taken
            timeBeamStart = beam->GetTimeStamp();
            indexBeam = iBeam;
            foundBeamStart = kTRUE;
          }
          else{
            break;
          }
        }
      }
      if (!foundBeamStart){
        Printf("No value for the Beam Type found before start of run, the (common) Beam Type will remain empty");
      }
      else {
        AliDCSArray* beam = (AliDCSArray*)beamArray->At(indexBeam);
        TObjString* beamString = beam->GetStringArray(0);
        TString beamType = beamString->String();
        Printf(Form("Beam Type = %s",beamType.Data()));	
        if (beamType.CompareTo("PROTON",TString::kIgnoreCase) == 0){
          Printf("Setting beam type to p-p");
          grpobj->SetBeamType("p-p");
        }
        else { // if there is no PROTON beam, we suppose it is Pb, and we put A-A
          Printf("Setting beam type to A-A");
          grpobj->SetBeamType("A-A");
        }
        /*
           else if (beamType.CompareTo("LEAD82",TString::kIgnoreCase) == 0){
           Printf("Setting beam type to Pb-Pb");
           grpobj->SetBeamType("Pb-Pb");
           }
           else{
           Printf("ERROR: Beam Type not known, leaving it empty");
           }
           */
        if (indexBeam < nBeam-1){
          AliDCSArray* beam1 = (AliDCSArray*)beamArray->At(indexBeam+1);
          if (beam1){
            if (beam1->GetTimeStamp()>timeStart && beam1->GetTimeStamp()<=timeEnd){
              timeBeamEnd = beam1->GetTimeStamp();
              TObjString* beamString1 = beam1->GetStringArray(0);
              TString beamType1 = beamString1->String();
              if (beamType.CompareTo(beamType1.Data(),TString::kIgnoreCase) == -1){
                Printf("WARNING: The Beam Type changed from %s to %s during the run at timestamp %f! Setting it to %s and keeping track of the time of the change to set MaxTimeLHCValidity afterward",beamType.Data(),(beamString1->String()).Data(),timeBeamEnd,beamType.Data());
                flagBeam = kTRUE;
                arrayTimes[2] = timeBeamEnd;
              }
            }
          }
          else {
            Printf("Invalid pointer for the first entry for Beam Type after the first valid one, not considering anything after what has already been found");
          }
        }
      }
    }
    delete beamArray;
  }
  else{
    Printf("ERROR: Beam Type array not found in LHC Data file!!!");
  }		

  // BeamType1 and BeamType2 - in separete string
  Printf("*************BeamType, 1 and 2 ");
  Int_t indexBeamTypeString = 6;  // index of the string with the alias of BeanType1 in the array fgkLHCDataPoints
  TString combinedBeamType = "-";  // combined beam type, built from beam type 1 and beam type 2
  TString combinedBeamTypeFromLHC = "-";  // combined beam type, built from beam type 1 and beam type 2 AS SENT FROM LHC
  for (Int_t ibeamType = 0; ibeamType<2; ibeamType++){
    beamArray = lhcReader.ReadSingleLHCDP(fileName.Data(),fgkLHCDataPoints[indexBeamTypeString+ibeamType]);
    if (beamArray){			
      Int_t nBeam = beamArray->GetEntries();
      if (nBeam==0){
        Printf(Form("No Beam Type %s found, leaving it empty",fgkLHCDataPoints[indexBeamTypeString+ibeamType]));
      }
      else{
        for (Int_t iBeam = 0; iBeam<nBeam; iBeam++){
          AliDCSArray* beam = (AliDCSArray*)beamArray->At(iBeam);
          if (beam){
            if (beam->GetTimeStamp()<=timeStart && beam->GetTimeStamp()>=timeBeamTypeStart[ibeamType]){// taking always the very last entry: of two measurements have the same timestamp, the last one is taken
              timeBeamTypeStart[ibeamType] = beam->GetTimeStamp();
              indexBeamType[ibeamType] = iBeam;
              foundBeamTypeStart[ibeamType] = kTRUE;
            }
            else{
              break;
            }
          }
        }
        if (!foundBeamTypeStart[ibeamType]){
          Printf(Form("No value for the Beam Type %s found before start of run, the Beam Type %d will remain empty", fgkLHCDataPoints[indexBeamTypeString+ibeamType], ibeamType));
        }
        else {
          AliDCSArray* beam = (AliDCSArray*)beamArray->At(indexBeam);
          TObjString* beamString = beam->GetStringArray(0);
          TString beamType = beamString->String();
          Printf(Form("Beam Type (for %s) = %s", fgkLHCDataPoints[indexBeamTypeString+ibeamType], beamType.Data()));
          TString singleBeam = ParseBeamTypeString(beamType,ibeamType);
          Printf(Form("Single Beam Type for beam %d set to %s", ibeamType, singleBeam.Data()));
          grpobj->SetSingleBeamType(ibeamType, singleBeam);
          if (beamType.CompareTo("PROTON",TString::kIgnoreCase) == 0){
            Printf(Form("Setting beam %d for combined beam type to p", ibeamType));
            if (ibeamType == 0) combinedBeamType.Prepend("p"); 
            else combinedBeamType.Append("p");
          }
          else { // if there is no PROTON beam, we suppose it is Pb, and we put A-A
            Printf(Form("Setting beam %d for combined beam type to A",ibeamType));
            if (ibeamType == 0) combinedBeamType.Prepend("A");
            else combinedBeamType.Append("A");
          }
          if (ibeamType == 0) combinedBeamTypeFromLHC.Prepend(beamType); 
          else combinedBeamTypeFromLHC.Append(beamType);
          /*
             else if (beamType.CompareTo("LEAD82",TString::kIgnoreCase) == 0){
             Printf("Setting beam type to Pb-Pb");
             grpobj->SetSingleBeamType(ibeamType, "Pb-Pb");
             }
             else{
             Printf("ERROR: Beam Type not known, leaving it empty");
             }
             */
          if (indexBeamType[ibeamType] < nBeam-1){
            AliDCSArray* beam1 = (AliDCSArray*)beamArray->At(indexBeam+1);
            if (beam1){
              if (beam1->GetTimeStamp()>timeStart && beam1->GetTimeStamp()<=timeEnd){
                timeBeamTypeEnd[ibeamType] = beam1->GetTimeStamp();
                TObjString* beamString1 = beam1->GetStringArray(0);
                TString beamType1 = beamString1->String();
                if (beamType.CompareTo(beamType1.Data(),TString::kIgnoreCase) == -1){
                  Printf("WARNING: The Beam Type for %s changed from %s to %s during the run at timestamp %f! Setting it to %s and keeping track of the time of the change to set MaxTimeLHCValidity afterward",fgkLHCDataPoints[indexBeamTypeString+ibeamType],beamType.Data(),(beamString1->String()).Data(),timeBeamEnd,beamType.Data());
                  flagBeamType[ibeamType] = kTRUE;
                  arrayTimes[3+ibeamType] = timeBeamTypeEnd[ibeamType];
                }
              }
            }
            else {
              Printf(Form("Invalid pointer for the first entry for Beam Type %s after the first valid one, not considering anything after what has already been found",fgkLHCDataPoints[indexBeamTypeString+ibeamType]));
            }
          }
        }
      }
      delete beamArray;
    }
    else{
      AliError(Form("Beam Type %s array not found in LHC Data file!!!",fgkLHCDataPoints[indexBeamTypeString+ibeamType]));
    }		
  }
  Printf(Form("Setting combined beam type to %s",combinedBeamType.Data()));
  grpobj->SetBeamType(combinedBeamType);
  Printf(Form("Setting combined beam type form LHC to %s",combinedBeamTypeFromLHC.Data()));
  grpobj->SetBeamTypeFromLHC(combinedBeamTypeFromLHC);

  // Setting minTimeLHCValidity
  if (flagBeamMode == kTRUE || flagMachineMode == kTRUE || flagBeam == kTRUE || flagBeamType[0] == kTRUE || flagBeamType[1] == kTRUE){ 
    Double_t minTimeLHCValidity= TMath::MinElement(5,arrayTimes);
    Printf("WARNING: Setting MaxTimeLHCValidity to %f",minTimeLHCValidity);
    grpobj->SetMaxTimeLHCValidity(minTimeLHCValidity);
  }
  /* 
  // Old way to determine the Maximum Time during which the LHC info is valid
  if (timeBeamModeEnd!=0 || timeMachineModeEnd!=0 || timeBeamEnd !=0){
  Double_t minTimeLHCValidity;
  if (flagBeamMode == kFALSE && flagMachineMode == kFALSE && flagBeam == kTRUE){ // flagBeam only true --> it is the only one that changed
  minTimeLHCValidity = timeBeamEnd;
  }
  else if (flagBeamMode == kFALSE && flagMachineMode == kTRUE && flagBeam == kFALSE){ // flagMachineMode only true
  minTimeLHCValidity = timeMachineModeEnd;
  }
  else if (flagBeamMode == kTRUE && flagMachineMode == kFALSE && flagBeam == kFALSE){ // flagBeamMode only true
  minTimeLHCValidity = timeBeamModeEnd;
  }
  else if (flagBeamMode == kFALSE && flagMachineMode == kTRUE && flagBeam == kTRUE){ // flagBeam and flagMachineMode only true
  minTimeLHCValidity= TMath::Min(timeBeamEnd,timeMachineModeEnd);
  }
  else if (flagBeamMode == kTRUE && flagMachineMode == kFALSE && flagBeam == kTRUE){ // flagBeam and flagBeamMode only true
  minTimeLHCValidity= TMath::Min(timeBeamEnd,timeBeamModeEnd);
  }
  else if (flagBeamMode == kTRUE && flagMachineMode == kTRUE && flagBeam == kFALSE){ // flagMachineMode and flagBeamMode only true
  minTimeLHCValidity= TMath::Min(timeMachineModeEnd,timeBeamModeEnd);
  }
  else {
  Double_t arrayTimes[3] = {timeBeamModeEnd,timeMachineModeEnd,timeBeamEnd};// flagMachineMode and flagBeamMode and flagBeam 
  minTimeLHCValidity= TMath::MinElement(3,arrayTimes);
  }
  Printf("WARNING: Setting MaxTimeLHCValidity to %f",minTimeLHCValidity));
  grpobj->SetMaxTimeLHCValidity(minTimeLHCValidity);
  }
  */

  // Data Quality Flag --> storing start and end values of periods within the run during which the value was found to be FALSE
  Printf("*************Data Quality Flag ");
  TObjArray* dataQualityArray = lhcReader.ReadSingleLHCDP(fileName.Data(),fgkLHCDataPoints[8]);
  Int_t nDataQuality = -1;
  Double_t timeDataQualityStart = -1; // min validity for Data Quality Flag
  Int_t indexDataQuality = -1;               // index of first measurement used to set Data Quality Flag
  Bool_t foundDataQualityStart = kFALSE;     // flag to be set in case an entry for the Data Quality Flag is found before (or at) SOR

  if (dataQualityArray){
    nDataQuality = dataQualityArray->GetEntries();
    if (nDataQuality==0){
      Printf("No Data Quality Flag found, leaving it empty");
    }
    else{
      for (Int_t iDataQuality = 0; iDataQuality<nDataQuality; iDataQuality++){
        AliDCSArray* dataQuality = (AliDCSArray*)dataQualityArray->At(iDataQuality);
        if (dataQuality){
          if (dataQuality->GetTimeStamp()<=timeStart && dataQuality->GetTimeStamp()>=timeDataQualityStart){// taking always the very last entry: if two measurements have the same timestamp, the last one is taken
            timeDataQualityStart = dataQuality->GetTimeStamp();
            indexDataQuality = iDataQuality;
            foundDataQualityStart = kTRUE;
          }
          else{
            // we suppose here that if the first measurement is not before SOR, then none will be (they MUST be in chronological order!!!) 
            break;
          }
        }
      }
      if (!foundDataQualityStart){
        // The Data Quality Flag should be found and TRUE at the start of the run. For the time being, if it is not found, don't do anything, but it means there is a problem..
        Printf("No value for the Data Quality Flag found before start of run, the Data Quality Flag will remain empty");
      }
      else {
        // counting how many FALSE values there are
        Bool_t foundEndOfFalse = kFALSE;
        Int_t nFalse = 0;
        for (Int_t iDataQuality = indexDataQuality; iDataQuality < nDataQuality; iDataQuality ++){
          AliDCSArray* dataQuality = (AliDCSArray*)dataQualityArray->At(iDataQuality);
          Printf("dataQuality->GetTimeStamp() = %f, timeDataQualityStart = %f, timeEnd = %f", dataQuality->GetTimeStamp(), timeDataQualityStart, timeEnd );
          if (dataQuality->GetTimeStamp()>=timeDataQualityStart && dataQuality->GetTimeStamp()<=timeEnd){ // considering only values between the first valid and the end of the run
            Bool_t dataQualityFlag = dataQuality->GetBool(0);
            Printf("DataQuality = %d (set at %f)",(Int_t)dataQualityFlag,dataQuality->GetTimeStamp());
            if (dataQualityFlag != kTRUE){
              if (iDataQuality == indexDataQuality) {  // the first Data Quality value should be TRUE, but ignoring the problem now...
                Printf("ERROR: The first value for the Data Quality MUST be TRUE! Ignoring for now...");
              }
              nFalse++;
            }
          }
        }

        Printf(Form("Found %d FALSE values for the Data Quality Flag",nFalse));
        Double_t falses[nFalse*2];  // dimensioning this to the maximum possible, as if each false value was followed by a true one --> the false periods correspond to the number of falses

        Int_t iDataQuality = indexDataQuality;
        if (nFalse > 0){
          Int_t iFalse = 0;
          // filling the info about the periods when the flag was set to FALSE
          // starting, like for the other DPS, from the measurement closest to SOR (the index of which is iDataQuality)
          while (iDataQuality < nDataQuality){
            Printf("iDataQuality = %d",iDataQuality);
            AliDCSArray* dataQuality = (AliDCSArray*)dataQualityArray->At(iDataQuality);
            if (dataQuality->GetTimeStamp()>=timeDataQualityStart && dataQuality->GetTimeStamp()<=timeEnd){ // considering only values between the first valid and the end of the run
              Bool_t dataQualityFlag = dataQuality->GetBool(0);
              Printf("DataQuality = %d (set at %f)",(Int_t)dataQualityFlag,dataQuality->GetTimeStamp());
              if (dataQualityFlag == kTRUE){
                // found TRUE value, continuing
                iDataQuality++;
                continue;
              }
              else{
                /*
                // the check was already done before
                if (iDataQuality == indexDataQuality) {  // the first Data Quality value should be TRUE, but ignoring the problem now...
                Printf("ERROR: The first value for the Data Quality MUST be TRUE! Ignoring for now...");
                }
                */
                falses[iFalse*2] = dataQuality->GetTimeStamp();
                foundEndOfFalse = kFALSE;
                Int_t iDataQualityNext = iDataQuality+1;
                while (iDataQualityNext < nDataQuality){
                  AliDCSArray* dataQualityNext = (AliDCSArray*)dataQualityArray->At(iDataQualityNext);
                  if (dataQualityNext->GetTimeStamp()>timeDataQualityStart && dataQualityNext->GetTimeStamp()<=timeEnd && dataQualityNext->GetTimeStamp() > dataQuality->GetTimeStamp()){ // considering only values between the first valid and the end of the run, and subsequent to the current value
                    Bool_t dataQualityFlagNext = dataQualityNext->GetBool(0);
                    Printf("DataQualityNext = %d (set at %f)",(Int_t)dataQualityFlagNext,dataQualityNext->GetTimeStamp());
                    if (dataQualityFlagNext == kTRUE){
                      // found TRUE value, first FALSE period completed
                      foundEndOfFalse = kTRUE;
                      falses[iFalse*2+1] = dataQualityNext->GetTimeStamp();
                      iFalse++;
                      break;
                    }
                    iDataQualityNext++;
                  }
                }
                if (!foundEndOfFalse) {
                  Printf("Please, note that the last FALSE value lasted until the end of the run");
                  falses[iFalse*2+1] = timeEnd;
                  iFalse++;
                  break;
                }
                iDataQuality = iDataQualityNext+1;
              }
            }
          }
          grpobj->SetNFalseDataQualityFlag(iFalse);
          grpobj->SetFalseDataQualityFlagPeriods(falses);
        }
      }
    }
    delete dataQualityArray;
  }
  else{
    Printf("ERROR: Data Quality Flag array not found in LHC Data file!!!");
  }

  // Processing data to go to AliLHCData object
  AliLHCData* dt = new AliLHCData(fileName.Data(),timeStart,timeEnd);
  // storing AliLHCData in OCDB
  if (dt){
    Printf(Form("Filled %d records to AliLHCData object",dt->GetData().GetEntriesFast()));
    AliCDBMetaData md;
    md.SetResponsible("Ruben Shahoyan");
    md.SetComment("LHC data from the GRP preprocessor.");
    Bool_t result = kTRUE;
    AliCDBId id("GRP/GRP/LHCData", 0, AliCDBRunRange::Infinity());
    result = cdb->Put(dt, id, &md); 
    delete dt;
    if (!result){
      Printf("Problems in storing LHC Data - but not going into Error");
    }
  }

  // processing LHC Phase

  TObjArray *beam1phase = lhcReader.ReadSingleLHCDP(fileName.Data(),fgkLHCDataPoints[4]);
  TObjArray *beam2phase = lhcReader.ReadSingleLHCDP(fileName.Data(),fgkLHCDataPoints[5]);
  if (beam1phase == 0x0 || beam2phase == 0x0){
    Printf(Form("Problems in retrieving LHC Clock data from LHC file"));
    return 4;
  }			
  AliLHCClockPhase *phaseObj = ProcessLHCClockPhase(beam1phase,beam2phase,timeEnd);
  delete beam1phase;
  delete beam2phase;
  if (phaseObj){
    Printf(Form("LHC Phase found"));
    AliCDBMetaData mdPhase;
    mdPhase.SetResponsible("Cvetan Cheshkov");
    mdPhase.SetComment("LHC Clock Phase");
    Bool_t result = kTRUE;
    AliCDBId id("GRP/Calib/LHCClockPhase", 0, AliCDBRunRange::Infinity());
    result = cdb->Put(phaseObj, id, &mdPhase); 
    delete phaseObj;
    if (!result) return 3;
  }
  else return 4;

  return 0;
}
/**
 * @file makeConfigurationObjectT0Reconstruction.C
 * @brief Creation of HLT component configuration objects in OCDB
 *
 * <pre>
 * Usage: aliroot -b -q makeConfigurationObjectT0Reconstruction.C'("param", "uri", runMin, runMax)'
 * </pre>
 *
 * Create an OCDB entry with a TObjString containing param for the 
 * T0 reconstruction.
 *
 * Parameters: <br>
 * - param (opt)    string to be stored in the TObjSting, default empty
 * - uri   (opt)    the OCDB URI, default $ALICE_ROOT   
 * - runMin (opt)   default 0
 * - runMax (opt)   default 999999999
 * 
 * Current Param : 
 *  - ""  <pre> aliroot -b -q makeConfigurationObjectT0Reconstruction.C </pre>
 *
 * @author Jochen Thaeder <*****@*****.**>
 * @ingroup alihlt_vzero
 */
void makeConfigurationObjectT0Reconstruction(const Char_t* param="", const Char_t* cdbUri=NULL,
				      Int_t runMin=0, Int_t runMax=AliCDBRunRange::Infinity()) {

  // --------------------------------------
  // -- Setup CDB
  // --------------------------------------
  cout<<" makeConfigurationObjectT0Reconstruction "<<endl;
  AliCDBManager* man = AliCDBManager::Instance();
  if (!man) {
    cerr << "Error : Can not get AliCDBManager" << end;
    exit;
  }

  TString storage;
  if (!man->IsDefaultStorageSet()) {
    if ( cdbUri ) {
      storage = cdbUri;
      if ( storage.Contains("://") == 0 ) {
	storage = "local://"; 
	storage += cdbUri;
      }
    } 
    else {
      storage="local://$ALICE_ROOT/OCDB";
    }
    man->SetDefaultStorage(storage);
  } 
  else {
    storage = man->GetDefaultStorage()->GetURI();
  }

 // TString path("HLT/ConfigT0/T0Reconstruction");
  TString path("HLT/ConfigT0/T0Calibration");
  cout<<path<<endl;

  // --------------------------------------
  // -- Create Config Object
  // --------------------------------------

  // here is the actual content of the configuration object
  TObjString configParam=param;

  TObject *configObj = static_cast<TObject*>(&configParam);
  // --------------------------------------
  // -- Fill Object
  // --------------------------------------
  
  if ( !configObj ) {
    cerr << "Error : No configuration object created" << endl;
    return;
  }
    
  AliCDBPath cdbPath(path);
  AliCDBId   cdbId(cdbPath, runMin, runMax);
  AliCDBMetaData cdbMetaData;
  man->Put(configObj, cdbId, &cdbMetaData);

  printf("Adding %s type OCDB object to %s [%d,%d] in %s \n",
	 configObj->ClassName(), 
	 path.Data(),
	 runMin, runMax, storage.Data());
}
Beispiel #11
0
void MakeADRecoParamEntry(AliRecoParam::EventSpecie_t defaultEventSpecie=AliRecoParam::kLowMult, const char *outputCDB = "local://$ALICE_ROOT/OCDB") {
//========================================================================
//
// Steering macro for AD reconstruction parameters
//
// Author: Michal Broz
//
//========================================================================

  const char* macroname = "MakeADRecoParam.C";

  // Activate CDB storage and load geometry from CDB
  AliCDBManager* cdb = AliCDBManager::Instance();
  cdb->SetDefaultStorage(outputCDB);
  cdb->SetRun(0);
  
  TObjArray *recoParamArray = new TObjArray();

  {
    AliADRecoParam * ADRecoParam = new AliADRecoParam;
    ADRecoParam->SetEventSpecie(AliRecoParam::kCosmic);
    ADRecoParam->SetStartClock(0);
    ADRecoParam->SetEndClock(20);
    ADRecoParam->SetNPreClocks(1);
    ADRecoParam->SetNPostClocks(10);
    ADRecoParam->SetTimeWindowBBALow(-2.5);
    ADRecoParam->SetTimeWindowBBAUp(2.5);
    ADRecoParam->SetTimeWindowBGALow(-4.0);
    ADRecoParam->SetTimeWindowBGAUp(4.0);
    ADRecoParam->SetTimeWindowBBCLow(-1.5);
    ADRecoParam->SetTimeWindowBBCUp(1.5);
    ADRecoParam->SetTimeWindowBGCLow(-2.0);
    ADRecoParam->SetTimeWindowBGCUp(2.0);
    ADRecoParam->SetAdcThresHold(5);
    ADRecoParam->SetMaxResid(1.5);
    ADRecoParam->SetResidRise(0.02);
    recoParamArray->AddLast(ADRecoParam);
  }
  {
    AliADRecoParam * ADRecoParam = new AliADRecoParam;
    ADRecoParam->SetStartClock(0);
    ADRecoParam->SetEndClock(20);
    ADRecoParam->SetNPreClocks(1);
    ADRecoParam->SetNPostClocks(10);
    ADRecoParam->SetTimeWindowBBALow(-2.5);
    ADRecoParam->SetTimeWindowBBAUp(2.5);
    ADRecoParam->SetTimeWindowBGALow(-4.0);
    ADRecoParam->SetTimeWindowBGAUp(4.0);
    ADRecoParam->SetTimeWindowBBCLow(-1.5);
    ADRecoParam->SetTimeWindowBBCUp(1.5);
    ADRecoParam->SetTimeWindowBGCLow(-2.0);
    ADRecoParam->SetTimeWindowBGCUp(2.0);
    ADRecoParam->SetAdcThresHold(5);
    ADRecoParam->SetMaxResid(1.5);
    ADRecoParam->SetResidRise(0.02);
    ADRecoParam->SetEventSpecie(AliRecoParam::kLowMult);
    recoParamArray->AddLast(ADRecoParam);
  }
  {
    AliADRecoParam * ADRecoParam = new AliADRecoParam;
    ADRecoParam->SetStartClock(9);
    ADRecoParam->SetEndClock(11);
    ADRecoParam->SetNPostClocks(6);
    ADRecoParam->SetTimeWindowBBALow(-2.5);
    ADRecoParam->SetTimeWindowBBAUp(2.5);
    ADRecoParam->SetTimeWindowBGALow(-4.0);
    ADRecoParam->SetTimeWindowBGAUp(4.0);
    ADRecoParam->SetTimeWindowBBCLow(-1.5);
    ADRecoParam->SetTimeWindowBBCUp(1.5);
    ADRecoParam->SetTimeWindowBGCLow(-2.0);
    ADRecoParam->SetTimeWindowBGCUp(2.0);
    ADRecoParam->SetAdcThresHold(5);
    ADRecoParam->SetMaxResid(1.5);
    ADRecoParam->SetResidRise(0.02);
    ADRecoParam->SetEventSpecie(AliRecoParam::kHighMult);
    recoParamArray->AddLast(ADRecoParam);
  }

  // Set the defaultEventSpecie
  Bool_t defaultIsSet = kFALSE;
  for(Int_t i =0; i < recoParamArray->GetEntriesFast(); i++) {
    AliDetectorRecoParam *param = (AliDetectorRecoParam *)recoParamArray->UncheckedAt(i);
    if (!param) continue;
    if (defaultEventSpecie & param->GetEventSpecie()) {
      param->SetAsDefault();
      defaultIsSet = kTRUE;
    }
  }

  if (!defaultIsSet) {
    Error(macroname,"The default reconstruction parameters are not set! Exiting...");
    return;
  }

  // save in CDB storage
  AliCDBMetaData *md= new AliCDBMetaData();
  md->SetResponsible("Michal Broz");
  md->SetComment("Reconstruction parameters for AD");
  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
  md->SetBeamPeriod(0);
  AliCDBId id("AD/Calib/RecoParam", 0, AliCDBRunRange::Infinity());
  cdb->Put(recoParamArray, id, md);

  return;
}