40 string histoProducerAlgoName = psetForHistoProducerAlgo.
getParameter<
string>(
"ComponentName");
59 associatorTokens.push_back(consumes<reco::TrackToTrackingParticleAssociator>(associator));
70 for (
unsigned int www=0;www<
label.size();www++){
78 dirName+=algo.
label()+
"_";
85 if (assoc.find(
"Track")<assoc.length()){
86 assoc.replace(assoc.find(
"Track"),5,
"");
93 string subDirName = dirName +
"/simulation";
112 edm::LogInfo(
"TrackValidator") <<
"\n====================================================" <<
"\n"
113 <<
"Analyzing new event" <<
"\n"
114 <<
"====================================================\n" <<
"\n";
127 if (tPCeff.size()==0) {
edm::LogInfo(
"TrackValidator") <<
"TP Collection for efficiency studies has size = 0! Skipping Event." ;
return;}
128 if (tPCfake.size()==0) {
edm::LogInfo(
"TrackValidator") <<
"TP Collection for fake rate studies has size = 0! Skipping Event." ;
return;}
131 event.getByToken(
bsSrc,recoBeamSpotHandle);
138 for (
unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
139 if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
140 puinfo=(*puinfoH)[puinfo_ite];
161 auto nlayers_tPCeff_ptrs = tpNumberOfLayersAlgo.
calculate(TPCollectionHeff, setup);
162 const auto& nLayers_tPCeff = *(std::get<TrackingParticleNumberOfLayers::nTrackerLayers>(nlayers_tPCeff_ptrs));
163 const auto& nPixelLayers_tPCeff = *(std::get<TrackingParticleNumberOfLayers::nPixelLayers>(nlayers_tPCeff_ptrs));
164 const auto& nStripMonoAndStereoLayers_tPCeff = *(std::get<TrackingParticleNumberOfLayers::nStripMonoAndStereoLayers>(nlayers_tPCeff_ptrs));
167 for (
unsigned int ww=0;ww<
associators.size();ww++){
172 for (
unsigned int www=0;www<
label.size();www++){
174 <<
label[www].process()<<
":"
175 <<
label[www].label()<<
":"
176 <<
label[www].instance()<<
" with "
183 if (seedCollection->size()==0) {
184 edm::LogInfo(
"TrackValidator") <<
"SeedCollection size = 0!" ;
189 LogTrace(
"TrackValidator") <<
"Calling associateRecoToSim method" <<
"\n";
192 LogTrace(
"TrackValidator") <<
"Calling associateSimToReco method" <<
"\n";
200 edm::LogVerbatim(
"TrackValidator") <<
"\n# of TrackingParticles: " << tPCeff.size() <<
"\n";
208 if (tp->charge()==0)
continue;
217 double dxySim = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
218 double dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2())
219 * momentum.z()/
sqrt(momentum.perp2());
221 if(tp->eventId().bunchCrossing() == 0) {
228 std::vector<std::pair<edm::RefToBase<TrajectorySeed>,
double> > rt;
229 if(simRecColl.
find(tp) != simRecColl.
end()){
233 matchedSeedPointer = rt.begin()->first.get();
235 <<
" with pt=" <<
sqrt(tp->momentum().perp2())
236 <<
" associated with quality:" << rt.begin()->second <<
"\n";
240 <<
" with pt=" <<
sqrt(tp->momentum().perp2())
241 <<
" NOT associated to any TrajectorySeed" <<
"\n";
244 int nSimHits = tp->numberOfTrackerHits();
245 int nSimLayers = nLayers_tPCeff[tp];
246 int nSimPixelLayers = nPixelLayers_tPCeff[tp];
247 int nSimStripMonoAndStereoLayers = nStripMonoAndStereoLayers_tPCeff[tp];
251 if (matchedSeedPointer) {
256 if(!(tsAtClosestApproachSeed.isValid())){
257 edm::LogVerbatim(
"SeedValidator")<<
"TrajectoryStateClosestToBeamLine not valid";
261 tsAtClosestApproachSeed.trackStateAtPCA().position().y(),
262 tsAtClosestApproachSeed.trackStateAtPCA().position().z());
264 tsAtClosestApproachSeed.trackStateAtPCA().momentum().y(),
265 tsAtClosestApproachSeed.trackStateAtPCA().momentum().z());
268 matchedTrackPointer =
new reco::Track(0.,0., vSeed1, pSeed, 1, seedPerigeeErrors.covarianceMatrix());
273 histoProducerAlgo_->
fill_recoAssociated_simTrack_histos(w,*tp,tp->momentum(),tp->vertex(),dxySim,dzSim,nSimHits,nSimLayers,nSimPixelLayers,nSimStripMonoAndStereoLayers,
277 if (matchedTrackPointer) asts++;
287 <<
label[www].process()<<
":"
288 <<
label[www].label()<<
":"
289 <<
label[www].instance()
290 <<
": " << seedCollection->size() <<
"\n";
304 if(!(tsAtClosestApproachSeed.isValid())){
305 edm::LogVerbatim(
"SeedValidator")<<
"TrajectoryStateClosestToBeamLine not valid";
309 tsAtClosestApproachSeed.trackStateAtPCA().position().y(),
310 tsAtClosestApproachSeed.trackStateAtPCA().position().z());
312 tsAtClosestApproachSeed.trackStateAtPCA().momentum().y(),
313 tsAtClosestApproachSeed.trackStateAtPCA().momentum().z());
318 reco::Track* trackFromSeed =
new reco::Track(0.,0., vSeed1, pSeed, 1, seedPerigeeErrors.covarianceMatrix());
321 bool isSigSimMatched(
false);
322 bool isSimMatched(
false);
323 bool isChargeMatched(
true);
324 int numAssocSeeds = 0;
326 double sharedFraction = 0.;
327 std::vector<std::pair<TrackingParticleRef, double> > tp;
328 if(recSimColl.
find(seed) != recSimColl.
end()) {
329 tp = recSimColl[
seed];
332 nSimHits = tp[0].first->numberOfTrackerHits();
333 sharedFraction = tp[0].second;
336 if(simRecColl.
find(tp[0].first) != simRecColl.
end()) numAssocSeeds = simRecColl[tp[0].
first].
size();
341 for (
unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
344 isSigSimMatched =
true;
351 edm::LogVerbatim(
"SeedValidator") <<
"TrajectorySeed #" << rT <<
" associated with quality:" << tp.begin()->second <<
"\n";
354 edm::LogVerbatim(
"SeedValidator") <<
"TrajectorySeed #" << rT <<
" NOT associated to any TrackingParticle" <<
"\n";
359 isChargeMatched, numAssocSeeds,
361 nSimHits, sharedFraction,
dR);
365 if (tp.size()==0)
continue;
412 LogTrace(
"SeedValidator") <<
"exception found: " << e.
what() <<
"\n";
419 <<
"Total Associated (simToReco): " << ats <<
"\n"
420 <<
"Total Reconstructed: " << rT <<
"\n"
421 <<
"Total Associated (recoToSim): " << at <<
"\n"
422 <<
"Total Fakes: " << rT-at <<
"\n";
virtual char const * what() const
T getParameter(std::string const &) const
void analyze(const edm::Event &, const edm::EventSetup &) override
Method called once per event.
std::vector< edm::InputTag > associators
virtual void fill_recoAssociated_simTrack_histos(int count, const TrackingParticle &tp, const TrackingParticle::Vector &momentumTP, const TrackingParticle::Point &vertexTP, double dxy, double dz, int nSimHits, int nSimLayers, int nSimPixelLayers, int nSimStripMonoAndStereoLayers, const reco::Track *track, int numVertices, double dR)=0
int event() const
get the contents of the subdetector field (should be protected?)
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > label_pileupinfo
std::vector< TrackingParticle > TrackingParticleCollection
const_iterator end() const
last iterator over the map (read only)
edm::EDGetTokenT< TrackingParticleCollection > label_tp_effic
edm::Ref< GenParticleCollection > GenParticleRef
persistent reference to a GenParticle
Sin< T >::type sin(const T &t)
const_iterator find(const key_type &k) const
find element with specified reference key
virtual void fill_ResoAndPull_recoTrack_histos(int count, const TrackingParticle::Vector &momentumTP, const TrackingParticle::Point &vertexTP, int chargeTP, const reco::Track &track, const math::XYZPoint &bsPosition)=0
edm::EDGetTokenT< TrackingVertexCollection > label_tv
TrackingParticleSelector tpSelector
edm::EDGetTokenT< reco::BeamSpot > bsSrc
math::XYZPointD Point
point in the space
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
bool appendHits(const C &c)
append hit patterns from vector of hit references
std::vector< edm::InputTag > label
std::vector< edm::EDGetTokenT< edm::View< TrajectorySeed > > > labelTokenSeed
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Method called to book the DQM histograms.
int bunchCrossing() const
get the detector field from this detid
FreeTrajectoryState const * freeState(bool withErrors=true) const
TrackerSeedValidator(const edm::ParameterSet &pset)
Constructor.
Cos< T >::type cos(const T &t)
virtual void bookRecoHistos(DQMStore::IBooker &ibook)=0
virtual void bookSimHistos(DQMStore::IBooker &ibook)=0
math::XYZPoint Point
point in the space
virtual void bookSimTrackHistos(DQMStore::IBooker &ibook)=0
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
edm::ESHandle< TransientTrackingRecHitBuilder > theTTRHBuilder
std::shared_ptr< TrackingRecHit const > RecHitPointer
std::string parametersDefiner
PTrajectoryStateOnDet const & startingState() const
void setCurrentFolder(const std::string &fullpath)
virtual void fill_simAssociated_recoTrack_histos(int count, const reco::Track &track)=0
T const * product() const
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
std::vector< TrackingVertex > TrackingVertexCollection
T const * product() const
virtual void fill_trackBased_histos(int count, int assTracks, int numRecoTracks, int numSimTracks)=0
TrackCharge charge() const
Charge (-1, 0 or 1)
const int getPU_NumInteractions() const
EncodedEventId eventId() const
Signal source, crossing number.
std::tuple< std::unique_ptr< edm::ValueMap< unsigned int > >, std::unique_ptr< edm::ValueMap< unsigned int > >, std::unique_ptr< edm::ValueMap< unsigned int > > > calculate(const edm::Handle< TrackingParticleCollection > &tps, const edm::EventSetup &iSetup) const
virtual void fill_generic_recoTrack_histos(int count, const reco::Track &track, const math::XYZPoint &bsPosition, bool isMatched, bool isSigMatched, bool isChargeMatched, int numAssocRecoTracks, int numVertices, int nSimHits, double sharedFraction, double dR)=0
Monte Carlo truth information used for tracking validation.
virtual void fill_simTrackBased_histos(int count, int numSimTracks)=0
PerigeeTrajectoryError ftsToPerigeeError(const FTS &originalFTS)
virtual ~TrackerSeedValidator()
Destructor.
const Point & position() const
position
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
math::XYZVectorD Vector
point in the space
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simHitTokens_
MTVHistoProducerAlgo * histoProducerAlgo_
virtual void fill_generic_simTrack_histos(int counter, const TrackingParticle::Vector &, const TrackingParticle::Point &vertex, int bx)=0
edm::EDGetTokenT< TrackingParticleCollection > label_tp_fake
math::XYZVector Vector
spatial vector
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
tuple size
Write out results.
T get(const Candidate &c)
std::vector< edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > > associatorTokens
const LocalTrajectoryParameters & parameters() const
edm::ESHandle< MagneticField > theMF