ATLAS Offline Software
PileUpClassification.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
9 
10  McEventCollection::const_iterator maxIterator = lEvt;
11  //McEventCollection::const_iterator minIterator = fEvt;
12 
13  int intervallN =-1; // -1 means no interval search.
14 
15 
16  switch(putype){
17  case SIGNAL:
18  lEvt = fEvt; lEvt++;
19  break;
20  case ALL:
21  break;
22  case INTIME:
23  {
24  // Special case : there's no SEPARATOR between SIGNAL and INTIME :
25  fEvt++; lEvt = fEvt; lEvt++;
26  for(; lEvt < maxIterator; lEvt++){
27  if(HepMC::signal_process_id(*lEvt) == 0 ) break;
28  }
29  break;
30  }
31  case OUTOFTIME:
32  intervallN = 1;
33  break;
34  case RESTOFMB:
35  intervallN = 2;
36  break;
37  case CAVERN:
38  intervallN = 3;
39  break;
40  case ALLMINBIAS:
41  fEvt++;
42  break;
43  default:
44  break;
45  };
46 
47 
48  // if needed, search the correct interval
49  while(intervallN>0){
50  for(; fEvt < maxIterator; fEvt++){
51  if( HepMC::signal_process_id(*fEvt) == 0 ) { fEvt++; break; }
52  }
53  lEvt = fEvt;
54  for(; lEvt < maxIterator; lEvt++){
55  if( HepMC::signal_process_id(*lEvt) == 0 ) break;
56  }
57  intervallN--;
58  }
59 
60  // don't overstep your bounds!
61  if (lEvt>maxIterator) lEvt=maxIterator;
62  if (fEvt>maxIterator) fEvt=maxIterator;
63 
64 }
65 
66 void PileUpClassification::findEventIterators(PileuType_t putype, const McEventCollection* evts, size_t &firstIndex, size_t &lastIndex ){
67 
70  findEventIterators(putype, fEvt, lEvt);
71  firstIndex = fEvt - evts->begin();
72  lastIndex = lEvt - evts->begin();
73 }
74 
76  if(evtIndex == 0 ) return SIGNAL;
77 
81  ++itEvt;
83  while( itEvt != lEvt){
84  if( size_t(itEvt - fEvt) == evtIndex ){ return type ;}
85  ++itEvt;
86  if(HepMC::signal_process_id(*itEvt) == 0 ) { // a SEPARATOR
87  ++itEvt; type = (PileuType_t) (type+1);
88  }
89  }
90  return UNKONW;
91 }
92 
93 void PileUpClassification::fillPileUpType(const McEventCollection* evts, std::vector<size_t> &evtToPUType){
94  evtToPUType.resize(evts->size());
97  // 1st GenEvent is always SIGNAL
98  evtToPUType[0] = SIGNAL; ++fEvt;
99  // increment automatically following GenEvents
101  int c=1;
102  for(; fEvt != lEvt; ++fEvt){
103  if(HepMC::signal_process_id(*fEvt) == 0 ) type= (PileuType_t)(type+1);
104  evtToPUType[c] = type;
105  c++;
106  }
107 
108 }
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
HepMC::signal_process_id
int signal_process_id(const GenEvent &e)
Definition: GenEvent.h:513
PileUpClassification::UNKONW
@ UNKONW
Definition: PileUpClassification.h:31
PileUpClassification::PileuType_t
PileuType_t
define some Pile-up classification Important : this classification is copied in McParticleAlgs/python...
Definition: PileUpClassification.h:29
PileUpClassification::INTIME
@ INTIME
Definition: PileUpClassification.h:31
PileUpClassification::ALL
@ ALL
Definition: PileUpClassification.h:30
PileUpClassification::SIGNAL
@ SIGNAL
Definition: PileUpClassification.h:29
PileUpClassification::OUTOFTIME
@ OUTOFTIME
Definition: PileUpClassification.h:31
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
PileUpClassification::CAVERN
@ CAVERN
Definition: PileUpClassification.h:31
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
PileUpClassification::RESTOFMB
@ RESTOFMB
Definition: PileUpClassification.h:31
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
PileUpClassification::fillPileUpType
static void fillPileUpType(const McEventCollection *evts, std::vector< size_t > &evtToPUType)
Fill evtToPUType so that entry i is the pile-up type of GenEvent number i inside the McEventCollectio...
Definition: PileUpClassification.cxx:93
PileUpClassification::ALLMINBIAS
@ ALLMINBIAS
Definition: PileUpClassification.h:31
PileUpClassification::pileUpType
static PileuType_t pileUpType(const McEventCollection *evts, size_t evtIndex)
Return the type of pile-up event of the GenEvent number evtIndex in the McEventCollection.
Definition: PileUpClassification.cxx:75
python.compressB64.c
def c
Definition: compressB64.py:93
PileUpClassification.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
PileUpClassification::findEventIterators
static void findEventIterators(PileuType_t putype, McEventCollection::const_iterator &fEvt, McEventCollection::const_iterator &lEvt)
Find interval [fEvt,lEvt] containing all GenEvents of type putype from the McEventCollection.
Definition: PileUpClassification.cxx:8