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 (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 (G4ThreeVector, double)
 
G4ThreeVector setToGlobal (G4ThreeVector, const G4VTouchable *)
 
G4ThreeVector setToLocal (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 21 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.

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

References meanResponse, slave, and theHC.

110  {
111  if (slave) delete slave;
112  if (theHC) delete theHC;
113  if (meanResponse) delete meanResponse;
114 }
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 328 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().

328  {
329  //look in the HitContainer whether a hit with the same ID already exists:
330  bool found = false;
331  if (useMap) {
332  std::map<CaloHitID,CaloG4Hit*>::const_iterator it = hitMap.find(currentID);
333  if (it != hitMap.end()) {
334  currentHit = it->second;
335  found = true;
336  }
337  } else {
338  if (checkHits <= 0) return false;
339  int minhit= (theHC->entries()>checkHits ? theHC->entries()-checkHits : 0);
340  int maxhit= theHC->entries()-1;
341 
342  for (int j=maxhit; j>minhit&&!found; --j) {
343  if ((*theHC)[j]->getID() == currentID) {
344  currentHit = (*theHC)[j];
345  found = true;
346  }
347  }
348  }
349 
350  if (found) {
352  return true;
353  } else {
354  return false;
355  }
356 }
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:437
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 685 of file CaloSD.cc.

References cleanIndex, correctT, corrTOFBeam, 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().

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

231 {}
void CaloSD::clearHits ( )
protectedvirtual

Implements SensitiveDetector.

Definition at line 553 of file CaloSD.cc.

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

Referenced by update().

553  {
554  if (useMap) hitMap.erase (hitMap.begin(), hitMap.end());
555  for (unsigned int i = 0; i<reusehit.size(); ++i) delete reusehit[i];
556  std::vector<CaloG4Hit*>().swap(reusehit);
557  cleanIndex = 0;
558  previousID.reset();
559  primIDSaved = -99;
560 #ifdef DebugLog
561  LogDebug("CaloSim") << "CaloSD: Clears hit vector for " << GetName() << " " << slave;
562 #endif
563  slave->Initialize();
564 #ifdef DebugLog
565  LogDebug("CaloSim") << "CaloSD: Initialises slave SD for " << GetName();
566 #endif
567 }
#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 360 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().

360  {
361 #ifdef DebugLog
362  LogDebug("CaloSim") << "CaloSD::CreateNewHit for"
363  << " Unit " << currentID.unitID()
364  << " " << currentID.depth()
365  << " Edeposit = " << edepositEM << " " << edepositHAD;
366  LogDebug("CaloSim") << " primary " << currentID.trackID()
367  << " time slice " << currentID.timeSliceID()
368  << " For Track " << theTrack->GetTrackID()
369  << " which is a " <<theTrack->GetDefinition()->GetParticleName()
370  << " of energy " << theTrack->GetKineticEnergy()/GeV
371  << " " << theTrack->GetMomentum().mag()/GeV
372  << " daughter of part. " << theTrack->GetParentID()
373  << " and created by " ;
374 
375  if (theTrack->GetCreatorProcess()!=NULL)
376  LogDebug("CaloSim") << theTrack->GetCreatorProcess()->GetProcessName() ;
377  else
378  LogDebug("CaloSim") << "NO process";
379 #endif
380 
381  CaloG4Hit* aHit;
382  if (reusehit.size() > 0) {
383  aHit = reusehit[0];
384  aHit->setEM(0.);
385  aHit->setHadr(0.);
386  reusehit.erase(reusehit.begin());
387  } else {
388  aHit = new CaloG4Hit;
389  }
390 
391  aHit->setID(currentID);
394  aHit->setPosition(posGlobal.x(),posGlobal.y(),posGlobal.z());
396  updateHit(aHit);
397 
398  storeHit(aHit);
399  double etrack = 0;
400  if (currentID.trackID() == primIDSaved) { // The track is saved; nothing to be done
401  } else if (currentID.trackID() == theTrack->GetTrackID()) {
402  etrack= theTrack->GetKineticEnergy();
403  //edm::LogInfo("CaloSim") << "CaloSD: set save the track " << currentID.trackID()
404  // << " etrack " << etrack << " eCut " << energyCut << " flag " << forceSave;
405  if (etrack >= energyCut || forceSave) {
406  TrackInformation* trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
407  trkInfo->storeTrack(true);
408  trkInfo->putInHistory();
409  // trkInfo->setAncestor();
410 #ifdef DebugLog
411  LogDebug("CaloSim") << "CaloSD: set save the track " << currentID.trackID()
412  << " with Hit";
413 #endif
414  }
415  } else {
417 #ifdef DebugLog
418  LogDebug("CaloSim") << "CaloSD : TrackwithHistory pointer for "
419  << currentID.trackID() << " is " << trkh;
420 #endif
421  if (trkh != NULL) {
422  etrack = sqrt(trkh->momentum().Mag2());
423  if (etrack >= energyCut) {
424  trkh->save();
425 #ifdef DebugLog
426  LogDebug("CaloSim") << "CaloSD: set save the track "
427  << currentID.trackID() << " with Hit";
428 #endif
429  }
430  }
431  }
433  if (useMap) totalHits++;
434  return aHit;
435 }
#define LogDebug(id)
float edepositEM
Definition: CaloSD.h:121
double energyCut
Definition: CaloSD.h:123
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:437
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:613
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 233 of file CaloSD.cc.

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

Reimplemented from SensitiveDetector.

Definition at line 219 of file CaloSD.cc.

References cleanHitCollection(), and theHC.

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

Implements SensitiveCaloDetector.

Definition at line 242 of file CaloSD.cc.

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

242  {
243  if (slave->name() == n) c=slave->hits();
244  slave->Clean();
245 }
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 594 of file CaloSD.cc.

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

Referenced by cleanHitCollection().

594  {
595  double emin(eminHit);
596  if (hit->getDepth() > 0) emin = eminHitD;
597 #ifdef DebugLog
598  LogDebug("CaloSim") << "Depth " << hit->getDepth() << " Emin = " << emin << " ("
599  << eminHit << ", " << eminHitD << ")";
600 #endif
601  return ((time <= tmaxHit) && (hit->getEnergyDeposit() > emin));
602 }
#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 462 of file CaloSD.cc.

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

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

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

Reimplemented in ECalSD.

Definition at line 592 of file CaloSD.cc.

Referenced by getStepInfo(), and ProcessHits().

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

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

Definition at line 200 of file CaloSD.cc.

Referenced by getStepInfo().

200  {
201  return aStep->GetTotalEnergyDeposit();
202 }
int CaloSD::getNumberOfHits ( )
protected

Definition at line 358 of file CaloSD.cc.

References theHC.

Referenced by HCalSD::ProcessHits().

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

Definition at line 604 of file CaloSD.cc.

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

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

604  {
605  if (meanResponse) {
606  TrackInformation * trkInfo = (TrackInformation *)(aTrack->GetUserInformation());
607  return meanResponse->getWeight(trkInfo->genParticlePID(), trkInfo->genParticleP());
608  } else {
609  return 1;
610  }
611 }
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 247 of file CaloSD.cc.

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

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

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

Reimplemented in ECalSD.

Definition at line 571 of file CaloSD.cc.

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

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

571  {
572  int primaryID = 0;
573  forceSave = false;
574  TrackInformation* trkInfo=(TrackInformation *)(aTrack->GetUserInformation());
575  if (trkInfo) {
576  primaryID = trkInfo->getIDonCaloSurface();
577 #ifdef DebugLog
578  LogDebug("CaloSim") << "CaloSD: hit update from track Id on Calo Surface "
579  << trkInfo->getIDonCaloSurface();
580 #endif
581  } else {
582  primaryID = aTrack->GetTrackID();
583 #ifdef DebugLog
584  edm::LogWarning("CaloSim") << "CaloSD: Problem with primaryID **** set by "
585  << "force to TkID **** " << primaryID << " in "
586  << preStepPoint->GetTouchable()->GetVolume(0)->GetName();
587 #endif
588  }
589  return primaryID;
590 }
#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 307 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().

307  {
308 #ifdef DebugLog
309  if (currentID.trackID()<1)
310  edm::LogWarning("CaloSim") << "***** CaloSD error: primaryID = "
311  << currentID.trackID()
312  << " maybe detector name changed";
313 #endif
314  // Update if in the same detector, time-slice and for same track
315  if (currentID == previousID) {
317  return true;
318  }
319 
320  // Reset entry point for new primary
321  posGlobal = preStepPoint->GetPosition();
322  if (currentID.trackID() != previousID.trackID())
323  resetForNewPrimary(preStepPoint->GetPosition(), preStepPoint->GetKineticEnergy());
324 
325  return checkHit();
326 }
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:437
G4ThreeVector posGlobal
Definition: CaloSD.h:113
G4bool checkHit()
Definition: CaloSD.cc:328
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 resetForNewPrimary(G4ThreeVector, double)
Definition: CaloSD.cc:451
void CaloSD::Initialize ( G4HCofThisEvent *  HCE)
virtual

Reimplemented from SensitiveDetector.

Definition at line 204 of file CaloSD.cc.

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

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

Reimplemented in CastorSD, HCalSD, DreamSD, and ZdcSD.

Definition at line 569 of file CaloSD.cc.

Referenced by update().

569 {}
void CaloSD::PrintAll ( )
virtual

Definition at line 235 of file CaloSD.cc.

References theHC.

235  {
236 #ifdef DebugLog
237  edm::LogInfo("CaloSim") << "CaloSD: Collection " << theHC->GetName();
238 #endif
239  theHC->PrintAllHits();
240 }
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 116 of file CaloSD.cc.

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

116  {
117 
118  NaNTrap( aStep ) ;
119 
120  if (aStep == NULL) {
121  return true;
122  } else {
123  if (getStepInfo(aStep)) {
124  if (hitExists() == false && edepositEM+edepositHAD>0.)
126  }
127  }
128  return true;
129 }
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:247
G4bool hitExists()
Definition: CaloSD.cc:307
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:360
bool CaloSD::ProcessHits ( G4GFlashSpot *  aSpot,
G4TouchableHistory *   
)
virtual

Definition at line 131 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().

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

Definition at line 451 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().

451  {
455 #ifdef DebugLog
456  LogDebug("CaloSim") << "CaloSD: Incident energy " << incidentEnergy/GeV
457  << " GeV and" << " entrance point " << entrancePoint
458  << " (Global) " << entranceLocal << " (Local)";
459 #endif
460 }
G4ThreeVector setToLocal(G4ThreeVector, const G4VTouchable *)
Definition: CaloSD.cc:293
#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
bool CaloSD::saveHit ( CaloG4Hit aHit)
private

Definition at line 624 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().

624  {
625  int tkID;
626  bool ok = true;
627  if (m_trackManager) {
628  tkID = m_trackManager->giveMotherNeeded(aHit->getTrackID());
629  if (tkID == 0) {
630  if (m_trackManager->trackExists(aHit->getTrackID())) tkID = (aHit->getTrackID());
631  else {
632  ok = false;
633  }
634  }
635  } else {
636  tkID = aHit->getTrackID();
637  ok = false;
638  }
639  // edm::LogInfo("CaloSim") << "CalosD: Track ID " << aHit->getTrackID() << " changed to " << tkID << " by SimTrackManager" << " Status " << ok;
640 #ifdef DebugLog
641  LogDebug("CaloSim") << "CalosD: Track ID " << aHit->getTrackID()
642  << " changed to " << tkID << " by SimTrackManager"
643  << " Status " << ok;
644 #endif
645  double time = aHit->getTimeSlice();
646  if (corrTOFBeam) time += correctT;
647  slave->processHits(aHit->getUnitID(), aHit->getEM()/GeV,
648  aHit->getHadr()/GeV, time, tkID, aHit->getDepth());
649 #ifdef DebugLog
650  LogDebug("CaloSim") << "CaloSD: Store Hit at " << std::hex
651  << aHit->getUnitID() << std::dec << " "
652  << aHit->getDepth() << " due to " << tkID
653  << " in time " << time << " of energy "
654  << aHit->getEM()/GeV << " GeV (EM) and "
655  << aHit->getHadr()/GeV << " GeV (Hadr)";
656 #endif
657  return ok;
658 }
#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 ( G4ThreeVector  local,
const G4VTouchable *  touch 
)
protected

Definition at line 300 of file CaloSD.cc.

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

Definition at line 293 of file CaloSD.cc.

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

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

Definition at line 613 of file CaloSD.cc.

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

Referenced by createNewHit().

613  {
614  if (previousID.trackID()<0) return;
615  if (hit == 0) {
616  edm::LogWarning("CaloSim") << "CaloSD: hit to be stored is NULL !!";
617  return;
618  }
619 
620  theHC->insert(hit);
621  if (useMap) hitMap.insert(std::pair<CaloHitID,CaloG4Hit*>(previousID,hit));
622 }
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 660 of file CaloSD.cc.

Referenced by update().

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

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 484 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().

484  {
485  G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
486  G4String particleName;
487  emPDG = theParticleTable->FindParticle(particleName="e-")->GetPDGEncoding();
488  epPDG = theParticleTable->FindParticle(particleName="e+")->GetPDGEncoding();
489  gammaPDG = theParticleTable->FindParticle(particleName="gamma")->GetPDGEncoding();
490 #ifdef DebugLog
491  LogDebug("CaloSim") << "CaloSD: Particle code for e- = " << emPDG
492  << " for e+ = " << epPDG << " for gamma = " << gammaPDG;
493 #endif
494  initRun();
495  runInit = true;
496 }
#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:569
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 498 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().

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

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 662 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().

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

506  {
507  int id = (*trk)()->GetTrackID();
508  TrackInformation *trkI =(TrackInformation *)((*trk)()->GetUserInformation());
509  int lastTrackID = -1;
510  if (trkI) lastTrackID = trkI->getIDonCaloSurface();
511  if (id == lastTrackID) {
512  const TrackContainer * trksForThisEvent = m_trackManager->trackContainer();
513  if (trksForThisEvent != NULL) {
514  int it = (int)(trksForThisEvent->size()) - 1;
515  if (it >= 0) {
516  TrackWithHistory * trkH = (*trksForThisEvent)[it];
517  if (trkH->trackID() == (unsigned int)(id)) tkMap[id] = trkH;
518 #ifdef DebugLog
519  LogDebug("CaloSim") << "CaloSD: get track " << it << " from "
520  << "Container of size " << trksForThisEvent->size()
521  << " with ID " << trkH->trackID();
522  } else {
523  LogDebug("CaloSim") << "CaloSD: get track " << it << " from "
524  << "Container of size " << trksForThisEvent->size()
525  << " with no ID";
526 #endif
527  }
528  }
529  }
530 }
#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 532 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().

532  {
533  int count = 0, wrong = 0;
534  bool ok;
535 
536  slave->ReserveMemory(theHC->entries());
537 
538  for (int i=0; i<theHC->entries(); ++i) {
539  ok = saveHit((*theHC)[i]);
540  ++count;
541  if (!ok) ++wrong;
542  }
543 
544  edm::LogInfo("CaloSim") << "CaloSD: " << GetName() << " store " << count
545  << " hits recorded with " << wrong
546  << " track IDs not given properly and "
547  << totalHits-count << " hits not passing cuts";
548  summarize();
549 
550  tkMap.erase (tkMap.begin(), tkMap.end());
551 }
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:660
CaloG4HitCollection * theHC
Definition: CaloSD.h:145
std::map< int, TrackWithHistory * > tkMap
Definition: CaloSD.h:148
bool saveHit(CaloG4Hit *)
Definition: CaloSD.cc:624
void CaloSD::updateHit ( CaloG4Hit aHit)
protected

Definition at line 437 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().

437  {
438  if (edepositEM+edepositHAD != 0) {
440 #ifdef DebugLog
441  LogDebug("CaloSim") << "CaloSD: Add energy deposit in " << currentID
442  << " em " << edepositEM/MeV << " hadronic "
443  << edepositHAD/MeV << " MeV";
444 #endif
445  }
446 
447  // buffer for next steps:
449 }
#define LogDebug(id)
float edepositEM
Definition: CaloSD.h:121
void addEnergyDeposit(double em, double hd)
Definition: CaloG4Hit.cc:45
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().