00001
00002
00003
00005
00006 #include "SimG4CMS/Calo/interface/CaloSD.h"
00007 #include "SimDataFormats/SimHitMaker/interface/CaloSlaveSD.h"
00008 #include "SimG4Core/Notification/interface/TrackInformation.h"
00009 #include "SimG4Core/Application/interface/EventAction.h"
00010
00011 #include "G4EventManager.hh"
00012 #include "G4SDManager.hh"
00013 #include "G4Step.hh"
00014 #include "G4Track.hh"
00015 #include "G4VProcess.hh"
00016 #include "G4GFlashSpot.hh"
00017 #include "G4ParticleTable.hh"
00018
00019 CaloSD::CaloSD(G4String name, const DDCompactView & cpv,
00020 SensitiveDetectorCatalog & clg,
00021 edm::ParameterSet const & p, const SimTrackManager* manager) :
00022 SensitiveCaloDetector(name, cpv, clg, p),
00023 G4VGFlashSensitiveDetector(),
00024 theTrack(0), preStepPoint(0), m_trackManager(manager), currentHit(0),
00025 hcID(-1), theHC(0){
00026
00027
00028
00029 collectionName.insert(name);
00030
00031
00032
00033
00034
00035 edm::ParameterSet m_CaloSD = p.getParameter<edm::ParameterSet>("CaloSD");
00036 energyCut = m_CaloSD.getParameter<double>("EminTrack")*GeV;
00037 tmaxHit = m_CaloSD.getParameter<double>("TmaxHit")*ns;
00038 suppressHeavy= m_CaloSD.getParameter<bool>("SuppressHeavy");
00039 kmaxIon = m_CaloSD.getParameter<double>("IonThreshold")*MeV;
00040 kmaxProton = m_CaloSD.getParameter<double>("ProtonThreshold")*MeV;
00041 kmaxNeutron = m_CaloSD.getParameter<double>("NeutronThreshold")*MeV;
00042 checkHits = m_CaloSD.getUntrackedParameter<int>("CheckHits", 25);
00043 useMap = m_CaloSD.getUntrackedParameter<bool>("UseMap", true);
00044 int verbn = m_CaloSD.getUntrackedParameter<int>("Verbosity", 0);
00045 bool on = m_CaloSD.getUntrackedParameter<bool>("DetailedTiming");
00046 corrTOFBeam = m_CaloSD.getUntrackedParameter<bool>("CorrectTOFBeam", false);
00047 double beamZ = m_CaloSD.getUntrackedParameter<double>("BeamPosition",0.0)*cm;
00048 correctT = beamZ/c_light/nanosecond;
00049
00050 SetVerboseLevel(verbn);
00051 LogDebug("CaloSim") << "***************************************************"
00052 << "\n"
00053 << "* *"
00054 << "\n"
00055 << "* Constructing a CaloSD with name " << GetName()
00056 << "\n"
00057 << "* *"
00058 << "\n"
00059 << "***************************************************";
00060
00061 slave = new CaloSlaveSD(name);
00062 currentID = CaloHitID();
00063 previousID = CaloHitID();
00064
00065
00066
00067
00068 std::vector<std::string> lvNames = clg.logicalNames(name);
00069 this->Register();
00070 for (std::vector<std::string>::iterator it=lvNames.begin();
00071 it !=lvNames.end(); it++){
00072 this->AssignSD(*it);
00073 LogDebug("CaloSim") << "CaloSD : Assigns SD to LV " << (*it);
00074 }
00075
00076
00077 if (on) {
00078
00079
00080
00081
00082
00083 }
00084
00085 edm::LogInfo("CaloSim") << "CaloSD: Minimum energy of track for saving it "
00086 << energyCut/GeV << " GeV" << "\n"
00087 << " Use of HitID Map " << useMap << "\n"
00088 << " Check last " << checkHits
00089 << " before saving the hit\n"
00090 << " Correct TOF globally by " << correctT
00091 << " ns (Flag =" << corrTOFBeam << ")\n"
00092 << " Save hits recorded before " << tmaxHit
00093 << " ns";
00094 }
00095
00096 CaloSD::~CaloSD() {
00097 if (slave) delete slave;
00098 if (theHC) delete theHC;
00099 }
00100
00101 bool CaloSD::ProcessHits(G4Step * aStep, G4TouchableHistory * ) {
00102
00103
00104 NaNTrap( aStep ) ;
00105
00106 if (aStep == NULL) {
00107 return true;
00108 } else {
00109 if (getStepInfo(aStep)) {
00110 if (hitExists() == false && edepositEM+edepositHAD>0.)
00111 currentHit = createNewHit();
00112 }
00113 }
00114 return true;
00115 }
00116
00117 bool CaloSD::ProcessHits(G4GFlashSpot* aSpot, G4TouchableHistory*) {
00118
00119 if (aSpot != NULL) {
00120
00121 theTrack = const_cast<G4Track *>(aSpot->GetOriginatorTrack()->GetPrimaryTrack());
00122 G4int particleCode = theTrack->GetDefinition()->GetPDGEncoding();
00123 TrackInformation * trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
00124
00125 if (particleCode == emPDG ||
00126 particleCode == epPDG ||
00127 particleCode == gammaPDG ) {
00128 edepositEM = aSpot->GetEnergySpot()->GetEnergy(); edepositHAD = 0.;
00129 } else {
00130 edepositEM = 0.; edepositHAD = 0.;
00131 }
00132
00133 if (edepositEM>0.) {
00134 G4Step * fFakeStep = new G4Step();
00135 G4StepPoint * fFakePreStepPoint = fFakeStep->GetPreStepPoint();
00136 G4StepPoint * fFakePostStepPoint = fFakeStep->GetPostStepPoint();
00137 fFakePreStepPoint->SetPosition(aSpot->GetPosition());
00138 fFakePostStepPoint->SetPosition(aSpot->GetPosition());
00139
00140 G4TouchableHandle fTouchableHandle = aSpot->GetTouchableHandle();
00141 fFakePreStepPoint->SetTouchableHandle(fTouchableHandle);
00142 fFakeStep->SetTotalEnergyDeposit(aSpot->GetEnergySpot()->GetEnergy());
00143
00144 double time = 0;
00145 unsigned int unitID = setDetUnitId(fFakeStep);
00146 int primaryID;
00147
00148 if (trkInfo)
00149 primaryID = trkInfo->getIDonCaloSurface();
00150 else
00151 primaryID = 0;
00152
00153 if (primaryID == 0) {
00154 edm::LogWarning("CaloSim") << "CaloSD: Spot Problem with primaryID "
00155 << "**** set by force to **** "
00156 << theTrack->GetTrackID();
00157 primaryID = theTrack->GetTrackID();
00158 }
00159 if (unitID > 0) {
00160 currentID.setID(unitID, time, primaryID, 0);
00161 LogDebug("CaloSim") << "CaloSD:: GetSpotInfo for"
00162 << " Unit 0x" << std::hex << currentID.unitID()
00163 << std::dec << " Edeposit = " << edepositEM << " "
00164 << edepositHAD;
00165
00166 if (currentID == previousID) {
00167 updateHit(currentHit);
00168 } else {
00169
00170 posGlobal = aSpot->GetEnergySpot()->GetPosition();
00171
00172 if (currentID.trackID() != previousID.trackID()) {
00173 entrancePoint = aSpot->GetPosition();
00174 entranceLocal = aSpot->GetTouchableHandle()->GetHistory()->
00175 GetTopTransform().TransformPoint(entrancePoint);
00176 incidentEnergy = theTrack->GetKineticEnergy();
00177 LogDebug("CaloSim") << "CaloSD: Incident energy "
00178 << incidentEnergy/GeV << " GeV and"
00179 << " entrance point " << entrancePoint
00180 << " (Global) " << entranceLocal << " (Local)";
00181 }
00182
00183 if (checkHit() == false) currentHit = createNewHit();
00184 }
00185 }
00186
00187 delete fFakeStep;
00188 }
00189 return true;
00190
00191 }
00192 return false;
00193 }
00194
00195 double CaloSD::getEnergyDeposit(G4Step* aStep) {
00196 return aStep->GetTotalEnergyDeposit();
00197 }
00198
00199 void CaloSD::Initialize(G4HCofThisEvent * HCE) {
00200
00201 LogDebug("CaloSim") << "CaloSD : Initialize called for " << GetName();
00202
00203
00204
00205 theHC = new CaloG4HitCollection(GetName(), collectionName[0]);
00206 if (hcID<0)
00207 hcID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
00208 HCE->AddHitsCollection(hcID, theHC);
00209 }
00210
00211 void CaloSD::EndOfEvent(G4HCofThisEvent* ) {
00212
00213 LogDebug("CaloSim") << "CaloSD: EndofEvent entered with " << theHC->entries()
00214 << " entries";
00215
00216
00217 hitvec.reserve(theHC->entries());
00218
00219
00220 for (int ii=0; ii<theHC->entries(); ii++) {
00221 CaloG4Hit* aHit = (*theHC)[ii];
00222 LogDebug("CaloSim") << "CaloHit " << ii << " " << *aHit;
00223 hitvec.push_back(aHit);
00224 }
00225
00226 LogDebug("CaloSim") << "CaloSD: EndofEvent transfer " << hitvec.size()
00227 << " hits to vector" << " for " << GetName();
00228 }
00229
00230 void CaloSD::clear() {}
00231
00232 void CaloSD::DrawAll() {}
00233
00234 void CaloSD::PrintAll() {
00235 LogDebug("CaloSim") << "CaloSD: Collection " << theHC->GetName();
00236 theHC->PrintAllHits();
00237 }
00238
00239 void CaloSD::fillHits(edm::PCaloHitContainer& c, std::string n){
00240 if (slave->name() == n) c=slave->hits();
00241 }
00242
00243 bool CaloSD::getStepInfo(G4Step* aStep) {
00244
00245 preStepPoint = aStep->GetPreStepPoint();
00246 theTrack = aStep->GetTrack();
00247
00248 G4int particleCode = theTrack->GetDefinition()->GetPDGEncoding();
00249 if (particleCode == emPDG ||
00250 particleCode == epPDG ||
00251 particleCode == gammaPDG ) {
00252 edepositEM = getEnergyDeposit(aStep); edepositHAD = 0.;
00253 } else {
00254 edepositEM = 0.; edepositHAD = getEnergyDeposit(aStep);
00255 }
00256
00257 double time = (aStep->GetPostStepPoint()->GetGlobalTime())/nanosecond;
00258 unsigned int unitID= setDetUnitId(aStep);
00259 TrackInformation * trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
00260 int primaryID;
00261
00262 if (trkInfo)
00263 primaryID = trkInfo->getIDonCaloSurface();
00264 else
00265 primaryID = 0;
00266
00267 if (primaryID == 0) {
00268 edm::LogWarning("CaloSim") << "CaloSD: Problem with primaryID **** set by "
00269 << "force to TkID **** "
00270 << theTrack->GetTrackID() << " in Volume "
00271 << preStepPoint->GetTouchable()->GetVolume(0)->GetName();
00272 primaryID = theTrack->GetTrackID();
00273 }
00274
00275 bool flag = (unitID > 0);
00276 G4TouchableHistory* touch =(G4TouchableHistory*)(theTrack->GetTouchable());
00277 if (flag) {
00278 currentID.setID(unitID, time, primaryID, 0);
00279
00280 LogDebug("CaloSim") << "CaloSD:: GetStepInfo for"
00281 << " PV " << touch->GetVolume(0)->GetName()
00282 << " PVid = " << touch->GetReplicaNumber(0)
00283 << " MVid = " << touch->GetReplicaNumber(1)
00284 << " Unit " << currentID.unitID()
00285 << " Edeposit = " << edepositEM << " " << edepositHAD;
00286 } else {
00287 LogDebug("CaloSim") << "CaloSD:: GetStepInfo for"
00288 << " PV " << touch->GetVolume(0)->GetName()
00289 << " PVid = " << touch->GetReplicaNumber(0)
00290 << " MVid = " << touch->GetReplicaNumber(1)
00291 << " Unit " << std::hex << unitID << std::dec
00292 << " Edeposit = " << edepositEM << " " << edepositHAD;
00293 }
00294 return flag;
00295 }
00296
00297 G4ThreeVector CaloSD::setToLocal(G4ThreeVector global,
00298 const G4VTouchable* touch) {
00299
00300 G4ThreeVector localPoint =
00301 touch->GetHistory()->GetTopTransform().TransformPoint(global);
00302
00303 return localPoint;
00304 }
00305
00306 G4bool CaloSD::hitExists() {
00307
00308 if (currentID.trackID()<1) {
00309 edm::LogWarning("CaloSim") << "***** CaloSD error: primaryID = "
00310 << currentID.trackID()
00311 << " maybe detector name changed";
00312 }
00313
00314
00315 if (currentID == previousID) {
00316 updateHit(currentHit);
00317 return true;
00318 }
00319
00320
00321 posGlobal = preStepPoint->GetPosition();
00322 if (currentID.trackID() != previousID.trackID())
00323 resetForNewPrimary(preStepPoint->GetPosition(),
00324 preStepPoint->GetKineticEnergy());
00325
00326 return checkHit();
00327 }
00328
00329 G4bool CaloSD::checkHit() {
00330
00331
00332 bool found = false;
00333 if (useMap) {
00334 std::map<CaloHitID,CaloG4Hit*>::const_iterator it = hitMap.find(currentID);
00335 if (it != hitMap.end()) {
00336 currentHit = it->second;
00337 found = true;
00338 }
00339 } else {
00340 if (checkHits <= 0) return false;
00341 int minhit= (theHC->entries()>checkHits ? theHC->entries()-checkHits : 0);
00342 int maxhit= theHC->entries()-1;
00343
00344 for (int j=maxhit; j>minhit&&!found; j--) {
00345 CaloG4Hit* aPreviousHit = (*theHC)[j];
00346 if (aPreviousHit->getID() == currentID) {
00347 currentHit = aPreviousHit;
00348 found = true;
00349 }
00350 }
00351 }
00352
00353 if (found) {
00354 updateHit(currentHit);
00355 return true;
00356 } else {
00357 return false;
00358 }
00359
00360 }
00361
00362 CaloG4Hit* CaloSD::createNewHit() {
00363
00364 LogDebug("CaloSim") << "CaloSD::CreateNewHit for"
00365 << " Unit " << currentID.unitID()
00366 << " " << currentID.depth()
00367 << " Edeposit = " << edepositEM << " " << edepositHAD;
00368 LogDebug("CaloSim") << " primary " << currentID.trackID()
00369 << " time slice " << currentID.timeSliceID()
00370 << " For Track " << theTrack->GetTrackID()
00371 << " which is a " <<theTrack->GetDefinition()->GetParticleName()
00372 << " of energy " << theTrack->GetKineticEnergy()/GeV
00373 << " " << theTrack->GetMomentum().mag()/GeV
00374 << " daughter of part. " << theTrack->GetParentID()
00375 << " and created by " ;
00376
00377 if (theTrack->GetCreatorProcess()!=NULL)
00378 LogDebug("CaloSim") << theTrack->GetCreatorProcess()->GetProcessName() ;
00379 else
00380 LogDebug("CaloSim") << "NO process";
00381
00382 CaloG4Hit* aHit = new CaloG4Hit;
00383 aHit->setID(currentID);
00384 aHit->setEntry(entrancePoint.x(),entrancePoint.y(),entrancePoint.z());
00385 aHit->setEntryLocal(entranceLocal.x(),entranceLocal.y(),entranceLocal.z());
00386 aHit->setPosition(posGlobal.x(),posGlobal.y(),posGlobal.z());
00387 aHit->setIncidentEnergy(incidentEnergy);
00388 updateHit(aHit);
00389
00390 storeHit(aHit);
00391 double etrack = 0;
00392 if (currentID.trackID() == primIDSaved) {
00393 } else if (currentID.trackID() == theTrack->GetTrackID()) {
00394 etrack= theTrack->GetKineticEnergy();
00395 if (etrack >= energyCut) {
00396 TrackInformation * trkInfo =
00397 (TrackInformation *)(theTrack->GetUserInformation());
00398 trkInfo->storeTrack(true);
00399 trkInfo->putInHistory();
00400 LogDebug("CaloSim") << "CaloSD: set save the track "
00401 << currentID.trackID() << " with Hit";
00402 }
00403 } else {
00404 TrackWithHistory * trkh = tkMap[currentID.trackID()];
00405 LogDebug("CaloSim") << "CaloSD : TrackwithHistory pointer for "
00406 << currentID.trackID() << " is " << trkh;
00407 if (trkh != NULL) {
00408 etrack = sqrt(trkh->momentum().Mag2());
00409 if (etrack >= energyCut) {
00410 trkh->save();
00411 LogDebug("CaloSim") << "CaloSD: set save the track "
00412 << currentID.trackID() << " with Hit";
00413 }
00414 }
00415 }
00416 primIDSaved = currentID.trackID();
00417 return aHit;
00418 }
00419
00420 void CaloSD::updateHit(CaloG4Hit* aHit) {
00421
00422 if (edepositEM+edepositHAD != 0) {
00423 aHit->addEnergyDeposit(edepositEM,edepositHAD);
00424 LogDebug("CaloSim") << "CaloSD: Add energy deposit in " << currentID
00425 << " em " << edepositEM/MeV << " hadronic "
00426 << edepositHAD/MeV << " MeV";
00427 }
00428
00429
00430 previousID = currentID;
00431 }
00432
00433 void CaloSD::resetForNewPrimary(G4ThreeVector point, double energy) {
00434
00435 entrancePoint = point;
00436 entranceLocal = setToLocal(entrancePoint, preStepPoint->GetTouchable());
00437 incidentEnergy = energy;
00438 LogDebug("CaloSim") << "CaloSD: Incident energy " << incidentEnergy/GeV
00439 << " GeV and" << " entrance point " << entrancePoint
00440 << " (Global) " << entranceLocal << " (Local)";
00441 }
00442
00443 double CaloSD::getAttenuation(G4Step* aStep, double birk1, double birk2,
00444 double birk3) {
00445
00446 double weight = 1.;
00447 double charge = aStep->GetPreStepPoint()->GetCharge();
00448
00449 if (charge != 0. && aStep->GetStepLength() > 0) {
00450 G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
00451 double density = mat->GetDensity();
00452 double dedx = aStep->GetTotalEnergyDeposit()/aStep->GetStepLength();
00453 double rkb = birk1/density;
00454 double c = birk2*rkb*rkb;
00455 if (std::abs(charge) >= 2.) rkb /= birk3;
00456 weight = 1./(1.+rkb*dedx+c*dedx*dedx);
00457 LogDebug("CaloSim") << "CaloSD::getAttenuation in " << mat->GetName()
00458 << " Charge " << charge << " dE/dx " << dedx
00459 << " Birk Const " << rkb << ", " << c << " Weight = "
00460 << weight << " dE " << aStep->GetTotalEnergyDeposit();
00461 }
00462 return weight;
00463 }
00464
00465 void CaloSD::update(const BeginOfRun *) {
00466
00467 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
00468 G4String particleName;
00469 emPDG = theParticleTable->FindParticle(particleName="e-")->GetPDGEncoding();
00470 epPDG = theParticleTable->FindParticle(particleName="e+")->GetPDGEncoding();
00471 gammaPDG = theParticleTable->FindParticle(particleName="gamma")->GetPDGEncoding();
00472 LogDebug("CaloSim") << "CaloSD: Particle code for e- = " << emPDG
00473 << " for e+ = " << epPDG << " for gamma = " << gammaPDG;
00474
00475 initRun();
00476 }
00477
00478 void CaloSD::update(const BeginOfEvent *) {
00479 LogDebug("CaloSim") << "CaloSD: Dispatched BeginOfEvent for " << GetName()
00480 << " !" ;
00481 clearHits();
00482 tkMap.erase (tkMap.begin(), tkMap.end());
00483 }
00484
00485 void CaloSD::update(const EndOfTrack * trk) {
00486
00487 int id = (*trk)()->GetTrackID();
00488 TrackInformation *trkI =(TrackInformation *)((*trk)()->GetUserInformation());
00489 int lastTrackID = -1;
00490 if (trkI) lastTrackID = trkI->getIDonCaloSurface();
00491 if (id == lastTrackID) {
00492 const TrackContainer * trksForThisEvent = m_trackManager->trackContainer();
00493 if (trksForThisEvent != NULL) {
00494 int it = (int)(trksForThisEvent->size()) - 1;
00495 if (it >= 0) {
00496 TrackWithHistory * trkH = (*trksForThisEvent)[it];
00497 LogDebug("CaloSim") << "CaloSD: get track " << it << " from "
00498 << "Container of size " << trksForThisEvent->size()
00499 << " with ID " << trkH->trackID();
00500 if (trkH->trackID() == (unsigned int)(id)) tkMap[id] = trkH;
00501 } else {
00502 LogDebug("CaloSim") << "CaloSD: get track " << it << " from "
00503 << "Container of size " << trksForThisEvent->size()
00504 << " with no ID";
00505 }
00506 }
00507 }
00508 }
00509
00510 void CaloSD::update(const ::EndOfEvent * ) {
00511
00512 LogDebug("CaloSim") << "CaloSD::update: Start saving hits for " << GetName()
00513 << " with " << hitvec.size() << " hits";
00514 int kount = 0, count = 0, wrong = 0, tcut = 0;
00515 std::vector<CaloG4Hit*>::iterator i;
00516 std::pair<bool,bool> ok;
00517
00518 if (useMap) {
00519 for (i=hitvec.begin(); i!=hitvec.end(); i++) {
00520 ok = saveHit(*i);
00521 if ((ok.second)) {
00522 count++;
00523 if (!(ok.first)) wrong++;
00524 } else {
00525 tcut++;
00526 }
00527 kount++;
00528 }
00529 } else {
00530 sort(hitvec.begin(), hitvec.end(), CaloG4HitLess());
00531 LogDebug("CaloSim") << "CaloSD: EndofEvent sort the hits in buffer ";
00532
00533 std::vector<CaloG4Hit*>::iterator j;
00534 CaloG4HitEqual equal;
00535 for (i=hitvec.begin(); i!=hitvec.end(); i++) {
00536 int jump = 0;
00537 for (j = i+1; j<hitvec.end() && equal(*i, *j); j++) {
00538 jump++;
00539
00540 (**i).addEnergyDeposit(**j);
00541 double em = 0.;
00542 double eh = 0.;
00543 (**j).setEM(em);
00544 (**j).setHadr(eh);
00545 }
00546
00547 kount++;
00548 LogDebug("CaloSim") << "CaloSD: Merge " << jump << " hits to hit "
00549 << kount;
00550 ok = saveHit(*i);
00551 if ((ok.second)) {
00552 count++;
00553 if (!(ok.first)) wrong++;
00554 } else {
00555 tcut++;
00556 }
00557 i+=jump;
00558 kount += jump;
00559 }
00560 }
00561
00562 edm::LogInfo("CaloSim") << "CaloSD: " << GetName() << " store " << count
00563 << " hits out of " << kount << " recorded with "
00564 << wrong << " track IDs not given properly and "
00565 << tcut << " hits with time above cutoff";
00566 summarize();
00567 }
00568
00569 void CaloSD::clearHits() {
00570
00571 hitvec.erase (hitvec.begin(), hitvec.end());
00572 hitMap.erase (hitMap.begin(), hitMap.end());
00573 previousID.reset();
00574 primIDSaved = -99;
00575 LogDebug("CaloSim") << "CaloSD: Clears hit vector for " << GetName() << " "
00576 << slave;
00577 slave->Initialize();
00578 LogDebug("CaloSim") << "CaloSD: Initialises slave SD for " << GetName();
00579 }
00580
00581 void CaloSD::initRun() {}
00582
00583 void CaloSD::storeHit(CaloG4Hit* hit) {
00584
00585 if (previousID.trackID()<0) return;
00586 if (hit == 0) {
00587 edm::LogWarning("CaloSim") << "CaloSD: hit to be stored is NULL !!";
00588 return;
00589 }
00590
00591 theHC->insert(hit);
00592 if (useMap) hitMap.insert(std::pair<CaloHitID,CaloG4Hit*>(previousID,hit));
00593
00594 }
00595
00596 std::pair<bool,bool> CaloSD::saveHit(CaloG4Hit* aHit) {
00597
00598 int tkID;
00599 bool ok = true;
00600 bool save = false;
00601 if (m_trackManager) {
00602 tkID = m_trackManager->idSavedTrack(aHit->getTrackID());
00603 if (tkID == 0) ok = false;
00604 } else {
00605 tkID = aHit->getTrackID();
00606 ok = false;
00607 }
00608 LogDebug("CaloSim") << "CalosD: Track ID " << aHit->getTrackID()
00609 << " changed to " << tkID << " by SimTrackManager"
00610 << " Status " << ok;
00611
00612 double time = aHit->getTimeSlice();
00613 if (corrTOFBeam) time += correctT;
00614 if (time <= tmaxHit) {
00615 save = true;
00616 slave->processHits(aHit->getUnitID(), aHit->getEM()/GeV,
00617 aHit->getHadr()/GeV, time, tkID, aHit->getDepth());
00618 LogDebug("CaloSim") << "CaloSD: Store Hit at " << std::hex
00619 << aHit->getUnitID() << std::dec << " "
00620 << aHit->getDepth() << " due to " << tkID
00621 << " in time " << time << " of energy "
00622 << aHit->getEM()/GeV << " GeV (EM) and "
00623 << aHit->getHadr()/GeV << " GeV (Hadr)";
00624 }
00625 return std::pair<bool,bool>(ok,save);
00626 }
00627
00628 void CaloSD::summarize() {}