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::EDAnalyzer edm::EDConsumerBase

Public Member Functions

bool check2DPartner (unsigned int iidd, const std::vector< TrajectoryMeasurement > &traj)
 
double checkConsistency (const StripClusterParameterEstimator::LocalValues &parameters, double xx, double xerr)
 
unsigned int checkLayer (unsigned int iidd, const TrackerTopology *tTopo)
 
 HitEff (const edm::ParameterSet &conf)
 
bool isDoubleSided (unsigned int iidd, const TrackerTopology *tTopo) const
 
 ~HitEff () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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
 
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::vector< ModuleDescription const * > &modules, 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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
 
float chi2
 
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_
 
edm::ParameterSet conf_
 
bool cutOnTracks_
 
bool DEBUG
 
float dedx
 
int dedxNOM
 
const edm::EDGetTokenT< DetIdCollectiondigis_token_
 
unsigned int event
 
int events
 
int EventTrackCKF
 
unsigned int Id
 
float instLumi
 
int istep
 
unsigned int layers
 
unsigned int ModIsBad
 
int nHits
 
int nLostHits
 
float p
 
float pT
 
float PU
 
float ResX
 
float ResXSig
 
unsigned int run
 
const edm::EDGetTokenT< LumiScalersCollectionscalerToken_
 
unsigned int SiStripQualBad
 
float timeDT
 
int timeDTDOF
 
float timeDTErr
 
float timeECAL
 
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
 
unsigned int whatlayer
 
bool withinAcceptance
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Definition at line 47 of file HitEff.h.

Constructor & Destructor Documentation

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

Definition at line 73 of file HitEff.cc.

References addCommonMode_, addLumi_, conf_, cutOnTracks_, DEBUG, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), layers, and trackMultiplicityCut_.

73  :
74  scalerToken_( consumes< LumiScalersCollection >(conf.getParameter<edm::InputTag>("lumiScalers")) ),
76  combinatorialTracks_token_( consumes< reco::TrackCollection >(conf.getParameter<edm::InputTag>("combinatorialTracks")) ),
77  trajectories_token_( consumes< std::vector<Trajectory> >(conf.getParameter<edm::InputTag>("trajectories")) ),
79  digis_token_( consumes< DetIdCollection >(conf.getParameter<edm::InputTag>("siStripDigis")) ),
80  trackerEvent_token_( consumes< MeasurementTrackerEvent>(conf.getParameter<edm::InputTag>("trackerEvent")) ),
81  conf_(conf)
82 {
83  layers =conf_.getParameter<int>("Layer");
84  DEBUG = conf_.getParameter<bool>("Debug");
85  addLumi_ = conf_.getUntrackedParameter<bool>("addLumi", false);
86  addCommonMode_ = conf_.getUntrackedParameter<bool>("addCommonMode", false);
87  cutOnTracks_ = conf_.getUntrackedParameter<bool>("cutOnTracks", false);
88  trackMultiplicityCut_ = conf.getUntrackedParameter<unsigned int>("trackMultiplicity",100);
89 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool DEBUG
Definition: HitEff.h:83
const edm::EDGetTokenT< MeasurementTrackerEvent > trackerEvent_token_
Definition: HitEff.h:75
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< DetIdCollection > digis_token_
Definition: HitEff.h:74
unsigned int trackMultiplicityCut_
Definition: HitEff.h:69
unsigned int layers
Definition: HitEff.h:82
const edm::EDGetTokenT< reco::TrackCollection > combinatorialTracks_token_
Definition: HitEff.h:71
bool addLumi_
Definition: HitEff.h:66
bool addCommonMode_
Definition: HitEff.h:67
bool cutOnTracks_
Definition: HitEff.h:68
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
Definition: HitEff.h:73
const edm::EDGetTokenT< LumiScalersCollection > scalerToken_
Definition: HitEff.h:63
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
const edm::EDGetTokenT< std::vector< Trajectory > > trajectories_token_
Definition: HitEff.h:72
const edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > commonModeToken_
Definition: HitEff.h:64
edm::ParameterSet conf_
Definition: HitEff.h:77
HitEff::~HitEff ( )
override

Definition at line 92 of file HitEff.cc.

92 { }

Member Function Documentation

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

Definition at line 149 of file HitEff.cc.

References funct::abs(), addCommonMode_, addLumi_, AnalyticalPropagator_cfi::AnalyticalPropagator, anyDirection, edmNew::DetSetVector< T >::begin(), Surface::bounds(), edm::EventBase::bunchCrossing(), bunchx, check2DPartner(), checkConsistency(), checkLayer(), chi2, ClusterLocErrX, ClusterLocErrY, ClusterLocX, ClusterLocY, clusters_token_, ClusterStoN, combinatorialTracks_token_, commonMode, commonModeToken_, gather_cfg::cout, cutOnTracks_, DEBUG, digis_token_, edmNew::DetSetVector< T >::empty(), edmNew::DetSetVector< T >::end(), edm::EventID::event(), events, EventTrackCKF, edm::EventSetup::get(), SiStripQuality::getBadApvs(), edm::Event::getByLabel(), edm::Event::getByToken(), mps_fire::i, edm::EventBase::id(), Id, TrackerGeometry::idToDetUnit(), cuy::ii, input, instLumi, ires, isDoubleSided(), edm::HandleBase::isValid(), layers, StripClusterParameterEstimator::localParameters(), LayerMeasurements::measurements(), ecalDrivenElectronSeedsParameters_cff::measurementTrackerEvent, ModIsBad, reco::MuonTime::nDof, nHits, nLostHits, StripTopology::nstrips(), p, TrapezoidalPlaneBounds::parameters(), edm::Handle< T >::product(), edm::ESHandle< T >::product(), PhotonConversionTrajectorySeedProducerFromQuadruplets_cfi::propagator, pT, PU, rpcPointValidation_cfi::recHit, TrajectoryMeasurement::recHit(), ResX, ResXSig, edm::EventID::run(), run, scalerToken_, SiStripQualBad, edm::EDCollection< T >::size(), edm::DetSetVector< T >::size(), edmNew::DetSetVector< T >::size(), StripGeomDetUnit::specificTopology(), mathSSE::sqrt(), subdetector, GeomDet::surface(), StripSubdetector::TEC, TrackerTopology::tecSide(), reco::MuonTime::timeAtIpInOut, reco::MuonTime::timeAtIpInOutErr, timeDT, timeDTDOF, timeDTErr, timeECAL, tmp, mixOne_simraw_on_sim_cfi::tracker, trackerEvent_token_, trackMultiplicityCut_, traj, trajectories_token_, TrajGlbX, TrajGlbY, TrajGlbZ, trajHitValid, TrajLocAngleX, TrajLocAngleY, TrajLocErrX, TrajLocErrY, TrajLocX, TrajLocY, whatlayer, Bounds::width(), and withinAcceptance.

149  {
150  //Retrieve tracker topology from geometry
151  edm::ESHandle<TrackerTopology> tTopoHandle;
152  es.get<TrackerTopologyRcd>().get(tTopoHandle);
153  const TrackerTopology* const tTopo = tTopoHandle.product();
154 
155  // bool DEBUG = false;
156 
157  if (DEBUG) cout << "beginning analyze from HitEff" << endl;
158 
159  using namespace edm;
160  using namespace reco;
161  // Step A: Get Inputs
162 
163  int run_nr = e.id().run();
164  int ev_nr = e.id().event();
165  int bunch_nr = e.bunchCrossing();
166 
167  // Luminosity informations
169  instLumi=0; PU=0;
170  if(addLumi_) {
171  e.getByToken(scalerToken_, lumiScalers);
172  if (lumiScalers->begin() != lumiScalers->end()) {
173  instLumi = lumiScalers->begin()->instantLumi();
174  PU = lumiScalers->begin()->pileup();
175  }
176  }
177 
178  // CM
180  if(addCommonMode_) e.getByToken(commonModeToken_, commonModeDigis);
181 
182  //CombinatoriaTrack
183  edm::Handle<reco::TrackCollection> trackCollectionCKF;
184  //edm::InputTag TkTagCKF = conf_.getParameter<edm::InputTag>("combinatorialTracks");
185  e.getByToken(combinatorialTracks_token_,trackCollectionCKF);
186 
187  edm::Handle<std::vector<Trajectory> > TrajectoryCollectionCKF;
188  //edm::InputTag TkTrajCKF = conf_.getParameter<edm::InputTag>("trajectories");
189  e.getByToken(trajectories_token_,TrajectoryCollectionCKF);
190 
191  // Clusters
192  // get the SiStripClusters from the event
194  //e.getByLabel("siStripClusters", theClusters);
195  e.getByToken(clusters_token_, theClusters);
196 
197  //get tracker geometry
199  es.get<TrackerDigiGeometryRecord>().get(tracker);
200  const TrackerGeometry * tkgeom=&(* tracker);
201 
202  //get Cluster Parameter Estimator
203  //std::string cpe = conf_.getParameter<std::string>("StripCPE");
205  es.get<TkStripCPERecord>().get("StripCPEfromTrackAngle", parameterestimator);
206  const StripClusterParameterEstimator &stripcpe(*parameterestimator);
207 
208  // get the SiStripQuality records
209  edm::ESHandle<SiStripQuality> SiStripQuality_;
210 //LQ commenting the try/catch that causes problem in 74X calibTree production
211 // try {
212 // es.get<SiStripQualityRcd>().get("forCluster",SiStripQuality_);
213 // }
214 // catch (...) {
215  es.get<SiStripQualityRcd>().get(SiStripQuality_);
216 // }
217 
218  edm::ESHandle<MagneticField> magFieldHandle;
219  es.get<IdealMagneticFieldRecord>().get(magFieldHandle);
220  const MagneticField* magField_ = magFieldHandle.product();
221 
222  // get the list of module IDs with FED-detected errors
223  edm::Handle< DetIdCollection > fedErrorIds;
224  //e.getByLabel("siStripDigis", fedErrorIds );
225  e.getByToken(digis_token_, fedErrorIds );
226 
227  ESHandle<MeasurementTracker> measurementTrackerHandle;
228  es.get<CkfComponentsRecord>().get(measurementTrackerHandle);
229 
231  //e.getByLabel("MeasurementTrackerEvent", measurementTrackerEvent);
232  e.getByToken(trackerEvent_token_,measurementTrackerEvent);
233 
235  es.get<TrackingComponentsRecord>().get("Chi2",est);
236 
238  es.get<TrackingComponentsRecord>().get("PropagatorWithMaterial",prop);
239  const Propagator* thePropagator = prop.product();
240 
241  events++;
242 
243  // *************** SiStripCluster Collection
244  const edmNew::DetSetVector<SiStripCluster>& input = *theClusters;
245 
246  //go through clusters to write out global position of good clusters for the layer understudy for comparison
247  // Loop through clusters just to print out locations
248  // Commented out to avoid discussion, should really be deleted.
249  /*
250  for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter = input.begin(); DSViter != input.end(); DSViter++) {
251  // DSViter is a vector of SiStripClusters located on a single module
252  unsigned int ClusterId = DSViter->id();
253  DetId ClusterDetId(ClusterId);
254  const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)tkgeom->idToDetUnit(ClusterDetId);
255 
256  edmNew::DetSet<SiStripCluster>::const_iterator begin=DSViter->begin();
257  edmNew::DetSet<SiStripCluster>::const_iterator end =DSViter->end();
258  for(edmNew::DetSet<SiStripCluster>::const_iterator iter=begin;iter!=end;++iter) {
259  //iter is a single SiStripCluster
260  StripClusterParameterEstimator::LocalValues parameters=stripcpe.localParameters(*iter,*stripdet);
261 
262  const Surface* surface;
263  surface = &(tracker->idToDet(ClusterDetId)->surface());
264  LocalPoint lp = parameters.first;
265  GlobalPoint gp = surface->toGlobal(lp);
266  unsigned int layer = checkLayer(ClusterId, tTopo);
267  if(DEBUG) cout << "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;
268  }
269  }
270  */
271 
272  // Tracking
273  const reco::TrackCollection *tracksCKF=trackCollectionCKF.product();
274  if (DEBUG) cout << "number ckf tracks found = " << tracksCKF->size() << endl;
275  //if (tracksCKF->size() == 1 ){
276  if (!tracksCKF->empty()) {
277  if( cutOnTracks_ && (tracksCKF->size() >= trackMultiplicityCut_) ) return;
278  if( DEBUG && cutOnTracks_ ) cout << "starting checking good event with < "<< trackMultiplicityCut_ <<" tracks" << endl;
279 
280  EventTrackCKF++;
281 
282  /*
283 
284  //get dEdx info if available
285  Handle<ValueMap<DeDxData> > dEdxUncalibHandle;
286  if (e.getByLabel("dedxMedianCTF", dEdxUncalibHandle)) {
287  const ValueMap<DeDxData> dEdxTrackUncalib = *dEdxUncalibHandle.product();
288 
289  reco::TrackRef itTrack = reco::TrackRef( trackCollectionCKF, 0 );
290  dedx = dEdxTrackUncalib[itTrack].dEdx();
291  dedxNOM = dEdxTrackUncalib[itTrack].numberOfMeasurements();
292  } else {
293  dedx = -999.0; dedxNOM = -999;
294  }
295 
296  */
297 
298  //get muon and ecal timing info if available
300  if(e.getByLabel("muonsWitht0Correction",muH)){
301  const MuonCollection & muonsT0 = *muH.product();
302  if(!muonsT0.empty()) {
303  MuonTime mt0 = muonsT0[0].time();
304  timeDT = mt0.timeAtIpInOut;
306  timeDTDOF = mt0.nDof;
307 
308  bool hasCaloEnergyInfo = muonsT0[0].isEnergyValid();
309  if (hasCaloEnergyInfo) timeECAL = muonsT0[0].calEnergy().ecal_time;
310  }
311  } else {
312  timeDT = -999.0; timeDTErr = -999.0; timeDTDOF = -999; timeECAL = -999.0;
313  }
314 
315  // actually should do a loop over all the tracks in the event here
316 
317  for (vector<Trajectory>::const_iterator itraj = TrajectoryCollectionCKF.product()->begin();
318  itraj != TrajectoryCollectionCKF.product()->end();
319  itraj++) {
320 
321  // for each track, fill some variables such as number of hits and momentum
322  nHits = itraj->foundHits();
323  nLostHits = itraj->lostHits();
324  chi2 = (itraj->chiSquared()/itraj->ndof());
325  pT = sqrt( ( itraj->lastMeasurement().updatedState().globalMomentum().x() *
326  itraj->lastMeasurement().updatedState().globalMomentum().x()) +
327  ( itraj->lastMeasurement().updatedState().globalMomentum().y() *
328  itraj->lastMeasurement().updatedState().globalMomentum().y()) );
329  p = itraj->lastMeasurement().updatedState().globalMomentum().mag();
330 
331  //Put in code to check track quality
332 
333 
334  std::vector<TrajectoryMeasurement> TMeas=itraj->measurements();
335  vector<TrajectoryMeasurement>::iterator itm;
336  double xloc = 0.;
337  double yloc = 0.;
338  double xErr = 0.;
339  double yErr = 0.;
340  double angleX = -999.;
341  double angleY = -999.;
342  double xglob,yglob,zglob;
343 
344  for (itm=TMeas.begin();itm!=TMeas.end();itm++){
345  auto theInHit = (*itm).recHit();
346 
347  if(DEBUG) cout << "theInHit is valid = " << theInHit->isValid() << endl;
348 
349  unsigned int iidd = theInHit->geographicalId().rawId();
350 
351  unsigned int TKlayers = checkLayer(iidd, tTopo);
352  if (DEBUG) cout << "TKlayer from trajectory: " << TKlayers << " from module = " << iidd << " matched/stereo/rphi = " << ((iidd & 0x3)==0) << "/" << ((iidd & 0x3)==1) << "/" << ((iidd & 0x3)==2) << endl;
353 
354  // If Trajectory measurement from TOB 6 or TEC 9, skip it because it's always valid they are filled later
355  if ( TKlayers == 10 || TKlayers == 22 ) {
356  if (DEBUG) cout << "skipping original TM for TOB 6 or TEC 9" << endl;
357  continue;
358  }
359 
360  // Make vector of TrajectoryAtInvalidHits to hold the trajectories
361  std::vector<TrajectoryAtInvalidHit> TMs;
362 
363  // Make AnalyticalPropagator to use in TAVH constructor
365 
366  // for double sided layers check both sensors--if no hit was found on either sensor surface,
367  // the trajectory measurements only have one invalid hit entry on the matched surface
368  // so get the TrajectoryAtInvalidHit for both surfaces and include them in the study
369  if (isDoubleSided(iidd, tTopo) && ((iidd & 0x3)==0) ) {
370  // do hit eff check twice--once for each sensor
371  //add a TM for each surface
372  TMs.push_back(TrajectoryAtInvalidHit(*itm, tTopo, tkgeom, propagator, 1));
373  TMs.push_back(TrajectoryAtInvalidHit(*itm, tTopo, tkgeom, propagator, 2));
374  } else if ( isDoubleSided(iidd, tTopo) && (!check2DPartner(iidd, TMeas)) ) {
375  // if only one hit was found the trajectory measurement is on that sensor surface, and the other surface from
376  // the matched layer should be added to the study as well
377  TMs.push_back(TrajectoryAtInvalidHit(*itm, tTopo, tkgeom, propagator, 1));
378  TMs.push_back(TrajectoryAtInvalidHit(*itm, tTopo, tkgeom, propagator, 2));
379  if (DEBUG) cout << " found a hit with a missing partner" << endl;
380  } else {
381  //only add one TM for the single surface and the other will be added in the next iteration
382  TMs.push_back(TrajectoryAtInvalidHit(*itm, tTopo, tkgeom, propagator));
383  }
384 
386  //Now check for tracks at TOB6 and TEC9
387 
388  // to make sure we only propagate on the last TOB5 hit check the next entry isn't also in TOB5
389  // to avoid bias, make sure the TOB5 hit is valid (an invalid hit on TOB5 could only exist with a valid hit on TOB6)
390 
391  bool isValid = theInHit->isValid();
392  bool isLast = (itm==(TMeas.end()-1));
393  bool isLastTOB5 = true;
394  if (!isLast) {
395  if ( checkLayer((++itm)->recHit()->geographicalId().rawId(), tTopo) == 9 ) isLastTOB5 = false;
396  else isLastTOB5 = true;
397  --itm;
398  }
399 
400  if ( TKlayers==9 && isValid && isLastTOB5 ) {
401  // if ( TKlayers==9 && itm==TMeas.rbegin()) {
402  // if ( TKlayers==9 && (itm==TMeas.back()) ) { // to check for only the last entry in the trajectory for propagation
403  std::vector< BarrelDetLayer const*> barrelTOBLayers = measurementTrackerHandle->geometricSearchTracker()->tobLayers() ;
404  const DetLayer* tob6 = barrelTOBLayers[barrelTOBLayers.size()-1];
405  const MeasurementEstimator* estimator = est.product();
406  const LayerMeasurements* theLayerMeasurements = new LayerMeasurements(*measurementTrackerHandle, *measurementTrackerEvent);
407  const TrajectoryStateOnSurface tsosTOB5 = itm->updatedState();
408  vector<TrajectoryMeasurement> tmp = theLayerMeasurements->measurements(*tob6, tsosTOB5, *thePropagator, *estimator);
409 
410  if ( !tmp.empty()) {
411  if (DEBUG) cout << "size of TM from propagation = " << tmp.size() << endl;
412 
413  // take the last of the TMs, which is always an invalid hit
414  // if no detId is available, ie detId==0, then no compatible layer was crossed
415  // otherwise, use that TM for the efficiency measurement
416  TrajectoryMeasurement tob6TM(tmp.back());
417  const auto& tob6Hit = tob6TM.recHit();
418 
419  if (tob6Hit->geographicalId().rawId()!=0) {
420  if (DEBUG) cout << "tob6 hit actually being added to TM vector" << endl;
421  TMs.push_back(TrajectoryAtInvalidHit(tob6TM, tTopo, tkgeom, propagator));
422  }
423  }
424  }
425 
426  bool isLastTEC8 = true;
427  if (!isLast) {
428  if ( checkLayer((++itm)->recHit()->geographicalId().rawId(), tTopo) == 21 ) isLastTEC8 = false;
429  else isLastTEC8 = true;
430  --itm;
431  }
432 
433  if ( TKlayers==21 && isValid && isLastTEC8 ) {
434 
435  std::vector< const ForwardDetLayer*> posTecLayers = measurementTrackerHandle->geometricSearchTracker()->posTecLayers() ;
436  const DetLayer* tec9pos = posTecLayers[posTecLayers.size()-1];
437  std::vector< const ForwardDetLayer*> negTecLayers = measurementTrackerHandle->geometricSearchTracker()->negTecLayers() ;
438  const DetLayer* tec9neg = negTecLayers[negTecLayers.size()-1];
439 
440  const MeasurementEstimator* estimator = est.product();
441  const LayerMeasurements* theLayerMeasurements = new LayerMeasurements(*measurementTrackerHandle, *measurementTrackerEvent);
442  const TrajectoryStateOnSurface tsosTEC9 = itm->updatedState();
443 
444  // check if track on positive or negative z
445  if (DEBUG) if (!(iidd == StripSubdetector::TEC)) cout << "there is a problem with TEC 9 extrapolation" << endl;
446 
447  //cout << " tec9 id = " << iidd << " and side = " << tTopo->tecSide(iidd) << endl;
448  vector<TrajectoryMeasurement> tmp;
449  if ( tTopo->tecSide(iidd) == 1 ) {
450  tmp = theLayerMeasurements->measurements(*tec9neg, tsosTEC9, *thePropagator, *estimator);
451  //cout << "on negative side" << endl;
452  }
453  if ( tTopo->tecSide(iidd) == 2 ) {
454  tmp = theLayerMeasurements->measurements(*tec9pos, tsosTEC9, *thePropagator, *estimator);
455  //cout << "on positive side" << endl;
456  }
457 
458  if ( !tmp.empty()) {
459  // take the last of the TMs, which is always an invalid hit
460  // if no detId is available, ie detId==0, then no compatible layer was crossed
461  // otherwise, use that TM for the efficiency measurement
462  TrajectoryMeasurement tec9TM(tmp.back());
463  const auto& tec9Hit = tec9TM.recHit();
464 
465  unsigned int tec9id = tec9Hit->geographicalId().rawId();
466  if (DEBUG) cout << "tec9id = " << tec9id << " is Double sided = " << isDoubleSided(tec9id, tTopo) << " and 0x3 = " << (tec9id & 0x3) << endl;
467 
468  if (tec9Hit->geographicalId().rawId()!=0) {
469  if (DEBUG) cout << "tec9 hit actually being added to TM vector" << endl;
470  // in tec the hit can be single or doubled sided. whenever the invalid hit at the end of vector of TMs is
471  // double sided it is always on the matched surface, so we need to split it into the true sensor surfaces
472  if (isDoubleSided(tec9id, tTopo)) {
473  TMs.push_back(TrajectoryAtInvalidHit(tec9TM, tTopo, tkgeom, propagator, 1));
474  TMs.push_back(TrajectoryAtInvalidHit(tec9TM, tTopo, tkgeom, propagator, 2));
475  } else
476  TMs.push_back(TrajectoryAtInvalidHit(tec9TM, tTopo, tkgeom, propagator));
477  }
478  } //else cout << "tec9 tmp empty" << endl;
479  }
480 
482 
483  // Modules Constraints
484 
485  for(std::vector<TrajectoryAtInvalidHit>::const_iterator TM=TMs.begin();TM!=TMs.end();++TM) {
486 
487  // --> Get trajectory from combinatedState
488  iidd = TM->monodet_id();
489  if (DEBUG) cout << "setting iidd = " << iidd << " before checking efficiency and ";
490 
491  xloc = TM->localX();
492  yloc = TM->localY();
493 
494  xErr = TM->localErrorX();
495  yErr = TM->localErrorY();
496 
497  angleX = atan( TM->localDxDz() );
498  angleY = atan( TM->localDyDz() );
499 
500  xglob = TM->globalX();
501  yglob = TM->globalY();
502  zglob = TM->globalZ();
503  withinAcceptance = TM->withinAcceptance();
504 
505  trajHitValid = TM->validHit();
506  int TrajStrip = -1;
507 
508  // reget layer from iidd here, to account for TOB 6 and TEC 9 TKlayers being off
509  TKlayers = checkLayer(iidd, tTopo);
510 
511  if ( (layers == TKlayers) || (layers == 0) ) { // Look at the layer not used to reconstruct the track
512  whatlayer = TKlayers;
513  if (DEBUG) cout << "Looking at layer under study" << endl;
514  TrajGlbX = 0.0; TrajGlbY = 0.0; TrajGlbZ = 0.0; ModIsBad = 2; Id = 0; SiStripQualBad = 0;
515  run = 0; event = 0; TrajLocX = 0.0; TrajLocY = 0.0; TrajLocErrX = 0.0; TrajLocErrY = 0.0;
516  TrajLocAngleX = -999.0; TrajLocAngleY = -999.0; ResX = 0.0; ResXSig = 0.0;
517  ClusterLocX = 0.0; ClusterLocY = 0.0; ClusterLocErrX = 0.0; ClusterLocErrY = 0.0; ClusterStoN = 0.0;
518  bunchx = 0; commonMode = -100;
519 
520  // RPhi RecHit Efficiency
521 
522  if (!input.empty() ) {
523  if (DEBUG) cout << "Checking clusters with size = " << input.size() << endl;
524  int nClusters = 0;
525  std::vector< std::vector<float> > VCluster_info; //fill with X residual, X residual pull, local X, sig(X), local Y, sig(Y), StoN
526  for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter = input.begin(); DSViter != input.end(); DSViter++) {
527  // DSViter is a vector of SiStripClusters located on a single module
528  //if (DEBUG) cout << "the ID from the DSViter = " << DSViter->id() << endl;
529  unsigned int ClusterId = DSViter->id();
530  if (ClusterId == iidd) {
531  if (DEBUG) cout << "found (ClusterId == iidd) with ClusterId = " << ClusterId << " and iidd = " << iidd << endl;
532  DetId ClusterDetId(ClusterId);
533  const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)tkgeom->idToDetUnit(ClusterDetId);
534  const StripTopology& Topo = stripdet->specificTopology();
535 
536  float hbedge = 0.0;
537  float htedge = 0.0;
538  float hapoth = 0.0;
539  float uylfac = 0.0;
540  float uxlden = 0.0;
541  if(TKlayers>=11) {
542  const BoundPlane& plane = stripdet->surface();
543  const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
544  std::array<const float, 4> const & parameterTrap = (*trapezoidalBounds).parameters(); // el bueno aqui
545  hbedge = parameterTrap[0];
546  htedge = parameterTrap[1];
547  hapoth = parameterTrap[3];
548  uylfac = (htedge-hbedge)/(htedge+hbedge)/hapoth;
549  uxlden = 1 + yloc*uylfac;
550  }
551 
552  // Need to know position of trajectory in strip number for selecting the right APV later
553  if( TrajStrip==-1 ) {
554  int nstrips = Topo.nstrips();
555  float pitch = stripdet->surface().bounds().width() / nstrips;
556  TrajStrip = xloc/pitch + nstrips/2.0;
557  // Need additionnal corrections for endcap
558  if(TKlayers>=11) {
559  float TrajLocXMid = xloc / (1 + (htedge-hbedge)*yloc/(htedge+hbedge)/hapoth) ; // radialy extrapolated x loc position at middle
560  TrajStrip = TrajLocXMid/pitch + nstrips/2.0;
561  }
562  //cout<<" Layer "<<TKlayers<<" TrajStrip: "<<nstrips<<" "<<pitch<<" "<<TrajStrip<<endl;
563  }
564 
565 
566  for(edmNew::DetSet<SiStripCluster>::const_iterator iter=DSViter->begin();iter!=DSViter->end();++iter) {
567  //iter is a single SiStripCluster
568  StripClusterParameterEstimator::LocalValues parameters=stripcpe.localParameters(*iter,*stripdet);
569  float res = (parameters.first.x() - xloc);
570  float sigma = checkConsistency(parameters , xloc, xErr);
571  // The consistency is probably more accurately measured with the Chi2MeasurementEstimator. To use it
572  // you need a TransientTrackingRecHit instead of the cluster
573  //theEstimator= new Chi2MeasurementEstimator(30);
574  //const Chi2MeasurementEstimator *theEstimator(100);
575  //theEstimator->estimate(TM->tsos(), TransientTrackingRecHit);
576 
577  if(TKlayers>=11) {
578  res = parameters.first.x() - xloc/uxlden ; // radialy extrapolated x loc position at middle
579  sigma = abs(res) / sqrt(parameters.second.xx() + xErr*xErr/uxlden/uxlden + yErr*yErr*xloc*xloc*uylfac*uylfac/uxlden/uxlden/uxlden/uxlden);
580  }
581 
582  SiStripClusterInfo clusterInfo = SiStripClusterInfo(*iter, es, ClusterId);
583  // signal to noise from SiStripClusterInfo not working in 225. I'll fix this after the interface
584  // redesign in 300 -ku
585  //float cluster_info[7] = {res, sigma, parameters.first.x(), sqrt(parameters.second.xx()), parameters.first.y(), sqrt(parameters.second.yy()), signal_to_noise};
586  std::vector< float > cluster_info;
587  cluster_info.push_back(res);
588  cluster_info.push_back(sigma);
589  cluster_info.push_back(parameters.first.x());
590  cluster_info.push_back(sqrt(parameters.second.xx()));
591  cluster_info.push_back(parameters.first.y());
592  cluster_info.push_back(sqrt(parameters.second.yy()));
593  cluster_info.push_back( clusterInfo.signalOverNoise() );
594  //cluster_info.push_back( clusterInfo.getSignalOverNoise() );
595  VCluster_info.push_back(cluster_info);
596  nClusters++;
597  if (DEBUG) cout << "Have ID match. residual = " << VCluster_info.back()[0] << " res sigma = " << VCluster_info.back()[1] << endl;
598  if (DEBUG) cout << "trajectory measurement compatability estimate = " << (*itm).estimate() << endl;
599  if (DEBUG) cout << "hit position = " << parameters.first.x() << " hit error = " << sqrt(parameters.second.xx()) << " trajectory position = " << xloc << " traj error = " << xErr << endl;
600  }
601  }
602  }
603  float FinalResSig = 1000.0;
604  float FinalCluster[7]= {1000.0, 1000.0, 0.0, 0.0, 0.0, 0.0, 0.0};
605  if (nClusters > 0) {
606  if (DEBUG) cout << "found clusters > 0" << endl;
607  if (nClusters > 1) {
608  //get the smallest one
609  vector< vector<float> >::iterator ires;
610  for (ires=VCluster_info.begin(); ires!=VCluster_info.end(); ires++){
611  if ( abs((*ires)[1]) < abs(FinalResSig)) {
612  FinalResSig = (*ires)[1];
613  for (unsigned int i = 0; i<ires->size(); i++) {
614  if (DEBUG) cout << "filling final cluster. i = " << i << " before fill FinalCluster[i]=" << FinalCluster[i] << " and (*ires)[i] =" << (*ires)[i] << endl;
615  FinalCluster[i] = (*ires)[i];
616  if (DEBUG) cout << "filling final cluster. i = " << i << " after fill FinalCluster[i]=" << FinalCluster[i] << " and (*ires)[i] =" << (*ires)[i] << endl;
617  }
618  }
619  if (DEBUG) cout << "iresidual = " << (*ires)[0] << " isigma = " << (*ires)[1] << " and FinalRes = " << FinalCluster[0] << endl;
620  }
621  }
622  else {
623  FinalResSig = VCluster_info.at(0)[1];
624  for (unsigned int i = 0; i<VCluster_info.at(0).size(); i++) {
625  FinalCluster[i] = VCluster_info.at(0)[i];
626  }
627  }
628  nClusters=0;
629  VCluster_info.clear();
630  }
631 
632  if (DEBUG) cout << "Final residual in X = " << FinalCluster[0] << "+-" << (FinalCluster[0]/FinalResSig) << endl;
633  if (DEBUG) cout << "Checking location of trajectory: abs(yloc) = " << abs(yloc) << " abs(xloc) = " << abs(xloc) << endl;
634  if (DEBUG) cout << "Checking location of cluster hit: yloc = " << FinalCluster[4] << "+-" << FinalCluster[5] << " xloc = " << FinalCluster[2] << "+-" << FinalCluster[3] << endl;
635  if (DEBUG) cout << "Final cluster signal to noise = " << FinalCluster[6] << endl;
636 
637  float exclusionWidth = 0.4;
638  float TOBexclusion = 0.0;
639  float TECexRing5 = -0.89;
640  float TECexRing6 = -0.56;
641  float TECexRing7 = 0.60;
642  //Added by Chris Edelmaier to do TEC bonding exclusion
643  int subdetector = ((iidd>>25) & 0x7);
644  int ringnumber = ((iidd>>5) & 0x7);
645 
646  //New TOB and TEC bonding region exclusion zone
647  if((TKlayers >= 5 && TKlayers < 11)||((subdetector == 6)&&( (ringnumber >= 5)&&(ringnumber <=7) ))) {
648  //There are only 2 cases that we need to exclude for
649  float highzone = 0.0;
650  float lowzone = 0.0;
651  float higherr = yloc + 5.0*yErr;
652  float lowerr = yloc - 5.0*yErr;
653  if(TKlayers >= 5 && TKlayers < 11) {
654  //TOB zone
655  highzone = TOBexclusion + exclusionWidth;
656  lowzone = TOBexclusion - exclusionWidth;
657  } else if (ringnumber == 5) {
658  //TEC ring 5
659  highzone = TECexRing5 + exclusionWidth;
660  lowzone = TECexRing5 - exclusionWidth;
661  } else if (ringnumber == 6) {
662  //TEC ring 6
663  highzone = TECexRing6 + exclusionWidth;
664  lowzone = TECexRing6 - exclusionWidth;
665  } else if (ringnumber == 7) {
666  //TEC ring 7
667  highzone = TECexRing7 + exclusionWidth;
668  lowzone = TECexRing7 - exclusionWidth;
669  }
670  //Now that we have our exclusion region, we just have to properly identify it
671  if((highzone <= higherr)&&(highzone >= lowerr)) withinAcceptance = false;
672  if((lowzone >= lowerr)&&(lowzone <= higherr)) withinAcceptance = false;
673  if((higherr <= highzone)&&(higherr >= lowzone)) withinAcceptance = false;
674  if((lowerr >= lowzone)&&(lowerr <= highzone)) withinAcceptance = false;
675  }
676 
677  // fill ntuple varibles
678  //get global position from module id number iidd
679  TrajGlbX = xglob;
680  TrajGlbY = yglob;
681  TrajGlbZ = zglob;
682  Id = iidd;
683  run = run_nr;
684  event = ev_nr;
685  bunchx = bunch_nr;
686  //if ( SiStripQuality_->IsModuleBad(iidd) ) {
687  if ( SiStripQuality_->getBadApvs(iidd)!=0 ) {
688  SiStripQualBad = 1;
689  if(DEBUG) cout << "strip is bad from SiStripQuality" << endl;
690  } else {
691  SiStripQualBad = 0;
692  if(DEBUG) cout << "strip is good from SiStripQuality" << endl;
693  }
694 
695  //check for FED-detected errors and include those in SiStripQualBad
696  for (unsigned int ii=0;ii< fedErrorIds->size();ii++) {
697  if (iidd == (*fedErrorIds)[ii].rawId() )
698  SiStripQualBad = 1;
699  }
700 
701  TrajLocX = xloc;
702  TrajLocY = yloc;
703  TrajLocErrX = xErr;
704  TrajLocErrY = yErr;
705  TrajLocAngleX = angleX;
706  TrajLocAngleY = angleY;
707  ResX = FinalCluster[0];
708  ResXSig = FinalResSig;
709  if (FinalResSig != FinalCluster[1]) if (DEBUG) cout << "Problem with best cluster selection because FinalResSig = " << FinalResSig << " and FinalCluster[1] = " << FinalCluster[1] << endl;
710  ClusterLocX = FinalCluster[2];
711  ClusterLocY = FinalCluster[4];
712  ClusterLocErrX = FinalCluster[3];
713  ClusterLocErrY = FinalCluster[5];
714  ClusterStoN = FinalCluster[6];
715 
716  // CM of APV crossed by traj
717  if(addCommonMode_)
718  if(commonModeDigis.isValid() && TrajStrip>=0 && TrajStrip<=768) {
719  edm::DetSetVector<SiStripRawDigi>::const_iterator digiframe = commonModeDigis->find(iidd);
720  if(digiframe != commonModeDigis->end())
721  if( (unsigned) TrajStrip/128 < digiframe->data.size())
722  commonMode = digiframe->data.at(TrajStrip/128).adc();
723  }
724 
725  if (DEBUG) cout << "before check good" << endl;
726 
727  if ( FinalResSig < 999.0) { //could make requirement on track/hit consistency, but for
728  //now take anything with a hit on the module
729  if (DEBUG) cout << "hit being counted as good " << FinalCluster[0] << " FinalRecHit " <<
730  iidd << " TKlayers " << TKlayers << " xloc " << xloc << " yloc " << yloc << " module " << iidd <<
731  " matched/stereo/rphi = " << ((iidd & 0x3)==0) << "/" << ((iidd & 0x3)==1) << "/" << ((iidd & 0x3)==2) << endl;
732  ModIsBad = 0;
733  traj->Fill();
734  }
735  else {
736  if (DEBUG) cout << "hit being counted as bad ######### Invalid RPhi FinalResX " << FinalCluster[0] << " FinalRecHit " <<
737  iidd << " TKlayers " << TKlayers << " xloc " << xloc << " yloc " << yloc << " module " << iidd <<
738  " matched/stereo/rphi = " << ((iidd & 0x3)==0) << "/" << ((iidd & 0x3)==1) << "/" << ((iidd & 0x3)==2) << endl;
739  ModIsBad = 1;
740  traj->Fill();
741 
742  if (DEBUG) cout << " RPhi Error " << sqrt(xErr*xErr + yErr*yErr) << " ErrorX " << xErr << " yErr " << yErr << endl;
743  } if (DEBUG) cout << "after good location check" << endl;
744  } if (DEBUG) cout << "after list of clusters" << endl;
745  } if (DEBUG) cout << "After layers=TKLayers if" << endl;
746  } if (DEBUG) cout << "After looping over TrajAtValidHit list" << endl;
747  } if (DEBUG) cout << "end TMeasurement loop" << endl;
748  } if (DEBUG) cout << "end of trajectories loop" << endl;
749  }
750 }
RunNumber_t run() const
Definition: EventID.h:39
size_type size() const
Definition: EDCollection.h:97
EventNumber_t event() const
Definition: EventID.h:41
std::vector< TrajectoryMeasurement > measurements(const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
float TrajGlbZ
Definition: HitEff.h:88
bool check2DPartner(unsigned int iidd, const std::vector< TrajectoryMeasurement > &traj)
Definition: HitEff.cc:799
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
float ClusterLocErrX
Definition: HitEff.h:90
const_iterator end(bool update=false) const
float ClusterLocErrY
Definition: HitEff.h:90
ConstRecHitPointer const & recHit() const
float TrajGlbY
Definition: HitEff.h:88
float TrajLocX
Definition: HitEff.h:89
virtual const std::array< const float, 4 > parameters() const
float ResXSig
Definition: HitEff.h:91
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
TString subdetector
float chi2
Definition: HitEff.h:94
int ires[2]
float instLumi
Definition: HitEff.h:102
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
int bunchCrossing() const
Definition: EventBase.h:66
const Bounds & bounds() const
Definition: Surface.h:120
std::pair< LocalPoint, LocalError > LocalValues
float ClusterStoN
Definition: HitEff.h:90
data_type const * const_iterator
Definition: DetSetNew.h:30
float TrajLocErrX
Definition: HitEff.h:89
float commonMode
Definition: HitEff.h:103
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
Definition: Electron.h:6
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
bool DEBUG
Definition: HitEff.h:83
const edm::EDGetTokenT< MeasurementTrackerEvent > trackerEvent_token_
Definition: HitEff.h:75
unsigned int bunchx
Definition: HitEff.h:95
static std::string const input
Definition: EdmProvDump.cc:44
float p
Definition: HitEff.h:94
float timeECAL
Definition: HitEff.h:98
virtual float width() const =0
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
bool isDoubleSided(unsigned int iidd, const TrackerTopology *tTopo) const
Definition: HitEff.cc:767
float timeDTErr
Definition: HitEff.h:96
short getBadApvs(const uint32_t &detid) const
float PU
Definition: HitEff.h:102
int nHits
Definition: HitEff.h:93
unsigned int Id
Definition: HitEff.h:92
T sqrt(T t)
Definition: SSEVec.h:18
int timeDTDOF
Definition: HitEff.h:97
float timeAtIpInOutErr
Definition: MuonTime.h:15
const edm::EDGetTokenT< DetIdCollection > digis_token_
Definition: HitEff.h:74
int nDof
number of muon stations used
Definition: MuonTime.h:10
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned int trajHitValid
Definition: HitEff.h:95
unsigned int ModIsBad
Definition: HitEff.h:92
float TrajGlbX
Definition: HitEff.h:88
bool isValid() const
Definition: HandleBase.h:74
bool withinAcceptance
Definition: HitEff.h:92
unsigned int run
Definition: HitEff.h:95
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:475
size_type size() const
Return the number of contained DetSets.
Definition: DetSetVector.h:283
float ClusterLocX
Definition: HitEff.h:90
ii
Definition: cuy.py:588
int events
Definition: HitEff.h:80
float TrajLocAngleX
Definition: HitEff.h:89
Definition: DetId.h:18
double checkConsistency(const StripClusterParameterEstimator::LocalValues &parameters, double xx, double xerr)
Definition: HitEff.cc:760
T const * product() const
Definition: Handle.h:81
unsigned int whatlayer
Definition: HitEff.h:84
virtual int nstrips() const =0
unsigned int trackMultiplicityCut_
Definition: HitEff.h:69
unsigned int checkLayer(unsigned int iidd, const TrackerTopology *tTopo)
Definition: HitEff.cc:815
float timeDT
Definition: HitEff.h:96
unsigned int layers
Definition: HitEff.h:82
float pT
Definition: HitEff.h:94
float ResX
Definition: HitEff.h:91
const edm::EDGetTokenT< reco::TrackCollection > combinatorialTracks_token_
Definition: HitEff.h:71
bool addLumi_
Definition: HitEff.h:66
unsigned int SiStripQualBad
Definition: HitEff.h:92
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
bool addCommonMode_
Definition: HitEff.h:67
size_type size() const
edm::EventID id() const
Definition: EventBase.h:60
fixed size matrix
HLT enums.
float TrajLocErrY
Definition: HitEff.h:89
float TrajLocAngleY
Definition: HitEff.h:89
bool cutOnTracks_
Definition: HitEff.h:68
float ClusterLocY
Definition: HitEff.h:90
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
Definition: HitEff.h:73
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104
const edm::EDGetTokenT< LumiScalersCollection > scalerToken_
Definition: HitEff.h:63
TTree * traj
Definition: HitEff.h:79
const edm::EDGetTokenT< std::vector< Trajectory > > trajectories_token_
Definition: HitEff.h:72
T const * product() const
Definition: ESHandle.h:86
const edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > commonModeToken_
Definition: HitEff.h:64
float timeAtIpInOut
Definition: MuonTime.h:14
int EventTrackCKF
Definition: HitEff.h:80
const_iterator begin(bool update=false) const
int nLostHits
Definition: HitEff.h:93
float TrajLocY
Definition: HitEff.h:89
unsigned int tecSide(const DetId &id) const
void HitEff::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 94 of file HitEff.cc.

References addCommonMode_, addLumi_, bunchx, chi2, ClusterLocErrX, ClusterLocErrY, ClusterLocX, ClusterLocY, ClusterStoN, commonMode, dedx, dedxNOM, events, EventTrackCKF, Id, instLumi, istep, TFileService::make(), ModIsBad, nHits, nLostHits, p, pT, PU, ResX, ResXSig, run, SiStripQualBad, timeDT, timeDTDOF, timeDTErr, timeECAL, tquality, traj, TrajGlbX, TrajGlbY, TrajGlbZ, trajHitValid, TrajLocAngleX, TrajLocAngleY, TrajLocErrX, TrajLocErrY, TrajLocX, TrajLocY, whatlayer, and withinAcceptance.

94  {
95 
97 
98  traj = fs->make<TTree>("traj","tree of trajectory positions");
99  traj->Branch("TrajGlbX",&TrajGlbX,"TrajGlbX/F");
100  traj->Branch("TrajGlbY",&TrajGlbY,"TrajGlbY/F");
101  traj->Branch("TrajGlbZ",&TrajGlbZ,"TrajGlbZ/F");
102  traj->Branch("TrajLocX",&TrajLocX,"TrajLocX/F");
103  traj->Branch("TrajLocY",&TrajLocY,"TrajLocY/F");
104  traj->Branch("TrajLocErrX",&TrajLocErrX,"TrajLocErrX/F");
105  traj->Branch("TrajLocErrY",&TrajLocErrY,"TrajLocErrY/F");
106  traj->Branch("TrajLocAngleX",&TrajLocAngleX,"TrajLocAngleX/F");
107  traj->Branch("TrajLocAngleY",&TrajLocAngleY,"TrajLocAngleY/F");
108  traj->Branch("ClusterLocX",&ClusterLocX,"ClusterLocX/F");
109  traj->Branch("ClusterLocY",&ClusterLocY,"ClusterLocY/F");
110  traj->Branch("ClusterLocErrX",&ClusterLocErrX,"ClusterLocErrX/F");
111  traj->Branch("ClusterLocErrY",&ClusterLocErrY,"ClusterLocErrY/F");
112  traj->Branch("ClusterStoN",&ClusterStoN,"ClusterStoN/F");
113  traj->Branch("ResX",&ResX,"ResX/F");
114  traj->Branch("ResXSig",&ResXSig,"ResXSig/F");
115  traj->Branch("ModIsBad",&ModIsBad,"ModIsBad/i");
116  traj->Branch("SiStripQualBad",&SiStripQualBad,"SiStripQualBad/i");
117  traj->Branch("withinAcceptance",&withinAcceptance,"withinAcceptance/O");
118  traj->Branch("nHits",&nHits,"nHits/I");
119  traj->Branch("nLostHits",&nLostHits,"nLostHits/I");
120  traj->Branch("chi2",&chi2,"chi2/F");
121  traj->Branch("p",&p,"p/F");
122  traj->Branch("pT",&pT,"pT/F");
123  traj->Branch("trajHitValid", &trajHitValid, "trajHitValid/i");
124  traj->Branch("Id",&Id,"Id/i");
125  traj->Branch("run",&run,"run/i");
126  traj->Branch("event",&event,"event/i");
127  traj->Branch("layer",&whatlayer,"layer/i");
128  traj->Branch("timeDT",&timeDT,"timeDT/F");
129  traj->Branch("timeDTErr",&timeDTErr,"timeDTErr/F");
130  traj->Branch("timeDTDOF",&timeDTDOF,"timeDTDOF/I");
131  traj->Branch("timeECAL",&timeECAL,"timeECAL/F");
132  traj->Branch("dedx",&dedx,"dedx/F");
133  traj->Branch("dedxNOM",&dedxNOM,"dedxNOM/I");
134  traj->Branch("tquality",&tquality,"tquality/I");
135  traj->Branch("istep",&istep,"istep/I");
136  traj->Branch("bunchx",&bunchx,"bunchx/I");
137  if(addLumi_) {
138  traj->Branch("instLumi",&instLumi,"instLumi/F");
139  traj->Branch("PU",&PU,"PU/F");
140  }
141  if(addCommonMode_) traj->Branch("commonMode",&commonMode,"commonMode/F");
142 
143  events = 0;
144  EventTrackCKF = 0;
145 
146 }
float TrajGlbZ
Definition: HitEff.h:88
float ClusterLocErrX
Definition: HitEff.h:90
float ClusterLocErrY
Definition: HitEff.h:90
float TrajGlbY
Definition: HitEff.h:88
float TrajLocX
Definition: HitEff.h:89
float ResXSig
Definition: HitEff.h:91
float chi2
Definition: HitEff.h:94
float instLumi
Definition: HitEff.h:102
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
float ClusterStoN
Definition: HitEff.h:90
float TrajLocErrX
Definition: HitEff.h:89
float commonMode
Definition: HitEff.h:103
unsigned int bunchx
Definition: HitEff.h:95
float p
Definition: HitEff.h:94
float timeECAL
Definition: HitEff.h:98
float timeDTErr
Definition: HitEff.h:96
float PU
Definition: HitEff.h:102
int nHits
Definition: HitEff.h:93
unsigned int Id
Definition: HitEff.h:92
int timeDTDOF
Definition: HitEff.h:97
unsigned int trajHitValid
Definition: HitEff.h:95
unsigned int ModIsBad
Definition: HitEff.h:92
int istep
Definition: HitEff.h:101
float TrajGlbX
Definition: HitEff.h:88
bool withinAcceptance
Definition: HitEff.h:92
unsigned int run
Definition: HitEff.h:95
float ClusterLocX
Definition: HitEff.h:90
int events
Definition: HitEff.h:80
float TrajLocAngleX
Definition: HitEff.h:89
int dedxNOM
Definition: HitEff.h:99
unsigned int whatlayer
Definition: HitEff.h:84
float timeDT
Definition: HitEff.h:96
float pT
Definition: HitEff.h:94
float ResX
Definition: HitEff.h:91
bool addLumi_
Definition: HitEff.h:66
unsigned int SiStripQualBad
Definition: HitEff.h:92
bool addCommonMode_
Definition: HitEff.h:67
float TrajLocErrY
Definition: HitEff.h:89
float TrajLocAngleY
Definition: HitEff.h:89
float dedx
Definition: HitEff.h:98
float ClusterLocY
Definition: HitEff.h:90
TTree * traj
Definition: HitEff.h:79
int EventTrackCKF
Definition: HitEff.h:80
int nLostHits
Definition: HitEff.h:93
float TrajLocY
Definition: HitEff.h:89
int tquality
Definition: HitEff.h:100
Definition: event.py:1
bool HitEff::check2DPartner ( unsigned int  iidd,
const std::vector< TrajectoryMeasurement > &  traj 
)

Definition at line 799 of file HitEff.cc.

Referenced by analyze().

799  {
800  unsigned int partner_iidd = 0;
801  bool found2DPartner = false;
802  // first get the id of the other detector
803  if ((iidd & 0x3)==1) partner_iidd = iidd+1;
804  if ((iidd & 0x3)==2) partner_iidd = iidd-1;
805  // next look in the trajectory measurements for a measurement from that detector
806  // loop through trajectory measurements to find the partner_iidd
807  for (std::vector<TrajectoryMeasurement>::const_iterator iTM=traj.begin(); iTM!=traj.end(); ++iTM) {
808  if (iTM->recHit()->geographicalId().rawId()==partner_iidd) {
809  found2DPartner = true;
810  }
811  }
812  return found2DPartner;
813 }
TTree * traj
Definition: HitEff.h:79
double HitEff::checkConsistency ( const StripClusterParameterEstimator::LocalValues parameters,
double  xx,
double  xerr 
)

Definition at line 760 of file HitEff.cc.

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

Referenced by analyze().

760  {
761  double error = sqrt(parameters.second.xx() + xerr*xerr);
762  double separation = abs(parameters.first.x() - xx);
763  double consistency = separation/error;
764  return consistency;
765 }
T sqrt(T t)
Definition: SSEVec.h:18
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned int HitEff::checkLayer ( unsigned int  iidd,
const TrackerTopology tTopo 
)

Definition at line 815 of file HitEff.cc.

References DEFINE_FWK_MODULE, digitizers_cfi::strip, DetId::subdetId(), StripSubdetector::TEC, TrackerTopology::tecWheel(), StripSubdetector::TIB, TrackerTopology::tibLayer(), StripSubdetector::TID, TrackerTopology::tidWheel(), StripSubdetector::TOB, and TrackerTopology::tobLayer().

Referenced by analyze().

815  {
817  unsigned int subid=strip.subdetId();
818  if (subid == StripSubdetector::TIB) {
819 
820  return tTopo->tibLayer(iidd);
821  }
822  if (subid == StripSubdetector::TOB) {
823 
824  return tTopo->tobLayer(iidd) + 4 ;
825  }
826  if (subid == StripSubdetector::TID) {
827 
828  return tTopo->tidWheel(iidd) + 10;
829  }
830  if (subid == StripSubdetector::TEC) {
831 
832  return tTopo->tecWheel(iidd) + 13 ;
833  }
834  return 0;
835 }
unsigned int tibLayer(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:38
unsigned int tecWheel(const DetId &id) const
unsigned int tobLayer(const DetId &id) const
void HitEff::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 752 of file HitEff.cc.

References gather_cfg::cout, DEBUG, events, EventTrackCKF, and traj.

Referenced by o2olib.O2ORunMgr::executeJob().

752  {
753  traj->GetDirectory()->cd();
754  traj->Write();
755 
756  if (DEBUG) cout << " Events Analysed " << events << endl;
757  if (DEBUG) cout << " Number Of Tracked events " << EventTrackCKF << endl;
758 }
bool DEBUG
Definition: HitEff.h:83
int events
Definition: HitEff.h:80
TTree * traj
Definition: HitEff.h:79
int EventTrackCKF
Definition: HitEff.h:80
bool HitEff::isDoubleSided ( unsigned int  iidd,
const TrackerTopology tTopo 
) const

Definition at line 767 of file HitEff.cc.

References digitizers_cfi::strip, DetId::subdetId(), StripSubdetector::TEC, TrackerTopology::tecRing(), StripSubdetector::TIB, TrackerTopology::tibLayer(), StripSubdetector::TID, TrackerTopology::tidRing(), StripSubdetector::TOB, and TrackerTopology::tobLayer().

Referenced by analyze().

767  {
769  unsigned int subid=strip.subdetId();
770  unsigned int layer = 0;
771  if (subid == StripSubdetector::TIB) {
772 
773  layer = tTopo->tibLayer(iidd);
774  if (layer == 1 || layer == 2) return true;
775  else return false;
776  }
777  else if (subid == StripSubdetector::TOB) {
778 
779  layer = tTopo->tobLayer(iidd) + 4 ;
780  if (layer == 5 || layer == 6) return true;
781  else return false;
782  }
783  else if (subid == StripSubdetector::TID) {
784 
785  layer = tTopo->tidRing(iidd) + 10;
786  if (layer == 11 || layer == 12) return true;
787  else return false;
788  }
789  else if (subid == StripSubdetector::TEC) {
790 
791  layer = tTopo->tecRing(iidd) + 13 ;
792  if (layer == 14 || layer == 15 || layer == 18) return true;
793  else return false;
794  }
795  else
796  return false;
797 }
unsigned int tibLayer(const DetId &id) const
unsigned int tidRing(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:38
unsigned int tobLayer(const DetId &id) const

Member Data Documentation

bool HitEff::addCommonMode_
private

Definition at line 67 of file HitEff.h.

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

bool HitEff::addLumi_
private

Definition at line 66 of file HitEff.h.

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

unsigned int HitEff::bunchx
private

Definition at line 95 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::chi2
private

Definition at line 94 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::ClusterLocErrX
private

Definition at line 90 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::ClusterLocErrY
private

Definition at line 90 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::ClusterLocX
private

Definition at line 90 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::ClusterLocY
private

Definition at line 90 of file HitEff.h.

Referenced by analyze(), and beginJob().

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

Definition at line 73 of file HitEff.h.

Referenced by analyze().

float HitEff::ClusterStoN
private

Definition at line 90 of file HitEff.h.

Referenced by analyze(), and beginJob().

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

Definition at line 71 of file HitEff.h.

Referenced by analyze().

float HitEff::commonMode
private

Definition at line 103 of file HitEff.h.

Referenced by analyze(), and beginJob().

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

Definition at line 64 of file HitEff.h.

Referenced by analyze().

edm::ParameterSet HitEff::conf_
private

Definition at line 77 of file HitEff.h.

Referenced by HitEff().

bool HitEff::cutOnTracks_
private

Definition at line 68 of file HitEff.h.

Referenced by analyze(), and HitEff().

bool HitEff::DEBUG
private

Definition at line 83 of file HitEff.h.

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

float HitEff::dedx
private

Definition at line 98 of file HitEff.h.

Referenced by beginJob().

int HitEff::dedxNOM
private

Definition at line 99 of file HitEff.h.

Referenced by beginJob().

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

Definition at line 74 of file HitEff.h.

Referenced by analyze().

unsigned int HitEff::event
private
int HitEff::events
private
int HitEff::EventTrackCKF
private

Definition at line 80 of file HitEff.h.

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

unsigned int HitEff::Id
private

Definition at line 92 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::instLumi
private

Definition at line 102 of file HitEff.h.

Referenced by analyze(), and beginJob().

int HitEff::istep
private

Definition at line 101 of file HitEff.h.

Referenced by beginJob().

unsigned int HitEff::layers
private

Definition at line 82 of file HitEff.h.

Referenced by analyze(), and HitEff().

unsigned int HitEff::ModIsBad
private

Definition at line 92 of file HitEff.h.

Referenced by analyze(), and beginJob().

int HitEff::nHits
private

Definition at line 93 of file HitEff.h.

Referenced by analyze(), and beginJob().

int HitEff::nLostHits
private

Definition at line 93 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::p
private
float HitEff::pT
private

Definition at line 94 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::PU
private

Definition at line 102 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::ResX
private

Definition at line 91 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::ResXSig
private

Definition at line 91 of file HitEff.h.

Referenced by analyze(), and beginJob().

unsigned int HitEff::run
private
const edm::EDGetTokenT<LumiScalersCollection> HitEff::scalerToken_
private

Definition at line 63 of file HitEff.h.

Referenced by analyze().

unsigned int HitEff::SiStripQualBad
private

Definition at line 92 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::timeDT
private

Definition at line 96 of file HitEff.h.

Referenced by analyze(), and beginJob().

int HitEff::timeDTDOF
private

Definition at line 97 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::timeDTErr
private

Definition at line 96 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::timeECAL
private

Definition at line 98 of file HitEff.h.

Referenced by analyze(), and beginJob().

int HitEff::tquality
private

Definition at line 100 of file HitEff.h.

Referenced by beginJob().

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

Definition at line 75 of file HitEff.h.

Referenced by analyze().

unsigned int HitEff::trackMultiplicityCut_
private

Definition at line 69 of file HitEff.h.

Referenced by analyze(), and HitEff().

TTree* HitEff::traj
private

Definition at line 79 of file HitEff.h.

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

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

Definition at line 72 of file HitEff.h.

Referenced by analyze().

float HitEff::TrajGlbX
private

Definition at line 88 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::TrajGlbY
private

Definition at line 88 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::TrajGlbZ
private

Definition at line 88 of file HitEff.h.

Referenced by analyze(), and beginJob().

unsigned int HitEff::trajHitValid
private

Definition at line 95 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::TrajLocAngleX
private

Definition at line 89 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::TrajLocAngleY
private

Definition at line 89 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::TrajLocErrX
private

Definition at line 89 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::TrajLocErrY
private

Definition at line 89 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::TrajLocX
private

Definition at line 89 of file HitEff.h.

Referenced by analyze(), and beginJob().

float HitEff::TrajLocY
private

Definition at line 89 of file HitEff.h.

Referenced by analyze(), and beginJob().

unsigned int HitEff::whatlayer
private

Definition at line 84 of file HitEff.h.

Referenced by analyze(), and beginJob().

bool HitEff::withinAcceptance
private

Definition at line 92 of file HitEff.h.

Referenced by analyze(), and beginJob().