CMS 3D CMS Logo

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

CSCFakeCrosstalkConditions Class Reference

#include <CSCFakeCrosstalkConditions.h>

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

List of all members.

Public Types

typedef const CSCcrosstalkReturnType

Public Member Functions

 CSCFakeCrosstalkConditions (const edm::ParameterSet &)
void prefillCrosstalk ()
ReturnType produceCrosstalk (const CSCcrosstalkRcd &)
 ~CSCFakeCrosstalkConditions ()

Public Attributes

long int M
float mean
float min
float minchi
int seed

Private Member Functions

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

Private Attributes

CSCcrosstalkcncrosstalk

Detailed Description

Definition at line 19 of file CSCFakeCrosstalkConditions.h.


Member Typedef Documentation

Definition at line 29 of file CSCFakeCrosstalkConditions.h.


Constructor & Destructor Documentation

CSCFakeCrosstalkConditions::CSCFakeCrosstalkConditions ( const edm::ParameterSet iConfig)

Definition at line 87 of file CSCFakeCrosstalkConditions.cc.

References prefillCrosstalk(), produceCrosstalk(), and edm::ESProducer::setWhatProduced().

{
  //the following line is needed to tell the framework what
  // data is being produced
  prefillCrosstalk();
  setWhatProduced(this,&CSCFakeCrosstalkConditions::produceCrosstalk);
  findingRecord<CSCcrosstalkRcd>();
  //now do what ever other initialization is needed
}
CSCFakeCrosstalkConditions::~CSCFakeCrosstalkConditions ( )

Definition at line 98 of file CSCFakeCrosstalkConditions.cc.

References cncrosstalk.

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

Member Function Documentation

void CSCFakeCrosstalkConditions::prefillCrosstalk ( )

Definition at line 5 of file CSCFakeCrosstalkConditions.cc.

References cncrosstalk, CSCcrosstalk::crosstalk, CSCDetId, M, CSCDetId::maxChamberId(), CSCDetId::maxEndcapId(), CSCDetId::maxLayerId(), CSCDetId::maxRingId(), CSCDetId::maxStationId(), mean, min, CSCDetId::minChamberId(), minchi, CSCDetId::minEndcapId(), CSCDetId::minLayerId(), CSCDetId::minRingId(), CSCDetId::minStationId(), and seed.

Referenced by CSCFakeCrosstalkConditions().

                                                 {
  
  const CSCDetId& detId = CSCDetId();
  cncrosstalk = new CSCcrosstalk();
  
  int max_istrip,id_layer,max_ring,max_cham;
  seed = 10000; 
  srand(seed);
  mean=-0.0009, min=0.035, minchi=1.5, M=1000;
 
  //endcap=1 to 2,station=1 to 4, ring=1 to 4,chamber=1 to 36,layer=1 to 6 
  for(int iendcap=detId.minEndcapId(); iendcap<=detId.maxEndcapId(); iendcap++){
    for(int istation=detId.minStationId() ; istation<=detId.maxStationId(); istation++){
      max_ring=detId.maxRingId();
      //station 4 ring 4 not there(36 chambers*2 missing)
      //3 rings max this way of counting (ME1a & b)
      if(istation==1)    max_ring=3;
      if(istation==2)    max_ring=2;
      if(istation==3)    max_ring=2;
      if(istation==4)    max_ring=1;
      
      for(int iring=detId.minRingId(); iring<=max_ring; iring++){
        max_istrip=80;
        max_cham=detId.maxChamberId();
        if(istation==1 && iring==1)    max_cham=36;
        if(istation==1 && iring==2)    max_cham=36;
        if(istation==1 && iring==3)    max_cham=36;
        if(istation==2 && iring==1)    max_cham=18;
        if(istation==2 && iring==2)    max_cham=36;
        if(istation==3 && iring==1)    max_cham=18;
        if(istation==3 && iring==2)    max_cham=36;
        if(istation==4 && iring==1)    max_cham=18;
        //station 1 ring 3 has 64 strips per layer instead of 80(minus & plus side!!!)

        for(int ichamber=detId.minChamberId(); ichamber<=max_cham; ichamber++){

          for(int ilayer=detId.minLayerId(); ilayer<=detId.maxLayerId(); ilayer++){
            //station 1 ring 3 has 64 strips per layer instead of 80 
            if(istation==1 && iring==3)   max_istrip=64;
            
            std::vector<CSCcrosstalk::Item> itemvector;
            itemvector.resize(max_istrip);
            id_layer = 100000*iendcap + 10000*istation + 1000*iring + 10*ichamber + ilayer;

            for(int istrip=0;istrip<max_istrip;istrip++){
              //create fake values
              itemvector[istrip].xtalk_slope_right=-((double)rand()/((double)(RAND_MAX)+(double)(1)))/10000+mean;
              itemvector[istrip].xtalk_intercept_right=((double)rand()/((double)(RAND_MAX)+(double)(1)))/100+min;
              itemvector[istrip].xtalk_chi2_right=((double)rand()/((double)(RAND_MAX)+(double)(1)))+minchi;
              itemvector[istrip].xtalk_slope_left=-((double)rand()/((double)(RAND_MAX)+(double)(1)))/10000+mean;
              itemvector[istrip].xtalk_intercept_left=((double)rand()/((double)(RAND_MAX)+(double)(1)))/100+min;
              itemvector[istrip].xtalk_chi2_left=((double)rand()/((double)(RAND_MAX)+(double)(1)))+minchi;
              cncrosstalk->crosstalk[id_layer]=itemvector;

              if(istrip==0){
                itemvector[istrip].xtalk_slope_right=-((double)rand()/((double)(RAND_MAX)+(double)(1)))/10000+mean;
                itemvector[istrip].xtalk_intercept_right=((double)rand()/((double)(RAND_MAX)+(double)(1)))/100+min;
                itemvector[istrip].xtalk_chi2_right=((double)rand()/((double)(RAND_MAX)+(double)(1)))+minchi;
                itemvector[istrip].xtalk_slope_left=0.0;
                itemvector[istrip].xtalk_intercept_left=0.0;
                itemvector[istrip].xtalk_chi2_left=0.0;
                cncrosstalk->crosstalk[id_layer]=itemvector;
              }
              
              if(istrip==79){
                itemvector[istrip].xtalk_slope_right=0.0;
                itemvector[istrip].xtalk_intercept_right=0.0;
                itemvector[istrip].xtalk_chi2_right=0.0;
                itemvector[istrip].xtalk_slope_left=-((double)rand()/((double)(RAND_MAX)+(double)(1)))/10000+mean;
                itemvector[istrip].xtalk_intercept_left=((double)rand()/((double)(RAND_MAX)+(double)(1)))/100+min;
                itemvector[istrip].xtalk_chi2_left=((double)rand()/((double)(RAND_MAX)+(double)(1)))+minchi;
                cncrosstalk->crosstalk[id_layer]=itemvector;
              }
            }
          }
        }
      }
    }
  }
}
CSCFakeCrosstalkConditions::ReturnType CSCFakeCrosstalkConditions::produceCrosstalk ( const CSCcrosstalkRcd iRecord)

Definition at line 113 of file CSCFakeCrosstalkConditions.cc.

References cncrosstalk.

Referenced by CSCFakeCrosstalkConditions().

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

Member Data Documentation

Definition at line 25 of file CSCFakeCrosstalkConditions.h.

Referenced by prefillCrosstalk().

Definition at line 24 of file CSCFakeCrosstalkConditions.h.

Referenced by prefillCrosstalk().

Definition at line 24 of file CSCFakeCrosstalkConditions.h.

Referenced by prefillCrosstalk().

Definition at line 24 of file CSCFakeCrosstalkConditions.h.

Referenced by prefillCrosstalk().

Definition at line 25 of file CSCFakeCrosstalkConditions.h.

Referenced by prefillCrosstalk().