83 mctruthMatchingInfo_ =
89 inputTagEcalRecHitsEB_
91 inputTagEcalRecHitsEE_
99 produces<reco::PFSimParticleCollection>();
102 (
"ParticleFilter" );
104 mySimEvent =
new FSimEvent( particleFilter_ );
125 mySimEvent->initializePdt(&(*pdt));
134 LogDebug(
"PFSimParticleProducer")<<
"START event: "<<iEvent.
id().
event()
135 <<
" in run "<<iEvent.
id().
run()<<endl;
141 std::vector<unsigned> recTrackSimID;
147 typedef std::pair<double, unsigned> hitSimID;
148 typedef std::list< std::pair<double, unsigned> >::iterator
ITM;
149 std::vector< std::list <hitSimID> > caloHitsEBID(62000);
150 std::vector<double> caloHitsEBTotE(62000,0.0);
152 if(mctruthMatchingInfo_){
161 = iEvent.
getByLabel(inputTagFamosSimHits_,pcalohits);
166 err<<
"could not find pcaloHit "<<
"famosSimHits:EcalHitsEB";
167 LogError(
"PFSimParticleProducer")<<err.str()<<endl;
177 edm::PCaloHitContainer::const_iterator it
178 = pcalohits.
product()->begin();
179 edm::PCaloHitContainer::const_iterator itend
195 if(it->energy() > 0.0) {
196 std::pair<double, unsigned> phitsimid
197 = make_pair(it->energy(),it->geantTrackId());
198 caloHitsEBID[
detid.hashedIndex()].push_back(phitsimid);
199 caloHitsEBTotE[
detid.hashedIndex()]
210 LogDebug(
"PFSimParticleProducer")<<
"getting PFRecTracks"<<endl;
211 iEvent.
getByLabel(inputTagRecTracks_, recTracks);
214 LogError(
"PFSimParticleProducer")<<err
215 <<
" cannot get collection "
216 <<
"particleFlowBlock"<<
":"
223 getSimIDs( recTracks, recTrackSimID );
228 if( processParticles_) {
230 auto_ptr< reco::PFSimParticleCollection >
238 err<<
"cannot find sim tracks: "<<inputTagSim_;
239 LogError(
"PFSimParticleProducer")<<err.str()<<endl;
247 found = iEvent.
getByLabel(inputTagSim_,simVertices);
250 <<
"cannot find sim vertices: "<<inputTagSim_<<endl;
262 mySimEvent->fill( *simTracks, *simVertices );
268 for(
unsigned i=0;
i<mySimEvent->nTracks();
i++) {
283 unsigned recTrackID = 99999;
284 vector<unsigned> recHitContrib;
285 vector<double> recHitContribFrac;
287 if(mctruthMatchingInfo_){
289 for(
unsigned lo=0; lo<recTrackSimID.size();
291 if(
i == recTrackSimID[lo] ) {
303 bool found = iEvent.
getByLabel(inputTagEcalRecHitsEB_,
307 err<<
"could not find rechits "<< inputTagEcalRecHitsEB_;
308 LogError(
"PFSimParticleProducer")<<err.str()<<endl;
318 = rhcHandle.
product()->begin();
322 for(;it_rh!=itend_rh;++it_rh)
331 ITM it_phit = caloHitsEBID[rhit_hi].begin();
332 ITM itend_phit = caloHitsEBID[rhit_hi].end();
333 for(;it_phit!=itend_phit;++it_phit)
335 if(
i == it_phit->second)
339 bool alreadyin =
false;
340 for(
unsigned ihit = 0; ihit < recHitContrib.size();
342 if(
detid.rawId() == recHitContrib[ihit])
346 double pcalofraction = 0.0;
347 if(caloHitsEBTotE[rhit_hi] != 0.0)
349 = (it_phit->first/caloHitsEBTotE[rhit_hi])*100.0;
352 recHitContrib.push_back(it_rh->id());
353 recHitContribFrac.push_back(pcalofraction);
384 originVtx.position().y(),
385 originVtx.position().z() );
397 particle.addPoint(pointOrig);
417 particle.addPoint(pointEnd);
421 particle.addPoint(dummy);
431 posLayer1, momLayer1);
433 particle.addPoint( layer1Pt );
439 particle.addPoint(dummy);
448 posLayer2, momLayer2);
450 particle.addPoint( layer2Pt );
456 particle.addPoint(dummy);
468 particle.addPoint( ecalPt );
474 particle.addPoint(dummy);
479 particle.addPoint(dummy);
490 posHCALin, momHCALin);
492 particle.addPoint( hcalPtin );
501 posHCALout, momHCALout);
503 particle.addPoint( hcalPtout );
512 posHOEntrance, momHOEntrance);
514 particle.addPoint( hoPtin );
522 particle.addPoint(dummy);
525 pOutputPFSimParticleCollection->push_back( particle );
528 iEvent.
put(pOutputPFSimParticleCollection);
533 <<
" in run "<<iEvent.
id().
run()<<endl;
537 std::vector<unsigned>& recTrackSimID )
543 for(
unsigned i=0;
i<trackh->size();
i++) {
555 = trackref->recHitsBegin();
557 = trackref->recHitsEnd();
559 it != rhitend; it++){
561 if( it->get()->isValid() ){
571 recTrackSimID.push_back( rechit->
simtrackId() );
PFSimParticleProducer(const edm::ParameterSet &)
T getParameter(std::string const &) const
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
reconstructed track used as an input to particle flow
bool noEndVertex() const
no end vertex
float charge() const
charge
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
double z() const
z of vertex
virtual void beginRun(const edm::Run &r, const edm::EventSetup &c) override
const XYZTLorentzVector & momentum() const
Temporary (until move of SimTrack to Mathcore) - No! Actually very useful.
const RawParticle & layer1Entrance() const
The particle at Preshower Layer 1.
std::vector< EcalRecHit >::const_iterator const_iterator
std::vector< PFSimParticle > PFSimParticleCollection
collection of PFSimParticle objects
const std::vector< int > & daughters() const
Vector of daughter indices.
double x() const
x of vertex
const reco::TrackRef & trackRef() const
void getData(T &iHolder) const
virtual void produce(edm::Event &, const edm::EventSetup &) override
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
int hashedIndex(int ieta, int iphi)
const int & simtrackId() const
Point of closest approach from beam axis (initial point in the case of PFSimParticle) ...
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
const math::XYZTLorentzVector & position() const
Temporary (until CMSSW moves to Mathcore) - No ! Actually very useful.
const RawParticle & ecalEntrance() const
The particle at ECAL entrance.
std::list< std::pair< double, unsigned > >::iterator ITM
const FSimVertex & vertex() const
Origin vertex.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
true particle for particle flow
static ParticleTable * instance()
XYZPointD XYZPoint
point in space with cartesian internal representation
T const * product() const
int type() const
particle type (HEP PDT convension)
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