1#ifndef DISCRETEINPUTS_H
2#define DISCRETEINPUTS_H
22 bool operator<(
const EcalTP &other)
const {
return tp > other.tp; }
23 void fill(
int _tid,
int _tp) {
32 void fill(
int _tid,
int _tp,
int _layer,
int _module,
int _cell,
41 void writeToFile(FILE *file)
const {
42 fwrite(&tp,
sizeof(uint8_t), 1, file);
43 fwrite(&tid,
sizeof(uint32_t), 1, file);
44 fwrite(&layer,
sizeof(uint32_t), 1, file);
45 fwrite(&module,
sizeof(uint32_t), 1, file);
46 fwrite(&cell,
sizeof(uint32_t), 1, file);
47 fwrite(&tp_lin,
sizeof(uint32_t), 1, file);
49 void readFromFile(FILE *file) {
50 fread(&tp,
sizeof(uint8_t), 1, file);
51 fread(&tid,
sizeof(uint32_t), 1, file);
52 fread(&layer,
sizeof(uint32_t), 1, file);
53 fread(&module,
sizeof(uint32_t), 1, file);
54 fread(&cell,
sizeof(uint32_t), 1, file);
55 fread(&tp_lin,
sizeof(uint32_t), 1, file);
60void writeManyToFile(
const std::vector<T> &objs, FILE *file) {
61 uint32_t number = objs.size();
62 fwrite(&number, 4, 1, file);
63 for (uint32_t i = 0; i < number; ++i) objs[i].writeToFile(file);
67void readManyFromFile(std::vector<T> &objs, FILE *file) {
69 fread(&number, 4, 1, file);
71 for (uint32_t i = 0; i < number; ++i) objs[i].readFromFile(file);