From ddec69e196784d7f1579d287f7e7b76ff6cf2892 Mon Sep 17 00:00:00 2001 From: echenard Date: Thu, 28 May 2026 19:15:57 -0500 Subject: [PATCH 1/2] Added Calo crystal sim conditions --- CaloConditions/CMakeLists.txt | 7 +- CaloConditions/data/Sim_crystal.txt | 1348 +++++++++++++++++ CaloConditions/fcl/prolog.fcl | 11 +- .../inc/{CaloDAQMap.hh => CalDAQMap.hh} | 20 +- .../{CaloDAQMapCache.hh => CalDAQMapCache.hh} | 14 +- CaloConditions/inc/CalDAQMapMaker.hh | 33 + CaloConditions/inc/CalSimCrystal.hh | 49 + CaloConditions/inc/CalSimCrystalCache.hh | 58 + CaloConditions/inc/CalSimCrystalMaker.hh | 32 + CaloConditions/inc/CaloDAQMapMaker.hh | 33 - .../src/{CaloDAQMap.cc => CalDAQMap.cc} | 14 +- .../{CaloDAQMapMaker.cc => CalDAQMapMaker.cc} | 36 +- CaloConditions/src/CalSimCrystal.cc | 32 + CaloConditions/src/CalSimCrystalMaker.cc | 110 ++ CaloConfig/CMakeLists.txt | 3 +- ...CaloDAQMapConfig.hh => CalDAQMapConfig.hh} | 8 +- CaloConfig/inc/CalSimCrystalConfig.hh | 22 + CaloMC/CMakeLists.txt | 1 + CaloMC/fcl/prolog.fcl | 7 +- CaloMC/src/CaloDigiMaker_module.cc | 31 +- CaloMC/src/CaloShowerROMaker_module.cc | 70 +- CaloMC/src/SConscript | 2 + CaloReco/src/CaloHitMakerFast_module.cc | 1 - DAQ/src/ArtBinaryPacketsFromDigis_module.cc | 14 +- DAQ/src/CaloDigisFromDTCEvents_module.cc | 10 +- DAQ/src/CaloDigisToFragments_module.cc | 4 +- DAQ/src/CaloHitsFromDTCEvents_module.cc | 10 +- DbTables/inc/CalCrystals.hh | 70 + ProditionsService/fcl/prolog.fcl | 5 +- ProditionsService/inc/ProditionsService.hh | 13 +- ProditionsService/src/ProditionsService.cc | 10 +- 31 files changed, 1894 insertions(+), 184 deletions(-) create mode 100644 CaloConditions/data/Sim_crystal.txt rename CaloConditions/inc/{CaloDAQMap.hh => CalDAQMap.hh} (63%) rename CaloConditions/inc/{CaloDAQMapCache.hh => CalDAQMapCache.hh} (77%) create mode 100644 CaloConditions/inc/CalDAQMapMaker.hh create mode 100644 CaloConditions/inc/CalSimCrystal.hh create mode 100644 CaloConditions/inc/CalSimCrystalCache.hh create mode 100644 CaloConditions/inc/CalSimCrystalMaker.hh delete mode 100644 CaloConditions/inc/CaloDAQMapMaker.hh rename CaloConditions/src/{CaloDAQMap.cc => CalDAQMap.cc} (56%) rename CaloConditions/src/{CaloDAQMapMaker.cc => CalDAQMapMaker.cc} (60%) create mode 100644 CaloConditions/src/CalSimCrystal.cc create mode 100644 CaloConditions/src/CalSimCrystalMaker.cc rename CaloConfig/inc/{CaloDAQMapConfig.hh => CalDAQMapConfig.hh} (75%) create mode 100644 CaloConfig/inc/CalSimCrystalConfig.hh create mode 100644 DbTables/inc/CalCrystals.hh diff --git a/CaloConditions/CMakeLists.txt b/CaloConditions/CMakeLists.txt index f3fc4c6ae2..d6530d64ef 100644 --- a/CaloConditions/CMakeLists.txt +++ b/CaloConditions/CMakeLists.txt @@ -2,8 +2,10 @@ cet_make_library( SOURCE src/CalCalib.cc src/CalCalibMaker.cc - src/CaloDAQMap.cc - src/CaloDAQMapMaker.cc + src/CalSimCrystal.cc + src/CalSimCrystalMaker.cc + src/CalDAQMap.cc + src/CalDAQMapMaker.cc LIBRARIES PUBLIC Offline::CaloConfig @@ -18,6 +20,7 @@ cet_make_library( configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/nominal.txt ${CURRENT_BINARY_DIR} data/nominal.txt) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/caloDMAP_nominal.dat ${CURRENT_BINARY_DIR} data/caloDMAP_nominal.dat) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/Sim_crystal.dat ${CURRENT_BINARY_DIR} data/Sim_crystal.dat) install(DIRECTORY data DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/Offline/CaloConditions) diff --git a/CaloConditions/data/Sim_crystal.txt b/CaloConditions/data/Sim_crystal.txt new file mode 100644 index 0000000000..c84a04ef00 --- /dev/null +++ b/CaloConditions/data/Sim_crystal.txt @@ -0,0 +1,1348 @@ +0 0.05 30 30 +1 0.05 30 30 +2 0.05 30 30 +3 0.05 30 30 +4 0.05 30 30 +5 0.05 30 30 +6 0.05 30 30 +7 0.05 30 30 +8 0.05 30 30 +9 0.05 30 30 +10 0.05 30 30 +11 0.05 30 30 +12 0.05 30 30 +13 0.05 30 30 +14 0.05 30 30 +15 0.05 30 30 +16 0.05 30 30 +17 0.05 30 30 +18 0.05 30 30 +19 0.05 30 30 +20 0.05 30 30 +21 0.05 30 30 +22 0.05 30 30 +23 0.05 30 30 +24 0.05 30 30 +25 0.05 30 30 +26 0.05 30 30 +27 0.05 30 30 +28 0.05 30 30 +29 0.05 30 30 +30 0.05 30 30 +31 0.05 30 30 +32 0.05 30 30 +33 0.05 30 30 +34 0.05 30 30 +35 0.05 30 30 +36 0.05 30 30 +37 0.05 30 30 +38 0.05 30 30 +39 0.05 30 30 +40 0.05 30 30 +41 0.05 30 30 +42 0.05 30 30 +43 0.05 30 30 +44 0.05 30 30 +45 0.05 30 30 +46 0.05 30 30 +47 0.05 30 30 +48 0.05 30 30 +49 0.05 30 30 +50 0.05 30 30 +51 0.05 30 30 +52 0.05 30 30 +53 0.05 30 30 +54 0.05 30 30 +55 0.05 30 30 +56 0.05 30 30 +57 0.05 30 30 +58 0.05 30 30 +59 0.05 30 30 +60 0.05 30 30 +61 0.05 30 30 +62 0.05 30 30 +63 0.05 30 30 +64 0.05 30 30 +65 0.05 30 30 +66 0.05 30 30 +67 0.05 30 30 +68 0.05 30 30 +69 0.05 30 30 +70 0.05 30 30 +71 0.05 30 30 +72 0.05 30 30 +73 0.05 30 30 +74 0.05 30 30 +75 0.05 30 30 +76 0.05 30 30 +77 0.05 30 30 +78 0.05 30 30 +79 0.05 30 30 +80 0.05 30 30 +81 0.05 30 30 +82 0.05 30 30 +83 0.05 30 30 +84 0.05 30 30 +85 0.05 30 30 +86 0.05 30 30 +87 0.05 30 30 +88 0.05 30 30 +89 0.05 30 30 +90 0.05 30 30 +91 0.05 30 30 +92 0.05 30 30 +93 0.05 30 30 +94 0.05 30 30 +95 0.05 30 30 +96 0.05 30 30 +97 0.05 30 30 +98 0.05 30 30 +99 0.05 30 30 +100 0.05 30 30 +101 0.05 30 30 +102 0.05 30 30 +103 0.05 30 30 +104 0.05 30 30 +105 0.05 30 30 +106 0.05 30 30 +107 0.05 30 30 +108 0.05 30 30 +109 0.05 30 30 +110 0.05 30 30 +111 0.05 30 30 +112 0.05 30 30 +113 0.05 30 30 +114 0.05 30 30 +115 0.05 30 30 +116 0.05 30 30 +117 0.05 30 30 +118 0.05 30 30 +119 0.05 30 30 +120 0.05 30 30 +121 0.05 30 30 +122 0.05 30 30 +123 0.05 30 30 +124 0.05 30 30 +125 0.05 30 30 +126 0.05 30 30 +127 0.05 30 30 +128 0.05 30 30 +129 0.05 30 30 +130 0.05 30 30 +131 0.05 30 30 +132 0.05 30 30 +133 0.05 30 30 +134 0.05 30 30 +135 0.05 30 30 +136 0.05 30 30 +137 0.05 30 30 +138 0.05 30 30 +139 0.05 30 30 +140 0.05 30 30 +141 0.05 30 30 +142 0.05 30 30 +143 0.05 30 30 +144 0.05 30 30 +145 0.05 30 30 +146 0.05 30 30 +147 0.05 30 30 +148 0.05 30 30 +149 0.05 30 30 +150 0.05 30 30 +151 0.05 30 30 +152 0.05 30 30 +153 0.05 30 30 +154 0.05 30 30 +155 0.05 30 30 +156 0.05 30 30 +157 0.05 30 30 +158 0.05 30 30 +159 0.05 30 30 +160 0.05 30 30 +161 0.05 30 30 +162 0.05 30 30 +163 0.05 30 30 +164 0.05 30 30 +165 0.05 30 30 +166 0.05 30 30 +167 0.05 30 30 +168 0.05 30 30 +169 0.05 30 30 +170 0.05 30 30 +171 0.05 30 30 +172 0.05 30 30 +173 0.05 30 30 +174 0.05 30 30 +175 0.05 30 30 +176 0.05 30 30 +177 0.05 30 30 +178 0.05 30 30 +179 0.05 30 30 +180 0.05 30 30 +181 0.05 30 30 +182 0.05 30 30 +183 0.05 30 30 +184 0.05 30 30 +185 0.05 30 30 +186 0.05 30 30 +187 0.05 30 30 +188 0.05 30 30 +189 0.05 30 30 +190 0.05 30 30 +191 0.05 30 30 +192 0.05 30 30 +193 0.05 30 30 +194 0.05 30 30 +195 0.05 30 30 +196 0.05 30 30 +197 0.05 30 30 +198 0.05 30 30 +199 0.05 30 30 +200 0.05 30 30 +201 0.05 30 30 +202 0.05 30 30 +203 0.05 30 30 +204 0.05 30 30 +205 0.05 30 30 +206 0.05 30 30 +207 0.05 30 30 +208 0.05 30 30 +209 0.05 30 30 +210 0.05 30 30 +211 0.05 30 30 +212 0.05 30 30 +213 0.05 30 30 +214 0.05 30 30 +215 0.05 30 30 +216 0.05 30 30 +217 0.05 30 30 +218 0.05 30 30 +219 0.05 30 30 +220 0.05 30 30 +221 0.05 30 30 +222 0.05 30 30 +223 0.05 30 30 +224 0.05 30 30 +225 0.05 30 30 +226 0.05 30 30 +227 0.05 30 30 +228 0.05 30 30 +229 0.05 30 30 +230 0.05 30 30 +231 0.05 30 30 +232 0.05 30 30 +233 0.05 30 30 +234 0.05 30 30 +235 0.05 30 30 +236 0.05 30 30 +237 0.05 30 30 +238 0.05 30 30 +239 0.05 30 30 +240 0.05 30 30 +241 0.05 30 30 +242 0.05 30 30 +243 0.05 30 30 +244 0.05 30 30 +245 0.05 30 30 +246 0.05 30 30 +247 0.05 30 30 +248 0.05 30 30 +249 0.05 30 30 +250 0.05 30 30 +251 0.05 30 30 +252 0.05 30 30 +253 0.05 30 30 +254 0.05 30 30 +255 0.05 30 30 +256 0.05 30 30 +257 0.05 30 30 +258 0.05 30 30 +259 0.05 30 30 +260 0.05 30 30 +261 0.05 30 30 +262 0.05 30 30 +263 0.05 30 30 +264 0.05 30 30 +265 0.05 30 30 +266 0.05 30 30 +267 0.05 30 30 +268 0.05 30 30 +269 0.05 30 30 +270 0.05 30 30 +271 0.05 30 30 +272 0.05 30 30 +273 0.05 30 30 +274 0.05 30 30 +275 0.05 30 30 +276 0.05 30 30 +277 0.05 30 30 +278 0.05 30 30 +279 0.05 30 30 +280 0.05 30 30 +281 0.05 30 30 +282 0.05 30 30 +283 0.05 30 30 +284 0.05 30 30 +285 0.05 30 30 +286 0.05 30 30 +287 0.05 30 30 +288 0.05 30 30 +289 0.05 30 30 +290 0.05 30 30 +291 0.05 30 30 +292 0.05 30 30 +293 0.05 30 30 +294 0.05 30 30 +295 0.05 30 30 +296 0.05 30 30 +297 0.05 30 30 +298 0.05 30 30 +299 0.05 30 30 +300 0.05 30 30 +301 0.05 30 30 +302 0.05 30 30 +303 0.05 30 30 +304 0.05 30 30 +305 0.05 30 30 +306 0.05 30 30 +307 0.05 30 30 +308 0.05 30 30 +309 0.05 30 30 +310 0.05 30 30 +311 0.05 30 30 +312 0.05 30 30 +313 0.05 30 30 +314 0.05 30 30 +315 0.05 30 30 +316 0.05 30 30 +317 0.05 30 30 +318 0.05 30 30 +319 0.05 30 30 +320 0.05 30 30 +321 0.05 30 30 +322 0.05 30 30 +323 0.05 30 30 +324 0.05 30 30 +325 0.05 30 30 +326 0.05 30 30 +327 0.05 30 30 +328 0.05 30 30 +329 0.05 30 30 +330 0.05 30 30 +331 0.05 30 30 +332 0.05 30 30 +333 0.05 30 30 +334 0.05 30 30 +335 0.05 30 30 +336 0.05 30 30 +337 0.05 30 30 +338 0.05 30 30 +339 0.05 30 30 +340 0.05 30 30 +341 0.05 30 30 +342 0.05 30 30 +343 0.05 30 30 +344 0.05 30 30 +345 0.05 30 30 +346 0.05 30 30 +347 0.05 30 30 +348 0.05 30 30 +349 0.05 30 30 +350 0.05 30 30 +351 0.05 30 30 +352 0.05 30 30 +353 0.05 30 30 +354 0.05 30 30 +355 0.05 30 30 +356 0.05 30 30 +357 0.05 30 30 +358 0.05 30 30 +359 0.05 30 30 +360 0.05 30 30 +361 0.05 30 30 +362 0.05 30 30 +363 0.05 30 30 +364 0.05 30 30 +365 0.05 30 30 +366 0.05 30 30 +367 0.05 30 30 +368 0.05 30 30 +369 0.05 30 30 +370 0.05 30 30 +371 0.05 30 30 +372 0.05 30 30 +373 0.05 30 30 +374 0.05 30 30 +375 0.05 30 30 +376 0.05 30 30 +377 0.05 30 30 +378 0.05 30 30 +379 0.05 30 30 +380 0.05 30 30 +381 0.05 30 30 +382 0.05 30 30 +383 0.05 30 30 +384 0.05 30 30 +385 0.05 30 30 +386 0.05 30 30 +387 0.05 30 30 +388 0.05 30 30 +389 0.05 30 30 +390 0.05 30 30 +391 0.05 30 30 +392 0.05 30 30 +393 0.05 30 30 +394 0.05 30 30 +395 0.05 30 30 +396 0.05 30 30 +397 0.05 30 30 +398 0.05 30 30 +399 0.05 30 30 +400 0.05 30 30 +401 0.05 30 30 +402 0.05 30 30 +403 0.05 30 30 +404 0.05 30 30 +405 0.05 30 30 +406 0.05 30 30 +407 0.05 30 30 +408 0.05 30 30 +409 0.05 30 30 +410 0.05 30 30 +411 0.05 30 30 +412 0.05 30 30 +413 0.05 30 30 +414 0.05 30 30 +415 0.05 30 30 +416 0.05 30 30 +417 0.05 30 30 +418 0.05 30 30 +419 0.05 30 30 +420 0.05 30 30 +421 0.05 30 30 +422 0.05 30 30 +423 0.05 30 30 +424 0.05 30 30 +425 0.05 30 30 +426 0.05 30 30 +427 0.05 30 30 +428 0.05 30 30 +429 0.05 30 30 +430 0.05 30 30 +431 0.05 30 30 +432 0.05 30 30 +433 0.05 30 30 +434 0.05 30 30 +435 0.05 30 30 +436 0.05 30 30 +437 0.05 30 30 +438 0.05 30 30 +439 0.05 30 30 +440 0.05 30 30 +441 0.05 30 30 +442 0.05 30 30 +443 0.05 30 30 +444 0.05 30 30 +445 0.05 30 30 +446 0.05 30 30 +447 0.05 30 30 +448 0.05 30 30 +449 0.05 30 30 +450 0.05 30 30 +451 0.05 30 30 +452 0.05 30 30 +453 0.05 30 30 +454 0.05 30 30 +455 0.05 30 30 +456 0.05 30 30 +457 0.05 30 30 +458 0.05 30 30 +459 0.05 30 30 +460 0.05 30 30 +461 0.05 30 30 +462 0.05 30 30 +463 0.05 30 30 +464 0.05 30 30 +465 0.05 30 30 +466 0.05 30 30 +467 0.05 30 30 +468 0.05 30 30 +469 0.05 30 30 +470 0.05 30 30 +471 0.05 30 30 +472 0.05 30 30 +473 0.05 30 30 +474 0.05 30 30 +475 0.05 30 30 +476 0.05 30 30 +477 0.05 30 30 +478 0.05 30 30 +479 0.05 30 30 +480 0.05 30 30 +481 0.05 30 30 +482 0.05 30 30 +483 0.05 30 30 +484 0.05 30 30 +485 0.05 30 30 +486 0.05 30 30 +487 0.05 30 30 +488 0.05 30 30 +489 0.05 30 30 +490 0.05 30 30 +491 0.05 30 30 +492 0.05 30 30 +493 0.05 30 30 +494 0.05 30 30 +495 0.05 30 30 +496 0.05 30 30 +497 0.05 30 30 +498 0.05 30 30 +499 0.05 30 30 +500 0.05 30 30 +501 0.05 30 30 +502 0.05 30 30 +503 0.05 30 30 +504 0.05 30 30 +505 0.05 30 30 +506 0.05 30 30 +507 0.05 30 30 +508 0.05 30 30 +509 0.05 30 30 +510 0.05 30 30 +511 0.05 30 30 +512 0.05 30 30 +513 0.05 30 30 +514 0.05 30 30 +515 0.05 30 30 +516 0.05 30 30 +517 0.05 30 30 +518 0.05 30 30 +519 0.05 30 30 +520 0.05 30 30 +521 0.05 30 30 +522 0.05 30 30 +523 0.05 30 30 +524 0.05 30 30 +525 0.05 30 30 +526 0.05 30 30 +527 0.05 30 30 +528 0.05 30 30 +529 0.05 30 30 +530 0.05 30 30 +531 0.05 30 30 +532 0.05 30 30 +533 0.05 30 30 +534 0.05 30 30 +535 0.05 30 30 +536 0.05 30 30 +537 0.05 30 30 +538 0.05 30 30 +539 0.05 30 30 +540 0.05 30 30 +541 0.05 30 30 +542 0.05 30 30 +543 0.05 30 30 +544 0.05 30 30 +545 0.05 30 30 +546 0.05 30 30 +547 0.05 30 30 +548 0.05 30 30 +549 0.05 30 30 +550 0.05 30 30 +551 0.05 30 30 +552 0.05 30 30 +553 0.05 30 30 +554 0.05 30 30 +555 0.05 30 30 +556 0.05 30 30 +557 0.05 30 30 +558 0.05 30 30 +559 0.05 30 30 +560 0.05 30 30 +561 0.05 30 30 +562 0.05 30 30 +563 0.05 30 30 +564 0.05 30 30 +565 0.05 30 30 +566 0.05 30 30 +567 0.05 30 30 +568 0.05 30 30 +569 0.05 30 30 +570 0.05 30 30 +571 0.05 30 30 +572 0.05 30 30 +573 0.05 30 30 +574 0.05 30 30 +575 0.05 30 30 +576 0.05 30 30 +577 0.05 30 30 +578 0.05 30 30 +579 0.05 30 30 +580 0.05 30 30 +581 0.05 30 30 +582 0.05 500 500 +583 0.05 30 30 +584 0.05 30 30 +585 0.05 30 30 +586 0.05 30 30 +587 0.05 30 30 +588 0.05 30 30 +589 0.05 30 30 +590 0.05 30 30 +591 0.05 30 30 +592 0.05 30 30 +593 0.05 30 30 +594 0.05 30 30 +595 0.05 30 30 +596 0.05 30 30 +597 0.05 30 30 +598 0.05 30 30 +599 0.05 30 30 +600 0.05 30 30 +601 0.05 30 30 +602 0.05 30 30 +603 0.05 30 30 +604 0.05 30 30 +605 0.05 30 30 +606 0.05 30 30 +607 0.05 30 30 +608 0.05 30 30 +609 0.05 500 500 +610 0.05 500 500 +611 0.05 30 30 +612 0.05 30 30 +613 0.05 30 30 +614 0.05 30 30 +615 0.05 30 30 +616 0.05 30 30 +617 0.05 30 30 +618 0.05 30 30 +619 0.05 30 30 +620 0.05 30 30 +621 0.05 30 30 +622 0.05 30 30 +623 0.05 30 30 +624 0.05 30 30 +625 0.05 30 30 +626 0.05 30 30 +627 0.05 30 30 +628 0.05 30 30 +629 0.05 30 30 +630 0.05 30 30 +631 0.05 30 30 +632 0.05 30 30 +633 0.05 30 30 +634 0.05 30 30 +635 0.05 30 30 +636 0.05 30 30 +637 0.05 500 500 +638 0.05 30 30 +639 0.05 30 30 +640 0.05 30 30 +641 0.05 30 30 +642 0.05 30 30 +643 0.05 30 30 +644 0.05 30 30 +645 0.05 30 30 +646 0.05 30 30 +647 0.05 30 30 +648 0.05 30 30 +649 0.05 30 30 +650 0.05 30 30 +651 0.05 30 30 +652 0.05 30 30 +653 0.05 30 30 +654 0.05 30 30 +655 0.05 30 30 +656 0.05 30 30 +657 0.05 30 30 +658 0.05 30 30 +659 0.05 30 30 +660 0.05 30 30 +661 0.05 30 30 +662 0.05 30 30 +663 0.05 30 30 +664 0.05 30 30 +665 0.05 30 30 +666 0.05 30 30 +667 0.05 30 30 +668 0.05 30 30 +669 0.05 30 30 +670 0.05 30 30 +671 0.05 30 30 +672 0.05 30 30 +673 0.05 30 30 +674 0.05 30 30 +675 0.05 30 30 +676 0.05 30 30 +677 0.05 30 30 +678 0.05 30 30 +679 0.05 30 30 +680 0.05 30 30 +681 0.05 30 30 +682 0.05 30 30 +683 0.05 30 30 +684 0.05 30 30 +685 0.05 30 30 +686 0.05 30 30 +687 0.05 30 30 +688 0.05 30 30 +689 0.05 30 30 +690 0.05 30 30 +691 0.05 30 30 +692 0.05 30 30 +693 0.05 30 30 +694 0.05 30 30 +695 0.05 30 30 +696 0.05 30 30 +697 0.05 30 30 +698 0.05 30 30 +699 0.05 30 30 +700 0.05 30 30 +701 0.05 30 30 +702 0.05 30 30 +703 0.05 30 30 +704 0.05 30 30 +705 0.05 30 30 +706 0.05 30 30 +707 0.05 30 30 +708 0.05 30 30 +709 0.05 30 30 +710 0.05 30 30 +711 0.05 30 30 +712 0.05 30 30 +713 0.05 30 30 +714 0.05 30 30 +715 0.05 30 30 +716 0.05 30 30 +717 0.05 30 30 +718 0.05 30 30 +719 0.05 30 30 +720 0.05 30 30 +721 0.05 30 30 +722 0.05 30 30 +723 0.05 30 30 +724 0.05 30 30 +725 0.05 30 30 +726 0.05 30 30 +727 0.05 30 30 +728 0.05 30 30 +729 0.05 30 30 +730 0.05 30 30 +731 0.05 30 30 +732 0.05 30 30 +733 0.05 30 30 +734 0.05 30 30 +735 0.05 30 30 +736 0.05 30 30 +737 0.05 30 30 +738 0.05 30 30 +739 0.05 30 30 +740 0.05 30 30 +741 0.05 30 30 +742 0.05 30 30 +743 0.05 30 30 +744 0.05 30 30 +745 0.05 30 30 +746 0.05 30 30 +747 0.05 30 30 +748 0.05 30 30 +749 0.05 30 30 +750 0.05 30 30 +751 0.05 30 30 +752 0.05 30 30 +753 0.05 30 30 +754 0.05 30 30 +755 0.05 30 30 +756 0.05 30 30 +757 0.05 30 30 +758 0.05 30 30 +759 0.05 30 30 +760 0.05 30 30 +761 0.05 30 30 +762 0.05 30 30 +763 0.05 30 30 +764 0.05 30 30 +765 0.05 30 30 +766 0.05 30 30 +767 0.05 30 30 +768 0.05 30 30 +769 0.05 30 30 +770 0.05 30 30 +771 0.05 30 30 +772 0.05 30 30 +773 0.05 30 30 +774 0.05 30 30 +775 0.05 30 30 +776 0.05 30 30 +777 0.05 30 30 +778 0.05 30 30 +779 0.05 30 30 +780 0.05 30 30 +781 0.05 30 30 +782 0.05 30 30 +783 0.05 30 30 +784 0.05 30 30 +785 0.05 30 30 +786 0.05 30 30 +787 0.05 30 30 +788 0.05 30 30 +789 0.05 30 30 +790 0.05 30 30 +791 0.05 30 30 +792 0.05 30 30 +793 0.05 30 30 +794 0.05 30 30 +795 0.05 30 30 +796 0.05 30 30 +797 0.05 30 30 +798 0.05 30 30 +799 0.05 30 30 +800 0.05 30 30 +801 0.05 30 30 +802 0.05 30 30 +803 0.05 30 30 +804 0.05 30 30 +805 0.05 30 30 +806 0.05 30 30 +807 0.05 30 30 +808 0.05 30 30 +809 0.05 30 30 +810 0.05 30 30 +811 0.05 30 30 +812 0.05 30 30 +813 0.05 30 30 +814 0.05 30 30 +815 0.05 30 30 +816 0.05 30 30 +817 0.05 30 30 +818 0.05 30 30 +819 0.05 30 30 +820 0.05 30 30 +821 0.05 30 30 +822 0.05 30 30 +823 0.05 30 30 +824 0.05 30 30 +825 0.05 30 30 +826 0.05 30 30 +827 0.05 30 30 +828 0.05 30 30 +829 0.05 30 30 +830 0.05 30 30 +831 0.05 30 30 +832 0.05 30 30 +833 0.05 30 30 +834 0.05 30 30 +835 0.05 30 30 +836 0.05 30 30 +837 0.05 30 30 +838 0.05 30 30 +839 0.05 30 30 +840 0.05 30 30 +841 0.05 30 30 +842 0.05 30 30 +843 0.05 30 30 +844 0.05 30 30 +845 0.05 30 30 +846 0.05 30 30 +847 0.05 30 30 +848 0.05 30 30 +849 0.05 30 30 +850 0.05 30 30 +851 0.05 30 30 +852 0.05 30 30 +853 0.05 30 30 +854 0.05 30 30 +855 0.05 30 30 +856 0.05 30 30 +857 0.05 30 30 +858 0.05 30 30 +859 0.05 30 30 +860 0.05 30 30 +861 0.05 30 30 +862 0.05 30 30 +863 0.05 30 30 +864 0.05 30 30 +865 0.05 30 30 +866 0.05 30 30 +867 0.05 30 30 +868 0.05 30 30 +869 0.05 30 30 +870 0.05 30 30 +871 0.05 30 30 +872 0.05 30 30 +873 0.05 30 30 +874 0.05 30 30 +875 0.05 30 30 +876 0.05 30 30 +877 0.05 30 30 +878 0.05 30 30 +879 0.05 30 30 +880 0.05 30 30 +881 0.05 30 30 +882 0.05 30 30 +883 0.05 30 30 +884 0.05 30 30 +885 0.05 30 30 +886 0.05 30 30 +887 0.05 30 30 +888 0.05 30 30 +889 0.05 30 30 +890 0.05 30 30 +891 0.05 30 30 +892 0.05 30 30 +893 0.05 30 30 +894 0.05 30 30 +895 0.05 30 30 +896 0.05 30 30 +897 0.05 30 30 +898 0.05 30 30 +899 0.05 30 30 +900 0.05 30 30 +901 0.05 30 30 +902 0.05 30 30 +903 0.05 30 30 +904 0.05 30 30 +905 0.05 30 30 +906 0.05 30 30 +907 0.05 30 30 +908 0.05 30 30 +909 0.05 30 30 +910 0.05 30 30 +911 0.05 30 30 +912 0.05 30 30 +913 0.05 30 30 +914 0.05 30 30 +915 0.05 30 30 +916 0.05 30 30 +917 0.05 30 30 +918 0.05 30 30 +919 0.05 30 30 +920 0.05 30 30 +921 0.05 30 30 +922 0.05 30 30 +923 0.05 30 30 +924 0.05 30 30 +925 0.05 30 30 +926 0.05 30 30 +927 0.05 30 30 +928 0.05 30 30 +929 0.05 30 30 +930 0.05 30 30 +931 0.05 30 30 +932 0.05 30 30 +933 0.05 30 30 +934 0.05 30 30 +935 0.05 30 30 +936 0.05 30 30 +937 0.05 30 30 +938 0.05 30 30 +939 0.05 30 30 +940 0.05 30 30 +941 0.05 30 30 +942 0.05 30 30 +943 0.05 30 30 +944 0.05 30 30 +945 0.05 30 30 +946 0.05 30 30 +947 0.05 30 30 +948 0.05 30 30 +949 0.05 30 30 +950 0.05 30 30 +951 0.05 30 30 +952 0.05 30 30 +953 0.05 30 30 +954 0.05 30 30 +955 0.05 30 30 +956 0.05 30 30 +957 0.05 30 30 +958 0.05 30 30 +959 0.05 30 30 +960 0.05 30 30 +961 0.05 30 30 +962 0.05 30 30 +963 0.05 30 30 +964 0.05 30 30 +965 0.05 30 30 +966 0.05 30 30 +967 0.05 30 30 +968 0.05 30 30 +969 0.05 30 30 +970 0.05 30 30 +971 0.05 30 30 +972 0.05 30 30 +973 0.05 30 30 +974 0.05 30 30 +975 0.05 30 30 +976 0.05 30 30 +977 0.05 30 30 +978 0.05 30 30 +979 0.05 30 30 +980 0.05 30 30 +981 0.05 30 30 +982 0.05 30 30 +983 0.05 30 30 +984 0.05 30 30 +985 0.05 30 30 +986 0.05 30 30 +987 0.05 30 30 +988 0.05 30 30 +989 0.05 30 30 +990 0.05 30 30 +991 0.05 30 30 +992 0.05 30 30 +993 0.05 30 30 +994 0.05 30 30 +995 0.05 30 30 +996 0.05 30 30 +997 0.05 30 30 +998 0.05 30 30 +999 0.05 30 30 +1000 0.05 30 30 +1001 0.05 30 30 +1002 0.05 30 30 +1003 0.05 30 30 +1004 0.05 30 30 +1005 0.05 30 30 +1006 0.05 30 30 +1007 0.05 30 30 +1008 0.05 30 30 +1009 0.05 30 30 +1010 0.05 30 30 +1011 0.05 30 30 +1012 0.05 30 30 +1013 0.05 30 30 +1014 0.05 30 30 +1015 0.05 30 30 +1016 0.05 30 30 +1017 0.05 30 30 +1018 0.05 30 30 +1019 0.05 30 30 +1020 0.05 30 30 +1021 0.05 30 30 +1022 0.05 30 30 +1023 0.05 30 30 +1024 0.05 30 30 +1025 0.05 30 30 +1026 0.05 30 30 +1027 0.05 30 30 +1028 0.05 30 30 +1029 0.05 30 30 +1030 0.05 30 30 +1031 0.05 30 30 +1032 0.05 30 30 +1033 0.05 30 30 +1034 0.05 30 30 +1035 0.05 30 30 +1036 0.05 30 30 +1037 0.05 30 30 +1038 0.05 30 30 +1039 0.05 30 30 +1040 0.05 30 30 +1041 0.05 30 30 +1042 0.05 30 30 +1043 0.05 30 30 +1044 0.05 30 30 +1045 0.05 30 30 +1046 0.05 30 30 +1047 0.05 30 30 +1048 0.05 30 30 +1049 0.05 30 30 +1050 0.05 30 30 +1051 0.05 30 30 +1052 0.05 30 30 +1053 0.05 30 30 +1054 0.05 30 30 +1055 0.05 30 30 +1056 0.05 30 30 +1057 0.05 30 30 +1058 0.05 30 30 +1059 0.05 30 30 +1060 0.05 30 30 +1061 0.05 30 30 +1062 0.05 30 30 +1063 0.05 30 30 +1064 0.05 30 30 +1065 0.05 30 30 +1066 0.05 30 30 +1067 0.05 30 30 +1068 0.05 30 30 +1069 0.05 30 30 +1070 0.05 30 30 +1071 0.05 30 30 +1072 0.05 30 30 +1073 0.05 30 30 +1074 0.05 30 30 +1075 0.05 30 30 +1076 0.05 30 30 +1077 0.05 30 30 +1078 0.05 30 30 +1079 0.05 30 30 +1080 0.05 30 30 +1081 0.05 30 30 +1082 0.05 30 30 +1083 0.05 30 30 +1084 0.05 30 30 +1085 0.05 30 30 +1086 0.05 30 30 +1087 0.05 30 30 +1088 0.05 30 30 +1089 0.05 30 30 +1090 0.05 30 30 +1091 0.05 30 30 +1092 0.05 30 30 +1093 0.05 30 30 +1094 0.05 30 30 +1095 0.05 30 30 +1096 0.05 30 30 +1097 0.05 30 30 +1098 0.05 30 30 +1099 0.05 30 30 +1100 0.05 30 30 +1101 0.05 30 30 +1102 0.05 30 30 +1103 0.05 30 30 +1104 0.05 30 30 +1105 0.05 30 30 +1106 0.05 30 30 +1107 0.05 30 30 +1108 0.05 30 30 +1109 0.05 30 30 +1110 0.05 30 30 +1111 0.05 30 30 +1112 0.05 30 30 +1113 0.05 30 30 +1114 0.05 30 30 +1115 0.05 30 30 +1116 0.05 30 30 +1117 0.05 30 30 +1118 0.05 30 30 +1119 0.05 30 30 +1120 0.05 30 30 +1121 0.05 30 30 +1122 0.05 30 30 +1123 0.05 30 30 +1124 0.05 30 30 +1125 0.05 30 30 +1126 0.05 30 30 +1127 0.05 30 30 +1128 0.05 30 30 +1129 0.05 30 30 +1130 0.05 30 30 +1131 0.05 30 30 +1132 0.05 30 30 +1133 0.05 30 30 +1134 0.05 30 30 +1135 0.05 30 30 +1136 0.05 30 30 +1137 0.05 30 30 +1138 0.05 30 30 +1139 0.05 30 30 +1140 0.05 30 30 +1141 0.05 30 30 +1142 0.05 30 30 +1143 0.05 30 30 +1144 0.05 30 30 +1145 0.05 30 30 +1146 0.05 30 30 +1147 0.05 30 30 +1148 0.05 30 30 +1149 0.05 30 30 +1150 0.05 30 30 +1151 0.05 30 30 +1152 0.05 30 30 +1153 0.05 30 30 +1154 0.05 30 30 +1155 0.05 30 30 +1156 0.05 30 30 +1157 0.05 30 30 +1158 0.05 30 30 +1159 0.05 30 30 +1160 0.05 30 30 +1161 0.05 30 30 +1162 0.05 30 30 +1163 0.05 30 30 +1164 0.05 30 30 +1165 0.05 30 30 +1166 0.05 30 30 +1167 0.05 30 30 +1168 0.05 30 30 +1169 0.05 30 30 +1170 0.05 30 30 +1171 0.05 30 30 +1172 0.05 30 30 +1173 0.05 30 30 +1174 0.05 30 30 +1175 0.05 30 30 +1176 0.05 30 30 +1177 0.05 30 30 +1178 0.05 30 30 +1179 0.05 30 30 +1180 0.05 30 30 +1181 0.05 30 30 +1182 0.05 30 30 +1183 0.05 30 30 +1184 0.05 30 30 +1185 0.05 30 30 +1186 0.05 30 30 +1187 0.05 30 30 +1188 0.05 30 30 +1189 0.05 30 30 +1190 0.05 30 30 +1191 0.05 30 30 +1192 0.05 30 30 +1193 0.05 30 30 +1194 0.05 30 30 +1195 0.05 30 30 +1196 0.05 30 30 +1197 0.05 30 30 +1198 0.05 30 30 +1199 0.05 30 30 +1200 0.05 30 30 +1201 0.05 30 30 +1202 0.05 30 30 +1203 0.05 30 30 +1204 0.05 30 30 +1205 0.05 30 30 +1206 0.05 30 30 +1207 0.05 30 30 +1208 0.05 30 30 +1209 0.05 30 30 +1210 0.05 30 30 +1211 0.05 30 30 +1212 0.05 30 30 +1213 0.05 30 30 +1214 0.05 30 30 +1215 0.05 30 30 +1216 0.05 30 30 +1217 0.05 30 30 +1218 0.05 30 30 +1219 0.05 30 30 +1220 0.05 30 30 +1221 0.05 30 30 +1222 0.05 30 30 +1223 0.05 30 30 +1224 0.05 30 30 +1225 0.05 30 30 +1226 0.05 30 30 +1227 0.05 30 30 +1228 0.05 30 30 +1229 0.05 30 30 +1230 0.05 30 30 +1231 0.05 30 30 +1232 0.05 30 30 +1233 0.05 30 30 +1234 0.05 30 30 +1235 0.05 30 30 +1236 0.05 30 30 +1237 0.05 30 30 +1238 0.05 30 30 +1239 0.05 30 30 +1240 0.05 30 30 +1241 0.05 30 30 +1242 0.05 30 30 +1243 0.05 30 30 +1244 0.05 30 30 +1245 0.05 30 30 +1246 0.05 30 30 +1247 0.05 30 30 +1248 0.05 30 30 +1249 0.05 30 30 +1250 0.05 30 30 +1251 0.05 30 30 +1252 0.05 30 30 +1253 0.05 30 30 +1254 0.05 30 30 +1255 0.05 30 30 +1256 0.05 30 30 +1257 0.05 30 30 +1258 0.05 30 30 +1259 0.05 30 30 +1260 0.05 30 30 +1261 0.05 30 30 +1262 0.05 30 30 +1263 0.05 30 30 +1264 0.05 30 30 +1265 0.05 30 30 +1266 0.05 30 30 +1267 0.05 30 30 +1268 0.05 30 30 +1269 0.05 30 30 +1270 0.05 30 30 +1271 0.05 30 30 +1272 0.05 30 30 +1273 0.05 30 30 +1274 0.05 30 30 +1275 0.05 30 30 +1276 0.05 30 30 +1277 0.05 30 30 +1278 0.05 30 30 +1279 0.05 30 30 +1280 0.05 30 30 +1281 0.05 30 30 +1282 0.05 30 30 +1283 0.05 30 30 +1284 0.05 30 30 +1285 0.05 30 30 +1286 0.05 30 30 +1287 0.05 30 30 +1288 0.05 30 30 +1289 0.05 30 30 +1290 0.05 30 30 +1291 0.05 30 30 +1292 0.05 30 30 +1293 0.05 30 30 +1294 0.05 30 30 +1295 0.05 30 30 +1296 0.05 30 30 +1297 0.05 30 30 +1298 0.05 30 30 +1299 0.05 30 30 +1300 0.05 30 30 +1301 0.05 30 30 +1302 0.05 30 30 +1303 0.05 30 30 +1304 0.05 30 30 +1305 0.05 30 30 +1306 0.05 30 30 +1307 0.05 30 30 +1308 0.05 30 30 +1309 0.05 30 30 +1310 0.05 30 30 +1311 0.05 30 30 +1312 0.05 30 30 +1313 0.05 30 30 +1314 0.05 30 30 +1315 0.05 30 30 +1316 0.05 30 30 +1317 0.05 30 30 +1318 0.05 30 30 +1319 0.05 30 30 +1320 0.05 30 30 +1321 0.05 30 30 +1322 0.05 30 30 +1323 0.05 30 30 +1324 0.05 30 30 +1325 0.05 30 30 +1326 0.05 30 30 +1327 0.05 30 30 +1328 0.05 30 30 +1329 0.05 30 30 +1330 0.05 30 30 +1331 0.05 30 30 +1332 0.05 30 30 +1333 0.05 30 30 +1334 0.05 30 30 +1335 0.05 30 30 +1336 0.05 30 30 +1337 0.05 30 30 +1338 0.05 30 30 +1339 0.05 30 30 +1340 0.05 30 30 +1341 0.05 30 30 +1342 0.05 30 30 +1343 0.05 30 30 +1344 0.05 30 30 +1345 0.05 30 30 +1346 0.05 30 30 +1347 0.05 30 30 diff --git a/CaloConditions/fcl/prolog.fcl b/CaloConditions/fcl/prolog.fcl index d15dc5dde7..50634e6575 100644 --- a/CaloConditions/fcl/prolog.fcl +++ b/CaloConditions/fcl/prolog.fcl @@ -1,16 +1,23 @@ BEGIN_PROLOG -calCalib : { +CalCalib : { verbose: 0 useDb: false ADC2MeV: 0.0625 timeoffset: 0.0 } -CaloDAQConditions : { +CalDAQConditions : { fileSpec : "Offline/CaloConditions/data/nominal.txt" verbose : 0 useDb : false } +CalSimCrystal : { + fileName : "Offline/CaloConditions/data/Sim_crystal.txt" + verbose : 0 + useDb : false +} + + END_PROLOG diff --git a/CaloConditions/inc/CaloDAQMap.hh b/CaloConditions/inc/CalDAQMap.hh similarity index 63% rename from CaloConditions/inc/CaloDAQMap.hh rename to CaloConditions/inc/CalDAQMap.hh index 527dce474a..a6e9d21515 100644 --- a/CaloConditions/inc/CaloDAQMap.hh +++ b/CaloConditions/inc/CalDAQMap.hh @@ -1,8 +1,8 @@ -#ifndef CaloConditions_CaloDAQMap_hh -#define CaloConditions_CaloDAQMap_hh +#ifndef CaloConditions_CalDAQMap_hh +#define CaloConditions_CalDAQMap_hh // -// CaloDAQMap converts between offline and readout SiPM channel numbers +// CalDAQMap converts between offline and readout SiPM channel numbers // #include "Offline/Mu2eInterfaces/inc/ProditionsEntity.hh" @@ -15,24 +15,24 @@ namespace mu2e { - class CaloDAQMap : virtual public ProditionsEntity { + class CalDAQMap : virtual public ProditionsEntity { public: - typedef std::shared_ptr ptr_t; - typedef std::shared_ptr cptr_t; + typedef std::shared_ptr ptr_t; + typedef std::shared_ptr cptr_t; typedef std::array RawArray; typedef std::array OfflineArray; - //CaloDAQMap():_name("CaloDAQMap") {} - constexpr static const char* cxname = {"CaloDAQMap"}; + //CalDAQMap():_name("CalDAQMap") {} + constexpr static const char* cxname = {"CalDAQMap"}; // construct with constants, then some values are computed and filled below - CaloDAQMap(const RawArray& raw2Offline, const OfflineArray& offline2Raw) : + CalDAQMap(const RawArray& raw2Offline, const OfflineArray& offline2Raw) : ProditionsEntity(cxname), _raw2Offline(raw2Offline),_offline2Raw(offline2Raw) {}; - virtual ~CaloDAQMap() {} + virtual ~CalDAQMap() {} CaloSiPMId offlineId(CaloRawSiPMId rawId) const; CaloRawSiPMId rawId(CaloSiPMId offId) const; diff --git a/CaloConditions/inc/CaloDAQMapCache.hh b/CaloConditions/inc/CalDAQMapCache.hh similarity index 77% rename from CaloConditions/inc/CaloDAQMapCache.hh rename to CaloConditions/inc/CalDAQMapCache.hh index 45b0b3c3cb..9de17c5c22 100644 --- a/CaloConditions/inc/CaloDAQMapCache.hh +++ b/CaloConditions/inc/CalDAQMapCache.hh @@ -1,18 +1,18 @@ -#ifndef CaloConditions_CaloDAQMapCache_hh -#define CaloConditions_CaloDAQMapCache_hh +#ifndef CaloConditions_CalDAQMapCache_hh +#define CaloConditions_CalDAQMapCache_hh #include "Offline/Mu2eInterfaces/inc/ProditionsCache.hh" //#include "DbTables/inc/DbIoV.hh" #include "Offline/DbService/inc/DbHandle.hh" -#include "Offline/CaloConditions/inc/CaloDAQMapMaker.hh" +#include "Offline/CaloConditions/inc/CalDAQMapMaker.hh" namespace mu2e { - class CaloDAQMapCache : public ProditionsCache { + class CalDAQMapCache : public ProditionsCache { public: - CaloDAQMapCache(CaloDAQMapConfig const& config): - ProditionsCache(CaloDAQMap::cxname,config.verbose()), + CalDAQMapCache(CalDAQMapConfig const& config): + ProditionsCache(CalDAQMap::cxname,config.verbose()), _useDb(config.useDb()),_maker(config) {} void initialize() { @@ -50,7 +50,7 @@ namespace mu2e { private: bool _useDb; - CaloDAQMapMaker _maker; + CalDAQMapMaker _maker; // these handles are not default constructed // so the db can be completely turned off diff --git a/CaloConditions/inc/CalDAQMapMaker.hh b/CaloConditions/inc/CalDAQMapMaker.hh new file mode 100644 index 0000000000..a1a9c3f6ea --- /dev/null +++ b/CaloConditions/inc/CalDAQMapMaker.hh @@ -0,0 +1,33 @@ +#ifndef CaloConditions_CalDAQMapMaker_hh +#define CaloConditions_CalDAQMapMaker_hh + +// +// construct a CalDAQMap conditions entity +// from fcl or database +// + +#include "Offline/CaloConditions/inc/CalDAQMap.hh" +#include "Offline/CaloConfig/inc/CalDAQMapConfig.hh" +#include "Offline/DbTables/inc/CalChannels.hh" + +namespace mu2e { + + class CalDAQMapMaker { + typedef std::shared_ptr ptr_t; + + public: + CalDAQMapMaker(CalDAQMapConfig const& config):_config(config) {} + ptr_t fromFcl(); + ptr_t fromDb(CalChannels::cptr_t cch_p); + + private: + + // this object needs to be thread safe, + // _config should only be initialized once + const CalDAQMapConfig _config; + + }; +} + + +#endif diff --git a/CaloConditions/inc/CalSimCrystal.hh b/CaloConditions/inc/CalSimCrystal.hh new file mode 100644 index 0000000000..9d4fde1d66 --- /dev/null +++ b/CaloConditions/inc/CalSimCrystal.hh @@ -0,0 +1,49 @@ +#ifndef CaloConditions_CalSimCrystal_hh +#define CaloConditions_CalSimCrystal_hh +// +// CalSimCrystal provides MC calib constants for Readout simulation +// +#include "Offline/Mu2eInterfaces/inc/ProditionsEntity.hh" +#include "Offline/DataProducts/inc/CaloConst.hh" +#include "Offline/DataProducts/inc/CrystalId.hh" +#include "fhiclcpp/ParameterSet.h" +#include +#include + + +namespace mu2e { + + class CalSimCrystal : virtual public ProditionsEntity { + public: + + typedef std::shared_ptr ptr_t; + typedef std::shared_ptr cptr_t; + typedef std::array IdArray; + typedef std::array floatArray; + typedef std::array, CaloConst::_nCrystal> floatVArray; + + constexpr static const char* cxname = {"CalSimCrystal"}; + + CalSimCrystal(const IdArray& crystalIds, const floatArray& LRUs, + const floatVArray& pePerMeVs) : + ProditionsEntity(cxname), + _crystalIds(crystalIds), + _LRUs(LRUs), + _pePerMeVs(pePerMeVs) + {}; + + virtual ~CalSimCrystal() = default; + + const std::vector pePerMeVs(const CrystalId& Id) const; + float LRU(const CrystalId& Id) const; + void print(std::ostream& os) const; + + private: + IdArray _crystalIds; + floatArray _LRUs; + floatVArray _pePerMeVs; + }; + +} + +#endif diff --git a/CaloConditions/inc/CalSimCrystalCache.hh b/CaloConditions/inc/CalSimCrystalCache.hh new file mode 100644 index 0000000000..507f7c6987 --- /dev/null +++ b/CaloConditions/inc/CalSimCrystalCache.hh @@ -0,0 +1,58 @@ +#ifndef CaloConditions_CalSimCrystalCache_hh +#define CaloConditions_CalSimCrystalCache_hh + +#include "Offline/Mu2eInterfaces/inc/ProditionsCache.hh" +#include "Offline/DbService/inc/DbHandle.hh" +#include "Offline/CaloConditions/inc/CalSimCrystalMaker.hh" + + +namespace mu2e { + class CalSimCrystalCache : public ProditionsCache { + public: + CalSimCrystalCache(CalSimCrystalConfig const& config): + ProditionsCache(CalSimCrystal::cxname, config.verbose()), + _useDb(config.useDb()),_maker(config) {} + + void initialize() { + if (_useDb) { + _cch_p = std::make_unique>(); + } + } + + set_t makeSet(art::EventID const& eid) { + ProditionsEntity::set_t cids; + if (_useDb) { + _cch_p->get(eid); + cids.insert(_cch_p->cid()); + } + return cids; + } + + DbIoV makeIov(art::EventID const& eid) { + DbIoV iov; + iov.setMax(); // start with full IOV range + if (_useDb) { + _cch_p->get(eid); + iov.overlap(_cch_p->iov()); + } + return iov; + } + + ProditionsEntity::ptr makeEntity(art::EventID const& eid) { + if (_useDb) { + return _maker.fromDb(_cch_p->getPtr(eid)); + } else { + return _maker.fromFcl(); + } + } + + private: + bool _useDb; + CalSimCrystalMaker _maker; + // these handles are not default constructed + // so the db can be completely turned off + std::unique_ptr> _cch_p; + }; +} + +#endif diff --git a/CaloConditions/inc/CalSimCrystalMaker.hh b/CaloConditions/inc/CalSimCrystalMaker.hh new file mode 100644 index 0000000000..e73820c3a4 --- /dev/null +++ b/CaloConditions/inc/CalSimCrystalMaker.hh @@ -0,0 +1,32 @@ +#ifndef CaloConditions_CalSimCrystalMaker_hh +#define CaloConditions_CalSimCrystalMaker_hh + +// +// construct a CalSimCrystal conditions entity +// from fcl or database +// + +#include "Offline/CaloConditions/inc/CalSimCrystal.hh" +#include "Offline/CaloConfig/inc/CalSimCrystalConfig.hh" +#include "Offline/DbTables/inc/CalCrystals.hh" + +namespace mu2e { + + class CalSimCrystalMaker { + typedef std::shared_ptr ptr_t; + + public: + CalSimCrystalMaker(CalSimCrystalConfig const& config):_config(config) {} + ptr_t fromFcl(); + ptr_t fromDb(CalCrystals::cptr_t cch_p); + + private: + // this object needs to be thread safe, + // _config should only be initialized once + const CalSimCrystalConfig _config; + + }; +} + + +#endif diff --git a/CaloConditions/inc/CaloDAQMapMaker.hh b/CaloConditions/inc/CaloDAQMapMaker.hh deleted file mode 100644 index 9a20385fc4..0000000000 --- a/CaloConditions/inc/CaloDAQMapMaker.hh +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef CaloConditions_CaloDAQMapMaker_hh -#define CaloConditions_CaloDAQMapMaker_hh - -// -// construct a CaloDAQMap conditions entity -// from fcl or database -// - -#include "Offline/CaloConditions/inc/CaloDAQMap.hh" -#include "Offline/CaloConfig/inc/CaloDAQMapConfig.hh" -#include "Offline/DbTables/inc/CalChannels.hh" - -namespace mu2e { - - class CaloDAQMapMaker { - typedef std::shared_ptr ptr_t; - - public: - CaloDAQMapMaker(CaloDAQMapConfig const& config):_config(config) {} - ptr_t fromFcl(); - ptr_t fromDb(CalChannels::cptr_t cch_p); - - private: - - // this object needs to be thread safe, - // _config should only be initialized once - const CaloDAQMapConfig _config; - - }; -} - - -#endif diff --git a/CaloConditions/src/CaloDAQMap.cc b/CaloConditions/src/CalDAQMap.cc similarity index 56% rename from CaloConditions/src/CaloDAQMap.cc rename to CaloConditions/src/CalDAQMap.cc index 3865ea7c0a..6de9ead82d 100644 --- a/CaloConditions/src/CaloDAQMap.cc +++ b/CaloConditions/src/CalDAQMap.cc @@ -1,29 +1,29 @@ -#include "Offline/CaloConditions/inc/CaloDAQMap.hh" +#include "Offline/CaloConditions/inc/CalDAQMap.hh" #include "cetlib_except/exception.h" #include using namespace std; namespace mu2e { -CaloSiPMId CaloDAQMap::offlineId(CaloRawSiPMId rawId) const { +CaloSiPMId CalDAQMap::offlineId(CaloRawSiPMId rawId) const { if (!rawId.isValid()) { throw cet::exception("CALODAQMP_RANGE") - << "CaloDAQMap::offlineId invalid input rawId" << rawId << std::endl; + << "CalDAQMap::offlineId invalid input rawId" << rawId << std::endl; } return _raw2Offline[rawId.id()]; } -CaloRawSiPMId CaloDAQMap::rawId(CaloSiPMId offId) const { +CaloRawSiPMId CalDAQMap::rawId(CaloSiPMId offId) const { if (!offId.isValid()) { throw cet::exception("CALODAQMP_RANGE") - << "CaloDAQMap::rawId invalid input offlineId" << offId << std::endl; + << "CalDAQMap::rawId invalid input offlineId" << offId << std::endl; } return _offline2Raw[offId.id()]; } -void CaloDAQMap::print(std::ostream& os) const { +void CalDAQMap::print(std::ostream& os) const { os << endl; - os << endl << "CaloDAQMap : " << endl; + os << endl << "CalDAQMap : " << endl; os << endl << " offline raw " << endl; for (uint16_t i = 0; i < CaloConst::_nRawChannel; i++) { os << setw(6) << _raw2Offline[i].id() << setw(6) << i << endl; diff --git a/CaloConditions/src/CaloDAQMapMaker.cc b/CaloConditions/src/CalDAQMapMaker.cc similarity index 60% rename from CaloConditions/src/CaloDAQMapMaker.cc rename to CaloConditions/src/CalDAQMapMaker.cc index c4d9f357d8..3884dacb5c 100644 --- a/CaloConditions/src/CaloDAQMapMaker.cc +++ b/CaloConditions/src/CalDAQMapMaker.cc @@ -1,4 +1,4 @@ -#include "Offline/CaloConditions/inc/CaloDAQMapMaker.hh" +#include "Offline/CaloConditions/inc/CalDAQMapMaker.hh" #include "Offline/ConfigTools/inc/ConfigFileLookupPolicy.hh" #include "Offline/DataProducts/inc/CaloConst.hh" #include "cetlib_except/exception.h" @@ -9,16 +9,16 @@ using namespace std; namespace mu2e { - CaloDAQMap::ptr_t CaloDAQMapMaker::fromFcl() { + CalDAQMap::ptr_t CalDAQMapMaker::fromFcl() { if (_config.verbose()>0) { - cout << "CaloDAQMapMaker::fromFcl making nominal CaloDAQMap\n"; + cout << "CalDAQMapMaker::fromFcl making nominal CalDAQMap\n"; } ConfigFileLookupPolicy configFile; string fileSpec = configFile(_config.fileSpec()); if (_config.verbose()>0) { - cout << "CaloDAQMapMaker::fromFcl reading from " << fileSpec << "\n"; + cout << "CalDAQMapMaker::fromFcl reading from " << fileSpec << "\n"; } ifstream ordFile; @@ -30,8 +30,8 @@ namespace mu2e { string line; - CaloDAQMap::RawArray raw2Offline; - CaloDAQMap::OfflineArray offline2Raw; + CalDAQMap::RawArray raw2Offline; + CalDAQMap::OfflineArray offline2Raw; uint16_t oid,rid,nRead(0); while (!ordFile.eof()){ @@ -39,10 +39,10 @@ namespace mu2e { if (ordFile.eof()) break; if(rid >= CaloConst::_nRawChannel) { - throw cet::exception("CALODAQMAPMAKER_RANGE") << "CaloDAQMapMaker read invalid rawId" << rid << endl; + throw cet::exception("CALODAQMAPMAKER_RANGE") << "CalDAQMapMaker read invalid rawId" << rid << endl; } if(oid != CaloConst::_invalid && oid >= CaloConst::_nChannel) { - throw cet::exception("CALODAQMAPMAKER_RANGE") << "CaloDAQMapMaker read invalid offlineId " << oid << endl; + throw cet::exception("CALODAQMAPMAKER_RANGE") << "CalDAQMapMaker read invalid offlineId " << oid << endl; } nRead++; @@ -57,11 +57,11 @@ namespace mu2e { if(nRead != CaloConst::_nRawChannel) { throw cet::exception("CALODAQMAPMAKER_COUNT") - << "CaloDAQMapMaker read the wrong number of id's " + << "CalDAQMapMaker read the wrong number of id's " << nRead << ", expected " << CaloConst::_nRawChannel << endl; } - auto ptr = make_shared(raw2Offline, offline2Raw); + auto ptr = make_shared(raw2Offline, offline2Raw); return ptr; @@ -69,23 +69,23 @@ namespace mu2e { //*************************************************** - CaloDAQMap::ptr_t CaloDAQMapMaker::fromDb(CalChannels::cptr_t cch_p) { + CalDAQMap::ptr_t CalDAQMapMaker::fromDb(CalChannels::cptr_t cch_p) { if (_config.verbose()>0) { - cout << "CaloDAQMapMaker::fromDb making CaloDAQMap\n"; + cout << "CalDAQMapMaker::fromDb making CalDAQMap\n"; } - CaloDAQMap::RawArray raw2Offline; - CaloDAQMap::OfflineArray offline2Raw; + CalDAQMap::RawArray raw2Offline; + CalDAQMap::OfflineArray offline2Raw; for (auto const& row : cch_p->rows()) { CaloRawSiPMId rawid = row.rawid(); CaloSiPMId roid = row.roid(); if(!rawid.isValid()) { - throw cet::exception("CALODAQMAPMAKER_RANGE") << "CaloDAQMapMaker found invalid rawId" << rawid << endl; + throw cet::exception("CALODAQMAPMAKER_RANGE") << "CalDAQMapMaker found invalid rawId" << rawid << endl; } if(!(roid.isValid() || roid.id() == CaloConst::_invalid)) { - throw cet::exception("CALODAQMAPMAKER_RANGE") << "CaloDAQMapMaker found invalid offlineId " << roid << endl; + throw cet::exception("CALODAQMAPMAKER_RANGE") << "CalDAQMapMaker found invalid offlineId " << roid << endl; } raw2Offline[rawid.id()] = roid; @@ -99,11 +99,11 @@ namespace mu2e { // to invalid and there is no other check that this was done correctly for (auto const& cc : offline2Raw) { if(!cc.isValid()) { - throw cet::exception("CALODAQMAPMAKER_MISSING") << "CaloDAQMapMaker found missing roid " << endl; + throw cet::exception("CALODAQMAPMAKER_MISSING") << "CalDAQMapMaker found missing roid " << endl; } } - auto ptr = make_shared(raw2Offline, offline2Raw); + auto ptr = make_shared(raw2Offline, offline2Raw); return ptr; diff --git a/CaloConditions/src/CalSimCrystal.cc b/CaloConditions/src/CalSimCrystal.cc new file mode 100644 index 0000000000..d02963e1e0 --- /dev/null +++ b/CaloConditions/src/CalSimCrystal.cc @@ -0,0 +1,32 @@ +#include "Offline/CaloConditions/inc/CalSimCrystal.hh" +#include "cetlib_except/exception.h" +#include + +namespace mu2e { + + float CalSimCrystal::LRU(const CrystalId& Id) const { + if (!Id.isValid()) { + throw cet::exception("CalSimCrystal_RANGE") + << "CalSimCrystal::id invalid input" << Id << "\n"; + } + return _LRUs[Id.id()]; + } + + const std::vector CalSimCrystal::pePerMeVs(const CrystalId& Id) const { + if (!Id.isValid()) { + throw cet::exception("CalSimCrystal_RANGE") + << "CalSimCrystal::id invalid input" << Id << "\n"; + } + return _pePerMeVs[Id.id()]; + } + + void CalSimCrystal::print(std::ostream& os) const { + os << "\n"; + os << "\n" << "CalSimCrystal : \n" ; + os << "\n" << " Crystalid LRU pePerMeV_0 pePerMeV_1" ; + for (uint16_t i = 0; i < CaloConst::_nCrystal; i++) { + os << std::setw(6) << i << std::setw(6) << _LRUs[i] << std::setw(6) << _pePerMeVs[i].at(0) << std::setw(6) << _pePerMeVs[i].at(1) <<"\n"; + } + os << "\n"; + } +} diff --git a/CaloConditions/src/CalSimCrystalMaker.cc b/CaloConditions/src/CalSimCrystalMaker.cc new file mode 100644 index 0000000000..b124086e05 --- /dev/null +++ b/CaloConditions/src/CalSimCrystalMaker.cc @@ -0,0 +1,110 @@ +#include "Offline/CaloConditions/inc/CalSimCrystalMaker.hh" +#include "Offline/ConfigTools/inc/ConfigFileLookupPolicy.hh" +#include "Offline/DataProducts/inc/CaloConst.hh" +#include "cetlib_except/exception.h" +#include +#include + + +namespace mu2e { + + CalSimCrystal::ptr_t CalSimCrystalMaker::fromFcl() { + + if (_config.verbose()>0) { + std::cout << "CalSimCrystalMaker::fromFcl making nominal CalCrystals\n"; + } + + ConfigFileLookupPolicy configFile; + std::string fileName = configFile(_config.fileName()); + if (_config.verbose()>0) { + std::cout << "CalSimCrystalMaker::fromFcl reading from " << fileName << "\n"; + } + + std::ifstream ordFile; + ordFile.open(fileName); + if (!ordFile.is_open()) { + throw cet::exception("CalCrystals_OPEN_FAILED") + << " failed to open file " << fileName << "\n"; + } + + CalSimCrystal::IdArray crystalIds; + CalSimCrystal::floatArray LRUs; + CalSimCrystal::floatVArray pePerMeVs; + uint16_t sid,nRead(0); + float lru,npe0,npe1; + + while (!ordFile.eof()){ + ordFile >> sid >> lru >> npe0 >> npe1; + if (ordFile.eof()) break; + + if (sid != CaloConst::_invalid && sid >= CaloConst::_nCrystal) { + throw cet::exception("CalSimCrystalMaker_RANGE") << "CalSimCrystalMaker read invalid offlineId " << sid << "\n"; + } + + crystalIds[sid] = CrystalId(sid); + LRUs[sid] = lru; + pePerMeVs[sid] = std::vector{npe0,npe1}; + ++nRead; + } + + if (pePerMeVs.back().size() !=CaloConst::_nSiPMPerCrystal ) { + throw cet::exception("CALSIMCRYSTALMAKER_RANGE") + << "CalSimCrystalMaker found too many nPE values\n"; + } + + if(nRead != CaloConst::_nCrystal) { + throw cet::exception("CalSimCrystalMaker_COUNT") + << "CalSimCrystalMaker read the wrong number of id's " + << nRead << ", expected " << CaloConst::_nCrystal << "\n"; + } + + auto ptr = make_shared(crystalIds,LRUs,pePerMeVs); + return ptr; + } + + + //*************************************************** + CalSimCrystal::ptr_t CalSimCrystalMaker::fromDb(CalCrystals::cptr_t cch_p) { + + if (_config.verbose()>0) { + std::cout << "CalSimCrystalMaker::fromDb making CalCrystals\n"; + } + + CalSimCrystal::IdArray crystalIds; + CalSimCrystal::floatArray LRUs; + CalSimCrystal::floatVArray pePerMeVs; + uint16_t nRead(0); + + for (auto const& row : cch_p->rows()) { + CrystalId crid = row.crid(); + float lru = row.LRU(); + float npe0 = row.pePerMeV_0(); + float npe1 = row.pePerMeV_1(); + + if (!(crid.isValid() || crid.id() == CaloConst::_invalid)) { + throw cet::exception("CALSIMCRYSTALMAKER_RANGE") + << "CalSimCrystalMaker found invalid offlineId " << crid << "\n"; + } + + crystalIds[crid.id()] = crid; + LRUs[crid.id()] = lru; + pePerMeVs[crid.id()] = std::vector{npe0,npe1}; + ++nRead; + } + + if (pePerMeVs.back().size() !=CaloConst::_nSiPMPerCrystal ) { + throw cet::exception("CALSIMCRYSTALMAKER_RANGE") + << "CalSimCrystalMaker found too many nPE values\n"; + } + + // check that all roid were filled + if(nRead != CaloConst::_nCrystal) { + throw cet::exception("CalSimCrystalMaker_COUNT") + << "CalSimCrystalMaker read the wrong number of id's " + << nRead << ", expected " << CaloConst::_nCrystal << "\n"; + } + + auto ptr = make_shared(crystalIds,LRUs,pePerMeVs); + return ptr; + } +} diff --git a/CaloConfig/CMakeLists.txt b/CaloConfig/CMakeLists.txt index a461de3e0e..41ac690007 100644 --- a/CaloConfig/CMakeLists.txt +++ b/CaloConfig/CMakeLists.txt @@ -1,7 +1,8 @@ cet_make_library(INTERFACE INSTALLED_PATH_BASE Offline SOURCE inc/CalCalibConfig.hh - inc/CaloDAQMapConfig.hh + inc/CalDAQMapConfig.hh + inc/CalSimCrystalConfig.hh LIBRARIES INTERFACE ) diff --git a/CaloConfig/inc/CaloDAQMapConfig.hh b/CaloConfig/inc/CalDAQMapConfig.hh similarity index 75% rename from CaloConfig/inc/CaloDAQMapConfig.hh rename to CaloConfig/inc/CalDAQMapConfig.hh index ba4c9ae31f..adb7f37525 100644 --- a/CaloConfig/inc/CaloDAQMapConfig.hh +++ b/CaloConfig/inc/CalDAQMapConfig.hh @@ -1,7 +1,7 @@ -#ifndef CaloConditions_CaloDAQMapConfig_hh -#define CaloConditions_CaloDAQMapConfig_hh +#ifndef CaloConditions_CalDAQMapConfig_hh +#define CaloConditions_CalDAQMapConfig_hh // -// Initialize CaloDAQMap from fcl +// Initialize CalDAQMap from fcl // #include "fhiclcpp/types/Atom.h" #include "fhiclcpp/types/Sequence.h" @@ -9,7 +9,7 @@ namespace mu2e { - struct CaloDAQMapConfig { + struct CalDAQMapConfig { using Name=fhicl::Name; using Comment=fhicl::Comment; fhicl::Atom fileSpec{ diff --git a/CaloConfig/inc/CalSimCrystalConfig.hh b/CaloConfig/inc/CalSimCrystalConfig.hh new file mode 100644 index 0000000000..1b04d9683b --- /dev/null +++ b/CaloConfig/inc/CalSimCrystalConfig.hh @@ -0,0 +1,22 @@ +#ifndef CaloConditions_CaloSimCrystalConfig_hh +#define CaloConditions_CaloSimCrystalConfig_hh +// +// Initialize CaloMCCalib from fcl +// +#include "fhiclcpp/types/Atom.h" +#include "fhiclcpp/types/Sequence.h" +#include + +namespace mu2e { + + struct CalSimCrystalConfig { + using Name = fhicl::Name; + using Comment = fhicl::Comment; + fhicl::Atom fileName{Name("fileName"),Comment("Calo MC calib filename")}; + fhicl::Atom verbose {Name("verbose"), Comment("verbosity")}; + fhicl::Atom useDb {Name("useDb"), Comment("use database or fcl")}; + }; + +} + +#endif diff --git a/CaloMC/CMakeLists.txt b/CaloMC/CMakeLists.txt index bc40a9c08c..da0c1ad8f5 100644 --- a/CaloMC/CMakeLists.txt +++ b/CaloMC/CMakeLists.txt @@ -56,6 +56,7 @@ cet_build_plugin(CaloShowerROMaker art::module Offline::CalorimeterGeom Offline::DAQConditions + Offline::CaloConditions Offline::DataProducts Offline::GeometryService Offline::GlobalConstantsService diff --git a/CaloMC/fcl/prolog.fcl b/CaloMC/fcl/prolog.fcl index 4cebf838ab..9540719cbd 100644 --- a/CaloMC/fcl/prolog.fcl +++ b/CaloMC/fcl/prolog.fcl @@ -21,7 +21,7 @@ CaloMC : { digiSampling : @local::HitMakerDigiSampling nMaxFragment : 1000 minPeakADC : @local::HitMakerMinPeakADC - readoutPEPerMeV : @local::readoutPEPerMeVCsI + readoutPEPerMeV : 30 MeVToADC : @local::MeVToADC diagLevel : 0 } @@ -54,9 +54,6 @@ CaloMC : { @table::CaloMC digitizationStart : @local::HitMakerDigitizationStart digitizationEnd : @local::HitMakerDigitizationEnd digitizationBuffer : 10 - crystalNonUniformity : 0.05 - readoutPEPerMeVCsI : @local::readoutPEPerMeVCsI - readoutPEPerMeVLyso : @local::readoutPEPerMeVLyso LRUCorrection : true BirksCorrection : true PEStatCorrection : true @@ -82,8 +79,6 @@ CaloMC : { @table::CaloMC minPeakADC : @local::HitMakerMinPeakADC nBinsPeak : 2 bufferDigi : 16 - readoutPEPerMeVCsI : @local::readoutPEPerMeVCsI - readoutPEPerMeVLyso : @local::readoutPEPerMeVLyso MeVToADC : @local::MeVToADC diagLevel : 0 } diff --git a/CaloMC/src/CaloDigiMaker_module.cc b/CaloMC/src/CaloDigiMaker_module.cc index 6911e64c0f..06fd8dc630 100644 --- a/CaloMC/src/CaloDigiMaker_module.cc +++ b/CaloMC/src/CaloDigiMaker_module.cc @@ -15,6 +15,7 @@ #include "Offline/Mu2eUtilities/inc/CaloPulseShape.hh" #include "Offline/CalorimeterGeom/inc/Calorimeter.hh" +#include "Offline/CaloConditions/inc/CalSimCrystal.hh" #include "Offline/CaloMC/inc/CaloNoiseSimGenerator.hh" #include "Offline/CaloMC/inc/CaloWFExtractor.hh" #include "Offline/ProditionsService/inc/ProditionsHandle.hh" @@ -66,8 +67,6 @@ namespace mu2e { fhicl::Atom addNoise { Name("addNoise"), Comment("Add noise to waveform") }; fhicl::Atom addRandomNoise { Name("addRandomNoise"), Comment("Add random salt and pepper noise") }; fhicl::Atom digiSampling { Name("digiSampling"), Comment("Digitization time sampling") }; - fhicl::Atom pePerMeVCsI { Name("readoutPEPerMeVCsI"), Comment("Number of pe / MeV for Readout for CsI") }; - fhicl::Atom pePerMeVLyso { Name("readoutPEPerMeVLyso"), Comment("Number of pe / MeV for Readout for LYSO") }; fhicl::Atom MeVToADC { Name("MeVToADC"), Comment("MeV to ADC conversion factor") }; fhicl::Atom nBits { Name("nBits"), Comment("ADC Number of bits") }; fhicl::Atom nBinsPeak { Name("nBinsPeak"), Comment("Window size for finding local maximum to digitize wf") }; @@ -87,8 +86,6 @@ namespace mu2e { bufferDigi_ (config().bufferDigi()), startTimeBuffer_ (config().digiSampling()*config().bufferDigi()), maxADCCounts_ ((1 << config().nBits()) -1), - pePerMeVCsI_ (config().pePerMeVCsI()), - pePerMeVLyso_ (config().pePerMeVLyso()), MeVToADC_ (config().MeVToADC()), pulseShape_ (CaloPulseShape(config().pulseFileName(),config().pulseHistName(),config().digiSampling())), wfExtractor_ (config().bufferDigi(),config().nBinsPeak(),config().minPeakADC(),config().bufferDigi()), @@ -113,8 +110,8 @@ namespace mu2e { private: - void makeDigitization (const CaloShowerROCollection&, CaloDigiCollection&, const EventWindowMarker&, const ProtonBunchTimeMC&); - bool fillROHits (unsigned iRO, std::vector& waveform, const CaloShowerROCollection&, const ProtonBunchTimeMC&); + void makeDigitization (const CaloShowerROCollection&, CaloDigiCollection&, const CalSimCrystal&, const EventWindowMarker&, const ProtonBunchTimeMC&); + bool fillROHits (unsigned iRO, std::vector& waveform, const CaloShowerROCollection&, const ProtonBunchTimeMC&, const CalSimCrystal&); void generateSpotNoise (std::vector& waveform); void buildOutputDigi (unsigned iRO, std::vector& waveform, double pedestal, CaloDigiCollection&); void diag0 (unsigned, const std::vector&); @@ -122,6 +119,7 @@ namespace mu2e { void plotWF (const std::vector& waveform, const std::string& pname, int pedestal); void plotWF (const std::vector& waveform, const std::string& pname, int pedestal); + ProditionsHandle calCrystalConds_; const art::ProductToken caloShowerToken_; art::InputTag ewMarkerTag_; art::InputTag pbtmcTag_; @@ -132,8 +130,6 @@ namespace mu2e { unsigned bufferDigi_; float startTimeBuffer_; int maxADCCounts_; - float pePerMeVCsI_; - float pePerMeVLyso_; float MeVToADC_; CaloPulseShape pulseShape_; CaloWFExtractor wfExtractor_; @@ -170,6 +166,8 @@ namespace mu2e { event.getByLabel(pbtmcTag_, pbtmcHandle); const ProtonBunchTimeMC& pbtmc(*pbtmcHandle); + const auto& calCrystalConds = calCrystalConds_.get(event.id()); + ProditionsHandle eventTimingHandle; const EventTiming &eventTiming = eventTimingHandle.get(event.id()); timeFromProtonsToDRMarker_ = eventTiming.timeFromProtonsToDRMarker(); @@ -178,7 +176,7 @@ namespace mu2e { const auto& CaloShowerROs = *caloShowerStepHandle; auto caloDigiColl = std::make_unique(); - makeDigitization(CaloShowerROs, *caloDigiColl,ewMarker, pbtmc); + makeDigitization(CaloShowerROs, *caloDigiColl, calCrystalConds, ewMarker, pbtmc); event.put(std::move(caloDigiColl)); if ( diagLevel_ > 0 ) std::cout<<"[CaloDigiMaker::produce] end" << std::endl; @@ -188,7 +186,8 @@ namespace mu2e { //----------------------------------------------------------------------------------------------------------------------------- // Note: DigitizationStart include the fixed delay from timeFromProtonsToDRMarker, need to subtract it to be in the digitizer frame void CaloDigiMaker::makeDigitization(const CaloShowerROCollection& CaloShowerROs, CaloDigiCollection& caloDigiColl, - const EventWindowMarker& ewMarker, const ProtonBunchTimeMC& pbtmc) + const CalSimCrystal& calCrystalConds, const EventWindowMarker& ewMarker, + const ProtonBunchTimeMC& pbtmc) { mu2e::GeomHandle ch; calorimeter_ = ch.get(); @@ -208,7 +207,7 @@ namespace mu2e { for (int iRO=0;iRO& waveform, const CaloShowerROCollection& CaloShowerROs, - const ProtonBunchTimeMC& pbtmc) + const ProtonBunchTimeMC& pbtmc, const CalSimCrystal& calCrystalConds) { - bool isEmpty = true; - bool isCaphri = CaloSiPMId(iRO).crystal().isCaphri(); - auto pePerMeV = isCaphri ? pePerMeVLyso_ : pePerMeVCsI_; + bool isEmpty = true; + auto SiPMID = CaloSiPMId(iRO); + auto crystalID = SiPMID.crystal(); + auto pePerMeVs = calCrystalConds.pePerMeVs(crystalID); + auto pePerMeV = pePerMeVs.at(SiPMID.SiPMLocalId()); auto scaleFactor = MeVToADC_/pePerMeV; for (const auto& CaloShowerRO : CaloShowerROs) diff --git a/CaloMC/src/CaloShowerROMaker_module.cc b/CaloMC/src/CaloShowerROMaker_module.cc index 9b2bbe9934..f8cc189814 100644 --- a/CaloMC/src/CaloShowerROMaker_module.cc +++ b/CaloMC/src/CaloShowerROMaker_module.cc @@ -11,6 +11,7 @@ #include "fhiclcpp/types/Sequence.h" #include "Offline/CaloMC/inc/CaloPhotonPropagation.hh" +#include "Offline/CaloConditions/inc/CalSimCrystal.hh" #include "Offline/CalorimeterGeom/inc/Calorimeter.hh" #include "Offline/DataProducts/inc/CrystalId.hh" #include "Offline/ProditionsService/inc/ProditionsHandle.hh" @@ -95,9 +96,6 @@ namespace mu2e { fhicl::Atom digitizationStart { Name("digitizationStart"), Comment("Minimum time of hit to be digitized") }; fhicl::Atom digitizationEnd { Name("digitizationEnd"), Comment("Maximum time of hit to be digitized") }; fhicl::Atom digitizationBuffer { Name("digitizationBuffer"), Comment("Digi time buffer for photon propagation inside crystal") }; - fhicl::Atom crystalNonUniformity { Name("crystalNonUniformity"), Comment("LRU parameter 0") }; - fhicl::Atom pePerMeVCsI { Name("readoutPEPerMeVCsI"), Comment("Number of pe / MeV for Readout for CsI") }; - fhicl::Atom pePerMeVLyso { Name("readoutPEPerMeVLyso"), Comment("Number of pe / MeV for Readout for LYSO") }; fhicl::Atom LRUCorrection { Name("LRUCorrection"), Comment("Include LRU corrections") }; fhicl::Atom BirksCorrection { Name("BirksCorrection"), Comment("Include Birks corrections") }; fhicl::Atom PEStatCorrection { Name("PEStatCorrection"), Comment("Include PE Poisson fluctuations") }; @@ -112,9 +110,6 @@ namespace mu2e { digitizationStart_ (config().digitizationStart()), digitizationEnd_ (config().digitizationEnd()), digitizationBuffer_ (config().digitizationBuffer()), - crystalNonUniformity_(config().crystalNonUniformity()), - pePerMeVCsI_ (config().pePerMeVCsI()), - pePerMeVLyso_ (config().pePerMeVLyso()), LRUCorrection_ (config().LRUCorrection()), BirksCorrection_ (config().BirksCorrection()), PEStatCorrection_ (config().PEStatCorrection()), @@ -133,7 +128,6 @@ namespace mu2e { produces(); } - void beginJob() override; void beginRun(art::Run& aRun) override; void produce(art::Event& e) override; @@ -141,20 +135,18 @@ namespace mu2e { private: using StepHandles = std::vector>; - void makeReadoutHits (const StepHandles&, CaloShowerROCollection&, CaloShowerSimCollection&, const EventWindowMarker&, - const ProtonBunchTimeMC&, float timeFromProtonsToDRMarker); - float LRUCorrection (int crystalID, float normalizedPosZ, float edepInit); + void makeReadoutHits (const StepHandles&, CaloShowerROCollection&, CaloShowerSimCollection&, const CalSimCrystal&, + const EventWindowMarker&, const ProtonBunchTimeMC&, float timeFromProtonsToDRMarker); + float LRUCorrection (float normalizedPosZ, float edepInit, float lru); void dumpCaloShowerSim (const CaloShowerSimCollection& caloShowerSims); + ProditionsHandle calCrystalConds_; std::vector> crystalShowerTokens_; art::InputTag ewMarkerTag_; art::InputTag pbtmcTag_; float digitizationStart_; float digitizationEnd_; float digitizationBuffer_; - float crystalNonUniformity_; - float pePerMeVCsI_; - float pePerMeVLyso_; bool LRUCorrection_; bool BirksCorrection_; bool PEStatCorrection_; @@ -163,23 +155,9 @@ namespace mu2e { CLHEP::HepRandomEngine& engine_; CLHEP::RandPoissonQ randPoisson_; CaloPhotonPropagation photonProp_; - TH2F* hTime_; - TH1F *hEtot_,*hECorrtot_,*hStot_; }; - //----------------------------------------------- - void CaloShowerROMaker::beginJob() - { - if (diagLevel_ > 1) - { - art::ServiceHandle tfs; - hTime_ = tfs->make("hTIme", "Photon prop time", 40,0,200,50,0,20); - hEtot_ = tfs->make("hEtot", "Total E dep", 150, 0, 150); - hECorrtot_ = tfs->make("hECorrtot", "Total E dep corr", 150, 0, 150); - hStot_ = tfs->make("hStot", "Total Compress steps", 100, 0, 1000); - } - } //----------------------------------------------- void CaloShowerROMaker::beginRun(art::Run& aRun) @@ -206,6 +184,8 @@ namespace mu2e { const EventTiming &eventTiming = eventTimingHandle.get(event.id()); float timeFromProtonsToDRMarker = eventTiming.timeFromProtonsToDRMarker(); //fixed time between CFO first tick and event start + const auto& calCrystalConds = calCrystalConds_.get(event.id()); + // Containers to hold the output hits. auto CaloShowerROs = std::make_unique(); auto caloShowerSims = std::make_unique(); @@ -215,7 +195,7 @@ namespace mu2e { back_inserter(newCrystalShowerTokens), [&event](const auto& token) {return event.getValidHandle(token);}); - makeReadoutHits(newCrystalShowerTokens, *CaloShowerROs, *caloShowerSims, ewMarker, pbtmc, timeFromProtonsToDRMarker ); + makeReadoutHits(newCrystalShowerTokens, *CaloShowerROs, *caloShowerSims, calCrystalConds, ewMarker, pbtmc, timeFromProtonsToDRMarker ); // Add the output hit collection to the event event.put(std::move(CaloShowerROs)); @@ -227,15 +207,15 @@ namespace mu2e { //----------------------------------------------------------------------------------------------------- void CaloShowerROMaker::makeReadoutHits(const StepHandles& crystalShowerHandles, CaloShowerROCollection& CaloShowerROs, - CaloShowerSimCollection& caloShowerSims, const EventWindowMarker& ewMarker, - const ProtonBunchTimeMC& pbtmc, float timeFromProtonsToDRMarker) + CaloShowerSimCollection& caloShowerSims, const CalSimCrystal& calCrystalConds, + const EventWindowMarker& ewMarker, const ProtonBunchTimeMC& pbtmc, + float timeFromProtonsToDRMarker) { GlobalConstantsHandle pdt; float mbtime = GlobalConstantsHandle()->getNominalDRPeriod(); const Calorimeter& cal = *(GeomHandle()); - const int nROs = cal.caloInfo().getInt("nSiPMPerCrystal"); const float cryhalflength = cal.caloInfo().getDouble("crystalZLength")/2.0; std::map> simEntriesMap; @@ -269,22 +249,21 @@ namespace mu2e { size_t idx = std::distance(caloShowerSteps.begin(), istep); art::Ptr stepPtr = art::Ptr(showerHandle,idx); - int crystalID = step.volumeG4ID(); - int SiPMIDBase = CrystalId(crystalID).SiPMId(CaloConst::SiPM0); + auto crystalID = CrystalId(step.volumeG4ID()); + int SiPMIDBase = crystalID.SiPMId(CaloConst::SiPM0); float posZ = step.position().z(); + float lru = calCrystalConds.LRU(crystalID); + auto pePerMeVs = calCrystalConds.pePerMeVs(crystalID); float edep_corr(step.energyDepG4()); if (BirksCorrection_) edep_corr = step.energyDepBirks(); - if (LRUCorrection_) edep_corr = LRUCorrection(crystalID, posZ/cryhalflength, edep_corr); - - bool isCaphri = CrystalId(crystalID).isCaphri(); - float pePerMeV = isCaphri ? pePerMeVLyso_ : pePerMeVCsI_; + if (LRUCorrection_) edep_corr = LRUCorrection(posZ/cryhalflength, edep_corr, lru); // Generate individual PEs and their arrival times - for (int i=0; i PETime(NPE,hitTime); @@ -296,17 +275,16 @@ namespace mu2e { if (diagLevel_ > 2) std::cout<<"[CaloShowerROMaker::generatePE] SiPMID:"< 2) {std::cout<<"Time hit "< 1) for (const auto& time : PETime) hTime_->Fill(2.0*cryhalflength-posZ,time-hitTime); diagSum.totNPE += NPE; - diagSum.totEdepNPE += double(NPE)/pePerMeV/2.0; //average between the two RO + diagSum.totEdepNPE += double(NPE)/pePerMeVs[i]/2.0; //average between the two RO } diagSum.totEdep += step.energyDepG4(); diagSum.totEdepCorr += edep_corr; diagSum.totSteps += step.nCompress(); //Produce an MC object that include the step and additional information for each original step - simEntriesMap[crystalID].push_back(StepEntry(stepPtr,edep_corr,hitTime)); + simEntriesMap[crystalID.id()].push_back(StepEntry(stepPtr,edep_corr,hitTime)); } auto sortFunctor = [](const auto& a, const auto& b){return a.SiPMID() < b.SiPMID();}; @@ -344,10 +322,6 @@ namespace mu2e { if (diagLevel_ > 1) { - hEtot_->Fill(diagSum.totEdep); - hECorrtot_->Fill(diagSum.totEdepCorr); - hStot_->Fill(diagSum.totSteps); - std::set crIds; for (const auto& css : caloShowerSims) crIds.insert(css.crystalID()); @@ -369,9 +343,9 @@ namespace mu2e { //---------------------------------------------------------------------------------------------------------------------------------- // apply a correction of type Energy = (a*(Z/HL-1)+1)*energy where Z position along the crystal, HL is the crystal half-length // and a is the level of non-uniformity (e.g. 5%) - float CaloShowerROMaker::LRUCorrection(int crystalID, float normalizedPosZ, float edepInit) + float CaloShowerROMaker::LRUCorrection(float normalizedPosZ, float edepInit, float lru) { - float factor = crystalNonUniformity_*(normalizedPosZ-1.0)+1.0; + float factor = lru*(normalizedPosZ-1.0)+1.0; float edep = edepInit*factor; if (diagLevel_ > 2) std::cout<<"[CaloShowerROMaker::LRUCorrection] before / after LRU -> edep_corr = " diff --git a/CaloMC/src/SConscript b/CaloMC/src/SConscript index 1e967fb532..5e88eeca92 100644 --- a/CaloMC/src/SConscript +++ b/CaloMC/src/SConscript @@ -22,6 +22,7 @@ mainlib = helper.make_mainlib ( ['mu2e_GeometryService', 'mu2e_Mu2eUtilities', 'mu2e_MCDataProducts', 'mu2e_CalorimeterGeom', + 'mu2e_CaloConditions', 'mu2e_CaloCluster', 'mu2e_GlobalConstantsService', 'mu2e_DbTables', @@ -51,6 +52,7 @@ helper.make_plugins( [ mainlib, 'mu2e_Mu2eUtilities', 'mu2e_GeometryService', 'mu2e_DAQConditions', + 'mu2e_CaloConditions', 'mu2e_SeedService', 'mu2e_CalorimeterGeom', 'mu2e_MCDataProducts', diff --git a/CaloReco/src/CaloHitMakerFast_module.cc b/CaloReco/src/CaloHitMakerFast_module.cc index 1d0b9e044f..0bf9c423c4 100644 --- a/CaloReco/src/CaloHitMakerFast_module.cc +++ b/CaloReco/src/CaloHitMakerFast_module.cc @@ -10,7 +10,6 @@ #include "Offline/RecoDataProducts/inc/CaloHit.hh" #include "Offline/RecoDataProducts/inc/ProtonBunchTime.hh" #include "Offline/RecoDataProducts/inc/IntensityInfoCalo.hh" -#include "Offline/CaloConditions/inc/CaloDAQMap.hh" #include "Offline/CalorimeterGeom/inc/Calorimeter.hh" #include "Offline/GeometryService/inc/GeomHandle.hh" #include "Offline/GeometryService/inc/GeometryService.hh" diff --git a/DAQ/src/ArtBinaryPacketsFromDigis_module.cc b/DAQ/src/ArtBinaryPacketsFromDigis_module.cc index a51431aede..7c38fdd982 100644 --- a/DAQ/src/ArtBinaryPacketsFromDigis_module.cc +++ b/DAQ/src/ArtBinaryPacketsFromDigis_module.cc @@ -43,7 +43,7 @@ #include "Offline/RecoDataProducts/inc/StrawHit.hh" // #include "Offline/DAQDataProducts/inc/DataBlockCollection.hh" #include "Offline/CRVConditions/inc/CRVOrdinal.hh" -#include "Offline/CaloConditions/inc/CaloDAQMap.hh" +#include "Offline/CaloConditions/inc/CalDAQMap.hh" #include "Offline/ProditionsService/inc/ProditionsHandle.hh" #include "Offline/SeedService/inc/SeedService.hh" @@ -184,7 +184,7 @@ class ArtBinaryPacketsFromDigis : public art::EDProducer { int _includeDMAHeaders; // -- include proditions handling - ProditionsHandle _calodaqconds_h; + ProditionsHandle _calodaqconds_h; ProditionsHandle _crvChannelMap_h; // Set to 1 to save packet data to a binary file int _generateBinaryFile; @@ -276,12 +276,12 @@ class ArtBinaryPacketsFromDigis : public art::EDProducer { //-------------------------------------------------------------------------------- // methods used to handle the calorimeter data //-------------------------------------------------------------------------------- - void fillCalorimeterDataPacket(CaloDAQMap const& calodaqconds, const CaloDigi& SD, + void fillCalorimeterDataPacket(CalDAQMap const& calodaqconds, const CaloDigi& SD, CaloDataPacket& caloData); void addCaloHitToCaloPacket(calo_data_block_t& dataBlock, CaloDataPacket& caloData); - void fillCalorimeterHeaderDataPacket(CaloDAQMap const& calodaqconds, const CaloDigi& SD, + void fillCalorimeterHeaderDataPacket(CalDAQMap const& calodaqconds, const CaloDigi& SD, DataBlockHeader& HeaderData, uint64_t& EventNum); void fillHeaderByteAndPacketCounts(calo_data_block_t& caloData); @@ -663,7 +663,7 @@ void ArtBinaryPacketsFromDigis::processCalorimeterData(art::Event& evt, uint64_t calo_data_block_list_t& caloDataBlocks) { auto const& cdH = evt.getValidHandle(_cdtoken); const CaloDigiCollection& hits_CD(*cdH); - CaloDAQMap const& calodaqconds = _calodaqconds_h.get(evt.id()); // Get calo daq cond + CalDAQMap const& calodaqconds = _calodaqconds_h.get(evt.id()); // Get calo daq cond calo_data_block_list_t tmpCaloDataBlockList; @@ -757,7 +757,7 @@ void ArtBinaryPacketsFromDigis::fillHeaderByteAndPacketCounts(calo_data_block_t& //-------------------------------------------------------------------------------- // crate a caloPacket from the digi //-------------------------------------------------------------------------------- -void ArtBinaryPacketsFromDigis::fillCalorimeterDataPacket(CaloDAQMap const& calodaqconds, +void ArtBinaryPacketsFromDigis::fillCalorimeterDataPacket(CalDAQMap const& calodaqconds, const CaloDigi& CD, CaloDataPacket& CaloData) { // CaloData.dataPacket.NumberOfHits = 1; @@ -920,7 +920,7 @@ void ArtBinaryPacketsFromDigis::fillCalorimeterDataStream(DTCLib::DTC_Event& cur //-------------------------------------------------------------------------------- // create the header for the caloPacket //-------------------------------------------------------------------------------- -void ArtBinaryPacketsFromDigis::fillCalorimeterHeaderDataPacket(CaloDAQMap const& calodaqconds, +void ArtBinaryPacketsFromDigis::fillCalorimeterHeaderDataPacket(CalDAQMap const& calodaqconds, const CaloDigi& CD, DataBlockHeader& HeaderData, uint64_t& EventNum) { diff --git a/DAQ/src/CaloDigisFromDTCEvents_module.cc b/DAQ/src/CaloDigisFromDTCEvents_module.cc index 1b1791a587..dcc2bd3515 100644 --- a/DAQ/src/CaloDigisFromDTCEvents_module.cc +++ b/DAQ/src/CaloDigisFromDTCEvents_module.cc @@ -16,7 +16,7 @@ #include //-- insert calls to proditions ..for calodmap----- -#include "Offline/CaloConditions/inc/CaloDAQMap.hh" +#include "Offline/CaloConditions/inc/CalDAQMap.hh" #include "Offline/ProditionsService/inc/ProditionsHandle.hh" //------------------------------------------------- @@ -60,9 +60,9 @@ class art::CaloDigiFromDTCEvents : public EDProducer { virtual void endJob(); private: - mu2e::ProditionsHandle _calodaqconds_h; + mu2e::ProditionsHandle _calodaqconds_h; - void analyze_calorimeter_(mu2e::CaloDAQMap const& calodaqconds, + void analyze_calorimeter_(mu2e::CalDAQMap const& calodaqconds, const mu2e::CalorimeterDataDecoder& cc, std::unique_ptr const& calo_digis); @@ -102,7 +102,7 @@ void art::CaloDigiFromDTCEvents::produce(Event& event) { // Collection of CaloDigis for the event std::unique_ptr calo_digis(new mu2e::CaloDigiCollection); - mu2e::CaloDAQMap const& calodaqconds = _calodaqconds_h.get(event.id()); // Get calo daq cond + mu2e::CalDAQMap const& calodaqconds = _calodaqconds_h.get(event.id()); // Get calo daq cond size_t totalSize = 0; size_t numCalDecoders = 0; @@ -145,7 +145,7 @@ void art::CaloDigiFromDTCEvents::produce(Event& event) { } // produce() void art::CaloDigiFromDTCEvents::analyze_calorimeter_( - mu2e::CaloDAQMap const& calodaqconds, const mu2e::CalorimeterDataDecoder& cc, + mu2e::CalDAQMap const& calodaqconds, const mu2e::CalorimeterDataDecoder& cc, std::unique_ptr const& calo_digis) { auto dtcID = cc.event_.GetDTCID(); diff --git a/DAQ/src/CaloDigisToFragments_module.cc b/DAQ/src/CaloDigisToFragments_module.cc index 9bfe85a828..7cd2feae14 100644 --- a/DAQ/src/CaloDigisToFragments_module.cc +++ b/DAQ/src/CaloDigisToFragments_module.cc @@ -20,7 +20,7 @@ #include "artdaq-core-mu2e/Overlays/FragmentType.hh" #include -#include "Offline/CaloConditions/inc/CaloDAQMap.hh" +#include "Offline/CaloConditions/inc/CalDAQMap.hh" #include "Offline/DataProducts/inc/CaloConst.hh" #include "Offline/DataProducts/inc/CaloRawSiPMId.hh" #include "Offline/DataProducts/inc/CaloSiPMId.hh" @@ -143,7 +143,7 @@ class mu2e::CaloDigisToFragments : public art::EDProducer { virtual void endJob(); private: - mu2e::ProditionsHandle calodaqconds_h_; + mu2e::ProditionsHandle calodaqconds_h_; int diagLevel_; art::InputTag caloDigiTag_; diff --git a/DAQ/src/CaloHitsFromDTCEvents_module.cc b/DAQ/src/CaloHitsFromDTCEvents_module.cc index 1e3557992e..5a3cd0fbe6 100644 --- a/DAQ/src/CaloHitsFromDTCEvents_module.cc +++ b/DAQ/src/CaloHitsFromDTCEvents_module.cc @@ -15,7 +15,7 @@ #include "artdaq-core-mu2e/Overlays/FragmentType.hh" #include -#include "Offline/CaloConditions/inc/CaloDAQMap.hh" +#include "Offline/CaloConditions/inc/CalDAQMap.hh" #include "Offline/ProditionsService/inc/ProditionsHandle.hh" #include "Offline/RecoDataProducts/inc/IntensityInfoCalo.hh" @@ -89,9 +89,9 @@ class art::CaloHitsFromDataDTCEvents : public EDProducer { virtual void endJob(); private: - mu2e::ProditionsHandle _calodaqconds_h; + mu2e::ProditionsHandle _calodaqconds_h; - void analyze_calorimeter_(mu2e::CaloDAQMap const& calodaqconds, + void analyze_calorimeter_(mu2e::CalDAQMap const& calodaqconds, const mu2e::CalorimeterDataDecoder& cc, std::unique_ptr const& calo_hits, std::unique_ptr const& caphri_hits, @@ -206,7 +206,7 @@ void art::CaloHitsFromDataDTCEvents::produce(Event& event) { art::EventNumber_t eventNumber = event.event(); - mu2e::CaloDAQMap const& calodaqconds = _calodaqconds_h.get(event.id()); + mu2e::CalDAQMap const& calodaqconds = _calodaqconds_h.get(event.id()); // Collection of CaloHits for the event std::unique_ptr calo_hits(new mu2e::CaloHitCollection); @@ -263,7 +263,7 @@ void art::CaloHitsFromDataDTCEvents::produce(Event& event) { } // produce() void art::CaloHitsFromDataDTCEvents::analyze_calorimeter_( - mu2e::CaloDAQMap const& calodaqconds, const mu2e::CalorimeterDataDecoder& cc, + mu2e::CalDAQMap const& calodaqconds, const mu2e::CalorimeterDataDecoder& cc, std::unique_ptr const& calo_hits, std::unique_ptr const& caphri_hits, std::unique_ptr const& int_info) { diff --git a/DbTables/inc/CalCrystals.hh b/DbTables/inc/CalCrystals.hh new file mode 100644 index 0000000000..91393dde06 --- /dev/null +++ b/DbTables/inc/CalCrystals.hh @@ -0,0 +1,70 @@ +#ifndef DbTables_CalCrystals_hh +#define DbTables_CalCrystals_hh + +#include +#include +#include +#include "Offline/DbTables/inc/DbTable.hh" +#include "Offline/DataProducts/inc/CrystalId.hh" + +namespace mu2e { + + class CalCrystals : public DbTable { + public: + typedef std::shared_ptr ptr_t; + typedef std::shared_ptr cptr_t; + + class Row { + public: + Row(CrystalId crid, float LRU, float pePerMeV_0, float pePerMeV_1): + _crid(crid), _LRU(LRU), _pePerMeV_0(pePerMeV_0),_pePerMeV_1(pePerMeV_1) {} + + CrystalId crid() const {return _crid;} + float LRU() const {return _LRU;} + float pePerMeV_0() const {return _pePerMeV_0;} + float pePerMeV_1() const {return _pePerMeV_1;} + + private: + CrystalId _crid; + float _LRU; + float _pePerMeV_0; + float _pePerMeV_1; + }; + + constexpr static const char* cxname = "CalSimCrystal"; + CalCrystals():DbTable(cxname,"cal.simcrystal","crid,LRU,pePerMeV0,pePerMeV1"){} + + const Row& row(CrystalId crid) const {return _rows.at(crid.id()); } + + const std::vector& rows() const {return _rows;} + std::size_t nrow() const override { return _rows.size(); }; + size_t size() const override { return baseSize() + nrow()*sizeof(Row); }; + virtual std::size_t nrowFix() const override { return CaloConst::_nCrystal; }; + const std::string orderBy() const { return std::string("crid"); } + void addRow(const std::vector& columns) override { + std::uint16_t index = std::stoul(columns[0]); + // enforce order, so channels can be looked up by index + if (index != _rows.size() || index >= CaloConst::_nCrystal) { + throw cet::exception("CALOROCALIB_BAD_INDEX") + << "CalCrystals::addRow found index out of order: " + < _rows; + }; +} +#endif diff --git a/ProditionsService/fcl/prolog.fcl b/ProditionsService/fcl/prolog.fcl index f533b2088d..5fd8210933 100644 --- a/ProditionsService/fcl/prolog.fcl +++ b/ProditionsService/fcl/prolog.fcl @@ -20,14 +20,15 @@ Proditions : { strawResponse : @local::StrawResponse alignedTracker : @local::AlignedTracker alignedTrackerSim : @local::AlignedTrackerSim - caloDAQConditions : @local::CaloDAQConditions trkQualCatalog : @local::TrkQualCatalog crvOrdinal : @local::CRVOrdinal crvPhotonYield : @local::CRVPhotonYield crvStatus : @local::CRVStatus crvCalib : @local::CRVCalib simbookkeeper : @local::SimBookkeeper - calCalib : @local::calCalib + calDAQConditions : @local::CalDAQConditions + calCalib : @local::CalCalib + calSimCrystal : @local::CalSimCrystal verbose : 0 } diff --git a/ProditionsService/inc/ProditionsService.hh b/ProditionsService/inc/ProditionsService.hh index 3d03f206a5..252cf0e68b 100644 --- a/ProditionsService/inc/ProditionsService.hh +++ b/ProditionsService/inc/ProditionsService.hh @@ -11,7 +11,7 @@ #include "Offline/CRVConfig/inc/CRVOrdinalConfig.hh" #include "Offline/CRVConfig/inc/CRVPhotonYieldConfig.hh" #include "Offline/CRVConfig/inc/CRVStatusConfig.hh" -#include "Offline/CaloConfig/inc/CaloDAQMapConfig.hh" +#include "Offline/CaloConfig/inc/CalDAQMapConfig.hh" #include "Offline/DAQConfig/inc/EventTimingConfig.hh" #include "Offline/Mu2eInterfaces/inc/ProditionsCache.hh" #include "Offline/Mu2eInterfaces/inc/ProditionsEntity.hh" @@ -31,6 +31,7 @@ #include "Offline/AnalysisConfig/inc/MVACatalogConfig.hh" #include "Offline/SimulationConfig/inc/SimBookkeeperConfig.hh" #include "Offline/CaloConfig/inc/CalCalibConfig.hh" +#include "Offline/CaloConfig/inc/CalSimCrystalConfig.hh" #include "art/Framework/Services/Registry/ActivityRegistry.h" #include "art/Framework/Services/Registry/ServiceDeclarationMacros.h" @@ -87,16 +88,16 @@ class ProditionsService { Name("alignedTracker"), Comment("Tracker alignment in reco code")}; fhicl::Table alignedTrackerSim{ Name("alignedTrackerSim"), Comment("Tracker alignment in sim code")}; - fhicl::Table caloDAQConditions{ - Name("caloDAQConditions"), Comment("DAQ channel maps for calorimeter")}; fhicl::Table trkQualCatalog{ Name("trkQualCatalog"), Comment("Catalog of TrkQual trainings")}; fhicl::Table simbookkeeper{ Name("simbookkeeper"), Comment("simulation bookkeeping")}; + fhicl::Table calDAQConditions{ + Name("calDAQConditions"), Comment("DAQ channel maps for calorimeter")}; fhicl::Table calCalib{ - Name("calCalib"), - Comment("calorimeter energy calib") }; - + Name("calCalib"),Comment("calorimeter energy calib") }; + fhicl::Table calSimCrystal{ + Name("calSimCrystal"),Comment("calorimeter sim crystal parameters") }; }; // this line is required by art to allow the command line help print diff --git a/ProditionsService/src/ProditionsService.cc b/ProditionsService/src/ProditionsService.cc index 1e9f8f943f..9c63844c0a 100644 --- a/ProditionsService/src/ProditionsService.cc +++ b/ProditionsService/src/ProditionsService.cc @@ -7,13 +7,14 @@ #include "Offline/CRVConditions/inc/CRVOrdinalCache.hh" #include "Offline/CRVConditions/inc/CRVPhotonYieldCache.hh" #include "Offline/CRVConditions/inc/CRVStatusCache.hh" -#include "Offline/CaloConditions/inc/CaloDAQMapCache.hh" +#include "Offline/CaloConditions/inc/CalDAQMapCache.hh" #include "Offline/DAQConditions/inc/EventTimingCache.hh" #include "Offline/DbService/inc/DbService.hh" #include "Offline/GeometryService/inc/GeometryService.hh" #include "Offline/ProditionsService/inc/ProditionsService.hh" -#include "Offline/CaloConditions/inc/CaloDAQMapCache.hh" +#include "Offline/CaloConditions/inc/CalSimCrystalCache.hh" +#include "Offline/CaloConditions/inc/CalDAQMapCache.hh" #include "Offline/CaloConditions/inc/CalCalibCache.hh" #include "Offline/DAQConditions/inc/EventTimingCache.hh" @@ -86,7 +87,7 @@ ProditionsService::ProditionsService(Parameters const& sTable, std::make_shared(_config.alignedTrackerSim()); _caches[atcs->name()+"Sim"] = atcs; auto cdc = - std::make_shared(_config.caloDAQConditions()); + std::make_shared(_config.calDAQConditions()); _caches[cdc->name()] = cdc; // auto tqc = // std::make_shared(_config.trkQualCatalog()); @@ -97,6 +98,9 @@ ProditionsService::ProditionsService(Parameters const& sTable, auto cec = std::make_shared(_config.calCalib()); _caches[cec->name()] = cec; + auto cmc = + std::make_shared(_config.calSimCrystal()); + _caches[cmc->name()] = cmc; if (_config.verbose() > 0) { cout << "Proditions built caches:" << endl; for (auto const& cc : _caches) { From 643f7dac2f63b357d3e5ac9dcdbae6f349717e7b Mon Sep 17 00:00:00 2001 From: echenard Date: Wed, 1 Jul 2026 20:06:21 -0500 Subject: [PATCH 2/2] Added missing entri in db table factory --- DbTables/src/DbTableFactory.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/DbTables/src/DbTableFactory.cc b/DbTables/src/DbTableFactory.cc index 2e6bd545fe..7a4606cf41 100644 --- a/DbTables/src/DbTableFactory.cc +++ b/DbTables/src/DbTableFactory.cc @@ -22,6 +22,7 @@ #include "Offline/DbTables/inc/CalEnergyCalib.hh" #include "Offline/DbTables/inc/CalTimeCalib.hh" #include "Offline/DbTables/inc/CalCosmicT0Align.hh" +#include "Offline/DbTables/inc/CalCrystals.hh" #include "Offline/DbTables/inc/TrkAlignElement.hh" #include "Offline/DbTables/inc/TrkAlignElementSim.hh" @@ -124,6 +125,8 @@ mu2e::DbTable::ptr_t mu2e::DbTableFactory::newTable(std::string const& name) { return std::shared_ptr(new mu2e::CalTimeCalib()); } else if (name=="CalCosmicT0Align") { return std::shared_ptr(new mu2e::CalCosmicT0Align()); + } else if (name=="CalSimCrystal") { + return std::shared_ptr(new mu2e::CalCrystals()); }else { throw cet::exception("DBFILE_BAD_TABLE_NAME") << "DbTableFactory::newTable call with bad table name: " + name + "\n";