CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

CSCBadStripsConditions Class Reference

#include <CSCBadStripsConditions.h>

Inheritance diagram for CSCBadStripsConditions:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Types

typedef const CSCBadStripsReturnType

Public Member Functions

 CSCBadStripsConditions (const edm::ParameterSet &)
ReturnType produceBadStrips (const CSCBadStripsRcd &)
 ~CSCBadStripsConditions ()

Static Public Member Functions

static CSCBadStripsprefillBadStrips ()

Private Member Functions

void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)

Private Attributes

CSCBadStripscndbBadStrips

Detailed Description

Definition at line 20 of file CSCBadStripsConditions.h.


Member Typedef Documentation

Definition at line 28 of file CSCBadStripsConditions.h.


Constructor & Destructor Documentation

CSCBadStripsConditions::CSCBadStripsConditions ( const edm::ParameterSet iConfig)

Definition at line 10 of file CSCBadStripsConditions.cc.

References cndbBadStrips, prefillBadStrips(), produceBadStrips(), and edm::ESProducer::setWhatProduced().

{
  //the following line is needed to tell the framework what
  // data is being produced
  cndbBadStrips = prefillBadStrips();
  setWhatProduced(this,&CSCBadStripsConditions::produceBadStrips);
  findingRecord<CSCBadStripsRcd>();
  //now do what ever other initialization is needed
}
CSCBadStripsConditions::~CSCBadStripsConditions ( )

Definition at line 21 of file CSCBadStripsConditions.cc.

References cndbBadStrips.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)
  delete cndbBadStrips;
}

Member Function Documentation

CSCBadStrips * CSCBadStripsConditions::prefillBadStrips ( ) [inline, static]

Definition at line 44 of file CSCBadStripsConditions.h.

References benchmark_cfg::cerr, CSCBadStrips::chambers, CSCBadStrips::channels, cmsRelvalreport::exit, i, recoMuon::in, j, and CSCBadStrips::numberOfBadChannels.

Referenced by CSCBadStripsConditions().

{
  CSCBadStrips * cndbbadstrips = new CSCBadStrips();

  int new_index, new_chan;
  int new_layer,new_channel, new_flag1, new_flag2, new_flag3,new_pointer;
  std::vector<int> new_index_id;
  std::vector<short int> new_layer_id;
  std::vector<short int> new_chan_id;
  std::vector<int> new_badchannels;
  std::vector<short int> new_flag1_id;
  std::vector<short int> new_flag2_id;
  std::vector<short int> new_flag3_id;
  std::vector<int> new_cham_id;
  std::vector<int> new_point;
  
  //when bad channels exist use the following
   int new_nrlines1=0;
   int new_nrlines2=0;
  //when empty
  //int new_nrlines1=-1;
  //int new_nrlines2=-1;

 
  std::ifstream newdata1;
  std::ifstream newdata2;

  newdata1.open("badstrips1.dat",std::ios::in); //chambercontainer
  if(!newdata1) {
    std::cerr <<"Error: badstrips1.dat -> no such file!"<< std::endl;
    exit(1);
  }
  newdata2.open("badstrips2.dat",std::ios::in); //channelcontainer
  if(!newdata2) {
    std::cerr <<"Error: badstrips2.dat -> no such file!"<< std::endl;
    exit(1);
  }

  while(!newdata1.eof() ) {
    newdata1 >> new_index >> new_pointer >> new_chan;
    new_index_id.push_back(new_index);
    new_point.push_back(new_pointer);
    new_badchannels.push_back(new_chan);
    new_nrlines1++;
  }
  newdata1.close();

  while (!newdata2.eof() ) { 
    newdata2 >> new_layer >> new_channel >> new_flag1 >> new_flag2 >> new_flag3; 
    new_layer_id.push_back(new_layer);
    new_chan_id.push_back(new_channel);
    new_flag1_id.push_back(new_flag1);
    new_flag2_id.push_back(new_flag2);
    new_flag3_id.push_back(new_flag3);
    new_nrlines2++;
  }
  newdata2.close();
  

  CSCBadStrips::BadChamberContainer & itemvector1 = cndbbadstrips->chambers;
  itemvector1.resize(new_nrlines1);
  
  CSCBadStrips::BadChannelContainer & itemvector2 = cndbbadstrips->channels;
  itemvector2.resize(new_nrlines2);
  
  cndbbadstrips->numberOfBadChannels = new_nrlines2;
 
  for(int i=0; i<new_nrlines1;i++){
    itemvector1[i].chamber_index = new_index_id[i];
    itemvector1[i].pointer = new_point[i];
    itemvector1[i].bad_channels = new_badchannels[i];
  }

  for(int j=0;j<new_nrlines2;j++) {
    itemvector2[j].layer =  new_layer_id[j];
    itemvector2[j].channel = new_chan_id[j];
    itemvector2[j].flag1 =  new_flag1_id[j];
    itemvector2[j].flag2 = new_flag2_id[j];
    itemvector2[j].flag3 = new_flag3_id[j];
  }

   return cndbbadstrips;
}
CSCBadStripsConditions::ReturnType CSCBadStripsConditions::produceBadStrips ( const CSCBadStripsRcd iRecord)

Definition at line 36 of file CSCBadStripsConditions.cc.

References cndbBadStrips.

Referenced by CSCBadStripsConditions().

{
  //need a new object so to not be deleted at exit
  CSCBadStrips* mydata=new CSCBadStrips( *cndbBadStrips );
  return mydata;
  
}
void CSCBadStripsConditions::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue ,
edm::ValidityInterval oValidity 
) [private, virtual]

Member Data Documentation