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 //
11 // Modifications:
12 //
13 //--------------------------------------------------
14 
17 
21 
25 
31 
32 // Configuration via EventSetup
35 
36 
38 
39  // if false, parameters will be read in from DB using EventSetup mechanism
40  // else will use all parameters from the config file
41  debugParameters_ = conf.getUntrackedParameter<bool>("debugParameters",false);
42 
43  wireDigiProducer_ = conf.getParameter<edm::InputTag>("CSCWireDigiProducer");
44  compDigiProducer_ = conf.getParameter<edm::InputTag>("CSCComparatorDigiProducer");
45  checkBadChambers_ = conf.getUntrackedParameter<bool>("checkBadChambers", true);
46 
47  lctBuilder_ = new CSCTriggerPrimitivesBuilder(conf); // pass on the conf
48 
49  // register what this produces
50  produces<CSCALCTDigiCollection>();
51  produces<CSCCLCTDigiCollection>();
52  produces<CSCCLCTPreTriggerCollection>();
53  produces<CSCCorrelatedLCTDigiCollection>();
54  produces<CSCCorrelatedLCTDigiCollection>("MPCSORTED");
55 }
56 
58  LogDebug("L1CSCTrigger")
59  << "deleting trigger primitives after " << iev << " events.";
60  delete lctBuilder_;
61 }
62 
63 //void CSCTriggerPrimitivesProducer::beginRun(const edm::EventSetup& setup) {
64 //}
65 
67  const edm::EventSetup& setup) {
68 
69  LogDebug("L1CSCTrigger") << "start producing LCTs for event " << ++iev;
70 
71  // Find the geometry (& conditions?) for this event & cache it in
72  // CSCTriggerGeometry.
73  {
75  setup.get<MuonGeometryRecord>().get(h);
77  }
78 
79  // Find conditions data for bad chambers.
80  edm::ESHandle<CSCBadChambers> pBadChambers;
81  setup.get<CSCBadChambersRcd>().get(pBadChambers);
82 
83  // If !debugParameters then get config parameters using EventSetup mechanism.
84  // This must be done in produce() for every event and not in beginJob()
85  // (see mail from Jim Brooke sent to hn-cms-L1TrigEmulator on July 30, 2007).
86  if (!debugParameters_) {
88  setup.get<CSCDBL1TPParametersRcd>().get(conf);
89  if (conf.product() == 0) {
90  edm::LogError("L1CSCTPEmulatorConfigError")
91  << "+++ Failed to find a CSCDBL1TPParametersRcd in EventSetup! +++\n"
92  << "+++ Cannot continue emulation without these parameters +++\n";
93  return;
94  }
96  }
97 
98  // Get the collections of comparator & wire digis from event.
103 
104  // Create empty collections of ALCTs, CLCTs, and correlated LCTs upstream
105  // and downstream of MPC.
106  std::auto_ptr<CSCALCTDigiCollection> oc_alct(new CSCALCTDigiCollection);
107  std::auto_ptr<CSCCLCTDigiCollection> oc_clct(new CSCCLCTDigiCollection);
108  std::auto_ptr<CSCCLCTPreTriggerCollection> oc_pretrig(new CSCCLCTPreTriggerCollection);
109  std::auto_ptr<CSCCorrelatedLCTDigiCollection> oc_lct(new CSCCorrelatedLCTDigiCollection);
110  std::auto_ptr<CSCCorrelatedLCTDigiCollection> oc_sorted_lct(new CSCCorrelatedLCTDigiCollection);
111 
112  if (!wireDigis.isValid()) {
113  edm::LogWarning("L1CSCTPEmulatorNoInputCollection")
114  << "+++ Warning: Collection of wire digis with label "
116  << " requested in configuration, but not found in the event..."
117  << " Skipping production of CSC TP digis +++\n";
118  }
119  if (!compDigis.isValid()) {
120  edm::LogWarning("L1CSCTPEmulatorNoInputCollection")
121  << "+++ Warning: Collection of comparator digis with label "
123  << " requested in configuration, but not found in the event..."
124  << " Skipping production of CSC TP digis +++\n";
125  }
126  // Fill output collections if valid input collections are available.
127  if (wireDigis.isValid() && compDigis.isValid()) {
128  const CSCBadChambers* temp = checkBadChambers_ ? pBadChambers.product() : new CSCBadChambers;
129  lctBuilder_->build(temp,
130  wireDigis.product(), compDigis.product(),
131  *oc_alct, *oc_clct, *oc_pretrig, *oc_lct, *oc_sorted_lct);
132  if (!checkBadChambers_)
133  delete temp;
134  }
135 
136  // Put collections in event.
137  ev.put(oc_alct);
138  ev.put(oc_clct);
139  ev.put(oc_pretrig);
140  ev.put(oc_lct);
141  ev.put(oc_sorted_lct,"MPCSORTED");
142 }
#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:116
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
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:81
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="")