Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions Common/Core/CollisionTypeHelper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// or submit itself to any jurisdiction.

///
/// \file CollisionTypeHelper.h
/// \file CollisionTypeHelper.cxx
/// \author Nicolò Jacazio nicolo.jacazio@cern.ch
/// \brief Utility to handle the collision type from the GRP information
///
Expand All @@ -34,17 +34,26 @@ std::string o2::common::core::CollisionSystemType::getCollisionSystemName(collTy
return "XeXe";
case kCollSyspPb:
return "pPb";
case kCollSysOO:
return "OO";
case kCollSyspO:
return "pO";
case kCollSysNeNe:
return "NeNe";
case kCollSysUndef:
return "Undefined";
default:
LOG(warning) << "Undefined collision system type: " << collSys;
return "Undefined";
}
}

int o2::common::core::CollisionSystemType::getCollisionTypeFromGrp(o2::parameters::GRPLHCIFData* grplhcif)
{
const int ZBeamA = grplhcif->getBeamZ(o2::constants::lhc::BeamDirection::BeamA);
const int ZBeamC = grplhcif->getBeamZ(o2::constants::lhc::BeamDirection::BeamC);
LOG(debug) << "Collision system: " << ZBeamA << " * " << ZBeamC << " detected";
switch (ZBeamA * ZBeamC) {
const int zBeamA = grplhcif->getBeamZ(o2::constants::lhc::BeamDirection::BeamA);
const int zBeamC = grplhcif->getBeamZ(o2::constants::lhc::BeamDirection::BeamC);
LOG(debug) << "Collision system Z: " << zBeamA << " * " << zBeamC << " detected = " << zBeamA * zBeamC;
switch (zBeamA * zBeamC) {
case 1: // pp 1*1
return kCollSyspp;
case 6724: // Pb-Pb 82*82
Expand All @@ -53,8 +62,14 @@ int o2::common::core::CollisionSystemType::getCollisionTypeFromGrp(o2::parameter
return kCollSysXeXe;
case 82: // p-Pb 82*1
return kCollSyspPb;
case 64: // O-O 8*8
return kCollSysOO;
case 8: // p-O 8*1
return kCollSyspO;
case 100: // Ne-Ne 10*10
return kCollSysNeNe;
default:
LOG(fatal) << "Undefined collision system in getCollisionTypeFromGrp with BeamA = " << ZBeamA << " and BeamC = " << ZBeamC;
LOG(fatal) << "Undefined collision system in getCollisionTypeFromGrp with Z of BeamA = " << zBeamA << " and Z of BeamC = " << zBeamC;
return kCollSysUndef;
}
return kCollSysUndef;
Expand Down
5 changes: 4 additions & 1 deletion Common/Core/CollisionTypeHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ struct CollisionSystemType {
static constexpr collType kCollSysPbPb = 1; // PbPb
static constexpr collType kCollSysXeXe = 2; // XeXe
static constexpr collType kCollSyspPb = 3; // pPb
static constexpr collType kNCollSys = 4; // Number of collision systems
static constexpr collType kCollSysOO = 4; // OO (Oxygen-Oxygen)
static constexpr collType kCollSyspO = 5; // pO (proton-Oxygen)
static constexpr collType kCollSysNeNe = 6; // NeNe (Neon-Neon)
static constexpr collType kNCollSys = 7; // Number of collision systems

static std::string getCollisionSystemName(collType collSys);

Expand Down
30 changes: 30 additions & 0 deletions Common/Core/macros/testCollisionTypeHelper.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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.

/// \file testCollisionTypeHelper.C
/// \author Nicolò Jacazio nicolo.jacazio@cern.ch
/// \brief Test the CollisionTypeHelper functionality

#include "Common/Core/CollisionTypeHelper.h"

#include "CCDB/BasicCCDBManager.h"
#include "DataFormatsParameters/GRPLHCIFData.h"

void testCollisionTypeHelper(int runNumber = 544124)
{

auto& ccdb = o2::ccdb::BasicCCDBManager::instance();
ccdb.setURL("http://alice-ccdb.cern.ch");
o2::parameters::GRPLHCIFData* grpo = ccdb.getSpecificForRun<o2::parameters::GRPLHCIFData>("GLO/Config/GRPLHCIF",
runNumber);
grpo->print();
int collsys = o2::common::core::CollisionSystemType::getCollisionTypeFromGrp(grpo);
}
Loading