CMS 3D CMS Logo

CSCBadStripsConditions Class Reference

#include <CalibMuon/CSCCalibration/interface/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

typedef const CSCBadStrips* CSCBadStripsConditions::ReturnType

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().

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

CSCBadStripsConditions::~CSCBadStripsConditions (  ) 

Definition at line 21 of file CSCBadStripsConditions.cc.

References cndbBadStrips.

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


Member Function Documentation

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

Definition at line 44 of file CSCBadStripsConditions.h.

References TestMuL1L2Filter_cff::cerr, CSCBadStrips::chambers, CSCBadStrips::channels, lat::endl(), cmsRelvalreport::exit, i, in, j, and CSCBadStrips::numberOfBadChannels.

Referenced by CSCBadStripsConditions().

00045 {
00046   CSCBadStrips * cndbbadstrips = new CSCBadStrips();
00047 
00048   int new_index, new_chan;
00049   int new_layer,new_channel, new_flag1, new_flag2, new_flag3,new_pointer;
00050   std::vector<int> new_index_id;
00051   std::vector<short int> new_layer_id;
00052   std::vector<short int> new_chan_id;
00053   std::vector<int> new_badchannels;
00054   std::vector<short int> new_flag1_id;
00055   std::vector<short int> new_flag2_id;
00056   std::vector<short int> new_flag3_id;
00057   std::vector<int> new_cham_id;
00058   std::vector<int> new_point;
00059 
00060   int new_nrlines1=0;
00061   int new_nrlines2=0;
00062  
00063   std::ifstream newdata1;
00064   std::ifstream newdata2;
00065 
00066   newdata1.open("badstrips1.dat",std::ios::in); //chambercontainer
00067   if(!newdata1) {
00068     std::cerr <<"Error: badstrips1.dat -> no such file!"<< std::endl;
00069     exit(1);
00070   }
00071   newdata2.open("badstrips2.dat",std::ios::in); //channelcontainer
00072   if(!newdata2) {
00073     std::cerr <<"Error: badstrips2.dat -> no such file!"<< std::endl;
00074     exit(1);
00075   }
00076 
00077   while(!newdata1.eof() ) {
00078     newdata1 >> new_index >> new_pointer >> new_chan;
00079     new_index_id.push_back(new_index);
00080     new_point.push_back(new_pointer);
00081     new_badchannels.push_back(new_chan);
00082     new_nrlines1++;
00083   }
00084   newdata1.close();
00085 
00086   while (!newdata2.eof() ) { 
00087     newdata2 >> new_layer >> new_channel >> new_flag1 >> new_flag2 >> new_flag3; 
00088     new_layer_id.push_back(new_layer);
00089     new_chan_id.push_back(new_channel);
00090     new_flag1_id.push_back(new_flag1);
00091     new_flag2_id.push_back(new_flag2);
00092     new_flag3_id.push_back(new_flag3);
00093     new_nrlines2++;
00094   }
00095   newdata2.close();
00096   
00097 
00098   CSCBadStrips::BadChamberContainer & itemvector1 = cndbbadstrips->chambers;
00099   itemvector1.resize(new_nrlines1);
00100   
00101   CSCBadStrips::BadChannelContainer & itemvector2 = cndbbadstrips->channels;
00102   itemvector2.resize(new_nrlines2);
00103   
00104   cndbbadstrips->numberOfBadChannels = new_nrlines2;
00105 
00106   for(int i=0; i<new_nrlines1;i++){
00107     itemvector1[i].chamber_index = new_index_id[i];
00108     itemvector1[i].pointer = new_point[i];
00109     itemvector1[i].bad_channels = new_badchannels[i];
00110   }
00111 
00112   for(int j=0;j<new_nrlines2;j++) {
00113     itemvector2[j].layer =  new_layer_id[j];
00114     itemvector2[j].channel = new_chan_id[j];
00115     itemvector2[j].flag1 =  new_flag1_id[j];
00116     itemvector2[j].flag2 = new_flag2_id[j];
00117     itemvector2[j].flag3 = new_flag3_id[j];
00118   }
00119 
00120    return cndbbadstrips;
00121 }

CSCBadStripsConditions::ReturnType CSCBadStripsConditions::produceBadStrips ( const CSCBadStripsRcd iRecord  ) 

Definition at line 36 of file CSCBadStripsConditions.cc.

References cndbBadStrips.

Referenced by CSCBadStripsConditions().

00037 {
00038   //need a new object so to not be deleted at exit
00039   CSCBadStrips* mydata=new CSCBadStrips( *cndbBadStrips );
00040   return mydata;
00041   
00042 }

void CSCBadStripsConditions::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue ,
edm::ValidityInterval oValidity 
) [private, virtual]

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 44 of file CSCBadStripsConditions.cc.

References edm::IOVSyncValue::beginOfTime(), and edm::IOVSyncValue::endOfTime().


Member Data Documentation

CSCBadStrips* CSCBadStripsConditions::cndbBadStrips [private]

Definition at line 35 of file CSCBadStripsConditions.h.

Referenced by CSCBadStripsConditions(), produceBadStrips(), and ~CSCBadStripsConditions().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:04 2009 for CMSSW by  doxygen 1.5.4