Skip to content

Commit

Permalink
Merge pull request #38 from HGCDAQ/shift-July15
Browse files Browse the repository at this point in the history
Adding more hexaboards for readout board 3
  • Loading branch information
andreypz authored Jul 15, 2017
2 parents 0128db0 + 9d31862 commit e91c56c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 22 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PROJECT( EUDAQ )
# project version
SET( ${PROJECT_NAME}_VERSION_MAJOR 1 )
SET( ${PROJECT_NAME}_VERSION_MINOR 6 )
SET( ${PROJECT_NAME}_VERSION_PATCH 6 )
SET( ${PROJECT_NAME}_VERSION_PATCH 8 )

# some macros are redefined to keep compatability with CMake 2.6
include(${PROJECT_SOURCE_DIR}/cmake/CMakeCompatibility.cmake)
Expand Down
17 changes: 11 additions & 6 deletions producers/cmshgcal/onlinemon/src/AhcalHistos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ AhcalHistos::AhcalHistos(eudaq::StandardPlane p, RootMonitor *mon)

sprintf(out, "%s %i Number of Hits", _sensor.c_str(), _id);
sprintf(out2, "h_raw_nHits_%s_%i", _sensor.c_str(), _id);
_nHits = new TH1I(out2, out, 20, 0, 20);
_nHits = new TH1I(out2, out, 50, 0, 50);
SetHistoAxisLabelx(_nHits, "Number of Hits above ZS");
//_nHits->SetStats(1);

/* Not used
sprintf(out, "%s %i Number of Invalid Hits", _sensor.c_str(), _id);
sprintf(out2, "h_nbadHits_%s_%i", _sensor.c_str(), _id);
_nbadHits = new TH1I(out2, out, 50, 0, 50);
Expand All @@ -62,7 +63,7 @@ AhcalHistos::AhcalHistos(eudaq::StandardPlane p, RootMonitor *mon)
sprintf(out2, "h_nhotpixels_%s_%i", _sensor.c_str(), _id);
_nHotPixels = new TH1I(out2, out, 50, 0, 50);
SetHistoAxisLabelx(_nHotPixels, "n_{HotPixels}");

*/

// make a plane array for calculating e..g hotpixels and occupancy

Expand Down Expand Up @@ -99,11 +100,15 @@ int AhcalHistos::zero_plane_array() {
void AhcalHistos::Fill(const eudaq::StandardPlane &plane) {
// std::cout<< "FILL with a plane." << std::endl;

if (_nHits != NULL)
_nHits->Fill(plane.HitPixels());
if ((_nbadHits != NULL)) {
_nbadHits->Fill(0);
if (_nHits != NULL) {
if (plane.HitPixels() >= 50)
_nHits->Fill(49); // overflow
else
_nHits->Fill(plane.HitPixels());
}
//if ((_nbadHits != NULL)) {
//_nbadHits->Fill(0);
//}


for (unsigned int pix = 0; pix < plane.HitPixels(); pix++)
Expand Down
13 changes: 12 additions & 1 deletion producers/cmshgcal/onlinemon/src/HexagonHistos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ void HexagonHistos::Fill(const eudaq::StandardPlane &plane) {
const int pixel_y = plane.GetY(pix);
const int ch = _ski_to_ch_map.find(make_pair(pixel_x,pixel_y))->second;

// ----- Maskig noisy channels ----
// These are noisy pixels in every hexaboard. Let's just mask them from DQM:
if (pixel_x==3 && (pixel_y==32 || pixel_y==48))
continue;
Expand All @@ -236,7 +237,17 @@ void HexagonHistos::Fill(const eudaq::StandardPlane &plane) {
plane.Sensor()=="HexaBoard-RDB3" && plane.ID()==1 ) &&
( pixel_x==0 && pixel_y==58 ) )
continue;


if ( plane.Sensor()=="HexaBoard-RDB3" && plane.ID()==0 &&
pixel_x==1 && pixel_y==4 )
continue;

if ( plane.Sensor()=="HexaBoard-RDB3" && plane.ID()==2 &&
pixel_x==0 && pixel_y==22 )
continue;

// -------- end masking -------------

//std::cout<<" We are getting a pixel with pix="<<pix
// <<"\t in hexagon channel:"<<ch<<", ski="<<pixel_x<<" Ch="<<pixel_y<<std::endl;

Expand Down
30 changes: 16 additions & 14 deletions producers/cmshgcal/src/HexaBoardConverterPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

const size_t RAW_EV_SIZE_32 = 123152;

const size_t nSkiPerBoard=16;
const uint32_t skiMask = 0x0000FFFF;
const size_t nSkiPerBoard[2] = {16,24};
const uint32_t skiMask[2] = {0x0000FFFF, 0x00FFFFFF};
//const uint32_t skiMask = 0;

const int nSCA=13;
Expand All @@ -27,7 +27,7 @@ const int nSCA=13;
//( these are not used anymore, because ZS is done with HA bit )
//const int ped = 250; // pedestal. It is now calculated as median from all channels in hexaboard
//const int noi = 10; // noise
const int thresh = 250; // ZS threshold (above pedestal)
//const int thresh = 250; // ZS threshold (above pedestal)

// Size of ZS data ()per channel
const char hitSizeZS = 31;
Expand Down Expand Up @@ -91,10 +91,6 @@ namespace eudaq {
const unsigned nBlocks = rev->NumBlocks();
std::cout<<"Number of Raw Data Blocks: "<<nBlocks<<std::endl;

const unsigned nPlanes = nSkiPerBoard/4;
std::cout<<"Number of Planes: "<<nPlanes<<std::endl;


int RDBOARD = 0;

for (unsigned blo=0; blo<nBlocks; blo++){
Expand All @@ -113,6 +109,10 @@ namespace eudaq {
std::memcpy(&brdID[0], &bl[0], bl.size());
RDBOARD = brdID[0];
std::cout<<"RDBRD ID = "<<RDBOARD<<std::endl;

const unsigned nPlanes = nSkiPerBoard[RDBOARD-2]/4;
std::cout<<"Number of Planes: "<<nPlanes<<std::endl;

continue;
}
else if (blo==1 && bl.size()!=RAW_EV_SIZE_32) {
Expand All @@ -125,10 +125,10 @@ namespace eudaq {
rawData32.resize(bl.size() / sizeof(uint32_t));
std::memcpy(&rawData32[0], &bl[0], bl.size());

const std::vector<std::array<unsigned int,1924>> decoded = decode_raw_32bit(rawData32, skiMask);
const std::vector<std::array<unsigned int,1924>> decoded = decode_raw_32bit(rawData32, RDBOARD);

// Here we parse the data per hexaboard and per ski roc and only leave meaningful data (Zero suppress and finding main frame):
const std::vector<std::vector<unsigned short>> dataBlockZS = GetZSdata(decoded);
const std::vector<std::vector<unsigned short>> dataBlockZS = GetZSdata(decoded, RDBOARD);

for (unsigned h = 0; h < dataBlockZS.size(); h++){

Expand Down Expand Up @@ -244,7 +244,10 @@ namespace eudaq {
}


std::vector<std::array<unsigned int,1924>> decode_raw_32bit(std::vector<uint32_t>& raw, const uint32_t ch_mask) const{
std::vector<std::array<unsigned int,1924>> decode_raw_32bit(std::vector<uint32_t>& raw, const int board_id) const{

const uint32_t ch_mask = skiMask[board_id-2];

//std::cout<<"In decoder"<<std::endl;
//printf("\t SkiMask: 0x%08x; Length of Raw: %d\n", ch_mask, raw.size());

Expand All @@ -253,7 +256,6 @@ namespace eudaq {
EUDAQ_DEBUG("You extarnal mask ("+eudaq::to_hex(ch_mask)+") does not agree with the one found in data ("+eudaq::to_hex(raw[0])+")");



//for (int b=0; b<2; b++)
//std::cout<< boost::format("Pos: %d Word in Hex: 0x%08x ") % b % raw[b]<<std::endl;

Expand All @@ -266,7 +268,7 @@ namespace eudaq {
//std::cout<<"ski mask: "<<ski_mask<<std::endl;

const int mask_count = ski_mask.count();
if (mask_count!= nSkiPerBoard) {
if (mask_count!= nSkiPerBoard[board_id-2]) {
EUDAQ_WARN("The mask does not agree with expected number of SkiRocs. Mask count:"+ eudaq::to_string(mask_count));
}

Expand Down Expand Up @@ -356,15 +358,15 @@ namespace eudaq {
}
*/

std::vector<std::vector<unsigned short>> GetZSdata(const std::vector<std::array<unsigned int,1924>> &decoded) const{
std::vector<std::vector<unsigned short>> GetZSdata(const std::vector<std::array<unsigned int,1924>> &decoded, const int board_id) const{

//std::cout<<"In GetZSdata() method"<<std::endl;

const int nSki = decoded.size();
const int nHexa = nSki/4;
if (nSki%4!=0)
EUDAQ_WARN("Number of SkiRocs is not right: "+ eudaq::to_string(nSki));
if (nHexa != nSkiPerBoard/4)
if (nHexa != nSkiPerBoard[board_id-2]/4)
EUDAQ_WARN("Number of HexaBoards is not right: "+ eudaq::to_string(nHexa));

// A vector per HexaBoard of vector of Hits from 4 ski-rocs
Expand Down

0 comments on commit e91c56c

Please sign in to comment.