Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:30:32

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   // For testing use 1:1 LUT
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,                       // eGammaLSB
0025             1.0,                       // jetMETLSB
0026             3.0,                       // eMinForFGCut
0027             40.0,                      // eMaxForFGCut
0028             0.5,                       // hOeCut
0029             1.0,                       // eMinForHoECut
0030             50.0,                      // eMaxForHoECut
0031             1.0,                       // hMinForHoECut
0032             2.0,                       // eActivityCut
0033             3.0,                       // hActivityCut
0034             3,                         // eicIsolationThreshold
0035                         3,                         // jscQuietThresholdBarrel
0036                         3,                         // jscQuietThresholdEndcap
0037             false,                     // noiseVetoHB
0038             false,                     // noiseVetoHEplus
0039             false,                     // noiseVetoHEminus
0040             false,                     // use Lindsey
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);  // transcoder and etScale are not used
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   //Now we pull in the data from the crate.input file
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 }