CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
HitResol Class Reference

#include <HitResol.h>

Inheritance diagram for HitResol:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Types

typedef std::vector< TrajectoryTrajectoryCollection
 
- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

double checkConsistency (const StripClusterParameterEstimator::LocalValues &parameters, double xx, double xerr)
 
bool getPairParameters (const MagneticField *magField_, AnalyticalPropagator &propagator, const TrajectoryMeasurement *traj1, const TrajectoryMeasurement *traj2, float &pairPath, float &hitDX, float &trackDX, float &trackDXE, float &trackParamX, float &trackParamY, float &trackParamDXDZ, float &trackParamDYDZ, float &trackParamXE, float &trackParamYE, float &trackParamDXDZE, float &trackParamDYDZE)
 
void getSimHitRes (const GeomDetUnit *det, const LocalVector &trackdirection, const TrackingRecHit &recHit, float &trackWidth, float *pitch, LocalVector &drift)
 
double getSimpleRes (const TrajectoryMeasurement *traj1)
 
 HitResol (const edm::ParameterSet &conf)
 
 ~HitResol () override=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

const bool addLumi_
 
float atEdge
 
float atEdge_2
 
unsigned int clusterCharge
 
unsigned int clusterCharge_2
 
unsigned int clusterWidth
 
unsigned int clusterWidth_2
 
const edm::EDGetTokenT< reco::TrackCollectioncombinatorialTracks_token_
 
const int compSettings_
 
const edm::ESGetToken< StripClusterParameterEstimator, TkStripCPERecordcpeToken_
 
const bool cutOnTracks_
 
const bool DEBUG_
 
float driftAlpha
 
float driftAlpha_2
 
int events
 
int EventTrackCKF
 
float expWidth
 
float expWidth_2
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordgeomToken_
 
std::map< TString, TH2F * > histos2d_
 
float hitDX
 
unsigned int iidd1
 
unsigned int iidd2
 
const unsigned int layers_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagFieldToken_
 
const double momentumCut_
 
float mymom
 
float mypitch1
 
float mypitch2
 
float N1
 
float N1uProj
 
float N2
 
float N2uProj
 
int Nstrips
 
int Nstrips_2
 
int NumberOf_tracks
 
int numHits
 
float pairPath
 
unsigned int pairsOnly
 
float ProbTrackChi2
 
TTree * reso
 
const edm::EDGetTokenT< LumiScalersCollectionscalerToken_
 
float simpleRes
 
const edm::ESGetToken< SiStripQuality, SiStripQualityRcdsiStripQualityToken_
 
float StripCPE1_smp_pos_error
 
float StripCPE2_smp_pos_error
 
float StripErrorSquared1
 
float StripErrorSquared2
 
float thickness
 
float thickness_2
 
const edm::EDGetTokenT< std::vector< Trajectory > > tjToken_
 
const edm::EDGetTokenT< reco::TrackCollectiontkToken_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtopoToken_
 
float track_eta
 
float track_momentum
 
float track_phi
 
float track_pt
 
float track_trackChi2
 
float track_width
 
float trackDX
 
float trackDXE
 
const unsigned int trackMultiplicityCut_
 
float trackParamDXDZ
 
float trackParamDXDZE
 
float trackParamDYDZ
 
float trackParamDYDZE
 
float trackParamX
 
float trackParamXE
 
float trackParamY
 
float trackParamYE
 
float trackWidth
 
float trackWidth_2
 
TTree * treso
 
float uerr2
 
float uerr2_2
 
const unsigned int usePairsOnly_
 

Static Private Attributes

static constexpr float cmToUm = 10000.f
 

Additional Inherited Members

- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 33 of file HitResol.h.

Member Typedef Documentation

◆ TrajectoryCollection

Definition at line 62 of file HitResol.h.

Constructor & Destructor Documentation

◆ HitResol()

HitResol::HitResol ( const edm::ParameterSet conf)
explicit

Definition at line 71 of file HitResol.cc.

References TFileService::kSharedResource.

72  : scalerToken_(consumes<LumiScalersCollection>(conf.getParameter<edm::InputTag>("lumiScalers"))),
74  consumes<reco::TrackCollection>(conf.getParameter<edm::InputTag>("combinatorialTracks"))),
75  tjToken_(consumes<std::vector<Trajectory> >(conf.getParameter<edm::InputTag>("trajectories"))),
78  cpeToken_(esConsumes(edm::ESInputTag("", "StripCPEfromTrackAngle"))),
81  addLumi_(conf.getUntrackedParameter<bool>("addLumi", false)),
82  DEBUG_(conf.getParameter<bool>("Debug")),
83  cutOnTracks_(conf.getUntrackedParameter<bool>("cutOnTracks", false)),
84  momentumCut_(conf.getUntrackedParameter<double>("MomentumCut", 3.)),
85  compSettings_(conf.getUntrackedParameter<int>("CompressionSettings", -1)),
86  usePairsOnly_(conf.getUntrackedParameter<unsigned int>("UsePairsOnly", 1)),
87  layers_(conf.getParameter<int>("Layer")),
88  trackMultiplicityCut_(conf.getUntrackedParameter<unsigned int>("trackMultiplicity", 100)) {
89  usesResource(TFileService::kSharedResource);
90 }
static const std::string kSharedResource
Definition: TFileService.h:76
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
Definition: HitResol.h:82
const unsigned int usePairsOnly_
Definition: HitResol.h:90
const edm::EDGetTokenT< reco::TrackCollection > combinatorialTracks_token_
Definition: HitResol.h:73
const int compSettings_
Definition: HitResol.h:89
const edm::ESGetToken< SiStripQuality, SiStripQualityRcd > siStripQualityToken_
Definition: HitResol.h:81
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< std::vector< Trajectory > > tjToken_
Definition: HitResol.h:74
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
Definition: HitResol.h:79
const bool DEBUG_
Definition: HitResol.h:86
const bool cutOnTracks_
Definition: HitResol.h:87
const bool addLumi_
Definition: HitResol.h:85
const edm::EDGetTokenT< LumiScalersCollection > scalerToken_
Definition: HitResol.h:72
const edm::ESGetToken< StripClusterParameterEstimator, TkStripCPERecord > cpeToken_
Definition: HitResol.h:80
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Definition: HitResol.h:78
const unsigned int layers_
Definition: HitResol.h:91
const unsigned int trackMultiplicityCut_
Definition: HitResol.h:92
const double momentumCut_
Definition: HitResol.h:88

◆ ~HitResol()

HitResol::~HitResol ( )
overridedefault

Member Function Documentation

◆ analyze()

void HitResol::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 159 of file HitResol.cc.

References AnalyticalPropagator_cfi::AnalyticalPropagator, anyDirection, atEdge, atEdge_2, ChiSquaredProbability(), clusterWidth, clusterWidth_2, combinatorialTracks_token_, cpeToken_, shallow::drift(), StripClusterParameterEstimator::driftDirection(), MillePedeFileConverter_cfg::e, events, expWidth, expWidth_2, geomToken_, edm::EventSetup::getData(), edm::EventSetup::getHandle(), getPairParameters(), getSimHitRes(), getSimpleRes(), TrackerTopology::glued(), histos2d_, hitDX, globals_cff::id1, globals_cff::id2, TrackerGeometry::idToDetUnit(), iidd1, iidd2, TrackerTopology::isStereo(), TrajectoryStateOnSurface::localDirection(), LogDebug, magFieldToken_, momentumCut_, mymom, mypitch1, StripTopology::nstrips(), Nstrips, Nstrips_2, numHits, pairPath, pairsOnly, ProbTrackChi2, edm::Handle< T >::product(), reso, simpleRes, siStripQualityToken_, findQualityFiles::size, StripSubdetector::TEC, StripSubdetector::TIB, tjToken_, topoToken_, track_eta, track_momentum, track_phi, track_pt, track_trackChi2, trackDX, trackDXE, PbPb_ZMuSkimMuonDPG_cff::tracker, trackParamDXDZ, trackParamDXDZE, trackParamDYDZ, trackParamDYDZE, trackParamX, trackParamXE, trackParamY, trackParamYE, treso, and usePairsOnly_.

159  {
160  //Retrieve tracker topology from geometry
161  const TrackerTopology* tTopo = &es.getData(topoToken_);
162 
163  LogDebug("SiStripHitResolution:HitResol") << "beginning analyze from HitResol" << endl;
164 
165  using namespace edm;
166  using namespace reco;
167 
168  // Step A: Get Inputs
169 
170  int run_nr = e.id().run();
171  int ev_nr = e.id().event();
172 
173  // get the tracks
174  edm::Handle<reco::TrackCollection> trackCollectionCKF;
175  e.getByToken(combinatorialTracks_token_, trackCollectionCKF);
176  const reco::TrackCollection* tracksCKF = trackCollectionCKF.product();
177 
178  // get the trajectory collection
179  edm::Handle<std::vector<Trajectory> > trajectoryCollectionHandle;
180  e.getByToken(tjToken_, trajectoryCollectionHandle);
181  const TrajectoryCollection* trajectoryCollection = trajectoryCollectionHandle.product();
182 
183  //get tracker geometry
185  const TrackerGeometry* tkgeom = &(*tracker);
186 
187  //get Cluster Parameter Estimator
188  edm::ESHandle<StripClusterParameterEstimator> parameterestimator = es.getHandle(cpeToken_);
189  const StripClusterParameterEstimator& stripcpe(*parameterestimator);
190 
191  // get the SiStripQuality records
192  edm::ESHandle<SiStripQuality> SiStripQuality_ = es.getHandle(siStripQualityToken_);
193 
194  // get the magnetic field
195  const MagneticField* magField_ = &es.getData(magFieldToken_);
196 
197  events++;
198 
199  // List of variables for SiStripHitResolution ntuple
200  mymom = 0;
201  numHits = 0;
202  ProbTrackChi2 = 0;
203  iidd1 = 0;
204  mypitch1 = 0;
205  clusterWidth = 0;
206  expWidth = 0;
207  atEdge = 0;
208  simpleRes = 0;
209  iidd2 = 0;
210  clusterWidth_2 = 0;
211  expWidth_2 = 0;
212  atEdge_2 = 0;
213  pairPath = 0;
214  hitDX = 0;
215  trackDX = 0;
216  trackDXE = 0;
217  trackParamX = 0;
218  trackParamY = 0;
219  trackParamDXDZ = 0;
220  trackParamDYDZ = 0;
221  trackParamXE = 0;
222  trackParamYE = 0;
223  trackParamDXDZE = 0;
224  trackParamDYDZE = 0;
225  pairsOnly = 0;
226 
227  LogDebug("HitResol") << "Starting analysis, nrun nevent, tracksCKF->size(): " << run_nr << " " << ev_nr << " "
228  << tracksCKF->size() << std::endl;
229 
230  for (unsigned int iT = 0; iT < tracksCKF->size(); ++iT) {
231  track_momentum = tracksCKF->at(iT).p();
232  track_pt = tracksCKF->at(iT).p();
233  track_eta = tracksCKF->at(iT).eta();
234  track_phi = tracksCKF->at(iT).phi();
235  track_trackChi2 = ChiSquaredProbability((double)(tracksCKF->at(iT).chi2()), (double)(tracksCKF->at(iT).ndof()));
236  treso->Fill();
237  }
238 
239  histos2d_["track_phi_vs_eta"]->Fill(track_phi, track_eta);
240 
241  // loop over trajectories from refit
242  for (const auto& traj : *trajectoryCollection) {
243  const auto& TMeas = traj.measurements();
244  // Loop on each measurement and take it into consideration
245  //--------------------------------------------------------
246  for (auto itm = TMeas.cbegin(); itm != TMeas.cend(); ++itm) {
247  if (!itm->updatedState().isValid()) {
248  LogDebug("HitResol") << "trajectory measurement not valid" << std::endl;
249  continue;
250  }
251 
252  const TransientTrackingRecHit::ConstRecHitPointer mypointhit = itm->recHit();
253  const TrackingRecHit* myhit = (*itm->recHit()).hit();
254 
255  ProbTrackChi2 = 0;
256  numHits = 0;
257 
258  LogDebug("HitResol") << "TrackChi2 = "
259  << ChiSquaredProbability((double)(traj.chiSquared()), (double)(traj.ndof(false))) << "\n"
260  << "itm->updatedState().globalMomentum().perp(): "
261  << itm->updatedState().globalMomentum().perp() << "\n"
262  << "numhits " << traj.foundHits() << std::endl;
263 
264  numHits = traj.foundHits();
265  ProbTrackChi2 = ChiSquaredProbability((double)(traj.chiSquared()), (double)(traj.ndof(false)));
266 
267  mymom = itm->updatedState().globalMomentum().perp();
268 
269  //Now for the first hit
270  TrajectoryStateOnSurface mytsos = itm->updatedState();
271  const auto hit1 = itm->recHit();
272  DetId id1 = hit1->geographicalId();
273  if (id1.subdetId() < StripSubdetector::TIB || id1.subdetId() > StripSubdetector::TEC)
274  continue;
275 
276  if (hit1->isValid() && mymom > momentumCut_ &&
277  (id1.subdetId() >= StripSubdetector::TIB && id1.subdetId() <= StripSubdetector::TEC)) {
278  const auto stripdet = dynamic_cast<const StripGeomDetUnit*>(tkgeom->idToDetUnit(hit1->geographicalId()));
279  const StripTopology& Topo = stripdet->specificTopology();
280  int Nstrips = Topo.nstrips();
281  mypitch1 = stripdet->surface().bounds().width() / Topo.nstrips();
282 
283  const auto det = dynamic_cast<const StripGeomDetUnit*>(tkgeom->idToDetUnit(mypointhit->geographicalId()));
284 
285  TrajectoryStateOnSurface mytsos = itm->updatedState();
286  LocalVector trackDirection = mytsos.localDirection();
287  LocalVector drift = stripcpe.driftDirection(stripdet);
288 
289  const auto hit1d = dynamic_cast<const SiStripRecHit1D*>(myhit);
290 
291  if (hit1d) {
292  getSimHitRes(det, trackDirection, *hit1d, expWidth, &mypitch1, drift);
293  clusterWidth = hit1d->cluster()->amplitudes().size();
294  uint16_t firstStrip = hit1d->cluster()->firstStrip();
295  uint16_t lastStrip = firstStrip + (hit1d->cluster()->amplitudes()).size() - 1;
296  atEdge = (firstStrip == 0 || lastStrip == (Nstrips - 1));
297  }
298 
299  const auto hit2d = dynamic_cast<const SiStripRecHit2D*>(myhit);
300 
301  if (hit2d) {
302  getSimHitRes(det, trackDirection, *hit2d, expWidth, &mypitch1, drift);
303  clusterWidth = hit2d->cluster()->amplitudes().size();
304  uint16_t firstStrip = hit2d->cluster()->firstStrip();
305  uint16_t lastStrip = firstStrip + (hit2d->cluster()->amplitudes()).size() - 1;
306  atEdge = (firstStrip == 0 || lastStrip == (Nstrips - 1));
307  }
308 
309  simpleRes =
310  getSimpleRes(&(*itm)); // simple resolution by using the track re-fit forward and backward predicted state
311 
312  histos2d_["residual_vs_trackMomentum"]->Fill(itm->updatedState().globalMomentum().mag(),
313  simpleRes * 10000); // reso in cm *10000 == micro-meter
314  histos2d_["residual_vs_trackPt"]->Fill(mymom, simpleRes * 10000); // reso in cm *10000 == micro-meter
315  histos2d_["residual_vs_trackEta"]->Fill(itm->updatedState().globalMomentum().eta(), simpleRes * 10000);
316  histos2d_["residual_vs_trackPhi"]->Fill(itm->updatedState().globalMomentum().phi(), simpleRes * 10000);
317  histos2d_["residual_vs_expectedWidth"]->Fill(expWidth, simpleRes * 10000);
318  histos2d_["numHits_vs_residual"]->Fill(simpleRes * 10000, numHits);
319 
320  // Now to see if there is a match - pair method - hit in overlapping sensors
321  vector<TrajectoryMeasurement>::const_iterator itTraj2 = TMeas.end(); // last hit along the fitted track
322 
323  for (auto itmCompare = itm - 1;
324  // start to compare from the 5th hit
325  itmCompare >= TMeas.cbegin() && itmCompare > itm - 4;
326  --itmCompare) {
327  const auto hit2 = itmCompare->recHit();
328  if (!hit2->isValid())
329  continue;
330  DetId id2 = hit2->geographicalId();
331 
332  //must be from the same detector and layer
333  iidd1 = hit1->geographicalId().rawId();
334  iidd2 = hit2->geographicalId().rawId();
335  if (id1.subdetId() != id2.subdetId() || ::checkLayer(iidd1, tTopo) != ::checkLayer(iidd2, tTopo))
336  break;
337  //must both be stereo if one is
338  if (tTopo->isStereo(id1) != tTopo->isStereo(id2))
339  continue;
340  //A check i dont completely understand but might as well keep there
341  if (tTopo->glued(id1) == id1.rawId())
342  LogDebug("HitResol") << "BAD GLUED: Have glued layer with id = " << id1.rawId()
343  << " and glued id = " << tTopo->glued(id1) << " and stereo = " << tTopo->isStereo(id1)
344  << endl;
345  if (tTopo->glued(id2) == id2.rawId())
346  LogDebug("HitResol") << "BAD GLUED: Have glued layer with id = " << id2.rawId()
347  << " and glued id = " << tTopo->glued(id2) << " and stereo = " << tTopo->isStereo(id2)
348  << endl;
349 
350  itTraj2 = itmCompare;
351  break;
352  }
353 
354  if (itTraj2 == TMeas.cend()) {
355  } else {
356  LogDebug("HitResol") << "Found overlapping sensors " << std::endl;
358 
359  //We found one....let's fill in the truth info!
360  TrajectoryStateOnSurface tsos_2 = itTraj2->updatedState();
361  LocalVector trackDirection_2 = tsos_2.localDirection();
362  const auto myhit2 = itTraj2->recHit();
363  const auto myhit_2 = (*itTraj2->recHit()).hit();
364  const auto stripdet_2 = dynamic_cast<const StripGeomDetUnit*>(tkgeom->idToDetUnit(myhit2->geographicalId()));
365  const StripTopology& Topo_2 = stripdet_2->specificTopology();
366  int Nstrips_2 = Topo_2.nstrips();
367  float mypitch_2 = stripdet_2->surface().bounds().width() / Topo_2.nstrips();
368 
369  if (mypitch1 != mypitch_2)
370  return; // for PairsOnly
371 
372  const auto det_2 = dynamic_cast<const StripGeomDetUnit*>(tkgeom->idToDetUnit(myhit2->geographicalId()));
373 
374  LocalVector drift_2 = stripcpe.driftDirection(stripdet_2);
375 
376  const auto hit1d_2 = dynamic_cast<const SiStripRecHit1D*>(myhit_2);
377  if (hit1d_2) {
378  getSimHitRes(det_2, trackDirection_2, *hit1d_2, expWidth_2, &mypitch_2, drift_2);
379  clusterWidth_2 = hit1d_2->cluster()->amplitudes().size();
380  uint16_t firstStrip_2 = hit1d_2->cluster()->firstStrip();
381  uint16_t lastStrip_2 = firstStrip_2 + (hit1d_2->cluster()->amplitudes()).size() - 1;
382  atEdge_2 = (firstStrip_2 == 0 || lastStrip_2 == (Nstrips_2 - 1));
383  }
384 
385  const auto hit2d_2 = dynamic_cast<const SiStripRecHit2D*>(myhit_2);
386  if (hit2d_2) {
387  getSimHitRes(det_2, trackDirection_2, *hit2d_2, expWidth_2, &mypitch_2, drift_2);
388  clusterWidth_2 = hit2d_2->cluster()->amplitudes().size();
389  uint16_t firstStrip_2 = hit2d_2->cluster()->firstStrip();
390  uint16_t lastStrip_2 = firstStrip_2 + (hit2d_2->cluster()->amplitudes()).size() - 1;
391  atEdge_2 = (firstStrip_2 == 0 || lastStrip_2 == (Nstrips_2 - 1));
392  }
393 
394  // if(pairsOnly && (pitch != pitch2) ) fill = false;
395 
396  // Make AnalyticalPropagator to use in getPairParameters
397  AnalyticalPropagator mypropagator(magField_, anyDirection);
398 
399  if (!getPairParameters(&(*magField_),
400  mypropagator,
401  &(*itTraj2),
402  &(*itm),
403  pairPath,
404  hitDX,
405  trackDX,
406  trackDXE,
407  trackParamX,
408  trackParamY,
411  trackParamXE,
412  trackParamYE,
414  trackParamDYDZE)) {
415  } else {
416  LogDebug("HitResol") << " \n\n\n"
417  << " momentum " << mymom << "\n"
418  << " numHits " << numHits << "\n"
419  << " trackChi2 " << ProbTrackChi2 << "\n"
420  << " detID1 " << iidd1 << "\n"
421  << " pitch1 " << mypitch1 << "\n"
422  << " clusterW1 " << clusterWidth << "\n"
423  << " expectedW1 " << expWidth << "\n"
424  << " atEdge1 " << atEdge << "\n"
425  << " simpleRes " << simpleRes << "\n"
426  << " detID2 " << iidd2 << "\n"
427  << " clusterW2 " << clusterWidth_2 << "\n"
428  << " expectedW2 " << expWidth_2 << "\n"
429  << " atEdge2 " << atEdge_2 << "\n"
430  << " pairPath " << pairPath << "\n"
431  << " hitDX " << hitDX << "\n"
432  << " trackDX " << trackDX << "\n"
433  << " trackDXE " << trackDXE << "\n"
434  << " trackParamX " << trackParamX << "\n"
435  << " trackParamY " << trackParamY << "\n"
436  << " trackParamDXDZ " << trackParamDXDZ << "\n"
437  << " trackParamDYDZ " << trackParamDYDZ << "\n"
438  << " trackParamXE " << trackParamXE << "\n"
439  << " trackParamYE " << trackParamYE << "\n"
440  << " trackParamDXDZE" << trackParamDXDZE << "\n"
441  << " trackParamDYDZE" << trackParamDYDZE << std::endl;
442  reso->Fill();
443  }
444  } //itTraj2 != TMeas.end()
445  } //hit1->isValid()....
446  } // itm
447  } // it
448 }
size
Write out results.
int Nstrips_2
Definition: HitResol.h:160
static constexpr auto TEC
virtual int nstrips() const =0
float simpleRes
Definition: HitResol.h:137
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
Definition: HitResol.h:82
int Nstrips
Definition: HitResol.h:159
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
float trackDX
Definition: HitResol.h:139
float trackParamDYDZE
Definition: HitResol.h:148
float pairPath
Definition: HitResol.h:124
float track_trackChi2
Definition: HitResol.h:154
float trackParamDYDZ
Definition: HitResol.h:146
int numHits
Definition: HitResol.h:108
T const * product() const
Definition: Handle.h:70
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:36
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
float atEdge
Definition: HitResol.h:135
const unsigned int usePairsOnly_
Definition: HitResol.h:90
const edm::EDGetTokenT< reco::TrackCollection > combinatorialTracks_token_
Definition: HitResol.h:73
int events
Definition: HitResol.h:103
bool isStereo(const DetId &id) const
const edm::ESGetToken< SiStripQuality, SiStripQualityRcd > siStripQualityToken_
Definition: HitResol.h:81
float trackParamXE
Definition: HitResol.h:143
float trackParamX
Definition: HitResol.h:141
const edm::EDGetTokenT< std::vector< Trajectory > > tjToken_
Definition: HitResol.h:74
float trackParamYE
Definition: HitResol.h:144
bool getPairParameters(const MagneticField *magField_, AnalyticalPropagator &propagator, const TrajectoryMeasurement *traj1, const TrajectoryMeasurement *traj2, float &pairPath, float &hitDX, float &trackDX, float &trackDXE, float &trackParamX, float &trackParamY, float &trackParamDXDZ, float &trackParamDYDZ, float &trackParamXE, float &trackParamYE, float &trackParamDXDZE, float &trackParamDYDZE)
Definition: HitResol.cc:511
float trackDXE
Definition: HitResol.h:140
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
Definition: HitResol.h:79
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
float track_eta
Definition: HitResol.h:151
float trackParamDXDZ
Definition: HitResol.h:145
LocalVector localDirection() const
unsigned int pairsOnly
Definition: HitResol.h:123
float expWidth
Definition: HitResol.h:127
float ChiSquaredProbability(double chiSquared, double nrDOF)
double getSimpleRes(const TrajectoryMeasurement *traj1)
Definition: HitResol.cc:492
std::map< TString, TH2F * > histos2d_
Definition: HitResol.h:97
float track_momentum
Definition: HitResol.h:149
float expWidth_2
Definition: HitResol.h:128
uint32_t glued(const DetId &id) const
Definition: DetId.h:17
static constexpr auto TIB
TTree * treso
Definition: HitResol.h:96
float hitDX
Definition: HitResol.h:138
const edm::ESGetToken< StripClusterParameterEstimator, TkStripCPERecord > cpeToken_
Definition: HitResol.h:80
unsigned int iidd1
Definition: HitResol.h:121
float ProbTrackChi2
Definition: HitResol.h:110
float trackParamDXDZE
Definition: HitResol.h:147
float track_pt
Definition: HitResol.h:150
fixed size matrix
HLT enums.
float mymom
Definition: HitResol.h:107
float track_phi
Definition: HitResol.h:153
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Definition: HitResol.h:78
unsigned int clusterWidth
Definition: HitResol.h:117
TTree * reso
Definition: HitResol.h:95
unsigned int iidd2
Definition: HitResol.h:122
std::vector< Trajectory > TrajectoryCollection
float trackParamY
Definition: HitResol.h:142
float atEdge_2
Definition: HitResol.h:136
unsigned int clusterWidth_2
Definition: HitResol.h:118
float mypitch1
Definition: HitResol.h:125
const double momentumCut_
Definition: HitResol.h:88
void getSimHitRes(const GeomDetUnit *det, const LocalVector &trackdirection, const TrackingRecHit &recHit, float &trackWidth, float *pitch, LocalVector &drift)
Definition: HitResol.cc:468
#define LogDebug(id)

◆ beginJob()

void HitResol::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 92 of file HitResol.cc.

References atEdge, atEdge_2, clusterWidth, clusterWidth_2, compSettings_, events, EventTrackCKF, expWidth, expWidth_2, compareTotals::fs, histos2d_, hitDX, iidd1, iidd2, mymom, mypitch1, NumberOf_tracks, numHits, pairPath, pairsOnly, ProbTrackChi2, reso, simpleRes, track_eta, track_momentum, track_phi, track_pt, track_trackChi2, trackDX, trackDXE, trackParamDXDZ, trackParamDXDZE, trackParamDYDZ, trackParamDYDZE, trackParamX, trackParamXE, trackParamY, trackParamYE, and treso.

92  {
94  if (compSettings_ > 0) {
95  edm::LogInfo("SiStripHitResolution:HitResol") << "the compressions settings are:" << compSettings_ << std::endl;
96  fs->file().SetCompressionSettings(compSettings_);
97  }
98 
99  reso = fs->make<TTree>("reso", "tree hit pairs for resolution studies");
100  reso->Branch("momentum", &mymom, "momentum/F");
101  reso->Branch("numHits", &numHits, "numHits/I");
102  reso->Branch("trackChi2", &ProbTrackChi2, "trackChi2/F");
103  reso->Branch("detID1", &iidd1, "detID1/I");
104  reso->Branch("pitch1", &mypitch1, "pitch1/F");
105  reso->Branch("clusterW1", &clusterWidth, "clusterW1/I");
106  reso->Branch("expectedW1", &expWidth, "expectedW1/F");
107  reso->Branch("atEdge1", &atEdge, "atEdge1/F");
108  reso->Branch("simpleRes", &simpleRes, "simpleRes/F");
109  reso->Branch("detID2", &iidd2, "detID2/I");
110  reso->Branch("clusterW2", &clusterWidth_2, "clusterW2/I");
111  reso->Branch("expectedW2", &expWidth_2, "expectedW2/F");
112  reso->Branch("atEdge2", &atEdge_2, "atEdge2/F");
113  reso->Branch("pairPath", &pairPath, "pairPath/F");
114  reso->Branch("hitDX", &hitDX, "hitDX/F");
115  reso->Branch("trackDX", &trackDX, "trackDX/F");
116  reso->Branch("trackDXE", &trackDXE, "trackDXE/F");
117  reso->Branch("trackParamX", &trackParamX, "trackParamX/F");
118  reso->Branch("trackParamY", &trackParamY, "trackParamY/F");
119  reso->Branch("trackParamDXDZ", &trackParamDXDZ, "trackParamDXDZ/F");
120  reso->Branch("trackParamDYDZ", &trackParamDYDZ, "trackParamDYDZ/F");
121  reso->Branch("trackParamXE", &trackParamXE, "trackParamXE/F");
122  reso->Branch("trackParamYE", &trackParamYE, "trackParamYE/F");
123  reso->Branch("trackParamDXDZE", &trackParamDXDZE, "trackParamDXDZE/F");
124  reso->Branch("trackParamDYDZE", &trackParamDYDZE, "trackParamDYDZE/F");
125  reso->Branch("pairsOnly", &pairsOnly, "pairsOnly/I");
126  treso = fs->make<TTree>("treso", "tree tracks for resolution studies");
127  treso->Branch("track_momentum", &track_momentum, "track_momentum/F");
128  treso->Branch("track_pt", &track_pt, "track_pt/F");
129  treso->Branch("track_eta", &track_eta, "track_eta/F");
130  treso->Branch("track_phi", &track_phi, "track_phi/F");
131  treso->Branch("track_trackChi2", &track_trackChi2, "track_trackChi2/F");
132  treso->Branch("track_width", &expWidth, "track_width/F"); // from 1D HIT
133  treso->Branch("NumberOf_tracks", &NumberOf_tracks, "NumberOf_tracks/I");
134 
135  events = 0;
136  EventTrackCKF = 0;
137 
138  histos2d_["track_phi_vs_eta"] = new TH2F("track_phi_vs_eta", ";track phi;track eta", 60, -3.5, 3.5, 60, -3., 3.);
139  histos2d_["residual_vs_trackMomentum"] = new TH2F("residual_vs_trackMomentum",
140  ";track momentum [GeV]; x_{pred_track} - x_{reco_hit} [#mum]",
141  60,
142  0.,
143  10.,
144  60,
145  0.,
146  200.);
147  histos2d_["residual_vs_trackPt"] = new TH2F(
148  "residual_vs_trackPt", ";track p_{T}[GeV];x_{pred_track} - x_{reco_hit} [#mum]", 60, 0., 10., 60, 0., 200.);
149  histos2d_["residual_vs_trackEta"] =
150  new TH2F("residual_vs_trackEta", ";track #eta;x_{pred_track} - x_{reco_hit} [#mum]", 60, 0., 3., 60, 0., 200.);
151  histos2d_["residual_vs_trackPhi"] =
152  new TH2F("residual_vs_trackPhi", ";track #phi;x_{pred_track} - x_{reco_hit} [#mum]", 60, 0., 3.5, 60, 0., 200.);
153  histos2d_["residual_vs_expectedWidth"] = new TH2F(
154  "residual_vs_expectedWidth", ";track Width;x_{pred_track} - x_{reco_hit} [#mum]", 3, 0., 3., 60, 0., 200.);
155  histos2d_["numHits_vs_residual"] =
156  new TH2F("numHits_vs_residual", ";x_{pred_track} - x_{reco_hit} [#mum];N Hits", 60, 0., 200., 15, 0., 15.);
157 }
float simpleRes
Definition: HitResol.h:137
int NumberOf_tracks
Definition: HitResol.h:109
float trackDX
Definition: HitResol.h:139
float trackParamDYDZE
Definition: HitResol.h:148
float pairPath
Definition: HitResol.h:124
float track_trackChi2
Definition: HitResol.h:154
float trackParamDYDZ
Definition: HitResol.h:146
int EventTrackCKF
Definition: HitResol.h:103
int numHits
Definition: HitResol.h:108
float atEdge
Definition: HitResol.h:135
const int compSettings_
Definition: HitResol.h:89
int events
Definition: HitResol.h:103
float trackParamXE
Definition: HitResol.h:143
float trackParamX
Definition: HitResol.h:141
float trackParamYE
Definition: HitResol.h:144
float trackDXE
Definition: HitResol.h:140
float track_eta
Definition: HitResol.h:151
float trackParamDXDZ
Definition: HitResol.h:145
unsigned int pairsOnly
Definition: HitResol.h:123
float expWidth
Definition: HitResol.h:127
std::map< TString, TH2F * > histos2d_
Definition: HitResol.h:97
float track_momentum
Definition: HitResol.h:149
float expWidth_2
Definition: HitResol.h:128
Log< level::Info, false > LogInfo
TTree * treso
Definition: HitResol.h:96
float hitDX
Definition: HitResol.h:138
unsigned int iidd1
Definition: HitResol.h:121
float ProbTrackChi2
Definition: HitResol.h:110
float trackParamDXDZE
Definition: HitResol.h:147
float track_pt
Definition: HitResol.h:150
float mymom
Definition: HitResol.h:107
float track_phi
Definition: HitResol.h:153
unsigned int clusterWidth
Definition: HitResol.h:117
TTree * reso
Definition: HitResol.h:95
unsigned int iidd2
Definition: HitResol.h:122
float trackParamY
Definition: HitResol.h:142
float atEdge_2
Definition: HitResol.h:136
unsigned int clusterWidth_2
Definition: HitResol.h:118
float mypitch1
Definition: HitResol.h:125

◆ checkConsistency()

double HitResol::checkConsistency ( const StripClusterParameterEstimator::LocalValues parameters,
double  xx,
double  xerr 
)

Definition at line 459 of file HitResol.cc.

References funct::abs(), relativeConstraints::error, mathSSE::sqrt(), and geometryCSVtoXML::xx.

461  {
462  double error = sqrt(parameters.second.xx() + xerr * xerr);
463  double separation = abs(parameters.first.x() - xx);
464  double consistency = separation / error;
465  return consistency;
466 }
T sqrt(T t)
Definition: SSEVec.h:23
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ endJob()

void HitResol::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 450 of file HitResol.cc.

References events, EventTrackCKF, LogDebug, reso, and treso.

Referenced by o2olib.O2ORunMgr::executeJob().

450  {
451  LogDebug("SiStripHitResolution:HitResol") << " Events Analysed " << events << endl;
452  LogDebug("SiStripHitResolution:HitResol") << " Number Of Tracked events " << EventTrackCKF << endl;
453 
454  reso->GetDirectory()->cd();
455  reso->Write();
456  treso->Write();
457 }
int EventTrackCKF
Definition: HitResol.h:103
int events
Definition: HitResol.h:103
TTree * treso
Definition: HitResol.h:96
TTree * reso
Definition: HitResol.h:95
#define LogDebug(id)

◆ fillDescriptions()

void HitResol::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 630 of file HitResol.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

630  {
632  desc.add<edm::InputTag>("lumiScalers", edm::InputTag("scalersRawToDigi"));
633  desc.add<edm::InputTag>("combinatorialTracks", edm::InputTag("generalTracks"));
634  desc.add<edm::InputTag>("trajectories", edm::InputTag("generalTracks"));
635  desc.addUntracked<int>("CompressionSettings", -1);
636  desc.add<int>("Layer", 0);
637  desc.add<bool>("Debug", false);
638  desc.addUntracked<bool>("addLumi", false);
639  desc.addUntracked<bool>("cutOnTracks", false);
640  desc.addUntracked<unsigned int>("trackMultiplicity", 100);
641  desc.addUntracked<double>("MomentumCut", 3.);
642  desc.addUntracked<unsigned int>("UsePairsOnly", 1);
643  descriptions.addWithDefaultLabel(desc);
644 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ getPairParameters()

bool HitResol::getPairParameters ( const MagneticField magField_,
AnalyticalPropagator propagator,
const TrajectoryMeasurement traj1,
const TrajectoryMeasurement traj2,
float &  pairPath,
float &  hitDX,
float &  trackDX,
float &  trackDXE,
float &  trackParamX,
float &  trackParamY,
float &  trackParamDXDZ,
float &  trackParamDYDZ,
float &  trackParamXE,
float &  trackParamYE,
float &  trackParamDXDZE,
float &  trackParamDYDZE 
)

Definition at line 511 of file HitResol.cc.

References TrajectoryMeasurement::backwardPredictedState(), TrajectoryStateCombiner::combine(), change_name::diff, TrajectoryMeasurement::forwardPredictedState(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalParameters(), TrajectoryStateOnSurface::globalPosition(), hitDX, mps_fire::i, TrajectoryStateOnSurface::isValid(), dqmiolumiharvest::j, JacobianCurvilinearToLocal::jacobian(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localParameters(), LogDebug, PV3DBase< T, PVType, FrameType >::mag(), LocalTrajectoryError::matrix(), pairPath, TrackCandidateProducer_cfi::propagator, TrajectoryMeasurement::recHit(), mathSSE::sqrt(), TrajectoryStateOnSurface::surface(), trackDX, trackDXE, trackParamDXDZ, trackParamDXDZE, trackParamDYDZ, trackParamDYDZE, trackParamX, trackParamXE, trackParamY, trackParamYE, and LocalTrajectoryParameters::vector().

Referenced by analyze().

526  {
527  pairPath = 0;
528  hitDX = 0;
529  trackDX = 0;
530  trackDXE = 0;
531 
532  trackParamX = 0;
533  trackParamY = 0;
534  trackParamDXDZ = 0;
535  trackParamDYDZ = 0;
536  trackParamXE = 0;
537  trackParamYE = 0;
538  trackParamDXDZE = 0;
539  trackParamDYDZE = 0;
540 
541  TrajectoryStateCombiner combiner_;
542 
543  // backward predicted state at module 1
544  const TrajectoryStateOnSurface& bwdPred1 = traj1->backwardPredictedState();
545  if (!bwdPred1.isValid())
546  return false;
547  LogDebug("HitResol") << "momentum from backward predicted state = " << bwdPred1.globalMomentum().mag() << endl;
548  // forward predicted state at module 2
549  const TrajectoryStateOnSurface& fwdPred2 = traj2->forwardPredictedState();
550  LogDebug("HitResol") << "momentum from forward predicted state = " << fwdPred2.globalMomentum().mag() << endl;
551  if (!fwdPred2.isValid())
552  return false;
553  // extrapolate fwdPred2 to module 1
554  TrajectoryStateOnSurface fwdPred2At1 = propagator.propagate(fwdPred2, bwdPred1.surface());
555  if (!fwdPred2At1.isValid())
556  return false;
557  // combine fwdPred2At1 with bwdPred1 (ref. state, best estimate without hits 1 and 2)
558  TrajectoryStateOnSurface comb1 = combiner_.combine(bwdPred1, fwdPred2At1);
559  if (!comb1.isValid())
560  return false;
561 
562  //
563  // propagation of reference parameters to module 2
564  //
565  std::pair<TrajectoryStateOnSurface, double> tsosWithS = propagator.propagateWithPath(comb1, fwdPred2.surface());
566  TrajectoryStateOnSurface comb1At2 = tsosWithS.first;
567  if (!comb1At2.isValid())
568  return false;
569  //distance of propagation from one surface to the next==could cut here
570  pairPath = tsosWithS.second;
571  if (TMath::Abs(pairPath) > 15)
572  return false; //cut to remove hit pairs > 15 cm apart
573 
574  // local parameters and errors on module 1
575  AlgebraicVector5 pars = comb1.localParameters().vector();
576  AlgebraicSymMatrix55 errs = comb1.localError().matrix();
577  //number 3 is predX
578  double predX1 = pars[3];
579  //track fitted parameters in local coordinates for position 0
580  (trackParamX) = pars[3];
581  (trackParamY) = pars[4];
582  (trackParamDXDZ) = pars[1];
583  (trackParamDYDZ) = pars[2];
584  (trackParamXE) = TMath::Sqrt(errs(3, 3));
585  (trackParamYE) = TMath::Sqrt(errs(4, 4));
586  (trackParamDXDZE) = TMath::Sqrt(errs(1, 1));
587  (trackParamDYDZE) = TMath::Sqrt(errs(2, 2));
588 
589  // local parameters and errors on module 2
590  pars = comb1At2.localParameters().vector();
591  errs = comb1At2.localError().matrix();
592  double predX2 = pars[3];
593 
597  JacobianLocalToCurvilinear jacLocToCurv(comb1.surface(), comb1.localParameters(), *magField_);
598  AnalyticalCurvilinearJacobian jacCurvToCurv(
599  comb1.globalParameters(), comb1At2.globalPosition(), comb1At2.globalMomentum(), tsosWithS.second);
600  JacobianCurvilinearToLocal jacCurvToLoc(comb1At2.surface(), comb1At2.localParameters(), *magField_);
601  // combined jacobian local-1-to-local-2
602  AlgebraicMatrix55 jacobian = jacLocToCurv.jacobian() * jacCurvToCurv.jacobian() * jacCurvToLoc.jacobian();
603  // covariance on module 1
604  AlgebraicSymMatrix55 covComb1 = comb1.localError().matrix();
605  // variance and correlations for predicted local_x on modules 1 and 2
606  double c00 = covComb1(3, 3);
607  double c10(0.);
608  double c11(0.);
609  for (int i = 1; i < 5; ++i) {
610  c10 += jacobian(3, i) * covComb1(i, 3);
611  for (int j = 1; j < 5; ++j)
612  c11 += jacobian(3, i) * covComb1(i, j) * jacobian(3, j);
613  }
614  // choose relative sign in order to minimize error on difference
615  double diff = c00 - 2 * fabs(c10) + c11;
616  diff = diff > 0 ? sqrt(diff) : -sqrt(-diff);
617  (trackDXE) = diff;
618  double relativeXSign_ = c10 > 0 ? -1 : 1;
619 
620  (trackDX) = predX1 + relativeXSign_ * predX2;
621 
622  double recHitX_1 = traj1->recHit()->localPosition().x();
623  double recHitX_2 = traj2->recHit()->localPosition().x();
624 
625  (hitDX) = recHitX_1 + relativeXSign_ * recHitX_2;
626 
627  return true;
628 }
const LocalTrajectoryError & localError() const
float trackDX
Definition: HitResol.h:139
float trackParamDYDZE
Definition: HitResol.h:148
float pairPath
Definition: HitResol.h:124
float trackParamDYDZ
Definition: HitResol.h:146
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
const GlobalTrajectoryParameters & globalParameters() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
const LocalTrajectoryParameters & localParameters() const
const SurfaceType & surface() const
float trackParamXE
Definition: HitResol.h:143
float trackParamX
Definition: HitResol.h:141
float trackParamYE
Definition: HitResol.h:144
float trackDXE
Definition: HitResol.h:140
GlobalPoint globalPosition() const
T sqrt(T t)
Definition: SSEVec.h:23
AlgebraicVector5 vector() const
float trackParamDXDZ
Definition: HitResol.h:145
T mag() const
Definition: PV3DBase.h:64
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
ROOT::Math::SVector< double, 5 > AlgebraicVector5
const AlgebraicMatrix55 & jacobian() const
float hitDX
Definition: HitResol.h:138
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
GlobalVector globalMomentum() const
float trackParamDXDZE
Definition: HitResol.h:147
const AlgebraicSymMatrix55 & matrix() const
float trackParamY
Definition: HitResol.h:142
TSOS combine(const TSOS &pTsos1, const TSOS &pTsos2) const
ConstRecHitPointer const & recHit() const
#define LogDebug(id)

◆ getSimHitRes()

void HitResol::getSimHitRes ( const GeomDetUnit det,
const LocalVector trackdirection,
const TrackingRecHit recHit,
float &  trackWidth,
float *  pitch,
LocalVector drift 
)

Definition at line 468 of file HitResol.cc.

References shallow::drift(), position, rpcPointValidation_cfi::recHit, funct::tan(), thickness, trackWidth, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by analyze().

473  {
474  const auto stripdet = dynamic_cast<const StripGeomDetUnit*>(det);
475  const auto& topol = dynamic_cast<const StripTopology&>(stripdet->topology());
476 
477  LocalPoint position = recHit.localPosition();
478  (*pitch) = topol.localPitch(position);
479 
480  float anglealpha = 0;
481  if (trackdirection.z() != 0) {
482  anglealpha = atan(trackdirection.x() / trackdirection.z()) * TMath::RadToDeg();
483  }
484 
485  // LocalVector drift = stripcpe.driftDirection(stripdet);
486  float thickness = stripdet->surface().bounds().thickness();
487  float tanalpha = tan(anglealpha * TMath::DegToRad());
488  float tanalphaL = drift.x() / drift.z();
489  (trackWidth) = fabs((thickness / (*pitch)) * tanalpha - (thickness / (*pitch)) * tanalphaL);
490 }
T z() const
Definition: PV3DBase.h:61
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:36
float thickness
Definition: HitResol.h:131
T x() const
Definition: PV3DBase.h:59
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
float trackWidth
Definition: HitResol.h:133
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ getSimpleRes()

double HitResol::getSimpleRes ( const TrajectoryMeasurement traj1)

Definition at line 492 of file HitResol.cc.

References TrajectoryMeasurement::backwardPredictedState(), TrajectoryStateCombiner::combine(), TrajectoryMeasurement::forwardPredictedState(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localPosition(), TrajectoryMeasurement::recHit(), and PV3DBase< T, PVType, FrameType >::x().

Referenced by analyze().

492  {
493  TrajectoryStateOnSurface theCombinedPredictedState;
494 
495  if (traj1->backwardPredictedState().isValid())
496  theCombinedPredictedState =
498  else
499  theCombinedPredictedState = traj1->forwardPredictedState();
500 
501  if (!theCombinedPredictedState.isValid()) {
502  return -100;
503  }
504 
505  const TransientTrackingRecHit::ConstRecHitPointer& firstRecHit = traj1->recHit();
506  double recHitX_1 = firstRecHit->localPosition().x();
507  return (theCombinedPredictedState.localPosition().x() - recHitX_1);
508 }
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
T x() const
Definition: PV3DBase.h:59
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
TSOS combine(const TSOS &pTsos1, const TSOS &pTsos2) const
ConstRecHitPointer const & recHit() const

Member Data Documentation

◆ addLumi_

const bool HitResol::addLumi_
private

Definition at line 85 of file HitResol.h.

◆ atEdge

float HitResol::atEdge
private

Definition at line 135 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ atEdge_2

float HitResol::atEdge_2
private

Definition at line 136 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ clusterCharge

unsigned int HitResol::clusterCharge
private

Definition at line 119 of file HitResol.h.

◆ clusterCharge_2

unsigned int HitResol::clusterCharge_2
private

Definition at line 120 of file HitResol.h.

◆ clusterWidth

unsigned int HitResol::clusterWidth
private

Definition at line 117 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ clusterWidth_2

unsigned int HitResol::clusterWidth_2
private

Definition at line 118 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ cmToUm

constexpr float HitResol::cmToUm = 10000.f
staticprivate

Definition at line 100 of file HitResol.h.

◆ combinatorialTracks_token_

const edm::EDGetTokenT<reco::TrackCollection> HitResol::combinatorialTracks_token_
private

Definition at line 73 of file HitResol.h.

Referenced by analyze().

◆ compSettings_

const int HitResol::compSettings_
private

Definition at line 89 of file HitResol.h.

Referenced by beginJob().

◆ cpeToken_

Definition at line 80 of file HitResol.h.

Referenced by analyze().

◆ cutOnTracks_

const bool HitResol::cutOnTracks_
private

Definition at line 87 of file HitResol.h.

◆ DEBUG_

const bool HitResol::DEBUG_
private

Definition at line 86 of file HitResol.h.

◆ driftAlpha

float HitResol::driftAlpha
private

Definition at line 129 of file HitResol.h.

◆ driftAlpha_2

float HitResol::driftAlpha_2
private

Definition at line 130 of file HitResol.h.

◆ events

int HitResol::events
private

◆ EventTrackCKF

int HitResol::EventTrackCKF
private

Definition at line 103 of file HitResol.h.

Referenced by beginJob(), and endJob().

◆ expWidth

float HitResol::expWidth
private

Definition at line 127 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ expWidth_2

float HitResol::expWidth_2
private

Definition at line 128 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ geomToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> HitResol::geomToken_
private

Definition at line 79 of file HitResol.h.

Referenced by analyze().

◆ histos2d_

std::map<TString, TH2F*> HitResol::histos2d_
private

Definition at line 97 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ hitDX

float HitResol::hitDX
private

Definition at line 138 of file HitResol.h.

Referenced by analyze(), beginJob(), and getPairParameters().

◆ iidd1

unsigned int HitResol::iidd1
private

Definition at line 121 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ iidd2

unsigned int HitResol::iidd2
private

Definition at line 122 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ layers_

const unsigned int HitResol::layers_
private

Definition at line 91 of file HitResol.h.

◆ magFieldToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> HitResol::magFieldToken_
private

Definition at line 82 of file HitResol.h.

Referenced by analyze().

◆ momentumCut_

const double HitResol::momentumCut_
private

Definition at line 88 of file HitResol.h.

Referenced by analyze().

◆ mymom

float HitResol::mymom
private

Definition at line 107 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ mypitch1

float HitResol::mypitch1
private

Definition at line 125 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ mypitch2

float HitResol::mypitch2
private

Definition at line 126 of file HitResol.h.

◆ N1

float HitResol::N1
private

Definition at line 155 of file HitResol.h.

◆ N1uProj

float HitResol::N1uProj
private

Definition at line 157 of file HitResol.h.

◆ N2

float HitResol::N2
private

Definition at line 156 of file HitResol.h.

◆ N2uProj

float HitResol::N2uProj
private

Definition at line 158 of file HitResol.h.

◆ Nstrips

int HitResol::Nstrips
private

Definition at line 159 of file HitResol.h.

Referenced by analyze().

◆ Nstrips_2

int HitResol::Nstrips_2
private

Definition at line 160 of file HitResol.h.

Referenced by analyze().

◆ NumberOf_tracks

int HitResol::NumberOf_tracks
private

Definition at line 109 of file HitResol.h.

Referenced by beginJob().

◆ numHits

int HitResol::numHits
private

Definition at line 108 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ pairPath

float HitResol::pairPath
private

Definition at line 124 of file HitResol.h.

Referenced by analyze(), beginJob(), and getPairParameters().

◆ pairsOnly

unsigned int HitResol::pairsOnly
private

Definition at line 123 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ ProbTrackChi2

float HitResol::ProbTrackChi2
private

Definition at line 110 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ reso

TTree* HitResol::reso
private

Definition at line 95 of file HitResol.h.

Referenced by analyze(), beginJob(), and endJob().

◆ scalerToken_

const edm::EDGetTokenT<LumiScalersCollection> HitResol::scalerToken_
private

Definition at line 72 of file HitResol.h.

◆ simpleRes

float HitResol::simpleRes
private

Definition at line 137 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ siStripQualityToken_

const edm::ESGetToken<SiStripQuality, SiStripQualityRcd> HitResol::siStripQualityToken_
private

Definition at line 81 of file HitResol.h.

Referenced by analyze().

◆ StripCPE1_smp_pos_error

float HitResol::StripCPE1_smp_pos_error
private

Definition at line 111 of file HitResol.h.

◆ StripCPE2_smp_pos_error

float HitResol::StripCPE2_smp_pos_error
private

Definition at line 112 of file HitResol.h.

◆ StripErrorSquared1

float HitResol::StripErrorSquared1
private

Definition at line 113 of file HitResol.h.

◆ StripErrorSquared2

float HitResol::StripErrorSquared2
private

Definition at line 114 of file HitResol.h.

◆ thickness

float HitResol::thickness
private

Definition at line 131 of file HitResol.h.

Referenced by getSimHitRes().

◆ thickness_2

float HitResol::thickness_2
private

Definition at line 132 of file HitResol.h.

◆ tjToken_

const edm::EDGetTokenT<std::vector<Trajectory> > HitResol::tjToken_
private

Definition at line 74 of file HitResol.h.

Referenced by analyze().

◆ tkToken_

const edm::EDGetTokenT<reco::TrackCollection> HitResol::tkToken_
private

Definition at line 75 of file HitResol.h.

◆ topoToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> HitResol::topoToken_
private

Definition at line 78 of file HitResol.h.

Referenced by analyze().

◆ track_eta

float HitResol::track_eta
private

Definition at line 151 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ track_momentum

float HitResol::track_momentum
private

Definition at line 149 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ track_phi

float HitResol::track_phi
private

Definition at line 153 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ track_pt

float HitResol::track_pt
private

Definition at line 150 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ track_trackChi2

float HitResol::track_trackChi2
private

Definition at line 154 of file HitResol.h.

Referenced by analyze(), and beginJob().

◆ track_width

float HitResol::track_width
private

Definition at line 152 of file HitResol.h.

◆ trackDX

float HitResol::trackDX
private

Definition at line 139 of file HitResol.h.

Referenced by analyze(), beginJob(), and getPairParameters().

◆ trackDXE

float HitResol::trackDXE
private

Definition at line 140 of file HitResol.h.

Referenced by analyze(), beginJob(), and getPairParameters().

◆ trackMultiplicityCut_

const unsigned int HitResol::trackMultiplicityCut_
private

Definition at line 92 of file HitResol.h.

◆ trackParamDXDZ

float HitResol::trackParamDXDZ
private

Definition at line 145 of file HitResol.h.

Referenced by analyze(), beginJob(), and getPairParameters().

◆ trackParamDXDZE

float HitResol::trackParamDXDZE
private

Definition at line 147 of file HitResol.h.

Referenced by analyze(), beginJob(), and getPairParameters().

◆ trackParamDYDZ

float HitResol::trackParamDYDZ
private

Definition at line 146 of file HitResol.h.

Referenced by analyze(), beginJob(), and getPairParameters().

◆ trackParamDYDZE

float HitResol::trackParamDYDZE
private

Definition at line 148 of file HitResol.h.

Referenced by analyze(), beginJob(), and getPairParameters().

◆ trackParamX

float HitResol::trackParamX
private

Definition at line 141 of file HitResol.h.

Referenced by analyze(), beginJob(), and getPairParameters().

◆ trackParamXE

float HitResol::trackParamXE
private

Definition at line 143 of file HitResol.h.

Referenced by analyze(), beginJob(), and getPairParameters().

◆ trackParamY

float HitResol::trackParamY
private

Definition at line 142 of file HitResol.h.

Referenced by analyze(), beginJob(), and getPairParameters().

◆ trackParamYE

float HitResol::trackParamYE
private

Definition at line 144 of file HitResol.h.

Referenced by analyze(), beginJob(), and getPairParameters().

◆ trackWidth

float HitResol::trackWidth
private

Definition at line 133 of file HitResol.h.

Referenced by getSimHitRes().

◆ trackWidth_2

float HitResol::trackWidth_2
private

Definition at line 134 of file HitResol.h.

◆ treso

TTree* HitResol::treso
private

Definition at line 96 of file HitResol.h.

Referenced by analyze(), beginJob(), and endJob().

◆ uerr2

float HitResol::uerr2
private

Definition at line 115 of file HitResol.h.

◆ uerr2_2

float HitResol::uerr2_2
private

Definition at line 116 of file HitResol.h.

◆ usePairsOnly_

const unsigned int HitResol::usePairsOnly_
private

Definition at line 90 of file HitResol.h.

Referenced by analyze().