Skip to content
Snippets Groups Projects
Commit 05889fb9 authored by Thomas Owen James's avatar Thomas Owen James :speech_balloon:
Browse files

fixed orbit numbers for bx's in gap and added verbosity option

parent b434a498
No related branches found
No related tags found
2 merge requests!59CMSSW json file,!12fixed orbit numbers for bx's in gap and added verbosity option
Pipeline #4396210 passed
...@@ -95,3 +95,6 @@ quality_cut:12 ...@@ -95,3 +95,6 @@ quality_cut:12
# Pipeline settings # Pipeline settings
threads:8 threads:8
#verbosity level, currently supports 0 and 1
verbosity:0
...@@ -16,7 +16,20 @@ if __name__ == "__main__": ...@@ -16,7 +16,20 @@ if __name__ == "__main__":
for f in onlyfiles: for f in onlyfiles:
full_filename = join('/fff/ramdisk/scdaq', f) full_filename = join('/fff/ramdisk/scdaq', f)
outfile = f+'.bz2' outfile = f+'.bz2'
dest_name = join('/fff/output/scdaq',outfile)
if f[7:10] == 'GMT':
run_number = f[10:16]
elif f[7:11] == 'CALO':
run_number = f[11:17]
else:
run_number = '000000'
dest_path = join('/store/lustre/l1scout/scdaq/',run_number)
if not (os.path.exists(dest_path)):
os.mkdir(dest_path)
dest_name = join(dest_path,outfile)
command = "lbzip2 "+full_filename+" -c > "+dest_name command = "lbzip2 "+full_filename+" -c > "+dest_name
print "compressing "+full_filename print "compressing "+full_filename
retval = os.system(command) retval = os.system(command)
......
...@@ -121,6 +121,10 @@ public: ...@@ -121,6 +121,10 @@ public:
bool getDoZS() const { bool getDoZS() const {
return (true ? vmap.at("doZS") == "yes" : false); return (true ? vmap.at("doZS") == "yes" : false);
} }
bool getVerbosity() const {
std::string v = vmap.at("verbosity");
return boost::lexical_cast<uint32_t>(v.c_str());
}
private: private:
std::map<std::string,std::string> vmap; std::map<std::string,std::string> vmap;
......
...@@ -8,10 +8,12 @@ struct ctrl { ...@@ -8,10 +8,12 @@ struct ctrl {
std::atomic<bool> running; std::atomic<bool> running;
/* Always write data to a file regardless of the run status */ /* Always write data to a file regardless of the run status */
bool output_force_write; bool output_force_write;
bool verbosity;
uint64_t max_file_size; uint64_t max_file_size;
int packets_per_report; int packets_per_report;
int n_orbits_per_dma_packet; int n_orbits_per_dma_packet;
std::atomic<uint32_t> orbit_trailer_error_count; std::atomic<uint32_t> orbit_trailer_error_count;
std::atomic<uint64_t> packet_count; std::atomic<uint64_t> packet_count;
std::atomic<uint64_t> excessOrbitsPerPacketCount;
}; };
#endif #endif
...@@ -62,7 +62,9 @@ std::vector<unsigned int> StreamProcessor::CountBX(Slice& input, char* rd_ptr, b ...@@ -62,7 +62,9 @@ std::vector<unsigned int> StreamProcessor::CountBX(Slice& input, char* rd_ptr, b
if(bl->orbit[0]==constants::beefdead){ // found orbit trailer if(bl->orbit[0]==constants::beefdead){ // found orbit trailer
orbit_trailer *ot = (orbit_trailer*)(rd_ptr); orbit_trailer *ot = (orbit_trailer*)(rd_ptr);
for (unsigned int k = 0; k < (14*8); k++){ // 14*8 = 14 frames, 8 links of orbit trailer containing BX hitmap for (unsigned int k = 0; k < (14*8); k++){ // 14*8 = 14 frames, 8 links of orbit trailer containing BX hitmap
bit_check(&bx_vect, ot->bx_map[k], k*32); //bit_check(&bx_vect, ot->bx_map[k], (k*32 + 1));// +1 added to account for BX counting starting at 1, commented out until firmware fix for BX number being one more in the trailer than the CMS convention
bit_check(&bx_vect, ot->bx_map[k], (k*32));
} }
return bx_vect; return bx_vect;
} }
...@@ -94,10 +96,12 @@ uint32_t StreamProcessor::FillOrbitCalo(std::vector<unsigned int>& bx_vect, char ...@@ -94,10 +96,12 @@ uint32_t StreamProcessor::FillOrbitCalo(std::vector<unsigned int>& bx_vect, char
blockCalo *bl = reinterpret_cast<blockCalo*>(rd_ptr); blockCalo *bl = reinterpret_cast<blockCalo*>(rd_ptr);
if(bl->calo0[0]==constants::beefdead){break;} // orbit trailer has been reached, end of orbit data if(bl->calo0[0]==constants::beefdead){break;} // orbit trailer has been reached, end of orbit data
uint32_t bx = uint32_t{bx_vect[relbx]}; uint32_t bx = uint32_t{bx_vect[relbx]};
uint32_t orbit = uint32_t{orbit_header.first};
if (bx > 3554){orbit--;} //fix for the fact that bx 3555 - 3564 are from the previous orbit
uint32_t header = uint32_t{orbit_header.second}; //header can be added to later uint32_t header = uint32_t{orbit_header.second}; //header can be added to later
memcpy(wr_ptr,(char*)&header,4); wr_ptr+=4; memcpy(wr_ptr,(char*)&header,4); wr_ptr+=4;
memcpy(wr_ptr,(char*)&bx,4); wr_ptr+=4; memcpy(wr_ptr,(char*)&bx,4); wr_ptr+=4;
memcpy(wr_ptr,(char*)&orbit_header.first,4); wr_ptr+=4; memcpy(wr_ptr,(char*)&orbit,4); wr_ptr+=4;
for(uint32_t i = 0; i < 8; i++){ for(uint32_t i = 0; i < 8; i++){
memcpy(wr_ptr,(char*)&i,4); wr_ptr+=4; //gives link number, can later be used to find object type memcpy(wr_ptr,(char*)&i,4); wr_ptr+=4; //gives link number, can later be used to find object type
memcpy(wr_ptr,(char*)&bl->calo0[i],4); wr_ptr+=4; memcpy(wr_ptr,(char*)&bl->calo0[i],4); wr_ptr+=4;
...@@ -132,12 +136,14 @@ uint32_t StreamProcessor::FillOrbitMuon(std::vector<unsigned int>& bx_vect, char ...@@ -132,12 +136,14 @@ uint32_t StreamProcessor::FillOrbitMuon(std::vector<unsigned int>& bx_vect, char
bool AblocksOn[8]; bool AblocksOn[8];
bool BblocksOn[8]; bool BblocksOn[8];
uint32_t bx = uint32_t {bx_vect[relbx]}; uint32_t bx = uint32_t {bx_vect[relbx]};
if (bx > 3554){orbit--;} //fix for the fact that bx 3555 - 3564 are from the previous orbit
for(unsigned int i = 0; i < 8; i++){ for(unsigned int i = 0; i < 8; i++){
uint32_t bxA = (bl->bx[i] >> shifts::bx) & masks::bx; uint32_t bxA = (bl->bx[i] >> shifts::bx) & masks::bx;
if((bxA != bx) && (i == 0)){ if((bxA != bx) && (i == 0) && (bx<3555) && control.verbosity){ //only prints warning when BX < 3555 i.e from the same orbit
LOG(WARNING) << "BX mismatch, uGMT data word BX = " << std::hex << bxA << LOG(WARNING) << "BX mismatch, uGMT data word BX = " << std::hex << bxA <<
", BX extracted from trailer = "<< bx << ", orbitN is " << std::dec << orbit; ", BX extracted from trailer = "<< bx << ", orbitN is " << std::dec << orbit;
} }
uint32_t pt = uint32_t{(bl->mu1f[i] >> shifts::pt) & masks::pt}; uint32_t pt = uint32_t{(bl->mu1f[i] >> shifts::pt) & masks::pt};
AblocksOn[i]=((pt>0) || (doZS==0)); AblocksOn[i]=((pt>0) || (doZS==0));
...@@ -255,9 +261,15 @@ void StreamProcessor::process(Slice& input, Slice& out) ...@@ -255,9 +261,15 @@ void StreamProcessor::process(Slice& input, Slice& out)
} }
if(orbit_per_packet_count > nOrbitsPerDMAPacket){ if(orbit_per_packet_count > nOrbitsPerDMAPacket){
LOG(WARNING) << "expected DMA trailer word deadbeef, found " if(control.verbosity){
<< std::hex << *dma_trailer_word << ". Orbits per packet count " LOG(WARNING) << "expected DMA trailer word deadbeef, found "
<< orbit_per_packet_count << ", > expected, (" << nOrbitsPerDMAPacket <<") skipping packet."; << std::hex << *dma_trailer_word << ". Orbits per packet count "
<< orbit_per_packet_count << ", > expected, (" << nOrbitsPerDMAPacket <<") skipping packet.";
}
control.excessOrbitsPerPacketCount++;
if(control.excessOrbitsPerPacketCount%10000 == 0){
LOG(WARNING) << "count of packets with excess # orbits " << control.excessOrbitsPerPacketCount;
}
return; return;
} }
} }
......
...@@ -146,6 +146,9 @@ if(argc < 2){ ...@@ -146,6 +146,9 @@ if(argc < 2){
control.packets_per_report = conf.getPacketsPerReport(); control.packets_per_report = conf.getPacketsPerReport();
control.output_force_write = conf.getOutputForceWrite(); control.output_force_write = conf.getOutputForceWrite();
control.n_orbits_per_dma_packet = conf.getNOrbitsPerDMAPacket(); control.n_orbits_per_dma_packet = conf.getNOrbitsPerDMAPacket();
control.verbosity = conf.getVerbosity();
control.excessOrbitsPerPacketCount = 0;
// Firmware needs at least 1MB buffer for DMA // Firmware needs at least 1MB buffer for DMA
if (conf.getDmaPacketBufferSize() < 1024*1024) { if (conf.getDmaPacketBufferSize() < 1024*1024) {
LOG(ERROR) << "dma_packet_buffer_size must be at least 1048576 bytes (1MB), but " << conf.getDmaPacketBufferSize() << " bytes was given. Check the configuration file."; LOG(ERROR) << "dma_packet_buffer_size must be at least 1048576 bytes (1MB), but " << conf.getDmaPacketBufferSize() << " bytes was given. Check the configuration file.";
......
...@@ -94,3 +94,6 @@ quality_cut:12 ...@@ -94,3 +94,6 @@ quality_cut:12
# Pipeline settings # Pipeline settings
threads:8 threads:8
# verbosity level, currently supports 0 and 1
verbosity:1
...@@ -95,3 +95,6 @@ quality_cut:12 ...@@ -95,3 +95,6 @@ quality_cut:12
# Pipeline settings # Pipeline settings
threads:8 threads:8
# verbosity level, currently supports 0 and 1
verbosity:0
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