USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283...

16
Computer Physics Communications 45 (1987) 283—298 283 North-Holland, Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S. TANG, W. ZHAO * IHEP, Academica Sinica, Be4jing China S.M. FISHER “, J. HARVEY Rutherford Appleton Laboratory, Didcot, GB M. BOANO, J. BUNN, R. McCLATCHEY, V. EMILIANI, P. PALAZZI * CERN, Geneva, Switzerland R. BRAZIOLI *, A. PUTZER IHEP, Heidelberg University, Fed Rep. Germany M.G. GREEN Royal Holloway College, Univ. of London, GB and R; FANTECHI Instituto di Fisica, Pisa, Italy ADAMO is a data management system for defining data and manipulating them from FORTRAN programs. A form of the Entity—Relationship (ER) model and the data flow diagrams of structured analysis have been combined to provide a system suited to algorithmic work. The FORTRAN interface consists of calls to a subroutine package with a few data manipulation primitives. Data items are visible in variables carrying meaningful names; the code is compact and readable. The ER data structures, mapped onto tables, are compatible with a relational data base management system. Tools have been written to copy tables to and from a relational data base. The system has been used for several applications in the fields of event simulation and reconstruction, online systems, detector description, support tools and packages. 1. Introduction and more complex, data structures and data management have become increasingly important. The Aleph DAta MOdel (ADAMO) system The design of ADAMO has been influenced by was developed as an independent project within clear trends in the software industry, such as the the ALEPH + collaboration, its aim being to cope prominence of relational data bases, increasing with the complexity of data in a modern particle use of engineering practices, data abstraction and physics experiment. It has been stated that the importance of a progranmiing environment PROGRAMS = ALGORITHMS with adequate software development tools. + DATA STRUCTURES In defining and constructing the system, it was decided to distinguish between the INTERNAL and in the past much attention has been devoted (machine) and EXTERNAL (programmer, user) to the algorithms. Now that detectors are larger view of the data, defining a CONCEPTUAL view to which they can both refer [1J. To achieve this a * Denotes those who are also authors of the ADAMO system. DATA MODEL was adopted, with a set of data + ALEPH is an experiment at the LEP collider at CERN. structures, manipulation operators and validation OO1O-4655/87/$03.50 © Elsevier Science Publishers B.V. (North-Holland Physics Publishing Division)

Transcript of USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283...

Page 1: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

ComputerPhysicsCommunications45 (1987) 283—298 283North-Holland,Amsterdam

USEOF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH

Z. QIAN, S. TANG, W. ZHAO *

IHEP, AcademicaSinica,Be4jing China

S.M. FISHER “, J. HARVEY

RutherfordAppletonLaboratory,Didcot, GB

M. BOANO, J.BUNN, R. McCLATCHEY, V. EMILIANI, P. PALAZZI *

CERN, Geneva,Switzerland

R. BRAZIOLI *, A. PUTZERIHEP, HeidelbergUniversity, Fed Rep.Germany

M.G. GREEN

RoyalHolloway College,Univ. of London,GB

andR; FANTECHI

Institutodi Fisica, Pisa, Italy

ADAMO is adatamanagementsystemfor definingdataandmanipulatingthem fromFORTRAN programs.A form of theEntity—Relationship(ER) modeland thedata flow diagramsof structuredanalysishavebeencombinedto provide a systemsuited to algorithmic work. TheFORTRAN interfaceconsistsof calls to a subroutinepackagewith a few datamanipulationprimitives. Data itemsare visible in variablescarryingmeaningfulnames;the code is compactand readable.TheER datastructures,mappedonto tables,are compatiblewith a relational databasemanagementsystem.Tools have been written tocopy tablesto and from a relational database. The systemhas been usedfor severalapplicationsin the fields of eventsimulationandreconstruction,online systems,detectordescription,support toolsand packages.

1. Introduction and more complex, data structures and datamanagementhavebecomeincreasinglyimportant.

The Aleph DAta MOdel (ADAMO) system The design of ADAMO has beeninfluenced bywas developedas an independentproject within clear trendsin the softwareindustry, such as thetheALEPH + collaboration,its aim being to cope prominence of relational data bases, increasingwith the complexity of datain a modernparticle useof engineeringpractices,dataabstractionandphysicsexperiment.It hasbeenstatedthat the importanceof a progranmiing environment

PROGRAMS= ALGORITHMS with adequatesoftwaredevelopmenttools.+ DATA STRUCTURES In defining andconstructingthe system,it was

decidedto distinguish betweenthe INTERNALandin the pastmuch attentionhasbeendevoted (machine)and EXTERNAL (programmer,user)to the algorithms. Now that detectorsare larger view of the data,defining a CONCEPTUAL view

to which they canbothrefer [1J.To achievethis a* Denotesthosewho arealsoauthorsof theADAMO system. DATA MODEL was adopted,with a set of data+ ALEPH is anexperimentat the LEPcollider atCERN. structures,manipulationoperatorsand validation

OO1O-4655/87/$03.50© ElsevierSciencePublishersB.V.(North-HollandPhysicsPublishingDivision)

Page 2: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

284 Z Qian et aL /ADAMO within ALEPH

primitives. A machine readableDATA DICT- tinctly identified and have a fixed number ofIONARY, accessibleto all the programsrelatedto characteristicscalled ATTRIBUTES, and RELA-a given application,is the physical supportof the TIONSHIPS,that are associationsamongentities.model. Finally, it was consideredessential that An important feature of the model is the ERdataelementsbe visible in the final codeas varia- diagram, a graphical representationof the datables carryingmeaningfulnames,while manipula- with boxesand arrows.Thesediagrams, togethertion operatorswould be seenas calls to a sub- with dataflow andstatetransitiondiagrams(whichroutine package. are complementarymodels of a system), form a

compactdescription that is easy to grasp andconvenientfor discussions.

2. Modellingdata

For datato beuseful in providing information, 3. Programmingwith ADAMOthey haveto be organizedso that they representthe realworld as closely as possible,andthat, at The analyst/programmerseesADAMO as athe same time, they can be easily handled by set of datadesign andprogrampreparationtools,computers.Thesetwo requirementsareoften con- integratedin the command environmentof theflicting. To determinehow bestto arrangedatafor operatingsystem(VMS and VM at present).Heeachapplicationit is convenientto formulategen- thenprogramshisapplicationin FORTRAN usingeralstatementsabouthow dataare organizedand the datamanipulationsubroutinesof the TAbleprocessedin all applications.A consistent,formal Package(TAP). The ADAMO system,includingset of such statementsdefinesa DATA MODEL the overall systemarchitecture[5], anda complete[2]. example,from modellingto a working program[6]

A datamodel is acombinationof at leastthree is describedin a seriesof notes.components[3]: Thetoolsprovidea completepath from the ER

1. a collectionof datastructuretypes; diagrams, through the data structures(entities,2. a collection of operatorswhich can be ap- relationshipsandattributes)describedin the Data

plied to anyvalid instanceof the datatypeslisted Definition Language(DDL) and mapped ontoin (1), to retrieve,derive or modify datafrom any tables,down to the FORTRAN variablesto whichpart of those structuresin any combination de- thosedatacorrespond.Othertools are availabletosired; validateand draw data flow diagramsof Struc-

3. a collectionof generalintegrity rules,which tured Analysis (SA) [7], to document the datadefinethe set of consistentdatabasestates— these structures,to define the schemaof a relationalrules are generalin the sensethat they apply to databaseand transferdata to and from it. Toolsany databaseusingthe model. can be activatedindividually with a command,After several attemptsto model typical particle and communicateasynchronouslythrough inter-physicsapplications,the Entity—Relationship(ER) face files. Online documentationis availableviamodel was selected.It wasoriginally proposedby HELP files that correspondto the printed docu-Chen in 1976 [4] as a way to unify the network ments,andtemplatesfor the VMS LanguageSen-and relational databaseapproaches,and in the sitive Editor (LSE) assistwith the syntaxandthelast decadethere has been a proliferation- of semanticsof the DDL.theoretical extensionsand practical applications After successfullyrunning the datadefinitionof it. Themodel is now part of boththeACM and and programpreparation tools, the applicationIEEE recommendedcurricula. It is simpleenough program is coded, including calls to the datathat the basicconceptscanbe learnedreadily, yet manipulationsubroutinesof the TAP (LSE tem-sufficiently powerful for scientific and technical plates are also available for this purpose).Theapplications.It adoptstheview that therealworld TAP consistsof about75 subroutines(althoughaconsistsof ENTITIES, things that can be dis- typical application uses about twenty), among

Page 3: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

Z Qian eta!. /ADA MO within ALEPH 285

themthe essentialdatamanipulationprimitives of The calorimeteris read out via cathodepads.themodel: The padsare groupedtogetherto reducethe num-

INSERT, REPLACE, DELETE, COUNT, ber of outputchannelsto 218 000. Eachgroup isSELECT, FETCH, RELATE, NAVIGATE nown as a s orey. .

Oneof the dataflow diagrams(DFD) descnb-Subroutinesexist to check the validity of various ing the reconstructionof the cluster energiesisaspectsof the data; for examplethat attributesof shown in fig. la. In contrast to this diagram,entitiesare within the rangespecifiedin the DDL. which shows how the dataare processed,the ER

The TAP normally makesa numberof checks diagramof fig. 2 definesthestructureof the dataon the consistencybetweenthe subroutineparam- as entitiesand the relationshipsbetweenthem. Itetersandthe datastructure,but thesechecksmay was found essentialto develop the two types ofbe inhibited in productionprogramsto savetime. diagramin parallel anditeratively, asit is is hard

Other subroutinescopy tables to and from a to imaginehow to processdata,if the dataarenotDirect AccessFile (DAF) where they are identi- understood;and it is not possible to know whatfied by a multi-level key. As all dataare held in dataare neededuntil theprocessingrequirementstables,building an interfaceto a RelationalDBMS areclear.was straightforward.This interfacetool, the TOR Correspondingto eachERdiagramis a formalis able to copy a set of ADAMO tables from a descriptionof that diagramin the DataDefinitionDAF to an ORACLE [8] data base, and back Language(DDL) of ADAMO. An extract fromagain. The ORACLE RDBMS providesfacilities theECALDataDDL showingdefinitionsof somesuch as multi-useraccessandconsistencycontrol, of the entity sets (ESET), relationships (RSET)and is supported by sophisticated database andattributesis presentedin fig. 3. DDL files aremanagementtools,but it is not alwaysconvenient processedby an ADAMO tool to produce anto use it directly from an applicationprogram. internalstoragerepresentationcalledthe ADAMOThereare threebasicreasonsfor this: Data Dictionary (ADD). To provide a real link— ORACLE is very slow whencomparedwith the betweendata flow and ER diagrams,data flows

TAP; are ultimately expandeddown to components— Codingwith the TAP is mucheasierthanusing which are entity sets,attributesandrelationships.

the query language interface provided by As this is describedin the DDL (fig. 3), the dataORACLE; flow plotting tool is able to redrawthe diagram

— Not manysiteshaveORACLE installed, where the data flow lines are annotatedwith theexpandednamesasillustratedin fig. lb.

Eachentity set hasan attribute(ID) to hold a4. An illustration of using the ADAMO system uniqueidentifier for eachentity.Within the appli-

cationprogrameachentity setis materialisedas a

This sectionillustrates the stepsperformedby table.Eachentity gives rise to a row in the corre-the application programmerusing ADAMO, to sponding table with the columns containingthecreate a section of the ALEPH reconstruction valuesof the attributesof that entity. In this tableprogram: cluster finding in the electromagnetic eachattributehasa correspondingcolumnas doescalorimeter(ECAL). In developing this codethe eachrelationshipfor which the arrow on the ERtechniquesof SASD were used in conjunction diagrampoints awayfrom the entity set.Thus thewith ADAMO. The ADAMO aspectsare stressed entity set ESDA has four attribute columns ashere,as the useof the SASD techniqueby ALEPH listed in the DDL of fig. 3 and threerelationshipis reported in another submission to this con- columns as shownin the ER diagram of fig. 2bference[91.This work is describedin more detail and the RSET definitionsof the DDL.in one of the ADAMO applicationnotes [101.A The contentsof the data dictionary can becompletelist of suchnotesmay be found in ref. listed in tabular form. Fig. 4 shows an extract[11]. from one of the several listings which can be

Page 4: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

286 Z. Qian et aL / ADAMO within ALEPH

EaGoosTrack Const

In~proosd ..— \ / a/ EctatrapConst N 2 5 3Energy Poram

AS5]6 N

~ CcM~p EeShoae~E Ass g dEcDead Ecieom TO ECA,LChannels CoostCLUSIER

SEARCHEcW,reData

FOR En

—CcStoreyDo~~~ EcAss ignedCcEeC l,te~ CLUSIE

EcObject Db~ectThreshold

Cal Object

(CAL

~LHcAssgnsd~

6~~L CO Data

4~SsOc~’IliclubeDota 11cC I uster ~ CLUStER TO ID splayANALYSISHCAL ) Clt~ster~ Tro EcG.oeCo & HcG.ce ColStnt~st,csMcSoorn ckleproved Cons& I.prov.dIroekCansi/ Chonn.I. 7 / \Author IRevuewer~ Reconstruct Aleph Event I 0 frctementISlatus I

FIND CALORIMETER OBJECT_________ IDate 6-OCT-l986100te

NTrack (cbaasStcr.yeCOnUt

Isp r ovU d —~ / bEcEotrapConsl N EcE tropCond EeShouer

(CAL-thpEn.rg, Par as/ 1RACICSECLU 3 254I ECDS- S. Ev6.o.Stteck~CansEI (CAR— S (c6.oeStor.ysCUnU~ ~ TO (CAL

CCLV- SEARCHI CUbA- I FOR En

~( ESDA- EUDA- 3~ LCAL__—~ CEUSIE I CUd— I [COB-(CALCIOLIUr Ihc.sh (COB-

ALO-

I HIDA- HC 255 I (CAL

___ ~~icHcAs~gnsd______ ______I FIND ........_ sp loyDota.I HSDA- S IICALEcu. RSJ

ANALYS c lStot,st~cs(cS.o.S&oyksC et~ Sr 7 EoR.~.Stor.y~~ss~ ~pIoyDaIa

irockbIeproved CI HCDS- 3I HCD1- onst ].proved

lAuthor IRevuewerReconstruct Aleph Event

1Versuon I B JComment

~Status IFIND CALORIMETER OBJECT IDate 6-OCT-1986J0ote

Fig. 1. (a)ECAL Dataflowdiagram2.5 (unexpanded);(b) ECAL dataflowdiagram2.5 (expanded).

Page 5: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

Z. Qian et aL / ADAMOwithin ALEPH 287

I. ECALGeom

I :CenLTSI~IeCIOrTra~ ~ r~LGeo~1_.~ ~-:~1J______________ ________ _____ SHCALDnIa

2. ECALDaIa 3. CalObjec

a I ___Calorimeters I Authors: M. 6. Green I Reyiewers:

Version: 2 I Commenl:

0 CONTEXT I Stalus: working II Dale:Dale: 1-OcI-1986 I

I EWire _____________________________E WireDala Calobject

‘PH ___E WireData ICluster

IE Cluster E Cluster - - CCfltF~l- -Track Detector________________ Track________E Module I AE Cluster I Calorimeter

Object ‘~‘ Object3I j e,.,,uon~ I E Storey I ~

Calobject

___________ E StoreyData(~ E Store

b ~ Object j~ J p,I EObject

_____________________________________ Version: 2

2 Calorimeters Authors: M.G.Green IStatus: Working IECALDaIa Date: 1-Oct.1986 I

Fig. 2. (a) ECAL ERdiagram - CONTEXT; (b) ECAL ER diagram- ECALData.

produced.This output formsan importantpart of give variablessuch as ESDA_Row, or ANSI sixthedocumentationof theapplicationprogram. characternamessuchas ESDARW.

The next stageis to passthe ADD through the An exampleof a routine from the ECAL recon-FORTRAN LanguageBinder to producea table structionis shownin fig. 5. Thisparticularroutineinitialisation routine and FORTRAN COMMON collects into a cluster all storeys that are con-blocks and declaration statementsfor insertion nected by at least one corner. This its principalinto the applicationprogram.The variablenames input is the table ESDA, and its output is themay be either “VAX-style”, formed by con- tableECLU. Calls to TAP routinesare underlinedcatenatingthe entity set and attribute namesto in this listing and illustrate typical operationson

Page 6: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

288 Z. Qianeta!. / ADAMOwithin ALEPH

DEFINE ESET

I~ *1ESDA : ‘Ecal storey data’

= (Row,Column,Stack,Ertergy);

ECLU : ‘Ecal cLuster’= (Charge,

Energy(4),Radius(4),Theta(4),Phi(4),RadErr(4),ThErr(4),PhiErr(4),StackLirnit(2) = INTE [1,21

‘Innermost and outermost stacks’,ProcLevel = INTE [Q,*]

‘Processing level’);

END ESET

DEFINE RSET

1* *1

(ESDA [1,1] —> (0,~] EMOD): ‘EcStorey data belong to a module’;

(ESDA (0,11 —> [1,*] ECLU): ‘Clusters are constructed from Storeys’;

(ESDA (1,1] —> (0,1] EPAT): ‘Neighbour pattern relation’;

END RSET

DEFINE ATTRIBUTE

1*

aow = INTE (1,228]: ‘Storey row number’;

Column = INTE (1,384]: ‘Storey column number’;

Stack = INTE (1,3] : ‘Stack number’;

END ATTRIBUTE

DEFINE DATAFLOW/~. *1

EcStoreyData: ‘Ec storey data from on—line after preparation’;= (ESDA_ }

EcwireData : ‘Ec wire plane data from on—line after preparation’;= CEWDA_}

EcData : ‘Ec data from on—line after preparation’;

= CESDA_ ), CEWDA_}EcAssignedWirePlane

:‘Relationship between wire planes & Cluster’;= CEWDA_}, CEWCL }

END DATAFLOW

Fig. 3. Extract fromDDL for ECALData.

Page 7: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

Z Qian eta!. / ADAMOwithin ALEPH 289

the tables such as fetching a row (FETTAB and 5. ApplicationsGETTAB), insert a new row (INSENT) and in-serting an entry into a relationshipcolumn (IN- 5.1. ReconstructionandsimulationprogramsSREL). The table ESDA for a typical simulatedevent is shown in fig. 6. The previoussection describedhow ADAMO

is beingusedin the reconstruction program. Work

was also performed to test the suitability of

ADAMO Toolset: LID run on 25—JAN—1987 11:56part 3 of Table alphabetic indexDIS

9ALEPH:(GREEN.RECONS]RECONS.ADD;5 of l5—DEC—l986 14:03

V

Table ColNain Base Func Par Cmt

ECLU Ecal clusterID SNUM IDCharge INTE AOE Charge on a particleEnergy(1) REAL ACE A general energy measurement

‘‘A’Energy(4) REAL ACERadius(l) REAL ACE A radial coordinate

‘‘‘I

Radius(4) REAL AOETheta(1) REAL ACE A general theta angle

Theta(4) REAL ACEPhi(1) REAL ACE A general phi angle

Phi(4) REAL ACERadErr(1) REAL AOE Error on a radius value

RadErr(4) REAL ACEThErr(1) REAL ACE Error on a theta value

ThErr(4) REAL ACEPhiErr(l) REAL ACE Error on a ?hi value

PhiErr(4) REAL ACEStackLimit(1) INTE ACE Innermost and outermost

stacksStackLimit(2) INTE AOEProcLevel tNT! AOE ProcessingLevel

ESDA Ecal storey dataID SNUM IDRow INTE ACE Storey row numberColumn INTE ACE Storey column numberStack INTE ACE Stack numberEnergy REAL ACE A general energy measurementECLU REL REL P Clusters are constructed

from StoreysEMOD REL REL EcStoreydata belong to a

moduleEPAT REL REL Neighbour pattern relation

Fig. 4. Extract from ADD listing.

Page 8: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

290 Z. Qian et aL / ADAMOwithinALEPH

SUBROUTINE ECTOPOCoC Find ECAL topological clustersC

C Loop Over Storeys collecting neighbours with energy > thresholdC

DO 100 IC1 = 1 ,COUTAB(ESOA)CALL FETTAB (ESDA,ID,IC1)IF(ESDA_ECLU.EQ.INULL AND.

ESDA_Energy . GT. ECAL_I-ii ghlhresh . AND.TOSP.LT.LSTAK) THEN

C Start new cluster, insert relationshipsECLU_ID = NEXTCALL ECLPAR C 1

CALL INSENT (ECLU)CALL INSREL (ESDA,ESOA_ECLU,ECLU)CALL EWIRIN

C Save memory mapped address and naig’hbour pattern IDTOSP =IMAPS(TOSP) = ECMAPS (ESDA_Column,ESDA_Row,ESDA_Stack)

IEPAT(TOSP) ESDA_EPATCC Having found the first storey in a pre—c luster. loop Over a~C contiguous storeys adding to the Cluster if above threshold.C Use a loop structure with a conditional GOTOto simulate recursionC

50 CONTINUEMAPSV = IMAPS(TOSP)

EPAT_ID = rEPAT(T0SP)CALL GETTAB (EPAT)

C Deal with ‘wrap-around’ regionIF (ESDA Column .EQ. 1 .OR.

MOD(ESDA_Column,96) .EQ. 0) CALL EMODOFTOSP = TOSP — 1

C Loop over neighbouring storeysDO 80 IC2 = l,EPAT_NOffSet

ESDA_ID = EMAP(EPAT..Offset(1C2) + MAPSV)IF (ESDA_ID NE. 0) ThEN CALL GETTAB (ESDA)

IF (ESDA_ECLU.EQ.INULL AND.ESDA_Energy.GT.ECAL_LowThreSfl .AND.TOSP.LT.LSTAN) THEN

C Insert relationshipsCALL INSREi.. (ESDA,ESDA_ECLU.ECLU)IF (ESDA_EMOD .NE. EWCL_EWDA) CALL EWIRIM

C upaate cluster parametersCALL ECLPAR (2)

C Save memory mapped address and neighbour pattern IDTOSP = TOSPIMAPS(TOSP) ECMAPS (ESDA_Column,

ESOA_Roei, ESDA_Stack)IEPAT(TOSP) ESDA_EPAT

ENDIFENDI F

80 CONTINUEIF (TOSP .GE. 1) GO TO SO

Complete cluster parameters and replaceCALL ECLPAR (3)CALL REPENT (ECLU)

END IFC

100 CONTINUEC

RETURNEND

Fig. 5. An examplefor ECAL codeusingtheTAP.

Page 9: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

Z. Qian etaL / ADAMOwithin ALEPH 291

ADAMO andthe TAP in theALEPH simulation working on the programhad usedhis favouriteprogram, by converting a part of it to use the datastructures.TAP, andcomparingit with the original [12]. The Taking as input existingcodeanddatadescrip-original program has been written using direct tions, the systemwas modelled in a way whichcalls to a memory manager,where eachperson reflectedthe existingdatastructuresuch that the

Ecal. stOrey data

TabLe : ESDA ADANC/TAPCount = 36COL: ID : SNUM (14 )

Row : INTE (15CoLumn : INTE (15Stack : INTE (ISEnergy : REAL (F7.3ECLU : REL (15 )EMOD : REL (15 )EPAT : REL (15 )

Printed aLong : ID [MINC,36}

ID Row Colum Stack Energy #ECLU I~IEMOD #EPAT1k 1k 1k

1 176 227 1 0.176# 1~ 20# 422 176 232 1 0.212# 21k 201k 423 176 237 1 0.0481k 31k 201k 424 176 238 1 0.7361k 31k 201k 425 177 225 1 0.0321k 11k 201k 436 177 226 1 0.4561k 11k 201k 437 177 227 1 0.6161k 11k 201k 438 177 232 1 0.0361k 21k 201k 439 177 238 1 0.9561k 31k 201k 43

10 181 226 1 0.0521k 11k 321k 4711 181 227 1 0.1961k 11k 321k 4712 181 238 1 0.0481k 31k 321k 4713 182 225 1 0.1241k 11k 321k 4814 182 226 1 0.4241k 11k 321k 4815 182 227 1 1.4881k 11k 321k 4816 182 227 2 0.2201k 11k 321k 12117 182 228 1 0.3401k 11k 321k 4818 182 229 1 0.1321k 11k 321k 4819 182 239 1 0.0481k 31k 321k 4820 182 240 1 0.1081k 31k 321k 4821 183 224 1 0.0801k 11k 321k 4922 183 225 1 0.1361k 11k 321k 4923 183 225 2 0.1001k 11k 321k 12224 183 226 1 0.1641k 11k 321k 4925 183 226 2 0.0961k 11k 321k 12226 183 230 1 0.0681k 11k 321k 4927 183 238 1 0.0481k 31k 321k 4928 183 239 1 0.0761k 31k 321k 4929 184 224 1 0.0841k 11k 321k 5030 184 229 1 0.0441k 11k 321k 5031 184 230 1 0.0601k 11k 321k 5032 184 237 1 0.1561k 31k 321k 5033 185 220 1 0.0641k=====# 321k 5134 187 226 1 0.0641k=====1k 321k 5235 189 170 1 0.1001k 41k 321k 5836 189 171 1 0.1321k 41k 321k 59

Fig. 6. Tablesproduced by theECAL code.

Page 10: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

292 Z. Qian et a!. / ADAMOwithin ALEPH

codewould needlittle restructuring.This is not ent places and by many people, a well definednecessarily the way it would have been done in the framework and explicit rules were needed. It was

absenceof suchconstraints.The ER diagramwas realisedthat a modernapproachwas requiredtoproduced,and DDL written andprocessedin the build and maintain a consistent database.Thenormalway. systemhadto be openended,sincemoreinforma-

The codewasthenmodified to makeuseof the tion will need to be stored in the future and itTAP. The only difficult part of this work was mustbepossibleto couple to existingRDBs.understandingthe original non-TAP code. After Fig. 7 shows part of the description of theperformingsome simple optimisation the execu- read-outgeometryfor two of the detectorcompo-tion speedwassimilar to theoriginal code,but all nents. A more detailed descriptionof the wholereferencesto the underlyingmemorymanagerhad systemcan be found in [13]. DDL was written,vanished.Specialprinting routineswereno longer and the ADAMO tools were used to provide aneededandintricatecode,which referencedvaria- consistencycheck of the model, to perform datables in the datastructureshandledby the memory validation, as documentationand to guaranteemanager,was eliminated, resulting in a program consistencybetweenthe applicationprogramsandwhich was shorterandclearer, the database.All thesepoints have been badly

neglectedin thepastas toolshavenotbeenavaila-5.2. Detectordescription ble.

The data must be available on computers from

The databaseof the ALEPH DetectorDescrip- different manufacturersand at many sites. Fortion System comprises all information on the de- this an ADAMODAF is used, copied to and from

tector, such as the geometricaldescriptionof the an ORACLE databaseby the TOR. Fastaccesstomodules and the read-out geometry. Since the the dataand distribution of the databaseis per-software,like the hardware,is developedat differ- formedvia the DAF, so it is notnecessaryto have

ALEPII

Component___________ Type ____________

~ITC~ ,PITPCI

ITC TPCSubcomp. Subcomp.

ITC Ali~n.~ ~TPCAli~n.~ ________

Slot ~,,.JTPC slot TPC Pad

ITC I I ITC TPC ~ I TPC ~.*( TPC PadPhysical I—eJ Module Physical • ~ Module k TriggerModule Type Module Type ~ Arrang.

[ITC layer ~“NjTPC Sector

I1Geometry

ADDS AUthOrS: A.Putzer

I 5t~~t~~s Working1 General Dale 14 Dec 1986

Fig. 7. ER diagramfrom theAleph DetectorDatabaseSystem.

Page 11: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

Z Qian eta!. / ADAMOwithin ALEPH 293

ORACLE running on all installations. 5.3. Use in an onlinesystemORACLEmaintains themasterdatabase,where

only peopleresponsiblefor parts of the detector The complexity of modern HEP experimentsare allowed to add, changeand delete informa- posessevereproblemsfor the designof the onlinetion. Full use may be madeof the featurespro- systemsused to operate the experiments. Thevided by the RDBMS and its support tools to arrangementof detector elementsis complicatedenter and maintain some basic constants.The and togetherthey generateseveralhundredthou-contents of a DAF may be manipulatedby a sandchannelsof information.A readoutsystemisprogram to enter data such as calibration con- neededto digitise andrecordall thesedataandastants.It is the task of the databaseadministrator controlsystemis requiredfor settingandmonitor-to ensure that the master copy (the ORACLE ing the operatingstateof the equipment[16].database)is keptup to date. Sophisticatedsoftware must be developed to

An additional study on detector description configurethe experimentfor datataking, for con-was performedto specify someof the datastruc- trolling accessto all systemresourcesand fortures of GEANT 3.07 [14] using the ER model, managingthe largequantityof information gener-and to recodesome GEANT routines to use the atedby the experiment.All this must be doneinTAP, and to comparewith the original [15]. The such a way that the operatoris screenedfromsystemwasmodelledin a way which reflectedthe unnecessarycomplexity. Only with a real under-existingdatastructure,to facilitate therecodingof standingof the data and their relationshipscanthe GEANT routines.The revised routineswere sucha systembe constructed.shorterandeasierto read as therewereno longer The ER model hasbeenfound capableof rep-any referencesto the memory manager.Certain resenting the essential online information onfeaturesof GEANT which were not very clear diagramswhich are clear and easy to interpretfrom the manual,wereevidentin the ER diagram, [17,18]. The scopeof the datamodel usedin theand of coursethe whole datastructurewas very design of the ALEPH online systemis shown inclearly describedby the DDL. fig. 8. The DetectorDescription,explainedin the

previoussection,forms a centralreferencepoint inthis model. In addition,much effort hasbeenput

I. Run Desc 4. Slow Control Desc

_ 1~ _

2. Partition Desc 3. Detector Desc S. Fastbus Desc

I Authors: Ilarsey Resiewers:

()NI.INE Version: 1.0 Commenl:SaIus: preliruilliary I

I ~L(()N’ll:X’l l)ate: 24~)Cl-8o

Fig. 8. ERContext diagram of the ALEPHon-line system.

Page 12: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

294 Z. Qian et a!. / ADAMOwithin ALEPH

ç’~intertace Type

IlostInti ____________ Host5Name

~ByHosiSegment PorlTypeSegment * Port Ipii’~~ : - -

________ *Name *GAUnit Owner Name ________________

ActiveStatus EnableMaster ~ Device*Name EnableLA

Status Initialised Thru I Owner

i Status

Either Cable ISenalNol

StartSlotHo I Pu.Pu.~ Crate StartSlotNo__if

UnitType I _________________ I InslallStatus I — — —. — .— — —.Extensions II [SerialNoj Des’tcelype

1 i ____________________________________________________

5Ext~n~joj~Mc,d~ T IIP0wes~pply IC~eType- InstallStatus I

I I ISe~No~

W

FASTRUS Data Model Author McClalchey Reviewer (s) : RimmerVersion II Conunienl~J Layout Subschcnia : l6.i)F(. 1986 l)ate :Fig. 9. ERdiagram from the FASTBUSdescription.

into describingour readoutsystemwhich is based configureaFastbussystemrequiresaccessto itemson Fastbus. stored in the database. These access procedures

Fastbusis a segmented,high speed bus for must allow data to be stored and retrievedfromestablishing communication paths between the the databaseand to follow relationshipsbetweenintelligent processingmodulus used to digitise, data items, but should hide the details of datacollect and processraw signalscoming from the storage.TheTAP packageof ADAMO providesadetectors.The possibleways in whichdevicescan set of standardprimitives to manipulateER struc-be configuredin Fastbus systems is complicated, tures and hasbeenfound to be ideal for imple-as are the rules governing the passing of oper- menting the accessprocedures,resulting in clearationsbetweendevices.Fig. 9 illustratesthis point and concisecode. Due to the complexity of theby anextract from the FastbusDescriptionshow- Fastbusmodel and the rangeof operationsto being connectivityandaddressabilityof the readout carried out on the data, many such proceduressystem.Oneof the greatbenefitsof following this must be provided. As the TAP will be used toapproachhas beenthat the diagramshave been accessdatathroughoutthedatabaseit is simpletoanalysedin greatdetail to checkthat they offer a maintain a general data accesspackagein thecorrect interpretationof the Fastbusstandard, online environment.The Fastbusdata tables areThis gives confidencein the correctnessof the stored on ADAMO DAFs. As with the detectorprogramstructuredevelopedfrom the dataspeci- description system the TOR was used to copyfication. theseDAFs to and from an ORACLE database,

The automatedinitialisation software used to to allow ADAMO and ORACLE to eachdo thejob they do best.

Page 13: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

Z. QianetaL /ADAMOwithin ALEPH 295

Node Network

Member ~~~~ogin Compuler Gateway

WI IOSWFIO

r~~ute~l

ComputeOn Maillnst MailProc

~ NAI)lR, New Aleph DIRectory Authors: Fanteclii,l’ahazei Reviewer: Ghiselhi IVersion: 3 Comment :

Status: drall -

2 AlephNct Dale: 28-8-86 Dale :

Fig. 10. ERdiagramfor the NewAleph Directory.

Wsescu I Environment CehlArray CAD~

~ WrdWin

Ws

PolyLine

Draw Primitive is

PolyMarker~.~.~ MPoint

Segment

FillArea FPoint

GulP

I Version: 2.0 I P.Palazzi

I Authors: M.ltoano I Reviewers: S.M.FisherStatus: IPICTURE Date: 27 Nov 1986 I Date: 3 Dec 1986

Fig. 11. The‘picture’ subschemaof GKS.

Page 14: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

296 Z Qian etaL / ADAMOwithin ALEPH

lxi I’ro

FNau.le I

4 C.lls~ CallQ DoliSi

~ BnkPro Procedure c~u~~7

NumWord ~I°~ ~

TabPro ComPro Parameter ParDim~UseFlg ~ :‘ IlOII1huhl ~

Table COMMN ComVar ComDim

~ I~‘~~slon [iii ~

t•~

Anal P Authors: j. Bunn Reviewers: S. M. Fisheryse rograms Version: 1.03 Comment:

Status: Draltrogram uescrlp ion I)ale: 6-Oct-1986 Dale:

Fig. 12. ERdiagram of a FORTRANprogram.

5.4. Experimentdirectory ADAMOtools of the commands(SQL) to createthe tables and indices in ORACLE.

Information exchange is of the utmost impor- The interactiveupdatesandqueriesarecarriedtancein a largecollaboration.The ALEPH secre- outvia full screenforms providedby theORACLEtariat takescareof mailing papersand technical support tools. The TOR is used to copy datanotes,bothwithin CERN and to outsideinstitutes. concerningcomputers,members,logins,networksThe information useful to reach people at CERN, and mail servers from the ORACLEdatabase to aat their Institute or at homeis madeavailable to DAF. This DAF is readby a program(installedatall groupmembersin the form of a printeddirec- ALEPH institutes where ORACLE may not betory. It contains information such as telephone available)which sendselectronicmail to ALEPHnumbers,addresses,telex andtelefaxnumbers.In membersusing the appropriatesystemsand gate-thepastyearsall thiswasmanagedwith WYLBUR ways[20].EXEC files. 55 GKS

In 1986 the New Aleph DiRectory [19] wasbuilt, to take advantageof the availability of the The GraphicalKernel System(GKS) providesORACLE RDBMS. Offering initially the same a set of low level functionsfor graphicsprogram-functionality asthe old system,it wasextendedto ming. The standard(ISO 7942) specifiesGKScover electronicmail and programupdatedistri- mostly by wordswith a very few diagramsto aidbution. The databasewas designedwith the ER understanding.The standardtook a long time tomodel (fig. 10), with automaticgenerationby the produce (1976—1986), and commercial GKS

Page 15: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

Z. Qian etaL / ADAMOwithin ALEPH 297

packageswerealso slow to appear.This enormous usethatwasmadeof VMS andthe VAXSet in thetime span results in obsolescentproducts. One developmentand maintenanceof the systemhasmust move rapidly from first specification to a beendescribedin ref. [23]. The tools all make fullworking system; for this to be possiblethespecifi- use of ADAMO and are written with the TAP.cation must be clear enough to allow wide ex- The TAP itself makesonly limited use of TAPchangeof ideasand theremustbe a simpleway to calls. It uses a memory managerbut has beenconstruct the systemfrom its specification. structuredto be well layeredsuch that the mem-

TheADAMO techniqueswereusedtogetherto ory manageris readily changeable.The systemspecify a GKS-2D system [211. For complete (including tests and documentation) containsGKS-2D only 32 Entity Setswereneeded,i.e. it is about40000 lines of sourcecodeand has,so far,inherentlya simple system, thoughat first sight, takenabout11 man-years.having 201 subroutines, GKS appears corn- Another applicationin this field is a programplicated. to analyseFORTRAN codeandproducereports

Fig. 11 show the ‘picture’ subschema.In GKS, [24]. Fig. 12 shows the ER diagram of a FOR-pictures are constructedfrom six output primi- TRAN program, which makesuse of a memorytives: polyline,polymarker,text, fill area,cell array managerandof the TAP. The input to the pro-andgeneralizeddrawingprimitive (GDP),eachof gram is generatedby a customisedversion ofwhich has associatedwith it a set of parameters, FLOP [25],which is ableto parsethe FORTRAN.for each instanceof the primitive. Primitives may The FLOP file is used to fill tablesmanagedbybegroupedtogetherinto units known assegments the TAP. Many possibilities exist for producingwhich are stored,and may be manipulatedas, a reportgeneratorswhich examinethesetables.Onesingleobject.A segmentmaycontainmanygraph- suchgeneratorhasbeenwritten to show the cal-ics primitives (it may alsobe empty). ling structureof a program. The report should

Dataflow diagramswere used to describethe correspondto thestructurechartof the program.overall system and the way in which differentclassesof subroutine calls are processed,statetransition diagramswereusedto show the states 6. Conclusionsof the systemand algorithms were simply de-scribed by means of the final code. It was a Thereis generalagreementwithin ALEPH thatstraightforwardtask to build GKS as the TAP the Entity—Relationshipmodel of ADAMO andallows the programmer to continueto think in therelatedtoolsare veryusefulin the analysisandtermsof entitiesand relationships,andso follow a designphasesof complex softwareprojects.Theysimple path from specification to code. Timing are now,togetherwith SASD, part of the softwaretestsindicate that the executionspeedof our GKS developmentstrategyof the experiment,and haveis comparablewith thefastestcommercialpackage providedtheanalyst/designerwith a solidmethod,we could find, as opposedto the heuristicapproachesusedprey-

The specifications occupied a junior pro- ously.The decisionto usethe model andthe toolsgrammer,unfamiliar with ADAMO, for about 6 requiresthat significanteffort MUST be spentatweeks.The system(whichis at level 2b exceptfor the modelling stage leading to a much clearersome inquiry and input routines) took about 4 insightinto the structureof the databeforecodingmanweeksfor the initial codingwith one partial begins. This greatly increasesthe probability ofdevice driver. The building of a GKS systemin producingthe desiredsystem. Modelling existingsuch a short time, from our ER specification, complexsystems,such asFastbusor GKS, makesshowsclearly the benefitsof the method. them easyto understand.

Experience in coding from scratch with the5.6. Softwareengineeringtools with ADAMO . . .

TAP, as well as in recoding existrng programsThe ADAMOsystem was constructed using as proves that coding and debugging time is much

far aspossibletheADAMO systemitself [22]. The shorter than with the traditional style of work.

Page 16: USE OF THE ADAMO DATA MANAGEMENT …Computer Physics Communications 45 (1987) 283—298 283 North-Holland,Amsterdam USE OF THE ADAMO DATA MANAGEMENT SYSTEM WITHIN ALEPH Z. QIAN, S.

298 Z. Qian etaL / ADAMOwithin ALEPH

The codeproducedis shorter(much shorterif it [3] E.F. Codd, 1981 Turing Award Lecture.

involves sorting), usesmeaningfulvariablenames [4] P.P.Chen,ACM Trans. on DatabaseSystems1 (1976)9.

and is therefore much more readableand main- [5] R. Brazioli, SM. Fisher, P. Palazzi and W. Zhao, Thearchitectureof the ADAMOsystem, ADAMOnote 4,tamable. The TAP routinesaccessthe datastruc- version 2.2 (November 1986).tures by copying rows of tables to and from [6] SM. Fisher, An example of the application of ADAMO

COMMON blocks, and providecheckswhich fre- methods and tools to a problem, ADAMOnote 2, version

quently catch bugsduring programdevelopment. 2.2.

An initialisation routine is produced automati- [7] T. DeMarco, Structured Analysis and SystemSpecifica-tion (YOURDON Press,1978).

cally, as are COMMON and type declaration [8] ORACLE, OracleCorporation,California,USA.

statements. In this way, the application code is as [9] G. Keilner, Comput. Phys. Commun. 45 (1987)A21.

invariant to changesin the datastructuresas it [10]MG. Green, JULIA/ECAL, cluster finding and track

can be (just recompilationand relinking is re- matching in the ALEPHreconstruction program, ADAMO

quired), and it cannot be inconsistentwith the Application Note 4.[11] The ADAMOapplication notes, ADAMOApplicationdata, nor with their description. Note 0 (Nov. 1986).

Accessing data through calls to the TAP is [12] S.M. Fisher, GALEPH/ITC, rewrite simulation of ITC

necessarily a little slower than addressing data using theADAMO/TAP, ADAMO ApplicationNote 6.

elementsby an offset in a vector, or usingFOR- [13] A. Putzer,ADDS, The Aleph Detector Description Sys-

TRAN arrays with no memory management tern,ADAMO ApplicationNote 12 (in preparation).[14] R. Brun, F. Bruyan, M. Maire, AC. Pherson and P.package.Substantialgains in speedare generally Zanarini, GEANT3 User’s Guide, CERNDD/EE/84-1obtainedby finding betteralgorithms.Sinceusing (May 1986).

ADAMO gives a betterdesign,allows fastercod- [15] SM. Fisher, GEANT (3.07)Volume, material andmediaing, and does not obscure the algorithm in intri- data structure,ADAMO ApplicationNote1.

cate code, a faster program may be obtained for [16]T. Charity, J. Harvey and R. McClatchey,Comput.Phys.Commun.45 (1987) 433.

the sameeffort.[17] R. McClatchey, FASTBUS Initialize/Verify, ADAMO

Application Note 5.

[18] J. Harvey, S. Tang andW. Zhao,ManagePARTITIONS

Acknowledgements in theALEPH dataacquisitionsystem,ADAMO Applica-tion Note 9.

[19] F. Blin, S.M. Fisher, W.G. Moorhead,P. Palazzi and Z.Takis Kokkinias and Stratos Zevgolatakos Qian, NADIR, theNew Aleph DIRectory,ADAMO Ap-

wrote the prototypesof the ORACLE interface plication Note 10.

tools. [20] V. Emiliani, R. Fantechi, P. Palazzi and Z. Qian,

We are indebted to Sau Lan Wu, Friedrich AMSEND, autility to sendelectronicmail within ALEPH,

Dydak,Mike Metcalf, JohnThompson,Klaus Tit- ADAMO ApplicationNote 11.[21] M. Boano,R. Brazioli, S.M. Fisher, P. Palazzi andW.R.tel and Weimin Wufor their support. Zhao, Specifying and Building Graphics Systemswith

We profited much from discussionswith Got- Entity—Relationship, Dataflow and State Transition Di-tfried Kellner, Jurgen Knobloch, Jean-Francois agrarns: GKS-2D, submitted to Eurographics ‘87.

RenardyandHenri Videau. [22] R. Brazioli, SM. Fisher, P. Palazzi and W. Zhao, UsingADAMO to designand build ADAMO, ADAMO Appli-cation Note 8 (Nov. 1986).

[23] R. Brazioli, S.M. Fisher, P. Palazziand W. Zhao, Use ofReferences VMS and the VAXSet for the ADAMO Data Manage-

ment System, 1986 DECUS SymposiumHamburg, Sep-[1] D.C. Tsichritzis and A. Kiug, The ANSI/X3/SPARC tember 1986 and DD/86/16.

DBMS framework report of thestudy group on database [24] J. Bums, PRODES,a tool to analyze and describe amanagementsystems,Information Systems,vol. 3 (1978). FORTRAN program,ADAMO ApplicationNote 3.

[2] D.C. TsichritzisandF.H. Lochovsky,DataModels (Pren- [25] H. Grote, FLOP, CERN DD/US/13.tice-Hall, EnglewoodCliffs, 1982).