StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcGenericClusterMaker.h
1 #ifndef __StEEmcGenericClusterMaker_h__
2 #define __StEEmcGenericClusterMaker_h__
3 
67 #include "StMaker.h"
68 #include "StEEmcCluster.h"
69 #include "StEEmcSmdCluster.h"
70 
71 class TH1F;
72 class TH2F;
73 class StEEmcA2EMaker;
74 
75 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
76 #include "StEEmcUtil/StEEmcSmd/EEmcSmdGeom.h"
77 #include "StEEmcUtil/EEmcSmdMap/EEmcSmdMap.h"
78 
79 #include <map>
80 
81 #include "TRefArray.h"
82 #include "TClonesArray.h"
83 
84 class TH1F;
85 class TH2F;
86 
87 //#include "StEEmcClusterCollection.h"
88 
89 class StMuTrack;
90 #include "StarClassLibrary/StPhysicalHelixD.hh"
91 
93 {
94 public:
95 
96  StEEmcGenericClusterMaker( const Char_t *name, const StEEmcA2EMaker *a2e=NULL );
97  virtual ~StEEmcGenericClusterMaker(){ /* nada */ }
98 
99  virtual Int_t Init();
100 
101  virtual Int_t Make();
102 
103  void makeHistograms();
104  void makeClusterMap();
105  void makeStEvent();
106  void makeTrackMap();
107 
108  virtual void Clear(Option_t *opts="");
109 
111  void add(const StEEmcCluster &cluster);
112 
114  void add(const StEEmcSmdCluster &cluster) {
116  c.key(nextClusterId());
117  mSmdClusters[ c.sector() ][ c.plane() ].push_back( c );
118  mNumberOfClusters[c.strip(0).plane()+4]++;
119  }
120 
123  void remove(const StEEmcCluster &cluster){ /* needs to be implemented */ }
124 
126  void remove(const StEEmcSmdCluster &cluster){ /* needs to be implemented */ }
127 
129  StEEmcClusterVec_t &clusters( Int_t sec, Int_t layer ) { return mTowerClusters[sec][layer]; }
130  const StEEmcClusterVec_t &clusters( Int_t sec, Int_t layer ) const { return mTowerClusters[sec][layer]; }
131 
133  StEEmcSmdClusterVec_t &smdclusters( Int_t sec, Int_t plane ) { return mSmdClusters[sec][plane]; }
134  const StEEmcSmdClusterVec_t &smdclusters( Int_t sec, Int_t plane ) const { return mSmdClusters[sec][plane]; }
135 
140  StEEmcCluster &cluster(Int_t sector, Int_t layer, Int_t index) { return mTowerClusters[sector][layer][index]; }
141  const StEEmcCluster &cluster(Int_t sector, Int_t layer, Int_t index) const { return mTowerClusters[sector][layer][index]; }
142 
147  StEEmcSmdCluster &smdcluster(Int_t sector, Int_t plane, Int_t index) { if ( plane < 2 ) return mSmdClusters[sector][plane][index]; else assert(0); /* please specify an smd plane 0=U or 1=V */}
148  const StEEmcSmdCluster &smdcluster(Int_t sector, Int_t plane, Int_t index) const { if ( plane < 2 ) return mSmdClusters[sector][plane][index]; else assert(0); /* please specify an smd plane 0=U or 1=V */}
149 
152  Int_t numberOfTracks(const StEEmcCluster &cluster) const { return (Int_t)(*(mClusterTrackMap.find(cluster.key()))).second.size(); }
153  Int_t numberOfBackgroundTracks(const StEEmcCluster &cluster) const { return (Int_t)(*(mBackgroundTrackMap.find(cluster.key()))).second.size(); }
154 
159  StMuTrack *track(const StEEmcCluster &cluster, Int_t index) const { return (*(mClusterTrackMap.find(cluster.key()))).second[index]; }
160  StMuTrack *backgroundTrack(const StEEmcCluster &cluster, Int_t index) const { return (*(mBackgroundTrackMap.find(cluster.key()))).second[index]; }
161 
165  Int_t numberOfClusters(Int_t sector, Int_t layer) const{
166  if ( layer < 4 )
167  return (Int_t)mTowerClusters[ sector ][ layer ].size();
168  else if ( layer < 6 )
169  return (Int_t)mSmdClusters[ sector ][ layer-4 ].size();
170  else
171  return -1;
172  }
174  Int_t numberOfClusters(Int_t layer) const{ return mNumberOfClusters[layer]; }
176  Int_t numberOfClusters() const { return mClusterId; }
177 
180  struct EEmatch
181  {
182  StEEmcClusterVec_t tower;
183  StEEmcClusterVec_t pre1;
184  StEEmcClusterVec_t pre2;
185  StEEmcClusterVec_t post;
186  StEEmcSmdClusterVec_t smdu;
187  StEEmcSmdClusterVec_t smdv;
188  StEEmcStripVec_t ustrips;
189  StEEmcStripVec_t vstrips;
190  };
191 
194  EEmatch &clusterMatch(const StEEmcCluster &c) { return mClusterMap[ c.key() ]; }
195  const EEmatch &clusterMatch(const StEEmcCluster &c) const { return (*(mClusterMap.find(c.key()))).second; }
196 
198  Int_t lastClusterId() const { return mClusterId; }
199 
203  Int_t numberOfMatchingSmdClusters(const StEEmcCluster &cluster, Int_t plane ) const;
204 
209  StEEmcSmdCluster &matchingSmdCluster (const StEEmcCluster &cluster, Int_t plane, Int_t index );
210  const StEEmcSmdCluster &matchingSmdCluster (const StEEmcCluster &cluster, Int_t plane, Int_t index ) const;
211 
214  void setTrackMatching( Float_t distance, Int_t layer ){ mClusterTrackSeparation[layer] = distance; }
215 
217  Bool_t extrapolateToZ( const StPhysicalHelixD &helix, const double z, TVector3 &r) const;
218 
222  void buildHistograms(const StEEmcCluster &cluster);
223 
227  Int_t nextClusterId() { return mClusterId++; }
228  Int_t maxClusterId() const { return mClusterId; }
229 
230  virtual const char* GetCVS() const
231  {static const char cvs[]="Tag $Name: $ $Id: StEEmcGenericClusterMaker.h,v 1.8 2014/08/06 11:42:59 jeromel Exp $ built " __DATE__ " " __TIME__; return cvs;}
232 
233 protected:
234 
235  // EEMC adc to energy
236  const StEEmcA2EMaker *mEEanalysis;
237 
238  // StEEmcClusterCollection *mCollection;
239 
240  // Keeps track of clusters
241  Int_t mClusterId;
242 
243  // mTowerClusters[sec][layer] provides list of tower
244  // clusters at specified layer in the given sector,
245  // where the sector is determined by the seed tower.
246  std::vector< std::vector< StEEmcClusterVec_t > > mTowerClusters;
247 
248  // mSmdClusters[sec][plane] provides a list of SMD
249  // clusters in the given sector for the given plane
250  std::vector< std::vector< StEEmcSmdClusterVec_t > > mSmdClusters;
251 
252  // keeps track of total number of clusters in each layer
253  Int_t mNumberOfClusters[6];
254 
255  // Pointers to geometry classes
256  const EEmcGeomSimple *mEEmcGeom;
257  const EEmcSmdGeom *mESmdGeom;
258  const EEmcSmdMap *mESmdMap;
259 
261  virtual Int_t buildTowerClusters(){ return kStOK; }
263  virtual Int_t buildPreshowerClusters(){ return kStOK; }
265  virtual Int_t buildPostshowerClusters(){ return kStOK; }
267  virtual Int_t buildSmdClusters(){ return kStOK; }
268 
273  Bool_t match(const StEEmcCluster &c1, const StEEmcCluster &c2 ) const;
274  Bool_t match(const StEEmcCluster &c1, const StEEmcSmdCluster &c2 ) const;
275  Bool_t match(const StEEmcSmdCluster &c1, const StEEmcSmdCluster &c2 ) const;
276 
277  Bool_t match(const StEEmcCluster &c1, const StMuTrack *track ) const;
278  Bool_t match(const StEEmcSmdCluster &c1, const StMuTrack *track ) const { return false; } /* needs to be implemented */
279 
280  Bool_t matchBackgroundTrack(const StEEmcCluster &c1, const StMuTrack *track) const;
281 
282  Int_t mSmdMatchRange;
283 
284  // hash tables holding relationships between tower clusters and
285  // pre/post and/or smd clusters
286 
287  // use mClusterMap[ cluster_key ] to grab all clusters which match
288  // a given cluster. All mappings are handled here.
289  std::map< Int_t, EEmatch > mClusterMap;
290 
291  // use mClusterTrackMap[ cluster_key ] to grab all StMuTracks which
292  // are matched to the cluster
293  std::map< Int_t, std::vector< StMuTrack* > > mClusterTrackMap;
294  std::map< Int_t, std::vector< StMuTrack* > > mBackgroundTrackMap;
295 
296  // use mTrackClusterMap[ track->id() ] to grab all clusters
297  // which match the given track (needs implementation)
298  std::map< Int_t, EEmatch > mTrackClusterMap;
299 
300  // Maximum distance between clusters and tracks where they will
301  // be associtated. TPQRUV
302  Float_t mClusterTrackSeparation[6];
303 
304  ClassDef(StEEmcGenericClusterMaker,1);
305 };
306 
307 #endif
Int_t lastClusterId() const
Returns the current largest cluster ID.
StEEmcSmdClusterVec_t & smdclusters(Int_t sec, Int_t plane)
Return a vector of smd clusters.
EEmc ADC –&gt; energy maker.
Int_t numberOfClusters() const
returns the total number of clusters summed over all layers
StEEmcGenericClusterMaker(const Char_t *name, const StEEmcA2EMaker *a2e=NULL)
virtual void Clear(Option_t *opts="")
User defined functions.
Bool_t extrapolateToZ(const StPhysicalHelixD &helix, const double z, TVector3 &r) const
extrapolates helix to position z (borrowed from StEEmcPool/TTM)
void setTrackMatching(Float_t distance, Int_t layer)
void add(const StEEmcCluster &cluster)
Add a tower (pre/postshower) cluster to the list of clusters.
Bool_t match(const StEEmcCluster &c1, const StEEmcCluster &c2) const
Int_t numberOfMatchingSmdClusters(const StEEmcCluster &cluster, Int_t plane) const
StEEmcClusterVec_t & clusters(Int_t sec, Int_t layer)
Return a vector of tower clusters.
void buildHistograms(const StEEmcCluster &cluster)
virtual Int_t buildSmdClusters()
builder for smd clusters
Int_t numberOfClusters(Int_t sector, Int_t layer) const
EEmatch & clusterMatch(const StEEmcCluster &c)
StEEmcSmdCluster & matchingSmdCluster(const StEEmcCluster &cluster, Int_t plane, Int_t index)
virtual Int_t buildPostshowerClusters()
builder for postshower clusters
Int_t key()
Return a unique key assigned by the cluster maker.
EEMC simple geometry.
Definition: Stypes.h:40
A base class for representing clusters of EEMC smd strips.
StEEmcSmdCluster & smdcluster(Int_t sector, Int_t plane, Int_t index)
Int_t numberOfClusters(Int_t layer) const
returns the total number of clusters in a given layer
StMuTrack * track(const StEEmcCluster &cluster, Int_t index) const
A base class for describing clusters of EEMC towers.
Definition: StEEmcCluster.h:50
void add(const StEEmcSmdCluster &cluster)
Add a smd cluster to the list of clusters.
void plane(Int_t p)
Sets the plane for this SMD strip, 0=U, 1=V.
Definition: StEEmcStrip.h:19
StEEmcStrip & strip(Int_t s)
Returns the specified smd strip w/in the cluster.
virtual Int_t buildPreshowerClusters()
builder for preshower clusters (both layers)
StEEmcCluster & cluster(Int_t sector, Int_t layer, Int_t index)
Int_t numberOfTracks(const StEEmcCluster &cluster) const
virtual Int_t buildTowerClusters()
builder for tower clusters