CMS 3D CMS Logo

GhostTrackComputer.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <cstddef>
3 #include <string>
4 #include <cmath>
5 #include <vector>
6 
7 #include <Math/VectorUtil.h>
8 
11 
25 
30 
32 
33 using namespace reco;
34 
36 {
37  edm::ParameterSet psetCopy(pset);
38  psetCopy.addParameter<double>("jetDeltaRMax", 99999.0);
39  return psetCopy;
40 }
41 
43  charmCut(params.getParameter<double>("charmCut")),
44  sortCriterium(TrackSorting::getCriterium(params.getParameter<std::string>("trackSort"))),
45  trackSelector(params.getParameter<edm::ParameterSet>("trackSelection")),
46  trackNoDeltaRSelector(dropDeltaR(params.getParameter<edm::ParameterSet>("trackSelection"))),
47  minTrackWeight(params.getParameter<double>("minimumTrackWeight")),
48  trackPairV0Filter(params.getParameter<edm::ParameterSet>("trackPairV0Filter"))
49 {
50 }
51 
52 const btag::TrackIPData &
54  const btag::SortCriteria sort,
55  const reco::Jet &jet,
56  const GlobalPoint &pv) const
57 {
59  trackIPTagInfo.selectedTracks();
60  const std::vector<btag::TrackIPData> &ipData =
61  trackIPTagInfo.impactParameterData();
62  std::vector<std::size_t> indices = trackIPTagInfo.sortedIndexes(sort);
63 
64  TrackKinematics kin;
65  for(std::vector<std::size_t>::const_iterator iter = indices.begin();
66  iter != indices.end(); ++iter) {
67  const btag::TrackIPData &data = ipData[*iter];
68  const Track &track = *tracks[*iter];
69 
70  if (!trackNoDeltaRSelector(track, data, jet, pv))
71  continue;
72 
73  kin.add(track);
74  if (kin.vectorSum().M() > charmCut)
75  return data;
76  }
77 
78  static const btag::TrackIPData dummy = {
79  GlobalPoint(),
80  GlobalPoint(),
81  Measurement1D(-1.0, 1.0),
82  Measurement1D(-1.0, 1.0),
83  Measurement1D(-1.0, 1.0),
84  Measurement1D(-1.0, 1.0),
85  0.
86  };
87  return dummy;
88 }
89 
90 const btag::TrackIPData &
92  const btag::SortCriteria sort,
93  const reco::Jet &jet,
94  const GlobalPoint &pv) const
95 {
97  trackIPTagInfo.selectedTracks();
98  const std::vector<btag::TrackIPData> &ipData =
99  trackIPTagInfo.impactParameterData();
100  std::vector<std::size_t> indices = trackIPTagInfo.sortedIndexes(sort);
101 
102  TrackKinematics kin;
103  for(std::vector<std::size_t>::const_iterator iter = indices.begin(); iter != indices.end(); ++iter) {
104  const btag::TrackIPData &data = ipData[*iter];
105  const CandidatePtr &track = tracks[*iter];
106 
107  if (!trackNoDeltaRSelector(track, data, jet, pv))
108  continue;
109 
110  kin.add(track);
111  if (kin.vectorSum().M() > charmCut)
112  return data;
113  }
114 
115  static const btag::TrackIPData dummy = {
116  GlobalPoint(),
117  GlobalPoint(),
118  Measurement1D(-1.0, 1.0),
119  Measurement1D(-1.0, 1.0),
120  Measurement1D(-1.0, 1.0),
121  Measurement1D(-1.0, 1.0),
122  0.
123  };
124  return dummy;
125 }
126 
127 static void addMeas(std::pair<double, double> &sum, Measurement1D meas)
128 {
129  double weight = 1. / meas.error();
130  weight *= weight;
131  sum.first += weight * meas.value();
132  sum.second += weight;
133 }
134 
137  const SecondaryVertexTagInfo &svInfo) const
138 {
139  using namespace ROOT::Math;
140 
141  edm::RefToBase<Jet> jet = ipInfo.jet();
142  math::XYZVector jetDir = jet->momentum().Unit();
143  bool havePv = ipInfo.primaryVertex().isNonnull();
144  GlobalPoint pv;
145  if (havePv)
146  pv = GlobalPoint(ipInfo.primaryVertex()->x(),
147  ipInfo.primaryVertex()->y(),
148  ipInfo.primaryVertex()->z());
149 
151 
152  TaggingVariableList vars;
153 
154  vars.insert(btau::jetPt, jet->pt(), true);
155  vars.insert(btau::jetEta, jet->eta(), true);
156 
157  TrackKinematics allKinematics;
158  TrackKinematics vertexKinematics;
159  TrackKinematics trackKinematics;
160 
161  std::pair<double, double> vertexDist2D, vertexDist3D;
162  std::pair<double, double> tracksDist2D, tracksDist3D;
163 
164  unsigned int nVertices = 0;
165  unsigned int nVertexTracks = 0;
166  unsigned int nTracks = 0;
167  for(unsigned int i = 0; i < svInfo.nVertices(); i++) {
168  const Vertex &vertex = svInfo.secondaryVertex(i);
169  bool hasRefittedTracks = vertex.hasRefittedTracks();
171  unsigned int n = 0;
173  track != tracks.end(); track++)
174  if (svInfo.trackWeight(i, *track) >= minTrackWeight)
175  n++;
176 
177  if (n < 1)
178  continue;
179  bool isTrackVertex = (n == 1);
180  ++*(isTrackVertex ? &nTracks : &nVertices);
181 
182  addMeas(*(isTrackVertex ? &tracksDist2D : &vertexDist2D),
183  svInfo.flightDistance(i, true));
184  addMeas(*(isTrackVertex ? &tracksDist3D : &vertexDist3D),
185  svInfo.flightDistance(i, false));
186 
187  TrackKinematics &kin = isTrackVertex ? trackKinematics
188  : vertexKinematics;
190  track != tracks.end(); track++) {
191  float w = svInfo.trackWeight(i, *track);
192  if (w < minTrackWeight)
193  continue;
194  if (hasRefittedTracks) {
195  Track actualTrack =
196  vertex.refittedTrack(*track);
197  kin.add(actualTrack, w);
199  actualTrack.momentum()), true);
200  } else {
201  kin.add(**track, w);
203  (*track)->momentum()), true);
204  }
205  if (!isTrackVertex)
206  nVertexTracks++;
207  }
208  }
209 
210  Measurement1D dist2D, dist3D;
211  if (nVertices) {
212  vtxType = btag::Vertices::RecoVertex;
213 
214  if (nVertices == 1 && nTracks) {
215  vertexDist2D.first += tracksDist2D.first;
216  vertexDist2D.second += tracksDist2D.second;
217  vertexDist3D.first += tracksDist3D.first;
218  vertexDist3D.second += tracksDist3D.second;
219  vertexKinematics += trackKinematics;
220  }
221 
222  dist2D = Measurement1D(
223  vertexDist2D.first / vertexDist2D.second,
224  std::sqrt(1. / vertexDist2D.second));
225  dist3D = Measurement1D(
226  vertexDist3D.first / vertexDist3D.second,
227  std::sqrt(1. / vertexDist3D.second));
228 
229  vars.insert(btau::jetNSecondaryVertices, nVertices, true);
230  vars.insert(btau::vertexNTracks, nVertexTracks, true);
231  } else if (nTracks) {
233  vertexKinematics = trackKinematics;
234 
235  dist2D = Measurement1D(
236  tracksDist2D.first / tracksDist2D.second,
237  std::sqrt(1. / tracksDist2D.second));
238  dist3D = Measurement1D(
239  tracksDist3D.first / tracksDist3D.second,
240  std::sqrt(1. / tracksDist3D.second));
241  }
242 
243  if (nVertices || nTracks) {
244  vars.insert(btau::flightDistance2dVal, dist2D.value(), true);
245  vars.insert(btau::flightDistance2dSig, dist2D.significance(), true);
246  vars.insert(btau::flightDistance3dVal, dist3D.value(), true);
247  vars.insert(btau::flightDistance3dSig, dist3D.significance(), true);
249  Geom::deltaR(svInfo.flightDirection(0), jetDir),true);
250  vars.insert(btau::jetNSingleTrackVertices, nTracks, true);
251  }
252 
253  std::vector<std::size_t> indices = ipInfo.sortedIndexes(sortCriterium);
254  const std::vector<btag::TrackIPData> &ipData =
255  ipInfo.impactParameterData();
257  ipInfo.selectedTracks();
258 
259  TrackRef trackPairV0Test[2];
260  for(unsigned int i = 0; i < indices.size(); i++) {
261  std::size_t idx = indices[i];
262  const btag::TrackIPData &data = ipData[idx];
263  const TrackRef &trackRef = tracks[idx];
264  const Track &track = *trackRef;
265 
266  // filter track
267 
268  if (!trackSelector(track, data, *jet, pv))
269  continue;
270 
271  // add track to kinematics for all tracks in jet
272 
273  allKinematics.add(track);
274 
275  // check against all other tracks for V0 track pairs
276 
277  trackPairV0Test[0] = tracks[idx];
278  bool ok = true;
279  for(unsigned int j = 0; j < indices.size(); j++) {
280  if (i == j)
281  continue;
282 
283  std::size_t pairIdx = indices[j];
284  const btag::TrackIPData &pairTrackData =
285  ipData[pairIdx];
286  const TrackRef &pairTrackRef = tracks[pairIdx];
287  const Track &pairTrack = *pairTrackRef;
288 
289  if (!trackSelector(pairTrack, pairTrackData, *jet, pv))
290  continue;
291 
292  trackPairV0Test[1] = pairTrackRef;
293  if (!trackPairV0Filter(trackPairV0Test, 2)) {
294  ok = false;
295  break;
296  }
297  }
298  if (!ok)
299  continue;
300 
301  // add track variables
302 
303  math::XYZVector trackMom = track.momentum();
304  double trackMag = std::sqrt(trackMom.Mag2());
305 
306  vars.insert(btau::trackSip3dVal, data.ip3d.value(), true);
307  vars.insert(btau::trackSip3dSig, data.ip3d.significance(), true);
308  vars.insert(btau::trackSip2dVal, data.ip2d.value(), true);
309  vars.insert(btau::trackSip2dSig, data.ip2d.significance(), true);
310  vars.insert(btau::trackJetDistVal, data.distanceToJetAxis.value(), true);
311  vars.insert(btau::trackGhostTrackDistVal, data.distanceToGhostTrack.value(), true);
312  vars.insert(btau::trackGhostTrackDistSig, data.distanceToGhostTrack.significance(), true);
313  vars.insert(btau::trackGhostTrackWeight, data.ghostTrackWeight, true);
314  vars.insert(btau::trackDecayLenVal, havePv ? (data.closestToGhostTrack - pv).mag() : -1.0, true);
315 
316  vars.insert(btau::trackMomentum, trackMag, true);
317  vars.insert(btau::trackEta, trackMom.Eta(), true);
318 
319  vars.insert(btau::trackChi2, track.normalizedChi2(), true);
322  vars.insert(btau::trackPtRel, VectorUtil::Perp(trackMom, jetDir), true);
323  vars.insert(btau::trackDeltaR, VectorUtil::DeltaR(trackMom, jetDir), true);
324  }
325 
326  vars.insert(btau::vertexCategory, vtxType, true);
328  VectorUtil::DeltaR(allKinematics.vectorSum(), jetDir), true);
330  allKinematics.vectorSum().Et() / ipInfo.jet()->et(), true);
332  threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv)
333  .ip3d.significance(),
334  true);
336  threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv)
337  .ip2d.significance(),
338  true);
339 
340  if (vtxType != btag::Vertices::NoVertex) {
341  math::XYZTLorentzVector allSum = allKinematics.vectorSum();
342  math::XYZTLorentzVector vertexSum = vertexKinematics.vectorSum();
343 
344  vars.insert(btau::vertexMass, vertexSum.M(), true);
345  if (allKinematics.numberOfTracks())
347  vertexSum.E() / allSum.E(), true);
348  else
349  vars.insert(btau::vertexEnergyRatio, 1, true);
350  }
351 
352  vars.finalize();
353 
354  return vars;
355 }
356 
359  const CandSecondaryVertexTagInfo &svInfo) const
360 {
361  using namespace ROOT::Math;
362 
363  edm::RefToBase<Jet> jet = ipInfo.jet();
364  math::XYZVector jetDir = jet->momentum().Unit();
365  bool havePv = ipInfo.primaryVertex().isNonnull();
366  GlobalPoint pv;
367  if (havePv)
368  pv = GlobalPoint(ipInfo.primaryVertex()->x(),
369  ipInfo.primaryVertex()->y(),
370  ipInfo.primaryVertex()->z());
371 
373 
374  TaggingVariableList vars;
375 
376  vars.insert(btau::jetPt, jet->pt(), true);
377  vars.insert(btau::jetEta, jet->eta(), true);
378 
379  TrackKinematics allKinematics;
380  TrackKinematics vertexKinematics;
381  TrackKinematics trackKinematics;
382 
383  std::pair<double, double> vertexDist2D, vertexDist3D;
384  std::pair<double, double> tracksDist2D, tracksDist3D;
385 
386  unsigned int nVertices = 0;
387  unsigned int nVertexTracks = 0;
388  unsigned int nTracks = 0;
389  for(unsigned int i = 0; i < svInfo.nVertices(); i++) {
390  const reco::VertexCompositePtrCandidate &vertex = svInfo.secondaryVertex(i);
391  const std::vector<CandidatePtr> & tracks = vertex.daughterPtrVector();
392  unsigned int n = 0;
393  for(std::vector<CandidatePtr>::const_iterator track = tracks.begin(); track != tracks.end(); ++track)
394  n++;
395 
396  if (n < 1)
397  continue;
398  bool isTrackVertex = (n == 1);
399  ++*(isTrackVertex ? &nTracks : &nVertices);
400 
401  addMeas(*(isTrackVertex ? &tracksDist2D : &vertexDist2D),
402  svInfo.flightDistance(i, true));
403  addMeas(*(isTrackVertex ? &tracksDist3D : &vertexDist3D),
404  svInfo.flightDistance(i, false));
405 
406  TrackKinematics &kin = isTrackVertex ? trackKinematics : vertexKinematics;
407 
408  for(std::vector<CandidatePtr>::const_iterator track = tracks.begin(); track != tracks.end(); ++track) {
409  kin.add(*track);
410  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir, (*track)->momentum()), true);
411  if (!isTrackVertex)
412  nVertexTracks++;
413  }
414  }
415 
416  Measurement1D dist2D, dist3D;
417  if (nVertices) {
418  vtxType = btag::Vertices::RecoVertex;
419 
420  if (nVertices == 1 && nTracks) {
421  vertexDist2D.first += tracksDist2D.first;
422  vertexDist2D.second += tracksDist2D.second;
423  vertexDist3D.first += tracksDist3D.first;
424  vertexDist3D.second += tracksDist3D.second;
425  vertexKinematics += trackKinematics;
426  }
427 
428  dist2D = Measurement1D(
429  vertexDist2D.first / vertexDist2D.second,
430  std::sqrt(1. / vertexDist2D.second));
431  dist3D = Measurement1D(
432  vertexDist3D.first / vertexDist3D.second,
433  std::sqrt(1. / vertexDist3D.second));
434 
435  vars.insert(btau::jetNSecondaryVertices, nVertices, true);
436  vars.insert(btau::vertexNTracks, nVertexTracks, true);
437  } else if (nTracks) {
439  vertexKinematics = trackKinematics;
440 
441  dist2D = Measurement1D(
442  tracksDist2D.first / tracksDist2D.second,
443  std::sqrt(1. / tracksDist2D.second));
444  dist3D = Measurement1D(
445  tracksDist3D.first / tracksDist3D.second,
446  std::sqrt(1. / tracksDist3D.second));
447  }
448 
449  if (nVertices || nTracks) {
450  vars.insert(btau::flightDistance2dVal, dist2D.value(), true);
451  vars.insert(btau::flightDistance2dSig, dist2D.significance(), true);
452  vars.insert(btau::flightDistance3dVal, dist3D.value(), true);
453  vars.insert(btau::flightDistance3dSig, dist3D.significance(), true);
454  vars.insert(btau::vertexJetDeltaR, Geom::deltaR(svInfo.flightDirection(0), jetDir),true);
455  vars.insert(btau::jetNSingleTrackVertices, nTracks, true);
456  }
457 
458  std::vector<std::size_t> indices = ipInfo.sortedIndexes(sortCriterium);
459  const std::vector<btag::TrackIPData> &ipData = ipInfo.impactParameterData();
461 
462  const Track * trackPairV0Test[2];
463  for(unsigned int i = 0; i < indices.size(); i++) {
464  std::size_t idx = indices[i];
465  const btag::TrackIPData &data = ipData[idx];
466  const Track * trackPtr = reco::btag::toTrack(tracks[idx]);
467  const Track &track = *trackPtr;
468 
469  // filter track
470 
471  if (!trackSelector(track, data, *jet, pv))
472  continue;
473 
474  // add track to kinematics for all tracks in jet
475 
476  allKinematics.add(track);
477 
478  // check against all other tracks for V0 track pairs
479 
480  trackPairV0Test[0] = reco::btag::toTrack(tracks[idx]);
481  bool ok = true;
482  for(unsigned int j = 0; j < indices.size(); j++) {
483  if (i == j)
484  continue;
485 
486  std::size_t pairIdx = indices[j];
487  const btag::TrackIPData &pairTrackData = ipData[pairIdx];
488  const Track * pairTrackPtr = reco::btag::toTrack(tracks[pairIdx]);
489  const Track &pairTrack = *pairTrackPtr;
490 
491  if (!trackSelector(pairTrack, pairTrackData, *jet, pv))
492  continue;
493 
494  trackPairV0Test[1] = pairTrackPtr;
495  if (!trackPairV0Filter(trackPairV0Test, 2)) {
496  ok = false;
497  break;
498  }
499  }
500  if (!ok)
501  continue;
502 
503  // add track variables
504 
505  math::XYZVector trackMom = track.momentum();
506  double trackMag = std::sqrt(trackMom.Mag2());
507 
508  vars.insert(btau::trackSip3dVal, data.ip3d.value(), true);
509  vars.insert(btau::trackSip3dSig, data.ip3d.significance(), true);
510  vars.insert(btau::trackSip2dVal, data.ip2d.value(), true);
511  vars.insert(btau::trackSip2dSig, data.ip2d.significance(), true);
512  vars.insert(btau::trackJetDistVal, data.distanceToJetAxis.value(), true);
513  vars.insert(btau::trackGhostTrackDistVal, data.distanceToGhostTrack.value(), true);
514  vars.insert(btau::trackGhostTrackDistSig, data.distanceToGhostTrack.significance(), true);
515  vars.insert(btau::trackGhostTrackWeight, data.ghostTrackWeight, true);
516  vars.insert(btau::trackDecayLenVal, havePv ? (data.closestToGhostTrack - pv).mag() : -1.0, true);
517 
518  vars.insert(btau::trackMomentum, trackMag, true);
519  vars.insert(btau::trackEta, trackMom.Eta(), true);
520 
521  vars.insert(btau::trackChi2, track.normalizedChi2(), true);
524  vars.insert(btau::trackPtRel, VectorUtil::Perp(trackMom, jetDir), true);
525  vars.insert(btau::trackDeltaR, VectorUtil::DeltaR(trackMom, jetDir), true);
526  }
527 
528  vars.insert(btau::vertexCategory, vtxType, true);
529  vars.insert(btau::trackSumJetDeltaR, VectorUtil::DeltaR(allKinematics.vectorSum(), jetDir), true);
530  vars.insert(btau::trackSumJetEtRatio, allKinematics.vectorSum().Et() / ipInfo.jet()->et(), true);
531  vars.insert(btau::trackSip3dSigAboveCharm, threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.significance(), true);
532  vars.insert(btau::trackSip2dSigAboveCharm, threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.significance(), true);
533 
534  if (vtxType != btag::Vertices::NoVertex) {
535  math::XYZTLorentzVector allSum = allKinematics.vectorSum();
536  math::XYZTLorentzVector vertexSum = vertexKinematics.vectorSum();
537 
538  vars.insert(btau::vertexMass, vertexSum.M(), true);
539  if (allKinematics.numberOfTracks())
540  vars.insert(btau::vertexEnergyRatio, vertexSum.E() / allSum.E(), true);
541  else
542  vars.insert(btau::vertexEnergyRatio, 1, true);
543  }
544 
545  vars.finalize();
546 
547  return vars;
548 }
reco::btag::SortCriteria getCriterium(const std::string &name)
Definition: TrackSorting.cc:11
const unsigned int nTracks(const reco::Vertex &sv)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
virtual reco::TaggingVariableList operator()(const reco::TrackIPTagInfo &ipInfo, const reco::SecondaryVertexTagInfo &svInfo) const
const double w
Definition: UKUtility.cc:23
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:561
void add(const reco::Track &track, double weight=1.0)
const VTX & secondaryVertex(unsigned int index) const
GhostTrackComputer(const edm::ParameterSet &params)
Track refittedTrack(const TrackBaseRef &track) const
Base class for all types of Jets.
Definition: Jet.h:20
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
bool hasRefittedTracks() const
Checks whether refitted tracks are stored.
Definition: Vertex.h:149
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double error() const
Definition: Measurement1D.h:30
const Container & selectedTracks() const
Definition: IPTagInfo.h:101
static edm::ParameterSet dropDeltaR(const edm::ParameterSet &pset)
Definition: weight.py:1
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:499
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:675
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:253
const reco::Track * toTrack(const reco::TrackBaseRef &t)
Definition: IPTagInfo.h:24
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:518
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:248
virtual const daughters & daughterPtrVector() const
references to daughtes
const edm::Ref< VertexCollection > & primaryVertex() const
Definition: IPTagInfo.h:133
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
static void addMeas(std::pair< double, double > &sum, Measurement1D meas)
float trackWeight(unsigned int svIndex, unsigned int trackindex) const
T sqrt(T t)
Definition: SSEVec.h:18
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:144
def pv(vc)
Definition: MetAnalyzer.py:6
std::vector< size_t > sortedIndexes(btag::SortCriteria mode=reco::btag::IP3DSig) const
Definition: IPTagInfo.h:238
reco::V0Filter trackPairV0Filter
const GlobalVector & flightDirection(unsigned int index) const
const std::vector< btag::TrackIPData > & impactParameterData() const
Definition: IPTagInfo.h:91
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
double significance() const
Definition: Measurement1D.h:32
unsigned int numberOfTracks() const
reco::btag::SortCriteria sortCriterium
const reco::btag::TrackIPData & threshTrack(const reco::TrackIPTagInfo &trackIPTagInfo, const reco::btag::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:446
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
double value() const
Definition: Measurement1D.h:28
fixed size matrix
HLT enums.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const math::XYZTLorentzVector & vectorSum() const
Measurement1D flightDistance(unsigned int index, int dim=0) const
reco::TrackSelector trackNoDeltaRSelector
reco::TrackSelector trackSelector
Container input_container
Definition: IPTagInfo.h:53
void insert(const TaggingVariable &variable, bool delayed=false)