150 likes | 170 Views
This software provides object-oriented reconstruction for the IFR detector of the BABAR experiment, using various clustering algorithms. It allows access to cluster information and has a customizable visitor pattern for adding new functionality.
E N D
Object Oriented Reconstruction Software for the IFR Detector of BABAR Experiment Luca Lista INFN, Sezione di Napoli for the BaBar Computing Group 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 Luca Lista
mcluster pcluster 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 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:the basic planar cluster object reconstructed in a single sector. Easy geometry in local coordinates • IfrInner3DCluster:the stereo readout in the inner RPC requires a dedicated clustering to reduce ghost intersections • Ifr3DComposite:a composite pattern generalizes a cluster reconstructed in more than one sector. Quantities are computed recursively • IfrAbs3D:all cluster types implement the same abstract interface Luca Lista
Cluster Class Diagram 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 IfrClusterVisitorbase (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 Luca Lista
Example of C++ Client Code IfrAbs3D* ifr; // get a cluster from somewhere // compute number of interaction lengths in the iron double l = ifr->accept( ifrVstDouble(“interactionLengths”) ); // compute center of gravity HepPoint c = ifr->accept( ifrVstPoint(“centerOfgravity”) ); // has hits in the barrel? bool barrel = ifr->accept(ifrVstHasBool(“hasBarrel”) ); // get number of hits in each layer int n[19]; for (int layer = 1; layer <= 19; layer++) n[layer-1] = ifr->accept( ifrVstInt(“hitsInLayer”, layer) ); Luca Lista
T 1..n IfrAbs3D IfrClusterVisitor accept (IfrClusterVisitor<T>&) : T operate (const Ifr3DCluster*) : T operate (const IfrInner3DCluster*) : T operate (const Ifr3DComposite*) : T operate (const Ifr2DCluster*) : T Ifr3DComposite accept (IfrClusterVisitor<T>& v) : T IfrClusterVisitor{Hep3Vector} IfrInner3DCluster accept (IfrClusterVisitor<T>& v) : T Ifr3DCluster accept (IfrClusterVisitor<T>& v) : T 2 Ifr2DCluster accept (IfrClusterVisitor<T>& v) : T IfrVstCenterOfGravity operate (const Ifr3DCluster*) : Hep3Vector { operate (const IfrInner3DCluster*) : Hep3Vector return v.operate( this ); operate (const Ifr3DComposite*) : Hep3Vector } operate (const Ifr2DCluster*) : Hep3Vector Cluster Visitor Class Diagram Luca Lista
Package Organization and Dependencies Abstract classes Concrete implementations Luca Lista
The IFR detector model -_iterator #_parent -_component 0..1 0..1 1 1 1 1 1..* 1..* IfrDetComponent IfrDetIterator -_components 0..1 0..1 1 1 0..1 0..1 IfrDetLeaf IfrDetComposite 1 1 IfrDetector IfrSector IfrLayer IfrView IfrFec IfrSectorIterator IfrPlanarSector IfrCylindricalSector IfrLayerIterator IfrViewIterator IfrBarrelSector IfrFwdCapSector IfrBarrelView IfrInnerView IfrFecIterator IfrBwdCapSector IfrInnerSector IfrEndCapView 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 (IfrClusterizer) 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 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! Luca Lista
Particle Identification • The IFR delivers to external clients a PID summary object IfrPidInfo • inherits from a common BABAR base class (AbsPidInfo) • 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... 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 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 Luca Lista