]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCMonitor.h
New TPC monitoring package from Stefan Kniege. The monitoring package can be started...
[u/mrichter/AliRoot.git] / TPC / AliTPCMonitor.h
1
2 #ifndef ALITPCMONITOR_H
3 #define ALITPCMONITOR_H
4
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6  * See cxx source for full Copyright notice                               */
7
8 /* $Id$ */
9
10
11 ////////////////////////////////////////////////////////////////////////
12 //
13 // AliTPCMonitor class
14 // 
15 // Main class for TPC Monitor
16 // Monitor can handle rootified data, files and online streams in DATE format.
17 // The monitor GUI is started by the macro TPCMonitor.C
18 // 
19 // Author: Stefan Kniege, IKF, Frankfurt
20 //       
21 //
22 /////////////////////////////////////////////////////////////////////////
23
24  
25 #include <stdio.h>
26 #include <fstream>
27 #include <stdlib.h>
28 #include <iostream>
29 #include <istream>
30 #include <ostream>
31 #include "TStyle.h"
32 #include "TSystem.h"
33 #include "TH2F.h"
34 #include "TLegend.h"
35 #include "TF1.h"
36 #include "TMath.h"
37 #include "TFormula.h"
38 #include <string>
39 #include "TROOT.h"
40 #include "TCanvas.h"
41 #include "TApplication.h"
42 #include "TGaxis.h"
43 #include "TPaveText.h"
44 #include "TGButtonGroup.h"
45 #include "TGButton.h"
46 #include "TGTextBuffer.h"
47 #include "TGTextEntry.h"
48 #include "TGLabel.h"
49 #include "TH3S.h"
50 #include "AliTPCMonitorMappingHandler.h"
51 #include "AliTPCMonitorDateFile.h"
52 #include "AliTPCMonitorDateFormat.h"
53 #include "AliTPCMonitorAltro.h"
54 #include "AliTPCMonitorFFT.h"
55 #include "AliTPCMonitorConfig.h"
56 #include "AliSignalProcesor.h"
57 #include "AliRawReaderRoot.h"
58 #include "AliRawReader.h"
59 #include "TGMsgBox.h"
60 #include "TNamed.h"
61 #include "TObject.h" 
62 #include "TDirectory.h"
63 #include "AliLog.h"
64 #include "RQ_OBJECT.h"
65
66 #ifdef DATEON
67 #include "AliTPCMonitorDateMonitor.h"
68 #endif
69
70
71 using namespace std;
72
73 class AliTPCMonitor : public AliTPCMonitorConfig {
74     
75  public:
76     
77     AliTPCMonitor(char* name, char* title);
78     virtual ~AliTPCMonitor();
79     
80     // stats for size of arrays and histograms /////////////////////////////////////////////////
81     Int_t**      fPad;                      // array to store channel adc in time    
82     Float_t*     fPadMapHw;                 // array to store mapping of hardware address and channel number
83     Int_t**      fPadMapRCU;                // store multiple information for hardware address for debugging purpose (read out errors occur)
84      
85         
86     // histograms to be used      ////////////////////////////////////////////////////////////////
87     TH2F*        fHistIROC;                 // histo for max adc IROC
88     TH2F*        fHistOROC;                 // histo for max adc OROC
89     TH2S*        fHistIROCIndex;            // histo for channel number in each bin IROC
90     TH2S*        fHistOROCIndex;            // histo for channel number in each bin OROC
91     TH2F*        fHistIROCTime;             // histo for peaking time in each bin IROC
92     TH2F*        fHistOROCTime;             // histo for peaking time in each bin OROC
93     TH2F*        fHistIROCClone;            // clone histo for max adc IROC (backup when selecting component)
94     TH2F*        fHistOROCClone;            // clone histo for max adc OROC (backup when selecting component)
95     TH2F*        fHistIROCRMS;              // histo for RMS IROC
96     TH2F*        fHistOROCRMS;              // histo for RMS OROC
97     TH2F*        fHistIROCBASE;             // histo for baseline IROC
98     TH2F*        fHistOROCBASE;             // histo for baseline OROC
99     TH2F*        fHistIROCSUM;              // histo for adc sum IROC
100     TH2F*        fHistOROCSUM;              // histo for adc sum OROC
101     
102     TH2F*        fHistChannelTime;          // histo for adc(channel,time)
103     TH1F*        fHistAddrMapIndex;         // histo for channel(hardware address)        
104     TH1F*        fHistAddrMaxAdc;           // histo for max-adc(hardware address)
105     TH1F*        fHistAddrBaseMean;         // histo for baseline(hardware address)
106     TH1F*        fHistAddrMaxAdcX;          // histo for max-adc-xposition(hardware address)
107     TH1F*        fHistAddrAdcSum;           // histo for adc-sum(hardware address)
108     TH1F*        fHistAddrBaseRms;          // histo for baselinr-rms(hardware address)
109   
110     TH1F*        fHistDistrSumIROC;         // distribution of adc sum for all channels IROC
111     TH1F*        fHistDistrMaxIROC;         // distribution of adc max for all channels OROC
112     TH1F*        fHistDistrSumOROC;         // distribution of adc sum for all channels OROC
113     TH1F*        fHistDistrMaxOROC;         // distribution of adc max for all channels OROC
114         
115     TH2F*        fHistDistrBase2dIROC;      // distribution of baseline vs rms for all channels IROC
116     TH2F*        fHistDistrBase2dOROC;      // distribution of baseline vs rms for all channels OROC
117     TH1D*        fHistDistrBaseRmsIROC;     // projection of fHistDistrBase2dIROC on Rms
118     TH1D*        fHistDistrBaseMeanIROC;    // projection of fHistDistrBase2dIROC on Mean
119     TH1D*        fHistDistrBaseRmsOROC;     // projection of fHistDistrBase2dOROC on Rms
120     TH1D*        fHistDistrBaseMeanOROC;    // projection of fHistDistrBase2dOROC on Mean
121
122     TH2S*        fHistGlobalMaxA;           // global histogramm for max adc of all sectors Side A
123     TH2S*        fHistGlobalMaxC;           // global histogramm for max adc of all sectors Side C
124     
125     TObjArray*   fHistList;                 // array to store all histogram 
126
127     
128     // row and pad settings 
129     Int_t        kNRowsIroc;                // number of rows in IROC
130     Int_t        kNRowsOroc;                // number of rows in OROC
131     
132     Int_t        kNPadsIroc;                // number of pads in IROC
133     Int_t        kNPadsOroc;                // number of pads in OROC
134     
135     Int_t        kNPadMinIroc;              // min for pad (y-axis) representation in 2D histogram IROC
136     Int_t        kNPadMinOroc;              // min for pad (y-axis) representation in 2D histogram OROC
137     Int_t        kNPadMaxIroc;              // max for pad (y-axis) representation in 2D histogram IROC
138     Int_t        kNPadMaxOroc;              // max for pad (y-axis) representation in 2D histogram IROC
139
140     Int_t        fVerb;                     // verbose flag
141     
142     Int_t        fLastEv;                   // flag for last event 
143     
144     Int_t        fEventNumber;              // current event number (ID)
145     Int_t        fEventNumberOld;           // previous event number
146     
147     Int_t        fDisableFit;               // flag to disable fit of maximum  peak
148     
149     Int_t        fExecGlob;                 // flag to add Executable to global histo
150     Int_t        fExecPlaneMax;             // flag to add executable for plane view ( max iroc/oroc)            
151     Int_t        fExecPadIrocRms;           // flag to add executable for rms plane view IROC
152     Int_t        fExecPadOrocRms;           // flag to add executable for rms plane view OROC
153     
154     Int_t        fRunId;                    // current run id
155     Int_t        fEqId;                     // currend equipment id
156     
157     Int_t        fPadUsedRoc;               // last ROC canvas the mouse pointed at 
158     Int_t        fPadUsedHwAddr;            // hwaddress for last pad the mouse pointed at 
159
160     Int_t        fGdcId;                    // current GDC id
161     Int_t        fLdcId;                    // current LDC id 
162     Int_t        fLdcIdOld;                 // previous LDC id
163     
164     Int_t**      fMapEqidsSec;              // mapping rcu-patch(equipmentid)
165     Int_t*       fMapEqidsRcu;              // mapping equipmentid(sector,rcu-patch)
166
167     Int_t        fMirror;                   // mirror x position on C-side
168     Int_t        fChannelIter;              // counter for channels read
169
170
171     AliTPCMonitorMappingHandler*  fMapHand;            // mapping handler   
172     
173     AliRawReaderRoot*             fReaderROOT;         // reader for ROOT format
174     AliTPCMonitorDateFile*        fReaderDATE;         // reader for DATE files
175
176     #ifdef DATEON
177     AliTPCMonitorDateMonitor*     fReaderDATEMon;      // reader for DATE monitoring
178     #endif
179     
180
181     Int_t         CheckEqId(Int_t secid, Int_t eqid);
182     TCanvas*      CreateCanvas(char* name);
183     void          CreateHistos();
184     
185     void          DeleteHistos();
186     void          DisableFit(Int_t val) { fDisableFit =val; }
187     void          DrawHists(Int_t histos);
188     void          DrawRMSMap();
189     void          DumpHeader(AliRawReaderRoot*          reader  );
190     void          DumpHeader(AliTPCMonitorDateFormat*   DateForm);
191     
192     void          ExecPad() ;
193     void          ExecRow() ;
194     Int_t         ExecProcess();
195     void          ExecTransform();
196     
197     void          FillGlobal(Int_t sector);
198     void          FillHistsDecode( AliTPCMonitorAltro* altro , Int_t rcu_patch, Int_t id=0);
199     void          FillHistsPadPlane();
200     
201     static double Gamma4(double* x, double* par);
202     Int_t         GetChannelsProc()   { return fChannelIter     ;}
203     Int_t         GetEventID()        { return fEventNumber     ;}
204     TH1*          GetHisto(char* histname);
205     Int_t         GetRCUPatch(Int_t runid, Int_t eqid);
206     
207     Int_t         GetPadAtX(Float_t xval, Int_t row, Int_t padmax);
208     Int_t         GetPadAtX(Float_t xval, Int_t row);
209     void          GetXY( double& xval , double& yval , Int_t rowmax, Int_t row , Int_t pad);
210     
211     Int_t         IsLastEvent()       { return fLastEv          ;}
212     
213     Int_t         ProcessEvent(); 
214     
215     void          SetEventID(Int_t val)     { fEventNumber =val;}
216     void          SetMirror(Int_t val)      { fMirror=val;}
217     void          SetVerbose(Int_t val)     { fVerb = val;}
218     void          SetMappingHandler(AliTPCMonitorMappingHandler* val ) { fMapHand  = val;}
219     void          ShowSel(Int_t* comp_val);
220     void          SetEqIds();
221     
222     void          ResizeCanv();
223     void          ResetHistos();
224     void          ResetArrays();
225     Int_t         ReadData(    Int_t secid);
226     
227     Int_t         ReadDataDATEFile(Int_t secid); 
228     #ifdef DATEON
229     Int_t         ReadDataDATEStream(Int_t secid); 
230     #endif
231     Int_t         ReadDataDATESubEventLoop(AliTPCMonitorDateFormat* DateForm, Int_t secid);
232     Int_t         ReadDataROOT(Int_t secid ); 
233     
234     void          WriteHistos() ;
235     void          Write10bitChannel();
236     
237
238  
239    
240     
241     
242  private:
243      
244     ClassDef(AliTPCMonitor,1); 
245 }; 
246
247 #endif