CMS 3D CMS Logo

EcalSelectiveReadoutSuppressor Class Reference

#include <SimCalorimetry/EcalSelectiveReadoutAlgos/interface/EcalSelectiveReadoutSuppressor.h>

List of all members.

Public Types

enum  { BARREL, ENDCAP }

Public Member Functions

 EcalSelectiveReadoutSuppressor (const edm::ParameterSet &params)
 Construtor.
EcalSelectiveReadoutgetEcalSelectiveReadout ()
 For debugging purposes.
void printTTFlags (std::ostream &os, int iEvent=-1, bool withHeader=true) const
 Writes out TT flags.
void run (const edm::EventSetup &eventSetup, const EcalTrigPrimDigiCollection &trigPrims, const EBDigiCollection &barrelDigis, const EEDigiCollection &endcapDigis, EBDigiCollection &selectedBarrelDigis, EEDigiCollection &selectedEndcapDigis, EBSrFlagCollection &ebSrFlags, EESrFlagCollection &eeSrFlags)
 Runs the selective readout (SR) algorithm.
void run (const edm::EventSetup &eventSetup, const EcalTrigPrimDigiCollection &trigPrims, EBDigiCollection &barrelDigis, EEDigiCollection &endcapDigis)
 Runs the selective readout(SR) algorithm.
void setGeometry (const CaloGeometry *caloGeometry)
 Sets the geometry of the calorimeters.
void setTriggerMap (const EcalTrigTowerConstituentsMap *map)
 Set the mapping of which cell goes with which trigger tower.

Static Public Member Functions

static int getFIRTapCount ()
 Gets number of weights supported by the zero suppression filter.

Private Member Functions

bool accept (const edm::DataFrame &frame, int thr)
 Returns true if a digi passes the zero suppression.
template<class T>
double frame2Energy (const T &frame, int timeOffset=0) const
std::vector< intgetFIRWeigths ()
 Gets the integer weights used by the zero suppression FIR filter.
int iEta2cIndex (int iEta) const
 Transforms CMSSW eta ECAL crystal indices to indices starting at 0 to use for c-array or vector.
void initCellThresholds (double barrelLowInterest, double endcapLowInterest, double barrelHighInterest, double endcapHighInterest)
 helpers for constructors
int internalThreshold (double thresholdInGeV, int iSubDet) const
 Converts threshold in GeV to threshold in internal unit used by the ZS FIR.
int iPhi2cIndex (int iPhi) const
 Transforms CMSSW phi ECAL crystal indices to indices starting at 0 to use for c-array or vector.
int iTTEta2cIndex (int iEta) const
 Transforms CMSSW eta ECAL TT indices to indices starting at 0 to use for c-array or vector.
int iTTPhi2cIndex (int iPhi) const
 Transforms CMSSW phi ECAL crystal indices to indices starting at 0 to use for c-array or vector.
void setTtFlags (const EcalTrigPrimDigiCollection &trigPrims)
 Help function to set the srFlags field.
void setTtFlags (const edm::EventSetup &eventSetup, const EBDigiCollection &ebDigis, const EEDigiCollection &eeDigis)
 Help function to set the srFlags field.
int thr2Srf (int thr, int zsFlag) const
 Help function to get SR flag from ZS threshold using min/max convention for SUPPRESS and FULL_READOUT: see zsThreshold.

Private Attributes

std::auto_ptr
< EcalSelectiveReadout
ecalSelectiveReadout
 Help class to comput selective readout flags.
int firstFIRSample
 Time position of the first sample to use in zero suppession FIR filter.
std::vector< intfirWeights
 Weights of zero suppression FIR filter.
int srFlags [2][4]
 Maps RU interest flag (low interest, single neighbour, center) to Selective readout action flag (type of readout).
bool symetricZS
 Flag to use a symetric zero suppression (cut on absolute value).
const
EcalTrigTowerConstituentsMap
theTriggerMap
double thrUnit [2]
 Internal unit for Zero Suppression threshold (1/4th ADC count) used by the FIR.
bool trigPrimBypass_
 Switch for trigger primitive simulation module bypass debug mode.
double trigPrimBypassHTH_
 Low TT Et threshold for trigger primitive simulation module bypass debug mode.
double trigPrimBypassLTH_
 Low TT Et threshold for trigger primitive simulation module bypass debug mode.
bool trigPrimBypassWithPeakFinder_
 When in trigger primitive simulation module bypass debug mode, switch to enable Peak finder effect simulation.
EcalSelectiveReadout::ttFlag_t ttFlags [nTriggerTowersInEta][nTriggerTowersInPhi]
 Trigger tower flags: see setTtFlags().
std::vector< double > weights
 DCC zero suppression FIR filter uncalibrated normalized weigths.
int zsThreshold [2][4]
 Zero suppresion threshold for the ECAL expressed in ebThrUnit and eeThrUnit.

Static Private Attributes

static const size_t nBarrelTriggerTowersInEta = 34
 Number of eta trigger tower divisions in the barrel.
static const size_t nEndcaps = 2
 Number of endcap, obviously two.
static const size_t nEndcapTriggerTowersInEta = 11
 Number of eta trigger tower divisions in one endcap.
static const int nFIRTaps = 6
 Depth of DCC zero suppression FIR filter (number of taps), in principal 6.
static const size_t nTriggerTowersInEta = 2*nEndcapTriggerTowersInEta+nBarrelTriggerTowersInEta
 Number of eta divisions in trigger towers for the whole ECAL.
static const size_t nTriggerTowersInPhi = 72
 Number of phi divisions in trigger towers.


Detailed Description

Definition at line 14 of file EcalSelectiveReadoutSuppressor.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
BARREL 
ENDCAP 

Definition at line 21 of file EcalSelectiveReadoutSuppressor.h.

00021 {BARREL, ENDCAP};


Constructor & Destructor Documentation

EcalSelectiveReadoutSuppressor::EcalSelectiveReadoutSuppressor ( const edm::ParameterSet params  ) 

Construtor.

Parameters:
params configuration

Definition at line 31 of file EcalSelectiveReadoutSuppressor.cc.

References BARREL, ecalSelectiveReadout, ENDCAP, edm::ParameterSet::getParameter(), initCellThresholds(), thrUnit, trigPrimBypass_, trigPrimBypassHTH_, trigPrimBypassLTH_, and trigPrimBypassWithPeakFinder_.

00031                                                                                             :
00032   firstFIRSample(params.getParameter<int>("ecalDccZs1stSample")),
00033   weights(params.getParameter<vector<double> >("dccNormalizedWeights")),
00034   symetricZS(params.getParameter<bool>("symetricZS"))
00035 {
00036   
00037   double adcToGeV = params.getParameter<double>("ebDccAdcToGeV");
00038   thrUnit[BARREL] = adcToGeV/4.; //unit=1/4th ADC count
00039   
00040   adcToGeV = params.getParameter<double>("eeDccAdcToGeV");
00041   thrUnit[ENDCAP] = adcToGeV/4.; //unit=1/4th ADC count
00042   ecalSelectiveReadout
00043     = auto_ptr<EcalSelectiveReadout>(new EcalSelectiveReadout
00044                                      (params.getParameter<int>("deltaEta"),
00045                                       params.getParameter<int>("deltaPhi")));
00046   initCellThresholds(params.getParameter<double>("srpBarrelLowInterestChannelZS"),
00047                      params.getParameter<double>("srpEndcapLowInterestChannelZS"),
00048                      params.getParameter<double>("srpBarrelHighInterestChannelZS"),
00049                      params.getParameter<double>("srpEndcapHighInterestChannelZS")
00050                      );
00051   trigPrimBypass_ = params.getParameter<bool>("trigPrimBypass");
00052   trigPrimBypassWithPeakFinder_
00053     = params.getParameter<bool>("trigPrimBypassWithPeakFinder");
00054   trigPrimBypassLTH_ = params.getParameter<double>("trigPrimBypassLTH");
00055   trigPrimBypassHTH_ = params.getParameter<double>("trigPrimBypassHTH");
00056   if(trigPrimBypass_){
00057     edm::LogWarning("Digitization") << "Beware a simplified trigger primitive "
00058       "computation is used for the ECAL selective readout";
00059   }
00060 }


Member Function Documentation

bool EcalSelectiveReadoutSuppressor::accept ( const edm::DataFrame frame,
int  thr 
) [private]

Returns true if a digi passes the zero suppression.

Parameters:
frame,data frame (aka digi).
thr zero suppression threshold in thrUnit.
Returns:
true if passed ZS filter, false if failed

Definition at line 154 of file EcalSelectiveReadoutSuppressor.cc.

References EcalMGPASample::adc(), firstFIRSample, EcalMGPASample::gainId(), getFIRWeigths(), nFIRTaps, HLT_VtxMuL3::result, edm::DataFrame::size(), symetricZS, and w.

Referenced by run().

00155                                                     {
00156   //FIR filter weights:
00157   const vector<int>& w = getFIRWeigths();
00158   
00159   //accumulator used to compute weighted sum of samples
00160   int acc = 0;
00161   bool gain12saturated = false;
00162   const int gain12 = 0x01; 
00163   const int lastFIRSample = firstFIRSample + nFIRTaps - 1;
00164   //LogDebug("DccFir") << "DCC FIR operation: ";
00165   int iWeight = 0;
00166   for(int iSample=firstFIRSample-1;
00167       iSample<lastFIRSample; ++iSample, ++iWeight){
00168     if(iSample>=0 && iSample < (int)frame.size()){
00169       EcalMGPASample sample(frame[iSample]);
00170       if(sample.gainId()!=gain12) gain12saturated = true;
00171       //LogTrace("DccFir") << (iSample>=firstFIRSample?"+":"") << sample.adc()
00172       //                 << "*(" << w[iWeight] << ")";
00173       acc+=sample.adc()*w[iWeight];
00174     } else{
00175       edm::LogWarning("DccFir") << __FILE__ << ":" << __LINE__ <<
00176         ": Not enough samples in data frame or 'ecalDccZs1stSample' module "
00177         "parameter is not valid...";
00178     }
00179   }
00180 
00181   if(symetricZS){//cut on absolute value
00182     if(acc<0) acc = -acc;
00183   }
00184   
00185   //LogTrace("DccFir") << "\n";
00186   //discards the 8 LSBs 
00187   //(result of shift operator on negative numbers depends on compiler
00188   //implementation, therefore the value is offset to make sure it is positive
00189   //before performing the bit shift).
00190   acc = ((acc + (1<<30)) >>8) - (1 <<(30-8));
00191 
00192   //ZS passed if weigthed sum acc above ZS threshold or if
00193   //one sample has a lower gain than gain 12 (that is gain 12 output
00194   //is saturated)
00195   
00196   const bool result = (acc >= thr) || gain12saturated;
00197   
00198   //LogTrace("DccFir") << "acc: " << acc << "\n"
00199   //                   << "threshold: " << thr << " ("
00200   //                   << thr*thrUnit[((EcalDataFrame&)frame).id().subdetId()==EcalBarrel?0:1]
00201   //                   << "GeV)\n"
00202   //                   << "saturated: " << (gain12saturated?"yes":"no") << "\n"
00203   //                   << "ZS passed: " << (result?"yes":"no")
00204   //                   << (symetricZS?" (symetric cut)":"") << "\n";
00205   
00206   return result;
00207 }

template<class T>
double EcalSelectiveReadoutSuppressor::frame2Energy ( const T &  frame,
int  timeOffset = 0 
) const [inline, private]

Definition at line 466 of file EcalSelectiveReadoutSuppressor.cc.

References TestMuL1L2Filter_cff::cerr, i, n, and weights.

Referenced by setTtFlags().

00467                                                                      {
00468   //we have to start by 0 in order to handle offset=-1
00469   //(however Fenix FIR has AFAK only 5 taps)
00470   double weights[] = {0., -1/3., -1/3., -1/3., 0., 1.};   
00471 
00472   double adc2GeV = 0.;
00473   if(typeid(frame) == typeid(EBDataFrame)){
00474     adc2GeV = 0.035;
00475   } else if(typeid(frame) == typeid(EEDataFrame)){
00476     adc2GeV = 0.060;
00477   } else{ //T is an invalid type!
00478     //TODO: replace message by a cms exception
00479     cerr << "Severe error. "
00480          << __FILE__ << ":" << __LINE__ << ": "
00481          << "this is a bug. Please report it.\n";
00482   }
00483     
00484   double acc = 0;
00485 
00486   const int n = min<int>(frame.size(), sizeof(weights)/sizeof(weights[0]));
00487 
00488   double gainInv[] = {12., 1., 6., 12.};
00489 
00490 
00491   //cout << __PRETTY_FUNCTION__ << ": ";
00492   for(int i=offset; i < n; ++i){
00493     int iframe = i + offset;
00494     if(iframe>=0 && iframe<frame.size()){
00495       acc += weights[i]*frame[iframe].adc()
00496         *gainInv[frame[iframe].gainId()]*adc2GeV;
00497       //cout << (iframe>offset?"+":"")
00498       //     << frame[iframe].adc() << "*" << gainInv[frame[iframe].gainId()]
00499       //     << "*" << adc2GeV << "*(" << weights[i] << ")";
00500     }
00501   }
00502   //cout << "\n";
00503   return acc;
00504 }

EcalSelectiveReadout* EcalSelectiveReadoutSuppressor::getEcalSelectiveReadout (  )  [inline]

For debugging purposes.

Definition at line 70 of file EcalSelectiveReadoutSuppressor.h.

References ecalSelectiveReadout.

00070                                                  {
00071     return ecalSelectiveReadout.get();
00072   }

static int EcalSelectiveReadoutSuppressor::getFIRTapCount (  )  [inline, static]

Gets number of weights supported by the zero suppression filter.

Returns:
number of weights

Definition at line 26 of file EcalSelectiveReadoutSuppressor.h.

References nFIRTaps.

Referenced by EcalSelectiveReadoutProducer::checkWeights().

00026 { return nFIRTaps;}

vector< int > EcalSelectiveReadoutSuppressor::getFIRWeigths (  )  [private]

Gets the integer weights used by the zero suppression FIR filter.

<U>Weight definitions:</U>

If a FIR weights exceeds the (2**12-1) absolute value limit, its absolute value is replaced by (2**12-1).

Definition at line 344 of file EcalSelectiveReadoutSuppressor.cc.

References funct::abs(), firWeights, i, min, nFIRTaps, and weights.

Referenced by accept().

00344                                                           {
00345   if(firWeights.size()==0){
00346     firWeights = vector<int>(nFIRTaps, 0); //default weight: 0;
00347     const static int maxWeight = 0xEFF; //weights coded on 11+1 signed bits
00348     for(unsigned i=0; i < min((size_t)nFIRTaps,weights.size()); ++i){ 
00349       firWeights[i] = lround(weights[i] * (1<<10));
00350       if(abs(firWeights[i])>maxWeight){//overflow
00351         firWeights[i] = firWeights[i]<0?-maxWeight:maxWeight;
00352       }
00353     }
00354   }
00355   return firWeights;
00356 }

int EcalSelectiveReadoutSuppressor::iEta2cIndex ( int  iEta  )  const [inline, private]

Transforms CMSSW eta ECAL crystal indices to indices starting at 0 to use for c-array or vector.

Parameters:
iEta CMSSW eta index (numbering -85...-1,1...85)
Returns:
index in numbering from 0 to 169

Definition at line 131 of file EcalSelectiveReadoutSuppressor.h.

00131                                  {
00132     return (iEta<0)?iEta+85:iEta+84;
00133   }

void EcalSelectiveReadoutSuppressor::initCellThresholds ( double  barrelLowInterest,
double  endcapLowInterest,
double  barrelHighInterest,
double  endcapHighInterest 
) [private]

helpers for constructors

Initializes ZS threshold and SR classificion to SR ("action") flags

Definition at line 77 of file EcalSelectiveReadoutSuppressor.cc.

References BARREL, ENDCAP, internalThreshold(), EcalSrFlag::SRF_ZS1, EcalSrFlag::SRF_ZS2, srFlags, thr2Srf(), and zsThreshold.

Referenced by EcalSelectiveReadoutSuppressor().

00080                                                                                   {
00081   //center, neighbour and single RUs are grouped into a single
00082   //'high interest' group
00083   int lowInterestThr[2]; //index for BARREL/ENDCAP
00084   int lowInterestSrFlag[2];
00085   int highInterestThr[2];
00086   int highInterestSrFlag[2];
00087   
00088   lowInterestThr[BARREL] = internalThreshold(barrelLowInterest, BARREL);
00089   lowInterestSrFlag[BARREL] = thr2Srf(lowInterestThr[BARREL],
00090                                       EcalSrFlag::SRF_ZS1);
00091   
00092   highInterestThr[BARREL] = internalThreshold(barrelHighInterest, BARREL);
00093   highInterestSrFlag[BARREL] = thr2Srf(highInterestThr[BARREL],
00094                                        EcalSrFlag::SRF_ZS2);
00095   
00096   lowInterestThr[ENDCAP] = internalThreshold(endcapLowInterest, ENDCAP);
00097   lowInterestSrFlag[ENDCAP] = thr2Srf(lowInterestThr[ENDCAP],
00098                                       EcalSrFlag::SRF_ZS2);
00099 
00100   highInterestThr[ENDCAP] = internalThreshold(endcapHighInterest, ENDCAP); 
00101   highInterestSrFlag[ENDCAP] = thr2Srf(highInterestThr[ENDCAP],
00102                                        EcalSrFlag::SRF_ZS2);
00103   
00104   for(int iSubDet = 0; iSubDet<2; ++iSubDet){
00105     //low interest
00106     zsThreshold[iSubDet][0] = lowInterestThr[iSubDet];
00107     srFlags[iSubDet][0] = lowInterestSrFlag[iSubDet];
00108 
00109     //single->high interest
00110     zsThreshold[iSubDet][1] = highInterestThr[iSubDet];
00111     srFlags[iSubDet][1] = highInterestSrFlag[iSubDet];
00112 
00113     //neighbour->high interest
00114     zsThreshold[iSubDet][2] = highInterestThr[iSubDet];
00115     srFlags[iSubDet][2] = highInterestSrFlag[iSubDet];
00116 
00117     //center->high interest
00118     zsThreshold[iSubDet][3] = highInterestThr[iSubDet];
00119     srFlags[iSubDet][3] = highInterestSrFlag[iSubDet];
00120   }
00121 }

int EcalSelectiveReadoutSuppressor::internalThreshold ( double  thresholdInGeV,
int  iSubDet 
) const [private]

Converts threshold in GeV to threshold in internal unit used by the ZS FIR.

Parameters:
thresholdInGeV the theshold in GeV
iSubDet 0 for barrel, 1 for endcap
Returns:
threshold in thrUnit unit. INT_MAX means complete suppression, INT_MIN means no zero suppression.

Definition at line 133 of file EcalSelectiveReadoutSuppressor.cc.

References max, min, and thrUnit.

Referenced by initCellThresholds().

00134                                                                         {
00135   double thr_ = thresholdInGeV / thrUnit[iSubDet];
00136   //treating over- and underflows, threshold is coded on 11+1 signed bits
00137   //an underflow threshold is considered here as if NoRO DCC switch is on
00138   //an overflow threshold is considered here as if ForcedRO DCC switch in on
00139   //Beware that conparison must be done on a double type, because conversion
00140   //cast to an int of a double higher than MAX_INT is undefined.
00141   int thr;
00142   if(thr_>=0x7FF+.5){
00143     thr = numeric_limits<int>::max();
00144   } else if(thr_<=-0x7FF-.5){
00145     thr = numeric_limits<int>::min();
00146   } else{
00147     thr = lround(thr_);
00148   }
00149   return thr;
00150 }

int EcalSelectiveReadoutSuppressor::iPhi2cIndex ( int  iPhi  )  const [inline, private]

Transforms CMSSW phi ECAL crystal indices to indices starting at 0 to use for c-array or vector.

Parameters:
iPhi CMSSW phi index (numbering 1...360)
Returns:
index in numbering 0...359

Definition at line 140 of file EcalSelectiveReadoutSuppressor.h.

00140                                  {
00141     return iPhi-1;
00142   }

int EcalSelectiveReadoutSuppressor::iTTEta2cIndex ( int  iEta  )  const [inline, private]

Transforms CMSSW eta ECAL TT indices to indices starting at 0 to use for c-array or vector.

Parameters:
iEta CMSSW eta index (numbering -28...-1,28...56)
Returns:
index in numbering from 0 to 55

Definition at line 149 of file EcalSelectiveReadoutSuppressor.h.

Referenced by setTtFlags().

00149                                    {
00150     return (iEta<0)?iEta+28:iEta+27;
00151   }

int EcalSelectiveReadoutSuppressor::iTTPhi2cIndex ( int  iPhi  )  const [inline, private]

Transforms CMSSW phi ECAL crystal indices to indices starting at 0 to use for c-array or vector.

Parameters:
iPhi CMSSW phi index (numbering 1...72)
Returns:
index in numbering 0...71

Definition at line 158 of file EcalSelectiveReadoutSuppressor.h.

Referenced by setTtFlags().

00158                                    {
00159     return iPhi-1;
00160   }

void EcalSelectiveReadoutSuppressor::printTTFlags ( std::ostream &  os,
int  iEvent = -1,
bool  withHeader = true 
) const

Writes out TT flags.

On of the 'run' method must be called beforehand. Beware this method might be removed in future.

Parameters:
os stream to write to
iEvent event index. Ignored if <0.
withHeader. If true writes out a header with the legend.

void EcalSelectiveReadoutSuppressor::run ( const edm::EventSetup eventSetup,
const EcalTrigPrimDigiCollection trigPrims,
const EBDigiCollection barrelDigis,
const EEDigiCollection endcapDigis,
EBDigiCollection selectedBarrelDigis,
EEDigiCollection selectedEndcapDigis,
EBSrFlagCollection ebSrFlags,
EESrFlagCollection eeSrFlags 
)

Runs the selective readout (SR) algorithm.

Parameters:
eventSetup event conditions
trigPrims the ECAL trigger primitives used as input to the SR.
barrelDigis the input EB digi collection
endcapDigis the input EE digi collection
selectedBarrelDigis [out] the EB digi passing the SR
selectedEndcapDigis [out] the EE digi passing the SR
ebSrFlags [out] the computed SR flags for EB
eeSrFlags [out] the computed SR flags for EE

Definition at line 228 of file EcalSelectiveReadoutSuppressor.cc.

References accept(), BARREL, edm::DataFrameContainer::begin(), GenMuonPlsPt100GeV_cfg::cout, EcalBarrel, ecalSelectiveReadout, edm::DataFrameContainer::end(), ENDCAP, Exception, EcalSelectiveReadout::FORCED_RO, id, nBarrelTriggerTowersInEta, nTriggerTowersInPhi, edm::DataFrameContainer::push_back(), edm::SortedCollection< T, SORT >::push_back(), edm::SortedCollection< T, SORT >::reserve(), edm::DataFrameContainer::reserve(), setTtFlags(), edm::DataFrameContainer::size(), EcalSrFlag::SRF_FORCED_MASK, EcalSrFlag::SRF_FULL, srFlags, trigPrimBypass_, ttFlags, EcalScDetId::validDetId(), and zsThreshold.

00235                                                                   {
00236   if(!trigPrimBypass_){//normal mode
00237     setTtFlags(trigPrims);
00238   } else{//debug mode, run w/o TP digis
00239     setTtFlags(eventSetup, barrelDigis, endcapDigis);
00240   }
00241 
00242   ecalSelectiveReadout->runSelectiveReadout0(ttFlags);  
00243   
00244   selectedBarrelDigis.reserve(barrelDigis.size()/20);
00245   selectedEndcapDigis.reserve(endcapDigis.size()/20);
00246 
00247   // do barrel first
00248   for(EBDigiCollection::const_iterator digiItr = barrelDigis.begin();
00249       digiItr != barrelDigis.end(); ++digiItr){
00250     int interestLevel
00251       = ecalSelectiveReadout->getCrystalInterest(EBDigiCollection::DetId(digiItr->id()));
00252     if(accept(*digiItr, zsThreshold[BARREL][interestLevel])){
00253       selectedBarrelDigis.push_back(digiItr->id(), digiItr->begin());
00254     } 
00255   }
00256   
00257   // and endcaps
00258   for(EEDigiCollection::const_iterator digiItr = endcapDigis.begin();
00259       digiItr != endcapDigis.end(); ++digiItr){
00260     int interestLevel = ecalSelectiveReadout->getCrystalInterest(EEDigiCollection::DetId(digiItr->id()));
00261     if(accept(*digiItr, zsThreshold[ENDCAP][interestLevel])){
00262       selectedEndcapDigis.push_back(digiItr->id(), digiItr->begin());
00263     }
00264   }
00265   
00266   ebSrFlags.reserve(34*72);
00267   eeSrFlags.reserve(624);
00268   //SR flags:
00269   for(int iZ = -1; iZ <=1; iZ+=2){ //-1=>EE-, EB-, +1=>EE+, EB+
00270     //barrel:
00271     for(unsigned iEta = 1; iEta <= nBarrelTriggerTowersInEta/2; ++iEta){
00272       for(unsigned iPhi = 1; iPhi <= nTriggerTowersInPhi; ++iPhi){
00273         const EcalTrigTowerDetId id(iZ, EcalBarrel, iEta, iPhi);
00274         EcalSelectiveReadout::towerInterest_t interest
00275           = ecalSelectiveReadout->getTowerInterest(id);
00276         if(interest<0){
00277           throw cms::Exception("EcalSelectiveReadout")
00278             << __FILE__ << ":" << __LINE__ << ": " << "unknown SR flag. for "
00279             << " TT " << id << ". Most probably a bug.";
00280         }
00281         int flag;
00282         if(interest==EcalSelectiveReadout::FORCED_RO){
00283           flag = EcalSrFlag::SRF_FORCED_MASK | EcalSrFlag::SRF_FULL;
00284         } else{
00285           flag = srFlags[BARREL][interest];
00286         }
00287         ebSrFlags.push_back(EBSrFlag(id, flag));
00288       }//next iPhi
00289     } //next barrel iEta
00290 
00291     //endcap:
00292     EcalScDetId id;
00293     for(int iX = 1; iX <= 20; ++iX){
00294       for(int iY = 1; iY <= 20; ++iY){
00295         if (EcalScDetId::validDetId(iX, iY, iZ))
00296           id = EcalScDetId(iX, iY, iZ);
00297         else
00298           continue;
00299         
00300         EcalSelectiveReadout::towerInterest_t interest
00301           = ecalSelectiveReadout->getSuperCrystalInterest(id);
00302         if(interest>=0){//negative no SC at (iX,iY) coordinates
00303           int flag;
00304           if(interest==EcalSelectiveReadout::FORCED_RO){
00305             flag = EcalSrFlag::SRF_FORCED_MASK | EcalSrFlag::SRF_FULL;
00306           } else{
00307             flag = srFlags[BARREL][interest];
00308           }
00309           eeSrFlags.push_back(EESrFlag(id, flag));
00310         } else{
00311           cout << __FILE__ << ":" << __LINE__ << ": "
00312                <<  "negative interest in EE for SC "
00313                << id << "\n";
00314         }
00315       } //next iY
00316     } //next iX
00317   }
00318 }

void EcalSelectiveReadoutSuppressor::run ( const edm::EventSetup eventSetup,
const EcalTrigPrimDigiCollection trigPrims,
EBDigiCollection barrelDigis,
EEDigiCollection endcapDigis 
)

Runs the selective readout(SR) algorithm.

Deprecated:
use the other run methode instead
Parameters:
eventSetup event conditions
trigPrims the ECAL trigger primitives used as input to the SR.
barrelDigis [in,out] the EB digi collection to filter
endcapDigis [in,out] the EE digi collection to filter

Definition at line 209 of file EcalSelectiveReadoutSuppressor.cc.

References EBDigiCollection::swap(), and EEDigiCollection::swap().

00212                                                                         {
00213   EBDigiCollection selectedBarrelDigis;
00214   EEDigiCollection selectedEndcapDigis;
00215   EBSrFlagCollection ebSrFlags;
00216   EESrFlagCollection eeSrFlags;
00217   
00218   run(eventSetup, trigPrims, barrelDigis, endcapDigis,
00219       selectedBarrelDigis, selectedEndcapDigis, ebSrFlags, eeSrFlags);
00220   
00221 //replaces the input with the suppressed version
00222   barrelDigis.swap(selectedBarrelDigis);
00223   endcapDigis.swap(selectedEndcapDigis);  
00224 }

void EcalSelectiveReadoutSuppressor::setGeometry ( const CaloGeometry caloGeometry  ) 

Sets the geometry of the calorimeters.

Definition at line 69 of file EcalSelectiveReadoutSuppressor.cc.

References ecalSelectiveReadout.

00070 {
00071 #ifndef ECALSELECTIVEREADOUT_NOGEOM
00072    ecalSelectiveReadout->setGeometry(caloGeometry);
00073 #endif
00074 }

void EcalSelectiveReadoutSuppressor::setTriggerMap ( const EcalTrigTowerConstituentsMap map  ) 

Set the mapping of which cell goes with which trigger tower.

Parameters:
map the trigger tower map

Definition at line 63 of file EcalSelectiveReadoutSuppressor.cc.

References ecalSelectiveReadout, and theTriggerMap.

00063                                                                                           {
00064   theTriggerMap = map;
00065   ecalSelectiveReadout->setTriggerMap(map);
00066 }

void EcalSelectiveReadoutSuppressor::setTtFlags ( const EcalTrigPrimDigiCollection trigPrims  )  [private]

Help function to set the srFlags field.

Parameters:
trigPrim the trigger primitive digi collection

Definition at line 321 of file EcalSelectiveReadoutSuppressor.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), nTriggerTowersInEta, nTriggerTowersInPhi, EcalSelectiveReadout::TTF_FORCED_RO_OTHER1, and ttFlags.

00321                                                                                            {
00322   for(size_t iEta0 = 0; iEta0 < nTriggerTowersInEta; ++iEta0){
00323     for(size_t iPhi0 = 0; iPhi0 < nTriggerTowersInPhi; ++iPhi0){
00324       ttFlags[iEta0][iPhi0] = EcalSelectiveReadout::TTF_FORCED_RO_OTHER1;
00325     }
00326   }
00327   for(EcalTrigPrimDigiCollection::const_iterator trigPrim = trigPrims.begin();
00328       trigPrim != trigPrims.end(); ++trigPrim){
00329     int iEta =  trigPrim->id().ieta();
00330     unsigned int iEta0;
00331     if(iEta<0){ //z- half ECAL: transforming ranges -28;-1 => 0;27
00332       iEta0 = iEta + nTriggerTowersInEta/2;
00333     } else{ //z+ halfECAL: transforming ranges 1;28 => 28;55
00334       iEta0 = iEta + nTriggerTowersInEta/2 - 1;
00335     }
00336 
00337     unsigned int iPhi0 = trigPrim->id().iphi() - 1;
00338     ttFlags[iEta0][iPhi0] =
00339       (EcalSelectiveReadout::ttFlag_t) trigPrim->ttFlag();
00340   }
00341 }

void EcalSelectiveReadoutSuppressor::setTtFlags ( const edm::EventSetup eventSetup,
const EBDigiCollection ebDigis,
const EEDigiCollection eeDigis 
) [private]

Help function to set the srFlags field.

Used in TrigPrimByPass mode

Parameters:
eventSetup the EDM event setup
ebDigi the ECAL barrel APD digis
eeDigi the ECAL endcap VPT digis

Definition at line 359 of file EcalSelectiveReadoutSuppressor.cc.

References edm::DataFrameContainer::begin(), e, DetId::Ecal, EcalBarrel, EcalEndcap, edm::DataFrameContainer::end(), frame2Energy(), edm::EventSetup::get(), CaloSubdetectorGeometry::getGeometry(), EBDataFrame::id(), EEDataFrame::id(), EcalTrigTowerDetId::ieta(), EcalTrigTowerDetId::iphi(), it, iTTEta2cIndex(), iTTPhi2cIndex(), nTriggerTowersInEta, nTriggerTowersInPhi, funct::sin(), theta, theTriggerMap, EcalTrigTowerConstituentsMap::towerOf(), trigPrimBypassHTH_, trigPrimBypassLTH_, trigPrimBypassWithPeakFinder_, EcalSelectiveReadout::TTF_HIGH_INTEREST, EcalSelectiveReadout::TTF_LOW_INTEREST, EcalSelectiveReadout::TTF_MID_INTEREST, and ttFlags.

Referenced by run().

00361                                                                            {
00362   double trigPrim[nTriggerTowersInEta][nTriggerTowersInPhi];
00363 
00364   //ecal geometry:
00365 //  static const CaloSubdetectorGeometry* eeGeometry = 0;
00366 //  static const CaloSubdetectorGeometry* ebGeometry = 0;
00367   const CaloSubdetectorGeometry* eeGeometry = 0;
00368   const CaloSubdetectorGeometry* ebGeometry = 0;
00369 //  if(eeGeometry==0 || ebGeometry==0){
00370     edm::ESHandle<CaloGeometry> geoHandle;
00371     es.get<CaloGeometryRecord>().get(geoHandle);
00372     eeGeometry
00373       = (*geoHandle).getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
00374     ebGeometry
00375       = (*geoHandle).getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
00376 //  }
00377 
00378   //init trigPrim array:
00379   bzero(trigPrim, sizeof(trigPrim));
00380         
00381   for(EBDigiCollection::const_iterator it = ebDigis.begin();
00382       it != ebDigis.end(); ++it){
00383     EBDataFrame frame(*it);
00384     const EcalTrigTowerDetId& ttId = theTriggerMap->towerOf(frame.id());
00385 //      edm:::LogDebug("TT") << __FILE__ << ":" << __LINE__ << ": "//    <<  ((EBDetId&)frame.id()).ieta()
00386 //       << "," << ((EBDetId&)frame.id()).iphi()
00387 //       << " -> " << ttId.ieta() << "," << ttId.iphi() << "\n";
00388     const int iTTEta0 = iTTEta2cIndex(ttId.ieta());
00389     const int iTTPhi0 = iTTPhi2cIndex(ttId.iphi());
00390     double theta = ebGeometry->getGeometry(frame.id())->getPosition().theta();
00391     double e = frame2Energy(frame);
00392     if(!trigPrimBypassWithPeakFinder_
00393        || ((frame2Energy(frame,-1) < e) && (frame2Energy(frame, 1) < e))){
00394       trigPrim[iTTEta0][iTTPhi0] += e*sin(theta);
00395     }
00396   }
00397 
00398   for(EEDigiCollection::const_iterator it = eeDigis.begin();
00399       it != eeDigis.end(); ++it){
00400     EEDataFrame frame(*it);
00401     const EcalTrigTowerDetId& ttId = theTriggerMap->towerOf(frame.id());
00402     const int iTTEta0 = iTTEta2cIndex(ttId.ieta());
00403     const int iTTPhi0 = iTTPhi2cIndex(ttId.iphi());
00404 //     cout << __FILE__ << ":" << __LINE__ << ": EE xtal->TT "
00405 //       <<  ((EEDetId&)frame.id()).ix()
00406 //       << "," << ((EEDetId&)frame.id()).iy()
00407 //       << " -> " << ttId.ieta() << "," << ttId.iphi() << "\n";
00408     double theta = eeGeometry->getGeometry(frame.id())->getPosition().theta();
00409     double e = frame2Energy(frame);
00410     if(!trigPrimBypassWithPeakFinder_
00411        || ((frame2Energy(frame,-1) < e) && (frame2Energy(frame, 1) < e))){
00412       trigPrim[iTTEta0][iTTPhi0] += e*sin(theta);
00413     }
00414   }
00415 
00416   //dealing with pseudo-TT in two inner EE eta-ring:
00417   int innerTTEtas[] = {0, 1, 54, 55};
00418   for(unsigned iRing = 0; iRing < sizeof(innerTTEtas)/sizeof(innerTTEtas[0]);
00419       ++iRing){
00420     int iTTEta0 = innerTTEtas[iRing];
00421     //this detector eta-section is divided in only 36 phi bins
00422     //For this eta regions,
00423     //current tower eta numbering scheme is inconsistent. For geometry
00424     //version 133:
00425     //- TT are numbered from 0 to 72 for 36 bins
00426     //- some TT have an even index, some an odd index
00427     //For geometry version 125, there are 72 phi bins.
00428     //The code below should handle both geometry definition.
00429     //If there are 72 input trigger primitives for each inner eta-ring,
00430     //then the average of the trigger primitive of the two pseudo-TT of
00431     //a pair (nEta, nEta+1) is taken as Et of both pseudo TTs.
00432     //If there are only 36 input TTs for each inner eta ring, then half
00433     //of the present primitive of a pseudo TT pair is used as Et of both
00434     //pseudo TTs.
00435 
00436     for(unsigned iTTPhi0 = 0; iTTPhi0 < nTriggerTowersInPhi-1; iTTPhi0 += 2){
00437       double et = .5*(trigPrim[iTTEta0][iTTPhi0]
00438                       +trigPrim[iTTEta0][iTTPhi0+1]);
00439       //divides the TT into 2 phi bins in order to match with 72 phi-bins SRP
00440       //scheme or average the Et on the two pseudo TTs if the TT is already
00441       //divided into two trigger primitives.
00442       trigPrim[iTTEta0][iTTPhi0] = et;
00443       trigPrim[iTTEta0][iTTPhi0+1] = et;
00444     }
00445   }
00446     
00447   for(unsigned iTTEta0 = 0; iTTEta0 < nTriggerTowersInEta; ++iTTEta0){
00448     for(unsigned iTTPhi0 = 0; iTTPhi0 < nTriggerTowersInPhi; ++iTTPhi0){
00449       if(trigPrim[iTTEta0][iTTPhi0] > trigPrimBypassHTH_){
00450         ttFlags[iTTEta0][iTTPhi0] = EcalSelectiveReadout::TTF_HIGH_INTEREST;
00451       } else if(trigPrim[iTTEta0][iTTPhi0] > trigPrimBypassLTH_){
00452         ttFlags[iTTEta0][iTTPhi0] = EcalSelectiveReadout::TTF_MID_INTEREST;
00453       } else{
00454         ttFlags[iTTEta0][iTTPhi0] = EcalSelectiveReadout::TTF_LOW_INTEREST;
00455       }
00456       
00457       // cout /*LogDebug("TT")*/
00458       //        << "ttFlags[" << iTTEta0 << "][" << iTTPhi0 << "] = "
00459       //        << ttFlags[iTTEta0][iTTPhi0] << "\n";
00460     }
00461   }
00462 }
00463 

int EcalSelectiveReadoutSuppressor::thr2Srf ( int  thr,
int  zsFlag 
) const [private]

Help function to get SR flag from ZS threshold using min/max convention for SUPPRESS and FULL_READOUT: see zsThreshold.

Parameters:
thr ZS threshold in thrUnit
flag for Zero suppression: EcalSrFlag::SRF_ZS1 or EcalSrFlag::SRF_ZS2
Returns:
the SR flag

Definition at line 123 of file EcalSelectiveReadoutSuppressor.cc.

References max, min, EcalSrFlag::SRF_FULL, and EcalSrFlag::SRF_SUPPRESS.

Referenced by initCellThresholds().

00123                                                                     {
00124   if(thr==numeric_limits<int>::max()){
00125     return EcalSrFlag::SRF_SUPPRESS;
00126   }
00127   if(thr==numeric_limits<int>::min()){
00128     return EcalSrFlag::SRF_FULL;
00129   } 
00130   return zsFlag;
00131 }


Member Data Documentation

std::auto_ptr<EcalSelectiveReadout> EcalSelectiveReadoutSuppressor::ecalSelectiveReadout [private]

Help class to comput selective readout flags.

Definition at line 213 of file EcalSelectiveReadoutSuppressor.h.

Referenced by EcalSelectiveReadoutSuppressor(), getEcalSelectiveReadout(), run(), setGeometry(), and setTriggerMap().

int EcalSelectiveReadoutSuppressor::firstFIRSample [private]

Time position of the first sample to use in zero suppession FIR filter.

Numbering starts at 0.

Definition at line 224 of file EcalSelectiveReadoutSuppressor.h.

Referenced by accept().

std::vector<int> EcalSelectiveReadoutSuppressor::firWeights [private]

Weights of zero suppression FIR filter.

Definition at line 228 of file EcalSelectiveReadoutSuppressor.h.

Referenced by getFIRWeigths().

const size_t EcalSelectiveReadoutSuppressor::nBarrelTriggerTowersInEta = 34 [static, private]

Number of eta trigger tower divisions in the barrel.

Definition at line 199 of file EcalSelectiveReadoutSuppressor.h.

Referenced by run().

const size_t EcalSelectiveReadoutSuppressor::nEndcaps = 2 [static, private]

Number of endcap, obviously two.

Definition at line 191 of file EcalSelectiveReadoutSuppressor.h.

const size_t EcalSelectiveReadoutSuppressor::nEndcapTriggerTowersInEta = 11 [static, private]

Number of eta trigger tower divisions in one endcap.

Definition at line 195 of file EcalSelectiveReadoutSuppressor.h.

const int EcalSelectiveReadoutSuppressor::nFIRTaps = 6 [static, private]

Depth of DCC zero suppression FIR filter (number of taps), in principal 6.

Definition at line 233 of file EcalSelectiveReadoutSuppressor.h.

Referenced by accept(), getFIRTapCount(), and getFIRWeigths().

const size_t EcalSelectiveReadoutSuppressor::nTriggerTowersInEta = 2*nEndcapTriggerTowersInEta+nBarrelTriggerTowersInEta [static, private]

Number of eta divisions in trigger towers for the whole ECAL.

Definition at line 204 of file EcalSelectiveReadoutSuppressor.h.

Referenced by setTtFlags().

const size_t EcalSelectiveReadoutSuppressor::nTriggerTowersInPhi = 72 [static, private]

Number of phi divisions in trigger towers.

Definition at line 208 of file EcalSelectiveReadoutSuppressor.h.

Referenced by run(), and setTtFlags().

int EcalSelectiveReadoutSuppressor::srFlags[2][4] [private]

Maps RU interest flag (low interest, single neighbour, center) to Selective readout action flag (type of readout).

1st index: 0 for barrel, 1 for endcap 2nd index: RU interest (low, single, neighbour, center)

Definition at line 281 of file EcalSelectiveReadoutSuppressor.h.

Referenced by initCellThresholds(), and run().

bool EcalSelectiveReadoutSuppressor::symetricZS [private]

Flag to use a symetric zero suppression (cut on absolute value).

Definition at line 241 of file EcalSelectiveReadoutSuppressor.h.

Referenced by accept().

const EcalTrigTowerConstituentsMap* EcalSelectiveReadoutSuppressor::theTriggerMap [private]

Definition at line 215 of file EcalSelectiveReadoutSuppressor.h.

Referenced by setTriggerMap(), and setTtFlags().

double EcalSelectiveReadoutSuppressor::thrUnit[2] [private]

Internal unit for Zero Suppression threshold (1/4th ADC count) used by the FIR.

Index: 0 for barrel, 1 for endcap

Definition at line 255 of file EcalSelectiveReadoutSuppressor.h.

Referenced by EcalSelectiveReadoutSuppressor(), and internalThreshold().

bool EcalSelectiveReadoutSuppressor::trigPrimBypass_ [private]

Switch for trigger primitive simulation module bypass debug mode.

Definition at line 259 of file EcalSelectiveReadoutSuppressor.h.

Referenced by EcalSelectiveReadoutSuppressor(), and run().

double EcalSelectiveReadoutSuppressor::trigPrimBypassHTH_ [private]

Low TT Et threshold for trigger primitive simulation module bypass debug mode.

Definition at line 274 of file EcalSelectiveReadoutSuppressor.h.

Referenced by EcalSelectiveReadoutSuppressor(), and setTtFlags().

double EcalSelectiveReadoutSuppressor::trigPrimBypassLTH_ [private]

Low TT Et threshold for trigger primitive simulation module bypass debug mode.

Definition at line 269 of file EcalSelectiveReadoutSuppressor.h.

Referenced by EcalSelectiveReadoutSuppressor(), and setTtFlags().

bool EcalSelectiveReadoutSuppressor::trigPrimBypassWithPeakFinder_ [private]

When in trigger primitive simulation module bypass debug mode, switch to enable Peak finder effect simulation.

Definition at line 264 of file EcalSelectiveReadoutSuppressor.h.

Referenced by EcalSelectiveReadoutSuppressor(), and setTtFlags().

EcalSelectiveReadout::ttFlag_t EcalSelectiveReadoutSuppressor::ttFlags[nTriggerTowersInEta][nTriggerTowersInPhi] [private]

Trigger tower flags: see setTtFlags().

Definition at line 219 of file EcalSelectiveReadoutSuppressor.h.

Referenced by run(), and setTtFlags().

std::vector<double> EcalSelectiveReadoutSuppressor::weights [private]

DCC zero suppression FIR filter uncalibrated normalized weigths.

Definition at line 237 of file EcalSelectiveReadoutSuppressor.h.

Referenced by frame2Energy(), and getFIRWeigths().

int EcalSelectiveReadoutSuppressor::zsThreshold[2][4] [private]

Zero suppresion threshold for the ECAL expressed in ebThrUnit and eeThrUnit.

Set to numeric_limits<int>::min() for FULL READOUT and to numeric_limits<int>::max() for SUPPRESS. First index: 0 for barrel, 1 for endcap 2nd index: channel interest (see EcalSelectiveReadout::towerInterest_t

Definition at line 249 of file EcalSelectiveReadoutSuppressor.h.

Referenced by initCellThresholds(), and run().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:19:52 2009 for CMSSW by  doxygen 1.5.4