Offline calibration * first strategy and examples

Chiara Zampolli
in collaboration with C. Cheshkov, A. Dainese
ALICE Offline Week Feb 2009
C. Zampolli
1
As LHC (re)start-up is approaching, the need for a clear
definition of the detector offline strategies arises
Following the late ALICE Offline weeks, calibration was
always mainly addressed to in terms of online calibration
Status of DAs
Status of DPs
Status of the preprocessor
OCDB objects
Apart from specific detector-related issues, the general
schema for online calibration within the Shuttle framework
is in place since long time, and “working smoothly since
Dec 2007”
A new – well... not so new – question is now (re)asked to the
detectors: What about offline calibration procedures?
ALICE Offline Week Feb 2009
C. Zampolli
2
From the ALICE Offline week – past and present – it looked
as if not many clear ideas are already there
Procedures may be defined, but..
...how to run them?...
...where?...
...when?...
...where to store the results?
The problem is in common between Calibration and
Alignement
A common approach/strategy should be defined
ALICE Offline Week Feb 2009
C. Zampolli
3
So far, EMCAL/PHOS, TOF, TPC, and TRD have some work
done on the offline calibration, but many details are still
missing.
TOF: offline calibration strategy first presented in the
October ‘06 ALICE Offline Week
EMCAL/PHOS: offline calibration strategy outlined recently,
presented last Monday, and also before at the February ‘09
PWG4 Meeting
ALICE Offline Week Feb 2009
C. Zampolli
4
ALICE Offline Week Feb
2009
C. Zampolli
5
On-the-Fly offline calibration redesigned wrt July Offline
week, being splitted into two steps:
TTask (post-reconstruction process):
Filling a tree:
one entry/TOF channel;
Each entry being a 1D array with the necessary information to
perform calibration;
Running at the EOR;
Writing the tree into AliEn (as reference data) → don’t need CDB
access
Job/Macro:
Chaining the trees so far created over many runs
Running the calibration process
Writing the calibration parameters on the CDB
8th October 2007
Chiara Zampolli – ALICE TOF
6
Process, loop over events:
Applying quality cuts, and retrieving essential information from
ESD tracks: ToT, measured time, expected times (π, K, p) →
filling of a 2D array [TOF channels][# expected tracks/channel
per run], as before;
Terminate:
Perform Combinatorial PID → reducing the 2D array size of a
1.7 factor (only one exp time stored), as before but added some
improvements in the encoding of the algorithm;
Filling a run-level tree, one entry/TOF channel, changed;
Storing the tree in AliEn, new.
8th October 2007
Chiara Zampolli – ALICE TOF
7
TOF Offline calib strategy
Run 0
Run 1
Chunk 0
Chunk 1
Chunk n
Chunk 0
Chunk 1
Chunk n
ESD 0
ESD 1
ESD n
ESD 0
ESD 1
ESD n
Tree 0
Tree 1
Tree 2
Tree n
Calibrator 0
Calibrator 1
Calibrator 2
Calibrator n
OCDB
Cern, July 19, 2007
OFFLINE Weekly meeting
Alberto, Jan Fiete 8
OCDB functionalities for Online/Offline Calibration:
writing/reading of TOF CDB objects, both online and offline, both for
decalibration (in MC) and calibration
Functionalities for Offline Calibration:
Summing over the run-level trees stored into AliEn
Now, creating a TTree object, copying the entries of the existing
ones (TTree::CopyEntries()):
Quite memory expensive
Allows to create the final tree also in case the run-level trees are stored
in the reference data using the CDB classes
Thinking of using a TChain object:
No memory expense
Many Log Info messages from TAlienFile
Only possible in case the run-level trees are stored in AliEn without using
the CDB classes (but this seems to be the way..)
8th October 2007
Chiara Zampolli – ALICE TOF
9
In the TOF schema:
The Task should prepare the objects needed to calculate
the offline calibration parameters...
...of which the job/macro should then be encharged
Not so bad, but who should run the Task? When exactly?
Where?
ALICE Offline Week Feb 2009
C. Zampolli
10
ALICE Offline Week Feb
2009
C. Zampolli
11
Offline Recalibration Strategy for PHOS and EMCal
Task 2547: Implementation of online calibration procedures



PHOS and EMCAL had a joint meeting on 12.02.2009 to define a strategy
for offline recalibration:
http://indico.cern.ch/conferenceDisplay.py?confId=52643
PHOS and EMCAL offline calibration requires the full available statistics
(~109 - 1010 events), therefore it can run with ESD only.
ESD produced after the first reconstruction pass should be filtered to
extract branches CaloClusters, PHOSCells, EMCALCells. Some calibration
algorithms using track matching require the Tracks ESD branch which also
should be extracted from ESD in the filtering procedure.


The AOD with selected branches obtained by ESD filtering will be used for
offline recalibration. Filtering and recalibration should be implemented as analysis
tasks.
The output of the recalibration task is a file with the corrections to the cell
amplitudes and can be stored in a private alien directory for expert use only.


The OCDB to be used for further pass reconstructions will be corrected with the
cell amplitude corrections obtained, basically multiplying the coefficients.


Should this file have an structure depending on runs like OCDB?
We have to provide to the reconstruction managers macro that automatically do this.
EMCal has already a recalibration procedure that works with the analysis
frame developed by Aleksei P. a year ago ($ALICE_ROOT/EMCAL/Calib)
Need to see how to adapt it to this recalibration strategy.
16/03/09
EMCal Status - Offline week
12/15
Offline Recalibration Strategy for PHOS and EMCal
Task 2547: Implementation of online calibration procedures

Besides creating the new OCDB object, we aim to recalibrate the ESD
created after the first reconstruction pass. For this, this first ESD should
pass through another filter, and parameters of the CaloClusters (energies,
coordinates, shower shape) should be recalculated with the use of
corrections to the cell amplitudes found by recalibration procedure.


As a result of this filtering, a new AOD will be created with better calibrated
CaloClusters. This new AOD should be used for the official physics analysis.
A possibility to create online DA is being studied. This DA can create TTree
of objects needed for recalibration. The total size of these objects
accumulated from 109 acquired pp events is estimated as a 33 Gb. These
objects in root files should be exported from DAQ or HLT network to the
outside world for an express offline analysis. As a result of this express
analysis, an OCDB needed for the first reconstruction pass can be created.

Question to core offline: is there a way to export root files produced by QA to a storage other
than OCDB?
16/03/09
EMCal Status - Offline week
13/15
A 1st Task would filter the ESDs obtained from pass1 to
create new AODs with the necessary info
A 2nd Task should run on the new AODs to get the
calibration parameters
With these calibration parameters, new AODs could be
created from the same initial ESDs, to be used for analysis
while waiting for the second pass reconstruction
Not so bad, but who should run the Task? When exactly?
Where?
ALICE Offline Week Feb 2009
C. Zampolli
14
from a discussion with C. Cheshkov and A. Dainese
Offline Calibration – as well as Alignment – could be organized as
a “calibration/alignment train” to be run immediately after the
reconstruction – in the same job, or in the same aliroot session:
Every detector providing its own wagon
Single loop over the events instead of once per detector calibration
procedure
Possibility to run over every type pf available data
Automatization of the procedure
Running on the Worker Node
Every detector wagon should produce Calibration/Alignment data
to be merged and from which to then extract the
Calibration/Alignment parameters
Merging of Calibration/Alignment data could be done over several
runs, depending on the detector’s needs
ALICE Offline Week Feb 2009
C. Zampolli
15
Chunk 0
Chunk 1
Chunk 2
Chunk 3
ESD 0
ESD 1
ESD 2
ESD 3
Calibration/Alignment train
Cal/Alig
data 0
Cal/Alig
data 1
Cal/Alig
data 2
Cal/Alig
data 3
j-th Run
i-th Run
reconstruction
Merging procedure (*)
(*) analogous to the
existing merging procedure
for ESD tags
ALICE Offline Week Feb 2009
Cal/Alig obj
run in AliEn
C. Zampolli
16
Size of Calibration/Alignment data after the merging must be small
compared to the overall ESDs size! (if possible use QA data...) 
requirement for detector, up to them to keep this under control
Calibration/Alignment data need to be processed to obtain the real
calibration parameters during a later step – macro? Job?
No automatization foreseen, at least for the beginning, since this would imply
blind processing of different runs (if summing over runs is necessary) and
storing the new Calib/Align objects in the OCDB w/ any check
Could also be done during the merging step – after a check (QA histo? ) of the
data, the storing to the OCDB might be triggered
Calibration/Alignment data will be produced with no access to the OCDB
– by definition
Can be run locally on the Worker Nodes
Need to store somewhere together with the Calib/Align objects the info about
the OCDB objs used to produce the ESDs
Calibration/Alignment strategy seems to fit both TOF & EMCAL...
Possibility to test it during next cosmics runs, but also with old cosmics
data
ALICE Offline Week Feb 2009
C. Zampolli
17
Thanks to Andrea, Cvetan, Gustavo...
ALICE Offline Week Feb 2009
C. Zampolli
18
ALICE Offline Week Feb
2009
C. Zampolli
19
Functionalities for Offline Calibration (cont’d):
Perform Calibration (as before):
Calibration the whole TOF → default
Calibrating a selected channel → debug purpose
Calibrating summing over more than one channel → in case
uniform behaviour between channels is expected
Calibrating a specific set of channels → partial TOF
configuration
Calibrating using a dedicated algorithm to produce profile
histogram → debug purpose
Still the same debugging functionalities:
possibility to store control histos both during the 2-D array
filling, and during calibration
8th October 2007
Chiara Zampolli – ALICE TOF
20
Offline
Online
0
1
2
3
4
5
Run validity
100 101 102 103 104
∞
Run 0
1
2
3
4
100
101
102
103
104
Offline
Calib
obj not valid
Reset!
Offline
Calib
Offline Calib obj valid
Offline Calib
objobj
valid
no more valid
Not valid
Run 0
1
2
3
4
Valid
Not valid
100
101
102
103
104
Cern, July 19, 2007
Valid
OFFLINE Weekly meeting
Alberto, Jan Fiete
Handled by AliTOFcalib as a const char* member, fValidity;
Validity for offline calibration objects is written as a comment
(AliCDBMetaData::SetComment()) in the MetaData of the obj;
“valid” is the key-word to activate the use of offline calibration
params during reco;
fValidity set as “valid” when AliTOFcalib::Calibrate ends
successfully (i.e. enough statistics), otherwise no new offline
calibration objs stored;
During TOF reconstruction, both online/offline calibration
objects are read: the first being always necessary to retrieve the
status of the channel, the second being used only in case
fValidity==“valid”.
8th October 2007
Chiara Zampolli – ALICE TOF
22