Skip to content

Commit

Permalink
Tutorial3: sort includes and add guards
Browse files Browse the repository at this point in the history
  • Loading branch information
rbx committed Feb 10, 2023
1 parent 0dba1cc commit 54ea9f5
Show file tree
Hide file tree
Showing 22 changed files with 116 additions and 15 deletions.
18 changes: 12 additions & 6 deletions examples/advanced/Tutorial3/MQ/fileSink/FileSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,27 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#ifndef FAIR_TESTDETECTOR_FILESINK_H_
#define FAIR_TESTDETECTOR_FILESINK_H_
#ifndef FAIR_TESTDETECTOR_FILESINK_H
#define FAIR_TESTDETECTOR_FILESINK_H

#include "FairMQ.h" // for fair::mq::Device
// this example
#include "FairTestDetectorHit.h"
#include "Payload.h"

// FairRoot
#include "FairMQ.h" // for fair::mq::Device

// ROOT
#include <Rtypes.h>
#include <TClonesArray.h>
#include <TFile.h>
#include <TSystem.h>
#include <TTree.h>
#include <array>

// logger
#include <fairlogger/Logger.h>
#include <iostream>

// std
#include <memory>
#include <string>

Expand Down Expand Up @@ -73,4 +79,4 @@ class FileSink : public fair::mq::Device
std::string fInChannelName;
};

#endif /* FAIR_TESTDETECTOR_FILESINK_H_ */
#endif /* FAIR_TESTDETECTOR_FILESINK_H */
5 changes: 5 additions & 0 deletions examples/advanced/Tutorial3/MQ/fileSink/FileSinkBin.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// Implementation of FileSink::Run() with pure binary transport data format

#ifndef FAIR_TESTDETECTOR_FILESINK_BIN_H
#define FAIR_TESTDETECTOR_FILESINK_BIN_H

#include "Payload.h"

template<>
Expand Down Expand Up @@ -42,3 +45,5 @@ void FileSink<TestDetectorBin>::InitTask()
return true;
});
}

#endif /* FAIR_TESTDETECTOR_FILESINK_BIN_H */
5 changes: 5 additions & 0 deletions examples/advanced/Tutorial3/MQ/fileSink/FileSinkBoost.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// Implementation of FileSink::Run() with Boost transport data format

#ifndef FAIR_TESTDETECTOR_FILESINK_BOOST_H
#define FAIR_TESTDETECTOR_FILESINK_BOOST_H

#include "Payload.h"
#include "BoostSerializer.h"

Expand All @@ -34,3 +37,5 @@ void FileSink<TestDetectorBoost>::InitTask()
return true;
});
}

#endif // FAIR_TESTDETECTOR_FILESINK_BOOST_H
5 changes: 5 additions & 0 deletions examples/advanced/Tutorial3/MQ/fileSink/FileSinkFlatBuffers.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// Implementation of FileSink::Run() with Google FlatBuffers transport data format

#ifndef FAIR_TESTDETECTOR_FILESINK_FLATBUFFERS_H
#define FAIR_TESTDETECTOR_FILESINK_FLATBUFFERS_H

#ifdef FLATBUFFERS

#include "Payload.h"
Expand Down Expand Up @@ -51,3 +54,5 @@ void FileSink<TestDetectorFlatBuffers>::InitTask()
}

#endif /* FLATBUFFERS */

#endif // FAIR_TESTDETECTOR_FILESINK_FLATBUFFERS_H
5 changes: 5 additions & 0 deletions examples/advanced/Tutorial3/MQ/fileSink/FileSinkProtobuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// Implementation of FileSink::Run() with Google Protocol Buffers transport data format

#ifndef FAIR_TESTDETECTOR_FILESINK_PROTOBUF_H
#define FAIR_TESTDETECTOR_FILESINK_PROTOBUF_H

#ifdef PROTOBUF

#include "Payload.h"
Expand Down Expand Up @@ -49,3 +52,5 @@ void FileSink<TestDetectorProtobuf>::InitTask()
}

#endif /* PROTOBUF */

#endif // FAIR_TESTDETECTOR_FILESINK_PROTOBUF_H
5 changes: 5 additions & 0 deletions examples/advanced/Tutorial3/MQ/fileSink/FileSinkTMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// Implementation of FileSink::Run() with Root TMessage transport data format

#ifndef FAIR_TESTDETECTOR_FILESINK_TMESSAGE_H
#define FAIR_TESTDETECTOR_FILESINK_TMESSAGE_H

#include "Payload.h"
#include "RootSerializer.h"

Expand All @@ -31,3 +34,5 @@ void FileSink<TestDetectorTMessage>::InitTask()
return true;
});
}

#endif // FAIR_TESTDETECTOR_FILESINK_TMESSAGE_H
7 changes: 7 additions & 0 deletions examples/advanced/Tutorial3/MQ/processor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

// this example
#include "ProcessorTask.h"
#include "MQRecoTask.h"
#include "MQRecoTaskBin.h"
Expand All @@ -14,11 +15,17 @@
#include "MQRecoTaskProtobuf.h"
#include "MQRecoTaskTMessage.h"

// FairRoot
#include "FairRunFairMQDevice.h"
#include "FairMQ.h" // for fair::mq::Device, fair::mq::MessagePtr

// logger
#include <fairlogger/Logger.h>

// std
#include <memory>
#include <string>

namespace bpo = boost::program_options;

template<typename Task>
Expand Down
12 changes: 9 additions & 3 deletions examples/advanced/Tutorial3/MQ/processorTask/MQRecoTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@
#ifndef FAIR_TESTDETECTOR_MQRECOTASK_H
#define FAIR_TESTDETECTOR_MQRECOTASK_H

#include "ProcessorTask.h"
#include "FairRootManager.h"
// this example
#include "FairTestDetectorDigi.h"
#include "FairTestDetectorHit.h"
#include "Payload.h"
#include "FairTestDetectorRecoTask.h"
#include "Payload.h"
#include "ProcessorTask.h"

// FairRoot
#include "FairRootManager.h"

// ROOT
#include <TClonesArray.h>

// logger
#include <fairlogger/Logger.h>

template<typename T>
Expand Down
5 changes: 5 additions & 0 deletions examples/advanced/Tutorial3/MQ/processorTask/MQRecoTaskBin.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// Implementation of MQRecoTask::Exec() with pure binary transport data format

#ifndef FAIR_TESTDETECTOR_PROCESSORTASK_BIN_H
#define FAIR_TESTDETECTOR_PROCESSORTASK_BIN_H

#include "Payload.h"

template<>
Expand Down Expand Up @@ -53,3 +56,5 @@ void MQRecoTask<TestDetectorBin>::Exec(Option_t* opt)
}
}
}

#endif // FAIR_TESTDETECTOR_PROCESSORTASK_BIN_H
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// Implementation of MQRecoTask::Exec() with Boost transport data format

#ifndef FAIR_TESTDETECTOR_PROCESSORTASK_BOOST_H
#define FAIR_TESTDETECTOR_PROCESSORTASK_BOOST_H

#include "Payload.h"
#include "BoostSerializer.h"

Expand All @@ -24,3 +27,5 @@ void MQRecoTask<TestDetectorBoost>::Exec(Option_t* opt)

BoostSerializer<FairTestDetectorHit>().Serialize(*fPayload, fRecoTask.fHitArray);
}

#endif // FAIR_TESTDETECTOR_PROCESSORTASK_BOOST_H
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// Implementation of MQRecoTask::Exec() with Google FlatBuffers transport data format

#ifndef FAIR_TESTDETECTOR_PROCESSORTASK_FLATBUFFERS_H
#define FAIR_TESTDETECTOR_PROCESSORTASK_FLATBUFFERS_H

#ifdef FLATBUFFERS

#include "Payload.h"
Expand Down Expand Up @@ -76,3 +79,5 @@ void MQRecoTask<TestDetectorFlatBuffers>::Exec(Option_t* opt)
}

#endif /* FLATBUFFERS */

#endif // FAIR_TESTDETECTOR_PROCESSORTASK_FLATBUFFERS_H
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// Implementation of MQRecoTask::Exec() with Google Protocol Buffers transport data format

#ifndef FAIR_TESTDETECTOR_PROCESSORTASK_PROTOBUF_H
#define FAIR_TESTDETECTOR_PROCESSORTASK_PROTOBUF_H

#ifdef PROTOBUF

#include "Payload.h"
Expand Down Expand Up @@ -64,3 +67,5 @@ void MQRecoTask<TestDetectorProtobuf>::Exec(Option_t* opt)
}

#endif /* PROTOBUF */

#endif // FAIR_TESTDETECTOR_PROCESSORTASK_PROTOBUF_H
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// Implementation of MQRecoTask::Exec() with Root TMessage transport data format

#ifndef FAIR_TESTDETECTOR_PROCESSORTASK_TMESSAGE_H
#define FAIR_TESTDETECTOR_PROCESSORTASK_TMESSAGE_H

#include "Payload.h"
#include "RootSerializer.h"

Expand All @@ -18,3 +21,5 @@ void MQRecoTask<TestDetectorTMessage>::Exec(Option_t* opt)
fRecoTask.Exec(opt);
RootSerializer().Serialize(*fPayload, fRecoTask.fHitArray);
}

#endif // FAIR_TESTDETECTOR_PROCESSORTASK_TMESSAGE_H
6 changes: 3 additions & 3 deletions examples/advanced/Tutorial3/MQ/processorTask/ProcessorTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#ifndef FAIR_TESTDETECTOR_ROCESSORTASK_H
#define FAIR_TESTDETECTOR_ROCESSORTASK_H
#ifndef FAIR_TESTDETECTOR_PROCESSORTASK_H
#define FAIR_TESTDETECTOR_PROCESSORTASK_H

#include "FairMQ.h" // for fair::mq::Message
#include "FairTask.h"
Expand All @@ -28,4 +28,4 @@ class ProcessorTask : public FairTask
std::unique_ptr<fair::mq::Message> fPayload;
};

#endif /* FAIR_TESTDETECTOR_ROCESSORTASK_H */
#endif /* FAIR_TESTDETECTOR_PROCESSORTASK_H */
4 changes: 4 additions & 0 deletions examples/advanced/Tutorial3/MQ/sampler.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

// this example
#include "DigiLoader.h"
#include "DigiLoaderBin.h"
#include "DigiLoaderBoost.h"
Expand All @@ -14,6 +15,7 @@
#include "DigiLoaderTMessage.h"
#include "SamplerTask.h"

// FairRoot
#include "FairFileSource.h"
#include "FairMQ.h" // for fair::mq::Device, fair::mq::MessagePtr
#include "FairParRootFileIo.h"
Expand All @@ -22,8 +24,10 @@
#include "FairRunFairMQDevice.h"
#include "FairRuntimeDb.h"

// logger
#include <fairlogger/Logger.h>

// std
#include <chrono>
#include <iomanip>
#include <stdexcept>
Expand Down
4 changes: 2 additions & 2 deletions examples/advanced/Tutorial3/MQ/samplerTask/DigiLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
#ifndef FAIR_TESTDETECTOR_DIGILOADER_H
#define FAIR_TESTDETECTOR_DIGILOADER_H

// this example
#include "SamplerTask.h"
#include "FairTestDetectorDigi.h"
#include "Payload.h"

#include <array>
// logger
#include <fairlogger/Logger.h>
#include <iostream>

template<typename T>
class DigiLoader : public SamplerTask
Expand Down
5 changes: 5 additions & 0 deletions examples/advanced/Tutorial3/MQ/samplerTask/DigiLoaderBin.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// Implementation of DigiLoader::Exec() with pure binary transport data format

#ifndef FAIR_TESTDETECTOR_DIGILOADER_BIN_H
#define FAIR_TESTDETECTOR_DIGILOADER_BIN_H

#include "Payload.h"

template<>
Expand All @@ -34,3 +37,5 @@ void DigiLoader<TestDetectorBin>::Exec(Option_t* /*opt*/)
digiPayload[i].fTimeStampError = digi->GetTimeStampError();
}
}

#endif // FAIR_TESTDETECTOR_DIGILOADER_BIN_H
5 changes: 5 additions & 0 deletions examples/advanced/Tutorial3/MQ/samplerTask/DigiLoaderBoost.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// Implementation of DigiLoader::Exec() with Boost transport data format

#ifndef FAIR_TESTDETECTOR_DIGILOADER_BOOST_H
#define FAIR_TESTDETECTOR_DIGILOADER_BOOST_H

#include "Payload.h"
#include "BoostSerializer.h"

Expand All @@ -17,3 +20,5 @@ void DigiLoader<TestDetectorBoost>::Exec(Option_t* /*opt*/)
fPayload = fTransportFactory->CreateMessage();
BoostSerializer<FairTestDetectorDigi>().Serialize(*fPayload, fInput);
}

#endif // FAIR_TESTDETECTOR_DIGILOADER_BOOST_H
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// Implementation of DigiLoader::Exec() with Google FlatBuffers transport data format

#ifndef FAIR_TESTDETECTOR_DIGILOADER_FLATBUFFERS_H
#define FAIR_TESTDETECTOR_DIGILOADER_FLATBUFFERS_H

#ifdef FLATBUFFERS

#include "Payload.h"
Expand Down Expand Up @@ -54,3 +57,5 @@ void DigiLoader<TestDetectorFlatBuffers>::Exec(Option_t* /*opt*/)
}

#endif /* FLATBUFFERS */

#endif // FAIR_TESTDETECTOR_DIGILOADER_FLATBUFFERS_H
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// Implementation of DigiLoader::Exec() with Google Protocol Buffers transport data format

#ifndef FAIR_TESTDETECTOR_DIGILOADER_PROTOBUF_H
#define FAIR_TESTDETECTOR_DIGILOADER_PROTOBUF_H

#ifdef PROTOBUF

#include "Payload.h"
Expand Down Expand Up @@ -44,3 +47,5 @@ void DigiLoader<TestDetectorProtobuf>::Exec(Option_t* /*opt*/)
}

#endif /* PROTOBUF */

#endif // FAIR_TESTDETECTOR_DIGILOADER_PROTOBUF_H
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// Implementation of DigiLoader::Exec() with Root TMessage transport data format

#ifndef FAIR_TESTDETECTOR_DIGILOADER_TMESSAGE_H
#define FAIR_TESTDETECTOR_DIGILOADER_TMESSAGE_H

#include "Payload.h"
#include "RootSerializer.h"

Expand All @@ -17,3 +20,5 @@ void DigiLoader<TestDetectorTMessage>::Exec(Option_t* /*opt*/)
fPayload = fTransportFactory->CreateMessage();
RootSerializer().Serialize(*fPayload, fInput);
}

#endif // FAIR_TESTDETECTOR_DIGILOADER_TMESSAGE_H
Loading

0 comments on commit 54ea9f5

Please sign in to comment.