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)
 
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 &)
 
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 26 of file EcalUncalibRecHitWorkerAnalFit.h.

Constructor & Destructor Documentation

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

Definition at line 37 of file EcalUncalibRecHitWorkerAnalFit.cc.

37  :
39 {
40 }
EcalUncalibRecHitWorkerBaseClass(const edm::ParameterSet &, edm::ConsumesCollector &c)
EcalUncalibRecHitWorkerAnalFit::~EcalUncalibRecHitWorkerAnalFit ( )
inline

Definition at line 30 of file EcalUncalibRecHitWorkerAnalFit.h.

30 {};

Member Function Documentation

bool EcalUncalibRecHitWorkerAnalFit::run ( const edm::Event evt,
const EcalDigiCollection::const_iterator digi,
EcalUncalibratedRecHitCollection result 
)
virtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 58 of file EcalUncalibRecHitWorkerAnalFit.cc.

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

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

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

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

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

Member Data Documentation

EcalUncalibRecHitRecAnalFitAlgo<EBDataFrame> EcalUncalibRecHitWorkerAnalFit::algoEB_
private

Definition at line 36 of file EcalUncalibRecHitWorkerAnalFit.h.

Referenced by run().

EcalUncalibRecHitRecAnalFitAlgo<EEDataFrame> EcalUncalibRecHitWorkerAnalFit::algoEE_
private

Definition at line 37 of file EcalUncalibRecHitWorkerAnalFit.h.

Referenced by run().

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

Definition at line 41 of file EcalUncalibRecHitWorkerAnalFit.h.

Referenced by run(), and set().

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

Definition at line 40 of file EcalUncalibRecHitWorkerAnalFit.h.

Referenced by run(), and set().