Skip to content

Commit 7ffd7e2

Browse files
authored
Merge pull request #25 from Mu2e/eflumerf/FixWhitespace
Run clang-format, fix git-whitespace check errors
2 parents 9098315 + c6d877d commit 7ffd7e2

26 files changed

+4775
-4322
lines changed

otsdaq-mu2e-calorimeter/ArtModules/CaloDataAnalyzer_module.cc

Lines changed: 356 additions & 309 deletions
Large diffs are not rendered by default.

otsdaq-mu2e-calorimeter/ArtModules/CaloDataVerifier_module.cc

Lines changed: 834 additions & 637 deletions
Large diffs are not rendered by default.

otsdaq-mu2e-calorimeter/ArtModules/detail/RawEventQueueReader.hh

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace detail
1212
{
1313
struct RawEventQueueReader : public artdaq::detail::RawEventQueueReader
1414
{
15-
RawEventQueueReader(RawEventQueueReader const&) = delete;
15+
RawEventQueueReader(RawEventQueueReader const&) = delete;
1616
RawEventQueueReader& operator=(RawEventQueueReader const&) = delete;
1717

1818
RawEventQueueReader(fhicl::ParameterSet const& ps,

otsdaq-mu2e-calorimeter/ArtModules/testFragments_module.cc

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,66 +14,71 @@
1414

1515
#include "artdaq-core/Data/Fragment.hh"
1616

17-
#include "trace.h"
18-
#include "TH1.h"
1917
#include <unistd.h>
2018
#include <iomanip>
2119
#include <iostream>
2220
#include <string>
21+
#include "TH1.h"
22+
#include "trace.h"
2323

24-
namespace mu2e {
24+
namespace mu2e
25+
{
2526
class testFragments;
2627
}
2728

2829
class mu2e::testFragments : public art::EDAnalyzer
2930
{
30-
public:
31+
public:
3132
explicit testFragments(fhicl::ParameterSet const& pset);
3233
virtual void analyze(art::Event const& evt);
3334

34-
private:
35+
private:
3536
art::InputTag caloFragmentsTag_;
36-
//TTree* testTree;
37-
TH1F *testHist;
37+
// TTree* testTree;
38+
TH1F* testHist;
3839
};
3940

4041
mu2e::testFragments::testFragments(fhicl::ParameterSet const& pset)
41-
: EDAnalyzer{pset}, caloFragmentsTag_{"calo"} {
42+
: EDAnalyzer{pset}, caloFragmentsTag_{"calo"}
43+
{
4244
art::ServiceHandle<art::TFileService> tfs;
43-
//testTree = tfs->make<TTree>("test", "test");
44-
//testTree->Branch("nSize", &_nSize, "nSize/F");
45-
testHist = tfs->make<TH1F>("test", "test", 100, 0., 500. );
46-
45+
// testTree = tfs->make<TTree>("test", "test");
46+
// testTree->Branch("nSize", &_nSize, "nSize/F");
47+
testHist = tfs->make<TH1F>("test", "test", 100, 0., 500.);
4748
}
4849

4950
void mu2e::testFragments::analyze(art::Event const& e)
5051
{
51-
std::cout<<" [testFragments] analyzer testing simulated events "<<std::endl;
52+
std::cout << " [testFragments] analyzer testing simulated events " << std::endl;
5253
std::vector<art::Handle<artdaq::Fragments>> vah = e.getMany<artdaq::Fragments>();
53-
54-
std::cout<<"[testFragments] size "<<vah.size()<<std::endl;
55-
for (auto const& calFragments : vah) {
54+
55+
std::cout << "[testFragments] size " << vah.size() << std::endl;
56+
for(auto const& calFragments : vah)
57+
{
5658
const art::Provenance* prov = calFragments.provenance();
5759

58-
std::string fcn = prov->friendlyClassName();
59-
std::string modn = prov->moduleLabel();
60+
std::string fcn = prov->friendlyClassName();
61+
std::string modn = prov->moduleLabel();
6062
std::string instn = prov->processName();
6163

6264
std::string name = fcn + "_" + prov->moduleLabel() + "_" + instn;
63-
std::cout<<"[testFragments] extracting name = "<<fcn<<" "<<modn<<" "<<instn<<std::endl; //artdaq::Fragments daq test001
65+
std::cout << "[testFragments] extracting name = " << fcn << " " << modn << " "
66+
<< instn << std::endl; // artdaq::Fragments daq test001
6467

6568
size_t totalSize = 0;
66-
67-
for (size_t idx = 0; idx < calFragments->size(); ++idx) {
69+
70+
for(size_t idx = 0; idx < calFragments->size(); ++idx)
71+
{
6872
auto size = ((*calFragments)[idx]).size() * sizeof(artdaq::RawDataType);
69-
testHist->Fill(size);
73+
testHist->Fill(size);
7074
totalSize += size;
71-
std::cout << "[testFragments] \tCAL Fragment " << idx << " has size " << size << std::endl;
75+
std::cout << "[testFragments] \tCAL Fragment " << idx << " has size " << size
76+
<< std::endl;
7277
}
73-
//testTree->Fill();
74-
std::cout << "[testFragments] \tTotal Size: " << (int)totalSize << " bytes." << std::endl;
78+
// testTree->Fill();
79+
std::cout << "[testFragments] \tTotal Size: " << (int)totalSize << " bytes."
80+
<< std::endl;
7581
}
76-
7782
}
7883

7984
DEFINE_ART_MODULE(mu2e::testFragments)
Lines changed: 107 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,119 @@
11

22
#define GNU_COMP
33

4-
54
#include "otsdaq-mu2e-calorimeter/FEInterfaces/MZB.h"
6-
//#include "otsdaq-mu2e-calorimeter/FEInterfaces/ROCCalorimeterInterface.h"
7-
8-
//#include "otsdaq-mu2e/FEInterfaces/ROCPolarFireCoreInterface.h"
9-
10-
11-
12-
13-
uint8_t* MZB_Encode_CMD_Command_raw(MZB_OSCMDCODE_t cmdCode, float* params) {
14-
15-
int i;
16-
17-
18-
// Create structure and fill only to ease the checksum calculation
19-
20-
#ifdef GNU_COMP
21-
static struct __attribute__ ((__packed__)) ems {
22-
#else
23-
__packed __align(4) struct ems {
24-
#endif
25-
short dummy;
26-
short adr;
27-
28-
#ifdef GNU_COMP
29-
struct __attribute__ ((__packed__)) {
30-
#else
31-
__packed struct {
32-
#endif
33-
unsigned short functionReq_tag; // 'CD'
34-
unsigned short functionReq;
35-
float P[CT_MAXP];
36-
37-
#ifdef GNU_COMP
38-
// } __attribute__((packed, aligned(4)))
39-
} __attribute__ ((aligned (4)))
40-
#else
41-
}
42-
#endif
43-
cmdReq;
44-
unsigned chksum;
45-
#ifdef GNU_COMP
46-
// } __attribute__((packed, aligned(4)))
47-
} __attribute__ ((aligned (4)))
48-
#else
49-
}
50-
#endif
51-
em;
52-
53-
54-
// *** Fill the structure ***
55-
56-
57-
em.adr = offsetof(EE_DATABUF_t, functionReq_tag);
58-
59-
// Structure id for the extended command request ('CD')
60-
em.cmdReq.functionReq_tag = 'C' | ('D' << 8);
61-
62-
// Command request (enumerated)
63-
em.cmdReq.functionReq = cmdCode | 0x8000;
64-
65-
66-
// 9 parameters (float)
67-
for (i = 0; i < CT_MAXP; i++) {
68-
em.cmdReq.P[i] = params[i];
69-
}
70-
71-
// Checksum
72-
em.chksum = 1 + (~ees_chksum((void *)&em.cmdReq, sizeof(em.cmdReq)));
73-
74-
// Print for debug
75-
int debug = 0;
76-
if (debug){
77-
uint8_t *p = (uint8_t*)&em.adr;
78-
for(size_t i=0; i < (sizeof(em) - offsetof(struct ems, adr)); i+=8){
79-
for(int j=0; j<8; j++){
80-
printf("%02x ", *p++);
81-
}
82-
printf("\n");
83-
}
84-
}
85-
86-
87-
88-
return (uint8_t*)&em.adr;
89-
5+
// #include "otsdaq-mu2e-calorimeter/FEInterfaces/ROCCalorimeterInterface.h"
6+
7+
// #include "otsdaq-mu2e/FEInterfaces/ROCPolarFireCoreInterface.h"
8+
9+
uint8_t* MZB_Encode_CMD_Command_raw(MZB_OSCMDCODE_t cmdCode, float* params)
10+
{
11+
int i;
12+
13+
// Create structure and fill only to ease the checksum calculation
14+
15+
#ifdef GNU_COMP
16+
static struct __attribute__((__packed__)) ems
17+
{
18+
#else
19+
__packed __align(4) struct ems
20+
{
21+
#endif
22+
short dummy;
23+
short adr;
24+
25+
#ifdef GNU_COMP
26+
struct __attribute__((__packed__))
27+
{
28+
#else
29+
__packed struct
30+
{
31+
#endif
32+
unsigned short functionReq_tag; // 'CD'
33+
unsigned short functionReq;
34+
float P[CT_MAXP];
35+
36+
#ifdef GNU_COMP
37+
// } __attribute__((packed, aligned(4)))
38+
} __attribute__((aligned(4)))
39+
#else
40+
}
41+
#endif
42+
cmdReq;
43+
unsigned chksum;
44+
#ifdef GNU_COMP
45+
// } __attribute__((packed, aligned(4)))
46+
} __attribute__((aligned(4)))
47+
#else
48+
}
49+
#endif
50+
em;
51+
52+
// *** Fill the structure ***
53+
54+
em.adr = offsetof(EE_DATABUF_t, functionReq_tag);
55+
56+
// Structure id for the extended command request ('CD')
57+
em.cmdReq.functionReq_tag = 'C' | ('D' << 8);
58+
59+
// Command request (enumerated)
60+
em.cmdReq.functionReq = cmdCode | 0x8000;
61+
62+
// 9 parameters (float)
63+
for(i = 0; i < CT_MAXP; i++)
64+
{
65+
em.cmdReq.P[i] = params[i];
66+
}
67+
68+
// Checksum
69+
em.chksum = 1 + (~ees_chksum((void*)&em.cmdReq, sizeof(em.cmdReq)));
70+
71+
// Print for debug
72+
int debug = 0;
73+
if(debug)
74+
{
75+
uint8_t* p = (uint8_t*)&em.adr;
76+
for(size_t i = 0; i < (sizeof(em) - offsetof(struct ems, adr)); i += 8)
77+
{
78+
for(int j = 0; j < 8; j++)
79+
{
80+
printf("%02x ", *p++);
81+
}
82+
printf("\n");
83+
}
84+
}
85+
86+
return (uint8_t*)&em.adr;
9087
}
9188

92-
unsigned ees_chksum(void *ptr, int len) {
93-
unsigned *src = (unsigned*)ptr;
94-
unsigned sum;
95-
unsigned tmp;
89+
unsigned ees_chksum(void* ptr, int len)
90+
{
91+
unsigned* src = (unsigned*)ptr;
92+
unsigned sum;
93+
unsigned tmp;
9694

97-
for(sum=0; len>=4; len-=4)
98-
sum += *src++;
95+
for(sum = 0; len >= 4; len -= 4)
96+
sum += *src++;
9997

100-
if (len) {
101-
tmp = 0;
102-
memcpy(&tmp, src, len);
103-
sum += tmp;
104-
}
98+
if(len)
99+
{
100+
tmp = 0;
101+
memcpy(&tmp, src, len);
102+
sum += tmp;
103+
}
105104

106-
return sum;
105+
return sum;
107106
}
108107

109-
MZB_OSCMDCODE_t mz_string_to_enum(const char* str){
110-
for (size_t i = 0; i < sizeof(code_map) / sizeof(code_map[0]); i++) {
111-
if (code_map[i].str == str) {
112-
return code_map[i].code;
113-
}
114-
}
115-
116-
return SYNTAX_ERROR;
117-
108+
MZB_OSCMDCODE_t mz_string_to_enum(const char* str)
109+
{
110+
for(size_t i = 0; i < sizeof(code_map) / sizeof(code_map[0]); i++)
111+
{
112+
if(code_map[i].str == str)
113+
{
114+
return code_map[i].code;
115+
}
116+
}
117+
118+
return SYNTAX_ERROR;
118119
}

0 commit comments

Comments
 (0)