]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/doc/QA.tex
Update from satyajit: HM Analysis
[u/mrichter/AliRoot.git] / EMCAL / doc / QA.tex
CommitLineData
a59caf82 1\section{Run by run QA, how to and code}
2\subsection{Online - Francesco, Michael}
3
4\subsubsection{Creation and checking of online QA histograms (AMORE)}
5The QA histograms for the EMCal are created and filled by the class:\\
6\texttt{\$ALICE\_ROOT/EMCAL/AliEMCALQADataMakerRec}\\
7It is run both during the offline reconstruction and by the online data quality monitoring framework. Its main methods are:\\
8
9\texttt{InitRaws()}:
10All the QA histograms are created here. Their titles should be self-explaining. Each of them has 2 important flags:\\
11\texttt{expert} - if true, the histogram is shipped only to the AMORE expert agent (run in the EMCal station), otherwise it is also shipped to the AMORE shifter agent (at the moment we have 4 histograms monitored by the DQM shifter).\\
12\texttt{image} - if true, the plots is saved to the loogbok (there should be 9 plots in the logbook).\\
13Each of those histograms is replicated 4 times by the amore framework and filled according to the event species (Calib, Cosmic, LowMultiplicity, HighMultiplicity).\\
14
15\texttt{MakeRaws(AliRawReader* rawReader)}:
16Here we loop over the input raw data stream and we fill the histograms.\\
17
18\texttt{MakeRawsSTU(AliRawReader* rawReader)}:
19STU raw data decoding, provided EMCal trigger experts.\\
20
21\texttt{GetCalibRefFromOCDB()}:
22Get the reference histograms from the OCDB. The ratio between histograms from current run and the reference run is calculated in the \texttt{MakeRaws} method.\\
23
24
25The QA histograms are then analyzed by the class:\\
26\texttt{\$ALICE\_ROOT/EMCAL/AliEMCALQAChecker}\\
27It checks the data contained in the 4 non-expert histograms. They are at the moment:
28\begin{enumerate}
29\item Ratio distribution of towers' amplitude in the current run w.r.t. the reference run.
30\item Number of hits of L1 Gamma patch.
31\item Number of hits of L1 Jet patch.
32\item Number of links between TRU and STU.
33\end{enumerate}
34The main method is:
35\texttt{CheckRaws()}: For the first histogram, we check how many
36channels have the ratio in the region $0.8-1.2$. If there are more than
37the threshold (default = 90\%), everything is ok, otherwise a red box with a ``call
38expert'' message is displayed. For L1 Jet/Gamma patch, we check if the
39rate of a single patch is higher than the average rate of all other
40patches times a certain threshold value (default = 0.5):
41\begin{equation}
42Rate_{patch}/Rate_{Total} > Threshold /(1 + Threshold)
43\end{equation}
44
45 If so red box with a ``hot spot - call expert'' message is
46 displayed. Finally, if there is a number (default = 1) of missing
47 STU-TRU links, another red box with a warning message is shown.
48If one wants to change the thresholds, this can be done by updating
49them in the database (type \texttt{amoreConfigFileBrowser d emc} at
50any machine at P2 and edit the file \texttt{QAThresholds.configfile} accordingly).
51
52\subsubsection{How to's for EMCal AMORE experts}
53
54\paragraph{How to run AMORE at point 2 (P2):}
55
56Some useful scripts for running AMORE at P2 are located in the \texttt{\textasciitilde/amore} directory in the aldaqacr51 machine. \texttt{StartAmore.sh} is used to run the agent and the GUI (in the expert mode). It simply launches the \texttt{configMonitor.sh} and the \texttt{checkLogs.sh} (used to check the logs of the agents). \texttt{configMonitor.sh} setup the agent and the GUI using some kdialog commands and runs them.
57Basically the agent is run by the following line in the script:\\
58\texttt{sshdqm \$agentName nohup \$scriptsPATH/startAmoreAgent.sh \$onlineMode \&}\\
59The agent is actually run on the EMCal DQM node via the sshdqm command, so this line basically is used to connect to our dqm node and run the agent there.\\
60The GUI is launched in our machine by the command:\\
61\texttt{amore -c EMC -m EMCUIQA(TRU) -g configFile.txt}\\
62The \texttt{configFile.txt} file contains just one line, i.e. \texttt{runType i}, where \texttt {i} runs from 1 to 4 (1=LowMultiplicity, 2=HighMultiplicity, 3=Cosmic, 4=Calib) and it is used to select the event specie you want to display in the GUI (this file is automatically created each time you run \texttt{configMonitor.sh}).\\
63Some other useful scripts (which are launched by \texttt{configMonitor.sh} using the sshdqm) are located in our DQM node. One can login to it by using:\\
64\texttt{ssdqm EMCQA}\\
65They are located in the \texttt{scripts} directory.\\
66\texttt{startAmoreAgent.sh} basically runs the agent, it simply issues the command:\\
67\texttt{amoreAgent -a EMCQA -s @\$1: -u}\\
68The only parameter here is \$1, which is the gdc to monitor, defined in \texttt{configMonitor.sh}.
69\texttt{killAgent.sh} kills any running agent. Be aware that there cannot be 2 running agents of the same kind at the same time (i.e. just one EMCQA and one EMCQAshifter at a time). It can happen that some time the agent does not start when you try to run it. Most of the time this is because the dqm shifter is already running the EMCQA agent instead of just the EMCQAshifter one (they can run it from the dqm station even if they shouldn't). To check if the dqm shifter is running it, simply do \texttt{ps aux | grep EMCQA} in the dmq node, and see if there is an EMCQA process belonging to the user daq. If so, kindly ask the dqm shifter to please kill it.\\
70The agent is always running using the same parameters, which are
71stored in a database. In order to change them, you should run the
72\texttt{amoreConfigFileBrowser} command in the aldaqacr51 machine. A
73window will appear, there you can browse a lot of configuration
74files. Our files are \texttt{EMCAL\_config.txt} (it contains just the
75librares to be loaded by the agent, and the event species to monitor),
76\texttt{QAdescriptions\-EMC.configfile} (it contains the descriptions
77of the histograms shipped to the dqm shifter), and
78\texttt{QAThresholds.configfile} (it contains the thresholds for the
79QA checker - see above). You can edit them by pressing the edit button.
80
81\paragraph{How to run AMORE in the test machine:}
82
83The EMCal AMORE test machine can be reached via \texttt{ssh
84 emcal@pcaldbl601}. The standard setup there is identical to the
85setup at P2. In the home directory there are some symbolic links which
86need to be changed in order to change the setup and test new
87features. \texttt{alirootLink} usually links to
88\texttt{/opt/aliroot-<some-ver>}, which is the version currently at P2
89(daq team updates the software in the \texttt{/opt} directory when
90needed). The same holds for \texttt{rootLink}, \texttt{amoreLink} and
91\texttt{amoreSiteLink} (you should not need to change
92\texttt{rootLink} and \texttt{amoreLink}). For testing some changes to
93the EMCAL QA classes, one has to compile an own version of aliroot
94with the new version of those classes, and then make a symbolic link
95to the path of this aliroot version. There is an aliroot trunk version
96which was used to be updated from time to time for tests in \texttt{fblanco/alisoft}. In the directory \texttt{myamoreStuff} there are 2 version of the AMORE modules: \texttt{current\_deploy} and \texttt{trunk} (of course you should do svn up from time to time). Let's suppose you want to make some modification to our AMORE GUI (the expert one) and test them. Remove the \texttt{amoreSiteLink} (it usually points to \texttt{/amoreSite}). Then do:\\
97\texttt{ln -s myamoreStuff/amoreSite amoreSiteLink}\\
98(or any other directory you would like to use). Then:\\
99\texttt{cd trunk[current\_deploy]/amoreEMC}\\
100At this point you can modify either the \texttt{src/ui/EMCUIQA} or \texttt{src/ui/EMCUIQATRU} class. This class contains just some manipulations of canvas/histograms to be shown in the expert panel and should be easy to understand. If there are some doubts, just ask. The first one also contains the hack we use in order to use our own reference file at P2 in used to calculate the ratio to reference (next section will explain how to create a new reference file). \texttt{make install} will install the modified libraries into \texttt{amoreSiteLink}. You can use some of the scripts in the \texttt{fblanco} directory to run the agent and the GUI.
101In order to run the expert agent with the expert GUI you should do:\\
102\texttt{amoreAgent -a EMCQA -s <some-raw-data>\footnote{If you want to create a raw data file, you should first download a chunk of raw data from alien. Then do:\\ \texttt{deroot file.root file.raw}.\\ Keep in mind that the test machine is shared with other detectors, so avoid to store a lot of raw data there and clean up the space from time to time.} -g emcal\_amore.cfg}\\
103After doing ssh to the test machine in another terminal, you do \\
104\texttt{amore -d EMC -m EMCUIQA(TRU) -g configGUI.txt}\\
105If you want to test the shifter agent, you simply do:\\
106\texttt{amoreAgent -a EMCQAshifter -s <some-raw-data> -g emcal\_amore.cfg}\\
107and type \texttt{amoreGui} in another terminal window.\\
108You can commit changes to the trunk (and not to the current\_deploy) with the usual \texttt{svn commit}. Once you feel that your changes are ready to be deployed at P2, send an email with a request to date-support.
109
110
111
112\paragraph{How to create a new reference file:}
113
114In order to create a new reference file, you have to use the \texttt{doReco.sh} script. The only thing you should do there is the path to the raw data in alien and the number of chunks to analyze (check it in the alien path).
115Remember to do \texttt{alien-token-init} and \texttt{source /tmp/gclient\_env\_\$UID} before running the script.
116After the script is executed you will have some directories (chunck10, chunk11...). Each of them contains an \texttt{EMCAL.QA.<RunNumber>.root} file. You can do :\\
117\texttt{hadd EMCAL.QA.0.root chunck10/EMCAL.QA.<RunNumber>.root \newline chunck11/EMCAL.QA.<RunNumber>.root}\\
118to merge them (the output files should always be called \texttt{EMCAL.QA.0.root}).
119At this point the output file can be already copied to the aldaqacr51 machine in the emcal station, in which we can change the QARef file whenever we want.
120In order to do that, you should copy it to your lxplus area, then from the \texttt{\textasciitilde/amore/QARef} directory in the aldaqacr51 you can do:\\
121\texttt{scp your-afs-account@aldaqgw01:/afs/cern.ch/<path-to-file>/<file> .}\\
122Do:\\
123\texttt{ln -s new-file QA.Ref.root}\\
124and add a note to the notes file in the directory.
125Then you have to create an OCDB file. In order to do that, you must do\\
126\texttt{aliroot Save2OCDB.C}\\
127Standard parameters of the macro are ``EMCAL'' (detector name), 0 (run number) and ``12'' (year). You may need to change only the last one. The macro will create a directory named \texttt{QARef/EMCAL/QA/Calib/}, and the file \texttt{Run0\_999999999\_v0\_s0.root} in it. This file has to be committed to the \texttt{QARef/EMCAL/QA/Calib/} directory of aliroot. You can check it with the \texttt{checkCDB.C} macro (it just displays a couple of histograms).
128%\subsection{}
129
130\subsubsection{Some more informations}
131Further details about AMORE can be found here:\\
132\href{https://ph-dep-aid.web.cern.ch/ph-dep-aid/amore/}{https://ph-dep-aid.web.cern.ch/ph-dep-aid/amore/}\\
133The Twiki page with the general EMCal informations for the DQM shifter is:\\
134\href{https://twiki.cern.ch/twiki/bin/viewauth/ALICE/EVEEMC}{https://twiki.cern.ch/twiki/bin/viewauth/ALICE/EVEEMC}
135The Twiki page (DQM blackboard) with temporary informations for the DQM shifter is:\\
136\href{https://twiki.cern.ch/twiki/bin/viewauth/ALICE/DQMBlackboard}{https://twiki.cern.ch/twiki/bin/viewauth/ALICE/DQMBlackboard}
137
138\subsection{Offline - Marie}
139\label{sec:QAOffline}
140
141The aim of the offline QA is to check EMCAL data quality but also to get information of the global run quality with respect to EMCAL. The offline QA is automaticclly processed for each official data reconstruction pass, it can be calibration passes, validation passes, production passes or specific early dedicated production such as the ``muoncalo'' production for calorimeters and muon detectors. The user can then analyse the outputs created during official reconstruction passes which are stored on alien. The output are in that case stored in /alice/data/year/period/pass/QAresults.root files.
142But each analyser can also add the QA task in its ianalysis in order to perform the QA of his dataset.
143
144
145The following sections describes how to run the QA task then how to analyse the ouputs run by run and how to look at EMCAL stability via some trending observables for whole periods/year.
146
147\subsubsection{Creation of offline QA histograms }
148
149The offline QA histograms for the EMCal are created and filled by the class:\\
150\texttt{\$ALICE\_ROOT/PWGGA/CaloTrackCorrelations/AliAnaCalorimeterQA}\\
151This class takes the information on AliESD/AliAOD objects and fills histograms related to EMCAL cluster or cells but also on correlation between EMCAL and the other detectors in the run.
152Its main methods are:
153\begin{itemize}
154
155\item \texttt{ MakeAnalysisFillHistograms()}: main loop where the histogram filling once the clusters and cells are loaded.
156\item \texttt{ ClusterLoopHistograms(const TObjArray $\*$ clusters, AliVCaloCells $\*$ cells)}: fill of cluster related histograms.
157\item \texttt{ CellHistograms(AliVCaloCells $\*$ cells)}: fill cells related histograms.
158\item \texttt{ Correlate()}: this methods allows to correlate clusters observables to other detector observables: tracks, VO signal, PHOS clusters.
159\item \texttt{ InvariantMassHistograms(const Int$\_$t iclus, const TLorentzVector mom, const Int$\_$t nModule,const TObjArray$\*$ caloClusters, AliVCaloCells $\*$ cells)}: fill Invariant mass histograms in cluster loop.
160\end{itemize}
161
162The way to initialize the macro is the following: \\
163\texttt{AddTaskCalorimeterQA(Bool$\_t$ kSimulation = kFALSE,const char *suffix = default, TString outputFile='' '' ,Int$\_t$ year = 2012, Bool$\_t$ kPrintSettings = kFALSE)}
164
165where
166\begin{itemize}
167
168\item kSimulation: TRUE if you want to run all the MC histograms.
169\item suffix: suffix added to $CaloQA\_$ to the name of the TDirectory and TList where the output histograms will be stored. This is important in case you want to add the task for different \textbf{AliVEvent} offline trigger type set by SelectCollisionCandidates(kTriggerMask).
170\item outputFile: this will be let to the Analysis manager to define it;
171\item year: by default to 2012 will set all the SuperModules histograms (12) even if data from previous years are analysed. (if sets to 2010 or 2011 the associated nb of SM (10 for 2011 to 2013 ; 4 for 2010)
172\item kPrintSettings: to have lots of printings.
173
174\end{itemize}
175
176An example of configuration macro for this class can be found in \\
177\texttt{\$ALICE\_ROOT/PWGGA/CaloTrackCorrelations/AliAnaCalorimeterQA/macros/\\QA/AddTaskCalorimeterQA.C}\\
178
179Lots of settings for this class can be configured via the macro
180such as the filling of MonteCarlo info, the range of the histograms, the different histogram class filling.
181
182The ingredient to be passed to the \texttt{AddTaskCalorimeterQA.C} macro are the ones of\\
183\texttt{\$ALICE\_ROOT/PWG/CaloTrackCorrBase/AliAnalysisTaskCaloTrackCorrelation.cxx}.
184
185An example of how to call it can be found in
186\texttt{\$ALICE\_ROOT/PWGGA/CaloTrackCorrelations/\\AliAnaCalorimeterQA/macros/ana.C}\\
187
188\subsubsection{Run by Run Quality Assurance}
189
190 The Run by Run Quality assurance is made by analyzing different histograms.
191A macro \\ \texttt{\$ALICE\_ROOT/PWGGA/CaloTrackCorrelations/AliAnaCalorimeterQA/macros/QA/QAplots.C} is used systematically on all the runs.
192This macro runs on the .root file generated by the\\ \texttt{\$ALICE\_ROOT/PWGGA/CaloTrackCorrelations/AliAnaCalorimeterQA/macros/ \\ QA/AddTaskCalorimeterQA.C} and looks at several histograms generated by the \texttt{AliAnaCalorimeterQA} task.
193To run this macro it is supposed that the output (.root files) of the QA task are in a directory named {\bf period/pass} where period is the period (e.g. LHC12h) and pass the reconstruction pass you are looking at. The .root files are supposed to be renamed {\bf runnumber.root} in case of production passes, validation passes or dedicated calo production passes and {\bf runnumber$\_$outer.root} or {\bf runnumber$\_$barrel.root} in case of cpass (calibration pass). In the calibration pass case, the Minimum Bias triggers are reconstructed within the $\_$barrel.root extansion and the specific triggers (muon, EMCAL, ...) are reconstructed with the $\_$outer.root extension. The QA task is called twice at the end of reconstruction to separate both kind of triggers.
194
195To run the macro you must have in the period/pass repository a text file called ``runlist.txt containing the list of run you whant to plot, the runlist.txt beeing of the type:\\
1961 ~~~~~run1\\
1972 ~~~~~run2\\
198.....\\
199The output plots are saved automatically in repository period/pass/runnumber so that you should create those repository prior to running the macro.\\
200
201
202
203The arguments to pass to the macro:
204\texttt{ QAplots(TString fCalorimeter = "EMCAL", TString period = "LHC11h", TString pass = "pass", TString fTrigger= "default", TString system = "PbPb")} are the following:
205\begin{itemize}
206\item TString fCalorimeter : name of the calorimeter: "EMCAL".
207\item TString period: path(name) of the repository for the period.
208\item TString pass: name of the repository where you saved the .root files (in the example period/pass).
209\item TString fTtrigger type: "default" for the minbias; "trigEMC" or "EMC7" for EMCAL triggers. This corresponds to the TString suffix of the AddTaskCalorimeterQA() when initializing the task.
210\item TString system: "PbPb" or "pp": a flag for setting/adjusting scales for some drawings to the multiplicities/energies reached in the system.
211\end{itemize}
212
213
214For typical automatic QA of official reconstruction passes the histograms we check automatically with runnning of the QAplots.C macro are the following: but the user can add as much histograms verifications as he wants.
215\begin{itemize}
216\item Occupancy map: $\eta$ $\phi$ distributions of cells with signsl (in row/col units).
217\item Summed energy map: $\eta$ $\phi$ distribution of mean energy/event (in row/col units).
218\item Time vs E of custers: Time vs Energy of clusters.
219\item EMCAL Cluster versus track correlation (multiplicities/energies).
220\item EMCAL Clusters vs VO signal correlation.
221\item EMCAL vs PHOS clusters correlations.
222\end{itemize}
223
224On top of those default settings and checks, the user can add as much histograms checks as he wants.
225
226\subsubsection{Period Quality Assurance and stability of EMCAL}
227
228The stability of EMCAL is checked also systematically at the end of each reconstruction passes (calibration pass, validation pass, production pass).
229This step is done via a set of macros called ``trending'' macros which can be found in \texttt{\$ALICE\_ROOT/PWGGA/CaloTrackCorrelations/\\ AliAnaCalorimeterQA/macros/QA/}. The goal of these two macros (trendingClusters.C and trendingPi0.C) is to look at averages observables concerning clusters and $\pi^0$ respectively, as a function of runnumber.
230Those macros uses the output of .root file generated by the\\ \texttt{\$ALICE\_ROOT/PWGGA/CaloTrackCorrelations/AliAnaCalorimeterQA/macros/ \\ QA/AddTaskCalorimeterQA.C}.
231It requires the same repository, naming conventions as in the previous section: period/pass/runnumber.root files and a runlist.txt file containing the list of runs to check. It can be run depending on the ``fTrigger" option EMCAL triggered events and on the MinBias events.
232
233{\bf Cluster Averages: (trendingCluster.C):}
234
235This macro computes some averages over histograms and store them in a TGraph as a fuction of runnumber.
236The folling histograms are used:
237\begin{itemize}
238\item EMCAL\_hE: cluster energy distribution in EMCAL.
239\item EMCAL\_hNClusters\_Mod\_xx: 2D histogram with number of cluster per supermodule.
240\item EMCAL\_hNCellsPerCluster\_Mod\_xx: 2D histogram with number of cells per supermodule.
241\item EMCAL\_hE\_Mod\_xx: 2D histogram with Cluster Energy per supermodule.
242\end{itemize}
243
244
245and the following averages are computed and displayed as a funcion of runnumber:
246
247\begin{itemize}
248\item Mean number of clusters per event is computed over EMCAL and also per supermodule. An example is displayed on figure \ref{fig:trendingCluster} for LHC12i period.
249\item Average energy of clusters (with given threshold energies) per event is computed over EMCAL and also per supermodule.
250\item Number of cells of clusters (with given threshold energies)per event is computed over EMCAL and also per supermodule.
251\end{itemize}
252
253
254\begin{figure}[ht]
255\begin{center}
256\includegraphics[width=0.9\textwidth]{figures/trendingClusterLHC12iMB.pdf}
257\end{center}
258\caption{\label{fig:trendingCluster}
259Example of trending plot for period LHC12i: mean number of cluster per event as a function of runnumber for MinBias events.}
260\end{figure}
261
262
263
264{\bf $\pi^0$ Averages: (trendingPi0.C):}
265
266This macro computes some fits over invariant mass histograms and store the fit parameters and $\pi^0$ computed values in a TGraph as a funcion of runnumber. The following histograms are used:
267\begin{itemize}
268\item EMCAL\_hIM: Invariant mass histogram filled over the whole cluster pairs.
269\item EMCAL$\_$hIM$\_$Mod$\_$xx: Invariant mass histogram filled over the cluster pairs in the same supermodule.
270\end{itemize}
271
272The fit is done by a gaussian plus a 2$^{nd}$ order polinom for background. This is a very ``raw'' fitting wich may not be appropriate especially for the PbPb cases but allows to check the stabilities of averages (mass, width, number of $\pi^O$).
273
274
275
276\begin{itemize}
277\item Mean number of $\pi^0$ per event is computed over EMCAL and also per supermodule.
278\item Mass of the $\pi^0$ per event is computed over EMCAL and also per supermodule.
279\item Witdh of the $\pi^0$ per event is computed over EMCAL and also per supermodule.
280\end{itemize}
281
282
283
284The use of these set of QA macros allows to identify problematic runs (subperiod with missing part of detectors) or more general features. Also it can be used to check global observables for different dataset used for analysis purpose.
285
286
287
288\subsection{Event display}
289
02582a78 290\subsection{Logbook tips}