CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
LaserSorter Class Reference

#include <LaserSorter.h>

Inheritance diagram for LaserSorter:
edm::EDAnalyzer edm::EDConsumerBase

Classes

struct  IndexRecord
 
class  OutStreamRecord
 
struct  stats_t
 

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 
 LaserSorter (const edm::ParameterSet &)
 
 ~LaserSorter ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef boost::ptr_list
< OutStreamRecord
OutStreamList
 

Private Member Functions

void closeAllStreams ()
 
void closeOldStreams (edm::LuminosityBlockNumber_t lumiBlock)
 
OutStreamList::iterator closeOutStream (OutStreamList::iterator streamRecord)
 
OutStreamList::iterator createOutStream (int fedId, edm::LuminosityBlockNumber_t lumiBlock)
 
int dcc2Lme (int dccNum, int dccSide)
 
int getDetailedTriggerType (const edm::Handle< FEDRawDataCollection > &rawdata, double *proba=0)
 
std::vector< int > getFullyReadoutDccs (const FEDRawDataCollection &data) const
 
void getOutputFedList (const edm::Event &event, const FEDRawDataCollection &data, std::vector< unsigned > &fedIds) const
 
OutStreamRecordgetStream (int fedId, edm::LuminosityBlockNumber_t lumiBlock)
 
bool isDccEventEmpty (const FEDRawData &data, size_t *dccLen=0, int *nTowerBlocks=0) const
 
int readFormatVersion (std::ifstream &in, const std::string &fileName)
 
bool readIndexTable (std::ifstream &in, std::string &inName, OutStreamRecord &outRcd, std::string *err)
 
bool renameAsBackup (const std::string &fileName, std::string &newFileName)
 
void restoreStreamsOfLumiBlock (int lumiBlock)
 
void streamFileName (int fedId, edm::LuminosityBlockNumber_t lumiBlock, std::string &tmpName, std::string &finalName)
 
bool writeEvent (OutStreamRecord &out, const edm::Event &event, int detailedTriggerType, const FEDRawDataCollection &data)
 
bool writeEventHeader (std::ofstream &out, const edm::Event &evt, int fedId, unsigned nFeds)
 
bool writeFedBlock (std::ofstream &out, const FEDRawData &data)
 
void writeFileHeader (std::ofstream &out)
 
bool writeIndexTable (std::ofstream &out, std::vector< IndexRecord > &indices)
 

Static Private Member Functions

static std::string toString (uint64_t t)
 

Private Attributes

int detailedTrigType_
 
bool disableOutput_
 
bool doOutputList_
 
edm::InputTag fedRawDataCollectionTag_
 
std::vector< std::string > fedSubDirs_
 
unsigned char formatVersion_
 
int iNoEcalDataMess_
 
int iNoFullReadoutDccError_
 
std::ofstream logFile_
 
edm::LuminosityBlockNumber_t lumiBlock_
 
int lumiBlockSpan_
 
int maxFullReadoutDccError_
 
int maxNoEcalDataMess_
 
std::string outputDir_
 
std::ofstream outputList_
 
std::string outputListFile_
 
OutStreamList outStreamList_
 
edm::RunNumber_t runNumber_
 
struct LaserSorter::stats_t stats_
 
std::ofstream timeLog_
 
std::string timeLogFile_
 
timeval timer_
 
bool timing_
 
int verbosity_
 

Static Private Attributes

static const int ecalDccFedIdMax_ = 654
 
static const int ecalDccFedIdMin_ = 601
 
static const int indexOffset32_ = 1
 
static const int matacqFedId_ = 655
 
static const unsigned maxEvents_ = 1<<20
 
static stats_t stats_init = {0, 0, 0, 0, 0}
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

This module is used to classify events of laser sequence acquired in a global run. Sorting: Events are grouped by bunch of consecutive events from the same FED. A file of such a bunch of events is identified by the FED or ECAL sector and the luminosity block id of the first event.

Sorting strategy: It is assumes that:

File completion: while being feeding, .part is appended at the end of the each output file.Once a file is completed (see above), it is renamed without the enclosing .part suffix.

Definition at line 44 of file LaserSorter.h.

Member Typedef Documentation

typedef boost::ptr_list<OutStreamRecord> LaserSorter::OutStreamList
private

Definition at line 112 of file LaserSorter.h.

Constructor & Destructor Documentation

LaserSorter::LaserSorter ( const edm::ParameterSet pset)

Definition at line 78 of file LaserSorter.cc.

References gather_cfg::cout, doOutputList_, edm::hlt::Exception, fedSubDirs_, logFile_, now(), dbtoconf::out, outputDir_, outputList_, outputListFile_, timeLog_, timeLogFile_, timer_, and timing_.

79  : lumiBlock_(0),
80  formatVersion_(5),
81  outputDir_(pset.getParameter<std::string>("outputDir")),
82  fedSubDirs_(pset.getParameter<std::vector<std::string> >("fedSubDirs")),
83  timeLogFile_(pset.getUntrackedParameter<std::string>("timeLogFile", "")),
84  disableOutput_(pset.getUntrackedParameter<bool>("disableOutput", false)),
85  runNumber_(0),
86  outputListFile_(pset.getUntrackedParameter<string>("outputListFile", "")),
87  doOutputList_(false),
88  verbosity_(pset.getUntrackedParameter<int>("verbosity", 0)),
90  maxFullReadoutDccError_(pset.getParameter<int>("maxFullReadoutDccError")),
92  maxNoEcalDataMess_(pset.getParameter<int>("maxNoEcalDataMess")),
93  lumiBlockSpan_(pset.getParameter<int>("lumiBlockSpan")),
94  fedRawDataCollectionTag_(pset.getParameter<edm::InputTag>("fedRawDataCollectionTag")),
96 {
97 
98  gettimeofday(&timer_, 0);
99  logFile_.open("eventSelect.log", ios::app | ios::out);
100 
101  const unsigned nEcalFeds= 54;
102  if(fedSubDirs_.size()!= nEcalFeds+1){
103  throw cms::Exception("LaserSorter")
104  << "Configuration error: "
105  << "fedSubDirs parameter must be a vector "
106  << " of " << nEcalFeds << " strings"
107  << " (subdirectory for unknown triggered FED followed by "
108  "subdirectories for FED ID 601 "
109  "to FED ID 654 in increasing FED ID order)";
110  }
111 
112  if(outputListFile_.size()!=0){
113  outputList_.open(outputListFile_.c_str(), ios::app);
114  if(outputList_.bad()){
115  throw cms::Exception("FileOpen")
116  << "Failed to open file '" << outputListFile_
117  << "' for logging of output file path list.";
118  }
119  doOutputList_ = true;
120  }
121 
122  if(timeLogFile_.size()>0){
123  timeLog_.open(timeLogFile_.c_str());
124  if(timeLog_.fail()){
125  cout << "[LaserSorter " << now() << "] "
126  << "Failed to open file " << timeLogFile_ << " to log timing.\n";
127  timing_ = false;
128  } else{
129  timing_ = true;
130  }
131  }
132 
133  struct stat fileStat;
134  if(0==stat(outputDir_.c_str(), &fileStat)){
135  if(!S_ISDIR(fileStat.st_mode)){
136  throw cms::Exception("[LaserSorter]")
137  << "File " << outputDir_ << " exists but is not a directory "
138  << " as expected.";
139  }
140  } else {//directory does not exists, let's try to create it
141  if(0!=mkdir(outputDir_.c_str(), 0755)){
142  throw cms::Exception("[LaserSorter]")
143  << "Failed to create directory " << outputDir_
144  << " for writing data.";
145  }
146  }
147 
148  logFile_ << "# "
149  "run\t"
150  "LB\t"
151  "event\t"
152  "trigType\t"
153  "FED\t"
154  "side\t"
155  "LB out\t"
156  "Written\t"
157  "ECAL data\n";
158 }
edm::InputTag fedRawDataCollectionTag_
Definition: LaserSorter.h:425
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int lumiBlockSpan_
Definition: LaserSorter.h:423
bool disableOutput_
Definition: LaserSorter.h:341
int maxFullReadoutDccError_
Definition: LaserSorter.h:401
edm::RunNumber_t runNumber_
Definition: LaserSorter.h:345
edm::LuminosityBlockNumber_t lumiBlock_
Definition: LaserSorter.h:316
std::vector< std::string > fedSubDirs_
Definition: LaserSorter.h:333
unsigned char formatVersion_
Definition: LaserSorter.h:325
std::string outputDir_
Definition: LaserSorter.h:329
timeval timer_
Definition: LaserSorter.h:349
std::string outputListFile_
Definition: LaserSorter.h:361
std::string timeLogFile_
Definition: LaserSorter.h:337
int iNoEcalDataMess_
Definition: LaserSorter.h:406
tuple out
Definition: dbtoconf.py:99
static std::string now()
Definition: LaserSorter.cc:64
std::ofstream outputList_
Definition: LaserSorter.h:373
std::ofstream logFile_
Definition: LaserSorter.h:312
struct LaserSorter::stats_t stats_
static stats_t stats_init
Definition: LaserSorter.h:456
tuple cout
Definition: gather_cfg.py:121
int maxNoEcalDataMess_
Definition: LaserSorter.h:410
int iNoFullReadoutDccError_
Definition: LaserSorter.h:396
bool doOutputList_
Definition: LaserSorter.h:365
std::ofstream timeLog_
Definition: LaserSorter.h:353
LaserSorter::~LaserSorter ( )

Definition at line 160 of file LaserSorter.cc.

References logFile_, LaserSorter::stats_t::nInvalidDccStrict, LaserSorter::stats_t::nInvalidDccWeak, LaserSorter::stats_t::nRead, LaserSorter::stats_t::nRestoredDcc, LaserSorter::stats_t::nWritten, and stats_.

160  {
161  logFile_ << "Summary. Event count: "
162  << stats_.nRead << " processed, "
163  << stats_.nWritten << " written, "
164  << stats_.nInvalidDccStrict << " with errors in DCC ID values, "
165  << stats_.nInvalidDccWeak << " with unusable DCC ID values, "
166  << stats_.nRestoredDcc << " restored DCC ID based on DCC block size\n";
167 }
double nRestoredDcc
number of events whose DCC ID was restored based on FED block sizes
Definition: LaserSorter.h:454
double nRead
number of events read out
Definition: LaserSorter.h:444
std::ofstream logFile_
Definition: LaserSorter.h:312
struct LaserSorter::stats_t stats_
double nWritten
number of events written out
Definition: LaserSorter.h:446

Member Function Documentation

void LaserSorter::analyze ( const edm::Event event,
const edm::EventSetup es 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 172 of file LaserSorter.cc.

References closeAllStreams(), closeOldStreams(), create_public_lumi_plots::color, colorNames, gather_cfg::cout, ecaldqm::dccId(), detailedTrigNames, detailedTrigType_, disableOutput_, ecalDccFedIdMax_, ecalDccFedIdMin_, LaserSorter::OutStreamRecord::excludedOrbit(), fedRawDataCollectionTag_, LaserSorter::OutStreamRecord::finalFileName(), getDetailedTriggerType(), getFullyReadoutDccs(), getStream(), i, edm::EventBase::id(), iNoEcalDataMess_, iNoFullReadoutDccError_, logFile_, lumiBlock_, lumiBlockSpan_, edm::EventBase::luminosityBlock(), maxFullReadoutDccError_, csvLumiCalc::maxLumi, csvLumiCalc::minLumi, LaserSorter::stats_t::nInvalidDccStrict, LaserSorter::stats_t::nInvalidDccWeak, now(), LaserSorter::stats_t::nRead, LaserSorter::stats_t::nRestoredDcc, LaserSorter::stats_t::nWritten, edm::EventBase::orbitNumber(), dbtoconf::out, lumiPlot::rawdata, restoreStreamsOfLumiBlock(), edm::EventID::run(), runNumber_, LaserSorter::OutStreamRecord::startingLumiBlock(), stats_, edmStreamStallGrapher::t, timeLog_, timer_, timing_, verbosity_, and writeEvent().

172  {
173  if(timing_){
174  timeval t;
175  gettimeofday(&t, 0);
176  timeLog_ << t.tv_sec << "."
177  << setfill('0') << setw(3) << (t.tv_usec+500)/1000 << setfill(' ')
178  << "\t"
179  << (t.tv_usec - timer_.tv_usec)*1.
180  + (t.tv_sec - timer_.tv_sec)*1.e6 << "\t";
181  timer_ = t;
182  }
183 
184  ++stats_.nRead;
185 
186  if(event.id().run()!=runNumber_){//run changed or first event
187  //for a new run, starts with a new output stream set.
188  closeAllStreams();
189  runNumber_ = event.id().run();
191  iNoEcalDataMess_ = 0;
192  }
193 
195  event.getByLabel(fedRawDataCollectionTag_, rawdata);
196 
197  //The "detailed trigger type DCC field content:
198  double dttProba = 0;
199  detailedTrigType_ = getDetailedTriggerType(rawdata, &dttProba);
200 
201  const int trigType = (detailedTrigType_ >>8 ) & 0x7;
202  const int color = (detailedTrigType_ >>6 ) & 0x3;
203  const int dccId = (detailedTrigType_ >>0 ) & 0x3F;
204  int triggeredFedId = (detailedTrigType_ == -2) ? -1 : (600 + dccId);
205  const int side = (detailedTrigType_ >>11) & 0x1;
206  //monitoring region extended id:
207  // const int lme = dcc2Lme(dccId, side);
208 
209  if(detailedTrigType_ > -2){
210  if(dttProba < 1. || triggeredFedId < ecalDccFedIdMin_
211  || triggeredFedId > ecalDccFedIdMax_){
213  }
214 
215  if(triggeredFedId<ecalDccFedIdMin_ || triggeredFedId > ecalDccFedIdMax_){
216  if(verbosity_) cout << "[LaserSorter " << now() << "] " << "DCC ID (" << dccId
217  << ") found in trigger type is out of range.";
219  vector<int> ids = getFullyReadoutDccs(*rawdata);
220  if(ids.size()==0){
222  cout << " No fully read-out DCC found\n";
224  }
225  } else if(ids.size()==1){
226  triggeredFedId = ids[0];
227  if(verbosity_) cout << " ID guessed from DCC payloads\n";
229  } else{ //ids.size()>1
230  if(verbosity_){
231  cout << " Several fully read-out Dccs:";
232  for(unsigned i=0; i < ids.size(); ++i) cout << " " << ids[i];
233  cout << "\n";
234  }
235  }
236  }
237 
238  if(verbosity_>1) cout << "\n----------------------------------------------------------------------\n"
239  << "Event id: "
240  << " " << event.id() << "\n"
241  << "Lumin block: " << event.luminosityBlock() << "\n"
242  << "TrigType: " << detailedTrigNames[trigType&0x7]
243  << " Color: " << colorNames[color&0x3]
244  << " FED: " << triggeredFedId
245  << " side:" << side << "\n"
246  << "\n----------------------------------------------------------------------\n";
247 
248  } else{ //NO ECAL DATA
249  if(verbosity_>1) cout << "\n----------------------------------------------------------------------\n"
250  << "Event id: "
251  << " " << event.id() << "\n"
252  << "Lumin block: " << event.luminosityBlock() << "\n"
253  << "No ECAL data\n"
254  << "\n----------------------------------------------------------------------\n";
255  }
256 
257  logFile_ << event.id().run() << "\t"
258  << event.luminosityBlock() << "\t"
259  << event.id().event() << "\t"
260  << trigType << "\t"
261  << triggeredFedId << "\t"
262  << side;
263 
264  bool written = false;
265  int assignedLB = -1;
266 
267  if(event.luminosityBlock()!=lumiBlock_){
268  //lumi block change => need for stream garbage collection
269  const int lb = event.luminosityBlock();
270  closeOldStreams(lb);
271  int minLumi = event.luminosityBlock() - lumiBlockSpan_;
272  int maxLumi = event.luminosityBlock() + lumiBlockSpan_;
273  for(int lb1 = minLumi; lb1 <= maxLumi; ++lb1){
275  }
276  }
277 
278  if(disableOutput_){
279  /* NO OP*/
280  } else{
281  OutStreamRecord* out = getStream(triggeredFedId, event.luminosityBlock());
282 
283  if(out!=0){
284  assignedLB = out->startingLumiBlock();
285  if(out->excludedOrbit().find(event.orbitNumber())
286  ==out->excludedOrbit().end()){
287  if(verbosity_ > 1) cout << "[LaserSorter " << now() << "] "
288  << "Writing out event from FED " << triggeredFedId
289  << " LB " << event.luminosityBlock()
290  << " orbit " << event.orbitNumber() << "\n";
291  int dtt = (detailedTrigType_ >=0) ? detailedTrigType_ : -1; //shall we use -1 or 0 for undefined value?
292  written = written
293  || writeEvent(*out, event, dtt, *rawdata);
294  ++stats_.nWritten;
295  } else{
296  if(verbosity_) cout << "[LaserSorter " << now() << "] "
297  << "File " << out->finalFileName() << " "
298  << "already contains calibration event from FED "
299  << triggeredFedId << ", LB = "
300  << event.luminosityBlock()
301  << " with orbit ID "
302  << event.orbitNumber() << ". Event skipped.\n";
303  }
304  }
305  }
306  lumiBlock_ = event.luminosityBlock();
307 
308  logFile_ << "\t";
309  if(assignedLB>=0) logFile_ << assignedLB; else logFile_ << "-";
310  logFile_ << "\t" << (written?"Y":"N") << "\n";
311  logFile_ << "\t" << (detailedTrigType_==-2?"N":"Y") << "\n";
312 
313  if(timing_){
314  timeval t;
315  gettimeofday(&t, 0);
316  timeLog_ << (t.tv_usec - timer_.tv_usec)*1.
317  + (t.tv_sec - timer_.tv_sec)*1.e6 << "\n";
318  timer_ = t;
319  }
320 }
RunNumber_t run() const
Definition: EventID.h:39
edm::InputTag fedRawDataCollectionTag_
Definition: LaserSorter.h:425
OutStreamRecord * getStream(int fedId, edm::LuminosityBlockNumber_t lumiBlock)
Definition: LaserSorter.cc:426
int i
Definition: DBlmapReader.cc:9
int lumiBlockSpan_
Definition: LaserSorter.h:423
bool disableOutput_
Definition: LaserSorter.h:341
std::vector< int > getFullyReadoutDccs(const FEDRawDataCollection &data) const
Definition: LaserSorter.cc:917
int maxFullReadoutDccError_
Definition: LaserSorter.h:401
double nRestoredDcc
number of events whose DCC ID was restored based on FED block sizes
Definition: LaserSorter.h:454
static const char *const detailedTrigNames[]
Definition: LaserSorter.cc:43
static const int ecalDccFedIdMin_
Definition: LaserSorter.h:300
bool writeEvent(OutStreamRecord &out, const edm::Event &event, int detailedTriggerType, const FEDRawDataCollection &data)
Definition: LaserSorter.cc:456
edm::RunNumber_t runNumber_
Definition: LaserSorter.h:345
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
edm::LuminosityBlockNumber_t lumiBlock_
Definition: LaserSorter.h:316
void closeAllStreams()
Definition: LaserSorter.cc:394
edm::LuminosityBlockNumber_t startingLumiBlock() const
Definition: LaserSorter.h:70
double nRead
number of events read out
Definition: LaserSorter.h:444
timeval timer_
Definition: LaserSorter.h:349
int orbitNumber() const
Definition: EventBase.h:63
int iNoEcalDataMess_
Definition: LaserSorter.h:406
void closeOldStreams(edm::LuminosityBlockNumber_t lumiBlock)
Definition: LaserSorter.cc:401
tuple out
Definition: dbtoconf.py:99
int getDetailedTriggerType(const edm::Handle< FEDRawDataCollection > &rawdata, double *proba=0)
Definition: LaserSorter.cc:353
int detailedTrigType_
Definition: LaserSorter.h:308
static const int ecalDccFedIdMax_
Definition: LaserSorter.h:304
static std::string now()
Definition: LaserSorter.cc:64
std::ofstream logFile_
Definition: LaserSorter.h:312
struct LaserSorter::stats_t stats_
edm::EventID id() const
Definition: EventBase.h:56
tuple cout
Definition: gather_cfg.py:121
static const char *const colorNames[]
Definition: LaserSorter.cc:54
int iNoFullReadoutDccError_
Definition: LaserSorter.h:396
void restoreStreamsOfLumiBlock(int lumiBlock)
dictionary rawdata
Definition: lumiPlot.py:393
double nWritten
number of events written out
Definition: LaserSorter.h:446
unsigned dccId(DetId const &)
std::ofstream timeLog_
Definition: LaserSorter.h:353
void LaserSorter::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 842 of file LaserSorter.cc.

842  {
843 }
void LaserSorter::closeAllStreams ( )
private

Closes all opened output streams.

Definition at line 394 of file LaserSorter.cc.

References closeOutStream(), and outStreamList_.

Referenced by analyze(), and endJob().

394  {
395  for(OutStreamList::iterator it = outStreamList_.begin();
396  it != outStreamList_.end();/*NOOP*/){
397  it = closeOutStream(it);
398  }
399 }
OutStreamList::iterator closeOutStream(OutStreamList::iterator streamRecord)
Definition: LaserSorter.cc:788
OutStreamList outStreamList_
Definition: LaserSorter.h:321
void LaserSorter::closeOldStreams ( edm::LuminosityBlockNumber_t  lumiBlock)
private

Closes output stream 2 lumi block older than the input 'lumiBlock' ID.

Parameters
lumiBlockID of the reference luminosity block.

Definition at line 401 of file LaserSorter.cc.

References closeOutStream(), gather_cfg::cout, lumiBlockSpan_, now(), outStreamList_, and verbosity_.

Referenced by analyze().

401  {
402  const edm::LuminosityBlockNumber_t minLumiBlock = lumiBlock - lumiBlockSpan_;
403  const edm::LuminosityBlockNumber_t maxLumiBlock = lumiBlock + lumiBlockSpan_;
404  //If container type is ever changed, beware that
405  //closeOutStream call in the loop removes it from outStreamList
406  for(boost::ptr_list<OutStreamRecord>::iterator it = outStreamList_.begin();
407  it != outStreamList_.end();
408  /*NOOP*/){
409  if(it->startingLumiBlock() < minLumiBlock
410  || it->startingLumiBlock() > maxLumiBlock){
411  //event older than 2 lumi block => stream can be closed
412  if(verbosity_) cout << "[LaserSorter " << now() << "] "
413  << "Closing file for "
414  << "FED "
415  << it->fedId()
416  << " LB " << it->startingLumiBlock()
417  << "\n";
418  it = closeOutStream(it);
419  } else{
420  ++it;
421  }
422  }
423 }
int lumiBlockSpan_
Definition: LaserSorter.h:423
OutStreamList::iterator closeOutStream(OutStreamList::iterator streamRecord)
Definition: LaserSorter.cc:788
unsigned int LuminosityBlockNumber_t
static std::string now()
Definition: LaserSorter.cc:64
tuple cout
Definition: gather_cfg.py:121
OutStreamList outStreamList_
Definition: LaserSorter.h:321
LaserSorter::OutStreamList::iterator LaserSorter::closeOutStream ( OutStreamList::iterator  streamRecord)
private

Closes an output stream and removed it from opened stream records. Beware: this methode modifies outStreamList_.

Parameters
streamRecordrecord of the output stream to close.
Returns
iterator to element next to the deleted one.

Definition at line 788 of file LaserSorter.cc.

References gather_cfg::cout, doOutputList_, f, analyzePatCleaning_cfg::inputFile, now(), dbtoconf::out, outputList_, outStreamList_, AlCaHLTBitMon_QueryRunRegistry::string, edmStreamStallGrapher::t, cond::rpcobgas::time, verbosity_, and writeIndexTable().

Referenced by closeAllStreams(), and closeOldStreams().

789  {
790  if(streamRecord==outStreamList_.end()) return outStreamList_.end();
791 
792  if(verbosity_) cout << "[LaserSorter " << now() << "] " << "Writing Index table of file "
793  << streamRecord->finalFileName() << "\n";
794  ofstream& out = *streamRecord->out();
795  out.clear();
796  if(!writeIndexTable(out, *streamRecord->indices())){
797  cout << "Error while writing index table for file "
798  << streamRecord->finalFileName() << ". "
799  << "Resulting file might be corrupted. "
800  << "The error can be due to a lack of disk space.";
801  }
802 
803  if(verbosity_) cout << "[LaserSorter " << now() << "] " << "Closing file "
804  << streamRecord->finalFileName() << ".\n";
805  out.close();
806 
807  const std::string& tmpFileName = streamRecord->tmpFileName();
808  const std::string& finalFileName = streamRecord->finalFileName();
809 
810  if(verbosity_) cout << "[LaserSorter " << now() << "] " << "Renaming " << tmpFileName
811  << " to " << finalFileName << ".\n";
812 
813  if(0!=rename(tmpFileName.c_str(), finalFileName.c_str())){
814  cout << "[LaserSorter " << now() << "] "
815  << " Failed to rename output file from "
816  << tmpFileName << " to " << finalFileName
817  << ". " << strerror(errno) << "\n";
818  }
819 
820  if(doOutputList_){
821  char buf[256];
822  time_t t = time(0);
823  strftime(buf, sizeof(buf), "%F %R:%S", localtime(&t));
824 
825  ifstream f(".watcherfile");
826  string inputFile;
827  f >> inputFile;
828  outputList_ << finalFileName << "\t" << buf
829  << "\t" << inputFile
830  << endl;
831  }
832 
833  return outStreamList_.erase(streamRecord);
834 }
bool writeIndexTable(std::ofstream &out, std::vector< IndexRecord > &indices)
Definition: LaserSorter.cc:929
double f[11][100]
tuple out
Definition: dbtoconf.py:99
static std::string now()
Definition: LaserSorter.cc:64
std::ofstream outputList_
Definition: LaserSorter.h:373
tuple cout
Definition: gather_cfg.py:121
bool doOutputList_
Definition: LaserSorter.h:365
OutStreamList outStreamList_
Definition: LaserSorter.h:321
LaserSorter::OutStreamList::iterator LaserSorter::createOutStream ( int  fedId,
edm::LuminosityBlockNumber_t  lumiBlock 
)
private

Creates an output stream. It must be ensured before calling this method that the output stream is not already opened (See outStreamList_).

Parameters
fedIdFED ID of the event to stream out.
lumiBlockstarting lumi block of the event group to write to the stream.
Returns
iterator to the new stream record. outStreamList_.end() in case of failure.

Definition at line 544 of file LaserSorter.cc.

References EnergyCorrector::c, gather_cfg::cout, TauDecayModes::dec, end, edm::hlt::Exception, formatVersion_, recoMuon::in, min(), now(), dbtoconf::out, outStreamList_, readFormatVersion(), readIndexTable(), renameAsBackup(), streamFileName(), AlCaHLTBitMon_QueryRunRegistry::string, estimatePileup_makeJSON::trunc, verbosity_, and writeFileHeader().

Referenced by getStream().

545  {
546  if(verbosity_) cout << "[LaserSorter " << now() << "] " << "Creating a stream for FED " << fedId
547  << " lumi block " << lumiBlock << ".\n";
548  std::string tmpName;
549  std::string finalName;
550 
551  streamFileName(fedId, lumiBlock, tmpName, finalName);
552 
553  errno = 0;
554 
555  //checks if a file with tmpName name already exists:
556  ofstream* out = new ofstream(tmpName.c_str(), ios::out | ios::in);
557  if(out->is_open()){//temporary file already exists. Making a backup:
558  string newName;
559  if(!renameAsBackup(tmpName, newName)){
560  throw cms::Exception("LaserSorter")
561  << "Failed to rename file " << tmpName
562  << " to " << newName << "\n";
563  }
564  if(verbosity_) cout << "[LaserSorter " << now() << "] "
565  << "Already existing File " << tmpName
566  << " renamed to "
567  << newName << "\n";
568  out->close();
569  }
570 
571  out->clear();
572  out->open(tmpName.c_str(), ios::out | ios::trunc);
573 
574  if(out->fail()){//failed to create file
575  delete out;
576  throw cms::Exception("LaserSorter")
577  << "Failed to create file "
578  << tmpName << " for writing event from FED " << fedId
579  << " lumi block " << lumiBlock
580  << ": " << strerror(errno) << "\n.";
581  }
582 
583  ifstream in(finalName.c_str());
584  bool newFile = true;
585  if(in.good()){//file already exists with final name.
586  if(verbosity_) cout << "[LaserSorter " << now() << "] " << "File "
587  << finalName
588  << " already exists. It will be updated if needed.\n";
589  //Copying its contents:
590  char buffer[256];
591  streamsize nread = -1;
592  int vers = readFormatVersion(in, finalName);
593  if(vers==-1){
594  edm::LogWarning("LaserSorter") << "File " << tmpName.c_str()
595  << " is not an LMF file despite its extension or "
596  << "it is corrupted.\n";
597  } else if(vers!=formatVersion_){
598  edm::LogWarning("LaserSorter") << "Cannot include events already in file "
599  << tmpName.c_str()
600  << " because of version "
601  << "mismatch (found version "
602  << (int)vers << " while "
603  << "only version "
604  << (int)formatVersion_
605  << " is supported).\n";
606  } else{
607  newFile = false;
608  //read index table offset value:
609  const int indexTableOffsetPos8 = 1*sizeof(uint32_t);
610  uint32_t indexTableOffsetValue = 0;
611  in.clear();
612  in.seekg(indexTableOffsetPos8, ios::beg);
613  in.read((char*) &indexTableOffsetValue,
614  sizeof(indexTableOffsetValue));
615  if(in.fail()){
616  cout << "[LaserSorter " << now() << "] " << "Failed to read offset of index table "
617  " in the existing file " << finalName << "\n";
618  } else{
619  if(verbosity_>2) cout << "[LaserSorter " << now() << "] " << "Index table offset of "
620  "original file " << finalName << ": 0x"
621  << hex << setfill('0')
622  << setw(8) << indexTableOffsetValue
623  << dec << setfill(' ') << "\n";
624  }
625  in.clear();
626  in.seekg(0, ios::beg);
627 
628  //copy legacy file contents except the index table
629  uint32_t toRead = indexTableOffsetValue;
630  cout << "[LaserSorter " << now() << "] " << "Copying " << finalName << " to " << tmpName << endl;
631  while(!in.eof()
632  && (toRead > 0)
633  && (nread=in.readsome(buffer, min(toRead, (uint32_t)sizeof(buffer))))!=0){
634  // cout << "Writing " << nread << " bytes to file "
635  // << tmpName.c_str() << "\n";
636  toRead -= nread;
637  // out->seekp(0, ios::end);
638  out->write(buffer, nread);
639  if(out->bad()){
640  throw cms::Exception("LaserSorter") << "Error while writing to file "
641  << tmpName
642  << ". Check if there is enough "
643  << "space on the device.\n";
644  }
645  }
646 
647  //resets index table offset field:
648  indexTableOffsetValue = 0 ;
649  out->clear();
650  out->seekp(indexTableOffsetPos8, ios::beg);
651  out->write((char*)&indexTableOffsetValue, sizeof(uint32_t));
652  out->clear();
653  out->seekp(0, ios::end);
654  }
655  }
656 
657 #if 0
658  out->flush();
659  cout << "Press enter... file name was " << tmpName << endl;
660  char c;
661  cin >> c;
662 #endif
663 
664  OutStreamRecord* outRcd = new OutStreamRecord(fedId, lumiBlock,
665  out,
666  tmpName, finalName);
667 
668  if(newFile){
669  writeFileHeader(*out);
670  } else{
671  std::string errMsg;
672  if(!readIndexTable(in, finalName, *outRcd, &errMsg)){
673  throw cms::Exception("LaserSorter") << errMsg << "\n";
674  }
675  }
676 
677  return outStreamList_.insert(outStreamList_.end(), outRcd);
678 }
bool readIndexTable(std::ifstream &in, std::string &inName, OutStreamRecord &outRcd, std::string *err)
Definition: LaserSorter.cc:969
void writeFileHeader(std::ofstream &out)
Definition: LaserSorter.cc:680
void streamFileName(int fedId, edm::LuminosityBlockNumber_t lumiBlock, std::string &tmpName, std::string &finalName)
Definition: LaserSorter.cc:734
unsigned char formatVersion_
Definition: LaserSorter.h:325
#define end
Definition: vmac.h:37
T min(T a, T b)
Definition: MathUtil.h:58
tuple out
Definition: dbtoconf.py:99
static std::string now()
Definition: LaserSorter.cc:64
int readFormatVersion(std::ifstream &in, const std::string &fileName)
tuple cout
Definition: gather_cfg.py:121
OutStreamList outStreamList_
Definition: LaserSorter.h:321
bool renameAsBackup(const std::string &fileName, std::string &newFileName)
Definition: LaserSorter.cc:523
int LaserSorter::dcc2Lme ( int  dccNum,
int  dccSide 
)
private

Definition at line 322 of file LaserSorter.cc.

References min().

322  {
323  int fedid = (dcc%600) + 600; //to handle both FED and DCC id.
324  vector<int> lmes;
325  // EE -
326  if( fedid <= 609 ) {
327  if ( fedid <= 607 ) {
328  lmes.push_back(fedid-601+83);
329  } else if ( fedid == 608 ) {
330  lmes.push_back(90);
331  lmes.push_back(91);
332  } else if ( fedid == 609 ) {
333  lmes.push_back(92);
334  }
335  } //EB
336  else if ( fedid >= 610 && fedid <= 645 ) {
337  lmes.push_back(2*(fedid-610)+1);
338  lmes.push_back(lmes[0]+1);
339  } // EE+
340  else if ( fedid >= 646 ) {
341  if ( fedid <= 652 ) {
342  lmes.push_back(fedid-646+73);
343  } else if ( fedid == 653 ) {
344  lmes.push_back(80);
345  lmes.push_back(81);
346  } else if ( fedid == 654 ) {
347  lmes.push_back(82);
348  }
349  }
350  return lmes.size()==0?-1:lmes[min(lmes.size(), (size_t)side)];
351 }
T min(T a, T b)
Definition: MathUtil.h:58
void LaserSorter::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 836 of file LaserSorter.cc.

References closeAllStreams().

836  {
837  //TODO: better treatement of last files:
838  //they might be imcomplete...
839  closeAllStreams();
840 }
void closeAllStreams()
Definition: LaserSorter.cc:394
int LaserSorter::getDetailedTriggerType ( const edm::Handle< FEDRawDataCollection > &  rawdata,
double *  proba = 0 
)
private

Retrieve detailed trigger type (trigger type, DCC, side) from raw event

Parameters
rawdataFED data collection
probaif not null used to store the maximum of occurence frequency of the detailed trigger types (DTT) appearing in each DCC block. In normal condition every DCC indicated the same DTT and this value is 1.
Returns
detailed trigger type. In case of descripancy between the DCCs, the most frequent value is returned if it covers more than 80% of the present DCC blocks, -1 is returned otherwise. If event does not contain any ECAL data -2 is returned.

Definition at line 353 of file LaserSorter.cc.

References Majority< T >::add(), gather_cfg::cout, FEDRawData::data(), data, ecalDccFedIdMax_, ecalDccFedIdMin_, iNoEcalDataMess_, FEDNumbering::inRange(), maxNoEcalDataMess_, now(), AlCaHLTBitMon_ParallelJobs::p, Majority< T >::result(), FEDRawData::size(), and verbosity_.

Referenced by analyze().

354  {
355  Majority<int> stat;
356  bool ecalData = false;
357  for(int id=ecalDccFedIdMin_; id<=ecalDccFedIdMax_; ++id){
358  if(!FEDNumbering::inRange(id)) continue;
359  const FEDRawData& data = rawdata->FEDData(id);
360  const int detailedTrigger32 = 5;
361  if(verbosity_>3) cout << "[LaserSorter " << now() << "] "
362  << "FED " << id << " data size: "
363  << data.size() << "\n";
364  if(data.size()>=4*(detailedTrigger32+1)){
365  ecalData = true;
366  const uint32_t* pData32 = (const uint32_t*) data.data();
367  int tType = pData32[detailedTrigger32] & 0xFFF;
368  if(verbosity_>3) cout << "[LaserSorter " << now() << "] "
369  << "Trigger type " << tType << "\n";
370  stat.add(tType);
371  }
372  }
373  if(!ecalData) return -2;
374  double p;
375  int tType = stat.result(&p);
376  if(p<0){
377  //throw cms::Exception("NotFound") << "No ECAL DCC data found\n";
379  edm::LogWarning("NotFound") << "No ECAL DCC data found. "
380  "(This warning will be disabled for the current run after "
381  << maxNoEcalDataMess_ << " occurences.)";
383  }
384  tType = -1;
385  } else if(p<.8){
386  //throw cms::Exception("EventCorruption") << "Inconsitency in detailed trigger type indicated in ECAL DCC data headers\n";
387  edm::LogWarning("EventCorruption") << "Inconsitency in detailed trigger type indicated in ECAL DCC data headers\n";
388  tType = -1;
389  }
390  if(proba) *proba = p;
391  return tType;
392 }
static const int ecalDccFedIdMin_
Definition: LaserSorter.h:300
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
void add(const T &value)
Definition: Majority.h:24
int iNoEcalDataMess_
Definition: LaserSorter.h:406
static const int ecalDccFedIdMax_
Definition: LaserSorter.h:304
static std::string now()
Definition: LaserSorter.cc:64
static bool inRange(int)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
tuple cout
Definition: gather_cfg.py:121
int maxNoEcalDataMess_
Definition: LaserSorter.h:410
T result(double *proba) const
Definition: Majority.h:29
std::vector< int > LaserSorter::getFullyReadoutDccs ( const FEDRawDataCollection data) const
private

Retrieves DCCs which were fully read out (>=68 readout channels).

Parameters
dataDCC data collection
Returns
FED ids.

Definition at line 917 of file LaserSorter.cc.

References ecalDccFedIdMax_, ecalDccFedIdMin_, FEDRawDataCollection::FEDData(), isDccEventEmpty(), ecaldqm::nTowers, and query::result.

Referenced by analyze().

917  {
918  int nTowers;
919  vector<int> result;
920  for(int fed = ecalDccFedIdMin_; fed < ecalDccFedIdMax_; ++fed){
921  const FEDRawData& fedData = data.FEDData(fed);
922  isDccEventEmpty(fedData, 0, &nTowers);
923  if(nTowers>=68) result.push_back(fed);
924  }
925  return result;
926 }
static const int ecalDccFedIdMin_
Definition: LaserSorter.h:300
bool isDccEventEmpty(const FEDRawData &data, size_t *dccLen=0, int *nTowerBlocks=0) const
Definition: LaserSorter.cc:845
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
tuple result
Definition: query.py:137
static const int ecalDccFedIdMax_
Definition: LaserSorter.h:304
void LaserSorter::getOutputFedList ( const edm::Event event,
const FEDRawDataCollection data,
std::vector< unsigned > &  fedIds 
) const
private

Computes the list of FEDs which data must be written out.

Parameters
dataCMS raw event
fedIds[out] list of FEDs to keep

Definition at line 888 of file LaserSorter.cc.

References ecalDccFedIdMax_, ecalDccFedIdMin_, FEDRawDataCollection::FEDData(), isDccEventEmpty(), matacqFedId_, and FEDRawData::size().

Referenced by writeEvent().

890  {
891  fedIds.erase(fedIds.begin(), fedIds.end());
892  for(int id=ecalDccFedIdMin_; id<=ecalDccFedIdMax_; ++id){
893  size_t dccLen = 0;
894  const FEDRawData& dccEvent = data.FEDData(id);
895  if(id==matacqFedId_
896  || !isDccEventEmpty(dccEvent, &dccLen)){
897  fedIds.push_back(id);
898  }
899  if(dccLen*sizeof(uint64_t)!=dccEvent.size()){
900  edm::LogWarning("LaserSorter")
901  << "Length error in data of FED " << id
902  << " in event " << event.id()
903  << ", Data of this FED dropped.";
904  }
905  }
906  // cout << __FILE__ << ":" << __LINE__ << ": "
907  // << "data.FEDData(" << matacqFedId_ << ").size() = "
908  // << data.FEDData(matacqFedId_).size() << "\n";
909  if(data.FEDData(matacqFedId_).size()>4){//matacq block present
910  // cout << __FILE__ << ":" << __LINE__ << ": "
911  // << "Adding matacq to list of FEDs\n";
912  fedIds.push_back(matacqFedId_);
913  }
914 }
static const int ecalDccFedIdMin_
Definition: LaserSorter.h:300
bool isDccEventEmpty(const FEDRawData &data, size_t *dccLen=0, int *nTowerBlocks=0) const
Definition: LaserSorter.cc:845
static const int matacqFedId_
Definition: LaserSorter.h:429
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
unsigned long long uint64_t
Definition: Time.h:15
static const int ecalDccFedIdMax_
Definition: LaserSorter.h:304
LaserSorter::OutStreamRecord * LaserSorter::getStream ( int  fedId,
edm::LuminosityBlockNumber_t  lumiBlock 
)
private

Gets and eventually creates the output stream for writing the events of a given FED and luminosity block.

Parameters
fedIdID of the FED the event is issued from
lumiBlockluminositu block of the event
Returns
pointer of the output stream record or null if not found.

Definition at line 426 of file LaserSorter.cc.

References funct::abs(), gather_cfg::cout, createOutStream(), ecalDccFedIdMax_, lumiBlockSpan_, now(), outStreamList_, and verbosity_.

Referenced by analyze(), and restoreStreamsOfLumiBlock().

427  {
428 
429  if((fedId != -1) &&
430  (fedId < ecalDccFedIdMin_ || fedId > ecalDccFedIdMax_)) fedId = -1;
431 
432  if(verbosity_>1) cout << "[LaserSorter " << now() << "] "
433  << "Looking for an opened output file for FED "
434  << fedId << " LB " << lumiBlock
435  << "\n";
436 
437  //first look if stream is already open:
438  for(OutStreamList::iterator it = outStreamList_.begin();
439  it != outStreamList_.end();
440  ++it){
441  if(it->fedId()==fedId &&
442  (abs((int)it->startingLumiBlock()-(int)lumiBlock)<=lumiBlockSpan_)){
443  //stream found!
444  return &(*it);
445  }
446  }
447  //stream was not found. Let's create one
448 
449  if(verbosity_) cout << "[LaserSorter " << now() << "] "
450  << "File not yet opened. Opening it.\n";
451 
452  OutStreamList::iterator streamRecord = createOutStream(fedId, lumiBlock);
453  return streamRecord!=outStreamList_.end()?&(*streamRecord):0;
454 }
int lumiBlockSpan_
Definition: LaserSorter.h:423
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const int ecalDccFedIdMax_
Definition: LaserSorter.h:304
static std::string now()
Definition: LaserSorter.cc:64
OutStreamList::iterator createOutStream(int fedId, edm::LuminosityBlockNumber_t lumiBlock)
Definition: LaserSorter.cc:544
tuple cout
Definition: gather_cfg.py:121
OutStreamList outStreamList_
Definition: LaserSorter.h:321
bool LaserSorter::isDccEventEmpty ( const FEDRawData data,
size_t *  dccLen = 0,
int *  nTowerBlocks = 0 
) const
private

Checks if an ECAL DCC event is empty. It is considered as empty if it does not contains FE data ("tower" block). So an event containing SRP or TCC data can be tagged as empty by this method. , if not null filled with the event length read from the DCC header. if not null, filled with number of tower blocks

Returns
true if event is empty, false otherwise

Definition at line 845 of file LaserSorter.cc.

References FEDRawData::data(), dtTPAnalyzer_cfg::dataType, and FEDRawData::size().

Referenced by getFullyReadoutDccs(), and getOutputFedList().

846  {
847  if(nTowerBlocks) *nTowerBlocks = 0;
848  //DCC event is considered empty if it does not contains any Tower block
849  //( = FE data)
850  bool rc = true;
851  if(dccLen) *dccLen = 0;
852  const unsigned nWord32 = data.size()/sizeof(uint32_t);
853  if(nWord32==0){
854  //cout << "[LaserSorter " << now() << "] " << "FED block completly empty\n";
855  return true;
856  }
857  for(unsigned iWord32 = 0; iWord32 < nWord32; iWord32 += 2){
858  uint32_t* data32 = ((uint32_t*)(data.data())) + iWord32;
859  int dataType = (data32[1] >>28) & 0xF;
860  // cout << hex << "0x" << setfill('0')
861  // << setw(8) << data32[1] << "'" << setw(8) << data32[0]
862  // << " dataType: 0x" << dataType
863  // << dec << setfill(' ') << "\n";
864  if(0==(dataType>>2)){//in DCC header
865  const int dccHeaderId = (data32[1] >>24) & 0x3F;
866  if(dccHeaderId==1){
867  if(dccLen) *dccLen=((data32[0] >>0 ) & 0xFFFFFF);
868  }
869  } if((dataType>>2)==3){//Tower block
870  rc = false;
871  if(nTowerBlocks){//number of tower block must be counted
872  ++(*nTowerBlocks);
873  } else{
874  break;
875  }
876  }
877  }
878  // cout << "[LaserSorter " << now() << "] " << "DCC Len: ";
879 
880  // if(dccLen){
881  // cout << (*dccLen) << " event ";
882  // }
883  // cout << (rc?"":"non") << " empty"
884  // << endl;
885  return rc;
886 }
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
int LaserSorter::readFormatVersion ( std::ifstream &  in,
const std::string &  fileName 
)
private

Gets format version of an LMF file. Position of file is preserved.

Parameters
instream to read the file
fileNamename of the file. Used in error message.
Returns
version or -1 in case of error.

Definition at line 1043 of file LaserSorter.cc.

References data, AlCaHLTBitMon_ParallelJobs::p, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by createOutStream().

1044  {
1045  int vers = -1;
1046  streampos p = in.tellg();
1047 
1048  uint32_t data;
1049 
1050  in.read((char*)&data, sizeof(data));
1051 
1052  char magic[4];
1053 
1054  magic[0] = data & 0xFF;
1055  magic[1] = (data >>8) & 0xFF;
1056  magic[2] = (data >>16) & 0xFF;
1057  magic[3] = 0;
1058 
1059 
1060  const string lmf = string("LMF");
1061 
1062  if(in.good() && lmf.compare(magic)==0){
1063  vers = (data >>24) & 0xFF;
1064  }
1065 
1066  if(lmf.compare(magic)!=0){
1067  edm::LogWarning("LaserSorter") << "File " << fileName
1068  << "is not an LMF file.\n";
1069  }
1070 
1071  in.clear();
1072  in.seekg(p);
1073  return vers;
1074 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
bool LaserSorter::readIndexTable ( std::ifstream &  in,
std::string &  inName,
OutStreamRecord outRcd,
std::string *  err 
)
private

Read index table of an LMF file.

Parameters
inLMF file whose index table must be read.
inNamename of the in file
outRcdrecord of the output file. whose the index table must be copied to.
errif not nul, in case of failure filled with the error message.
Returns
true in case of success, false otherwise

Definition at line 969 of file LaserSorter.cc.

References gather_cfg::cout, LaserSorter::OutStreamRecord::excludedOrbit(), i, recoMuon::in, LaserSorter::OutStreamRecord::indices(), maxEvents_, jetmet_cfg::nevts, now(), alignCSCRings::s, and verbosity_.

Referenced by createOutStream().

972  {
973  stringstream errMsg;
974 
975  ifstream* s = &in;
976 
977  //streampos pos = s->tellg();
978  s->clear();
979  s->seekg(0);
980 
981  uint32_t fileHeader[2];
982  s->read((char*)&fileHeader[0], sizeof(fileHeader));
983  uint32_t indexTablePos = fileHeader[1];
984 
985  if(s->eof()){
986  s->clear();
987  s->seekg(0);
988  errMsg << "Failed to read header of file " << inName
989  << ".";
990  if(err) *err = errMsg.str();
991  return false;
992  }
993 
994  s->seekg(indexTablePos);
995 
996  uint32_t nevts = 0;
997  s->read((char*)&nevts, sizeof(nevts));
998  s->ignore(4);
999  if(s->bad()){
1000  errMsg << "Failed to read index table from file "
1001  << inName << ".";
1002  if(err) *err = errMsg.str();
1003  return false;
1004  }
1005  if(nevts>maxEvents_){
1006  errMsg << "Number of events indicated in event index of file "
1007  << inName << " (" << nevts << ") "
1008  << "is unexpectively large.";
1009  if(err) *err = errMsg.str();
1010  return false;
1011  }
1012  outRcd.indices()->resize(nevts);
1013  s->read((char*)&(*outRcd.indices())[0], nevts*sizeof(IndexRecord));
1014  if(s->bad()){
1015  outRcd.indices()->clear();
1016  errMsg << "Failed to read index table from file "
1017  << inName << ".";
1018  if(err) *err = errMsg.str();
1019  return false;
1020  }
1021  if(nevts>maxEvents_){
1022  errMsg << "Number of events indicated in event index of file "
1023  << inName << " is unexpectively large.";
1024  if(err) *err = errMsg.str();
1025  outRcd.indices()->clear();
1026  return false;
1027  }
1028 
1029  if(verbosity_ > 1) cout << "[LaserSorter " << now() << "] " << "Orbit IDs of events "
1030  << "already contained in the file "
1031  << inName << ":";
1032  for(unsigned i = 0; i < outRcd.indices()->size(); ++i){
1033  if(verbosity_>1){
1034  cout << " " << setw(9) << (*outRcd.indices())[i].orbit;
1035  }
1036  outRcd.excludedOrbit().insert((*outRcd.indices())[i].orbit);
1037  }
1038  if(verbosity_>1) cout << "\n";
1039 
1040  return true;
1041 }
int i
Definition: DBlmapReader.cc:9
static const unsigned maxEvents_
Definition: LaserSorter.h:438
static std::string now()
Definition: LaserSorter.cc:64
tuple cout
Definition: gather_cfg.py:121
int nevts
Definition: jetmet_cfg.py:3
bool LaserSorter::renameAsBackup ( const std::string &  fileName,
std::string &  newFileName 
)
private

Definition at line 523 of file LaserSorter.cc.

References i, and MainPageGenerator::link.

Referenced by createOutStream().

524  {
525  int i = 0;
526  int err;
527  static const int maxTries = 100;
528  stringstream newFileName_;
529  do{
530  newFileName_.str("");
531  newFileName_ << fileName << "~";
532  if(i>0) newFileName_ << i;
533  err = link(fileName.c_str(), newFileName_.str().c_str());
534  if(err==0){
535  newFileName = newFileName_.str();
536  err = unlink(fileName.c_str());
537  }
538  ++i;
539  } while((err!=0) && (errno == EEXIST) && (i < maxTries));
540  return err==0;
541 }
int i
Definition: DBlmapReader.cc:9
void LaserSorter::restoreStreamsOfLumiBlock ( int  lumiBlock)
private

Opens output streams associated to a lumi block according to already existing files. To be used when previously processed luminosity block is not

Parameters
lumiBlockID of the luminosity block whose output streams must be reopened.

Definition at line 1091 of file LaserSorter.cc.

References ecalDccFedIdMax_, ecalDccFedIdMin_, convertXMLtoSQLite_cfg::fileName, getStream(), alignCSCRings::s, and streamFileName().

Referenced by analyze().

1091  {
1092  string dummy;
1093  string fileName;
1094 
1095  for(int fedId = ecalDccFedIdMin_-2; fedId <= ecalDccFedIdMax_; ++fedId){
1096  int fedId_;
1097  if(fedId == ecalDccFedIdMin_-2) fedId_ = -1; //stream for event w/o ECAL data
1098  else fedId_ = fedId;
1099  streamFileName(fedId_, lumiBlock, dummy, fileName);
1100  struct stat s;
1101  //TODO: could be optimized by adding an option to get stream
1102  //to open only existing file: would avoid double call to streamFileName.
1103  if(stat(fileName.c_str(), &s)==0){//file exists
1104  getStream(fedId_, lumiBlock);
1105  }
1106  }
1107 }
OutStreamRecord * getStream(int fedId, edm::LuminosityBlockNumber_t lumiBlock)
Definition: LaserSorter.cc:426
static const int ecalDccFedIdMin_
Definition: LaserSorter.h:300
void streamFileName(int fedId, edm::LuminosityBlockNumber_t lumiBlock, std::string &tmpName, std::string &finalName)
Definition: LaserSorter.cc:734
static const int ecalDccFedIdMax_
Definition: LaserSorter.h:304
void LaserSorter::streamFileName ( int  fedId,
edm::LuminosityBlockNumber_t  lumiBlock,
std::string &  tmpName,
std::string &  finalName 
)
private

Builds the file names for the group of event corresponding to a FED and a starting lumi block.

Parameters
fedIdFED ID of the event set
lumiBlockstarting luminoisty block of the event set
[out]tmpNamename of the file to use when filling it.
[out]finalNamename of the file once completed.

Definition at line 734 of file LaserSorter.cc.

References gather_cfg::cout, dir, ecalDccFedIdMax_, ecalDccFedIdMin_, edm::hlt::Exception, fedSubDirs_, convertXMLtoSQLite_cfg::fileName, now(), outputDir_, runNumber_, and verbosity_.

Referenced by createOutStream(), and restoreStreamsOfLumiBlock().

736  {
737  int iFed;
738  if(fedId >= ecalDccFedIdMin_ && fedId <= ecalDccFedIdMax_){
739  iFed = fedId - ecalDccFedIdMin_ + 1;
740  } else if(fedId < 0){
741  iFed = -1; //event w/o ECAL data
742  } else {
743  iFed = 0;
744  }
745  if(iFed < -1 || iFed >= (int)fedSubDirs_.size()){
746  throw cms::Exception("LaserSorter")
747  << "Bug found at " << __FILE__ << ":" << __LINE__
748  << ". FED ID is out of index!";
749  }
750 
751 
752  struct stat fileStat;
753 
754  stringstream buf;
755  buf << outputDir_ << "/"
756  << (iFed<0 ? "Empty" : fedSubDirs_[iFed]);
757 
758  string dir = buf.str();
759  if(0==stat(dir.c_str(), &fileStat)){
760  if(!S_ISDIR(fileStat.st_mode)){
761  throw cms::Exception("[LaserSorter]")
762  << "File " << dir << " exists but is not a directory "
763  << " as expected.";
764  }
765  } else {//directory does not exists, let's try to create it
766  if(0!=mkdir(dir.c_str(), 0755)){
767  throw cms::Exception("[LaserSorter]")
768  << "Failed to create directory " << dir
769  << " for writing data.";
770  }
771  }
772 
773  buf.str("");
774  buf << "Run" << runNumber_
775  << "_LB" << setfill('0') << setw(4) << lumiBlock
776  << ".lmf";
777  string fileName = buf.str();
778  string tmpFileName = fileName + ".part";
779 
780  finalName = dir + "/" + fileName;
781  tmpName = dir + "/" + tmpFileName;
782 
783  if(verbosity_>3) cout << "[LaserSorter " << now() << "] " << "File path: "
784  << finalName << "\n";
785 }
static const int ecalDccFedIdMin_
Definition: LaserSorter.h:300
edm::RunNumber_t runNumber_
Definition: LaserSorter.h:345
std::vector< std::string > fedSubDirs_
Definition: LaserSorter.h:333
std::string outputDir_
Definition: LaserSorter.h:329
static const int ecalDccFedIdMax_
Definition: LaserSorter.h:304
static std::string now()
Definition: LaserSorter.cc:64
tuple cout
Definition: gather_cfg.py:121
dbl *** dir
Definition: mlp_gen.cc:35
std::string LaserSorter::toString ( uint64_t  t)
staticprivate

Help function to format a date

Definition at line 1076 of file LaserSorter.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by writeEventHeader().

1076  {
1077  char buf[256];
1078 
1079  time_t tsec = t>>32;
1080 
1081  uint32_t tusec = t & 0xFFFFFFFF;
1082  strftime(buf, sizeof(buf), "%F %R %S s", localtime(&tsec));
1083  buf[sizeof(buf)-1] = 0;
1084 
1085  stringstream buf2;
1086  buf2 << (tusec+500)/1000;
1087 
1088  return string(buf) + " " + buf2.str() + " ms";
1089 }
bool LaserSorter::writeEvent ( OutStreamRecord out,
const edm::Event event,
int  detailedTriggerType,
const FEDRawDataCollection data 
)
private

Writes a monitoring events to an output stream.

Parameters
outstream to write the event out
eventEDM event, used to retrieve meta information like timestamp and ID.
IDof the unique FED block of the event
dataDCC data
Returns
true on success, false on failure
See Also
getStream(int, edm::LuminosityBlockNumber_t)

Definition at line 456 of file LaserSorter.cc.

References FEDRawDataCollection::FEDData(), getOutputFedList(), LaserSorter::OutStreamRecord::indices(), LaserSorter::OutStreamRecord::out(), dbtoconf::out, edm::Event::size(), writeEventHeader(), and writeFedBlock().

Referenced by analyze().

458  {
459 
460  ofstream& out = *outRcd.out();
461  bool rc = true;
462  vector<unsigned> fedIds;
463  getOutputFedList(event, data, fedIds);
464 
465  out.clear();
466  uint32_t evtStart = out.tellp();
467  if(out.bad()) evtStart = 0;
468  // cout << "------> fedIds.size() = " << fedIds.size() << endl;
469  rc &= writeEventHeader(out, event, dtt, fedIds.size());
470 
471  for(unsigned iFed = 0; iFed < fedIds.size() && rc; ++iFed){
472 // cout << "------> data.FEDData(" << fedIds[iFed] << ").size = "
473 // << data.FEDData(fedIds[iFed]).size() << "\n";
474  rc &= writeFedBlock(out, data.FEDData(fedIds[iFed]));
475  }
476 
477  if(rc){
478  //update index table for this file:
479  vector<IndexRecord>& indices = *outRcd.indices();
480  IndexRecord indexRcd = {event.orbitNumber(), evtStart};
481  indices.push_back(indexRcd);
482  }
483  return rc;
484 }
size_t size() const
Definition: Event.cc:185
void getOutputFedList(const edm::Event &event, const FEDRawDataCollection &data, std::vector< unsigned > &fedIds) const
Definition: LaserSorter.cc:888
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
bool writeFedBlock(std::ofstream &out, const FEDRawData &data)
Definition: LaserSorter.cc:486
tuple out
Definition: dbtoconf.py:99
bool writeEventHeader(std::ofstream &out, const edm::Event &evt, int fedId, unsigned nFeds)
Definition: LaserSorter.cc:697
bool LaserSorter::writeEventHeader ( std::ofstream &  out,
const edm::Event evt,
int  fedId,
unsigned  nFeds 
)
private

Write event header with event identification and timestamp.

Parameters
outoutput stream to write to
evtevent
Returns
false in case of write failure

Definition at line 697 of file LaserSorter.cc.

References edm::EventBase::bunchCrossing(), colorNames, gather_cfg::cout, data, TauDecayModes::dec, detailedTrigNames, edm::EventID::event(), edm::EventBase::id(), edm::EventBase::luminosityBlock(), now(), edm::EventBase::orbitNumber(), edm::Event::run(), edm::EventBase::time(), toString(), edm::Timestamp::value(), and verbosity_.

Referenced by writeEvent().

700  {
701  uint32_t data[10];
702 
703  data[0] = evt.time().value() & 0xFFFFFFFF;
704  data[1] = evt.time().value() >>32;
705  data[2] = evt.luminosityBlock();
706  data[3] = evt.run();
707  data[4] = evt.orbitNumber();
708  data[5] = evt.bunchCrossing();
709  data[6] = evt.id().event();
710  data[7] = dtt;
711  data[8] = nFeds;
712  data[9] = 0; //reserved (to be aligned on 64-bits)
713 
714  if(verbosity_>1){
715  cout << "[LaserSorter " << now() << "] " << "Write header of event: "
716  << "Time: " << toString(evt.time().value())
717  << ", LB: " << evt.luminosityBlock()
718  << ", Run: " << evt.run()
719  << ", Bx: " << evt.bunchCrossing()
720  << ", Event ID: " << evt.id().event()
721  << ", Detailed trigger type: 0x" << hex << dtt << dec
722  << " (" << detailedTrigNames[(dtt>>8)&0x7] << ", "
723  << colorNames[(dtt>>6)&0x3] << ", DCC " << (dtt&0x3f)
724  << ", side " << ((dtt>>10) &0x1) << ")"
725  << ", number of FEDs: " << nFeds
726  << "\n";
727  }
728 
729  out.clear();
730  out.write((char*)data, sizeof(data));
731  return !out.bad();
732 }
EventNumber_t event() const
Definition: EventID.h:41
static const char *const detailedTrigNames[]
Definition: LaserSorter.cc:43
static std::string toString(uint64_t t)
int bunchCrossing() const
Definition: EventBase.h:62
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
RunNumber_t run() const
Definition: Event.h:85
int orbitNumber() const
Definition: EventBase.h:63
tuple out
Definition: dbtoconf.py:99
static std::string now()
Definition: LaserSorter.cc:64
edm::EventID id() const
Definition: EventBase.h:56
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
tuple cout
Definition: gather_cfg.py:121
static const char *const colorNames[]
Definition: LaserSorter.cc:54
TimeValue_t value() const
Definition: Timestamp.h:56
edm::Timestamp time() const
Definition: EventBase.h:57
bool LaserSorter::writeFedBlock ( std::ofstream &  out,
const FEDRawData data 
)
private

Writes out data of a FED

Parameters
outstream to write the event out
dataFED data
Returns
true on success, false on failure

Definition at line 486 of file LaserSorter.cc.

References gather_cfg::cout, FEDRawData::data(), edm::hlt::Exception, now(), FEDRawData::size(), and verbosity_.

Referenced by writeEvent().

487  {
488  bool rc = false;
489  if (data.size()>4){
490  const uint32_t * pData
491  = reinterpret_cast<uint32_t*>(const_cast<unsigned char*> ( data.data()));
492 
493  uint32_t dccLen64 = pData[2] & 0x00FFFFFF; //in 32-byte unit
494 
495  if(data.size() != dccLen64*sizeof(uint64_t)){
496 // throw cms::Exception("Bug") << "Bug found in "
497 // << __FILE__ << ":" << __LINE__ << ".";
498  throw cms::Exception("LaserSorter")
499  << "Mismatch between FED fragment size indicated in header "
500  << "(" << dccLen64 << "*8 Byte) "
501  << "and actual size (" << data.size() << " Byte) "
502  << "for FED ID " << ((pData[0] >>8) & 0xFFF) << "!\n";
503  }
504 
505  if(verbosity_>3) cout << "[LaserSorter " << now() << "] " << "Event fragment size: "
506  << data.size() << " Byte"
507  << "\t From Dcc header: " << dccLen64*8 << " Byte\n";
508 
509  const size_t nBytes = data.size();
510  // cout << "[LaserSorter " << now() << "] "
511  // << "Writing " << nBytes << " byte from adress "
512  // << (void*) data.data() << " to file.\n";
513  if(out.fail()) cout << "[LaserSorter " << now() << "] " << "Problem with stream!\n";
514  out.write((char*)data.data(), nBytes);
515  rc = true;
516  } else{
517  throw cms::Exception("Bug") << "Bug found in "
518  << __FILE__ << ":" << __LINE__ << ".\n";
519  }
520  return rc;
521 }
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
tuple out
Definition: dbtoconf.py:99
unsigned long long uint64_t
Definition: Time.h:15
static std::string now()
Definition: LaserSorter.cc:64
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
tuple cout
Definition: gather_cfg.py:121
void LaserSorter::writeFileHeader ( std::ofstream &  out)
private

Writing file header for an LMF binary file

Parameters
outstream of the output file

Definition at line 680 of file LaserSorter.cc.

References edm::hlt::Exception, and formatVersion_.

Referenced by createOutStream().

680  {
681  out.clear();
682 
683  uint32_t id = 'L' | ('M' <<8) | ('F' <<16) | (formatVersion_<<24);
684 
685  out.write((char*)&id, sizeof(uint32_t));
686 
687  //index position (to be filled at end of writing)
688  uint32_t zero = 0;
689  out.write((char*)&zero, sizeof(uint32_t));
690 
691  if(out.fail()){
692  throw cms::Exception("LaserSorter")
693  << "Failed to write file header.\n";
694  }
695 }
unsigned char formatVersion_
Definition: LaserSorter.h:325
tuple out
Definition: dbtoconf.py:99
bool LaserSorter::writeIndexTable ( std::ofstream &  out,
std::vector< IndexRecord > &  indices 
)
private

Writes index table in LMF output file. stream must be positionned to the place for the index table (end of file).

Parameters
outstream of output file.
indicesindex table

Definition at line 929 of file LaserSorter.cc.

References data, end, i, indexOffset32_, jetmet_cfg::nevts, and python.multivaluedict::sort().

Referenced by closeOutStream().

930  {
931  uint32_t indexTablePos = out.tellp();
932  uint32_t nevts = indices.size();
933 
934  out.clear();
935  out.write((char*)&nevts, sizeof(nevts));
936  const uint32_t reserved = 0;
937  out.write((char*)&reserved, sizeof(reserved));
938 
939  if(out.bad()) return false;
940 
941  sort(indices.begin(), indices.end());
942 
943  for(unsigned i = 0; i < indices.size(); ++i){
944  uint32_t data[2];
945  data[0] = indices[i].orbit;
946  data[1] = indices[i].filePos;
947  out.write((char*)data, sizeof(data));
948  }
949 
950  if(out.bad()) return false; //intial 0 valur for index table position
951  // is left to indicate corrupted table.
952 
953  //writes index table position:x
954  out.clear();
955  out.seekp(indexOffset32_*sizeof(uint32_t));
956  // cout << "[LaserSorter] Index table position: 0x" << hex << indexTablePos
957  // << dec << "\n";
958  if(!out.bad()) out.write((char*)&indexTablePos, sizeof(uint32_t));
959 
960  bool rc = !out.bad();
961 
962  //reposition pointer to eof:
963  out.seekp(0, ios::end);
964 
965  return rc;
966 }
int i
Definition: DBlmapReader.cc:9
static const int indexOffset32_
Definition: LaserSorter.h:433
#define end
Definition: vmac.h:37
tuple out
Definition: dbtoconf.py:99
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int nevts
Definition: jetmet_cfg.py:3

Member Data Documentation

int LaserSorter::detailedTrigType_
private

Trigger type of calibration event. -1 if unkown.

Definition at line 308 of file LaserSorter.h.

Referenced by analyze().

bool LaserSorter::disableOutput_
private

Switch to disable writing output file (for test purpose).

Definition at line 341 of file LaserSorter.h.

Referenced by analyze().

bool LaserSorter::doOutputList_
private

Switch for logging paths of the output files

Definition at line 365 of file LaserSorter.h.

Referenced by closeOutStream(), and LaserSorter().

const int LaserSorter::ecalDccFedIdMax_ = 654
staticprivate
const int LaserSorter::ecalDccFedIdMin_ = 601
staticprivate

Lower bound of ECAL DCC FED ID

Definition at line 300 of file LaserSorter.h.

Referenced by analyze(), getDetailedTriggerType(), getFullyReadoutDccs(), getOutputFedList(), restoreStreamsOfLumiBlock(), and streamFileName().

edm::InputTag LaserSorter::fedRawDataCollectionTag_
private

Definition at line 425 of file LaserSorter.h.

Referenced by analyze().

std::vector<std::string> LaserSorter::fedSubDirs_
private

Subdirectories for output file of each FED

Definition at line 333 of file LaserSorter.h.

Referenced by LaserSorter(), and streamFileName().

unsigned char LaserSorter::formatVersion_
private

Data format version of lmf output file

Definition at line 325 of file LaserSorter.h.

Referenced by createOutStream(), and writeFileHeader().

const int LaserSorter::indexOffset32_ = 1
staticprivate

Definition at line 433 of file LaserSorter.h.

Referenced by writeIndexTable().

int LaserSorter::iNoEcalDataMess_
private

number of "ECAL DCC data" message in a run

Definition at line 406 of file LaserSorter.h.

Referenced by analyze(), and getDetailedTriggerType().

int LaserSorter::iNoFullReadoutDccError_
private

Number of "No fully readout DCC error"

Definition at line 396 of file LaserSorter.h.

Referenced by analyze().

std::ofstream LaserSorter::logFile_
private

File for logging

Definition at line 312 of file LaserSorter.h.

Referenced by analyze(), LaserSorter(), and ~LaserSorter().

edm::LuminosityBlockNumber_t LaserSorter::lumiBlock_
private

Luminosity block of event under processing

Definition at line 316 of file LaserSorter.h.

Referenced by analyze().

int LaserSorter::lumiBlockSpan_
private

Tolerance on lumi block spanning of a FED sequence. Subsequent events of a same FED must span at most on 2*lumiBlockSpan_+1 luminosity blocks.

  • It is important that the laser sequence scane does not pass twice on the same FED within the 2*lumiBlockSpan_+1. Failing this requirement will result mixing event of different passes in the same output file.
  • The number of input files opened simultinuously is proportional to 2*lumiBlockSpan_+1. So increasing lumiBlockSpan_ will also increase the number of opened files and may have some impact of sorting time performances.

Definition at line 423 of file LaserSorter.h.

Referenced by analyze(), closeOldStreams(), and getStream().

const int LaserSorter::matacqFedId_ = 655
staticprivate

FED ID associated to Matacq data

Definition at line 429 of file LaserSorter.h.

Referenced by getOutputFedList().

const unsigned LaserSorter::maxEvents_ = 1<<20
staticprivate

Limit of number of events to prevent exhausting memory with indexTable_ in case of file corruption.

Definition at line 438 of file LaserSorter.h.

Referenced by readIndexTable().

int LaserSorter::maxFullReadoutDccError_
private

Maximum number of "No fully readout DCC error" message in a run

Definition at line 401 of file LaserSorter.h.

Referenced by analyze().

int LaserSorter::maxNoEcalDataMess_
private

Maximum number of "ECAL DCC data" message in a run

Definition at line 410 of file LaserSorter.h.

Referenced by getDetailedTriggerType().

std::string LaserSorter::outputDir_
private

Top directory for output files

Definition at line 329 of file LaserSorter.h.

Referenced by LaserSorter(), batchmanager.BatchManager::PrepareJob(), valtools.webpage::readCaptions(), and streamFileName().

std::ofstream LaserSorter::outputList_
private

stream where list of output file is listed to

Definition at line 373 of file LaserSorter.h.

Referenced by closeOutStream(), and LaserSorter().

std::string LaserSorter::outputListFile_
private

name of file where list of output file is listed to

Definition at line 361 of file LaserSorter.h.

Referenced by LaserSorter().

OutStreamList LaserSorter::outStreamList_
private

List of output stream to write sorted data

Definition at line 321 of file LaserSorter.h.

Referenced by closeAllStreams(), closeOldStreams(), closeOutStream(), createOutStream(), and getStream().

edm::RunNumber_t LaserSorter::runNumber_
private

Run number of event under process

Definition at line 345 of file LaserSorter.h.

Referenced by analyze(), and streamFileName().

struct LaserSorter::stats_t LaserSorter::stats_
private

Referenced by analyze(), and ~LaserSorter().

LaserSorter::stats_t LaserSorter::stats_init = {0, 0, 0, 0, 0}
staticprivate

Definition at line 456 of file LaserSorter.h.

std::ofstream LaserSorter::timeLog_
private

Output stream to log code timing

Definition at line 353 of file LaserSorter.h.

Referenced by analyze(), and LaserSorter().

std::string LaserSorter::timeLogFile_
private

Name of the file to log the processing time

Definition at line 337 of file LaserSorter.h.

Referenced by LaserSorter().

timeval LaserSorter::timer_
private

Buffer for timing

Definition at line 349 of file LaserSorter.h.

Referenced by analyze(), and LaserSorter().

bool LaserSorter::timing_
private

Switch for code timing.

Definition at line 357 of file LaserSorter.h.

Referenced by analyze(), and LaserSorter().

int LaserSorter::verbosity_
private