1 |
pam-fi |
1.1 |
/* |
2 |
|
|
* RigFillAction.cpp |
3 |
|
|
* |
4 |
|
|
* Created on: 14/lug/2009 |
5 |
|
|
* Author: Nicola Mori |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
/*! @file RigFillAction.cpp The RigFillAction class implementation file. */ |
9 |
|
|
|
10 |
|
|
#include "RigFillAction.h" |
11 |
|
|
|
12 |
|
|
RigFillAction::RigFillAction(const char *actionName, TString outFileBase, vector<float> &bins, float thresholdCoeff, |
13 |
|
|
float chargeSign, bool spilloverFlag, float spilloverLimit) : |
14 |
|
|
Histo2DAction<Int_t> (actionName, "", outFileBase, "RECREATE", false, true), _thresholdCoeff(thresholdCoeff), |
15 |
|
|
_chargeSign(chargeSign), _spilloverFlag(spilloverFlag), _spilloverLimit(spilloverLimit) { |
16 |
|
|
|
17 |
|
|
SetXAxis("Rc [GV]", bins); |
18 |
|
|
SetYAxis("R [GV]", bins); |
19 |
|
|
|
20 |
|
|
} |
21 |
|
|
|
22 |
|
|
RigFillAction::RigFillAction(const char *actionName, TString outFileBase, TString rigBinsFile, float thresholdCoeff, |
23 |
|
|
float chargeSign, bool spilloverFlag, float spilloverLimit) : |
24 |
|
|
Histo2DAction<Int_t> (actionName, "", outFileBase, "RECREATE", false, true), _thresholdCoeff(thresholdCoeff), |
25 |
|
|
_chargeSign(chargeSign), _spilloverFlag(spilloverFlag), _spilloverLimit(spilloverLimit) { |
26 |
|
|
|
27 |
|
|
SetXAxis("Rc [GV]", rigBinsFile); |
28 |
|
|
SetYAxis("R [GV]", rigBinsFile); |
29 |
|
|
|
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
void RigFillAction::OnGood(PamLevel2 *event) { |
33 |
|
|
|
34 |
|
|
float rigThreshold = _thresholdCoeff * event->GetOrbitalInfo()->GetCutoffSVL(); |
35 |
|
|
float rig = 1. / event->GetTrack(0)->GetTrkTrack()->GetDeflection(); |
36 |
|
|
|
37 |
|
|
if (rig / _chargeSign > 0) { // Check if the particle has the right sign |
38 |
|
|
Fill(rigThreshold, rig); |
39 |
|
|
} |
40 |
|
|
else if (_spilloverFlag && fabs(rig) > _spilloverLimit) { // Check if it is a spillover event |
41 |
|
|
Fill(rigThreshold, _yBins.back() + 1.); // Place it in the Y overflow |
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
} |
45 |
|
|
|
46 |
|
|
void RigFillAction::Finalize() { |
47 |
|
|
|
48 |
|
|
// Save the histogram |
49 |
|
|
Histo2DAction<Int_t>::Finalize(); |
50 |
|
|
|
51 |
|
|
// Save the zero bins |
52 |
|
|
if (_outFileBase != "") { |
53 |
|
|
ofstream outTextFile((_outFileBase + "-InfBins.txt").Data(), ios_base::out); |
54 |
|
|
// XUnderflow is the vector of events whose Rc is below the lower histogram limit |
55 |
|
|
for (unsigned int i = 0; i < GetXUnderflow().size(); i++) |
56 |
|
|
outTextFile << GetXUnderflow()[i] << "\n"; |
57 |
|
|
outTextFile.close(); |
58 |
|
|
|
59 |
|
|
// Save the (spillover + rigidity overflow) |
60 |
|
|
if (_spilloverFlag) { |
61 |
|
|
ofstream outTextFile((_outFileBase + "-Spillover.txt").Data(), ios_base::out); |
62 |
|
|
// XUnderYOverflow is the number of (spillover + rigidity overflow) events with an underflowing critical rigidity |
63 |
|
|
outTextFile << GetXUnderYOverflow() << "\n"; |
64 |
|
|
for (unsigned int i = 0; i < GetXUnderflow().size(); i++) |
65 |
|
|
// YOverflow are the (spillover + rigidity overflow) bins |
66 |
|
|
outTextFile << GetYOverflow()[i] << "\n"; |
67 |
|
|
outTextFile.close(); |
68 |
|
|
} |
69 |
|
|
} |
70 |
|
|
} |