CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCTriggerPrimitivesProducer.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: CSCTriggerPrimitivesProducer
4 //
5 // Description: Steering routine of the local Level-1 Cathode Strip Chamber
6 // trigger.
7 //
8 // Author List: S. Valuev, UCLA.
9 //
10 // $Id: CSCTriggerPrimitivesProducer.cc,v 1.16 2012/12/05 21:16:16 khotilov Exp $
11 //
12 // Modifications:
13 //
14 //--------------------------------------------------
15 
18 
22 
26 
32 
33 // Configuration via EventSetup
36 
37 
39 
40  // if false, parameters will be read in from DB using EventSetup mechanism
41  // else will use all parameters from the config file
42  debugParameters_ = conf.getUntrackedParameter<bool>("debugParameters",false);
43 
44  wireDigiProducer_ = conf.getParameter<edm::InputTag>("CSCWireDigiProducer");
45  compDigiProducer_ = conf.getParameter<edm::InputTag>("CSCComparatorDigiProducer");
46  checkBadChambers_ = conf.getUntrackedParameter<bool>("checkBadChambers", true);
47 
48  lctBuilder_ = new CSCTriggerPrimitivesBuilder(conf); // pass on the conf
49 
50  // register what this produces
51  produces<CSCALCTDigiCollection>();
52  produces<CSCCLCTDigiCollection>();
53  produces<CSCCLCTPreTriggerCollection>();
54  produces<CSCCorrelatedLCTDigiCollection>();
55  produces<CSCCorrelatedLCTDigiCollection>("MPCSORTED");
56 }
57 
59  LogDebug("L1CSCTrigger")
60  << "deleting trigger primitives after " << iev << " events.";
61  delete lctBuilder_;
62 }
63 
64 //void CSCTriggerPrimitivesProducer::beginRun(const edm::EventSetup& setup) {
65 //}
66 
68  const edm::EventSetup& setup) {
69 
70  LogDebug("L1CSCTrigger") << "start producing LCTs for event " << ++iev;
71 
72  // Find the geometry (& conditions?) for this event & cache it in
73  // CSCTriggerGeometry.
74  {
76  setup.get<MuonGeometryRecord>().get(h);
78  }
79 
80  // Find conditions data for bad chambers.
81  edm::ESHandle<CSCBadChambers> pBadChambers;
82  setup.get<CSCBadChambersRcd>().get(pBadChambers);
83 
84  // If !debugParameters then get config parameters using EventSetup mechanism.
85  // This must be done in produce() for every event and not in beginJob()
86  // (see mail from Jim Brooke sent to hn-cms-L1TrigEmulator on July 30, 2007).
87  if (!debugParameters_) {
89  setup.get<CSCDBL1TPParametersRcd>().get(conf);
90  if (conf.product() == 0) {
91  edm::LogError("L1CSCTPEmulatorConfigError")
92  << "+++ Failed to find a CSCDBL1TPParametersRcd in EventSetup! +++\n"
93  << "+++ Cannot continue emulation without these parameters +++\n";
94  return;
95  }
97  }
98 
99  // Get the collections of comparator & wire digis from event.
104 
105  // Create empty collections of ALCTs, CLCTs, and correlated LCTs upstream
106  // and downstream of MPC.
107  std::auto_ptr<CSCALCTDigiCollection> oc_alct(new CSCALCTDigiCollection);
108  std::auto_ptr<CSCCLCTDigiCollection> oc_clct(new CSCCLCTDigiCollection);
109  std::auto_ptr<CSCCLCTPreTriggerCollection> oc_pretrig(new CSCCLCTPreTriggerCollection);
110  std::auto_ptr<CSCCorrelatedLCTDigiCollection> oc_lct(new CSCCorrelatedLCTDigiCollection);
111  std::auto_ptr<CSCCorrelatedLCTDigiCollection> oc_sorted_lct(new CSCCorrelatedLCTDigiCollection);
112 
113  if (!wireDigis.isValid()) {
114  edm::LogWarning("L1CSCTPEmulatorNoInputCollection")
115  << "+++ Warning: Collection of wire digis with label "
117  << " requested in configuration, but not found in the event..."
118  << " Skipping production of CSC TP digis +++\n";
119  }
120  if (!compDigis.isValid()) {
121  edm::LogWarning("L1CSCTPEmulatorNoInputCollection")
122  << "+++ Warning: Collection of comparator digis with label "
124  << " requested in configuration, but not found in the event..."
125  << " Skipping production of CSC TP digis +++\n";
126  }
127  // Fill output collections if valid input collections are available.
128  if (wireDigis.isValid() && compDigis.isValid()) {
129  const CSCBadChambers* temp = checkBadChambers_ ? pBadChambers.product() : new CSCBadChambers;
130  lctBuilder_->build(temp,
131  wireDigis.product(), compDigis.product(),
132  *oc_alct, *oc_clct, *oc_pretrig, *oc_lct, *oc_sorted_lct);
133  if (!checkBadChambers_)
134  delete temp;
135  }
136 
137  // Put collections in event.
138  ev.put(oc_alct);
139  ev.put(oc_clct);
140  ev.put(oc_pretrig);
141  ev.put(oc_lct);
142  ev.put(oc_sorted_lct,"MPCSORTED");
143 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual void produce(edm::Event &, const edm::EventSetup &)
void build(const CSCBadChambers *badChambers, const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, CSCALCTDigiCollection &oc_alct, CSCCLCTDigiCollection &oc_clct, CSCCLCTPreTriggerCollection &oc_pretrig, CSCCorrelatedLCTDigiCollection &oc_lct, CSCCorrelatedLCTDigiCollection &oc_sorted_lct)
CSCTriggerPrimitivesProducer(const edm::ParameterSet &)
static void setGeometry(const edm::ESHandle< CSCGeometry > &thegeom)
void setConfigParameters(const CSCDBL1TPParameters *conf)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
tuple conf
Definition: dbtoconf.py:185
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
CSCTriggerPrimitivesBuilder * lctBuilder_
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:74
std::string const & label() const
Definition: InputTag.h:42
std::string const & instance() const
Definition: InputTag.h:43
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")