Skip to content

Commit

Permalink
v1 of hcal detid refactoring from Jeremy (biggish set of changes)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Lange committed Nov 12, 2012
1 parent 8b7c4f3 commit c858908
Show file tree
Hide file tree
Showing 135 changed files with 2,484 additions and 2,362 deletions.
4 changes: 3 additions & 1 deletion CalibCalorimetry/CastorCalib/plugins/CastorDbProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// Original Author: Fedor Ratnikov
// Created: Tue Aug 9 19:10:10 CDT 2005
// Adapted for CASTOR by L. Mundim
// $Id: CastorDbProducer.cc,v 1.22 2009/03/24 16:11:35 rofierzy Exp $
// $Id: CastorDbProducer.cc,v 1.3 2009/03/26 17:49:44 mundim Exp $
//
//

Expand Down Expand Up @@ -82,8 +82,10 @@ boost::shared_ptr<CastorDbService> CastorDbProducer::produce( const CastorDbReco
}

void CastorDbProducer::pedestalsCallback (const CastorPedestalsRcd& fRecord) {

edm::ESHandle <CastorPedestals> item;
fRecord.get (item);

mService->setData (item.product ());
if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Pedestals")) != mDumpRequest.end()) {
*mDumpStream << "New HCAL/CASTOR Pedestals set" << std::endl;
Expand Down
20 changes: 11 additions & 9 deletions CalibCalorimetry/HcalAlgos/interface/HcalLogicalMapGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,34 @@
#define HcalLogicalMapGenerator_h

#include "CondFormats/HcalObjects/interface/HcalLogicalMap.h"

class HcalTopology;

class HcalLogicalMapGenerator {


public:

HcalLogicalMapGenerator( );
~HcalLogicalMapGenerator( );
HcalLogicalMap createMap(unsigned int mapIOV = 4);
HcalLogicalMap createMap(const HcalTopology* topo, unsigned int mapIOV = 4);

private:

void buildHBEFTMap(std::vector <HBHEHFLogicalMapEntry>&,std::vector <HTLogicalMapEntry>&,std::vector <uint32_t>&,
void buildHBEFTMap(const HcalTopology* topo,
std::vector <HBHEHFLogicalMapEntry>&,std::vector <HTLogicalMapEntry>&,std::vector <uint32_t>&,
std::vector <uint32_t>&,
std::vector <uint32_t>&,
std::vector <uint32_t>&,
std::vector <uint32_t>&);
void buildHOXMap (std::vector <HOHXLogicalMapEntry>& ,std::vector <uint32_t>&,
void buildHOXMap (const HcalTopology* topo,
std::vector <HOHXLogicalMapEntry>& ,std::vector <uint32_t>&,
std::vector <uint32_t>&,
std::vector <uint32_t>&);
void buildCALIBMap(std::vector <CALIBLogicalMapEntry>& ,std::vector <uint32_t>&,
void buildCALIBMap(const HcalTopology* topo,
std::vector <CALIBLogicalMapEntry>& ,std::vector <uint32_t>&,
std::vector <uint32_t>&);
void buildZDCMap (std::vector <ZDCLogicalMapEntry>& ,std::vector <uint32_t>&,
void buildZDCMap (const HcalTopology* topo,
std::vector <ZDCLogicalMapEntry>& ,std::vector <uint32_t>&,
std::vector <uint32_t>&);
void ConstructTriggerTower(
void ConstructTriggerTower(const HcalTopology* topo,
std::vector <HTLogicalMapEntry>&,
int i_side, int i_eta, int i_phi, int i_dphi, int i_depth, std::string i_det, int i_wedge, int i_rm,
int i_pixel, int i_qie, int i_adc, int i_rm_fi, int i_fi_ch, int i_crate, int i_htr, std::string i_fpga,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class HcalPedestalAnalysis{
int evt_curr;
float m_stat[4];
std::vector<bool> state;

HcalTopology* fTopology;
// flag to make gaussian fits to charge dists
static const int fitflag=0;
};
Expand Down
6 changes: 4 additions & 2 deletions CalibCalorimetry/HcalAlgos/interface/HcalPulseShapes.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

/** \class HcalPulseShapes
*
* $Date: 2011/09/08 13:23:03 $
* $Revision: 1.5 $
* $Date: 2011/11/23 13:48:27 $
* $Revision: 1.6 $
* \author J. Mans - Minnesota
*/
class HcalMCParams;
class HcalRecoParams;
class HcalTopology;

class HcalPulseShapes {
public:
Expand Down Expand Up @@ -46,6 +47,7 @@ class HcalPulseShapes {
Shape hpdShape_v3, hpdShapeMC_v3;
Shape hpdBV30Shape_v2, hpdBV30ShapeMC_v2;
const HcalMCParams * theMCParams;
const HcalTopology * theTopology;
const HcalRecoParams * theRecoParams;
typedef std::map<int, const Shape *> ShapeMap;
ShapeMap theShapes;
Expand Down
29 changes: 13 additions & 16 deletions CalibCalorimetry/HcalAlgos/src/HcalDbASCIIIO.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// F.Ratnikov (UMd), Oct 28, 2005
// $Id: HcalDbASCIIIO.cc,v 1.66 2011/11/23 13:48:27 abdullin Exp $
// $Id: HcalDbASCIIIO.cc,v 1.67 2012/11/02 14:15:56 dlange Exp $
//
#include <vector>
#include <string>
Expand Down Expand Up @@ -163,7 +163,7 @@ bool from_string(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&)

template <class T,class S>
bool getHcalObject (std::istream& fInput, T* fObject, S* fCondObject) {
if (!fObject) fObject = new T;
if (!fObject) return false; //fObject = new T;
char buffer [1024];
while (fInput.getline(buffer, 1024)) {
if (buffer [0] == '#') continue; //ignore comment
Expand Down Expand Up @@ -212,7 +212,7 @@ bool dumpHcalObject (std::ostream& fOutput, const T& fObject) {

template <class T,class S>
bool getHcalSingleFloatObject (std::istream& fInput, T* fObject, S* fCondObject) {
if (!fObject) fObject = new T;
if (!fObject) return false; //fObject = new T;
char buffer [1024];
while (fInput.getline(buffer, 1024)) {
if (buffer [0] == '#') continue; //ignore comment
Expand Down Expand Up @@ -257,7 +257,7 @@ bool dumpHcalSingleFloatObject (std::ostream& fOutput, const T& fObject) {

template <class T,class S>
bool getHcalSingleIntObject (std::istream& fInput, T* fObject, S* fCondObject) {
if (!fObject) fObject = new T;
if (!fObject) return false; //fObject = new T;
char buffer [1024];
while (fInput.getline(buffer, 1024)) {
if (buffer [0] == '#') continue; //ignore comment
Expand Down Expand Up @@ -302,7 +302,7 @@ bool dumpHcalSingleIntObject (std::ostream& fOutput, const T& fObject) {

template <class T,class S>
bool getHcalMatrixObject (std::istream& fInput, T* fObject, S* fCondObject) {
if (!fObject) fObject = new T;
if (!fObject) return false; //fObject = new T;
char buffer [1024];
while (fInput.getline(buffer, 1024)) {
if (buffer [0] == '#') continue; //ignore comment
Expand Down Expand Up @@ -388,7 +388,7 @@ bool HcalDbASCIIIO::dumpObject (std::ostream& fOutput, const HcalCovarianceMatri
// ------------------------------ start specific implementations ------------------------------
bool HcalDbASCIIIO::getObject (std::istream& fInput, HcalRecoParams* fObject)
{
if (!fObject) fObject = new HcalRecoParams();
if (!fObject) return false; // fObject = new HcalRecoParams(); This was always useless...
char buffer [1024];
while (fInput.getline(buffer, 1024)) {
if (buffer [0] == '#') continue; //ignore comment
Expand Down Expand Up @@ -583,7 +583,7 @@ bool HcalDbASCIIIO::dumpObject (std::ostream& fOutput, const HcalRecoParams& fOb

bool HcalDbASCIIIO::getObject (std::istream& fInput, HcalLongRecoParams* fObject)
{
if (!fObject) fObject = new HcalLongRecoParams();
if (!fObject) return false; // fObject = new HcalLongRecoParams();
char buffer [1024];
while (fInput.getline(buffer, 1024)) {
if (buffer [0] == '#') continue; //ignore comment
Expand Down Expand Up @@ -611,7 +611,7 @@ bool HcalDbASCIIIO::getObject (std::istream& fInput, HcalLongRecoParams* fObject
}
bool HcalDbASCIIIO::getObject (std::istream& fInput, HcalTimingParams* fObject)
{
if (!fObject) fObject = new HcalTimingParams();
if (!fObject) return false; // fObject = new HcalTimingParams();
char buffer [1024];
while (fInput.getline(buffer, 1024)) {
if (buffer [0] == '#') continue; //ignore comment
Expand Down Expand Up @@ -696,7 +696,7 @@ bool HcalDbASCIIIO::dumpObject (std::ostream& fOutput, const HcalLongRecoParams&

bool HcalDbASCIIIO::getObject (std::istream& fInput, HcalMCParams* fObject)
{
if (!fObject) fObject = new HcalMCParams();
if (!fObject) return false; // fObject = new HcalMCParams();
char buffer [1024];
while (fInput.getline(buffer, 1024)) {
if (buffer [0] == '#') continue; //ignore comment
Expand Down Expand Up @@ -810,7 +810,6 @@ bool HcalDbASCIIIO::dumpObject (std::ostream& fOutput, const HcalMCParams& fObje
}

bool HcalDbASCIIIO::getObject (std::istream& fInput, HcalPedestals* fObject) {
if (!fObject) fObject = new HcalPedestals(false);
char buffer [1024];

while (fInput.getline(buffer, 1024)) {
Expand Down Expand Up @@ -905,7 +904,7 @@ bool HcalDbASCIIIO::dumpObject (std::ostream& fOutput, const HcalPedestals& fObj
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool HcalDbASCIIIO::getObject (std::istream& fInput, HcalChannelQuality* fObject)
{
if (!fObject) fObject = new HcalChannelQuality;
if (!fObject) return false; //fObject = new HcalChannelQuality;
char buffer [1024];
while (fInput.getline(buffer, 1024)) {
if (buffer [0] == '#') continue; //ignore comment
Expand Down Expand Up @@ -963,7 +962,6 @@ bool HcalDbASCIIIO::dumpObject (std::ostream& fOutput, const HcalChannelQuality&
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool HcalDbASCIIIO::getObject (std::istream& fInput, HcalL1TriggerObjects* fObject)
{
if (!fObject) fObject = new HcalL1TriggerObjects;
char buffer [1024];

while (fInput.getline(buffer, 1024)) {
Expand Down Expand Up @@ -1033,7 +1031,6 @@ bool HcalDbASCIIIO::dumpObject (std::ostream& fOutput, const HcalL1TriggerObject

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool HcalDbASCIIIO::getObject (std::istream& fInput, HcalPedestalWidths* fObject) {
if (!fObject) fObject = new HcalPedestalWidths(false);
char buffer [1024];
int linecounter = 0;

Expand Down Expand Up @@ -1420,7 +1417,7 @@ bool HcalDbASCIIIO::dumpObject (std::ostream& fOutput, const HcalElectronicsMap&


bool HcalDbASCIIIO::getObject (std::istream& fInput, HcalLutMetadata* fObject){
if (!fObject) fObject = new HcalLutMetadata;
if (!fObject) return false; //fObject = new HcalLutMetadata;
char buffer [1024];
while (fInput.getline(buffer, 1024)) {
if (buffer [0] == '#') continue; //ignore comment
Expand Down Expand Up @@ -1488,7 +1485,7 @@ bool HcalDbASCIIIO::dumpObject (std::ostream& fOutput, const HcalLutMetadata& fO

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalDcsValues * fObject) {
if (!fObject) fObject = new HcalDcsValues;
if (!fObject) return false; //fObject = new HcalDcsValues;
std::string buffer;
while (getline(fInput, buffer)) {
if (buffer.at(0) == '#') continue; //ignore comment
Expand Down Expand Up @@ -1747,7 +1744,7 @@ bool HcalDbASCIIIO::dumpObject (std::ostream& fOutput, const HcalDcsMap& fObject
bool HcalDbASCIIIO::getObject (std::istream& fInput, HcalFlagHFDigiTimeParams* fObject)
{

if (!fObject) fObject = new HcalFlagHFDigiTimeParams();
if (!fObject) return false; //fObject = new HcalFlagHFDigiTimeParams();
char buffer [1024];
while (fInput.getline(buffer, 1024)) {
if (buffer [0] == '#') continue; //ignore comment
Expand Down
6 changes: 3 additions & 3 deletions CalibCalorimetry/HcalAlgos/src/HcalDbXml.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// F.Ratnikov (UMd), Oct 28, 2005
// Modified by S. Won 6 May 2008
// $Id: HcalDbXml.cc,v 1.17.6.1 2011/11/14 11:15:00 abdullin Exp $
// $Id: HcalDbXml.cc,v 1.18 2011/11/14 13:34:41 abdullin Exp $
//
#include <vector>
#include <string>
Expand Down Expand Up @@ -150,7 +150,7 @@ bool HcalDbXml::dumpObject (std::ostream& fOutput,
const HcalPedestals& fObject) {
float dummyError = 0.0001;
std::cout << "HcalDbXml::dumpObject-> set default errors: 0.0001, 0.0001, 0.0001, 0.0001" << std::endl;
HcalPedestalWidths widths(fObject.isADC() );
HcalPedestalWidths widths(fObject.topo(),fObject.isADC() );
std::vector<DetId> channels = fObject.getAllChannels ();
for (std::vector<DetId>::iterator channel = channels.begin ();
channel != channels.end ();
Expand Down Expand Up @@ -206,7 +206,7 @@ bool HcalDbXml::dumpObject (std::ostream& fOutput,
float dummyErrors [4] = {0., 0., 0., 0.};
std::cout << "HcalDbXml::dumpObject-> set default errors: 4 x 0.0" << std::endl;

HcalGainWidths widths;
HcalGainWidths widths(fObject.topo());
std::vector<DetId> channels = fObject.getAllChannels ();
for (std::vector<DetId>::iterator channel = channels.begin (); channel != channels.end (); channel++)
{
Expand Down
Loading

0 comments on commit c858908

Please sign in to comment.