CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCDigiToRawModule.cc
Go to the documentation of this file.
1 
16 
22 
24 
35 
36 namespace edm {
38 }
39 
40 class CSCDigiToRaw;
41 
43 public:
46 
47  // Operations
48  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
49 
50  // Fill parameters descriptions
51  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
52 
53 private:
54  bool usePreTriggers_; // Select if to use Pre-Triggers CLCT digis
55  bool useGEMs_;
57 
58  std::unique_ptr<const CSCDigiToRaw> packer_;
59 
71 
73 };
74 
75 CSCDigiToRawModule::CSCDigiToRawModule(const edm::ParameterSet& pset) : packer_(std::make_unique<CSCDigiToRaw>(pset)) {
76  usePreTriggers_ = pset.getParameter<bool>("usePreTriggers"); // disable checking CLCT PreTriggers digis
77 
78  useGEMs_ = pset.getParameter<bool>("useGEMs");
79  useCSCShowers_ = pset.getParameter<bool>("useCSCShowers");
80  wd_token = consumes<CSCWireDigiCollection>(pset.getParameter<edm::InputTag>("wireDigiTag"));
81  sd_token = consumes<CSCStripDigiCollection>(pset.getParameter<edm::InputTag>("stripDigiTag"));
82  cd_token = consumes<CSCComparatorDigiCollection>(pset.getParameter<edm::InputTag>("comparatorDigiTag"));
83  if (usePreTriggers_) {
84  pr_token = consumes<CSCCLCTPreTriggerCollection>(pset.getParameter<edm::InputTag>("preTriggerTag"));
85  prdigi_token = consumes<CSCCLCTPreTriggerDigiCollection>(pset.getParameter<edm::InputTag>("preTriggerDigiTag"));
86  }
87  al_token = consumes<CSCALCTDigiCollection>(pset.getParameter<edm::InputTag>("alctDigiTag"));
88  cl_token = consumes<CSCCLCTDigiCollection>(pset.getParameter<edm::InputTag>("clctDigiTag"));
89  co_token = consumes<CSCCorrelatedLCTDigiCollection>(pset.getParameter<edm::InputTag>("correlatedLCTDigiTag"));
90  cham_token = esConsumes<CSCChamberMap, CSCChamberMapRcd>();
91  if (useGEMs_) {
92  gem_token = consumes<GEMPadDigiClusterCollection>(pset.getParameter<edm::InputTag>("padDigiClusterTag"));
93  }
94  if (useCSCShowers_) {
95  shower_token = consumes<CSCShowerDigiCollection>(pset.getParameter<edm::InputTag>("showerDigiTag"));
96  }
97  put_token_ = produces<FEDRawDataCollection>("CSCRawData");
98 }
99 
102 
103  desc.add<unsigned int>("formatVersion", 2005)
104  ->setComment("Set to 2005 for pre-LS1 CSC data format, 2013 - new post-LS1 CSC data format");
105  desc.add<bool>("usePreTriggers", true)->setComment("Set to false if CSCCLCTPreTrigger digis are not available");
106  desc.add<bool>("packEverything", false)
107  ->setComment("Set to true to disable trigger-related constraints on readout data");
108  desc.add<bool>("packByCFEB", false)->setComment("Pack strip digis using CFEB info");
109  desc.add<bool>("useGEMs", false)->setComment("Pack GEM trigger data");
110  desc.add<bool>("useCSCShowers", false)->setComment("Pack CSC shower trigger data");
111 
112  desc.add<edm::InputTag>("wireDigiTag", edm::InputTag("simMuonCSCDigis", "MuonCSCWireDigi"));
113  desc.add<edm::InputTag>("stripDigiTag", edm::InputTag("simMuonCSCDigis", "MuonCSCStripDigi"));
114  desc.add<edm::InputTag>("comparatorDigiTag", edm::InputTag("simMuonCSCDigis", "MuonCSCComparatorDigi"));
115  desc.add<edm::InputTag>("alctDigiTag", edm::InputTag("simCscTriggerPrimitiveDigis"));
116  desc.add<edm::InputTag>("clctDigiTag", edm::InputTag("simCscTriggerPrimitiveDigis"));
117  desc.add<edm::InputTag>("preTriggerTag", edm::InputTag("simCscTriggerPrimitiveDigis"));
118  desc.add<edm::InputTag>("preTriggerDigiTag", edm::InputTag("simCscTriggerPrimitiveDigis"));
119  desc.add<edm::InputTag>("correlatedLCTDigiTag", edm::InputTag("simCscTriggerPrimitiveDigis", "MPCSORTED"));
120  desc.add<edm::InputTag>("padDigiClusterTag", edm::InputTag("simMuonGEMPadDigiClusters"));
121  desc.add<edm::InputTag>("showerDigiTag", edm::InputTag("simCscTriggerPrimitiveDigis"));
122 
123  desc.add<int32_t>("alctWindowMin", -3)->setComment("If min parameter = -999 always accept");
124  desc.add<int32_t>("alctWindowMax", 3);
125  desc.add<int32_t>("clctWindowMin", -3)->setComment("If min parameter = -999 always accept");
126  desc.add<int32_t>("clctWindowMax", 3);
127  desc.add<int32_t>("preTriggerWindowMin", -3)->setComment("If min parameter = -999 always accept");
128  desc.add<int32_t>("preTriggerWindowMax", 1);
129 
130  descriptions.add("cscPackerDef", desc);
131 }
132 
136  const CSCChamberMap* theMapping = hcham.product();
137 
138  FEDRawDataCollection fed_buffers;
139 
140  // Take digis from the event
147 
148  // collections that are always packed
149  e.getByToken(wd_token, wireDigis);
150  e.getByToken(sd_token, stripDigis);
151  e.getByToken(cd_token, comparatorDigis);
152  e.getByToken(al_token, alctDigis);
153  e.getByToken(cl_token, clctDigis);
154  e.getByToken(co_token, correlatedLCTDigis);
155 
156  // packing with pre-triggers
157  CSCCLCTPreTriggerCollection const* preTriggersPtr = nullptr;
158  CSCCLCTPreTriggerDigiCollection const* preTriggerDigisPtr = nullptr;
159  if (usePreTriggers_) {
160  preTriggersPtr = &e.get(pr_token);
161  preTriggerDigisPtr = &e.get(prdigi_token);
162  }
163 
164  // collections that are packed optionally
165 
166  // packing of GEM hits
167  const GEMPadDigiClusterCollection* padDigiClustersPtr = nullptr;
168  if (useGEMs_) {
169  padDigiClustersPtr = &e.get(gem_token);
170  }
171 
172  // packing of CSC shower digis
173  const CSCShowerDigiCollection* cscShowerDigisPtr = nullptr;
174  if (useCSCShowers_) {
175  cscShowerDigisPtr = &e.get(shower_token);
176  }
177 
178  // Create the packed data
179  packer_->createFedBuffers(*stripDigis,
180  *wireDigis,
181  *comparatorDigis,
182  *alctDigis,
183  *clctDigis,
184  preTriggersPtr,
185  preTriggerDigisPtr,
186  *correlatedLCTDigis,
187  cscShowerDigisPtr,
188  padDigiClustersPtr,
189  fed_buffers,
190  theMapping,
191  e.id());
192 
193  // put the raw data to the event
194  e.emplace(put_token_, std::move(fed_buffers));
195 }
196 
edm::EDGetTokenT< CSCCLCTPreTriggerCollection > pr_token
const edm::EventSetup & c
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< CSCCLCTPreTriggerDigiCollection > prdigi_token
edm::EDPutTokenT< FEDRawDataCollection > put_token_
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > co_token
edm::EDGetTokenT< CSCComparatorDigiCollection > cd_token
edm::EDGetTokenT< CSCWireDigiCollection > wd_token
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< CSCCLCTDigiCollection > cl_token
def move
Definition: eostools.py:511
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< GEMPadDigiClusterCollection > gem_token
edm::ESGetToken< CSCChamberMap, CSCChamberMapRcd > cham_token
edm::EDGetTokenT< CSCShowerDigiCollection > shower_token
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:433
edm::EDGetTokenT< CSCALCTDigiCollection > al_token
CSCDigiToRawModule(const edm::ParameterSet &pset)
Constructor.
T const * product() const
Definition: ESHandle.h:86
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::unique_ptr< const CSCDigiToRaw > packer_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EventID id() const
Definition: EventBase.h:59
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
edm::EDGetTokenT< CSCStripDigiCollection > sd_token
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
A container for a generic type of digis indexed by some index, implemented with a map&lt;IndexType...