File indexing completed on 2024-04-06 12:21:37
0001 #include <iostream>
0002 #include <fstream>
0003 #include <vector>
0004 #include <string>
0005 #include "L1Trigger/RegionalCaloTrigger/interface/L1RCT.h"
0006 #include "L1Trigger/RegionalCaloTrigger/interface/L1RCTORCAMap.h"
0007 #include "L1Trigger/RegionalCaloTrigger/interface/L1RCTLookupTables.h"
0008 #include "CondFormats/L1TObjects/interface/L1RCTParameters.h"
0009
0010 using std::vector;
0011 using std::fstream;
0012 using std::cout;
0013 using std::endl;
0014 using std::ios;
0015
0016 int main (){
0017
0018 std::vector<double> eGammaECalScaleFactors(32, 1.0);
0019 std::vector<double> eGammaHCalScaleFactors(32, 1.0);
0020 std::vector<double> jetMETECalScaleFactors(32, 1.0);
0021 std::vector<double> jetMETHCalScaleFactors(32, 1.0);
0022 std::vector<double> c,d,e,f,g,h;
0023 L1RCTParameters* rctParameters =
0024 new L1RCTParameters(1.0,
0025 1.0,
0026 3.0,
0027 40.0,
0028 0.5,
0029 1.0,
0030 50.0,
0031 1.0,
0032 2.0,
0033 3.0,
0034 3,
0035 3,
0036 3,
0037 false,
0038 false,
0039 false,
0040 false,
0041 eGammaECalScaleFactors,
0042 eGammaHCalScaleFactors,
0043 jetMETECalScaleFactors,
0044 jetMETHCalScaleFactors,
0045 c,
0046 d,
0047 e,
0048 f,
0049 g,
0050 h
0051 );
0052 L1RCTLookupTables* lut = new L1RCTLookupTables();
0053 lut->setRCTParameters(rctParameters);
0054 L1RCT rct(lut);
0055 std::vector<int> data(4);
0056 std::vector<int> location(3);
0057 unsigned long lookupValue;
0058 std::vector<std::vector<unsigned short> > hf(18,std::vector<unsigned short>(8));
0059 std::vector<std::vector<std::vector<unsigned short> > > barrel(18,std::vector<std::vector<unsigned short> >(7,
0060 std::vector<unsigned short>(64)));
0061
0062 char throwaway[2000];
0063
0064 fstream input("crate.input",std::ios::in);
0065 if ( ! input.is_open() ) return 0;
0066
0067 fstream output("lut.out",std::ios::out);
0068 fstream rctoutput("rct.out",std::ios::out);
0069 input.getline(throwaway,2000);
0070 L1RCTORCAMap theMap;
0071 output << "Eta Phi Ecal Hcal Lookup" << std::endl;
0072 while(!input.eof()){
0073 for(int i=0;i<4;i++){
0074 input >> data.at(i);
0075 output << data.at(i) << " ";
0076 }
0077 location = theMap.orcamap(data.at(0),data.at(1));
0078 barrel.at(location.at(0)).at(location.at(1)).at(location.at(2)) = data.at(2);
0079 barrel.at(location.at(0)).at(location.at(1)).at(location.at(2)+32) = data.at(3);
0080 lookupValue = lut->lookup(data.at(2)&255,data.at(3)&255,(data.at(2)<<8)&1,
0081 location.at(0), location.at(1), location.at(2));
0082 output << lookupValue << std::endl;
0083 }
0084 rct.input(barrel,hf);
0085 rct.processEvent();
0086 input.close();
0087 output.close();
0088 rct.printCrate(0);
0089 }