Skip to content
Snippets Groups Projects
Commit a0fefa28 authored by Thomas Owen James's avatar Thomas Owen James
Browse files

Merge branch 'patch-prescale' of...

Merge branch 'patch-prescale' of ssh://gitlab.cern.ch:7999/scouting-demonstrator/scdaq into patch-prescale
parents 5f066a16 7f7ec794
No related branches found
2 merge requests!59CMSSW json file,!9added configuration option that prescales the DMA packets
......@@ -27,7 +27,7 @@ CXXFLAGS = -std=c++11 -Wall -Wextra -O0 -g -rdynamic -Wconversion
#CXXFLAGS = -std=c++11 -Wall -Wextra -g -rdynamic
CFLAGS = $(CXXFLAGS)
LDFLAGS = -ltbb -ltbbmalloc -lboost_thread -lcurl -pthread
LDFLAGS = -ltbb -ltbbmalloc -lboost_thread -lboost_chrono -lcurl -pthread
CPPFLAGS = -I. -Iwzdma
......
......@@ -98,8 +98,8 @@ void ElasticProcessor::makeCreateIndexRequest(unsigned int run){
void ElasticProcessor::makeAppendToBulkRequest(std::ostringstream &particle_data, char*c){
uint32_t *p = (uint32_t*)c;
uint32_t header = *p++;
int mAcount = (header&header_masks::mAcount)>>header_shifts::mAcount;
int mBcount = (header&header_masks::mBcount)>>header_shifts::mBcount;
int mAcount = (header&packed_format_header_masks::mAcount)>>packed_format_header_shifts::mAcount;
int mBcount = (header&packed_format_header_masks::mBcount)>>packed_format_header_shifts::mBcount;
uint32_t bx=*p++;
uint32_t orbit=*p++;
......
......@@ -13,6 +13,13 @@ struct blockCalo{
uint32_t calo5[8];
};
struct block_calo_packed{
uint32_t header;
uint32_t bx;
uint32_t orbit;
uint32_t frame[56]; //+8 for extra word containing link number;
};
struct blockMuon{
uint32_t orbit[8];
uint32_t bx[8];
......@@ -23,16 +30,113 @@ struct blockMuon{
};
struct bx_map_frame{
uint32_t bx_map_l[8];
uint32_t bx_map_l[8];
};
struct orbit_trailer{
uint32_t beefdead[8];
uint32_t bx_map[14*8];
uint32_t trailer1[8];
uint32_t trailer2[8];
uint32_t beefdead[8];
uint32_t bx_map[14*8];
uint32_t trailer1[8];
uint32_t trailer2[8];
};
struct shiftsCaloTau{
static constexpr uint32_t ET = 0;
static constexpr uint32_t eta = 9;
static constexpr uint32_t phi = 17;
static constexpr uint32_t iso = 25;
};
struct masksCaloJet{
static constexpr uint32_t ET = 0x07ff;
static constexpr uint32_t eta = 0x00ff;
static constexpr uint32_t phi = 0x00ff;
};
struct shiftsCaloJet{
static constexpr uint32_t ET = 0;
static constexpr uint32_t eta = 11;
static constexpr uint32_t phi = 19;
};
struct masksCaloEGamma{
static constexpr uint32_t ET = 0x01ff;
static constexpr uint32_t eta = 0x00ff;
static constexpr uint32_t phi = 0x00ff;
static constexpr uint32_t iso = 0x0003;
};
struct shiftsCaloEGamma{
static constexpr uint32_t ET = 0;
static constexpr uint32_t eta = 9;
static constexpr uint32_t phi = 17;
static constexpr uint32_t iso = 25;
};
struct masksCaloTau{
static constexpr uint32_t ET = 0x01ff;
static constexpr uint32_t eta = 0x00ff;
static constexpr uint32_t phi = 0x00ff;
static constexpr uint32_t iso = 0x0003;
};
struct masksCaloESums{
static constexpr uint32_t ETEt = 0x0fff;//Et of ET object
static constexpr uint32_t ETEttem = 0x0fff;
static constexpr uint32_t ETMinBiasHF = 0x000f;
static constexpr uint32_t HTEt = 0x0fff;//ET of HT object
static constexpr uint32_t HTtowerCount = 0x1fff;
static constexpr uint32_t HTMinBiasHF = 0x0003;
static constexpr uint32_t ETmissEt = 0x0fff;
static constexpr uint32_t ETmissPhi = 0x00ff;
static constexpr uint32_t ETmissASYMET = 0x00ff;
static constexpr uint32_t ETmissMinBiasHF = 0x0003;
static constexpr uint32_t HTmissEt = 0x0fff;
static constexpr uint32_t HTmissPhi = 0x00ff;
static constexpr uint32_t HTmissASYMHT = 0x00ff;
static constexpr uint32_t HTmissMinBiasHF = 0x0003;
static constexpr uint32_t ETHFmissEt = 0x0fff;
static constexpr uint32_t ETHFmissPhi = 0x00ff;
static constexpr uint32_t ETHFmissASYMETHF = 0x00ff;
static constexpr uint32_t ETHFmissCENT = 0x0003;
static constexpr uint32_t HTHFmissEt = 0x0fff;
static constexpr uint32_t HTHFmissPhi = 0x00ff;
static constexpr uint32_t HTHFmissASYMHTHF = 0x00ff;
static constexpr uint32_t HTHFmissCENT = 0x0003;
};
struct shiftsCaloESums{
static constexpr uint32_t ETEt = 0;//Et of ET object
static constexpr uint32_t ETEttem = 12;
static constexpr uint32_t ETMinBiasHF = 28;
static constexpr uint32_t HTEt = 0;//ET of HT object
static constexpr uint32_t HTtowerCount = 12;
static constexpr uint32_t HTMinBiasHF = 28;
static constexpr uint32_t ETmissEt = 0;
static constexpr uint32_t ETmissPhi = 12;
static constexpr uint32_t ETmissASYMET = 20;
static constexpr uint32_t ETmissMinBiasHF = 28;
static constexpr uint32_t HTmissEt = 0;
static constexpr uint32_t HTmissPhi = 12;
static constexpr uint32_t HTmissASYMHT = 20;
static constexpr uint32_t HTmissMinBiasHF = 28;
static constexpr uint32_t ETHFmissEt = 0;
static constexpr uint32_t ETHFmissPhi = 12;
static constexpr uint32_t ETHFmissASYMETHF = 20;
static constexpr uint32_t ETHFmissCENT = 28;
static constexpr uint32_t HTHFmissEt = 0;
static constexpr uint32_t HTHFmissPhi = 12;
static constexpr uint32_t HTHFmissASYMHTHF = 20;
static constexpr uint32_t HTHFmissCENT = 28;
};
struct muon{
uint32_t f; //first word
......@@ -46,30 +150,6 @@ struct block{
muon mu[16];
};
//original format
/*struct masks{
//bx word: 16 bits used for actual bx, MS 4 bits are muon type
//(0xf intermediate, 0x0 final, following 4 bits for link id)
static constexpr uint32_t bx = 0xffff;
static constexpr uint32_t interm = 0x000f;
static constexpr uint32_t linkid = 0x000f;
//masks for muon 64 bits
static constexpr uint32_t phiext = 0x03ff;
static constexpr uint32_t pt = 0x01ff;
static constexpr uint32_t qual = 0x000f;
static constexpr uint32_t etaext = 0x01ff;
static constexpr uint32_t etaextv = 0x00ff;
static constexpr uint32_t etaexts = 0x0100;
static constexpr uint32_t iso = 0x0003;
static constexpr uint32_t chrg = 0x0001;
static constexpr uint32_t chrgv = 0x0001;
static constexpr uint32_t index = 0x007f;
static constexpr uint32_t phi = 0x03ff;
static constexpr uint32_t eta = 0x01ff;
static constexpr uint32_t etav = 0x00ff;
static constexpr uint32_t etas = 0x0100;
};*/
//run3 format --tj
struct masks{
//bx word: 16 bits used for actual bx, MS 4 bits are muon type
......@@ -98,55 +178,66 @@ struct masks{
struct shifts{
//bx word: 16 bits used for actual bx, MS 4 bits are muon type
//(0xf intermediate, 0x0 final, following 4 bits for link id)
static constexpr uint32_t bx = 0;
static constexpr uint32_t interm = 31; //updated for new run3 format //tj
static constexpr uint32_t bx = 0;
static constexpr uint32_t interm = 31; //updated for new run3 format //tj
//shifts for muon 64 bits
static constexpr uint32_t phiext = 0;
static constexpr uint32_t pt = 10;
static constexpr uint32_t qual = 19;
static constexpr uint32_t etaext = 23;
static constexpr uint32_t iso = 0;
static constexpr uint32_t chrg = 2;
static constexpr uint32_t chrgv = 3;
static constexpr uint32_t index = 4;
static constexpr uint32_t phi = 11;
static constexpr uint32_t eta = 21;
static constexpr uint32_t phiext = 0;
static constexpr uint32_t pt = 10;
static constexpr uint32_t qual = 19;
static constexpr uint32_t etaext = 23;
static constexpr uint32_t iso = 0;
static constexpr uint32_t chrg = 2;
static constexpr uint32_t chrgv = 3;
static constexpr uint32_t index = 4;
static constexpr uint32_t phi = 11;
static constexpr uint32_t eta1 = 13;
static constexpr uint32_t eta2 = 22;
static constexpr uint32_t ptuncon = 21;
static constexpr uint32_t impact = 30;
static constexpr uint32_t impact = 30;
};
struct header_shifts{
struct packed_format_header_shifts{
static constexpr uint32_t bxmatch = 24;
static constexpr uint32_t mAcount = 16;
static constexpr uint32_t orbitmatch = 8;
static constexpr uint32_t warningTestEnabled = 8;
static constexpr uint32_t mBcount = 0;
};
struct header_masks{
static constexpr uint32_t bxmatch = 0xff << header_shifts::bxmatch;
static constexpr uint32_t mAcount = 0x0f << header_shifts::mAcount;
static constexpr uint32_t orbitmatch = 0xff << header_shifts::orbitmatch;
static constexpr uint32_t mBcount = 0x0f << header_shifts::mBcount;
struct packed_format_header_masks{
static constexpr uint32_t bxmatch = 0x00ff << packed_format_header_shifts::bxmatch;
static constexpr uint32_t mAcount = 0x000f << packed_format_header_shifts::mAcount;
static constexpr uint32_t warningTestEnabled = 0x0001<<packed_format_header_shifts::warningTestEnabled;
static constexpr uint32_t orbitmatch = 0x00ff << packed_format_header_shifts::orbitmatch;
static constexpr uint32_t mBcount = 0x000f << packed_format_header_shifts::mBcount;
};
struct gmt_scales{
static constexpr float pt_scale = 0.5;
static constexpr float ptunconstrained_scale = 1.0;
static constexpr float phi_scale = static_cast<float>(2.*M_PI/576.);
static constexpr float eta_scale = static_cast<float>(0.0870/8.); //9th MS bit is sign
static constexpr float phi_range = M_PI;
};
struct calo_scales{
static constexpr float phi_scale = static_cast<float>(2.*M_PI/144.);
static constexpr float eta_scale = 0.0435;
static constexpr float et_scale = 0.5;
};
struct constants{
static constexpr uint32_t deadbeef = 0xdeadbeef;
static constexpr uint32_t beefdead = 0xbeefdead;
static constexpr uint32_t intermediate_marker= 0x0000000f;
static constexpr uint32_t orbit_trailer_size = 544;
static constexpr uint32_t orbit_header_size = 32;
static constexpr uint32_t dma_trailer_size = 32;
static constexpr uint32_t deadbeef = 0xdeadbeef;
static constexpr uint32_t beefdead = 0xbeefdead;
static constexpr uint32_t intermediate_marker = 0x0000000f;
static constexpr uint32_t orbit_trailer_size = 544;
static constexpr uint32_t orbit_header_size = 32;
static constexpr uint32_t dma_trailer_size = 32;
//Note: total number of bytes of overhead per packet is:
// (orbit_trailer_size+orbit_header_size)*NOrbitsPerDMAPacket + dma_trailer_size
static constexpr uint32_t intermediate = 0x00000001;
static constexpr uint32_t final = 0x00000001;
static constexpr uint32_t intermediate = 0x00000001;
static constexpr uint32_t final = 0x00000001;
};
......
......@@ -105,6 +105,7 @@ int run_pipeline( int nbThreads, ctrl& control, config& conf )
int main( int argc, char* argv[] ) {
(void)(argc);
(void)(argv);
int retval = 0;
if(argc < 2){
LOG(DEBUG) << "no arguments provided to scdaq, try --help";
......@@ -132,7 +133,7 @@ if(argc < 2){
try {
config conf(argv[2]);
conf.print();
LOG(DEBUG) << "configuration loaded";
LOG(DEBUG) << "Configuration loaded";
ctrl control;
// tbb::tick_count mainStartTime = tbb::tick_count::now();
......@@ -157,15 +158,32 @@ if(argc < 2){
int nbThreads = conf.getNumThreads();
tbb::task_scheduler_init init( nbThreads );
if (!run_pipeline (nbThreads, control, conf))
return 1;
retval = 0;
try {
tbb::task_scheduler_init init( nbThreads );
if (!run_pipeline (nbThreads, control, conf)) {
retval = 1;
// Will terminate with errorocde set
}
} catch(std::exception& e) {
LOG(ERROR) << "Error in pipelines. Error text is: \"" << e.what() << "\"";
retval = 1;
// Will terminate with errorocde set
}
LOG(DEBUG) << "Terminating the internal TCP server.";
io_service.stop();
if (!t.try_join_for(boost::chrono::milliseconds(2000))) {
LOG(ERROR) << "Failed to terminate the internal TCP server, the program may crash on exit.";
} else {
LOG(DEBUG) << "Internal TCP server is terminated.";
}
// utility::report_elapsed_time((tbb::tick_count::now() - mainStartTime).seconds());
return retval;
return 0;
} catch(std::exception& e) {
LOG(ERROR) << "error occurred. error text is :\"" << e.what() << "\"";
LOG(ERROR) << "Error occurred. error text is: \"" << e.what() << "\"";
return 1;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment