CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
OverlapValidation Class Reference
Inheritance diagram for OverlapValidation:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 OverlapValidation (const edm::ParameterSet &)
 
 ~OverlapValidation () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const 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
 
bool wantsStreamRuns () const
 
 ~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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef
TransientTrackingRecHit::ConstRecHitPointer 
ConstRecHitPointer
 
typedef vector< TrajectoryTrajectoryCollection
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void analyzeTrajectory (const Trajectory &, const Propagator &, TrackerHitAssociator &, const TrackerTopology *const tTopo)
 
void endJob () override
 
int layerFromId (const DetId &, const TrackerTopology *const tTopo) const
 

Private Attributes

vector< bool > acceptLayer
 
const bool addExtraBranches_
 
bool barrelOnly_
 
float chi2_ [2]
 
const float chi2ProbCut_
 
uint clusterCharge_ [2]
 
float clusterSize_ [2]
 
float clusterWidthX_ [2]
 
float clusterWidthY_ [2]
 
TrajectoryStateCombiner combiner_
 
const int compressionSettings_
 
edm::ParameterSet config_
 
SiStripDetInfo detInfo_
 
bool doSimHit_
 
int edge_ [2]
 
uint event_
 
edm::FileInPath FileInPath_
 
const edm::ESGetToken
< TrackerGeometry,
TrackerDigiGeometryRecord
geomToken_
 
unsigned short hitCounts_ [2]
 
float hitErrors_ [2]
 
float hitErrorsY_ [2]
 
float hitPositions_ [2]
 
float hitPositionsY_ [2]
 
uint layer_
 
float localxdotglobalphi_ [2]
 
float localxdotglobalr_ [2]
 
float localxdotglobalx_ [2]
 
float localxdotglobaly_ [2]
 
float localxdotglobalz_ [2]
 
float localydotglobalphi_ [2]
 
float localydotglobalr_ [2]
 
float localydotglobalx_ [2]
 
float localydotglobaly_ [2]
 
float localydotglobalz_ [2]
 
const MagneticFieldmagField_
 
const edm::ESGetToken
< MagneticField,
IdealMagneticFieldRecord
magFieldToken_
 
const int minHitsCut_
 
float moduleX_ [2]
 
float moduleY_ [2]
 
float moduleZ_ [2]
 
float momentum_
 
const Point2DBase< float,
LocalTag
onezero = Point2DBase<float, LocalTag>(1, 0)
 
int overlapCounts_ [3]
 
unsigned int overlapIds_ [2]
 
float overlapPath_
 
float predictedDeltaXError_
 
float predictedDeltaYError_
 
float predictedLocalErrors_ [5][2]
 
float predictedLocalParameters_ [5][2]
 
float predictedPositions_ [3][2]
 
char relativeXSign_
 
char relativeYSign_
 
TTree * rootTree_
 
uint run_
 
float simHitPositions_ [2]
 
float simHitPositionsY_ [2]
 
int subdetID
 
const edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
topoToken_
 
const TrackerGeometrytrackerGeometry_
 
edm::InputTag trajectoryTag_
 
edm::EDGetTokenT
< TrajectoryCollection
trajectoryToken_
 
const Point2DBase< float,
LocalTag
zeroone = Point2DBase<float, LocalTag>(0, 1)
 
const Point2DBase< float,
LocalTag
zerozero = Point2DBase<float, LocalTag>(0, 0)
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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< B > consumes (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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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 () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
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 88 of file OverlapValidation.cc.

Member Typedef Documentation

Definition at line 97 of file OverlapValidation.cc.

Definition at line 94 of file OverlapValidation.cc.

Constructor & Destructor Documentation

OverlapValidation::OverlapValidation ( const edm::ParameterSet iConfig)
explicit

Definition at line 192 of file OverlapValidation.cc.

References acceptLayer, addExtraBranches_, barrelOnly_, chi2_, clusterCharge_, clusterSize_, clusterWidthX_, clusterWidthY_, compressionSettings_, edm::ConsumesCollector::consumes(), edm::EDConsumerBase::consumesCollector(), detInfo_, doSimHit_, edge_, event_, TFileService::file(), FileInPath_, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), hitCounts_, hitErrors_, hitErrorsY_, hitPositions_, hitPositionsY_, layer_, localxdotglobalphi_, localxdotglobalr_, localxdotglobalx_, localxdotglobaly_, localxdotglobalz_, localydotglobalphi_, localydotglobalr_, localydotglobalx_, localydotglobaly_, localydotglobalz_, moduleX_, moduleY_, moduleZ_, momentum_, overlapCounts_, overlapIds_, overlapPath_, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, predictedDeltaXError_, predictedDeltaYError_, predictedLocalErrors_, predictedLocalParameters_, predictedPositions_, SiStripDetInfoFileReader::read(), relativeXSign_, relativeYSign_, rootTree_, run_, simHitPositions_, simHitPositionsY_, subdetID, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, trajectoryTag_, and trajectoryToken_.

193  : geomToken_(esConsumes()),
196  config_(iConfig),
197  rootTree_(nullptr),
199  compressionSettings_(iConfig.getUntrackedParameter<int>("compressionSettings", -1)),
200  addExtraBranches_(false),
201  minHitsCut_(6),
202  chi2ProbCut_(0.001) {
204  //now do what ever initialization is needed
205  trajectoryTag_ = iConfig.getParameter<edm::InputTag>("trajectories");
207  doSimHit_ = iConfig.getParameter<bool>("associateStrip");
209 
210  overlapCounts_[0] = 0; // #trajectories
211  overlapCounts_[1] = 0; // #hits
212  overlapCounts_[2] = 0; // #overlap hits
213  acceptLayer.resize(7, false);
214  acceptLayer[PixelSubdetector::PixelBarrel] = iConfig.getParameter<bool>("usePXB");
215  acceptLayer[PixelSubdetector::PixelEndcap] = iConfig.getParameter<bool>("usePXF");
216  acceptLayer[StripSubdetector::TIB] = iConfig.getParameter<bool>("useTIB");
217  acceptLayer[StripSubdetector::TOB] = iConfig.getParameter<bool>("useTOB");
218  acceptLayer[StripSubdetector::TID] = iConfig.getParameter<bool>("useTID");
219  acceptLayer[StripSubdetector::TEC] = iConfig.getParameter<bool>("useTEC");
220  barrelOnly_ = iConfig.getParameter<bool>("barrelOnly");
221 
223  //
224  // root output
225  //
226  if (compressionSettings_ > 0) {
227  fs->file().SetCompressionSettings(compressionSettings_);
228  }
229 
230  rootTree_ = fs->make<TTree>("Overlaps", "Overlaps");
231  if (addExtraBranches_) {
232  rootTree_->Branch("hitCounts", hitCounts_, "found/s:lost/s");
233  rootTree_->Branch("chi2", chi2_, "chi2/F:ndf/F");
234  rootTree_->Branch("path", &overlapPath_, "path/F");
235  }
236  rootTree_->Branch("layer", &layer_, "layer/i");
237  rootTree_->Branch("detids", overlapIds_, "id[2]/i");
238  rootTree_->Branch("predPos", predictedPositions_, "gX[2]/F:gY[2]/F:gZ[2]/F");
239  rootTree_->Branch("predPar", predictedLocalParameters_, "predQP[2]/F:predDX[2]/F:predDY[2]/F:predX[2]/F:predY[2]/F");
240  rootTree_->Branch("predErr", predictedLocalErrors_, "predEQP[2]/F:predEDX[2]/F:predEDY[2]/F:predEX[2]/F:predEY[2]/F");
241  rootTree_->Branch("predEDeltaX", &predictedDeltaXError_, "sigDeltaX/F");
242  rootTree_->Branch("predEDeltaY", &predictedDeltaYError_, "sigDeltaY/F");
243  rootTree_->Branch("relSignX", &relativeXSign_, "relSignX/B");
244  rootTree_->Branch("relSignY", &relativeYSign_, "relSignY/B");
245  rootTree_->Branch("hitX", hitPositions_, "hitX[2]/F");
246  rootTree_->Branch("hitEX", hitErrors_, "hitEX[2]/F");
247  rootTree_->Branch("hitY", hitPositionsY_, "hitY[2]/F");
248  rootTree_->Branch("hitEY", hitErrorsY_, "hitEY[2]/F");
249  if (addExtraBranches_) {
250  rootTree_->Branch("simX", simHitPositions_, "simX[2]/F");
251  rootTree_->Branch("simY", simHitPositionsY_, "simY[2]/F");
252  rootTree_->Branch("clusterSize", clusterSize_, "clusterSize[2]/F");
253  rootTree_->Branch("clusterWidthX", clusterWidthX_, "clusterWidthX[2]/F");
254  rootTree_->Branch("clusterWidthY", clusterWidthY_, "clusterWidthY[2]/F");
255  rootTree_->Branch("clusterCharge", clusterCharge_, "clusterCharge[2]/i");
256  rootTree_->Branch("edge", edge_, "edge[2]/I");
257  }
258  rootTree_->Branch("momentum", &momentum_, "momentum/F");
259  rootTree_->Branch("run", &run_, "run/i");
260  rootTree_->Branch("event", &event_, "event/i");
261  rootTree_->Branch("subdetID", &subdetID, "subdetID/I");
262  rootTree_->Branch("moduleX", moduleX_, "moduleX[2]/F");
263  rootTree_->Branch("moduleY", moduleY_, "moduleY[2]/F");
264  rootTree_->Branch("moduleZ", moduleZ_, "moduleZ[2]/F");
265  rootTree_->Branch("localxdotglobalphi", localxdotglobalphi_, "localxdotglobalphi[2]/F");
266  rootTree_->Branch("localxdotglobalr", localxdotglobalr_, "localxdotglobalr[2]/F");
267  rootTree_->Branch("localxdotglobalz", localxdotglobalz_, "localxdotglobalz[2]/F");
268  rootTree_->Branch("localxdotglobalx", localxdotglobalx_, "localxdotglobalx[2]/F");
269  rootTree_->Branch("localxdotglobaly", localxdotglobaly_, "localxdotglobaly[2]/F");
270  rootTree_->Branch("localydotglobalphi", localydotglobalphi_, "localydotglobalphi[2]/F");
271  rootTree_->Branch("localydotglobalr", localydotglobalr_, "localydotglobalr[2]/F");
272  rootTree_->Branch("localydotglobalz", localydotglobalz_, "localydotglobalz[2]/F");
273  rootTree_->Branch("localydotglobalx", localydotglobalx_, "localydotglobalx[2]/F");
274  rootTree_->Branch("localydotglobaly", localydotglobaly_, "localydotglobaly[2]/F");
275 }
edm::InputTag trajectoryTag_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
static constexpr auto TEC
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< TrajectoryCollection > trajectoryToken_
unsigned int overlapIds_[2]
vector< bool > acceptLayer
const bool addExtraBranches_
float predictedPositions_[3][2]
unsigned short hitCounts_[2]
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
SiStripDetInfo detInfo_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
SiStripDetInfo read(std::string filePath)
float predictedLocalErrors_[5][2]
static constexpr auto TOB
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
TFile & file() const
return opened TFile
Definition: TFileService.h:37
float predictedLocalParameters_[5][2]
static constexpr auto TIB
edm::FileInPath FileInPath_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const int compressionSettings_
edm::ParameterSet config_
std::vector< Trajectory > TrajectoryCollection
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
std::string fullPath() const
Definition: FileInPath.cc:161
static constexpr char const *const kDefaultFile
static constexpr auto TID
OverlapValidation::~OverlapValidation ( )
override

Definition at line 277 of file OverlapValidation.cc.

References overlapCounts_, and w.

277  {
278  edm::LogWarning w("Overlaps");
279  // do anything here that needs to be done at desctruction time
280  // (e.g. close files, deallocate resources etc.)
281 
282  w << "Counters =";
283  w << " Number of tracks: " << overlapCounts_[0];
284  w << " Number of valid hits: " << overlapCounts_[1];
285  w << " Number of overlaps: " << overlapCounts_[2];
286 }
const double w
Definition: UKUtility.cc:23

Member Function Documentation

void OverlapValidation::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 293 of file OverlapValidation.cc.

References AnalyticalPropagator_cfi::AnalyticalPropagator, analyzeTrajectory(), anyDirection, config_, edm::EDConsumerBase::consumesCollector(), doSimHit_, edm::EventID::event(), event_, geomToken_, edm::Event::getByToken(), edm::EventSetup::getData(), edm::EventBase::id(), magField_, magFieldToken_, HLT_FULL_cff::propagator, edm::EventID::run(), run_, topoToken_, trackerGeometry_, and trajectoryToken_.

293  {
294  using namespace edm;
295  //
296  // mag field & search tracker
297  //
298  magField_ = &iSetup.getData(magFieldToken_);
299  //
300  // propagator
301  //
303  //
304  // geometry
305  //
307  //
308  // make associator for SimHits
309  //
310  TrackerHitAssociator* associator;
311  if (doSimHit_) {
313  associator = new TrackerHitAssociator(iEvent, hitassociatorconfig);
314  } else {
315  associator = nullptr;
316  }
317 
318  //if(doSimHit_) associator = new TrackerHitAssociator(iEvent, config_); else associator = 0;
319 
320  //
321  // trajectories (from refit)
322  //
323  //typedef vector<Trajectory> TrajectoryCollection;
324  edm::Handle<TrajectoryCollection> trajectoryCollectionHandle;
325  iEvent.getByToken(trajectoryToken_, trajectoryCollectionHandle);
326  const TrajectoryCollection* const trajectoryCollection = trajectoryCollectionHandle.product();
327 
328  //
329  // loop over trajectories from refit
330  const TrackerTopology* const tTopo = &iSetup.getData(topoToken_);
331  for (const auto& trajectory : *trajectoryCollection)
332  analyzeTrajectory(trajectory, propagator, *associator, tTopo);
333 
334  run_ = iEvent.id().run();
335  event_ = iEvent.id().event();
336 }
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
tuple propagator
edm::EDGetTokenT< TrajectoryCollection > trajectoryToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
const MagneticField * magField_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
virtual void analyzeTrajectory(const Trajectory &, const Propagator &, TrackerHitAssociator &, const TrackerTopology *const tTopo)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
const TrackerGeometry * trackerGeometry_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
edm::ParameterSet config_
std::vector< Trajectory > TrajectoryCollection
edm::EventID id() const
Definition: EventBase.h:59
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
void OverlapValidation::analyzeTrajectory ( const Trajectory trajectory,
const Propagator propagator,
TrackerHitAssociator associator,
const TrackerTopology *const  tTopo 
)
privatevirtual

Definition at line 338 of file OverlapValidation.cc.

References funct::abs(), acceptLayer, TrackerHitAssociator::associateHit(), barrelOnly_, RecoTauCleanerPlugins::charge, chi2_, chi2ProbCut_, Trajectory::chiSquared(), ChiSquaredProbability(), SiStripRecHit1D::cluster(), SiPixelRecHit::cluster(), clusterCharge_, clusterSize_, clusterWidthX_, clusterWidthY_, TrajectoryStateCombiner::combine(), combiner_, detInfo_, change_name::diff, doSimHit_, edge_, Trajectory::foundHits(), SiStripDetInfo::getNumberOfApvsAndStripLength(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalParameters(), TrajectoryStateOnSurface::globalPosition(), SiStripDetId::glued(), runTauDisplay::gp, hitCounts_, hitErrors_, hitErrorsY_, hitPositions_, hitPositionsY_, mps_fire::i, PixelTopology::isItEdgePixelInX(), PixelTopology::isItEdgePixelInY(), TrajectoryStateOnSurface::isValid(), dqmiolumiharvest::j, JacobianCurvilinearToLocal::jacobian(), phase1PixelTopology::layer, layer_, layerFromId(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localParameters(), localxdotglobalphi_, localxdotglobalr_, localxdotglobalx_, localxdotglobaly_, localxdotglobalz_, localydotglobalphi_, localydotglobalr_, localydotglobalx_, localydotglobaly_, localydotglobalz_, Trajectory::lostHits(), visualization-live-secondInstance_cfg::m, PV3DBase< T, PVType, FrameType >::mag(), magField_, LocalTrajectoryError::matrix(), Trajectory::measurements(), minHitsCut_, moduleX_, moduleY_, moduleZ_, momentum_, GluedGeomDet::monoDet(), Trajectory::ndof(), onezero, overlapCounts_, overlapIds_, overlapPath_, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, position, predictedDeltaXError_, predictedDeltaYError_, predictedLocalErrors_, predictedLocalParameters_, predictedPositions_, Propagator::propagate(), Propagator::propagateWithPath(), DetId::rawId(), relativeXSign_, relativeYSign_, rootTree_, pileupReCalc_HLTpaths::scale, simHitPositions_, simHitPositionsY_, findQualityFiles::size, PixelGeomDetUnit::specificTopology(), mathSSE::sqrt(), SiStripDetId::stereo(), DetId::subdetId(), subdetID, GeomDet::surface(), TrajectoryStateOnSurface::surface(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, Surface::toGlobal(), GloballyPositioned< T >::toLocal(), parallelization::uint(), LocalTrajectoryParameters::vector(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), zeroone, and zerozero.

Referenced by analyze().

341  {
342  typedef std::pair<const TrajectoryMeasurement*, const TrajectoryMeasurement*> Overlap;
343  typedef vector<Overlap> OverlapContainer;
344  ++overlapCounts_[0];
345 
346  OverlapContainer overlapHits;
347 
348  // quality cuts on trajectory
349  // min. # hits / matched hits
350 
351  if (trajectory.foundHits() < minHitsCut_)
352  return;
353  if (ChiSquaredProbability((double)(trajectory.chiSquared()), (double)(trajectory.ndof(false))) < chi2ProbCut_)
354  return;
355  //
356  // loop over measurements in the trajectory and calculate residuals
357  //
358 
359  vector<TrajectoryMeasurement> measurements(trajectory.measurements());
360  for (vector<TrajectoryMeasurement>::const_iterator itm = measurements.begin(); itm != measurements.end(); ++itm) {
361  //
362  // skip "invalid" (i.e. missing) hits
363  //
364  ConstRecHitPointer hit = itm->recHit();
365  DetId id = hit->geographicalId();
366  int layer(layerFromId(id, tTopo));
367  int subDet = id.subdetId();
368 
369  if (!hit->isValid()) {
370  edm::LogVerbatim("OverlapValidation") << "Invalid";
371  continue;
372  }
373  if (barrelOnly_ && (subDet == StripSubdetector::TID || subDet == StripSubdetector::TEC))
374  return;
375 
376  //edm::LogVerbatim("OverlapValidation") << "Check " <<subDet << ", layer = " << layer<<" stereo: "<< ((subDet > 2)?(SiStripDetId(id).stereo()):2);
377  //cout << "Check SubID " <<subDet << ", layer = " << layer<<" stereo: "<< ((subDet > 2)?(SiStripDetId(id).stereo()):2) << endl;
378 
379  //
380  // check for overlap: same subdet-id && layer number for
381  // two consecutive hits
382  //
383  ++overlapCounts_[1];
384  if ((layer != -1) && (acceptLayer[subDet])) {
385  for (vector<TrajectoryMeasurement>::const_iterator itmCompare = itm - 1;
386  itmCompare >= measurements.begin() && itmCompare > itm - 4;
387  --itmCompare) {
388  DetId compareId = itmCompare->recHit()->geographicalId();
389 
390  if (subDet != compareId.subdetId() || layer != layerFromId(compareId, tTopo))
391  break;
392  if (!itmCompare->recHit()->isValid())
393  continue;
394  if ((subDet == PixelSubdetector::PixelBarrel || subDet == PixelSubdetector::PixelEndcap) ||
395  (SiStripDetId(id).stereo() == SiStripDetId(compareId).stereo())) {
396  overlapHits.push_back(std::make_pair(&(*itmCompare), &(*itm)));
397  //edm::LogVerbatim("OverlapValidation") << "adding pair "<< ((subDet > 2)?(SiStripDetId(id).stereo()) : 2)
398  // << " from layer = " << layer;
399  //cout << "adding pair "<< ((subDet > 2)?(SiStripDetId(id).stereo()) : 2) << " from subDet = " << subDet << " and layer = " << layer;
400  //cout << " \t"<<run_<< "\t"<<event_<<"\t";
401  //cout << min(id.rawId(),compareId.rawId())<<"\t"<<max(id.rawId(),compareId.rawId())<<endl;
402  if (SiStripDetId(id).glued() == id.rawId())
403  edm::LogInfo("Overlaps") << "BAD GLUED: Have glued layer with id = " << id.rawId()
404  << " and glued id = " << SiStripDetId(id).glued()
405  << " and stereo = " << SiStripDetId(id).stereo() << endl;
406  if (SiStripDetId(compareId).glued() == compareId.rawId())
407  edm::LogInfo("Overlaps") << "BAD GLUED: Have glued layer with id = " << compareId.rawId()
408  << " and glued id = " << SiStripDetId(compareId).glued()
409  << " and stereo = " << SiStripDetId(compareId).stereo() << endl;
410  break;
411  }
412  }
413  }
414  }
415 
416  //
417  // Loop over all overlap pairs.
418  //
419  hitCounts_[0] = trajectory.foundHits();
420  hitCounts_[1] = trajectory.lostHits();
421  chi2_[0] = trajectory.chiSquared();
422  chi2_[1] = trajectory.ndof(false);
423 
424  for (const auto& overlapHit : overlapHits) {
425  //
426  // create reference state @ module 1 (no info from overlap hits)
427  //
428  ++overlapCounts_[2];
429  // backward predicted state at module 1
430  TrajectoryStateOnSurface bwdPred1 = overlapHit.first->backwardPredictedState();
431  if (!bwdPred1.isValid())
432  continue;
433  //cout << "momentum from backward predicted state = " << bwdPred1.globalMomentum().mag() << endl;
434  // forward predicted state at module 2
435  TrajectoryStateOnSurface fwdPred2 = overlapHit.second->forwardPredictedState();
436  //cout << "momentum from forward predicted state = " << fwdPred2.globalMomentum().mag() << endl;
437  if (!fwdPred2.isValid())
438  continue;
439  // extrapolate fwdPred2 to module 1
440  TrajectoryStateOnSurface fwdPred2At1 = propagator.propagate(fwdPred2, bwdPred1.surface());
441  if (!fwdPred2At1.isValid())
442  continue;
443  // combine fwdPred2At1 with bwdPred1 (ref. state, best estimate without hits 1 and 2)
444  TrajectoryStateOnSurface comb1 = combiner_.combine(bwdPred1, fwdPred2At1);
445  if (!comb1.isValid())
446  continue;
447  //
448  // propagation of reference parameters to module 2
449  //
450  std::pair<TrajectoryStateOnSurface, double> tsosWithS = propagator.propagateWithPath(comb1, fwdPred2.surface());
451  TrajectoryStateOnSurface comb1At2 = tsosWithS.first;
452  if (!comb1At2.isValid())
453  continue;
454  //distance of propagation from one surface to the next==could cut here
455  overlapPath_ = tsosWithS.second;
456  if (abs(overlapPath_) > 15)
457  continue; //cut to remove hit pairs > 15 cm apart
458  // global position on module 1
460  predictedPositions_[0][0] = position.x();
461  predictedPositions_[1][0] = position.y();
462  predictedPositions_[2][0] = position.z();
463  momentum_ = comb1.globalMomentum().mag();
464  //cout << "momentum from combination = " << momentum_ << endl;
465  //cout << "magnetic field from TSOS = " << comb1.magneticField()->inTesla(position).mag() << endl;
466  // local parameters and errors on module 1
467  AlgebraicVector5 pars = comb1.localParameters().vector();
468  AlgebraicSymMatrix55 errs = comb1.localError().matrix();
469  for (int i = 0; i < 5; ++i) {
470  predictedLocalParameters_[i][0] = pars[i];
471  predictedLocalErrors_[i][0] = sqrt(errs(i, i));
472  }
473  // global position on module 2
474  position = comb1At2.globalPosition();
475  predictedPositions_[0][1] = position.x();
476  predictedPositions_[1][1] = position.y();
477  predictedPositions_[2][1] = position.z();
478  // local parameters and errors on module 2
479  pars = comb1At2.localParameters().vector();
480  errs = comb1At2.localError().matrix();
481  for (int i = 0; i < 5; ++i) {
482  predictedLocalParameters_[i][1] = pars[i];
483  predictedLocalErrors_[i][1] = sqrt(errs(i, i));
484  }
485 
486  //print out local errors in X to check
487  //cout << "Predicted local error in X at 1 = " << predictedLocalErrors_[3][0] << " and predicted local error in X at 2 is = " << predictedLocalErrors_[3][1] << endl;
488  //cout << "Predicted local error in Y at 1 = " << predictedLocalErrors_[4][0] << " and predicted local error in Y at 2 is = " << predictedLocalErrors_[4][1] << endl;
489 
490  //
491  // jacobians (local-to-global@1,global 1-2,global-to-local@2)
492  //
493  JacobianLocalToCurvilinear jacLocToCurv(comb1.surface(), comb1.localParameters(), *magField_);
494  AnalyticalCurvilinearJacobian jacCurvToCurv(
495  comb1.globalParameters(), comb1At2.globalPosition(), comb1At2.globalMomentum(), tsosWithS.second);
496  JacobianCurvilinearToLocal jacCurvToLoc(comb1At2.surface(), comb1At2.localParameters(), *magField_);
497  // combined jacobian local-1-to-local-2
498  AlgebraicMatrix55 jacobian = jacLocToCurv.jacobian() * jacCurvToCurv.jacobian() * jacCurvToLoc.jacobian();
499  // covariance on module 1
500  AlgebraicSymMatrix55 covComb1 = comb1.localError().matrix();
501  // variance and correlations for predicted local_x on modules 1 and 2
502  double c00 = covComb1(3, 3);
503  double c10(0.);
504  double c11(0.);
505  for (int i = 1; i < 5; ++i) {
506  c10 += jacobian(3, i) * covComb1(i, 3);
507  for (int j = 1; j < 5; ++j)
508  c11 += jacobian(3, i) * covComb1(i, j) * jacobian(3, j);
509  }
510  // choose relative sign in order to minimize error on difference
511  double diff = c00 - 2 * fabs(c10) + c11;
512  diff = diff > 0 ? sqrt(diff) : -sqrt(-diff);
514  relativeXSign_ = c10 > 0 ? -1 : 1;
515  //
516  // now find variance and correlations for predicted local_y
517  double c00Y = covComb1(4, 4);
518  double c10Y(0.);
519  double c11Y(0.);
520  for (int i = 1; i < 5; ++i) {
521  c10Y += jacobian(4, i) * covComb1(i, 4);
522  for (int j = 1; j < 5; ++j)
523  c11Y += jacobian(4, i) * covComb1(i, j) * jacobian(4, j);
524  }
525  double diffY = c00Y - 2 * fabs(c10Y) + c11Y;
526  diffY = diffY > 0 ? sqrt(diffY) : -sqrt(-diffY);
527  predictedDeltaYError_ = diffY;
528  relativeYSign_ = c10Y > 0 ? -1 : 1;
529 
530  // information on modules and hits
531  overlapIds_[0] = overlapHit.first->recHit()->geographicalId().rawId();
532  overlapIds_[1] = overlapHit.second->recHit()->geographicalId().rawId();
533 
534  //added by Heshy and Jared
535  moduleX_[0] = overlapHit.first->recHit()->det()->surface().position().x();
536  moduleX_[1] = overlapHit.second->recHit()->det()->surface().position().x();
537  moduleY_[0] = overlapHit.first->recHit()->det()->surface().position().y();
538  moduleY_[1] = overlapHit.second->recHit()->det()->surface().position().y();
539  moduleZ_[0] = overlapHit.first->recHit()->det()->surface().position().z();
540  moduleZ_[1] = overlapHit.second->recHit()->det()->surface().position().z();
541  subdetID = overlapHit.first->recHit()->geographicalId().subdetId();
542  localxdotglobalphi_[0] = overlapHit.first->recHit()->det()->surface().toGlobal(onezero).phi() -
543  overlapHit.first->recHit()->det()->surface().toGlobal(zerozero).phi();
544  localxdotglobalphi_[1] = overlapHit.second->recHit()->det()->surface().toGlobal(onezero).phi() -
545  overlapHit.second->recHit()->det()->surface().toGlobal(zerozero).phi();
546  //added by Jason
547  localxdotglobalr_[0] = overlapHit.first->recHit()->det()->surface().toGlobal(onezero).perp() -
548  overlapHit.first->recHit()->det()->surface().toGlobal(zerozero).perp();
549  localxdotglobalr_[1] = overlapHit.second->recHit()->det()->surface().toGlobal(onezero).perp() -
550  overlapHit.second->recHit()->det()->surface().toGlobal(zerozero).perp();
551  localxdotglobalz_[0] = overlapHit.first->recHit()->det()->surface().toGlobal(onezero).z() -
552  overlapHit.first->recHit()->det()->surface().toGlobal(zerozero).z();
553  localxdotglobalz_[1] = overlapHit.second->recHit()->det()->surface().toGlobal(onezero).z() -
554  overlapHit.second->recHit()->det()->surface().toGlobal(zerozero).z();
555  localxdotglobalx_[0] = overlapHit.first->recHit()->det()->surface().toGlobal(onezero).x() -
556  overlapHit.first->recHit()->det()->surface().toGlobal(zerozero).x();
557  localxdotglobalx_[1] = overlapHit.second->recHit()->det()->surface().toGlobal(onezero).x() -
558  overlapHit.second->recHit()->det()->surface().toGlobal(zerozero).x();
559  localxdotglobaly_[0] = overlapHit.first->recHit()->det()->surface().toGlobal(onezero).y() -
560  overlapHit.first->recHit()->det()->surface().toGlobal(zerozero).y();
561  localxdotglobaly_[1] = overlapHit.second->recHit()->det()->surface().toGlobal(onezero).y() -
562  overlapHit.second->recHit()->det()->surface().toGlobal(zerozero).y();
563  localydotglobalr_[0] = overlapHit.first->recHit()->det()->surface().toGlobal(zeroone).perp() -
564  overlapHit.first->recHit()->det()->surface().toGlobal(zerozero).perp();
565  localydotglobalr_[1] = overlapHit.second->recHit()->det()->surface().toGlobal(zeroone).perp() -
566  overlapHit.second->recHit()->det()->surface().toGlobal(zerozero).perp();
567  localydotglobalz_[0] = overlapHit.first->recHit()->det()->surface().toGlobal(zeroone).z() -
568  overlapHit.first->recHit()->det()->surface().toGlobal(zerozero).z();
569  localydotglobalz_[1] = overlapHit.second->recHit()->det()->surface().toGlobal(zeroone).z() -
570  overlapHit.second->recHit()->det()->surface().toGlobal(zerozero).z();
571  localydotglobalx_[0] = overlapHit.first->recHit()->det()->surface().toGlobal(zeroone).x() -
572  overlapHit.first->recHit()->det()->surface().toGlobal(zerozero).x();
573  localydotglobalx_[1] = overlapHit.second->recHit()->det()->surface().toGlobal(zeroone).x() -
574  overlapHit.second->recHit()->det()->surface().toGlobal(zerozero).x();
575  localydotglobaly_[0] = overlapHit.first->recHit()->det()->surface().toGlobal(zeroone).y() -
576  overlapHit.first->recHit()->det()->surface().toGlobal(zerozero).y();
577  localydotglobaly_[1] = overlapHit.second->recHit()->det()->surface().toGlobal(zeroone).y() -
578  overlapHit.second->recHit()->det()->surface().toGlobal(zerozero).y();
579  localydotglobalphi_[0] = overlapHit.first->recHit()->det()->surface().toGlobal(zeroone).phi() -
580  overlapHit.first->recHit()->det()->surface().toGlobal(zerozero).phi();
581  localydotglobalphi_[1] = overlapHit.second->recHit()->det()->surface().toGlobal(zeroone).phi() -
582  overlapHit.second->recHit()->det()->surface().toGlobal(zerozero).phi();
583 
584  if (overlapHit.first->recHit()->geographicalId().subdetId() == StripSubdetector::TIB)
585  layer_ = layerFromId(overlapHit.first->recHit()->geographicalId().rawId(), tTopo);
586  else if (overlapHit.first->recHit()->geographicalId().subdetId() == StripSubdetector::TOB)
587  layer_ = layerFromId(overlapHit.first->recHit()->geographicalId().rawId(), tTopo) + 4;
588  else if (overlapHit.first->recHit()->geographicalId().subdetId() == StripSubdetector::TID)
589  layer_ = layerFromId(overlapHit.first->recHit()->geographicalId().rawId(), tTopo) + 10;
590  else if (overlapHit.first->recHit()->geographicalId().subdetId() == StripSubdetector::TEC)
591  layer_ = layerFromId(overlapHit.first->recHit()->geographicalId().rawId(), tTopo) + 13;
592  else if (overlapHit.first->recHit()->geographicalId().subdetId() == PixelSubdetector::PixelBarrel)
593  layer_ = layerFromId(overlapHit.first->recHit()->geographicalId().rawId(), tTopo) + 20;
594  else if (overlapHit.first->recHit()->geographicalId().subdetId() == PixelSubdetector::PixelEndcap)
595  layer_ = layerFromId(overlapHit.first->recHit()->geographicalId().rawId(), tTopo) + 30;
596  else
597  layer_ = 99;
598 
599  if (overlapIds_[0] == SiStripDetId(overlapHit.first->recHit()->geographicalId()).glued())
600  edm::LogWarning("Overlaps") << "BAD GLUED: First Id = " << overlapIds_[0] << " has glued = "
601  << SiStripDetId(overlapHit.first->recHit()->geographicalId()).glued()
602  << " and stereo = "
603  << SiStripDetId(overlapHit.first->recHit()->geographicalId()).stereo() << endl;
604  if (overlapIds_[1] == SiStripDetId(overlapHit.second->recHit()->geographicalId()).glued())
605  edm::LogWarning("Overlaps") << "BAD GLUED: Second Id = " << overlapIds_[1] << " has glued = "
606  << SiStripDetId(overlapHit.second->recHit()->geographicalId()).glued()
607  << " and stereo = "
608  << SiStripDetId(overlapHit.second->recHit()->geographicalId()).stereo() << endl;
609 
610  const TransientTrackingRecHit::ConstRecHitPointer firstRecHit = overlapHit.first->recHit();
611  const TransientTrackingRecHit::ConstRecHitPointer secondRecHit = overlapHit.second->recHit();
612  hitPositions_[0] = firstRecHit->localPosition().x();
613  hitErrors_[0] = sqrt(firstRecHit->localPositionError().xx());
614  hitPositions_[1] = secondRecHit->localPosition().x();
615  hitErrors_[1] = sqrt(secondRecHit->localPositionError().xx());
616 
617  hitPositionsY_[0] = firstRecHit->localPosition().y();
618  hitErrorsY_[0] = sqrt(firstRecHit->localPositionError().yy());
619  hitPositionsY_[1] = secondRecHit->localPosition().y();
620  hitErrorsY_[1] = sqrt(secondRecHit->localPositionError().yy());
621 
622  //cout << "printing local X hit position and error for the overlap hits. Hit 1 = " << hitPositions_[0] << "+-" << hitErrors_[0] << " and hit 2 is " << hitPositions_[1] << "+-" << hitErrors_[1] << endl;
623 
624  DetId id1 = overlapHit.first->recHit()->geographicalId();
625  DetId id2 = overlapHit.second->recHit()->geographicalId();
626  int layer1 = layerFromId(id1, tTopo);
627  int subDet1 = id1.subdetId();
628  int layer2 = layerFromId(id2, tTopo);
629  int subDet2 = id2.subdetId();
630  if (abs(hitPositions_[0]) > 5)
631  edm::LogInfo("Overlaps") << "BAD: Bad hit position: Id = " << id1.rawId()
632  << " stereo = " << SiStripDetId(id1).stereo()
633  << " glued = " << SiStripDetId(id1).glued() << " from subdet = " << subDet1
634  << " and layer = " << layer1 << endl;
635  if (abs(hitPositions_[1]) > 5)
636  edm::LogInfo("Overlaps") << "BAD: Bad hit position: Id = " << id2.rawId()
637  << " stereo = " << SiStripDetId(id2).stereo()
638  << " glued = " << SiStripDetId(id2).glued() << " from subdet = " << subDet2
639  << " and layer = " << layer2 << endl;
640 
641  // get track momentum
642  momentum_ = comb1.globalMomentum().mag();
643 
644  // get cluster size
645  if (!(subDet1 == PixelSubdetector::PixelBarrel || subDet1 == PixelSubdetector::PixelEndcap)) { //strip
646  const TransientTrackingRecHit::ConstRecHitPointer thit1 = overlapHit.first->recHit();
647  const SiStripRecHit1D* hit1 = dynamic_cast<const SiStripRecHit1D*>((*thit1).hit());
648  if (hit1) {
649  //check cluster width
650  const SiStripRecHit1D::ClusterRef& cluster1 = hit1->cluster();
651  clusterSize_[0] = (cluster1->amplitudes()).size();
652  clusterWidthX_[0] = (cluster1->amplitudes()).size();
653  clusterWidthY_[0] = -1;
654 
655  //check if cluster at edge of sensor
656  uint16_t firstStrip = cluster1->firstStrip();
657  uint16_t lastStrip = firstStrip + (cluster1->amplitudes()).size() - 1;
658  unsigned short Nstrips;
659  Nstrips = detInfo_.getNumberOfApvsAndStripLength(id1).first * 128;
660  bool atEdge = false;
661  if (firstStrip == 0 || lastStrip == (Nstrips - 1))
662  atEdge = true;
663  if (atEdge)
664  edge_[0] = 1;
665  else
666  edge_[0] = -1;
667 
668  // get cluster total charge
669  const auto& stripCharges = cluster1->amplitudes();
670  uint16_t charge = 0;
671  for (uint i = 0; i < stripCharges.size(); i++) {
672  charge += stripCharges[i];
673  }
674  clusterCharge_[0] = charge;
675  }
676 
677  const TransientTrackingRecHit::ConstRecHitPointer thit2 = overlapHit.second->recHit();
678  const SiStripRecHit1D* hit2 = dynamic_cast<const SiStripRecHit1D*>((*thit2).hit());
679  if (hit2) {
680  const SiStripRecHit1D::ClusterRef& cluster2 = hit2->cluster();
681  clusterSize_[1] = (cluster2->amplitudes()).size();
682  clusterWidthX_[1] = (cluster2->amplitudes()).size();
683  clusterWidthY_[1] = -1;
684 
685  uint16_t firstStrip = cluster2->firstStrip();
686  uint16_t lastStrip = firstStrip + (cluster2->amplitudes()).size() - 1;
687  unsigned short Nstrips;
688  Nstrips = detInfo_.getNumberOfApvsAndStripLength(id2).first * 128;
689  bool atEdge = false;
690  if (firstStrip == 0 || lastStrip == (Nstrips - 1))
691  atEdge = true;
692  if (atEdge)
693  edge_[1] = 1;
694  else
695  edge_[1] = -1;
696 
697  // get cluster total charge
698  const auto& stripCharges = cluster2->amplitudes();
699  uint16_t charge = 0;
700  for (uint i = 0; i < stripCharges.size(); i++) {
701  charge += stripCharges[i];
702  }
703  clusterCharge_[1] = charge;
704  }
705  //cout << "strip cluster size2 = " << clusterWidthX_[0] << " and size 2 = " << clusterWidthX_[1] << endl;
706  }
707 
708  if (subDet2 == PixelSubdetector::PixelBarrel || subDet2 == PixelSubdetector::PixelEndcap) { //pixel
709 
710  const TransientTrackingRecHit::ConstRecHitPointer thit1 = overlapHit.first->recHit();
711  const SiPixelRecHit* recHitPix1 = dynamic_cast<const SiPixelRecHit*>((*thit1).hit());
712  if (recHitPix1) {
713  // check for cluster size and width
714  SiPixelRecHit::ClusterRef const& cluster1 = recHitPix1->cluster();
715 
716  clusterSize_[0] = cluster1->size();
717  clusterWidthX_[0] = cluster1->sizeX();
718  clusterWidthY_[0] = cluster1->sizeY();
719 
720  // check for cluster at edge
721  const PixelGeomDetUnit* theGeomDet = dynamic_cast<const PixelGeomDetUnit*>((*trackerGeometry_).idToDet(id1));
722  const PixelTopology* topol = (&(theGeomDet->specificTopology()));
723 
724  int minPixelRow = cluster1->minPixelRow(); //x
725  int maxPixelRow = cluster1->maxPixelRow();
726  int minPixelCol = cluster1->minPixelCol(); //y
727  int maxPixelCol = cluster1->maxPixelCol();
728 
729  bool edgeHitX = (topol->isItEdgePixelInX(minPixelRow)) || (topol->isItEdgePixelInX(maxPixelRow));
730  bool edgeHitY = (topol->isItEdgePixelInY(minPixelCol)) || (topol->isItEdgePixelInY(maxPixelCol));
731  if (edgeHitX || edgeHitY)
732  edge_[0] = 1;
733  else
734  edge_[0] = -1;
735 
736  clusterCharge_[0] = (uint)cluster1->charge();
737 
738  } else {
739  edm::LogWarning("Overlaps") << "didn't find pixel cluster" << endl;
740  continue;
741  }
742 
743  const TransientTrackingRecHit::ConstRecHitPointer thit2 = overlapHit.second->recHit();
744  const SiPixelRecHit* recHitPix2 = dynamic_cast<const SiPixelRecHit*>((*thit2).hit());
745  if (recHitPix2) {
746  SiPixelRecHit::ClusterRef const& cluster2 = recHitPix2->cluster();
747 
748  clusterSize_[1] = cluster2->size();
749  clusterWidthX_[1] = cluster2->sizeX();
750  clusterWidthY_[1] = cluster2->sizeY();
751  //cout << "second pixel cluster is " << clusterSize_[1] << " pixels with x width = " << clusterWidthX_[1] << " and y width = " << clusterWidthY_[1] << endl;
752 
753  const PixelGeomDetUnit* theGeomDet = dynamic_cast<const PixelGeomDetUnit*>((*trackerGeometry_).idToDet(id2));
754  const PixelTopology* topol = (&(theGeomDet->specificTopology()));
755 
756  int minPixelRow = cluster2->minPixelRow(); //x
757  int maxPixelRow = cluster2->maxPixelRow();
758  int minPixelCol = cluster2->minPixelCol(); //y
759  int maxPixelCol = cluster2->maxPixelCol();
760 
761  bool edgeHitX = (topol->isItEdgePixelInX(minPixelRow)) || (topol->isItEdgePixelInX(maxPixelRow));
762  bool edgeHitY = (topol->isItEdgePixelInY(minPixelCol)) || (topol->isItEdgePixelInY(maxPixelCol));
763  if (edgeHitX || edgeHitY)
764  edge_[1] = 1;
765  else
766  edge_[1] = -1;
767 
768  clusterCharge_[1] = (uint)cluster2->charge();
769 
770  } else {
771  edm::LogWarning("Overlaps") << "didn't find pixel cluster" << endl;
772  continue;
773  }
774  }
775 
776  //also check for edge pixels
777 
778  //try writing out the SimHit info (for MC only)
779  if (doSimHit_) {
780  std::vector<PSimHit> psimHits1;
781  std::vector<PSimHit> psimHits2;
782  //calculate layer
783  DetId id = overlapHit.first->recHit()->geographicalId();
784  int layer(-1);
785  layer = layerFromId(id, tTopo);
786  int subDet = id.subdetId();
787  edm::LogVerbatim("OverlapValidation") << "Subdet = " << subDet << " ; layer = " << layer;
788 
789  psimHits1 = associator.associateHit(*(firstRecHit->hit()));
790  edm::LogVerbatim("OverlapValidation") << "single hit ";
791  edm::LogVerbatim("OverlapValidation") << "length of psimHits1: " << psimHits1.size();
792  if (!psimHits1.empty()) {
793  float closest_dist = 99999.9;
794  std::vector<PSimHit>::const_iterator closest_simhit = psimHits1.begin();
795  for (std::vector<PSimHit>::const_iterator m = psimHits1.begin(); m < psimHits1.end(); m++) {
796  //find closest simHit to the recHit
797  float simX = (*m).localPosition().x();
798  float dist = fabs(simX - (overlapHit.first->recHit()->localPosition().x()));
799  edm::LogVerbatim("OverlapValidation")
800  << "simHit1 simX = " << simX << " hitX = " << overlapHit.first->recHit()->localPosition().x()
801  << " distX = " << dist << " layer = " << layer;
802  if (dist < closest_dist) {
803  //cout << "found newest closest dist for simhit1" << endl;
804  closest_dist = dist;
805  closest_simhit = m;
806  }
807  }
808  //if glued layer, convert sim hit position to matchedhit surface
809  //layer index from 1-4 for TIB, 1-6 for TOB
810  // Are the sim hits on the glued layers or are they split???
811  if (subDet > 2 && !SiStripDetId(id).glued()) {
812  const GluedGeomDet* gluedDet =
813  (const GluedGeomDet*)(*trackerGeometry_).idToDet((*firstRecHit).hit()->geographicalId());
814  const StripGeomDetUnit* stripDet = (StripGeomDetUnit*)gluedDet->monoDet();
815  GlobalPoint gp = stripDet->surface().toGlobal((*closest_simhit).localPosition());
816  LocalPoint lp = gluedDet->surface().toLocal(gp);
817  LocalVector localdirection = (*closest_simhit).localDirection();
818  GlobalVector globaldirection = stripDet->surface().toGlobal(localdirection);
819  LocalVector direction = gluedDet->surface().toLocal(globaldirection);
820  float scale = -lp.z() / direction.z();
821  LocalPoint projectedPos = lp + scale * direction;
822  simHitPositions_[0] = projectedPos.x();
823  edm::LogVerbatim("OverlapValidation") << "simhit position from matched layer = " << simHitPositions_[0];
824  simHitPositionsY_[0] = projectedPos.y();
825  } else {
826  simHitPositions_[0] = (*closest_simhit).localPosition().x();
827  simHitPositionsY_[0] = (*closest_simhit).localPosition().y();
828  edm::LogVerbatim("OverlapValidation") << "simhit position from non-matched layer = " << simHitPositions_[0];
829  }
830  edm::LogVerbatim("OverlapValidation") << "hit position = " << hitPositions_[0];
831  } else {
832  simHitPositions_[0] = -99.;
833  simHitPositionsY_[0] = -99.;
834  //cout << " filling simHitX: " << -99 << endl;
835  }
836 
837  psimHits2 = associator.associateHit(*(secondRecHit->hit()));
838  if (!psimHits2.empty()) {
839  float closest_dist = 99999.9;
840  std::vector<PSimHit>::const_iterator closest_simhit = psimHits2.begin();
841  for (std::vector<PSimHit>::const_iterator m = psimHits2.begin(); m < psimHits2.end(); m++) {
842  float simX = (*m).localPosition().x();
843  float dist = fabs(simX - (overlapHit.second->recHit()->localPosition().x()));
844  if (dist < closest_dist) {
845  closest_dist = dist;
846  closest_simhit = m;
847  }
848  }
849  //if glued layer, convert sim hit position to matchedhit surface
850  // if no sim hits on matched layers then this section can be removed
851  if (subDet > 2 && !SiStripDetId(id).glued()) {
852  const GluedGeomDet* gluedDet =
853  (const GluedGeomDet*)(*trackerGeometry_).idToDet((*secondRecHit).hit()->geographicalId());
854  const StripGeomDetUnit* stripDet = (StripGeomDetUnit*)gluedDet->monoDet();
855  GlobalPoint gp = stripDet->surface().toGlobal((*closest_simhit).localPosition());
856  LocalPoint lp = gluedDet->surface().toLocal(gp);
857  LocalVector localdirection = (*closest_simhit).localDirection();
858  GlobalVector globaldirection = stripDet->surface().toGlobal(localdirection);
859  LocalVector direction = gluedDet->surface().toLocal(globaldirection);
860  float scale = -lp.z() / direction.z();
861  LocalPoint projectedPos = lp + scale * direction;
862  simHitPositions_[1] = projectedPos.x();
863  simHitPositionsY_[1] = projectedPos.y();
864  } else {
865  simHitPositions_[1] = (*closest_simhit).localPosition().x();
866  simHitPositionsY_[1] = (*closest_simhit).localPosition().y();
867  }
868  } else {
869  simHitPositions_[1] = -99.;
870  simHitPositionsY_[1] = -99.;
871  }
872  }
873  rootTree_->Fill();
874  }
875 }
ClusterRef cluster() const
Log< level::Info, true > LogVerbatim
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
const Point2DBase< float, LocalTag > zerozero
static constexpr auto TEC
int foundHits() const
Definition: Trajectory.h:206
int lostHits() const
Definition: Trajectory.h:217
TrajectoryStateCombiner combiner_
unsigned int overlapIds_[2]
vector< bool > acceptLayer
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:19
uint32_t stereo() const
Definition: SiStripDetId.h:168
const LocalTrajectoryParameters & localParameters() const
TSOS combine(const TSOS &pTsos1, const TSOS &pTsos2) const
float predictedPositions_[3][2]
const Point2DBase< float, LocalTag > onezero
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
T y() const
Definition: PV3DBase.h:60
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
GlobalPoint globalPosition() const
const Point2DBase< float, LocalTag > zeroone
unsigned short hitCounts_[2]
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
constexpr std::array< uint8_t, layerIndexSize > layer
const MagneticField * magField_
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
DataContainer const & measurements() const
Definition: Trajectory.h:178
AlgebraicVector5 vector() const
virtual bool isItEdgePixelInX(int ixbin) const =0
const SurfaceType & surface() const
T mag() const
Definition: PV3DBase.h:64
SiStripDetInfo detInfo_
int layerFromId(const DetId &, const TrackerTopology *const tTopo) const
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
T sqrt(T t)
Definition: SSEVec.h:19
LocalPoint toLocal(const GlobalPoint &gp) const
T z() const
Definition: PV3DBase.h:61
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ROOT::Math::SVector< double, 5 > AlgebraicVector5
float ChiSquaredProbability(double chiSquared, double nrDOF)
const AlgebraicSymMatrix55 & matrix() const
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
float predictedLocalErrors_[5][2]
const LocalTrajectoryError & localError() const
static constexpr auto TOB
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Surface &) const final
Definition: Propagator.cc:10
Log< level::Info, false > LogInfo
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
Definition: DetId.h:17
uint32_t glued() const
Definition: SiStripDetId.h:163
int ndof(bool bon=true) const
Definition: Trajectory.cc:97
float predictedLocalParameters_[5][2]
static constexpr auto TIB
const GlobalTrajectoryParameters & globalParameters() const
ClusterRef cluster() const
Definition: SiPixelRecHit.h:47
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
float chiSquared() const
Definition: Trajectory.h:241
virtual bool isItEdgePixelInY(int iybin) const =0
GlobalVector globalMomentum() const
static int position[264][3]
Definition: ReadPGInfo.cc:289
const AlgebraicMatrix55 & jacobian() const
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
Log< level::Warning, false > LogWarning
T x() const
Definition: PV3DBase.h:59
static constexpr auto TID
tuple size
Write out results.
Our base class.
Definition: SiPixelRecHit.h:23
void OverlapValidation::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 885 of file OverlapValidation.cc.

References rootTree_.

Referenced by o2olib.O2ORunMgr::executeJob().

885  {
886  if (rootTree_) {
887  rootTree_->GetDirectory()->cd();
888  rootTree_->Write();
889  delete rootTree_;
890  }
891 }
int OverlapValidation::layerFromId ( const DetId id,
const TrackerTopology *const  tTopo 
) const
private

Definition at line 877 of file OverlapValidation.cc.

References phase1PixelTopology::layer, and TrackerAlignableId::typeAndLayerFromDetId().

Referenced by analyzeTrajectory().

877  {
878  TrackerAlignableId aliid;
879  std::pair<int, int> subdetandlayer = aliid.typeAndLayerFromDetId(id, tTopo);
880  int layer = subdetandlayer.second;
881 
882  return layer;
883 }
std::pair< int, int > typeAndLayerFromDetId(const DetId &detId, const TrackerTopology *tTopo) const
constexpr std::array< uint8_t, layerIndexSize > layer

Member Data Documentation

vector<bool> OverlapValidation::acceptLayer
private

Definition at line 154 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

const bool OverlapValidation::addExtraBranches_
private

Definition at line 126 of file OverlapValidation.cc.

Referenced by OverlapValidation().

bool OverlapValidation::barrelOnly_
private

Definition at line 157 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::chi2_[2]
private

Definition at line 133 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

const float OverlapValidation::chi2ProbCut_
private

Definition at line 128 of file OverlapValidation.cc.

Referenced by analyzeTrajectory().

uint OverlapValidation::clusterCharge_[2]
private

Definition at line 151 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::clusterSize_[2]
private

Definition at line 150 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::clusterWidthX_[2]
private

Definition at line 148 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::clusterWidthY_[2]
private

Definition at line 149 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

TrajectoryStateCombiner OverlapValidation::combiner_
private

Definition at line 120 of file OverlapValidation.cc.

Referenced by analyzeTrajectory().

const int OverlapValidation::compressionSettings_
private

Definition at line 125 of file OverlapValidation.cc.

Referenced by OverlapValidation().

edm::ParameterSet OverlapValidation::config_
private

Definition at line 113 of file OverlapValidation.cc.

Referenced by analyze().

SiStripDetInfo OverlapValidation::detInfo_
private

Definition at line 115 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

bool OverlapValidation::doSimHit_
private

Definition at line 116 of file OverlapValidation.cc.

Referenced by analyze(), analyzeTrajectory(), and OverlapValidation().

int OverlapValidation::edge_[2]
private

Definition at line 152 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

uint OverlapValidation::event_
private

Definition at line 156 of file OverlapValidation.cc.

Referenced by analyze(), and OverlapValidation().

edm::FileInPath OverlapValidation::FileInPath_
private

Definition at line 124 of file OverlapValidation.cc.

Referenced by OverlapValidation().

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

Definition at line 109 of file OverlapValidation.cc.

Referenced by analyze().

unsigned short OverlapValidation::hitCounts_[2]
private

Definition at line 132 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::hitErrors_[2]
private

Definition at line 143 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::hitErrorsY_[2]
private

Definition at line 145 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::hitPositions_[2]
private

Definition at line 142 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::hitPositionsY_[2]
private

Definition at line 144 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

uint OverlapValidation::layer_
private

Definition at line 131 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::localxdotglobalphi_[2]
private

Definition at line 168 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::localxdotglobalr_[2]
private

Definition at line 169 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::localxdotglobalx_[2]
private

Definition at line 171 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::localxdotglobaly_[2]
private

Definition at line 172 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::localxdotglobalz_[2]
private

Definition at line 170 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::localydotglobalphi_[2]
private

Definition at line 173 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::localydotglobalr_[2]
private

Definition at line 174 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::localydotglobalx_[2]
private

Definition at line 176 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::localydotglobaly_[2]
private

Definition at line 177 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::localydotglobalz_[2]
private

Definition at line 175 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

const MagneticField* OverlapValidation::magField_
private

Definition at line 118 of file OverlapValidation.cc.

Referenced by analyze(), and analyzeTrajectory().

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

Definition at line 110 of file OverlapValidation.cc.

Referenced by analyze().

const int OverlapValidation::minHitsCut_
private

Definition at line 127 of file OverlapValidation.cc.

Referenced by analyzeTrajectory().

float OverlapValidation::moduleX_[2]
private

Definition at line 160 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::moduleY_[2]
private

Definition at line 161 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::moduleZ_[2]
private

Definition at line 162 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::momentum_
private

Definition at line 155 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

const Point2DBase<float, LocalTag> OverlapValidation::onezero = Point2DBase<float, LocalTag>(1, 0)
private

Definition at line 165 of file OverlapValidation.cc.

Referenced by analyzeTrajectory().

int OverlapValidation::overlapCounts_[3]
private

Definition at line 121 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), OverlapValidation(), and ~OverlapValidation().

unsigned int OverlapValidation::overlapIds_[2]
private

Definition at line 134 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::overlapPath_
private

Definition at line 130 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::predictedDeltaXError_
private

Definition at line 138 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::predictedDeltaYError_
private

Definition at line 139 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::predictedLocalErrors_[5][2]
private

Definition at line 137 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::predictedLocalParameters_[5][2]
private

Definition at line 136 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::predictedPositions_[3][2]
private

Definition at line 135 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

char OverlapValidation::relativeXSign_
private

Definition at line 140 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

char OverlapValidation::relativeYSign_
private

Definition at line 141 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

TTree* OverlapValidation::rootTree_
private

Definition at line 123 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), endJob(), and OverlapValidation().

uint OverlapValidation::run_
private

Definition at line 156 of file OverlapValidation.cc.

Referenced by analyze(), and OverlapValidation().

float OverlapValidation::simHitPositions_[2]
private

Definition at line 146 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

float OverlapValidation::simHitPositionsY_[2]
private

Definition at line 147 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

int OverlapValidation::subdetID
private

Definition at line 163 of file OverlapValidation.cc.

Referenced by analyzeTrajectory(), and OverlapValidation().

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

Definition at line 111 of file OverlapValidation.cc.

Referenced by analyze().

const TrackerGeometry* OverlapValidation::trackerGeometry_
private

Definition at line 117 of file OverlapValidation.cc.

Referenced by analyze().

edm::InputTag OverlapValidation::trajectoryTag_
private

Definition at line 114 of file OverlapValidation.cc.

Referenced by OverlapValidation().

edm::EDGetTokenT<TrajectoryCollection> OverlapValidation::trajectoryToken_
private

Definition at line 96 of file OverlapValidation.cc.

Referenced by analyze(), and OverlapValidation().

const Point2DBase<float, LocalTag> OverlapValidation::zeroone = Point2DBase<float, LocalTag>(0, 1)
private

Definition at line 166 of file OverlapValidation.cc.

Referenced by analyzeTrajectory().

const Point2DBase<float, LocalTag> OverlapValidation::zerozero = Point2DBase<float, LocalTag>(0, 0)
private

Definition at line 164 of file OverlapValidation.cc.

Referenced by analyzeTrajectory().