QualityControl  1.5.1
O2 Data Quality Control Framework
ITSRawTask.h
Go to the documentation of this file.
1 
9 #ifndef QC_MODULE_ITS_ITSRAWTASK_H
10 #define QC_MODULE_ITS_ITSRAWTASK_H
11 
13 
14 #include <TH2F.h>
15 #include <TPaveText.h>
16 #include <TEllipse.h>
17 #include <ITSMFTReconstruction/RawPixelReader.h>
18 #include <ITSBase/GeometryTGeo.h>
19 #include <ITSMFTReconstruction/DigitPixelReader.h>
20 
21 class TH1F;
22 
23 using namespace o2::quality_control::core;
24 
25 struct DigitEvent {
26  o2::itsmft::Digit Digits;
27  unsigned int NEvent;
28 };
29 
30 namespace o2
31 {
32 namespace quality_control_modules
33 {
34 namespace its
35 {
36 
37 class ITSRawTask : public TaskInterface // todo add back the "final" when doxygen is fixed
38 {
39 
40  using ChipPixelData = o2::itsmft::ChipPixelData;
41  using PixelReader = o2::itsmft::PixelReader;
42 
43  public:
45  ITSRawTask();
47  ~ITSRawTask() override;
48 
49  // Definition of the methods for the template method pattern
50  void initialize(o2::framework::InitContext& ctx) override;
51  void startOfActivity(Activity& activity) override;
52  void startOfCycle() override;
53  void monitorData(o2::framework::ProcessingContext& ctx) override;
54  void endOfCycle() override;
55  void endOfActivity(Activity& activity) override;
56  void reset() override;
57  void setNChips(int n)
58  {
59  mChips.resize(n);
60  mChipsOld.resize(n);
61  }
62  void ConfirmXAxis(TH1* h);
63  void ReverseYAxis(TH1* h);
64 
65  private:
66  void createHistos();
67  void createGlobalHistos();
68  // void createIBHistos(int aLayer);
69  void createLayerHistos(int aLayer);
70  void createStaveHistos(int aLayer, int aStave);
71  void createEtaPhiHitmap(int aLayer);
72  void createChipStaveOcc(int aLayer);
73  void createHicHistos(int aLayer, int aStave, int aHic);
74  void publishHistos();
75  void addMetadata(int runID, int EpID, int fileID);
76  void formatAxes(TH1* h, const char* xTitle, const char* yTitle, float xOffset = 1., float yOffset = 1.);
77  void formatPaveText(TPaveText* aPT, float aTextSize, Color_t aTextColor, short aTextAlign, const char* aText);
78  void getHicCoordinates(int aLayer, int aChip, int aCol, int aRow, int& aHicRow, int& aHicCol);
79  void getProcessStatus(int aInfoFile, int& aFileFinish);
80  void updateFile(int aRunID, int aEpID, int aFileID);
81  void resetHitmaps();
82  void resetOccupancyPlots();
83  void updateOccupancyPlots(int nEvents);
84  void addObject(TObject* aObject, bool published = true);
85  void enableLayers();
86  void formatStatistics(TH2* h);
87  void format2DZaxis(TH2* h);
88 
89  ChipPixelData* mChipData = nullptr;
90  std::vector<ChipPixelData> mChips;
91  std::vector<ChipPixelData> mChipsOld;
92  o2::itsmft::PixelReader* mReader = nullptr;
93  std::unique_ptr<o2::itsmft::DigitPixelReader> mReaderMC;
94  o2::itsmft::RawPixelReader<o2::itsmft::ChipMappingITS> mReaderRaw;
95  o2::itsmft::ChipInfo chipInfo;
96  UInt_t mCurrROF = o2::itsmft::PixelData::DummyROF;
97  int* mCurr; // pointer on the 1st row of currently processed mColumnsX
98  int* mPrev; // pointer on the 1st row of previously processed mColumnsX
99  static constexpr int NCols = 1024;
100  static constexpr int NRows = 512;
101  const int NColHis = 1024;
102  const int NRowHis = 512;
103 
104  int mSizeReduce = 4;
105 
106  const int occUpdateFrequency = 1000000;
107 
108  int mDivisionStep = 32;
109  static constexpr int NPixels = NRows * NCols;
110  static constexpr int NLayer = 7;
111  static constexpr int NLayerIB = 3;
112 
113  const int ChipBoundary[NLayer + 1] = { 0, 108, 252, 432, 3120, 6480, 14712, 24120 };
114  const int NStaves[NLayer] = { 12, 16, 20, 24, 30, 42, 48 };
115  const int nHicPerStave[NLayer] = { 1, 1, 1, 8, 8, 14, 14 };
116  const int nChipsPerHic[NLayer] = { 9, 9, 9, 14, 14, 14, 14 };
117  int mlayerEnable[NLayer] = { 0, 0, 0, 0, 0, 0, 0 };
118  const float etaCoverage[NLayer] = { 2.5, 2.3, 2.0, 1.5, 1.4, 1.4, 1.3 };
119  const double PhiMin = 0;
120  const double PhiMax = 3.284; //???
121 
122  TH1D* hErrorPlots;
123  TH1D* hFileNameInfo;
124  TH2D* hErrorFile;
125  TH1D* hInfoCanvas;
126 
127  TH1D* hOccupancyPlot[NLayer];
128  TH2I* hEtaPhiHitmap[NLayer];
129  TH2D* hChipStaveOccupancy[NLayer];
130  TH2I* hHicHitmap[7][48][14];
131  TH2I* hChipHitmap[7][48][14][14];
132  TH2I* hIBHitmap[3];
133  const std::vector<o2::itsmft::Digit>* mDigits = nullptr;
134 
135  o2::its::GeometryTGeo* gm = o2::its::GeometryTGeo::Instance();
136 
137  static constexpr int NError = 11;
138  std::array<unsigned int, NError> mErrors;
139  std::array<unsigned int, NError> mErrorPre;
140  std::array<unsigned int, NError> mErrorPerFile;
141 
142  //unsigned int Error[NError];
143  TPaveText* pt[NError];
144  TPaveText* ptFileName;
145  TPaveText* ptNFile;
146  TPaveText* ptNEvent;
147  TPaveText* bulbGreen;
148  TPaveText* bulbRed;
149  TPaveText* bulbYellow;
150 
151  std::vector<TObject*> m_objects;
152  std::vector<TObject*> m_publishedObjects;
153 
154  TString ErrorType[NError] = { "Error ID 1: ErrPageCounterDiscontinuity", "Error ID 2: ErrRDHvsGBTHPageCnt",
155  "Error ID 3: ErrMissingGBTHeader", "Error ID 4: ErrMissingGBTTrailer", "Error ID 5: ErrNonZeroPageAfterStop",
156  "Error ID 6: ErrUnstoppedLanes", "Error ID 7: ErrDataForStoppedLane", "Error ID 8: ErrNoDataForActiveLane",
157  "Error ID 9: ErrIBChipLaneMismatch", "Error ID 10: ErrCableDataHeadWrong",
158  "Error ID 11: Jump in RDH_packetCounter" };
159  const int NFiles = 24;
160  TEllipse* bulb;
161 
162  int mTotalDigits = 0;
163  int mNEvent;
164  int mNEventPre;
165  int mTotalFileDone;
166  // int FileRest;
167 
168  int mCounted;
169  int mTotalCounted = 10000;
170  int mYellowed;
171 };
172 
173 } // namespace its
174 } // namespace quality_control_modules
175 } // namespace o2
176 
177 #endif // QC_MODULE_ITS_ITSRAWTASK_H
Skeleton of a QC task.
Definition: TaskInterface.h:53
Definition: ITSRawTask.h:25
Dummy class that should be removed when there is the official one. This corresponds to a Run1/2 "run"...
Definition: Activity.h:25
These methods can be used to build a complex processing topology. It spawns 3 separate dummy processi...
Definition: Activity.h:19