QualityControl  1.5.1
O2 Data Quality Control Framework
ITSFhrTask.h
Go to the documentation of this file.
1 // Copyright CERN and copyright holders of ALICE O2. This software is
2 // distributed under the terms of the GNU General Public License v3 (GPL
3 // Version 3), copied verbatim in the file "COPYING".
4 //
5 // See http://alice-o2.web.cern.ch/license for full licensing information.
6 //
7 // In applying this license CERN does not waive the privileges and immunities
8 // granted to it by virtue of its status as an Intergovernmental Organization
9 // or submit itself to any jurisdiction.
10 
16 
17 #ifndef QC_MODULE_ITS_ITSFHRTASK_H
18 #define QC_MODULE_ITS_ITSFHRTASK_H
19 
21 #include <ITSMFTReconstruction/ChipMappingITS.h>
22 #include <ITSMFTReconstruction/PixelData.h>
23 #include <ITSBase/GeometryTGeo.h>
24 #include <ITSMFTReconstruction/RawPixelDecoder.h>
25 
26 #include <TText.h>
27 #include <TH1.h>
28 #include <TH2.h>
29 #include <THnSparse.h>
30 
31 class TH1F;
32 class TH2;
33 
34 using namespace o2::quality_control::core;
35 using PixelReader = o2::itsmft::PixelReader;
36 
38 {
39 
42 class ITSFhrTask final : public TaskInterface
43 {
44  using ChipPixelData = o2::itsmft::ChipPixelData;
45 
46  public:
48  ITSFhrTask();
50  ~ITSFhrTask() override;
51 
52  // Definition of the methods for the template method pattern
53  void initialize(o2::framework::InitContext& ctx) override;
54  void startOfActivity(Activity& activity) override;
55  void startOfCycle() override;
56  void monitorData(o2::framework::ProcessingContext& ctx) override;
57  void endOfCycle() override;
58  void endOfActivity(Activity& activity) override;
59  void reset() override;
60 
61  private:
62  int mAverageProcessTime = 0;
63  void setAxisTitle(TH1* object, const char* xTitle, const char* yTitle);
64  void createGeneralPlots(int barrel); //create General PLots for IB/OB/ALL (1/2/3)
65  void createErrorTriggerPlots();
66  void createOccupancyPlots();
67  void setPlotsFormat();
68  void getEnableLayers();
69  void resetGeneralPlots();
70  void resetOccupancyPlots();
71  //detector information
72  static constexpr int NCols = 1024; //column number in Alpide chip
73  static constexpr int NRows = 512; //row number in Alpide chip
74  static constexpr int NLayer = 7; //layer number in ITS detector
75  static constexpr int NLayerIB = 3;
76 
77  const int NSubStave[NLayer] = { 1, 1, 1, 2, 2, 2, 2 };
78  const int NStaves[NLayer] = { 12, 16, 20, 24, 30, 42, 48 };
79  const int nHicPerStave[NLayer] = { 1, 1, 1, 8, 8, 14, 14 };
80  const int nChipsPerHic[NLayer] = { 9, 9, 9, 14, 14, 14, 14 };
81  //const int ChipBoundary[NLayer + 1] = { 0, 108, 252, 432, 3120, 6480, 14712, 24120 };
82  const int StaveBoundary[NLayer + 1] = { 0, 12, 28, 48, 72, 102, 144, 192 };
83  const int ReduceFraction = 1; //TODO: move to Config file to define this number
84 
85  std::array<bool, NLayer> mEnableLayers = { false };
86 
87  int mNThreads = 0;
88  std::vector<std::pair<int, int>> mHitPixelID[7][48][14][14]; //layer, stave, hic, chip
89  std::unordered_map<unsigned int, int> mHitPixelID_Hash[7][48][2][14][14]; //layer, stave, substave, hic, chip
90 
91  std::vector<int> mPixelHitNumber[7][48][14][14]; //hit number correspond mHitPixelID
92  o2::itsmft::RawPixelDecoder<o2::itsmft::ChipMappingITS>* mDecoder;
93  ChipPixelData* mChipDataBuffer = nullptr;
94  std::vector<ChipPixelData> mChipsBuffer;
95  int mHitNumberOfChip[7][48][2][14][14] = { { { { { 0 } } } } }; //layer, stave, substave, hic, chip
96  int mTimeFrameId = 0;
97  uint32_t mTriggerTypeCount[13] = { 0 };
98 
99  int mNError = 19;
100  int mNTrigger = 13;
101  unsigned int mErrors[19] = { 0 };
102  static constexpr int NTrigger = 13;
103  int16_t partID = 0;
104 
105  TString mTriggerType[NTrigger] = { "ORBIT", "HB", "HBr", "HC", "PHYSICS", "PP", "CAL", "SOT", "EOT", "SOC", "EOC", "TF", "INT" };
106 
107  //General plots
108  TH1F* mTFInfo; //count vs TF ID
109  TH1D* mErrorPlots;
110  TH2I* mErrorVsFeeid;
111  TH2I* mTriggerVsFeeid;
112  TH1D* mTriggerPlots;
113  //TH1D* mInfoCanvas;//TODO: default, not implemented yet
114  TH2I* mInfoCanvasComm; //tmp object decidated to ITS commissioning
115  TH2I* mInfoCanvasOBComm; //tmp object decidated to ITS Outer Barral commissioning
116 
117  TText* mTextForShifter;
118  TText* mTextForShifter2;
119 
120  //Occupancy and hit-map
121  THnSparseI* mStaveHitmap[7][48];
122  TH2I* mHitmapTmp;
123  TH2D* mChipStaveOccupancy[7];
124  TH2I* mChipStaveEventHitCheck[7];
125  TH1D* mOccupancyPlot[7];
126 
127  std::string mRunNumberPath;
128  std::string mRunNumber = "000000";
129 
130  //Geometry decoder
131  o2::its::GeometryTGeo* mGeom;
132 };
133 } // namespace o2::quality_control_modules::its
134 
135 #endif // QC_MODULE_ITS_ITSFHRTASK_H
Definition: ITSClusterTask.h:31
Skeleton of a QC task.
Definition: TaskInterface.h:53
ITS Fake-hit rate real-time data processing task Working with the chain of "Detector -> RU -> CRU -> ...
Definition: ITSFhrTask.h:42
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