-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Common] add parameters for event selection based on data quality
- definition of bits in the CCDB objects - utility class to check a collision/bc based on a given list of bits
- Loading branch information
1 parent
58f18a6
commit fb6edb6
Showing
3 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
// All rights not expressly granted are reserved. | ||
// | ||
// This software is distributed under the terms of the GNU General Public | ||
// License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
#include "QualitySelectionParams.h" | ||
|
||
namespace o2::aod::qualitysel | ||
{ | ||
} // namespace o2::aod::qualitysel | ||
|
||
using namespace o2::aod::qualitysel; | ||
|
||
QualityChecker QualitySelectionFactory::create(const std::string& label) | ||
{ | ||
if (label == "CBT") { | ||
return {kFT0Bad, kITSBad, kTPCBadTracking, kTPCBadPID}; | ||
} | ||
else if (label == "CBT_hadronPID") { | ||
return {kFT0Bad, kITSBad, kTPCBadTracking, kTPCBadPID, kTOFBad}; | ||
} | ||
else if (label == "CBT_electronPID") { | ||
return {kFT0Bad, kITSBad, kTPCBadTracking, kTPCBadPID, kTRDBad}; | ||
} | ||
else if (label == "CBT_calo") { | ||
return {kFT0Bad, kITSBad, kTPCBadTracking, kTPCBadPID, kEMCBad}; | ||
} | ||
else if (label == "CBT_muon") { | ||
return {kFT0Bad, kITSBad, kTPCBadTracking, kMCHBad, kMIDBad}; | ||
} | ||
else if (label == "CBT_muon_glo") { | ||
return {kFT0Bad, kITSBad, kTPCBadTracking, kMCHBad, kMFTBad, kMIDBad}; | ||
} | ||
|
||
return {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
// All rights not expressly granted are reserved. | ||
// | ||
// This software is distributed under the terms of the GNU General Public | ||
// License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
#ifndef COMMON_CCDB_QUALITYSELECTIONPARAMS_H_ | ||
#define COMMON_CCDB_QUALITYSELECTIONPARAMS_H_ | ||
|
||
#include <Rtypes.h> | ||
#include <TMath.h> | ||
|
||
#include <stdexcept> | ||
|
||
namespace o2::aod::qualitysel | ||
{ | ||
|
||
// Quality selection criteria | ||
enum QualitySelectionFlags { | ||
kCPVBad = 0, | ||
kEMCLimAccMCRepr, | ||
kEMCBad, | ||
kFDDBad, | ||
kFT0Bad, | ||
kFV0Bad, | ||
kHMPBad, | ||
kITSLimAccMCRepr, | ||
kITSBad, | ||
kMCHLimAccMCRepr, | ||
kMCHBad, | ||
kMFTLimAccMCRepr, | ||
kMFTBad, | ||
kMIDLimAccMCRepr, | ||
kMIDBad, | ||
kPHSBad, | ||
kTOFLimAccMCRepr, | ||
kTOFBad, | ||
kTPCLimAccMCRepr, | ||
kTPCBadTracking, | ||
kTPCBadPID, | ||
kTRDBad, | ||
kZDCBad, | ||
kNQualitySelectionFlags | ||
}; | ||
|
||
template <typename T> | ||
concept HasDetectorQuality = requires(T a, int bit) | ||
{ | ||
{ a.detectorQuality_bit(bit) } -> std::convertible_to<bool>; | ||
}; | ||
|
||
class QualityChecker | ||
{ | ||
public: | ||
QualityChecker() = default; | ||
QualityChecker(std::initializer_list<QualitySelectionFlags> bitsTocheck) : vBitsToCheck(bitsTocheck.size()) | ||
{ | ||
std::copy(bitsTocheck.begin(), bitsTocheck.end(), vBitsToCheck.begin()); | ||
} | ||
|
||
QualityChecker(const std::vector<QualitySelectionFlags> bitsTocheck) : vBitsToCheck(bitsTocheck) {} | ||
|
||
bool checkTable(const HasDetectorQuality auto& table) | ||
{ | ||
if (vBitsToCheck.empty()) { | ||
throw std::out_of_range ("QualityChecker with empty QualitySelectionFlags bits vector"); | ||
} | ||
|
||
for (auto bit : vBitsToCheck) { | ||
if (table.detectorQuality_bit(bit)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
bool operator ()(const HasDetectorQuality auto& table) | ||
{ | ||
return checkTable(table); | ||
} | ||
|
||
private: | ||
std::vector<QualitySelectionFlags> vBitsToCheck; | ||
}; | ||
|
||
} // namespace o2::aod::qualitysel | ||
|
||
class QualitySelectionFactory | ||
{ | ||
public: | ||
static o2::aod::qualitysel::QualityChecker create(const std::string& label); | ||
}; | ||
|
||
#endif // COMMON_CCDB_QUALITYSELECTIONPARAMS_H_ |