CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
 DCCEETCCBlock (DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpacking)
 
unsigned int getLength ()
 
void updateCollectors ()
 
- Public Member Functions inherited from DCCTCCBlock
 DCCTCCBlock (DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpack)
 
void display (std::ostream &o)
 
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 ()
 

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::auto_ptr
< EcalPSInputDigiCollection > * 
pss_
 
EcalTriggerPrimitiveDigipTP_
 
EcalTrigTowerDetIdpTTDetId_
 
unsigned int tccId_
 
std::auto_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 ( )
virtual

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(), i, EcalElectronicsMapper::isTCCExternal(), DCCEventBlock::l1A(), DCCDataBlockPrototype::mapper_, DCCTCCBlock::nTTs_, NUMB_PSEUDOSTRIPS, NUMB_TTS_TPG1, NUMB_TTS_TPG2, NUMB_TTS_TPG2_DUPL, evf::evtn::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  (*tps_)->push_back(*pTP_);
71  }
72 
73 
74  if(processTPG2){
75 
76  // Unpack TPG2 pseudostrip input block
77  if(ps_){
78  for(unsigned int i = 1; i<= NUMB_PSEUDOSTRIPS; i++, tccP_++, psInputCounter++){
79  if (i<=NUMB_TTS_TPG2_DUPL) continue;
80  //fill pseudostrip container
81  pPS_= mapper_->getPSInputDigiPointer(tccId_,psInputCounter);
82  if(!pPS_) continue;
83  pPS_->setSampleValue(0, *tccP_ );
84  (*pss_)->push_back(*pPS_);
85  }
86  }
87 
88 
89  // Unpack TPG2 trigger primitive block
90  for(unsigned int i = 1; i<= NUMB_TTS_TPG2; i++, tccP_++){//12
91  unsigned int tt = i+NUMB_TTS_TPG1;
92 
93  if( tt <= nTTs_){
95  if(pTP_) pTP_->setSample(0, *tccP_ );
96  }
97  else break;
98  // adding trigger primitive digi to the collection
99  (*tps_)->push_back(*pTP_);
100  }
101 
102  }// end if(processTPG2)
103 
104  }// end FOV==0
105 
107  // real data since ever FOV was initialized; only 2 used >= June 09
108  else if (dccFOV == dcc_FOV_1 || dccFOV == dcc_FOV_2)
109  {
110 
111  // Unpack TPG1 pseudostrip input block
112  if(ps_){
113  for(unsigned int i = 1; i<= NUMB_PSEUDOSTRIPS; i++, tccP_++, psInputCounter++){
114  pPS_= mapper_->getPSInputDigiPointer(tccId_,psInputCounter);
115  if(!pPS_) continue;
116  pPS_->setSampleValue(0, *tccP_ );
117  (*pss_)->push_back(*pPS_);
118  }
119  }
120 
121  int offset(0);
122  // Unpack TPG1 trigger primitive block
123  // loop over tp_counter=i and navigate forward in raw (tccP_)
124  for(unsigned int i = 1; i<= NUMB_TTS_TPG1; i++, tccP_++){//16
125 
126  if( i<= nTTs_){
128  if(i>8 && i<=16 ) continue; // skip blank tp's [9,16]
129  if(i>8 ) offset=8; //
130  if(i>24 ) continue; // skip blank tp's [25, 28]
131  }
132 
133  pTP_ = mapper_->getTPPointer(tccId_,i-offset); // pointer to tp digi container
134  if(pTP_) pTP_->setSample(0, *tccP_ ); // fill it
135 
136  }else {
137  processTPG2 = false;
138  break;
139  }
140  // adding trigger primitive digi to the collection
141  (*tps_)->push_back(*pTP_);
142  }
143 
144  if(processTPG2){
145 
146  // Unpack TPG2 pseudostrip input block
147  if(ps_){
148  for(unsigned int i = 1; i<= NUMB_PSEUDOSTRIPS; i++, tccP_++, psInputCounter++){
149  if (i<=NUMB_TTS_TPG2_DUPL) continue;
150  //fill pseudostrip container
151  pPS_= mapper_->getPSInputDigiPointer(tccId_,psInputCounter);
152  if(!pPS_) continue;
153  pPS_->setSampleValue(0, *tccP_ );
154  (*pss_)->push_back(*pPS_);
155  }
156  }
157 
158 
159  // Unpack TPG2 trigger primitive block
160  for(unsigned int i = 1; i<= NUMB_TTS_TPG2; i++, tccP_++){//12
161  unsigned int tt = i+NUMB_TTS_TPG1;
162 
163  if( i<= nTTs_){
165  if(tt>8 && tt<=16 ) continue; // skip blank tp's [9,16]
166  if(tt>8 ) offset=8; //
167  if(tt>24 ) continue; // skip blank tp's [25, 28]
168  }
169 
171  if(pTP_) pTP_->setSample(0, *tccP_ );
172  }
173  else break;
174  // adding trigger primitive digi to the collection
175  (*tps_)->push_back(*pTP_);
176  }
177  }// end if(processTPG2)
178  }// end FOV==1 or 2
179 }
int i
Definition: DBlmapReader.cc:9
EcalPseudoStripInputDigi * pPS_
Definition: DCCTCCBlock.h:67
static bool silentMode_
void setSample(int i, const EcalTriggerPrimitiveSample &sam)
unsigned int bx()
Definition: DCCEventBlock.h:55
EcalTriggerPrimitiveDigi * pTP_
Definition: DCCTCCBlock.h:66
unsigned int fov()
Definition: DCCEventBlock.h:52
unsigned int offset(bool)
EcalPseudoStripInputDigi * getPSInputDigiPointer(unsigned int tccId, unsigned int towerId, unsigned int psId)
unsigned int tccId_
Definition: DCCTCCBlock.h:54
unsigned int nTTs_
Definition: DCCTCCBlock.h:59
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:63
unsigned int l1A()
Definition: DCCEventBlock.h:54
bool DCCEETCCBlock::checkTccIdAndNumbTTs ( )
protectedvirtual

Reimplemented from DCCTCCBlock.

Definition at line 182 of file DCCEETCCBlock.cc.

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

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

Reimplemented from DCCDataBlockPrototype.

Definition at line 237 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.

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

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::auto_ptr< EcalTrigPrimDigiCollection > * tps_
Definition: DCCTCCBlock.h:68
std::auto_ptr< EcalPSInputDigiCollection > * ecalPSsCollection()
std::auto_ptr< EcalPSInputDigiCollection > * pss_
Definition: DCCTCCBlock.h:69
DCCDataUnpacker * unpacker_
std::auto_ptr< EcalTrigPrimDigiCollection > * ecalTpsCollection()