Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca...

15
Luca Lista Object Oriented Reconstruction Software for the IFR Detector of BABAR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing Group

description

Luca Lista Reconstruction Object Model Objects encapsulate the behavior of: – reconstruction information (strip, hit, cluster,…) – the detector model (sector, layer, …) – algorithm strategies (clusterizer, …) – etc. strip “hit” : 1D-cluster

Transcript of Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca...

Page 1: Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing.

Luca Lista

Object Oriented Reconstruction Software

for the IFR Detector of BABAR Experiment

Luca ListaINFN, Sezione di Napoli

for the BaBar Computing Group

Page 2: Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing.

Luca Lista

The Instrumented Flux Return of BABAR

• Muon and K0L detector

• Planar IFR:– 19 (18) layers of Resistive

Plate Chambers (RPC) in the barrel (endcaps)

– 65 (60) cm of iron • Inner RPC

– 2 layers of cylindrical RPC inside the coil

• The detector output consists of a digital strip pattern – charged: muon or charged hadron candidate– neutral: neutral hadron candidate

Page 3: Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing.

Luca Lista

Reconstruction Object Model

• Objects encapsulate the behavior of:– reconstruction information (strip, hit, cluster,…)– the detector model (sector, layer, …)– algorithm strategies (clusterizer, …)– etc.

stripstrip ““hit” : 1D-clusterhit” : 1D-cluster

clustercluster

clustercluster

Page 4: Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing.

Luca Lista

Cluster Object Model• The IFR is segmented into sectors

– 6 sectors in the barrel– 3 sectors in each end-cap half door (top, middle, bottom)– 4 sectors in the inner RPC

• Ifr3DCluster:Ifr3DCluster: the basic planar cluster object reconstructed in a single sector. Easy geometry in local coordinates

• IfrInner3DCluster:IfrInner3DCluster: the stereo readout in the inner RPC requires a dedicated clustering to reduce ghost intersections

• Ifr3DComposite:Ifr3DComposite: a composite pattern generalizes a cluster reconstructed in more than one sector. Quantities are computed recursively

• IfrAbs3D:IfrAbs3D: all cluster types implement the same abstract interface

Page 5: Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing.

Luca Lista

1

Ifr3DCluster IfrInner3DCluster

Ifr2DCluster

2

1

2

IfrAbs1D

2..4

1

2..4

1

1..*1 1..*1

IfrAbs3D

Ifr3DComposite

1

1..*

1

1..*

Cluster Class Diagram

Page 6: Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing.

Luca Lista

Access to cluster information

• The access to cluster information is done using a visitor pattern• Each functionality of the cluster classes is implemented in a

separate subclass of IfrClusterVisitorIfrClusterVisitor base (templated) class for all cluster types – center of gravity, number of interaction lengths,

number of strips/hits, first, last layer hit,, etc.• Adding new functionality does not require any change to the

class interfaces– a new visitor subclass has to be implemented

• Cache mechanism provided using a proxy pattern– cache is invalidated if a cluster changes

• Visitors instances are organized in an hash table to be fetched by a string key

Page 7: Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing.

Luca Lista

Example of C++ Client Code

IfrAbs3D* ifr; // get a cluster from somewhere

// compute number of interaction lengths in the irondouble l = ifr->accept( ifrVstDouble(“interactionLengths”) );

// compute center of gravityHepPoint c = ifr->accept( ifrVstPoint(“centerOfgravity”) );

// has hits in the barrel?bool barrel = ifr->accept(ifrVstHasBool(“hasBarrel”) ); // get number of hits in each layerint n[19];for (int layer = 1; layer <= 19; layer++) n[layer-1] = ifr->accept( ifrVstInt(“hitsInLayer”, layer) );

Page 8: Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing.

Luca Lista

Cluster Visitor Class Diagram

Ifr3DClusteraccept (IfrClusterVisitor<T>& v) : T

Ifr2DClusteraccept (IfrClusterVisitor<T>& v) : T

IfrAbs3Daccept (IfrClusterVisitor<T>&) : T

Ifr3DCompositeaccept (IfrClusterVisitor<T>& v) : T

T

IfrClusterVisitoroperate (const Ifr3DCluster*) : Toperate (const IfrInner3DCluster*) : Toperate (const Ifr3DComposite*) : Toperate (const Ifr2DCluster*) : T

IfrInner3DClusteraccept (IfrClusterVisitor<T>& v) : T

{ return v.operate( this );}

1..n

IfrVstCenterOfGravityoperate (const Ifr3DCluster*) : Hep3Vectoroperate (const IfrInner3DCluster*) : Hep3Vectoroperate (const Ifr3DComposite*) : Hep3Vectoroperate (const Ifr2DCluster*) : Hep3Vector

IfrClusterVisitor{Hep3Vector}

2

Page 9: Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing.

Luca Lista

Package Organization and Dependencies

IfrVisitors

IfrData

IfrDataImp

External Clients

IfrClusterVisitor

IfrVstCenterOfGravityIfr3DCluster

IfrVst ...IfrInner3DCluster

Ifr2DCluster

IfrAbs3D

Ifr3DComposite

Abstract classes

Concrete implementations

Page 10: Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing.

Luca Lista

The IFR detector model

IfrBarrelSector

IfrPlanarSector

IfrBarrelView

IfrView

IfrBwdCapSector

IfrCylindricalSector

IfrDetLeaf

IfrEndCapView

IfrFecIteratorIfrFwdCapSector

IfrInnerSector

IfrInnerView

IfrLayer

IfrLayerIterator

IfrSectorIterator

IfrViewIterator

-_components

1..*

1

IfrDetComposite

1

#_parent

0..1-_component

0..1 1

1

IfrDetIterator

1

0..1

-_iterator

0..1

IfrSector IfrFecIfrDetector

IfrDetComponent10..1

0..1 1

1..*

1

IfrGeomBase

IfrGeom

Page 11: Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing.

Luca Lista

Cluster Reconstruction• Clustering algorithms are implemented as modules of the

BABAR Framework• Charged clustering

– tracks are extrapolated in the non uniform B field– hits closer distant less than a given cut to the expect track

intersections with the RPC are clustered together– a specific object (IfrClusterizerIfrClusterizer) returns the appropriate cluster

object from a list of hits, independently on the algorithm• Neutral clustering

– hits unassociated to charged tracks undergoan IFR-alone clustering algorithm based on the hit distances in measured projection (“blob”)

• All clustering modules have a common steering part (iterating over sectors, etc.) that is abstracted in a strategy pattern

Page 12: Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing.

Luca Lista

Evolution of Cluster Reconstruction

• The current IFR-alone “blob” clustering algorithm was used for charged clustering – the track extrapolation tools (“Swimmer”) were not

available at the beginning• The migration to the new clustering algorithm

required no change to the cluster classes– no client code change was induced – the design and implementation of the new

clustering algorithm took much less time than scheduled!

Page 13: Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing.

Luca Lista

Particle Identification

• The IFR delivers to external clients a PID summary object IfrPidInfoIfrPidInfo– inherits from a common BABAR base class (AbsPidInfoAbsPidInfo) – implements the interface to handle significance levels

and likelihood for different particle hypotheses• PID likelihoods are extracted on the basis of discriminating

variables that are computed using the visitors• Calibration information are stored persistently

– Implemented using Rogue Wave Tools.h++– Objectivity under development– A flexible persistence design permits to change easily technology

see poster session...

Page 14: Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing.

Luca Lista

Experience with software development

• Inflexible design was spotted when problems repeatedly occurred in the same code areas introducing changes

• Applying a more flexible design has usually improved the software management– more effective development– problems isolation

• A concrete example: computation of number of interaction lengths:– Abstract base class for cluster curve approximation– Path length in the detector model computation has been tested

using a straight line implementation of the curve approximation– Polynomial approximation from a fit in each view was implemented

separately– The integration of the two pieces has been immediately successful

Page 15: Luca Lista Object Oriented Reconstruction Software for the IFR Detector of B A B AR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing.

Luca Lista

Conclusions

• Object Oriented technology and Design Patterns have been applied to the IFR reconstruction software

• This showed benefits in:– Improving code flexibility and robustness– More effective software development– Reducing dependencies and decreasing the

number of changes induced during the software evolution