Project
Loading...
Searching...
No Matches
FT0DigitWriterSpec.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15namespace o2
16{
17namespace ft0
18{
19
20template <typename T>
22
24{
27 // Spectators for logging
28 auto logger = [](std::vector<o2::ft0::Digit> const& vecDigits) {
29 LOG(debug) << "FT0DigitWriter pulled " << vecDigits.size() << " digits";
30 };
31 // the callback to be set as hook for custom action when the writer is closed
32 auto finishWriting = [](TFile* outputfile, TTree* outputtree) {
33 const auto* brArr = outputtree->GetListOfBranches();
34 int64_t nent = 0;
35 for (const auto* brc : *brArr) {
36 int64_t n = ((const TBranch*)brc)->GetEntries();
37 if (nent && (nent != n)) {
38 LOG(error) << "Branches have different number of entries";
39 }
40 nent = n;
41 }
42 outputtree->SetEntries(nent);
43 outputtree->Write();
44 outputfile->Close();
45 };
46
47 auto labelsdef = BranchDefinition<o2::dataformats::MCTruthContainer<o2::ft0::MCLabel>>{InputSpec{"labelinput", "FT0", "DIGITSMCTR"},
48 "FT0DIGITSMCTR", mctruth ? 1 : 0};
49 if (trigInp) {
50 return MakeRootTreeWriterSpec("FT0DigitWriter",
51 "ft0digits.root",
52 "o2sim",
54 BranchDefinition<std::vector<o2::ft0::Digit>>{InputSpec{"ft0digitBCinput", "FT0", "DIGITSBC"}, "FT0DIGITSBC", "ft0-digits-branch-name", 1,
55 logger},
56 BranchDefinition<std::vector<o2::ft0::ChannelData>>{InputSpec{"ft0digitChinput", "FT0", "DIGITSCH"}, "FT0DIGITSCH", "ft0-chhdata-branch-name"},
57 BranchDefinition<std::vector<o2::ft0::DetTrigInput>>{InputSpec{"ft0digitTrinput", "FT0", "TRIGGERINPUT"}, "TRIGGERINPUT", "ft0-triggerinput-branch-name"},
58 std::move(labelsdef))();
59 } else {
60 return MakeRootTreeWriterSpec("FT0DigitWriterRaw",
61 "o2_ft0digits.root",
62 "o2sim",
64 BranchDefinition<std::vector<o2::ft0::Digit>>{InputSpec{"ft0digitBCinput", "FT0", "DIGITSBC"}, "FT0DIGITSBC", "ft0-digits-branch-name", 1,
65 logger},
66 BranchDefinition<std::vector<o2::ft0::ChannelData>>{InputSpec{"ft0digitChinput", "FT0", "DIGITSCH"}, "FT0DIGITSCH", "ft0-chhdata-branch-name"},
67 std::move(labelsdef))();
68 }
69}
70
71} // end namespace ft0
72} // end namespace o2
std::ostringstream debug
Generate a processor spec for the RootTreeWriter utility.
GLdouble n
Definition glcorearb.h:1982
framework::DataProcessorSpec getFT0DigitWriterSpec(bool mctruth=true, bool trigInp=true)
create a processor spec
struct o2::upgrades_utils::@462 ft0
structure to keep V0C information
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"