21 using namespace pftools;
25 debug_(0), nParticleWrites_(0), nParticleFails_(0), nEventWrites_(0), nEventFails_(0),
26 deltaRCandToSim_(0.4) {
28 std::cout << __PRETTY_FUNCTION__ << std::endl;
33 tree_->Branch(
"Calibratable",
"pftools::Calibratable", &calib_, 32000, 2);
75 std::cout <<
"\tStarting event..."<< std::endl;
82 if (sims.size() == 0) {
83 std::cout <<
"\tNo sim particles found!" << std::endl;
90 std::cout <<
"\tFound "<< primarySims.size()
91 <<
" primary sim particles, "<< (**pfCandidates_).size() <<
" pfCandidates\n";
93 for (std::vector<unsigned>::const_iterator cit = primarySims.begin(); cit
94 != primarySims.end(); ++cit) {
97 std::cout <<
"\t**Starting particle...**\n";
119 std::cout <<
"\t\tFound candidates near sim, found "
120 << matchingCands.size()<<
" of them.\n";
121 if (matchingCands.size() == 0)
123 for (std::vector<unsigned>::const_iterator mcIt = matchingCands.begin(); mcIt
124 != matchingCands.end(); ++mcIt) {
146 const std::vector<PFSimParticle>& sims) {
147 std::vector<unsigned> answers;
149 for (std::vector<PFSimParticle>::const_iterator cit = sims.begin(); cit
150 != sims.end(); ++cit) {
156 if (particleId != 211)
161 answers.push_back(index);
169 std::cout <<
"\tCandidate: "<< cand <<
"\n";
176 cw.
eta_ = cand.eta();
177 cw.
phi_ = cand.phi();
178 cw.
type_ = cand.particleId();
182 std::cout <<
"\t\tECAL energy = " << cand.ecalEnergy()
183 <<
", HCAL energy = " << cand.hcalEnergy() <<
"\n";
188 std::cout <<
"\tLooping over elements in blocks, "
189 << eleInBlocks.size() <<
" of them."<< std::endl;
190 for (PFCandidate::ElementsInBlocks::iterator bit = eleInBlocks.begin(); bit
191 != eleInBlocks.end(); ++bit) {
200 unsigned indexInBlock((*bit).second);
206 switch (elements[indexInBlock].
type()) {
209 const PFCluster theRealCluster = *clusterRef;
214 std::cout <<
"\t\tECAL cluster: "<< theRealCluster <<
"\n";
221 const PFCluster theRealCluster = *clusterRef;
226 std::cout <<
"\t\tHCAL cluster: "<< theRealCluster <<
"\n";
234 << elements[indexInBlock].type() <<
"\n";
244 const PFSimParticle& pft,
const std::vector<PFCandidate>& cands,
245 const double& deltaRCut) {
248 std::vector<unsigned> answers;
253 for (std::vector<PFCandidate>::const_iterator cit = cands.begin(); cit
254 != cands.end(); ++cit) {
257 double cEta = cand.
eta();
258 double cPhi = cand.
phi();
260 if (
deltaR(cEta, trEta, cPhi, trPhi) < deltaRCut) {
262 answers.push_back(index);
283 std::cout <<
"\t**Finished particle.**\n";
290 std::cout << __PRETTY_FUNCTION__ << std::endl;
296 std::cout <<
"Leaving "<< __PRETTY_FUNCTION__ <<
"\n";
302 const double& phi1,
const double& phi2) {
303 double deltaEta = fabs(eta1 - eta2);
304 double deltaPhi = fabs(phi1 - phi2);
305 if (deltaPhi >
M_PI) {
308 return sqrt(
pow(deltaEta, 2) +
pow(deltaPhi, 2));
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
const REPPoint & positionREP() const
trajectory position in (rho, eta, phi) base
const std::vector< int > & daughterIds() const
T getParameter(std::string const &) const
edm::InputTag inputTagClustersHcal_
edm::Service< TFileService > fileservice_
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
std::vector< unsigned > findPrimarySimParticles(const std::vector< reco::PFSimParticle > &sims)
virtual void fillTreeAndReset()
CalibratableTest(const edm::ParameterSet &)
edm::Handle< reco::PFCandidateCollection > * pfCandidates_
unsigned nParticleWrites_
double deltaR(const double &eta1, const double &eta2, const double &phi1, const double &phi2)
std::vector< PFSimParticle > PFSimParticleCollection
collection of PFSimParticle objects
const edm::OwnVector< reco::PFBlockElement > & elements() const
T * make(const Args &...args) const
make new ROOT object
void extractCandidate(const reco::PFCandidate &cand)
pftools::Calibratable * calib_
virtual double eta() const
momentum pseudorapidity
std::vector< ElementInBlock > ElementsInBlocks
edm::Handle< reco::PFSimParticleCollection > * simParticles_
edm::Handle< reco::PFClusterCollection > * clustersEcal_
const REPPoint & positionREP() const
cluster position: rho, eta, phi
void getCollection(edm::Handle< T > &c, const edm::InputTag &tag, const edm::Event &event) const
edm::InputTag inputTagCandidates_
Abs< T >::type abs(const T &t)
std::vector< unsigned > findCandidatesInDeltaR(const reco::PFSimParticle &pft, const std::vector< reco::PFCandidate > &cands, const double &deltaR)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
true particle for particle flow
double energy() const
cluster energy
edm::InputTag inputTagSimParticles_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
const math::XYZTLorentzVector & momentum() const
4-momenta quadrivector
const reco::PFTrajectoryPoint & trajectoryPoint(unsigned index) const
edm::Handle< reco::PFClusterCollection > * clustersHcal_
Particle reconstructed by the particle flow algorithm.
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
unsigned int nTrajectoryPoints() const
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
edm::InputTag inputTagClustersEcal_
virtual double phi() const
momentum azimuthal angle
Power< A, B >::type pow(const A &a, const B &b)