83 mctruthMatchingInfo_ =
89 inputTagEcalRecHitsEB_
91 inputTagEcalRecHitsEE_
99 produces<reco::PFSimParticleCollection>();
102 (
"ParticleFilter" );
104 mySimEvent =
new FSimEvent( particleFilter_ );
125 mySimEvent->initializePdt(&(*pdt));
133 LogDebug(
"PFSimParticleProducer")<<
"START event: "<<iEvent.
id().
event()
134 <<
" in run "<<iEvent.
id().
run()<<endl;
140 std::vector<unsigned> recTrackSimID;
146 typedef std::pair<double, unsigned> hitSimID;
147 typedef std::list< std::pair<double, unsigned> >::iterator
ITM;
148 std::vector< std::list <hitSimID> > caloHitsEBID(62000);
149 std::vector<double> caloHitsEBTotE(62000,0.0);
151 if(mctruthMatchingInfo_){
160 = iEvent.
getByLabel(inputTagFamosSimHits_,pcalohits);
165 err<<
"could not find pcaloHit "<<
"famosSimHits:EcalHitsEB";
166 LogError(
"PFSimParticleProducer")<<err.str()<<endl;
176 edm::PCaloHitContainer::const_iterator it
177 = pcalohits.
product()->begin();
178 edm::PCaloHitContainer::const_iterator itend
194 if(it->energy() > 0.0) {
195 std::pair<double, unsigned> phitsimid
196 = make_pair(it->energy(),it->geantTrackId());
197 caloHitsEBID[
detid.hashedIndex()].push_back(phitsimid);
198 caloHitsEBTotE[
detid.hashedIndex()]
209 LogDebug(
"PFSimParticleProducer")<<
"getting PFRecTracks"<<endl;
210 iEvent.
getByLabel(inputTagRecTracks_, recTracks);
213 LogError(
"PFSimParticleProducer")<<err
214 <<
" cannot get collection "
215 <<
"particleFlowBlock"<<
":"
222 getSimIDs( recTracks, recTrackSimID );
227 if( processParticles_) {
229 auto_ptr< reco::PFSimParticleCollection >
237 err<<
"cannot find sim tracks: "<<inputTagSim_;
238 LogError(
"PFSimParticleProducer")<<err.str()<<endl;
246 found = iEvent.
getByLabel(inputTagSim_,simVertices);
249 <<
"cannot find sim vertices: "<<inputTagSim_<<endl;
261 mySimEvent->fill( *simTracks, *simVertices );
267 for(
unsigned i=0;
i<mySimEvent->nTracks();
i++) {
282 unsigned recTrackID = 99999;
283 vector<unsigned> recHitContrib;
284 vector<double> recHitContribFrac;
286 if(mctruthMatchingInfo_){
288 for(
unsigned lo=0; lo<recTrackSimID.size();
290 if(
i == recTrackSimID[lo] ) {
302 bool found = iEvent.
getByLabel(inputTagEcalRecHitsEB_,
306 err<<
"could not find rechits "<< inputTagEcalRecHitsEB_;
307 LogError(
"PFSimParticleProducer")<<err.str()<<endl;
317 = rhcHandle.
product()->begin();
321 for(;it_rh!=itend_rh;++it_rh)
330 ITM it_phit = caloHitsEBID[rhit_hi].begin();
331 ITM itend_phit = caloHitsEBID[rhit_hi].end();
332 for(;it_phit!=itend_phit;++it_phit)
334 if(
i == it_phit->second)
338 bool alreadyin =
false;
339 for(
unsigned ihit = 0; ihit < recHitContrib.size();
341 if(
detid.rawId() == recHitContrib[ihit])
345 double pcalofraction = 0.0;
346 if(caloHitsEBTotE[rhit_hi] != 0.0)
348 = (it_phit->first/caloHitsEBTotE[rhit_hi])*100.0;
351 recHitContrib.push_back(it_rh->id());
352 recHitContribFrac.push_back(pcalofraction);
383 originVtx.position().y(),
384 originVtx.position().z() );
396 particle.addPoint(pointOrig);
416 particle.addPoint(pointEnd);
420 particle.addPoint(dummy);
430 posLayer1, momLayer1);
432 particle.addPoint( layer1Pt );
438 particle.addPoint(dummy);
447 posLayer2, momLayer2);
449 particle.addPoint( layer2Pt );
455 particle.addPoint(dummy);
467 particle.addPoint( ecalPt );
473 particle.addPoint(dummy);
478 particle.addPoint(dummy);
489 posHCALin, momHCALin);
491 particle.addPoint( hcalPtin );
507 particle.addPoint(dummy);
510 pOutputPFSimParticleCollection->push_back( particle );
513 iEvent.
put(pOutputPFSimParticleCollection);
518 <<
" in run "<<iEvent.
id().
run()<<endl;
522 std::vector<unsigned>& recTrackSimID )
528 for(
unsigned i=0;
i<trackh->size();
i++) {
540 = trackref->recHitsBegin();
542 = trackref->recHitsEnd();
544 it != rhitend; it++){
546 if( it->get()->isValid() ){
556 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 FSimVertex & endVertex() const
end vertex
double y() const
y of vertex
double z() const
z of vertex
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< T >::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 beginRun(edm::Run &r, const edm::EventSetup &c)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
int hashedIndex(int ieta, int iphi)
const int & simtrackId() const
virtual void produce(edm::Event &, const edm::EventSetup &)
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