]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDMultRegion.cxx
Removing memory leak
[u/mrichter/AliRoot.git] / FMD / AliFMDMultRegion.cxx
1 /**************************************************************************
2  * Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 //____________________________________________________________________
19 //
20 // FMD reconstructed multiplicity in a region of a ring.  The region
21 // is identified by (strip_min,sector_min)x(strip_max,sector_max) or
22 // by (eta_max,phi_min),(eta_min,phi_max).   It's also possible to
23 // get the peudorapidity of the center-of-mass of the region, as well
24 // as the mean azimuthal angle.
25 //
26 // [Note, that minStrip corresponds to maxEta, and maxStrip
27 // corresponds to minEta]
28 // 
29 // These objects are usually created by the Poisson reconstruction
30 // method. 
31 //
32 #include "AliFMDMultRegion.h"   // ALIFMDPARTICLES_H
33 #include <TString.h>            // ROOT_TString
34 #include <Riostream.h>          // ROOT_Riostream
35
36 //____________________________________________________________________
37 ClassImp(AliFMDMultRegion)
38 #if 0
39   ; // This is here to keep Emacs for indenting the next line
40 #endif
41
42
43 //____________________________________________________________________
44 AliFMDMultRegion::AliFMDMultRegion()
45   : fDetector(0),
46     fRing('\0'),
47     fMinSector(0),
48     fMaxSector(0),
49     fMinStrip(0),
50     fMaxStrip(0),
51     fMinEta(0),
52     fMaxEta(0),
53     fMinPhi(0),
54     fMaxPhi(0)
55 {}
56
57 //____________________________________________________________________
58 AliFMDMultRegion::AliFMDMultRegion(UShort_t detector,  Char_t ring, 
59                                    UShort_t minSector, UShort_t maxSector, 
60                                    UShort_t minStrip,  UShort_t maxStrip, 
61                                    Float_t  minEta,    Float_t  maxEta, 
62                                    Float_t  minPhi,    Float_t  maxPhi,
63                                    Float_t  particles, UShort_t method)
64   : AliFMDMult(particles, method),
65     fDetector(detector),
66     fRing(ring),
67     fMinSector(minSector),
68     fMaxSector(maxSector),
69     fMinStrip(minStrip),
70     fMaxStrip(maxStrip),
71     fMinEta(minEta),
72     fMaxEta(maxEta),
73     fMinPhi(minPhi),
74     fMaxPhi(maxPhi)
75 {}
76
77 //____________________________________________________________________
78 Float_t
79 AliFMDMultRegion::Eta() const 
80 {
81   // Return the center-of-mass eta of the region.   This is calculated
82   // as the weighted mean of min and max eta, where the weights are
83   // the length of the arcs of the upper and lower edge of the region: 
84   // 
85   //            (maxPhi - minPhi)
86   //  f       = -----------------
87   //                   360      
88   //
89   //  w_max   = ds*minStrip*2*pi*f
90   //                                   
91   //  w_min   = ds*maxStrip*2*pi*f
92   // 
93   //  1/w^2   = 1/w_max^2 + 1/w_min^2 
94   //
95   //                      1                        1          
96   //          = ---------------------- + ----------------------
97   //            (ds*minStrip*2*pi*f)^2   (ds*maxStrip*2*pi*f)^2
98   // 
99   //            (ds*maxStrip*2*pi*f)^2 + (ds*minStrip*2*pi*f)^2
100   //          = -----------------------------------------------
101   //            (ds*maxStrip*2*pi*f)^2 * (ds*minStrip*2*pi*f)^2
102   //
103   //          
104   //             4 * pi^2 * ds^2 * f^2 (maxStrip^2  + minStrip^2)
105   //          = -------------------------------------------------
106   //             16 * pi^4 * ds^4 * f^4 minStrip^2 * maxStrip^2 
107   //
108   //                     (maxStrip^2  + minStrip^2)
109   //          = -------------------------------------------------
110   //             4 * pi^2 * ds^2 * f^2 minStrip^2 * maxStrip^2 
111   //
112   //  <eta> = (maxEta/w_max^2 + minEta /w_min^2) / (1/w^2)
113   //      
114   //           w_min^2 * maxEta + w_max^2 * minEta
115   //        = ------------------------------------ / (1/w^2)
116   //                  w_max^2 * w_min^2
117   // 
118   //           4*pi^2*ds^2*(maxStrip*maxEta + minStrip*minEta)
119   //        =  ----------------------------------------------- / (1/w^2)
120   //               16*pi^4*ds^4*f^4*minStrip^2*maxStrip^2 
121   //
122   //           maxStrip * maxEta + minStrip * minEta   
123   //        =  ------------------------------------- 
124   //           4*pi^2*ds^2*f^2*minStrip^2*maxStrip^2 
125   //
126   //               4*pi^2*ds^2*f^2*minStrip^2*maxStrip^2
127   //             * -------------------------------------                  
128   //                     maxStrip^2+minStrip^2            
129   // 
130   //           maxStrip * maxEta + minStrip * minEta   
131   //        =  ------------------------------------- 
132   //                  maxStrip^2 + minStrip^2
133   //                                                     _
134   //                                                    |_|
135   //
136   Float_t eta = (fMaxStrip * fMaxEta + fMinStrip * fMinEta) 
137     / (fMaxStrip * fMaxStrip + fMinStrip * fMinStrip);
138   return eta;
139 }
140
141   
142 //____________________________________________________________________
143 void
144 AliFMDMultRegion::Print(Option_t* option) const
145 {
146   // Print information 
147   // 
148   // Options:
149   //    D:           Detector (default)
150   //    S:           Sector range 
151   //    T:           Strip range 
152   //    E:           Eta range (default)
153   //    P:           Phi range (default)
154   //
155   TString opt(option);
156   cout << "FMD Multiplicity in a region: " << fParticles << endl;
157   if (opt.Contains("D", TString::kIgnoreCase))
158     cout << "  Detector:      FMD" << fDetector << fRing 
159          << "[" << fMinSector << "-" << fMaxSector 
160          << "," <<  fMinStrip << "-" << fMaxStrip << "]" << endl;
161   if (opt.Contains("E", TString::kIgnoreCase))
162     cout << "  Eta range:     [" << fMinEta << "," << fMaxEta << endl;
163   if (opt.Contains("P", TString::kIgnoreCase))
164     cout << "  Phi range:     [" << fMinPhi << "," << fMaxPhi << endl;
165   AliFMDMult::Print(option);
166 }
167
168     
169 //____________________________________________________________________
170 //
171 // EOF
172 //