From 71e9dc2a41549275b5c375a38ea36bece6f170ed Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Tue, 23 Nov 2021 10:24:06 +0100 Subject: [PATCH 1/2] Make copyright headers consistent This is to prepare the code for introducing copyright header checking. One file, PWGDQ/Tasks/filterPPTiny.cxx, had CR-LF line endings, which would confuse the checker. It was converted to LF line endings to match the rest of O2Physics. --- Common/Tasks/ft0Qa.cxx | 1 - DPG/TableProducer/pidMLProducer.cxx | 9 +- EventFiltering/PWGHF/HFFilter.cxx | 9 +- EventFiltering/PWGJE/jetFilter.cxx | 1 - EventFiltering/PWGLF/strangenessFilter.cxx | 9 +- EventFiltering/PWGMM/multFilter.cxx | 5 +- PWGCF/FemtoDream/FemtoDreamDetaDphiStar.h | 9 +- PWGDQ/Tasks/filterPPTiny.cxx | 738 +++++++++--------- .../HFBPlusToD0PiCandidateSelector.cxx | 9 +- .../TableProducer/HFCandidateCreatorBPlus.cxx | 9 +- .../TableProducer/HFCandidateCreatorXicc.cxx | 9 +- .../HFLbToLcPiCandidateSelector.cxx | 9 +- .../HFXiccToPKPiPiCandidateSelector.cxx | 9 +- PWGHF/Tasks/taskXicc.cxx | 9 +- PWGMM/Tasks/dndeta.cxx | 9 +- PWGMM/Tasks/dndeta.h | 9 +- PWGMM/Tasks/run2dndeta.cxx | 9 +- 17 files changed, 437 insertions(+), 425 deletions(-) diff --git a/Common/Tasks/ft0Qa.cxx b/Common/Tasks/ft0Qa.cxx index ab54121c15b..2f46da092bd 100644 --- a/Common/Tasks/ft0Qa.cxx +++ b/Common/Tasks/ft0Qa.cxx @@ -1,4 +1,3 @@ - // 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. diff --git a/DPG/TableProducer/pidMLProducer.cxx b/DPG/TableProducer/pidMLProducer.cxx index ca4aa06ff57..cb6d5823cf2 100644 --- a/DPG/TableProducer/pidMLProducer.cxx +++ b/DPG/TableProducer/pidMLProducer.cxx @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/EventFiltering/PWGHF/HFFilter.cxx b/EventFiltering/PWGHF/HFFilter.cxx index d9a8729a832..ae8105119a1 100644 --- a/EventFiltering/PWGHF/HFFilter.cxx +++ b/EventFiltering/PWGHF/HFFilter.cxx @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/EventFiltering/PWGJE/jetFilter.cxx b/EventFiltering/PWGJE/jetFilter.cxx index 0fc2976eaaf..8ea96eb7265 100644 --- a/EventFiltering/PWGJE/jetFilter.cxx +++ b/EventFiltering/PWGJE/jetFilter.cxx @@ -1,4 +1,3 @@ - // 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. diff --git a/EventFiltering/PWGLF/strangenessFilter.cxx b/EventFiltering/PWGLF/strangenessFilter.cxx index 013724627b3..5114a8cfebe 100644 --- a/EventFiltering/PWGLF/strangenessFilter.cxx +++ b/EventFiltering/PWGLF/strangenessFilter.cxx @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/EventFiltering/PWGMM/multFilter.cxx b/EventFiltering/PWGMM/multFilter.cxx index aa515c49aff..b523acdc08b 100644 --- a/EventFiltering/PWGMM/multFilter.cxx +++ b/EventFiltering/PWGMM/multFilter.cxx @@ -1,4 +1,3 @@ - // 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. @@ -9,11 +8,13 @@ // 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. -// O2 includes +// // \file multFilter.cxx // \brief task for selection of high multiplicity events // // \author Antonio Ortiz , ICN-UNAM +// +// O2 includes #include "ReconstructionDataFormats/Track.h" #include "Framework/runDataProcessing.h" diff --git a/PWGCF/FemtoDream/FemtoDreamDetaDphiStar.h b/PWGCF/FemtoDream/FemtoDreamDetaDphiStar.h index 74e1935c4d1..12fb7e5a377 100644 --- a/PWGCF/FemtoDream/FemtoDreamDetaDphiStar.h +++ b/PWGCF/FemtoDream/FemtoDreamDetaDphiStar.h @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/PWGDQ/Tasks/filterPPTiny.cxx b/PWGDQ/Tasks/filterPPTiny.cxx index dbdc4a268af..4a53553bfa9 100644 --- a/PWGDQ/Tasks/filterPPTiny.cxx +++ b/PWGDQ/Tasks/filterPPTiny.cxx @@ -1,369 +1,369 @@ -// 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. -// -// Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no -// -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" -#include "Common/CCDB/TriggerAliases.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" -#include "PWGDQ/Core/VarManager.h" -#include "PWGDQ/Core/HistogramManager.h" -#include "PWGDQ/Core/AnalysisCut.h" -#include "PWGDQ/Core/AnalysisCompositeCut.h" -#include "PWGDQ/Core/CutsLibrary.h" -#include "PWGDQ/Core/HistogramsLibrary.h" -#include "Common/Core/PID/PIDResponse.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include -#include -#include -#include -#include -#include -#include -#include - -using std::cout; -using std::endl; - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -using namespace o2::aod; - -// Some definitions -namespace o2::aod -{ -namespace dqppfilter -{ -DECLARE_SOA_COLUMN(IsDQEventSelected, isDQEventSelected, int); -DECLARE_SOA_COLUMN(IsBarrelSelected, isBarrelSelected, uint8_t); -} // namespace dqppfilter - -DECLARE_SOA_TABLE(DQEventCuts, "AOD", "DQEVENTCUTS", dqppfilter::IsDQEventSelected); -DECLARE_SOA_TABLE(DQBarrelTrackCuts, "AOD", "DQBARRELCUTS", dqppfilter::IsBarrelSelected); -} // namespace o2::aod - -using MyEvents = soa::Join; -using MyEventsSelected = soa::Join; -using MyBarrelTracks = soa::Join; -using MyBarrelTracksSelected = soa::Join; - -constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision; -constexpr static uint32_t gkTrackFillMap = VarManager::ObjTypes::Track | VarManager::ObjTypes::TrackExtra | VarManager::ObjTypes::TrackDCA | VarManager::ObjTypes::TrackSelection | VarManager::ObjTypes::TrackCov | VarManager::ObjTypes::TrackPID; - -void DefineHistograms(HistogramManager* histMan, TString histClasses); - -struct DQEventSelectionTask { - Produces eventSel; - OutputObj fOutputList{"output"}; - HistogramManager* fHistMan; - AnalysisCompositeCut fEventCut{true}; - - float* fValues; - - Configurable fConfigCuts{"cfgEventCuts", "eventStandard", "Comma separated list of event cuts; multiple cuts are applied with a logical AND"}; - - void init(o2::framework::InitContext&) - { - fValues = new float[VarManager::kNVars]; - VarManager::SetDefaultVarNames(); - fHistMan = new HistogramManager("analysisHistos", "aa", VarManager::kNVars); - fHistMan->SetUseDefaultVariableNames(kTRUE); - fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); - - DefineHistograms(fHistMan, "Event_BeforeCuts;Event_AfterCuts;"); // define all histograms - VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill - fOutputList.setObject(fHistMan->GetMainHistogramList()); - - DefineCuts(); - } - - void DefineCuts() - { - // default cut is "eventStandard" (kINT7 and vtxZ selection) - TString cutNamesStr = fConfigCuts.value; - if (!cutNamesStr.IsNull()) { - std::unique_ptr objArray(cutNamesStr.Tokenize(",")); - for (int icut = 0; icut < objArray->GetEntries(); ++icut) { - fEventCut.AddCut(dqcuts::GetAnalysisCut(objArray->At(icut)->GetName())); - } - } - - // NOTE: Additional cuts to those specified via the Configurable may still be added - - VarManager::SetUseVars(AnalysisCut::fgUsedVars); // provide the list of required variables so that VarManager knows what to fill - } - - void process(MyEvents::iterator const& event, aod::BCs const& bcs) - { - // Reset the fValues array - VarManager::ResetValues(0, VarManager::kNEventWiseVariables, fValues); - - VarManager::FillEvent(event, fValues); - fHistMan->FillHistClass("Event_BeforeCuts", fValues); // automatically fill all the histograms in the class Event - if (fEventCut.IsSelected(fValues)) { - fHistMan->FillHistClass("Event_AfterCuts", fValues); - eventSel(1); - } else { - eventSel(0); - } - } -}; - -struct DQBarrelTrackSelectionTask { - Produces trackSel; - OutputObj fOutputList{"output"}; - HistogramManager* fHistMan; - std::vector fTrackCuts; - - float* fValues; // array to be used by the VarManager - - Configurable fConfigCuts{"cfgBarrelTrackCuts", "jpsiPID1", "Comma separated list of barrel track cuts"}; - - void init(o2::framework::InitContext&) - { - DefineCuts(); - - fValues = new float[VarManager::kNVars]; - VarManager::SetDefaultVarNames(); - fHistMan = new HistogramManager("analysisHistos", "aa", VarManager::kNVars); - fHistMan->SetUseDefaultVariableNames(kTRUE); - fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); - - TString cutNames = "TrackBarrel_BeforeCuts;"; - for (auto& cut : fTrackCuts) { - cutNames += Form("TrackBarrel_%s;", cut.GetName()); - } - - DefineHistograms(fHistMan, cutNames.Data()); // define all histograms - VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill - fOutputList.setObject(fHistMan->GetMainHistogramList()); - } - - void DefineCuts() - { - // available cuts: jpsiKineAndQuality, jpsiPID1, jpsiPID2 - TString cutNamesStr = fConfigCuts.value; - if (!cutNamesStr.IsNull()) { - std::unique_ptr objArray(cutNamesStr.Tokenize(",")); - for (int icut = 0; icut < objArray->GetEntries(); ++icut) { - fTrackCuts.push_back(*dqcuts::GetCompositeCut(objArray->At(icut)->GetName())); - } - } - - // NOTE: Additional cuts to those specified via the Configurable may still be added - - VarManager::SetUseVars(AnalysisCut::fgUsedVars); // provide the list of required variables so that VarManager knows what to fill - } - - void process(MyEvents::iterator const& event, MyBarrelTracks const& tracks, aod::BCs const& bcs) - { - uint8_t filterMap = uint8_t(0); - trackSel.reserve(tracks.size()); - - VarManager::ResetValues(0, VarManager::kNBarrelTrackVariables, fValues); - // fill event information which might be needed in histograms that combine track and event properties - VarManager::FillEvent(event, fValues); - - for (auto& track : tracks) { - filterMap = uint8_t(0); - // TODO: if a condition on the event selection is applied, the histogram output is missing - VarManager::FillTrack(track, fValues); - fHistMan->FillHistClass("TrackBarrel_BeforeCuts", fValues); - int i = 0; - for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); ++cut, ++i) { - if ((*cut).IsSelected(fValues)) { - filterMap |= (uint8_t(1) << i); - fHistMan->FillHistClass(Form("TrackBarrel_%s", (*cut).GetName()), fValues); - } - } - trackSel(filterMap); - } - } -}; - -struct DQFilterPPTaskTiny { - Produces eventFilter; - OutputObj fOutputList{"output"}; - OutputObj fStats{"stats"}; - HistogramManager* fHistMan; - std::vector fPairCuts; - - float* fValues; - - Partition posTracks = aod::track::signed1Pt > 0.0f && aod::dqppfilter::isBarrelSelected > uint8_t(0); - Partition negTracks = aod::track::signed1Pt < 0.0f && aod::dqppfilter::isBarrelSelected > uint8_t(0); - - Configurable fConfigTrackCuts{"cfgBarrelTrackCuts", "jpsiPID1", "Comma separated list of barrel track cuts"}; - Configurable fConfigPairCuts{"cfgPairCuts", "pairMassLow", "Comma separated list of pair cuts"}; - - int fNTrackCuts; - int fNPairCuts; - TObjArray* fTrkCutsNameArray; - - void DefineCuts() - { - // available pair cuts in CutsLibrary: pairNoCut,pairMassLow,pairJpsi,pairPsi2S,pairUpsilon,pairJpsiPtLow1, pairJpsiPtLow2 - TString pairCutNamesStr = fConfigPairCuts.value; - std::unique_ptr objArray(pairCutNamesStr.Tokenize(",")); - fNPairCuts = objArray->GetEntries(); - if (fNPairCuts) { - for (int icut = 0; icut < fNPairCuts; ++icut) { - fPairCuts.push_back(*dqcuts::GetCompositeCut(objArray->At(icut)->GetName())); - } - } - - // NOTE: Additional cuts to those specified via the Configurable may still be added - - VarManager::SetUseVars(AnalysisCut::fgUsedVars); // provide the list of required variables so that VarManager knows what to fill - } - - void init(o2::framework::InitContext&) - { - DefineCuts(); - - fValues = new float[VarManager::kNVars]; - - // initialize the variable manager - VarManager::SetDefaultVarNames(); - fHistMan = new HistogramManager("analysisHistos", "aa", VarManager::kNVars); - fHistMan->SetUseDefaultVariableNames(kTRUE); - fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); - - // configure histograms - TString trackCutNamesStr = fConfigTrackCuts.value; - fTrkCutsNameArray = trackCutNamesStr.Tokenize(","); - fNTrackCuts = fTrkCutsNameArray->GetEntries(); - TString histNames = ""; - for (int i = 0; i < fNTrackCuts; i++) { - histNames += Form("PairsBarrelPM_%s;", fTrkCutsNameArray->At(i)->GetName()); - } - DefineHistograms(fHistMan, histNames.Data()); // define all histograms - VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill - fOutputList.setObject(fHistMan->GetMainHistogramList()); - - // configure the stats histogram - fStats.setObject(new TH2I("stats", "stats", fNPairCuts, -0.5, -0.5 + fNPairCuts, fNTrackCuts, -0.5, -0.5 + fNTrackCuts)); - for (int i = 0; i < fNPairCuts; ++i) { - fStats->GetXaxis()->SetBinLabel(i + 1, fPairCuts[i].GetName()); - } - for (int i = 0; i < fNTrackCuts; ++i) { - fStats->GetYaxis()->SetBinLabel(i + 1, fTrkCutsNameArray->At(i)->GetName()); - } - } - - void process(MyEventsSelected::iterator const& event, MyBarrelTracksSelected const& tracks, aod::BCs const& bcs) - { - uint64_t filter = 0; - constexpr int pairType = VarManager::kJpsiToEE; - - if (event.isDQEventSelected() == 1) { - // Reset the fValues array - VarManager::ResetValues(0, VarManager::kNVars, fValues); - VarManager::FillEvent(event, fValues); - - uint8_t* pairsCount = new uint8_t[fNPairCuts * fNTrackCuts]; - for (int i = 0; i < fNPairCuts * fNTrackCuts; i++) { - pairsCount[i] = 0; - } - - uint8_t cutFilter = 0; - for (auto tpos : posTracks) { - for (auto tneg : negTracks) { // +- pairs - cutFilter = tpos.isBarrelSelected() & tneg.isBarrelSelected(); - if (!cutFilter) { // the tracks must have at least one filter bit in common to continue - continue; - } - VarManager::FillPair(tpos, tneg, fValues); // compute pair quantities - for (int i = 0; i < fNTrackCuts; ++i) { - if (!(cutFilter & (uint8_t(1) << i))) { - continue; - } - fHistMan->FillHistClass(Form("PairsBarrelPM_%s", fTrkCutsNameArray->At(i)->GetName()), fValues); - int j = 0; - for (auto cut = fPairCuts.begin(); cut != fPairCuts.end(); cut++, j++) { - if ((*cut).IsSelected(fValues)) { - pairsCount[j + i * fNPairCuts] += 1; - } - } - } - } - } - - for (int i = 0; i < fNTrackCuts; i++) { - for (int j = 0; j < fNPairCuts; j++) { - if (pairsCount[j + i * fNPairCuts] > 0) { - filter |= (uint64_t(1) << (j + i * fNPairCuts)); - fStats->Fill(j, i); - } - } - } - delete[] pairsCount; - } - eventFilter(filter); - } -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc)}; -} - -void DefineHistograms(HistogramManager* histMan, TString histClasses) -{ - // - // Define here the histograms for all the classes required in analysis. - // The histogram classes are provided in the histClasses string, separated by semicolon ";" - // NOTE: Additional histograms to those predefined in the library can be added here !! - const int kNRuns = 25; - int runs[kNRuns] = { - 285009, 285011, 285012, 285013, 285014, 285015, 285064, 285065, 285066, 285106, - 285108, 285125, 285127, 285165, 285200, 285202, 285203, 285222, 285224, 285327, - 285328, 285347, 285364, 285365, 285396}; - VarManager::SetRunNumbers(kNRuns, runs); - - std::unique_ptr objArray(histClasses.Tokenize(";")); - for (Int_t iclass = 0; iclass < objArray->GetEntries(); ++iclass) { - TString classStr = objArray->At(iclass)->GetName(); - histMan->AddHistClass(classStr.Data()); - - if (classStr.Contains("Event")) { - dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "event", "trigger,vtxPbPb"); - } - - if (classStr.Contains("Track")) { - dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "track", "its,tpcpid,dca"); - } - - if (classStr.Contains("Pairs")) { - dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "pair_barrel", "vertexing-barrel"); - } - } -} +// 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. +// +// Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no +// +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Centrality.h" +#include "Common/CCDB/TriggerAliases.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/AnalysisCut.h" +#include "PWGDQ/Core/AnalysisCompositeCut.h" +#include "PWGDQ/Core/CutsLibrary.h" +#include "PWGDQ/Core/HistogramsLibrary.h" +#include "Common/Core/PID/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include +#include +#include +#include +#include +#include +#include +#include + +using std::cout; +using std::endl; + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod; + +// Some definitions +namespace o2::aod +{ +namespace dqppfilter +{ +DECLARE_SOA_COLUMN(IsDQEventSelected, isDQEventSelected, int); +DECLARE_SOA_COLUMN(IsBarrelSelected, isBarrelSelected, uint8_t); +} // namespace dqppfilter + +DECLARE_SOA_TABLE(DQEventCuts, "AOD", "DQEVENTCUTS", dqppfilter::IsDQEventSelected); +DECLARE_SOA_TABLE(DQBarrelTrackCuts, "AOD", "DQBARRELCUTS", dqppfilter::IsBarrelSelected); +} // namespace o2::aod + +using MyEvents = soa::Join; +using MyEventsSelected = soa::Join; +using MyBarrelTracks = soa::Join; +using MyBarrelTracksSelected = soa::Join; + +constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision; +constexpr static uint32_t gkTrackFillMap = VarManager::ObjTypes::Track | VarManager::ObjTypes::TrackExtra | VarManager::ObjTypes::TrackDCA | VarManager::ObjTypes::TrackSelection | VarManager::ObjTypes::TrackCov | VarManager::ObjTypes::TrackPID; + +void DefineHistograms(HistogramManager* histMan, TString histClasses); + +struct DQEventSelectionTask { + Produces eventSel; + OutputObj fOutputList{"output"}; + HistogramManager* fHistMan; + AnalysisCompositeCut fEventCut{true}; + + float* fValues; + + Configurable fConfigCuts{"cfgEventCuts", "eventStandard", "Comma separated list of event cuts; multiple cuts are applied with a logical AND"}; + + void init(o2::framework::InitContext&) + { + fValues = new float[VarManager::kNVars]; + VarManager::SetDefaultVarNames(); + fHistMan = new HistogramManager("analysisHistos", "aa", VarManager::kNVars); + fHistMan->SetUseDefaultVariableNames(kTRUE); + fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); + + DefineHistograms(fHistMan, "Event_BeforeCuts;Event_AfterCuts;"); // define all histograms + VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill + fOutputList.setObject(fHistMan->GetMainHistogramList()); + + DefineCuts(); + } + + void DefineCuts() + { + // default cut is "eventStandard" (kINT7 and vtxZ selection) + TString cutNamesStr = fConfigCuts.value; + if (!cutNamesStr.IsNull()) { + std::unique_ptr objArray(cutNamesStr.Tokenize(",")); + for (int icut = 0; icut < objArray->GetEntries(); ++icut) { + fEventCut.AddCut(dqcuts::GetAnalysisCut(objArray->At(icut)->GetName())); + } + } + + // NOTE: Additional cuts to those specified via the Configurable may still be added + + VarManager::SetUseVars(AnalysisCut::fgUsedVars); // provide the list of required variables so that VarManager knows what to fill + } + + void process(MyEvents::iterator const& event, aod::BCs const& bcs) + { + // Reset the fValues array + VarManager::ResetValues(0, VarManager::kNEventWiseVariables, fValues); + + VarManager::FillEvent(event, fValues); + fHistMan->FillHistClass("Event_BeforeCuts", fValues); // automatically fill all the histograms in the class Event + if (fEventCut.IsSelected(fValues)) { + fHistMan->FillHistClass("Event_AfterCuts", fValues); + eventSel(1); + } else { + eventSel(0); + } + } +}; + +struct DQBarrelTrackSelectionTask { + Produces trackSel; + OutputObj fOutputList{"output"}; + HistogramManager* fHistMan; + std::vector fTrackCuts; + + float* fValues; // array to be used by the VarManager + + Configurable fConfigCuts{"cfgBarrelTrackCuts", "jpsiPID1", "Comma separated list of barrel track cuts"}; + + void init(o2::framework::InitContext&) + { + DefineCuts(); + + fValues = new float[VarManager::kNVars]; + VarManager::SetDefaultVarNames(); + fHistMan = new HistogramManager("analysisHistos", "aa", VarManager::kNVars); + fHistMan->SetUseDefaultVariableNames(kTRUE); + fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); + + TString cutNames = "TrackBarrel_BeforeCuts;"; + for (auto& cut : fTrackCuts) { + cutNames += Form("TrackBarrel_%s;", cut.GetName()); + } + + DefineHistograms(fHistMan, cutNames.Data()); // define all histograms + VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill + fOutputList.setObject(fHistMan->GetMainHistogramList()); + } + + void DefineCuts() + { + // available cuts: jpsiKineAndQuality, jpsiPID1, jpsiPID2 + TString cutNamesStr = fConfigCuts.value; + if (!cutNamesStr.IsNull()) { + std::unique_ptr objArray(cutNamesStr.Tokenize(",")); + for (int icut = 0; icut < objArray->GetEntries(); ++icut) { + fTrackCuts.push_back(*dqcuts::GetCompositeCut(objArray->At(icut)->GetName())); + } + } + + // NOTE: Additional cuts to those specified via the Configurable may still be added + + VarManager::SetUseVars(AnalysisCut::fgUsedVars); // provide the list of required variables so that VarManager knows what to fill + } + + void process(MyEvents::iterator const& event, MyBarrelTracks const& tracks, aod::BCs const& bcs) + { + uint8_t filterMap = uint8_t(0); + trackSel.reserve(tracks.size()); + + VarManager::ResetValues(0, VarManager::kNBarrelTrackVariables, fValues); + // fill event information which might be needed in histograms that combine track and event properties + VarManager::FillEvent(event, fValues); + + for (auto& track : tracks) { + filterMap = uint8_t(0); + // TODO: if a condition on the event selection is applied, the histogram output is missing + VarManager::FillTrack(track, fValues); + fHistMan->FillHistClass("TrackBarrel_BeforeCuts", fValues); + int i = 0; + for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); ++cut, ++i) { + if ((*cut).IsSelected(fValues)) { + filterMap |= (uint8_t(1) << i); + fHistMan->FillHistClass(Form("TrackBarrel_%s", (*cut).GetName()), fValues); + } + } + trackSel(filterMap); + } + } +}; + +struct DQFilterPPTaskTiny { + Produces eventFilter; + OutputObj fOutputList{"output"}; + OutputObj fStats{"stats"}; + HistogramManager* fHistMan; + std::vector fPairCuts; + + float* fValues; + + Partition posTracks = aod::track::signed1Pt > 0.0f && aod::dqppfilter::isBarrelSelected > uint8_t(0); + Partition negTracks = aod::track::signed1Pt < 0.0f && aod::dqppfilter::isBarrelSelected > uint8_t(0); + + Configurable fConfigTrackCuts{"cfgBarrelTrackCuts", "jpsiPID1", "Comma separated list of barrel track cuts"}; + Configurable fConfigPairCuts{"cfgPairCuts", "pairMassLow", "Comma separated list of pair cuts"}; + + int fNTrackCuts; + int fNPairCuts; + TObjArray* fTrkCutsNameArray; + + void DefineCuts() + { + // available pair cuts in CutsLibrary: pairNoCut,pairMassLow,pairJpsi,pairPsi2S,pairUpsilon,pairJpsiPtLow1, pairJpsiPtLow2 + TString pairCutNamesStr = fConfigPairCuts.value; + std::unique_ptr objArray(pairCutNamesStr.Tokenize(",")); + fNPairCuts = objArray->GetEntries(); + if (fNPairCuts) { + for (int icut = 0; icut < fNPairCuts; ++icut) { + fPairCuts.push_back(*dqcuts::GetCompositeCut(objArray->At(icut)->GetName())); + } + } + + // NOTE: Additional cuts to those specified via the Configurable may still be added + + VarManager::SetUseVars(AnalysisCut::fgUsedVars); // provide the list of required variables so that VarManager knows what to fill + } + + void init(o2::framework::InitContext&) + { + DefineCuts(); + + fValues = new float[VarManager::kNVars]; + + // initialize the variable manager + VarManager::SetDefaultVarNames(); + fHistMan = new HistogramManager("analysisHistos", "aa", VarManager::kNVars); + fHistMan->SetUseDefaultVariableNames(kTRUE); + fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); + + // configure histograms + TString trackCutNamesStr = fConfigTrackCuts.value; + fTrkCutsNameArray = trackCutNamesStr.Tokenize(","); + fNTrackCuts = fTrkCutsNameArray->GetEntries(); + TString histNames = ""; + for (int i = 0; i < fNTrackCuts; i++) { + histNames += Form("PairsBarrelPM_%s;", fTrkCutsNameArray->At(i)->GetName()); + } + DefineHistograms(fHistMan, histNames.Data()); // define all histograms + VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill + fOutputList.setObject(fHistMan->GetMainHistogramList()); + + // configure the stats histogram + fStats.setObject(new TH2I("stats", "stats", fNPairCuts, -0.5, -0.5 + fNPairCuts, fNTrackCuts, -0.5, -0.5 + fNTrackCuts)); + for (int i = 0; i < fNPairCuts; ++i) { + fStats->GetXaxis()->SetBinLabel(i + 1, fPairCuts[i].GetName()); + } + for (int i = 0; i < fNTrackCuts; ++i) { + fStats->GetYaxis()->SetBinLabel(i + 1, fTrkCutsNameArray->At(i)->GetName()); + } + } + + void process(MyEventsSelected::iterator const& event, MyBarrelTracksSelected const& tracks, aod::BCs const& bcs) + { + uint64_t filter = 0; + constexpr int pairType = VarManager::kJpsiToEE; + + if (event.isDQEventSelected() == 1) { + // Reset the fValues array + VarManager::ResetValues(0, VarManager::kNVars, fValues); + VarManager::FillEvent(event, fValues); + + uint8_t* pairsCount = new uint8_t[fNPairCuts * fNTrackCuts]; + for (int i = 0; i < fNPairCuts * fNTrackCuts; i++) { + pairsCount[i] = 0; + } + + uint8_t cutFilter = 0; + for (auto tpos : posTracks) { + for (auto tneg : negTracks) { // +- pairs + cutFilter = tpos.isBarrelSelected() & tneg.isBarrelSelected(); + if (!cutFilter) { // the tracks must have at least one filter bit in common to continue + continue; + } + VarManager::FillPair(tpos, tneg, fValues); // compute pair quantities + for (int i = 0; i < fNTrackCuts; ++i) { + if (!(cutFilter & (uint8_t(1) << i))) { + continue; + } + fHistMan->FillHistClass(Form("PairsBarrelPM_%s", fTrkCutsNameArray->At(i)->GetName()), fValues); + int j = 0; + for (auto cut = fPairCuts.begin(); cut != fPairCuts.end(); cut++, j++) { + if ((*cut).IsSelected(fValues)) { + pairsCount[j + i * fNPairCuts] += 1; + } + } + } + } + } + + for (int i = 0; i < fNTrackCuts; i++) { + for (int j = 0; j < fNPairCuts; j++) { + if (pairsCount[j + i * fNPairCuts] > 0) { + filter |= (uint64_t(1) << (j + i * fNPairCuts)); + fStats->Fill(j, i); + } + } + } + delete[] pairsCount; + } + eventFilter(filter); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc)}; +} + +void DefineHistograms(HistogramManager* histMan, TString histClasses) +{ + // + // Define here the histograms for all the classes required in analysis. + // The histogram classes are provided in the histClasses string, separated by semicolon ";" + // NOTE: Additional histograms to those predefined in the library can be added here !! + const int kNRuns = 25; + int runs[kNRuns] = { + 285009, 285011, 285012, 285013, 285014, 285015, 285064, 285065, 285066, 285106, + 285108, 285125, 285127, 285165, 285200, 285202, 285203, 285222, 285224, 285327, + 285328, 285347, 285364, 285365, 285396}; + VarManager::SetRunNumbers(kNRuns, runs); + + std::unique_ptr objArray(histClasses.Tokenize(";")); + for (Int_t iclass = 0; iclass < objArray->GetEntries(); ++iclass) { + TString classStr = objArray->At(iclass)->GetName(); + histMan->AddHistClass(classStr.Data()); + + if (classStr.Contains("Event")) { + dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "event", "trigger,vtxPbPb"); + } + + if (classStr.Contains("Track")) { + dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "track", "its,tpcpid,dca"); + } + + if (classStr.Contains("Pairs")) { + dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "pair_barrel", "vertexing-barrel"); + } + } +} diff --git a/PWGHF/TableProducer/HFBPlusToD0PiCandidateSelector.cxx b/PWGHF/TableProducer/HFBPlusToD0PiCandidateSelector.cxx index 4946526f203..6b1d4a8ba60 100644 --- a/PWGHF/TableProducer/HFBPlusToD0PiCandidateSelector.cxx +++ b/PWGHF/TableProducer/HFBPlusToD0PiCandidateSelector.cxx @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/PWGHF/TableProducer/HFCandidateCreatorBPlus.cxx b/PWGHF/TableProducer/HFCandidateCreatorBPlus.cxx index be6fb5564be..c6f20a3145d 100644 --- a/PWGHF/TableProducer/HFCandidateCreatorBPlus.cxx +++ b/PWGHF/TableProducer/HFCandidateCreatorBPlus.cxx @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/PWGHF/TableProducer/HFCandidateCreatorXicc.cxx b/PWGHF/TableProducer/HFCandidateCreatorXicc.cxx index a60ef3649ee..1539adb8dbe 100644 --- a/PWGHF/TableProducer/HFCandidateCreatorXicc.cxx +++ b/PWGHF/TableProducer/HFCandidateCreatorXicc.cxx @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/PWGHF/TableProducer/HFLbToLcPiCandidateSelector.cxx b/PWGHF/TableProducer/HFLbToLcPiCandidateSelector.cxx index 0565b1b85a2..82429305594 100644 --- a/PWGHF/TableProducer/HFLbToLcPiCandidateSelector.cxx +++ b/PWGHF/TableProducer/HFLbToLcPiCandidateSelector.cxx @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/PWGHF/TableProducer/HFXiccToPKPiPiCandidateSelector.cxx b/PWGHF/TableProducer/HFXiccToPKPiPiCandidateSelector.cxx index 0ef3b829b96..04a426962f4 100644 --- a/PWGHF/TableProducer/HFXiccToPKPiPiCandidateSelector.cxx +++ b/PWGHF/TableProducer/HFXiccToPKPiPiCandidateSelector.cxx @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/PWGHF/Tasks/taskXicc.cxx b/PWGHF/Tasks/taskXicc.cxx index 29ed5d8b4f0..09df5e1025a 100644 --- a/PWGHF/Tasks/taskXicc.cxx +++ b/PWGHF/Tasks/taskXicc.cxx @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/PWGMM/Tasks/dndeta.cxx b/PWGMM/Tasks/dndeta.cxx index 6aafa957a99..40ca2eeaa8e 100644 --- a/PWGMM/Tasks/dndeta.cxx +++ b/PWGMM/Tasks/dndeta.cxx @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/PWGMM/Tasks/dndeta.h b/PWGMM/Tasks/dndeta.h index 6362a78c9ff..7caf51d0c17 100644 --- a/PWGMM/Tasks/dndeta.h +++ b/PWGMM/Tasks/dndeta.h @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/PWGMM/Tasks/run2dndeta.cxx b/PWGMM/Tasks/run2dndeta.cxx index b7872769e7c..b64218f67b3 100644 --- a/PWGMM/Tasks/run2dndeta.cxx +++ b/PWGMM/Tasks/run2dndeta.cxx @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 From 81afcbc4490ede2ec15ca72d7c88b6af34acfbad Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Tue, 23 Nov 2021 10:36:44 +0100 Subject: [PATCH 2/2] Add check for copyright headers It runs in parallel with the clang-format check, and makes sure the copyright notice of any changed .cxx or .h files is OK. --- .github/workflows/code-formatting.yml | 53 ++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/.github/workflows/code-formatting.yml b/.github/workflows/code-formatting.yml index 508b911d2c2..de51f755dba 100644 --- a/.github/workflows/code-formatting.yml +++ b/.github/workflows/code-formatting.yml @@ -1,9 +1,10 @@ -name: Check PR with clang-format +name: PR formatting on: [pull_request_target] jobs: clang-format: + name: clang-format # We need at least 20.04 to install clang-format-11. runs-on: ubuntu-20.04 @@ -99,3 +100,53 @@ jobs: true) echo 'PR clean' ; exit 0 ;; false) echo 'PR not clean' ; exit 1 ;; esac + + copyright: + name: copyright headers + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false + # We need the history of the dev branch all the way back to where the PR + # diverged. We're fetching everything here, as we don't know how many + # commits back that point is. + fetch-depth: 0 + + - name: Check copyright headers + env: + # The expected copyright notice. + COPYRIGHT: | + // 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. + run: | + # Run copyright notice check + copyright_lines=$(echo "$COPYRIGHT" | wc -l) + base_commit=$(git merge-base HEAD ${{ github.event.pull_request.base.sha }}) + have_err= + git diff --diff-filter d --name-only "$base_commit" -- '*.cxx' '*.h' | while read -r file; do + if [ "$(head -n "$copyright_lines" "$file")" != "$COPYRIGHT" ]; then + echo "::error::$file: missing or malformed copyright notice" >&2 + have_err=1 + fi + done + + # Tell user what to do in case of copyright notice error + if [ -n "$have_err" ]; then + cat << EOF >&2 + ::error::The files listed above are missing the correct copyright notice. + ::error::Make sure all your source files begin with the following exact lines: + $COPYRIGHT + EOF + exit 1 + fi