|
33 | 33 | #include "TOFClusterizerSpec.h" |
34 | 34 | #include "TOFClusterWriterSpec.h" |
35 | 35 |
|
| 36 | +// GRP |
| 37 | +#include "DataFormatsParameters/GRPObject.h" |
| 38 | + |
36 | 39 | #include <cstdlib> |
37 | 40 | // this is somewhat assuming that a DPL workflow will run on one node |
38 | 41 | #include <thread> // to detect number of hardware threads |
@@ -139,47 +142,75 @@ bool wantCollisionTimePrinter() |
139 | 142 | return false; |
140 | 143 | } |
141 | 144 |
|
| 145 | +o2::parameters::GRPObject* readGRP(std::string inputGRP = "o2sim_grp.root") |
| 146 | +{ |
| 147 | + const auto grp = o2::parameters::GRPObject::loadFrom(inputGRP); |
| 148 | + if (!grp) { |
| 149 | + LOG(ERROR) << "This workflow needs a valid GRP file to start"; |
| 150 | + } |
| 151 | + return grp; |
| 152 | +} |
| 153 | + |
142 | 154 | /// This function is required to be implemented to define the workflow |
143 | 155 | /// specifications |
144 | 156 | WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) |
145 | 157 | { |
146 | 158 | WorkflowSpec specs; |
147 | 159 |
|
| 160 | + // we will first of all read the GRP to detect which components need |
| 161 | + // instantiations |
| 162 | + // (for the moment this assumes the file o2sim_grp.root to be in the current directory) |
| 163 | + const auto grp = readGRP(); |
| 164 | + if (!grp) { |
| 165 | + return specs; |
| 166 | + } |
| 167 | + |
148 | 168 | int fanoutsize = 0; |
149 | 169 | if (wantCollisionTimePrinter()) { |
150 | 170 | specs.emplace_back(o2::steer::getCollisionTimePrinter(fanoutsize++)); |
151 | 171 | } |
152 | 172 |
|
| 173 | + // the TPC part |
| 174 | + // we need to instantiate this anyway since TPC is treated a bit special (for the moment) |
153 | 175 | initTPC(); |
154 | 176 | // keeps track of which subchannels correspond to tpc channels |
155 | 177 | auto tpclanes = std::make_shared<std::vector<int>>(); |
156 | 178 | // keeps track of which tpc sectors to process |
157 | 179 | auto tpcsectors = std::make_shared<std::vector<int>>(); |
158 | | - extractTPCSectors(*tpcsectors.get(), configcontext); |
159 | | - auto lanes = getNumTPCLanes(*tpcsectors.get(), configcontext); |
| 180 | + if (grp->isDetReadOut(o2::detectors::DetID::TPC)) { |
160 | 181 |
|
161 | | - for (int l = 0; l < lanes; ++l) { |
162 | | - specs.emplace_back(o2::steer::getTPCDriftTimeDigitizer(fanoutsize)); |
163 | | - tpclanes->emplace_back(fanoutsize); // this records that TPC is "listening under this subchannel" |
164 | | - fanoutsize++; |
| 182 | + extractTPCSectors(*tpcsectors.get(), configcontext); |
| 183 | + auto lanes = getNumTPCLanes(*tpcsectors.get(), configcontext); |
| 184 | + |
| 185 | + for (int l = 0; l < lanes; ++l) { |
| 186 | + specs.emplace_back(o2::steer::getTPCDriftTimeDigitizer(fanoutsize)); |
| 187 | + tpclanes->emplace_back(fanoutsize); // this records that TPC is "listening under this subchannel" |
| 188 | + fanoutsize++; |
| 189 | + } |
| 190 | + |
| 191 | + // for writing digits to disc |
| 192 | + specs.emplace_back(o2::TPC::getTPCDigitRootWriterSpec(lanes)); |
165 | 193 | } |
166 | 194 |
|
167 | | - // for writing digits to disc |
168 | | - specs.emplace_back(o2::TPC::getTPCDigitRootWriterSpec(lanes)); |
169 | | - |
170 | | - // connect the ITS digitization |
171 | | - specs.emplace_back(o2::ITS::getITSDigitizerSpec(fanoutsize++)); |
172 | | - // connect ITS digit writer |
173 | | - specs.emplace_back(o2::ITS::getITSDigitWriterSpec()); |
174 | | - |
175 | | - // connect the TOF digitization |
176 | | - specs.emplace_back(o2::tof::getTOFDigitizerSpec(fanoutsize++)); |
177 | | - // add TOF digit writer |
178 | | - specs.emplace_back(o2::tof::getTOFDigitWriterSpec()); |
179 | | - // add TOF clusterer |
180 | | - specs.emplace_back(o2::tof::getTOFClusterizerSpec()); |
181 | | - // add TOF cluster writer |
182 | | - specs.emplace_back(o2::tof::getTOFClusterWriterSpec()); |
| 195 | + // the ITS part |
| 196 | + if (grp->isDetReadOut(o2::detectors::DetID::ITS)) { |
| 197 | + // connect the ITS digitization |
| 198 | + specs.emplace_back(o2::ITS::getITSDigitizerSpec(fanoutsize++)); |
| 199 | + // connect ITS digit writer |
| 200 | + specs.emplace_back(o2::ITS::getITSDigitWriterSpec()); |
| 201 | + } |
| 202 | + |
| 203 | + // the TOF part |
| 204 | + if (grp->isDetReadOut(o2::detectors::DetID::TOF)) { |
| 205 | + // connect the TOF digitization |
| 206 | + specs.emplace_back(o2::tof::getTOFDigitizerSpec(fanoutsize++)); |
| 207 | + // add TOF digit writer |
| 208 | + specs.emplace_back(o2::tof::getTOFDigitWriterSpec()); |
| 209 | + // add TOF clusterer |
| 210 | + specs.emplace_back(o2::tof::getTOFClusterizerSpec()); |
| 211 | + // add TOF cluster writer |
| 212 | + specs.emplace_back(o2::tof::getTOFClusterWriterSpec()); |
| 213 | + } |
183 | 214 |
|
184 | 215 | // The SIM Reader. NEEDS TO BE LAST |
185 | 216 | specs.emplace_back(o2::steer::getSimReaderSpec(fanoutsize, tpcsectors, tpclanes)); |
|
0 commit comments