CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DataFormats/SiPixelDigi/src/PixelDigi.cc

Go to the documentation of this file.
00001 // Modify the pixel packing to make 100micron pixels possible. d.k. 2/02
00002 //
00003 #include "DataFormats/SiPixelDigi/interface/PixelDigi.h"
00004 
00005 #include <algorithm>
00006 
00007 void PixelDigi::init( int row, int col, int adc) {
00008   // This check is for the maximal row or col number that can be packed
00009   // in a PixelDigi. The actual number of rows or columns in a detector
00010   // may be smaller!
00011   if ( row < 0 || row > PixelChannelIdentifier::thePacking.max_row || 
00012        col < 0 || col > PixelChannelIdentifier::thePacking.max_column) {
00013     std::cout << "PixelDigi constructor: row or column out packing range" << std::endl;
00014   }
00015 
00016   // Set adc to max_adc in case of overflow
00017   adc = (adc > PixelChannelIdentifier::thePacking.max_adc) ? PixelChannelIdentifier::thePacking.max_adc : std::max(adc,0);
00018 
00019   theData = (row << PixelChannelIdentifier::thePacking.row_shift) | 
00020     (col << PixelChannelIdentifier::thePacking.column_shift) | 
00021     (adc << PixelChannelIdentifier::thePacking.adc_shift);
00022 }
00023