CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Private Types | Private Attributes
SiStripLAProfileBooker Class Reference

#include <SiStripLAProfileBooker.h>

Inheritance diagram for SiStripLAProfileBooker:
edm::one::EDAnalyzer< edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  detparameters
 

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void beginRun (edm::Run const &, const edm::EventSetup &c) override
 
void endJob () override
 
void endRun (edm::Run const &, const edm::EventSetup &c) override
 
void getlayer (const DetId &detid, const TrackerTopology *tTopo, std::string &name, unsigned int &layerid)
 
 SiStripLAProfileBooker (const edm::ParameterSet &conf)
 
 ~SiStripLAProfileBooker () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector
< ProductResolverIndexAndSkipBit >
const & 
itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef std::map< unsigned int,
detparameters * > 
detparmap
 
typedef std::map< unsigned int,
MonitorElement * > 
histomap
 

Private Attributes

uint8_t Amplitudes [100]
 
float barycenter
 
int better_double_hit
 
int bw_fw
 
float chi2norm
 
int ClSize
 
edm::ParameterSet conf_
 
DQMStoredbe_
 
edm::ESGetToken
< SiStripDetCabling,
SiStripDetCablingRcd
detCablingToken_
 
detparmap detmap
 
float EtaTrack
 
TDirectory * Event_Tree
 
int eventcounter
 
int EventCounter
 
int EventNumber
 
TTree * EventTree
 
int Ext_Int
 
TFile * hFile
 
histomap histos
 
float hit_std_dev
 
TDirectory * Hit_Tree
 
int HitCharge
 
int hitcounter
 
int hitcounter_2ndloop
 
int HitNr
 
int HitPerTrack
 
TTree * HitsTree
 
int id_detector
 
int Layer
 
float MagField
 
edm::ESGetToken< MagneticField,
IdealMagneticFieldRecord
magFieldToken_
 
float Momentum
 
int MonoStereo
 
int nstrip
 
int ParticleCharge
 
float PhiTrack
 
float pitch_detector
 
float pt
 
int RunNumber
 
float SignCorrection
 
int size
 
detparmap summarydetmap
 
histomap summaryhisto
 
float sumx
 
float TanTrackAngle
 
float TanTrackAngleParallel
 
float thick_detector
 
const TrackerGeometrytkGeom_ = nullptr
 
edm::ESGetToken
< TrackerGeometry,
TrackerDigiGeometryRecord
tkGeomToken_
 
TDirectory * Track_Tree
 
int trackcollsize
 
int TrackCounter
 
TTree * TrackTree
 
int trajsize
 
std::string treename_
 
edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
tTopoToken_
 
int Type
 
int Wheel
 
int worse_double_hit
 
float XGlobal
 
float YGlobal
 
float ZGlobal
 

Additional Inherited Members

- 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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 33 of file SiStripLAProfileBooker.h.

Member Typedef Documentation

typedef std::map<unsigned int, detparameters*> SiStripLAProfileBooker::detparmap
private

Definition at line 57 of file SiStripLAProfileBooker.h.

Definition at line 36 of file SiStripLAProfileBooker.h.

typedef std::map<unsigned int, MonitorElement*> SiStripLAProfileBooker::histomap
private

Definition at line 58 of file SiStripLAProfileBooker.h.

Definition at line 35 of file SiStripLAProfileBooker.h.

Constructor & Destructor Documentation

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

Definition at line 55 of file SiStripLAProfileBooker.cc.

References detCablingToken_.

56  : conf_(conf),
57  tTopoToken_(esConsumes<edm::Transition::BeginRun>()),
58  tkGeomToken_(esConsumes<edm::Transition::BeginRun>()),
59  magFieldToken_(esConsumes<edm::Transition::BeginRun>()),
60  detCablingToken_(conf_.getParameter<bool>("UseStripCablingDB")
61  ? decltype(detCablingToken_){esConsumes<edm::Transition::BeginRun>()}
edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd > detCablingToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
SiStripLAProfileBooker::~SiStripLAProfileBooker ( )
override

Definition at line 242 of file SiStripLAProfileBooker.cc.

References detmap, for(), hFile, and summarydetmap.

242  {
243  detparmap::iterator detpariter;
244  for (detpariter = detmap.begin(); detpariter != detmap.end(); ++detpariter)
245  delete detpariter->second;
246  for (detpariter = summarydetmap.begin(); detpariter != summarydetmap.end(); ++detpariter)
247  delete detpariter->second;
248  delete hFile;
249 }
for(Iditer=Id.begin();Iditer!=Id.end();Iditer++)

Member Function Documentation

void SiStripLAProfileBooker::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 253 of file SiStripLAProfileBooker.cc.

References Amplitudes, barycenter, SplitLinear::begin, better_double_hit, Surface::bounds(), bw_fw, utilities::cache(), chi2norm, ClSize, SiStripRecHit2D::cluster(), conf_, edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, detmap, EtaTrack, edm::EventID::event(), eventcounter, EventNumber, EventTree, Ext_Int, TrackingRecHit::geographicalId(), edm::Event::getByLabel(), edm::EventSetup::getData(), getlayer(), edm::ParameterSet::getParameter(), histos, hit_std_dev, HitCharge, hitcounter, hitcounter_2ndloop, HitNr, HitPerTrack, HitsTree, mps_fire::i, edm::EventBase::id(), id_detector, TrackerGeometry::idToDet(), Layer, TrajectoryStateOnSurface::localDirection(), StripTopology::localPitch(), BaseTrackerRecHit::localPosition(), LogDebug, PV3DBase< T, PVType, FrameType >::mag(), MagField, Momentum, GluedGeomDet::monoDet(), SiStripMatchedRecHit2D::monoHit(), MonoStereo, mergeVDriftHistosByStation::name, nstrip, ProjectedSiStripRecHit2D::originalHit(), ParticleCharge, PhiTrack, pitch_detector, position, funct::pow(), pt, DetId::rawId(), edm::EventID::run(), RunNumber, SignCorrection, size, GeomDet::specificSurface(), mathSSE::sqrt(), StripSubdetector::stereo(), GluedGeomDet::stereoDet(), SiStripMatchedRecHit2D::stereoHit(), AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), summaryhisto, sumx, GeomDet::surface(), TanTrackAngle, TanTrackAngleParallel, StripSubdetector::TEC, TrackerTopology::tecPetalInfo(), TrackerTopology::tecWheel(), thick_detector, Bounds::thickness(), StripSubdetector::TIB, TrackerTopology::tibLayer(), TrackerTopology::tibStringInfo(), StripSubdetector::TID, TrackerTopology::tidModuleInfo(), TrackerTopology::tidWheel(), tkGeom_, StripSubdetector::TOB, TrackerTopology::tobLayer(), TrackerTopology::tobRodInfo(), GeomDet::toGlobal(), GeomDet::toLocal(), GeomDet::topology(), HLT_FULL_cff::trackCollection, trackcollsize, tracks, TrackTree, trajsize, tTopoToken_, Type, Wheel, worse_double_hit, PV3DBase< T, PVType, FrameType >::x(), XGlobal, PV3DBase< T, PVType, FrameType >::y(), YGlobal, PV3DBase< T, PVType, FrameType >::z(), and ZGlobal.

253  {
254  const TrackerTopology* const tTopo = &es.getData(tTopoToken_);
255 
256  RunNumber = e.id().run();
257  EventNumber = e.id().event();
258 
259  eventcounter++;
260 
261  EventTree->Fill();
262 
263  //Analysis of Trajectory-RecHits
264 
266 
268  e.getByLabel(TkTag, trackCollection);
269 
271  e.getByLabel(TkTag, TrajectoryCollection);
272 
274  e.getByLabel(TkTag, TrajTrackMap);
275 
276  const reco::TrackCollection* tracks = trackCollection.product();
277 
278  // FIXME this has to be changed to use pointers to clusters...
279  std::map<const SiStripRecHit2D*, std::pair<float, float>, DetIdLess> hitangleassociation;
280  std::list<SiStripRecHit2D> cache; // ugly, inefficient, effective in making the above working
281 
282  trackcollsize = tracks->size();
283  trajsize = TrajectoryCollection->size();
284 
285  edm::LogInfo("SiStripLAProfileBooker::analyze") << " Number of tracks in event = " << trackcollsize << "\n";
286  edm::LogInfo("SiStripLAProfileBooker::analyze") << " Number of trajectories in event = " << trajsize << "\n";
287 
289 
290  for (TrajTrackIter = TrajTrackMap->begin(); TrajTrackIter != TrajTrackMap->end();
291  TrajTrackIter++) { //loop on trajectories
292 
293  if (TrajTrackIter->key->foundHits() >= 5) {
294  TrackTree->Fill();
295 
296  ParticleCharge = -99;
297  Momentum = -99;
298  pt = -99;
299  chi2norm = -99;
300  HitPerTrack = -99;
301  EtaTrack = -99;
302  PhiTrack = -99;
303 
304  ParticleCharge = TrajTrackIter->val->charge();
305  pt = TrajTrackIter->val->pt();
306  Momentum = TrajTrackIter->val->p();
307  chi2norm = TrajTrackIter->val->normalizedChi2();
308  EtaTrack = TrajTrackIter->val->eta();
309  PhiTrack = TrajTrackIter->val->phi();
310  HitPerTrack = TrajTrackIter->key->foundHits();
311 
312  std::vector<TrajectoryMeasurement> TMeas = TrajTrackIter->key->measurements();
313  std::vector<TrajectoryMeasurement>::iterator itm;
314 
315  for (itm = TMeas.begin(); itm != TMeas.end(); itm++) { //loop on hits
316 
317  int i;
318  for (i = 0; i < 100; i++) {
319  Amplitudes[i] = 0;
320  }
321 
322  TanTrackAngle = -99;
323  TanTrackAngleParallel = -99;
324  ClSize = -99;
325  HitCharge = 0;
326  Type = -99;
327  Layer = -99;
328  Wheel = -99;
329  bw_fw = -99;
330  Ext_Int = -99;
331  MonoStereo = -99;
332  MagField = -99;
333  SignCorrection = -99;
334  XGlobal = -99;
335  YGlobal = -99;
336  ZGlobal = -99;
337  barycenter = -99;
338  hit_std_dev = -99;
339  sumx = 0;
340  id_detector = -1;
341  thick_detector = -1;
342  pitch_detector = -1;
343  HitNr = 1;
344 
345  SiStripRecHit2D lhit;
346  TrajectoryStateOnSurface tsos = itm->updatedState();
347  const TransientTrackingRecHit::ConstRecHitPointer thit = itm->recHit();
348  if ((thit->geographicalId().subdetId() == int(StripSubdetector::TIB)) ||
349  thit->geographicalId().subdetId() == int(StripSubdetector::TOB)) { //include only barrel
350  const SiStripMatchedRecHit2D* matchedhit = dynamic_cast<const SiStripMatchedRecHit2D*>((*thit).hit());
351  const ProjectedSiStripRecHit2D* phit = dynamic_cast<const ProjectedSiStripRecHit2D*>((*thit).hit());
352  const SiStripRecHit2D* hit = dynamic_cast<const SiStripRecHit2D*>((*thit).hit());
353  if (phit) {
354  lhit = phit->originalHit();
355  hit = &lhit;
356  }
357 
358  LocalVector trackdirection = tsos.localDirection();
359 
360  if (matchedhit) { //if matched hit...
361 
362  GluedGeomDet* gdet = (GluedGeomDet*)tkGeom_->idToDet(matchedhit->geographicalId());
363 
364  GlobalVector gtrkdir = gdet->toGlobal(trackdirection);
365 
366  // THIS THE POINTER TO THE MONO HIT OF A MATCHED HIT
367 
368  // top be migrated to the more direct interface of matchedhit
369  cache.push_back(matchedhit->monoHit());
370  const SiStripRecHit2D* monohit = &cache.back();
371  const SiStripRecHit2D::ClusterRef& monocluster = monohit->cluster();
372  const GeomDetUnit* monodet = gdet->monoDet();
373  // this does not exists anymore! either project the matched or use CPE
374  const LocalPoint monoposition = monohit->localPosition();
375 
377  id_detector = detid.rawId();
379  const StripTopology& mtopol = (StripTopology&)monodet->topology();
380  pitch_detector = mtopol.localPitch(monoposition);
381  const GlobalPoint monogposition = (monodet->surface()).toGlobal(monoposition);
382  ClSize = (monocluster->amplitudes()).size();
383 
384  const auto& amplitudes = monocluster->amplitudes();
385 
386  barycenter = monocluster->barycenter() - 0.5;
387  uint16_t FirstStrip = monocluster->firstStrip();
388  auto begin = amplitudes.begin();
389  nstrip = 0;
390  for (auto idigi = begin; idigi != amplitudes.end(); idigi++) {
391  Amplitudes[nstrip] = *idigi;
392  sumx += pow(((FirstStrip + idigi - begin) - barycenter), 2) * (*idigi);
393  HitCharge += *idigi;
394  }
396 
397  XGlobal = monogposition.x();
398  YGlobal = monogposition.y();
399  ZGlobal = monogposition.z();
400 
401  Type = detid.subdetId();
402  MonoStereo = detid.stereo();
403 
404  if (detid.subdetId() == int(StripSubdetector::TIB)) {
405  Layer = tTopo->tibLayer(detid);
406  bw_fw = tTopo->tibStringInfo(detid)[0];
407  Ext_Int = tTopo->tibStringInfo(detid)[1];
408  }
409  if (detid.subdetId() == int(StripSubdetector::TOB)) {
410  Layer = tTopo->tobLayer(detid);
411  bw_fw = tTopo->tobRodInfo(detid)[0];
412  }
413  if (detid.subdetId() == int(StripSubdetector::TID)) {
414  Wheel = tTopo->tidWheel(detid);
415  bw_fw = tTopo->tidModuleInfo(detid)[0];
416  }
417  if (detid.subdetId() == int(StripSubdetector::TEC)) {
418  Wheel = tTopo->tecWheel(detid);
419  bw_fw = tTopo->tecPetalInfo(detid)[0];
420  }
421 
422  LocalVector monotkdir = monodet->toLocal(gtrkdir);
423 
424  if (monotkdir.z() != 0) {
425  // THE LOCAL ANGLE (MONO)
426  float tanangle = monotkdir.x() / monotkdir.z();
427  TanTrackAngleParallel = monotkdir.y() / monotkdir.z();
428  TanTrackAngle = tanangle;
429  detparmap::iterator TheDet = detmap.find(detid.rawId());
430  LocalVector localmagdir;
431  if (TheDet != detmap.end())
432  localmagdir = TheDet->second->magfield;
433  MagField = localmagdir.mag();
434  if (MagField != 0.) {
435  LocalVector monoylocal(0, 1, 0);
436  float signcorrection = (localmagdir * monoylocal) / (MagField);
437  if (signcorrection != 0)
438  SignCorrection = 1 / signcorrection;
439  }
440 
441  std::map<const SiStripRecHit2D*, std::pair<float, float>, DetIdLess>::iterator alreadystored =
442  hitangleassociation.find(monohit);
443 
444  if (alreadystored != hitangleassociation.end()) { //decide which hit take
445  if (itm->estimate() > alreadystored->second.first) {
447  }
448  if (itm->estimate() < alreadystored->second.first) {
450  hitangleassociation.insert(std::make_pair(monohit, std::make_pair(itm->estimate(), tanangle)));
451  }
452  } else {
453  hitangleassociation.insert(make_pair(monohit, std::make_pair(itm->estimate(), tanangle)));
454  HitsTree->Fill();
455  hitcounter++;
456  }
457 
458  // THIS THE POINTER TO THE STEREO HIT OF A MATCHED HIT
459 
460  // top be migrated to the more direct interface of matchedhit
461  cache.push_back(matchedhit->stereoHit());
462  const SiStripRecHit2D* stereohit = &cache.back();
463  const SiStripRecHit2D::ClusterRef& stereocluster = stereohit->cluster();
464  const GeomDetUnit* stereodet = gdet->stereoDet();
465  // this does not exists anymore! either project the matched or use CPE
466  const LocalPoint stereoposition = stereohit->localPosition();
467  StripSubdetector detid = (StripSubdetector)stereohit->geographicalId();
468  id_detector = detid.rawId();
469  thick_detector = stereodet->specificSurface().bounds().thickness();
470  const StripTopology& stopol = (StripTopology&)stereodet->topology();
471  pitch_detector = stopol.localPitch(stereoposition);
472  const GlobalPoint stereogposition = (stereodet->surface()).toGlobal(stereoposition);
473 
474  ClSize = (stereocluster->amplitudes()).size();
475 
476  const auto& amplitudes = stereocluster->amplitudes();
477 
478  barycenter = stereocluster->barycenter() - 0.5;
479  uint16_t FirstStrip = stereocluster->firstStrip();
480  auto begin = amplitudes.begin();
481  nstrip = 0;
482  for (auto idigi = begin; idigi != amplitudes.end(); idigi++) {
483  Amplitudes[nstrip] = *idigi;
484  sumx += pow(((FirstStrip + idigi - begin) - barycenter), 2) * (*idigi);
485  HitCharge += *idigi;
486  }
488 
489  XGlobal = stereogposition.x();
490  YGlobal = stereogposition.y();
491  ZGlobal = stereogposition.z();
492 
493  Type = detid.subdetId();
494  MonoStereo = detid.stereo();
495 
496  if (detid.subdetId() == int(StripSubdetector::TIB)) {
497  Layer = tTopo->tibLayer(detid);
498  bw_fw = tTopo->tibStringInfo(detid)[0];
499  Ext_Int = tTopo->tibStringInfo(detid)[1];
500  }
501  if (detid.subdetId() == int(StripSubdetector::TOB)) {
502  Layer = tTopo->tobLayer(detid);
503  bw_fw = tTopo->tobRodInfo(detid)[0];
504  }
505  if (detid.subdetId() == int(StripSubdetector::TID)) {
506  Wheel = tTopo->tidWheel(detid);
507  bw_fw = tTopo->tidModuleInfo(detid)[0];
508  }
509  if (detid.subdetId() == int(StripSubdetector::TEC)) {
510  Wheel = tTopo->tecWheel(detid);
511  bw_fw = tTopo->tecPetalInfo(detid)[0];
512  }
513 
514  LocalVector stereotkdir = stereodet->toLocal(gtrkdir);
515 
516  if (stereotkdir.z() != 0) {
517  // THE LOCAL ANGLE (STEREO)
518  float tanangle = stereotkdir.x() / stereotkdir.z();
519  TanTrackAngleParallel = stereotkdir.y() / stereotkdir.z();
520  TanTrackAngle = tanangle;
521  detparmap::iterator TheDet = detmap.find(detid.rawId());
522  LocalVector localmagdir;
523  if (TheDet != detmap.end())
524  localmagdir = TheDet->second->magfield;
525  MagField = localmagdir.mag();
526  LocalVector stereoylocal(0, 1, 0);
527  if (MagField != 0.) {
528  float signcorrection = (localmagdir * stereoylocal) / (MagField);
529  if (signcorrection != 0)
530  SignCorrection = 1 / signcorrection;
531  }
532 
533  std::map<const SiStripRecHit2D*, std::pair<float, float>, DetIdLess>::iterator alreadystored =
534  hitangleassociation.find(stereohit);
535 
536  if (alreadystored != hitangleassociation.end()) { //decide which hit take
537  if (itm->estimate() > alreadystored->second.first) {
539  }
540  if (itm->estimate() < alreadystored->second.first) {
542  hitangleassociation.insert(std::make_pair(stereohit, std::make_pair(itm->estimate(), tanangle)));
543  }
544  } else {
545  hitangleassociation.insert(std::make_pair(stereohit, std::make_pair(itm->estimate(), tanangle)));
546  HitsTree->Fill();
547  hitcounter++;
548  }
549  }
550  }
551  } else if (hit) {
552  // hit= POINTER TO THE RECHIT
553 
554  const SiStripRecHit2D::ClusterRef& cluster = hit->cluster();
555 
557  const LocalPoint position = hit->localPosition();
559  id_detector = detid.rawId();
561  const StripTopology& topol = (StripTopology&)gdet->topology();
562  pitch_detector = topol.localPitch(position);
563  const GlobalPoint gposition = (gdet->surface()).toGlobal(position);
564 
565  ClSize = (cluster->amplitudes()).size();
566 
567  const auto& amplitudes = cluster->amplitudes();
568 
569  barycenter = cluster->barycenter() - 0.5;
570  uint16_t FirstStrip = cluster->firstStrip();
571  nstrip = 0;
572  auto begin = amplitudes.begin();
573  for (auto idigi = amplitudes.begin(); idigi != amplitudes.end(); idigi++) {
574  Amplitudes[nstrip] = *idigi;
575  sumx += pow(((FirstStrip + idigi - begin) - barycenter), 2) * (*idigi);
576  HitCharge += *idigi;
577  }
579 
580  XGlobal = gposition.x();
581  YGlobal = gposition.y();
582  ZGlobal = gposition.z();
583 
584  Type = detid.subdetId();
585  MonoStereo = detid.stereo();
586 
587  if (detid.subdetId() == int(StripSubdetector::TIB)) {
588  Layer = tTopo->tibLayer(detid);
589  bw_fw = tTopo->tibStringInfo(detid)[0];
590  Ext_Int = tTopo->tibStringInfo(detid)[1];
591  }
592  if (detid.subdetId() == int(StripSubdetector::TOB)) {
593  Layer = tTopo->tobLayer(detid);
594  bw_fw = tTopo->tobRodInfo(detid)[0];
595  }
596  if (detid.subdetId() == int(StripSubdetector::TID)) {
597  Wheel = tTopo->tidWheel(detid);
598  bw_fw = tTopo->tidModuleInfo(detid)[0];
599  }
600  if (detid.subdetId() == int(StripSubdetector::TEC)) {
601  Wheel = tTopo->tecWheel(detid);
602  bw_fw = tTopo->tecPetalInfo(detid)[0];
603  }
604 
605  if (trackdirection.z() != 0) {
606  // THE LOCAL ANGLE
607  float tanangle = trackdirection.x() / trackdirection.z();
608  TanTrackAngleParallel = trackdirection.y() / trackdirection.z();
609  TanTrackAngle = tanangle;
610  detparmap::iterator TheDet = detmap.find(detid.rawId());
611  LocalVector localmagdir;
612  if (TheDet != detmap.end())
613  localmagdir = TheDet->second->magfield;
614  MagField = localmagdir.mag();
615  if (MagField != 0.) {
616  LocalVector ylocal(0, 1, 0);
617  float signcorrection = (localmagdir * ylocal) / (MagField);
618  if (signcorrection != 0)
619  SignCorrection = 1 / signcorrection;
620  }
621 
622  std::map<const SiStripRecHit2D*, std::pair<float, float>, DetIdLess>::iterator alreadystored =
623  hitangleassociation.find(hit);
624 
625  if (alreadystored != hitangleassociation.end()) { //decide which hit take
626  if (itm->estimate() > alreadystored->second.first) {
628  }
629  if (itm->estimate() < alreadystored->second.first) {
631  hitangleassociation.insert(std::make_pair(hit, std::make_pair(itm->estimate(), tanangle)));
632  }
633  } else {
634  hitangleassociation.insert(std::make_pair(hit, std::make_pair(itm->estimate(), tanangle)));
635  HitsTree->Fill();
636  hitcounter++;
637  }
638  }
639  }
640  }
641  }
642  }
643  }
644  std::map<const SiStripRecHit2D*, std::pair<float, float>, DetIdLess>::iterator hitsiter;
645 
646  for (hitsiter = hitangleassociation.begin(); hitsiter != hitangleassociation.end(); hitsiter++) {
648 
649  const SiStripRecHit2D* hit = hitsiter->first;
650  const SiStripRecHit2D::ClusterRef& cluster = hit->cluster();
651 
652  size = (cluster->amplitudes()).size();
653 
655 
656  float tangent = hitsiter->second.second;
657 
658  //Sign and XZ plane projection correction applied in TrackLocalAngle (TIB|TOB layers)
659 
660  detparmap::iterator thedet = detmap.find(detid.rawId());
661  LocalVector localmagdir;
662  if (thedet != detmap.end())
663  localmagdir = thedet->second->magfield;
664  float localmagfield = localmagdir.mag();
665 
666  if (localmagfield != 0.) {
667  LocalVector ylocal(0, 1, 0);
668 
669  float normprojection = (localmagdir * ylocal) / (localmagfield);
670 
671  if (normprojection == 0.)
672  LogDebug("SiStripLAProfileBooker::analyze") << "Error: YBprojection = 0";
673 
674  else {
675  float signprojcorrection = 1 / normprojection;
676  tangent *= signprojcorrection;
677  }
678  }
679 
680  //Filling histograms
681 
682  histomap::iterator thehisto = histos.find(detid.rawId());
683 
684  if (thehisto == histos.end())
685  edm::LogError("SiStripLAProfileBooker::analyze")
686  << "Error: the profile associated to" << detid.rawId() << "does not exist! ";
687  else
688  thehisto->second->Fill(tangent, size);
689 
690  //Summary histograms
692  unsigned int layerid;
693  getlayer(detid, tTopo, name, layerid);
694  histomap::iterator thesummaryhisto = summaryhisto.find(layerid);
695  if (thesummaryhisto == summaryhisto.end())
696  edm::LogError("SiStripLAProfileBooker::analyze")
697  << "Error: the profile associated to subdet " << name << "does not exist! ";
698  else
699  thesummaryhisto->second->Fill(tangent, size);
700  }
701 }
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
static constexpr auto TEC
unsigned int tibLayer(const DetId &id) const
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:19
virtual const Topology & topology() const
Definition: GeomDet.cc:67
std::vector< unsigned int > tidModuleInfo(const DetId &id) const
LocalVector localDirection() const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
T y() const
Definition: PV3DBase.h:60
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
const Bounds & bounds() const
Definition: Surface.h:87
unsigned int tidWheel(const DetId &id) const
auto const & tracks
cannot be loose
std::vector< unsigned int > tibStringInfo(const DetId &id) const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
virtual float thickness() const =0
virtual float localPitch(const LocalPoint &) const =0
std::vector< unsigned int > tecPetalInfo(const DetId &id) const
T mag() const
Definition: PV3DBase.h:64
std::vector< unsigned int > tobRodInfo(const DetId &id) const
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
void getlayer(const DetId &detid, const TrackerTopology *tTopo, std::string &name, unsigned int &layerid)
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
ClusterRef cluster() const
static constexpr auto TOB
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:500
const TrackerGeomDet * idToDet(DetId) const override
SiStripRecHit2D originalHit() const
Log< level::Info, false > LogInfo
unsigned int stereo() const
stereo
tuple trackCollection
static constexpr auto TIB
SiStripRecHit2D stereoHit() const
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
std::vector< Trajectory > TrajectoryCollection
SiStripRecHit2D monoHit() const
edm::EventID id() const
Definition: EventBase.h:59
LocalPoint localPosition() const override
static int position[264][3]
Definition: ReadPGInfo.cc:289
DetId geographicalId() const
T x() const
Definition: PV3DBase.h:59
edm::InputTag TkTag
unsigned int tecWheel(const DetId &id) const
static constexpr auto TID
const TrackerGeometry * tkGeom_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:20
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40
unsigned int tobLayer(const DetId &id) const
def cache
Definition: utilities.py:3
#define LogDebug(id)
void SiStripLAProfileBooker::beginRun ( edm::Run const &  ,
const edm::EventSetup c 
)
override
void SiStripLAProfileBooker::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 737 of file SiStripLAProfileBooker.cc.

References conf_, dbe_, edm::ParameterSet::getUntrackedParameter(), hFile, dqm::implementation::DQMStore::save(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by o2olib.O2ORunMgr::executeJob().

737  {
738  std::string outputFile_ = conf_.getUntrackedParameter<std::string>("fileName", "LorentzAngle.root");
739  dbe_->save(outputFile_);
740 
741  hFile->Write();
742  hFile->Close();
743 }
T getUntrackedParameter(std::string const &, T const &) const
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:784
void SiStripLAProfileBooker::endRun ( edm::Run const &  ,
const edm::EventSetup c 
)
override

Definition at line 240 of file SiStripLAProfileBooker.cc.

240 {}
void SiStripLAProfileBooker::getlayer ( const DetId detid,
const TrackerTopology tTopo,
std::string &  name,
unsigned int &  layerid 
)

Definition at line 705 of file SiStripLAProfileBooker.cc.

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

Referenced by analyze(), and for().

708  {
709  int layer = 0;
710  std::stringstream layernum;
711 
712  if (detid.subdetId() == int(StripSubdetector::TIB)) {
713  name += "TIB_Layer_";
714  layer = tTopo->tibLayer(detid);
715  }
716 
717  else if (detid.subdetId() == int(StripSubdetector::TID)) {
718  name += "TID_Ring_";
719  layer = tTopo->tidRing(detid);
720  }
721 
722  else if (detid.subdetId() == int(StripSubdetector::TOB)) {
723  name += "TOB_Layer_";
724  layer = tTopo->tobLayer(detid);
725 
726  }
727 
728  else if (detid.subdetId() == int(StripSubdetector::TEC)) {
729  name += "TEC_Ring_";
730  layer = tTopo->tecRing(detid);
731  }
732  layernum << layer;
733  name += layernum.str();
734  layerid = detid.subdetId() * 10 + layer;
735 }
static constexpr auto TEC
unsigned int tibLayer(const DetId &id) const
unsigned int tidRing(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
constexpr std::array< uint8_t, layerIndexSize > layer
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
static constexpr auto TIB
static constexpr auto TID
unsigned int tobLayer(const DetId &id) const

Member Data Documentation

uint8_t SiStripLAProfileBooker::Amplitudes[100]
private

Definition at line 68 of file SiStripLAProfileBooker.h.

Referenced by analyze().

float SiStripLAProfileBooker::barycenter
private

Definition at line 62 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::better_double_hit
private

Definition at line 64 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::bw_fw
private

Definition at line 60 of file SiStripLAProfileBooker.h.

Referenced by analyze().

float SiStripLAProfileBooker::chi2norm
private

Definition at line 62 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::ClSize
private

Definition at line 60 of file SiStripLAProfileBooker.h.

Referenced by analyze().

edm::ParameterSet SiStripLAProfileBooker::conf_
private

Definition at line 82 of file SiStripLAProfileBooker.h.

Referenced by analyze(), and endJob().

DQMStore* SiStripLAProfileBooker::dbe_
private

Definition at line 78 of file SiStripLAProfileBooker.h.

Referenced by endJob(), and for().

edm::ESGetToken<SiStripDetCabling, SiStripDetCablingRcd> SiStripLAProfileBooker::detCablingToken_
private

Definition at line 89 of file SiStripLAProfileBooker.h.

Referenced by if(), and SiStripLAProfileBooker().

detparmap SiStripLAProfileBooker::detmap
private

Definition at line 80 of file SiStripLAProfileBooker.h.

Referenced by analyze(), for(), and ~SiStripLAProfileBooker().

float SiStripLAProfileBooker::EtaTrack
private

Definition at line 62 of file SiStripLAProfileBooker.h.

Referenced by analyze().

TDirectory * SiStripLAProfileBooker::Event_Tree
private

Definition at line 73 of file SiStripLAProfileBooker.h.

int SiStripLAProfileBooker::eventcounter
private

Definition at line 64 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::EventCounter
private

Definition at line 66 of file SiStripLAProfileBooker.h.

int SiStripLAProfileBooker::EventNumber
private

Definition at line 60 of file SiStripLAProfileBooker.h.

Referenced by analyze().

TTree * SiStripLAProfileBooker::EventTree
private

Definition at line 70 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::Ext_Int
private

Definition at line 60 of file SiStripLAProfileBooker.h.

Referenced by analyze().

TFile* SiStripLAProfileBooker::hFile
private

Definition at line 71 of file SiStripLAProfileBooker.h.

Referenced by endJob(), and ~SiStripLAProfileBooker().

histomap SiStripLAProfileBooker::histos
private

Definition at line 75 of file SiStripLAProfileBooker.h.

Referenced by analyze(), DisplayManager.DisplayManager::Draw(), and for().

float SiStripLAProfileBooker::hit_std_dev
private

Definition at line 62 of file SiStripLAProfileBooker.h.

Referenced by analyze().

TDirectory* SiStripLAProfileBooker::Hit_Tree
private

Definition at line 73 of file SiStripLAProfileBooker.h.

int SiStripLAProfileBooker::HitCharge
private

Definition at line 60 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::hitcounter
private

Definition at line 64 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::hitcounter_2ndloop
private

Definition at line 64 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::HitNr
private

Definition at line 64 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::HitPerTrack
private

Definition at line 64 of file SiStripLAProfileBooker.h.

Referenced by analyze().

TTree* SiStripLAProfileBooker::HitsTree
private

Definition at line 70 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::id_detector
private

Definition at line 66 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::Layer
private

Definition at line 60 of file SiStripLAProfileBooker.h.

Referenced by analyze().

float SiStripLAProfileBooker::MagField
private

Definition at line 62 of file SiStripLAProfileBooker.h.

Referenced by analyze().

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> SiStripLAProfileBooker::magFieldToken_
private

Definition at line 88 of file SiStripLAProfileBooker.h.

float SiStripLAProfileBooker::Momentum
private

Definition at line 62 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::MonoStereo
private

Definition at line 60 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::nstrip
private

Definition at line 64 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::ParticleCharge
private

Definition at line 60 of file SiStripLAProfileBooker.h.

Referenced by analyze().

float SiStripLAProfileBooker::PhiTrack
private

Definition at line 62 of file SiStripLAProfileBooker.h.

Referenced by analyze().

float SiStripLAProfileBooker::pitch_detector
private

Definition at line 67 of file SiStripLAProfileBooker.h.

Referenced by analyze().

float SiStripLAProfileBooker::pt
private
int SiStripLAProfileBooker::RunNumber
private

Definition at line 60 of file SiStripLAProfileBooker.h.

Referenced by analyze().

float SiStripLAProfileBooker::SignCorrection
private

Definition at line 62 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::size
private
detparmap SiStripLAProfileBooker::summarydetmap
private

Definition at line 81 of file SiStripLAProfileBooker.h.

Referenced by for(), and ~SiStripLAProfileBooker().

histomap SiStripLAProfileBooker::summaryhisto
private

Definition at line 76 of file SiStripLAProfileBooker.h.

Referenced by analyze(), and for().

float SiStripLAProfileBooker::sumx
private

Definition at line 62 of file SiStripLAProfileBooker.h.

Referenced by analyze().

float SiStripLAProfileBooker::TanTrackAngle
private

Definition at line 62 of file SiStripLAProfileBooker.h.

Referenced by analyze().

float SiStripLAProfileBooker::TanTrackAngleParallel
private

Definition at line 62 of file SiStripLAProfileBooker.h.

Referenced by analyze().

float SiStripLAProfileBooker::thick_detector
private

Definition at line 67 of file SiStripLAProfileBooker.h.

Referenced by analyze().

const TrackerGeometry* SiStripLAProfileBooker::tkGeom_ = nullptr
private

Definition at line 85 of file SiStripLAProfileBooker.h.

Referenced by analyze(), and for().

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiStripLAProfileBooker::tkGeomToken_
private

Definition at line 87 of file SiStripLAProfileBooker.h.

TDirectory * SiStripLAProfileBooker::Track_Tree
private

Definition at line 73 of file SiStripLAProfileBooker.h.

int SiStripLAProfileBooker::trackcollsize
private

Definition at line 60 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::TrackCounter
private

Definition at line 66 of file SiStripLAProfileBooker.h.

TTree * SiStripLAProfileBooker::TrackTree
private

Definition at line 70 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::trajsize
private

Definition at line 60 of file SiStripLAProfileBooker.h.

Referenced by analyze().

std::string SiStripLAProfileBooker::treename_
private

Definition at line 83 of file SiStripLAProfileBooker.h.

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiStripLAProfileBooker::tTopoToken_
private

Definition at line 86 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::Type
private

Definition at line 60 of file SiStripLAProfileBooker.h.

Referenced by analyze(), and BeamSpotObj.BeamSpot::Reset().

int SiStripLAProfileBooker::Wheel
private

Definition at line 60 of file SiStripLAProfileBooker.h.

Referenced by analyze().

int SiStripLAProfileBooker::worse_double_hit
private

Definition at line 64 of file SiStripLAProfileBooker.h.

Referenced by analyze().

float SiStripLAProfileBooker::XGlobal
private

Definition at line 62 of file SiStripLAProfileBooker.h.

Referenced by analyze().

float SiStripLAProfileBooker::YGlobal
private

Definition at line 62 of file SiStripLAProfileBooker.h.

Referenced by analyze().

float SiStripLAProfileBooker::ZGlobal
private

Definition at line 62 of file SiStripLAProfileBooker.h.

Referenced by analyze().