diff --git a/Geometry/src/HGCalTBCellVertices.cc b/Geometry/src/HGCalTBCellVertices.cc index 4b4cfde..d72fd24 100644 --- a/Geometry/src/HGCalTBCellVertices.cc +++ b/Geometry/src/HGCalTBCellVertices.cc @@ -56,7 +56,7 @@ std::pair HGCalTBCellVertices::GetCellCentreCoordinates(int laye bool ValidFlag = Top.iu_iv_valid(layer, sensor_iu, sensor_iv, iu, iv, sensorsize); if(ValidFlag) { centre_x_tmp = iu * x0 + iv * vx0 + sensor_iu*X0 + sensor_iv*VX0; - centre_y_tmp = iv * vy0 + iv * vy0 + sensor_iv*VY0; + centre_y_tmp = iv * vy0 + sensor_iv*VY0; auto point = RotateLayer(std::make_pair(centre_x_tmp, centre_y_tmp), TEST_BEAM_LAYER_ROTATION); // if(flipX==true) point.first = - point.first; return point; diff --git a/Geometry/src/HGCalTBTopology.cc b/Geometry/src/HGCalTBTopology.cc index 55bf4d8..729ae89 100644 --- a/Geometry/src/HGCalTBTopology.cc +++ b/Geometry/src/HGCalTBTopology.cc @@ -11,13 +11,14 @@ bool HGCalTBTopology::iu_iv_valid(int layer, int sensor_iu, int sensor_iv, int i int aiv = abs(iv); int iuc = (iv < 0) ? (-iu) : (iu); - int aIv = abs(sensor_iv); - int Iuc = (sensor_iv < 0)?(-sensor_iu):(sensor_iu); + int aIv = sensor_iv; + int Iuc = sensor_iu; - if(layer <= 28) Is_Valid_sensor_iu_iv = (Iuc == 0 && aIv == 0); + if(layer <= 4) Is_Valid_sensor_iu_iv = (Iuc == 0 && aIv == 0); else{ - if(aIv == 0) Is_Valid_sensor_iu_iv = (Iuc >= -1 && Iuc <= 1); - else if(aIv == 1) Is_Valid_sensor_iu_iv = (Iuc >= -1 && Iuc <= 0); + if((Iuc == 1) && (aIv == -1) ) Is_Valid_sensor_iu_iv = 1; + else if((Iuc == 0) && (aIv == 0) ) Is_Valid_sensor_iu_iv = 1; + else if ( (Iuc == 0) && (aIv == -1) ) Is_Valid_sensor_iu_iv = 1; } if(layer <= 40 && Is_Valid_sensor_iu_iv) { diff --git a/RawToDigi/plugins/HGCalTBRawDataSource.cc b/RawToDigi/plugins/HGCalTBRawDataSource.cc index 29a8d44..d64cef1 100644 --- a/RawToDigi/plugins/HGCalTBRawDataSource.cc +++ b/RawToDigi/plugins/HGCalTBRawDataSource.cc @@ -9,6 +9,8 @@ #include #include +using namespace std; + HGCalTBRawDataSource::HGCalTBRawDataSource(const edm::ParameterSet & pset, edm::InputSourceDescription const& desc) : edm::ProducerSourceFromFiles(pset, desc, true), m_electronicMap(pset.getUntrackedParameter("ElectronicMap","HGCal/CondObjects/data/map_CERN_Hexaboard_28Layers.txt")), @@ -202,6 +204,7 @@ void HGCalTBRawDataSource::produce(edm::Event & e) else{ HGCalTBDetId did = essource_.emap_.eid2detId(eid); detids.push_back(did); +// cout<mkdir( os.str().c_str() ); h=dir.make(); os.str(""); - os<<"ChannelMapping"; + os<<"ChannelMapping_"<<"Layer_"<SetName(os.str().c_str()); h->SetTitle(os.str().c_str()); - InitTH2Poly(*h, (int)ib, 0, 0); + InitTH2Poly(*h, Board_Layer, Board_IU, Board_IV); chanMap.insert( std::pair(ib,h) ); TFileDirectory hgpdir = dir.mkdir( "HighGainPedestal" ); TFileDirectory lgpdir = dir.mkdir( "LowGainPedestal" ); @@ -201,18 +227,19 @@ void PedestalPlotter::endJob() h=hgpdir.make(); os.str(""); - os<<"SCA"<SetName(os.str().c_str()); h->SetTitle(os.str().c_str()); - InitTH2Poly(*h, (int)ib, 0, 0); + InitTH2Poly(*h, Board_Layer, Board_IU, Board_IV); hgMeanMap.insert( std::pair(100*ib+it,h) ); h=lgpdir.make(); os.str(""); + os<<"SCA"<SetName(os.str().c_str()); h->SetTitle(os.str().c_str()); - InitTH2Poly(*h, (int)ib, 0, 0); + InitTH2Poly(*h, Board_Layer, Board_IU, Board_IV); lgMeanMap.insert( std::pair(100*ib+it,h) ); h=hgndir.make(); @@ -220,7 +247,7 @@ void PedestalPlotter::endJob() os<<"SCA"<SetName(os.str().c_str()); h->SetTitle(os.str().c_str()); - InitTH2Poly(*h, (int)ib, 0, 0); + InitTH2Poly(*h, Board_Layer, Board_IU, Board_IV); hgRMSMap.insert( std::pair(100*ib+it,h) ); h=lgndir.make(); @@ -228,7 +255,7 @@ void PedestalPlotter::endJob() os<<"SCA"<SetName(os.str().c_str()); h->SetTitle(os.str().c_str()); - InitTH2Poly(*h, (int)ib, 0, 0); + InitTH2Poly(*h, Board_Layer, Board_IU, Board_IV); lgRMSMap.insert( std::pair(100*ib+it,h) ); } @@ -266,8 +293,12 @@ void PedestalPlotter::endJob() } HGCalTBDetId detid=(*it).second; CellCentreXY = TheCell.GetCellCentreCoordinatesForPlots( detid.layer(), detid.sensorIU(), detid.sensorIV(), detid.iu(), detid.iv(), m_sensorsize ); + double iux = (CellCentreXY.first < 0 ) ? (CellCentreXY.first + HGCAL_TB_GEOMETRY::DELTA) : (CellCentreXY.first - HGCAL_TB_GEOMETRY::DELTA) ; double iuy = (CellCentreXY.second < 0 ) ? (CellCentreXY.second + HGCAL_TB_GEOMETRY::DELTA) : (CellCentreXY.second - HGCAL_TB_GEOMETRY::DELTA); + +// cout<Fill(iux/2 , iuy, iski*1000+ichan ); + chanMap[ iboard ]->Fill(iux , iuy, iski*1000+ichan ); if( m_writePedestalFile ){ pedestalHG << std::endl; pedestalLG << std::endl; diff --git a/RawToDigi/plugins/RawDataPlotter.cc b/RawToDigi/plugins/RawDataPlotter.cc index d916cf0..0204d1e 100644 --- a/RawToDigi/plugins/RawDataPlotter.cc +++ b/RawToDigi/plugins/RawDataPlotter.cc @@ -168,7 +168,7 @@ void RawDataPlotter::analyze(const edm::Event& event, const edm::EventSetup& set CellCentreXY = TheCell.GetCellCentreCoordinatesForPlots( detid.layer(), detid.sensorIU(), detid.sensorIV(), detid.iu(), detid.iv(), m_sensorsize ); double iux = (CellCentreXY.first < 0 ) ? (CellCentreXY.first + HGCAL_TB_GEOMETRY::DELTA) : (CellCentreXY.first - HGCAL_TB_GEOMETRY::DELTA) ; double iuy = (CellCentreXY.second < 0 ) ? (CellCentreXY.second + HGCAL_TB_GEOMETRY::DELTA) : (CellCentreXY.second - HGCAL_TB_GEOMETRY::DELTA); - polyMap[ 100*iboard+it ]->Fill(iux/2 , iuy, skiroc.ADCHigh(ichan,it) ); + polyMap[ 100*iboard+it ]->Fill(iux , iuy, skiroc.ADCHigh(ichan,it) ); } } } diff --git a/RawToDigi/plugins/RawHitPlotter.cc b/RawToDigi/plugins/RawHitPlotter.cc index 277c6da..f72a327 100644 --- a/RawToDigi/plugins/RawHitPlotter.cc +++ b/RawToDigi/plugins/RawHitPlotter.cc @@ -254,7 +254,7 @@ void RawHitPlotter::analyze(const edm::Event& event, const edm::EventSetup& setu CellCentreXY=TheCell.GetCellCentreCoordinatesForPlots(hit.detid().layer(),hit.detid().sensorIU(),hit.detid().sensorIV(),hit.detid().iu(),hit.detid().iv(),m_sensorsize); double iux = (CellCentreXY.first < 0 ) ? (CellCentreXY.first + delta) : (CellCentreXY.first - delta) ; double iuy = (CellCentreXY.second < 0 ) ? (CellCentreXY.second + delta) : (CellCentreXY.second - delta); - polyMap[ 100*iboard+it ]->Fill(iux/2 , iuy, highGain); + polyMap[ 100*iboard+it ]->Fill(iux , iuy, highGain); } } } @@ -347,10 +347,10 @@ void RawHitPlotter::endJob() float lgMean=cif->meanLGMap[it]/cif->counterLGMap[it]; float hgRMS=std::sqrt(cif->rmsHGMap[it]/cif->counterHGMap[it]-cif->meanHGMap[it]/cif->counterHGMap[it]*cif->meanHGMap[it]/cif->counterHGMap[it]); float lgRMS=std::sqrt(cif->rmsLGMap[it]/cif->counterLGMap[it]-cif->meanLGMap[it]/cif->counterLGMap[it]*cif->meanLGMap[it]/cif->counterLGMap[it]); - hgMeanMap[ 100*iboard+it ]->Fill(iux/2 , iuy, hgMean ); - lgMeanMap[ 100*iboard+it ]->Fill(iux/2 , iuy, lgMean ); - hgRMSMap[ 100*iboard+it ]->Fill(iux/2 , iuy, hgRMS ); - lgRMSMap[ 100*iboard+it ]->Fill(iux/2 , iuy, lgRMS ); + hgMeanMap[ 100*iboard+it ]->Fill(iux , iuy, hgMean ); + lgMeanMap[ 100*iboard+it ]->Fill(iux , iuy, lgMean ); + hgRMSMap[ 100*iboard+it ]->Fill(iux , iuy, hgRMS ); + lgRMSMap[ 100*iboard+it ]->Fill(iux , iuy, lgRMS ); } } } diff --git a/Reco/plugins/HGCalTBRecHitProducer.cc b/Reco/plugins/HGCalTBRecHitProducer.cc index c202f17..91a96c1 100644 --- a/Reco/plugins/HGCalTBRecHitProducer.cc +++ b/Reco/plugins/HGCalTBRecHitProducer.cc @@ -56,7 +56,7 @@ void HGCalTBRecHitProducer::produce(edm::Event& event, const edm::EventSetup& iS std::vector sampleHG, sampleLG, sampleT; - float highGain, lowGain, totGain; + float highGain = -500, lowGain = -500, totGain; int hgStatus = -1; int lgStatus = -1; float timeHG = 0.; diff --git a/Reco/plugins/RecHitPlotter.cc b/Reco/plugins/RecHitPlotter.cc index e7a1471..a9b9b26 100644 --- a/Reco/plugins/RecHitPlotter.cc +++ b/Reco/plugins/RecHitPlotter.cc @@ -187,8 +187,8 @@ void RecHitPlotter::analyze(const edm::Event& event, const edm::EventSetup& setu CellCentreXY=TheCell.GetCellCentreCoordinatesForPlots(hit.id().layer(),hit.id().sensorIU(),hit.id().sensorIV(),hit.id().iu(),hit.id().iv(),m_sensorsize); double iux = (CellCentreXY.first < 0 ) ? (CellCentreXY.first + HGCAL_TB_GEOMETRY::DELTA) : (CellCentreXY.first - HGCAL_TB_GEOMETRY::DELTA) ; double iuy = (CellCentreXY.second < 0 ) ? (CellCentreXY.second + HGCAL_TB_GEOMETRY::DELTA) : (CellCentreXY.second - HGCAL_TB_GEOMETRY::DELTA); - polyMapHG[ (eid.iskiroc()-1)/HGCAL_TB_GEOMETRY::N_SKIROC_PER_HEXA ]->Fill(iux/2 , iuy, hit.energyHigh()); - polyMapLG[ (eid.iskiroc()-1)/HGCAL_TB_GEOMETRY::N_SKIROC_PER_HEXA ]->Fill(iux/2 , iuy, hit.energyLow()); + polyMapHG[ (eid.iskiroc()-1)/HGCAL_TB_GEOMETRY::N_SKIROC_PER_HEXA ]->Fill(iux , iuy, hit.energyHigh()); + polyMapLG[ (eid.iskiroc()-1)/HGCAL_TB_GEOMETRY::N_SKIROC_PER_HEXA ]->Fill(iux , iuy, hit.energyLow()); } } m_h_hgSum->Fill( energyHighSum ); diff --git a/rawhitprod2017_cfg.py b/rawhitprod2017_cfg.py deleted file mode 100644 index a05cc6c..0000000 --- a/rawhitprod2017_cfg.py +++ /dev/null @@ -1,80 +0,0 @@ -import FWCore.ParameterSet.Config as cms -import FWCore.ParameterSet.VarParsing as VarParsing - -import os,sys - -options = VarParsing.VarParsing('standard') # avoid the options: maxEvents, files, secondaryFiles, output, secondaryOutput because they are already defined in 'standard' -#Change the data folder appropriately to where you wish to access the files from: -options.register('dataFolder', - './', - VarParsing.VarParsing.multiplicity.singleton, - VarParsing.VarParsing.varType.string, - 'folder containing raw input') - -options.register('runNumber', - 106, - VarParsing.VarParsing.multiplicity.singleton, - VarParsing.VarParsing.varType.int, - 'Input run to process') - -options.register('outputFolder', - '/afs/cern.ch/work/a/asteen/public/data/july2017/', - VarParsing.VarParsing.multiplicity.singleton, - VarParsing.VarParsing.varType.string, - 'Output folder where analysis output are stored') - -options.maxEvents = -1 -options.output = "cmsswEvents.root" - -options.parseArguments() -print options -if not os.path.isdir(options.dataFolder): - sys.exit("Error: Data folder not found or inaccessible!") - -electronicMap="HGCal/CondObjects/data/map_CERN_Hexaboard_28Layers_AllFlipped.txt" -pedestalHighGain="pedestalHG_"+str(options.runNumber)+".txt" -pedestalLowGain="pedestalLG_"+str(options.runNumber)+".txt" - -################################ -process = cms.Process("rawhitprod") -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(options.maxEvents) -) - -#################################### - -process.source = cms.Source("PoolSource", - fileNames=cms.untracked.vstring("file:%s/cmsswEvents_Run%d.root"%(options.dataFolder,options.runNumber)) -) - -filename = options.outputFolder+"/HexaOutput_"+str(options.runNumber)+".root" -process.TFileService = cms.Service("TFileService", - fileName = cms.string(filename) -) -process.output = cms.OutputModule("PoolOutputModule", - fileName = cms.untracked.string(options.output), - outputCommands = cms.untracked.vstring('drop *', - 'keep *_*_HGCALTBRAWHITS_*') -) - -process.rawhitproducer = cms.EDProducer("HGCalTBRawHitProducer", - InputCollection=cms.InputTag("source","skiroc2cmsdata"), - OutputCollectionName=cms.string("HGCALTBRAWHITS"), - ElectronicMap=cms.untracked.string(electronicMap), - SubtractPedestal=cms.untracked.bool(True), - HighGainPedestalFileName=cms.string(pedestalHighGain), - LowGainPedestalFileName=cms.string(pedestalLowGain) -) - -process.rawhitplotter = cms.EDAnalyzer("RawHitPlotter", - InputCollection=cms.InputTag("rawhitproducer","HGCALTBRAWHITS"), - ElectronicMap=cms.untracked.string(electronicMap), - SensorSize=cms.untracked.int32(128), - EventPlotter=cms.untracked.bool(False), - SubtractCommonMode=cms.untracked.bool(True) -) - - -process.p = cms.Path( process.rawhitproducer*process.rawhitplotter ) - -process.end = cms.EndPath(process.output) diff --git a/runPedestalEval.sh b/runPedestalEval.sh new file mode 100755 index 0000000..9014826 --- /dev/null +++ b/runPedestalEval.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +run=$1 + +path="/afs/cern.ch/work/r/rchatter/TestBeam_July/CMSSW_8_0_21/src/HGCal" +CFG="${path}/unpack2017_cfg.py" +TOP=${PWD} + +echo ${path} +echo ${CFG} + +cp ${CFG} ./cfg.py + +cd ${path} +eval `scramv1 runtime -sh` +cd ${TOP} + +eosPath="/eos/cms/store/group/dpg_hgcal/tb_hgcal/july2017/July2017_TB_data_orm" +echo "Download ${eosPath}/HexaData_Run${run}.raw" + +# THIS IS DO DOWNLOAD THE TIMING TXT FILES WHICH YOU DON'T NEED + echo "Download ${eosPath}/HexaData_Run${run}_TIMING_RDOUT_ORM0.txt" + xrdcp -f root://eoscms.cern.ch/${eosPath}/HexaData_Run${run}_TIMING_RDOUT_ORM0.txt HexaData_Run${run}_TIMING_RDOUT_ORM0.txt + echo "Download ${eosPath}/HexaData_Run${run}_TIMING_RDOUT_ORM1.txt" + xrdcp -f root://eoscms.cern.ch/${eosPath}/HexaData_Run${run}_TIMING_RDOUT_ORM1.txt HexaData_Run${run}_TIMING_RDOUT_ORM1.txt + echo "Download ${eosPath}/HexaData_Run${run}_TIMING_RDOUT_ORM2.txt" + xrdcp -f root://eoscms.cern.ch/${eosPath}/HexaData_Run${run}_TIMING_RDOUT_ORM2.txt HexaData_Run${run}_TIMING_RDOUT_ORM2.txt + +cmsRun unpack2017_cfg.py runNumber=${run} dataFolder="./" outputFolder="./" + +# THIS IS TO SAVE OUTPUT ON EOS : PLEASE DON'T DO THAT +# eosOutputPath="/eos/cms/store/group/dpg_hgcal/tb_hgcal/july2017/pedestalFiles" +# +# echo "Upload ${eosOutputPath}/PedestalOutput_${run}.root" +# xrdcp -f PedestalOutput_${run}.root root://eoscms.cern.ch/${eosOutputPath}/PedestalOutput_${run}.root +# echo "Upload ${eosOutputPath}/pedestalHG_${run}.txt" +# xrdcp -f pedestalHG_${run}.txt root://eoscms.cern.ch/${eosOutputPath}/pedestalHG_${run}.txt +# echo "Upload ${eosOutputPath}/pedestalLG_${run}.txt" +# xrdcp -f pedestalLG_${run}.txt root://eoscms.cern.ch/${eosOutputPath}/pedestalLG_${run}.txt +# +# eosOutputPath="/eos/cms/store/group/dpg_hgcal/tb_hgcal/july2017/HGCalTBSkiroc2CMS" +# echo "Upload ${eosOutputPath}/cmsswEvents_Run${run}.root" +# xrdcp -f cmsswEvents.root root://eoscms.cern.ch/${eosOutputPath}/cmsswEvents_Run${run}.root diff --git a/unpack2017_cfg.py b/unpack2017_cfg.py index f6a6bc4..33f7838 100644 --- a/unpack2017_cfg.py +++ b/unpack2017_cfg.py @@ -31,7 +31,7 @@ if not os.path.isdir(options.dataFolder): sys.exit("Error: Data folder not found or inaccessible!") -electronicMap="HGCal/CondObjects/data/map_CERN_Hexaboard_28Layers_AllFlipped.txt" +electronicMap="HGCal/CondObjects/data/map_CERN_Hexaboard_July_6Layers.txt" pedestalHighGain=options.outputFolder+"/pedestalHG_"+str(options.runNumber)+".txt" pedestalLowGain=options.outputFolder+"/pedestalLG_"+str(options.runNumber)+".txt" @@ -53,7 +53,7 @@ NumberOfBytesForTheTrailer=cms.untracked.uint32(4), NumberOfBytesForTheEventTrailers=cms.untracked.uint32(4), NSkipEvents=cms.untracked.uint32(0), - ReadTXTForTiming=cms.untracked.bool(True), + ReadTXTForTiming=cms.untracked.bool(False), timingFiles=cms.vstring("%s/HexaData_Run%04d_TIMING_RDOUT_ORM0.txt"%(options.dataFolder,options.runNumber), "%s/HexaData_Run%04d_TIMING_RDOUT_ORM1.txt"%(options.dataFolder,options.runNumber), "%s/HexaData_Run%04d_TIMING_RDOUT_ORM2.txt"%(options.dataFolder,options.runNumber))