Evolution of cluster design in the Instrumented Flux


















- Slides: 18
Evolution of cluster design in the Instrumented Flux Return (IFR) of Ba. Bar Luca Lista INFN, Sezione di Napoli for the Ba. Bar Computing Group Luca Lista - CHEP '98
The Instrumented Flux Return of Ba. Bar • 18 -19 layers of Resistive Plate Chambers (RPC) • 2 layers of cylindrical RPC inside the coil • Digital strip readout, 2 -3 cm pitch Luca Lista - CHEP '98
Ifr basic reconstruction information • The Ifr reconstruction provides the following basic information strip 1 D cluster Luca Lista - CHEP '98 3 D cluster
Clustering in the IFR • The IFR identifies m, p and K 0 L • The reconstruction information in the IFR is made of clusters of strips which are “close” in space • Details of the pattern information give particle ID discriminating power m cluster • Estimate of the impact point provides a determination of the flight direction of the K 0 L p cluster Luca Lista - CHEP '98
2 D and 3 D Clustering • Projective geometry in the planar RPC’s ® 2 D reconstruction in each projection • 3 D association of the two projections Ifr 2 DCluster Luca Lista - CHEP '98
Early class design • The basic class structure Ifr 3 DCluster 1 2 Ifr 2 DCluster 1 1. . n Ifr 1 DCluster • The initial interface: Ifr 3 DCluster center. Of. Gravity () : Point cov. Matrix () : Bbr. Error direction (from : Point) : Vector 1 number. Of. Hits () : int number. Of. Strips () : int first. Layer () : int last. Layer () : int hit. Layers () : int 2 1 1. . n Ifr 1 DCluster number. Of. Strips( ) Luca Lista - CHEP '98 Ifr 2 DCluster number. Of. Hits () : int number. Of. Strips () : int first. Layer () : int last. Layer () : int hit. Layer () : int
Composite clusters • Cluster segments associated to the same charged track are combined together Ifr 3 DComposite Ifr 3 DCluster center. Of. Gravity () : Point cov. Matrix () : Bbr. Error direction (from : Point) : Vector number. Of. Hits () : int number. Of. Strips () : int first. Layer () : int last. Layer () : int hit. Layers () : int 1. . n Luca Lista - CHEP '98 center. Of. Gravity () : Point cov. Matrix () : Bbr. Error direction (from : Point) : Vector number. Of. Hits () : int number. Of. Strips () : int first. Layer () : int last. Layer () : int hit. Layers () : int
Polimorphic clusters • The user shouldn’t care about the detail of the cluster substructure: Ifr. Abs 3 D center. Of. Gravity () : Point cov. Matrix () : Bbr. Error direction (from : Point) : Vector number. Of. Hits () : int number. Of. Strips () : int first. Layer () : int last. Layer () : int hit. Layers () : int – just use Ifr. Abs 3 D • All clusters implement the same interface. Ifr 3 DComposite center. Of. Gravity () : Point cov. Matrix () : Bbr. Error direction (from : Point) : Vector number. Of. Hits () : int number. Of. Strips () : int first. Layer () : int last. Layer () : int hit. Layers () : int Luca Lista - CHEP '98 Ifr 3 DCluster 1. . n center. Of. Gravity () : Point cov. Matrix () : Bbr. Error direction (from : Point) : Vector number. Of. Hits () : int number. Of. Strips () : int first. Layer () : int last. Layer () : int hit. Layers () : int
Inner RPC clusters • The inner RPC readout layout changed during software evolution: – stereo readout strips • 2 D clustering is no longer appropriate • Composite clusters can’t be done of homogeneous elements Luca Lista - CHEP '98
Evolution of the cluster model • Cluster information is intrinsically complex • It is not possible to predict now all the needed functions • The extension of the class functions requires changing the base class interface • Extension to new cluster types? Luca Lista - CHEP '98 Ifr. Abs 3 D () : Ifr. Abs 3 D (a : const Ifr. Abs 3 D&) : Ifr. Abs 3 D position () : Hep. Point ~Ifr. Abs 3 D () number. Of. Digis () : int number. Of. Strips () : int cov. Matrix () : Bbr. Error pol. Cov. Matrix () : Bbr. Error $pol. Cov. Matrix ( : Bbr. Error&, : Hep. Point&) : Bbr. Error first. Layer () : int last. Layer () : int hit. Layers. I () : int hits. In. Layer (n : int) : int strips. In. Layer (n : int) : int max. Missed () : int section. Code () : Ifr: : Section. Code component ( : int = 0) : Ifr 3 DCluster* number. Of. Components () : int number. Of. Components ( : Ifr: : Sector. Code) : int number. Of. Components ( : Ifr: : Section. Code) : int get. Composite () : Ifr 3 DComposite* has. Barrel () : bool has. End. Cap () : bool has. Fwd. Cap () : bool has. Bwd. Cap () : bool has. Inner () : bool operator == ( : const Ifr. Abs 3 D&) : bool number () : unsigned int $reset. Counter () : void save. Guts ( : RWvostream&) : void restore. Guts ( : RWvistream&) : void Ifr 3 DComposite 1. . n Ifr 3 DCluster
Problems spotted during the development • The cluster class interface growth rate was more than linear with time • Code which used deep information of the cluster pattern tended to “understand” which subclass type it was using (dynamic_cast) • Dependencies on cluster subtypes rather than base class increased • Problems to effectively evolve the design Luca Lista - CHEP '98
Visitor pattern • Each function of the cluster classes is implemented in a separate class for all cluster types – all inherit from Ifr. Cluster. Visitor abstract interface • Extending the functionality does not require any change to classe interfaces – just add a new visitor class • Dependency on cluster subclasses is concentrated in the visitor classes • The design is, according to an OO principle, – open to extensions – closed to class interface changes Luca Lista - CHEP '98
1. . n Visitor pattern class diagram Ifr. Abs 3 D T Ifr. Cluster. Visitor accept (Ifr. Cluster. Visitor<T>) : T operate (const Ifr 3 DCluster*) : T operate (const Ifr. Inner 3 DCluster*) : T operate (const Ifr 3 DComposite*) : T operate (const Ifr 2 DCluster*) : T Ifr 3 DComposite accept (const Ifr. Cluster. Visitor<T>& v) : T Ifr. Cluster. Visitor{Hep 3 Vector} Ifr. Inner 3 DCluster accept (const Ifr. Cluster. Visitor<T>& v) : T Ifr 3 DCluster accept (const Ifr. Cluster. Visitor<T>& v) : T 2 Ifr 2 DCluster accept (const Ifr. Cluster. Visitor<T>& v) : T Ifr. Vst. Center. Of. Gravity operate (const Ifr 3 DCluster*) : Hep 3 Vector operate (const Ifr. Inner 3 DCluster*) : Hep 3 Vector operate (const Ifr 3 DComposite*) : Hep 3 Vector operate (const Ifr 2 DCluster*) : Hep 3 Vector { return v. operate(this); } Luca Lista - CHEP '98
Visitors features • New visitors can be added as new subclasses of Ifr. Cluster. Visitor<my. Type> with no other changes • New cluster types can be added without mayor design changes (e. g. : Ifr 3 DFast. Cluster) – but all the visitors subclasses should be updated to work on the new cluster subclass • Details can be handled internally: • – calibrations, alignments The code which uses Ifr. Abs 3 D and visitors appears to be much more robust than before – a couple of unsolved bugs have been understood and fixed during the migration Luca Lista - CHEP '98
Visitors features (cont. ) • Recursive action on Ifr 3 DComposite components matches the composite pattern – Ifr 3 DComposite has n Ifr. Abs 3 D’s • A visitor subclass handles a built-in cache mechanism implemented with a hash dictionary. – a visitor “knows” the cluster he has already “visited” – the cache is invalidated at: • destruction of every cluster for the deleted cluster • at the end of every event (to prevent the accumulation of possible memory leaks) Luca Lista - CHEP '98
Available Visitors • Visitors are singleton/multiton • Some of the available visitors are: • Ifr. Vst. Center. Of. Gravity • Ifr. Vst. Cov. Matrix • Ifr. Vst. First. Layer – first | last. Barrel • Ifr. Vst. Has. Sector – forward | backward | barrel • Ifr. Vst. Hit. Layers • Ifr. Vst. Hits. In. Layer – n = 1, . . . , 19 • Ifr. Vst. Max. Missed • Ifr. Vst. Number. Of. Strips • . . . Luca Lista - CHEP '98
Visitors Usage • How to use visitors: Ifr. Abs 3 D* ifr; // get a cluster from somewhere // compute center of gravity Hep. Point c = ifr->accept( Ifr. Vst. Center. Ofgravity: : instance() ); // has hits in the barrel? bool barrel = ifr->accept(Ifr. Vst. Has. Sector: : instance (Ifr. Vst. Has. Sector: : barrel) ); // get number of hits in each layer int n[19], i; for (i = 0; i < 19; i++) n[i] = ifr->accept( Ifr. Vst. Hits. In. Layer: : instance(i+1) ); // compute max. number of missed layers int max. Miss = ifr->accept( Ifr. Vst. Max. Missed: : instance() ); Luca Lista - CHEP '98
References • On-line Ifr documentation: – http: //www 1. na. infn. it/wsubnucl/accel/Ba. Bar/Reco/6. 7. 3/ see Ifr. Data and Ifr. Visitor packages for class diagram and C++ code • Original proposal document: – http: //www 1. na. infn. it/wsubnucl/accel/Ba. Bar/Reco/visitors. html Luca Lista - CHEP '98