CMS 3D CMS Logo

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

CSCFakeDBCrosstalk Class Reference

#include <CSCFakeDBCrosstalk.h>

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

List of all members.

Public Types

typedef boost::shared_ptr
< CSCDBCrosstalk
Pointer

Public Member Functions

 CSCFakeDBCrosstalk (const edm::ParameterSet &)
Pointer produceDBCrosstalk (const CSCDBCrosstalkRcd &)
 ~CSCFakeDBCrosstalk ()

Static Public Member Functions

static CSCDBCrosstalkprefillDBCrosstalk ()

Private Member Functions

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

Private Attributes

Pointer cndbCrosstalk

Detailed Description

Definition at line 21 of file CSCFakeDBCrosstalk.h.


Member Typedef Documentation

typedef boost::shared_ptr<CSCDBCrosstalk> CSCFakeDBCrosstalk::Pointer

Definition at line 28 of file CSCFakeDBCrosstalk.h.


Constructor & Destructor Documentation

CSCFakeDBCrosstalk::CSCFakeDBCrosstalk ( const edm::ParameterSet iConfig)

Definition at line 6 of file CSCFakeDBCrosstalk.cc.

References cndbCrosstalk, prefillDBCrosstalk(), produceDBCrosstalk(), and edm::ESProducer::setWhatProduced().

{
  //the following line is needed to tell the framework what
  // data is being produced
  cndbCrosstalk = boost::shared_ptr<CSCDBCrosstalk> ( prefillDBCrosstalk() );
  setWhatProduced(this,&CSCFakeDBCrosstalk::produceDBCrosstalk);
  findingRecord<CSCDBCrosstalkRcd>();
}
CSCFakeDBCrosstalk::~CSCFakeDBCrosstalk ( )

Definition at line 16 of file CSCFakeDBCrosstalk.cc.

{
}

Member Function Documentation

CSCDBCrosstalk * CSCFakeDBCrosstalk::prefillDBCrosstalk ( ) [inline, static]

Definition at line 44 of file CSCFakeDBCrosstalk.h.

References CSCDBCrosstalk::crosstalk, CSCDBCrosstalk::factor_intercept, CSCDBCrosstalk::factor_slope, i, plotscripts::mean(), and min.

Referenced by CSCFakeDBCrosstalk().

{
  int seed;
  long int M;
  float mean,min, minchi;
  int ii,jj,iii,jjj;
  const int MAX_SIZE = 217728; //or 252288 for ME4/2 chambers
  const int SLOPE_FACTOR=10000000;
  const int INTERCEPT_FACTOR=100000;
  
  CSCDBCrosstalk * cndbcrosstalk = new CSCDBCrosstalk();
  cndbcrosstalk->crosstalk.resize(MAX_SIZE);

  seed = 10000; 
  srand(seed);
  mean=-0.0009, min=0.035, minchi=1.5, M=1000;
  ii=0,jj=0,iii=0,jjj=0; 
  
  cndbcrosstalk->factor_slope = int (SLOPE_FACTOR);
  cndbcrosstalk->factor_intercept = int (INTERCEPT_FACTOR);
  
  for(int i=0; i<MAX_SIZE;i++){
    cndbcrosstalk->crosstalk[i].xtalk_slope_right = (short int) ((-((double)rand()/((double)(RAND_MAX)+(double)(1)))/10000+mean)*SLOPE_FACTOR+0.5);
    cndbcrosstalk->crosstalk[i].xtalk_intercept_right= (short int) ((((double)rand()/((double)(RAND_MAX)+(double)(1)))/100+min)*INTERCEPT_FACTOR+0.5);
    cndbcrosstalk->crosstalk[i].xtalk_slope_left= (short int) ((-((double)rand()/((double)(RAND_MAX)+(double)(1)))/10000+mean)*SLOPE_FACTOR+0.5);
    cndbcrosstalk->crosstalk[i].xtalk_intercept_left=(short int) ((((double)rand()/((double)(RAND_MAX)+(double)(1)))/100+min)*INTERCEPT_FACTOR+0.5); 
  
  
    //80 strips per chamber
    if(i<34561 && i%80==0){
      cndbcrosstalk->crosstalk[i].xtalk_slope_left=0;
      cndbcrosstalk->crosstalk[i].xtalk_intercept_left=0;
    }
    
    if(i!=0 && i<34561 && (i+1)%80==0){
      cndbcrosstalk->crosstalk[i].xtalk_slope_right=0;
      cndbcrosstalk->crosstalk[i].xtalk_intercept_right=0;
    }
    
    //64 strips per chamber
    if(i>34560 && i<48385 && i%64==0){
      cndbcrosstalk->crosstalk[i].xtalk_slope_left=0;
      cndbcrosstalk->crosstalk[i].xtalk_intercept_left=0;
    }
    
    if(i>34560 && i<48385 && (i+1)%64==0){
      cndbcrosstalk->crosstalk[i].xtalk_slope_right=0;
      cndbcrosstalk->crosstalk[i].xtalk_intercept_right=0;
    }
    
    //80 strips per chamber again
    if(i>48384 && i<143425){
      ii++;
      if(i>48384 && i<143425 && ii%80==0){
        cndbcrosstalk->crosstalk[i].xtalk_slope_left=0;
        cndbcrosstalk->crosstalk[i].xtalk_intercept_left=0;
      }
    }
    
    if(i>48384 && i<143425){
      jj++;
      if(i>48384 && i<143425 && (jj+1)%80==0){
        cndbcrosstalk->crosstalk[i].xtalk_slope_right=0;
        cndbcrosstalk->crosstalk[i].xtalk_intercept_right=0;
      }
    }
    
    //64 strips per chamber again
    if(i>143424 && i<157249 &&i%64==0){
      cndbcrosstalk->crosstalk[i].xtalk_slope_left=0;
      cndbcrosstalk->crosstalk[i].xtalk_intercept_left=0;
    }
    
    if(i>143424 && i<157249 && (i+1)%64==0){
      cndbcrosstalk->crosstalk[i].xtalk_slope_right=0;
      cndbcrosstalk->crosstalk[i].xtalk_intercept_right=0;
    }
    
    
    //80 strips per chamber last time
    if(i>157248){
      iii++;
      if(i>157248 && iii%80==0){
        cndbcrosstalk->crosstalk[i].xtalk_slope_left=0;
        cndbcrosstalk->crosstalk[i].xtalk_intercept_left=0;
      }
    }
    
    if(i>157248){
      jjj++;
      if(i>157248 && (jjj+1)%80==0){
        cndbcrosstalk->crosstalk[i].xtalk_slope_right=0;
        cndbcrosstalk->crosstalk[i].xtalk_intercept_right=0;
      }
    }
  }
  return cndbcrosstalk;
}  
CSCFakeDBCrosstalk::Pointer CSCFakeDBCrosstalk::produceDBCrosstalk ( const CSCDBCrosstalkRcd iRecord)

Definition at line 23 of file CSCFakeDBCrosstalk.cc.

References cndbCrosstalk.

Referenced by CSCFakeDBCrosstalk().

{
  return cndbCrosstalk;
}
void CSCFakeDBCrosstalk::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue ,
edm::ValidityInterval oValidity 
) [private, virtual]

Member Data Documentation

Definition at line 35 of file CSCFakeDBCrosstalk.h.

Referenced by CSCFakeDBCrosstalk(), and produceDBCrosstalk().