]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/scripts/CheckRaw.C
Last fixes before declaring (almost) success
[u/mrichter/AliRoot.git] / FMD / scripts / CheckRaw.C
1 //____________________________________________________________________
2 //
3 // $Id$
4 //
5 // Script that contains a class to compare the raw data written to the
6 // digits it's created from.
7 //
8 // Use the script `Compile.C' to compile this class using ACLic. 
9 //
10 #include <AliLog.h>
11 #include <AliFMDDigit.h>
12 #include <AliFMDInput.h>
13 #include <AliFMDUShortMap.h>
14 #include <AliFMDParameters.h>
15 #include <iostream>
16 #include <TStyle.h>
17 #include <TArrayF.h>
18 #include <TCanvas.h>
19
20 class CheckRaw : public AliFMDInput
21 {
22 public:
23   CheckRaw()
24   {
25     AddLoad(kDigits);
26     AddLoad(kRaw);
27   }
28   Bool_t Init() 
29   {
30     Bool_t ret = AliFMDInput::Init();
31     // AliFMDGeometry* geom = AliFMDGeometry::Instance();
32     // geom->Init();
33     // geom->InitTransformations();
34     AliFMDParameters* param = AliFMDParameters::Instance();
35     param->Init();
36     return ret;
37   }
38   Bool_t ProcessDigit(AliFMDDigit* digit)
39   {
40     // Cache the energy loss 
41     if (!digit) return kFALSE;
42     UShort_t det = digit->Detector();
43     Char_t   rng = digit->Ring();
44     UShort_t sec = digit->Sector();
45     UShort_t str = digit->Strip();
46     if (str > 511) {
47       AliWarning(Form("Bad strip number %d in digit", str));
48       return kTRUE;
49     }
50     fMap(det, rng, sec, str) = digit->Counts();
51     return kTRUE;
52   }
53   Bool_t ProcessRawDigit(AliFMDDigit* digit)
54   {
55     // Cache the energy loss 
56     if (!digit) return kFALSE;
57     UShort_t det = digit->Detector();
58     Char_t   rng = digit->Ring();
59     UShort_t sec = digit->Sector();
60     UShort_t str = digit->Strip();
61     if (str > 511) {
62       AliWarning(Form("Bad strip number %d in digit", str));
63       return kTRUE;
64     }
65     if (digit->Counts() != fMap(det, rng, sec, str) && 
66         fMap(det, rng, sec, str) != 1024) {
67       AliWarning(Form("Mismatch in digit FMD%d%c[%2d,%3d] %d != %d", 
68                       det, rng, sec, str, digit->Counts(), 
69                       fMap(det, rng, sec, str)));
70       return kTRUE;
71     }
72     AliDebug(1, Form("Raw digit FMD%d%c[%2d,%3D] is good", 
73                      det, rng, sec, str));
74     return kTRUE;
75   }
76 protected:
77   AliFMDUShortMap fMap;
78 };
79
80
81 //____________________________________________________________________
82 //
83 // EOF
84 //
85
86
87   
88