Skip to content

Commit dcb864a

Browse files
lietavashahor02
andauthored
ctpdev (#5758)
* CTP with ID=18 added to DetID.h * CTP digitizer development * clang formatting * CTP digitizer development * clang format * CTP ID=16, upgrades shifted * straightforward ruben's comment implemented * clang format * CTP digitization dev * calng format * CTP digitizer dev: Ruben's comments implemented. * clang format * rubens suggestions - passing vectors/spans cleaned/fixed * clang format * some fixes * fullCI fixes * clang format Co-authored-by: shahoian <ruben.shahoyan@cern.ch>
1 parent 8bf1830 commit dcb864a

20 files changed

Lines changed: 512 additions & 11 deletions

File tree

DataFormats/Detectors/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ add_subdirectory(ZDC)
2121
add_subdirectory(TRD)
2222
add_subdirectory(PHOS)
2323
add_subdirectory(CPV)
24-
24+
add_subdirectory(CTP)
2525
if(ENABLE_UPGRADES)
2626
add_subdirectory(Upgrades)
2727
else()
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright CERN and copyright holders of ALICE O2. This software is distributed
2+
# under the terms of the GNU General Public License v3 (GPL Version 3), copied
3+
# 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 or
9+
# submit itself to any jurisdiction.
10+
11+
o2_add_library(DataFormatsCTP
12+
SOURCES src/Digits.cxx
13+
PUBLIC_LINK_LIBRARIES O2::CommonDataFormat
14+
O2::Headers
15+
O2::SimulationDataFormat
16+
O2::DataFormatsFT0)
17+
o2_target_root_dictionary(DataFormatsCTP
18+
HEADERS include/DataFormatsCTP/Digits.h)
19+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
11+
#ifndef _CTP_DIGITS_H_
12+
#define _CTP_DIGITS_H_
13+
#include "DetectorsCommonDataFormats/DetID.h"
14+
#include "CommonDataFormat/InteractionRecord.h"
15+
#include "DataFormatsFT0/Digit.h"
16+
#include <bitset>
17+
#include <iosfwd>
18+
19+
namespace o2
20+
{
21+
namespace ctp
22+
{
23+
static constexpr uint32_t CTP_NINPUTS = 46;
24+
static constexpr uint32_t CTP_NCLASSES = 64;
25+
static constexpr uint32_t CTP_MAXL0PERDET = 5;
26+
// Positions of CTP Detector inputs in CTPInputMask
27+
static constexpr std::pair<uint32_t, std::bitset<CTP_MAXL0PERDET>> CTP_INPUTMASK_FV0(0, 0x1f);
28+
static constexpr std::pair<uint32_t, std::bitset<CTP_MAXL0PERDET>> CTP_INPUTMASK_FT0(5, 0x1f);
29+
struct CTPDigit {
30+
o2::InteractionRecord mIntRecord;
31+
std::bitset<CTP_NINPUTS> mCTPInputMask;
32+
std::bitset<CTP_NCLASSES> mCTPClassMask;
33+
CTPDigit() = default;
34+
void printStream(std::ostream& stream) const;
35+
ClassDefNV(CTPDigit, 1);
36+
};
37+
struct CTPInputDigit {
38+
o2::InteractionRecord mIntRecord;
39+
std::bitset<CTP_MAXL0PERDET> mInputsMask;
40+
std::int32_t mDetector;
41+
CTPInputDigit() = default;
42+
CTPInputDigit(o2::InteractionRecord IntRecord, std::bitset<CTP_MAXL0PERDET> InputsMask, uint32_t DetID)
43+
{
44+
mIntRecord = IntRecord;
45+
mInputsMask = InputsMask;
46+
mDetector = DetID;
47+
}
48+
ClassDefNV(CTPInputDigit, 1)
49+
};
50+
} // namespace ctp
51+
} // namespace o2
52+
#endif //_CTP_DIGITS_H
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
11+
#ifdef __CLING__
12+
13+
#pragma link off all globals;
14+
#pragma link off all classes;
15+
#pragma link off all functions;
16+
#pragma link C++ class o2::ctp::CTPDigit + ;
17+
#pragma link C++ class vector < o2::ctp::CTPDigit> + ;
18+
#pragma link C++ class o2::ctp::CTPInputDigit + ;
19+
#pragma link C++ class vector < o2::ctp::CTPInputDigit> + ;
20+
#endif
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
11+
#include "DataFormatsCTP/Digits.h"
12+
#include <iostream>
13+
14+
using namespace o2::ctp;
15+
16+
void CTPDigit::printStream(std::ostream& stream) const
17+
{
18+
stream << "CTP Digit: BC " << mIntRecord.bc << " orbit " << mIntRecord.orbit << std::endl;
19+
stream << "Input Mask: " << mCTPInputMask << " Class Mask: " << mCTPClassMask << std::endl;
20+
}

DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,14 @@ class DetID
6868
static constexpr ID FV0 = 13;
6969
static constexpr ID FDD = 14;
7070
static constexpr ID ACO = 15;
71+
static constexpr ID CTP = 16;
7172
#ifdef ENABLE_UPGRADES
72-
static constexpr ID IT3 = 16;
73-
static constexpr ID TRK = 17;
74-
static constexpr ID FT3 = 18;
73+
static constexpr ID IT3 = 17;
74+
static constexpr ID TRK = 18;
75+
static constexpr ID FT3 = 19;
7576
static constexpr ID Last = FT3;
7677
#else
77-
static constexpr ID Last = ACO; ///< if extra detectors added, update this !!!
78+
static constexpr ID Last = CTP; ///< if extra detectors added, update this !!!
7879
#endif
7980
static constexpr ID First = ITS;
8081

@@ -135,9 +136,9 @@ class DetID
135136

136137
static constexpr const char* sDetNames[nDetectors + 1] = ///< defined detector names
137138
#ifdef ENABLE_UPGRADES
138-
{"ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "FT0", "FV0", "FDD", "ACO", "IT3", "TRK", "FT3", nullptr};
139+
{"ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "FT0", "FV0", "FDD", "ACO", "CTP", "IT3", "TRK", "FT3", nullptr};
139140
#else
140-
{"ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "FT0", "FV0", "FDD", "ACO", nullptr};
141+
{"ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "FT0", "FV0", "FDD", "ACO", "CTP", nullptr};
141142
#endif
142143
// detector names, will be defined in DataSources
143144
static constexpr std::array<mask_t, nDetectors> sMasks = ///< detectot masks
@@ -155,7 +156,8 @@ class DetID
155156
sOrigins = ///< detector data origins
156157
{o2h::gDataOriginITS, o2h::gDataOriginTPC, o2h::gDataOriginTRD, o2h::gDataOriginTOF, o2h::gDataOriginPHS,
157158
o2h::gDataOriginCPV, o2h::gDataOriginEMC, o2h::gDataOriginHMP, o2h::gDataOriginMFT, o2h::gDataOriginMCH,
158-
o2h::gDataOriginMID, o2h::gDataOriginZDC, o2h::gDataOriginFT0, o2h::gDataOriginFV0, o2h::gDataOriginFDD, o2h::gDataOriginACO
159+
o2h::gDataOriginMID, o2h::gDataOriginZDC, o2h::gDataOriginFT0, o2h::gDataOriginFV0, o2h::gDataOriginFDD,
160+
o2h::gDataOriginACO, o2h::gDataOriginCTP
159161
#ifdef ENABLE_UPGRADES
160162
,
161163
o2h::gDataOriginIT3, o2h::gDataOriginTRK, o2h::gDataOriginFT3

Detectors/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ add_subdirectory(CTF)
1414

1515
add_subdirectory(Passive) # must be first as some detector's macros use it
1616

17+
add_subdirectory(CTP)
1718
add_subdirectory(PHOS)
1819
add_subdirectory(CPV)
1920
add_subdirectory(EMCAL)

Detectors/CTP/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright CERN and copyright holders of ALICE O2. This software is distributed
2+
# under the terms of the GNU General Public License v3 (GPL Version 3), copied
3+
# 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 or
9+
# submit itself to any jurisdiction.
10+
11+
add_subdirectory(simulation)
12+
add_subdirectory(workflow)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright CERN and copyright holders of ALICE O2. This software is distributed
2+
# under the terms of the GNU General Public License v3 (GPL Version 3), copied
3+
# 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 or
9+
# submit itself to any jurisdiction.
10+
11+
o2_add_library(CTPSimulation
12+
SOURCES src/Digitizer.cxx
13+
PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::Framework
14+
O2::DataFormatsCTP
15+
O2::Headers)
16+
o2_target_root_dictionary(CTPSimulation HEADERS
17+
include/CTPSimulation/Digitizer.h)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
#ifndef ALICEO2_CTP_DIGITIZER_H
11+
#define ALICEO2_CTP_DIGITIZER_H
12+
13+
#include "CommonDataFormat/InteractionRecord.h"
14+
#include "DataFormatsCTP/Digits.h"
15+
16+
#include <gsl/span>
17+
18+
namespace o2
19+
{
20+
namespace ctp
21+
{
22+
class Digitizer
23+
{
24+
public:
25+
Digitizer() = default;
26+
~Digitizer() = default;
27+
std::vector<CTPDigit> process(const gsl::span<o2::ctp::CTPInputDigit> digits);
28+
void calculateClassMask(std::vector<const CTPInputDigit*> inputs, std::bitset<CTP_NCLASSES>& classmask);
29+
void init();
30+
31+
private:
32+
ClassDefNV(Digitizer, 1);
33+
};
34+
} // namespace ctp
35+
} // namespace o2
36+
#endif //ALICEO2_CTP_DIGITIZER_H

0 commit comments

Comments
 (0)