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  uint32_t signedlayer = 0;
93  if (subdet == SiStripRegionCabling::TIB || subdet == SiStripRegionCabling::TID) signedlayer = layer;
94  else if (subdet == SiStripRegionCabling::TOB) signedlayer = SiStripRegionCabling::TIBLAYERS + layer;
95  else if (subdet == SiStripRegionCabling::TEC) signedlayer = SiStripRegionCabling::TIDLAYERS + layer;
96  else signedlayer = SiStripRegionCabling::ALLLAYERS;
97 
98  return (nlayers_ == -1 || int(signedlayer) < nlayers_) ? true : false;
99 }
100 
102 
103  uint32_t total = cabling_->getRegionCabling().size();
104  uint32_t required = static_cast<uint32_t>(CLHEP::RandFlat::shoot()*(total+1));
105  for (uint32_t iregion = 0; iregion < required; iregion++) {
106  for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
107  SubDet subdet = static_cast<SubDet>(isubdet);
108  for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
109  if (!physicalLayer(subdet,ilayer)) break;
110  cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,SiStripRegionCabling::elementIndex(iregion,subdet,ilayer));
111  }
112  }
113  }
114 }
115 
116 
118 
119  l1extra::L1JetParticleCollection::const_iterator icollection = collection.begin();
120  for (; icollection!=collection.end(); icollection++) {
121  Position position(icollection->eta(),icollection->phi());
122  for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
123  SubDet subdet = static_cast<SubDet>(isubdet);
124  for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
125  if (!physicalLayer(subdet,ilayer)) break;
126  cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,position,taujetdeta_,taujetdphi_,subdet,ilayer);
127  }
128  }
129  }
130 }
131 
132 
134 
135  std::vector< edm::Ref<reco::IsolatedPixelTrackCandidateCollection> > isoPixTrackRefs;
136  collection.getObjects(trigger::TriggerTrack, isoPixTrackRefs);
137  for (uint32_t p=0 ; p<isoPixTrackRefs.size(); p++) {
138  Position position(isoPixTrackRefs[p]->track()->eta(),isoPixTrackRefs[p]->track()->phi());
139  for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
140  SubDet subdet = static_cast<SubDet>(isubdet);
141  for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
142  if (!physicalLayer(subdet,ilayer)) break;
143  cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,position,ptrackEta_,ptrackPhi_,subdet,ilayer);
144  }
145  }
146 
147  }
148 }
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
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_
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
static int position[264][3]
Definition: ReadPGInfo.cc:509
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="")