28 #define LOG std::cout << "TCS::DeltaRSqrIncl1Charge: "
52 if(parameter(
"MaxTob").
value() > 0) {
53 p_NumberLeading1 = parameter(
"MaxTob").value();
54 p_NumberLeading2 = parameter(
"MaxTob").value();
56 p_NumberLeading1 = parameter(
"InputWidth").value();
57 p_NumberLeading2 = parameter(
"InputWidth").value();
59 p_OneBarrel = parameter(
"RequireOneBarrel").value();
61 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
62 p_DeltaRMin[
i] = parameter(
"DeltaRMin",
i).value();
63 p_DeltaRMax[
i] = parameter(
"DeltaRMax",
i).value();
65 p_MinET1 = parameter(
"MinET1").value();
66 p_MinET2 = parameter(
"MinET2").value();
72 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
82 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
83 std::string hname_accept =
"hDeltaRSqrIncl1Charge_accept_bit"+
std::to_string(
static_cast<int>(
i));
84 std::string hname_reject =
"hDeltaRSqrIncl1Charge_reject_bit"+
std::to_string(
static_cast<int>(
i));
86 bookHist(m_histAccept, hname_accept,
"DR", 100, std::sqrt(p_DeltaRMin[
i]), std::sqrt(p_DeltaRMax[
i]));
87 bookHist(m_histReject, hname_reject,
"DR", 100, std::sqrt(p_DeltaRMin[
i]), std::sqrt(p_DeltaRMax[
i]));
89 bookHist(m_histAcceptEta1Eta2, hname_accept,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
90 bookHist(m_histRejectEta1Eta2, hname_reject,
"ETA vs ETA", 100, -70, 70, 100, -70, 70);
100 const std::vector<TCS::TOBArray *> & output,
104 if(input.size() == 1) {
106 tob1 != input[0]->end() &&
distance( input[0]->
begin(), tob1) < p_NumberLeading1;
112 tob2 != input[0]->end() &&
distance( input[0]->
begin(), tob2) < p_NumberLeading2;
117 if (p_OneBarrel &&
parType_t(std::abs((*tob1)->eta())) > 10 &&
parType_t(std::abs((*tob2)->eta())) > 10 )
continue;
119 unsigned int deltaR2 = calcDeltaR2BW( *tob1, *tob2 );
121 int charge1 = (*tob1)->charge();
122 int charge2 = (*tob2)->charge();
123 int totalCharge = charge1 + charge2;
124 bool acceptCharge =
true;
125 if ( std::abs(totalCharge) == 2 ) { acceptCharge =
false; }
126 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
129 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
130 const bool fillReject = fillHistos() and not fillAccept;
131 const bool alreadyFilled = decision.
bit(
i);
136 if(fillAccept and not alreadyFilled) {
137 fillHist1D(m_histAccept[
i],std::sqrt(
static_cast<float>(
deltaR2)));
138 fillHist2D(m_histAcceptEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
139 }
else if(fillReject) {
140 fillHist1D(m_histReject[
i],std::sqrt(
static_cast<float>(
deltaR2)));
141 fillHist2D(m_histRejectEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
149 for (
unsigned int i=0;
i < numberOutputBits(); ++
i) {
150 output[
i]->setAmbiguityFlag(hasAmbiguousInputs);
153 TCS_EXCEPTION(
"DeltaRSqrIncl1Charge alg must have either 1 input, but got " << input.size());
160 const std::vector<TCS::TOBArray *> & output,
163 if(input.size() == 1) {
165 tob1 != input[0]->end() &&
distance( input[0]->
begin(), tob1) < p_NumberLeading1;
171 tob2 != input[0]->end() &&
distance( input[0]->
begin(), tob2) < p_NumberLeading2;
176 if (p_OneBarrel &&
parType_t(std::abs((*tob1)->eta())) > 10 &&
parType_t(std::abs((*tob2)->eta())) > 10 )
continue;
178 unsigned int deltaR2 = calcDeltaR2( *tob1, *tob2 );
180 int charge1 = (*tob1)->charge();
181 int charge2 = (*tob2)->charge();
182 int totalCharge = charge1 + charge2;
183 bool acceptCharge =
true;
184 if ( std::abs(totalCharge) == 2 ) { acceptCharge =
false; }
185 for(
unsigned int i=0;
i<numberOutputBits(); ++
i) {
188 const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(
i) :
accept);
189 const bool fillReject = fillHistos() and not fillAccept;
190 const bool alreadyFilled = decision.
bit(
i);
195 if(fillAccept and not alreadyFilled) {
196 fillHist1D(m_histAccept[
i],std::sqrt(
static_cast<float>(
deltaR2)));
197 fillHist2D(m_histAcceptEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
198 }
else if(fillReject) {
199 fillHist1D(m_histReject[
i],std::sqrt(
static_cast<float>(
deltaR2)));
200 fillHist2D(m_histRejectEta1Eta2[
i],(*tob1)->eta(),(*tob2)->eta());
207 TCS_EXCEPTION(
"DeltaRSqrIncl1Charge alg must have either 1 input, but got " << input.size());