12 , {
"cutsWithoutCalo",
false}
13 , {
"MVAWithCalo",
false}
14 , {
"MVAWithoutCalo",
false}
15 , {
"MVAWithoutCaloAndMinTrack",
false}
33 , m_useCutsTrigger(
true)
34 , m_useCutswoutTrigger(
true)
35 , m_useMVAwCaloTrigger(
true)
36 , m_useMVAwoutCaloTrigger(
true)
37 , m_useMVAwoutCaloAndMinTrackTrigger(
true)
43 , m_useCutsTrigger(
true)
44 , m_useCutswoutTrigger(
true)
45 , m_useMVAwCaloTrigger(
true)
46 , m_useMVAwoutCaloTrigger(
true)
47 , m_useMVAwoutCaloAndMinTrackTrigger(
true)
53 std::cout <<
"--Cut parameters--" << std::endl;
54 std::cout <<
"meanMult: " <<
meanMult << std::endl;
62 std::cout <<
"-----------------" << std::endl;
89 if (successfulTrigger) std::cout <<
"One of the heavy flavor triggers fired" << std::endl;
90 else std::cout <<
"No heavy flavor triggers fired" << std::endl;
112 triggerDecisionsMVA.find(
"cuts")->second =
false;
113 triggerDecisionsMVA.find(
"cutsWithoutCalo")->second =
false;
114 triggerDecisionsMVA.find(
"MVAWithCalo")->second =
false;
115 triggerDecisionsMVA.find(
"MVAWithoutCalo")->second =
false;
116 triggerDecisionsMVA.find(
"MVAWithoutCaloAndMinTrack")->second =
false;
129 bool anyTriggerFired =
false;
134 float min_TrackVertex_3D_DCA = 0;
135 float min_TrackVertex_2D_DCA = 0;
136 float max_TrackVertex_3D_DCA = 0;
137 float max_TrackVertex_2D_DCA = 0;
138 float min_TrackTrack_3D_DCA = 0;
146 for (
unsigned int k = 0;
k < allVertices.size();
k++)
148 for (
unsigned int i = 0;
i < allTracks.size();
i++)
150 for (
unsigned int j =
i + 1;
j < allTracks.size();
j++)
154 min_TrackVertex_3D_DCA, min_TrackVertex_2D_DCA,
155 max_TrackVertex_3D_DCA, max_TrackVertex_2D_DCA,
156 min_TrackTrack_3D_DCA);
169 max_TrackVertex_3D_DCA,
170 max_TrackVertex_2D_DCA,
171 min_TrackTrack_3D_DCA);
173 if (trigger) triggerDecisionsMVA.find(
"cuts")->second =
true;
179 max_TrackVertex_3D_DCA,
180 max_TrackVertex_2D_DCA,
181 min_TrackTrack_3D_DCA);
183 if (trigger) triggerDecisionsMVA.find(
"cutsWithoutCalo")->second =
true;
189 if (trigger) triggerDecisionsMVA.find(
"MVAWithCalo")->second =
true;
195 if (trigger) triggerDecisionsMVA.find(
"MVAWithoutCalo")->second =
true;
201 if (trigger) triggerDecisionsMVA.find(
"MVAWithoutCaloAndMinTrack")->second =
true;
210 const int numberOfFiredTriggers = std::accumulate(
begin(triggerDecisionsMVA),
end(triggerDecisionsMVA), 0,
211 [](
const int previous,
const std::pair<const std::string, bool>&
element)
212 {
return previous + element.second; });
214 if (numberOfFiredTriggers != 0) anyTriggerFired =
true;
216 return anyTriggerFired;
220 float IP,
float IP_xy,
float DCA)
222 bool triggerDecision =
false;
230 return triggerDecision;
235 float mvaResponse = (Float_t) reader->EvaluateMVA(inputValues, method.c_str());
236 return mvaResponse >= cut;
241 TrkrHitSetContainer* hitContainer = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
246 int inttHits[2] = {0};
248 for (
int i = 0;
i < 2;
i++)
251 hitsetitr != inttHitSetRange[
i].second;
255 inttHits[
i] += hitset->
size();
259 meanMultiplicity = (inttHits[0] + inttHits[1])/2;
260 asymmetryMultiplicity = (inttHits[0] - inttHits[1])/(inttHits[0] + inttHits[1]);
267 m_dst_trackmap = findNode::getClass<SvtxTrackMap>(topNode,
"SvtxTrackMap");
273 maxEnergy = std::max(maxEnergy, thisEnergy);
281 float& minIP,
float& minIP_xy,
282 float& maxIP,
float& maxIP_xy,
float&
DCA)
289 minIP =
std::min(track1_IP, track2_IP);
290 minIP_xy =
std::min(track1_IP_xy, track2_IP_xy);
291 maxIP = std::max(track1_IP, track2_IP);
292 maxIP_xy = std::max(track1_IP_xy, track2_IP_xy);
309 std::vector<Vertex> primaryVertices;
310 m_dst_vertexmap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMap");
315 primaryVertices.push_back(
makeVertex(topNode));
318 return primaryVertices;
337 std::vector<Track>
tracks;
338 m_dst_trackmap = findNode::getClass<SvtxTrackMap>(topNode,
"SvtxTrackMap");
351 for (
unsigned int i = 0;
i < 3;
i++)
353 trackPosition(
i,0) = track(
i,0);
354 trackMomentum(
i,0) = track(
i+3,0);
369 dcaVertex = pos - vertex - mom.dot(pos - vertex)*mom/(mom.dot(mom));
371 float twoD_DCA = std::sqrt(std::pow(dcaVertex[0], 2) + std::pow(dcaVertex[1], 2));
384 dcaVertex = pos - vertex - mom.dot(pos - vertex)*mom/(mom.dot(mom));
386 return std::abs(dcaVertex.norm());
400 Eigen::Vector3f momOneCrossmomTwo = momOne.cross(momTwo);
401 Eigen::Vector3f posOneMinusposTwo = posOne - posTwo;
402 dcaTrackSize = std::abs(momOneCrossmomTwo.dot(posOneMinusposTwo)/(momOneCrossmomTwo.norm()));
409 TMVA::Tools::Instance();
410 TMVA::Reader *
reader =
new TMVA::Reader(
"!Color:!Silent");
412 std::vector<Float_t> reader_floats;
414 for (
unsigned int i = 0;
i < variableList.size(); ++
i)
416 reader_floats.push_back(0);
417 reader->AddVariable(variableList[
i].c_str(), &reader_floats[
i]);
419 reader->BookMVA(method.c_str(), mvaFile.c_str());
426 std::cout <<
"\n---------------HFTriggerMVA run information---------------" << std::endl;
427 std::cout <<
"The number of events processed is: " <<
m_events << std::endl;
428 std::cout <<
"The number of events that did not trigger is: " <<
m_no_trigger << std::endl;
434 std::cout <<
"The number of events triggered is: " <<
m_counter << std::endl;
435 std::cout <<
"--Comparing cuts-based and MVA, both with Calorimetry:" << std::endl;
436 std::cout <<
"----The number of events that fired the cuts-based trigger but not the MVA trigger is: " <<
m_cuts_and_no_mva_wcalo_counter << std::endl;
437 std::cout <<
"----The number of events that fired the MVA trigger but not the cuts-based trigger is: " <<
m_no_cuts_and_mva_wcalo_counter << std::endl;
438 std::cout <<
"----The number of events that fired both the cuts-based trigger and the MVA triggers is: " <<
m_cuts_and_mva_wcalo_counter << std::endl;
440 std::cout <<
"--Comparing cuts-based and MVA, both without Calorimetry:" << std::endl;
443 std::cout <<
"----The number of events that fired both the cuts-based trigger and the MVA triggers is: " <<
m_cuts_and_mva_woutcalo_counter << std::endl;
445 std::cout <<
"--Comparing cuts-based and MVA without Calorimetry or IP of second track:" << std::endl;
450 std::cout <<
"----------------------------------------------------------\n" << std::endl;
455 std::cout <<
"\n---------------HFTriggerMVA event information---------------" << std::endl;
456 if (
m_useCutsTrigger) std::cout <<
"The cuts based trigger decision is " << triggerDecisionsMVA.find(
"cuts")->second << std::endl;
457 if (
m_useMVAwCaloTrigger) std::cout <<
"The MVA wCalo trigger decision is " << triggerDecisionsMVA.find(
"MVAWithCalo")->second << std::endl;
458 std::cout <<
"---------------------------------------------------------\n" << std::endl;