diff --git a/Waveform/WaveformConditions/WaveCondUtils/scripts/makeDigiDB.py b/Waveform/WaveformConditions/WaveCondUtils/scripts/makeDigiDB.py index 40e4247398e516c884152f5e30de34fd26977a8c..3d113c50e41ae4245d60d49d0af8258d0cb1d5d5 100755 --- a/Waveform/WaveformConditions/WaveCondUtils/scripts/makeDigiDB.py +++ b/Waveform/WaveformConditions/WaveCondUtils/scripts/makeDigiDB.py @@ -57,7 +57,77 @@ if not folder: # Crystalball function Parameters estimated from Deion's slides uploaded at # https://indico.cern.ch/event/1099652/contributions/4626975/attachments/2352595/4013927/Faser-Physics-run3933-plots.pdf (20/01/2022) -# Fill values into record +# Updated after the geometry updates November 2023 +# This also requires different testbeam and TI12 values +testbeam_iov = (1000 << 32) + +# Start with the testbeam +base_mean = 15350. +base_rms = 3. + +# Calorimeter default (low gain/filters) +calo_record = cool.Record(spec) +calo_record['base_mean'] = base_mean +calo_record['base_rms'] = base_rms +calo_record['cb_norm'] = 0.69 +calo_record['cb_mean'] = 815 # Time in ns +calo_record['cb_sigma'] = 4.14 +calo_record['cb_alpha'] = -0.32 +calo_record['cb_n'] = 1000. + +vetonu_record = cool.Record(spec) +vetonu_record['base_mean'] = base_mean +vetonu_record['base_rms'] = base_rms +vetonu_record['cb_norm'] = 19360 +vetonu_record['cb_mean'] = 810 # Time in ns +vetonu_record['cb_sigma'] = 7.68 +vetonu_record['cb_alpha'] = -0.38 +vetonu_record['cb_n'] = 1000. + +veto_record = vetonu_record # not sure if testbeam reco uses vetoNu or veto digi parameters + +preshower_record = cool.Record(spec) +preshower_record['base_mean'] = base_mean +preshower_record['base_rms'] = base_rms +preshower_record['cb_norm'] = 500 +preshower_record['cb_mean'] = 845 # Time in ns +preshower_record['cb_sigma'] = 5.2 +preshower_record['cb_alpha'] = -0.30 +preshower_record['cb_n'] = 1000. + +# Low gain, filters in default +tag = "WAVE-Digitization-02-LG" +calo_record['cb_norm'] = 0.69 +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, calo_record, 0, tag) +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, vetonu_record, 1, tag) +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, veto_record, 2, tag) +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, preshower_record, 4, tag) + +# Low gain, filters out +tag = "WAVE-Digitization-02-LG-nofilt" +calo_record['cb_norm'] = 6.9 +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, calo_record, 0, tag) +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, vetonu_record, 1, tag) +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, veto_record, 2, tag) +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, preshower_record, 4, tag) + +# High gain +tag = "WAVE-Digitization-02-HG" +calo_record['cb_norm'] = 20.7 +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, calo_record, 0, tag) +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, vetonu_record, 1, tag) +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, veto_record, 2, tag) +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, preshower_record, 4, tag) + +# High gain, filters out +tag = "WAVE-Digitization-02-HG-nofilt" +calo_record['cb_norm'] = 207 +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, calo_record, 0, tag) +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, vetonu_record, 1, tag) +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, veto_record, 2, tag) +folder.storeObject( cool.ValidityKeyMin, testbeam_iov, preshower_record, 4, tag) + +# Now fill TI12 values # Values in ADC counts base_mean = 15650. base_rms = 3. @@ -66,7 +136,7 @@ base_rms = 3. calo_record = cool.Record(spec) calo_record['base_mean'] = base_mean calo_record['base_rms'] = base_rms -calo_record['cb_norm'] = 0.56 +calo_record['cb_norm'] = 0.55 calo_record['cb_mean'] = 820 # Time in ns calo_record['cb_sigma'] = 3.67 calo_record['cb_alpha'] = -0.32 @@ -75,8 +145,8 @@ calo_record['cb_n'] = 1000. vetonu_record = cool.Record(spec) vetonu_record['base_mean'] = base_mean vetonu_record['base_rms'] = base_rms -vetonu_record['cb_norm'] = 7040 -vetonu_record['cb_mean'] = 815 # Time in ns +vetonu_record['cb_norm'] = 10420 +vetonu_record['cb_mean'] = 800 # Time in ns vetonu_record['cb_sigma'] = 5.0 vetonu_record['cb_alpha'] = -0.28 vetonu_record['cb_n'] = 1000. @@ -84,8 +154,8 @@ vetonu_record['cb_n'] = 1000. veto_record = cool.Record(spec) veto_record['base_mean'] = base_mean veto_record['base_rms'] = base_rms -veto_record['cb_norm'] = 6840 -veto_record['cb_mean'] = 815 # Time in ns +veto_record['cb_norm'] = 8890 +veto_record['cb_mean'] = 825 # Time in ns veto_record['cb_sigma'] = 3.35 veto_record['cb_alpha'] = -0.32 veto_record['cb_n'] = 9. @@ -93,8 +163,8 @@ veto_record['cb_n'] = 9. timing_record = cool.Record(spec) timing_record['base_mean'] = base_mean timing_record['base_rms'] = base_rms -timing_record['cb_norm'] = 4240 -timing_record['cb_mean'] = 815 # Time in ns +timing_record['cb_norm'] = 6360 +timing_record['cb_mean'] = 830 # Time in ns timing_record['cb_sigma'] = 3.21 timing_record['cb_alpha'] = -0.424 timing_record['cb_n'] = 6.14 @@ -102,8 +172,8 @@ timing_record['cb_n'] = 6.14 preshower_record = cool.Record(spec) preshower_record['base_mean'] = base_mean preshower_record['base_rms'] = base_rms -preshower_record['cb_norm'] = 400 -preshower_record['cb_mean'] = 846 # Time in ns +preshower_record['cb_norm'] = 530 +preshower_record['cb_mean'] = 850 # Time in ns preshower_record['cb_sigma'] = 4.0 preshower_record['cb_alpha'] = -0.32 preshower_record['cb_n'] = 1000. @@ -112,50 +182,60 @@ preshower_record['cb_n'] = 1000. # Values: 0.56, 5.6, 16.8, 168 # Dec. 19, 2022 # Lowered by 10% to 0.51, 5.1, 15.3, 153 +# Nov. 21, 2023 +# Adjusted to 0.55, 5.5, 16.5, 165 # Low gain, filters in default -calo_record['cb_norm'] = 0.51 -tag = "WAVE-Digitization-01-LG" -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, calo_record, 0, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, vetonu_record, 1, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, veto_record, 2, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, timing_record, 3, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, preshower_record, 4, tag) -folder.createTagRelation("WAVE-01", tag) - -# Also associate this default with all of the global tags -# We will use a folder override to set other conditions -wave_folder.createTagRelation("OFLCOND-FASER-TB00", "WAVE-01") -wave_folder.createTagRelation("OFLCOND-FASER-01", "WAVE-01") -wave_folder.createTagRelation("OFLCOND-FASER-02", "WAVE-01") -wave_folder.createTagRelation("OFLCOND-FASER-03", "WAVE-01") +calo_record['cb_norm'] = 0.55 +tag = "WAVE-Digitization-02-LG" +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, calo_record, 0, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, vetonu_record, 1, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, veto_record, 2, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, timing_record, 3, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, preshower_record, 4, tag) # Low gain, filters out -tag = "WAVE-Digitization-01-LG-nofilt" -calo_record['cb_norm'] = 5.1 -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, calo_record, 0, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, vetonu_record, 1, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, veto_record, 2, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, timing_record, 3, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, preshower_record, 4, tag) +tag = "WAVE-Digitization-02-LG-nofilt" +calo_record['cb_norm'] = 5.5 +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, calo_record, 0, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, vetonu_record, 1, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, veto_record, 2, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, timing_record, 3, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, preshower_record, 4, tag) # High gain -tag = "WAVE-Digitization-01-HG" -calo_record['cb_norm'] = 15.3 -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, calo_record, 0, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, vetonu_record, 1, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, veto_record, 2, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, timing_record, 3, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, preshower_record, 4, tag) +tag = "WAVE-Digitization-02-HG" +calo_record['cb_norm'] = 16.5 +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, calo_record, 0, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, vetonu_record, 1, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, veto_record, 2, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, timing_record, 3, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, preshower_record, 4, tag) # High gain, filters out -tag = "WAVE-Digitization-01-HG-nofilt" -calo_record['cb_norm'] = 153 -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, calo_record, 0, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, vetonu_record, 1, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, veto_record, 2, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, timing_record, 3, tag) -folder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, preshower_record, 4, tag) +tag = "WAVE-Digitization-02-HG-nofilt" +calo_record['cb_norm'] = 165 +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, calo_record, 0, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, vetonu_record, 1, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, veto_record, 2, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, timing_record, 3, tag) +folder.storeObject( testbeam_iov, cool.ValidityKeyMax, preshower_record, 4, tag) + +# Make the tag releations +# This is the default folder tag +folder.createTagRelation("WAVE-02", "WAVE-Digitization-02-LG") + +# Also associate this default with all of the global tags +# We will use a folder override to set other conditions +# Assign to global tags used with new geometry +wave_folder.createTagRelation("OFLCOND-FASER-TB01", "WAVE-02") +wave_folder.createTagRelation("OFLCOND-FASER-04", "WAVE-02") + +# Previous +#wave_folder.createTagRelation("OFLCOND-FASER-TB00", "WAVE-01") +#wave_folder.createTagRelation("OFLCOND-FASER-01", "WAVE-01") +#wave_folder.createTagRelation("OFLCOND-FASER-02", "WAVE-01") +#wave_folder.createTagRelation("OFLCOND-FASER-03", "WAVE-01") # All done db.closeDatabase() diff --git a/Waveform/WaveformConditions/WaveCondUtils/scripts/makeTimingDB.py b/Waveform/WaveformConditions/WaveCondUtils/scripts/makeTimingDB.py index 0074c2b69906eda40667defdebd2596ff96d8652..640b684042565ad09468a951f2b83923e4bb217b 100755 --- a/Waveform/WaveformConditions/WaveCondUtils/scripts/makeTimingDB.py +++ b/Waveform/WaveformConditions/WaveCondUtils/scripts/makeTimingDB.py @@ -5,8 +5,8 @@ # Can test results with # AtlCoolConsole.py "sqlite://;schema=waveform_reco.db;dbname=OFLP200" -#filename = 'waveform_reco.db' -filename = 'ALLP200.db' +filename = 'waveform_timing.db' +#filename = 'ALLP200.db' # Nominal trigger time in ns nominal_data = { @@ -24,13 +24,16 @@ nominal_data = { ehn1_offsets = [ -20., -20., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. ] ti12_offsets = [ -20., -20., -20., -20., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. ] +tb_offsets = [ -10., -10., -10., -10., -10., -10., 15., 15., -20., -20., 0., 0., 0., 0., 0., 0. ] + +final_offsets = [ -10., -10., -10., -10., -25., -25., 0., 0., 0., 0., 0., 0., 18., 18., 0., 0. ] offset_data = { 0: [ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. ], # Initial TI12 1324: [ -10., -10., -10., -10., 0., 0., 0., 0., 0., 0., 0., 0., 18., 18., 0., 0. ], # Testbeam geometry - 3247: [ -10., -10., -10., -10., -10., -10., 15., 15., -20., -20., 0., 0., 0., 0., 0., 0. ], + 3247: tb_offsets, # TI12 4272: ti12_offsets, # EHN1 (interleaved with TI12 running) @@ -56,7 +59,6 @@ offset_data = { 6525: [ -10., -10., -10., -10., -25., -25., 0., 0., 0., 0., 0., 0., 18., 18., 0., 0. ], # 2024, add 2nd digitizer 13847: [ -10., -10., -10., -10., -25., -25., 0., 0., 0., 0., 0., 0., 18., 18., 0., 0., -10., -10., -10., -10. ] - } attr_list_desc = '<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type="71" clid="40774348" /></addrHeader><typeName>AthenaAttributeList</typeName>' @@ -202,25 +204,26 @@ except Exception as e: nominalSpec = cool.RecordSpecification() nominalSpec.extend( 'NominalTriggerTime', cool.StorageType.Float ) -nominalFolderSpec = cool.FolderSpecification(cool.FolderVersioning.SINGLE_VERSION, nominalSpec) +nominalFolderSpec = cool.FolderSpecification(cool.FolderVersioning.MULTI_VERSION, nominalSpec) nominalFolder = db.createFolder('/WAVE/DAQ/Timing', nominalFolderSpec, attr_list_desc, True) # There should be one record entered per IOV +tag = 'WAVE-DAQ-Timing-01' lastValid = cool.ValidityKeyMax for firstValidRun, time in reversed(nominal_data.items()): firstValid = (firstValidRun << 32) nominalRecord = cool.Record(nominalSpec) nominalRecord[ 'NominalTriggerTime' ] = float(time) - nominalFolder.storeObject( firstValid, lastValid, nominalRecord, cool.ChannelId(0)) + nominalFolder.storeObject( firstValid, lastValid, nominalRecord, cool.ChannelId(0), tag) lastValid = ((firstValidRun - 1) << 32) | (cool.ValidityKeyMax & 0x00000000FFFFFFFF) # Trigger offset times - +tag = 'WAVE-DAQ-TimingOffset-01' offsetSpec = cool.RecordSpecification() offsetSpec.extend( 'TriggerOffset', cool.StorageType.Float ) -offsetFolderSpec = cool.FolderSpecification(cool.FolderVersioning.SINGLE_VERSION, offsetSpec) +offsetFolderSpec = cool.FolderSpecification(cool.FolderVersioning.MULTI_VERSION, offsetSpec) offsetFolder = db.createFolder('/WAVE/DAQ/TimingOffset', offsetFolderSpec, cond_attr_list_desc, True) # There should be one record entered per IOV @@ -230,7 +233,25 @@ for firstValidRun, offset_list in reversed(offset_data.items()): for channel in range(len(offset_list)): offsetRecord = cool.Record(offsetSpec) offsetRecord[ 'TriggerOffset' ] = float(offset_list[channel]) - offsetFolder.storeObject( firstValid, lastValid, offsetRecord, cool.ChannelId(channel) ) + offsetFolder.storeObject( firstValid, lastValid, offsetRecord, cool.ChannelId(channel), tag ) + + lastValid = ((firstValidRun - 1) << 32) | (cool.ValidityKeyMax & 0x00000000FFFFFFFF) + +# Now make offsets that match real data +offset_data = { + 0: tb_offsets, + 1000: final_offsets +} + +tag = 'WAVE-DAQ-TimingOffset-02' +# There should be one record entered per IOV +lastValid = cool.ValidityKeyMax +for firstValidRun, offset_list in reversed(offset_data.items()): + firstValid = (firstValidRun << 32) + for channel in range(offset_channels): + offsetRecord = cool.Record(offsetSpec) + offsetRecord[ 'TriggerOffset' ] = float(offset_list[channel]) + offsetFolder.storeObject( firstValid, lastValid, offsetRecord, cool.ChannelId(channel), tag ) lastValid = ((firstValidRun - 1) << 32) | (cool.ValidityKeyMax & 0x00000000FFFFFFFF)