CMS 3D CMS Logo

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

#include <L1Comparator.h>

Inheritance diagram for L1Comparator:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

template<class myCol >
bool CompareCollections (edm::Handle< myCol > data, edm::Handle< myCol > emul)
 
 L1Comparator (const edm::ParameterSet &)
 
 ~L1Comparator ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual void beginJob (void)
 
virtual void beginRun (edm::Run &, const edm::EventSetup &)
 
bool compareCollections (edm::Handle< L1GlobalTriggerReadoutRecord > data, edm::Handle< L1GlobalTriggerReadoutRecord > emul)
 
bool compareCollections (edm::Handle< L1GlobalTriggerEvmReadoutRecord >data, edm::Handle< L1GlobalTriggerEvmReadoutRecord >emul)
 
bool compareCollections (edm::Handle< L1GlobalTriggerObjectMapRecord > data, edm::Handle< L1GlobalTriggerObjectMapRecord > emul)
 
template<class T >
bool CompareCollections (edm::Handle< T > data, edm::Handle< T > emul)
 
bool compareFedRawCollections (edm::Handle< FEDRawDataCollection > data, edm::Handle< FEDRawDataCollection > emul, int fedid)
 
template<class T >
bool dumpCandidate (const T &dt, const T &em, std::ostream &s)
 
virtual void endJob ()
 
template<class T >
void process (T const *, T const *, const int, const int)
 
template<class T >
void process (const edm::Handle< T > data, const edm::Handle< T > emul, const int sys, const int cid)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
int verbose ()
 

Private Attributes

bool DEmatchEvt [dedefs::DEnsys]
 
int DEncand [dedefs::DEnsys][2]
 
bool dumpEvent_
 
int evtNum_
 
L1DEDigiCollection m_dedigis
 
edm::InputTag m_DEsource [dedefs::DEnsys][4]
 
bool m_doSys [dedefs::DEnsys]
 
std::ofstream m_dumpFile
 
std::string m_dumpFileName
 
int m_dumpMode
 
int m_fedId
 
edm::InputTag m_FEDsource [2]
 
bool m_match
 
int nevt_
 
int runNum_
 
int verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 43 of file L1Comparator.h.

Constructor & Destructor Documentation

L1Comparator::L1Comparator ( const edm::ParameterSet iConfig)
explicit

assertions/temporary

dump level: -1(all),0(none),1(disagree),2(loc.disagree),3(loc.agree)

create d|e record product

Definition at line 6 of file L1Comparator.cc.

References gather_cfg::cout, dedefs::CTF, dedefs::CTP, dedefs::DEnsys, dedefs::DTF, dedefs::DTP, dedefs::ETP, edm::hlt::Exception, dedefs::GCT, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), dedefs::GLT, dedefs::GMT, dedefs::HTP, i, j, dedefs::LTC, dbtoconf::out, dedefs::RCT, dedefs::RPC, dedefs::SystLabel, and validate_alignment_devdb10_cfg::verbose.

6  {
7 
8  verbose_ = iConfig.getUntrackedParameter<int>("VerboseFlag",0);
9 
10  if(verbose())
11  std::cout << "\nL1COMPARATOR constructor...\n" << std::flush;
12 
13  std::vector<unsigned int> dosys(0,DEnsys);
14  dosys =
15  iConfig.getUntrackedParameter<std::vector<unsigned int> >("COMPARE_COLLS", dosys);
16 
17  if((int)dosys.size()!=DEnsys)
18  edm::LogError("L1Comparator")
19  << "wrong selection of systems to be compared\n"
20  << "\t the size of the mask COMPARE_COLLS (" << dosys.size()
21  << ") is not " << DEnsys << std::endl;
22  assert((int)dosys.size()==DEnsys);
23 
24  for(int isys=0; isys<DEnsys; isys++)
25  if( dosys[isys]!=0 && dosys[isys]!=1 )
26  throw cms::Exception("Invalid configuration")
27  << "L1Comparator: comparison flag for system " << isys
28  << " is non boolean: " << dosys[isys] << ". Exiting.\n";
29 
30  for(int i=0; i<DEnsys; i++)
31  m_doSys[i] = dosys[i];
32 
33  if(verbose()) {
34  std::cout << "[L1Comparator] do sys? ";
35  for(int i=0; i<DEnsys; i++)
36  std::cout << m_doSys[i] << " ";
37  std::cout << std::endl;
38 
39  std::cout << "[L1Comparator] list of systems to process: ";
40  for(int i=0; i<DEnsys; i++)
41  if(m_doSys[i])
42  std::cout << SystLabel[i] << " ";
43  std::cout << std::endl;
44  }
45 
47  assert(ETP==0); assert(HTP==1); assert(RCT== 2); assert(GCT== 3);
48  assert(DTP==4); assert(DTF==5); assert(CTP== 6); assert(CTF== 7);
49  assert(RPC==8); assert(LTC==9); assert(GMT==10); assert(GLT==11);
50 
51  if(verbose())
52  std::cout << "[L1Comparator] debug print collection labels\n";
53 
54  m_DEsource[ETP][0] = iConfig.getParameter<edm::InputTag>("ETPsourceData");
55  m_DEsource[ETP][1] = iConfig.getParameter<edm::InputTag>("ETPsourceEmul");
56  m_DEsource[HTP][0] = iConfig.getParameter<edm::InputTag>("HTPsourceData");
57  m_DEsource[HTP][1] = iConfig.getParameter<edm::InputTag>("HTPsourceEmul");
58  m_DEsource[RCT][0] = iConfig.getParameter<edm::InputTag>("RCTsourceData");
59  m_DEsource[RCT][1] = iConfig.getParameter<edm::InputTag>("RCTsourceEmul");
60  m_DEsource[GCT][0] = iConfig.getParameter<edm::InputTag>("GCTsourceData");
61  m_DEsource[GCT][1] = iConfig.getParameter<edm::InputTag>("GCTsourceEmul");
62  m_DEsource[DTP][0] = iConfig.getParameter<edm::InputTag>("DTPsourceData");
63  m_DEsource[DTP][1] = iConfig.getParameter<edm::InputTag>("DTPsourceEmul");
64  m_DEsource[DTF][0] = iConfig.getParameter<edm::InputTag>("DTFsourceData");
65  m_DEsource[DTF][1] = iConfig.getParameter<edm::InputTag>("DTFsourceEmul");
66  m_DEsource[CTP][0] = iConfig.getParameter<edm::InputTag>("CTPsourceData");
67  m_DEsource[CTP][1] = iConfig.getParameter<edm::InputTag>("CTPsourceEmul");
68  m_DEsource[CTF][0] = iConfig.getParameter<edm::InputTag>("CTFsourceData");
69  m_DEsource[CTF][1] = iConfig.getParameter<edm::InputTag>("CTFsourceEmul");
70  m_DEsource[CTF][2] = iConfig.getParameter<edm::InputTag>("CTTsourceData");
71  m_DEsource[CTF][3] = iConfig.getParameter<edm::InputTag>("CTTsourceEmul");
72  m_DEsource[RPC][0] = iConfig.getParameter<edm::InputTag>("RPCsourceData");
73  m_DEsource[RPC][1] = iConfig.getParameter<edm::InputTag>("RPCsourceEmul");
74  m_DEsource[LTC][0] = iConfig.getParameter<edm::InputTag>("LTCsourceData");
75  m_DEsource[LTC][1] = iConfig.getParameter<edm::InputTag>("LTCsourceEmul");
76  m_DEsource[GMT][0] = iConfig.getParameter<edm::InputTag>("GMTsourceData");
77  m_DEsource[GMT][1] = iConfig.getParameter<edm::InputTag>("GMTsourceEmul");
78  m_DEsource[GLT][0] = iConfig.getParameter<edm::InputTag>("GLTsourceData");
79  m_DEsource[GLT][1] = iConfig.getParameter<edm::InputTag>("GLTsourceEmul");
80 
81  for(int sys=0; sys<DEnsys; sys++) {
82  std::string data_label = SystLabel[sys] + "sourceData";
83  std::string emul_label = SystLabel[sys] + "sourceEmul";
84  //m_DEsource[sys][0] = iConfig.getParameter<edm::InputTag>(data_label);
85  //m_DEsource[sys][1] = iConfig.getParameter<edm::InputTag>(emul_label);
86  //if(sys==CTF) {
87  // std::string data_label(""); data_label+="CTTsourceData";
88  // std::string emul_label(""); emul_label+="CTTsourceEmul";
89  // m_DEsource[sys][2] = iConfig.getParameter<edm::InputTag>(data_label);
90  // m_DEsource[sys][3] = iConfig.getParameter<edm::InputTag>(emul_label);
91  //}
92  if(m_doSys[sys] && verbose()) {
93  std::cout << " sys:" << sys << " label:" << SystLabel[sys]
94  << "\n\tdt:" << data_label << " : " <<m_DEsource[sys][0]
95  << "\n\tem:" << emul_label << " : " <<m_DEsource[sys][1]
96  << std::endl;
97  if(sys==CTF) {
98  std::cout << "\tdt:" << data_label << " : " <<m_DEsource[sys][2]
99  << "\n\tem:" << emul_label << " : " <<m_DEsource[sys][3]
100  << std::endl;
101  }
102  }
103  }
104 
105 
106  m_fedId = iConfig.getUntrackedParameter<int>("FEDid", 0);
107  m_FEDsource[0] =
108  iConfig.getUntrackedParameter<edm::InputTag>("FEDsourceData",edm::InputTag());
109  m_FEDsource[1] =
110  iConfig.getUntrackedParameter<edm::InputTag>("FEDsourceEmul",edm::InputTag());
111 
112 
114  m_dumpMode = iConfig.getUntrackedParameter<int>("DumpMode",0);
115  m_dumpFileName = iConfig.getUntrackedParameter<std::string>("DumpFile","");
116  if(m_dumpMode) {
117  m_dumpFile.open(m_dumpFileName.c_str(), std::ios::out);
118  if(!m_dumpFile.good())
119  edm::LogInfo("L1ComparatorDumpFileOpenError")
120  << " L1Comparator::L1Comparator() : "
121  << " couldn't open dump file " << m_dumpFileName.c_str() << std::endl;
122  }
123 
124  m_match = true;
125  dumpEvent_ = true;
126  nevt_=-1;
127 
128  for(int i=0; i<DEnsys; i++) {
129  for(int j=0; j<2; j++)
130  DEncand[i][j] = 0;
131  DEmatchEvt[i] = true;
132  }
133 
134  m_dedigis.clear();
136  produces<L1DataEmulRecord>().setBranchAlias("L1DataEmulRecord");
137 
138  if(verbose())
139  std::cout << "\nL1Comparator constructor...done.\n" << std::flush;
140 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
const int DEnsys
Definition: DEtrait.h:38
int DEncand[dedefs::DEnsys][2]
Definition: L1Comparator.h:95
std::string m_dumpFileName
Definition: L1Comparator.h:90
edm::InputTag m_FEDsource[2]
Definition: L1Comparator.h:99
edm::InputTag m_DEsource[dedefs::DEnsys][4]
Definition: L1Comparator.h:88
int j
Definition: DBlmapReader.cc:9
tuple out
Definition: dbtoconf.py:99
bool DEmatchEvt[dedefs::DEnsys]
Definition: L1Comparator.h:94
const std::string SystLabel[DEnsys]
Definition: DEtrait.h:45
L1DEDigiCollection m_dedigis
Definition: L1Comparator.h:96
std::ofstream m_dumpFile
Definition: L1Comparator.h:91
tuple cout
Definition: gather_cfg.py:121
bool m_doSys[dedefs::DEnsys]
Definition: L1Comparator.h:89
L1Comparator::~L1Comparator ( )

Definition at line 143 of file L1Comparator.cc.

143 {}

Member Function Documentation

void L1Comparator::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 145 of file L1Comparator.cc.

145 {}
void L1Comparator::beginRun ( edm::Run iRun,
const edm::EventSetup iSetup 
)
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 147 of file L1Comparator.cc.

References gather_cfg::cout, dedefs::CTF, dedefs::DTF, dedefs::GCT, edm::EventSetup::get(), dedefs::GLT, dedefs::GMT, L1TriggerKey::kCSCTF, L1TriggerKey::kDTTF, L1TriggerKey::kGCT, L1TriggerKey::kGMT, L1TriggerKey::kGT, L1TriggerKey::kRCT, L1TriggerKey::kRPC, dedefs::RCT, dedefs::RPC, and validate_alignment_devdb10_cfg::verbose.

147  {
148 
149  if(verbose())
150  std::cout << "\nL1COMPARATOR beginRun...\n" << std::flush;
151 
152 
153  // disable subsystem if not included in current run configuration
154  try
155  {
157  iSetup.get< L1TriggerKeyRcd >().get( pKey ) ;
158 
159  m_doSys[RCT] &= (!(pKey->subsystemKey( L1TriggerKey::kRCT) .empty()));
160  m_doSys[GCT] &= (!(pKey->subsystemKey( L1TriggerKey::kGCT) .empty()));
161  m_doSys[DTF] &= (!(pKey->subsystemKey( L1TriggerKey::kDTTF) .empty()));
162  m_doSys[CTF] &= (!(pKey->subsystemKey( L1TriggerKey::kCSCTF).empty()));
163  m_doSys[RPC] &= (!(pKey->subsystemKey( L1TriggerKey::kRPC) .empty()));
164  m_doSys[GMT] &= (!(pKey->subsystemKey( L1TriggerKey::kGMT) .empty()));
165  m_doSys[GLT] &= (!(pKey->subsystemKey( L1TriggerKey::kGT) .empty()));
166 
167  if(verbose()) {
168  if ( pKey->subsystemKey( L1TriggerKey::kRCT ).empty() )
169  std::cout << "RCT key is empty. Sub-systems is disabled ("<<m_doSys[RCT]<<")\n";
170  if ( pKey->subsystemKey( L1TriggerKey::kGCT ).empty() )
171  std::cout << "GCT key is empty. Sub-systems is disabled ("<<m_doSys[GCT]<<")\n";
172  if ( pKey->subsystemKey( L1TriggerKey::kDTTF ).empty() )
173  std::cout << "DTTF key is empty. Sub-systems is disabled ("<<m_doSys[DTF]<<")\n";
174  if ( pKey->subsystemKey( L1TriggerKey::kCSCTF).empty() )
175  std::cout << "CSCTF key is empty. Sub-systems is disabled ("<<m_doSys[CTF]<<")\n";
176  if ( pKey->subsystemKey( L1TriggerKey::kRPC ).empty() )
177  std::cout << "RPC key is empty. Sub-systems is disabled ("<<m_doSys[RPC]<<")\n";
178  if ( pKey->subsystemKey( L1TriggerKey::kGMT ).empty() )
179  std::cout << "GMT key is empty. Sub-systems is disabled ("<<m_doSys[GMT]<<")\n";
180  if ( pKey->subsystemKey( L1TriggerKey::kGT ).empty() )
181  std::cout << "GT key is empty. Sub-systems is disabled ("<<m_doSys[GLT]<<")\n";
182  std::cout << "TSC key = " << pKey->tscKey() << std::endl;
183  }
184 
185  //access subsystem key if needed, eg:
186  //std::cout << "RCT key:" << pKey->subsystemKey( L1TriggerKey::kRCT ) << std::endl;
187  }
188  catch( cms::Exception& ex )
189  {
190  edm::LogWarning("L1Comparator")
191  << "No L1TriggerKey found."
192  << std::endl;
193  }
194 
195  if(verbose())
196  std::cout << "L1COMPARATOR beginRun... done\n" << std::flush;
197 
198 }
const T & get() const
Definition: EventSetup.h:55
tuple cout
Definition: gather_cfg.py:121
bool m_doSys[dedefs::DEnsys]
Definition: L1Comparator.h:89
bool L1Comparator::compareCollections ( edm::Handle< L1GlobalTriggerReadoutRecord data,
edm::Handle< L1GlobalTriggerReadoutRecord emul 
)
private

todo: skip empty events

todo printL1Objects!

debug: print it all ()

Definition at line 1089 of file L1Comparator.cc.

References gather_cfg::cout, i, match(), convertSQLiteXML::ok, edm::Handle< T >::product(), and validate_alignment_devdb10_cfg::verbose.

1090  {
1091 
1092  if(verbose())
1093  std::cout << "L1Comparator -- result of GT embedded comparison.\n"
1094  << "L1GlobalTriggerReadoutRecord:: data and emulator agree? "
1095  << ((*data==*emul)?"yes":"no")
1096  << std::endl;
1097 
1098  m_dumpFile << "\n L1GlobalTriggerReadoutRecord candidates...\n";
1099 
1100  bool thematch = true;
1101 
1102  thematch &= (*data==*emul);
1103 
1104  bool match = thematch;
1105 
1106  if(m_dumpMode==0 && match)
1107  return match;
1108 
1109  //expand to check mismatching stage
1110 
1111  //need to create new objects due to lack of suitable accessors
1112  // needed only for accessing gtPsbVector()
1113  std::auto_ptr<L1GlobalTriggerReadoutRecord>
1114  data_( new L1GlobalTriggerReadoutRecord(*(data.product())));
1115  std::auto_ptr<L1GlobalTriggerReadoutRecord>
1116  emul_( new L1GlobalTriggerReadoutRecord(*(emul.product())));
1117 
1118  match = true;
1119  m_dumpFile << "\tmatch stage: ";
1120  match &= (data->gtfeWord() == emul->gtfeWord() );
1121  m_dumpFile << " gtfeWord:" << match;
1122  match &= (data->gtFdlWord() == emul->gtFdlWord() );
1123  m_dumpFile << " gtFdlWord:" << match;
1124  match &= (data->muCollectionRefProd() == emul->muCollectionRefProd());
1125  m_dumpFile << " muCollectionRefProd:" << match << "\n";
1126  boost::uint16_t dt_psb_bid=0, em_psb_bid=0;
1127  size_t npsbw = (data_->gtPsbVector().size()>emul_->gtPsbVector().size())?
1128  emul_->gtPsbVector().size():data_->gtPsbVector().size();
1129  for(int idx=0; idx<(int)npsbw; idx++) {
1130  if(data_->gtPsbVector().at(idx) != emul_->gtPsbVector().at(idx) ) {
1131  //match &= false;
1132  dt_psb_bid = data_->gtPsbVector().at(idx).boardId();
1133  em_psb_bid = emul_->gtPsbVector().at(idx).boardId();
1134  break;
1135  }
1136  }
1137  match &= (data->gtPsbWord(dt_psb_bid) == emul->gtPsbWord(em_psb_bid) );
1138  //if(!match) {
1139  // m_dumpFile << " data"; data_->gtPsbWord(dt_psb_bid).print(m_dumpFile);
1140  // m_dumpFile << "\nemul"; emul_->gtPsbWord(em_psb_bid).print(m_dumpFile);
1141  //}
1142  //problem: vector not accessible from handle (only reference non-const)
1143  //std::vector<L1GtPsbWord>& data_psbVec = data_->gtPsbVector();
1144  //std::vector<L1GtPsbWord>& emul_psbVec = emul_->gtPsbVector();
1145  m_dumpFile << " gtPsbWord("<<dt_psb_bid<<","<<em_psb_bid<<"):" << match << "\n";
1146 
1148 
1149  // gt decision
1150  m_dumpFile << "\n\tGlobal decision: "
1151  << data->decision() << " (data) "
1152  << emul->decision() << " (emul) "
1153  << std::endl;
1154 
1155  // gt decision word
1156  m_dumpFile << "\n\tDecisionWord (bits: 63:0, 127:64)";
1157  int nbitword = 64;
1158  std::vector<bool> data_gtword = data->decisionWord();
1159  std::vector<bool> emul_gtword = emul->decisionWord();
1160  m_dumpFile << "\n\tdata: ";
1161  for(int i=0; i<nbitword; i++) {
1162  if (i%16==0) m_dumpFile << " ";
1163  m_dumpFile << (data_gtword.at(nbitword-1-i) ? '1' : '0');
1164  }
1165  m_dumpFile << "\n\t ";
1166  for(int i=0; i<nbitword; i++) {
1167  if (i%16==0) m_dumpFile << " ";
1168  m_dumpFile << (data_gtword.at(nbitword*2-1-i) ? '1' : '0');
1169  }
1170  m_dumpFile << "\n\temul: ";
1171  for(int i=0; i<nbitword; i++) {
1172  if (i%16==0) m_dumpFile << " ";
1173  m_dumpFile << (emul_gtword.at(nbitword-1-i) ? '1' : '0');
1174  }
1175  m_dumpFile << "\n\t ";
1176  for(int i=0; i<nbitword; i++) {
1177  if (i%16==0) m_dumpFile << " ";
1178  m_dumpFile << (emul_gtword.at(nbitword*2-1-i) ? '1' : '0');
1179  }
1180  m_dumpFile << std::endl;
1181 
1182  m_dumpFile << "\n\tDecisionWordExtended (bits: 0:63)";
1183  std::vector<bool> data_decwext = data->gtFdlWord().gtDecisionWordExtended();
1184  std::vector<bool> emul_decwext = emul->gtFdlWord().gtDecisionWordExtended();
1185  m_dumpFile << "\n\tdata: ";
1186  for(int i=0; i<nbitword; i++) {
1187  if (i%16==0) m_dumpFile << " ";
1188  m_dumpFile << (data_decwext.at(nbitword-1-i) ? '1' : '0');
1189  }
1190  m_dumpFile << "\n\temul: ";
1191  for(int i=0; i<nbitword; i++) {
1192  if (i%16==0) m_dumpFile << " ";
1193  m_dumpFile << (emul_decwext.at(nbitword-1-i) ? '1' : '0');
1194  }
1195  m_dumpFile << std::endl;
1196 
1197  m_dumpFile << "\n\tTechnical triggers (bits: 0:63)";
1198  std::vector<bool> data_fdlttw = data->gtFdlWord().gtTechnicalTriggerWord();
1199  std::vector<bool> emul_fdlttw = emul->gtFdlWord().gtTechnicalTriggerWord();
1200  assert((int)data_fdlttw.size()==nbitword);
1201  m_dumpFile << "\n\tdata: ";
1202  for(int i=0; i<nbitword; i++) {
1203  if (i%16==0) m_dumpFile << " ";
1204  m_dumpFile << (data_fdlttw.at(nbitword-1-i) ? '1' : '0');
1205  }
1206  m_dumpFile << "\n\temul: ";
1207  for(int i=0; i<nbitword; i++) {
1208  if (i%16==0) m_dumpFile << " ";
1209  m_dumpFile << (emul_fdlttw.at(nbitword-1-i) ? '1' : '0');
1210  }
1211  m_dumpFile << std::endl;
1212 
1213  m_dumpFile << "\n\tL1GtFdlWord";
1214  m_dumpFile << "\n\tdata: "
1215  << " BoardId:" << data->gtFdlWord().boardId()
1216  << " BxInEvent:" << data->gtFdlWord().bxInEvent()
1217  << " BxNr:" << data->gtFdlWord().bxNr()
1218  << " EventNr:" << data->gtFdlWord().eventNr()
1219  << " NoAlgo:" << data->gtFdlWord().noAlgo()
1220  << " FinalOR:" << data->gtFdlWord().finalOR()
1221  << " LocalBxNr:" << data->gtFdlWord().localBxNr();
1222  m_dumpFile << "\n\temul: "
1223  << " BoardId:" << emul->gtFdlWord().boardId()
1224  << " BxInEvent:" << emul->gtFdlWord().bxInEvent()
1225  << " BxNr:" << emul->gtFdlWord().bxNr()
1226  << " EventNr:" << emul->gtFdlWord().eventNr()
1227  << " NoAlgo:" << emul->gtFdlWord().noAlgo()
1228  << " FinalOR:" << emul->gtFdlWord().finalOR()
1229  << " LocalBxNr:" << emul->gtFdlWord().localBxNr()
1230  << std::endl;
1231 
1232  m_dumpFile << "\n\tL1GtfeWord";
1233  m_dumpFile << "\n\tdata: "
1234  << " BoardId:" << data->gtfeWord().boardId()
1235  << " RecordLength:" << data->gtfeWord().recordLength()
1236  << " BxNr:" << data->gtfeWord().bxNr()
1237  << " SetupVersion:" << data->gtfeWord().setupVersion()
1238  << " ActiveBoards:" << data->gtfeWord().activeBoards()
1239  << " TotalTriggerNr:" << data->gtfeWord().totalTriggerNr();
1240  m_dumpFile << "\n\temul: "
1241  << " BoardId:" << emul->gtfeWord().boardId()
1242  << " RecordLength:" << emul->gtfeWord().recordLength()
1243  << " BxNr:" << emul->gtfeWord().bxNr()
1244  << " SetupVersion:" << emul->gtfeWord().setupVersion()
1245  << " ActiveBoards:" << emul->gtfeWord().activeBoards()
1246  << " TotalTriggerNr:" << emul->gtfeWord().totalTriggerNr()
1247  << std::endl;
1248 
1249  //uint16_t psb_bid = (uint16_t)idx; //need to find relevant board-id to dump
1250  m_dumpFile << "\n\tgtPsbWord";
1251  m_dumpFile << "\n\tdata: "
1252  << " Board Id:" << data->gtPsbWord(dt_psb_bid).boardId()
1253  << " BxInEvent:" << data->gtPsbWord(dt_psb_bid).bxInEvent()
1254  << " BxNr:" << data->gtPsbWord(dt_psb_bid).bxNr()
1255  << " LocalBxNr:" << data->gtPsbWord(dt_psb_bid).localBxNr()
1256  << " EventNr:" << data->gtPsbWord(dt_psb_bid).eventNr();
1257  m_dumpFile << "\n\temul: "
1258  << " Board Id:" << emul->gtPsbWord(em_psb_bid).boardId()
1259  << " BxInEvent:" << emul->gtPsbWord(em_psb_bid).bxInEvent()
1260  << " BxNr:" << emul->gtPsbWord(em_psb_bid).bxNr()
1261  << " LocalBxNr:" << emul->gtPsbWord(em_psb_bid).localBxNr()
1262  << " EventNr:" << emul->gtPsbWord(em_psb_bid).eventNr()
1263  << std::endl;
1264 
1265  // m_dumpFile << "\n\tA,B_Data_CH7:0"
1266  // << " ...waiting for data accessors in dataformats!\n\n";
1267  //#include "DataFormats/L1GlobalTrigger/src/L1GtPsbWord.cc"
1268 
1269  m_dumpFile << "\n\tA_Data_CH7:0";
1270  m_dumpFile << "\n\tdata: ";
1271  for (int i=0; i<8; ++i)
1272  m_dumpFile << data->gtPsbWord(dt_psb_bid).aData(7-i) << " ";
1273  m_dumpFile << "\n\temul: ";
1274  for (int i=0; i<8; ++i)
1275  m_dumpFile << emul->gtPsbWord(em_psb_bid).aData(7-i) << " ";
1276  m_dumpFile << std::endl;
1277 
1278  m_dumpFile << "\n\tA_Data_CH7:0";
1279  m_dumpFile << "\n\tdata: ";
1280  for (int i=0; i<8; ++i)
1281  m_dumpFile << data->gtPsbWord(dt_psb_bid).bData(7-i) << " ";
1282  m_dumpFile << "\n\temul: ";
1283  for (int i=0; i<8; ++i)
1284  m_dumpFile << emul->gtPsbWord(em_psb_bid).bData(7-i) << " ";
1285  m_dumpFile << "\n" << std::endl;
1286 
1287 
1289 
1291  if(false) {
1292  m_dumpFile << "---debug: print full gt record---";
1293  m_dumpFile << "\n\tdata: ";
1294  data->print(m_dumpFile);
1295  m_dumpFile << "\n\temul: ";
1296  emul->print(m_dumpFile);
1297  m_dumpFile << "\n";
1298  m_dumpFile << "---debug: print full gt record Done.---\n\n";
1299  }
1300 
1301  char ok[10];
1302  if(match) sprintf(ok,"successful");
1303  else sprintf(ok,"failed");
1304  m_dumpFile << " ...L1GlobalTriggerReadoutRecord data and emulator comparison: "
1305  << ok << std::endl;
1306 
1307  return thematch;
1308 }
int i
Definition: DBlmapReader.cc:9
T const * product() const
Definition: Handle.h:74
std::ofstream m_dumpFile
Definition: L1Comparator.h:91
tuple cout
Definition: gather_cfg.py:121
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
bool L1Comparator::compareCollections ( edm::Handle< L1GlobalTriggerEvmReadoutRecord data,
edm::Handle< L1GlobalTriggerEvmReadoutRecord emul 
)
private

Definition at line 1312 of file L1Comparator.cc.

References gather_cfg::cout, i, match(), convertSQLiteXML::ok, and validate_alignment_devdb10_cfg::verbose.

1313  {
1314 
1315  if(verbose())
1316  std::cout << "L1Comparator -- result of GT embedded comparison.\n"
1317  << "L1GlobalTriggerEvmReadoutRecord data and emulator agree? "
1318  << ((*data==*emul)?"yes":"no")
1319  << std::endl;
1320 
1321  m_dumpFile << "\n L1GlobalTriggerEvmReadoutRecord candidates...\n";
1322 
1323  bool match = true;
1324  match &= (*data==*emul);
1325 
1326  if(m_dumpMode==0 && match)
1327  return match;
1328 
1329  // gt decision
1330  m_dumpFile << "\n\tGlobal decision: "
1331  << data->decision() << " (data) "
1332  << emul->decision() << " (emul) "
1333  << std::endl;
1334 
1335  // gt decision word
1336  m_dumpFile << "\n\tDecisionWord (bits: 0:63, 127:64)";
1337  int nbitword = 64;
1338  std::vector<bool> data_gtword = data->decisionWord();
1339  std::vector<bool> emul_gtword = emul->decisionWord();
1340  m_dumpFile << "\n\tdata: ";
1341  for(int i=0; i<nbitword; i++) {
1342  if (i%16==0) m_dumpFile << " ";
1343  m_dumpFile << (data_gtword.at(nbitword-1-i) ? '1' : '0');
1344  }
1345  m_dumpFile << "\n\t ";
1346  for(int i=0; i<nbitword; i++) {
1347  if (i%16==0) m_dumpFile << " ";
1348  m_dumpFile << (data_gtword.at(nbitword*2-1-i) ? '1' : '0');
1349  }
1350  m_dumpFile << "\n\temul: ";
1351  for(int i=0; i<nbitword; i++) {
1352  if (i%16==0) m_dumpFile << " ";
1353  m_dumpFile << (emul_gtword.at(nbitword-1-i) ? '1' : '0');
1354  }
1355  m_dumpFile << "\n\t ";
1356  for(int i=0; i<nbitword; i++) {
1357  if (i%16==0) m_dumpFile << " ";
1358  m_dumpFile << (emul_gtword.at(nbitword*2-1-i) ? '1' : '0');
1359  }
1360  m_dumpFile << std::endl;
1361 
1362  m_dumpFile << "\n\tDecisionWordExtended (bits: 0:63)";
1363  std::vector<bool> data_decwext = data->gtFdlWord().gtDecisionWordExtended();
1364  std::vector<bool> emul_decwext = emul->gtFdlWord().gtDecisionWordExtended();
1365  m_dumpFile << "\n\tdata: ";
1366  for(int i=0; i<nbitword; i++) {
1367  if (i%16==0) m_dumpFile << " ";
1368  m_dumpFile << (data_decwext.at(nbitword-1-i) ? '1' : '0');
1369  }
1370  m_dumpFile << "\n\temul: ";
1371  for(int i=0; i<nbitword; i++) {
1372  if (i%16==0) m_dumpFile << " ";
1373  m_dumpFile << (emul_decwext.at(nbitword-1-i) ? '1' : '0');
1374  }
1375  m_dumpFile << std::endl;
1376 
1377  m_dumpFile << "\n\tTechnical triggers (bits: 0:63)";
1378  std::vector<bool> data_fdlttw = data->gtFdlWord().gtTechnicalTriggerWord();
1379  std::vector<bool> emul_fdlttw = emul->gtFdlWord().gtTechnicalTriggerWord();
1380  assert((int)data_fdlttw.size()==nbitword);
1381  m_dumpFile << "\n\tdata: ";
1382  for(int i=0; i<nbitword; i++) {
1383  if (i%16==0) m_dumpFile << " ";
1384  m_dumpFile << (data_fdlttw.at(nbitword-1-i) ? '1' : '0');
1385  }
1386  m_dumpFile << "\n\temul: ";
1387  for(int i=0; i<nbitword; i++) {
1388  if (i%16==0) m_dumpFile << " ";
1389  m_dumpFile << (emul_fdlttw.at(nbitword-1-i) ? '1' : '0');
1390  }
1391  m_dumpFile << std::endl;
1392 
1393  m_dumpFile << "\n\tL1GtFdlWord";
1394  m_dumpFile << "\n\tdata: "
1395  << " BoardId:" << data->gtFdlWord().boardId()
1396  << " BxInEvent:" << data->gtFdlWord().bxInEvent()
1397  << " BxNr:" << data->gtFdlWord().bxNr()
1398  << " EventNr:" << data->gtFdlWord().eventNr()
1399  << " NoAlgo:" << data->gtFdlWord().noAlgo()
1400  << " FinalOR:" << data->gtFdlWord().finalOR()
1401  << " LocalBxNr:" << data->gtFdlWord().localBxNr();
1402  m_dumpFile << "\n\temul: "
1403  << " BoardId:" << emul->gtFdlWord().boardId()
1404  << " BxInEvent:" << emul->gtFdlWord().bxInEvent()
1405  << " BxNr:" << emul->gtFdlWord().bxNr()
1406  << " EventNr:" << emul->gtFdlWord().eventNr()
1407  << " NoAlgo:" << emul->gtFdlWord().noAlgo()
1408  << " FinalOR:" << emul->gtFdlWord().finalOR()
1409  << " LocalBxNr:" << emul->gtFdlWord().localBxNr()
1410  << std::endl;
1411 
1412  m_dumpFile << "\n\tL1GtfeWord";
1413  m_dumpFile << "\n\tdata: "
1414  << " BoardId:" << data->gtfeWord().boardId()
1415  << " RecordLength:" << data->gtfeWord().recordLength()
1416  << " BxNr:" << data->gtfeWord().bxNr()
1417  << " SetupVersion:" << data->gtfeWord().setupVersion()
1418  << " ActiveBoards:" << data->gtfeWord().activeBoards()
1419  << " TotalTriggerNr:" << data->gtfeWord().totalTriggerNr();
1420  m_dumpFile << "\n\temul: "
1421  << " BoardId:" << emul->gtfeWord().boardId()
1422  << " RecordLength:" << emul->gtfeWord().recordLength()
1423  << " BxNr:" << emul->gtfeWord().bxNr()
1424  << " SetupVersion:" << emul->gtfeWord().setupVersion()
1425  << " ActiveBoards:" << emul->gtfeWord().activeBoards()
1426  << " TotalTriggerNr:" << emul->gtfeWord().totalTriggerNr()
1427  << std::endl;
1428 
1429  // -- tcs
1430  m_dumpFile << "\n\ttcsWord";
1431  m_dumpFile << "\n\tdata:"
1432  << " DaqNr:" << data->tcsWord().daqNr()
1433  << " TriggerType:" << data->tcsWord().triggerType()
1434  << " Status:" << data->tcsWord().status()
1435  << " BxNr:" << data->tcsWord().bxNr()
1436  << " PartTrigNr:" << data->tcsWord().partTrigNr()
1437  << " EventNr:" << data->tcsWord().eventNr() << "\n\t"
1438  << " AssignedPartitions:" << data->tcsWord().assignedPartitions()
1439  << " PartRunNr:" << data->tcsWord().partTrigNr()
1440  << " OrbitNr:" << data->tcsWord().orbitNr();
1441  m_dumpFile << "\n\temul:"
1442  << " DaqNr:" << emul->tcsWord().daqNr()
1443  << " TriggerType:" << emul->tcsWord().triggerType()
1444  << " Status:" << emul->tcsWord().status()
1445  << " BxNr:" << emul->tcsWord().bxNr()
1446  << " PartTrigNr:" << emul->tcsWord().partTrigNr()
1447  << " EventNr:" << emul->tcsWord().eventNr() << "\n\t"
1448  << " AssignedPartitions:" << emul->tcsWord().assignedPartitions()
1449  << " PartRunNr:" << emul->tcsWord().partTrigNr()
1450  << " OrbitNr:" << emul->tcsWord().orbitNr()
1451  << "\n" << std::endl;
1452 
1453  char ok[10];
1454  if(match) sprintf(ok,"successful");
1455  else sprintf(ok,"failed");
1456  m_dumpFile << " ...L1GlobalTriggerEvmReadoutRecord data and emulator comparison: "
1457  << ok << std::endl;
1458 
1459  return match;
1460 }
int i
Definition: DBlmapReader.cc:9
std::ofstream m_dumpFile
Definition: L1Comparator.h:91
tuple cout
Definition: gather_cfg.py:121
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
bool L1Comparator::compareCollections ( edm::Handle< L1GlobalTriggerObjectMapRecord data,
edm::Handle< L1GlobalTriggerObjectMapRecord emul 
)
private

Definition at line 1464 of file L1Comparator.cc.

References i, match(), and convertSQLiteXML::ok.

1465  {
1466 
1467  m_dumpFile << "\n L1GlobalTriggerObjectMapRecord candidates...\n";
1468 
1469  bool match = true;
1470  //match &= (*data==*emul);
1471 
1472  const std::vector<L1GlobalTriggerObjectMap>& data_ovec = data->gtObjectMap();
1473  const std::vector<L1GlobalTriggerObjectMap>& emul_ovec = emul->gtObjectMap();
1474 
1475  for(std::vector<L1GtLogicParser::OperandToken>::size_type idx=0; idx<data_ovec.size(); idx++) {
1476  match &= ( data_ovec.at(idx).algoName() == emul_ovec.at(idx).algoName() );
1477  match &= ( data_ovec.at(idx).algoBitNumber() == emul_ovec.at(idx).algoBitNumber() );
1478  match &= ( data_ovec.at(idx).algoGtlResult() == emul_ovec.at(idx).algoGtlResult() );
1479  match &= ( data_ovec.at(idx).combinationVector() == emul_ovec.at(idx).combinationVector() );
1480  match &= ( data_ovec.at(idx).operandTokenVector().size()==emul_ovec.at(idx).operandTokenVector().size());
1481  if(match) {
1482  for(std::vector<L1GtLogicParser::OperandToken>::size_type i=0; i<data_ovec.at(idx).operandTokenVector().size(); i++) {
1483  match &= ( data_ovec.at(idx).operandTokenVector().at(i).tokenName ==
1484  emul_ovec.at(idx).operandTokenVector().at(i).tokenName );
1485  match &= ( data_ovec.at(idx).operandTokenVector().at(i).tokenNumber ==
1486  emul_ovec.at(idx).operandTokenVector().at(i).tokenNumber );
1487  match &= ( data_ovec.at(idx).operandTokenVector().at(i).tokenResult ==
1488  emul_ovec.at(idx).operandTokenVector().at(i).tokenResult );
1489  }
1490  }
1491  }
1492 
1493  if(m_dumpMode==0 && match)
1494  return match;
1495 
1496  // dump
1497  int idx = 0;
1498  m_dumpFile << "\n\tL1GlobalTriggerObjectMap";
1499  m_dumpFile << "\n\tdata: "
1500  << " algorithmName:" << data_ovec.at(idx).algoName()
1501  << " Bitnumber:" << data_ovec.at(idx).algoBitNumber()
1502  << " GTLresult:" << data_ovec.at(idx).algoGtlResult()
1503  << " combinationVectorSize:" << data_ovec.at(idx).combinationVector().size()
1504  << " operandTokenVector:" << data_ovec.at(idx).operandTokenVector().size();
1505  m_dumpFile << "\n\temul: "
1506  << " algorithmName:" << emul_ovec.at(idx).algoName()
1507  << " Bitnumber:" << emul_ovec.at(idx).algoBitNumber()
1508  << " GTLresult:" << emul_ovec.at(idx).algoGtlResult()
1509  << " combinationVectorSize:" << emul_ovec.at(idx).combinationVector().size()
1510  << " operandTokenVector:" << emul_ovec.at(idx).operandTokenVector().size()
1511  << "\n" << std::endl;
1512 
1513  char ok[10];
1514  if(match) sprintf(ok,"successful");
1515  else sprintf(ok,"failed");
1516  m_dumpFile << " ...L1GlobalTriggerObjectMapRecord data and emulator comparison: "
1517  << ok << std::endl;
1518 
1519  return match;
1520 }
int i
Definition: DBlmapReader.cc:9
uint16_t size_type
std::ofstream m_dumpFile
Definition: L1Comparator.h:91
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
template<class T >
bool L1Comparator::CompareCollections ( edm::Handle< T data,
edm::Handle< T emul 
)
private
template<class myCol >
bool L1Comparator::CompareCollections ( edm::Handle< myCol >  data,
edm::Handle< myCol >  emul 
)

Definition at line 1561 of file L1Comparator.cc.

References begin, i, and match().

1561  {
1562  bool match = true;
1563  typedef typename myCol::size_type col_sz;
1564  typedef typename myCol::iterator col_it;
1565  col_sz ndata = data->size();
1566  col_sz nemul = emul->size();
1567  if(ndata!=nemul) {
1568  match &= false;
1569  m_dumpFile << " #cand mismatch!"
1570  << "\tdata: " << ndata
1571  << "\temul: " << nemul
1572  << std::endl;
1573  }
1574  col_it itd = data -> begin();
1575  col_it itm = emul -> begin();
1576  for (col_sz i=0; i<ndata; i++) {
1577  match &= dumpCandidate(*itd++,*itm++, m_dumpFile);
1578  }
1579  return match;
1580 }
int i
Definition: DBlmapReader.cc:9
uint16_t size_type
bool dumpCandidate(const T &dt, const T &em, std::ostream &s)
#define begin
Definition: vmac.h:31
std::ofstream m_dumpFile
Definition: L1Comparator.h:91
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
bool L1Comparator::compareFedRawCollections ( edm::Handle< FEDRawDataCollection data,
edm::Handle< FEDRawDataCollection emul,
int  fedid 
)
private

Definition at line 1524 of file L1Comparator.cc.

References gather_cfg::cout, FEDRawData::data(), createTree::dd, i, j, convertSQLiteXML::ok, FEDRawData::size(), and validate_alignment_devdb10_cfg::verbose.

1525  {
1526  if(verbose())
1527  std::cout << "[L1Comparator] fedraw start processing :" << std::endl << std::flush;
1528  if(dumpEvent_) {
1529  m_dumpFile << "\nEvent: " << nevt_ << std::endl;
1530  dumpEvent_=false;
1531  }
1532  m_dumpFile << "\n FEDRawData candidates...\n";
1533  const FEDRawData& raw_fed_data = data->FEDData(fedId);
1534  const FEDRawData& raw_fed_emul = emul->FEDData(fedId);
1535  bool raw_match=true;
1536  for(int i=0; i!=(int)raw_fed_data.size();i++) {
1537  raw_match &= ( raw_fed_data.data()[i] == raw_fed_emul.data()[i] );
1538  }
1539  unsigned long dd = 0, de = 0;
1540  for(int i=0; i<(int)raw_fed_data.size()/4;i++) {
1541  dd=0; de=0;
1542  for(int j=0; j<4; j++)
1543  dd += ((raw_fed_data.data()[i*4+j]&0xff)<<(8*j));
1544  for(int j=0; j<4; j++)
1545  de += ((raw_fed_emul.data()[i*4+j]&0xff)<<(8*j));
1546  if(m_dumpMode==-1 || (m_dumpMode==1 && dd!=de) ) {
1547  m_dumpFile << "\n\tdata: " << std::setw(8) << std::setfill('0') << std::hex << dd;
1548  m_dumpFile << "\n\temul: " << std::setw(8) << std::setfill('0') << std::hex << de;
1549  }
1550  m_dumpFile << std::endl;
1551  }
1552  char ok[10];
1553  if(raw_match) sprintf(ok,"successful");
1554  else sprintf(ok,"failed");
1555  m_dumpFile << " ...FEDRawData data and emulator comparison: "
1556  << ok << std::endl;
1557  return raw_match;
1558 }
int i
Definition: DBlmapReader.cc:9
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
int j
Definition: DBlmapReader.cc:9
std::ofstream m_dumpFile
Definition: L1Comparator.h:91
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
tuple cout
Definition: gather_cfg.py:121
template<class T >
bool L1Comparator::dumpCandidate ( const T dt,
const T em,
std::ostream &  s 
)
private

Definition at line 1583 of file L1Comparator.cc.

1583  {
1584  if(dt==em)
1585  return true;
1586  s<<dt<<std::endl;
1587  s<<em<<std::endl<<std::endl;
1588  return false;
1589 }
float dt
Definition: AMPTWrapper.h:126
void L1Comparator::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 200 of file L1Comparator.cc.

200  {
201  if(m_dumpMode)
202  m_dumpFile << "\n\n-------\n"
203  << "Global data|emulator agreement: "
204  << m_match << std::endl;
205  m_dumpFile.close();
206 }
std::ofstream m_dumpFile
Definition: L1Comparator.h:91
template<class T >
void L1Comparator::process ( T const *  data,
T const *  emul,
const int  sys,
const int  cid 
)
private

tmp: for getting a clean dump (avoid empty entries)

perform comparison

gather results

over-write system-id: needed eg for GMT input, CSC tf reg cand, CTP&CTF

over-write data type: needed eg for GCT jet types, regional muon sources

append d|e digis to the record's collection

Definition at line 977 of file L1Comparator.cc.

References gather_cfg::cout, DEcompare< T >::de_type(), DEcompare< T >::do_compare(), DEcompare< T >::get_ncand(), DEcompare< T >::getDEDigis(), DEcompare< T >::GetName(), i, DEcompare< T >::print(), dedefs::SystLabel, tmp, and validate_alignment_devdb10_cfg::verbose.

Referenced by ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), and process().

977  {
978 
979  if(verbose())
980  std::cout << "L1Comparator::process -ing system:" << sys
981  << " (" << SystLabel[sys] << "), data type " << cid
982  << "...\n" << std::flush;
983  if(verbose())
984  std::cout << "L1Comparator::process debug "
985  << " (size " << data->size() << "," <<emul->size() << ")"
986  << ".\n" << std::flush;
987 
989  bool prt = false;
990  if(!m_dumpMode)
991  prt = false;
992  else if(m_dumpMode==-1)
993  prt=true;
994  else if(m_dumpMode>0) {
995  DEcompare<T> tmp(data,emul);
996  if(tmp.get_ncand(0)==0 && tmp.get_ncand(1)==0)
997  prt=false;
998  else
999  prt = !tmp.do_compare(m_dumpFile,0);
1000  }
1001 
1002  //declare de compare object
1003  DEcompare<T> cmp(data,emul);
1004 
1005  int ndata = cmp.get_ncand(0);
1006  int nemul = cmp.get_ncand(1);
1007 
1008  if(verbose())
1009  std::cout << "L1Comparator::process "
1010  << " system:" << SystLabel[sys] << "(id " << sys << ")"
1011  << " type:" << cmp.GetName(0) << "(" << cmp.de_type() << ")"
1012  << " ndata:" << ndata
1013  << " nemul:" << nemul
1014  << " (size " << data->size() << "," <<emul->size() << ")"
1015  << ".\n" << std::flush;
1016 
1017  if(ndata==0&&nemul==0) {
1018  if(verbose())
1019  std::cout << "L1Comparator::process "
1020  << "empty collections -- exiting!\n" << std::flush;
1021  return;
1022  }
1023 
1024  m_dumpFile << std::setiosflags(std::ios::showpoint | std::ios::fixed
1025  | std::ios::right | std::ios::adjustfield);
1026  std::cout << std::setiosflags(std::ios::showpoint | std::ios::fixed
1027  | std::ios::right | std::ios::adjustfield);
1028 
1029  if(dumpEvent_ && prt ) {
1030  m_dumpFile << "\nEntry: " << nevt_
1031  << " (event:" << evtNum_
1032  << " | run:" << runNum_
1033  << ")\n" << std::flush;
1034  dumpEvent_=false;
1035  }
1036 
1037  if(prt)
1038  m_dumpFile << "\n sys:" << SystLabel[sys]
1039  << " (" << sys << "), type:" << cid //cmp.GetName()
1040  << " ...\n";
1041 
1042  if(verbose())
1043  std::cout << "L1Comparator::process print:\n" << std::flush
1044  << cmp.print()
1045  << std::flush;
1046 
1048  DEmatchEvt[sys] &= cmp.do_compare(m_dumpFile,m_dumpMode);
1049 
1051  L1DEDigiCollection dg = cmp.getDEDigis();
1052 
1053  if(verbose())
1054  for(L1DEDigiCollection::iterator it=dg.begin(); it!=dg.end();it++)
1055  std::cout << *it << "\n";
1056 
1058  for(L1DEDigiCollection::iterator it=dg.begin(); it!=dg.end();it++)
1059  it->setSid(sys);
1061  for(L1DEDigiCollection::iterator it=dg.begin(); it!=dg.end();it++)
1062  it->setCid(cid);
1063 
1065  m_dedigis.insert(m_dedigis.end(), dg.begin(), dg.end());
1066  for(int i=0; i<2; i++)
1067  DEncand[sys][i] += cmp.get_ncand(i);
1068 
1069  if(verbose())
1070  std::cout << "L1Comparator::process "
1071  << " system:" << SystLabel[sys]
1072  << " type:" << cmp.GetName(0)
1073  << " ndata:" << DEncand[sys][0]
1074  << " nemul:" << DEncand[sys][1]
1075  << " (size " << data->size() << "," <<emul->size() << ")"
1076  << " ndigis:" << dg.size()
1077  << " agree? " << DEmatchEvt[sys]
1078  << std::endl;
1079 
1080  if(verbose())
1081  std::cout << "L1Comparator::process -ing system:"
1082  << sys << " (" << SystLabel[sys] << ")...done.\n"
1083  << std::flush;
1084 }
int i
Definition: DBlmapReader.cc:9
int DEncand[dedefs::DEnsys][2]
Definition: L1Comparator.h:95
std::vector< L1DataEmulDigi > L1DEDigiCollection
Definition: DEtrait.h:79
bool DEmatchEvt[dedefs::DEnsys]
Definition: L1Comparator.h:94
const std::string SystLabel[DEnsys]
Definition: DEtrait.h:45
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
L1DEDigiCollection m_dedigis
Definition: L1Comparator.h:96
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::ofstream m_dumpFile
Definition: L1Comparator.h:91
tuple cout
Definition: gather_cfg.py:121
template<class T >
void L1Comparator::process ( const edm::Handle< T data,
const edm::Handle< T emul,
const int  sys,
const int  cid 
)
inlineprivate

Definition at line 60 of file L1Comparator.h.

References edm::HandleBase::isValid(), process(), and edm::Handle< T >::product().

Referenced by ConfigBuilder.ConfigBuilder.PrintAllModules::leave().

61  {
62  if(data.isValid()&&emul.isValid())
63  process(data.product(),emul.product(),sys, cid);
64  }
bool isValid() const
Definition: HandleBase.h:76
T const * product() const
Definition: Handle.h:74
void process(T const *, T const *, const int, const int)
void L1Comparator::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

– Get the data and emulated collections -----————————

place candidates into vectors

restrict comparison to middle of readout window

— done getting collections. —

processing : compare the pairs of collections

tmp: for getting a clean dump (avoid empty entries)

(may skip further collection checks temporarily...)

further analysis

Implements edm::EDProducer.

Definition at line 209 of file L1Comparator.cc.

References CSCALCTDigi::clear(), CSCCLCTDigi::clear(), edm::HandleBase::clear(), gather_cfg::cout, dedefs::CSCtf, dedefs::CSCtfsta, dedefs::CSCtftrk, dedefs::CSCtpa, dedefs::CSCtpc, dedefs::CSCtpl, dedefs::CTF, dedefs::CTP, dedefs::DEnsys, cond::rpcobgas::detid, dedefs::DTF, dedefs::DTP, dedefs::DTtf, dedefs::DTtftrk, dedefs::DTtpPh, dedefs::DTtpTh, dedefs::ECALtp, dedefs::ETP, edm::EventID::event(), spr::find(), dedefs::GCT, dedefs::GCTcenjets, dedefs::GCTethad, dedefs::GCTetmiss, dedefs::GCTettot, dedefs::GCTforjets, dedefs::GCThfbit, dedefs::GCThfring, dedefs::GCThtmiss, dedefs::GCTisolaem, dedefs::GCTnoisoem, dedefs::GCTtaujets, edm::Event::getByLabel(), dedefs::GLT, dedefs::GMT, dedefs::GMTcnd, dedefs::GMTmain, dedefs::GMTrdt, dedefs::HCALtp, dedefs::HTP, i, edm::EventBase::id(), instance, edm::HandleBase::isValid(), j, diffTwoXMLs::label, dedefs::LTC, dedefs::LTCi, convertSQLiteXML::ok, edm::Event::put(), dedefs::RCT, dedefs::RCTem, dedefs::RCTrgn, record, dedefs::RPC, dedefs::RPCcen, dedefs::RPCfor, edm::EventID::run(), L1MuGMTCand::setPhiValue(), and validate_alignment_devdb10_cfg::verbose.

209  {
210 
211  nevt_++;
212  evtNum_ = iEvent.id().event();
213  runNum_ = iEvent.id().run();
214 
215  if(verbose())
216  std::cout << "\nL1COMPARATOR entry:" << nevt_ << " | evt:" << evtNum_
217  << " | run:" << runNum_ << "\n" << std::flush;
218 
219  //flag whether event id has already been written to dumpFile
220  dumpEvent_ = true;
221 
222  //reset event holder quantities
223  for(int i=0; i<DEnsys; i++) {
224  for(int j=0; j<2; j++)
225  DEncand[i][j] = 0;
226  DEmatchEvt[i] = true;
227  }
228  m_dedigis.clear();
229 
230 
232 
233  // -- ETP [electromagnetic calorimeter trigger primitives]
236  if(m_doSys[ETP]) {
237  iEvent.getByLabel(m_DEsource[ETP][0], ecal_tp_data);
238  iEvent.getByLabel(m_DEsource[ETP][1], ecal_tp_emul);
239  }
240 
241  // -- HTP [hadronic calorimeter trigger primitives]
244  if(m_doSys[HTP]) {
245  iEvent.getByLabel(m_DEsource[HTP][0], hcal_tp_data);
246  iEvent.getByLabel(m_DEsource[HTP][1], hcal_tp_emul);
247  }
248 
249  // -- RCT [regional calorimeter trigger]
254  if(m_doSys[RCT]) {
255  iEvent.getByLabel(m_DEsource[RCT][0], rct_em_data);
256  iEvent.getByLabel(m_DEsource[RCT][1], rct_em_emul);
257  iEvent.getByLabel(m_DEsource[RCT][0], rct_rgn_data);
258  iEvent.getByLabel(m_DEsource[RCT][1], rct_rgn_emul);
259  }
260 
261  // -- GCT [global calorimeter trigger]
262  edm::Handle<L1GctEmCandCollection> gct_isolaem_data;
263  edm::Handle<L1GctEmCandCollection> gct_isolaem_emul;
264  edm::Handle<L1GctEmCandCollection> gct_noisoem_data;
265  edm::Handle<L1GctEmCandCollection> gct_noisoem_emul;
266  edm::Handle<L1GctJetCandCollection> gct_cenjets_data;
267  edm::Handle<L1GctJetCandCollection> gct_cenjets_emul;
268  edm::Handle<L1GctJetCandCollection> gct_forjets_data;
269  edm::Handle<L1GctJetCandCollection> gct_forjets_emul;
270  edm::Handle<L1GctJetCandCollection> gct_taujets_data;
271  edm::Handle<L1GctJetCandCollection> gct_taujets_emul;
272 
275  edm::Handle<L1GctEtMissCollection> gct_etmiss_data;
276  edm::Handle<L1GctEtMissCollection> gct_etmiss_emul;
277  edm::Handle<L1GctEtTotalCollection> gct_ettota_data;
278  edm::Handle<L1GctEtTotalCollection> gct_ettota_emul;
279  edm::Handle<L1GctHtMissCollection> gct_htmiss_data;
280  edm::Handle<L1GctHtMissCollection> gct_htmiss_emul;
285  edm::Handle<L1GctJetCountsCollection> gct_jetcnt_data;
287 
288  if(m_doSys[GCT]) {
289  iEvent.getByLabel(m_DEsource[GCT][0].label(),"isoEm", gct_isolaem_data);
290  iEvent.getByLabel(m_DEsource[GCT][1].label(),"isoEm", gct_isolaem_emul);
291  iEvent.getByLabel(m_DEsource[GCT][0].label(),"nonIsoEm",gct_noisoem_data);
292  iEvent.getByLabel(m_DEsource[GCT][1].label(),"nonIsoEm",gct_noisoem_emul);
293  iEvent.getByLabel(m_DEsource[GCT][0].label(),"cenJets", gct_cenjets_data);
294  iEvent.getByLabel(m_DEsource[GCT][1].label(),"cenJets", gct_cenjets_emul);
295  iEvent.getByLabel(m_DEsource[GCT][0].label(),"forJets", gct_forjets_data);
296  iEvent.getByLabel(m_DEsource[GCT][1].label(),"forJets", gct_forjets_emul);
297  iEvent.getByLabel(m_DEsource[GCT][0].label(),"tauJets", gct_taujets_data);
298  iEvent.getByLabel(m_DEsource[GCT][1].label(),"tauJets", gct_taujets_emul);
299 
300  iEvent.getByLabel(m_DEsource[GCT][0],gct_ht_data);
301  iEvent.getByLabel(m_DEsource[GCT][1],gct_ht_emul);
302  iEvent.getByLabel(m_DEsource[GCT][0],gct_etmiss_data);
303  iEvent.getByLabel(m_DEsource[GCT][1],gct_etmiss_emul);
304  iEvent.getByLabel(m_DEsource[GCT][0],gct_ettota_data);
305  iEvent.getByLabel(m_DEsource[GCT][1],gct_ettota_emul);
306  iEvent.getByLabel(m_DEsource[GCT][0],gct_htmiss_data);
307  iEvent.getByLabel(m_DEsource[GCT][1],gct_htmiss_emul);
308  iEvent.getByLabel(m_DEsource[GCT][0],gct_hfring_data);
309  iEvent.getByLabel(m_DEsource[GCT][1],gct_hfring_emul);
310  iEvent.getByLabel(m_DEsource[GCT][0],gct_hfbcnt_data);
311  iEvent.getByLabel(m_DEsource[GCT][1],gct_hfbcnt_emul);
312  iEvent.getByLabel(m_DEsource[GCT][0],gct_jetcnt_data);
313  iEvent.getByLabel(m_DEsource[GCT][1],gct_jetcnt_emul);
314  }
315 
316  // -- DTP [drift tube trigger primitive]
321  if(m_doSys[DTP]) {
322  iEvent.getByLabel(m_DEsource[DTP][0],dtp_ph_data_);
323  iEvent.getByLabel(m_DEsource[DTP][1],dtp_ph_emul_);
324  iEvent.getByLabel(m_DEsource[DTP][0],dtp_th_data_);
325  iEvent.getByLabel(m_DEsource[DTP][1],dtp_th_emul_);
326  }
327  L1MuDTChambPhDigiCollection const* dtp_ph_data = 0;
328  L1MuDTChambPhDigiCollection const* dtp_ph_emul = 0;
329  L1MuDTChambThDigiCollection const* dtp_th_data = 0;
330  L1MuDTChambThDigiCollection const* dtp_th_emul = 0;
331 
332  if(dtp_ph_data_.isValid()) dtp_ph_data = dtp_ph_data_->getContainer();
333  if(dtp_ph_emul_.isValid()) dtp_ph_emul = dtp_ph_emul_->getContainer();
334  if(dtp_th_data_.isValid()) dtp_th_data = dtp_th_data_->getContainer();
335  if(dtp_th_emul_.isValid()) dtp_th_emul = dtp_th_emul_->getContainer();
336 
337  // -- DTF [drift tube track finder]
340  edm::Handle<L1MuDTTrackContainer> dtf_trk_data_;
341  edm::Handle<L1MuDTTrackContainer> dtf_trk_emul_;
342  L1MuRegionalCandCollection const* dtf_trk_data = 0;
343  L1MuRegionalCandCollection const* dtf_trk_emul = 0;
344  if(m_doSys[DTF]) {
345  iEvent.getByLabel(m_DEsource[DTF][0].label(),"DT",dtf_data);
346  iEvent.getByLabel(m_DEsource[DTF][1].label(),"DT",dtf_emul);
347  //iEvent.getByLabel(m_DEsource[DTF][0].label(),"DTTF",dtf_trk_data_);
348  iEvent.getByLabel(m_DEsource[DTF][0].label(),"DATA",dtf_trk_data_);
349  iEvent.getByLabel(m_DEsource[DTF][1].label(),"DTTF",dtf_trk_emul_);
350  }
351  //extract the regional cands
352  typedef std::vector<L1MuDTTrackCand> L1MuDTTrackCandCollection;
353  L1MuRegionalCandCollection dtf_trk_data_v, dtf_trk_emul_v;
354  dtf_trk_data_v.clear(); dtf_trk_emul_v.clear();
355  if(dtf_trk_data_.isValid()) {
356  L1MuDTTrackCandCollection *dttc = dtf_trk_data_->getContainer();
357  for(L1MuDTTrackCandCollection::const_iterator it=dttc->begin();
358  it!=dttc->end(); it++)
359  dtf_trk_data_v.push_back(L1MuRegionalCand(*it));
360  }
361  if(dtf_trk_emul_.isValid()) {
362  L1MuDTTrackCandCollection *dttc = dtf_trk_emul_->getContainer();
363  for(L1MuDTTrackCandCollection::const_iterator it=dttc->begin();
364  it!=dttc->end(); it++)
365  dtf_trk_emul_v.push_back(L1MuRegionalCand(*it));
366  }
367  dtf_trk_data =&dtf_trk_data_v;
368  dtf_trk_emul =&dtf_trk_emul_v;
369 
370  // -- CTP [cathode strip chamber trigger primitive]
377  CSCALCTDigiCollection_ const* ctp_ano_data = 0;
378  CSCALCTDigiCollection_ const* ctp_ano_emul = 0;
379  CSCCLCTDigiCollection_ const* ctp_cat_data = 0;
380  CSCCLCTDigiCollection_ const* ctp_cat_emul = 0;
381  CSCCorrelatedLCTDigiCollection_ const* ctp_lct_data = 0;
382  CSCCorrelatedLCTDigiCollection_ const* ctp_lct_emul = 0;
383  if(m_doSys[CTP]) {
384  if(m_DEsource[CTP][0].label().find("tf")!=std::string::npos) {
385  //if correlated LCTs from TF, read needed info from TP data digis
386  iEvent.getByLabel("muonCSCDigis", "MuonCSCALCTDigi" ,ctp_ano_data_);
387  iEvent.getByLabel("muonCSCDigis", "MuonCSCCLCTDigi" ,ctp_cat_data_);
388  iEvent.getByLabel(m_DEsource[CTP][0] ,ctp_lct_data_);
389  } else {
390  iEvent.getByLabel(m_DEsource[CTP][0].label(),"MuonCSCALCTDigi",ctp_ano_data_);
391  iEvent.getByLabel(m_DEsource[CTP][0].label(),"MuonCSCCLCTDigi",ctp_cat_data_);
392  iEvent.getByLabel(m_DEsource[CTP][0].label(),"MuonCSCCorrelatedLCTDigi",ctp_lct_data_);
393  }
394  iEvent.getByLabel(m_DEsource[CTP][1] ,ctp_ano_emul_);
395  iEvent.getByLabel(m_DEsource[CTP][1] ,ctp_cat_emul_);
396  iEvent.getByLabel(m_DEsource[CTP][1] ,ctp_lct_emul_);
397  }
398 
400  //Anode LCT
401  CSCALCTDigiCollection_ ctp_ano_data_v, ctp_ano_emul_v;
402  ctp_ano_data_v.clear(); ctp_ano_emul_v.clear();
403  if(ctp_ano_data_.isValid() && ctp_ano_emul_.isValid()) {
404  // The following numbers should come from config. database eventually...
405  int fifo_pretrig = 10;
406  int fpga_latency = 6;
407  int l1a_window_width = 7;
408  // Time offset of raw hits w.r.t. the full 12-bit BXN.
409  int rawhit_tbin_offset =
410  (fifo_pretrig - fpga_latency) + (l1a_window_width-1)/2;
411  // Extra difference due to additional register stages; determined
412  // empirically.
413  int register_delay = 2;
416  for (mapIt mit = ctp_ano_data_->begin(); mit != ctp_ano_data_->end(); mit++)
417  for (vecIt vit = ctp_ano_data_->get((*mit).first).first;
418  vit != ctp_ano_data_->get((*mit).first).second; vit++)
419  ctp_ano_data_v.push_back(*vit);
420  for (mapIt mit = ctp_ano_emul_->begin(); mit != ctp_ano_emul_->end(); mit++)
421  for (vecIt vit = ctp_ano_emul_->get((*mit).first).first;
422  vit != ctp_ano_emul_->get((*mit).first).second; vit++) {
423  int emul_bx_corr =
424  (*vit).getBX() - rawhit_tbin_offset + register_delay;
425  CSCALCTDigi alct((*vit).isValid(), (*vit).getQuality(),
426  (*vit).getAccelerator(), (*vit).getCollisionB(),
427  (*vit).getKeyWG(), emul_bx_corr,
428  (*vit).getTrknmb());
429  ctp_ano_emul_v.push_back(alct);
430  }
431  }
432  ctp_ano_data =&ctp_ano_data_v;
433  ctp_ano_emul =&ctp_ano_emul_v;
434  //Cathode LCT
435  CSCCLCTDigiCollection_ ctp_cat_data_v, ctp_cat_emul_v;
436  ctp_cat_data_v.clear(); ctp_cat_emul_v.clear();
437  if(ctp_cat_data_.isValid() && ctp_cat_emul_.isValid()) {
438  int tbin_cathode_offset = 7, emul_bx_corr;
441  for (mapIt mit = ctp_cat_data_->begin(); mit != ctp_cat_data_->end(); mit++)
442  for (vecIt vit = ctp_cat_data_->get((*mit).first).first;
443  vit != ctp_cat_data_->get((*mit).first).second; vit++)
444  ctp_cat_data_v.push_back(*vit);
445  for (mapIt mit = ctp_cat_emul_->begin(); mit != ctp_cat_emul_->end(); mit++) {
446  const CSCDetId& detid = (*mit).first;
447 
448  // Extract full 12-bit BX word from CLCT data collections.
449  int full_cathode_bx = -999;
450  const CSCCLCTDigiCollection::Range& crange = ctp_cat_data_->get(detid);
451  for (vecIt digiIt = crange.first; digiIt != crange.second; digiIt++) {
452  if ((*digiIt).isValid()) {
453  full_cathode_bx = (*digiIt).getFullBX();
454  break;
455  }
456  }
457 
458  for (vecIt vit = ctp_cat_emul_->get(detid).first;
459  vit != ctp_cat_emul_->get(detid).second; vit++) {
460  int emul_bx = (*vit).getBX();
461  if (full_cathode_bx != -999)
462  emul_bx_corr =
463  (full_cathode_bx + emul_bx - tbin_cathode_offset) & 0x03;
464  else
465  emul_bx_corr = emul_bx & 0x03;
466  CSCCLCTDigi clct((*vit).isValid(), (*vit).getQuality(),
467  (*vit).getPattern(), (*vit).getStripType(),
468  (*vit).getBend(), (*vit).getStrip(),
469  (*vit).getCFEB(), emul_bx_corr,
470  (*vit).getTrknmb());
471  ctp_cat_emul_v.push_back(clct);
472  }
473  }
474  }
475  ctp_cat_data =&ctp_cat_data_v;
476  ctp_cat_emul =&ctp_cat_emul_v;
477  //Correlated (anode+cathode) LCTs
478  CSCCorrelatedLCTDigiCollection_ ctp_lct_data_v, ctp_lct_emul_v;
479  ctp_lct_data_v.clear(); ctp_lct_emul_v.clear();
480  if(ctp_lct_data_.isValid() && ctp_lct_emul_.isValid()) {
481  int tbin_anode_offset = 5, emul_bx_corr;
482  typedef CSCCorrelatedLCTDigiCollection::DigiRangeIterator mapIt;//map iterator
483  typedef CSCCorrelatedLCTDigiCollection::const_iterator vecIt;//vec iterator
484  //loop over data (map<idx,vec_digi>)
485  for (mapIt mit = ctp_lct_data_->begin(); mit != ctp_lct_data_->end(); mit++)
486  //get vec_digi range(pair) corresponding to idx of map
487  //loop over digi vector (ie between begin and end pointers in range)
488  //CSCCorrelatedLCTDigiCollection::Range ctpRange = ctp_lct_data_->get((*mit).first)
489  //for (vecIt vit = ctpRange.first; vit != ctpRange.second; vit++) {
490  for (vecIt vit = ctp_lct_data_->get((*mit).first).first;
491  vit != ctp_lct_data_->get((*mit).first).second; vit++)
492  ctp_lct_data_v.push_back(*vit);
493  for (mapIt mit = ctp_lct_emul_->begin(); mit != ctp_lct_emul_->end(); mit++) {
494  const CSCDetId& detid = (*mit).first;
495 
496  // Extract full 12-bit BX word from ALCT data collections.
497  int full_anode_bx = -999;
498  if(ctp_ano_data_.isValid()) {
499  const CSCALCTDigiCollection::Range& arange = ctp_ano_data_->get(detid);
500  for (CSCALCTDigiCollection::const_iterator digiIt = arange.first;
501  digiIt != arange.second; digiIt++) {
502  if ((*digiIt).isValid()) {
503  full_anode_bx = (*digiIt).getFullBX();
504  break;
505  }
506  }
507  }
508 
509  for (vecIt vit = ctp_lct_emul_->get(detid).first;
510  vit != ctp_lct_emul_->get(detid).second; vit++) {
511  int emul_bx = (*vit).getBX();
512  if (full_anode_bx != -999) {
513  emul_bx_corr = (full_anode_bx + emul_bx - tbin_anode_offset) & 0x01;
514  }
515  else { // This should never happen for default config. settings.
516  emul_bx_corr = emul_bx & 0x01;
517  }
518 
519  // If one compares correlated LCTs after the muon port card, an
520  // additional offset is needed.
521  if (m_DEsource[CTP][1].instance() == "MPCSORTED") emul_bx_corr += 5;
522 
523  CSCCorrelatedLCTDigi lct((*vit).getTrknmb(), (*vit).isValid(),
524  (*vit).getQuality(), (*vit).getKeyWG(),
525  (*vit).getStrip(), (*vit).getPattern(),
526  (*vit).getBend(), emul_bx_corr,
527  (*vit).getMPCLink(), (*vit).getBX0(),
528  (*vit).getSyncErr(), (*vit).getCSCID());
529  ctp_lct_emul_v.push_back(lct);
530  }
531  }
532  }
533  ctp_lct_data =&ctp_lct_data_v;
534  ctp_lct_emul =&ctp_lct_emul_v;
535 
536 
537  // -- CTF [cathode strip chamber track finder]
538 
539  edm::Handle<L1MuRegionalCandCollection> ctf_data, ctf_emul;
540  edm::Handle<L1CSCTrackCollection> ctf_trk_data_, ctf_trk_emul_;
541 
544 
545  //L1MuRegionalCandCollection const* ctf_trc_data(new L1MuRegionalCandCollection);
546  //L1MuRegionalCandCollection const* ctf_trc_emul(new L1MuRegionalCandCollection);
547 
550 
553 
554  if(m_doSys[CTF]) {
555  iEvent.getByLabel(m_DEsource[CTF][2],ctf_trk_data_);
556  iEvent.getByLabel(m_DEsource[CTF][3],ctf_trk_emul_);
557  //note: unpacker different label: MounL1CSCTrackCollection
558  iEvent.getByLabel(m_DEsource[CTF][0],ctf_data);
559  iEvent.getByLabel(m_DEsource[CTF][1],ctf_emul);
560  //note: unpacker only
561  iEvent.getByLabel(m_DEsource[CTF][0].label(),"MuonL1CSCStatusDigiCollection",ctf_sta_data_);
562  iEvent.getByLabel(m_DEsource[CTF][1].label(),"MuonL1CSCStatusDigiCollection",ctf_sta_emul_);
563  }
564 
565  if(ctf_sta_data_.isValid())
566  ctf_sta_data = &(ctf_sta_data_->second);
567 
568  if(ctf_sta_emul_.isValid())
569  ctf_sta_emul = &(ctf_sta_emul_->second);
570 
571  CSCCorrelatedLCTDigiCollection_ ctf_trk_data_v, ctf_trk_emul_v; //vector
572  L1MuRegionalCandCollection ctf_trc_data_v, ctf_trc_emul_v; //vector
573 
574  if(ctf_trk_data_.isValid() && ctf_trk_emul_.isValid()) {
575  typedef CSCCorrelatedLCTDigiCollection::DigiRangeIterator mapIt;//map iterator
576  typedef CSCCorrelatedLCTDigiCollection::const_iterator vecIt;//vec iterator
577  typedef L1CSCTrackCollection::const_iterator ctcIt;
578 
579  //loop over csc-tracks (ie pairs<l1track,digi_vec>)
580  for(ctcIt tcit=ctf_trk_data_->begin(); tcit!=ctf_trk_data_->end(); tcit++) {
582  if((tcit->first.bx() < -1) || (tcit->first.bx() > 1))
583  continue;
584  //store the muon candidate
585  //csc::L1Track ttr = tcit->first;
586  //L1MuRegionalCand cand(ttr);
587  //ctf_trc_data_v.push_back(tcit->first);
588  ctf_trc_data_v.push_back(L1MuRegionalCand(tcit->first.getDataWord(), tcit->first.bx()));
589  CSCCorrelatedLCTDigiCollection ldc = tcit->second; //muondigicollection=map
590  //get the lct-digi-collection (ie muon-digi-collection)
591  //loop over data (map<idx,vec_digi>)
592  for (mapIt mit = ldc.begin(); mit != ldc.end(); mit++)
593  //get vec_digi range(pair) corresponding to idx of map
594  //loop over digi vector (ie between begin and end pointers in range)
595  //CSCCorrelatedLCTDigiCollection::Range ctpRange = ctp_lct_data_->get((*mit).first)
596  //for (vecIt vit = ctpRange.first; vit != ctpRange.second; vit++) {
597  for (vecIt vit = ldc.get((*mit).first).first;
598  vit != ldc.get((*mit).first).second; vit++)
599  ctf_trk_data_v.push_back(*vit);
600  }
601 
602  //ctf_trk_data = &ctf_trk_data_v;
603  //ctf_trc_data = &ctf_trc_data_v;
604 
605  //same for emulator collection
606  for(ctcIt tcit=ctf_trk_emul_->begin();tcit!=ctf_trk_emul_->end(); tcit++) {
607  if((tcit->first.bx() < -1) || (tcit->first.bx() > 1))
608  continue;
609  ctf_trc_emul_v.push_back(L1MuRegionalCand(tcit->first.getDataWord(), tcit->first.bx()));
610  CSCCorrelatedLCTDigiCollection ldc = tcit->second;
611  for (mapIt mit = ldc.begin(); mit != ldc.end(); mit++)
612  for (vecIt vit = ldc.get((*mit).first).first;
613  vit != ldc.get((*mit).first).second; vit++)
614  ctf_trk_emul_v.push_back(*vit);
615  }
616 
617  ctf_trk_emul = &ctf_trk_emul_v;
618  //ctf_trc_emul = &ctf_trc_emul_v;
619 
620  }
621 
622  // -- RPC [resistive plate chambers regional trigger]
627  if(m_doSys[RPC]) {
628  iEvent.getByLabel(m_DEsource[RPC][0].label(),"RPCb",rpc_cen_data);
629  iEvent.getByLabel(m_DEsource[RPC][1].label(),"RPCb",rpc_cen_emul);
630  iEvent.getByLabel(m_DEsource[RPC][0].label(),"RPCf",rpc_for_data);
631  iEvent.getByLabel(m_DEsource[RPC][1].label(),"RPCf",rpc_for_emul);
632  }
633 
634  // -- LTC [local trigger controller]
637  if(m_doSys[LTC]) {
638  iEvent.getByLabel(m_DEsource[LTC][0],ltc_data);
639  iEvent.getByLabel(m_DEsource[LTC][1],ltc_emul);
640  }
641 
642  // -- GMT [global muon trigger]
649  //tbd: may compare extended candidates
650  L1MuGMTCandCollection const *gmt_can_data(new L1MuGMTCandCollection);
651  L1MuGMTCandCollection const *gmt_can_emul(new L1MuGMTCandCollection);
652  if(m_doSys[GMT]) {
653  iEvent.getByLabel(m_DEsource[GMT][0], gmt_data);
654  iEvent.getByLabel(m_DEsource[GMT][1], gmt_emul);
655  iEvent.getByLabel(m_DEsource[GMT][0], gmt_rdt_data_);
656  iEvent.getByLabel(m_DEsource[GMT][1], gmt_rdt_emul_);
657  }
658  L1MuGMTCandCollection gmt_can_data_vec, gmt_can_emul_vec;
659  L1MuRegionalCandCollection gmt_rdt_data_vec, gmt_rdt_emul_vec;
660  gmt_can_data_vec.clear(); gmt_can_emul_vec.clear();
661  gmt_rdt_data_vec.clear(); gmt_rdt_emul_vec.clear();
662  if( gmt_rdt_data_.isValid() && gmt_rdt_emul_.isValid() ) {
663  typedef std::vector<L1MuGMTReadoutRecord>::const_iterator GmtRrIt;
664  //get record vector for data
665  std::vector<L1MuGMTReadoutRecord> gmt_rdt_data_bx = gmt_rdt_data_->getRecords();
666  for(GmtRrIt igmtrr=gmt_rdt_data_bx.begin(); igmtrr!=gmt_rdt_data_bx.end(); igmtrr++) {
667  //get gmt cands
668  typedef std::vector<L1MuGMTExtendedCand>::const_iterator GmtECIt;
669  std::vector<L1MuGMTExtendedCand> gmc;
670  gmc = igmtrr->getGMTCands();
671  for(GmtECIt iter1=gmc.begin(); iter1!=gmc.end(); iter1++) {
672  L1MuGMTCand cand(iter1->getDataWord(),iter1->bx());
673  cand.setPhiValue(iter1->phiValue());
674  cand.setEtaValue(iter1->etaValue());
675  cand.setPtValue (iter1->ptValue ());
676  gmt_can_data_vec.push_back(cand);
677  }
678  //get reg cands
679  typedef L1MuRegionalCandCollection::const_iterator GmtRCIt;
681  rmc.clear();
682  rmc = igmtrr->getDTBXCands();
683  gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(),rmc.begin(),rmc.end());
684  rmc.clear();
685  rmc = igmtrr->getCSCCands();
686  gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(),rmc.begin(),rmc.end());
687  rmc.clear();
688  rmc = igmtrr->getBrlRPCCands();
689  gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(),rmc.begin(),rmc.end());
690  rmc.clear();
691  rmc = igmtrr->getFwdRPCCands();
692  gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(),rmc.begin(),rmc.end());
693  }
694  //get record vector for emul
695  std::vector<L1MuGMTReadoutRecord> gmt_rdt_emul_bx = gmt_rdt_emul_->getRecords();
696  for(GmtRrIt igmtrr=gmt_rdt_emul_bx.begin(); igmtrr!=gmt_rdt_emul_bx.end(); igmtrr++) {
697  //get gmt cands
698  typedef std::vector<L1MuGMTExtendedCand>::const_iterator GmtECIt;
699  std::vector<L1MuGMTExtendedCand> gmc;
700  gmc = igmtrr->getGMTCands();
701  for(GmtECIt iter1=gmc.begin(); iter1!=gmc.end(); iter1++) {
702  gmt_can_emul_vec.push_back(L1MuGMTCand(iter1->getDataWord(),iter1->bx()));
703  }
704  //get reg cands
705  typedef L1MuRegionalCandCollection::const_iterator GmtRCIt;
707  rmc.clear();
708  rmc = igmtrr->getDTBXCands();
709  gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(),rmc.begin(),rmc.end());
710  rmc.clear();
711  rmc = igmtrr->getCSCCands();
712  gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(),rmc.begin(),rmc.end());
713  rmc.clear();
714  rmc = igmtrr->getBrlRPCCands();
715  gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(),rmc.begin(),rmc.end());
716  rmc.clear();
717  rmc = igmtrr->getFwdRPCCands();
718  gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(),rmc.begin(),rmc.end());
719  }
720  }
721  gmt_rdt_data = &gmt_rdt_data_vec;
722  gmt_rdt_emul = &gmt_rdt_emul_vec;
723  gmt_can_data = &gmt_can_data_vec;
724  gmt_can_emul = &gmt_can_emul_vec;
725 
726  // -- GLT [global trigger]
733  if(m_doSys[GLT]) {
734  iEvent.getByLabel(m_DEsource[GLT][0], glt_rdt_data);
735  iEvent.getByLabel(m_DEsource[GLT][1], glt_rdt_emul);
736  iEvent.getByLabel(m_DEsource[GLT][0], glt_evm_data);
737  iEvent.getByLabel(m_DEsource[GLT][1], glt_evm_emul);
738  iEvent.getByLabel(m_DEsource[GLT][0], glt_obj_data);
739  iEvent.getByLabel(m_DEsource[GLT][1], glt_obj_emul);
740  }
741 
743 
744  //check collections validity
745  bool isValidDE[DEnsys][2];// = {false};
746  for(int i=0; i<DEnsys; i++) for(int j=0; j<2; j++) isValidDE[i][j]=false;
747 
748  isValidDE[ETP][0] = ecal_tp_data .isValid(); isValidDE[ETP][1] = ecal_tp_emul .isValid();
749  isValidDE[HTP][0] = hcal_tp_data .isValid(); isValidDE[HTP][1] = hcal_tp_emul .isValid();
750  isValidDE[RCT][0] = rct_em_data .isValid(); isValidDE[RCT][1] = rct_em_emul .isValid();
751  isValidDE[RCT][0]&= rct_rgn_data .isValid(); isValidDE[RCT][1] = rct_rgn_emul .isValid();
752  isValidDE[GCT][0] = gct_isolaem_data .isValid(); isValidDE[GCT][1] =gct_isolaem_emul .isValid();
753  isValidDE[GCT][0]&= gct_noisoem_data .isValid(); isValidDE[GCT][1]&=gct_noisoem_emul .isValid();
754  isValidDE[GCT][0]&= gct_cenjets_data .isValid(); isValidDE[GCT][1]&=gct_cenjets_emul .isValid();
755  isValidDE[GCT][0]&= gct_forjets_data .isValid(); isValidDE[GCT][1]&=gct_forjets_emul .isValid();
756  isValidDE[GCT][0]&= gct_taujets_data .isValid(); isValidDE[GCT][1]&=gct_taujets_emul .isValid();
757  isValidDE[GCT][0]&= gct_etmiss_data .isValid(); isValidDE[GCT][1]&= gct_etmiss_emul .isValid();
758  isValidDE[GCT][0]&= gct_ettota_data .isValid(); isValidDE[GCT][1]&= gct_ettota_emul .isValid();
759  isValidDE[GCT][0]&= gct_htmiss_data .isValid(); isValidDE[GCT][1]&= gct_htmiss_emul .isValid();
760  isValidDE[GCT][0]&= gct_hfring_data .isValid(); isValidDE[GCT][1]&= gct_hfring_emul .isValid();
761  isValidDE[GCT][0]&= gct_hfbcnt_data .isValid(); isValidDE[GCT][1]&= gct_hfbcnt_emul .isValid();
762 //isValidDE[GCT][0]&= gct_jetcnt_data .isValid(); isValidDE[GCT][1]&= gct_jetcnt_emul .isValid(); #temporary
763  isValidDE[DTP][0] = dtp_ph_data_.isValid(); isValidDE[DTP][1] = dtp_ph_emul_.isValid();
764  isValidDE[DTP][0]&= dtp_th_data_.isValid(); isValidDE[DTP][1]&= dtp_th_emul_.isValid();
765  isValidDE[DTF][0] = dtf_trk_data_.isValid(); isValidDE[DTF][1] = dtf_trk_emul_.isValid();
766 //isValidDE[DTF][0]&= dtf_data .isValid(); isValidDE[DTF][1]&= dtf_emul .isValid();
767  isValidDE[CTP][0] = ctp_lct_data_.isValid(); isValidDE[CTP][1] = ctp_lct_emul_.isValid();
768  if (m_DEsource[CTP][0].label().find("tf") == std::string::npos) {
769  isValidDE[CTP][0]&= ctp_ano_data_.isValid(); isValidDE[CTP][1]&= ctp_ano_emul_.isValid();
770  isValidDE[CTP][0]&= ctp_cat_data_.isValid(); isValidDE[CTP][1]&= ctp_cat_emul_.isValid();
771  }
772  isValidDE[CTF][0] = ctf_data .isValid(); isValidDE[CTF][1] = ctf_emul .isValid();
773  isValidDE[CTF][0]&= ctf_trk_data_ .isValid(); isValidDE[CTF][1]&= ctf_trk_emul_ .isValid();
774  //isValidDE[CTF][0]&= ctf_sta_data_ .isValid(); isValidDE[CTF][1]&= ctf_sta_emul_ .isValid();
775  isValidDE[RPC][0] = rpc_cen_data .isValid(); isValidDE[RPC][1] = rpc_cen_emul .isValid();
776  isValidDE[RPC][0]&= rpc_for_data .isValid(); isValidDE[RPC][1]&= rpc_for_emul .isValid();
777  isValidDE[LTC][0] = ltc_data .isValid(); isValidDE[LTC][1] = ltc_emul .isValid();
778  isValidDE[GMT][0] = gmt_data .isValid(); isValidDE[GMT][1] = gmt_emul .isValid();
779 //isValidDE[GMT][0]&= gmt_rdt_data_.isValid(); isValidDE[GMT][1]&= gmt_rdt_emul_.isValid();
780  isValidDE[GLT][0] = glt_rdt_data .isValid(); isValidDE[GLT][1] = glt_rdt_emul .isValid();
781 //isValidDE[GLT][0]&= glt_evm_data .isValid(); isValidDE[GLT][1]&= glt_evm_emul .isValid();
782 //isValidDE[GLT][0]&= glt_obj_data .isValid(); isValidDE[GLT][1]&= glt_obj_emul .isValid();
783 
784  bool isValid[DEnsys];
785  for(int i=0; i<DEnsys; i++) {
786  isValid[i]=true;
787  for(int j=0; j<2; j++) {
788  isValid[i] &= isValidDE[i][j];
789  }
790  }
791 
792  if(verbose()) {
793  std::cout << "L1Comparator sys isValid? (evt:" << nevt_ << ") ";
794  std::cout << "\n\t&: ";
795  for(int i=0; i<DEnsys; i++)
796  std::cout << isValid[i] << " ";
797  std::cout << "\n\td: ";
798  for(int i=0; i<DEnsys; i++)
799  std::cout << isValidDE[i][0] << " ";
800  std::cout << "\n\te: ";
801  for(int i=0; i<DEnsys; i++)
802  std::cout << isValidDE[i][1] << " ";
803  std::cout << std::endl;
804  }
805 
806  //reset flags...
807  //for(int i=0; i<DEnsys; i++) isValid[i]=true;
808 
809  if(verbose())
810  std::cout << "L1Comparator start processing the collections.\n" << std::flush;
811 
813  if(m_doSys[ETP]&&isValid[ETP]) process<EcalTrigPrimDigiCollection> ( ecal_tp_data, ecal_tp_emul, ETP,ECALtp);
814  if(m_doSys[HTP]&&isValid[HTP]) process<HcalTrigPrimDigiCollection> ( hcal_tp_data, hcal_tp_emul, HTP,HCALtp);
815  if(m_doSys[RCT]&&isValid[RCT]) process<L1CaloEmCollection> ( rct_em_data, rct_em_emul, RCT,RCTem);
816  if(m_doSys[RCT]&&isValid[RCT]) process<L1CaloRegionCollection> ( rct_rgn_data, rct_rgn_emul, RCT,RCTrgn);
817  if(m_doSys[GCT]&&isValid[GCT]) process<L1GctEmCandCollection> (gct_isolaem_data, gct_isolaem_emul, GCT,GCTisolaem);
818  if(m_doSys[GCT]&&isValid[GCT]) process<L1GctEmCandCollection> (gct_noisoem_data, gct_noisoem_emul, GCT,GCTnoisoem);
819  if(m_doSys[GCT]&&isValid[GCT]) process<L1GctJetCandCollection> (gct_cenjets_data, gct_cenjets_emul, GCT,GCTcenjets);
820  if(m_doSys[GCT]&&isValid[GCT]) process<L1GctJetCandCollection> (gct_forjets_data, gct_forjets_emul, GCT,GCTforjets);
821  if(m_doSys[GCT]&&isValid[GCT]) process<L1GctJetCandCollection> (gct_taujets_data, gct_taujets_emul, GCT,GCTtaujets);
822  if(m_doSys[GCT]&&isValid[GCT]) process<L1GctEtHadCollection> ( gct_ht_data, gct_ht_emul, GCT,GCTethad);
823  if(m_doSys[GCT]&&isValid[GCT]) process<L1GctEtMissCollection> ( gct_etmiss_data, gct_etmiss_emul, GCT,GCTetmiss);
824  if(m_doSys[GCT]&&isValid[GCT]) process<L1GctEtTotalCollection> ( gct_ettota_data , gct_ettota_emul, GCT,GCTettot);
825  if(m_doSys[GCT]&&isValid[GCT]) process<L1GctHtMissCollection> ( gct_htmiss_data, gct_htmiss_emul, GCT,GCThtmiss);
826  if(m_doSys[GCT]&&isValid[GCT]) process<L1GctHFRingEtSumsCollection> ( gct_hfring_data, gct_hfring_emul, GCT,GCThfring);
827  if(m_doSys[GCT]&&isValid[GCT]) process<L1GctHFBitCountsCollection> ( gct_hfbcnt_data, gct_hfbcnt_emul, GCT,GCThfbit);
828 //if(m_doSys[GCT]&&isValid[GCT]) process<L1GctJetCountsCollection> ( gct_jetcnt_data, gct_jetcnt_emul, GCT,GCTjetcnt);#missing in emulator
829  if(m_doSys[DTP]&&isValid[DTP]) process<L1MuDTChambPhDigiCollection> ( dtp_ph_data, dtp_ph_emul, DTP,DTtpPh);
830  if(m_doSys[DTP]&&isValid[DTP]) process<L1MuDTChambThDigiCollection> ( dtp_th_data, dtp_th_emul, DTP,DTtpTh);
831  if(m_doSys[DTF]&&isValid[DTF]) process<L1MuRegionalCandCollection> ( dtf_data, dtf_emul, DTF,DTtf);
832  if(m_doSys[DTF]&&isValid[DTF]) process<L1MuRegionalCandCollection> ( dtf_trk_data, dtf_trk_emul, DTF,DTtftrk);
833  if(m_DEsource[CTP][0].label().find("tf") == std::string::npos) {
834  if(m_doSys[CTP]&&isValid[CTP]) process<CSCALCTDigiCollection_> ( ctp_ano_data, ctp_ano_emul, CTP,CSCtpa);
835  if(m_doSys[CTP]&&isValid[CTP]) process<CSCCLCTDigiCollection_> ( ctp_cat_data, ctp_cat_emul, CTP,CSCtpc);
836  }
837  if(m_doSys[CTP]&&isValid[CTP]) process<CSCCorrelatedLCTDigiCollection_>( ctp_lct_data, ctp_lct_emul, CTP,CSCtpl);
838  if(m_doSys[CTF]&&isValid[CTF]) process<L1MuRegionalCandCollection> ( ctf_data, ctf_emul, CTF,CSCtf);
839  if(m_doSys[CTF]&&isValid[CTF]) process<CSCCorrelatedLCTDigiCollection_>( ctf_trk_data, ctf_trk_emul, CTF,CSCtftrk);
840  //if(m_doSys[CTF]&&isValid[CTF]) process<L1MuRegionalCandCollection> ( ctf_trc_data, ctf_trc_emul, CTF,CSCtftrc);
841  if(m_doSys[CTF]&&isValid[CTF]) process<L1CSCSPStatusDigiCollection_> ( ctf_sta_data, ctf_sta_emul, CTF,CSCtfsta);
842  if(m_doSys[RPC]&&isValid[RPC]) process<L1MuRegionalCandCollection> ( rpc_cen_data, rpc_cen_emul, RPC,RPCcen);
843  if(m_doSys[RPC]&&isValid[RPC]) process<L1MuRegionalCandCollection> ( rpc_for_data, rpc_for_emul, RPC,RPCfor);
844  if(m_doSys[LTC]&&isValid[LTC]) process<LTCDigiCollection> ( ltc_data, ltc_emul, LTC,LTCi);
845  if(m_doSys[GMT]&&isValid[GMT]) process<L1MuGMTCandCollection> ( gmt_data, gmt_emul, GMT,GMTmain);
846  if(m_doSys[GMT]&&isValid[GMT]) process<L1MuRegionalCandCollection> ( gmt_rdt_data, gmt_rdt_emul, GMT,GMTrdt);
847  if(m_doSys[GMT]&&isValid[GMT]) process<L1MuGMTCandCollection> ( gmt_can_data, gmt_can_emul, GMT,GMTcnd);
848 
849  // >>---- GLT ---- <<
850  GltDEDigi gltdigimon;
851 
852  if(m_doSys[GLT] && isValid[GLT] ) {
853 
855  bool prt = false;
856  if(!m_dumpMode)
857  prt = false;
858  else if(m_dumpMode==-1)
859  prt=true;
860 
861  if(dumpEvent_ && prt) {
862  m_dumpFile << "\nEntry: " << nevt_
863  << " (event:" << evtNum_
864  << " | run:" << runNum_
865  << ")\n" << std::flush;
866  dumpEvent_=false;
867  }
868 
869  m_dumpFile << "\n GT...\n";
870 
871  if(glt_rdt_data.isValid() && glt_rdt_emul.isValid()) {
872 
873  //fill gt mon info
874  bool globalDBit[2];
875  std::vector<bool> gltDecBits[2], gltTchBits[2];
876  globalDBit[0] = glt_rdt_data->decision();
877  globalDBit[1] = glt_rdt_emul->decision();
878  gltDecBits[0] = glt_rdt_data->decisionWord();
879  gltDecBits[1] = glt_rdt_emul->decisionWord();
880  //gltTchBits[0] = glt_rdt_data->gtFdlWord().gtTechnicalTriggerWord();
881  //gltTchBits[1] = glt_rdt_emul->gtFdlWord().gtTechnicalTriggerWord();
882  gltTchBits[0] = glt_rdt_data->technicalTriggerWord();
883  gltTchBits[1] = glt_rdt_emul->technicalTriggerWord();
884  gltdigimon.set(globalDBit, gltDecBits, gltTchBits);
885 
886  DEncand[GLT][0]=1; DEncand[GLT][1]=1;
887  DEmatchEvt[GLT] = compareCollections(glt_rdt_data, glt_rdt_emul);
888  }
889 
891  if(glt_evm_data.isValid() && glt_evm_emul.isValid())
892  DEmatchEvt[GLT] &= compareCollections(glt_evm_data, glt_evm_emul);
893  if(glt_obj_data.isValid() && glt_obj_emul.isValid())
894  DEmatchEvt[GLT] &= compareCollections(glt_obj_data, glt_obj_emul);
895 
896  char ok[10];
897  char dumptofile[1000];
898  if(DEmatchEvt[GLT]) sprintf(ok,"successful");
899  else sprintf(ok,"failed");
900  sprintf(dumptofile," ...GT data and emulator comparison: %s\n", ok);
901  m_dumpFile<<dumptofile;
902  }
903 
904  if(verbose())
905  std::cout << "L1Comparator done processing all collections.\n" << std::flush;
906 
907  if(verbose()) {
908  std::cout << "[L1Comparator] sys match? << evt." << nevt_ << ": ";
909  for(int i=0; i<DEnsys; i++)
910  std::cout << DEmatchEvt[i] << " ";
911  std::cout << std::endl;
912  }
913 
914 
915  // >>---- Event match? ---- <<
916 
917  bool evt_match = true;
918  for(int i=0; i<DEnsys; i++)
919  evt_match &= DEmatchEvt[i];
920 
921 
922  /* char ok[10];
923  if(evt_match) sprintf(ok,"GOOD :]");
924  else sprintf(ok,"BAD !!!");
925  char dumptofile[1000];
926  sprintf(dumptofile,"\n -> event data and emulator match... %s\n", ok);
927  m_dumpFile<<dumptofile;
928  */
929 
930  // >>---- Global match? ---- <<
931  m_match &= evt_match;
932  m_dumpFile << std::flush;
933 
934  //if collection is empty, add empty digi
935  if(m_dedigis.size()==0) {
936  if(verbose())
937  std::cout << "\n [L1Comparator] adding empty collection to DErecord\n";
938  m_dedigis.push_back(L1DataEmulDigi());
939  }
940 
941  // >>---- d|e record ---- <<
942  std::auto_ptr<L1DataEmulRecord> record
943  (new L1DataEmulRecord(evt_match,m_doSys,DEmatchEvt,DEncand,m_dedigis, gltdigimon));
944  if(verbose()) {
945  std::cout << "\n [L1Comparator] printing DErecord"
946  << "(entry:"<< nevt_
947  << "|evt:" << evtNum_
948  << "|run:" << runNum_
949  << "):\n" << std::flush;
950  std::cout << *record
951  << "\n" << std::flush;
952  }
953 
954  iEvent.put(record);
955 
957  bool dorawdata = false;
958  if(dorawdata) {
959  edm::Handle<FEDRawDataCollection> raw_fedcoll_data;
960  edm::Handle<FEDRawDataCollection> raw_fedcoll_emul;
961  iEvent.getByLabel(m_FEDsource[0], raw_fedcoll_data);
962  iEvent.getByLabel(m_FEDsource[1], raw_fedcoll_emul);
963  bool rawval=true;
964  rawval &= raw_fedcoll_data.isValid();
965  rawval &= raw_fedcoll_emul.isValid();
966  if(rawval)
967  compareFedRawCollections(raw_fedcoll_data,raw_fedcoll_emul, m_fedId);
968  }
969 
970  if(verbose())
971  std::cout << "L1comparator::analize() end. " << nevt_ << std::endl;
972 
973 }
RunNumber_t run() const
Definition: EventID.h:42
EventNumber_t event() const
Definition: EventID.h:44
int i
Definition: DBlmapReader.cc:9
std::vector< CSCALCTDigi > CSCALCTDigiCollection_
Definition: DEtrait.h:73
const int DEnsys
Definition: DEtrait.h:38
int DEncand[dedefs::DEnsys][2]
Definition: L1Comparator.h:95
JetCorrectorParameters::Record record
Definition: classes.h:11
static PFTauRenderPlugin instance
void clear()
clear this ALCT
Definition: CSCALCTDigi.cc:37
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
edm::InputTag m_FEDsource[2]
Definition: L1Comparator.h:99
edm::InputTag m_DEsource[dedefs::DEnsys][4]
Definition: L1Comparator.h:88
void setPhiValue(float phiVal)
Setters for physical values.
Definition: L1MuGMTCand.h:179
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
std::vector< CSCCLCTDigi > CSCCLCTDigiCollection_
Definition: DEtrait.h:74
std::vector< L1CSCSPStatusDigi > L1CSCSPStatusDigiCollection_
Definition: DEtrait.h:76
int j
Definition: DBlmapReader.cc:9
bool compareCollections(edm::Handle< L1GlobalTriggerReadoutRecord > data, edm::Handle< L1GlobalTriggerReadoutRecord > emul)
bool isValid() const
Definition: HandleBase.h:76
std::vector< L1MuDTChambThDigi > L1MuDTChambThDigiCollection
Definition: DEtrait.h:71
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
std::vector< L1MuRegionalCand > L1MuRegionalCandCollection
bool compareFedRawCollections(edm::Handle< FEDRawDataCollection > data, edm::Handle< FEDRawDataCollection > emul, int fedid)
std::vector< L1MuDTChambPhDigi > L1MuDTChambPhDigiCollection
Definition: DEtrait.h:70
std::vector< CSCCorrelatedLCTDigi > CSCCorrelatedLCTDigiCollection_
Definition: DEtrait.h:75
std::vector< DigiType >::const_iterator const_iterator
bool DEmatchEvt[dedefs::DEnsys]
Definition: L1Comparator.h:94
L1DEDigiCollection m_dedigis
Definition: L1Comparator.h:96
edm::EventID id() const
Definition: EventBase.h:56
std::ofstream m_dumpFile
Definition: L1Comparator.h:91
void clear()
clear this CLCT
Definition: CSCCLCTDigi.cc:60
std::pair< const_iterator, const_iterator > Range
tuple cout
Definition: gather_cfg.py:121
std::vector< L1MuGMTCand > L1MuGMTCandCollection
Definition: DEtrait.h:77
bool m_doSys[dedefs::DEnsys]
Definition: L1Comparator.h:89
int L1Comparator::verbose ( )
inlineprivate

Definition at line 78 of file L1Comparator.h.

References verbose_.

78 {return verbose_;}

Member Data Documentation

bool L1Comparator::DEmatchEvt[dedefs::DEnsys]
private

Definition at line 94 of file L1Comparator.h.

int L1Comparator::DEncand[dedefs::DEnsys][2]
private

Definition at line 95 of file L1Comparator.h.

bool L1Comparator::dumpEvent_
private

Definition at line 86 of file L1Comparator.h.

int L1Comparator::evtNum_
private

Definition at line 83 of file L1Comparator.h.

L1DEDigiCollection L1Comparator::m_dedigis
private

Definition at line 96 of file L1Comparator.h.

edm::InputTag L1Comparator::m_DEsource[dedefs::DEnsys][4]
private

Definition at line 88 of file L1Comparator.h.

bool L1Comparator::m_doSys[dedefs::DEnsys]
private

Definition at line 89 of file L1Comparator.h.

std::ofstream L1Comparator::m_dumpFile
private

Definition at line 91 of file L1Comparator.h.

std::string L1Comparator::m_dumpFileName
private

Definition at line 90 of file L1Comparator.h.

int L1Comparator::m_dumpMode
private

Definition at line 92 of file L1Comparator.h.

int L1Comparator::m_fedId
private

Definition at line 98 of file L1Comparator.h.

edm::InputTag L1Comparator::m_FEDsource[2]
private

Definition at line 99 of file L1Comparator.h.

bool L1Comparator::m_match
private

Definition at line 93 of file L1Comparator.h.

int L1Comparator::nevt_
private

Definition at line 82 of file L1Comparator.h.

int L1Comparator::runNum_
private

Definition at line 84 of file L1Comparator.h.

int L1Comparator::verbose_
private

Definition at line 85 of file L1Comparator.h.

Referenced by verbose().