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 
14  ecalTBInfo_ = consumes<PEcalTBInfo>(edm::InputTag("EcalTBInfoLabel","SimEcalTBG4Object"));
15  produces<EcalTBHodoscopeRawInfo>();
16 
17  theTBHodoGeom_ = new EcalTBHodoscopeGeometry();
18 }
19 
21 
22  delete theTBHodoGeom_;
23 
24 }
25 
27 {
28  unique_ptr<EcalTBHodoscopeRawInfo> product(new EcalTBHodoscopeRawInfo());
29 
30  // get the vertex information from the event
31 
32  edm::Handle<PEcalTBInfo> theEcalTBInfo;
33  event.getByToken(ecalTBInfo_,theEcalTBInfo);
34 
35  double partXhodo = theEcalTBInfo->evXbeam();
36  double partYhodo = theEcalTBInfo->evYbeam();
37 
38  LogDebug("EcalTBHodo") << "TB frame vertex (X,Y) for hodoscope simulation: \n"
39  << "x = " << partXhodo << " y = " << partYhodo;
40 
41  // for each hodoscope plane determine the fibre number corresponding
42  // to the event vertex coordinates in the TB reference frame
43  // plane 0/2 = x plane 1/3 = y
44 
45  int nPlanes = (int)theTBHodoGeom_->getNPlanes();
46  product->setPlanes(nPlanes);
47 
48  for ( int iPlane = 0 ; iPlane < nPlanes ; ++iPlane) {
49 
50  float theCoord = (float)partXhodo;
51  if (iPlane == 1 || iPlane == 3) theCoord = (float)partYhodo;
52 
53  vector<int> firedChannels = theTBHodoGeom_->getFiredFibresInPlane(theCoord, iPlane);
54  unsigned int nChannels = firedChannels.size();
55 
56  EcalTBHodoscopePlaneRawHits planeHit(nChannels);
57  for ( unsigned int i = 0 ; i < nChannels ; ++i ) {
58  planeHit.addHit(firedChannels[i]);
59  }
60 
61  product->setPlane((unsigned int)iPlane, planeHit);
62 
63  }
64 
65  LogDebug("EcalTBHodo") << (*product);
66 
67  event.put(std::move(product));
68 
69 }
#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:35
double evYbeam() const
Definition: PEcalTBInfo.h:36
FakeTBHodoscopeRawInfoProducer(const edm::ParameterSet &ps)
Constructor.
def move(src, dest)
Definition: eostools.py:510
Definition: event.py:1