CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/L1Trigger/HardwareValidation/interface/L1Comparator.h

Go to the documentation of this file.
00001 #ifndef L1COMPARATOR_H
00002 #define L1COMPARATOR_H
00003 
00004 /*\class L1Comparator
00005  *\description L1 trigger data|emulation comparison and validation
00006  *\author Nuno Leonardo (CERN)
00007  *\date 07.02
00008  */
00009 
00010 // common/system includes
00011 #include <memory>
00012 #include <string>
00013 #include <iostream>
00014 #include <fstream>
00015 #include <iomanip>
00016 #include <vector>
00017 #include <algorithm>
00018 #include "FWCore/ServiceRegistry/interface/Service.h"
00019 #include "FWCore/Framework/interface/Frameworkfwd.h"
00020 #include "FWCore/Framework/interface/EDProducer.h"
00021 #include "FWCore/Framework/interface/Event.h"
00022 #include "FWCore/Framework/interface/MakerMacros.h"
00023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00024 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00025 
00026 // l1 dataformats, d|e record includes
00027 #include "L1Trigger/HardwareValidation/interface/DEtrait.h"
00028 
00029 // comparator template
00030 #include "L1Trigger/HardwareValidation/interface/DEcompare.h"
00031 
00032 // extra
00033 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00034 
00035 // db trigger/subsystem key access
00036 #include "CondFormats/L1TObjects/interface/L1TriggerKey.h"         
00037 //#include "CondFormats/L1TObjects/interface/L1TriggerKeyList.h"   
00038 #include "CondFormats/DataRecord/interface/L1TriggerKeyRcd.h"      
00039 //#include "CondFormats/DataRecord/interface/L1TriggerKeyListRcd.h"
00040 
00041 template <class T> class DEcompare;
00042 
00043 class L1Comparator : public edm::EDProducer {
00044 
00045 public:
00046 
00047   explicit L1Comparator(const edm::ParameterSet&);
00048   ~L1Comparator();
00049   
00050 private:
00051 
00052   virtual void beginJob(void);
00053   virtual void beginRun(edm::Run&, const edm::EventSetup&);
00054    virtual void produce (edm::Event&, const edm::EventSetup&);
00055   virtual void endJob();
00056 
00057   template <class T> 
00058     void process( T const*, T const*, const int, const int);
00059   template <class T> 
00060     void process(const edm::Handle<T> data, const edm::Handle<T> emul, 
00061                  const int sys, const int cid) {
00062     if(data.isValid()&&emul.isValid())
00063       process(data.product(),emul.product(),sys, cid);
00064   }
00065 
00066   // gt, fedraw, extra
00067   bool compareCollections(edm::Handle<L1GlobalTriggerReadoutRecord>   data, 
00068                           edm::Handle<L1GlobalTriggerReadoutRecord>   emul);
00069   bool compareCollections(edm::Handle<L1GlobalTriggerEvmReadoutRecord>data, 
00070                           edm::Handle<L1GlobalTriggerEvmReadoutRecord>emul);
00071   bool compareCollections(edm::Handle<L1GlobalTriggerObjectMapRecord> data, 
00072                           edm::Handle<L1GlobalTriggerObjectMapRecord> emul);
00073   bool compareFedRawCollections(edm::Handle<FEDRawDataCollection>     data, 
00074                                 edm::Handle<FEDRawDataCollection>     emul, int fedid);
00075   template <class T> bool CompareCollections(edm::Handle<T> data, edm::Handle<T> emul);
00076   template <class T> bool dumpCandidate(const T& dt, const T& em, std::ostream& s);
00077 
00078   int verbose() {return verbose_;}
00079 
00080  private:
00081 
00082   int nevt_;
00083   int evtNum_;
00084   int runNum_;
00085   int verbose_;
00086   bool dumpEvent_;
00087 
00088   edm::InputTag m_DEsource[dedefs::DEnsys][4];
00089   bool m_doSys[dedefs::DEnsys];
00090   std::string m_dumpFileName;
00091   std::ofstream m_dumpFile;
00092   int m_dumpMode;
00093   bool m_match;
00094   bool DEmatchEvt[dedefs::DEnsys]; 
00095   int DEncand[dedefs::DEnsys][2];
00096   L1DEDigiCollection m_dedigis;
00097 
00098   int m_fedId;
00099   edm::InputTag m_FEDsource[2];
00100 
00101 };
00102 
00103 #endif