/[PAMELA software]/PamCut/CollectionActions/RigFillAction/RigFillAction.h
ViewVC logotype

Contents of /PamCut/CollectionActions/RigFillAction/RigFillAction.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Fri Jul 17 08:22:48 2009 UTC (16 years, 5 months ago) by pam-fi
Branch: MAIN
File MIME type: text/plain
Added to repository.

1 /*
2 * RigFillAction.h
3 *
4 * Created on: 14/lug/2009
5 * Author: Nicola Mori
6 */
7
8 /*! @file RigFillAction.h The RigFillAction class declaration file */
9
10 #ifndef RIGFILLACTION_H_
11 #define RIGFILLACTION_H_
12
13 #include "../CollectionAction/CollectionAction.h"
14 #include <TH2I.h>
15 #include <stdint.h>
16
17 /*! @brief The rigidity vs threshold rigidity histogram filling.
18 *
19 * This class builds a 2D histogram binned in rigidity modulus
20 * and threshold rigidity. Each 2D bin will contain the number of events whose
21 * rigidity modulus and threshold rigidity (eg., Stoermer cutoff rigidity times a threshold coefficient)
22 * lie in that bin. Note that the meaning of this threshold coefficient is the same as in
23 * TrkRigGeoCut, so it must have the same value used for TrkRigGeoCut (consider
24 * using TrkRigGeoCut::GetThresholdCoeff() to retrieve its value).
25 * Events are discarded only if their rigidity modulus or cutoff rigidity lies
26 * outside the histogram bounds.
27 *
28 * CUT DEPENDECIES: TrkPhSinCut for single physical track, TrkRigGeoCut for galactic event.
29 *
30 */
31 class RigFillAction: public CollectionAction {
32
33 public:
34 /*! @brief Constructor.
35 *
36 * outFileBase is the base name for output file: #Finalize will add .txt for ASCII output
37 * and .root for ROOT output. outFileBase has to contain the path (otherwise, files will be
38 * saved in the current directory).
39 * The file containing the rigidity bins must be a text file. It must contain both the
40 * lower and upper limits of the rigidity axis, so that if it contains N values it
41 * defines a set of N-1 bins.
42 *
43 * @param actionName The action's name.
44 * @param outFileBase The output file base name.
45 * @param rigBinsFile The file containing the rigidity bins.
46 * @param thresholdCoeff The threshold coefficient for critical rigidity.
47 */
48 RigFillAction(const char *actionName, TString outFileBase, TString rigBinsFile, float thresholdCoeff);
49
50 /*! @brief Destructor */
51 ~RigFillAction() {
52 }
53
54 /*! @brief Fills histogram with the selected event.
55 *
56 * The current event will be added to the bin corresponding to its rigidity and critical rigidity multiplied
57 * by the threshold coefficient, eg., to the bin (Rc*threshold, R).
58 *
59 * @param event The selected event.
60 */
61 void OnGood(PamLevel2 *event);
62
63 /*! @brief Writes the histogram to the output files (ASCII and ROOT).
64 *
65 * The output consists of a text file and of a ROOT file where the 2-dimensional histogram (TH2F) is
66 * saved. The first row of the text file is the lowest rigidity bin, the second is the next bin and so on, so
67 * in the text output the positive direction of the rigidity axis (Y axis) is downwards.
68 */
69 void Finalize();
70
71 /*! @brief Returns the histogram.
72 *
73 * This method returns a SimpleMatrix. Its [i][j] element contain the number of analyzed events
74 * whose rigidity modulus falls in the i-th rigidity bin and whose threshold rigidity multiplied by the
75 * threshold falls in the j-th rigidity bin.
76 *
77 * @return The rigidity modulus - threshold rigidity 2D histogram.
78 */
79 SimpleMatrix<UInt_t> &GetHisto() {
80 return _textHisto;
81 }
82
83 private:
84
85 TString _outFileBase;
86 vector<float> _bins;
87 TH2I _rootHisto;
88 SimpleMatrix<UInt_t> _textHisto;
89 float _thresholdCoeff;
90
91 };
92 #endif /* RIGFILLACTION_H_ */

  ViewVC Help
Powered by ViewVC 1.1.23