CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HitEff Class Reference

#include <HitEff.h>

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

Public Member Functions

 HitEff (const edm::ParameterSet &conf)
 
 ~HitEff () 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 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
 
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)
 

Private Member Functions

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

Private Attributes

bool addCommonMode_
 
bool addLumi_
 
unsigned int bunchx
 
const edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecordchi2MeasurementEstimatorToken_
 
float ClusterLocErrX
 
float ClusterLocErrY
 
float ClusterLocX
 
float ClusterLocY
 
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
 
float ClusterStoN
 
const edm::EDGetTokenT< reco::TrackCollectioncombinatorialTracks_token_
 
float commonMode
 
const edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > commonModeToken_
 
int compSettings
 
edm::ParameterSet conf_
 
const edm::ESGetToken< StripClusterParameterEstimator, TkStripCPERecordcpeToken_
 
bool cutOnTracks_
 
bool DEBUG
 
const edm::EDGetTokenT< DetIdCollectiondigisCol_token_
 
const edm::EDGetTokenT< DetIdVectordigisVec_token_
 
bool doMissingHitsRecovery_
 
unsigned int event
 
int events
 
int EventTrackCKF
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordgeomToken_
 
bool highPurity
 
std::vector< unsigned int > hitRecoveryCounters
 
std::vector< unsigned int > hitTotalCounters
 
unsigned int Id
 
float instLumi
 
unsigned int layers
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagFieldToken_
 
const edm::ESGetToken< MeasurementTracker, CkfComponentsRecordmeasurementTkToken_
 
const edm::EDGetTokenT< OnlineLuminosityRecordmetaDataToken_
 
std::vector< int > missHitPerLayer
 
unsigned int ModIsBad
 
int nHits
 
const edm::ESGetToken< Propagator, TrackingComponentsRecordpropagatorToken_
 
float pT
 
float PU
 
float ResX
 
float ResXSig
 
unsigned int run
 
const edm::EDGetTokenT< LumiScalersCollectionscalerToken_
 
SiStripClusterInfo siStripClusterInfo_
 
unsigned int SiStripQualBad
 
const edm::ESGetToken< SiStripQuality, SiStripQualityRcdsiStripQualityToken_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtopoToken_
 
int totalNbHits
 
int tquality
 
const edm::EDGetTokenT< MeasurementTrackerEventtrackerEvent_token_
 
unsigned int trackMultiplicityCut_
 
TTree * traj
 
const edm::EDGetTokenT< std::vector< Trajectory > > trajectories_token_
 
float TrajGlbX
 
float TrajGlbY
 
float TrajGlbZ
 
unsigned int trajHitValid
 
float TrajLocAngleX
 
float TrajLocAngleY
 
float TrajLocErrX
 
float TrajLocErrY
 
float TrajLocX
 
float TrajLocY
 
const edm::EDGetTokenT< TrajTrackAssociationCollectiontrajTrackAsso_token_
 
bool useAllHitsFromTracksWithMissingHits_
 
bool useFirstMeas_
 
bool useLastMeas_
 
unsigned int whatlayer
 
bool withinAcceptance
 

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< 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 53 of file HitEff.h.

Constructor & Destructor Documentation

◆ HitEff()

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

Definition at line 74 of file HitEff.cc.

References addCommonMode_, addLumi_, compSettings, conf_, cutOnTracks_, DEBUG, doMissingHitsRecovery_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hitRecoveryCounters, hitTotalCounters, TFileService::kSharedResource, layers, trackMultiplicityCut_, useAllHitsFromTracksWithMissingHits_, useFirstMeas_, and useLastMeas_.

75  : scalerToken_(consumes<LumiScalersCollection>(conf.getParameter<edm::InputTag>("lumiScalers"))),
76  metaDataToken_(consumes<OnlineLuminosityRecord>(conf.getParameter<edm::InputTag>("metadata"))),
80  consumes<reco::TrackCollection>(conf.getParameter<edm::InputTag>("combinatorialTracks"))),
81  trajectories_token_(consumes<std::vector<Trajectory> >(conf.getParameter<edm::InputTag>("trajectories"))),
82  trajTrackAsso_token_(consumes<TrajTrackAssociationCollection>(conf.getParameter<edm::InputTag>("trajectories"))),
85  digisCol_token_(consumes(conf.getParameter<edm::InputTag>("siStripDigis"))),
86  digisVec_token_(consumes(conf.getParameter<edm::InputTag>("siStripDigis"))),
87  trackerEvent_token_(consumes<MeasurementTrackerEvent>(conf.getParameter<edm::InputTag>("trackerEvent"))),
90  cpeToken_(esConsumes(edm::ESInputTag("", "StripCPEfromTrackAngle"))),
95  propagatorToken_(esConsumes(edm::ESInputTag("", "PropagatorWithMaterial"))),
96  conf_(conf) {
97  usesResource(TFileService::kSharedResource);
98  compSettings = conf_.getUntrackedParameter<int>("CompressionSettings", -1);
99  layers = conf_.getParameter<int>("Layer");
100  DEBUG = conf_.getParameter<bool>("Debug");
101  addLumi_ = conf_.getUntrackedParameter<bool>("addLumi", false);
102  addCommonMode_ = conf_.getUntrackedParameter<bool>("addCommonMode", false);
103  cutOnTracks_ = conf_.getUntrackedParameter<bool>("cutOnTracks", false);
104  trackMultiplicityCut_ = conf.getUntrackedParameter<unsigned int>("trackMultiplicity", 100);
105  useFirstMeas_ = conf_.getUntrackedParameter<bool>("useFirstMeas", false);
106  useLastMeas_ = conf_.getUntrackedParameter<bool>("useLastMeas", false);
108  conf_.getUntrackedParameter<bool>("useAllHitsFromTracksWithMissingHits", false);
109  doMissingHitsRecovery_ = conf_.getUntrackedParameter<bool>("doMissingHitsRecovery", false);
110 
111  hitRecoveryCounters.resize(k_END_OF_LAYERS, 0);
112  hitTotalCounters.resize(k_END_OF_LAYERS, 0);
113 }
static const std::string kSharedResource
Definition: TFileService.h:76
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
Definition: HitEff.h:94
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< unsigned int > hitRecoveryCounters
Definition: HitEff.h:109
const edm::EDGetTokenT< OnlineLuminosityRecord > metaDataToken_
Definition: HitEff.h:66
std::vector< unsigned int > hitTotalCounters
Definition: HitEff.h:110
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Definition: HitEff.h:90
bool useAllHitsFromTracksWithMissingHits_
Definition: HitEff.h:77
int compSettings
Definition: HitEff.h:104
bool doMissingHitsRecovery_
Definition: HitEff.h:78
const edm::EDGetTokenT< std::vector< Trajectory > > trajectories_token_
Definition: HitEff.h:81
const edm::EDGetTokenT< DetIdVector > digisVec_token_
Definition: HitEff.h:85
SiStripClusterInfo siStripClusterInfo_
Definition: HitEff.h:69
const edm::EDGetTokenT< DetIdCollection > digisCol_token_
Definition: HitEff.h:84
const edm::ESGetToken< SiStripQuality, SiStripQualityRcd > siStripQualityToken_
Definition: HitEff.h:93
bool DEBUG
Definition: HitEff.h:106
const edm::EDGetTokenT< MeasurementTrackerEvent > trackerEvent_token_
Definition: HitEff.h:86
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
Definition: HitEff.h:91
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
Definition: HitEff.h:83
const edm::EDGetTokenT< reco::TrackCollection > combinatorialTracks_token_
Definition: HitEff.h:80
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
Definition: HitEff.h:97
const edm::ESGetToken< MeasurementTracker, CkfComponentsRecord > measurementTkToken_
Definition: HitEff.h:95
const edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecord > chi2MeasurementEstimatorToken_
Definition: HitEff.h:96
bool useLastMeas_
Definition: HitEff.h:76
const edm::ESGetToken< StripClusterParameterEstimator, TkStripCPERecord > cpeToken_
Definition: HitEff.h:92
unsigned int trackMultiplicityCut_
Definition: HitEff.h:74
unsigned int layers
Definition: HitEff.h:105
bool addLumi_
Definition: HitEff.h:71
bool addCommonMode_
Definition: HitEff.h:72
const edm::EDGetTokenT< TrajTrackAssociationCollection > trajTrackAsso_token_
Definition: HitEff.h:82
bool cutOnTracks_
Definition: HitEff.h:73
bool useFirstMeas_
Definition: HitEff.h:75
const edm::EDGetTokenT< LumiScalersCollection > scalerToken_
Definition: HitEff.h:65
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
const edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > commonModeToken_
Definition: HitEff.h:67
edm::ParameterSet conf_
Definition: HitEff.h:99

◆ ~HitEff()

HitEff::~HitEff ( )
overridedefault

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 177 of file HitEff.cc.

References funct::abs(), addCommonMode_, addLumi_, AnalyticalPropagator_cfi::AnalyticalPropagator, anyDirection, OnlineLuminosityRecord::avgPileUp(), edm::AssociationMap< Tag >::begin(), Surface::bounds(), bunchx, nano_mu_local_reco_cff::chi2, chi2MeasurementEstimatorToken_, ClusterLocErrX, ClusterLocErrY, ClusterLocX, ClusterLocY, clusters_token_, ClusterStoN, combinatorialTracks_token_, commonMode, commonModeToken_, GeometricSearchDet::compatibleDets(), edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, cpeToken_, cutOnTracks_, digisCol_token_, digisVec_token_, doMissingHitsRecovery_, MillePedeFileConverter_cfg::e, edm::AssociationMap< Tag >::end(), events, EventTrackCKF, Exception, geomToken_, SiStripQuality::getBadApvs(), edm::EventSetup::getData(), edm::EventSetup::getHandle(), highPurity, muons_cff::highPurity, hitRecoveryCounters, hitTotalCounters, mps_fire::i, Id, TrackerGeometry::idToDetUnit(), cuy::ii, SiStripClusterInfo::initEvent(), input, OnlineLuminosityRecord::instLumi(), instLumi, createfilelist::int, sistrip::SpyUtilities::isValid(), edm::HandleBase::isValid(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, nano_mu_digi_cff::layer, layers, StripClusterParameterEstimator::localParameters(), LogDebug, V0Monitor_cfi::lumiScalers, magFieldToken_, measurementTkToken_, HLT_2024v11_cff::measurementTrackerEvent, metaDataToken_, missHitPerLayer, combine::missing, ModIsBad, heavyionUCCDQM_cfi::nClusters, reco::MuonTime::nDof, nHits, StripTopology::nstrips(), AlCaHLTBitMon_ParallelJobs::p, TrapezoidalPlaneBounds::parameters(), edm::Handle< T >::product(), TrackCandidateProducer_cfi::propagator, propagatorToken_, pT, PU, nano_mu_digi_cff::rawId, rpcPointValidation_cfi::recHit, TrajectoryMeasurement::recHit(), ResX, ResXSig, run, scalerToken_, SiStripClusterInfo::setCluster(), SiStripClusterInfo::signalOverNoise(), siStripClusterInfo_, SiStripQualBad, siStripQualityToken_, edm::DetSetVector< T >::size(), StripGeomDetUnit::specificTopology(), mathSSE::sqrt(), subdetector, GeomDet::surface(), StripSubdetector::TEC, TrackerTopology::tecSide(), TrackerTopology::tidSide(), reco::MuonTime::timeAtIpInOut, reco::MuonTime::timeAtIpInOutErr, createJobs::tmp, topoToken_, totalNbHits, PbPb_ZMuSkimMuonDPG_cff::tracker, trackerEvent_token_, trackMultiplicityCut_, traj, trajectories_token_, TrajGlbX, TrajGlbY, TrajGlbZ, trajHitValid, TrajLocAngleX, TrajLocAngleY, TrajLocErrX, TrajLocErrY, TrajLocX, TrajLocY, trajTrackAsso_token_, useAllHitsFromTracksWithMissingHits_, useFirstMeas_, useLastMeas_, whatlayer, Bounds::width(), and withinAcceptance.

177  {
178  //Retrieve tracker topology from geometry
179  const TrackerTopology* tTopo = &es.getData(topoToken_);
181 
182  // bool DEBUG = false;
183 
184  LogDebug("SiStripHitEfficiency:HitEff") << "beginning analyze from HitEff" << endl;
185 
186  using namespace edm;
187  using namespace reco;
188  // Step A: Get Inputs
189 
190  int run_nr = e.id().run();
191  int ev_nr = e.id().event();
192  int bunch_nr = e.bunchCrossing();
193 
194  // Luminosity informations
197 
198  instLumi = 0;
199  PU = 0;
200  if (addLumi_) {
201  if (lumiScalers.isValid() && !lumiScalers->empty()) {
202  if (lumiScalers->begin() != lumiScalers->end()) {
203  instLumi = lumiScalers->begin()->instantLumi();
204  PU = lumiScalers->begin()->pileup();
205  }
206  } else if (metaData.isValid()) {
207  instLumi = metaData->instLumi();
208  PU = metaData->avgPileUp();
209  } else {
210  edm::LogWarning("SiStripHitEfficiencyWorker") << "could not find a source for the Luminosity and PU";
211  }
212  }
213 
214  // CM
216  if (addCommonMode_)
217  e.getByToken(commonModeToken_, commonModeDigis);
218 
219  //CombinatoriaTrack
220  edm::Handle<reco::TrackCollection> trackCollectionCKF;
221  //edm::InputTag TkTagCKF = conf_.getParameter<edm::InputTag>("combinatorialTracks");
222  e.getByToken(combinatorialTracks_token_, trackCollectionCKF);
223 
224  edm::Handle<std::vector<Trajectory> > TrajectoryCollectionCKF;
225  //edm::InputTag TkTrajCKF = conf_.getParameter<edm::InputTag>("trajectories");
226  e.getByToken(trajectories_token_, TrajectoryCollectionCKF);
227 
228  edm::Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
229  e.getByToken(trajTrackAsso_token_, trajTrackAssociationHandle);
230 
231  // Clusters
232  // get the SiStripClusters from the event
234  //e.getByLabel("siStripClusters", theClusters);
235  e.getByToken(clusters_token_, theClusters);
236 
237  //get tracker geometry
239  const TrackerGeometry* tkgeom = &(*tracker);
240 
241  //get Cluster Parameter Estimator
242  //std::string cpe = conf_.getParameter<std::string>("StripCPE");
243  edm::ESHandle<StripClusterParameterEstimator> parameterestimator = es.getHandle(cpeToken_);
244  const StripClusterParameterEstimator& stripcpe(*parameterestimator);
245 
246  // get the SiStripQuality records
247  edm::ESHandle<SiStripQuality> SiStripQuality_ = es.getHandle(siStripQualityToken_);
248 
249  const MagneticField* magField_ = &es.getData(magFieldToken_);
250 
251  // get the list of module IDs with FED-detected errors
252  // - In Aug-2023, the data format was changed from DetIdCollection to DetIdVector.
253  // - To provide some level of backward-compatibility,
254  // the plugin checks for both types giving preference to the new format.
255  // - If only the old format is available, the collection is
256  // converted to the new format, then used downstream.
257  auto const& fedErrorIdsCol_h = e.getHandle(digisCol_token_);
258  auto const& fedErrorIdsVec_h = e.getHandle(digisVec_token_);
259  if (not fedErrorIdsCol_h.isValid() and not fedErrorIdsVec_h.isValid()) {
260  throw cms::Exception("InvalidProductSiStripDetIdsWithFEDErrors")
261  << "no valid product for SiStrip DetIds with FED errors (see parameter \"siStripDigis\"), "
262  "neither for new format (DetIdVector) nor old format (DetIdCollection)";
263  }
264  auto const& fedErrorIds = fedErrorIdsVec_h.isValid() ? *fedErrorIdsVec_h : fedErrorIdsCol_h->as_vector();
265 
266  edm::ESHandle<MeasurementTracker> measurementTrackerHandle = es.getHandle(measurementTkToken_);
267 
269  //e.getByLabel("MeasurementTrackerEvent", measurementTrackerEvent);
271 
273  const Propagator* thePropagator = &es.getData(propagatorToken_);
274 
275  events++;
276 
277  // *************** SiStripCluster Collection
278  const edmNew::DetSetVector<SiStripCluster>& input = *theClusters;
279 
280  //go through clusters to write out global position of good clusters for the layer understudy for comparison
281  // Loop through clusters just to print out locations
282  // Commented out to avoid discussion, should really be deleted.
283  /*
284  for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter = input.begin(); DSViter != input.end(); DSViter++) {
285  // DSViter is a vector of SiStripClusters located on a single module
286  unsigned int ClusterId = DSViter->id();
287  DetId ClusterDetId(ClusterId);
288  const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)tkgeom->idToDetUnit(ClusterDetId);
289 
290  edmNew::DetSet<SiStripCluster>::const_iterator begin=DSViter->begin();
291  edmNew::DetSet<SiStripCluster>::const_iterator end =DSViter->end();
292  for(edmNew::DetSet<SiStripCluster>::const_iterator iter=begin;iter!=end;++iter) {
293  //iter is a single SiStripCluster
294  StripClusterParameterEstimator::LocalValues parameters=stripcpe.localParameters(*iter,*stripdet);
295 
296  const Surface* surface;
297  surface = &(tracker->idToDet(ClusterDetId)->surface());
298  LocalPoint lp = parameters.first;
299  GlobalPoint gp = surface->toGlobal(lp);
300  unsigned int layer = ::checkLayer(ClusterId, tTopo);
301  if(DEBUG) LOGPRINT << "Found hit in cluster collection layer = " << layer << " with id = " << ClusterId << " local X position = " << lp.x() << " +- " << sqrt(parameters.second.xx()) << " matched/stereo/rphi = " << ((ClusterId & 0x3)==0) << "/" << ((ClusterId & 0x3)==1) << "/" << ((ClusterId & 0x3)==2) << endl;
302  }
303  }
304  */
305 
306  // Tracking
307  const reco::TrackCollection* tracksCKF = trackCollectionCKF.product();
308  LogDebug("SiStripHitEfficiency:HitEff") << "number ckf tracks found = " << tracksCKF->size() << endl;
309  //if (tracksCKF->size() == 1 ){
310  if (!tracksCKF->empty()) {
311  if (cutOnTracks_ && (tracksCKF->size() >= trackMultiplicityCut_))
312  return;
313  if (cutOnTracks_)
314  LogDebug("SiStripHitEfficiency:HitEff")
315  << "starting checking good event with < " << trackMultiplicityCut_ << " tracks" << endl;
316 
317  EventTrackCKF++;
318 
319 #ifdef ExtendedCALIBTree
320  //get dEdx info if available
321  edm::Handle<ValueMap<DeDxData> > dEdxUncalibHandle;
322  if (e.getByLabel("dedxMedianCTF", dEdxUncalibHandle)) {
323  const ValueMap<DeDxData> dEdxTrackUncalib = *dEdxUncalibHandle.product();
324 
325  reco::TrackRef itTrack = reco::TrackRef(trackCollectionCKF, 0);
326  dedx = dEdxTrackUncalib[itTrack].dEdx();
327  dedxNOM = dEdxTrackUncalib[itTrack].numberOfMeasurements();
328  } else {
329  dedx = -999.0;
330  dedxNOM = -999;
331  }
332 
333  //get muon and ecal timing info if available
335  if (e.getByLabel("muonsWitht0Correction", muH)) {
336  const MuonCollection& muonsT0 = *muH.product();
337  if (!muonsT0.empty()) {
338  MuonTime mt0 = muonsT0[0].time();
339  timeDT = mt0.timeAtIpInOut;
340  timeDTErr = mt0.timeAtIpInOutErr;
341  timeDTDOF = mt0.nDof;
342 
343  bool hasCaloEnergyInfo = muonsT0[0].isEnergyValid();
344  if (hasCaloEnergyInfo)
345  timeECAL = muonsT0[0].calEnergy().ecal_time;
346  }
347  } else {
348  timeDT = -999.0;
349  timeDTErr = -999.0;
350  timeDTDOF = -999;
351  timeECAL = -999.0;
352  }
353 
354 #endif
355  // actually should do a loop over all the tracks in the event here
356 
357  // Looping over traj-track associations to be able to get traj & track informations
358  for (TrajTrackAssociationCollection::const_iterator it = trajTrackAssociationHandle->begin();
359  it != trajTrackAssociationHandle->end();
360  it++) {
361  edm::Ref<std::vector<Trajectory> > itraj = it->key;
362  reco::TrackRef itrack = it->val;
363 
364  // for each track, fill some variables such as number of hits and momentum
365  nHits = itraj->foundHits();
366 #ifdef ExtendedCALIBTree
367  nLostHits = itraj->lostHits();
368  chi2 = (itraj->chiSquared() / itraj->ndof());
369  p = itraj->lastMeasurement().updatedState().globalMomentum().mag();
370 #endif
371  pT = sqrt((itraj->lastMeasurement().updatedState().globalMomentum().x() *
372  itraj->lastMeasurement().updatedState().globalMomentum().x()) +
373  (itraj->lastMeasurement().updatedState().globalMomentum().y() *
374  itraj->lastMeasurement().updatedState().globalMomentum().y()));
375 
376  // track quality
378 
379  std::vector<TrajectoryMeasurement> TMeas = itraj->measurements();
380  totalNbHits += int(TMeas.size());
381  vector<TrajectoryMeasurement>::iterator itm;
382  double xloc = 0.;
383  double yloc = 0.;
384  double xErr = 0.;
385  double yErr = 0.;
386  double angleX = -999.;
387  double angleY = -999.;
388  double xglob, yglob, zglob;
389 
390  // Check whether the trajectory has some missing hits
391  bool hasMissingHits = false;
392  int previous_layer = 999;
393  vector<unsigned int> missedLayers;
394  for (const auto& itm : TMeas) {
395  auto theHit = itm.recHit();
396  unsigned int iidd = theHit->geographicalId().rawId();
397  int layer = ::checkLayer(iidd, tTopo);
398  int missedLayer = (layer + 1);
399  int diffPreviousLayer = (layer - previous_layer);
401  //Layers from TIB + TOB
402  if (diffPreviousLayer == -2 && missedLayer > k_LayersStart && missedLayer < k_LayersAtTOBEnd) {
403  missHitPerLayer[missedLayer] += 1;
404  hasMissingHits = true;
405  }
406  //Layers from TID
407  else if (diffPreviousLayer == -2 && (missedLayer > k_LayersAtTOBEnd + 1 && missedLayer <= k_LayersAtTIDEnd)) {
408  missHitPerLayer[missedLayer] += 1;
409  hasMissingHits = true;
410  }
411  //Layers from TEC
412  else if (diffPreviousLayer == -2 && missedLayer > k_LayersAtTIDEnd && missedLayer <= k_LayersAtTECEnd) {
413  missHitPerLayer[missedLayer] += 1;
414  hasMissingHits = true;
415  }
416 
417  //##### TID Layer 11 in transition TID -> TIB : layer is in TIB, previous layer = 12
418  if ((layer > k_LayersStart && layer <= k_LayersAtTIBEnd) && (previous_layer == 12)) {
419  missHitPerLayer[11] += 1;
420  hasMissingHits = true;
421  }
422 
423  //##### TEC Layer 14 in transition TEC -> TOB : layer is in TOB, previous layer = 15
424  if ((layer > k_LayersAtTIBEnd && layer <= k_LayersAtTOBEnd) && (previous_layer == 15)) {
425  missHitPerLayer[14] += 1;
426  hasMissingHits = true;
427  }
428  }
429  if (theHit->getType() == TrackingRecHit::Type::missing)
430  hasMissingHits = true;
431 
432  if (hasMissingHits)
433  missedLayers.push_back(layer);
434  previous_layer = layer;
435  }
436 
437  // Loop on each measurement and take it into consideration
438  //--------------------------------------------------------
439  unsigned int prev_TKlayers = 0;
440  for (itm = TMeas.begin(); itm != TMeas.end(); itm++) {
441  auto theInHit = (*itm).recHit();
442 
443  LogDebug("SiStripHitEfficiency:HitEff") << "theInHit is valid = " << theInHit->isValid() << endl;
444 
445  unsigned int iidd = theInHit->geographicalId().rawId();
446 
447  unsigned int TKlayers = ::checkLayer(iidd, tTopo);
448  LogDebug("SiStripHitEfficiency:HitEff") << "TKlayer from trajectory: " << TKlayers << " from module = " << iidd
449  << " matched/stereo/rphi = " << ((iidd & 0x3) == 0) << "/"
450  << ((iidd & 0x3) == 1) << "/" << ((iidd & 0x3) == 2) << endl;
451 
452  // Test first and last points of the trajectory
453  // the list of measurements starts from outer layers !!! This could change -> should add a check
454  bool isFirstMeas = (itm == (TMeas.end() - 1));
455  bool isLastMeas = (itm == (TMeas.begin()));
456 
457  if (!useFirstMeas_ && isFirstMeas)
458  continue;
459  if (!useLastMeas_ && isLastMeas)
460  continue;
461 
462  // In case of missing hit in the track, check whether to use the other hits or not.
463  if (hasMissingHits && theInHit->getType() != TrackingRecHit::Type::missing &&
465  continue;
466 
467  // If Trajectory measurement from TOB 6 or TEC 9, skip it because it's always valid they are filled later
468  if (TKlayers == 10 || TKlayers == 22) {
469  LogDebug("SiStripHitEfficiency:HitEff") << "skipping original TM for TOB 6 or TEC 9" << endl;
470  continue;
471  }
472 
473  // Make vector of TrajectoryAtInvalidHits to hold the trajectories
474  std::vector<TrajectoryAtInvalidHit> TMs;
475 
476  // Make AnalyticalPropagator to use in TAVH constructor
478 
479  // for double sided layers check both sensors--if no hit was found on either sensor surface,
480  // the trajectory measurements only have one invalid hit entry on the matched surface
481  // so get the TrajectoryAtInvalidHit for both surfaces and include them in the study
482  if (::isDoubleSided(iidd, tTopo) && ((iidd & 0x3) == 0)) {
483  // do hit eff check twice--once for each sensor
484  //add a TM for each surface
485  TMs.push_back(TrajectoryAtInvalidHit(*itm, tTopo, tkgeom, propagator, 1));
486  TMs.push_back(TrajectoryAtInvalidHit(*itm, tTopo, tkgeom, propagator, 2));
487  } else if (::isDoubleSided(iidd, tTopo) && (!::check2DPartner(iidd, TMeas))) {
488  // if only one hit was found the trajectory measurement is on that sensor surface, and the other surface from
489  // the matched layer should be added to the study as well
490  TMs.push_back(TrajectoryAtInvalidHit(*itm, tTopo, tkgeom, propagator, 1));
491  TMs.push_back(TrajectoryAtInvalidHit(*itm, tTopo, tkgeom, propagator, 2));
492  LogDebug("SiStripHitEfficiency:HitEff") << " found a hit with a missing partner";
493  } else {
494  //only add one TM for the single surface and the other will be added in the next iteration
495  TMs.push_back(TrajectoryAtInvalidHit(*itm, tTopo, tkgeom, propagator));
496  }
497  bool missingHitAdded = false;
498 
499  vector<TrajectoryMeasurement> tmpTmeas;
500  unsigned int misLayer = TKlayers + 1;
501  //Use bool doMissingHitsRecovery to add possible missing hits based on actual/previous hit
503  if (int(TKlayers) - int(prev_TKlayers) == -2) {
504  const DetLayer* detlayer = itm->layer();
505  const LayerMeasurements layerMeasurements{*measurementTrackerHandle, *measurementTrackerEvent};
506  const TrajectoryStateOnSurface tsos = itm->updatedState();
507  std::vector<DetLayer::DetWithState> compatDets = detlayer->compatibleDets(tsos, *thePropagator, *estimator);
508 
509  if (misLayer > k_LayersAtTIDEnd && misLayer < k_LayersAtTECEnd) { //TEC
510  std::vector<ForwardDetLayer const*> negTECLayers =
511  measurementTrackerHandle->geometricSearchTracker()->negTecLayers();
512  std::vector<ForwardDetLayer const*> posTECLayers =
513  measurementTrackerHandle->geometricSearchTracker()->posTecLayers();
514  const DetLayer* tecLayerneg = negTECLayers[misLayer - k_LayersAtTIDEnd - 1];
515  const DetLayer* tecLayerpos = posTECLayers[misLayer - k_LayersAtTIDEnd - 1];
516  if (tTopo->tecSide(iidd) == 1) {
517  tmpTmeas = layerMeasurements.measurements(*tecLayerneg, tsos, *thePropagator, *estimator);
518  } else if (tTopo->tecSide(iidd) == 2) {
519  tmpTmeas = layerMeasurements.measurements(*tecLayerpos, tsos, *thePropagator, *estimator);
520  }
521  }
522 
523  else if (misLayer == (k_LayersAtTIDEnd - 1) ||
524  misLayer == k_LayersAtTIDEnd) { // This is for TID layers 12 and 13
525 
526  std::vector<ForwardDetLayer const*> negTIDLayers =
527  measurementTrackerHandle->geometricSearchTracker()->negTidLayers();
528  std::vector<ForwardDetLayer const*> posTIDLayers =
529  measurementTrackerHandle->geometricSearchTracker()->posTidLayers();
530  const DetLayer* tidLayerneg = negTIDLayers[misLayer - k_LayersAtTOBEnd - 1];
531  const DetLayer* tidLayerpos = posTIDLayers[misLayer - k_LayersAtTOBEnd - 1];
532 
533  if (tTopo->tidSide(iidd) == 1) {
534  tmpTmeas = layerMeasurements.measurements(*tidLayerneg, tsos, *thePropagator, *estimator);
535  } else if (tTopo->tidSide(iidd) == 2) {
536  tmpTmeas = layerMeasurements.measurements(*tidLayerpos, tsos, *thePropagator, *estimator);
537  }
538  }
539 
540  if (misLayer > k_LayersStart && misLayer < k_LayersAtTOBEnd) { // Barrel
541 
542  std::vector<BarrelDetLayer const*> barrelTIBLayers =
543  measurementTrackerHandle->geometricSearchTracker()->tibLayers();
544  std::vector<BarrelDetLayer const*> barrelTOBLayers =
545  measurementTrackerHandle->geometricSearchTracker()->tobLayers();
546 
547  if (misLayer > k_LayersStart && misLayer <= k_LayersAtTIBEnd) {
548  const DetLayer* tibLayer = barrelTIBLayers[misLayer - k_LayersStart - 1];
549  tmpTmeas = layerMeasurements.measurements(*tibLayer, tsos, *thePropagator, *estimator);
550  } else if (misLayer > k_LayersAtTIBEnd && misLayer < k_LayersAtTOBEnd) {
551  const DetLayer* tobLayer = barrelTOBLayers[misLayer - k_LayersAtTIBEnd - 1];
552  tmpTmeas = layerMeasurements.measurements(*tobLayer, tsos, *thePropagator, *estimator);
553  }
554  }
555  }
556  if ((int(TKlayers) > k_LayersStart && int(TKlayers) <= k_LayersAtTIBEnd) && int(prev_TKlayers) == 12) {
557  const DetLayer* detlayer = itm->layer();
558  const LayerMeasurements layerMeasurements{*measurementTrackerHandle, *measurementTrackerEvent};
559  const TrajectoryStateOnSurface tsos = itm->updatedState();
560  std::vector<DetLayer::DetWithState> compatDets = detlayer->compatibleDets(tsos, *thePropagator, *estimator);
561  std::vector<ForwardDetLayer const*> negTIDLayers =
562  measurementTrackerHandle->geometricSearchTracker()->negTidLayers();
563  std::vector<ForwardDetLayer const*> posTIDLayers =
564  measurementTrackerHandle->geometricSearchTracker()->posTidLayers();
565 
566  const DetLayer* tidLayerneg = negTIDLayers[k_LayersStart];
567  const DetLayer* tidLayerpos = posTIDLayers[k_LayersStart];
568  if (tTopo->tidSide(iidd) == 1) {
569  tmpTmeas = layerMeasurements.measurements(*tidLayerneg, tsos, *thePropagator, *estimator);
570  } else if (tTopo->tidSide(iidd) == 2) {
571  tmpTmeas = layerMeasurements.measurements(*tidLayerpos, tsos, *thePropagator, *estimator);
572  }
573  }
574 
575  if ((int(TKlayers) > k_LayersAtTIBEnd && int(TKlayers) <= k_LayersAtTOBEnd) && int(prev_TKlayers) == 15) {
576  const DetLayer* detlayer = itm->layer();
577  const LayerMeasurements layerMeasurements{*measurementTrackerHandle, *measurementTrackerEvent};
578  const TrajectoryStateOnSurface tsos = itm->updatedState();
579  std::vector<DetLayer::DetWithState> compatDets = detlayer->compatibleDets(tsos, *thePropagator, *estimator);
580 
581  std::vector<ForwardDetLayer const*> negTECLayers =
582  measurementTrackerHandle->geometricSearchTracker()->negTecLayers();
583  std::vector<ForwardDetLayer const*> posTECLayers =
584  measurementTrackerHandle->geometricSearchTracker()->posTecLayers();
585 
586  const DetLayer* tecLayerneg = negTECLayers[k_LayersStart];
587  const DetLayer* tecLayerpos = posTECLayers[k_LayersStart];
588  if (tTopo->tecSide(iidd) == 1) {
589  tmpTmeas = layerMeasurements.measurements(*tecLayerneg, tsos, *thePropagator, *estimator);
590  } else if (tTopo->tecSide(iidd) == 2) {
591  tmpTmeas = layerMeasurements.measurements(*tecLayerpos, tsos, *thePropagator, *estimator);
592  }
593  }
594 
595  if (!tmpTmeas.empty()) {
596  TrajectoryMeasurement TM_tmp(tmpTmeas.back());
597  unsigned int iidd_tmp = TM_tmp.recHit()->geographicalId().rawId();
598  if (iidd_tmp != 0) {
599  LogDebug("SiStripHitEfficiency:HitEff") << " hit actually being added to TM vector";
600  if ((!useAllHitsFromTracksWithMissingHits_ || (!useFirstMeas_ && isFirstMeas)))
601  TMs.clear();
602  if (::isDoubleSided(iidd_tmp, tTopo)) {
603  TMs.push_back(TrajectoryAtInvalidHit(TM_tmp, tTopo, tkgeom, propagator, 1));
604  TMs.push_back(TrajectoryAtInvalidHit(TM_tmp, tTopo, tkgeom, propagator, 2));
605  } else
606  TMs.push_back(TrajectoryAtInvalidHit(TM_tmp, tTopo, tkgeom, propagator));
607  missingHitAdded = true;
608  hitRecoveryCounters[misLayer] += 1;
609  }
610  }
611  }
612 
613  prev_TKlayers = TKlayers;
614  if (!useFirstMeas_ && isFirstMeas && !missingHitAdded)
615  continue;
616  if (!useLastMeas_ && isLastMeas)
617  continue;
618  bool hitsWithBias = false;
619  for (auto ilayer : missedLayers) {
620  if (ilayer < TKlayers)
621  hitsWithBias = true;
622  }
623  if (hasMissingHits && theInHit->getType() != TrackingRecHit::Type::missing && !missingHitAdded &&
624  hitsWithBias && !useAllHitsFromTracksWithMissingHits_) {
625  continue;
626  }
628  //Now check for tracks at TOB6 and TEC9
629 
630  // to make sure we only propagate on the last TOB5 hit check the next entry isn't also in TOB5
631  // to avoid bias, make sure the TOB5 hit is valid (an invalid hit on TOB5 could only exist with a valid hit on TOB6)
632 
633  bool isValid = theInHit->isValid();
634  bool isLast = (itm == (TMeas.end() - 1));
635  bool isLastTOB5 = true;
636  if (!isLast) {
637  if (::checkLayer((++itm)->recHit()->geographicalId().rawId(), tTopo) == 9)
638  isLastTOB5 = false;
639  else
640  isLastTOB5 = true;
641  --itm;
642  }
643 
644  if (TKlayers == 9 && isValid && isLastTOB5) {
645  // if ( TKlayers==9 && itm==TMeas.rbegin()) {
646  // if ( TKlayers==9 && (itm==TMeas.back()) ) { // to check for only the last entry in the trajectory for propagation
647  std::vector<BarrelDetLayer const*> barrelTOBLayers =
648  measurementTrackerHandle->geometricSearchTracker()->tobLayers();
649  const DetLayer* tob6 = barrelTOBLayers[barrelTOBLayers.size() - 1];
650  const LayerMeasurements layerMeasurements{*measurementTrackerHandle, *measurementTrackerEvent};
651  const TrajectoryStateOnSurface tsosTOB5 = itm->updatedState();
652  auto tmp = layerMeasurements.measurements(*tob6, tsosTOB5, *thePropagator, *estimator);
653 
654  if (!tmp.empty()) {
655  LogDebug("SiStripHitEfficiency:HitEff") << "size of TM from propagation = " << tmp.size() << endl;
656 
657  // take the last of the TMs, which is always an invalid hit
658  // if no detId is available, ie detId==0, then no compatible layer was crossed
659  // otherwise, use that TM for the efficiency measurement
660  TrajectoryMeasurement tob6TM(tmp.back());
661  const auto& tob6Hit = tob6TM.recHit();
662 
663  if (tob6Hit->geographicalId().rawId() != 0) {
664  LogDebug("SiStripHitEfficiency:HitEff") << "tob6 hit actually being added to TM vector" << endl;
665  TMs.push_back(TrajectoryAtInvalidHit(tob6TM, tTopo, tkgeom, propagator));
666  }
667  }
668  }
669 
670  bool isLastTEC8 = true;
671  if (!isLast) {
672  if (::checkLayer((++itm)->recHit()->geographicalId().rawId(), tTopo) == 21)
673  isLastTEC8 = false;
674  else
675  isLastTEC8 = true;
676  --itm;
677  }
678 
679  if (TKlayers == 21 && isValid && isLastTEC8) {
680  std::vector<const ForwardDetLayer*> posTecLayers =
681  measurementTrackerHandle->geometricSearchTracker()->posTecLayers();
682  const DetLayer* tec9pos = posTecLayers[posTecLayers.size() - 1];
683  std::vector<const ForwardDetLayer*> negTecLayers =
684  measurementTrackerHandle->geometricSearchTracker()->negTecLayers();
685  const DetLayer* tec9neg = negTecLayers[negTecLayers.size() - 1];
686  const LayerMeasurements layerMeasurements{*measurementTrackerHandle, *measurementTrackerEvent};
687  const TrajectoryStateOnSurface tsosTEC9 = itm->updatedState();
688 
689  // check if track on positive or negative z
690  if (!(iidd == StripSubdetector::TEC))
691  LogDebug("SiStripHitEfficiency:HitEff") << "there is a problem with TEC 9 extrapolation" << endl;
692 
693  //LOGPRINT << " tec9 id = " << iidd << " and side = " << tTopo->tecSide(iidd) << endl;
694  vector<TrajectoryMeasurement> tmp;
695  if (tTopo->tecSide(iidd) == 1) {
696  tmp = layerMeasurements.measurements(*tec9neg, tsosTEC9, *thePropagator, *estimator);
697  //LOGPRINT << "on negative side" << endl;
698  }
699  if (tTopo->tecSide(iidd) == 2) {
700  tmp = layerMeasurements.measurements(*tec9pos, tsosTEC9, *thePropagator, *estimator);
701  //LOGPRINT << "on positive side" << endl;
702  }
703 
704  if (!tmp.empty()) {
705  // take the last of the TMs, which is always an invalid hit
706  // if no detId is available, ie detId==0, then no compatible layer was crossed
707  // otherwise, use that TM for the efficiency measurement
708  TrajectoryMeasurement tec9TM(tmp.back());
709  const auto& tec9Hit = tec9TM.recHit();
710 
711  unsigned int tec9id = tec9Hit->geographicalId().rawId();
712  LogDebug("SiStripHitEfficiency:HitEff")
713  << "tec9id = " << tec9id << " is Double sided = " << ::isDoubleSided(tec9id, tTopo)
714  << " and 0x3 = " << (tec9id & 0x3) << endl;
715 
716  if (tec9Hit->geographicalId().rawId() != 0) {
717  LogDebug("SiStripHitEfficiency:HitEff") << "tec9 hit actually being added to TM vector" << endl;
718  // in tec the hit can be single or doubled sided. whenever the invalid hit at the end of vector of TMs is
719  // double sided it is always on the matched surface, so we need to split it into the true sensor surfaces
720  if (::isDoubleSided(tec9id, tTopo)) {
721  TMs.push_back(TrajectoryAtInvalidHit(tec9TM, tTopo, tkgeom, propagator, 1));
722  TMs.push_back(TrajectoryAtInvalidHit(tec9TM, tTopo, tkgeom, propagator, 2));
723  } else
724  TMs.push_back(TrajectoryAtInvalidHit(tec9TM, tTopo, tkgeom, propagator));
725  }
726  } //else LOGPRINT << "tec9 tmp empty" << endl;
727  }
728  hitTotalCounters[TKlayers] += 1;
729 
731 
732  // Modules Constraints
733 
734  for (std::vector<TrajectoryAtInvalidHit>::const_iterator TM = TMs.begin(); TM != TMs.end(); ++TM) {
735  // --> Get trajectory from combinatedState
736  iidd = TM->monodet_id();
737  LogDebug("SiStripHitEfficiency:HitEff") << "setting iidd = " << iidd << " before checking efficiency and ";
738 
739  xloc = TM->localX();
740  yloc = TM->localY();
741 
742  angleX = atan(TM->localDxDz());
743  angleY = atan(TM->localDyDz());
744 
745  TrajLocErrX = 0.0;
746  TrajLocErrY = 0.0;
747 
748  xglob = TM->globalX();
749  yglob = TM->globalY();
750  zglob = TM->globalZ();
751  xErr = TM->localErrorX();
752  yErr = TM->localErrorY();
753 
754  TrajGlbX = 0.0;
755  TrajGlbY = 0.0;
756  TrajGlbZ = 0.0;
757  withinAcceptance = TM->withinAcceptance();
758 
759  trajHitValid = TM->validHit();
760  int TrajStrip = -1;
761 
762  // reget layer from iidd here, to account for TOB 6 and TEC 9 TKlayers being off
763  TKlayers = ::checkLayer(iidd, tTopo);
764 
765  if ((layers == TKlayers) || (layers == 0)) { // Look at the layer not used to reconstruct the track
766  whatlayer = TKlayers;
767  LogDebug("SiStripHitEfficiency:HitEff") << "Looking at layer under study" << endl;
768  ModIsBad = 2;
769  Id = 0;
770  SiStripQualBad = 0;
771  run = 0;
772  event = 0;
773  TrajLocX = 0.0;
774  TrajLocY = 0.0;
775  TrajLocAngleX = -999.0;
776  TrajLocAngleY = -999.0;
777  ResX = 0.0;
778  ResXSig = 0.0;
779  ClusterLocX = 0.0;
780  ClusterLocY = 0.0;
781  ClusterLocErrX = 0.0;
782  ClusterLocErrY = 0.0;
783  ClusterStoN = 0.0;
784  bunchx = 0;
785  commonMode = -100;
786 
787  // RPhi RecHit Efficiency
788 
789  if (!input.empty()) {
790  LogDebug("SiStripHitEfficiency:HitEff") << "Checking clusters with size = " << input.size() << endl;
791  int nClusters = 0;
792  std::vector<std::vector<float> >
793  VCluster_info; //fill with X residual, X residual pull, local X, sig(X), local Y, sig(Y), StoN
794  for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter = input.begin(); DSViter != input.end();
795  DSViter++) {
796  // DSViter is a vector of SiStripClusters located on a single module
797  //if (DEBUG) LOGPRINT << "the ID from the DSViter = " << DSViter->id() << endl;
798  unsigned int ClusterId = DSViter->id();
799  if (ClusterId == iidd) {
800  LogDebug("SiStripHitEfficiency:HitEff")
801  << "found (ClusterId == iidd) with ClusterId = " << ClusterId << " and iidd = " << iidd << endl;
802  DetId ClusterDetId(ClusterId);
803  const StripGeomDetUnit* stripdet = (const StripGeomDetUnit*)tkgeom->idToDetUnit(ClusterDetId);
804  const StripTopology& Topo = stripdet->specificTopology();
805 
806  float hbedge = 0.0;
807  float htedge = 0.0;
808  float hapoth = 0.0;
809  float uylfac = 0.0;
810  float uxlden = 0.0;
811  if (TKlayers >= 11) {
812  const BoundPlane& plane = stripdet->surface();
813  const TrapezoidalPlaneBounds* trapezoidalBounds(
814  dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
815  std::array<const float, 4> const& parameterTrap =
816  (*trapezoidalBounds).parameters(); // el bueno aqui
817  hbedge = parameterTrap[0];
818  htedge = parameterTrap[1];
819  hapoth = parameterTrap[3];
820  uylfac = (htedge - hbedge) / (htedge + hbedge) / hapoth;
821  uxlden = 1 + yloc * uylfac;
822  }
823 
824  // Need to know position of trajectory in strip number for selecting the right APV later
825  if (TrajStrip == -1) {
826  int nstrips = Topo.nstrips();
827  float pitch = stripdet->surface().bounds().width() / nstrips;
828  TrajStrip = xloc / pitch + nstrips / 2.0;
829  // Need additionnal corrections for endcap
830  if (TKlayers >= 11) {
831  float TrajLocXMid = xloc / (1 + (htedge - hbedge) * yloc / (htedge + hbedge) /
832  hapoth); // radialy extrapolated x loc position at middle
833  TrajStrip = TrajLocXMid / pitch + nstrips / 2.0;
834  }
835  //LOGPRINT<<" Layer "<<TKlayers<<" TrajStrip: "<<nstrips<<" "<<pitch<<" "<<TrajStrip<<endl;
836  }
837 
838  for (edmNew::DetSet<SiStripCluster>::const_iterator iter = DSViter->begin(); iter != DSViter->end();
839  ++iter) {
840  //iter is a single SiStripCluster
841  StripClusterParameterEstimator::LocalValues parameters = stripcpe.localParameters(*iter, *stripdet);
842  float res = (parameters.first.x() - xloc);
843  float sigma = ::checkConsistency(parameters, xloc, xErr);
844  // The consistency is probably more accurately measured with the Chi2MeasurementEstimator. To use it
845  // you need a TransientTrackingRecHit instead of the cluster
846  //theEstimator= new Chi2MeasurementEstimator(30);
847  //const Chi2MeasurementEstimator *theEstimator(100);
848  //theEstimator->estimate(TM->tsos(), TransientTrackingRecHit);
849 
850  if (TKlayers >= 11) {
851  res = parameters.first.x() - xloc / uxlden; // radialy extrapolated x loc position at middle
852  sigma = abs(res) /
853  sqrt(parameters.second.xx() + xErr * xErr / uxlden / uxlden +
854  yErr * yErr * xloc * xloc * uylfac * uylfac / uxlden / uxlden / uxlden / uxlden);
855  }
856 
857  siStripClusterInfo_.setCluster(*iter, ClusterId);
858  // signal to noise from SiStripClusterInfo not working in 225. I'll fix this after the interface
859  // redesign in 300 -ku
860  //float cluster_info[7] = {res, sigma, parameters.first.x(), sqrt(parameters.second.xx()), parameters.first.y(), sqrt(parameters.second.yy()), signal_to_noise};
861  std::vector<float> cluster_info;
862  cluster_info.push_back(res);
863  cluster_info.push_back(sigma);
864  cluster_info.push_back(parameters.first.x());
865  cluster_info.push_back(sqrt(parameters.second.xx()));
866  cluster_info.push_back(parameters.first.y());
867  cluster_info.push_back(sqrt(parameters.second.yy()));
868  cluster_info.push_back(siStripClusterInfo_.signalOverNoise());
869  VCluster_info.push_back(cluster_info);
870  nClusters++;
871  LogDebug("SiStripHitEfficiency:HitEff") << "Have ID match. residual = " << VCluster_info.back()[0]
872  << " res sigma = " << VCluster_info.back()[1] << endl;
873  LogDebug("SiStripHitEfficiency:HitEff")
874  << "trajectory measurement compatability estimate = " << (*itm).estimate() << endl;
875  LogDebug("SiStripHitEfficiency:HitEff")
876  << "hit position = " << parameters.first.x() << " hit error = " << sqrt(parameters.second.xx())
877  << " trajectory position = " << xloc << " traj error = " << xErr << endl;
878  }
879  }
880  }
881  float FinalResSig = 1000.0;
882  float FinalCluster[7] = {1000.0, 1000.0, 0.0, 0.0, 0.0, 0.0, 0.0};
883  if (nClusters > 0) {
884  LogDebug("SiStripHitEfficiency:HitEff") << "found clusters > 0" << endl;
885  if (nClusters > 1) {
886  //get the smallest one
887  vector<vector<float> >::iterator ires;
888  for (ires = VCluster_info.begin(); ires != VCluster_info.end(); ires++) {
889  if (abs((*ires)[1]) < abs(FinalResSig)) {
890  FinalResSig = (*ires)[1];
891  for (unsigned int i = 0; i < ires->size(); i++) {
892  LogDebug("SiStripHitEfficiency:HitEff")
893  << "filling final cluster. i = " << i << " before fill FinalCluster[i]=" << FinalCluster[i]
894  << " and (*ires)[i] =" << (*ires)[i] << endl;
895  FinalCluster[i] = (*ires)[i];
896  LogDebug("SiStripHitEfficiency:HitEff")
897  << "filling final cluster. i = " << i << " after fill FinalCluster[i]=" << FinalCluster[i]
898  << " and (*ires)[i] =" << (*ires)[i] << endl;
899  }
900  }
901  LogDebug("SiStripHitEfficiency:HitEff")
902  << "iresidual = " << (*ires)[0] << " isigma = " << (*ires)[1]
903  << " and FinalRes = " << FinalCluster[0] << endl;
904  }
905  } else {
906  FinalResSig = VCluster_info.at(0)[1];
907  for (unsigned int i = 0; i < VCluster_info.at(0).size(); i++) {
908  FinalCluster[i] = VCluster_info.at(0)[i];
909  }
910  }
911  VCluster_info.clear();
912  }
913 
914  LogDebug("SiStripHitEfficiency:HitEff")
915  << "Final residual in X = " << FinalCluster[0] << "+-" << (FinalCluster[0] / FinalResSig) << endl;
916  LogDebug("SiStripHitEfficiency:HitEff") << "Checking location of trajectory: abs(yloc) = " << abs(yloc)
917  << " abs(xloc) = " << abs(xloc) << endl;
918  LogDebug("SiStripHitEfficiency:HitEff")
919  << "Checking location of cluster hit: yloc = " << FinalCluster[4] << "+-" << FinalCluster[5]
920  << " xloc = " << FinalCluster[2] << "+-" << FinalCluster[3] << endl;
921  LogDebug("SiStripHitEfficiency:HitEff") << "Final cluster signal to noise = " << FinalCluster[6] << endl;
922 
923  float exclusionWidth = 0.4;
924  float TOBexclusion = 0.0;
925  float TECexRing5 = -0.89;
926  float TECexRing6 = -0.56;
927  float TECexRing7 = 0.60;
928  //Added by Chris Edelmaier to do TEC bonding exclusion
929  int subdetector = ((iidd >> 25) & 0x7);
930  int ringnumber = ((iidd >> 5) & 0x7);
931 
932  //New TOB and TEC bonding region exclusion zone
933  if ((TKlayers >= 5 && TKlayers < 11) ||
934  ((subdetector == 6) && ((ringnumber >= 5) && (ringnumber <= 7)))) {
935  //There are only 2 cases that we need to exclude for
936  float highzone = 0.0;
937  float lowzone = 0.0;
938  float higherr = yloc + 5.0 * yErr;
939  float lowerr = yloc - 5.0 * yErr;
940  if (TKlayers >= 5 && TKlayers < 11) {
941  //TOB zone
942  highzone = TOBexclusion + exclusionWidth;
943  lowzone = TOBexclusion - exclusionWidth;
944  } else if (ringnumber == 5) {
945  //TEC ring 5
946  highzone = TECexRing5 + exclusionWidth;
947  lowzone = TECexRing5 - exclusionWidth;
948  } else if (ringnumber == 6) {
949  //TEC ring 6
950  highzone = TECexRing6 + exclusionWidth;
951  lowzone = TECexRing6 - exclusionWidth;
952  } else if (ringnumber == 7) {
953  //TEC ring 7
954  highzone = TECexRing7 + exclusionWidth;
955  lowzone = TECexRing7 - exclusionWidth;
956  }
957  //Now that we have our exclusion region, we just have to properly identify it
958  if ((highzone <= higherr) && (highzone >= lowerr))
959  withinAcceptance = false;
960  if ((lowzone >= lowerr) && (lowzone <= higherr))
961  withinAcceptance = false;
962  if ((higherr <= highzone) && (higherr >= lowzone))
963  withinAcceptance = false;
964  if ((lowerr >= lowzone) && (lowerr <= highzone))
965  withinAcceptance = false;
966  }
967 
968  // fill ntuple varibles
969  //get global position from module id number iidd
970  TrajGlbX = xglob;
971  TrajGlbY = yglob;
972  TrajGlbZ = zglob;
973 
974  TrajLocErrX = xErr;
975  TrajLocErrY = yErr;
976 
977  Id = iidd;
978  run = run_nr;
979  event = ev_nr;
980  bunchx = bunch_nr;
981  //if ( SiStripQuality_->IsModuleBad(iidd) ) {
982  if (SiStripQuality_->getBadApvs(iidd) != 0) {
983  SiStripQualBad = 1;
984  LogDebug("SiStripHitEfficiency:HitEff") << "strip is bad from SiStripQuality" << endl;
985  } else {
986  SiStripQualBad = 0;
987  LogDebug("SiStripHitEfficiency:HitEff") << "strip is good from SiStripQuality" << endl;
988  }
989 
990  //check for FED-detected errors and include those in SiStripQualBad
991  for (unsigned int ii = 0; ii < fedErrorIds.size(); ii++) {
992  if (iidd == fedErrorIds[ii].rawId())
993  SiStripQualBad = 1;
994  }
995 
996  TrajLocX = xloc;
997  TrajLocY = yloc;
998  TrajLocAngleX = angleX;
999  TrajLocAngleY = angleY;
1000  ResX = FinalCluster[0];
1001  ResXSig = FinalResSig;
1002  if (FinalResSig != FinalCluster[1])
1003  LogDebug("SiStripHitEfficiency:HitEff")
1004  << "Problem with best cluster selection because FinalResSig = " << FinalResSig
1005  << " and FinalCluster[1] = " << FinalCluster[1] << endl;
1006  ClusterLocX = FinalCluster[2];
1007  ClusterLocY = FinalCluster[4];
1008  ClusterLocErrX = FinalCluster[3];
1009  ClusterLocErrY = FinalCluster[5];
1010  ClusterStoN = FinalCluster[6];
1011 
1012  // CM of APV crossed by traj
1013  if (addCommonMode_)
1014  if (commonModeDigis.isValid() && TrajStrip >= 0 && TrajStrip <= 768) {
1015  edm::DetSetVector<SiStripRawDigi>::const_iterator digiframe = commonModeDigis->find(iidd);
1016  if (digiframe != commonModeDigis->end())
1017  if ((unsigned)TrajStrip / 128 < digiframe->data.size())
1018  commonMode = digiframe->data.at(TrajStrip / 128).adc();
1019  }
1020 
1021  LogDebug("SiStripHitEfficiency:HitEff") << "before check good" << endl;
1022 
1023  if (FinalResSig < 999.0) { //could make requirement on track/hit consistency, but for
1024  //now take anything with a hit on the module
1025  LogDebug("SiStripHitEfficiency:HitEff")
1026  << "hit being counted as good " << FinalCluster[0] << " FinalRecHit " << iidd << " TKlayers "
1027  << TKlayers << " xloc " << xloc << " yloc " << yloc << " module " << iidd
1028  << " matched/stereo/rphi = " << ((iidd & 0x3) == 0) << "/" << ((iidd & 0x3) == 1) << "/"
1029  << ((iidd & 0x3) == 2) << endl;
1030  ModIsBad = 0;
1031  traj->Fill();
1032  } else {
1033  LogDebug("SiStripHitEfficiency:HitEff")
1034  << "hit being counted as bad ######### Invalid RPhi FinalResX " << FinalCluster[0]
1035  << " FinalRecHit " << iidd << " TKlayers " << TKlayers << " xloc " << xloc << " yloc " << yloc
1036  << " module " << iidd << " matched/stereo/rphi = " << ((iidd & 0x3) == 0) << "/"
1037  << ((iidd & 0x3) == 1) << "/" << ((iidd & 0x3) == 2) << endl;
1038  ModIsBad = 1;
1039  traj->Fill();
1040 
1041  LogDebug("SiStripHitEfficiency:HitEff") << " RPhi Error " << sqrt(xErr * xErr + yErr * yErr)
1042  << " ErrorX " << xErr << " yErr " << yErr << endl;
1043  }
1044  LogDebug("SiStripHitEfficiency:HitEff") << "after good location check" << endl;
1045  }
1046  LogDebug("SiStripHitEfficiency:HitEff") << "after list of clusters" << endl;
1047  }
1048  LogDebug("SiStripHitEfficiency:HitEff") << "After layers=TKLayers if" << endl;
1049  }
1050  LogDebug("SiStripHitEfficiency:HitEff") << "After looping over TrajAtValidHit list" << endl;
1051  }
1052  LogDebug("SiStripHitEfficiency:HitEff") << "end TMeasurement loop" << endl;
1053  }
1054  LogDebug("SiStripHitEfficiency:HitEff") << "end of trajectories loop" << endl;
1055  }
1056 }
std::pair< LocalPoint, LocalError > LocalValues
static constexpr auto TEC
virtual int nstrips() const =0
float TrajGlbZ
Definition: HitEff.h:123
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
Definition: HitEff.h:94
float ClusterLocErrX
Definition: HitEff.h:126
std::vector< unsigned int > hitRecoveryCounters
Definition: HitEff.h:109
float ClusterLocErrY
Definition: HitEff.h:126
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
const edm::EDGetTokenT< OnlineLuminosityRecord > metaDataToken_
Definition: HitEff.h:66
void setCluster(const SiStripCluster &cluster, int detId)
float TrajGlbY
Definition: HitEff.h:123
std::vector< unsigned int > hitTotalCounters
Definition: HitEff.h:110
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Definition: HitEff.h:90
float TrajLocX
Definition: HitEff.h:124
float ResXSig
Definition: HitEff.h:127
bool useAllHitsFromTracksWithMissingHits_
Definition: HitEff.h:77
unsigned int tidSide(const DetId &id) const
TString subdetector
bool doMissingHitsRecovery_
Definition: HitEff.h:78
float instLumi
Definition: HitEff.h:137
const edm::EDGetTokenT< std::vector< Trajectory > > trajectories_token_
Definition: HitEff.h:81
T const * product() const
Definition: Handle.h:70
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
const edm::EDGetTokenT< DetIdVector > digisVec_token_
Definition: HitEff.h:85
SiStripClusterInfo siStripClusterInfo_
Definition: HitEff.h:69
float ClusterStoN
Definition: HitEff.h:126
data_type const * const_iterator
Definition: DetSetNew.h:31
float TrajLocErrX
Definition: HitEff.h:125
float instLumi() const
Return the luminosity for the current nibble.
float commonMode
Definition: HitEff.h:138
const edm::EDGetTokenT< DetIdCollection > digisCol_token_
Definition: HitEff.h:84
const edm::ESGetToken< SiStripQuality, SiStripQualityRcd > siStripQualityToken_
Definition: HitEff.h:93
Definition: Electron.h:6
missing
Definition: combine.py:5
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
const edm::EDGetTokenT< MeasurementTrackerEvent > trackerEvent_token_
Definition: HitEff.h:86
unsigned int bunchx
Definition: HitEff.h:135
static std::string const input
Definition: EdmProvDump.cc:50
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
Definition: HitEff.h:91
const_iterator end() const
last iterator over the map (read only)
float signalOverNoise() const
bool highPurity
Definition: HitEff.h:132
size_type size() const
Return the number of contained DetSets.
Definition: DetSetVector.h:250
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
Definition: HitEff.h:83
unsigned int tecSide(const DetId &id) const
float PU
Definition: HitEff.h:137
int nHits
Definition: HitEff.h:133
unsigned int Id
Definition: HitEff.h:129
const edm::EDGetTokenT< reco::TrackCollection > combinatorialTracks_token_
Definition: HitEff.h:80
T sqrt(T t)
Definition: SSEVec.h:19
float timeAtIpInOutErr
Definition: MuonTime.h:14
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
Definition: HitEff.h:97
int nDof
number of muon stations used
Definition: MuonTime.h:9
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned int trajHitValid
Definition: HitEff.h:135
unsigned int ModIsBad
Definition: HitEff.h:128
float TrajGlbX
Definition: HitEff.h:123
const edm::ESGetToken< MeasurementTracker, CkfComponentsRecord > measurementTkToken_
Definition: HitEff.h:95
bool withinAcceptance
Definition: HitEff.h:131
unsigned int run
Definition: HitEff.h:135
float ClusterLocX
Definition: HitEff.h:126
ii
Definition: cuy.py:589
int events
Definition: HitEff.h:102
float TrajLocAngleX
Definition: HitEff.h:124
const edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecord > chi2MeasurementEstimatorToken_
Definition: HitEff.h:96
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetId.h:17
int totalNbHits
Definition: HitEff.h:121
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
bool useLastMeas_
Definition: HitEff.h:76
unsigned int whatlayer
Definition: HitEff.h:107
const edm::ESGetToken< StripClusterParameterEstimator, TkStripCPERecord > cpeToken_
Definition: HitEff.h:92
virtual const std::array< const float, 4 > parameters() const
unsigned int trackMultiplicityCut_
Definition: HitEff.h:74
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
unsigned int layers
Definition: HitEff.h:105
float pT
Definition: HitEff.h:134
float ResX
Definition: HitEff.h:127
bool addLumi_
Definition: HitEff.h:71
bool isValid() const
Definition: HandleBase.h:70
unsigned int SiStripQualBad
Definition: HitEff.h:130
bool addCommonMode_
Definition: HitEff.h:72
const_iterator begin() const
first iterator over the map (read only)
const edm::EDGetTokenT< TrajTrackAssociationCollection > trajTrackAsso_token_
Definition: HitEff.h:82
fixed size matrix
HLT enums.
float TrajLocErrY
Definition: HitEff.h:125
float TrajLocAngleY
Definition: HitEff.h:124
bool cutOnTracks_
Definition: HitEff.h:73
bool useFirstMeas_
Definition: HitEff.h:75
Log< level::Warning, false > LogWarning
float ClusterLocY
Definition: HitEff.h:126
void initEvent(const edm::EventSetup &iSetup)
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
tmp
align.sh
Definition: createJobs.py:716
const edm::EDGetTokenT< LumiScalersCollection > scalerToken_
Definition: HitEff.h:65
TTree * traj
Definition: HitEff.h:101
virtual float width() const =0
const edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > commonModeToken_
Definition: HitEff.h:67
float timeAtIpInOut
Definition: MuonTime.h:13
int EventTrackCKF
Definition: HitEff.h:102
float avgPileUp() const
Return the average pileup for th current nibble.
float TrajLocY
Definition: HitEff.h:124
std::vector< int > missHitPerLayer
Definition: HitEff.h:122
ConstRecHitPointer const & recHit() const
#define LogDebug(id)
short getBadApvs(uint32_t detid) const
const Bounds & bounds() const
Definition: Surface.h:87

◆ beginJob()

void HitEff::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 115 of file HitEff.cc.

References addCommonMode_, addLumi_, bunchx, nano_mu_local_reco_cff::chi2, ClusterLocErrX, ClusterLocErrY, ClusterLocX, ClusterLocY, ClusterStoN, commonMode, compSettings, events, EventTrackCKF, compareTotals::fs, highPurity, Id, instLumi, missHitPerLayer, ModIsBad, nHits, AlCaHLTBitMon_ParallelJobs::p, pT, PU, ResX, ResXSig, run, SiStripQualBad, totalNbHits, tquality, traj, TrajGlbX, TrajGlbY, TrajGlbZ, trajHitValid, TrajLocAngleX, TrajLocAngleY, TrajLocErrX, TrajLocErrY, TrajLocX, TrajLocY, whatlayer, and withinAcceptance.

115  {
117  if (compSettings > 0) {
118  edm::LogInfo("SiStripHitEfficiency:HitEff") << "the compressions settings are:" << compSettings << std::endl;
119  fs->file().SetCompressionSettings(compSettings);
120  }
121 
122  traj = fs->make<TTree>("traj", "tree of trajectory positions");
123 #ifdef ExtendedCALIBTree
124  traj->Branch("timeDT", &timeDT, "timeDT/F");
125  traj->Branch("timeDTErr", &timeDTErr, "timeDTErr/F");
126  traj->Branch("timeDTDOF", &timeDTDOF, "timeDTDOF/I");
127  traj->Branch("timeECAL", &timeECAL, "timeECAL/F");
128  traj->Branch("dedx", &dedx, "dedx/F");
129  traj->Branch("dedxNOM", &dedxNOM, "dedxNOM/I");
130  traj->Branch("nLostHits", &nLostHits, "nLostHits/I");
131  traj->Branch("chi2", &chi2, "chi2/F");
132  traj->Branch("p", &p, "p/F");
133 #endif
134  traj->Branch("TrajGlbX", &TrajGlbX, "TrajGlbX/F");
135  traj->Branch("TrajGlbY", &TrajGlbY, "TrajGlbY/F");
136  traj->Branch("TrajGlbZ", &TrajGlbZ, "TrajGlbZ/F");
137  traj->Branch("TrajLocX", &TrajLocX, "TrajLocX/F");
138  traj->Branch("TrajLocY", &TrajLocY, "TrajLocY/F");
139  traj->Branch("TrajLocAngleX", &TrajLocAngleX, "TrajLocAngleX/F");
140  traj->Branch("TrajLocAngleY", &TrajLocAngleY, "TrajLocAngleY/F");
141  traj->Branch("TrajLocErrX", &TrajLocErrX, "TrajLocErrX/F");
142  traj->Branch("TrajLocErrY", &TrajLocErrY, "TrajLocErrY/F");
143  traj->Branch("ClusterLocX", &ClusterLocX, "ClusterLocX/F");
144  traj->Branch("ClusterLocY", &ClusterLocY, "ClusterLocY/F");
145  traj->Branch("ClusterLocErrX", &ClusterLocErrX, "ClusterLocErrX/F");
146  traj->Branch("ClusterLocErrY", &ClusterLocErrY, "ClusterLocErrY/F");
147  traj->Branch("ClusterStoN", &ClusterStoN, "ClusterStoN/F");
148  traj->Branch("ResX", &ResX, "ResX/F");
149  traj->Branch("ResXSig", &ResXSig, "ResXSig/F");
150  traj->Branch("ModIsBad", &ModIsBad, "ModIsBad/i");
151  traj->Branch("SiStripQualBad", &SiStripQualBad, "SiStripQualBad/i");
152  traj->Branch("withinAcceptance", &withinAcceptance, "withinAcceptance/O");
153  traj->Branch("nHits", &nHits, "nHits/I");
154  traj->Branch("pT", &pT, "pT/F");
155  traj->Branch("highPurity", &highPurity, "highPurity/O");
156  traj->Branch("trajHitValid", &trajHitValid, "trajHitValid/i");
157  traj->Branch("Id", &Id, "Id/i");
158  traj->Branch("run", &run, "run/i");
159  traj->Branch("event", &event, "event/i");
160  traj->Branch("layer", &whatlayer, "layer/i");
161  traj->Branch("tquality", &tquality, "tquality/I");
162  traj->Branch("bunchx", &bunchx, "bunchx/I");
163  if (addLumi_) {
164  traj->Branch("instLumi", &instLumi, "instLumi/F");
165  traj->Branch("PU", &PU, "PU/F");
166  }
167  if (addCommonMode_)
168  traj->Branch("commonMode", &commonMode, "commonMode/F");
169 
170  events = 0;
171  EventTrackCKF = 0;
172 
173  totalNbHits = 0;
174  missHitPerLayer.resize(k_END_OF_LAYERS, 0);
175 }
float TrajGlbZ
Definition: HitEff.h:123
float ClusterLocErrX
Definition: HitEff.h:126
float ClusterLocErrY
Definition: HitEff.h:126
float TrajGlbY
Definition: HitEff.h:123
float TrajLocX
Definition: HitEff.h:124
float ResXSig
Definition: HitEff.h:127
int compSettings
Definition: HitEff.h:104
float instLumi
Definition: HitEff.h:137
float ClusterStoN
Definition: HitEff.h:126
float TrajLocErrX
Definition: HitEff.h:125
float commonMode
Definition: HitEff.h:138
unsigned int bunchx
Definition: HitEff.h:135
bool highPurity
Definition: HitEff.h:132
float PU
Definition: HitEff.h:137
int nHits
Definition: HitEff.h:133
unsigned int Id
Definition: HitEff.h:129
unsigned int trajHitValid
Definition: HitEff.h:135
unsigned int ModIsBad
Definition: HitEff.h:128
float TrajGlbX
Definition: HitEff.h:123
bool withinAcceptance
Definition: HitEff.h:131
unsigned int run
Definition: HitEff.h:135
float ClusterLocX
Definition: HitEff.h:126
int events
Definition: HitEff.h:102
float TrajLocAngleX
Definition: HitEff.h:124
Log< level::Info, false > LogInfo
int totalNbHits
Definition: HitEff.h:121
unsigned int whatlayer
Definition: HitEff.h:107
float pT
Definition: HitEff.h:134
float ResX
Definition: HitEff.h:127
bool addLumi_
Definition: HitEff.h:71
unsigned int SiStripQualBad
Definition: HitEff.h:130
bool addCommonMode_
Definition: HitEff.h:72
float TrajLocErrY
Definition: HitEff.h:125
float TrajLocAngleY
Definition: HitEff.h:124
float ClusterLocY
Definition: HitEff.h:126
TTree * traj
Definition: HitEff.h:101
int EventTrackCKF
Definition: HitEff.h:102
float TrajLocY
Definition: HitEff.h:124
int tquality
Definition: HitEff.h:136
std::vector< int > missHitPerLayer
Definition: HitEff.h:122
Definition: event.py:1

◆ endJob()

void HitEff::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 1058 of file HitEff.cc.

References doMissingHitsRecovery_, events, EventTrackCKF, hitRecoveryCounters, hitTotalCounters, mps_fire::i, LogDebug, missHitPerLayer, totalNbHits, and traj.

Referenced by o2olib.O2ORunMgr::executeJob().

1058  {
1059  traj->GetDirectory()->cd();
1060  traj->Write();
1061 
1062  LogDebug("SiStripHitEfficiency:HitEff") << " Events Analysed " << events << endl;
1063  LogDebug("SiStripHitEfficiency:HitEff") << " Number Of Tracked events " << EventTrackCKF << endl;
1064 
1065  if (doMissingHitsRecovery_) {
1066  float totTIB = 0.0;
1067  float totTOB = 0.0;
1068  float totTID = 0.0;
1069  float totTEC = 0.0;
1070 
1071  float totTIBrepro = 0.0;
1072  float totTOBrepro = 0.0;
1073  float totTIDrepro = 0.0;
1074  float totTECrepro = 0.0;
1075 
1076  edm::LogInfo("SiStripHitEfficiency:HitEff") << "Within TIB :";
1077  for (int i = 0; i <= k_LayersAtTIBEnd; i++) {
1078  edm::LogInfo("SiStripHitEfficiency:HitEff")
1079  << "Layer " << i << " has : " << missHitPerLayer[i] << "/" << totalNbHits << " = "
1080  << (missHitPerLayer[i] * 1.0 / totalNbHits) * 100 << " % of missing hit";
1081  totTIB += missHitPerLayer[i];
1082  edm::LogInfo("SiStripHitEfficiency:HitEff")
1083  << "Removing recovered hits : layer " << i << " has : " << missHitPerLayer[i] - hitRecoveryCounters[i] << "/"
1084  << totalNbHits << " = " << ((missHitPerLayer[i] - hitRecoveryCounters[i]) * 1.0 / totalNbHits) * 100
1085  << " % of missing hit";
1086  totTIBrepro += (missHitPerLayer[i] - hitRecoveryCounters[i]);
1087  }
1088  edm::LogInfo("SiStripHitEfficiency:HitEff")
1089  << "TOTAL % of missing hits within TIB :" << (totTIB * 1.0 / totalNbHits) * 100 << "%";
1090  edm::LogInfo("SiStripHitEfficiency:HitEff")
1091  << "AFTER repropagation :" << (totTIBrepro * 1.0 / totalNbHits) * 100 << "%";
1092 
1093  edm::LogInfo("SiStripHitEfficiency:HitEff") << "Within TOB :";
1094  for (int i = k_LayersAtTIBEnd + 1; i <= k_LayersAtTOBEnd; i++) {
1095  edm::LogInfo("SiStripHitEfficiency:HitEff")
1096  << "Layer " << i << " has : " << missHitPerLayer[i] << "/" << totalNbHits << " = "
1097  << (missHitPerLayer[i] * 1.0 / totalNbHits) * 100 << " % of missing hit";
1098  totTOB += missHitPerLayer[i];
1099  edm::LogInfo("SiStripHitEfficiency:HitEff")
1100  << "Removing recovered hits : layer " << i << " has : " << missHitPerLayer[i] - hitRecoveryCounters[i] << "/"
1101  << totalNbHits << " = " << ((missHitPerLayer[i] - hitRecoveryCounters[i]) * 1.0 / totalNbHits) * 100
1102  << " % of missing hit";
1103  totTOBrepro += (missHitPerLayer[i] - hitRecoveryCounters[i]);
1104  }
1105  edm::LogInfo("SiStripHitEfficiency:HitEff")
1106  << "TOTAL % of missing hits within TOB :" << (totTOB * 1.0 / totalNbHits) * 100 << "%";
1107  edm::LogInfo("SiStripHitEfficiency:HitEff")
1108  << "AFTER repropagation :" << (totTOBrepro * 1.0 / totalNbHits) * 100 << "%";
1109 
1110  edm::LogInfo("SiStripHitEfficiency:HitEff") << "Within TID :";
1111  for (int i = k_LayersAtTOBEnd + 1; i <= k_LayersAtTIDEnd; i++) {
1112  edm::LogInfo("SiStripHitEfficiency:HitEff")
1113  << "Layer " << i << " has : " << missHitPerLayer[i] << "/" << totalNbHits << " = "
1114  << (missHitPerLayer[i] * 1.0 / totalNbHits) * 100 << " % of missing hit";
1115  totTID += missHitPerLayer[i];
1116  edm::LogInfo("SiStripHitEfficiency:HitEff")
1117  << "Removing recovered hits : layer " << i << " has : " << missHitPerLayer[i] - hitRecoveryCounters[i] << "/"
1118  << totalNbHits << " = " << ((missHitPerLayer[i] - hitRecoveryCounters[i]) * 1.0 / totalNbHits) * 100
1119  << " % of missing hit";
1120  totTIDrepro += (missHitPerLayer[i] - hitRecoveryCounters[i]);
1121  }
1122  edm::LogInfo("SiStripHitEfficiency:HitEff")
1123  << "TOTAL % of missing hits within TID :" << (totTID * 1.0 / totalNbHits) * 100 << "%";
1124  edm::LogInfo("SiStripHitEfficiency:HitEff")
1125  << "AFTER repropagation :" << (totTIDrepro * 1.0 / totalNbHits) * 100 << "%";
1126 
1127  edm::LogInfo("SiStripHitEfficiency:HitEff") << "Within TEC :";
1128  for (int i = k_LayersAtTIDEnd + 1; i < k_END_OF_LAYERS; i++) {
1129  edm::LogInfo("SiStripHitEfficiency:HitEff")
1130  << "Layer " << i << " has : " << missHitPerLayer[i] << "/" << totalNbHits << " = "
1131  << (missHitPerLayer[i] * 1.0 / totalNbHits) * 100 << " % of missing hit";
1132  totTEC += missHitPerLayer[i];
1133  edm::LogInfo("SiStripHitEfficiency:HitEff")
1134  << "Removing recovered hits : layer " << i << " has : " << missHitPerLayer[i] - hitRecoveryCounters[i] << "/"
1135  << totalNbHits << " = " << ((missHitPerLayer[i] - hitRecoveryCounters[i]) * 1.0 / totalNbHits) * 100
1136  << " % of missing hit";
1137  totTECrepro += (missHitPerLayer[i] - hitRecoveryCounters[i]);
1138  }
1139  edm::LogInfo("SiStripHitEfficiency:HitEff")
1140  << "TOTAL % of missing hits within TEC :" << (totTEC * 1.0 / totalNbHits) * 100 << "%";
1141  edm::LogInfo("SiStripHitEfficiency:HitEff")
1142  << "AFTER repropagation :" << (totTECrepro * 1.0 / totalNbHits) * 100 << "%";
1143 
1144  edm::LogInfo("SiStripHitEfficiency:HitEff") << " Hit recovery summary:";
1145 
1146  for (int ilayer = 0; ilayer < k_END_OF_LAYERS; ilayer++) {
1147  edm::LogInfo("SiStripHitEfficiency:HitEff")
1148  << " layer " << ilayer << ": " << hitRecoveryCounters[ilayer] << " / " << hitTotalCounters[ilayer];
1149  }
1150  }
1151 }
std::vector< unsigned int > hitRecoveryCounters
Definition: HitEff.h:109
std::vector< unsigned int > hitTotalCounters
Definition: HitEff.h:110
bool doMissingHitsRecovery_
Definition: HitEff.h:78
int events
Definition: HitEff.h:102
Log< level::Info, false > LogInfo
int totalNbHits
Definition: HitEff.h:121
TTree * traj
Definition: HitEff.h:101
int EventTrackCKF
Definition: HitEff.h:102
std::vector< int > missHitPerLayer
Definition: HitEff.h:122
#define LogDebug(id)

Member Data Documentation

◆ addCommonMode_

bool HitEff::addCommonMode_
private

Definition at line 72 of file HitEff.h.

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

◆ addLumi_

bool HitEff::addLumi_
private

Definition at line 71 of file HitEff.h.

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

◆ bunchx

unsigned int HitEff::bunchx
private

Definition at line 135 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ chi2MeasurementEstimatorToken_

const edm::ESGetToken<Chi2MeasurementEstimatorBase, TrackingComponentsRecord> HitEff::chi2MeasurementEstimatorToken_
private

Definition at line 96 of file HitEff.h.

Referenced by analyze().

◆ ClusterLocErrX

float HitEff::ClusterLocErrX
private

Definition at line 126 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ ClusterLocErrY

float HitEff::ClusterLocErrY
private

Definition at line 126 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ ClusterLocX

float HitEff::ClusterLocX
private

Definition at line 126 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ ClusterLocY

float HitEff::ClusterLocY
private

Definition at line 126 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ clusters_token_

const edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > HitEff::clusters_token_
private

Definition at line 83 of file HitEff.h.

Referenced by analyze().

◆ ClusterStoN

float HitEff::ClusterStoN
private

Definition at line 126 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ combinatorialTracks_token_

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

Definition at line 80 of file HitEff.h.

Referenced by analyze().

◆ commonMode

float HitEff::commonMode
private

Definition at line 138 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ commonModeToken_

const edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> > HitEff::commonModeToken_
private

Definition at line 67 of file HitEff.h.

Referenced by analyze().

◆ compSettings

int HitEff::compSettings
private

Definition at line 104 of file HitEff.h.

Referenced by beginJob(), and HitEff().

◆ conf_

edm::ParameterSet HitEff::conf_
private

Definition at line 99 of file HitEff.h.

Referenced by HitEff().

◆ cpeToken_

Definition at line 92 of file HitEff.h.

Referenced by analyze().

◆ cutOnTracks_

bool HitEff::cutOnTracks_
private

Definition at line 73 of file HitEff.h.

Referenced by analyze(), and HitEff().

◆ DEBUG

bool HitEff::DEBUG
private

Definition at line 106 of file HitEff.h.

Referenced by HitEff().

◆ digisCol_token_

const edm::EDGetTokenT<DetIdCollection> HitEff::digisCol_token_
private

Definition at line 84 of file HitEff.h.

Referenced by analyze().

◆ digisVec_token_

const edm::EDGetTokenT<DetIdVector> HitEff::digisVec_token_
private

Definition at line 85 of file HitEff.h.

Referenced by analyze().

◆ doMissingHitsRecovery_

bool HitEff::doMissingHitsRecovery_
private

Definition at line 78 of file HitEff.h.

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

◆ event

unsigned int HitEff::event
private

◆ events

int HitEff::events
private

◆ EventTrackCKF

int HitEff::EventTrackCKF
private

Definition at line 102 of file HitEff.h.

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

◆ geomToken_

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

Definition at line 91 of file HitEff.h.

Referenced by analyze().

◆ highPurity

bool HitEff::highPurity
private

Definition at line 132 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ hitRecoveryCounters

std::vector<unsigned int> HitEff::hitRecoveryCounters
private

Definition at line 109 of file HitEff.h.

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

◆ hitTotalCounters

std::vector<unsigned int> HitEff::hitTotalCounters
private

Definition at line 110 of file HitEff.h.

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

◆ Id

unsigned int HitEff::Id
private

Definition at line 129 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ instLumi

float HitEff::instLumi
private

Definition at line 137 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ layers

unsigned int HitEff::layers
private

Definition at line 105 of file HitEff.h.

Referenced by analyze(), and HitEff().

◆ magFieldToken_

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

Definition at line 94 of file HitEff.h.

Referenced by analyze().

◆ measurementTkToken_

const edm::ESGetToken<MeasurementTracker, CkfComponentsRecord> HitEff::measurementTkToken_
private

Definition at line 95 of file HitEff.h.

Referenced by analyze().

◆ metaDataToken_

const edm::EDGetTokenT<OnlineLuminosityRecord> HitEff::metaDataToken_
private

Definition at line 66 of file HitEff.h.

Referenced by analyze().

◆ missHitPerLayer

std::vector<int> HitEff::missHitPerLayer
private

Definition at line 122 of file HitEff.h.

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

◆ ModIsBad

unsigned int HitEff::ModIsBad
private

Definition at line 128 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ nHits

int HitEff::nHits
private

Definition at line 133 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ propagatorToken_

const edm::ESGetToken<Propagator, TrackingComponentsRecord> HitEff::propagatorToken_
private

Definition at line 97 of file HitEff.h.

Referenced by analyze().

◆ pT

float HitEff::pT
private

Definition at line 134 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ PU

float HitEff::PU
private

◆ ResX

float HitEff::ResX
private

Definition at line 127 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ ResXSig

float HitEff::ResXSig
private

Definition at line 127 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ run

unsigned int HitEff::run
private

◆ scalerToken_

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

Definition at line 65 of file HitEff.h.

Referenced by analyze().

◆ siStripClusterInfo_

SiStripClusterInfo HitEff::siStripClusterInfo_
private

Definition at line 69 of file HitEff.h.

Referenced by analyze().

◆ SiStripQualBad

unsigned int HitEff::SiStripQualBad
private

Definition at line 130 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ siStripQualityToken_

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

Definition at line 93 of file HitEff.h.

Referenced by analyze().

◆ topoToken_

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

Definition at line 90 of file HitEff.h.

Referenced by analyze().

◆ totalNbHits

int HitEff::totalNbHits
private

Definition at line 121 of file HitEff.h.

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

◆ tquality

int HitEff::tquality
private

Definition at line 136 of file HitEff.h.

Referenced by beginJob().

◆ trackerEvent_token_

const edm::EDGetTokenT<MeasurementTrackerEvent> HitEff::trackerEvent_token_
private

Definition at line 86 of file HitEff.h.

Referenced by analyze().

◆ trackMultiplicityCut_

unsigned int HitEff::trackMultiplicityCut_
private

Definition at line 74 of file HitEff.h.

Referenced by analyze(), and HitEff().

◆ traj

TTree* HitEff::traj
private

Definition at line 101 of file HitEff.h.

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

◆ trajectories_token_

const edm::EDGetTokenT<std::vector<Trajectory> > HitEff::trajectories_token_
private

Definition at line 81 of file HitEff.h.

Referenced by analyze().

◆ TrajGlbX

float HitEff::TrajGlbX
private

Definition at line 123 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ TrajGlbY

float HitEff::TrajGlbY
private

Definition at line 123 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ TrajGlbZ

float HitEff::TrajGlbZ
private

Definition at line 123 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ trajHitValid

unsigned int HitEff::trajHitValid
private

Definition at line 135 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ TrajLocAngleX

float HitEff::TrajLocAngleX
private

Definition at line 124 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ TrajLocAngleY

float HitEff::TrajLocAngleY
private

Definition at line 124 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ TrajLocErrX

float HitEff::TrajLocErrX
private

Definition at line 125 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ TrajLocErrY

float HitEff::TrajLocErrY
private

Definition at line 125 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ TrajLocX

float HitEff::TrajLocX
private

Definition at line 124 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ TrajLocY

float HitEff::TrajLocY
private

Definition at line 124 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ trajTrackAsso_token_

const edm::EDGetTokenT<TrajTrackAssociationCollection> HitEff::trajTrackAsso_token_
private

Definition at line 82 of file HitEff.h.

Referenced by analyze().

◆ useAllHitsFromTracksWithMissingHits_

bool HitEff::useAllHitsFromTracksWithMissingHits_
private

Definition at line 77 of file HitEff.h.

Referenced by analyze(), and HitEff().

◆ useFirstMeas_

bool HitEff::useFirstMeas_
private

Definition at line 75 of file HitEff.h.

Referenced by analyze(), and HitEff().

◆ useLastMeas_

bool HitEff::useLastMeas_
private

Definition at line 76 of file HitEff.h.

Referenced by analyze(), and HitEff().

◆ whatlayer

unsigned int HitEff::whatlayer
private

Definition at line 107 of file HitEff.h.

Referenced by analyze(), and beginJob().

◆ withinAcceptance

bool HitEff::withinAcceptance
private

Definition at line 131 of file HitEff.h.

Referenced by analyze(), and beginJob().