CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
CaloSD Class Referenceabstract

#include <CaloSD.h>

Inheritance diagram for CaloSD:
SensitiveCaloDetector Observer< const BeginOfRun * > Observer< const BeginOfEvent * > Observer< const BeginOfTrack * > Observer< const EndOfTrack * > Observer< const EndOfEvent * > SensitiveDetector CastorSD DreamSD ECalSD EcalTBH4BeamSD HCalSD HcalTB02SD HcalTB06BeamSD ZdcSD

Public Member Functions

 CaloSD (G4String aSDname, const DDCompactView &cpv, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, int tSlice=1, bool ignoreTkID=false)
 
virtual void clear ()
 
virtual void DrawAll ()
 
virtual void EndOfEvent (G4HCofThisEvent *eventHC)
 
void fillHits (edm::PCaloHitContainer &, std::string n)
 
virtual double getEnergyDeposit (G4Step *step)
 
virtual void Initialize (G4HCofThisEvent *HCE)
 
virtual void PrintAll ()
 
virtual bool ProcessHits (G4Step *step, G4TouchableHistory *tHistory)
 
virtual bool ProcessHits (G4GFlashSpot *aSpot, G4TouchableHistory *)
 
virtual uint32_t setDetUnitId (G4Step *step)=0
 
virtual ~CaloSD ()
 
- Public Member Functions inherited from SensitiveCaloDetector
 SensitiveCaloDetector (std::string &iname, const DDCompactView &cpv, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
virtual void AssignSD (std::string &vname)
 
Local3DPoint ConvertToLocal3DPoint (const G4ThreeVector &point)
 
Local3DPoint FinalStepPosition (G4Step *s, coordinates)
 
virtual std::vector< std::string > getNames ()
 
Local3DPoint InitialStepPosition (G4Step *s, coordinates)
 
std::string nameOfSD ()
 
void NaNTrap (G4Step *step)
 
void Register ()
 
 SensitiveDetector (std::string &iname, const DDCompactView &cpv, SensitiveDetectorCatalog &, edm::ParameterSet const &p)
 
virtual ~SensitiveDetector ()
 
- Public Member Functions inherited from Observer< const BeginOfRun * >
 Observer ()
 
void slotForUpdate (const BeginOfRun *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfTrack * >
 Observer ()
 
void slotForUpdate (const BeginOfTrack *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfTrack * >
 Observer ()
 
void slotForUpdate (const EndOfTrack *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfEvent * >
 Observer ()
 
void slotForUpdate (const EndOfEvent *iT)
 
virtual ~Observer ()
 

Protected Member Functions

G4bool checkHit ()
 
virtual void clearHits ()
 
CaloG4HitcreateNewHit ()
 
virtual bool filterHit (CaloG4Hit *, double)
 
double getAttenuation (G4Step *aStep, double birk1, double birk2, double birk3)
 
virtual uint16_t getDepth (G4Step *)
 
int getNumberOfHits ()
 
double getResponseWt (G4Track *)
 
virtual G4bool getStepInfo (G4Step *aStep)
 
virtual int getTrackID (G4Track *)
 
G4bool hitExists ()
 
virtual void initRun ()
 
void resetForNewPrimary (const G4ThreeVector &, double)
 
G4ThreeVector setToGlobal (const G4ThreeVector &, const G4VTouchable *)
 
G4ThreeVector setToLocal (const G4ThreeVector &, const G4VTouchable *)
 
virtual void update (const BeginOfRun *)
 This routine will be called when the appropriate signal arrives. More...
 
virtual void update (const BeginOfEvent *)
 This routine will be called when the appropriate signal arrives. More...
 
virtual void update (const BeginOfTrack *trk)
 This routine will be called when the appropriate signal arrives. More...
 
virtual void update (const EndOfTrack *trk)
 This routine will be called when the appropriate signal arrives. More...
 
virtual void update (const ::EndOfEvent *)
 
void updateHit (CaloG4Hit *)
 
- Protected Member Functions inherited from Observer< const EndOfEvent * >
virtual void update (const EndOfEvent *)=0
 This routine will be called when the appropriate signal arrives. More...
 

Protected Attributes

int checkHits
 
double correctT
 
bool corrTOFBeam
 
CaloG4HitcurrentHit
 
CaloHitID currentID
 
float edepositEM
 
float edepositHAD
 
double eminHit
 
double eminHitD
 
G4int emPDG
 
double energyCut
 
G4ThreeVector entranceLocal
 
G4ThreeVector entrancePoint
 
G4int epPDG
 
bool forceSave
 
G4int gammaPDG
 
float incidentEnergy
 
double kmaxIon
 
double kmaxNeutron
 
double kmaxProton
 
const SimTrackManagerm_trackManager
 
G4ThreeVector posGlobal
 
G4StepPoint * preStepPoint
 
CaloHitID previousID
 
int primIDSaved
 
bool runInit
 
bool suppressHeavy
 
G4Track * theTrack
 
double tmaxHit
 
bool useMap
 

Private Member Functions

void cleanHitCollection ()
 
bool saveHit (CaloG4Hit *)
 
void storeHit (CaloG4Hit *)
 
void summarize ()
 

Private Attributes

int cleanIndex
 
int hcID
 
std::map< CaloHitID, CaloG4Hit * > hitMap
 
std::vector< CaloG4Hit * > hitvec
 
bool ignoreTrackID
 
CaloMeanResponsemeanResponse
 
int primAncestor
 
std::vector< CaloG4Hit * > reusehit
 
std::vector< unsigned int > selIndex
 
CaloSlaveSDslave
 
CaloG4HitCollectiontheHC
 
int timeSlice
 
std::map< int, TrackWithHistory * > tkMap
 
int totalHits
 

Additional Inherited Members

- Public Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 

Detailed Description

Definition at line 42 of file CaloSD.h.

Constructor & Destructor Documentation

CaloSD::CaloSD ( G4String  aSDname,
const DDCompactView cpv,
SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager,
int  tSlice = 1,
bool  ignoreTkID = false 
)

Definition at line 24 of file CaloSD.cc.

References SensitiveDetector::AssignSD(), checkHits, cleanIndex, ecaldqm::collectionName, correctT, corrTOFBeam, currentID, eminHit, eminHitD, energyCut, forceSave, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), ignoreTrackID, gen::k, kmaxIon, kmaxNeutron, kmaxProton, LogDebug, SensitiveDetectorCatalog::logicalNames(), meanResponse, previousID, primAncestor, SensitiveDetector::Register(), slave, suppressHeavy, timeSlice, tmaxHit, totalHits, and useMap.

27  :
28  SensitiveCaloDetector(name, cpv, clg, p),
29  G4VGFlashSensitiveDetector(), theTrack(0), preStepPoint(0), eminHit(0),
30  eminHitD(0), m_trackManager(manager), currentHit(0), runInit(false),
31  timeSlice(tSlice), ignoreTrackID(ignoreTkID), hcID(-1), theHC(0),
32  meanResponse(0) {
33  //Add Hcal Sentitive Detector Names
34 
35  collectionName.insert(name);
36 
37  //Parameters
38  edm::ParameterSet m_CaloSD = p.getParameter<edm::ParameterSet>("CaloSD");
39  energyCut = m_CaloSD.getParameter<double>("EminTrack")*GeV;
40  tmaxHit = m_CaloSD.getParameter<double>("TmaxHit")*ns;
41  std::vector<double> eminHits = m_CaloSD.getParameter<std::vector<double> >("EminHits");
42  std::vector<double> tmaxHits = m_CaloSD.getParameter<std::vector<double> >("TmaxHits");
43  std::vector<std::string> hcn = m_CaloSD.getParameter<std::vector<std::string> >("HCNames");
44  std::vector<int> useResMap = m_CaloSD.getParameter<std::vector<int> >("UseResponseTables");
45  std::vector<double> eminHitX = m_CaloSD.getParameter<std::vector<double> >("EminHitsDepth");
46  suppressHeavy= m_CaloSD.getParameter<bool>("SuppressHeavy");
47  kmaxIon = m_CaloSD.getParameter<double>("IonThreshold")*MeV;
48  kmaxProton = m_CaloSD.getParameter<double>("ProtonThreshold")*MeV;
49  kmaxNeutron = m_CaloSD.getParameter<double>("NeutronThreshold")*MeV;
50  checkHits = m_CaloSD.getUntrackedParameter<int>("CheckHits", 25);
51  useMap = m_CaloSD.getUntrackedParameter<bool>("UseMap", true);
52  int verbn = m_CaloSD.getUntrackedParameter<int>("Verbosity", 0);
53  corrTOFBeam = m_CaloSD.getParameter<bool>("CorrectTOFBeam");
54  double beamZ = m_CaloSD.getParameter<double>("BeamPosition")*cm;
55  correctT = beamZ/c_light/nanosecond;
56 
57  SetVerboseLevel(verbn);
58  for (unsigned int k=0; k<hcn.size(); ++k) {
59  if (name == (G4String)(hcn[k])) {
60  if (k < eminHits.size()) eminHit = eminHits[k]*MeV;
61  if (k < eminHitX.size()) eminHitD= eminHitX[k]*MeV;
62  if (k < tmaxHits.size()) tmaxHit = tmaxHits[k]*ns;
63  if (k < useResMap.size() && useResMap[k] > 0) meanResponse = new CaloMeanResponse(p);
64  break;
65  }
66  }
67 #ifdef DebugLog
68  LogDebug("CaloSim") << "***************************************************"
69  << "\n"
70  << "* *"
71  << "\n"
72  << "* Constructing a CaloSD with name " << GetName()
73  << "\n"
74  << "* *"
75  << "\n"
76  << "***************************************************";
77 #endif
78  slave = new CaloSlaveSD(name);
81 
82  primAncestor = 0;
83  cleanIndex = 0;
84  totalHits = 0;
85  forceSave = false;
86 
87  //
88  // Now attach the right detectors (LogicalVolumes) to me
89  //
90  std::vector<std::string> lvNames = clg.logicalNames(name);
91  this->Register();
92  for (std::vector<std::string>::iterator it=lvNames.begin(); it !=lvNames.end(); ++it) {
93  this->AssignSD(*it);
94 #ifdef DebugLog
95  LogDebug("CaloSim") << "CaloSD : Assigns SD to LV " << (*it);
96 #endif
97  }
98 
99  edm::LogInfo("CaloSim") << "CaloSD: Minimum energy of track for saving it "
100  << energyCut/GeV << " GeV" << "\n"
101  << " Use of HitID Map " << useMap << "\n"
102  << " Check last " << checkHits
103  << " before saving the hit\n"
104  << " Correct TOF globally by " << correctT
105  << " ns (Flag =" << corrTOFBeam << ")\n"
106  << " Save hits recorded before " << tmaxHit
107  << " ns and if energy is above " << eminHit/MeV
108  << " MeV (for depth 0) or " << eminHitD/MeV
109  << " MeV (for nonzero depths); Time Slice Unit "
110  << timeSlice << " Ignore TrackID Flag " << ignoreTrackID;
111 }
#define LogDebug(id)
double energyCut
Definition: CaloSD.h:123
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int timeSlice
Definition: CaloSD.h:141
std::vector< std::string > logicalNames(std::string &readoutName)
double kmaxNeutron
Definition: CaloSD.h:134
bool corrTOFBeam
Definition: CaloSD.h:132
int totalHits
Definition: CaloSD.h:156
bool useMap
Definition: CaloSD.h:125
int hcID
Definition: CaloSD.h:144
double eminHitD
Definition: CaloSD.h:123
int primAncestor
Definition: CaloSD.h:151
double kmaxProton
Definition: CaloSD.h:134
double eminHit
Definition: CaloSD.h:123
bool forceSave
Definition: CaloSD.h:137
std::string const collectionName[nCollections]
Definition: Collections.h:45
double kmaxIon
Definition: CaloSD.h:134
bool suppressHeavy
Definition: CaloSD.h:132
CaloSlaveSD * slave
Definition: CaloSD.h:143
CaloHitID previousID
Definition: CaloSD.h:117
CaloG4Hit * currentHit
Definition: CaloSD.h:128
CaloMeanResponse * meanResponse
Definition: CaloSD.h:149
G4Track * theTrack
Definition: CaloSD.h:118
double tmaxHit
Definition: CaloSD.h:123
int k[5][pyjets_maxn]
G4StepPoint * preStepPoint
Definition: CaloSD.h:120
CaloHitID currentID
Definition: CaloSD.h:117
double correctT
Definition: CaloSD.h:133
bool runInit
Definition: CaloSD.h:130
virtual void AssignSD(std::string &vname)
CaloG4HitCollection * theHC
Definition: CaloSD.h:145
SensitiveCaloDetector(std::string &iname, const DDCompactView &cpv, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
int checkHits
Definition: CaloSD.h:124
const SimTrackManager * m_trackManager
Definition: CaloSD.h:127
int cleanIndex
Definition: CaloSD.h:152
bool ignoreTrackID
Definition: CaloSD.h:142
CaloSD::~CaloSD ( )
virtual

Definition at line 113 of file CaloSD.cc.

References meanResponse, slave, and theHC.

113  {
114  if (slave) delete slave;
115  if (theHC) delete theHC;
116  if (meanResponse) delete meanResponse;
117 }
CaloSlaveSD * slave
Definition: CaloSD.h:143
CaloMeanResponse * meanResponse
Definition: CaloSD.h:149
CaloG4HitCollection * theHC
Definition: CaloSD.h:145

Member Function Documentation

G4bool CaloSD::checkHit ( )
protected

Definition at line 331 of file CaloSD.cc.

References checkHits, currentHit, currentID, newFWLiteAna::found, hitMap, j, theHC, updateHit(), and useMap.

Referenced by CastorSD::getFromLibrary(), HCalSD::getFromLibrary(), HCalSD::getFromParam(), HCalSD::getHitFibreBundle(), HCalSD::getHitPMT(), hitExists(), HCalSD::hitForFibre(), and ProcessHits().

331  {
332  //look in the HitContainer whether a hit with the same ID already exists:
333  bool found = false;
334  if (useMap) {
335  std::map<CaloHitID,CaloG4Hit*>::const_iterator it = hitMap.find(currentID);
336  if (it != hitMap.end()) {
337  currentHit = it->second;
338  found = true;
339  }
340  } else {
341  if (checkHits <= 0) return false;
342  int minhit= (theHC->entries()>checkHits ? theHC->entries()-checkHits : 0);
343  int maxhit= theHC->entries()-1;
344 
345  for (int j=maxhit; j>minhit&&!found; --j) {
346  if ((*theHC)[j]->getID() == currentID) {
347  currentHit = (*theHC)[j];
348  found = true;
349  }
350  }
351  }
352 
353  if (found) {
355  return true;
356  } else {
357  return false;
358  }
359 }
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:440
bool useMap
Definition: CaloSD.h:125
int j
Definition: DBlmapReader.cc:9
CaloG4Hit * currentHit
Definition: CaloSD.h:128
CaloHitID currentID
Definition: CaloSD.h:117
std::map< CaloHitID, CaloG4Hit * > hitMap
Definition: CaloSD.h:146
CaloG4HitCollection * theHC
Definition: CaloSD.h:145
int checkHits
Definition: CaloSD.h:124
void CaloSD::cleanHitCollection ( )
private

Definition at line 688 of file CaloSD.cc.

References cleanIndex, correctT, corrTOFBeam, cond::serialization::equal(), filterHit(), CaloG4Hit::getTimeSlice(), hitMap, hitvec, i, cuy::ii, j, LogDebug, evf::evtn::offset(), reusehit, selIndex, python.multivaluedict::sort(), swap(), theHC, cond::rpcobgas::time, totalHits, and useMap.

Referenced by EndOfEvent(), and update().

688  {
689  std::vector<CaloG4Hit*>* theCollection = theHC->GetVector();
690 
691 #ifdef DebugLog
692  LogDebug("CaloSim") << "CaloSD: collection before merging, size = " << theHC->entries();
693 #endif
694 
695  selIndex.reserve(theHC->entries()-cleanIndex);
696  if ( reusehit.size() == 0 ) reusehit.reserve(theHC->entries()-cleanIndex);
697 
698  // if no map used, merge before hits to have the save situation as a map
699  if ( !useMap ) {
700  hitvec.swap(*theCollection);
701  sort((hitvec.begin()+cleanIndex), hitvec.end(), CaloG4HitLess());
702 #ifdef DebugLog
703  LogDebug("CaloSim") << "CaloSD::cleanHitCollection: sort hits in buffer "
704  << "starting from element = " << cleanIndex;
705  for (unsigned int i = 0; i<hitvec.size(); ++i)
706  LogDebug("CaloSim")<<i<<" "<<*hitvec[i];
707 #endif
708  unsigned int i, j;
710  for (i=cleanIndex; i<hitvec.size(); ++i) {
711  selIndex.push_back(i-cleanIndex);
712  int jump = 0;
713  for (j = i+1; j <hitvec.size() && equal(hitvec[i], hitvec[j]); ++j) {
714  ++jump;
715  // merge j to i
716  (*hitvec[i]).addEnergyDeposit(*hitvec[j]);
717  (*hitvec[j]).setEM(0.);
718  (*hitvec[j]).setHadr(0.);
719  reusehit.push_back(hitvec[j]);
720  }
721  i+=jump;
722  }
723 #ifdef DebugLog
724  LogDebug("CaloSim") << "CaloSD: cleanHitCollection merge the hits in buffer ";
725  for (unsigned int i = 0; i<hitvec.size(); ++i)
726  LogDebug("CaloSim")<<i<<" "<<*hitvec[i];
727 #endif
728  for ( unsigned int i = cleanIndex; i < cleanIndex+selIndex.size(); ++i ) {
729  hitvec[i] = hitvec[selIndex[i-cleanIndex]+cleanIndex];
730  }
731  hitvec.resize(cleanIndex+selIndex.size());
732 #ifdef DebugLog
733  LogDebug("CaloSim") << "CaloSD::cleanHitCollection: remove the merged hits in buffer,"
734  << " new size = " << hitvec.size();
735  for (unsigned int i = 0; i<hitvec.size(); ++i)
736  LogDebug("CaloSim")<<i<<" "<<*hitvec[i];
737 #endif
738  hitvec.swap(*theCollection);
739  std::vector<CaloG4Hit*>().swap(hitvec);
740  selIndex.clear();
741  totalHits = theHC->entries();
742  }
743 
744 #ifdef DebugLog
745  LogDebug("CaloSim") << "CaloSD: collection after merging, size = " << theHC->entries();
746 #endif
747 
748  int addhit = 0;
749 
750 #ifdef DebugLog
751  LogDebug("CaloSim") << "CaloSD: Size of reusehit after merge = " << reusehit.size();
752  LogDebug("CaloSim") << "CaloSD: Starting hit selection from index = " << cleanIndex;
753 #endif
754 
755  selIndex.reserve(theCollection->size()-cleanIndex);
756  for (unsigned int i = cleanIndex; i<theCollection->size(); ++i) {
757  CaloG4Hit* aHit((*theCollection)[i]);
758 
759  // selection
760 
761  double time = aHit->getTimeSlice();
762  if (corrTOFBeam) time += correctT;
763  if (!filterHit(aHit,time)) {
764 #ifdef DebugLog
765  LogDebug("CaloSim") << "CaloSD: dropped CaloG4Hit " << " " << *aHit;
766 #endif
767 
768  // create the list of hits to be reused
769 
770  reusehit.push_back((*theCollection)[i]);
771  ++addhit;
772  } else {
773  selIndex.push_back(i-cleanIndex);
774  }
775  }
776 
777 #ifdef DebugLog
778  LogDebug("CaloSim") << "CaloSD: Size of reusehit after selection = " << reusehit.size()
779  << " Number of added hit = " << addhit;
780 #endif
781  if (useMap) {
782  if ( addhit>0 ) {
783  int offset = reusehit.size()-addhit;
784  for (int ii = addhit-1; ii>=0; --ii) {
785  CaloHitID theID = reusehit[offset+ii]->getID();
786  hitMap.erase(theID);
787  }
788  }
789  }
790  for (unsigned int j = 0; j<selIndex.size(); ++j) {
791  (*theCollection)[cleanIndex+j] = (*theCollection)[cleanIndex+selIndex[j]];
792  }
793 
794  theCollection->resize(cleanIndex+selIndex.size());
795  std::vector<unsigned int>().swap(selIndex);
796 
797 #ifdef DebugLog
798  LogDebug("CaloSim") << "CaloSD: hit collection after selection, size = "
799  << theHC->entries();
800  theHC->PrintAllHits();
801 #endif
802 
803  cleanIndex = theHC->entries();
804 }
#define LogDebug(id)
void swap(ora::Record &rh, ora::Record &lh)
Definition: Record.h:70
int i
Definition: DBlmapReader.cc:9
bool corrTOFBeam
Definition: CaloSD.h:132
int totalHits
Definition: CaloSD.h:156
bool useMap
Definition: CaloSD.h:125
int ii
Definition: cuy.py:588
std::vector< CaloG4Hit * > reusehit
Definition: CaloSD.h:153
bool equal(const T &first, const T &second)
Definition: Equal.h:34
int j
Definition: DBlmapReader.cc:9
std::vector< CaloG4Hit * > hitvec
Definition: CaloSD.h:154
std::vector< unsigned int > selIndex
Definition: CaloSD.h:155
unsigned int offset(bool)
virtual bool filterHit(CaloG4Hit *, double)
Definition: CaloSD.cc:597
double correctT
Definition: CaloSD.h:133
std::map< CaloHitID, CaloG4Hit * > hitMap
Definition: CaloSD.h:146
CaloG4HitCollection * theHC
Definition: CaloSD.h:145
int cleanIndex
Definition: CaloSD.h:152
void CaloSD::clear ( void  )
virtual

Definition at line 234 of file CaloSD.cc.

234 {}
void CaloSD::clearHits ( )
protectedvirtual

Implements SensitiveDetector.

Definition at line 556 of file CaloSD.cc.

References cleanIndex, hitMap, i, CaloSlaveSD::Initialize(), LogDebug, previousID, primIDSaved, CaloHitID::reset(), reusehit, slave, swap(), and useMap.

Referenced by update().

556  {
557  if (useMap) hitMap.erase (hitMap.begin(), hitMap.end());
558  for (unsigned int i = 0; i<reusehit.size(); ++i) delete reusehit[i];
559  std::vector<CaloG4Hit*>().swap(reusehit);
560  cleanIndex = 0;
561  previousID.reset();
562  primIDSaved = -99;
563 #ifdef DebugLog
564  LogDebug("CaloSim") << "CaloSD: Clears hit vector for " << GetName() << " " << slave;
565 #endif
566  slave->Initialize();
567 #ifdef DebugLog
568  LogDebug("CaloSim") << "CaloSD: Initialises slave SD for " << GetName();
569 #endif
570 }
#define LogDebug(id)
void swap(ora::Record &rh, ora::Record &lh)
Definition: Record.h:70
virtual void Initialize()
Definition: CaloSlaveSD.cc:21
int i
Definition: DBlmapReader.cc:9
bool useMap
Definition: CaloSD.h:125
int primIDSaved
Definition: CaloSD.h:115
std::vector< CaloG4Hit * > reusehit
Definition: CaloSD.h:153
void reset()
Definition: CaloHitID.cc:53
CaloSlaveSD * slave
Definition: CaloSD.h:143
CaloHitID previousID
Definition: CaloSD.h:117
std::map< CaloHitID, CaloG4Hit * > hitMap
Definition: CaloSD.h:146
int cleanIndex
Definition: CaloSD.h:152
CaloG4Hit * CaloSD::createNewHit ( )
protected

Definition at line 363 of file CaloSD.cc.

References currentID, CaloHitID::depth(), edepositEM, edepositHAD, energyCut, entranceLocal, entrancePoint, forceSave, incidentEnergy, LogDebug, TrackWithHistory::momentum(), NULL, posGlobal, primIDSaved, TrackInformation::putInHistory(), reusehit, TrackWithHistory::save(), CaloG4Hit::setEM(), CaloG4Hit::setEntry(), CaloG4Hit::setEntryLocal(), CaloG4Hit::setHadr(), CaloG4Hit::setID(), CaloG4Hit::setIncidentEnergy(), CaloG4Hit::setPosition(), mathSSE::sqrt(), storeHit(), TrackInformation::storeTrack(), theTrack, CaloHitID::timeSliceID(), tkMap, totalHits, CaloHitID::trackID(), CaloHitID::unitID(), updateHit(), and useMap.

Referenced by ZdcSD::getFromLibrary(), CastorSD::getFromLibrary(), HCalSD::getFromLibrary(), HCalSD::getFromParam(), HCalSD::getHitFibreBundle(), HCalSD::getHitPMT(), HCalSD::hitForFibre(), ZdcSD::ProcessHits(), DreamSD::ProcessHits(), HCalSD::ProcessHits(), and ProcessHits().

363  {
364 #ifdef DebugLog
365  LogDebug("CaloSim") << "CaloSD::CreateNewHit for"
366  << " Unit " << currentID.unitID()
367  << " " << currentID.depth()
368  << " Edeposit = " << edepositEM << " " << edepositHAD;
369  LogDebug("CaloSim") << " primary " << currentID.trackID()
370  << " time slice " << currentID.timeSliceID()
371  << " For Track " << theTrack->GetTrackID()
372  << " which is a " <<theTrack->GetDefinition()->GetParticleName()
373  << " of energy " << theTrack->GetKineticEnergy()/GeV
374  << " " << theTrack->GetMomentum().mag()/GeV
375  << " daughter of part. " << theTrack->GetParentID()
376  << " and created by " ;
377 
378  if (theTrack->GetCreatorProcess()!=NULL)
379  LogDebug("CaloSim") << theTrack->GetCreatorProcess()->GetProcessName() ;
380  else
381  LogDebug("CaloSim") << "NO process";
382 #endif
383 
384  CaloG4Hit* aHit;
385  if (reusehit.size() > 0) {
386  aHit = reusehit[0];
387  aHit->setEM(0.);
388  aHit->setHadr(0.);
389  reusehit.erase(reusehit.begin());
390  } else {
391  aHit = new CaloG4Hit;
392  }
393 
394  aHit->setID(currentID);
397  aHit->setPosition(posGlobal.x(),posGlobal.y(),posGlobal.z());
399  updateHit(aHit);
400 
401  storeHit(aHit);
402  double etrack = 0;
403  if (currentID.trackID() == primIDSaved) { // The track is saved; nothing to be done
404  } else if (currentID.trackID() == theTrack->GetTrackID()) {
405  etrack= theTrack->GetKineticEnergy();
406  //edm::LogInfo("CaloSim") << "CaloSD: set save the track " << currentID.trackID()
407  // << " etrack " << etrack << " eCut " << energyCut << " flag " << forceSave;
408  if (etrack >= energyCut || forceSave) {
409  TrackInformation* trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
410  trkInfo->storeTrack(true);
411  trkInfo->putInHistory();
412  // trkInfo->setAncestor();
413 #ifdef DebugLog
414  LogDebug("CaloSim") << "CaloSD: set save the track " << currentID.trackID()
415  << " with Hit";
416 #endif
417  }
418  } else {
420 #ifdef DebugLog
421  LogDebug("CaloSim") << "CaloSD : TrackwithHistory pointer for "
422  << currentID.trackID() << " is " << trkh;
423 #endif
424  if (trkh != NULL) {
425  etrack = sqrt(trkh->momentum().Mag2());
426  if (etrack >= energyCut) {
427  trkh->save();
428 #ifdef DebugLog
429  LogDebug("CaloSim") << "CaloSD: set save the track "
430  << currentID.trackID() << " with Hit";
431 #endif
432  }
433  }
434  }
436  if (useMap) totalHits++;
437  return aHit;
438 }
#define LogDebug(id)
float edepositEM
Definition: CaloSD.h:121
double energyCut
Definition: CaloSD.h:123
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:440
bool storeTrack() const
int totalHits
Definition: CaloSD.h:156
void setIncidentEnergy(double e)
Definition: CaloG4Hit.h:66
void setEntryLocal(double x, double y, double z)
Definition: CaloG4Hit.h:54
bool useMap
Definition: CaloSD.h:125
#define NULL
Definition: scimark2.h:8
G4ThreeVector posGlobal
Definition: CaloSD.h:113
int primIDSaved
Definition: CaloSD.h:115
uint16_t depth() const
Definition: CaloHitID.h:26
std::vector< CaloG4Hit * > reusehit
Definition: CaloSD.h:153
bool forceSave
Definition: CaloSD.h:137
int timeSliceID() const
Definition: CaloHitID.h:23
float edepositHAD
Definition: CaloSD.h:121
T sqrt(T t)
Definition: SSEVec.h:48
int trackID() const
Definition: CaloHitID.h:25
void setEM(double e)
Definition: CaloG4Hit.h:60
void setID(uint32_t i, double d, int j, uint16_t k=0)
Definition: CaloG4Hit.h:75
void storeHit(CaloG4Hit *)
Definition: CaloSD.cc:616
G4Track * theTrack
Definition: CaloSD.h:118
CaloHitID currentID
Definition: CaloSD.h:117
const math::XYZVectorD & momentum() const
float incidentEnergy
Definition: CaloSD.h:114
void setHadr(double e)
Definition: CaloG4Hit.h:63
void setPosition(double x, double y, double z)
Definition: CaloG4Hit.h:57
void setEntry(double x, double y, double z)
Definition: CaloG4Hit.h:51
std::map< int, TrackWithHistory * > tkMap
Definition: CaloSD.h:148
uint32_t unitID() const
Definition: CaloHitID.h:22
G4ThreeVector entrancePoint
Definition: CaloSD.h:111
G4ThreeVector entranceLocal
Definition: CaloSD.h:112
void CaloSD::DrawAll ( )
virtual

Definition at line 236 of file CaloSD.cc.

236 {}
void CaloSD::EndOfEvent ( G4HCofThisEvent *  eventHC)
virtual

Reimplemented from SensitiveDetector.

Definition at line 222 of file CaloSD.cc.

References cleanHitCollection(), and theHC.

222  {
223  // clean the hits for the last tracks
224 
226 
227 #ifdef DebugLog
228  edm::LogInfo("CaloSim") << "CaloSD: EndofEvent entered with " << theHC->entries()
229  << " entries";
230 #endif
231  // TimeMe("CaloSD:sortAndMergeHits",false);
232 }
void cleanHitCollection()
Definition: CaloSD.cc:688
CaloG4HitCollection * theHC
Definition: CaloSD.h:145
void CaloSD::fillHits ( edm::PCaloHitContainer c,
std::string  n 
)
virtual

Implements SensitiveCaloDetector.

Definition at line 245 of file CaloSD.cc.

References CaloSlaveSD::Clean(), CaloSlaveSD::hits(), n, CaloSlaveSD::name(), and slave.

245  {
246  if (slave->name() == n) c=slave->hits();
247  slave->Clean();
248 }
Collection & hits()
Definition: CaloSlaveSD.h:29
virtual void Clean()
Definition: CaloSlaveSD.cc:43
std::string name() const
Definition: CaloSlaveSD.h:26
CaloSlaveSD * slave
Definition: CaloSD.h:143
bool CaloSD::filterHit ( CaloG4Hit hit,
double  time 
)
protectedvirtual

Reimplemented in HCalSD.

Definition at line 597 of file CaloSD.cc.

References eminHit, eminHitD, CaloG4Hit::getDepth(), CaloG4Hit::getEnergyDeposit(), LogDebug, and tmaxHit.

Referenced by cleanHitCollection().

597  {
598  double emin(eminHit);
599  if (hit->getDepth() > 0) emin = eminHitD;
600 #ifdef DebugLog
601  LogDebug("CaloSim") << "Depth " << hit->getDepth() << " Emin = " << emin << " ("
602  << eminHit << ", " << eminHitD << ")";
603 #endif
604  return ((time <= tmaxHit) && (hit->getEnergyDeposit() > emin));
605 }
#define LogDebug(id)
uint16_t getDepth() const
Definition: CaloG4Hit.h:72
double eminHitD
Definition: CaloSD.h:123
double eminHit
Definition: CaloSD.h:123
double tmaxHit
Definition: CaloSD.h:123
double getEnergyDeposit() const
Definition: CaloG4Hit.h:81
double CaloSD::getAttenuation ( G4Step *  aStep,
double  birk1,
double  birk2,
double  birk3 
)
protected

Definition at line 465 of file CaloSD.cc.

References funct::abs(), trackerHits::c, DeDxDiscriminatorTools::charge(), LogDebug, and histoStyle::weight.

Referenced by EcalTBH4BeamSD::getEnergyDeposit(), HcalTB06BeamSD::getEnergyDeposit(), ECalSD::getEnergyDeposit(), HcalTB02SD::getEnergyDeposit(), HCalSD::getEnergyDeposit(), and DreamSD::getStepInfo().

465  {
466  double weight = 1.;
467  double charge = aStep->GetPreStepPoint()->GetCharge();
468 
469  if (charge != 0. && aStep->GetStepLength() > 0) {
470  G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
471  double density = mat->GetDensity();
472  double dedx = aStep->GetTotalEnergyDeposit()/aStep->GetStepLength();
473  double rkb = birk1/density;
474  double c = birk2*rkb*rkb;
475  if (std::abs(charge) >= 2.) rkb /= birk3; // based on alpha particle data
476  weight = 1./(1.+rkb*dedx+c*dedx*dedx);
477 #ifdef DebugLog
478  LogDebug("CaloSim") << "CaloSD::getAttenuation in " << mat->GetName()
479  << " Charge " << charge << " dE/dx " << dedx
480  << " Birk Const " << rkb << ", " << c << " Weight = "
481  << weight << " dE " << aStep->GetTotalEnergyDeposit();
482 #endif
483  }
484  return weight;
485 }
#define LogDebug(id)
double charge(const std::vector< uint8_t > &Ampls)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int weight
Definition: histoStyle.py:50
uint16_t CaloSD::getDepth ( G4Step *  )
protectedvirtual

Reimplemented in ECalSD.

Definition at line 595 of file CaloSD.cc.

Referenced by getStepInfo(), and ProcessHits().

595 { return 0; }
double CaloSD::getEnergyDeposit ( G4Step *  step)
virtual

Reimplemented in HCalSD, CastorSD, HcalTB02SD, ECalSD, EcalTBH4BeamSD, and HcalTB06BeamSD.

Definition at line 203 of file CaloSD.cc.

Referenced by getStepInfo().

203  {
204  return aStep->GetTotalEnergyDeposit();
205 }
int CaloSD::getNumberOfHits ( )
protected

Definition at line 361 of file CaloSD.cc.

References theHC.

Referenced by HCalSD::ProcessHits().

361 { return theHC->entries(); }
CaloG4HitCollection * theHC
Definition: CaloSD.h:145
double CaloSD::getResponseWt ( G4Track *  aTrack)
protected

Definition at line 607 of file CaloSD.cc.

References TrackInformation::genParticleP(), TrackInformation::genParticlePID(), CaloMeanResponse::getWeight(), and meanResponse.

Referenced by ECalSD::getEnergyDeposit(), and HCalSD::getEnergyDeposit().

607  {
608  if (meanResponse) {
609  TrackInformation * trkInfo = (TrackInformation *)(aTrack->GetUserInformation());
610  return meanResponse->getWeight(trkInfo->genParticlePID(), trkInfo->genParticleP());
611  } else {
612  return 1;
613  }
614 }
double genParticleP() const
double getWeight(int genPID, double genP)
int genParticlePID() const
CaloMeanResponse * meanResponse
Definition: CaloSD.h:149
bool CaloSD::getStepInfo ( G4Step *  aStep)
protectedvirtual

Reimplemented in DreamSD.

Definition at line 250 of file CaloSD.cc.

References currentID, edepositEM, edepositHAD, emPDG, epPDG, archive::flag, gammaPDG, getDepth(), getEnergyDeposit(), getTrackID(), LogDebug, preStepPoint, setDetUnitId(), CaloHitID::setID(), theTrack, cond::rpcobgas::time, and CaloHitID::unitID().

Referenced by ZdcSD::ProcessHits(), HCalSD::ProcessHits(), and ProcessHits().

250  {
251 
252  preStepPoint = aStep->GetPreStepPoint();
253  theTrack = aStep->GetTrack();
254 
255  double time = (aStep->GetPostStepPoint()->GetGlobalTime())/nanosecond;
256  unsigned int unitID= setDetUnitId(aStep);
257  uint16_t depth = getDepth(aStep);
258  int primaryID = getTrackID(theTrack);
259 
260  bool flag = (unitID > 0);
261  if (flag) {
262  currentID.setID(unitID, time, primaryID, depth);
263 #ifdef DebugLog
264  G4TouchableHistory* touch =(G4TouchableHistory*)(theTrack->GetTouchable());
265  LogDebug("CaloSim") << "CaloSD:: GetStepInfo for"
266  << " PV " << touch->GetVolume(0)->GetName()
267  << " PVid = " << touch->GetReplicaNumber(0)
268  << " MVid = " << touch->GetReplicaNumber(1)
269  << " Unit " << currentID.unitID()
270  << " Edeposit = " << edepositEM << " " << edepositHAD;
271  } else {
272  G4TouchableHistory* touch =(G4TouchableHistory*)(theTrack->GetTouchable());
273  LogDebug("CaloSim") << "CaloSD:: GetStepInfo for"
274  << " PV " << touch->GetVolume(0)->GetName()
275  << " PVid = " << touch->GetReplicaNumber(0)
276  << " MVid = " << touch->GetReplicaNumber(1)
277  << " Unit " << std::hex << unitID << std::dec
278  << " Edeposit = " << edepositEM << " " << edepositHAD;
279 #endif
280  }
281 
282  G4int particleCode = theTrack->GetDefinition()->GetPDGEncoding();
283  if (particleCode == emPDG ||
284  particleCode == epPDG ||
285  particleCode == gammaPDG ) {
286  edepositEM = getEnergyDeposit(aStep);
287  edepositHAD = 0.;
288  } else {
289  edepositEM = 0.;
290  edepositHAD = getEnergyDeposit(aStep);
291  }
292 
293  return flag;
294 }
#define LogDebug(id)
float edepositEM
Definition: CaloSD.h:121
virtual uint32_t setDetUnitId(G4Step *step)=0
G4int emPDG
Definition: CaloSD.h:136
virtual int getTrackID(G4Track *)
Definition: CaloSD.cc:574
float edepositHAD
Definition: CaloSD.h:121
G4int epPDG
Definition: CaloSD.h:136
G4int gammaPDG
Definition: CaloSD.h:136
G4Track * theTrack
Definition: CaloSD.h:118
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:44
G4StepPoint * preStepPoint
Definition: CaloSD.h:120
CaloHitID currentID
Definition: CaloSD.h:117
uint32_t unitID() const
Definition: CaloHitID.h:22
virtual uint16_t getDepth(G4Step *)
Definition: CaloSD.cc:595
virtual double getEnergyDeposit(G4Step *step)
Definition: CaloSD.cc:203
int CaloSD::getTrackID ( G4Track *  aTrack)
protectedvirtual

Reimplemented in ECalSD.

Definition at line 574 of file CaloSD.cc.

References forceSave, TrackInformation::getIDonCaloSurface(), LogDebug, and preStepPoint.

Referenced by getStepInfo(), ECalSD::getTrackID(), and ProcessHits().

574  {
575  int primaryID = 0;
576  forceSave = false;
577  TrackInformation* trkInfo=(TrackInformation *)(aTrack->GetUserInformation());
578  if (trkInfo) {
579  primaryID = trkInfo->getIDonCaloSurface();
580 #ifdef DebugLog
581  LogDebug("CaloSim") << "CaloSD: hit update from track Id on Calo Surface "
582  << trkInfo->getIDonCaloSurface();
583 #endif
584  } else {
585  primaryID = aTrack->GetTrackID();
586 #ifdef DebugLog
587  edm::LogWarning("CaloSim") << "CaloSD: Problem with primaryID **** set by "
588  << "force to TkID **** " << primaryID << " in "
589  << preStepPoint->GetTouchable()->GetVolume(0)->GetName();
590 #endif
591  }
592  return primaryID;
593 }
#define LogDebug(id)
int getIDonCaloSurface() const
bool forceSave
Definition: CaloSD.h:137
G4StepPoint * preStepPoint
Definition: CaloSD.h:120
G4bool CaloSD::hitExists ( )
protected

Definition at line 310 of file CaloSD.cc.

References checkHit(), currentHit, currentID, posGlobal, preStepPoint, previousID, resetForNewPrimary(), CaloHitID::trackID(), and updateHit().

Referenced by ZdcSD::ProcessHits(), DreamSD::ProcessHits(), HCalSD::ProcessHits(), and ProcessHits().

310  {
311 #ifdef DebugLog
312  if (currentID.trackID()<1)
313  edm::LogWarning("CaloSim") << "***** CaloSD error: primaryID = "
314  << currentID.trackID()
315  << " maybe detector name changed";
316 #endif
317  // Update if in the same detector, time-slice and for same track
318  if (currentID == previousID) {
320  return true;
321  }
322 
323  // Reset entry point for new primary
324  posGlobal = preStepPoint->GetPosition();
325  if (currentID.trackID() != previousID.trackID())
326  resetForNewPrimary(preStepPoint->GetPosition(), preStepPoint->GetKineticEnergy());
327 
328  return checkHit();
329 }
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:440
G4ThreeVector posGlobal
Definition: CaloSD.h:113
G4bool checkHit()
Definition: CaloSD.cc:331
void resetForNewPrimary(const G4ThreeVector &, double)
Definition: CaloSD.cc:454
int trackID() const
Definition: CaloHitID.h:25
CaloHitID previousID
Definition: CaloSD.h:117
CaloG4Hit * currentHit
Definition: CaloSD.h:128
G4StepPoint * preStepPoint
Definition: CaloSD.h:120
CaloHitID currentID
Definition: CaloSD.h:117
void CaloSD::Initialize ( G4HCofThisEvent *  HCE)
virtual

Reimplemented from SensitiveDetector.

Definition at line 207 of file CaloSD.cc.

References ecaldqm::collectionName, hcID, theHC, and totalHits.

207  {
208  totalHits = 0;
209 
210 #ifdef DebugLog
211  edm::LogInfo("CaloSim") << "CaloSD : Initialize called for " << GetName();
212 #endif
213 
214  //This initialization is performed at the beginning of an event
215  //------------------------------------------------------------
216  theHC = new CaloG4HitCollection(GetName(), collectionName[0]);
217 
218  if (hcID<0) hcID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
219  HCE->AddHitsCollection(hcID, theHC);
220 }
int totalHits
Definition: CaloSD.h:156
int hcID
Definition: CaloSD.h:144
std::string const collectionName[nCollections]
Definition: Collections.h:45
CaloG4HitCollection * theHC
Definition: CaloSD.h:145
G4THitsCollection< CaloG4Hit > CaloG4HitCollection
void CaloSD::initRun ( )
protectedvirtual

Reimplemented in CastorSD, HCalSD, DreamSD, and ZdcSD.

Definition at line 572 of file CaloSD.cc.

Referenced by update().

572 {}
void CaloSD::PrintAll ( )
virtual

Definition at line 238 of file CaloSD.cc.

References theHC.

238  {
239 #ifdef DebugLog
240  edm::LogInfo("CaloSim") << "CaloSD: Collection " << theHC->GetName();
241 #endif
242  theHC->PrintAllHits();
243 }
CaloG4HitCollection * theHC
Definition: CaloSD.h:145
bool CaloSD::ProcessHits ( G4Step *  step,
G4TouchableHistory *  tHistory 
)
virtual

Implements SensitiveDetector.

Reimplemented in HCalSD, DreamSD, and ZdcSD.

Definition at line 119 of file CaloSD.cc.

References createNewHit(), currentHit, edepositEM, edepositHAD, getStepInfo(), hitExists(), SensitiveDetector::NaNTrap(), and NULL.

119  {
120 
121  NaNTrap( aStep ) ;
122 
123  if (aStep == NULL) {
124  return true;
125  } else {
126  if (getStepInfo(aStep)) {
127  if (hitExists() == false && edepositEM+edepositHAD>0.)
129  }
130  }
131  return true;
132 }
float edepositEM
Definition: CaloSD.h:121
#define NULL
Definition: scimark2.h:8
float edepositHAD
Definition: CaloSD.h:121
CaloG4Hit * currentHit
Definition: CaloSD.h:128
void NaNTrap(G4Step *step)
virtual G4bool getStepInfo(G4Step *aStep)
Definition: CaloSD.cc:250
G4bool hitExists()
Definition: CaloSD.cc:310
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:363
bool CaloSD::ProcessHits ( G4GFlashSpot *  aSpot,
G4TouchableHistory *   
)
virtual

Definition at line 134 of file CaloSD.cc.

References checkHit(), createNewHit(), currentHit, currentID, edepositEM, edepositHAD, emPDG, entranceLocal, entrancePoint, epPDG, gammaPDG, getDepth(), getTrackID(), incidentEnergy, LogDebug, NULL, posGlobal, preStepPoint, previousID, setDetUnitId(), CaloHitID::setID(), theTrack, cond::rpcobgas::time, CaloHitID::trackID(), CaloHitID::unitID(), and updateHit().

134  {
135 
136  if (aSpot != NULL) {
137  theTrack = const_cast<G4Track *>(aSpot->GetOriginatorTrack()->GetPrimaryTrack());
138  G4int particleCode = theTrack->GetDefinition()->GetPDGEncoding();
139 
140  if (particleCode == emPDG ||
141  particleCode == epPDG ||
142  particleCode == gammaPDG ) {
143  edepositEM = aSpot->GetEnergySpot()->GetEnergy();
144  edepositHAD = 0.;
145  } else {
146  edepositEM = 0.;
147  edepositHAD = 0.;
148  }
149 
150  if (edepositEM>0.) {
151  G4Step * fFakeStep = new G4Step();
152  preStepPoint = fFakeStep->GetPreStepPoint();
153  G4StepPoint * fFakePostStepPoint = fFakeStep->GetPostStepPoint();
154  preStepPoint->SetPosition(aSpot->GetPosition());
155  fFakePostStepPoint->SetPosition(aSpot->GetPosition());
156 
157  G4TouchableHandle fTouchableHandle = aSpot->GetTouchableHandle();
158  preStepPoint->SetTouchableHandle(fTouchableHandle);
159  fFakeStep->SetTotalEnergyDeposit(aSpot->GetEnergySpot()->GetEnergy());
160 
161  double time = 0;
162  unsigned int unitID = setDetUnitId(fFakeStep);
163  int primaryID = getTrackID(theTrack);
164  uint16_t depth = getDepth(fFakeStep);
165 
166  if (unitID > 0) {
167  currentID.setID(unitID, time, primaryID, depth);
168 #ifdef DebugLog
169  LogDebug("CaloSim") << "CaloSD:: GetSpotInfo for"
170  << " Unit 0x" << std::hex << currentID.unitID()
171  << std::dec << " Edeposit = " << edepositEM << " "
172  << edepositHAD;
173 #endif
174  // Update if in the same detector, time-slice and for same track
175  if (currentID == previousID) {
177  } else {
178  posGlobal = aSpot->GetEnergySpot()->GetPosition();
179  // Reset entry point for new primary
180  if (currentID.trackID() != previousID.trackID()) {
181  entrancePoint = aSpot->GetPosition();
182  entranceLocal = aSpot->GetTouchableHandle()->GetHistory()->
183  GetTopTransform().TransformPoint(entrancePoint);
184  incidentEnergy = theTrack->GetKineticEnergy();
185 #ifdef DebugLog
186  LogDebug("CaloSim") << "CaloSD: Incident energy "
187  << incidentEnergy/GeV << " GeV and"
188  << " entrance point " << entrancePoint
189  << " (Global) " << entranceLocal << " (Local)";
190 #endif
191  }
192 
193  if (checkHit() == false) currentHit = createNewHit();
194  }
195  }
196  delete fFakeStep;
197  }
198  return true;
199  }
200  return false;
201 }
#define LogDebug(id)
float edepositEM
Definition: CaloSD.h:121
virtual uint32_t setDetUnitId(G4Step *step)=0
G4int emPDG
Definition: CaloSD.h:136
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:440
virtual int getTrackID(G4Track *)
Definition: CaloSD.cc:574
#define NULL
Definition: scimark2.h:8
G4ThreeVector posGlobal
Definition: CaloSD.h:113
G4bool checkHit()
Definition: CaloSD.cc:331
float edepositHAD
Definition: CaloSD.h:121
int trackID() const
Definition: CaloHitID.h:25
G4int epPDG
Definition: CaloSD.h:136
G4int gammaPDG
Definition: CaloSD.h:136
CaloHitID previousID
Definition: CaloSD.h:117
CaloG4Hit * currentHit
Definition: CaloSD.h:128
G4Track * theTrack
Definition: CaloSD.h:118
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:44
G4StepPoint * preStepPoint
Definition: CaloSD.h:120
CaloHitID currentID
Definition: CaloSD.h:117
float incidentEnergy
Definition: CaloSD.h:114
uint32_t unitID() const
Definition: CaloHitID.h:22
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:363
virtual uint16_t getDepth(G4Step *)
Definition: CaloSD.cc:595
G4ThreeVector entrancePoint
Definition: CaloSD.h:111
G4ThreeVector entranceLocal
Definition: CaloSD.h:112
void CaloSD::resetForNewPrimary ( const G4ThreeVector &  point,
double  energy 
)
protected

Definition at line 454 of file CaloSD.cc.

References relval_parameters_module::energy, entranceLocal, entrancePoint, incidentEnergy, LogDebug, point, preStepPoint, and setToLocal().

Referenced by ZdcSD::getFromLibrary(), CastorSD::getFromLibrary(), HCalSD::getFromLibrary(), HCalSD::getHitFibreBundle(), HCalSD::getHitPMT(), hitExists(), ZdcSD::setTrackID(), CastorSD::setTrackID(), and HCalSD::setTrackID().

454  {
458 #ifdef DebugLog
459  LogDebug("CaloSim") << "CaloSD: Incident energy " << incidentEnergy/GeV
460  << " GeV and" << " entrance point " << entrancePoint
461  << " (Global) " << entranceLocal << " (Local)";
462 #endif
463 }
#define LogDebug(id)
G4StepPoint * preStepPoint
Definition: CaloSD.h:120
float incidentEnergy
Definition: CaloSD.h:114
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
G4ThreeVector entrancePoint
Definition: CaloSD.h:111
G4ThreeVector entranceLocal
Definition: CaloSD.h:112
G4ThreeVector setToLocal(const G4ThreeVector &, const G4VTouchable *)
Definition: CaloSD.cc:296
bool CaloSD::saveHit ( CaloG4Hit aHit)
private

Definition at line 627 of file CaloSD.cc.

References correctT, corrTOFBeam, CaloG4Hit::getDepth(), CaloG4Hit::getEM(), CaloG4Hit::getHadr(), CaloG4Hit::getTimeSlice(), CaloG4Hit::getTrackID(), CaloG4Hit::getUnitID(), SimTrackManager::giveMotherNeeded(), LogDebug, m_trackManager, convertSQLiteXML::ok, CaloSlaveSD::processHits(), slave, cond::rpcobgas::time, and SimTrackManager::trackExists().

Referenced by update().

627  {
628  int tkID;
629  bool ok = true;
630  if (m_trackManager) {
631  tkID = m_trackManager->giveMotherNeeded(aHit->getTrackID());
632  if (tkID == 0) {
633  if (m_trackManager->trackExists(aHit->getTrackID())) tkID = (aHit->getTrackID());
634  else {
635  ok = false;
636  }
637  }
638  } else {
639  tkID = aHit->getTrackID();
640  ok = false;
641  }
642  // edm::LogInfo("CaloSim") << "CalosD: Track ID " << aHit->getTrackID() << " changed to " << tkID << " by SimTrackManager" << " Status " << ok;
643 #ifdef DebugLog
644  LogDebug("CaloSim") << "CalosD: Track ID " << aHit->getTrackID()
645  << " changed to " << tkID << " by SimTrackManager"
646  << " Status " << ok;
647 #endif
648  double time = aHit->getTimeSlice();
649  if (corrTOFBeam) time += correctT;
650  slave->processHits(aHit->getUnitID(), aHit->getEM()/GeV,
651  aHit->getHadr()/GeV, time, tkID, aHit->getDepth());
652 #ifdef DebugLog
653  LogDebug("CaloSim") << "CaloSD: Store Hit at " << std::hex
654  << aHit->getUnitID() << std::dec << " "
655  << aHit->getDepth() << " due to " << tkID
656  << " in time " << time << " of energy "
657  << aHit->getEM()/GeV << " GeV (EM) and "
658  << aHit->getHadr()/GeV << " GeV (Hadr)";
659 #endif
660  return ok;
661 }
#define LogDebug(id)
virtual bool processHits(uint32_t, double, double, double, int, uint16_t depth=0)
Definition: CaloSlaveSD.cc:34
bool corrTOFBeam
Definition: CaloSD.h:132
uint16_t getDepth() const
Definition: CaloG4Hit.h:72
bool trackExists(unsigned int i) const
CaloSlaveSD * slave
Definition: CaloSD.h:143
int giveMotherNeeded(int i) const
int getTrackID() const
Definition: CaloG4Hit.h:68
double correctT
Definition: CaloSD.h:133
double getEM() const
Definition: CaloG4Hit.h:59
double getTimeSlice() const
Definition: CaloG4Hit.h:70
const SimTrackManager * m_trackManager
Definition: CaloSD.h:127
uint32_t getUnitID() const
Definition: CaloG4Hit.h:69
double getHadr() const
Definition: CaloG4Hit.h:62
virtual uint32_t CaloSD::setDetUnitId ( G4Step *  step)
pure virtual
G4ThreeVector CaloSD::setToGlobal ( const G4ThreeVector &  local,
const G4VTouchable *  touch 
)
protected

Definition at line 303 of file CaloSD.cc.

303  {
304 
305  G4ThreeVector globalPoint = touch->GetHistory()->GetTopTransform().Inverse().TransformPoint(local);
306 
307  return globalPoint;
308 }
G4ThreeVector CaloSD::setToLocal ( const G4ThreeVector &  global,
const G4VTouchable *  touch 
)
protected

Definition at line 296 of file CaloSD.cc.

Referenced by DreamSD::curve_LY(), HcalTB02SD::curve_LY(), ECalSD::curve_LY(), ECalSD::getRadiationLength(), resetForNewPrimary(), and HcalTB06BeamSD::setDetUnitId().

296  {
297 
298  G4ThreeVector localPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
299 
300  return localPoint;
301 }
void CaloSD::storeHit ( CaloG4Hit hit)
private

Definition at line 616 of file CaloSD.cc.

References hitMap, previousID, theHC, CaloHitID::trackID(), and useMap.

Referenced by createNewHit().

616  {
617  if (previousID.trackID()<0) return;
618  if (hit == 0) {
619  edm::LogWarning("CaloSim") << "CaloSD: hit to be stored is NULL !!";
620  return;
621  }
622 
623  theHC->insert(hit);
624  if (useMap) hitMap.insert(std::pair<CaloHitID,CaloG4Hit*>(previousID,hit));
625 }
bool useMap
Definition: CaloSD.h:125
int trackID() const
Definition: CaloHitID.h:25
CaloHitID previousID
Definition: CaloSD.h:117
std::map< CaloHitID, CaloG4Hit * > hitMap
Definition: CaloSD.h:146
CaloG4HitCollection * theHC
Definition: CaloSD.h:145
void CaloSD::summarize ( )
private

Definition at line 663 of file CaloSD.cc.

Referenced by update().

663 {}
void CaloSD::update ( const BeginOfRun )
protectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 487 of file CaloSD.cc.

References emPDG, epPDG, gammaPDG, initRun(), LogDebug, and runInit.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

487  {
488  G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
489  G4String particleName;
490  emPDG = theParticleTable->FindParticle(particleName="e-")->GetPDGEncoding();
491  epPDG = theParticleTable->FindParticle(particleName="e+")->GetPDGEncoding();
492  gammaPDG = theParticleTable->FindParticle(particleName="gamma")->GetPDGEncoding();
493 #ifdef DebugLog
494  LogDebug("CaloSim") << "CaloSD: Particle code for e- = " << emPDG
495  << " for e+ = " << epPDG << " for gamma = " << gammaPDG;
496 #endif
497  initRun();
498  runInit = true;
499 }
#define LogDebug(id)
G4int emPDG
Definition: CaloSD.h:136
G4int epPDG
Definition: CaloSD.h:136
G4int gammaPDG
Definition: CaloSD.h:136
virtual void initRun()
Definition: CaloSD.cc:572
bool runInit
Definition: CaloSD.h:130
void CaloSD::update ( const BeginOfEvent )
protectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 501 of file CaloSD.cc.

References clearHits(), and LogDebug.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

501  {
502 #ifdef DebugLog
503  LogDebug("CaloSim") << "CaloSD: Dispatched BeginOfEvent for " << GetName()
504  << " !" ;
505 #endif
506  clearHits();
507 }
#define LogDebug(id)
virtual void clearHits()
Definition: CaloSD.cc:556
void CaloSD::update ( const BeginOfTrack )
protectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 665 of file CaloSD.cc.

References cleanHitCollection(), TrackInformation::isPrimary(), LogDebug, primAncestor, and theHC.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

665  {
666  int primary = -1;
667  TrackInformation * trkInfo = (TrackInformation *)((*trk)()->GetUserInformation());
668  if ( trkInfo->isPrimary() ) primary = (*trk)()->GetTrackID();
669 
670 #ifdef DebugLog
671  LogDebug("CaloSim") << "New track: isPrimary " << trkInfo->isPrimary()
672  << " primary ID = " << primary
673  << " primary ancestor ID " << primAncestor;
674 #endif
675 
676  // update the information if a different primary track ID
677 
678  if (primary > 0 && primary != primAncestor) {
679  primAncestor = primary;
680 
681  // clean the hits information
682 
683  if (theHC->entries()>0) cleanHitCollection();
684 
685  }
686 }
#define LogDebug(id)
int primAncestor
Definition: CaloSD.h:151
void cleanHitCollection()
Definition: CaloSD.cc:688
bool isPrimary() const
CaloG4HitCollection * theHC
Definition: CaloSD.h:145
void CaloSD::update ( const EndOfTrack )
protectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfTrack * >.

Definition at line 509 of file CaloSD.cc.

References TrackInformation::getIDonCaloSurface(), LogDebug, m_trackManager, NULL, tkMap, SimTrackManager::trackContainer(), and TrackWithHistory::trackID().

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

509  {
510  int id = (*trk)()->GetTrackID();
511  TrackInformation *trkI =(TrackInformation *)((*trk)()->GetUserInformation());
512  int lastTrackID = -1;
513  if (trkI) lastTrackID = trkI->getIDonCaloSurface();
514  if (id == lastTrackID) {
515  const TrackContainer * trksForThisEvent = m_trackManager->trackContainer();
516  if (trksForThisEvent != NULL) {
517  int it = (int)(trksForThisEvent->size()) - 1;
518  if (it >= 0) {
519  TrackWithHistory * trkH = (*trksForThisEvent)[it];
520  if (trkH->trackID() == (unsigned int)(id)) tkMap[id] = trkH;
521 #ifdef DebugLog
522  LogDebug("CaloSim") << "CaloSD: get track " << it << " from "
523  << "Container of size " << trksForThisEvent->size()
524  << " with ID " << trkH->trackID();
525  } else {
526  LogDebug("CaloSim") << "CaloSD: get track " << it << " from "
527  << "Container of size " << trksForThisEvent->size()
528  << " with no ID";
529 #endif
530  }
531  }
532  }
533 }
#define LogDebug(id)
int getIDonCaloSurface() const
#define NULL
Definition: scimark2.h:8
const TrackContainer * trackContainer() const
std::vector< TrackWithHistory * > TrackContainer
Definition: TrackContainer.h:8
unsigned int trackID() const
std::map< int, TrackWithHistory * > tkMap
Definition: CaloSD.h:148
const SimTrackManager * m_trackManager
Definition: CaloSD.h:127
void CaloSD::update ( const ::EndOfEvent )
protectedvirtual

Definition at line 535 of file CaloSD.cc.

References prof2calltree::count, i, convertSQLiteXML::ok, CaloSlaveSD::ReserveMemory(), saveHit(), slave, summarize(), theHC, tkMap, and totalHits.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

535  {
536  int count = 0, wrong = 0;
537  bool ok;
538 
539  slave->ReserveMemory(theHC->entries());
540 
541  for (int i=0; i<theHC->entries(); ++i) {
542  ok = saveHit((*theHC)[i]);
543  ++count;
544  if (!ok) ++wrong;
545  }
546 
547  edm::LogInfo("CaloSim") << "CaloSD: " << GetName() << " store " << count
548  << " hits recorded with " << wrong
549  << " track IDs not given properly and "
550  << totalHits-count << " hits not passing cuts";
551  summarize();
552 
553  tkMap.erase (tkMap.begin(), tkMap.end());
554 }
int i
Definition: DBlmapReader.cc:9
int totalHits
Definition: CaloSD.h:156
virtual void ReserveMemory(unsigned int size)
Definition: CaloSlaveSD.cc:50
CaloSlaveSD * slave
Definition: CaloSD.h:143
void summarize()
Definition: CaloSD.cc:663
CaloG4HitCollection * theHC
Definition: CaloSD.h:145
std::map< int, TrackWithHistory * > tkMap
Definition: CaloSD.h:148
bool saveHit(CaloG4Hit *)
Definition: CaloSD.cc:627
void CaloSD::updateHit ( CaloG4Hit aHit)
protected

Definition at line 440 of file CaloSD.cc.

References CaloG4Hit::addEnergyDeposit(), currentID, edepositEM, edepositHAD, LogDebug, and previousID.

Referenced by checkHit(), createNewHit(), ZdcSD::getFromLibrary(), CastorSD::getFromLibrary(), HCalSD::getFromLibrary(), HCalSD::getFromParam(), HCalSD::getHitFibreBundle(), HCalSD::getHitPMT(), hitExists(), HCalSD::hitForFibre(), and ProcessHits().

440  {
441  if (edepositEM+edepositHAD != 0) {
443 #ifdef DebugLog
444  LogDebug("CaloSim") << "CaloSD: Add energy deposit in " << currentID
445  << " em " << edepositEM/MeV << " hadronic "
446  << edepositHAD/MeV << " MeV";
447 #endif
448  }
449 
450  // buffer for next steps:
452 }
#define LogDebug(id)
float edepositEM
Definition: CaloSD.h:121
void addEnergyDeposit(double em, double hd)
Definition: CaloG4Hit.cc:47
float edepositHAD
Definition: CaloSD.h:121
CaloHitID previousID
Definition: CaloSD.h:117
CaloHitID currentID
Definition: CaloSD.h:117

Member Data Documentation

int CaloSD::checkHits
protected

Definition at line 124 of file CaloSD.h.

Referenced by CaloSD(), and checkHit().

int CaloSD::cleanIndex
private

Definition at line 152 of file CaloSD.h.

Referenced by CaloSD(), cleanHitCollection(), and clearHits().

double CaloSD::correctT
protected

Definition at line 133 of file CaloSD.h.

Referenced by CaloSD(), cleanHitCollection(), and saveHit().

bool CaloSD::corrTOFBeam
protected

Definition at line 132 of file CaloSD.h.

Referenced by CaloSD(), cleanHitCollection(), and saveHit().

CaloG4Hit* CaloSD::currentHit
protected
CaloHitID CaloSD::currentID
protected
float CaloSD::edepositEM
protected
float CaloSD::edepositHAD
protected
double CaloSD::eminHit
protected

Definition at line 123 of file CaloSD.h.

Referenced by CaloSD(), and filterHit().

double CaloSD::eminHitD
protected

Definition at line 123 of file CaloSD.h.

Referenced by CaloSD(), and filterHit().

G4int CaloSD::emPDG
protected
double CaloSD::energyCut
protected

Definition at line 123 of file CaloSD.h.

Referenced by CaloSD(), createNewHit(), HCalSD::getHitFibreBundle(), and HCalSD::getHitPMT().

G4ThreeVector CaloSD::entranceLocal
protected

Definition at line 112 of file CaloSD.h.

Referenced by createNewHit(), ZdcSD::getFromLibrary(), ProcessHits(), and resetForNewPrimary().

G4ThreeVector CaloSD::entrancePoint
protected

Definition at line 111 of file CaloSD.h.

Referenced by createNewHit(), ZdcSD::getFromLibrary(), ProcessHits(), and resetForNewPrimary().

G4int CaloSD::epPDG
protected
bool CaloSD::forceSave
protected

Definition at line 137 of file CaloSD.h.

Referenced by CaloSD(), createNewHit(), ECalSD::getTrackID(), and getTrackID().

G4int CaloSD::gammaPDG
protected
int CaloSD::hcID
private

Definition at line 144 of file CaloSD.h.

Referenced by Initialize().

std::map<CaloHitID,CaloG4Hit*> CaloSD::hitMap
private

Definition at line 146 of file CaloSD.h.

Referenced by checkHit(), cleanHitCollection(), clearHits(), and storeHit().

std::vector<CaloG4Hit*> CaloSD::hitvec
private

Definition at line 154 of file CaloSD.h.

Referenced by cleanHitCollection().

bool CaloSD::ignoreTrackID
private

Definition at line 142 of file CaloSD.h.

Referenced by CaloSD().

float CaloSD::incidentEnergy
protected

Definition at line 114 of file CaloSD.h.

Referenced by createNewHit(), ProcessHits(), and resetForNewPrimary().

double CaloSD::kmaxIon
protected
double CaloSD::kmaxNeutron
protected
double CaloSD::kmaxProton
protected
const SimTrackManager* CaloSD::m_trackManager
protected

Definition at line 127 of file CaloSD.h.

Referenced by saveHit(), and update().

CaloMeanResponse* CaloSD::meanResponse
private

Definition at line 149 of file CaloSD.h.

Referenced by CaloSD(), getResponseWt(), and ~CaloSD().

G4ThreeVector CaloSD::posGlobal
protected
G4StepPoint* CaloSD::preStepPoint
protected
CaloHitID CaloSD::previousID
protected
int CaloSD::primAncestor
private

Definition at line 151 of file CaloSD.h.

Referenced by CaloSD(), and update().

int CaloSD::primIDSaved
protected

Definition at line 115 of file CaloSD.h.

Referenced by clearHits(), and createNewHit().

std::vector<CaloG4Hit*> CaloSD::reusehit
private

Definition at line 153 of file CaloSD.h.

Referenced by cleanHitCollection(), clearHits(), and createNewHit().

bool CaloSD::runInit
protected

Definition at line 130 of file CaloSD.h.

Referenced by update().

std::vector<unsigned int> CaloSD::selIndex
private

Definition at line 155 of file CaloSD.h.

Referenced by cleanHitCollection().

CaloSlaveSD* CaloSD::slave
private

Definition at line 143 of file CaloSD.h.

Referenced by CaloSD(), clearHits(), fillHits(), saveHit(), update(), and ~CaloSD().

bool CaloSD::suppressHeavy
protected
CaloG4HitCollection* CaloSD::theHC
private
G4Track* CaloSD::theTrack
protected
int CaloSD::timeSlice
private

Definition at line 141 of file CaloSD.h.

Referenced by CaloSD().

std::map<int,TrackWithHistory*> CaloSD::tkMap
private

Definition at line 148 of file CaloSD.h.

Referenced by createNewHit(), and update().

double CaloSD::tmaxHit
protected

Definition at line 123 of file CaloSD.h.

Referenced by CaloSD(), HCalSD::filterHit(), and filterHit().

int CaloSD::totalHits
private

Definition at line 156 of file CaloSD.h.

Referenced by CaloSD(), cleanHitCollection(), createNewHit(), Initialize(), and update().

bool CaloSD::useMap
protected

Definition at line 125 of file CaloSD.h.

Referenced by CaloSD(), checkHit(), cleanHitCollection(), clearHits(), createNewHit(), and storeHit().