Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:33

0001 #include "DataFormats/EcalDetId/interface/ESDetId.h"
0002 #include "DataFormats/EcalDigi/interface/ESDataFrame.h"
0003 #include "SimDataFormats/CaloHit/interface/PCaloHit.h"
0004 #include "SimCalorimetry/CaloSimAlgos/interface/CaloHitResponse.h"
0005 #include "SimCalorimetry/CaloSimAlgos/interface/CaloTDigitizer.h"
0006 #include "SimCalorimetry/EcalSimAlgos/interface/EcalSimParameterMap.h"
0007 #include "SimCalorimetry/EcalSimAlgos/interface/ESShape.h"
0008 #include "SimCalorimetry/EcalSimAlgos/interface/EcalDigitizerTraits.h"
0009 #include "SimCalorimetry/EcalSimAlgos/interface/ESElectronicsSim.h"
0010 #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
0011 #include <vector>
0012 #include <iostream>
0013 #include <iterator>
0014 
0015 int main() {
0016 
0017   // make a silly little hit in each subdetector, which should
0018   // correspond to a 300 keV particle
0019   ESDetId ESDetId(1, 1, 1, 1, 1);
0020   PCaloHit ESHit(ESDetId.rawId(), 0.0003, 0.);
0021 
0022   vector<DetId> ESDetIds;
0023   ESDetIds.push_back(ESDetId);
0024 
0025   vector<PCaloHit> ESHits;
0026   ESHits.push_back(ESHit);
0027 
0028   string ESName = "EcalHitsES";
0029 
0030   edm::EventID id;
0031   CrossingFrame<PCaloHit> crossingFrame(-5, 5, 25, ESName, 1);
0032   crossingFrame.addSignals(&ESHits,id);
0033 
0034   EcalSimParameterMap parameterMap;
0035   ESShape shape(1);
0036 
0037   CaloHitResponse ESResponse(&parameterMap, &shape);
0038 
0039   ESElectronicsSim electronicsSim(true, 3, 1, 1000, 9, 78.47);
0040 
0041   bool addNoise = false;
0042   CaloTDigitizer<ESDigitizerTraits> ESDigitizer(&ESResponse, &electronicsSim, addNoise);
0043   ESDigitizer.setDetIds(ESDetIds);
0044 
0045   unique_ptr<ESDigiCollection> ESResult(new ESDigiCollection);
0046 
0047   MixCollection<PCaloHit> ESHitCollection(&crossingFrame);
0048 
0049   ESDigitizer.run(ESHitCollection, *ESResult);
0050 
0051   // print out all the digis
0052   cout << "ES Frames" << endl;
0053   copy(ESResult->begin(), ESResult->end(), std::ostream_iterator<ESDataFrame>(std::cout, "\n"));
0054 
0055   return 0;
0056 }
0057 
0058