ATLAS Offline Software
Loading...
Searching...
No Matches
TRT_LoLumRawData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6
8// TRT_LoLumRawData.cxx
9// Implementation file for class TRT_LoLumRawData
11// (c) ATLAS Detector software
13// Version 1.0 13/08/2002 Veronique Boisvert
14// Implementation provided by A. Zalite, February 2003
16
19
20
21
22// default constructor
24 TRT_RDORawData(Identifier(), 0) //call base-class constructor
25{}
26
27// Constructor with parameters:
29 const unsigned int word) :
30 TRT_RDORawData( rdoId, word) //call base-class constructor
31{}
32
33void TRT_LoLumRawData::findLargestIsland(unsigned int word, Island& island) {
34 unsigned long mask = 0x02000000; // 0 0 10000000 0 00000000 0 00000000
35 unsigned int bestLength = 0;
36 unsigned int currentLength = 0;
37
38 // set 4 last bits to zero (to match data and MC bitmasks)
39 unsigned int wordLE = word & m_maskFourLastBits;
40
41 mask >>=1; // 0 0 01000000 0 00000000 0 00000000
42 bool SawZero = false;
43 unsigned int k = 1;
44 island.m_leadingEdge=0, island.m_trailingEdge=0;
45 unsigned int currentLeadingEdge=0, currentTrailingEdge=0;
46
47 // shift bitmask to the right until end
48 while (true) {
49 if (!(wordLE & mask) && !SawZero) SawZero = true; // search for the first 0 to 1 transition
50 if (SawZero) {
51 if (wordLE & mask){
52 if (currentLength==0) currentLeadingEdge=k;
53 currentTrailingEdge=k;
54 ++currentLength;
55 } else { // remember longest island, ignore islands of length 1 which are very likely noise
56 if (currentLength >= bestLength && currentLeadingEdge<18 && currentLength > 1) {
57 bestLength = currentLength;
58 island.m_leadingEdge = currentLeadingEdge;
59 island.m_trailingEdge = currentTrailingEdge;
60 }
61 currentLength = 0;
62 }
63 }
64 mask >>= 1;
65 if (!(mask & m_maskThreeLastBits)) break; // stop after checking 20 LT bits
66 if (k == 7 || k == 15) mask >>= 1; // ignore HT bits
67 assert(k < 20);
68 ++k;
69 }
70 assert(k == 20);
71 // avoid very early TE, most likely from previous BX. Hit will still be used for tracking if it has a valid LE
72 if (island.m_trailingEdge < 8) island.m_trailingEdge = 0;
73}
static constexpr unsigned int m_maskThreeLastBits
static constexpr unsigned int m_maskFourLastBits
static void findLargestIsland(unsigned int word, Island &island)
TRT_RDORawData(const Identifier rdoId, const unsigned int word)