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
8 changes: 8 additions & 0 deletions Detectors/CTP/macro/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@ o2_add_test_root_macro(dumpCTPRO.C
PUBLIC_LINK_LIBRARIES O2::DataFormatsCTP
O2::CCDB
LABELS ctp)
o2_add_test_root_macro(GetAndSave.C
PUBLIC_LINK_LIBRARIES O2::DataFormatsCTP
O2::CCDB
LABELS ctp)
o2_add_test_root_macro(ReadCTPRunScalersFromFile.C
PUBLIC_LINK_LIBRARIES O2::DataFormatsCTP
O2::CCDB
LABELS ctp)
61 changes: 61 additions & 0 deletions Detectors/CTP/macro/GetAndSave.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// 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 TestCTPScalers.C
/// \brief create CTP scalers, test it and add to database
/// \author Roman Lietava
#if !defined(__CLING__) || defined(__ROOTCLING__)

#include <fairlogger/Logger.h>
#include "CCDB/CcdbApi.h"
#include "CCDB/BasicCCDBManager.h"
#include "DataFormatsCTP/Scalers.h"
#include "DataFormatsCTP/Configuration.h"
#include "TFile.h"
#include "TString.h"
#include <string>
#include <map>
#include <iostream>
#endif
using namespace o2::ctp;
void GetAndSave(std::string ccdbHost = "http://ccdb-test.cern.ch:8080")
{
std::string CCDBPathCTPScalers = "CTP/Calib/Scalers";
// std::vector<string> runs = {"518541","518543","518546","518547"};
// std::vector<long> timestamps = {1655116302316,1655118513690,1655121997478,1655123792911};
std::vector<string> runs = {"519903", "519904", "519905", "519906"};
std::vector<long> timestamps = {1656658674161, 1656660737184, 1656667772462, 1656669421115};
// std::vector<string> runs = {"518543"};
// std::vector<long> timestamps = {1655118513690};
int i = 0;
CTPRunManager mng;
// mng.setCCDBHost(ccdbHost);
auto& mgr = o2::ccdb::BasicCCDBManager::instance();
mgr.setURL(ccdbHost);
for (auto const& run : runs) {
CTPConfiguration ctpcfg;
CTPRunScalers scl;
map<string, string> metadata; // can be empty
metadata["runNumber"] = run;
CTPRunScalers* ctpscalers = mgr.getSpecific<CTPRunScalers>(CCDBPathCTPScalers, timestamps[i], metadata);
if (ctpscalers == nullptr) {
std::cout << run << " CTPRunScalers not in database, timestamp:" << timestamps[i] << std::endl;
} else {
// ctpscalers->printStream(std::cout);
std::string name = run + ".root";
TFile* myFile = TFile::Open(name.c_str(), "RECREATE");
myFile->WriteObject(ctpscalers, "CTPRunScalers");
// myFile->Write();
std::cout << run << " ok" << std::endl;
}
i++;
}
}
1 change: 1 addition & 0 deletions Detectors/CTP/macro/GetScalers.C
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/// \file TestCTPScalers.C
/// \brief create CTP scalers, test it and add to database
/// \author Roman Lietava
// root -b -q "GetScalers.C(\"519499\", 1656286373953)"
#if !defined(__CLING__) || defined(__ROOTCLING__)

#include <fairlogger/Logger.h>
Expand Down
35 changes: 35 additions & 0 deletions Detectors/CTP/macro/ReadCTPRunScalersFromFile.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// 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 TestCTPScalers.C
/// \brief create CTP scalers, test it and add to database
/// \author Roman Lietava
#if !defined(__CLING__) || defined(__ROOTCLING__)

#include <fairlogger/Logger.h>
#include "CCDB/CcdbApi.h"
#include "CCDB/BasicCCDBManager.h"
#include "DataFormatsCTP/Scalers.h"
#include "DataFormatsCTP/Configuration.h"
#include "TFile.h"
#include "TString.h"
#include <string>
#include <map>
#include <iostream>
#endif
using namespace o2::ctp;
void ReadCTPRunScalersFromFile(std::string name = "519903.root")
{
std::cout << "Reading file:" << name << std::endl;
TFile* myFile = TFile::Open(name.c_str());
CTPRunScalers* ctpscalers = myFile->Get<CTPRunScalers>("CTPRunScalers");
ctpscalers->printStream(std::cout);
}
3 changes: 3 additions & 0 deletions Detectors/CTP/reconstruction/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@

o2_add_library(CTPReconstruction
SOURCES src/CTFCoder.cxx src/CTFHelper.cxx
src/RawDataDecoder.cxx
PUBLIC_LINK_LIBRARIES O2::DataFormatsCTP
O2::DPLUtils
O2::DetectorsRaw
O2::DetectorsBase
O2::CommonDataFormat
O2::DetectorsCommonDataFormats
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// 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 RawDataDecoder.h
/// \brief Digits tw Raw translation
/// \author Roman Lietava

#ifndef ALICEO2_CTP_RAWDATADECODER_H_
#define ALICEO2_CTP_RAWDATADECODER_H_

#include <vector>
#include <map>
#include <deque>
#include "DPLUtils/DPLRawParser.h"
#include "Framework/InputRecord.h"
#include "Framework/InputRecord.h"
#include "DataFormatsCTP/Digits.h"
#include "DataFormatsCTP/LumiInfo.h"
#include "DataFormatsCTP/TriggerOffsetsParam.h"

namespace o2
{
namespace ctp
{
class RawDataDecoder
{
public:
RawDataDecoder() = default;
~RawDataDecoder() = default;
static void makeGBTWordInverse(std::vector<gbtword80_t>& diglets, gbtword80_t& GBTWord, gbtword80_t& remnant, uint32_t& size_gbt, uint32_t Npld);
int addCTPDigit(uint32_t linkCRU, uint32_t triggerOrbit, gbtword80_t& diglet, gbtword80_t& pldmask, std::map<o2::InteractionRecord, CTPDigit>& digits);
int decodeRaw(o2::framework::InputRecord& inputs, std::map<o2::InteractionRecord, CTPDigit>& digits, std::vector<LumiInfo>& lumiPointsHBF1);
void setDoLumi(bool lumi) { mDoLumi = lumi; }
void setDoDigits(bool digi) { mDoDigits = digi; }
void setVerbose(bool v) { mVerbose = v; }
uint32_t getIRRejected() const { return mIRRejected; }
uint32_t getTCRRejected() const { return mTCRRejected; }
std::vector<uint32_t>& getTFOrbits() { return mTFOrbits; }
int init();

private:
static constexpr uint32_t TF_TRIGGERTYPE_MASK = 0x800;
static constexpr uint32_t HB_TRIGGERTYPE_MASK = 0x2;
// for digits
bool mDoDigits = true;
std::vector<CTPDigit> mOutputDigits;
// for lumi
bool mDoLumi = true;
//
gbtword80_t mTVXMask = 0x4; // TVX is 3rd input
gbtword80_t mVBAMask = 0x20; // VBA is 6 th input
LumiInfo mOutputLumiInfo;
bool mVerbose = false;
uint32_t mIRRejected = 0;
uint32_t mTCRRejected = 0;
bool mPadding = true;
uint32_t mTFOrbit = 0;
std::vector<uint32_t> mTFOrbits;
};
} // namespace ctp
} // namespace o2
#endif
Loading