/[PAMELA software]/PamCut/CollectionActions/Histo2DActions/RigFillAction/RigFillAction.cpp
ViewVC logotype

Annotation of /PamCut/CollectionActions/Histo2DActions/RigFillAction/RigFillAction.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.2.1 - (hide annotations) (download)
Tue May 11 14:25:56 2010 UTC (14 years, 7 months ago) by pam-fi
Branch: V8
CVS Tags: MergedToHEAD_1, nuclei_reproc
Changes since 1.1: +16 -9 lines
Deflection correction for MDR cut added. Template argument changed to Float_t.

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 pam-fi 1.1.2.1 float chargeSign, bool spilloverFlag, float spilloverLimit, float mdrMin) :
14     Histo2DAction<Float_t> (actionName, "", outFileBase, "RECREATE", false, true), _thresholdCoeff(thresholdCoeff),
15     _chargeSign(chargeSign), _spilloverFlag(spilloverFlag), _spilloverLimit(spilloverLimit), _mdrMin(mdrMin) {
16 pam-fi 1.1
17     SetXAxis("Rc [GV]", bins);
18     SetYAxis("R [GV]", bins);
19     }
20    
21     RigFillAction::RigFillAction(const char *actionName, TString outFileBase, TString rigBinsFile, float thresholdCoeff,
22 pam-fi 1.1.2.1 float chargeSign, bool spilloverFlag, float spilloverLimit, float mdrMin) :
23     Histo2DAction<Float_t> (actionName, "", outFileBase, "RECREATE", false, true), _thresholdCoeff(thresholdCoeff),
24     _chargeSign(chargeSign), _spilloverFlag(spilloverFlag), _spilloverLimit(spilloverLimit), _mdrMin(mdrMin) {
25 pam-fi 1.1
26     SetXAxis("Rc [GV]", rigBinsFile);
27     SetYAxis("R [GV]", rigBinsFile);
28     }
29    
30     void RigFillAction::OnGood(PamLevel2 *event) {
31    
32     float rigThreshold = _thresholdCoeff * event->GetOrbitalInfo()->GetCutoffSVL();
33     float rig = 1. / event->GetTrack(0)->GetTrkTrack()->GetDeflection();
34    
35 pam-fi 1.1.2.1 // Compute deflection correction due to MDR cut
36     if (_mdrMin > 0.) {
37     Double_t F = 0.;
38     if (_mdrMin > 300.) {
39     F = 2.215e-4 * (log(_mdrMin) - log(300.));
40     }
41     rig = 1. / (1. / rig + F);
42     }
43    
44 pam-fi 1.1 if (rig / _chargeSign > 0) { // Check if the particle has the right sign
45     Fill(rigThreshold, rig);
46     }
47     else if (_spilloverFlag && fabs(rig) > _spilloverLimit) { // Check if it is a spillover event
48     Fill(rigThreshold, _yBins.back() + 1.); // Place it in the Y overflow
49     }
50    
51     }
52    
53     void RigFillAction::Finalize() {
54    
55     // Save the histogram
56 pam-fi 1.1.2.1 Histo2DAction<Float_t>::Finalize();
57 pam-fi 1.1
58     // Save the zero bins
59     if (_outFileBase != "") {
60     ofstream outTextFile((_outFileBase + "-InfBins.txt").Data(), ios_base::out);
61     // XUnderflow is the vector of events whose Rc is below the lower histogram limit
62     for (unsigned int i = 0; i < GetXUnderflow().size(); i++)
63     outTextFile << GetXUnderflow()[i] << "\n";
64     outTextFile.close();
65    
66     // Save the (spillover + rigidity overflow)
67     if (_spilloverFlag) {
68     ofstream outTextFile((_outFileBase + "-Spillover.txt").Data(), ios_base::out);
69     // XUnderYOverflow is the number of (spillover + rigidity overflow) events with an underflowing critical rigidity
70     outTextFile << GetXUnderYOverflow() << "\n";
71     for (unsigned int i = 0; i < GetXUnderflow().size(); i++)
72     // YOverflow are the (spillover + rigidity overflow) bins
73     outTextFile << GetYOverflow()[i] << "\n";
74     outTextFile.close();
75     }
76     }
77     }

  ViewVC Help
Powered by ViewVC 1.1.23