From 5708122affc1746682354568b8f00c51d5c6f145 Mon Sep 17 00:00:00 2001 From: Rajdeep Date: Thu, 10 Aug 2017 02:11:55 +0200 Subject: [PATCH 1/2] Fixing error in Geometry, and corresponding codes to plot on TH2Poly --- Geometry/src/HGCalTBCellVertices.cc | 2 +- RawToDigi/plugins/PedestalPlotter.cc | 10 +++++----- RawToDigi/plugins/RawDataPlotter.cc | 2 +- RawToDigi/plugins/RawHitPlotter.cc | 10 +++++----- Reco/plugins/HGCalTBRecHitProducer.cc | 2 +- Reco/plugins/RecHitPlotter.cc | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) 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/RawToDigi/plugins/PedestalPlotter.cc b/RawToDigi/plugins/PedestalPlotter.cc index effd1aa..d2dc4af 100644 --- a/RawToDigi/plugins/PedestalPlotter.cc +++ b/RawToDigi/plugins/PedestalPlotter.cc @@ -275,16 +275,16 @@ void PedestalPlotter::endJob() float lgMean=iter->second.medianLG; float hgRMS=iter->second.rmsHG; float lgRMS=iter->second.rmsLG; - 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 ); if( m_writePedestalFile ){ pedestalHG << " " << hgMean << " " << hgRMS; pedestalLG << " " << lgMean << " " << lgRMS;; } } - chanMap[ iboard ]->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 ); From 79b24409494a61763642b2b5ac2d26f20818016a Mon Sep 17 00:00:00 2001 From: Rajdeep Date: Sat, 19 Aug 2017 02:12:28 +0200 Subject: [PATCH 2/2] Working towards enabling Multisensor layer geometry---DEBUGGING branch --- Geometry/src/HGCalTBTopology.cc | 11 ++-- RawToDigi/plugins/HGCalTBRawDataSource.cc | 3 + RawToDigi/plugins/PedestalPlotter.cc | 45 +++++++++++-- rawhitprod2017_cfg.py | 80 ----------------------- runPedestalEval.sh | 43 ++++++++++++ unpack2017_cfg.py | 4 +- 6 files changed, 92 insertions(+), 94 deletions(-) delete mode 100644 rawhitprod2017_cfg.py create mode 100755 runPedestalEval.sh 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<