StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFmsEventClusterer.h
Go to the documentation of this file.
1 // $Id: StFmsEventClusterer.h,v 1.8 2019/06/26 16:49:53 akio Exp $
2 //
3 // $Log: StFmsEventClusterer.h,v $
4 // Revision 1.8 2019/06/26 16:49:53 akio
5 // shower shape scaling for all shapes
6 //
7 // Revision 1.7 2018/03/02 20:27:29 akio
8 // Big update from Zhanwen Zhu with new shower shape and six z slices
9 //
10 // Revision 1.6 2015/11/05 17:54:57 akio
11 // Adding option to scale up shower shape function for large cells
12 //
13 // Revision 1.5 2015/11/02 22:44:49 akio
14 // Fix photonEnergyInTower()
15 //
16 // Revision 1.4 2015/10/30 21:33:56 akio
17 // fix parameter initialization
18 // adding new cluster categorization method
19 //
20 // Revision 1.3 2015/10/21 15:58:05 akio
21 // Code speed up (~x2) by optimizing minimization fuctions and showershape function
22 // Add option to merge small cells to large, so that it finds cluster at border
23 // Add option to perform 1photon fit when 2photon fit faield
24 // Add option to turn on/off global refit
25 // Moment analysis done without ECUTOFF when no tower in cluster exceed ECUTOFF=0.5GeV
26 //
27 // Revision 1.2 2015/09/02 15:01:32 akio
28 // Removing StFmsGeometry class, and now it uses StFmsDbMaker to get appropriate parameters.
29 //
30 // Revision 1.1 2015/03/10 14:38:54 jeromel
31 // First version of FmsUtil from Yuxi Pan - reviewd 2015/02
32 //
42 #ifndef STROOT_STFMSPOINTMAKER_STFMSEVENTCLUSTERER_H_
43 #define STROOT_STFMSPOINTMAKER_STFMSEVENTCLUSTERER_H_
44 
45 #include <memory> // For std::unique_ptr
46 #include <vector>
47 
48 #include "TObject.h"
49 
50 #include "StFmsClusterFinder.h"
51 
52 class StFmsDbMaker;
53 
54 namespace FMSCluster { // $NMSPC
55 class StFmsClusterFitter;
56 class StFmsFittedPhoton;
57  //class StFmsGeometry;
58 
65 class StFmsEventClusterer: public TObject {
66  public:
77  // StFmsEventClusterer(const StFmsGeometry* geometry, Int_t detectorId);
78  StFmsEventClusterer(StFmsDbMaker* db, Int_t detectorId,
79  Int_t globalrefit, Int_t mergeSmallToLarge,
80  Int_t try1Photon, Int_t categorizationAlgo,
81  Float_t scaleShowerShapeLarge , Float_t scaleShowerShapeSmall,
82  Int_t showerShapeWithAngle , double vertexz);
90  int detector() const { return mDetectorId; }
98  Bool_t cluster(std::vector<FMSCluster::StFmsTower>* towers);
99 #ifndef __CINT__ // Hide ClusterList from CINT as it uses C++11
100 
101  ClusterList& clusters() { return mClusters; }
103  const ClusterList& clusters() const { return mClusters; }
104 #endif // __CINT__
105 
106  private:
107 #ifndef __CINT__ // Hide ClusterList from CINT as it uses C++11
108 
109  typedef ClusterList::iterator ClusterIter;
111  typedef ClusterList::const_iterator ClusterConstIter;
112 #endif // __CINT__
113 
123  StFmsEventClusterer& operator=(const StFmsEventClusterer&);
131  Int_t fitEvent();
137  Int_t findClusters();
143  Bool_t fitClusters();
149  Bool_t refitClusters();
155  Double_t photonEnergyInCluster(const StFmsTowerCluster* cluster,
156  const StFmsFittedPhoton* photon) const;
162  Double_t photonEnergyInTower(const StFmsTower* tower,
163  const StFmsFittedPhoton* photon) const;
169  Double_t fit1PhotonCluster(StFmsTowerCluster* cluster);
170 #ifndef __CINT__ // Hide Cluster(Const)Iter from CINT as it uses C++11
171  /*
172  Special 2-photon fit for a single cluster.
173 
174  Cluster moments must have been calculated first
175 
176  Returns the &chi;<sup>2</sup> of the fit.
177  */
178  Double_t fit2PhotonCluster(ClusterIter cluster);
179  /*
180  Fit an ambiguous cluster (one that isn't obviously 1- or 2-photon).
181 
182  First tries a 1-photon fit. If that fit is good enough, it is set as a
183  1-photon cluster.
184  Otherwise tries a 2-photon fit and chooses the better result.
185 
186  Returns the category of the cluster (EFmsClusterCategory in StFmsCluster).
187  */
188  Int_t fitAmbiguousCluster(ClusterIter cluster);
189  /*
190  Perform a global fit of all photons in an event.
191 
192  Update the (x, y) positions end energies of the photons in each cluster based
193  on a global fit including all photons.
194  Only makes sense when there is more than one photon in the event.
195  Also, should only be done after prior single- or N-photon fits of the
196  clusters concerned, in order to provide starting values for the photon
197  positions and energies.
198  Arguments:
199  - nPhotons, number of photons in the event
200  - nClusters, number of clusters containing those photons
201  - first, iterator to the first cluster
202 
203  Returns the &chi;<sup>2</sup> of the fit.
204  */
205  Double_t fitGlobalClusters(unsigned int nPhotons, unsigned int nClusters,
206  ClusterIter first);
207  /*
208  Run tests on the lower-energy photon in a 2-photon cluster.
209 
210  Return true if the photon passes tests, in which case it is a real photon.
211  Return false if it fails, in which case it is a bogus photon due to some
212  problem in reconstruction - the cluster is actually a 1-photon cluster.
213 
214  Arguments:
215  const iterator of ClusterList
216  */
217  bool validate2ndPhoton(ClusterConstIter cluster) const;
218  ClusterList mClusters;
219  std::unique_ptr<StFmsClusterFitter> mFitter;
220 #endif // __CINT__
221  StFmsClusterFinder mClusterFinder;
222  //const StFmsGeometry* mGeometry; ///< FMS geometry for current run
223  Int_t mDetectorId;
224  std::vector<FMSCluster::StFmsTower>* mTowers;
225  std::vector<Double_t> mTowerWidthXY;
226 
227  StFmsDbMaker *mFmsDbMaker;
228  Int_t mGlobalRefit;
229  Int_t mMergeSmallToLarge;
230  Int_t mTry1PhotonFitWhen2PhotonFitFailed;
231  Int_t mCategorizationAlgo;
232  Float_t mScaleShowerShapeLarge;
233  Float_t mScaleShowerShapeSmall;
234  Int_t mShowerShapeWithAngle;
235  double vertexz;
236 
237  ClassDef(StFmsEventClusterer, 0)
238 };
239 } // namespace FMSCluster
240 #endif // STROOT_STFMSPOINTMAKER_STFMSEVENTCLUSTERER_H_
Bool_t cluster(std::vector< FMSCluster::StFmsTower > *towers)
const ClusterList & clusters() const
Declaration of StFmsClusterFinder, an FMS tower clustering algorithm.
StFmsEventClusterer(StFmsDbMaker *db, Int_t detectorId, Int_t globalrefit, Int_t mergeSmallToLarge, Int_t try1Photon, Int_t categorizationAlgo, Float_t scaleShowerShapeLarge, Float_t scaleShowerShapeSmall, Int_t showerShapeWithAngle, double vertexz)