126 LogDebug(
"PFSimParticleProducer")<<
"START event: "<<iEvent.
id().
event()
127 <<
" in run "<<iEvent.
id().
run()<<endl;
133 std::vector<unsigned> recTrackSimID;
139 typedef std::pair<double, unsigned> hitSimID;
140 typedef std::list< std::pair<double, unsigned> >::iterator ITM;
141 std::vector< std::list <hitSimID> > caloHitsEBID(62000);
142 std::vector<double> caloHitsEBTotE(62000,0.0);
158 err<<
"could not find pcaloHit "<<
"famosSimHits:EcalHitsEB";
159 LogError(
"PFSimParticleProducer")<<err.str()<<endl;
169 edm::PCaloHitContainer::const_iterator it
170 = pcalohits.
product()->begin();
171 edm::PCaloHitContainer::const_iterator itend
187 if(it->energy() > 0.0) {
188 std::pair<double, unsigned> phitsimid
189 = make_pair(it->energy(),it->geantTrackId());
190 caloHitsEBID[detid.hashedIndex()].push_back(phitsimid);
191 caloHitsEBTotE[detid.hashedIndex()]
202 LogDebug(
"PFSimParticleProducer")<<
"getting PFRecTracks"<<endl;
206 LogError(
"PFSimParticleProducer")<<err
207 <<
" cannot get collection " 208 <<
"particleFlowBlock"<<
":" 222 auto pOutputPFSimParticleCollection = std::make_unique<reco::PFSimParticleCollection>();
230 LogError(
"PFSimParticleProducer")<<err.str()<<endl;
241 <<
"cannot find sim vertices: "<<inputTagSim_<<endl;
274 unsigned recTrackID = 99999;
275 vector<unsigned> recHitContrib;
276 vector<double> recHitContribFrac;
280 for(
unsigned lo=0; lo<recTrackSimID.size();
282 if(
i == recTrackSimID[lo] ) {
299 LogError(
"PFSimParticleProducer")<<err.str()<<endl;
313 for(;it_rh!=itend_rh;++it_rh)
322 ITM it_phit = caloHitsEBID[rhit_hi].begin();
323 ITM itend_phit = caloHitsEBID[rhit_hi].end();
324 for(;it_phit!=itend_phit;++it_phit)
326 if(
i == it_phit->second)
330 bool alreadyin =
false;
331 for(
unsigned ihit = 0; ihit < recHitContrib.size();
333 if(detid.rawId() == recHitContrib[ihit])
337 double pcalofraction = 0.0;
338 if(caloHitsEBTotE[rhit_hi] != 0.0)
340 = (it_phit->first/caloHitsEBTotE[rhit_hi])*100.0;
343 recHitContrib.push_back(it_rh->id());
344 recHitContribFrac.push_back(pcalofraction);
375 originVtx.position().y(),
376 originVtx.position().z() );
388 particle.addPoint(pointOrig);
408 particle.addPoint(pointEnd);
412 particle.addPoint(dummy);
422 posLayer1, momLayer1);
424 particle.addPoint( layer1Pt );
430 particle.addPoint(dummy);
439 posLayer2, momLayer2);
441 particle.addPoint( layer2Pt );
447 particle.addPoint(dummy);
459 particle.addPoint( ecalPt );
465 particle.addPoint(dummy);
470 particle.addPoint(dummy);
481 posHCALin, momHCALin);
483 particle.addPoint( hcalPtin );
492 posHCALout, momHCALout);
494 particle.addPoint( hcalPtout );
503 posHOEntrance, momHOEntrance);
505 particle.addPoint( hoPtin );
513 particle.addPoint(dummy);
516 pOutputPFSimParticleCollection->push_back( particle );
524 <<
" in run "<<iEvent.
id().
run()<<endl;
bool processParticles_
process particles on/off
EventNumber_t event() const
bool noEndVertex() const
no end vertex
float charge() const
charge
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const RawParticle & hoEntrance() const
The particle at HCAL exir.
const FSimVertex & endVertex() const
end vertex
const RawParticle & hcalExit() const
The particle at HCAL exir.
double y() const
y of vertex
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double z() const
z of vertex
const XYZTLorentzVector & momentum() const
Temporary (until move of SimTrack to Mathcore) - No! Actually very useful.
void fill(const HepMC::GenEvent &hev, edm::EventID &Id)
fill the FBaseSimEvent from the current HepMC::GenEvent
const HepPDT::ParticleDataTable * theTable() const
Get the pointer to the particle data table.
edm::EDGetTokenT< edm::PCaloHitContainer > tokenFamosSimHits_
const RawParticle & layer1Entrance() const
The particle at Preshower Layer 1.
std::vector< EcalRecHit >::const_iterator const_iterator
edm::InputTag inputTagEcalRecHitsEB_
const std::vector< int > & daughters() const
Vector of daughter indices.
double x() const
x of vertex
edm::EDGetTokenT< reco::PFRecTrackCollection > tokenRecTracks_
void getData(T &iHolder) const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
int hashedIndex(int ieta, int iphi)
edm::InputTag inputTagSim_
module label for retrieving input simtrack and simvertex
Point of closest approach from beam axis (initial point in the case of PFSimParticle) ...
const math::XYZTLorentzVector & position() const
Temporary (until CMSSW moves to Mathcore) - No ! Actually very useful.
edm::EDGetTokenT< std::vector< SimTrack > > tokenSim_
const RawParticle & ecalEntrance() const
The particle at ECAL entrance.
const FSimVertex & vertex() const
Origin vertex.
bool mctruthMatchingInfo_
true particle for particle flow
unsigned int nTracks() const
Number of tracks.
const_iterator end() const
T const * product() const
XYZPointD XYZPoint
point in space with cartesian internal representation
edm::EDGetTokenT< EcalRecHitCollection > tokenEcalRecHitsEB_
int type() const
particle type (HEP PDT convension)
void initializePdt(const HepPDT::ParticleDataTable *aPdt)
Initialize the particle data table.
int id() const
the index in FBaseSimEvent and other vectors
const RawParticle & layer2Entrance() const
The particle at Preshower Layer 2.
bool noMother() const
no mother particle
const RawParticle & hcalEntrance() const
The particle at HCAL entrance.
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
void getSimIDs(const TrackHandle &trackh, std::vector< unsigned > &recTrackSimID)
const FSimTrack & mother() const
mother
const_iterator begin() const
edm::EDGetTokenT< std::vector< SimVertex > > tokenSimVertices_
void print() const
print the FBaseSimEvent in an intelligible way
FSimTrack & track(int id) const
Return track with given Id.