CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/L1Trigger/RPCTechnicalTrigger/src/RPCWheelMap.cc

Go to the documentation of this file.
00001 // $Id: RPCWheelMap.cc,v 1.7 2009/06/07 21:18:51 aosorio Exp $
00002 // Include files 
00003 
00004 
00005 
00006 // local
00007 #include "L1Trigger/RPCTechnicalTrigger/interface/RPCWheelMap.h"
00008 #include <string>
00009 #include <iostream>
00010 //-----------------------------------------------------------------------------
00011 // Implementation file for class : RPCWheelMap
00012 //
00013 // 2008-11-24 : Andres Felipe Osorio Oliveros
00014 //-----------------------------------------------------------------------------
00015 
00016 //=============================================================================
00017 // Standard constructor, initializes variables
00018 //=============================================================================
00019 RPCWheelMap::RPCWheelMap( int wheelid ) {
00020   
00021   m_maxBx = 7;
00022   m_maxBxWindow = 3; //... considering that we have a bxing in the range [-3,+3]
00023   m_maxSectors = 12;
00024   
00025   int maxMaps = m_maxBx * m_maxSectors;
00026   
00027   m_wheelid    = wheelid;
00028   m_wheelMap   = new std::bitset<6>[m_maxSectors];
00029   m_wheelMapBx = new std::bitset<6>[m_maxSectors * m_maxBx];
00030   m_ttuinVec   = new TTUInput[m_maxBx];
00031     
00032   for(int i=0; i < m_maxSectors; ++i)
00033     m_wheelMap[i].reset();
00034   
00035   for(int i=0; i < maxMaps; ++i)
00036     m_wheelMapBx[i].reset();
00037   
00038   m_debug = false;
00039   
00040 }
00041 //=============================================================================
00042 // Destructor
00043 //=============================================================================
00044 RPCWheelMap::~RPCWheelMap() {
00045   
00046   if ( m_wheelMap )   delete[] m_wheelMap;
00047   if ( m_wheelMapBx ) delete[] m_wheelMapBx;
00048   if ( m_ttuinVec )   delete[] m_ttuinVec;
00049   
00050 } 
00051 
00052 //=============================================================================
00053 void RPCWheelMap::addHit( int bx, int sec, int layer)
00054 {
00055   
00056   // |--12--|--12--|--12--|--12--|--12--|--12--|--12--| (12 sectors x 6 layers x  7 bx)
00057   // 0.....11
00058   int indx1 = bx + m_maxBxWindow;
00059   int indx2 = sec + indx1*m_maxSectors;
00060   m_wheelMapBx[ indx2 ].set( layer-1, 1);
00061   
00062 }
00063 
00064 void RPCWheelMap::prepareData()
00065 {
00066   
00067   bool anyHits(false);
00068   
00069   for(int bx=0; bx < m_maxBx; ++bx) {
00070   
00071     anyHits = false;
00072       
00073     for(int i=0; i < m_maxSectors; ++i) {
00074       
00075       int indx = i + bx*m_maxSectors;
00076       
00077       m_ttuinVec[bx].m_bx = ( bx - m_maxBxWindow );
00078       m_wheelMap[i] = m_wheelMapBx[ indx ];
00079       m_ttuinVec[bx].input_sec[i] = m_wheelMap[i]; 
00080     
00081       anyHits |= m_wheelMap[i].any();
00082       
00083       if( m_debug ) {
00084         std::string test;
00085         test = m_wheelMap[i].to_string<char,std::char_traits<char>,std::allocator<char> >();
00086         std::cout << "prepareData> sec: " << i << " " << test << " anyHits " << anyHits << std::endl;
00087       }
00088       
00089     }
00090     
00091     m_ttuinVec[bx].m_hasHits = anyHits;
00092     
00093   }
00094   
00095   if( m_debug ) std::cout << "prepareData> done." << '\n';
00096   
00097 }
00098 
00099