Beispiel #1
0
// helper function to get release information about dataset
func datasetDetails(dataset string, ch chan Record) {
	api := "datasets"
	records, _ := dbsInfo(dataset, api, "True")
	for _, rec := range records {
		if rec != nil {
			rec["acquisition_era_name"] = utils.GetValue(rec["acquisition_era_name"])
			rec["create_by"] = utils.GetValue(rec["create_by"])
			rec["physics_group_name"] = utils.GetValue(rec["physics_group_name"])
			rec["primary_ds_type"] = utils.GetValue(rec["primary_ds_type"])
			rec["prep_id"] = utils.GetValue(rec["prep_id"])
			rec["processing_version"] = utils.GetFloatValue(rec["processing_version"])
			rec["xtcrosssection"] = utils.GetFloatValue(rec["xtcrosssection"])
			ch <- rec
			return
		}
	}
	rec := make(Record)
	ch <- rec // we must send at least empty record
}
Beispiel #2
0
// Unmarshal McM data stream and return DAS records based on api
func mcmProduces(dataset string, ch chan Record) {
	api := "produces"
	furl := fmt.Sprintf("%s/%s/%s", mcmUrl(), api, dataset)
	if utils.VERBOSE > 1 {
		fmt.Println("furl", furl)
	}
	response := utils.FetchResponse(furl, "")
	if response.Error == nil {
		records := loadMcMData(furl, response.Data)
		for _, r := range records {
			if r == nil {
				continue
			}
			v := r["results"]
			if v == nil {
				continue
			}
			res := v.(map[string]interface{})
			rec := make(Record)
			rec["energy"] = utils.GetFloatValue(res["energy"])
			s := res["sequences"]
			if s != nil {
				rec["nseq"] = len(s.([]interface{}))
			} else {
				rec["nseq"] = 0
			}
			rec["flown_with"] = utils.GetValue(res["flown_with"])
			rec["mcmtype"] = utils.GetValue(res["type"])
			rec["pwg"] = utils.GetValue(res["pwg"])
			rec["idataset"] = utils.GetValue(res["input_dataset"])
			rec["pdataset"] = utils.GetValue(res["pileup_dataset_name"])
			rec["campain"] = utils.GetValue(res["member_of_campaign"])
			rec["mcmevts"] = utils.GetFloatValue(res["nevents"])
			rec["mcmpid"] = utils.GetValue(res["prepid"])
			ch <- rec
			return
		}
	}
	rec := make(Record)
	ch <- rec // we must send at least empty record
}