Plotting bit masks?


Is there a simple way of plotting histograms of bit masks?

The trigger bits are stored in an integer and I would like to visualise how often the different triggers fired, like in a bar chart.

Many thanks,

Do something like

TH1I *h = new TH1I("h","trigger bit count",32,1,33); //loop on your data and for each data loop on all bits for (.....) { int mydata = ??? UInt_t mask =1; for (int i=0;i<32;i++) { if (data & mask) h->AddBinContent(i,1); mask *= 2; } }