Warning, /firebird/firebird-ng/src/app/pages/input-config/input-config.component.ts is written in an unsupported language. File is not indexed.
0001 // event-display-source.component.ts
0002 import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core';
0003 import { FormBuilder, FormGroup, FormControl } from '@angular/forms';
0004 import { UserConfigService } from "../../services/user-config.service";
0005 import { ReactiveFormsModule } from '@angular/forms';
0006 import {RouterLink, RouterOutlet} from '@angular/router';
0007 import {ConfigProperty} from "../../utils/config-property";
0008 import {MatCard, MatCardContent, MatCardTitle} from "@angular/material/card";
0009 import {MatSlideToggle} from "@angular/material/slide-toggle";
0010 import {MatFormField} from "@angular/material/form-field";
0011 import {MatInput, MatLabel} from "@angular/material/input";
0012 import {config, map, Observable, startWith} from "rxjs";
0013 import {MatAutocomplete, MatAutocompleteTrigger, MatOption} from "@angular/material/autocomplete";
0014 import {AsyncPipe, NgForOf} from "@angular/common";
0015 import {MatTooltip} from "@angular/material/tooltip";
0016 import {ResourceSelectComponent} from "../../components/resource-select/resource-select.component";
0017 import {defaultFirebirdConfig, ServerConfig, ServerConfigService} from "../../services/server-config.service";
0018 import {MatAccordion, MatExpansionPanel, MatExpansionPanelTitle, MatExpansionPanelHeader} from "@angular/material/expansion";
0019 import {NavConfigComponent} from "../../components/nav-config/nav-config.component";
0020
0021
0022
0023 @Component({
0024 selector: 'app-input-config',
0025 standalone: true,
0026 imports: [ReactiveFormsModule, RouterLink, MatCard, MatCardContent, MatCardTitle, MatSlideToggle, MatFormField, MatInput, MatLabel, MatAutocompleteTrigger, MatAutocomplete, MatOption, AsyncPipe, MatTooltip, NgForOf, ResourceSelectComponent, MatAccordion, MatExpansionPanel, MatExpansionPanelTitle, MatExpansionPanelHeader, RouterOutlet, NavConfigComponent],
0027 templateUrl: './input-config.component.html',
0028 styleUrl: './input-config.component.scss'
0029 })
0030 export class InputConfigComponent implements OnInit, AfterViewInit {
0031
0032
0033 selectedEventSource = new FormControl('');
0034 onlyCentralDetector: FormControl<boolean | null> = new FormControl(true);
0035 serverUseApi: FormControl<boolean | null> = new FormControl(false);
0036 serverApiUrl = new FormControl('localhost');
0037 serverApiPort: FormControl<number | null> = new FormControl(5454);
0038 firebirdConfig: ServerConfig = defaultFirebirdConfig;
0039
0040
0041 @ViewChild('geometrySelect')
0042 geometrySelect!: ResourceSelectComponent;
0043
0044 @ViewChild('edm4eicSelect')
0045 edm4eicSelect!: ResourceSelectComponent;
0046
0047 @ViewChild('trajectorySelect')
0048 trajectorySelect!: ResourceSelectComponent;
0049
0050
0051 public geometryOptions: string[] = [
0052 "builtin://epic-central-optimized",
0053 "https://eic.github.io/epic/artifacts/tgeo/epic_bhcal.root",
0054 "https://eic.github.io/epic/artifacts/tgeo/epic_calorimeters.root",
0055 "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake.root",
0056 "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_10x100.root",
0057 "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_10x275.root",
0058 "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_18x110_Au.root",
0059 "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_18x275.root",
0060 "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_5x41.root",
0061 "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_material_map.root",
0062 "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_no_bhcal.root",
0063 "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_tracking_only.root",
0064 "https://eic.github.io/epic/artifacts/tgeo/epic_dirc_only.root",
0065 "https://eic.github.io/epic/artifacts/tgeo/epic_drich_only.root",
0066 "https://eic.github.io/epic/artifacts/tgeo/epic_forward_detectors.root",
0067 "https://eic.github.io/epic/artifacts/tgeo/epic_forward_detectors_with_inserts.root",
0068 "https://eic.github.io/epic/artifacts/tgeo/epic_full.root",
0069 "https://eic.github.io/epic/artifacts/tgeo/epic_imaging_only.root",
0070 "https://eic.github.io/epic/artifacts/tgeo/epic_inner_detector.root",
0071 "https://eic.github.io/epic/artifacts/tgeo/epic_ip6.root",
0072 "https://eic.github.io/epic/artifacts/tgeo/epic_ip6_extended.root",
0073 "https://eic.github.io/epic/artifacts/tgeo/epic_lfhcal_only.root",
0074 "https://eic.github.io/epic/artifacts/tgeo/epic_lfhcal_with_insert.root",
0075 "https://eic.github.io/epic/artifacts/tgeo/epic_mrich_only.root",
0076 "https://eic.github.io/epic/artifacts/tgeo/epic_pfrich_only.root",
0077 "https://eic.github.io/epic/artifacts/tgeo/epic_pid_only.root",
0078 "https://eic.github.io/epic/artifacts/tgeo/epic_tof_endcap_only.root",
0079 "https://eic.github.io/epic/artifacts/tgeo/epic_tof_only.root",
0080 "https://eic.github.io/epic/artifacts/tgeo/epic_vertex_only.root",
0081 "https://eic.github.io/epic/artifacts/tgeo/epic_zdc_lyso_sipm.root",
0082 "https://eic.github.io/epic/artifacts/tgeo/epic_zdc_sipm_on_tile_only.root"
0083 ];
0084
0085 public trajectoryOptions: string[] = [
0086 "https://firebird-eic.org/dirc_event.json.zip",
0087 "https://firebird-eic.org/py8_dis-cc_10x100_minq2-1000_minp-300mev_vtxcut-5m_nevt-5.evt.zip",
0088 "https://firebird-eic.org/py8_dis-cc_18x275_minq2-1000_minp-300mev_vtxcut-5m_nevt-5.evt.zip",
0089 "https://firebird-eic.org/py8_dis-cc_18x275_minq2-100_minp-300mev_vtxcut-5m_nevt-5.evt.zip",
0090 "https://firebird-eic.org/py8_dis-cc_5x41_minq2-100_minp-300mev_vtxcut-5m_nevt-5.evt.zip",
0091 "https://firebird-eic.org/py8_dis-cc_all_minq2-100_minp-300mev_vtxcut-5m_nevt-5.evt.zip",
0092 "https://firebird-eic.org/py8_dis-nc_10x100_minq2-1000_minp-300mev_vtxcut-5m_nevt-5.evt.zip",
0093 "https://firebird-eic.org/py8_dis-nc_10x100_minq2-100_minp-300mev_vtxcut-5m_nevt-5.evt.zip",
0094 "https://firebird-eic.org/py8_dis-nc_10x100_minq2-1_minp-300mev_vtxcut-5m_nevt-5.evt.zip",
0095 "https://firebird-eic.org/py8_dis-nc_18x275_minq2-1000_minp-300mev_vtxcut-5m_nevt-5.evt.zip",
0096 "https://firebird-eic.org/py8_dis-nc_18x275_minq2-100_minp-300mev_vtxcut-5m_nevt-5.evt.zip",
0097 "https://firebird-eic.org/py8_dis-nc_18x275_minq2-1_minp-300mev_vtxcut-5m_nevt-5.evt.zip",
0098 "https://firebird-eic.org/py8_dis-nc_5x41_minq2-100_minp-300mev_vtxcut-5m_nevt-5.evt.zip",
0099 "https://firebird-eic.org/py8_dis-nc_all_minq2-1_minp-300mev_vtxcut-5m_nevt-5.evt.zip",
0100 ]
0101
0102
0103
0104 public edm4eicOptions: string[] = [
0105 "",
0106
0107 ];
0108
0109
0110 constructor(private userConfigService: UserConfigService,
0111 private firebirdConfigService: ServerConfigService) {
0112 }
0113
0114
0115 bindConfigToControl<Type>(control: FormControl<Type | null>, config: ConfigProperty<Type> ) {
0116 control.setValue(config.value, { emitEvent: false })
0117 control.valueChanges.subscribe(
0118 value => {
0119 if(value !== null) {
0120 config.value=value;
0121 }
0122 }
0123 );
0124 config.changes$.subscribe(
0125 value => {
0126 control.setValue(value, { emitEvent: false })
0127 }
0128 );
0129 }
0130
0131 ngAfterViewInit() {
0132 // Now the 'geometrySelect' is available
0133 this.bindConfigToControl(this.geometrySelect.value, this.userConfigService.selectedGeometry);
0134 this.bindConfigToControl(this.edm4eicSelect.value, this.userConfigService.edm4eicEventSource);
0135 this.bindConfigToControl(this.trajectorySelect.value, this.userConfigService.trajectoryEventSource);
0136 }
0137
0138 ngOnInit(): void {
0139 //this.selectedGeometry.setValue(this.configService.selectedGeometry.value, { emitEvent: false })
0140 //this.bindConfigToControl(this.geometryUrl, this.configService.selectedGeometry);
0141 //this.bindConfigToControl(this.selectedEventSource, this.configService.trajectoryEventSource);
0142 this.bindConfigToControl(this.onlyCentralDetector, this.userConfigService.onlyCentralDetector);
0143 this.bindConfigToControl(this.serverUseApi, this.userConfigService.localServerUseApi);
0144 this.bindConfigToControl(this.serverApiUrl, this.userConfigService.localServerUrl);
0145
0146 this.firebirdConfig = this.firebirdConfigService.config;
0147 }
0148 }