CMS 3D CMS Logo

FakeTBHodoscopeRawInfoProducer.cc
Go to the documentation of this file.
1 /*
2  * \file FakeTBHodoscopeRawInfoProducer.cc
3  *
4  *
5  */
6 
8 
9 using namespace cms;
10 using namespace std;
11 
13  ecalTBInfo_ = consumes<PEcalTBInfo>(edm::InputTag("EcalTBInfoLabel", "SimEcalTBG4Object"));
14  produces<EcalTBHodoscopeRawInfo>();
15 
16  theTBHodoGeom_ = new EcalTBHodoscopeGeometry();
17 }
18 
20 
22  unique_ptr<EcalTBHodoscopeRawInfo> product(new EcalTBHodoscopeRawInfo());
23 
24  // get the vertex information from the event
25 
26  edm::Handle<PEcalTBInfo> theEcalTBInfo;
27  event.getByToken(ecalTBInfo_, theEcalTBInfo);
28 
29  double partXhodo = theEcalTBInfo->evXbeam();
30  double partYhodo = theEcalTBInfo->evYbeam();
31 
32  LogDebug("EcalTBHodo") << "TB frame vertex (X,Y) for hodoscope simulation: \n"
33  << "x = " << partXhodo << " y = " << partYhodo;
34 
35  // for each hodoscope plane determine the fibre number corresponding
36  // to the event vertex coordinates in the TB reference frame
37  // plane 0/2 = x plane 1/3 = y
38 
39  int nPlanes = (int)theTBHodoGeom_->getNPlanes();
40  product->setPlanes(nPlanes);
41 
42  for (int iPlane = 0; iPlane < nPlanes; ++iPlane) {
43  float theCoord = (float)partXhodo;
44  if (iPlane == 1 || iPlane == 3)
45  theCoord = (float)partYhodo;
46 
47  vector<int> firedChannels = theTBHodoGeom_->getFiredFibresInPlane(theCoord, iPlane);
48  unsigned int nChannels = firedChannels.size();
49 
50  EcalTBHodoscopePlaneRawHits planeHit(nChannels);
51  for (unsigned int i = 0; i < nChannels; ++i) {
52  planeHit.addHit(firedChannels[i]);
53  }
54 
55  product->setPlane((unsigned int)iPlane, planeHit);
56  }
57 
58  LogDebug("EcalTBHodo") << (*product);
59 
60  event.put(std::move(product));
61 }
#define LogDebug(id)
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
Produce digis out of raw data.
double evXbeam() const
Definition: PEcalTBInfo.h:34
Namespace of DDCMS conversion namespace.
~FakeTBHodoscopeRawInfoProducer() override
Destructor.
double evYbeam() const
Definition: PEcalTBInfo.h:35
FakeTBHodoscopeRawInfoProducer(const edm::ParameterSet &ps)
Constructor.
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1