CMS 3D CMS Logo

CTPPSPixelRawToDigi.cc
Go to the documentation of this file.
1 /*
2  * adapting to CTPPS pixel detector March 2017 - F.Ferro
3  */
4 
5 
7 
11 
13 
19 
21 
23 
24 using namespace std;
25 
26 
28  : config_(conf)
29 
30 {
31 
32  FEDRawDataCollection_ = consumes <FEDRawDataCollection> (config_.getParameter<edm::InputTag>("InputLabel"));
33 
34 // Products
35  produces< edm::DetSetVector<CTPPSPixelDigi> >();
36 
37 //CablingMap could have a label //Tav
38  mappingLabel_ = config_.getParameter<std::string> ("mappingLabel"); //RPix
39 
40 }
41 
42 
44  edm::LogInfo("CTPPSPixelRawToDigi") << " CTPPSPixelRawToDigi destructor!";
45 
46 }
47 
49  const edm::EventSetup& es)
50 {
51 
52 
54  ev.getByToken(FEDRawDataCollection_, buffers);
55 
57 
58  bool data_exist=false;
60  const FEDRawData& tempRawData = buffers->FEDData( fed );
61  if(tempRawData.size()!=0){
62  data_exist=true;
63  break;
64  }
65  }
67  auto collection = std::make_unique<edm::DetSetVector<CTPPSPixelDigi>>();
68 
69 
70  if(data_exist){
71  es.get<CTPPSPixelDAQMappingRcd>().get( mapping);
72 
73 
74  fedIds_ = mapping->fedIds();
75 
76  CTPPSPixelDataFormatter formatter(mapping->ROCMapping);
77 
78  bool errorsInEvent = false;
79  for (auto aFed = fedIds_.begin(); aFed != fedIds_.end(); ++aFed) {
80  int fedId = *aFed;
81 
82  edm::LogInfo("CTPPSPixelRawToDigi")<< " PRODUCE DIGI FOR FED: " << dec <<fedId << endl;
83 
85  const FEDRawData& fedRawData = buffers->FEDData( fedId );
86 
87  formatter.interpretRawData( errorsInEvent, fedId, fedRawData, *collection);
88  }
89  }
92 
93 }
94 
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
std::set< unsigned int > fedIds() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::ParameterSet config_
CTPPSPixelRawToDigi(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
bool ev
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
std::set< unsigned int > fedIds_
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void interpretRawData(bool &errorsInEvent, int fedId, const FEDRawData &data, Collection &digis)
std::map< CTPPSPixelFramePosition, CTPPSPixelROCInfo > ROCMapping
const T & get() const
Definition: EventSetup.h:56
virtual void produce(edm::Event &, const edm::EventSetup &) override
get data, convert to digis attach againe to Event
edm::EDGetTokenT< FEDRawDataCollection > FEDRawDataCollection_
def move(src, dest)
Definition: eostools.py:510