CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions
DCCEETCCBlock Class Reference

#include <DCCEETCCBlock.h>

Inheritance diagram for DCCEETCCBlock:
DCCTCCBlock DCCDataBlockPrototype

Public Member Functions

void addTriggerPrimitivesToCollection () override
 
 DCCEETCCBlock (DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpacking)
 
unsigned int getLength () override
 
void updateCollectors () override
 
- Public Member Functions inherited from DCCTCCBlock
 DCCTCCBlock (DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpack)
 
void display (std::ostream &o) override
 
int unpack (const uint64_t **data, unsigned int *dwToEnd, short tccChId=0)
 
- Public Member Functions inherited from DCCDataBlockPrototype
 DCCDataBlockPrototype (DCCDataUnpacker *unpacker, EcalElectronicsMapper *mapper, DCCEventBlock *event, bool unpack=true)
 
void enableSyncChecks ()
 
virtual int unpack (const uint64_t **data, unsigned int *dwToEnd)
 
virtual void updateEventPointers ()
 
virtual ~DCCDataBlockPrototype ()
 

Protected Member Functions

bool checkTccIdAndNumbTTs () override
 

Additional Inherited Members

- Protected Attributes inherited from DCCTCCBlock
unsigned int bx_
 
unsigned int expNumbTTs_
 
unsigned int expTccId_
 
unsigned int l1_
 
unsigned int nTSamples_
 
unsigned int nTTs_
 
EcalPseudoStripInputDigipPS_
 
unsigned int ps_
 
std::unique_ptr< EcalPSInputDigiCollection > * pss_
 
EcalTriggerPrimitiveDigipTP_
 
EcalTrigTowerDetIdpTTDetId_
 
unsigned int tccId_
 
std::unique_ptr< EcalTrigPrimDigiCollection > * tps_
 
- Protected Attributes inherited from DCCDataBlockPrototype
unsigned int blockLength_
 
const uint64_t * data_
 
const uint64_t ** datap_
 
unsigned int * dwToEnd_
 
bool error_
 
DCCEventBlockevent_
 
EcalElectronicsMappermapper_
 
bool sync_
 
DCCDataUnpackerunpacker_
 
bool unpackInternalData_
 

Detailed Description

Definition at line 30 of file DCCEETCCBlock.h.

Constructor & Destructor Documentation

DCCEETCCBlock::DCCEETCCBlock ( DCCDataUnpacker u,
EcalElectronicsMapper m,
DCCEventBlock e,
bool  unpacking 
)

Class constructor

Definition at line 7 of file DCCEETCCBlock.cc.

References DCCDataBlockPrototype::blockLength_.

7  :
8 DCCTCCBlock(u,m,e,unpack)
9 {
10  blockLength_ = 0;
11 
12 }
int unpack(const uint64_t **data, unsigned int *dwToEnd, short tccChId=0)
Definition: DCCTCCBlock.cc:11
DCCTCCBlock(DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpack)
Definition: DCCTCCBlock.cc:7

Member Function Documentation

void DCCEETCCBlock::addTriggerPrimitivesToCollection ( )
overridevirtual

Reimplemented from DCCTCCBlock.

Definition at line 19 of file DCCEETCCBlock.cc.

References DCCEventBlock::bx(), DCCDataBlockPrototype::data_, dcc_FOV_0, dcc_FOV_1, dcc_FOV_2, DCCDataBlockPrototype::event_, DCCEventBlock::fov(), EcalElectronicsMapper::getActiveDCC(), EcalElectronicsMapper::getPSInputDigiPointer(), EcalElectronicsMapper::getTPPointer(), mps_fire::i, EcalElectronicsMapper::isTCCExternal(), DCCEventBlock::l1A(), DCCDataBlockPrototype::mapper_, DCCTCCBlock::nTTs_, NUMB_PSEUDOSTRIPS, NUMB_TTS_TPG1, NUMB_TTS_TPG2, NUMB_TTS_TPG2_DUPL, PFRecoTauDiscriminationByIsolation_cfi::offset, DCCTCCBlock::pPS_, DCCTCCBlock::ps_, DCCTCCBlock::pTP_, EcalTriggerPrimitiveDigi::setSample(), EcalPseudoStripInputDigi::setSampleValue(), DCCDataUnpacker::silentMode_, DCCTCCBlock::tccId_, and groupFilesInBlocks::tt.

19  {
20 
21  //point to trigger data
22  data_++;
23 
24  bool processTPG2(true) ;
25  unsigned int psInputCounter(0);
26 
27  const uint16_t * tccP_= reinterpret_cast<const uint16_t * >(data_);
28 
29 
30  int dccFOV = event_->fov();
31  if (! (dccFOV==dcc_FOV_0 || dccFOV==dcc_FOV_1 || dccFOV==dcc_FOV_2) ){
33  edm::LogWarning("IncorrectEvent")
34  <<"\n FOV value in data is: " << dccFOV <<
35  "At event: " <<event_->l1A()<<" with bx "<<event_->bx()<<" in fed <<"<<mapper_->getActiveDCC()
36  <<"\n TCC id "<<tccId_<<" FOV "<< dccFOV << " which is not a foreseen value. Setting it to: " << dcc_FOV_2;
37  }
38  dccFOV=dcc_FOV_2;
39  }
40 
41 
43  // MC raw data based on CMS NOTE 2005/021
44  // (and raw data when FOV was unassigned, earlier than mid 2008)
45  if (dccFOV == dcc_FOV_0)
46  {
47 
48  // Unpack TPG1 pseudostrip input block
49  if(ps_){
50  for(unsigned int i = 1; i<= NUMB_PSEUDOSTRIPS; i++, tccP_++, psInputCounter++){
51  pPS_= mapper_->getPSInputDigiPointer(tccId_,psInputCounter);
52  if(!pPS_) continue;
53  pPS_->setSampleValue(0, *tccP_ );
54  (*pss_)->push_back(*pPS_);
55  }
56  }
57 
58  // Unpack TPG1 trigger primitive block
59  // loop over tp_counter=i and navigate forward in raw (tccP_)
60  for(unsigned int i = 1; i<= NUMB_TTS_TPG1; i++, tccP_++){//16
61 
62  if( i<= nTTs_){
63  pTP_ = mapper_->getTPPointer(tccId_,i); // pointer to tp digi container
64  if(pTP_) pTP_->setSample(0, *tccP_ ); // fill it
65  }else {
66  processTPG2 = false;
67  break;
68  }
69  // adding trigger primitive digi to the collection
70  if (pTP_) (*tps_)->push_back(*pTP_);
71  else edm::LogError("IncorrectBlock")<<"trigger primitive digi was not aquired";
72  }
73 
74 
75  if(processTPG2){
76 
77  // Unpack TPG2 pseudostrip input block
78  if(ps_){
79  for(unsigned int i = 1; i<= NUMB_PSEUDOSTRIPS; i++, tccP_++, psInputCounter++){
80  if (i<=NUMB_TTS_TPG2_DUPL) continue;
81  //fill pseudostrip container
82  pPS_= mapper_->getPSInputDigiPointer(tccId_,psInputCounter);
83  if(!pPS_) continue;
84  pPS_->setSampleValue(0, *tccP_ );
85  (*pss_)->push_back(*pPS_);
86  }
87  }
88 
89 
90  // Unpack TPG2 trigger primitive block
91  for(unsigned int i = 1; i<= NUMB_TTS_TPG2; i++, tccP_++){//12
92  unsigned int tt = i+NUMB_TTS_TPG1;
93 
94  if( tt <= nTTs_){
96  if(pTP_) pTP_->setSample(0, *tccP_ );
97  }
98  else break;
99  // adding trigger primitive digi to the collection
100  (*tps_)->push_back(*pTP_);
101  }
102 
103  }// end if(processTPG2)
104 
105  }// end FOV==0
106 
108  // real data since ever FOV was initialized; only 2 used >= June 09
109  else if (dccFOV == dcc_FOV_1 || dccFOV == dcc_FOV_2)
110  {
111 
112  // Unpack TPG1 pseudostrip input block
113  if(ps_){
114  for(unsigned int i = 1; i<= NUMB_PSEUDOSTRIPS; i++, tccP_++, psInputCounter++){
115  pPS_= mapper_->getPSInputDigiPointer(tccId_,psInputCounter);
116  if(!pPS_) continue;
117  pPS_->setSampleValue(0, *tccP_ );
118  (*pss_)->push_back(*pPS_);
119  }
120  }
121 
122  int offset(0);
123  // Unpack TPG1 trigger primitive block
124  // loop over tp_counter=i and navigate forward in raw (tccP_)
125  for(unsigned int i = 1; i<= NUMB_TTS_TPG1; i++, tccP_++){//16
126 
127  if( i<= nTTs_){
129  if(i>8 && i<=16 ) continue; // skip blank tp's [9,16]
130  if(i>8 ) offset=8; //
131  if(i>24 ) continue; // skip blank tp's [25, 28]
132  }
133 
134  pTP_ = mapper_->getTPPointer(tccId_,i-offset); // pointer to tp digi container
135  if(pTP_) pTP_->setSample(0, *tccP_ ); // fill it
136 
137  }else {
138  processTPG2 = false;
139  break;
140  }
141  // adding trigger primitive digi to the collection
142  if (pTP_) (*tps_)->push_back(*pTP_);
143  else edm::LogError("IncorrectBlock")<<"trigger primitive digi was not aquired";
144  }
145 
146  if(processTPG2){
147 
148  // Unpack TPG2 pseudostrip input block
149  if(ps_){
150  for(unsigned int i = 1; i<= NUMB_PSEUDOSTRIPS; i++, tccP_++, psInputCounter++){
151  if (i<=NUMB_TTS_TPG2_DUPL) continue;
152  //fill pseudostrip container
153  pPS_= mapper_->getPSInputDigiPointer(tccId_,psInputCounter);
154  if(!pPS_) continue;
155  pPS_->setSampleValue(0, *tccP_ );
156  (*pss_)->push_back(*pPS_);
157  }
158  }
159 
160 
161  // Unpack TPG2 trigger primitive block
162  for(unsigned int i = 1; i<= NUMB_TTS_TPG2; i++, tccP_++){//12
163  unsigned int tt = i+NUMB_TTS_TPG1;
164 
165  if( i<= nTTs_){
167  if(tt>8 && tt<=16 ) continue; // skip blank tp's [9,16]
168  if(tt>8 ) offset=8; //
169  if(tt>24 ) continue; // skip blank tp's [25, 28]
170  }
171 
173  if(pTP_) pTP_->setSample(0, *tccP_ );
174  }
175  else break;
176  // adding trigger primitive digi to the collection
177  (*tps_)->push_back(*pTP_);
178  }
179  }// end if(processTPG2)
180  }// end FOV==1 or 2
181 }
EcalPseudoStripInputDigi * pPS_
Definition: DCCTCCBlock.h:68
void setSample(int i, const EcalTriggerPrimitiveSample &sam)
static std::atomic< bool > silentMode_
unsigned int bx()
Definition: DCCEventBlock.h:55
EcalTriggerPrimitiveDigi * pTP_
Definition: DCCTCCBlock.h:67
unsigned int fov()
Definition: DCCEventBlock.h:52
EcalPseudoStripInputDigi * getPSInputDigiPointer(unsigned int tccId, unsigned int towerId, unsigned int psId)
unsigned int tccId_
Definition: DCCTCCBlock.h:55
unsigned int nTTs_
Definition: DCCTCCBlock.h:60
EcalTriggerPrimitiveDigi * getTPPointer(unsigned int tccId, unsigned int tower)
bool isTCCExternal(unsigned int TCCId)
EcalElectronicsMapper * mapper_
void setSampleValue(int i, uint16_t value)
unsigned int ps_
Definition: DCCTCCBlock.h:64
unsigned int l1A()
Definition: DCCEventBlock.h:54
bool DCCEETCCBlock::checkTccIdAndNumbTTs ( )
overrideprotectedvirtual

Reimplemented from DCCTCCBlock.

Definition at line 184 of file DCCEETCCBlock.cc.

References DCCEventBlock::bx(), DCCDataBlockPrototype::event_, EcalElectronicsMapper::getActiveDCC(), EcalElectronicsMapper::getActiveSM(), EcalElectronicsMapper::getTccs(), DCCEventBlock::l1A(), funct::m, DCCDataBlockPrototype::mapper_, DCCTCCBlock::nTTs_, DCCDataUnpacker::silentMode_, and DCCTCCBlock::tccId_.

184  {
185 
186 
187  bool tccFound(false);
188  bool errorOnNumbOfTTs(false);
189  const int activeDCC = mapper_->getActiveSM();
190  std::vector<unsigned int> * m = mapper_->getTccs(activeDCC);
191  std::vector<unsigned int>::iterator it;
192  for(it= m->begin();it!=m->end();it++){
193  if((*it) == tccId_){
194  tccFound=true;
195 
196  /*
197  expNumbTTs_= 28; //separate from inner and outer tcc
198  For inner TCCs you expect 28 TTs (4 in phi, 7 in eta).
199  For outer TCCs you expect 16 TTs (4 in phi, 4 in eta).
200  to implement : map tccid-> number of tts
201 
202  Pascal P.: For outer board, only 16 TPs are meaningful but 28 are sent.
203  - [1,8] are meaningful
204  - [9,16] are empty ie should be skipped by unpacker
205  - [17, 24] are meaningful
206  - [25, 28] are empty ie should be skipped by unpacker
207  */
208 
209  if( nTTs_ != 28 && nTTs_ !=16 ){
211  edm::LogWarning("IncorrectBlock")
212  <<"Error on event "<<event_->l1A()<<" with bx "<<event_->bx()<<" in fed <<"<<mapper_->getActiveDCC()
213  <<"\n TCC id "<<tccId_<<" has "<<nTTs_<<" Trigger Towers (only 28 or 16 are the expected values in EE)"
214  <<"\n => Skipping to next fed block...";
215  errorOnNumbOfTTs = true;
216  //todo : add to error collection
217  }
218  }
219  }
220  }
221 
222  if(!tccFound){
223 
225  edm::LogWarning("IncorrectBlock")
226  <<"Error on event "<<event_->l1A()<<" with bx "<<event_->bx()<<" in fed <<"<<mapper_->getActiveDCC()
227  <<"\n TCC id "<<tccId_<<" is not valid for this dcc "
228  <<"\n => Skipping to next fed block...";
229  //todo : add to error collection
230  }
231  }
232 
233 
234  return (tccFound || errorOnNumbOfTTs);
235 
236 }
std::vector< unsigned int > * getTccs(unsigned int smId)
static std::atomic< bool > silentMode_
unsigned int bx()
Definition: DCCEventBlock.h:55
unsigned int tccId_
Definition: DCCTCCBlock.h:55
unsigned int nTTs_
Definition: DCCTCCBlock.h:60
EcalElectronicsMapper * mapper_
unsigned int l1A()
Definition: DCCEventBlock.h:54
unsigned int DCCEETCCBlock::getLength ( )
overridevirtual

Reimplemented from DCCDataBlockPrototype.

Definition at line 239 of file DCCEETCCBlock.cc.

References B_MASK, DCCDataBlockPrototype::data_, NUMB_PSEUDOSTRIPS, NUMB_TTS_TPG1, NUMB_TTS_TPG2, DCCTCCBlock::ps_, TCC_PS_B, and groupFilesInBlocks::temp.

239  {
240 
241  const uint64_t * temp = data_;
242  temp++;
243 
244  ps_ = ( *temp>>TCC_PS_B ) & B_MASK;
245 
246  unsigned int numbTps = (NUMB_TTS_TPG1 + NUMB_TTS_TPG2);
247  if(ps_){ numbTps += 2*NUMB_PSEUDOSTRIPS;}
248 
249  unsigned int length = numbTps/4 + 2; //header and trailer
250  if(numbTps%4) length++ ;
251 
252 
253  return length;
254 
255 }
unsigned long long uint64_t
Definition: Time.h:15
unsigned int ps_
Definition: DCCTCCBlock.h:64
void DCCEETCCBlock::updateCollectors ( )
overridevirtual

Reimplemented from DCCDataBlockPrototype.

Definition at line 14 of file DCCEETCCBlock.cc.

References DCCDataUnpacker::ecalPSsCollection(), DCCDataUnpacker::ecalTpsCollection(), DCCTCCBlock::pss_, DCCTCCBlock::tps_, and DCCDataBlockPrototype::unpacker_.

14  {
17 }
std::unique_ptr< EcalPSInputDigiCollection > * ecalPSsCollection()
std::unique_ptr< EcalTrigPrimDigiCollection > * tps_
Definition: DCCTCCBlock.h:69
std::unique_ptr< EcalPSInputDigiCollection > * pss_
Definition: DCCTCCBlock.h:70
DCCDataUnpacker * unpacker_
std::unique_ptr< EcalTrigPrimDigiCollection > * ecalTpsCollection()