41 string histoProducerAlgoName = psetForHistoProducerAlgo.
getParameter<
string>(
"ComponentName");
69 for (
unsigned int www=0;www<
label.size();www++){
77 dirName+=algo.
label()+
"_";
84 if (assoc.find(
"Track")<assoc.length()){
85 assoc.replace(assoc.find(
"Track"),5,
"");
95 string subDirName = dirName +
"/simulation";
119 edm::LogInfo(
"TrackValidator") <<
"\n====================================================" <<
"\n"
120 <<
"Analyzing new event" <<
"\n"
121 <<
"====================================================\n" <<
"\n";
134 if (tPCeff.size()==0) {
edm::LogInfo(
"TrackValidator") <<
"TP Collection for efficiency studies has size = 0! Skipping Event." ;
return;}
135 if (tPCfake.size()==0) {
edm::LogInfo(
"TrackValidator") <<
"TP Collection for fake rate studies has size = 0! Skipping Event." ;
return;}
138 event.getByToken(
bsSrc,recoBeamSpotHandle);
145 for (
unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
146 if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
147 puinfo=(*puinfoH)[puinfo_ite];
157 for (
unsigned int ww=0;ww<
associators.size();ww++){
158 for (
unsigned int www=0;www<
label.size();www++){
160 <<
label[www].process()<<
":"
161 <<
label[www].label()<<
":"
162 <<
label[www].instance()<<
" with "
169 if (seedCollection->size()==0) {
170 edm::LogInfo(
"TrackValidator") <<
"SeedCollection size = 0!" ;
175 LogTrace(
"TrackValidator") <<
"Calling associateRecoToSim method" <<
"\n";
179 LogTrace(
"TrackValidator") <<
"Calling associateSimToReco method" <<
"\n";
188 edm::LogVerbatim(
"TrackValidator") <<
"\n# of TrackingParticles: " << tPCeff.size() <<
"\n";
196 if (tp->charge()==0)
continue;
205 double dxySim = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
206 double dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2())
207 * momentum.z()/
sqrt(momentum.perp2());
214 std::vector<std::pair<edm::RefToBase<TrajectorySeed>,
double> > rt;
215 if(simRecColl.
find(tp) != simRecColl.
end()){
219 matchedSeedPointer = rt.begin()->first.get();
221 <<
" with pt=" <<
sqrt(tp->momentum().perp2())
222 <<
" associated with quality:" << rt.begin()->second <<
"\n";
226 <<
" with pt=" <<
sqrt(tp->momentum().perp2())
227 <<
" NOT associated to any TrajectorySeed" <<
"\n";
230 int nSimHits = tp->numberOfTrackerHits();
232 double vtx_z_PU = tp->vertex().z();
233 for (
size_t j = 0;
j < tv.size();
j++) {
234 if (tp->eventId().event() == tv[
j].eventId().event()) {
235 vtx_z_PU = tv[
j].position().z();
243 if (matchedSeedPointer) {
248 if(!(tsAtClosestApproachSeed.isValid())){
249 edm::LogVerbatim(
"SeedValidator")<<
"TrajectoryStateClosestToBeamLine not valid";
253 tsAtClosestApproachSeed.trackStateAtPCA().position().y(),
254 tsAtClosestApproachSeed.trackStateAtPCA().position().z());
256 tsAtClosestApproachSeed.trackStateAtPCA().momentum().y(),
257 tsAtClosestApproachSeed.trackStateAtPCA().momentum().z());
260 matchedTrackPointer =
new reco::Track(0.,0., vSeed1, pSeed, 1, seedPerigeeErrors.covarianceMatrix());
268 if (matchedTrackPointer) asts++;
276 <<
label[www].process()<<
":"
277 <<
label[www].label()<<
":"
278 <<
label[www].instance()
279 <<
": " << seedCollection->size() <<
"\n";
293 if(!(tsAtClosestApproachSeed.isValid())){
294 edm::LogVerbatim(
"SeedValidator")<<
"TrajectoryStateClosestToBeamLine not valid";
298 tsAtClosestApproachSeed.trackStateAtPCA().position().y(),
299 tsAtClosestApproachSeed.trackStateAtPCA().position().z());
301 tsAtClosestApproachSeed.trackStateAtPCA().momentum().y(),
302 tsAtClosestApproachSeed.trackStateAtPCA().momentum().z());
307 reco::Track* trackFromSeed =
new reco::Track(0.,0., vSeed1, pSeed, 1, seedPerigeeErrors.covarianceMatrix());
310 bool isSigSimMatched(
false);
311 bool isSimMatched(
false);
312 bool isChargeMatched(
true);
313 int numAssocSeeds = 0;
316 double sharedFraction = 0.;
317 std::vector<std::pair<TrackingParticleRef, double> > tp;
318 if(recSimColl.
find(seed) != recSimColl.
end()) {
319 tp = recSimColl[
seed];
322 nSimHits = tp[0].first->numberOfTrackerHits();
323 sharedFraction = tp[0].second;
326 if(simRecColl.
find(tp[0].first) != simRecColl.
end()) numAssocSeeds = simRecColl[tp[0].
first].
size();
328 tpbx = tp[0].first->eventId().bunchCrossing();
332 for (
unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
335 isSigSimMatched =
true;
342 edm::LogVerbatim(
"SeedValidator") <<
"TrajectorySeed #" << rT <<
" associated with quality:" << tp.begin()->second <<
"\n";
345 edm::LogVerbatim(
"SeedValidator") <<
"TrajectorySeed #" << rT <<
" NOT associated to any TrackingParticle" <<
"\n";
350 tpbx, nSimHits, sharedFraction);
354 if (tp.size()==0)
continue;
401 LogTrace(
"SeedValidator") <<
"exception found: " << e.
what() <<
"\n";
408 <<
"Total Associated (simToReco): " << ats <<
"\n"
409 <<
"Total Reconstructed: " << rT <<
"\n"
410 <<
"Total Associated (recoToSim): " << at <<
"\n"
411 <<
"Total Fakes: " << rT-at <<
"\n";
418 LogTrace(
"SeedValidator") <<
"TrackerSeedValidator::endRun()";
420 for (
unsigned int ww=0;ww<
associators.size();ww++){
421 for (
unsigned int www=0;www<
label.size();www++){
virtual char const * what() const
T getParameter(std::string const &) const
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
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
Method called to book the DQM histograms.
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
std::vector< const TrackAssociatorBase * > associator
void endRun(edm::Run const &, edm::EventSetup const &)
Method called at the end of the event loop.
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
virtual void bookRecoHistosForStandaloneRunning(DQMStore::IBooker &ibook)=0
TrackingParticleSelector tpSelector
edm::EDGetTokenT< reco::BeamSpot > bsSrc
math::XYZPointD Point
point in the space
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
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, const reco::Track *track, int numVertices, double vertz)=0
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.
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 tpbunchcrossing, int nSimHits, double sharedFraction)=0
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 fillProfileHistosFromVectors(int counter)=0
virtual void initialize()=0
virtual void bookSimHistos(DQMStore::IBooker &ibook)=0
math::XYZPoint Point
point in the space
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
virtual void finalHistoFits(int counter)=0
void setHitPattern(const C &c)
set hit patterns from vector of hit references
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
std::vector< TrackingVertex > TrackingVertexCollection
virtual void fillHistosFromVectors(int counter)=0
T const * product() const
virtual void fill_trackBased_histos(int count, int assTracks, int numRecoTracks, int numSimTracks)=0
T const * product() const
TrackCharge charge() const
Charge (-1, 0 or 1)
const int getPU_NumInteractions() const
EncodedEventId eventId() const
Signal source, crossing number.
Monte Carlo truth information used for tracking validation.
PerigeeTrajectoryError ftsToPerigeeError(const FTS &originalFTS)
virtual ~TrackerSeedValidator()
Destructor.
const Point & position() const
position
std::vector< std::string > associators
math::XYZVectorD Vector
point in the space
void analyze(const edm::Event &, const edm::EventSetup &)
Method called once per event.
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)
const LocalTrajectoryParameters & parameters() const
edm::ESHandle< MagneticField > theMF