CMS 3D CMS Logo

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

CSCBadWiresConditions Class Reference

#include <CSCBadWiresConditions.h>

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

List of all members.

Public Types

typedef const CSCBadWiresReturnType

Public Member Functions

 CSCBadWiresConditions (const edm::ParameterSet &)
ReturnType produceBadWires (const CSCBadWiresRcd &)
 ~CSCBadWiresConditions ()

Static Public Member Functions

static CSCBadWiresprefillBadWires ()

Private Member Functions

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

Private Attributes

CSCBadWirescndbBadWires

Detailed Description

Definition at line 20 of file CSCBadWiresConditions.h.


Member Typedef Documentation

Definition at line 28 of file CSCBadWiresConditions.h.


Constructor & Destructor Documentation

CSCBadWiresConditions::CSCBadWiresConditions ( const edm::ParameterSet iConfig)

Definition at line 10 of file CSCBadWiresConditions.cc.

References cndbBadWires, prefillBadWires(), produceBadWires(), and edm::ESProducer::setWhatProduced().

{
  //the following line is needed to tell the framework what
  // data is being produced
  cndbBadWires = prefillBadWires();
  setWhatProduced(this,&CSCBadWiresConditions::produceBadWires);
  findingRecord<CSCBadWiresRcd>();
  //now do what ever other initialization is needed
}
CSCBadWiresConditions::~CSCBadWiresConditions ( )

Definition at line 21 of file CSCBadWiresConditions.cc.

References cndbBadWires.

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

Member Function Documentation

CSCBadWires * CSCBadWiresConditions::prefillBadWires ( ) [inline, static]

Definition at line 44 of file CSCBadWiresConditions.h.

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

Referenced by CSCBadWiresConditions().

{
  CSCBadWires * cndbbadwires = new CSCBadWires();

  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("badwires1.dat",std::ios::in); 
  if(!newdata1) {
    std::cerr <<"Error: badwires1.dat -> no such file!"<< std::endl;
    exit(1);
  }
  newdata2.open("badwires2.dat",std::ios::in); //channelcontainer
  if(!newdata2) {
    std::cerr <<"Error: badwires2.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();

 
  CSCBadWires::BadChamberContainer & itemvector1 = cndbbadwires->chambers;
  itemvector1.resize(new_nrlines1);
  

  CSCBadWires::BadChannelContainer & itemvector2 = cndbbadwires->channels;
  itemvector2.resize(new_nrlines2);
  
  cndbbadwires->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 cndbbadwires;
}
CSCBadWiresConditions::ReturnType CSCBadWiresConditions::produceBadWires ( const CSCBadWiresRcd iRecord)

Definition at line 36 of file CSCBadWiresConditions.cc.

References cndbBadWires.

Referenced by CSCBadWiresConditions().

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

Member Data Documentation