slicPandora/src
diff -u -r1.22 -r1.23
--- CalorimeterHitProcessor.cpp 19 Sep 2011 18:54:31 -0000 1.22
+++ CalorimeterHitProcessor.cpp 18 Jan 2012 21:36:34 -0000 1.23
@@ -1,4 +1,4 @@
-// $Id: CalorimeterHitProcessor.cpp,v 1.22 2011/09/19 18:54:31 jeremy Exp $
+// $Id: CalorimeterHitProcessor.cpp,v 1.23 2012/01/18 21:36:34 jeremy Exp $
#include "CalorimeterHitProcessor.h"
@@ -129,16 +129,15 @@
params.m_positionVector = pandora::CartesianVector(pos[0], pos[1], pos[2]);
params.m_expectedDirection = pandora::CartesianVector(pos[0], pos[1], pos[2]).GetUnitVector();
+ // Copy energy from CalHit. Sampling fraction and digital or analogy calculation was already applied in SimCalorimeterHitProcessor.
+ params.m_inputEnergy = hit->getEnergy();
- // Digital calorimeter setting.
+ // Get the digital calorimeter setting from the associated subdetector parameters.
params.m_isDigital = xsubdet->m_isDigital;
- // For digital hits, divide 1 by the sampling fraction.
+ // For digital hits, divide 1 by the sampling fractions.
if (params.m_isDigital.Get() == true)
{
- // Hit energy in GeV.
- params.m_inputEnergy = 1. / samplingFraction;
-
// EM energy in GeV.
params.m_electromagneticEnergy = 1. / emSamplingFraction;
@@ -148,12 +147,9 @@
// MIP equivalent energy.
params.m_mipEquivalentEnergy = 1. / mipEnergy;
}
- // For analog hits, divide the raw energy by the sampling fraction.
+ // For analog hits, divide the raw energy by the sampling fractions.
else
{
- // Hit energy in GeV. Sampling fraction applied in SimCalorimeterHitProcessor.
- params.m_inputEnergy = hit->getEnergy();
-
// EM energy in GeV.
params.m_electromagneticEnergy = rawEnergy / emSamplingFraction;
slicPandora/src
diff -u -r1.29 -r1.30
--- SimCalorimeterHitProcessor.cpp 17 Oct 2011 15:47:50 -0000 1.29
+++ SimCalorimeterHitProcessor.cpp 18 Jan 2012 21:36:34 -0000 1.30
@@ -57,7 +57,7 @@
LCCollectionVec* scRel = new LCCollectionVec(EVENT::LCIO::LCRELATION);
scRel->parameters().setValue("RelationFromType", EVENT::LCIO::CALORIMETERHIT);
scRel->parameters().setValue("RelationToType", EVENT::LCIO::SIMCALORIMETERHIT);
-
+
typedef std::map<MCParticle *, float> MCParticleToEnergyWeightMap;
MCParticleToEnergyWeightMap mcParticleToEnergyWeightMap;
@@ -73,13 +73,10 @@
// Get the CaloType string.
const std::string& caloType = LcioInputCollectionSettings::getStringFromType(it->first);
- // DEBUG
- //std::cout << "SimCalHitProc - " << caloType << std::endl;
-
// Skip over unknown types of cal collections.
if (caloType.compare("UNKNOWN") == 0)
{
- std::cout << "Skipping unknown type of calorimeter collections!" << std::endl;
+ std::cout << "Skipping unknown type of calorimeter collection!" << std::endl;
continue;
}
@@ -121,9 +118,6 @@
// Get the collection name.
const std::string& collectionName = (*it2);
- // DEBUG
- //std::cout << "collectionName - " << collectionName << std::endl;
-
// Lookup CalHit collection in input event.
LCCollection* simCalHits = 0;
try
@@ -137,35 +131,32 @@
}
catch (std::exception& e)
{
- std::cout << "Caught unknown exception trying to access " << collectionName << " from event." << std::endl;
+ std::cout << "Caught unknown std exception trying to access " << collectionName << " from event." << std::endl;
throw new std::exception;
}
- // Convert input SimCalorimeterHits into CalorimeterHits.
+ // Get the number of SimCalorimeterHits.
int nSimHits = simCalHits->getNumberOfElements();
- // DEBUG
- //std::cout << "going to proc " << nSimHits << " SimCalHits from input coll" << std::endl;
-
- // Loop over input SimCalHits.
+ // Loop over input SimCalorimeterHits and convert them to CalorimeterHits.
for (int i = 0; i < nSimHits; i++)
{
- // Get the SimCalorimeterHit to be converted.
+ // Get the SimCalorimeterHit to be converted from the LCIO collection.
SimCalorimeterHit* simCalHit = dynamic_cast<SimCalorimeterHit*> (simCalHits->getElementAt(i));
- // Get first time contrib.
+ // Get the first time contrib.
float timeCont = simCalHit->getTimeCont(0);
- // Get energy.
+ // Get the raw energy deposition.
float rawEnergy = simCalHit->getEnergy();
- // Time cut on late times.
+ // Apply the time cut from the subdetector params.
if (timeCont > timeCut)
{
continue;
}
- // Cut on input hits with energy less than mipCut.
+ // Apply MIP energy cut from the subdetector params.
if (rawEnergy < mipCut)
{
continue;
@@ -174,38 +165,51 @@
// Create a new CalorimeterHit.
CalorimeterHitImpl* calHit = new CalorimeterHitImpl;
- // Get the two 32-bit chunks of the id.
+ // Get the two 32-bit chunks of the ID.
int cellId0 = simCalHit->getCellID0();
int cellId1 = simCalHit->getCellID1();
- // Make a 64-bit id for the IDDecoder.
- // The type MUST be "long long" and not "long". (from tonyj)
- long long cellId = ((long long)cellId1)<<32 | cellId0;
+ // Make a 64-bit id for the IDDecoder. The type MUST be "long long" and not "long". (from Tony Johnson)
+ long long cellId = ((long long)cellId1) << 32 | cellId0;
- // Decode the layer number from the id.
+ // Decode the layer number from the ID.
int layer = decoder->getFieldValue("layer", cellId);
- // Get the layer parameters for this layer.
+ // Get the parameters for this layer.
PandoraApi::GeometryParameters::LayerParameters layerParams = (*layerList)[layer];
- // Get the extra layer parameters for this layer (sampling).
+ // Get the extra parameters for this layer.
float samplingFrac = 0.f;
try
{
+ // Get the layer parameters.
DetectorGeometry::ExtraLayerParameters xlayerParams = xsubdet->m_extraLayerParams.at(layer);
+
// Get the sampling fraction for this layer.
- // TODO: Separate EM + HAD sampling fractions.
samplingFrac = xlayerParams.m_samplingFraction.Get();
+
+ // TODO: Separate EM + HAD sampling fractions.
}
- // FIXME What exception caught here?
+ // FIXME What exception is caught here?
catch(...)
{
std::cout << "No layer #" << layer << " existing in detector " << caloType << std::endl;
throw;
}
- // Copy SimCalorimeterHit information into CalorimeterHit.
- calHit->setEnergy(simCalHit->getEnergy() / samplingFrac);
+ // Set hit energy.
+ if (xsubdet->m_isDigital.Get())
+ {
+ // Digital energy is one over the sampling fraction.
+ calHit->setEnergy(1. / samplingFrac);
+ }
+ else
+ {
+ // Analog energy is the raw energy over the sampling fraction.
+ calHit->setEnergy(simCalHit->getEnergy() / samplingFrac);
+ }
+
+ // Copy SimCalorimeterHit information into CalorimeterHit
calHit->setCellID0(simCalHit->getCellID0());
calHit->setCellID1(simCalHit->getCellID1());
calHit->setTime(simCalHit->getTimeCont(0));
@@ -215,6 +219,7 @@
scRel->addElement(new LCRelationImpl(calHit, simCalHit, 0.5));
// FIXME Need to add links for CalorimeterHit collections that already exist.
+ // FIXME Is this code to set energy weighting really needed or used in recon?
mcParticleToEnergyWeightMap.clear();
for (int iCont = 0, iEnd = simCalHit->getNMCContributions(); iCont < iEnd; ++iCont)
{
@@ -232,7 +237,7 @@
}
// Set the ReadoutName parameter for LCSim to find the correct IDDecoder.
- // FIXME This should actually be in the outer loop but collectionName no longer available.
+ // FIXME This should actually be in the outer loop but collectionName is no longer available.
calHits->parameters().setValue("ReadoutName", collectionName);
}