eTauMultiplicity.cxx 2.54 KB
Newer Older
1
/*
2
  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
4
*/
/*********************************
5
 * eTauMultiplicity.cpp
6
7
8
9
10
11
12
13
14
15
16
 * Created by Carlos Moreno on 05/06/20.
 *
 * @brief algorithm that computes the multiplicity for a specified list and ET threshold
 * line 1: 0 or 1, line 1 and 2 : 2 or more, uses 2 bits
 *
 * @param NumberLeading MinET

**********************************/

#include <cmath>

17
#include "L1TopoAlgorithms/eTauMultiplicity.h"
18
19
20
21
#include "L1TopoCommon/Exception.h"
#include "L1TopoInterfaces/Count.h"

#include "L1TopoEvent/TOBArray.h"
22
#include "L1TopoEvent/eTauTOBArray.h"
23
24
#include "L1TopoEvent/GenericTOB.h"

25
REGISTER_ALG_TCS(eTauMultiplicity)
26
27
28
29

using namespace std;


30
TCS::eTauMultiplicity::eTauMultiplicity(const std::string & name) : CountingAlg(name)
31
32
33
34
35
36
37
{
   
   
   setNumberOutputBits(12); //To-Do: Make this flexible to addapt to the menu. Each counting requires more than one bit

}

38
TCS::eTauMultiplicity::~eTauMultiplicity(){}
39
40
41


TCS::StatusCode
42
TCS::eTauMultiplicity::initialize() { 
43
44
45
46

  m_threshold = getThreshold();

  // book histograms
47
  std::string hname_accept = "heTauMultiplicity_accept_"+m_threshold->name();
48
  bookHist(m_histAccept, hname_accept, "eta vs pT", 150, -100, 100, 30, 0., 20.);
49

50
  hname_accept = "heTauMultiplicity_accept_counts_"+m_threshold->name();
51
  bookHist(m_histAccept, hname_accept, "Counts", 15, 0., 10. );
52
53
54
55
56
57
58

  return StatusCode::SUCCESS;
     
}


TCS::StatusCode
59
TCS::eTauMultiplicity::processBitCorrect( const TCS::InputTOBArray & input,
60
61
62
					 Count & count)

{
63
   return process(input, count);
64
65
66
}

TCS::StatusCode
67
TCS::eTauMultiplicity::process( const TCS::InputTOBArray & input,
68
69
70
71
			       Count & count )
{

  // Grab the threshold and cast it into the right type
72
  auto eTAUThr = dynamic_cast<const TrigConf::L1Threshold_eTAU &>(*m_threshold);
73
74

  // Grab inputs
75
  const eTauTOBArray & etaus = dynamic_cast<const eTauTOBArray&>(input);
76

77
  int counting = 0; 
78
79
  
  // loop over input TOBs
80
81
82
  for(eTauTOBArray::const_iterator etau = etaus.begin();
      etau != etaus.end();
      ++etau ) {
83
    
84
    const GenericTOB gtob(**etau);
85

86
    // Dividing by 4 standing for converting eta from 0.025 to 0.1 granularity as it is defined in the menu as 0.1 gran.
87
    bool passed = gtob.Et() >= eTAUThr.thrValueCounts(gtob.eta()/4);
88

89
90
    if (passed) {
      counting++; 
91
      fillHist2D( m_histAccept[0], gtob.eta(), gtob.EtDouble() );
92
93
94
95
96
97
98
99
100
101
102
103
    }

  }

  fillHist1D( m_histAccept[1], counting);
  
  // Pass counting to TCS::Count object - output bits are composed there
  count.setSizeCount(counting);
  
  return TCS::StatusCode::SUCCESS;

}