ATLAS Offline Software
Loading...
Searching...
No Matches
ExtractCondensedIBLhits.cxx File Reference

implementation file for utility functions shiftRight and DivideHITS More...

#include "ExtractCondensedIBLhits.h"
#include <iostream>
Include dependency graph for ExtractCondensedIBLhits.cxx:

Go to the source code of this file.

Functions

unsigned int shiftRight (unsigned int &number, const int shifting)
int shiftRight (int &number, const int shifting)
unsigned int divideHits (unsigned int &sourceWord, const unsigned int startBit, const unsigned int endBit)
 Push bits from a sourceWord to a target word, returns true if successful.
int divideHits (int &sourceWord, const unsigned int startBit, const unsigned int endBit)

Detailed Description

implementation file for utility functions shiftRight and DivideHITS

Author
Laura Franconi
Date
10 July 2013

Definition in file ExtractCondensedIBLhits.cxx.

Function Documentation

◆ divideHits() [1/2]

int divideHits ( int & sourceWord,
const unsigned int startBit,
const unsigned int endBit )

Definition at line 53 of file ExtractCondensedIBLhits.cxx.

53 {
54 int targetWord = shiftRight (sourceWord, startBit);
55 // cout << "source Word: " <<hex << sourceWord << "\t"<< dec << "start bit: "<< startBit << "\t"<< "end bit: " << endBit << "\t";
56 int length = endBit - startBit + 1;
57 // std::cout << "length: " << length;
58 unsigned int mask = 0;
59 switch (length)
60 {
61 case 8: mask = 0xFF; // mask for the tot bits in the hitword
62 break;
63 case 4: mask = 0xF; // mask for the row bits in the hitword
64 break;
65 }
66 if (mask == 0) {
67 std::cout << "error: length of the info is not correct " << std::endl;
68 }
69 targetWord &= mask;
70 //std::cout << " => after shifting & masking: " << std::hex << targetWord<< std::dec << std::endl;
71
72 return targetWord;
73}
unsigned int shiftRight(unsigned int &number, const int shifting)
double length(const pvec &v)

◆ divideHits() [2/2]

unsigned int divideHits ( unsigned int & sourceWord,
const unsigned int startBit,
const unsigned int endBit )

Push bits from a sourceWord to a target word, returns true if successful.

Definition at line 28 of file ExtractCondensedIBLhits.cxx.

28 {
29 unsigned int targetWord = shiftRight (sourceWord, startBit);
30 // cout << "source Word: " << std::hex << sourceWord << "\t"<< std::dec << "start bit: "<< startBit << "\t"<< "end bit: " << endBit << "\t";
31 int length = endBit - startBit + 1;
32 // std::cout << "length: " << length;
33 unsigned int mask = 0;
34 switch (length)
35 {
36 case 7: mask = 0x7F; // mask for the column bits in the hitword
37 break;
38 case 8: mask = 0xFF; // mask for the tot bits in the hitword
39 break;
40 case 9: mask = 0x1FF; // mask for the row bits in the hitword
41 break;
42 }
43 if (mask == 0) {
44 std::cout << "error: length of the info is not correct " << std::endl;
45 }
46 targetWord &= mask;
47 //std::cout << " => after shifting & masking: " << std::hex << targetWord<< std::dec << std::endl;
48
49 return targetWord;
50}

◆ shiftRight() [1/2]

int shiftRight ( int & number,
const int shifting )

Definition at line 22 of file ExtractCondensedIBLhits.cxx.

22 {
23 return number >> shifting;
24}
std::string number(const double &d, const std::string &s)
Definition utils.cxx:186

◆ shiftRight() [2/2]

unsigned int shiftRight ( unsigned int & number,
const int shifting )

Definition at line 17 of file ExtractCondensedIBLhits.cxx.

17 {
18 return number >> shifting;
19}