CMS 3D CMS Logo

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

#include <SiPixelPhase1TrackClusters.h>

Inheritance diagram for SiPixelPhase1TrackClusters:
SiPixelPhase1Base DQMEDAnalyzer HistogramManagerHolder edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
 
 SiPixelPhase1TrackClusters (const edm::ParameterSet &conf)
 
- Public Member Functions inherited from SiPixelPhase1Base
void analyze (edm::Event const &e, edm::EventSetup const &eSetup)=0
 
void bookHistograms (DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &iSetup)
 
 SiPixelPhase1Base (const edm::ParameterSet &iConfig)
 
virtual ~SiPixelPhase1Base ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 & itemsToGetFromEvent () 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 
- Public Member Functions inherited from HistogramManagerHolder
 HistogramManagerHolder (const edm::ParameterSet &iConfig)
 

Private Types

enum  {
  ONTRACK_CHARGE, ONTRACK_SIZE, ONTRACK_NCLUSTERS, ONTRACK_POSITION_B,
  ONTRACK_POSITION_F, OFFTRACK_CHARGE, OFFTRACK_SIZE, OFFTRACK_NCLUSTERS,
  OFFTRACK_POSITION_B, OFFTRACK_POSITION_F, NTRACKS, NTRACKS_VOLUME
}
 

Private Attributes

edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > clustersToken_
 
edm::EDGetTokenT< reco::TrackCollectiontracksToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from SiPixelPhase1Base
bool checktrigger (const edm::Event &iEvent, const edm::EventSetup &iSetup, const unsigned trgidx) const
 
- 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)
 
- Protected Attributes inherited from HistogramManagerHolder
GeometryInterface geometryInterface
 
std::vector< HistogramManagerhisto
 

Detailed Description

Definition at line 15 of file SiPixelPhase1TrackClusters.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
ONTRACK_CHARGE 
ONTRACK_SIZE 
ONTRACK_NCLUSTERS 
ONTRACK_POSITION_B 
ONTRACK_POSITION_F 
OFFTRACK_CHARGE 
OFFTRACK_SIZE 
OFFTRACK_NCLUSTERS 
OFFTRACK_POSITION_B 
OFFTRACK_POSITION_F 
NTRACKS 
NTRACKS_VOLUME 

Definition at line 16 of file SiPixelPhase1TrackClusters.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file SiPixelPhase1TrackClusters.cc.

References clustersToken_, edm::ParameterSet::getParameter(), and tracksToken_.

26  :
27  SiPixelPhase1Base(iConfig)
28 {
29  clustersToken_ = consumes<edmNew::DetSetVector<SiPixelCluster>>(iConfig.getParameter<edm::InputTag>("clusters"));
30  tracksToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracks"));
31 }
edm::EDGetTokenT< reco::TrackCollection > tracksToken_
SiPixelPhase1Base(const edm::ParameterSet &iConfig)
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > clustersToken_

Member Function Documentation

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

Definition at line 33 of file SiPixelPhase1TrackClusters.cc.

References funct::abs(), edmNew::DetSetVector< T >::begin(), SiPixelCluster::charge(), SiPixelRecHit::cluster(), clustersToken_, allConversions_cfi::d0, DEFINE_FWK_MODULE, allConversions_cfi::dz, edmNew::DetSetVector< T >::end(), objects.autophobj::float, edm::EventSetup::get(), edm::Event::getByToken(), h, hcalSimParameters_cfi::hb, HistogramManagerHolder::histo, hcalTTPDigis_cfi::id, TrackerGeometry::idToDet(), iEvent, edm::ESHandleBase::isValid(), edm::HandleBase::isValid(), crabWrapper::key, Topology::localPosition(), PV3DBase< T, PVType, FrameType >::mag(), edmNew::makeRefTo(), NTRACKS, NTRACKS_VOLUME, OFFTRACK_CHARGE, OFFTRACK_NCLUSTERS, OFFTRACK_POSITION_B, OFFTRACK_POSITION_F, OFFTRACK_SIZE, ONTRACK_CHARGE, ONTRACK_NCLUSTERS, ONTRACK_POSITION_B, ONTRACK_POSITION_F, ONTRACK_SIZE, PV3DBase< T, PVType, FrameType >::phi(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, funct::pow(), SiPixelCluster::size(), mathSSE::sqrt(), funct::tan(), HiIsolationCommonParameters_cff::track, mixOne_simraw_on_sim_cfi::tracker, l1t::tracks, tracksToken_, PV3DBase< T, PVType, FrameType >::x(), SiPixelCluster::x(), PV3DBase< T, PVType, FrameType >::y(), SiPixelCluster::y(), and PV3DBase< T, PVType, FrameType >::z().

33  {
34 
35  // get geometry
37  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
38  assert(tracker.isValid());
39 
40  //get the map
42  iEvent.getByToken( tracksToken_, tracks);
43  if ( !tracks.isValid() ) {
44  edm::LogWarning("SiPixelPhase1TrackClusters") << "track collection is not valid";
45  return;
46  }
47 
48  // get clusters
50  iEvent.getByToken( clustersToken_, clusterColl );
51  if ( !clusterColl.isValid() ) {
52  edm::LogWarning("SiPixelPhase1TrackClusters") << "pixel cluster collection is not valid";
53  return;
54  }
55 
56  // we need to store some per-cluster data. Instead of a map, we use a vector,
57  // exploiting the fact that all custers live in the DetSetVector and we can
58  // use the same indices to refer to them.
59  // corr_charge is not strictly needed but cleaner to have it.
60  std::vector<bool> ontrack (clusterColl->data().size(), false);
61  std::vector<float> corr_charge(clusterColl->data().size(), -1.0f);
62 
63  for (auto const & track : *tracks) {
64 
65  bool isBpixtrack = false, isFpixtrack = false, crossesPixVol=false;
66 
67  // find out whether track crosses pixel fiducial volume (for cosmic tracks)
68  double d0 = track.d0(), dz = track.dz();
69  if(std::abs(d0)<15 && std::abs(dz)<50) crossesPixVol = true;
70 
71  auto const & trajParams = track.extra()->trajParams();
72  assert(trajParams.size()==track.recHitsSize());
73  auto hb = track.recHitsBegin();
74  for(unsigned int h=0;h<track.recHitsSize();h++){
75  auto hit = *(hb+h);
76  if (!hit->isValid()) continue;
77  DetId id = hit->geographicalId();
78 
79  // check that we are in the pixel
80  uint32_t subdetid = (id.subdetId());
81  if (subdetid == PixelSubdetector::PixelBarrel) isBpixtrack = true;
82  if (subdetid == PixelSubdetector::PixelEndcap) isFpixtrack = true;
83  if (subdetid != PixelSubdetector::PixelBarrel && subdetid != PixelSubdetector::PixelEndcap) continue;
84  auto pixhit = dynamic_cast<const SiPixelRecHit*>(hit->hit());
85  if (!pixhit) continue;
86 
87  // get the cluster
88  auto clust = pixhit->cluster();
89  if (clust.isNull()) continue;
90  ontrack[clust.key()] = true; // mark cluster as ontrack
91 
92 
93  // correct charge for track impact angle
94  auto const & ltp = trajParams[h];
95  LocalVector localDir = ltp.momentum()/ltp.momentum().mag();
96 
97  float clust_alpha = atan2(localDir.z(), localDir.x());
98  float clust_beta = atan2(localDir.z(), localDir.y());
99  double corrCharge = clust->charge() * sqrt( 1.0 / ( 1.0/pow( tan(clust_alpha), 2 ) +
100  1.0/pow( tan(clust_beta ), 2 ) +
101  1.0 ));
102  corr_charge[clust.key()] = (float) corrCharge;
103  }
104 
105  // statistics on tracks
106  histo[NTRACKS].fill(1, DetId(0), &iEvent);
107  if (isBpixtrack || isFpixtrack)
108  histo[NTRACKS].fill(2, DetId(0), &iEvent);
109  if (isBpixtrack)
110  histo[NTRACKS].fill(3, DetId(0), &iEvent);
111  if (isFpixtrack)
112  histo[NTRACKS].fill(4, DetId(0), &iEvent);
113 
114  if (crossesPixVol) {
115  if (isBpixtrack || isFpixtrack)
116  histo[NTRACKS_VOLUME].fill(1, DetId(0), &iEvent);
117  else
118  histo[NTRACKS_VOLUME].fill(0, DetId(0), &iEvent);
119  }
120  }
121 
123  for (it = clusterColl->begin(); it != clusterColl->end(); ++it) {
124  auto id = DetId(it->detId());
125 
126  const PixelGeomDetUnit* geomdetunit = dynamic_cast<const PixelGeomDetUnit*> ( tracker->idToDet(id) );
127  const PixelTopology& topol = geomdetunit->specificTopology();
128 
129  for(auto subit = it->begin(); subit != it->end(); ++subit) {
130  // we could do subit-...->data().front() as well, but this seems cleaner.
131  auto key = edmNew::makeRefTo(clusterColl, subit).key();
132  bool is_ontrack = ontrack[key];
133  float corrected_charge = corr_charge[key];
134  SiPixelCluster const& cluster = *subit;
135 
136  LocalPoint clustlp = topol.localPosition(MeasurementPoint(cluster.x(), cluster.y()));
137  GlobalPoint clustgp = geomdetunit->surface().toGlobal(clustlp);
138 
139  if (is_ontrack) {
140  histo[ONTRACK_NCLUSTERS ].fill(id, &iEvent);
141  histo[ONTRACK_CHARGE ].fill(double(corrected_charge), id, &iEvent);
142  histo[ONTRACK_SIZE ].fill(double(cluster.size() ), id, &iEvent);
143  histo[ONTRACK_POSITION_B].fill(clustgp.z(), clustgp.phi(), id, &iEvent);
144  histo[ONTRACK_POSITION_F].fill(clustgp.x(), clustgp.y(), id, &iEvent);
145  } else {
146  histo[OFFTRACK_NCLUSTERS ].fill(id, &iEvent);
147  histo[OFFTRACK_CHARGE ].fill(double(cluster.charge()), id, &iEvent);
148  histo[OFFTRACK_SIZE ].fill(double(cluster.size() ), id, &iEvent);
149  histo[OFFTRACK_POSITION_B].fill(clustgp.z(), clustgp.phi(), id, &iEvent);
150  histo[OFFTRACK_POSITION_F].fill(clustgp.x(), clustgp.y(), id, &iEvent);
151  }
152  }
153  }
154 
155  histo[ONTRACK_NCLUSTERS].executePerEventHarvesting(&iEvent);
156  histo[OFFTRACK_NCLUSTERS].executePerEventHarvesting(&iEvent);
157 }
edm::Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, typename HandleT::element_type::value_type::const_iterator itIter)
float charge() const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
edm::EDGetTokenT< reco::TrackCollection > tracksToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
int iEvent
Definition: GenABIO.cc:230
T mag() const
Definition: PV3DBase.h:67
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isValid() const
Definition: HandleBase.h:74
Definition: DetId.h:18
ClusterRef cluster() const
Definition: SiPixelRecHit.h:49
const T & get() const
Definition: EventSetup.h:56
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
std::vector< HistogramManager > histo
Pixel cluster – collection of neighboring pixels above threshold.
float y() const
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > clustersToken_
bool isValid() const
Definition: ESHandle.h:47
T x() const
Definition: PV3DBase.h:62
float x() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
const_iterator begin(bool update=false) const
const TrackerGeomDet * idToDet(DetId) const
Our base class.
Definition: SiPixelRecHit.h:23
int size() const

Member Data Documentation

edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > SiPixelPhase1TrackClusters::clustersToken_
private

Definition at line 38 of file SiPixelPhase1TrackClusters.h.

Referenced by analyze(), and SiPixelPhase1TrackClusters().

edm::EDGetTokenT<reco::TrackCollection> SiPixelPhase1TrackClusters::tracksToken_
private

Definition at line 39 of file SiPixelPhase1TrackClusters.h.

Referenced by analyze(), and SiPixelPhase1TrackClusters().