StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcSlowMaker.h
1 // $Id: StEEmcSlowMaker.h,v 2.10 2014/08/06 11:43:04 jeromel Exp $
2 
3 #ifndef STAR_StEEmcSlowMaker
4 #define STAR_StEEmcSlowMaker
5 
124 #ifndef StMaker_H
125 #include "StMaker.h"
126 #endif
127 
128 class TObjArray;
129 class StEEmcDb;
130 class StMuEmcCollection;
131 class StEmcCollection;
132 
133 #include "StEEmcUtil/EEmcGeom/EEmcGeomDefs.h"
134 #include "StEEmcUtil/EEfeeRaw/EEdims.h"
135 #include "StEEmcUtil/database/EEmcDbItem.h"
136 
137 class StEEmcSlowMaker : public StMaker {
138 
139 private:
140  // parameters, fixed :
141  Float_t mMip2ene; // conversion from mips to energy in GeV
142  Float_t mSig1pe; // width of the single photoelectron peak (in p.e.)
143  Float_t mMip2pe[MaxSmdStrips]; // conversion from mip to p.e. from ANL cosmic ray measurements for SMD strips
144  Float_t mPmip2ene[3]; // as above for pre- and post-shower elements
145  Float_t mPmip2pe; // as above for pre- and post-shower elements
146 
147  Float_t avgNumPePerMip(Int_t stripID); // avg # p.e. per mip
148 
149  enum Source_t {kMuDst, kStEvent};
150  Source_t mSource;
151 
152  StEEmcDb *mEeDb;
153 
154  Int_t mNInpEve; // private event counter
155 
156  enum {maxHist = 32};
157  TH1 *mHist[maxHist]; // some global (test) histograms
158  void InitHisto();
159 
162  Int_t MakeTower(StMuEmcCollection *emc);
163 
166  Int_t MakePrePost(StMuEmcCollection *emc);
167 
170  Int_t MakeSMD(StMuEmcCollection *emc);
171 
174  Int_t MakeTower(StEmcCollection* emc);
175 
178  Int_t MakePrePost(StEmcCollection* emc);
179 
182  Int_t MakeSMD(StEmcCollection* emc);
183 
185  Bool_t checkDBped(const EEmcDbItem *x);
186 
188  Float_t getPedSmear(Float_t sigPed);
189 
191  void setZeroAdc(StMuEmcCollection *emc);
192 
194  void setZeroAdc(StEmcCollection* emc);
195 
196  Bool_t mEnableSMD;
197  Bool_t mEnablePrePost;
198  Bool_t mEnableTower;
199 
200  // Offset by pedestal (default true)
201  Bool_t mAddPed;
202  // Smear the pedestals (default true)
203  Bool_t mSmearPed;
204  // Drop bad channels (default false)
205  Bool_t mDropBad;
206  // Overwrite muDst values(default true)
207  Bool_t mOverwrite;
208 
209  Bool_t mIsEmbeddingMode;
210  // set separate defaults for use in BFC
211  Bool_t mIsBFC;
212 
213  enum {kPre1=0, kPre2, kPost, kNumberPrepost};
214 
215  Float_t mRelativeLightYield[kNumberPrepost]; /* <N p.e.>/MIP for pre1, pre2 and post */
216  Float_t mSamplingFraction; /* sampling fraction from the fast simu */
217  Float_t mSamplingFractionUser; /* user-specified sampling fraction */
218  Float_t mTowerGains[kEEmcNumSectors]; /* tower gains from the fast simu */
219  Float_t mPrepostGains; /* pre/post .. */
220  Float_t mSmdGains; /* smd .. */
221  Int_t mMaxAdc; /* max ADC in fast simu */
222  Bool_t mDoLightYield; /* set false to disable tower pre/post relative light yield correction */
223  Float_t mTowerGainFact[kEEmcNumSectors][kEEmcNumSubSectors][kEEmcNumEtas];
224  Float_t mSmdGainFact[kEEmcNumSectors][kEEmcNumSmdUVs][kEEmcNumStrips];
225 
226  Int_t mTruncatePedSmear;
227 
228  // Left unimplemented
230  StEEmcSlowMaker &operator=(const StEEmcSlowMaker &);
231 
232 public:
233 
235  StEEmcSlowMaker(const Char_t *name = "EEmcSlowSim", const Char_t *muDstMakerName = 0);
237  virtual ~StEEmcSlowMaker();
238 
240  virtual Int_t Init();
242  virtual Int_t Make();
244  void setEmbeddingMode(Bool_t e = true) {mIsEmbeddingMode = e;}
245 
248  void disableTower() {mEnableTower = false;}
250  void disablePrePost() {mEnablePrePost = false;}
252  void disableSMD() {mEnableSMD = false;}
253 
255  void setAddPed(Bool_t a = true) {mAddPed = a;}
257  void setSmearPed(Bool_t s = true) {mSmearPed = s;}
259  void setDropBad(Bool_t d = true) {mDropBad = true;}
260 
262  void setOverwrite(Bool_t o = true) {mOverwrite = o;}
263 
265  void setTruncatePedSmear(Float_t nSigma) {mTruncatePedSmear = nSigma;}
266 
269  void setMipElossSmd(Float_t e) {mMip2ene = e;}
272  void setNpePerMipSmd(Int_t strip, Float_t npe) {mMip2pe[strip] = npe;}
275  void setNpePerMipSmd(Float_t npe) {for (Int_t i = 0;i < MaxSmdStrips;i++) mMip2pe[i] = npe;}
276 
279  void setMipElossPre(Int_t layer, Float_t e) {mPmip2ene[layer] = e;}
282  void setNpePerMipPre(Float_t npe) {mPmip2pe = npe;}
283 
286  void setSinglePeResolution(Float_t r) {mSig1pe = r;}
287 
289  void setSource(const Char_t* name);
290 
298  void setRelativeLightYield(Float_t pre1, Float_t pre2, Float_t post) {mRelativeLightYield[kPre1] = pre1; mRelativeLightYield[kPre2] = pre2; mRelativeLightYield[kPost] = post;}
299 
303  void setDoLightYield(Bool_t ly) {mDoLightYield = ly;}
304 
306  void setSamplingFraction(Float_t f) {mSamplingFractionUser = f;}
307 
309  void setTowerGainSpread(Float_t s, Float_t mean = 1.0);
310 
312  void setSmdGainSpread(Float_t s, Int_t sector, Int_t uv, Int_t strip_index);
313  void setSmdGainSpread(Float_t s, Int_t strip_index);
314  void setSmdGainSpread(Float_t s);
315 
317  static Float_t getMipdEdx();
318 
320  virtual const char *GetCVS() const {
321  static const char cvs[]="Tag $Name: $ $Id: StEEmcSlowMaker.h,v 2.10 2014/08/06 11:43:04 jeromel Exp $ built " __DATE__ " " __TIME__ ;
322  return cvs;
323  }
324 
325  ClassDef(StEEmcSlowMaker, 3)
326 };
327 
328 #endif
329 
330 // $Log: StEEmcSlowMaker.h,v $
331 // Revision 2.10 2014/08/06 11:43:04 jeromel
332 // Suffix on literals need to be space (later gcc compiler makes it an error) - first wave of fixes
333 //
334 // Revision 2.9 2010/09/07 22:24:52 stevens4
335 // give access to MIP dE/dx to other makers
336 //
337 // Revision 2.8 2010/08/05 21:23:45 stevens4
338 // Update sampling fraction to 4.8%
339 //
340 // Revision 2.7 2010/08/03 02:20:40 stevens4
341 // final update from peer review
342 //
343 // Revision 2.6 2010/07/29 16:12:03 ogrebeny
344 // Update after the peer review
345 //
346 // Revision 2.5 2010/05/03 20:47:23 ogrebeny
347 // Some code cleanup
348 //
349 // Revision 2.4 2010/02/12 23:02:38 ogrebeny
350 // By the request of the photon group, added an option to shift EEMC gains in the slow simulator.
351 //
352 // Revision 2.3 2009/02/05 20:06:53 ogrebeny
353 // Changed StEEmcDbMaker -> StEEmcDb
354 //
355 // Revision 2.2 2008/04/11 14:37:17 jwebb
356 // Added options to disable operation of individual slow simulaor subsystems.
357 //
358 // Revision 2.1 2007/11/28 16:17:34 jwebb
359 // Added the following features:
360 //
361 // 1. User may specify the sampling fraction.
362 //
363 // 2. Tower and SMD gain spreads.
364 //
365 // Revision 2.0 2007/01/13 00:03:03 jwebb
366 // Upgrade of the slow simulator. The following changes have been made:
367 //
368 // 1. Towers will always be masked out when a "fail" bit is set in the database.
369 // Previously this only happened if pedestals were being added, smeared.
370 //
371 // 2. Tower, preshower and postshower ADC values will be simulated using the
372 // GEANT energy loss stored in StEmcHit and StMuEmcHit. Previously, ADC
373 // values from the fast simulator were used and energy loss recovered
374 // using gains, resulting in roundoff errors. Note that towers still use
375 // the old path for MuDst-based analysis.
376 //
377 // 3. Tower simulation now accounts for the different light yields provided
378 // by the brighter scintillator and two-fiber readout in the preshower
379 // and postshower layers. Previously, only the difference in thickness
380 // was accounted for by the GEANT simulation.
381 //
382 // Revision 1.4 2006/12/12 20:29:14 balewski
383 // added hooks for Endcap embedding
384 //
385 // Revision 1.3 2006/08/07 18:50:11 balewski
386 // added capabilty to run on StEvent, use se-method, see macros/ for example
387 //
388 // Revision 1.2 2005/09/23 01:30:11 jwebb
389 // Tower peds now added if option is set.
390 //
391 // Revision 1.1 2004/12/15 17:02:56 balewski
392 // try 2
393 //
void setNpePerMipPre(Float_t npe)
void setSamplingFraction(Float_t f)
Changes the sampling fraction from the default in the fast simulator.
void setRelativeLightYield(Float_t pre1, Float_t pre2, Float_t post)
void setDoLightYield(Bool_t ly)
void setNpePerMipSmd(Float_t npe)
void setAddPed(Bool_t a=true)
Add pedestal offsets from DB.
virtual const char * GetCVS() const
Displayed on session exit, leave it as-is please ...
void disableSMD()
Disables slow simulator for the SMD detectors.
void setNpePerMipSmd(Int_t strip, Float_t npe)
void setOverwrite(Bool_t o=true)
Overwrite the muDst values.
static Float_t getMipdEdx()
Return MIP dE/dx used for SMD, Pre, Post.
void setDropBad(Bool_t d=true)
Drop bad channels marked as &quot;fail&quot; in DB.
void setSinglePeResolution(Float_t r)
void setTruncatePedSmear(Float_t nSigma)
Set truncation of pedestal smearing.
virtual ~StEEmcSlowMaker()
Class destructor.
void setMipElossPre(Int_t layer, Float_t e)
void setMipElossSmd(Float_t e)
virtual Int_t Init()
Initialization.
void setTowerGainSpread(Float_t s, Float_t mean=1.0)
Defines a spread in the tower gains, generated gains will be between zero and mean + 1...
void setSmearPed(Bool_t s=true)
Smear the pedestal with sigma from DB.
void setEmbeddingMode(Bool_t e=true)
Sets all switches required to perform embedding.
Slow simulator for EEMC.
void setSource(const Char_t *name)
Set the source of ADC. Can be &quot;MuDst&quot; (default) or &quot;StEvent&quot;.
void setSmdGainSpread(Float_t s, Int_t sector, Int_t uv, Int_t strip_index)
Defines a spread in the SMD gains, generated gains will be between zero and mean + 1...
void disablePrePost()
Disables slow simulator for the preshower and postshwoer detectors.
virtual Int_t Make()
Processes a single event.