CMS 3D CMS Logo

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 
69 
77 
79 };
80 
82  usePreTriggers_ = pset.getParameter<bool>("usePreTriggers"); // disable checking CLCT PreTriggers digis
83 
84  useGEMs_ = pset.getParameter<bool>("useGEMs");
85  useCSCShowers_ = pset.getParameter<bool>("useCSCShowers");
86  wd_token = consumes<CSCWireDigiCollection>(pset.getParameter<edm::InputTag>("wireDigiTag"));
87  sd_token = consumes<CSCStripDigiCollection>(pset.getParameter<edm::InputTag>("stripDigiTag"));
88  cd_token = consumes<CSCComparatorDigiCollection>(pset.getParameter<edm::InputTag>("comparatorDigiTag"));
89  if (usePreTriggers_) {
90  pr_token = consumes<CSCCLCTPreTriggerCollection>(pset.getParameter<edm::InputTag>("preTriggerTag"));
91  prdigi_token = consumes<CSCCLCTPreTriggerDigiCollection>(pset.getParameter<edm::InputTag>("preTriggerDigiTag"));
92  }
93  al_token = consumes<CSCALCTDigiCollection>(pset.getParameter<edm::InputTag>("alctDigiTag"));
94  cl_token = consumes<CSCCLCTDigiCollection>(pset.getParameter<edm::InputTag>("clctDigiTag"));
95  co_token = consumes<CSCCorrelatedLCTDigiCollection>(pset.getParameter<edm::InputTag>("correlatedLCTDigiTag"));
96  cham_token = esConsumes<CSCChamberMap, CSCChamberMapRcd>();
97  if (useGEMs_) {
98  gem_token = consumes<GEMPadDigiClusterCollection>(pset.getParameter<edm::InputTag>("padDigiClusterTag"));
99  }
100  if (useCSCShowers_) {
101  shower_token = consumes<CSCShowerDigiCollection>(pset.getParameter<edm::InputTag>("showerDigiTag"));
102  anode_shower_token = consumes<CSCShowerDigiCollection>(pset.getParameter<edm::InputTag>("anodeShowerDigiTag"));
103  cathode_shower_token = consumes<CSCShowerDigiCollection>(pset.getParameter<edm::InputTag>("cathodeShowerDigiTag"));
105  consumes<CSCShowerDigiCollection>(pset.getParameter<edm::InputTag>("anodeALCTShowerDigiTag"));
106  }
107  put_token_ = produces<FEDRawDataCollection>("CSCRawData");
108 }
109 
112 
113  desc.add<unsigned int>("formatVersion", 2005)
114  ->setComment(
115  "Set to 2005 for pre-LS1 CSC data format, 2013 - post-LS1 Run2 CSC data format, 2020 - Run3 CSC data "
116  "format");
117  desc.add<bool>("usePreTriggers", true)->setComment("Set to false if CSCCLCTPreTrigger digis are not available");
118  desc.add<bool>("packEverything", false)
119  ->setComment("Set to true to disable trigger-related constraints on readout data");
120  desc.add<bool>("packByCFEB", false)->setComment("Pack strip digis using CFEB info");
122  desc.add<bool>("useGEMs", false)->setComment("Pack Run3 GEM trigger data");
123  desc.add<bool>("useCSCShowers", false)->setComment("Pack Run3 CSC shower trigger data");
124 
125  desc.add<edm::InputTag>("wireDigiTag", edm::InputTag("simMuonCSCDigis", "MuonCSCWireDigi"));
126  desc.add<edm::InputTag>("stripDigiTag", edm::InputTag("simMuonCSCDigis", "MuonCSCStripDigi"));
127  desc.add<edm::InputTag>("comparatorDigiTag", edm::InputTag("simMuonCSCDigis", "MuonCSCComparatorDigi"));
128  desc.add<edm::InputTag>("alctDigiTag", edm::InputTag("simCscTriggerPrimitiveDigis"));
129  desc.add<edm::InputTag>("clctDigiTag", edm::InputTag("simCscTriggerPrimitiveDigis"));
130  desc.add<edm::InputTag>("preTriggerTag", edm::InputTag("simCscTriggerPrimitiveDigis"));
131  desc.add<edm::InputTag>("preTriggerDigiTag", edm::InputTag("simCscTriggerPrimitiveDigis"));
132  desc.add<edm::InputTag>("correlatedLCTDigiTag", edm::InputTag("simCscTriggerPrimitiveDigis", "MPCSORTED"));
133  desc.add<edm::InputTag>("padDigiClusterTag",
134  edm::InputTag("simMuonGEMPadDigiClusters"));
135  desc.add<edm::InputTag>("showerDigiTag",
136  edm::InputTag("simCscTriggerPrimitiveDigis"));
137  desc.add<edm::InputTag>("anodeShowerDigiTag",
138  edm::InputTag("simCscTriggerPrimitiveDigis"));
139  desc.add<edm::InputTag>("cathodeShowerDigiTag",
140  edm::InputTag("simCscTriggerPrimitiveDigis"));
141  desc.add<edm::InputTag>("anodeALCTShowerDigiTag",
142  edm::InputTag("simCscTriggerPrimitiveDigis"));
143 
144  desc.add<int32_t>("alctWindowMin", -3)->setComment("If min parameter = -999 always accept");
145  desc.add<int32_t>("alctWindowMax", 3);
146  desc.add<int32_t>("clctWindowMin", -3)->setComment("If min parameter = -999 always accept");
147  desc.add<int32_t>("clctWindowMax", 3);
148  desc.add<int32_t>("preTriggerWindowMin", -3)->setComment("If min parameter = -999 always accept");
149  desc.add<int32_t>("preTriggerWindowMax", 1);
150 
151  descriptions.add("cscPackerDef", desc);
152 }
153 
156  edm::ESHandle<CSCChamberMap> hcham = c.getHandle(cham_token);
157  const CSCChamberMap* theMapping = hcham.product();
158 
159  FEDRawDataCollection fed_buffers;
160 
161  // Take digis from the event
168 
169  // collections that are always packed
170  e.getByToken(wd_token, wireDigis);
171  e.getByToken(sd_token, stripDigis);
172  e.getByToken(cd_token, comparatorDigis);
173  e.getByToken(al_token, alctDigis);
174  e.getByToken(cl_token, clctDigis);
175  e.getByToken(co_token, correlatedLCTDigis);
176 
177  // packing with pre-triggers
178  CSCCLCTPreTriggerCollection const* preTriggersPtr = nullptr;
179  CSCCLCTPreTriggerDigiCollection const* preTriggerDigisPtr = nullptr;
180  if (usePreTriggers_) {
181  preTriggersPtr = &e.get(pr_token);
182  preTriggerDigisPtr = &e.get(prdigi_token);
183  }
184 
185  // collections that are packed optionally
186 
187  // packing of Run3 GEM GE11 hits
188  const GEMPadDigiClusterCollection* padDigiClustersPtr = nullptr;
189  if (useGEMs_) {
190  padDigiClustersPtr = &e.get(gem_token);
191  }
192 
193  // packing of Run3 CSC shower digis
194  const CSCShowerDigiCollection* cscShowerDigisPtr = nullptr;
195  const CSCShowerDigiCollection* cscAnodeShowerDigisPtr = nullptr;
196  const CSCShowerDigiCollection* cscCathodeShowerDigisPtr = nullptr;
197  const CSCShowerDigiCollection* cscALCTAnodeShowerDigisPtr = nullptr;
198  if (useCSCShowers_) {
199  cscShowerDigisPtr = &e.get(shower_token);
200  cscAnodeShowerDigisPtr = &e.get(anode_shower_token);
201  cscCathodeShowerDigisPtr = &e.get(cathode_shower_token);
202  cscALCTAnodeShowerDigisPtr = &e.get(alct_anode_shower_token);
203  }
204 
205  // Create the packed data
206  packer_->createFedBuffers(*stripDigis,
207  *wireDigis,
208  *comparatorDigis,
209  *alctDigis,
210  *clctDigis,
211  preTriggersPtr,
212  preTriggerDigisPtr,
213  *correlatedLCTDigis,
214  cscShowerDigisPtr,
215  cscAnodeShowerDigisPtr,
216  cscCathodeShowerDigisPtr,
217  cscALCTAnodeShowerDigisPtr,
218  padDigiClustersPtr,
219  fed_buffers,
220  theMapping,
221  e.id());
222 
223  // put the raw data to the event
224  e.emplace(put_token_, std::move(fed_buffers));
225 }
226 
edm::EDGetTokenT< CSCShowerDigiCollection > alct_anode_shower_token
edm::EDGetTokenT< CSCCLCTPreTriggerCollection > pr_token
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< CSCShowerDigiCollection > anode_shower_token
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)
T const * product() const
Definition: ESHandle.h:86
edm::EDGetTokenT< CSCCLCTDigiCollection > cl_token
edm::EDGetTokenT< GEMPadDigiClusterCollection > gem_token
Run3 GEM GE11 trigger objects collection.
edm::ESGetToken< CSCChamberMap, CSCChamberMapRcd > cham_token
edm::EDGetTokenT< CSCShowerDigiCollection > shower_token
Run3 CSC Shower objects collections.
edm::EDGetTokenT< CSCShowerDigiCollection > cathode_shower_token
edm::EDGetTokenT< CSCALCTDigiCollection > al_token
CSCDigiToRawModule(const edm::ParameterSet &pset)
Constructor.
std::unique_ptr< const CSCDigiToRaw > packer_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
edm::EDGetTokenT< CSCStripDigiCollection > sd_token
def move(src, dest)
Definition: eostools.py:511
A container for a generic type of digis indexed by some index, implemented with a map<IndexType...