5 modified files
slicPandora/include
diff -u -r1.6 -r1.7
--- CalorimeterHitProcessor.h 16 Sep 2011 23:31:17 -0000 1.6
+++ CalorimeterHitProcessor.h 19 Sep 2011 18:54:31 -0000 1.7
@@ -40,13 +40,15 @@
/**
* This method converts LCIO CalorimeterHits into Pandora CalHit::Parameters.
+ * @param The LCIO event containing the CalorimeterHit collections to convert.
*/
- void processEvent(EVENT::LCEvent*);
+ void processEvent(EVENT::LCEvent* event);
private:
/**
* Make a 64-bit ID from the two 32-bit cell IDs of a CalorimeterHit.
+ * @param The CalorimterHit with the ID to be converted.
*/
inline long long makeId64(CalorimeterHit* hit) const
{
@@ -55,49 +57,21 @@
/**
* Convert an LCIO CalorimeterHit into a PandoraPFANew CaloHit Parameters.
+ * @param subdet The SubDetector parameters for the hit.
+ * @param xsubdet The extra SubDetector parameters.
+ * @oaran calhit The CaloHit to be converted.
+ * @return A Pandora CaloHit.
*/
PandoraApi::CaloHit::Parameters makeCaloHitParameters(
PandoraApi::GeometryParameters::SubDetectorParameters* subdet,
DetectorGeometry::ExtraSubDetectorParameters* xsubdet,
- CalorimeterHit*);
+ CalorimeterHit* calhit);
/**
* Print the given CalHit::Parameters to cout.
+ * @param The CaloHit parameters to print out.
*/
- void printCaloHitParameters(const PandoraApi::CaloHit::Parameters&);
-
- /**
- * Compute the path lengths in units of interaction/radiation lengths
- */
- //void GetPathLengths(const EVENT::CalorimeterHit *const pCaloHit, float &nRadiationLengthsFromIp,
- // float &nInteractionLengthsFromIp);
-
- /**
- * Compute the average interaction/radiation lengths for a subdetector
- */
- //void ComputeAverageLengthsFromExtraSubDetectorParameters(DetectorGeometry::ExtraSubDetectorParameters* xsubdet, float& avgIntLength, float& avgRadLength);
-
- /**
- * Compute the path lengths from the IP through a rectangle
- */
- //float ComputePathLengthFromIPInRectangle(const pandora::CartesianVector &position, float rMin, float zMin,
- // float rMax, float zMax);
-
- /**
- * Calculate the intersection of two lines
- */
- //bool IntersectLines2D(float lineAXStart, float lineAYStart, float lineAXEnd, float lineAYEnd,
- // float lineBXStart, float lineBYStart, float lineBXEnd, float lineBYEnd, float &xIntersect, float &yIntersect);
-
-
- /**
- * Calculate the corrected "radius" in a polygon
- */
- //void ComputePolygonCorrection(int symmetryOrder, float distanceToIp, bool isClosestDistance, float phi0, float phi, float& correctedDistance);
-
-private:
-
- float m_totalEHits;
+ void printCaloHitParameters(const PandoraApi::CaloHit::Parameters& calparams);
};
#endif
slicPandora/include
diff -u -r1.1 -r1.2
--- LcioInputCollectionSettings.h 16 Sep 2011 23:31:17 -0000 1.1
+++ LcioInputCollectionSettings.h 19 Sep 2011 18:54:31 -0000 1.2
@@ -39,14 +39,20 @@
}
/**
- * Get the map of CaloTypes to collections.
+ * Get the name of the Track collection.
*/
- const CaloCollectionMap& getCaloCollectionMap() const;
+ const std::string& getTrackCollectionName() const
+ {
+ return trackCollectionName;
+ }
/**
- * Get the name of the Track collection.
+ * Get the name of the TrackState collection.
*/
- const std::string& getTrackCollectionName();
+ inline std::string getTrackStateCollectionName(const std::string& trackState)
+ {
+ return trackStateMap[trackState];
+ }
/**
* Was setup from XML?
@@ -66,22 +72,38 @@
*/
static const std::string& getStringFromType(CaloType caloType);
- const std::vector<std::string>& getDefaultCalorimeterTypes() const;
+ /**
+ * Get the map of CalorimeterHit collection names.
+ */
+ const CaloCollectionMap& getCaloCollectionMap() const
+ {
+ return caloCollectionMap;
+ }
+
+ /**
+ * Get the list of default CalorimeterHit subdetector types.
+ */
+ const std::vector<std::string>& getDefaultCalorimeterTypes() const
+ {
+ return defaultCaloTypes;
+ }
private:
- CaloCollectionMap caloCollectionMap;
- std::string trackCollectionName;
bool m_initialized;
- static std::string emBarrel;
- static std::string emEndcap;
- static std::string hadBarrel;
- static std::string hadEndcap;
- static std::string muonBarrel;
- static std::string muonEndcap;
- static std::string unknown;
std::vector<std::string> defaultCaloTypes;
+ CaloCollectionMap caloCollectionMap;
+ std::string trackCollectionName;
+ std::map<std::string, std::string> trackStateMap;
+
+ static std::string emBarrel;
+ static std::string emEndcap;
+ static std::string hadBarrel;
+ static std::string hadEndcap;
+ static std::string muonBarrel;
+ static std::string muonEndcap;
+ static std::string unknown;
};
#endif
slicPandora/src
diff -u -r1.21 -r1.22
--- CalorimeterHitProcessor.cpp 16 Sep 2011 23:31:18 -0000 1.21
+++ CalorimeterHitProcessor.cpp 19 Sep 2011 18:54:31 -0000 1.22
@@ -1,4 +1,4 @@
-// $Id: CalorimeterHitProcessor.cpp,v 1.21 2011/09/16 23:31:18 jeremy Exp $
+// $Id: CalorimeterHitProcessor.cpp,v 1.22 2011/09/19 18:54:31 jeremy Exp $
#include "CalorimeterHitProcessor.h"
@@ -20,8 +20,6 @@
void CalorimeterHitProcessor::processEvent(EVENT::LCEvent* event)
{
- //m_totalEHits = 0.;
-
// Get the parameter objects necessary for CaloHit conversion to Pandora.
const pandora::Pandora& pandora = getJobManager()->getPandora();
DetectorGeometry* geom = getJobManager()->getDetectorGeometry();
@@ -33,8 +31,6 @@
{
std::string caloType = LcioInputCollectionSettings::getStringFromType(iter->first);
- //std::cout << "CaloHitProc - " << caloType << std::endl;
-
// Get the SubDetector parameters.
PandoraApi::GeometryParameters::SubDetectorParameters* subdet = geom->getSubDetectorFromType(caloType);
DetectorGeometry::ExtraSubDetectorParameters* xsubdet = geom->getExtraSubDetectorParametersFromType(caloType);
@@ -54,31 +50,14 @@
int nhits = caloHits->getNumberOfElements();
- //std::cout << "Collection " << caloType << " has " << nhits << " hits." << std::endl;
-
-//#ifdef CALO_PARAMS_DEBUG
-// std::cout << "COLLECTION: " << caloType << std::endl;
-//#endif
for (int i=0; i<nhits; i++)
{
CalorimeterHit* calHit = dynamic_cast<CalorimeterHit*> (caloHits->getElementAt(i));
PandoraApi::CaloHit::Parameters caloHitParams = makeCaloHitParameters(subdet, xsubdet, calHit);
-
-//#ifdef CALO_PARAMS_DEBUG
-// printCaloHitParameters(caloHitParams);
-//#endif
PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::CaloHit::Create(pandora, caloHitParams));
}
-//#ifdef CALO_PARAMS_DEBUG
-// std::cout << "-----------------------------------------------------" << std::endl;
-//#endif
}
-
-//#ifdef CALO_PARAMS_DEBUG
-// std::cout << "totalEHits: " << m_totalEHits << std::endl;
-//#endif
-// m_totalEHits = 0;
}
PandoraApi::CaloHit::Parameters CalorimeterHitProcessor::makeCaloHitParameters(
@@ -185,10 +164,6 @@
params.m_mipEquivalentEnergy = rawEnergy / mipEnergy;
}
- // DEBUG
- //m_totalEHits += params.m_inputEnergy.Get();
- // END DEBUG
-
// Layer number.
params.m_layer = layer;
@@ -232,13 +207,6 @@
// Return completed calorimeter parameters.
return params;
-
- // Number of interaction lengths from the IP.
- //float intLengthsFromIp = 0.f;
- //float radLengthsFromIp = 0.f;
- //GetPathLengths(hit, radLengthsFromIp, intLengthsFromIp);
- //params.m_nInteractionLengthsFromIp = intLengthsFromIp;
- //params.m_nRadiationLengthsFromIp = radLengthsFromIp;
}
@@ -257,474 +225,3 @@
std::cout << " detectorRegion: " << params.m_detectorRegion.Get() << std::endl;
std::cout << " outerLayer: " << params.m_isInOuterSamplingLayer.Get() << std::endl;
}
-
-
-/*
-void CalorimeterHitProcessor::GetPathLengths(const EVENT::CalorimeterHit *const pCaloHit, float &nRadiationLengthsFromIp,
- float &nInteractionLengthsFromIp)
-{
- try
- {
- static bool initialized = false;
-
- // Coordinates of the sub-detectors in one quadrant
- static float rMinECalBarrel = 0.f;
- static float rMaxECalBarrel = 0.f;
- static float zMinECalBarrel = 0.f;
- static float zMaxECalBarrel = 0.f;
- static float innerPhiECalBarrel = 0.f;
- static int innerSymECalBarrel = 0;
- static float outerPhiECalBarrel = 0.f;
- static int outerSymECalBarrel = 0;
-
- static float rMinECalEndCap = 0.f;
- static float rMaxECalEndCap = 0.f;
- static float zMinECalEndCap = 0.f;
- static float zMaxECalEndCap = 0.f;
- static float innerPhiECalEndCap = 0.f;
- static int innerSymECalEndCap = 0;
- static float outerPhiECalEndCap = 0.f;
- static int outerSymECalEndCap = 0;
-
- static float rMinHCalBarrel = 0.f;
- static float rMaxHCalBarrel = 0.f;
- static float zMinHCalBarrel = 0.f;
- static float zMaxHCalBarrel = 0.f;
- static float innerPhiHCalBarrel = 0.f;
- static int innerSymHCalBarrel = 0;
- static float outerPhiHCalBarrel = 0.f;
- static int outerSymHCalBarrel = 0;
-
- static float rMinHCalEndCap = 0.f;
- static float rMaxHCalEndCap = 0.f;
- static float zMinHCalEndCap = 0.f;
- static float zMaxHCalEndCap = 0.f;
- static float innerPhiHCalEndCap = 0.f;
- static int innerSymHCalEndCap = 0;
- static float outerPhiHCalEndCap = 0.f;
- static int outerSymHCalEndCap = 0;
-
- static float rMinCoil = 0.f;
- static float rMaxCoil = 0.f;
- static float zMinCoil = 0.f;
- static float zMaxCoil = 0.f;
-// static float innerPhiCoil = 0.f;
-// static int innerSymCoil = 0;
-// static float outerPhiCoil = 0.f;
-// static int outerSymCoil = 0;
-
- static float rMinTracker = 0.f;
- static float rMaxTracker = 0.f;
- static float zMinTracker = 0.f;
- static float zMaxTracker = 0.f;
-// static float innerPhiTracker = 0.f;
-// static int innerSymTracker = 0;
-// static float outerPhiTracker = 0.f;
-// static int outerSymTracker = 0;
-
- static float rMinMuonBarrel = 0.f;
- static float rMaxMuonBarrel = 0.f;
- static float zMinMuonBarrel = 0.f;
- static float zMaxMuonBarrel = 0.f;
- static float innerPhiMuonBarrel = 0.f;
- static int innerSymMuonBarrel = 0;
- static float outerPhiMuonBarrel = 0.f;
- static int outerSymMuonBarrel = 0;
-
- static float rMinMuonEndCap = 0.f;
- static float rMaxMuonEndCap = 0.f;
- static float zMinMuonEndCap = 0.f;
- static float zMaxMuonEndCap = 0.f;
- static float innerPhiMuonEndCap = 0.f;
- static int innerSymMuonEndCap = 0;
- static float outerPhiMuonEndCap = 0.f;
- static int outerSymMuonEndCap = 0;
-
- static float avgIntLengthECalBarrel = 0.f;
- static float avgIntLengthECalEndCap = 0.f;
- static float avgIntLengthHCalBarrel = 0.f;
- static float avgIntLengthHCalEndCap = 0.f;
- static float avgIntLengthCoil = 0.f;
-// static float avgIntLengthTracker = 0.f;
- static float avgIntLengthMuonBarrel = 0.f;
- static float avgIntLengthMuonEndCap = 0.f;
-
- static float avgRadLengthECalBarrel = 0.f;
- static float avgRadLengthECalEndCap = 0.f;
- static float avgRadLengthHCalBarrel = 0.f;
- static float avgRadLengthHCalEndCap = 0.f;
- static float avgRadLengthCoil = 0.f;
-// static float avgRadLengthTracker = 0.f;
- static float avgRadLengthMuonBarrel = 0.f;
- static float avgRadLengthMuonEndCap = 0.f;
-
- if (!initialized)
- {
- const PandoraApi::Geometry::Parameters geometryParameters;
-
- DetectorGeometry* geom = getJobManager()->getDetectorGeometry();
- JobConfig::CalorimeterTypes calTypes = getJobManager()->getJobConfig()->getCalorimeterTypes();
-
- // no path length info for tracker computed yet
- rMinTracker = 0.;
- rMaxTracker = 0.;
- zMinTracker = 0;
- zMaxTracker = 0.;
-
- // coil
- rMinCoil = geom->getGeometryParameters()->m_coilInnerRadius.Get();
- rMaxCoil = geom->getGeometryParameters()->m_coilOuterRadius.Get();
- zMinCoil = 0.f;
- zMaxCoil = geom->getGeometryParameters()->m_coilZExtent.Get();
- avgRadLengthCoil = geom->m_coilRadiationLength;
- avgIntLengthCoil = geom->m_coilInteractionLength;
-
-
- // Get the EM barrel SubDetector parameters.
- std::string calType = "EM_BARREL";
- PandoraApi::GeometryParameters::SubDetectorParameters* subdet = geom->getSubDetectorFromType(calType);
- DetectorGeometry::ExtraSubDetectorParameters* xsubdet = geom->getExtraSubDetectorParametersFromType(calType);
-
- ComputeAverageLengthsFromExtraSubDetectorParameters(xsubdet, avgIntLengthECalBarrel, avgRadLengthECalBarrel);
-
- rMinECalBarrel = subdet->m_innerRCoordinate.Get();
- rMaxECalBarrel = subdet->m_outerRCoordinate.Get();
- zMinECalBarrel = subdet->m_innerZCoordinate.Get();
- zMaxECalBarrel = subdet->m_outerZCoordinate.Get();
- innerPhiECalBarrel = subdet->m_innerPhiCoordinate.Get();
- outerPhiECalBarrel = subdet->m_outerPhiCoordinate.Get();
- innerSymECalBarrel = subdet->m_innerSymmetryOrder.Get();
- outerSymECalBarrel = subdet->m_outerSymmetryOrder.Get();
-
- // Get the HCal barrel SubDetector parameters.
- calType = "HAD_BARREL";
- subdet = geom->getSubDetectorFromType(calType);
- xsubdet = geom->getExtraSubDetectorParametersFromType(calType);
-
- ComputeAverageLengthsFromExtraSubDetectorParameters(xsubdet, avgIntLengthHCalBarrel, avgRadLengthHCalBarrel);
-
- rMinHCalBarrel = subdet->m_innerRCoordinate.Get();
- rMaxHCalBarrel = subdet->m_outerRCoordinate.Get();
- zMinHCalBarrel = subdet->m_innerZCoordinate.Get();
- zMaxHCalBarrel = subdet->m_outerZCoordinate.Get();
- innerPhiHCalBarrel = subdet->m_innerPhiCoordinate.Get();
- outerPhiHCalBarrel = subdet->m_outerPhiCoordinate.Get();
- innerSymHCalBarrel = subdet->m_innerSymmetryOrder.Get();
- outerSymHCalBarrel = subdet->m_outerSymmetryOrder.Get();
-
-
- // Get the ECal EndCap SubDetector parameters.
- calType = "EM_ENDCAP";
- subdet = geom->getSubDetectorFromType(calType);
- xsubdet = geom->getExtraSubDetectorParametersFromType(calType);
-
- ComputeAverageLengthsFromExtraSubDetectorParameters(xsubdet, avgIntLengthECalEndCap, avgRadLengthECalEndCap);
-
- rMinECalEndCap = subdet->m_innerRCoordinate.Get();
- rMaxECalEndCap = subdet->m_outerRCoordinate.Get();
- zMinECalEndCap = subdet->m_innerZCoordinate.Get();
- zMaxECalEndCap = subdet->m_outerZCoordinate.Get();
- innerPhiECalEndCap = subdet->m_innerPhiCoordinate.Get();
- outerPhiECalEndCap = subdet->m_outerPhiCoordinate.Get();
- innerSymECalEndCap = subdet->m_innerSymmetryOrder.Get();
- outerSymECalEndCap = subdet->m_outerSymmetryOrder.Get();
-
-
- // Get the HCal EndCap SubDetector parameters.
- calType = "HAD_ENDCAP";
- subdet = geom->getSubDetectorFromType(calType);
- xsubdet = geom->getExtraSubDetectorParametersFromType(calType);
-
- ComputeAverageLengthsFromExtraSubDetectorParameters(xsubdet, avgIntLengthHCalEndCap, avgRadLengthHCalEndCap);
-
- rMinHCalEndCap = subdet->m_innerRCoordinate.Get();
- rMaxHCalEndCap = subdet->m_outerRCoordinate.Get();
- zMinHCalEndCap = subdet->m_innerZCoordinate.Get();
- zMaxHCalEndCap = subdet->m_outerZCoordinate.Get();
- innerPhiHCalEndCap = subdet->m_innerPhiCoordinate.Get();
- outerPhiHCalEndCap = subdet->m_outerPhiCoordinate.Get();
- innerSymHCalEndCap = subdet->m_innerSymmetryOrder.Get();
- outerSymHCalEndCap = subdet->m_outerSymmetryOrder.Get();
-
- // Get the Muon Barrel SubDetector parameters.
- calType = "MUON_BARREL";
- subdet = geom->getSubDetectorFromType(calType);
- xsubdet = geom->getExtraSubDetectorParametersFromType(calType);
-
- ComputeAverageLengthsFromExtraSubDetectorParameters(xsubdet, avgIntLengthMuonBarrel, avgRadLengthMuonBarrel);
-
- rMinMuonBarrel = subdet->m_innerRCoordinate.Get();
- rMaxMuonBarrel = subdet->m_outerRCoordinate.Get();
- zMinMuonBarrel = subdet->m_innerZCoordinate.Get();
- zMaxMuonBarrel = subdet->m_outerZCoordinate.Get();
- innerPhiMuonBarrel = subdet->m_innerPhiCoordinate.Get();
- outerPhiMuonBarrel = subdet->m_outerPhiCoordinate.Get();
- innerSymMuonBarrel = subdet->m_innerSymmetryOrder.Get();
- outerSymMuonBarrel = subdet->m_outerSymmetryOrder.Get();
-
- // Get the Muon EndCap SubDetector parameters.
- calType = "MUON_ENDCAP";
- subdet = geom->getSubDetectorFromType(calType);
- xsubdet = geom->getExtraSubDetectorParametersFromType(calType);
-
- ComputeAverageLengthsFromExtraSubDetectorParameters(xsubdet, avgIntLengthMuonEndCap, avgRadLengthMuonEndCap);
-
- rMinMuonEndCap = subdet->m_innerRCoordinate.Get();
- rMaxMuonEndCap = subdet->m_outerRCoordinate.Get();
- zMinMuonEndCap = subdet->m_innerZCoordinate.Get();
- zMaxMuonEndCap = subdet->m_outerZCoordinate.Get();
- innerPhiMuonEndCap = subdet->m_innerPhiCoordinate.Get();
- outerPhiMuonEndCap = subdet->m_outerPhiCoordinate.Get();
- innerSymMuonEndCap = subdet->m_innerSymmetryOrder.Get();
- outerSymMuonEndCap = subdet->m_outerSymmetryOrder.Get();
-
- initialized = true;
- }
-
- const float *pPosition = pCaloHit->getPosition();
- pandora::CartesianVector positionVector(pPosition[0], pPosition[1], pPosition[2]);
-
- float radius, phi, z;
- positionVector.GetCylindricalCoordinates(radius, phi, z);
- positionVector.SetValues(radius, 0.f, std::fabs(z));
-
- float corrRMin = 0.f, corrRMax = 0.f;
-
- ComputePolygonCorrection(innerSymECalBarrel, rMinECalBarrel, true, innerPhiECalBarrel, phi, corrRMin);
- ComputePolygonCorrection(innerSymECalBarrel, rMaxECalBarrel, true, outerPhiECalBarrel, phi, corrRMax);
- const float eCalBarrelPathLength(ComputePathLengthFromIPInRectangle(positionVector, corrRMin, zMinECalBarrel, corrRMax, zMaxECalBarrel));
-
- ComputePolygonCorrection(innerSymHCalBarrel, rMinHCalBarrel, true, innerPhiHCalBarrel, phi, corrRMin);
- ComputePolygonCorrection(innerSymHCalBarrel, rMaxHCalBarrel, true, outerPhiHCalBarrel, phi, corrRMax);
- const float hCalBarrelPathLength(ComputePathLengthFromIPInRectangle(positionVector, corrRMin, zMinHCalBarrel, corrRMax, zMaxHCalBarrel));
-
- ComputePolygonCorrection(innerSymMuonBarrel, rMinMuonBarrel, true, innerPhiMuonBarrel, phi, corrRMin);
- ComputePolygonCorrection(innerSymMuonBarrel, rMaxMuonBarrel, true, outerPhiMuonBarrel, phi, corrRMax);
- const float muonBarrelPathLength(ComputePathLengthFromIPInRectangle(positionVector, corrRMin, zMinMuonBarrel, corrRMax, zMaxMuonBarrel));
-
- ComputePolygonCorrection(innerSymECalEndCap, rMinECalEndCap, true, innerPhiECalEndCap, phi, corrRMin);
- ComputePolygonCorrection(innerSymECalEndCap, rMaxECalEndCap, true, outerPhiECalEndCap, phi, corrRMax);
- const float eCalEndCapPathLength(ComputePathLengthFromIPInRectangle(positionVector, corrRMin, zMinECalEndCap, corrRMax, zMaxECalEndCap));
-
- ComputePolygonCorrection(innerSymHCalEndCap, rMinHCalEndCap, true, innerPhiHCalEndCap, phi, corrRMin);
- ComputePolygonCorrection(innerSymHCalEndCap, rMaxHCalEndCap, true, outerPhiHCalEndCap, phi, corrRMax);
- const float hCalEndCapPathLength(ComputePathLengthFromIPInRectangle(positionVector, corrRMin, zMinHCalEndCap, corrRMax, zMaxHCalEndCap));
-
- ComputePolygonCorrection(innerSymMuonEndCap, rMinMuonEndCap, true, innerPhiMuonEndCap, phi, corrRMin);
- ComputePolygonCorrection(innerSymMuonEndCap, rMaxMuonEndCap, true, outerPhiMuonEndCap, phi, corrRMax);
- const float muonEndCapPathLength(ComputePathLengthFromIPInRectangle(positionVector, corrRMin, zMinMuonEndCap, corrRMax, zMaxMuonEndCap));
-
- const float coilPathLength(ComputePathLengthFromIPInRectangle(positionVector, rMinCoil, zMinCoil, rMaxCoil, zMaxCoil));
-
- nRadiationLengthsFromIp = (eCalBarrelPathLength * avgRadLengthECalBarrel) +
- (hCalBarrelPathLength * avgRadLengthHCalBarrel) +
- (muonBarrelPathLength * avgRadLengthMuonBarrel) +
- (eCalEndCapPathLength * avgRadLengthECalEndCap) +
- (hCalEndCapPathLength * avgRadLengthHCalEndCap) +
- (muonEndCapPathLength * avgRadLengthMuonEndCap) +
- (coilPathLength * avgRadLengthCoil);
-
- nInteractionLengthsFromIp = (eCalBarrelPathLength * avgIntLengthECalBarrel) +
- (hCalBarrelPathLength * avgIntLengthHCalBarrel) +
- (muonBarrelPathLength * avgIntLengthMuonBarrel) +
- (eCalEndCapPathLength * avgIntLengthECalEndCap) +
- (hCalEndCapPathLength * avgIntLengthHCalEndCap) +
- (muonEndCapPathLength * avgIntLengthMuonEndCap) +
- (coilPathLength * avgIntLengthCoil);
- }
- catch (...)
- {
- std::cout << "CalorimeterHitProcessor: calculation of path length failed" << std::endl;
- throw;
- }
-}
-
-
-void CalorimeterHitProcessor::ComputeAverageLengthsFromExtraSubDetectorParameters(DetectorGeometry::ExtraSubDetectorParameters* xsubdet, float& avgIntLength, float& avgRadLength)
-{
- // compute the average interaction and radiation lengths
- float sumCellThicknesses = 0.f;
- avgIntLength = 0.f;
- avgRadLength = 0.f;
- for (DetectorGeometry::ExtraLayerParametersList::iterator itLay = xsubdet->m_extraLayerParams.begin(), itLayEnd = xsubdet->m_extraLayerParams.end(); itLay != itLayEnd; ++itLay )
- {
- DetectorGeometry::ExtraLayerParameters& layParameters = (*itLay);
- sumCellThicknesses += layParameters.m_cellThickness.Get();
- avgIntLength += layParameters.m_intLength;
- avgRadLength += layParameters.m_radLength;
- }
- avgIntLength = (sumCellThicknesses>0.f ? avgIntLength / sumCellThicknesses: 0.f);
- avgRadLength = (sumCellThicknesses>0.f ? avgRadLength / sumCellThicknesses: 0.f);
-}
-
-
-float CalorimeterHitProcessor::ComputePathLengthFromIPInRectangle(const pandora::CartesianVector &position, float rMin, float zMin,
- float rMax, float zMax)
-{
- // compute cuts with rectangle borders
- float phi, radius, z;
- position.GetCylindricalCoordinates(radius, phi, z);
-
- bool valid[4];
- float xInt[4], zInt[4];
-
- valid[0] = IntersectLines2D(0.f, 0.f, radius, z, rMin, zMin, rMin, zMax, xInt[0], zInt[0]); // first edge of rectangle at rMin
- valid[1] = IntersectLines2D(0.f, 0.f, radius, z, rMin, zMin, rMax, zMin, xInt[1], zInt[1]); // first edge of rectangle at zMin
- valid[2] = IntersectLines2D(0.f, 0.f, radius, z, rMax, zMax, rMax, zMin, xInt[2], zInt[2]); // first edge of rectangle at rMax
- valid[3] = IntersectLines2D(0.f, 0.f, radius, z, rMax, zMax, rMin, zMax, xInt[3], zInt[3]); // first edge of rectangle at zMax
-
- int indexFirstPoint = -1;
- int indexSecondPoint = -1;
-
- for (int i = 0; i < 4; ++i)
- {
- if (valid[i])
- {
- if (indexFirstPoint == -1)
- {
- indexFirstPoint = i;
- }
- else if (indexSecondPoint == -1)
- {
- indexSecondPoint = i;
- }
- else
- {
- std::cout << "ERROR calohitcreator problem at computing path length from IP to calohit in rectangle" << std::endl;
- }
- }
- }
-
- if (indexFirstPoint == -1)
- return 0.f;
-
- pandora::CartesianVector intersectionA( xInt[indexFirstPoint], 0.f, zInt[indexFirstPoint] );
-
- if (indexSecondPoint == -1)
- {
- const float length(pandora::CartesianVector(position - intersectionA).GetMagnitude());
- return length;
- }
-
- pandora::CartesianVector intersectionB(xInt[indexSecondPoint], 0.f, zInt[indexSecondPoint]);
-
- const float length(pandora::CartesianVector(intersectionA - intersectionB).GetMagnitude());
- return length;
-}
-
-
-
-
-bool CalorimeterHitProcessor::IntersectLines2D(float lineAXStart, float lineAYStart, float lineAXEnd, float lineAYEnd,
- float lineBXStart, float lineBYStart, float lineBXEnd, float lineBYEnd, float &xIntersect, float &yIntersect)
-{
- // Slopes of the two lines, take max float value instead of infinity
- float k0(std::numeric_limits<float>::max()), k1(std::numeric_limits<float>::max());
-
- bool parallelToY_A = false;
- bool parallelToY_B = false;
-
- if (std::fabs(lineAXEnd-lineAXStart) > std::numeric_limits<float>::epsilon())
- {
- k0 = (lineAYEnd - lineAYStart) / (lineAXEnd - lineAXStart);
- }
- else
- {
- parallelToY_A = true;
- }
-
- if (std::fabs(lineBXEnd - lineBXStart) > std::numeric_limits<float>::epsilon())
- {
- k1 = (lineBYEnd - lineBYStart) / (lineBXEnd - lineBXStart);
- }
- else
- {
- parallelToY_B = true;
- }
-
- if (parallelToY_A && parallelToY_B)
- {
- xIntersect = 0.f;
- yIntersect = 0.f;
-
- return false;
- }
-
- if (parallelToY_A)
- {
- xIntersect = lineAXStart;
- yIntersect = lineBXStart + k1 * (xIntersect - lineBXStart);
- }
- else if (parallelToY_B)
- {
- xIntersect = lineBXStart;
- yIntersect = lineAXStart + k0 * (xIntersect - lineAXStart);
- }
- else
- {
- const float b0 = -1;
- const float b1 = -1;
-
- const float c0 = (lineAYStart - k0 * lineAXStart);
- const float c1 = (lineBYStart - k1 * lineBXStart);
-
- const float determinant(k0 * b1 - k1 * b0);
-
- if (0.f == determinant)
- {
- std::cout << "ERROR zero determinant in interaction length calculator" << std::endl;
- return false;
- }
-
- // use Kramers rule to compute xi and yi
- xIntersect=((b0 * c1 - b1 * c0) / determinant);
- yIntersect=((k1 * c0 - k0 * c1) / determinant);
- }
-
- // check if intersections are within end-points of lines
- // check x coordinate, line A
- if (!((xIntersect >= lineAXStart && xIntersect <= lineAXEnd) || (xIntersect >= lineAXEnd && xIntersect <= lineAXStart)))
- return false;
-
- // check x coordinate, line B
- if (!((xIntersect >= lineBXStart && xIntersect <= lineBXEnd) || (xIntersect >= lineBXEnd && xIntersect <= lineBXStart)))
- return false;
-
- // check y coordinate, line A
- if (!((yIntersect >= lineAYStart && yIntersect <= lineAYEnd) || (yIntersect >= lineAYEnd && yIntersect <= lineAYStart)))
- return false;
-
- // check y coordinate, line B
- if (!((yIntersect >= lineBYStart && yIntersect <= lineBYEnd) || (yIntersect >= lineBYEnd && yIntersect <= lineBYStart)))
- return false;
-
- return true;
-}
-
-
-void CalorimeterHitProcessor::ComputePolygonCorrection(int symmetryOrder, float distanceToIp, bool isClosestDistance, float phi0, float phi, float& correctedDistance)
-{
- correctedDistance = distanceToIp;
- if (symmetryOrder > 2)
- {
- static const float pi(std::acos(-1.));
-
- const float symmOrderAngle = (pi/float(symmetryOrder));
- float rotPhi = phi - trunc(phi/symmOrderAngle ) *symmOrderAngle;
- float rotPhi0 = phi0- trunc(phi0/symmOrderAngle) *symmOrderAngle;
-
-
-// std::cout << "phi " << phi << " rotphi " << rotPhi << " phi0 " << phi0 << " rotphi0 " << rotPhi0 << " symordang " << symmOrderAngle;
-
- rotPhi -= rotPhi0;
-// std::cout << " rotphi- " << rotPhi << std::endl;
-
- if (isClosestDistance)
- correctedDistance = distanceToIp/cos(rotPhi);
- else
- correctedDistance = cos(symmOrderAngle/2.0)*distanceToIp/cos(rotPhi);
-
-// std::cout << "distance " << distanceToIp << " corrected distance " << correctedDistance << std::endl;
- }
-}
-*/
slicPandora/src
diff -u -r1.1 -r1.2
--- LcioInputCollectionSettings.cpp 16 Sep 2011 23:31:18 -0000 1.1
+++ LcioInputCollectionSettings.cpp 19 Sep 2011 18:54:31 -0000 1.2
@@ -1,4 +1,4 @@
-// $Id: LcioInputCollectionSettings.cpp,v 1.1 2011/09/16 23:31:18 jeremy Exp $
+// $Id: LcioInputCollectionSettings.cpp,v 1.2 2011/09/19 18:54:31 jeremy Exp $
#include "LcioInputCollectionSettings.h"
@@ -11,15 +11,21 @@
std::string LcioInputCollectionSettings::unknown = "UNKNOWN";
LcioInputCollectionSettings::LcioInputCollectionSettings()
- : m_initialized(false)
+ : m_initialized(false),
+ trackCollectionName("Tracks")
{
- // Init default CaloType list.
+ // Default list of hit collection types to read in.
defaultCaloTypes.push_back(emBarrel);
defaultCaloTypes.push_back(emEndcap);
defaultCaloTypes.push_back(hadBarrel);
defaultCaloTypes.push_back(hadEndcap);
defaultCaloTypes.push_back(muonBarrel);
defaultCaloTypes.push_back(muonEndcap);
+
+ // Default names of TrackState collections.
+ trackStateMap["StateAtStart"] = "StateAtStart";
+ trackStateMap["StateAtECal"] = "StateAtECal";
+ trackStateMap["StateAtEnd"] = "StateAtEnd";
}
LcioInputCollectionSettings::~LcioInputCollectionSettings()
@@ -27,6 +33,8 @@
pandora::StatusCode LcioInputCollectionSettings::readSettings(const std::string& xmlFileName)
{
+ std::cout << "Reading in LCIO collection settings from XML file " << xmlFileName << " ... " << std::endl << std::endl;
+
if (m_initialized)
{
std::cout << "Already initialized." << std::endl;
@@ -47,13 +55,11 @@
const TiXmlHandle pXmlHandle = TiXmlHandle(pXmlDocHandle.FirstChildElement().Element());
// Loop over CaloCollection elements.
+ std::cout << "Using these CalorimeterHit collections ..." << std::endl;
for (TiXmlElement* pXmlElement = pXmlHandle.FirstChild("CaloCollection").Element(); NULL != pXmlElement;
pXmlElement = pXmlElement->NextSiblingElement("CaloCollection"))
{
- //std::cout << "name: " << pXmlElement->Attribute("name") << std::endl;
- //std::cout << "type: " << pXmlElement->Attribute("caloType") << std::endl;
- //std::cout << "typeFromStr: " << getTypeFromString(pXmlElement->Attribute("caloType")) << std::endl;
- //std::cout << std::endl;
+ std::cout << pXmlElement->Attribute("name") << " with type " << pXmlElement->Attribute("caloType") << std::endl;
CaloType calType = getTypeFromString(pXmlElement->Attribute("caloType"));
std::string collName = pXmlElement->Attribute("name");
@@ -67,13 +73,16 @@
return pandora::STATUS_CODE_FAILURE;
}
}
+ std::cout << std::endl;
// Track collection.
TiXmlElement* pTrackCollElement = pXmlHandle.FirstChild("TrackCollection").Element();
if (pTrackCollElement != NULL)
{
+ std::cout << "Using this TrackCollection ..." << std::endl;
if (pTrackCollElement->Attribute("name") != NULL)
{
+ std::cout << pTrackCollElement->Attribute("name") << std::endl;
trackCollectionName = pTrackCollElement->Attribute("name");
}
else
@@ -82,14 +91,39 @@
return pandora::STATUS_CODE_FAILURE;
}
}
+ std::cout << std::endl;
+
+ // TrackState setup.
+ std::cout << "Checking for custom TrackState collection settings ..." << std::endl;
+ for (TiXmlElement* pXmlElement = pXmlHandle.FirstChild("TrackStateCollection").Element(); NULL != pXmlElement;
+ pXmlElement = pXmlElement->NextSiblingElement("TrackStateCollection"))
+ {
+ if (pXmlElement->Attribute("name") == NULL)
+ {
+ std::cout << "TrackStateCollection is missing name attribute." << std::endl;
+ return pandora::STATUS_CODE_FAILURE;
+ }
+ if (pXmlElement->Attribute("trackState") == NULL)
+ {
+ std::cout << "TrackStateCollection is missing trackState attribute." << std::endl;
+ return pandora::STATUS_CODE_FAILURE;
+ }
+ std::string name = pXmlElement->Attribute("name");
+ std::string trackState = pXmlElement->Attribute("trackState");
+ trackStateMap[trackState] = name;
+ std::cout << name << " with state " << trackState << std::endl;
+ }
+ std::cout << std::endl;
}
catch (pandora::StatusCodeException &statusCodeException)
{
std::cout << "Failure in reading collection settings." << statusCodeException.ToString() << std::endl;
+ return pandora::STATUS_CODE_FAILURE;
}
catch (...)
{
- std::cout << "Unrecognized exception while Pandora settings file." << std::endl;
+ std::cout << "Unrecognized exception while reading LCIO collection settings." << std::endl;
+ return pandora::STATUS_CODE_FAILURE;
}
m_initialized = true;
@@ -132,29 +166,21 @@
const std::string& LcioInputCollectionSettings::getStringFromType(CaloType caloType)
{
- static std::string ecalBarrel("EM_BARREL");
- static std::string ecalEndcap("EM_ENDCAP");
- static std::string hcalBarrel("HAD_BARREL");
- static std::string hcalEndcap("HAD_ENDCAP");
- static std::string muonBarrel("MUON_BARREL");
- static std::string muonEndcap("MUON_ENDCAP");
- static std::string unknown("UNKNOWN");
-
if (caloType == EM_BARREL)
{
- return ecalBarrel;
+ return emBarrel;
}
else if (caloType == EM_ENDCAP)
{
- return ecalEndcap;
+ return emEndcap;
}
else if (caloType == HAD_BARREL)
{
- return hcalBarrel;
+ return hadBarrel;
}
else if (caloType == HAD_ENDCAP)
{
- return hcalEndcap;
+ return hadEndcap;
}
else if (caloType == MUON_BARREL)
{
@@ -169,13 +195,3 @@
return unknown;
}
}
-
-const LcioInputCollectionSettings::CaloCollectionMap& LcioInputCollectionSettings::getCaloCollectionMap() const
-{
- return caloCollectionMap;
-}
-
-const std::vector<std::string>& LcioInputCollectionSettings::getDefaultCalorimeterTypes() const
-{
- return this->defaultCaloTypes;
-}
slicPandora/src
diff -u -r1.24 -r1.25
--- SimpleTrackProcessor.cpp 4 Feb 2011 14:49:20 -0000 1.24
+++ SimpleTrackProcessor.cpp 19 Sep 2011 18:54:31 -0000 1.25
@@ -1,4 +1,4 @@
-// $Id: SimpleTrackProcessor.cpp,v 1.24 2011/02/04 14:49:20 stanitzk Exp $
+// $Id: SimpleTrackProcessor.cpp,v 1.25 2011/09/19 18:54:31 jeremy Exp $
//#define POST_CDR_VERSION 1
@@ -36,13 +36,16 @@
using pandora::CartesianVector;
// FIXME: Name of collection containing LCIO Track objects is hard-coded to "Tracks".
-std::string SimpleTrackProcessor::trackCollectionName = "Tracks";
+//std::string SimpleTrackProcessor::trackCollectionName = "Tracks";
//std::string SimpleTrackProcessor::startCollectionName = trackCollectionName + "_StateAtStart";
//std::string SimpleTrackProcessor::ecalCollectionName = trackCollectionName + "_StateAtECal";
//std::string SimpleTrackProcessor::endCollectionName = trackCollectionName + "_StateAtEnd";
void SimpleTrackProcessor::processEvent(EVENT::LCEvent* event)
{
+ // Get the name of the Track collection from the job config.
+ const std::string& trackCollectionName = getJobManager()->getLcioCollectionSettings().getTrackCollectionName();
+
LCCollection* trackCollection = NULL;
try
{
@@ -54,7 +57,6 @@
return;
}
-
// Check if MC information is present.
bool haveMCRelations = false;
const EVENT::LCCollection *pMCRelationCollection = 0;
@@ -250,10 +252,10 @@
void SimpleTrackProcessor::setupTrackStatesFromGenericObjects(PandoraApi::Track::Parameters& trackParameters, EVENT::LCEvent* event, int i)
{
// Get the Track state collections.
- // FIXME: Hard-coded collection names.
- LCCollection* startCollection = event->getCollection("StateAtStart");
- LCCollection* ecalCollection = event->getCollection("StateAtECal");
- LCCollection* endCollection = event->getCollection("StateAtEnd");
+ LcioInputCollectionSettings settings = this->getJobManager()->getLcioCollectionSettings();
+ LCCollection* startCollection = event->getCollection(settings.getTrackStateCollectionName("StateAtStart"));
+ LCCollection* ecalCollection = event->getCollection(settings.getTrackStateCollectionName("StateAtECal"));
+ LCCollection* endCollection = event->getCollection(settings.getTrackStateCollectionName("StateAtEnd"));
// Add start state.
LCGenericObject* startObj = dynamic_cast<LCGenericObject*>(startCollection->getElementAt(i));
@@ -311,19 +313,13 @@
const float innerZ=pandora::GeometryHelper::GetECalEndCapParameters().GetInnerZCoordinate();
float trackZ=fabs(trackParameters.m_trackStateAtCalorimeter.Get().GetPosition().GetZ());
- //FIXME hard-coded for now!!!
- if (trackZ-innerZ>-1.5) // it is close to the endcap,
+ // FIXME Hard-coded check for projection to EndCap.
+ if (trackZ-innerZ > -1.5) // it is close to the endcap,
{
-
- trackParameters.m_isProjectedToEndCap=true; //it is in the endcap
-
+ trackParameters.m_isProjectedToEndCap=true; //it is in the endcap
}
else
{
- trackParameters.m_isProjectedToEndCap=false; //stays in barrel
+ trackParameters.m_isProjectedToEndCap=false; //stays in barrel
}
-
-
-
-
}
CVSspam 0.2.8