4 |
|
#include <stdexcept> |
5 |
|
#include <cmath> |
6 |
|
|
7 |
< |
#include "UserCode/L1TriggerUpgrade/macros/L1Menu2015.h" |
7 |
> |
#include <TSystem.h> |
8 |
> |
#include "UserCode/L1TriggerUpgrade/macros/L1UpgradeNtuple.h" |
9 |
> |
#include "UserCode/L1TriggerUpgrade/interface/L1AnalysisDataFormat.h" |
10 |
> |
#include "l1menu/IEvent.h" |
11 |
> |
|
12 |
> |
// I'll use the unnamed namespace for things that are only used in this file |
13 |
> |
namespace |
14 |
> |
{ |
15 |
> |
/** Implementation of the l1menu::IEvent interface. |
16 |
> |
* |
17 |
> |
* @author Mark Grimes (mark.grimes@bristol.ac.uk) |
18 |
> |
* @date 21/May/2013 |
19 |
> |
*/ |
20 |
> |
class EventImplementation : public l1menu::IEvent |
21 |
> |
{ |
22 |
> |
public: |
23 |
> |
// |
24 |
> |
// These are the methods required by the IEvent interface |
25 |
> |
// |
26 |
> |
virtual L1Analysis::L1AnalysisDataFormat& rawEvent() { return rawEvent_; } |
27 |
> |
virtual const L1Analysis::L1AnalysisDataFormat& rawEvent() const { return rawEvent_; } |
28 |
> |
virtual bool* physicsBits() { return physicsBits_; } |
29 |
> |
virtual const bool* physicsBits() const { return physicsBits_; } |
30 |
> |
virtual float weight() const { return 1; } |
31 |
> |
protected: |
32 |
> |
L1Analysis::L1AnalysisDataFormat rawEvent_; |
33 |
> |
bool physicsBits_[128]; |
34 |
> |
}; // end of the EventImplementation class |
35 |
> |
|
36 |
> |
} // end of the unnamed namespace |
37 |
|
|
38 |
|
namespace l1menu |
39 |
|
{ |
52 |
|
double calculateHTM( const L1Analysis::L1AnalysisDataFormat& event ); |
53 |
|
public: |
54 |
|
void fillDataStructure( int selectDataInput ); |
55 |
+ |
void fillL1Bits(); |
56 |
|
L1UpgradeNtuple inputNtuple; |
57 |
< |
L1Analysis::L1AnalysisDataFormat currentEvent; |
57 |
> |
::EventImplementation currentEvent; |
58 |
|
}; |
59 |
|
} |
60 |
|
|
143 |
|
|
144 |
|
void l1menu::MenuSamplePrivateMembers::fillDataStructure( int selectDataInput ) |
145 |
|
{ |
146 |
< |
currentEvent.Reset(); |
146 |
> |
// Use a reference for ease of use |
147 |
> |
L1Analysis::L1AnalysisDataFormat& analysisDataFormat=currentEvent.rawEvent(); |
148 |
> |
|
149 |
> |
analysisDataFormat.Reset(); |
150 |
|
|
151 |
|
// Grab standard event information |
152 |
< |
currentEvent.Run=inputNtuple.event_->run; |
153 |
< |
currentEvent.LS=inputNtuple.event_->lumi; |
154 |
< |
currentEvent.Event=inputNtuple.event_->event; |
152 |
> |
analysisDataFormat.Run=inputNtuple.event_->run; |
153 |
> |
analysisDataFormat.LS=inputNtuple.event_->lumi; |
154 |
> |
analysisDataFormat.Event=inputNtuple.event_->event; |
155 |
|
|
156 |
|
/* ======================================================================================================= |
157 |
|
/ Select the input source information |
177 |
|
for( unsigned int i=0; i<inputNtuple.l1upgrade_->nEG; i++ ) |
178 |
|
{ |
179 |
|
|
180 |
< |
currentEvent.Bxel.push_back( inputNtuple.l1upgrade_->egBx.at( i ) ); |
181 |
< |
currentEvent.Etel.push_back( inputNtuple.l1upgrade_->egEt.at( i ) ); |
182 |
< |
currentEvent.Phiel.push_back( phiINjetCoord( inputNtuple.l1upgrade_->egPhi.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with phiINjetCoord |
183 |
< |
currentEvent.Etael.push_back( etaINjetCoord( inputNtuple.l1upgrade_->egEta.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with etaINjetCoord |
180 |
> |
analysisDataFormat.Bxel.push_back( inputNtuple.l1upgrade_->egBx.at( i ) ); |
181 |
> |
analysisDataFormat.Etel.push_back( inputNtuple.l1upgrade_->egEt.at( i ) ); |
182 |
> |
analysisDataFormat.Phiel.push_back( phiINjetCoord( inputNtuple.l1upgrade_->egPhi.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with phiINjetCoord |
183 |
> |
analysisDataFormat.Etael.push_back( etaINjetCoord( inputNtuple.l1upgrade_->egEta.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with etaINjetCoord |
184 |
|
|
185 |
|
// Check whether this EG is located in the isolation list |
186 |
|
bool isolated=false; |
196 |
|
} |
197 |
|
isoEG++; |
198 |
|
} |
199 |
< |
currentEvent.Isoel.push_back( isolated ); |
200 |
< |
currentEvent.Nele++; |
199 |
> |
analysisDataFormat.Isoel.push_back( isolated ); |
200 |
> |
analysisDataFormat.Nele++; |
201 |
|
} |
202 |
|
|
203 |
|
// Note: Taus are in the jet list. Decide what to do with them. For now |
221 |
|
|
222 |
|
if( !duplicate ) |
223 |
|
{ |
224 |
< |
currentEvent.Bxjet.push_back( inputNtuple.l1upgrade_->jetBx.at( i ) ); |
225 |
< |
currentEvent.Etjet.push_back( inputNtuple.l1upgrade_->jetEt.at( i ) ); |
226 |
< |
currentEvent.Phijet.push_back( phiINjetCoord( inputNtuple.l1upgrade_->jetPhi.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with phiINjetCoord |
227 |
< |
currentEvent.Etajet.push_back( etaINjetCoord( inputNtuple.l1upgrade_->jetEta.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with etaINjetCoord |
228 |
< |
currentEvent.Taujet.push_back( false ); |
229 |
< |
currentEvent.isoTaujet.push_back( false ); |
230 |
< |
//currentEvent.Fwdjet.push_back(false); //COMMENT OUT IF JET ETA FIX |
224 |
> |
analysisDataFormat.Bxjet.push_back( inputNtuple.l1upgrade_->jetBx.at( i ) ); |
225 |
> |
analysisDataFormat.Etjet.push_back( inputNtuple.l1upgrade_->jetEt.at( i ) ); |
226 |
> |
analysisDataFormat.Phijet.push_back( phiINjetCoord( inputNtuple.l1upgrade_->jetPhi.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with phiINjetCoord |
227 |
> |
analysisDataFormat.Etajet.push_back( etaINjetCoord( inputNtuple.l1upgrade_->jetEta.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with etaINjetCoord |
228 |
> |
analysisDataFormat.Taujet.push_back( false ); |
229 |
> |
analysisDataFormat.isoTaujet.push_back( false ); |
230 |
> |
//analysisDataFormat.Fwdjet.push_back(false); //COMMENT OUT IF JET ETA FIX |
231 |
|
|
232 |
< |
//if(fabs(inputNtuple.l1upgrade_->jetEta.at(i))>=3.0) printf("Et %f Eta %f iEta %f Phi %f iPhi %f \n",currentEvent.Etjet.at(currentEvent.Njet),inputNtuple.l1upgrade_->jetEta.at(i),currentEvent.Etajet.at(currentEvent.Njet),inputNtuple.l1upgrade_->jetPhi.at(i),currentEvent.Phijet.at(currentEvent.Njet)); |
232 |
> |
//if(fabs(inputNtuple.l1upgrade_->jetEta.at(i))>=3.0) printf("Et %f Eta %f iEta %f Phi %f iPhi %f \n",analysisDataFormat.Etjet.at(analysisDataFormat.Njet),inputNtuple.l1upgrade_->jetEta.at(i),analysisDataFormat.Etajet.at(analysisDataFormat.Njet),inputNtuple.l1upgrade_->jetPhi.at(i),analysisDataFormat.Phijet.at(analysisDataFormat.Njet)); |
233 |
|
// Eta Jet Fix. Some Jets with eta>3 has appeared in central jet list. Move them by hand |
234 |
|
// This is a problem in Stage 2 Jet code. |
235 |
< |
(fabs( inputNtuple.l1upgrade_->jetEta.at( i ) )>=3.0) ? currentEvent.Fwdjet.push_back( true ) : currentEvent.Fwdjet.push_back( false ); |
235 |
> |
(fabs( inputNtuple.l1upgrade_->jetEta.at( i ) )>=3.0) ? analysisDataFormat.Fwdjet.push_back( true ) : analysisDataFormat.Fwdjet.push_back( false ); |
236 |
|
|
237 |
< |
currentEvent.Njet++; |
237 |
> |
analysisDataFormat.Njet++; |
238 |
|
} |
239 |
|
} |
240 |
|
|
241 |
|
for( unsigned int i=0; i<inputNtuple.l1upgrade_->nFwdJets; i++ ) |
242 |
|
{ |
243 |
|
|
244 |
< |
currentEvent.Bxjet.push_back( inputNtuple.l1upgrade_->fwdJetBx.at( i ) ); |
245 |
< |
currentEvent.Etjet.push_back( inputNtuple.l1upgrade_->fwdJetEt.at( i ) ); |
246 |
< |
currentEvent.Phijet.push_back( phiINjetCoord( inputNtuple.l1upgrade_->fwdJetPhi.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with phiINjetCoord |
247 |
< |
currentEvent.Etajet.push_back( etaINjetCoord( inputNtuple.l1upgrade_->fwdJetEta.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with etaINjetCoord |
248 |
< |
currentEvent.Taujet.push_back( false ); |
249 |
< |
currentEvent.isoTaujet.push_back( false ); |
250 |
< |
currentEvent.Fwdjet.push_back( true ); |
244 |
> |
analysisDataFormat.Bxjet.push_back( inputNtuple.l1upgrade_->fwdJetBx.at( i ) ); |
245 |
> |
analysisDataFormat.Etjet.push_back( inputNtuple.l1upgrade_->fwdJetEt.at( i ) ); |
246 |
> |
analysisDataFormat.Phijet.push_back( phiINjetCoord( inputNtuple.l1upgrade_->fwdJetPhi.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with phiINjetCoord |
247 |
> |
analysisDataFormat.Etajet.push_back( etaINjetCoord( inputNtuple.l1upgrade_->fwdJetEta.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with etaINjetCoord |
248 |
> |
analysisDataFormat.Taujet.push_back( false ); |
249 |
> |
analysisDataFormat.isoTaujet.push_back( false ); |
250 |
> |
analysisDataFormat.Fwdjet.push_back( true ); |
251 |
|
|
252 |
< |
currentEvent.Njet++; |
252 |
> |
analysisDataFormat.Njet++; |
253 |
|
} |
254 |
|
|
255 |
|
// NOTES: Stage 1 has Tau Relaxed and TauIsolated. The isolated Tau are a subset of the Relaxed. |
274 |
|
|
275 |
|
if( !duplicate ) |
276 |
|
{ |
277 |
< |
currentEvent.Bxjet.push_back( inputNtuple.l1upgrade_->tauBx.at( i ) ); |
278 |
< |
currentEvent.Etjet.push_back( inputNtuple.l1upgrade_->tauEt.at( i ) ); |
279 |
< |
currentEvent.Phijet.push_back( phiINjetCoord( inputNtuple.l1upgrade_->tauPhi.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with phiINjetCoord |
280 |
< |
currentEvent.Etajet.push_back( etaINjetCoord( inputNtuple.l1upgrade_->tauEta.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with etaINjetCoord |
281 |
< |
currentEvent.Taujet.push_back( true ); |
282 |
< |
currentEvent.Fwdjet.push_back( false ); |
277 |
> |
analysisDataFormat.Bxjet.push_back( inputNtuple.l1upgrade_->tauBx.at( i ) ); |
278 |
> |
analysisDataFormat.Etjet.push_back( inputNtuple.l1upgrade_->tauEt.at( i ) ); |
279 |
> |
analysisDataFormat.Phijet.push_back( phiINjetCoord( inputNtuple.l1upgrade_->tauPhi.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with phiINjetCoord |
280 |
> |
analysisDataFormat.Etajet.push_back( etaINjetCoord( inputNtuple.l1upgrade_->tauEta.at( i ) ) ); //PROBLEM: real value, trigger wants bin convert with etaINjetCoord |
281 |
> |
analysisDataFormat.Taujet.push_back( true ); |
282 |
> |
analysisDataFormat.Fwdjet.push_back( false ); |
283 |
|
|
284 |
|
bool isolated=false; |
285 |
|
bool fnd=false; |
294 |
|
} |
295 |
|
isoTau++; |
296 |
|
} |
297 |
< |
currentEvent.isoTaujet.push_back( isolated ); |
297 |
> |
analysisDataFormat.isoTaujet.push_back( isolated ); |
298 |
|
|
299 |
< |
currentEvent.Njet++; |
299 |
> |
analysisDataFormat.Njet++; |
300 |
|
} // duplicate check |
301 |
|
} |
302 |
|
|
304 |
|
for( unsigned int i=0; i<inputNtuple.l1upgrade_->nMet; i++ ) |
305 |
|
{ |
306 |
|
//if(inputNtuple.l1upgrade_->metBx.at(i)==0) { |
307 |
< |
currentEvent.ETT=inputNtuple.l1upgrade_->et.at( i ); |
308 |
< |
currentEvent.ETM=inputNtuple.l1upgrade_->met.at( i ); |
309 |
< |
currentEvent.PhiETM=inputNtuple.l1upgrade_->metPhi.at( i ); |
307 |
> |
analysisDataFormat.ETT=inputNtuple.l1upgrade_->et.at( i ); |
308 |
> |
analysisDataFormat.ETM=inputNtuple.l1upgrade_->met.at( i ); |
309 |
> |
analysisDataFormat.PhiETM=inputNtuple.l1upgrade_->metPhi.at( i ); |
310 |
|
} |
311 |
< |
currentEvent.OvETT=0; //not available in l1extra |
312 |
< |
currentEvent.OvETM=0; //not available in l1extra |
311 |
> |
analysisDataFormat.OvETT=0; //not available in l1extra |
312 |
> |
analysisDataFormat.OvETM=0; //not available in l1extra |
313 |
|
|
314 |
|
for( unsigned int i=0; i<inputNtuple.l1upgrade_->nMht; i++ ) |
315 |
|
{ |
316 |
|
if( inputNtuple.l1upgrade_->mhtBx.at( i )==0 ) |
317 |
|
{ |
318 |
< |
currentEvent.HTT=calculateHTT( currentEvent ); //inputNtuple.l1upgrade_->ht.at(i) ; |
319 |
< |
currentEvent.HTM=calculateHTM( currentEvent ); //inputNtuple.l1upgrade_->mht.at(i) ; |
320 |
< |
currentEvent.PhiHTM=0.; //inputNtuple.l1upgrade_->mhtPhi.at(i) ; |
318 |
> |
analysisDataFormat.HTT=calculateHTT( analysisDataFormat ); //inputNtuple.l1upgrade_->ht.at(i) ; |
319 |
> |
analysisDataFormat.HTM=calculateHTM( analysisDataFormat ); //inputNtuple.l1upgrade_->mht.at(i) ; |
320 |
> |
analysisDataFormat.PhiHTM=0.; //inputNtuple.l1upgrade_->mhtPhi.at(i) ; |
321 |
|
} |
322 |
|
} |
323 |
< |
currentEvent.OvHTM=0; //not available in l1extra |
324 |
< |
currentEvent.OvHTT=0; //not available in l1extra |
323 |
> |
analysisDataFormat.OvHTM=0; //not available in l1extra |
324 |
> |
analysisDataFormat.OvHTT=0; //not available in l1extra |
325 |
|
|
326 |
|
// Get the muon information from reEmul GMT |
327 |
|
for( int i=0; i<inputNtuple.gmtEmu_->N; i++ ) |
328 |
|
{ |
329 |
|
|
330 |
< |
currentEvent.Bxmu.push_back( inputNtuple.gmtEmu_->CandBx[i] ); |
331 |
< |
currentEvent.Ptmu.push_back( inputNtuple.gmtEmu_->Pt[i] ); |
332 |
< |
currentEvent.Phimu.push_back( inputNtuple.gmtEmu_->Phi[i] ); |
333 |
< |
currentEvent.Etamu.push_back( inputNtuple.gmtEmu_->Eta[i] ); |
334 |
< |
currentEvent.Qualmu.push_back( inputNtuple.gmtEmu_->Qual[i] ); |
335 |
< |
currentEvent.Isomu.push_back( false ); |
330 |
> |
analysisDataFormat.Bxmu.push_back( inputNtuple.gmtEmu_->CandBx[i] ); |
331 |
> |
analysisDataFormat.Ptmu.push_back( inputNtuple.gmtEmu_->Pt[i] ); |
332 |
> |
analysisDataFormat.Phimu.push_back( inputNtuple.gmtEmu_->Phi[i] ); |
333 |
> |
analysisDataFormat.Etamu.push_back( inputNtuple.gmtEmu_->Eta[i] ); |
334 |
> |
analysisDataFormat.Qualmu.push_back( inputNtuple.gmtEmu_->Qual[i] ); |
335 |
> |
analysisDataFormat.Isomu.push_back( false ); |
336 |
|
} |
337 |
|
|
338 |
|
break; |
346 |
|
return; |
347 |
|
} |
348 |
|
|
349 |
+ |
void l1menu::MenuSamplePrivateMembers::fillL1Bits() |
350 |
+ |
{ |
351 |
+ |
bool* PhysicsBits=currentEvent.physicsBits(); |
352 |
+ |
|
353 |
+ |
// I really don't think this if statement is correct. Surely it |
354 |
+ |
// should be "if( gt_ )"? - M. Grimes. |
355 |
+ |
if( !inputNtuple.gt_ ) |
356 |
+ |
{ |
357 |
+ |
for( Int_t ibit=0; ibit<128; ibit++ ) |
358 |
+ |
{ |
359 |
+ |
PhysicsBits[ibit]=0; |
360 |
+ |
if( ibit<64 ) |
361 |
+ |
{ |
362 |
+ |
PhysicsBits[ibit]=(inputNtuple.gt_->tw1[2]>>ibit)&1; |
363 |
+ |
} |
364 |
+ |
else |
365 |
+ |
{ |
366 |
+ |
PhysicsBits[ibit]=(inputNtuple.gt_->tw2[2]>>(ibit-64))&1; |
367 |
+ |
} |
368 |
+ |
} |
369 |
+ |
} |
370 |
+ |
else |
371 |
+ |
{ |
372 |
+ |
PhysicsBits[0]=1; //set zero bias on if no gt information |
373 |
+ |
} |
374 |
+ |
} |
375 |
+ |
|
376 |
+ |
|
377 |
|
l1menu::MenuSample::MenuSample() |
378 |
|
: pImple_( new MenuSamplePrivateMembers ) |
379 |
|
{ |
391 |
|
// No operation besides the initialiser list |
392 |
|
} |
393 |
|
|
394 |
+ |
l1menu::MenuSample::MenuSample( l1menu::MenuSample&& otherMenuSample ) noexcept |
395 |
+ |
: pImple_( otherMenuSample.pImple_ ) |
396 |
+ |
{ |
397 |
+ |
otherMenuSample.pImple_=NULL; |
398 |
+ |
} |
399 |
+ |
|
400 |
|
l1menu::MenuSample& l1menu::MenuSample::operator=( const l1menu::MenuSample& otherMenuSample ) |
401 |
|
{ |
402 |
|
*pImple_=*otherMenuSample.pImple_; |
403 |
|
return *this; |
404 |
|
} |
405 |
|
|
406 |
+ |
l1menu::MenuSample& l1menu::MenuSample::operator=( l1menu::MenuSample&& otherMenuSample ) noexcept |
407 |
+ |
{ |
408 |
+ |
pImple_=otherMenuSample.pImple_; |
409 |
+ |
otherMenuSample.pImple_=NULL; |
410 |
+ |
return *this; |
411 |
+ |
} |
412 |
+ |
|
413 |
|
void l1menu::MenuSample::loadFile( const std::string& filename ) |
414 |
|
{ |
415 |
|
pImple_->inputNtuple.Open( filename ); |
420 |
|
return static_cast<size_t>( pImple_->inputNtuple.GetEntries() ); |
421 |
|
} |
422 |
|
|
423 |
< |
const L1Analysis::L1AnalysisDataFormat& l1menu::MenuSample::getEvent( size_t eventNumber ) const |
423 |
> |
const l1menu::IEvent& l1menu::MenuSample::getEvent( size_t eventNumber ) const |
424 |
|
{ |
425 |
|
// Make sure the event number requested is valid. Use static_cast to get rid |
426 |
|
// of the "comparison between signed and unsigned" compiler warning. |
430 |
|
pImple_->inputNtuple.GetEntry(eventNumber); |
431 |
|
// This next call fills pImple_->currentEvent with the information in pImple_->inputNtuple |
432 |
|
pImple_->fillDataStructure( 22 ); |
433 |
+ |
pImple_->fillL1Bits(); |
434 |
|
|
435 |
|
return pImple_->currentEvent; |
436 |
|
} |