2 #include <CalorimeterHitType.h>
3 #include <EVENT/LCCollection.h>
4 #include <EVENT/LCObject.h>
5 #include <EVENT/MCParticle.h>
6 #include <EVENT/SimTrackerHit.h>
7 #include <EVENT/Track.h>
8 #include <EVENT/TrackerHit.h>
9 #include <IMPL/LCCollectionVec.h>
10 #include <IMPL/LCFlagImpl.h>
11 #include <IMPL/LCRelationImpl.h>
12 #include <IMPL/ReconstructedParticleImpl.h>
13 #include <IMPL/TrackImpl.h>
14 #include <UTIL/LCRelationNavigator.h>
15 #include <UTIL/LCTOOLS.h>
16 #include <gear/BField.h>
17 #include <gear/CalorimeterParameters.h>
18 #include <gear/GEAR.h>
19 #include <gear/GearParameters.h>
20 #include <gear/PadRowLayout2D.h>
21 #include <gear/TPCParameters.h>
22 #include <gear/VXDLayerLayout.h>
23 #include <gear/VXDParameters.h>
24 #include <marlin/Global.h>
29 #include "ClusterShapes.h"
35 using namespace marlin;
46 _description =
"Prints out information in DST in a useful format";
48 registerProcessorParameter(
"Debug",
"Activate debugging?",
m_debug,
int(0));
50 registerProcessorParameter(
"Monitoring",
"Monitoring",
m_monitoring,
int(1));
52 registerProcessorParameter(
"ShowBackground",
"Show background pfo information",
m_showBackground,
int(1));
54 registerInputCollection(LCIO::RECONSTRUCTEDPARTICLE,
"InputPfoCollection",
"Input PFO Collection",
m_inputPfoCollection,
55 std::string(
"PandoraPFANewPFOs"));
57 registerProcessorParameter(
"PfoToMcRelationCollection",
"Input PFO to MC particle relation Collection",
60 registerInputCollection(LCIO::MCPARTICLE,
"McParticleCollection",
"Input MC particle collection",
73 streamlog_out(MESSAGE) << std::endl;
74 streamlog_out(MESSAGE) <<
"CLICDstChecker ---> new run : run number = " <<
m_nRun << std::endl;
79 streamlog_out(MESSAGE) << std::endl;
80 streamlog_out(MESSAGE) <<
"CLICDstChecker -> run = " <<
m_nRun <<
" event = " <<
m_nEvt << std::endl;
81 streamlog_out(MESSAGE) << std::endl;
84 std::vector<ReconstructedParticle*> physicsPfos;
85 std::vector<MCParticle*> physicsMatchedMcParticle;
86 std::vector<ReconstructedParticle*> backgroundPfos;
90 const int nelem = col->getNumberOfElements();
91 for (
int iPfo = 0; iPfo < nelem; ++iPfo)
92 m_pfoVector.push_back(static_cast<ReconstructedParticle*>(col->getElementAt(iPfo)));
94 }
catch (DataNotAvailableException&
e) {
95 streamlog_out(MESSAGE) <<
m_inputPfoCollection.c_str() <<
" collection is unavailable" << std::endl;
100 int nelem = col->getNumberOfElements();
101 for (
int iMc = 0; iMc < nelem; ++iMc) {
102 MCParticle* pMc =
static_cast<MCParticle*
>(col->getElementAt(iMc));
105 const float px(pMc->getMomentum()[0]);
106 const float py(pMc->getMomentum()[1]);
107 const float pz(pMc->getMomentum()[2]);
108 const float p = sqrt(px * px + py * py + pz * pz);
109 const float cosThetaMc = fabs(pz) / p;
111 if (cosThetaMc < 1.0)
113 if ((pMc->getParents()).size() == 0)
114 streamlog_out(MESSAGE) <<
" Primary MC particle : " << pMc->getPDG() <<
" E = " << pMc->getEnergy()
115 <<
" cosT = " << cosThetaMc <<
" theta = " << thetaMc << std::endl;
117 }
catch (DataNotAvailableException& e) {
124 }
catch (DataNotAvailableException& e) {
128 for (
unsigned int iPfo = 0; iPfo <
m_pfoVector.size(); ++iPfo) {
131 if (objectVec.size() > 0) {
132 for (
unsigned int imc = 0; imc < objectVec.size(); imc++) {
133 MCParticle* pMC =
static_cast<MCParticle*
>(objectVec[imc]);
136 physicsPfos.push_back(pPfo);
137 physicsMatchedMcParticle.push_back(pMC);
139 backgroundPfos.push_back(pPfo);
146 float eBackground = 0;
149 for (
unsigned int ipass = 0; ipass < 2; ipass++) {
151 (ipass == 0) ? nPfos = physicsPfos.size() : nPfos = backgroundPfos.size();
152 for (
unsigned int iPfo = 0; iPfo < nPfos; ++iPfo) {
155 streamlog_out(MESSAGE) <<
" *********************** Physics Pfos ************************" << std::endl;
156 streamlog_out(MESSAGE) <<
" pfo E pT cost nt nc mc Emc " << std::endl;
159 streamlog_out(MESSAGE) <<
" ********************** Background Pfos ************************" << std::endl;
160 streamlog_out(MESSAGE) <<
" pfo E pT cost nt nc " << std::endl;
164 ReconstructedParticle* pPfo;
165 (ipass == 0) ? pPfo = physicsPfos[iPfo] : pPfo = backgroundPfos[iPfo];
166 MCParticle* pMc = NULL;
168 pMc = physicsMatchedMcParticle[iPfo];
169 eMc += pMc->getEnergy();
172 const int type = pPfo->getType();
175 for (
unsigned int i = 0; i < 3; i++)
176 momentum[i] = pPfo->getMomentum()[i];
177 const float pT = sqrt(momentum[0] * momentum[0] + momentum[1] * momentum[1]);
178 const float p = sqrt(pT * pT + momentum[2] * momentum[2]);
179 const float cosTheta = fabs(momentum[2]) / p;
180 const float energy = pPfo->getEnergy();
184 const ParticleIDVec particleIDs = pPfo->getParticleIDs();
187 const ReconstructedParticleVec particles = pPfo->getParticles();
188 const ClusterVec clusters = pPfo->getClusters();
189 const TrackVec tracks = pPfo->getTracks();
210 (ipass == 0) ? eSignal += energy : eBackground += energy;
213 std::stringstream output;
214 output << std::fixed;
216 if (clusters.size() == 0)
218 if (tracks.size() == 0)
221 if (tracks.size() > 0 && clusters.size() > 0)
226 streamlog_out(MESSAGE) << output.str();
227 streamlog_out(MESSAGE) << std::endl;
233 streamlog_out(MESSAGE) <<
" ESignal = " << eSignal <<
"( " << eMc <<
" )" << std::endl;
234 streamlog_out(MESSAGE) <<
" EBack = " << eBackground << std::endl;
=== CLICDstChecker Processor === Processor to check DST Pfos
#define FORMATTED_OUTPUT_MC(out, N1, E1)
#define FORMATTED_OUTPUT_CLUSTER(out, N1, E1, E2, E3, N2, N3)
virtual void processRunHeader(LCRunHeader *run)
std::string m_inputMcParticleCollection
const float radiansToDegrees
std::set< MCParticle * > m_mcSet
#define FORMATTED_OUTPUT_TRACK_CLUSTER(out, N1, E1, E2, E3, N2, N3)
virtual void processEvent(LCEvent *evt)
int m_monitoring
Whether to display monitoring information.
int m_showBackground
Whether to display background information.
virtual void check(LCEvent *evt)
std::vector< ReconstructedParticle * > m_pfoVector
std::string m_inputPfoToMcRelationCollection
#define FORMATTED_OUTPUT_TRACK(out, N1, E1, E2, E3, N2, N3)
static bool PfoSortFunction(EVENT::ReconstructedParticle *lhs, EVENT::ReconstructedParticle *rhs)
CLICDstChecker aCLICDstChecker
LCRelationNavigator * m_pfoToMcNavigator
std::string m_inputPfoCollection
Input PFO collection name.