CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalTBDigiProducer.cc
Go to the documentation of this file.
1 
11 
13  EcalDigiProducer( params )
14 {
15  m_EBdigiFinalTag = params.getParameter<std::string>( "EBdigiFinalCollection" ) ;
16  m_EBdigiTempTag = params.getParameter<std::string>( "EBdigiCollection");
17 
18  produces<EBDigiCollection>( m_EBdigiFinalTag ) ; // after selective readout
19  produces<EcalTBTDCRawInfo>() ;
20 
21  const bool syncPhase ( params.getParameter<bool>("syncPhase") ) ;
22 
23  // possible phase shift for asynchronous trigger (e.g. test-beam)
24 
25  m_doPhaseShift = !syncPhase ;
26  m_thisPhaseShift = 1. ;
27 
28  typedef std::vector< edm::ParameterSet > Parameters;
29  Parameters ranges=params.getParameter<Parameters>( "tdcRanges" ) ;
30  for( Parameters::iterator itRanges = ranges.begin();
31  itRanges != ranges.end(); ++itRanges )
32  {
34  aRange.runRanges.first = itRanges->getParameter<int>("startRun");
35  aRange.runRanges.second = itRanges->getParameter<int>("endRun");
36  aRange.tdcMin = itRanges->getParameter< std::vector<double> >("tdcMin");
37  aRange.tdcMax = itRanges->getParameter< std::vector<double> >("tdcMax");
38  m_tdcRanges.push_back(aRange);
39  }
40 
42  params.getUntrackedParameter< bool >("use2004OffsetConvention",
43  false ) ;
44 
46  params.getUntrackedParameter<std::string>( "EcalTBInfoLabel" ,
47  "SimEcalTBG4Object" ) ;
48 
49  m_doReadout = params.getParameter<bool>( "doReadout" ) ;
50 
51  m_theTBReadout = new EcalTBReadout( m_ecalTBInfoLabel ) ;
52 
53  m_tunePhaseShift = params.getParameter<double>( "tunePhaseShift" ) ;
54 }
55 
57 {
58 }
59 
61  const edm::EventSetup& eventSetup )
62 {
63  std::cout<<"====****Entering EcalTBDigiProducer produce()"<<std::endl ;
64  edm::ESHandle<CaloGeometry> hGeometry ;
65  eventSetup.get<CaloGeometryRecord>().get( hGeometry ) ;
66  const std::vector<DetId>& theBarrelDets (
67  hGeometry->getValidDetIds(DetId::Ecal, EcalBarrel) ) ;
68 
69  m_theTBReadout->setDetIds( theBarrelDets ) ;
70 
71  std::auto_ptr<EcalTBTDCRawInfo> TDCproduct( new EcalTBTDCRawInfo(1) ) ;
72  if( m_doPhaseShift )
73  {
74  edm::Handle<PEcalTBInfo> theEcalTBInfo ;
75  event.getByLabel( m_ecalTBInfoLabel, theEcalTBInfo ) ;
76  m_thisPhaseShift = theEcalTBInfo->phaseShift() ;
77 
78  DetId detId( DetId::Ecal, 1 ) ;
79  setPhaseShift( detId ) ;
80 
81  fillTBTDCRawInfo( *TDCproduct ) ; // fill the TDC info in the event
82  }
83 
84  m_ebDigis = std::auto_ptr<EBDigiCollection> ( new EBDigiCollection ) ;
85 
86  EcalDigiProducer::produce( event, eventSetup ) ;
87 
88  const EBDigiCollection* barrelResult ( &*m_ebDigis ) ;
89 
90  std::auto_ptr<EBDigiCollection> barrelReadout( new EBDigiCollection() ) ;
91  if( m_doReadout )
92  {
94  m_theTTmap,
95  *barrelResult,
96  *barrelReadout ) ;
97  }
98  else
99  {
100  *barrelReadout = *barrelResult ;
101  }
102 
103  std::cout<< "===**** EcalTBDigiProducer: number of barrel digis = "
104  << barrelReadout->size()<<std::endl ;
105 
106  event.put( barrelReadout, m_EBdigiFinalTag ) ;
107  event.put( TDCproduct ) ;
108 
109  m_ebDigis.reset() ; // release memory
110  m_eeDigis.reset() ; // release memory
111 }
112 
113 void
115 {
116  const CaloSimParameters& parameters (
117  EcalDigiProducer::m_ParameterMap->simParameters( detId ) ) ;
118 
119  if ( !parameters.syncPhase() )
120  {
121  const int myDet ( detId.subdetId() ) ;
122 
123  LogDebug("EcalDigi") << "Setting the phase shift "
124  << m_thisPhaseShift
125  << " and the offset "
126  << m_tunePhaseShift
127  << " for the subdetector "
128  << myDet;
129 
130  if( myDet == 1 )
131  {
132  double passPhaseShift ( m_thisPhaseShift + m_tunePhaseShift ) ;
133  if( m_use2004OffsetConvention ) passPhaseShift = 1. - passPhaseShift ;
134  EcalDigiProducer::m_EBResponse->setPhaseShift( passPhaseShift ) ;
135  EcalDigiProducer::m_EEResponse->setPhaseShift( passPhaseShift ) ;
136  }
137  }
138 }
139 
140 void
142 {
143  const unsigned int thisChannel ( 1 ) ;
144 
145  const unsigned int thisCount (
146  (unsigned int)( m_thisPhaseShift*( m_tdcRanges[0].tdcMax[0]
147  - m_tdcRanges[0].tdcMin[0] )
148  + m_tdcRanges[0].tdcMin[0] ) ) ;
149 
150  EcalTBTDCSample theTBTDCSample ( thisChannel, thisCount ) ;
151 
152  const unsigned int sampleIndex ( 0 ) ;
153  theTBTDCRawInfo.setSample( sampleIndex, theTBTDCSample ) ;
154 
155  LogDebug("EcalDigi") << theTBTDCSample << "\n" << theTBTDCRawInfo ;
156 }
157 
158 void
160 {
161  m_ebDigis.reset( new EBDigiCollection ) ;
162  *m_ebDigis = *ebDigiPtr ;
163 }
164 
165 void
167 {
168  std::cout<< "===**** EcalTBDigiProducer: number of endcap digis = "
169  << eeDigiPtr->size()<<std::endl ;
170 }
#define LogDebug(id)
const EcalTrigTowerConstituentsMap m_theTTmap
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::auto_ptr< EBDigiCollection > m_ebDigis
dictionary parameters
Definition: Parameters.py:2
const EcalSimParameterMap * m_ParameterMap
virtual void produce(edm::Event &event, const edm::EventSetup &eventSetup)
std::vector< EcalTBTDCRecInfoAlgo::EcalTBTDCRanges > m_tdcRanges
Main class for Parameters in different subdetectors.
void fillTBTDCRawInfo(EcalTBTDCRawInfo &theTBTDCRawInfo)
virtual void cacheEBDigis(const EBDigiCollection *ebDigiPtr) const
vector< ParameterSet > Parameters
void setPhaseShift(const DetId &detId)
EBHitResponse * m_EBResponse
void setPhaseShift(double phaseShift)
std::string m_EBdigiFinalTag
void performReadout(edm::Event &event, const EcalTrigTowerConstituentsMap &theTTmap, const EBDigiCollection &input, EBDigiCollection &output)
master function to be called once per event
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
string ranges
Definition: diffTwoXMLs.py:78
void setDetIds(const std::vector< DetId > &detIds)
tell the readout which cells exist
Definition: EcalTBReadout.h:28
Definition: DetId.h:20
const T & get() const
Definition: EventSetup.h:55
EcalTBReadout * m_theTBReadout
void setSample(unsigned int i, const EcalTBTDCSample &sam)
std::string m_EBdigiTempTag
virtual void produce(edm::Event &event, const edm::EventSetup &eventSetup)
EcalTBDigiProducer(const edm::ParameterSet &params)
tuple cout
Definition: gather_cfg.py:121
std::auto_ptr< EEDigiCollection > m_eeDigis
std::string m_ecalTBInfoLabel
virtual void cacheEEDigis(const EEDigiCollection *eeDigiPtr) const
EEHitResponse * m_EEResponse
bool syncPhase() const
choice of the ADC time alignment (synchronous for LHC, asynchronous for test beams) ...