CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HITSiStripRawToClustersRoI.cc
Go to the documentation of this file.
4 #include "CLHEP/Random/RandFlat.h"
5 
6 
7 using namespace std;
8 using namespace sistrip;
9 
11 
12  cabling_(),
13  allregions_(),
14  nlayers_(conf.getUntrackedParameter<int>("layers",-1)),
15  global_(conf.getUntrackedParameter<bool>("doGlobal",true)),
16  random_(conf.getUntrackedParameter<bool>("random",false)),
17  taujets_(conf.getUntrackedParameter<bool>("useTauJets",false)),
18  ptrack_(conf.getUntrackedParameter<bool>("usePixelTracks",true)),
19  taujetdeta_(conf.getUntrackedParameter<double>("tjetEtaWindow",0.2)),
20  taujetdphi_(conf.getUntrackedParameter<double>("tjetPhiWindow",0.2)),
21  ptrackEta_(conf.getUntrackedParameter<double>("ptrackEtaWindow",0.3)),
22  ptrackPhi_(conf.getUntrackedParameter<double>("ptrackPhiWindow",0.3))
23 
24 {
25  tok_siStrip_ = consumes<LazyGetter>(conf.getParameter<edm::InputTag>("siStripLazyGetter"));
26  tok_tauL1_ = consumes<l1extra::L1JetParticleCollection>(conf.getParameter<edm::InputTag>("l1tauJetLabel"));
27  tok_ptrack_ = consumes<trigger::TriggerFilterObjectWithRefs>(conf.getParameter<edm::InputTag>("pixelTrackLabel"));
28 
29  produces< RefGetter >();
30 }
31 
33 
35 
37 
39 
40  setup.get<SiStripRegionCablingRcd>().get(cabling_);
41  allregions_.reserve(cabling_->getRegionCabling().size());
42  for (uint32_t iregion=0;iregion<cabling_->getRegionCabling().size();iregion++) {
43  for (uint32_t isubdet=0;isubdet<cabling_->getRegionCabling()[iregion].size();isubdet++) {
44  for (uint32_t ilayer=0;ilayer<cabling_->getRegionCabling()[iregion][isubdet].size();ilayer++) {
45  uint32_t index = SiStripRegionCabling::elementIndex(iregion,static_cast<SubDet>(isubdet),ilayer);
46  allregions_.push_back(index);
47  }
48  }
49  }
50 
51 
52  edm::Handle< LazyGetter > lazygetter;
53  event.getByToken(tok_siStrip_,lazygetter);
54 
56 
57  if (global_) {
58  std::auto_ptr<RefGetter> globalrefgetter(new RefGetter(lazygetter,allregions_));
59  /*//unpack
60  for (RefGetter::const_iterator iReg = globalrefgetter->begin(); iReg != globalrefgetter->end(); iReg++) *iReg;*/
61  event.put(globalrefgetter);
62  return;
63  }
64 
65  std::auto_ptr<RefGetter> refgetter(new RefGetter(allregions_.size()));
66  refgetter->reserve(10000);
67 
69 
70  if (random_) {random(*refgetter,lazygetter);}
71 
73 
74  if (taujets_) {
76  event.getByToken(tok_tauL1_,collection);
77  taujets(*collection,*refgetter,lazygetter);
78  }
79 
80 
82  if (ptrack_) {
84  event.getByToken(tok_ptrack_,collection);
85  ptracks(*collection,*refgetter,lazygetter);
86  }
87 
88  event.put(refgetter);
89 }
90 
91 bool HITSiStripRawToClustersRoI::physicalLayer(SubDet& subdet, uint32_t& layer) const {
92  int signedlayer = static_cast<int>(SiStripRegionCabling::physicalLayer(subdet,layer));
93  return (nlayers_ == -1 || signedlayer < nlayers_) ? true : false;
94 }
95 
97 
98  uint32_t total = cabling_->getRegionCabling().size();
99  uint32_t required = static_cast<uint32_t>(CLHEP::RandFlat::shoot()*(total+1));
100  for (uint32_t iregion = 0; iregion < required; iregion++) {
101  for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
102  SubDet subdet = static_cast<SubDet>(isubdet);
103  for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
104  if (!physicalLayer(subdet,ilayer)) break;
105  cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,SiStripRegionCabling::elementIndex(iregion,subdet,ilayer));
106  }
107  }
108  }
109 }
110 
111 
113 
114  l1extra::L1JetParticleCollection::const_iterator icollection = collection.begin();
115  for (; icollection!=collection.end(); icollection++) {
116  Position position(icollection->eta(),icollection->phi());
117  for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
118  SubDet subdet = static_cast<SubDet>(isubdet);
119  for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
120  if (!physicalLayer(subdet,ilayer)) break;
121  cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,position,taujetdeta_,taujetdphi_,subdet,ilayer);
122  }
123  }
124  }
125 }
126 
127 
129 
130  std::vector< edm::Ref<reco::IsolatedPixelTrackCandidateCollection> > isoPixTrackRefs;
131  collection.getObjects(trigger::TriggerTrack, isoPixTrackRefs);
132  for (uint32_t p=0 ; p<isoPixTrackRefs.size(); p++) {
133  Position position(isoPixTrackRefs[p]->track()->eta(),isoPixTrackRefs[p]->track()->phi());
134  for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
135  SubDet subdet = static_cast<SubDet>(isubdet);
136  for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
137  if (!physicalLayer(subdet,ilayer)) break;
138  cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,position,ptrackEta_,ptrackPhi_,subdet,ilayer);
139  }
140  }
141 
142  }
143 }
static const ElementIndex elementIndex(const uint32_t region, const SubDet, const uint32_t layer)
T getParameter(std::string const &) const
void ptracks(const trigger::TriggerFilterObjectWithRefs &, RefGetter &, edm::Handle< LazyGetter > &) const
static const uint32_t physicalLayer(const SubDet, const uint32_t layer)
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
void taujets(const l1extra::L1JetParticleCollection &, RefGetter &, edm::Handle< LazyGetter > &) const
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_ptrack_
SiStripRegionCabling::Position Position
std::vector< L1JetParticle > L1JetParticleCollection
edm::EDGetTokenT< LazyGetter > tok_siStrip_
T eta() const
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_tauL1_
virtual void produce(edm::Event &, const edm::EventSetup &)
edm::ESHandle< SiStripRegionCabling > cabling_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
tuple conf
Definition: dbtoconf.py:185
void random(RefGetter &, edm::Handle< LazyGetter > &) const
const T & get() const
Definition: EventSetup.h:55
bool physicalLayer(SubDet &, uint32_t &) const
std::vector< uint32_t > allregions_
edm::RefGetter< SiStripCluster > RefGetter
HITSiStripRawToClustersRoI(const edm::ParameterSet &)
volatile std::atomic< bool > shutdown_flag false
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Definition: DDAxes.h:10