Detector Description Framework in LHCb S é bastien Ponce CERN

21
CHEP 2003 - 3/21/03 Detector Description Framework in LHCb Sébastien Ponce CERN

description

Detector Description Framework in LHCb S é bastien Ponce CERN. Topics. Detector data overview Structure, Transient Store, XML backend Possible extensions Parameters, Full extension Condition Database Purpose, Implementation, Impact on user Tools - PowerPoint PPT Presentation

Transcript of Detector Description Framework in LHCb S é bastien Ponce CERN

Page 1: Detector Description Framework in LHCb S é bastien Ponce CERN

CHEP 2003 - 3/21/03

Detector DescriptionFramework in LHCb

Sébastien PonceCERN

Page 2: Detector Description Framework in LHCb S é bastien Ponce CERN

2/21CHEP 2003 - 3/21/03Sébastien Ponce

Topics

● Detector data overviewDetector data overview● Structure, Transient Store, XML backend

● Possible extensionsPossible extensions● Parameters, Full extension

● Condition DatabaseCondition Database● Purpose, Implementation, Impact on user

● ToolsTools● Simulation, Geometry Checker, Visualization

Page 3: Detector Description Framework in LHCb S é bastien Ponce CERN

3/21CHEP 2003 - 3/21/03Sébastien Ponce

Data Diagram

Structure

MaterialGeometry

DetElem GeometryInfo

CalibrationConditionAlignmentConditionReadoutCondition

MuonStation

EcalClusterCondition

Conditions

EcalClusterCondition

MuonStationAlignment

VeloReadout

Lvolume

Pvolume

Solid

Box

Sphere

*

Points to

Inherits fromResolved on demand Material

Isotope Mixture

Element

Page 4: Detector Description Framework in LHCb S é bastien Ponce CERN

4/21CHEP 2003 - 3/21/03Sébastien Ponce

Transient Store

● Tree-like structure● Items identified by a logical name

● Load/update on demand● Automatic update when new event

Transient Store

LvolumeLvolumeLvolumeDetElem GeometryDb

DetectorData Service

PersistencyService

Algorithm

Ask forObject

Retrievepointer

Checkpresence LoadAsk creation

Cnv

Page 5: Detector Description Framework in LHCb S é bastien Ponce CERN

5/21CHEP 2003 - 3/21/03Sébastien Ponce

XML Backend

● Easy to read and to parse● Extensible● Easy to convert● Many tools● Extended using references

<subtraction name="sub2"> <box name="box3“ sizeX="1*m“ sizeY="1*m“ sizeZ="15*cm"/> <tubs name="tub2“ outerRadius="15*cm“ sizeZ="25*cm"/></subtraction><posXYZ z="-40*cm"/><rotXYZ rotX=“90*degree”/>

protocol://hostname/path/file.xml#ObjectIDprotocol://hostname/path/file.xml#ObjectID

<detelemref href="LHCb/structure.xml#LHCb"/>

Page 6: Detector Description Framework in LHCb S é bastien Ponce CERN

CHEP 2003 - 3/21/03

User Extensions

Page 7: Detector Description Framework in LHCb S é bastien Ponce CERN

7/21CHEP 2003 - 3/21/03Sébastien Ponce

User Extensions

● Why ?● In order to implement specific behaviour

(e.g. answering specific simulation questions)● Add specific information to elements / conditions

● How ?● By specializing the Detector Element / Condition● 3 main possibilities :

● Usage of parameters in the XML code● Specialization of the C++ object only● Full extension, including XML, DTD and C++

converters

Page 8: Detector Description Framework in LHCb S é bastien Ponce CERN

8/21CHEP 2003 - 3/21/03Sébastien Ponce

Parameter Extension

<detelem name="MStation01"> <param name="Al_thickness" type="double"> 1.2222*mm <param></detelem>

SmartDataPtr<IDetectorElement> station (detSvc(), "/dd/Structure/LHCb/Muon/MStation01");std::cout << station->param("Al_thickness");

SmartDataPtr<IDetectorElement> station (detSvc(), "/dd/Structure/LHCb/Muon/MStation01");std::cout << station->param("Al_thickness");

● Definition of parameters (name, type and value) in the XML code

● Vectors of parameters also allowed● Direct and easy access in C++

Page 9: Detector Description Framework in LHCb S é bastien Ponce CERN

9/21CHEP 2003 - 3/21/03Sébastien Ponce

C++ Class Extension

● New C++ class inheriting from DetectorElement

● Any member or method may be added

● Its initialize method is called by the framework.

● A dummy converter is needed (2 lines)

class MyDetElem : public DetectorElement {

int getChannelNb() { return chNb; }

StatusCode initialize() { chNb = paramAsInt (“ChNb”); return SUCCESS; }

private : int chNb;}

static CnvFactory <XmlUserDetElemCnv<MyDetElem>> s_factory;const ICnvFactory& XmlMyDetElemCnvFactory = s_factory;

Page 10: Detector Description Framework in LHCb S é bastien Ponce CERN

10/21CHEP 2003 - 3/21/03Sébastien Ponce

Full Extension

● Extension of the DTD to define new XML elements inside the <specific> element

● Parsing of the new XML code using dedicated converters

● Still specialized C++ objects

<detelem name="Head"> <specific> <channelSet name="Controls"> <channels name=”in” nb="20"/> <channels name=”out” nb="150"/> </channelSet> </specific></detelem>

<detelem name="Head"> <specific> <channelSet name="Controls"> <channels name=”in” nb="20"/> <channels name=”out” nb="150"/> </channelSet> </specific></detelem>

if ("channels" == elementName) { string name = childElement.getAttribute ("name"); int nb = xmlSvc()->eval(childElement.getAttribute("nb")); currentChannelSet->addChannel(name, nb);}

if ("channels" == elementName) { string name = childElement.getAttribute ("name"); int nb = xmlSvc()->eval(childElement.getAttribute("nb")); currentChannelSet->addChannel(name, nb);}

Page 11: Detector Description Framework in LHCb S é bastien Ponce CERN

CHEP 2003 - 3/21/03

Condition Database

Page 12: Detector Description Framework in LHCb S é bastien Ponce CERN

12/21CHEP 2003 - 3/21/03Sébastien Ponce

CondDB Purpose

Data ItemData Item

TimeTime

VersionVersion

● To deal with time varying data like calibration, alignment, environment (temperatures) ...

● Handle several versions of a given data● Also deal with the geometry, which is also time

dependent (longer period though)

Page 13: Detector Description Framework in LHCb S é bastien Ponce CERN

13/21CHEP 2003 - 3/21/03Sébastien Ponce

CondDB Implementation

Transient Store

DetElemDetElemDetElemDetElem

DetectorData Service

PersistencyService

Algorithm

Ask forObject

Retrievepointer

Checkpresence Ask creation

Cnv

ConditionDb

ConditionService

Ask for data Retrieve themfrom Database

Abstract interface

● Additional service of the framework● Independent of the type of data contained (XML)● Based on an abstract interface with several

possible backends (Objectivity, ORACLE, MySQL)

Page 14: Detector Description Framework in LHCb S é bastien Ponce CERN

14/21CHEP 2003 - 3/21/03Sébastien Ponce

Impact on End User

● No impact on the "raw" XML code● Only references are changed by the usage of the

"conddb" protocol● No change at all in the C++ code : the correct data

are loaded depending on the event time

<DDDB> <catalog name="Hcal"> <!-- Hcal slow control catalog --> <conditionref href="conddb:/CONDDB/SlowControl/Hcal/scHcal#scHcal"/> </catalog></DDDB>

<DDDB> <catalog name="Hcal"> <!-- Hcal slow control catalog --> <conditionref href="conddb:/CONDDB/SlowControl/Hcal/scHcal#scHcal"/> </catalog></DDDB>

Page 15: Detector Description Framework in LHCb S é bastien Ponce CERN

CHEP 2003 - 3/21/03

Tools

Page 16: Detector Description Framework in LHCb S é bastien Ponce CERN

16/21CHEP 2003 - 3/21/03Sébastien Ponce

XmlEditor Tool

● Specialized XML Editor for Detector data● Understanding cross file references● Hides the complexity of XML from the end user

● Tree like structure a la explorer● Easy drag & drop, cut & paste● Insure that the XML is well-formed and valid● Still writes human readable, indented XML

Page 17: Detector Description Framework in LHCb S é bastien Ponce CERN

17/21CHEP 2003 - 3/21/03Sébastien Ponce

XmlEditor Tool

Page 18: Detector Description Framework in LHCb S é bastien Ponce CERN

18/21CHEP 2003 - 3/21/03Sébastien Ponce

Geometry Checkers

● Visual checker :● based on David :

Dawn's Visual Intersection Debugger

● Uses GiGa :Gaudi interface to Geant4 applications

● Gaudi Transport Service :

● More precise

● More reliable

Page 19: Detector Description Framework in LHCb S é bastien Ponce CERN

19/21CHEP 2003 - 3/21/03Sébastien Ponce

Visualization Tool

● Event and geometry viewer● Interfaced with Gaudi via scripting services

Page 20: Detector Description Framework in LHCb S é bastien Ponce CERN

20/21CHEP 2003 - 3/21/03Sébastien Ponce

Visualization (2)

Page 21: Detector Description Framework in LHCb S é bastien Ponce CERN

21/21CHEP 2003 - 3/21/03Sébastien Ponce

Conclusion

● A fully functional and stable solution● Many tools provided :

● For XML generation● For geometry checking● For visualization

● Used successfully for simulation, reconstruction and analysis