EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EicDetector.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EicDetector.h
1 //
2 // AYK (ayk@bnl.gov), 2013/06/12
3 //
4 // Basic EIC detector class;
5 //
6 
7 #include <ostream>
8 
9 #ifndef _EIC_DETECTOR_
10 #define _EIC_DETECTOR_
11 
12 #include <TLorentzVector.h>
13 #include "TVector3.h"
14 class TClonesArray;
15 
16 class FairVolume;
17 #include "FairDetector.h"
18 
19 #include <PndDetectorList.h>
20 
21 #include <EicBlackHole.h>
22 #include <EicEnergyMonitor.h>
23 #include <EicDetName.h>
24 #include <EicNamePatternHub.h>
25 #include <EicGeoPar.h>
26 #include <EicContFact.h>
27 #include <EicGeoParData.h>
28 #include <EicMoCaPoint.h>
29 //#include <EicFakeMoCaPoint.h>
30 //#include <EicFakeMoCaPointDbEntry.h>
31 
40 
47 
48 
50 class EicDetector : public FairDetector {
51  friend class EicMCApplication;
52 
53 public:
67  EicDetector(const char *Name, const char *geometryName, EicDetectorId dType = qDUMMY,
68  SteppingType stType = qSteppingTypeUndefined, Bool_t Active = kTRUE);
69 
72  //printf("Entering default constructor ...\n"); //exit(0);
73  ResetVars();
74  };
75 
76  void ResetVars() {
77  dname = 0; eicContFact = 0; //fEicFakeMoCaPointCollection = 0;
79 
80  fTime = fELoss = fStep = fLength = 0.0;
81 
82  mPrintGeometryInfoFlag = false;
83 
86  gptr = 0; vptr = 0;
87 
88  //dbEntry = 0; dbFile = 0; dbTree = 0; _fCutOffMap = 0;
89 
90  mKillerVolumes = 0;
91  };
92 
94  ~EicDetector();
95 
97  virtual void Initialize();
98 
101  virtual void FinishRun();
102 
106  virtual Bool_t ProcessHits( FairVolume *v=0);
107 
109  virtual void Register();
110 
112  virtual void Print() const;
113 
115  virtual void Reset();
116 
117  // May be called from more than one detector; does not hurt;
118  virtual void BeginEvent() {
120  };
121 
123  virtual void ConstructGeometry();
124 
140  bool CheckIfSensitive(std::string name);
141 
150  ULong64_t GetNodeMultiIndex();
151 
153  virtual TClonesArray* GetCollection(Int_t iColl) const ;
154 
155  void ResetSteppingVariables();
156 
175  virtual void AddMoCaPoint(Int_t trackID, Int_t primaryMotherID, Int_t secondaryMotherID, Int_t detID,
176  ULong64_t multiIndex,
177  TVector3 PosIn, TVector3 PosOut,
178  TVector3 MomIn, TVector3 MomOut,
179  Double_t time, Double_t length,
180  Double_t eLoss, Double_t step) {
181  new((*fEicMoCaPointCollection)[fEicMoCaPointCollection->GetEntriesFast()])
182  EicMoCaPoint(trackID, primaryMotherID, secondaryMotherID, detID,
183  multiIndex,
184  PosIn, PosOut, MomIn, MomOut, time, length, eLoss, step);
185  }
186 
204  //virtual void AddFakeMoCaPoint(Int_t trackID, Int_t primaryMotherId, Int_t PDG, Int_t detID,
205  // TString volumePath, ULong64_t multiIndex,
206  // TVector3 PosIn, TVector3 MomIn,
207  // Double_t time, Double_t length) {
208  //new((*fEicFakeMoCaPointCollection)[fEicFakeMoCaPointCollection->GetEntriesFast()])
209  // EicFakeMoCaPoint(trackID, primaryMotherId, PDG, detID, volumePath, multiIndex, PosIn,
210  // MomIn, time, length);
211  //}
212 
222  //int SetEnergyCutOff(Int_t PDG, Double_t cutMin, Double_t cutMax);
223 
225  void EndOfEvent();
226 
229 
232 
235  EicDetName *GetDname() { return dname; };
236 
242  int createFakeMoCaDatabase(const char *outFileName);
243 
244  // NB: can not print anything at initialization stage in simulation.C since respective
245  // EicGeoParData block is not imported yet -> just book printout;
246  void RequestGeometryInfoPrintout(const char *option = 0) {
247  mPrintGeometryInfoFlag = true;
248  mPrintGeometryInfoOption = option;
249  };
250 
251  void RequestAttachedFilePrintout(const char *fileName, const char *option = 0) {
252  mAttachedFilePrintoutRequestName = TString(fileName);
254  };
255 
256  EicEnergyMonitor *AddEnergyMonitorVolume(const char *volumeName, Int_t PDG,
257  char *histogramName, double histogramMin,
258  double histogramMax, unsigned histogramBinNum = 1000) {
259  EicEnergyMonitor *monitor = new EicEnergyMonitor(volumeName, PDG,
260  histogramName, histogramMin,
261  histogramMax, histogramBinNum);
262 
263  mEnergyMonitorVolumes.push_back(monitor);
264 
265  return monitor;
266  };
267 
268  protected:
270  EicDetName *dname;
271 
274 
276  TClonesArray *fEicMoCaPointCollection;
277 
281  //TClonesArray *fEicFakeMoCaPointCollection; //!
282 
283  // Geometry printout request flag and respective option;
286 
289 
290  //
291  // Working variables;
292  //
294  TLorentzVector fPosIn;
295 
296  TLorentzVector fMomIn;
297 
298  Double32_t fTime;
299 
300  Double32_t fLength;
301 
302  Double32_t fELoss;
303 
304  Double32_t fStep;
305 
316  virtual void SetGeometryFileName(TString fname, TString geoVer="0");
317 
318  void AddKillerVolume(TGeoVolume *volume) {
320 
321  // I guess no double-counting check is really needed here?;
322  mKillerVolumes->AddExactMatch(volume->GetName());
323  };
324  public:
325  void AddKillerVolume(const char *vname) {
327 
328  // I guess no double-counting check is really needed here?;
330  };
331  protected:
332  bool IsKillerVolume(const char *name);
333 
334  void CheckEnergyMonitors(const char *name, Int_t trackID,
335  Int_t PDG, bool isPrimary, bool isEntering, bool isExiting,
336  double energy);
337 
338  private:
341 
343  TGeoVolume *vptr;
344 
347 
349 
351  TString fPathUponEntry;
352 
355  //std::vector<std::string> fListOfGeantSensitives; //!
358 
362  //std::map<Int_t, std::pair<Double_t,Double_t> > *_fCutOffMap; //!
363  //
364  // May want to clean up here (move to local variables in respective routines)?;
365  //
367  //TString fFakeMoCaDatabaseFile; //!
369  //EicFakeMoCaPointDbEntry *dbEntry; //!
371  //TFile *dbFile; //!
373  //TTree *dbTree; //!
374 
375  // Let it be unsigned here; not used anyway;
376  EicNamePatternHub<unsigned> *mKillerVolumes; // list of volumes which kill particles upon entry
377 
378  // May want to declare some of the volumes as energy measuring ones for particles upon
379  // entrance(exit); may want to extend this formalism to other quantities later;
380  std::vector<EicEnergyMonitor*> mEnergyMonitorVolumes;
381 
382  ClassDef(EicDetector,49)
383 };
384 
387 public:
395  EicDummyDetector(const char *Name, const char *geometryName):
396  EicDetector(Name, geometryName, qDUMMY, qOneStepOneHit, kFALSE) {};
397 
401 
405 
406  private:
407 
408  ClassDef(EicDummyDetector,7)
409 };
410 
411 #endif