void OccupancyAscii2OCDB(Int_t runNumber, TObjArray& filenames, const char* ocdbpath, const char* comment) { AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); AliCDBManager::Instance()->SetRun(runNumber); AliCDBManager::Instance()->SetSpecificStorage("MUON/Calib/OccupancyMap",ocdbpath); AliMpCDB::LoadAll(); AliMUON2DMap occupancy(kTRUE); TObjString* str; TIter next(&filenames); while ( ( str = static_cast<TObjString*>(next()) ) ) { TString data; ReadOccupancyFile(str->String().Data(),data); AliMUONTrackerIO::DecodeOccupancy(data.Data(),occupancy); } if (occupancy.GetSize()) { AliCDBId id("MUON/Calib/OccupancyMap",runNumber,runNumber); AliCDBMetaData metaData; metaData.SetBeamPeriod(0); metaData.SetResponsible("MUON TRK"); metaData.SetComment(comment); AliCDBManager::Instance()->Put(&occupancy,id,&metaData); } }
MakeCDBEntryTriggerMask(Int_t startRun = 0, Int_t endRun = AliCDBRunRange::Infinity()) { UInt_t triggerMask[72]; for (Int_t i = 0; i < 72; i++) triggerMask[i] = 0xffffff; /* create object */ AliTOFTriggerMask *obj = new AliTOFTriggerMask(); obj->SetTriggerMaskArray(triggerMask); /* create cdb info */ AliCDBId id("TRIGGER/TOF/TriggerMask", startRun, endRun); AliCDBMetaData *md = new AliCDBMetaData(); md->SetResponsible("Roberto Preghenella"); md->SetComment("TOF Trigger Mask"); md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); md->SetBeamPeriod(0); /* put object in cdb */ AliCDBManager *cdb = AliCDBManager::Instance(); cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); cdb->GetDefaultStorage()->Put(obj, id, md); }
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()); }
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 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"); } }
void WriteDCSAliasMap() { // This writes the output from CreateDCSAliasMap to a CDB file TMap* dcsAliasMap = CreateDCSAliasMap(); AliCDBMetaData metaData; metaData.SetBeamPeriod(0); metaData.SetResponsible("Responsible person"); metaData.SetComment("Test object for TestPreprocessor.C"); AliCDBId id("DET/DCS/Data", 0, 0); // look into AliTestShuttle's CDB main folder AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB()) ->Put(dcsAliasMap, id, &metaData); }
MakeCDBEntryCTPLatency(Float_t value = 0., Int_t startRun = 0, Int_t endRun = AliCDBRunRange::Infinity()) { /* create object */ AliTOFCTPLatency *obj = new AliTOFCTPLatency(); obj->SetCTPLatency(value); /* create cdb info */ AliCDBId id("TOF/Calib/CTPLatency", startRun, endRun); AliCDBMetaData *md = new AliCDBMetaData(); md->SetResponsible("Roberto Preghenella"); md->SetComment("CTPLatency (ps)"); md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); md->SetBeamPeriod(0); /* put object in cdb */ AliCDBManager *cdb = AliCDBManager::Instance(); cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); cdb->GetDefaultStorage()->Put(obj, id, md); }
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); }
ReadRecoParam(const Int_t runNumber) { // Read the array of PHOS recoparam objects from OCDB and // print its content to stdout AliCDBManager::Instance()->SetDefaultStorage("raw://"); AliCDBManager::Instance()->SetRun(runNumber); AliCDBEntry* cdbEntry = AliCDBManager::Instance()->Get("PHOS/Calib/RecoParam"); AliCDBMetaData *md = cdbEntry->GetMetaData(); printf("Responsible: %s\n",md->GetResponsible()); printf("MD Comment : %s\n",md->GetComment()); TObjArray* arrayRecoParam = (TObjArray*)cdbEntry->GetObject(); AliPHOSRecoParam *rp = 0; for (Int_t i=0; i<arrayRecoParam->GetEntries(); i++) { rp = (AliPHOSRecoParam*)arrayRecoParam->At(i); printf("Recoparam %d: event specie = %d\n", i,rp->GetEventSpecie()); printf("\tEMCClusteringThreshold = %g\n",rp->GetEMCClusteringThreshold()); printf("\tEMCLocalMaxCut = %g\n",rp->GetEMCLocalMaxCut()); printf("\tEMCRawDigitThreshold = %g\n",rp->GetEMCRawDigitThreshold()); printf("\tEMCMinE = %g\n",rp->GetEMCMinE()); printf("\tEMCLogWeight = %g\n",rp->GetEMCLogWeight()); printf("\tEMCSampleQualityCut = %g\n",rp->GetEMCSampleQualityCut()); printf("\tEMCEcoreRadius = %g\n",rp->GetEMCEcoreRadius()); printf("\tEMCEcore2ESD = %d\n",rp->EMCEcore2ESD()); printf("\tEMCSubtractPedestals = %d\n",rp->EMCSubtractPedestals()); printf("\tEMCToUnfold = %d\n",rp->EMCToUnfold()); printf("\tEMCfitter version = %s\n",rp->EMCFitterVersion()); printf("\tEMCEnergyCorrectionOn = %d\n",rp->GetEMCEnergyCorrectionOn()); printf("\tGlobalAltroOffset = %f\n",rp->GetGlobalAltroOffset()); printf("\tGlobalAltroThreshold = %d\n",rp->GetGlobalAltroThreshold()); printf("\tTimeGateAmpThresh = %g\n",rp->GetTimeGateAmpThresh()); printf("\tTimeGateLow = %g\n",rp->GetTimeGateLow()); printf("\tTimeGateHigh = %g\n",rp->GetTimeGateHigh()); printf("\tNonlinearityCorrectionVersion = %s\n",rp->GetNonlinearityCorrectionVersion()); } }
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; }
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(); }
/// /// Main method /// /// \param year: year to set geometry and run range /// \param printAll: verbosity checks /// void SetOCDBFromRun1(Int_t year = 2010, Bool_t printAll = kFALSE) { TGrid::Connect("alien://"); Int_t run = 182325; //2012 if(year == 2010) run = 134908; if(year == 2011) run = 159582; AliCDBManager* man = AliCDBManager::Instance(); man->SetDefaultStorage("raw://"); man->SetRun(run); AliCDBStorage *storage = man->GetDefaultStorage(); // Instantiate EMCAL geometry for the first time AliEMCALGeometry * geom; if (year == 2010) geom = AliEMCALGeometry::GetInstance("EMCAL_FIRSTYEARV1"); // 2010 else geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1"); // 2011-2012-2013 //else geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETE12SMV1_DCAL_8SM"); // Run2 const Int_t nSM = geom->GetNumberOfSuperModules(); // Get the final OCDB object AliEMCALCalibData* cparam = (AliEMCALCalibData*) (storage->Get("EMCAL/Calib/Data", run)->GetObject()); // Access OCDB file with the first version of the calibration TString first = "Run177115_999999999_v2_s0.root"; if(year==2010) first = "Run113461_999999999_v3_s0.root"; if(year==2011) first = "Run144484_999999999_v3_s0.root"; TFile * f = TFile::Open(Form("alien:///alice/data/%d/OCDB/EMCAL/Calib/Data/%s",year,first.Data()),"READ"); AliCDBEntry * cdb = (AliCDBEntry*) f->Get("AliCDBEntry"); AliEMCALCalibData* cparam1 = (AliEMCALCalibData*) cdb->GetObject(); // New OCDB container AliEMCALCalibData *cparamnew=new AliEMCALCalibData("EMCAL"); // Do the comparison Float_t param = -1; Float_t param1 = -1; Int_t iCol = -1, iRow = -1, iSM =-1, iMod = -1,iIphi =-1,iIeta = -1; for(Int_t i=0;i < nSM*24*48; i++) { //printf("AbsID %d\n",i); geom->GetCellIndex(i,iSM,iMod,iIphi,iIeta); geom->GetCellPhiEtaIndexInSModule(iSM,iMod, iIphi, iIeta,iRow,iCol); Float_t param = -1; if( cparam ) param = cparam ->GetADCchannel(iSM,iCol,iRow); Float_t param1 = -1; if( cparam1 ) param1 = cparam1->GetADCchannel(iSM,iCol,iRow); if (printAll) printf("ID %d, col %d, row %d, sm %d final %1.4f, first %1.4f\n", i,iCol,iRow,iSM,param, param1); cparamnew->SetADCchannel (iSM,iCol,iRow,param ); cparamnew->SetADCchannelOnline(iSM,iCol,iRow,param1); } // Create OCDB File AliCDBMetaData md; md.SetComment("Calibration after calibration with pi0, store also first online calibration"); md.SetBeamPeriod(0); md.SetResponsible("Gustavo Conesa"); md.SetAliRootVersion(gSystem->Getenv("ARVERSION")); // Careful, select here the first run where this calibration is valid Int_t firstRun = 172439; // 2012-13 if(year == 2010) firstRun = 113461; if(year == 2011) firstRun = 144484; AliCDBId id("EMCAL/Calib/Data",firstRun,AliCDBRunRange::Infinity()); // create in EMCAL/Calib/Data DBFolder AliCDBManager* man2 = AliCDBManager::Instance(); AliCDBStorage* loc = man2->GetStorage(Form("local://%d",year)); loc->Put(cparamnew, id, &md); }
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(); }
Bool_t MakeCosmicTriggersEntry(const char *fileName, const char* cdbUri) { const char* macroname = "MakeCosmicTriggersEntry.C"; if (gSystem->AccessPathName(fileName)) { Error(macroname,Form("file (%s) not found", fileName)); return kFALSE; } ifstream *file = new ifstream(fileName); if (!*file) { Error(macroname,Form("Error opening file (%s) !",fileName)); file->close(); delete file; return kFALSE; } THashTable *table = new THashTable(); table->SetName("List of defined cosmic triggers"); TString strLine; while (strLine.ReadLine(*file)) { if (strLine.BeginsWith("#")) continue; strLine.ReplaceAll(" ",""); strLine.ReplaceAll("\t",""); if (strLine.IsNull()) continue; TObjString *obj = new TObjString(strLine.Data()); table->Add(obj); } file->close(); delete file; // create OCDB storage TString Storage(cdbUri); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); return kFALSE; } AliCDBManager* cdb = AliCDBManager::Instance(); AliCDBStorage* storage = cdb->GetStorage(Storage.Data()); if(!storage){ Error(macroname,"Unable to open storage %s\n",Storage.Data()); return kFALSE; } AliCDBMetaData* md = new AliCDBMetaData(); md->SetResponsible("Federico Antinori"); md->SetComment("List of the defined cosmic triggers. It is used in order to steer the reconstruction, namely in the selection of the proper event specie. It is maintained and updated by the trigger coordinator."); // Get root and AliRoot versions and set them in the metadata const char* rootv = gROOT->GetVersion(); TString av(ALIROOT_VERSION); TString revnum(ALIROOT_REVISION); av+=" - revision: "; av+=revnum; md->SetAliRootVersion(av.Data()); AliCDBId id("GRP/Calib/CosmicTriggers",0,AliCDBRunRange::Infinity()); Info(macroname,"Saving the list of defined cosmic triggers in the OCDB storage \"%s\"",Storage.Data()); storage->Put(table,id,md); table->Delete(); delete table; return kTRUE; }
//------------------------------------------------------------------------ void SetCC(Int_t flag=0) { // Writing calibration coefficients into the Calibration DB // Arguments: // flag=0: all calibration coefficients are equal // flag=1: decalibration coefficients // flag=2: calibration coefficients equal to inverse decalibration ones // Author: Boris Polishchuk (Boris.Polichtchouk at cern.ch) TString DBFolder; Int_t firstRun = 0; Int_t lastRun = 0; Int_t beamPeriod = 1; char* objFormat = ""; AliPHOSCalibData* cdb = 0; if (flag == 0) { // Ideal calibration with all channels at nominal value 0.005 DBFolder ="local://InitCalibDB"; firstRun = 0; lastRun = AliCDBRunRange::Infinity(); objFormat = "PHOS ideal pedestals and ADC gain factors (5x64x56)"; cdb = new AliPHOSCalibData(); cdb->CreateNew(); } else if (flag == 1) { // Full decalibration is +-10% of the nominal value DBFolder ="local://FullDecalibDB"; firstRun = 0; lastRun = AliCDBRunRange::Infinity(); objFormat = "PHOS fully decalibrated calibration coefficients (5x64x56)"; cdb = new AliPHOSCalibData(); cdb->RandomEmc(0.045,0.055); cdb->RandomCpv(0.0008,0.0016); } else if (flag == 2) { // Residual decalibration is +-1% of the nominal value DBFolder ="local://ResidualCalibDB"; firstRun = 0; lastRun = AliCDBRunRange::Infinity(); objFormat = "PHOS residual calibration coefficients (5x64x56)"; cdb = new AliPHOSCalibData(); cdb->RandomEmc(0.00495,0.00505); cdb->RandomCpv(0.00115,0.00125); } //Store calibration data into database AliCDBMetaData md; md.SetComment(objFormat); md.SetBeamPeriod(beamPeriod); md.SetResponsible("Boris Polichtchouk"); AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); if(gSystem->Getenv("STORAGE")){ cout << "Setting specific storage" << endl; AliCDBManager::Instance()->SetSpecificStorage("PHOS/*",DBFolder.Data()); } cdb->WriteEmc(firstRun,lastRun,&md); cdb->WriteCpv(firstRun,lastRun,&md); cdb->WriteEmcBadChannelsMap(firstRun,lastRun,&md); }
void UploadRejectList(Int_t firstRun=0, Int_t lastRun=AliCDBRunRange::Infinity()) { AliCDBManager::Instance()->SetDefaultStorage("alien://folder=/alice/data/2015/OCDB"); AliCDBManager::Instance()->SetRun(firstRun); AliCDBManager::Instance()->SetSpecificStorage("MUON/Calib/RejectList","alien://folder=/alice/cern.ch/user/l/laphecet/OCDB2015"); AliMpCDB::LoadAll(); AliMUONRejectList rl; rl.SetDetectionElementProbability(806,1.0); // alignment problem // first round of checks in LHC13f with first run of the period : 4 holes rl.SetHVProbability("MchHvLvRight/Chamber03Right/Quad4Sect1",1.0); rl.SetPCBProbability(811,4,1.0); rl.SetPCBProbability(900,1,1.0); rl.SetPCBProbability(1010,0,1.0); // second scan of LHC13f: all runs // DE 612 : one of the 7-8 HV capa per PCB went bad ? // remove 3 full manus and then the channels in between... rl.SetManuProbability(612,1034,1.0); rl.SetManuProbability(612,112,1.0); rl.SetManuProbability(612,14,1.0); for ( Int_t i = 0; i < 8; ++i ) { rl.SetChannelProbability(612,111,i,1.0); rl.SetChannelProbability(612,113,40+i,1.0); rl.SetChannelProbability(612,15,40+i,1.0); rl.SetChannelProbability(612,13,i,1.0); } for ( Int_t i = 48; i <= 63; ++i ) { rl.SetChannelProbability(612,1141,i,1.0); } for ( Int_t i = 32; i <= 47; ++i ) { rl.SetChannelProbability(612,1141,i,1.0); } for ( Int_t i = 0; i <= 31; ++i ) { rl.SetChannelProbability(612,1140,i,1.0); } // DE 714 : same story as in DE 612 ... rl.SetManuProbability(714,111,1.0); rl.SetManuProbability(714,216,1.0); rl.SetManuProbability(714,1143,1.0); for ( Int_t i = 47; i <= 32; ++i ) { rl.SetChannelProbability(714,112,i,1.0); } for ( Int_t i = 0; i <= 15; ++i ) { rl.SetChannelProbability(714,215,i,1.0); } for ( Int_t i = 18; i <= 63; ++i ) { rl.SetChannelProbability(714,1233,i,1.0); } for ( Int_t i = 32; i <= 47; ++i ) { rl.SetChannelProbability(714,112,i,1.0); } rl.SetChannelProbability(714,1142,0,1.0); rl.SetChannelProbability(714,1142,1,1.0); rl.SetManuProbability(903,1129,1.0); rl.SetManuProbability(903,108,1.0); // only for run 196646 rl.SetDetectionElementProbability(919,1.0); rl.SetPCBProbability(918,1,1.0); rl.SetPCBProbability(918,2,1.0); rl.SetPCBProbability(918,3,1.0); rl.SetBusPatchProbability(1648,1.0); // BP on DE 918 AliCDBId id("MUON/Calib/RejectList",firstRun,lastRun); AliCDBMetaData metaData; metaData.SetBeamPeriod(0); metaData.SetResponsible("MUON TRK"); metaData.SetComment("Uploaded by UploadRejectList.C macro (handmade by L. Aphecetche) using information from MC vs Data tracking efficiency studies (Javier Martin Bianco) - eye scan (P. Pillot) - only for run 196646 -"); AliCDBManager::Instance()->Put(&rl,id,&metaData); }
void SetCalibDB() { Int_t firstRun = 0; // What is this Int_t lastRun = 9999999; Int_t beamPeriod = 1; char* objFormat = ""; TString DBFolder ="local://$ALICE_ROOT/OCDB/EMCAL/beamtest07"; firstRun = 0; lastRun = 999999999; objFormat = "EMCAL beam test 2007 gain factors and pedestals"; AliEMCALCalibData *calibda=new AliEMCALCalibData("EMCAL"); Float_t fADCpedestal = 0.009; Float_t fADCchannel = 0.0153; // 250 GeV / (16*1024) Float_t ped = 0.; Float_t cc = fADCchannel; Int_t nSMod = 12; Int_t nCol = 48; Int_t nRow = 24; Int_t nRow2 = 12; //Modules 11 and 12 are half modules Int_t colOffset = 40; Int_t rowOffset = 8; Double_t gain_ratios[8][8] = { 15.9289, 16.2141, 16.1204, 15.9118, 15.9363, 15.9402, 16.2257, 16.0097, 16.058, 16.1116, 16.039, 16.4167, 16.2148, 16.1399, 16.1515, 16.2194, 15.9082, 16.0776, 16.0496, 16.2353, 15.8054, 16.2158, 16.2344, 16.1023, 15.8903, 16.2387, 16.13, 16.157, 16.0685, 16.172, 16.3495, 16.3887, 16.2842, 16.049, 16.4328, 16.3954, 16.4226, 15.7254, 16.1634, 16.3182, 16.4216, 16.1201, 16.0000, 16.2305, 16.0266, 16.3573, 16.1382, 16.237, 16.2981, 16.1796, 15.854, 16.4189, 15.6425, 16.287, 16.3293, 16.6308, 16.2469, 16.0412, 16.252, 16.3367, 16.1412, 16.0646, 16.3996, 16.3479 }; Float_t gains[8][8] = { 4.43274, 6.7283, 8.23733, 3.59882, 4.2717, 2.85658, 4.86389, 2.71961, 3.05523, 3.02552, 3.50615, 3.26494, 6.69024, 2.51058, 8.42275, 2.83824, 8.05074, 5.36051, 4.36794, 4.73468, 9.9684, 5.5, 6.42999, 5.6, 7.37306, 5.28314, 5.27662, 5.26982, 3.29468, 5.23107, 6.40948, 4.06855, 4.09685, 5.37323, 5.32816, 5.89487, 9.2395, 5.3, 4.77239, 5.0, 4.85923, 3.44063, 4.74517, 5.28772, 3.80171, 4.84878, 5.12039, 4.59205, 2.34745, 3.16971, 3.61231, 3.65195, 3.43496, 3.4, 3.65678, 2.9, 2.71648, 3.39577, 3.40896, 3.31741, 3.24286, 3.51346, 2.61503, 3.44246 }; for(Int_t supermodule=0; supermodule < nSMod; supermodule++) { for(Int_t column=0; column< nCol; column++) { if(supermodule >= 10) nRow = nRow2; for(Int_t row=0; row< nRow; row++) { if(supermodule < 2 && column > 39 && row > 7 && row < 16) { cc = 1./gain_ratios[column-colOffset][row-rowOffset]/gains[column-colOffset][row-rowOffset]; cout << "column = " << column << " column - colOffset = " << column-colOffset << " row = " << " row Offset = " << row-rowOffset << endl; } calibda->SetADCchannel(supermodule,column,row,cc); calibda->SetADCpedestal(supermodule,column,row,ped); } } } //Store calibration data into database AliCDBMetaData md; md.SetComment(objFormat); md.SetBeamPeriod(beamPeriod); md.SetResponsible("David Silvermyr"); AliCDBId id("EMCAL/Calib/Data",firstRun,lastRun); // create in // EMCAL/Calib/Data DBFolder AliCDBManager* man = AliCDBManager::Instance(); AliCDBStorage* loc = man->GetStorage(DBFolder.Data()); loc->Put(calibda, id, &md); }
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(); }
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(); }
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; }
/** * Generates a default CDB entry for the trigger menu in the given CDB storage * (local by default). * \param cdbPath The path to the default CDB storage. */ void HM_PHYSICS_V0001( const char* cdbPath = "local://$ALICE_ROOT/OCDB", Int_t version = 0, Int_t firstRun = 0, Int_t lastRun = AliCDBRunRange::Infinity() ) { gSystem->Load("libAliHLTTrigger"); // Setup the CDB default storage and run number. AliCDBManager* cdbManager = AliCDBManager::Instance(); if (cdbManager == NULL) { cerr << "ERROR: Global CDB manager object does not exist." << endl; return; } AliCDBStorage* storage = cdbManager->GetStorage(cdbPath); if (storage == NULL) { cerr << "ERROR: Could not get storage for: " << cdbPath << endl; return; } // ///////////////////////////////////////////////////////////////////////////////////////// // Create the trigger menu. AliHLTGlobalTriggerConfig config("HM-COSMICS-V0001"); config.AddSymbol("domainAll", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"*******:***\")"); // ///////////////////////////////////////////////////////////////////////////////////////// // the domain definitions for the global HLT output and the HLT DDLs //config.AddSymbol("domainHLTOUT", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"*******:HLT \")"); config.AddSymbol("domainHLTDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:HLT\\0\")"); // some explicite domain entries config.AddSymbol("domainTObject" , "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"ROOTTOBJ:HLT \")"); config.AddSymbol("domainESD" , "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"ALIESDV0:HLT \")"); config.AddSymbol("domainHistogram" , "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"ROOTHIST:HLT \")"); config.AddSymbol("domainSPDCluster", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"CLUSTERS:ISPD\")"); config.AddSymbol("domainSDDCluster", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"CLUSTERS:ISDD\")"); config.AddSymbol("domainSSDCluster", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"CLUSTERS:ISSD\")"); config.AddSymbol("domainTPCCluster", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"CLUSTERS:TPC \")"); // an explicite HLTOUT selection which avoids wildcards config.AddSymbol("domainHLTOUT", "AliHLTTriggerDomain", "", "domainTObject | " "domainESD | " "domainHistogram | " "domainSPDCluster | " "domainSDDCluster | " "domainSSDCluster | " "domainTPCCluster" ); // ///////////////////////////////////////////////////////////////////////////////////////// // -- DETECTOR READOUT DOMAINS config.AddSymbol("domainSPDDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:SPD\\0\")"); config.AddSymbol("domainSDDDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:SDD\\0\")"); config.AddSymbol("domainSSDDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:SSD\\0\")"); config.AddSymbol("domainTPCDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:TPC\\0\")"); config.AddSymbol("domainTRDDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:TRD\\0\")"); config.AddSymbol("domainTOFDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:TOF\\0\")"); config.AddSymbol("domainHMPDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:HMP\\0\")"); config.AddSymbol("domainPHSDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:PHS\\0\")"); config.AddSymbol("domainCPVDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:CPV\\0\")"); config.AddSymbol("domainPMDDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:PMD\\0\")"); config.AddSymbol("domainMCHDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:MCH\\0\")"); config.AddSymbol("domainMTRDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:MTR\\0\")"); config.AddSymbol("domainFMDDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:FMD\\0\")"); config.AddSymbol("domainT00DDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:T00\\0\")"); config.AddSymbol("domainV00DDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:V00\\0\")"); config.AddSymbol("domainZDCDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:ZDC\\0\")"); config.AddSymbol("domainACODDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:ACO\\0\")"); config.AddSymbol("domainCTPDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:TRI\\0\")"); config.AddSymbol("domainEMCDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:EMC\\0\")"); // ///////////////////////////////////////////////////////////////////////////////////////// // -- DETECTOR READOUT DOMAINS - SPECIAL config.AddSymbol("domainALLDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:***\\0\")"); // ///////////////////////////////////////////////////////////////////////////////////////// // NOTE: always make sure that the global HLT output and the HLT DDLs are included // in the readout, i.e. add domainHLTOUT|domainHLTDDL to the trigger domain // -- BarrelMultiplicity config.AddItem( "BarrelMultiplicityTrigger", "domainHLTOUT|domainALLDDL", "H-TRACK_MULTIPLICITY-V0002.001-CENTRAL-ALL" ); config.AddItem( "BarrelHighMultiplicity", "domainHLTOUT|domainALLDDL", "H-TRACK_MULTIPLICITY-V0002.002-CENTRAL-ALL" ); config.AddItem( "BarrelPt_v01", "domainHLTOUT|domainALLDDL", "H-TRACK_MULTIPLICITY-V0002.003-CENTRAL-ALL" ); config.AddItem( "BarrelPt_v01", "domainHLTOUT|domainALLDDL", "H-TRACK_MULTIPLICITY-V0002.004-CENTRAL-ALL" ); config.AddItem( "BarrelPt_v01", "domainHLTOUT|domainALLDDL", "H-TRACK_MULTIPLICITY-V0002.005-CENTRAL-ALL" ); // -- Min bias trigger config.AddItem( "true", "domainALLDDL|domainHLTOUT", 10, "H-MINBIAS_SCALE_DOWN-V0002.001-CENTRAL-ALL" ); // ///////////////////////////////////////////////////////////////////////////////////////// // default domain in case there is no global trigger // readout the output of the reconstruction // this refers to the domain domainHLTOUT|domainHLTDDL config.SetDefaultTriggerDescription("No HLT global trigger"); // HLT payload also stored for not triggered events config.DefaultTriggerDomain().Add("*******", "HLT "); AliHLTReadoutList readoutlist; readoutlist.Enable(AliHLTReadoutList::kHLT); config.DefaultTriggerDomain().Add(readoutlist); TObject* menu = AliHLTGlobalTriggerConfig::Menu()->Clone(); menu->Print(); // ///////////////////////////////////////////////////////////////////////////////////////// // Write the trigger menu object to the CDB. AliCDBId id("HLT/ConfigHLT/HLTGlobalTrigger", firstRun, lastRun, version); AliCDBMetaData* metaData = new AliCDBMetaData(); metaData->SetResponsible("ALICE HLT [email protected]"); metaData->SetComment("HM-PHYSICS-V0001"); storage->Put(menu, id, metaData); // ///////////////////////////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////////////////// // // component configurations gROOT->LoadMacro("$ALICE_ROOT/HLT/exa/makeComponentConfigurationObject.C"); // ///////////////////////////////////////////////////////////////////////////////////////// // configuration of BarrelMultiplicityTrigger instances makeComponentConfigurationObject("HLT/ConfigHLT/BarrelMultiplicityTrigger", "-mintracks 10", cdbPath, firstRun, lastRun); makeComponentConfigurationObject("HLT/ConfigHLT/BarrelHighMultiplicity", "-mintracks 100" , cdbPath, firstRun, lastRun); makeComponentConfigurationObject("HLT/ConfigHLT/BarrelPt_v01", "-mintracks 1 -minpt 0.5" , cdbPath, firstRun, lastRun); makeComponentConfigurationObject("HLT/ConfigHLT/BarrelPt_v02", "-mintracks 1 -minpt 1.0" , cdbPath, firstRun, lastRun); makeComponentConfigurationObject("HLT/ConfigHLT/BarrelPt_v03", "-mintracks 1 -minpt 5.0" , cdbPath, firstRun, lastRun); }
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(); }
void MakeTRDResMisAlignment(){ // Create TClonesArray of residual misalignment objects for TRD // const char* macroname = "MakeTRDResMisAlignment.C"; TClonesArray *array = new TClonesArray("AliAlignObjParams",1000); TClonesArray &alobj = *array; // Activate CDB storage and load geometry from CDB AliCDBManager* cdb = AliCDBManager::Instance(); if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); cdb->SetRun(0); AliCDBStorage* storage; if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); return; } storage = cdb->GetStorage(Storage.Data()); if(!storage){ Error(macroname,"Unable to open storage %s\n",Storage.Data()); return; } AliCDBPath path("GRP","Geometry","Data"); AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun()); if(!entry) Fatal(macroname,"Could not get the specified CDB entry!"); entry->SetOwner(0); TGeoManager* geom = (TGeoManager*) entry->GetObject(); AliGeomManager::SetGeometry(geom); } else { AliGeomManager::LoadGeometry(); //load geom from default CDB storage } // sigmas for the chambers Double_t chdx = 0.002; // 20 microns Double_t chdy = 0.003; // 30 microns Double_t chdz = 0.007; // 70 microns Double_t chrx = 0.0005 / 1000.0 / TMath::Pi()*180; // 0 mrad Double_t chry = 0.0005 / 1000.0 / TMath::Pi()*180; // 0 mrad Double_t chrz = 0.1 / 1000.0 / TMath::Pi()*180; // 0.1 mrad // Truncation for the chambers Double_t cutChdx = 3.0 * chdx; Double_t cutChdy = 3.0 * chdy; Double_t cutChdz = 0.14 * chdz; Int_t sActive[18]={1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1}; Double_t dx=0.,dy=0.,dz=0.,rx=0.,ry=0.,rz=0.; Int_t j=0; UShort_t volid; const char* symname; // create the supermodules' alignment objects for (Int_t iSect=0; iSect<18; iSect++) { TString sm_symname(Form("TRD/sm%02d",iSect)); if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue; new((*array)[j++]) AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kTRUE); } // create the chambers' alignment objects Int_t chId; for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) { chId=-1; for (Int_t iSect = 0; iSect < 18; iSect++){ for (Int_t iCh = 0; iCh < 5; iCh++) { dx = AliMathBase::TruncatedGaus(0.0,chdx,cutChdx); dy = AliMathBase::TruncatedGaus(0.0,chdy,cutChdy); dz = AliMathBase::TruncatedGaus(0.0,chdz,cutChdz); rx = gRandom->Rndm() * 2.0*chrx - chrx; ry = gRandom->Rndm() * 2.0*chry - chry; rz = gRandom->Rndm() * 2.0*chrz - chrz; chId++; if ((iSect==13 || iSect==14 || iSect==15) && iCh==2) continue; volid = AliGeomManager::LayerToVolUID(iLayer,chId); if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue; symname = AliGeomManager::SymName(volid); new(alobj[j++]) AliAlignObjParams(symname,volid,dx,dy,dz,rx,ry,rz,kFALSE); } } } if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) { // save on file const char* filename = "TRDresidualMisalignment.root"; TFile f(filename,"RECREATE"); if(!f){ Error(macroname,"cannot open file for output\n"); return; } Info(macroname,"Saving alignment objects to the file %s", filename); f.cd(); f.WriteObject(array,"TRDAlignObjs","kSingleKey"); f.Close(); } else { // save in CDB storage AliCDBMetaData* md = new AliCDBMetaData(); md->SetResponsible("Dariusz Miskowiec"); md->SetComment("Residual misalignment for TRD"); md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); AliCDBId id("TRD/Align/Data",0,AliCDBRunRange::Infinity()); storage->Put(array,id,md); } array->Delete(); }
void StoreMapsSDD(Int_t firstRun=0,Int_t lastRun=AliCDBRunRange::Infinity(), Bool_t optSmear=kFALSE){ /////////////////////////////////////////////////////////////////////// // Macro to generate and store the correction maps for SDD // // Generates: // // 1 file with 520 AliITSCorrMapSDD drift maps (MapsTimeSDD) // /////////////////////////////////////////////////////////////////////// if(!AliCDBManager::Instance()->IsDefaultStorageSet()) { AliCDBManager::Instance()->SetDefaultStorage("local://OCDB"); } AliCDBMetaData *md = new AliCDBMetaData(); md->SetObjectClassName("TObjArray"); md->SetResponsible("Francesco Prino"); md->SetBeamPeriod(0); md->SetComment("Simulated data"); AliCDBId mapT("ITS/Calib/MapsTimeSDD",firstRun,lastRun); TObjArray tmap(520); tmap.SetOwner(kFALSE); TRandom3 *gran = new TRandom3(); AliITSCorrMapSDD* mapTime0; AliITSCorrMapSDD* mapTime1; for(Int_t mod=0;mod<260;mod++){ // maps Char_t name[20]; sprintf(name,"DriftTimeMap_%d_%d\n",mod,0); Int_t nbinsan=1; if(optSmear && (mod==10 || mod==240)){ nbinsan=256; sprintf(name,"DriftTimeMap_%d_%d\n",mod,0); mapTime0 = new AliITSCorrMap2DSDD(name,nbinsan,72); sprintf(name,"DriftTimeMap_%d_%d\n",mod,1); mapTime1 = new AliITSCorrMap2DSDD(name,nbinsan,72); }else{ sprintf(name,"DriftTimeMap_%d_%d\n",mod,0); mapTime0 = new AliITSCorrMap1DSDD(name,72); sprintf(name,"DriftTimeMap_%d_%d\n",mod,1); mapTime1 = new AliITSCorrMap1DSDD(name,72); } for(Int_t nan = 0;nan< nbinsan;nan++){ for(Int_t nt = 0;nt<36*2;nt++){ Double_t cnt0=0.; Double_t cnt1=0.; if(optSmear){ cnt0=gran->Gaus(0,20); cnt1=gran->Gaus(0,20); } mapTime0->SetCellContent(nan,nt,cnt0); mapTime1->SetCellContent(nan,nt,cnt1); } } tmap.Add(mapTime0); tmap.Add(mapTime1); printf("Added module %d\n",mod); } AliCDBManager::Instance()->GetDefaultStorage()->Put(&tmap, mapT, md); }