CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/L1Trigger/RegionalCaloTrigger/interface/L1RCT.h

Go to the documentation of this file.
00001 #ifndef L1RCT_h
00002 #define L1RCT_h
00003 
00004 #include <vector>
00005 #include <bitset>
00006 #include <iostream>
00007 #include <iomanip>
00008 #include <string>
00009 
00010 #include "L1Trigger/RegionalCaloTrigger/interface/L1RCTCrate.h"
00011 #include "L1Trigger/RegionalCaloTrigger/interface/L1RCTNeighborMap.h"
00012 
00013 #include "DataFormats/L1CaloTrigger/interface/L1CaloRegion.h"
00014 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
00015 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00016 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00017 
00018 class L1RCTLookupTables;
00019 
00020 class L1RCT {
00021 
00022  public:
00023   
00024   L1RCT(const L1RCTLookupTables* rctLookupTables);
00025 
00026   //Organize input for consumption by the cards
00027   void input();
00028 
00029   //For testing accept external input
00030   void input(std::vector<std::vector<std::vector<unsigned short> > > barrelIn,
00031              std::vector<std::vector<unsigned short> > hfIn);
00032 
00033   //Should send commands to all crates to send commands to all RCs to
00034   //process the input data and then send it on to the EICs and then
00035   //to the JSCs
00036   void processEvent();
00037 
00038   void fileInput(const char* filename);       // added "const" also in .cc
00039 
00040   void digiInput(const EcalTrigPrimDigiCollection& ecalCollection, 
00041                  const HcalTrigPrimDigiCollection& hcalCollection);
00042   
00043   void randomInput();
00044 
00045   void print();
00046   void printCrate(int i){
00047     crates.at(i).print();
00048   }
00049   void printJSC(int i){
00050     crates.at(i).printJSC();
00051   }
00052   void printJSC(){
00053     for(int i=0;i<18;i++){
00054       std::cout << "JSC for Crate " << i << std::endl;
00055       crates.at(i).printJSC();
00056     }
00057   }
00058   void printRC(int i, int j){
00059     crates.at(i).printRC(j);
00060   }
00061   void printEIC(int i, int j){
00062     crates.at(i).printEIC(j);
00063   }
00064   void printEICEdges(int i, int j){
00065     crates.at(i).printEICEdges(j);
00066   }
00067 
00068   L1CaloEmCollection getIsolatedEGObjects(unsigned crate);
00069 
00070   L1CaloEmCollection getNonisolatedEGObjects(unsigned crate);
00071 
00072   std::vector<unsigned short> getJetRegions(unsigned crate){
00073     return crates.at(crate).getJetRegions();
00074   }
00075 
00076   std::vector<L1CaloRegion> getRegions(unsigned crate);
00077 
00078   unsigned short ecalCompressedET(int crate, int card, int tower)
00079     {return barrel.at(crate).at(card).at(tower) / 2;}
00080   unsigned short ecalFineGrainBit(int crate, int card, int tower)
00081     {return barrel.at(crate).at(card).at(tower) & 1;}
00082   unsigned short hcalCompressedET(int crate, int card, int tower)
00083     {return barrel.at(crate).at(card).at(tower+32) / 2;}
00084   unsigned short hcalFineGrainBit(int crate, int card, int tower)
00085     {return barrel.at(crate).at(card).at(tower+32) & 1;}
00086   unsigned short hfCompressedET(int crate, int tower)
00087     {return hf.at(crate).at(tower) / 2;}
00088   unsigned short hfFineGrainBit(int crate, int tower)
00089     {return hf.at(crate).at(tower) & 1;}
00090 
00091  private:
00092   
00093   L1RCT();  // Do not implement this
00094 
00095   const L1RCTLookupTables* rctLookupTables_;
00096 
00097   //Helper methods called by constructor
00098   //Set all the neighbors properly.
00099   //Will make use of the internal neighborMap
00100   void makeCrates();
00101   void configureCards();
00102   void shareNeighbors();
00103 
00104   L1RCTRegion empty;
00105 
00106   //Helper class containing information to set all the neighbors for
00107   //the receiver cards.  We will use the methods
00108   //north,south,west,east,se,sw,ne,nw,which each take in the
00109   //indices of the region in question and then return the indices
00110   //of the region that is the corresponding neighbor to be used.
00111   L1RCTNeighborMap neighborMap;
00112 
00113   //Vector of all 18 crates.
00114   //Will follow numbering convention listed
00115   //in the CaloTrigger Tower Mapping
00116   //So 0->8 are eta -5 -> 0
00117   //While 9-17 are eta 0 -> 5
00118   //Crate i and crate i+9 are next to each other  
00119   std::vector<L1RCTCrate> crates;
00120 
00121   //Data for processing is organized into the crates and cards
00122   //in two multilayered vectors of vectors.
00123   //The first is of the actual barrel information.
00124   //18 crates -> 7 RCs -> 64 unsigned shorts per RC
00125   //so it should be a std::vector<std::vector<std::vector<unsigned short> > >
00126   //The second is of the HF regions which is just of type
00127   //std::vector<std::vector<unsigned short> >
00128   std::vector<std::vector<std::vector<unsigned short> > > barrel;
00129   std::vector<std::vector<unsigned short> > hf;
00130 
00131 };
00132 
00133 #endif