EMCAL DB Use Cases

Intent of this document

Following Edouard document on EmCal DB structure, in this document we try to define some use cases of the EMCAL Database(s). The rationale behind use cases is to define functionalities we would like to see in our software. They can also be viewed as 'user requirements', and define some steps in the development of the final software (e.g. we could make some status reports saying : Use Case 1 is done, 2 is 50% done, and 3 to 5 still under developement).
From the different use cases we present here, some class diagrams are proposed.
We hope that this could help splitting work between people and/or triggers people to ask for some methods/objects to be there.

Content

The Use Cases we consider here are :

Please voice if we miss some or if we split them too much or not enough...

When preparing this document, we intended to go through all these use cases. But we soon realized that we lack some depth in the understanding of many problems involved. So we have or will asked questions about that to people who know... Also, all use cases need not to be done by us. If you know how to do something, please document it yourself for the benefit of all EmCal !


Offline : DST Production

Use Case

Typical use case for the offine is the DST production : raw data needs to go from ADC counts to GeV and ns.

[Offline Calibration for DST production Use Case]

In this simple use case, we already see two different kinds of DB "data" :

Calibration data
Ideally, this should be, for each tower, a set of four numbers a,b,c,d, so we can then calibrate a tower as : E(GeV) = a.E + b and T(ns) = c.T + d.
The computation of a,b,c,d may require to access specific part(s) of the DB, depending on how we organize things, but there should be a way of asking for a,b,c,d directly, without knowing from where they come.
Configuration data
This is at least the EMCAL-FEM combination (i.e. which FEM were connected, and to which EMCAL supermodules), so that offline is only given the active channels.

We miss something in the above use case, namely the DB entry points. For the calibration data, we for sure use the tower (absolute) number, but we also need the event number+run number+time (e.g.PHBigTimeStamp) as a way to access the DB.

Class Diagram

A class diagram corresponding to the above use case could be like that :

Offline calibration Class Diagram

In the above design, we can choose between different calibration strategies, possibly at runtime (if we use a Factory to create CalibrationStrategy objects for instance). For example, in the emcCalibTower module, the code could be :

static emcCalibrationStrategy* calib = 
             emcCalibrationStrategyFactory::GetInstance()->
             CreateCalibrationStrategy("name_of_strategy") ;

for ( i=0; i < dEmcRawData_h->nok; i++ ) {
  e_lo = calib->Calibrate(event,
                dEmcRawData[i].swkey,
                dEmcRawData[i].adclopost-dEmcRawData[i].adclopre,
                dEmcRawData[i].tdc,
                dEmcCalibTower[i].ecal,
                dEmcCalibTower[i].tof) ;
  ...
}

Please note that using such a generic interface (emcCalibrationStrategy) and factory (emcCalibrationStrategyFactory), the offline code would not have to be recompiled every time we change something in the calibration classes. Note also that a calibration strategy need not to access the DB, if it's not wanted...

A note about DB Access

The emcDatabaseAccessor in the above diagram would be a Singleton (global class) which responsabilities cover ALL accesses to the Emcal Database.
[ This class does not have to actually do all the work by itself. There's a nice Design Pattern called Facade which could be used to provide a unique interface (through emcDatabaseAccessor interface) from a bunch of related classes. ]

Also, this class must be accessible from all Emcal processes (being online or offline), that's for sure. A slightly different question is "do we need the object of this class being accessible from all Emcal processes ?". If we would like to do so, we should consider the following points :

Conclusion

The DST production does not access directly the emcDatabaseAccessor object. It only talks with one of possibly many Calibration Strategy objects. At this point of the problem analysis, the DB Accessor class should provide methods to :

We now turn to the DB structure/content. Pedestals handling is well separated from all other stuff, so I think it make sense to have a separate database (in the Objectivity vocabulary) for them. As other steps in the calibration need those pedestals, we should probably focus on this database (and the corresponding user interface) first (once we have understood what those pedestal matrices are all about, of course...).

... to be continued ...


Laurent.Aphecetche@subatech.in2p3.fr
Created: Thu Nov 4 1999
Last modified: Mon Nov 8 18:22:46 CET 1999