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 Types | Private Member Functions | Private Attributes
EcalTB07DaqFormatter Class Reference

#include <EcalTB07DaqFormatter.h>

Public Member Functions

 EcalTB07DaqFormatter (std::string tbName, int a[68][5][5], int b[71], int c[201])
 
void interpretRawData (const FEDRawData &data, EBDigiCollection &digicollection, EEDigiCollection &eeDigiCollection, EcalPnDiodeDigiCollection &pndigicollection, EcalRawDataCollection &DCCheaderCollection, EBDetIdCollection &dccsizecollection, EcalElectronicsIdCollection &ttidcollection, EcalElectronicsIdCollection &blocksizecollection, EBDetIdCollection &chidcollection, EBDetIdCollection &gaincollection, EBDetIdCollection &gainswitchcollection, EcalElectronicsIdCollection &memttidcollection, EcalElectronicsIdCollection &memblocksizecollection, EcalElectronicsIdCollection &memgaincollection, EcalElectronicsIdCollection &memchidcollection, EcalTrigPrimDigiCollection &tpcollection)
 
virtual ~EcalTB07DaqFormatter ()
 

Private Types

enum  SMElectronics_t {
  kSamplesPerChannel = 10, kSamplesPerPn = 50, kChannelsPerTower = 25, kStripsPerTower = 5,
  kChannelsPerStrip = 5, kPnPerTowerBlock = 5, kTriggerTowersAndMem = 70
}
 
enum  SMGeom_t {
  kModules = 4, kTriggerTowers = 68, kTowersInPhi = 4, kTowersInEta = 17,
  kCrystals = 1700, kPns = 10, kCrystalsInPhi = 20, kCrystalsInEta = 85,
  kCrystalsPerTower = 25, kCardsPerTower = 5, kChannelsPerCard = 5
}
 

Private Member Functions

std::pair< int, int > cellIndex (int tower_id, int strip, int xtal)
 
int cryIc (int tower_id, int strip, int xtal)
 
void DecodeMEM (DCCTBTowerBlock *towerblock, EcalPnDiodeDigiCollection &pndigicollection, EcalElectronicsIdCollection &memttidcollection, EcalElectronicsIdCollection &memblocksizecollection, EcalElectronicsIdCollection &memgaincollection, EcalElectronicsIdCollection &memchidcollection)
 
int getEE_ix (int tower, int strip, int ch)
 
int getEE_iy (int tower, int strip, int ch)
 
bool leftTower (int tower) const
 
bool rightTower (int tower) const
 

Private Attributes

unsigned _ExpectedTowers [71]
 
unsigned _expTowersIndex
 
unsigned _numExpectedTowers
 
int cryIcMap_ [68][5][5]
 
int data_MEM [500]
 
int memRawSample_ [kStripsPerTower][kChannelsPerStrip][kSamplesPerChannel+1]
 
bool pnAllocated
 
bool pnIsOkInBlock [kPnPerTowerBlock]
 
std::string tbName_
 
int tbStatusToLocation_ [71]
 
int tbTowerIDToLocation_ [201]
 
DCCTBDataParsertheParser_
 

Detailed Description

Date:
2008/01/21 11:21:00
Revision:
1.7
Author
N. Marinelli IASA-Athens
G. Della Ricca
G. Franzoni
A. Ghezzi

Definition at line 29 of file EcalTB07DaqFormatter.h.

Member Enumeration Documentation

Enumerator
kSamplesPerChannel 
kSamplesPerPn 
kChannelsPerTower 
kStripsPerTower 
kChannelsPerStrip 
kPnPerTowerBlock 
kTriggerTowersAndMem 

Definition at line 83 of file EcalTB07DaqFormatter.h.

83  {
84  kSamplesPerChannel = 10, // Number of sample per channel, per event
85  kSamplesPerPn = 50, // Number of sample per PN, per event
86  kChannelsPerTower = 25, // Number of channels per trigger tower
87  kStripsPerTower = 5, // Number of VFE cards per trigger tower
88  kChannelsPerStrip = 5, // Number channels per VFE card
89  kPnPerTowerBlock = 5, // Number Pn diodes pertaining to 1 tower block = 1/2 mem box
90  kTriggerTowersAndMem = 70 // Number of trigger towers block including mems
91  };
Enumerator
kModules 
kTriggerTowers 
kTowersInPhi 
kTowersInEta 
kCrystals 
kPns 
kCrystalsInPhi 
kCrystalsInEta 
kCrystalsPerTower 
kCardsPerTower 
kChannelsPerCard 

Definition at line 69 of file EcalTB07DaqFormatter.h.

69  {
70  kModules = 4, // Number of modules per supermodule
71  kTriggerTowers = 68, // Number of trigger towers per supermodule
72  kTowersInPhi = 4, // Number of trigger towers in phi
73  kTowersInEta = 17, // Number of trigger towers in eta
74  kCrystals = 1700, // Number of crystals per supermodule
75  kPns = 10, // Number of PN laser monitoring diodes per supermodule
76  kCrystalsInPhi = 20, // Number of crystals in phi
77  kCrystalsInEta = 85, // Number of crystals in eta
78  kCrystalsPerTower = 25, // Number of crystals per trigger tower
79  kCardsPerTower = 5, // Number of VFE cards per trigger tower
80  kChannelsPerCard = 5 // Number of channels per VFE card
81  };

Constructor & Destructor Documentation

EcalTB07DaqFormatter::EcalTB07DaqFormatter ( std::string  tbName,
int  a[68][5][5],
int  b[71],
int  c[201] 
)

Definition at line 37 of file EcalTB07DaqFormatter.cc.

References cryIcMap_, i, j, gen::k, LogDebug, Parameters::parameters, tbName_, tbStatusToLocation_, tbTowerIDToLocation_, and theParser_.

40  {
41 
42  LogDebug("EcalTB07RawToDigi") << "@SUB=EcalTB07DaqFormatter";
43  std::vector<uint32_t> parameters;
44  parameters.push_back(10); // parameters[0] is the xtal samples
45  parameters.push_back(1); // parameters[1] is the number of trigger time samples for TPG's
46  parameters.push_back(68); // parameters[2] is the number of TT
47  parameters.push_back(68); // parameters[3] is the number of SR Flags
48  parameters.push_back(1); // parameters[4] is the dcc id
49  parameters.push_back(1); // parameters[5] is the sr id
50  parameters.push_back(1); // parameters[6] is the tcc1 id
51  parameters.push_back(2); // parameters[7] is the tcc2 id
52  parameters.push_back(3); // parameters[8] is the tcc3 id
53  parameters.push_back(4); // parameters[9] is the tcc4 id
54 
55  theParser_ = new DCCTBDataParser(parameters);
56 
57  tbName_ = tbName;
58 
59  for(int i=0; i<68; ++i)
60  for (int j=0; j<5; ++j)
61  for (int k=0; k<5; ++k)
62  cryIcMap_[i][j][k] = cryIcMap[i][j][k];
63 
64  for(int i=0; i<71; ++i)
65  tbStatusToLocation_[i] = tbStatusToLocation[i];
66 
67  for(int i=0; i<201; ++i)
68  tbTowerIDToLocation_[i] = tbTowerIDToLocation[i];
69 
70 
71 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
int j
Definition: DBlmapReader.cc:9
DCCTBDataParser * theParser_
int k[5][pyjets_maxn]
virtual EcalTB07DaqFormatter::~EcalTB07DaqFormatter ( )
inlinevirtual

Definition at line 34 of file EcalTB07DaqFormatter.h.

References LogDebug.

34 {LogDebug("EcalTB07RawToDigi") << "@SUB=EcalTB07DaqFormatter" << "\n"; };
#define LogDebug(id)

Member Function Documentation

std::pair< int, int > EcalTB07DaqFormatter::cellIndex ( int  tower_id,
int  strip,
int  xtal 
)
private

Definition at line 893 of file EcalTB07DaqFormatter.cc.

References eta(), kCardsPerTower, kChannelsPerCard, kCrystalsPerTower, kTowersInPhi, phi, and rightTower().

893  {
894 
895  int xtal= (strip-1)*5+ch-1;
896  // std::cout << " cellIndex input xtal " << xtal << std::endl;
897  std::pair<int,int> ind;
898 
899  int eta = (tower_id - 1)/kTowersInPhi*kCardsPerTower;
900  int phi = (tower_id - 1)%kTowersInPhi*kChannelsPerCard;
901 
902  if (rightTower(tower_id))
903  eta += xtal/kCardsPerTower;
904  else
905  eta += (kCrystalsPerTower - 1 - xtal)/kCardsPerTower;
906 
907  if ((rightTower(tower_id) && (xtal/kCardsPerTower)%2 == 1) ||
908  (!rightTower(tower_id) && (xtal/kCardsPerTower)%2 == 0))
909 
910  phi += (kChannelsPerCard - 1 - xtal%kChannelsPerCard);
911  else
912  phi += xtal%kChannelsPerCard;
913 
914 
915  ind.first =eta+1;
916  ind.second=phi+1;
917 
918  // std::cout << " EcalTB07DaqFormatter::cell_index eta " << ind.first << " phi " << ind.second << " " << std::endl;
919 
920  return ind;
921 
922 }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
T eta() const
bool rightTower(int tower) const
Definition: DDAxes.h:10
int EcalTB07DaqFormatter::cryIc ( int  tower_id,
int  strip,
int  xtal 
)
private

Definition at line 949 of file EcalTB07DaqFormatter.cc.

References cryIcMap_.

Referenced by getEE_ix(), getEE_iy(), and interpretRawData().

949  {
950 
951  if ( strip < 1 || 5<strip || ch <1 || 5 < ch || 68<tower)
952  {
953  edm::LogWarning("EcalTB07RawToDigiChId") << "EcalTB07DaqFormatter::interpretRawData (cryIc) "
954  << " wrong channel id, since out of range: "
955  << "\t strip: " << strip << "\t channel: " << ch
956  << "\t in TT: " << tower;
957  return -1;
958  }
959 
960  // YM
961  return cryIcMap_[tower-1][strip-1][ch-1];
962  //std::pair<int,int> cellInd= EcalTB07DaqFormatter::cellIndex(tower, strip, ch);
963  //return cellInd.second + (cellInd.first-1)*kCrystalsInPhi;
964 }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
void EcalTB07DaqFormatter::DecodeMEM ( DCCTBTowerBlock towerblock,
EcalPnDiodeDigiCollection pndigicollection,
EcalElectronicsIdCollection memttidcollection,
EcalElectronicsIdCollection memblocksizecollection,
EcalElectronicsIdCollection memgaincollection,
EcalElectronicsIdCollection memchidcollection 
)
private

Definition at line 676 of file EcalTB07DaqFormatter.cc.

References _ExpectedTowers, _expTowersIndex, edm::EDCollection< T >::begin(), data_MEM, edm::EDCollection< T >::end(), errorMatrix2Lands_multiChannel::id, kChannelsPerStrip, kChannelsPerTower, kPnPerTowerBlock, kSamplesPerChannel, kSamplesPerPn, kStripsPerTower, LogDebug, memRawSample_, pnIsOkInBlock, edm::EDCollection< T >::push_back(), edm::SortedCollection< T, SORT >::push_back(), compare_using_db::sample, EcalPnDiodeDigi::setSample(), EcalPnDiodeDigi::setSize(), edm::EDCollection< T >::size(), strip(), DCCTBTowerBlock::towerID(), and DCCTBTowerBlock::xtalBlocks().

Referenced by interpretRawData().

679 {
680 
681  LogDebug("EcalTB07RawToDigi") << "@SUB=EcalTB07DaqFormatter::DecodeMEM"
682  << "in mem " << towerblock->towerID();
683 
684  int tower_id = towerblock ->towerID() ;
685  int mem_id = tower_id-69;
686 
687  // initializing container
688  for (int st_id=0; st_id< kStripsPerTower; st_id++){
689  for (int ch_id=0; ch_id<kChannelsPerStrip; ch_id++){
690  for (int sa=0; sa<11; sa++){
691  memRawSample_[st_id][ch_id][sa] = -1;} } }
692 
693 
694  // check that tower block id corresponds to mem boxes
695  if(tower_id != 69 && tower_id != 70)
696  {
697  edm::LogWarning("EcalTB07RawToDigiTowerId") << "@SUB=EcalTB07DaqFormatter:decodeMem"
698  << "DecodeMEM: this is not a mem box tower (" << tower_id << ")";
699  ++ _expTowersIndex;
700  return;
701  }
702 
703 
704  /******************************************************************************
705  // getting the raw hits from towerBlock while checking tt and ch data structure
706  ******************************************************************************/
707  std::vector<DCCTBXtalBlock *> & dccXtalBlocks = towerblock->xtalBlocks();
708  std::vector<DCCTBXtalBlock*>::iterator itXtal;
709 
710  // checking mem tower block fo size
711  if (dccXtalBlocks.size() != kChannelsPerTower)
712  {
713  LogDebug("EcalTB07RawToDigiDccBlockSize") << "@SUB=EcalTB07DaqFormatter:decodeMem"
714  << " wrong dccBlock size, namely: " << dccXtalBlocks.size()
715  << ", for mem " << _ExpectedTowers[_expTowersIndex];
716 
717  // reporting mem-tt block size problem
718  // chosing channel 1 as representative as a dummy...
720  memblocksizecollection.push_back(id);
721 
722  ++ _expTowersIndex;
723  return; // if mem tt block size not ok - do not build any Pn digis
724  }
725 
726 
727  // loop on channels of the mem block
728  int cryCounter = 0; int strip_id = 0; int xtal_id = 0;
729 
730  for ( itXtal = dccXtalBlocks.begin(); itXtal < dccXtalBlocks.end(); itXtal++ ) {
731  strip_id = (*itXtal) ->getDataField("STRIP ID");
732  xtal_id = (*itXtal) ->getDataField("XTAL ID");
733  int wished_strip_id = cryCounter/ kStripsPerTower;
734  int wished_ch_id = cryCounter% kStripsPerTower;
735 
736  if( (wished_strip_id+1) != ((int)strip_id) ||
737  (wished_ch_id+1) != ((int)xtal_id) )
738  {
739 
740  LogDebug("EcalTB07RawToDigiChId") << "@SUB=EcalTB07DaqFormatter:decodeMem"
741  << " in mem " << towerblock->towerID()
742  << ", expected:\t strip"
743  << (wished_strip_id+1) << " cry " << (wished_ch_id+1) << "\tfound: "
744  << " strip " << strip_id << " cry " << xtal_id;
745 
746  // report on crystal with unexpected indices
747  EcalElectronicsId id(1, (int)_ExpectedTowers[_expTowersIndex], wished_strip_id, wished_ch_id);
748  memchidcollection.push_back(id);
749  }
750 
751 
752  // Accessing the 10 time samples per Xtal:
753  memRawSample_[wished_strip_id][wished_ch_id][1] = (*itXtal)->getDataField("ADC#1");
754  memRawSample_[wished_strip_id][wished_ch_id][2] = (*itXtal)->getDataField("ADC#2");
755  memRawSample_[wished_strip_id][wished_ch_id][3] = (*itXtal)->getDataField("ADC#3");
756  memRawSample_[wished_strip_id][wished_ch_id][4] = (*itXtal)->getDataField("ADC#4");
757  memRawSample_[wished_strip_id][wished_ch_id][5] = (*itXtal)->getDataField("ADC#5");
758  memRawSample_[wished_strip_id][wished_ch_id][6] = (*itXtal)->getDataField("ADC#6");
759  memRawSample_[wished_strip_id][wished_ch_id][7] = (*itXtal)->getDataField("ADC#7");
760  memRawSample_[wished_strip_id][wished_ch_id][8] = (*itXtal)->getDataField("ADC#8");
761  memRawSample_[wished_strip_id][wished_ch_id][9] = (*itXtal)->getDataField("ADC#9");
762  memRawSample_[wished_strip_id][wished_ch_id][10] = (*itXtal)->getDataField("ADC#10");
763 
764  cryCounter++;
765  }// end loop on crystals of mem dccXtalBlock
766 
767  // tower accepted and digi read from all 25 channels.
768  // Increase counter of expected towers before unpacking in the 5 PNs
769  ++ _expTowersIndex;
770 
771 
772 
773  /************************************************************
774  // unpacking and 'cooking' the raw numbers to get PN sample
775  ************************************************************/
776  int tempSample=0;
777  int memStoreIndex=0;
778  int ipn=0;
779  for (memStoreIndex=0; memStoreIndex<500; memStoreIndex++) {
780  data_MEM[memStoreIndex]= -1; }
781 
782 
783  for(int strip=0; strip<kStripsPerTower; strip++) {// loop on strips
784  for(int channel=0; channel<kChannelsPerStrip; channel++) {// loop on channels
785 
786  if(strip%2 == 0)
787  {ipn= mem_id*5+channel;}
788  else
789  {ipn=mem_id*5+4-channel;}
790 
791  for(int sample=0;sample< kSamplesPerChannel ;sample++) {
792  tempSample= memRawSample_[strip][channel][sample+1];
793 
794  int new_data=0;
795  if(strip%2 == 1) {
796  // 1) if strip number is even, 14 bits are reversed in order
797  for(int ib=0;ib<14;ib++)
798  {
799  new_data <<= 1;
800  new_data=new_data | (tempSample&1);
801  tempSample >>= 1;
802  }
803  } else {
804  new_data=tempSample;
805  }
806 
807  // 2) flip 11th bit for AD9052 still there on MEM !
808  // 3) mask with 1 1111 1111 1111
809  new_data = (new_data ^ 0x800) & 0x3fff; // (new_data XOR 1000 0000 0000) & 11 1111 1111 1111
810  // new_data = (new_data ^ 0x800) & 0x1fff; // (new_data XOR 1000 0000 0000) & 1 1111 1111 1111
811 
812  //(Bit 12) == 1 -> Gain 16; (Bit 12) == 0 -> Gain 1
813  // gain in mem can be 1 or 16 encoded resp. with 0 ir 1 in the 13th bit.
814  // checking and reporting if there is any sample with gain==2,3
815  short sampleGain = (new_data &0x3000)/4096;
816  if ( sampleGain==2 || sampleGain==3)
817  {
819  memgaincollection.push_back(id);
820 
821  edm::LogWarning("EcalTB07RawToDigiGainZero") << "@SUB=EcalTB07DaqFormatter:decodeMem"
822  << "in mem " << towerblock->towerID()
823  << " :\t strip: "
824  << (strip +1) << " cry: " << (channel+1)
825  << " has 14th bit non zero! Gain results: "
826  << sampleGain << ".";
827 
828  continue;
829  }// end 'if gain is zero'
830 
831  memStoreIndex= ipn*50+strip*kSamplesPerChannel+sample;
832  // storing in data_MEM also the gain bits
833  data_MEM[memStoreIndex]= new_data & 0x3fff;
834 
835  }// loop on samples
836  }// loop on strips
837  }// loop on channels
838 
839 
840 
841 
842  for (int pnId=0; pnId<kPnPerTowerBlock; pnId++) pnIsOkInBlock[pnId]=true;
843  // if anything was wrong with mem_tt_id or mem_tt_size: you would have already exited
844  // otherwise, if any problem with ch_gain or ch_id: must not produce digis for the pertaining Pn
845 
846  if (! (memgaincollection.size()==0 && memchidcollection.size()==0) )
847  {
848  for ( EcalElectronicsIdCollection::const_iterator idItr = memgaincollection.begin();
849  idItr != memgaincollection.end();
850  ++ idItr ) {
851  int ch = (*idItr).channelId();
852  ch = (ch-1)/5;
853  pnIsOkInBlock [ch] = false;
854  }
855 
856  for ( EcalElectronicsIdCollection::const_iterator idItr = memchidcollection.begin();
857  idItr != memchidcollection.end();
858  ++ idItr ) {
859  int ch = (*idItr).channelId();
860  ch = (ch-1)/5;
861  pnIsOkInBlock [ch] = false;
862  }
863 
864  }// end: if any ch_gain or ch_id problems exclude the Pn's from digi production
865 
866 
867 
868 
869  // looping on PN's of current mem box
870  for (int pnId = 1; pnId < (kPnPerTowerBlock+1); pnId++){
871 
872  // if present Pn has any of its 5 channels with problems, do not produce digi for it
873  if (! pnIsOkInBlock [pnId-1] ) continue;
874 
875  // second argument is DccId which is set to 46 to match h2 data in global CMS geometry
876  EcalPnDiodeDetId PnId(2, 46, pnId + kPnPerTowerBlock*mem_id);
877  EcalPnDiodeDigi thePnDigi(PnId );
878 
879  thePnDigi.setSize(kSamplesPerPn);
880 
881  for (int sample =0; sample<kSamplesPerPn; sample++)
882  {
883  EcalFEMSample thePnSample( data_MEM[(mem_id)*250 + (pnId-1)*kSamplesPerPn + sample ] );
884  thePnDigi.setSample(sample, thePnSample );
885  }
886  pndigicollection.push_back(thePnDigi);
887  }
888 
889 
890 }
#define LogDebug(id)
size_type size() const
Definition: EDCollection.h:98
std::vector< DCCTBXtalBlock * > & xtalBlocks()
Definition: DCCTowerBlock.h:57
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
const_iterator end() const
Definition: EDCollection.h:154
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
void push_back(T const &t)
void push_back(T const &t)
Definition: EDCollection.h:68
const_iterator begin() const
Definition: EDCollection.h:147
bool pnIsOkInBlock[kPnPerTowerBlock]
int memRawSample_[kStripsPerTower][kChannelsPerStrip][kSamplesPerChannel+1]
std::vector< T >::const_iterator const_iterator
Definition: EDCollection.h:20
int EcalTB07DaqFormatter::getEE_ix ( int  tower,
int  strip,
int  ch 
)
private

Definition at line 924 of file EcalTB07DaqFormatter.cc.

References cryIc(), and tbName_.

Referenced by interpretRawData().

924  {
925  // H2 -- ix is in [-90, -80], and iy is in [-5; 5]
926  int ic = cryIc(tower, strip, ch);
927  int ix = 0;
928  if ( tbName_ == "h2" )
929  ix = 95 - (ic-1)/20;
930 
931  if ( tbName_ == "h4" )
932  ix = 35 - (ic-1)%20;
933 
934  return ix;
935 
936 }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
int cryIc(int tower_id, int strip, int xtal)
int EcalTB07DaqFormatter::getEE_iy ( int  tower,
int  strip,
int  ch 
)
private

Definition at line 937 of file EcalTB07DaqFormatter.cc.

References cryIc(), and tbName_.

Referenced by interpretRawData().

937  {
938  int ic = cryIc(tower, strip, ch);
939  int iy = 0;
940  if ( tbName_ == "h2" )
941  iy = 46 + (ic-1)%20;
942 
943  if ( tbName_ == "h4" )
944  iy = 51 + (int)((ic-1)/20);
945 
946  return iy;
947 }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
int cryIc(int tower_id, int strip, int xtal)
void EcalTB07DaqFormatter::interpretRawData ( const FEDRawData data,
EBDigiCollection digicollection,
EEDigiCollection eeDigiCollection,
EcalPnDiodeDigiCollection pndigicollection,
EcalRawDataCollection DCCheaderCollection,
EBDetIdCollection dccsizecollection,
EcalElectronicsIdCollection ttidcollection,
EcalElectronicsIdCollection blocksizecollection,
EBDetIdCollection chidcollection,
EBDetIdCollection gaincollection,
EBDetIdCollection gainswitchcollection,
EcalElectronicsIdCollection memttidcollection,
EcalElectronicsIdCollection memblocksizecollection,
EcalElectronicsIdCollection memgaincollection,
EcalElectronicsIdCollection memchidcollection,
EcalTrigPrimDigiCollection tpcollection 
)

Definition at line 73 of file EcalTB07DaqFormatter.cc.

References _ExpectedTowers, _expTowersIndex, _numExpectedTowers, edm::DataFrameContainer::back(), gather_cfg::cout, cryIc(), FEDRawData::data(), DCCTBDataParser::dccEvents(), EcalDCCTBHeaderRuntypeDecoder::Decode(), DecodeMEM(), EcalBarrel, first, getEE_ix(), getEE_iy(), i, errorMatrix2Lands_multiChannel::id, kChannelsPerCard, kChannelsPerStrip, kChannelsPerTower, kCrystals, kPns, kStripsPerTower, kTowersInPhi, kTriggerTowers, kTriggerTowersAndMem, LogDebug, MAX_TCC_SIZE, MAX_TT_SIZE, DCCTBDataParser::parseBuffer(), pnAllocated, edm::DataFrameContainer::pop_back(), edm::EDCollection< T >::push_back(), edm::DataFrameContainer::push_back(), edm::SortedCollection< T, SORT >::push_back(), edm::DataFrameContainer::reserve(), edm::SortedCollection< T, SORT >::reserve(), edm::second(), EcalDCCHeaderBlock::setBasicTriggerType(), EcalDCCHeaderBlock::setBX(), EcalDCCHeaderBlock::setErrors(), EcalDCCHeaderBlock::setFedId(), EcalDCCHeaderBlock::setFEStatus(), EcalDCCHeaderBlock::setId(), EcalDCCHeaderBlock::setLV1(), EcalDCCHeaderBlock::setOrbit(), EcalDCCHeaderBlock::setRunNumber(), EcalTriggerPrimitiveDigi::setSample(), EcalDataFrame::setSample(), EcalDCCHeaderBlock::setSelectiveReadout(), EcalTriggerPrimitiveDigi::setSize(), EcalDCCHeaderBlock::setSrpStatus(), EcalDCCHeaderBlock::setTccStatus(), EcalDCCHeaderBlock::setTestZeroSuppression(), EcalDCCHeaderBlock::setZeroSuppression(), FEDRawData::size(), strip(), tbName_, tbStatusToLocation_, tbTowerIDToLocation_, theParser_, and v.

Referenced by EcalDCCTB07UnpackingModule::produce().

88  {
89 
90 
91  const unsigned char * pData = fedData.data();
92  int length = fedData.size();
93  bool shit=true;
94  unsigned int tower=0;
95  int ch=0;
96  int strip=0;
97 
98  LogDebug("EcalTB07RawToDigi") << "@SUB=EcalTB07DaqFormatter::interpretRawData"
99  << "size " << length;
100 
101 
102  // mean + 3sigma estimation needed when switching to 0suppressed data
103  digicollection.reserve(kCrystals);
104  eeDigiCollection.reserve(kCrystals);
105  pnAllocated = false;
106 
107 
108  theParser_->parseBuffer( reinterpret_cast<uint32_t*>(const_cast<unsigned char*>(pData)), static_cast<uint32_t>(length), shit );
109 
110  std::vector< DCCTBEventBlock * > & dccEventBlocks = theParser_->dccEvents();
111 
112  // Access each DCCTB block
113  for( std::vector< DCCTBEventBlock * >::iterator itEventBlock = dccEventBlocks.begin();
114  itEventBlock != dccEventBlocks.end();
115  itEventBlock++){
116 
117  bool _displayParserMessages = false;
118  if( (*itEventBlock)->eventHasErrors() && _displayParserMessages)
119  {
120  edm::LogWarning("EcalTB07RawToDigi") << "@SUB=EcalTB07DaqFormatter::interpretRawData"
121  << "errors found from parser... ";
122  edm::LogWarning("EcalTB07RawToDigi") << (*itEventBlock)->eventErrorString();
123  edm::LogWarning("EcalTB07RawToDigi") << "@SUB=EcalTB07DaqFormatter::interpretRawData"
124  << "... errors from parser notified";
125  }
126 
127  // getting the fields of the DCC header
128  EcalDCCHeaderBlock theDCCheader;
129 
130  theDCCheader.setId(46); // tb EE unpacker: forced to 46 to match EE region used at h2
131  int fedId = (*itEventBlock)->getDataField("FED/DCC ID");
132  theDCCheader.setFedId( fedId ); // fed id as found in raw data (0... 35 at tb )
133 
134  theDCCheader.setRunNumber((*itEventBlock)->getDataField("RUN NUMBER"));
135  short trigger_type = (*itEventBlock)->getDataField("TRIGGER TYPE");
136  short zs = (*itEventBlock)->getDataField("ZS");
137  short tzs = (*itEventBlock)->getDataField("TZS");
138  short sr = (*itEventBlock)->getDataField("SR");
139  bool dataIsSuppressed;
140 
141  // if zs&&tzs the suppression algo is used in DCC, the data are not suppressed and zs-bits are set
142  if ( zs && !(tzs) ) dataIsSuppressed = true;
143  else dataIsSuppressed = false;
144 
145  if(trigger_type >0 && trigger_type <5){theDCCheader.setBasicTriggerType(trigger_type);}
146  else{ edm::LogWarning("EcalTB07RawToDigiTriggerType") << "@SUB=EcalTB07DaqFormatter::interpretRawData"
147  << "unrecognized TRIGGER TYPE: "<<trigger_type;}
148  theDCCheader.setLV1((*itEventBlock)->getDataField("LV1"));
149  theDCCheader.setOrbit((*itEventBlock)->getDataField("ORBIT COUNTER"));
150  theDCCheader.setBX((*itEventBlock)->getDataField("BX"));
151  theDCCheader.setErrors((*itEventBlock)->getDataField("DCC ERRORS"));
152  theDCCheader.setSelectiveReadout( sr );
153  theDCCheader.setZeroSuppression( zs );
154  theDCCheader.setTestZeroSuppression( tzs );
155  theDCCheader.setSrpStatus((*itEventBlock)->getDataField("SR_CHSTATUS"));
156 
157 
158 
159 
160  std::vector<short> theTCCs;
161  for(int i=0; i<MAX_TCC_SIZE; i++){
162 
163  char TCCnum[20]; sprintf(TCCnum,"TCC_CHSTATUS#%d",i+1); std::string TCCnumS(TCCnum);
164  theTCCs.push_back ((*itEventBlock)->getDataField(TCCnumS) );
165  }
166  theDCCheader.setTccStatus(theTCCs);
167 
168 
169  std::vector< DCCTBTCCBlock * > tccBlocks = (*itEventBlock)->tccBlocks();
170 
171  for( std::vector< DCCTBTCCBlock * >::iterator itTCCBlock = tccBlocks.begin();
172  itTCCBlock != tccBlocks.end();
173  itTCCBlock ++)
174  {
175 
176  std::vector< std::pair<int,bool> > TpSamples = (* itTCCBlock) -> triggerSamples() ;
177  // std::vector of 3 bits
178  std::vector<int> TpFlags = (* itTCCBlock) -> triggerFlags() ;
179 
180  // there have always to be 68 primitives and flags, per FED
181  if (TpSamples.size()==68 && TpFlags.size()==68)
182  {
183  for(int i=0; i<((int)TpSamples.size()); i++)
184  {
185 
186  int etaTT = (i) / kTowersInPhi +1;
187  int phiTT = (i) % kTowersInPhi +1;
188 
189  // follow HB convention in iphi
190  phiTT=3-phiTT;
191  if(phiTT<=0)phiTT=phiTT+72;
192 
193  EcalTriggerPrimitiveSample theSample(TpSamples[i].first, TpSamples[i].second, TpFlags[i]);
194 
195  EcalTrigTowerDetId idtt(2, EcalBarrel, etaTT, phiTT, 0);
196  EcalTriggerPrimitiveDigi thePrimitive(idtt);
197  thePrimitive.setSize(1); // hard coded
198  thePrimitive.setSample(0, theSample);
199 
200  tpcollection.push_back(thePrimitive);
201 
202  LogDebug("EcalTB07RawToDigiTpg") << "@SUBS=EcalTB07DaqFormatter::interpretRawData"
203  << "tower: " << (i+1)
204  << " primitive: " << TpSamples[i].first
205  << " flag: " << TpSamples[i].second;
206 
207  LogDebug("EcalTB07RawToDigiTpg") << "@SUBS=EcalTB07DaqFormatter::interpretRawData"<<
208  "tower: " << (i+1) << " flag: " << TpFlags[i];
209  }// end loop on tower primitives
210 
211  }// end if
212  else
213  {
214  edm::LogWarning("EcalTB07RawToDigiTpg") << "68 elements not found for TpFlags or TpSamples, collection will be empty";
215  }
216  }
217 
218 
219 
220 
221  short TowerStatus[MAX_TT_SIZE+1];
222  char buffer[20];
223  std::vector<short> theTTstatus;
224  for(int i=1;i<MAX_TT_SIZE+1;i++)
225  {
226  sprintf(buffer, "FE_CHSTATUS#%d", i);
227  std::string Tower(buffer);
228  TowerStatus[i]= (*itEventBlock)->getDataField(Tower);
229  theTTstatus.push_back(TowerStatus[i]);
230  //std::cout << "tower " << i << " has status " << TowerStatus[i] << std::endl;
231  }
232  bool checkTowerStatus = TowerStatus[1] == 0 && TowerStatus[2] == 0 && TowerStatus[3] == 0 && TowerStatus[4] == 0;
233  for (int i=5; i < MAX_TT_SIZE+1; ++i) checkTowerStatus = checkTowerStatus && TowerStatus[i] == 1;
234  if (!checkTowerStatus) {
235  for(int i=1; i<MAX_TT_SIZE+1; ++i) {
236  std::cout << "tower " << i << " has status " << TowerStatus[i] << std::endl;
237  }
238  }
239 
240  theDCCheader.setFEStatus(theTTstatus);
241 
242  EcalDCCTBHeaderRuntypeDecoder theRuntypeDecoder;
243  uint32_t DCCruntype = (*itEventBlock)->getDataField("RUN TYPE");
244  theRuntypeDecoder.Decode(DCCruntype, &theDCCheader);
245  //DCCHeader filled!
246  DCCheaderCollection.push_back(theDCCheader);
247 
248  // add three more DCC headers (EE region used at h4)
249  EcalDCCHeaderBlock hdr = theDCCheader;
250  hdr.setId(04);
251  DCCheaderCollection.push_back(hdr);
252  hdr.setId(05);
253  DCCheaderCollection.push_back(hdr);
254  hdr.setId(06);
255  DCCheaderCollection.push_back(hdr);
256 
257  std::vector< DCCTBTowerBlock * > dccTowerBlocks = (*itEventBlock)->towerBlocks();
258  LogDebug("EcalTB07RawToDigi") << "@SUBS=EcalTB07DaqFormatter::interpretRawData"
259  << "dccTowerBlocks size " << dccTowerBlocks.size();
260 
261 
262 
264  for (int v=0; v<71; v++){
265  _ExpectedTowers[v]=99999;
266  }
267 
268  // note: these are the tower statuses handled at the moment - to be completed
269  // staus==0: tower expected;
270  // staus==9: Synk error LV1, tower expected;
271  // staus==10: Synk error BX, tower expected;
272  // status==1, 2, 3, 4, 5: tower not expected
273  for (int u=1; u< (kTriggerTowersAndMem+1); u++)
274  {
275  // map status array to expected tower array
276  //int towerMap[kTriggerTowersAndMem+1];
277  //for (int i=0; i<kTriggerTowersAndMem; ++i ) towerMap[i] = i;
278  //towerMap[1] = 6;
279  //towerMap[2] = 2;
280  //towerMap[3] = 1;
281  //towerMap[4] = 5;
282 
283  if( TowerStatus[u] ==0 || TowerStatus[u] ==9 || TowerStatus[u] ==10 )
285  _expTowersIndex++;
287  }
288  }
289  // resetting counter of expected towers
290  _expTowersIndex=0;
291 
292 
293  // if number of dccEventBlocks NOT same as expected stop
294  if (! (dccTowerBlocks.size() == _numExpectedTowers) )
295  {
296  // we probably always want to know if this happens
297  edm::LogWarning("EcalTB07RawToDigiNumTowerBlocks") << "@SUB=EcalTB07DaqFormatter::interpretRawData"
298  << "number of TowerBlocks found (" << dccTowerBlocks.size()
299  << ") differs from expected (" << _numExpectedTowers
300  << ") skipping event";
301 
302  EBDetId idsm(1, 1);
303  dccsizecollection.push_back(idsm);
304 
305  return;
306 
307  }
308 
309 
310 
311 
312 
313  // Access the Tower block
314  for( std::vector< DCCTBTowerBlock * >::iterator itTowerBlock = dccTowerBlocks.begin();
315  itTowerBlock!= dccTowerBlocks.end();
316  itTowerBlock++){
317 
318  tower=(*itTowerBlock)->towerID();
319  // here is "correct" h2 map
320  //if ( tower == 1 ) tower = 6;
321  //if ( tower == 71 ) tower = 2;
322  //if ( tower == 80 ) tower = 1;
323  //if ( tower == 45 ) tower = 5;
324  tower = tbTowerIDToLocation_[tower];
325 
326  // checking if tt in data is the same as tt expected
327  // else skip tower and increment problem counter
328 
329  // dccId set to 46 in order to match 'real' CMS positio at H2
330 
332 
333 
334  if ( !(tower == _ExpectedTowers[_expTowersIndex]) )
335  {
336 
337  if (_ExpectedTowers[_expTowersIndex] <= 68){
338  edm::LogWarning("EcalTB07RawToDigiTowerId") << "@SUBS=EcalTB07DaqFormatter::interpretRawData"
339  << "TTower id found (=" << tower
340  << ") different from expected (=" << _ExpectedTowers[_expTowersIndex]
341  << ") " << (_expTowersIndex+1) << "-th tower checked"
342  << "\n Real hardware id is " << (*itTowerBlock)->towerID();
343 
344  // report on failed tt_id for regular tower block
345  ttidcollection.push_back(idtt);
346  }
347  else
348  {
349  edm::LogWarning("EcalTB07RawToDigiTowerId") << "@SUB=EcalTB07DaqFormatter:interpretRawData"
350  << "DecodeMEM: tower " << tower
351  << " is not the same as expected " << ((int)_ExpectedTowers[_expTowersIndex])
352  << " (according to DCC header channel status)";
353 
354  // report on failed tt_id for mem tower block
355  // chosing channel 1 as representative
356  EcalElectronicsId id(1, (int)_ExpectedTowers[_expTowersIndex], 1, 1);
357  memttidcollection.push_back(id);
358  }
359 
360  ++ _expTowersIndex;
361  continue;
362  }// if TT id found different than expected
363 
364 
365 
366  /*********************************
367  // tt: 1 ... 68: crystal data
368  *********************************/
369  if ( 0< (*itTowerBlock)->towerID() &&
370  ((*itTowerBlock)->towerID() < (kTriggerTowers+1) ||
371  (*itTowerBlock)->towerID() == 71 ||
372  (*itTowerBlock)->towerID() == 80)
373  )
374  {
375 
376  std::vector<DCCTBXtalBlock * > & xtalDataBlocks = (*itTowerBlock)->xtalBlocks();
377 
378  // if there is no zero suppression, tower block must have have 25 channels in it
379  if ( (!dataIsSuppressed) && (xtalDataBlocks.size() != kChannelsPerTower) )
380  {
381  edm::LogWarning("EcalTB07RawToDigiTowerSize") << "EcalTB07DaqFormatter::interpretRawData, no zero suppression "
382  << "wrong tower block size is: " << xtalDataBlocks.size()
383  << " at LV1 " << (*itEventBlock)->getDataField("LV1")
384  << " for TT " << _ExpectedTowers[_expTowersIndex];
385  // report on wrong tt block size
386  blocksizecollection.push_back(idtt);
387 
388  ++ _expTowersIndex; continue;
389 
390  }
391 
392 
393  short cryInTower =0;
394 
395  short expStripInTower;
396  short expCryInStrip;
397  short expCryInTower =0;
398 
399  // Access the Xstal data
400  for( std::vector< DCCTBXtalBlock * >::iterator itXtalBlock = xtalDataBlocks.begin();
401  itXtalBlock!= xtalDataBlocks.end();
402  itXtalBlock++){ //loop on crys of a tower
403 
404  strip =(*itXtalBlock)->stripID();
405  ch =(*itXtalBlock)->xtalID();
406  cryInTower =(strip-1)* kChannelsPerCard + (ch -1);
407 
408  expStripInTower = expCryInTower/5 +1;
409  expCryInStrip = expCryInTower%5 +1;
410 
411 
412  // FIXME: waiting for geometry to do (TT, strip,chNum) <--> (SMChId)
413  // short abscissa = (_ExpectedTowers[_expTowersIndex]-1) /4;
414  // short ordinate = (_ExpectedTowers[_expTowersIndex]-1) %4;
415  // temporarily choosing central crystal in trigger tower
416  // int cryIdInSM = 45 + ordinate*5 + abscissa * 100;
417 
418 
419  // in case of 0 zuppressed data, check that cryInTower constantly grows
420  if (dataIsSuppressed)
421  {
422 
423  if ( strip < 1 || 5<strip || ch <1 || 5 < ch)
424  {
425  int sm = 1; // hardcoded because of test beam
426  for (int StripInTower_ =1; StripInTower_ < 6; StripInTower_++){
427  for (int CryInStrip_ =1; CryInStrip_ < 6; CryInStrip_++){
428  int ic = cryIc(tower, StripInTower_, CryInStrip_) ;
429  EBDetId idExp(sm, ic,1);
430  chidcollection.push_back(idExp);
431  }
432  }
433 
434  edm::LogWarning("EcalTB07RawToDigiChId") << "EcalTB07DaqFormatter::interpretRawData with zero suppression, "
435  << " wrong channel id, since out of range: "
436  << "\t strip: " << strip << "\t channel: " << ch
437  << "\t in TT: " << _ExpectedTowers[_expTowersIndex]
438  << "\t at LV1 : " << (*itEventBlock)->getDataField("LV1");
439 
440  expCryInTower++;
441  continue;
442  }
443 
444 
445  // correct ordering
446  if( cryInTower >= expCryInTower ){
447  expCryInTower = cryInTower +1;
448  }
449 
450 
451  // cry_id wrong because of incorrect ordering within trigger tower
452  else
453  {
454  edm::LogWarning("EcalTB07RawToDigiChId") << "EcalTB07DaqFormatter::interpretRawData with zero suppression, "
455  << " based on ch ordering within tt, wrong channel id: "
456  << "\t strip: " << strip << "\t channel: " << ch
457  << "\t cryInTower " << cryInTower
458  << "\t expCryInTower: " << expCryInTower
459  << "\t in TT: " << _ExpectedTowers[_expTowersIndex]
460  << "\t at LV1: " << (*itEventBlock)->getDataField("LV1");
461 
462  int sm = 1; // hardcoded because of test beam
463  for (int StripInTower_ =1; StripInTower_ < 6; StripInTower_++){
464  for (int CryInStrip_ =1; CryInStrip_ < 6; CryInStrip_++){
465  int ic = cryIc(tower, StripInTower_, CryInStrip_) ;
466  EBDetId idExp(sm, ic,1);
467  chidcollection.push_back(idExp);
468  }
469  }
470 
471  // chennel with id which does not follow correct odering
472  expCryInTower++; continue;
473 
474  }// end 'ch_id does not respect growing order'
475 
476  }// end if zero supression
477 
478 
479 
480  else {
481 
482  // checking that ch and strip are within range and cryInTower is as expected
483  if( cryInTower != expCryInTower ||
484  strip < 1 || kStripsPerTower <strip ||
485  ch <1 || kChannelsPerStrip < ch )
486  {
487 
488  int ic = cryIc(tower, expStripInTower, expCryInStrip) ;
489  int sm = 1; // hardcoded because of test beam
490  EBDetId idExp(sm, ic,1);
491 
492  edm::LogWarning("EcalTB07RawToDigiChId") << "EcalTB07DaqFormatter::interpretRawData no zero suppression "
493  << " wrong channel id for channel: " << expCryInStrip
494  << "\t strip: " << expStripInTower
495  << "\t in TT: " << _ExpectedTowers[_expTowersIndex]
496  << "\t at LV1: " << (*itEventBlock)->getDataField("LV1")
497  << "\t (in the data, found channel: " << ch
498  << "\t strip: " << strip << " ).";
499 
500 
501  // report on wrong channel id
502  chidcollection.push_back(idExp);
503 
504  // there has been unexpected crystal id, dataframe not to go to the Event
505  expCryInTower++; continue;
506 
507  } // if channel in data does not equal expected channel
508 
509  expCryInTower++;
510 
511  } // end 'not zero suppression'
512 
513 
514 
515  // data to be stored in EBDataFrame, identified by EBDetId
516  int ic = cryIc(tower, strip, ch) ;
517  int sm = 1;
518  EBDetId id(sm, ic,1);
519  // EE data to be stored in EEDataFrame, identified by EEDetId
520  // eeId(int i, int j, int iz (+1/-1), int mode = XYMODE)
521  int ix = getEE_ix(tower, strip, ch);
522  int iy = getEE_iy(tower, strip, ch);
523 
524  int iz = 1;
525  if ( tbName_ == "h4" ) iz = -1;
526  EEDetId eeId(ix, iy, iz);
527 
528  // here data frame go into the Event
529  // removed later on (with a pop_back()) if gain==0 or if forbidden-gain-switch
530  digicollection.push_back( id );
531  eeDigiCollection.push_back( eeId );
532  EBDataFrame theFrame ( digicollection.back() );
533  EEDataFrame eeFrame ( eeDigiCollection.back() );
534 
535  std::vector<int> xtalDataSamples = (*itXtalBlock)->xtalDataSamples();
536  //theFrame.setSize(xtalDataSamples.size()); // if needed, to be changed when constructing digicollection
537  //eeFrame. setSize(xtalDataSamples.size()); // if needed, to be changed when constructing eeDigicollection
538 
539 
540  // gain cannot be 0, checking for that
541  bool gainIsOk =true;
542  unsigned gain_mask = 12288; //12th and 13th bit
543  std::vector <int> xtalGain;
544 
545  for (unsigned short i=0; i<xtalDataSamples.size(); ++i ) {
546 
547  theFrame.setSample (i, xtalDataSamples[i] );
548  eeFrame .setSample (i, xtalDataSamples[i] );
549 
550  if((xtalDataSamples[i] & gain_mask) == 0){gainIsOk =false;}
551 
552  xtalGain.push_back(0);
553  xtalGain[i] |= (xtalDataSamples[i] >> 12);
554  }
555 
556  if (! gainIsOk) {
557 
558  edm::LogWarning("EcalTB07RawToDigiGainZero") << "@SUB=EcalTB07DaqFormatter::interpretRawData"
559  << " gain==0 for strip: " << expStripInTower
560  << "\t channel: " << expCryInStrip
561  << "\t in TT: " << _ExpectedTowers[_expTowersIndex]
562  << "\t ic: " << ic
563  << "\t at LV1: " << (*itEventBlock)->getDataField("LV1");
564  // report on gain==0
565  gaincollection.push_back(id);
566 
567  // there has been a gain==0, dataframe not to go to the Event
568  digicollection.pop_back();
569  eeDigiCollection.pop_back();
570  continue; // expCryInTower already incremented
571  }
572 
573 
574 
575 
576  // looking for forbidden gain transitions
577 
578  short firstGainWrong=-1;
579  short numGainWrong=0;
580 
581  for (unsigned short i=0; i<xtalGain.size(); i++ ) {
582 
583  if (i>0 && xtalGain[i-1]>xtalGain[i]) {
584 
585  numGainWrong++;// counting forbidden gain transitions
586 
587  if (firstGainWrong == -1) {
588  firstGainWrong=i;
589  edm::LogWarning("EcalTB07RawToDigiGainSwitch") << "@SUB=EcalTB07DaqFormatter::interpretRawData"
590  << "channelHasGainSwitchProblem: crystal eta = "
591  << id.ieta() << " phi = " << id.iphi();
592  }
593  edm::LogWarning("EcalTB07RawToDigiGainSwitch") << "@SUB=EcalTB07DaqFormatter::interpretRawData"
594  << "channelHasGainSwitchProblem: sample = " << (i-1)
595  << " gain: " << xtalGain[i-1] << " sample: "
596  << i << " gain: " << xtalGain[i];
597  }
598  }
599 
600  if (numGainWrong>0) {
601  gainswitchcollection.push_back(id);
602 
603  edm::LogWarning("EcalTB07RawToDigiGainSwitch") << "@SUB=EcalTB07DaqFormatter:interpretRawData"
604  << "channelHasGainSwitchProblem: more than 1 wrong transition";
605 
606  for (unsigned short i1=0; i1<xtalDataSamples.size(); ++i1 ) {
607  int countADC = 0x00000FFF;
608  countADC &= xtalDataSamples[i1];
609  LogDebug("EcalTB07RawToDigi") << "Sample " << i1 << " ADC " << countADC << " Gain " << xtalGain[i1];
610  }
611 
612  // there has been a forbidden gain transition, dataframe not to go to the Event
613  digicollection.pop_back();
614  eeDigiCollection.pop_back();
615  continue; // expCryInTower already incremented
616 
617  }// END of: 'if there is a forbidden gain transition'
618 
619  }// end loop on crystals within a tower block
620 
621  _expTowersIndex++;
622  }// end: tt1 ... tt68, crystal data
623 
624 
625 
626 
627 
628  /******************************************************************
629  // tt 69 and 70: two mem boxes, holding PN0 ... PN9
630  ******************************************************************/
631  else if ( (*itTowerBlock)->towerID() == 69
632  || (*itTowerBlock)->towerID() == 70 )
633  {
634 
635  LogDebug("EcalTB07RawToDigi") << "@SUB=EcalTB07DaqFormatter::interpretRawData"
636  << "processing mem box num: " << (*itTowerBlock)->towerID();
637 
638  // if tt 69 or 70 found, allocate Pn digi collection
639  if(! pnAllocated)
640  {
641  pndigicollection.reserve(kPns);
642  pnAllocated = true;
643  }
644 
645  DecodeMEM( (*itTowerBlock), pndigicollection ,
646  memttidcollection, memblocksizecollection,
647  memgaincollection, memchidcollection);
648 
649  }// end of < if it is a mem box>
650 
651 
652 
653 
654 
655  // wrong tt id
656  else {
657  edm::LogWarning("EcalTB07RawToDigiTowerId") <<"@SUB=EcalTB07DaqFormatter::interpretRawData"
658  << " processing tt with ID not existing ( "
659  << (*itTowerBlock)->towerID() << ")";
660  ++ _expTowersIndex;
661  continue;
662  }// end: tt id error
663 
664  }// end loop on trigger towers
665 
666  }// end loop on events
667 }
#define LogDebug(id)
bool Decode(unsigned long headerWord, EcalDCCHeaderBlock *theHeader)
int i
Definition: DBlmapReader.cc:9
void setSelectiveReadout(const bool &selectiveReadout)
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
void setFedId(const int &fedId)
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
void setBasicTriggerType(const short &triggerType)
void push_back(T const &t)
void push_back(T const &t)
Definition: EDCollection.h:68
std::vector< DCCTBEventBlock * > & dccEvents()
void setFEStatus(const std::vector< short > &feStatus)
void setRunNumber(const int &run)
U second(std::pair< T, U > const &p)
void setZeroSuppression(const bool &zeroSuppression)
int cryIc(int tower_id, int strip, int xtal)
void setTestZeroSuppression(const bool &testZeroSuppression)
DCCTBDataParser * theParser_
bool first
Definition: L1TdeRCT.cc:94
int getEE_iy(int tower, int strip, int ch)
void setTccStatus(const std::vector< short > &tccStatus)
void reserve(size_t isize)
void DecodeMEM(DCCTBTowerBlock *towerblock, EcalPnDiodeDigiCollection &pndigicollection, EcalElectronicsIdCollection &memttidcollection, EcalElectronicsIdCollection &memblocksizecollection, EcalElectronicsIdCollection &memgaincollection, EcalElectronicsIdCollection &memchidcollection)
void setErrors(const int &dccErrors)
void setSrpStatus(const short &srpStatus)
void push_back(id_type iid, data_type const *idata)
void parseBuffer(uint32_t *buffer, uint32_t bufferSize, bool singleEvent=false)
void setOrbit(const int &orbit)
int getEE_ix(int tower, int strip, int ch)
void setSample(int i, EcalMGPASample sam)
Definition: EcalDataFrame.h:44
#define MAX_TCC_SIZE
void reserve(size_type n)
void setId(const int &dccId)
tuple cout
Definition: gather_cfg.py:121
void setLV1(const int &LV1)
void setBX(const int &BX)
#define MAX_TT_SIZE
mathSSE::Vec4< T > v
bool EcalTB07DaqFormatter::leftTower ( int  tower) const
private

Definition at line 979 of file EcalTB07DaqFormatter.cc.

References rightTower().

980 {
981  return !rightTower(tower);
982 }
bool rightTower(int tower) const
bool EcalTB07DaqFormatter::rightTower ( int  tower) const
private

Definition at line 968 of file EcalTB07DaqFormatter.cc.

Referenced by cellIndex(), and leftTower().

968  {
969 
970  if ((tower>12 && tower<21) || (tower>28 && tower<37) ||
971  (tower>44 && tower<53) || (tower>60 && tower<69))
972  return true;
973  else
974  return false;
975 }

Member Data Documentation

unsigned EcalTB07DaqFormatter::_ExpectedTowers[71]
private

Definition at line 95 of file EcalTB07DaqFormatter.h.

Referenced by DecodeMEM(), and interpretRawData().

unsigned EcalTB07DaqFormatter::_expTowersIndex
private

Definition at line 96 of file EcalTB07DaqFormatter.h.

Referenced by DecodeMEM(), and interpretRawData().

unsigned EcalTB07DaqFormatter::_numExpectedTowers
private

Definition at line 94 of file EcalTB07DaqFormatter.h.

Referenced by interpretRawData().

int EcalTB07DaqFormatter::cryIcMap_[68][5][5]
private

Definition at line 61 of file EcalTB07DaqFormatter.h.

Referenced by cryIc(), and EcalTB07DaqFormatter().

int EcalTB07DaqFormatter::data_MEM[500]
private

Definition at line 100 of file EcalTB07DaqFormatter.h.

Referenced by DecodeMEM().

int EcalTB07DaqFormatter::memRawSample_[kStripsPerTower][kChannelsPerStrip][kSamplesPerChannel+1]
private

Definition at line 99 of file EcalTB07DaqFormatter.h.

Referenced by DecodeMEM().

bool EcalTB07DaqFormatter::pnAllocated
private

Definition at line 101 of file EcalTB07DaqFormatter.h.

Referenced by interpretRawData().

bool EcalTB07DaqFormatter::pnIsOkInBlock[kPnPerTowerBlock]
private

Definition at line 102 of file EcalTB07DaqFormatter.h.

Referenced by DecodeMEM().

std::string EcalTB07DaqFormatter::tbName_
private

Definition at line 64 of file EcalTB07DaqFormatter.h.

Referenced by EcalTB07DaqFormatter(), getEE_ix(), getEE_iy(), and interpretRawData().

int EcalTB07DaqFormatter::tbStatusToLocation_[71]
private

Definition at line 62 of file EcalTB07DaqFormatter.h.

Referenced by EcalTB07DaqFormatter(), and interpretRawData().

int EcalTB07DaqFormatter::tbTowerIDToLocation_[201]
private

Definition at line 63 of file EcalTB07DaqFormatter.h.

Referenced by EcalTB07DaqFormatter(), and interpretRawData().

DCCTBDataParser* EcalTB07DaqFormatter::theParser_
private

Definition at line 60 of file EcalTB07DaqFormatter.h.

Referenced by EcalTB07DaqFormatter(), and interpretRawData().