CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonCandProducerMon.cc
Go to the documentation of this file.
2 
4 
9 
11 
12  verbose_ = pset.getUntrackedParameter<int>("VerboseFlag", 0);
13 
15  (edm::InputTag) ("csctfdigis"));
17  (edm::InputTag) ("dttfdigis"));
18 
19  cscPtLUT_ = 0;
20  m_scalesCacheID = 0;
21  m_ptScaleCacheID = 0;
22 
23  produces<std::vector<L1MuRegionalCand> >("CSC");
24  produces<std::vector<L1MuRegionalCand> >("DT");
25 }
26 
28 }
29 
31  if (cscPtLUT_)
32  delete cscPtLUT_;
33 }
34 
36  const edm::EventSetup& iSetup) {
37 
39  iEvent.getByLabel(CSCinput_, CSCtracks);
40 
42  iEvent.getByLabel(DTinput_, DTtracks);
43 
44  std::auto_ptr<std::vector<L1MuRegionalCand> > csc_product(
45  new std::vector<L1MuRegionalCand>);
46 
47  std::auto_ptr<std::vector<L1MuRegionalCand> > dt_product(
48  new std::vector<L1MuRegionalCand>);
49 
50  if (!CSCtracks.isValid()) {
51 
52  csc_product->push_back(L1MuRegionalCand());
53 
54  } else {
55 
56  typedef L1CSCTrackCollection::const_iterator ctcIt;
57 
58  for (ctcIt tcit = CSCtracks->begin(); tcit != CSCtracks->end(); tcit++) {
59 
60  L1MuRegionalCand cand(tcit->first.getDataWord(), tcit->first.bx());
61 
62  // set pt value
63 
64  // Update CSCTFTrackBuilder only if the scales have changed. Use the
65  // EventSetup cacheIdentifier to tell when this has happened.
68  || iSetup.get<L1MuTriggerPtScaleRcd>().cacheIdentifier()
69  != m_ptScaleCacheID) {
70  if (cscPtLUT_)
71  delete cscPtLUT_;
73  iSetup.get<L1MuTriggerScalesRcd>().get(scales);
75  iSetup.get<L1MuTriggerPtScaleRcd>().get(ptScale);
76  // Create a dummy pset for CSC Pt LUTs
77 
78  edm::ParameterSet ptLUTset;
79  ptLUTset.addParameter<bool>("ReadPtLUT", false);
80  ptLUTset.addParameter<bool>("isBinary", false);
81  ptLUTset.addUntrackedParameter<std::string>("LUTPath", "./");
82 
83  cscPtLUT_ = new CSCTFPtLUT(ptLUTset, scales.product(),
84  ptScale.product());
86  = iSetup.get<L1MuTriggerScalesRcd>().cacheIdentifier();
88  = iSetup.get<L1MuTriggerPtScaleRcd>().cacheIdentifier();
89  }
90 
91  ptadd thePtAddress(tcit->first.ptLUTAddress());
92  ptdat thePtData = cscPtLUT_->Pt(thePtAddress);
93  const unsigned int rank =
94  (thePtAddress.track_fr ? thePtData.front_rank
95  : thePtData.rear_rank);
96  unsigned int quality = 0;
97  unsigned int pt = 0;
98  csc::L1Track::decodeRank(rank, pt, quality);
99  cand.setQualityPacked(quality & 0x3);
100  cand.setPtPacked(pt & 0x1f);
101  csc_product->push_back(cand);
102  }
103  }
104 
105  if (!DTtracks.isValid()) {
106 
107  dt_product->push_back(L1MuRegionalCand());
108 
109  } else {
110 
111  typedef std::vector<L1MuDTTrackCand>::const_iterator ctcIt;
112 
113  std::vector<L1MuDTTrackCand> *dttc = DTtracks->getContainer();
114 
115  for (ctcIt it = dttc->begin(); it != dttc->end(); it++) {
116  dt_product->push_back(L1MuRegionalCand(*it));
117  }
118  }
119 
120  iEvent.put(csc_product, "CSC");
121  iEvent.put(dt_product, "DT");
122 }
123 
unsigned long long cacheIdentifier() const
T getUntrackedParameter(std::string const &, T const &) const
ptdat Pt(const ptadd &) const
Definition: CSCTFPtLUT.cc:171
unsigned long long m_scalesCacheID
MuonCandProducerMon(const edm::ParameterSet &)
unsigned long long m_ptScaleCacheID
virtual void produce(edm::Event &, const edm::EventSetup &)
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:145
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
static void decodeRank(const unsigned &rank, unsigned &pt, unsigned &quality)
Definition: L1Track.cc:140
class pt_address ptadd
class pt_data ptdat
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:209
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62