CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
EcalUncalibRecHitWorkerAnalFit Class Reference

#include <EcalUncalibRecHitWorkerAnalFit.h>

Inheritance diagram for EcalUncalibRecHitWorkerAnalFit:
EcalUncalibRecHitWorkerBaseClass

Public Member Functions

 EcalUncalibRecHitWorkerAnalFit (const edm::ParameterSet &ps, edm::ConsumesCollector &c)
 
 EcalUncalibRecHitWorkerAnalFit ()
 
edm::ParameterSetDescription getAlgoDescription ()
 
bool run (const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result)
 
void set (const edm::EventSetup &es)
 
 ~EcalUncalibRecHitWorkerAnalFit ()
 
- Public Member Functions inherited from EcalUncalibRecHitWorkerBaseClass
 EcalUncalibRecHitWorkerBaseClass (const edm::ParameterSet &, edm::ConsumesCollector &c)
 
 EcalUncalibRecHitWorkerBaseClass (const edm::ParameterSet &)
 
 EcalUncalibRecHitWorkerBaseClass ()
 
virtual void set (const edm::Event &evt)
 
virtual ~EcalUncalibRecHitWorkerBaseClass ()
 

Private Attributes

EcalUncalibRecHitRecAnalFitAlgo
< EBDataFrame
algoEB_
 
EcalUncalibRecHitRecAnalFitAlgo
< EEDataFrame
algoEE_
 
edm::ESHandle< EcalPedestalspedHandle
 
edm::ESHandle< EcalGainRatiospRatio
 

Detailed Description

produce ECAL uncalibrated rechits from dataframes with the analytical fit method

Author
Shahram Rahatlou, University of Rome & INFN, Sept 2005

Definition at line 27 of file EcalUncalibRecHitWorkerAnalFit.h.

Constructor & Destructor Documentation

EcalUncalibRecHitWorkerAnalFit::EcalUncalibRecHitWorkerAnalFit ( const edm::ParameterSet ps,
edm::ConsumesCollector c 
)
EcalUncalibRecHitWorkerAnalFit::EcalUncalibRecHitWorkerAnalFit ( )
inline

Definition at line 31 of file EcalUncalibRecHitWorkerAnalFit.h.

31 {};
EcalUncalibRecHitWorkerAnalFit::~EcalUncalibRecHitWorkerAnalFit ( )
inline

Definition at line 32 of file EcalUncalibRecHitWorkerAnalFit.h.

32 {};

Member Function Documentation

edm::ParameterSetDescription EcalUncalibRecHitWorkerAnalFit::getAlgoDescription ( )
virtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 141 of file EcalUncalibRecHitWorkerAnalFit.cc.

141  {
142 
144 //psd.addNode(edm::ParameterSet<edm::InputTag>("EBdigiCollection", edm::InputTag("ecalDigis","ebDigis")) and
145 // edm::ParameterSet<std::string>("EEhitCollection", "EcalUncalibRecHitsEE") and
146 // edm::ParameterSet<edm::InputTag>("EEdigiCollection", edm::InputTag("ecalDigis","eeDigis")) and
147 // edm::ParameterSet<std::string>("algo", "EcalUncalibRecHitWorkerAnalFit") and
148 // edm::ParameterSet<std::string>("EBhitCollection", "EcalUncalibRecHitsEB"));
149 //
150  return psd;
151 }
bool EcalUncalibRecHitWorkerAnalFit::run ( const edm::Event evt,
const EcalDigiCollection::const_iterator digi,
EcalUncalibratedRecHitCollection result 
)
virtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 62 of file EcalUncalibRecHitWorkerAnalFit.cc.

References algoEB_, algoEE_, EcalUncalibratedRecHit::amplitude(), EcalBarrel, LogDebug, EcalUncalibRecHitRecAnalFitAlgo< C >::makeRecHit(), pedHandle, pRatio, and edm::SortedCollection< T, SORT >::push_back().

65 {
66  using namespace edm;
67 
68  const EcalGainRatioMap & gainMap = pRatio.product()->getMap(); // map of gain ratios
69  const EcalPedestalsMap & pedMap = pedHandle.product()->getMap(); // map of pedestals
70 
71  EcalPedestalsMapIterator pedIter; // pedestal iterator
72  EcalPedestals::Item aped; // pedestal object for a single xtal
73 
74  EcalGainRatioMap::const_iterator gainIter; // gain iterator
75  EcalMGPAGainRatio aGain; // gain object for a single xtal
76 
77  DetId detid( itdg->id() );
78 
79  // find pedestals for this channel
80  //LogDebug("EcalUncalibRecHitDebug") << "looking up pedestal for crystal: " << itdg->id(); // FIXME
81  pedIter = pedMap.find( detid );
82  if( pedIter != pedMap.end() ) {
83  aped = (*pedIter);
84  } else {
85  edm::LogError("EcalUncalibRecHitWorkerAnalFit") << "error!! could not find pedestals for channel: ";
86  if ( detid.subdetId() == EcalBarrel ) {
87  edm::LogError("EcalUncalibRecHitWorkerAnalFit") << EBDetId( detid );
88  } else {
89  edm::LogError("EcalUncalibRecHitWorkerAnalFit") << EEDetId( detid );
90  }
91  edm::LogError("EcalUncalibRecHitWorkerAnalFit") << "\n no uncalib rechit will be made for this digi!";
92  return false;
93  }
94  double pedVec[3];
95  pedVec[0] = aped.mean_x12;
96  pedVec[1] = aped.mean_x6;
97  pedVec[2] = aped.mean_x1;
98 
99 
100  // find gain ratios
101  //LogDebug("EcalUncalibRecHitDebug") << "looking up gainRatios for crystal: " << itdg->id(); // FIXME
102  gainIter = gainMap.find( detid );
103  if( gainIter != gainMap.end() ) {
104  aGain = (*gainIter);
105  } else {
106  edm::LogError("EcalUncalibRecHitWorkerAnalFit") << "error!! could not find gain ratios for channel: ";
107  if ( detid.subdetId() == EcalBarrel ) {
108  edm::LogError("EcalUncalibRecHitWorkerAnalFit") << EBDetId( detid );
109  } else {
110  edm::LogError("EcalUncalibRecHitWorkerAnalFit") << EEDetId( detid );
111  }
112  edm::LogError("EcalUncalibRecHitWorkerAnalFit") << "\n no uncalib rechit will be made for this digi!";
113  return false;
114  }
115  double gainRatios[3];
116  gainRatios[0] = 1.;
117  gainRatios[1] = aGain.gain12Over6();
118  gainRatios[2] = aGain.gain6Over1()*aGain.gain12Over6();
119 
120  if ( detid.subdetId() == EcalBarrel ) {
121  EcalUncalibratedRecHit aHit = algoEB_.makeRecHit(*itdg, pedVec, gainRatios, 0 ,0);
122  result.push_back( aHit );
123  if(aHit.amplitude()>0.) {
124  LogDebug("EcalUncalibRecHitInfo") << "EcalUncalibRecHitWorkerAnalFit: processed EBDataFrame with id: "
125  << EBDetId( detid )
126  << "\n" << "uncalib rechit amplitude: " << aHit.amplitude();
127  }
128  } else {
129  EcalUncalibratedRecHit aHit = algoEE_.makeRecHit(*itdg, pedVec, gainRatios, 0, 0);
130  result.push_back( aHit );
131  if(aHit.amplitude()>0.) {
132  LogDebug("EcalUncalibRecHitInfo") << "EcalUncalibRecHitWorkerAnalFit: processed EEDataFrame with id: "
133  << EEDetId( detid ) << "\n"
134  << "uncalib rechit amplitude: " << aHit.amplitude();
135  }
136  }
137  return true;
138 }
#define LogDebug(id)
void push_back(T const &t)
edm::ESHandle< EcalPedestals > pedHandle
EcalPedestalsMap::const_iterator EcalPedestalsMapIterator
Definition: EcalPedestals.h:52
EcalUncalibRecHitRecAnalFitAlgo< EBDataFrame > algoEB_
EcalUncalibRecHitRecAnalFitAlgo< EEDataFrame > algoEE_
virtual EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const double *pedestals, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalWeightSet::EcalChi2WeightMatrix **chi2Matrix)
Compute parameters.
Definition: DetId.h:18
std::vector< Item >::const_iterator const_iterator
edm::ESHandle< EcalGainRatios > pRatio
void EcalUncalibRecHitWorkerAnalFit::set ( const edm::EventSetup es)
virtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 48 of file EcalUncalibRecHitWorkerAnalFit.cc.

References edm::EventSetup::get(), LogDebug, pedHandle, and pRatio.

49 {
50  // Gain Ratios
51  LogDebug("EcalUncalibRecHitDebug") << "fetching gainRatios....";
52  es.get<EcalGainRatiosRcd>().get(pRatio);
53  LogDebug("EcalUncalibRecHitDebug") << "done." ;
54 
55  // fetch the pedestals from the cond DB via EventSetup
56  LogDebug("EcalUncalibRecHitDebug") << "fetching pedestals....";
57  es.get<EcalPedestalsRcd>().get( pedHandle );
58  LogDebug("EcalUncalibRecHitDebug") << "done." ;
59 }
#define LogDebug(id)
edm::ESHandle< EcalPedestals > pedHandle
const T & get() const
Definition: EventSetup.h:56
edm::ESHandle< EcalGainRatios > pRatio

Member Data Documentation

EcalUncalibRecHitRecAnalFitAlgo<EBDataFrame> EcalUncalibRecHitWorkerAnalFit::algoEB_
private

Definition at line 40 of file EcalUncalibRecHitWorkerAnalFit.h.

Referenced by run().

EcalUncalibRecHitRecAnalFitAlgo<EEDataFrame> EcalUncalibRecHitWorkerAnalFit::algoEE_
private

Definition at line 41 of file EcalUncalibRecHitWorkerAnalFit.h.

Referenced by run().

edm::ESHandle<EcalPedestals> EcalUncalibRecHitWorkerAnalFit::pedHandle
private

Definition at line 45 of file EcalUncalibRecHitWorkerAnalFit.h.

Referenced by run(), and set().

edm::ESHandle<EcalGainRatios> EcalUncalibRecHitWorkerAnalFit::pRatio
private

Definition at line 44 of file EcalUncalibRecHitWorkerAnalFit.h.

Referenced by run(), and set().