Skip to content

Commit

Permalink
Renamed folder
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrothman committed Oct 21, 2021
1 parent b1bd05d commit 81f4301
Show file tree
Hide file tree
Showing 22 changed files with 170 additions and 59 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ DBFiles/*
#*#
*~
*.pb
*.json
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void DRNProducer::acquire(edm::Event const& iEvent, edm::EventSetup const& iSetu
// edm::LogPrint(debugName_) << std::endl;
// edm::LogPrint(debugName_) << "acquiring..." << std::endl;
auto inputSCs = iEvent.get(inputSCToken_);
edm::LogPrint("test") << "nSCs = " << inputSCs.size();
// edm::LogPrint("test") << "nSCs = " << inputSCs.size();
//}
if(inputSCs.size()==0){
client_->setBatchSize(0);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

process.load("Configuration.StandardSequences.GeometryRecoDB_cff")

process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10) )
process.options.numberOfThreads = cms.untracked.uint32(1)
process.options.numberOfStreams = cms.untracked.uint32(1)
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1000) )
#process.options.numberOfThreads = cms.untracked.uint32(4)
#process.options.numberOfStreams = cms.untracked.uint32(8)
process.options.SkipEvent = cms.untracked.vstring('ProductNotFound')

process.TritonService.verbose = True
Expand All @@ -21,7 +21,7 @@
process.TritonService.fallback.useGPU = False


process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(1)
process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(100)

options = VarParsing.VarParsing('standard')

Expand All @@ -40,7 +40,9 @@
# replace 'myfile.root' with the source file you want to use
fileNames = cms.untracked.vstring(
#'root://cms-xrd-global.cern.ch///store/mc/RunIISummer19UL18RECO/DYJetsToEE_M-50_TuneCP5_13TeV-madgraphMLM-pythia8/AODSIM/NoPUECAL4BX25_106X_upgrade2018_realistic_v11_Ecal4-v2/20000/D2F029DD-CACC-AA48-BC51-D1987DD92E26.root'
"file:testfile.root"
#"file:testfile.root"
'root://cms-xrd-global.cern.ch///store/mc/RunIISummer19UL18RECO/GJet_Pt-20toInf_DoubleEMEnriched_MGG-40to80_TuneCP5_13TeV_Pythia8/AODSIM/106X_upgrade2018_realistic_v11_L1v1-v2/10000/755C8490-4B61-E648-8984-4ED4CF3D3873.root'

)
)

Expand Down Expand Up @@ -122,7 +124,7 @@
electrons = cms.InputTag('gedGsfElectrons'),
mightGet = cms.optional.untracked.vstring,
Client = cms.PSet(
mode = cms.string("Sync"),
mode = cms.string("Async"),
preferredServer = cms.untracked.string(""),
timeout = cms.untracked.uint32(10),
modelName = cms.string("EGM_DRN"),
Expand Down Expand Up @@ -167,7 +169,7 @@
writeFeatures = cms.bool(False),
mightGet = cms.optional.untracked.vstring,
Client = cms.PSet(
mode = cms.string("Sync"),
mode = cms.string("Async"),
preferredServer = cms.untracked.string(""),
timeout = cms.untracked.uint32(10),
modelName = cms.string('EGM_DRN'),
Expand Down Expand Up @@ -225,6 +227,49 @@
closeFileFast = cms.untracked.bool(True)
)

process.load( "HLTrigger.Timer.FastTimerService_cfi" )

process.FastTimerService = cms.Service( "FastTimerService",
dqmPath = cms.untracked.string( "timer" ),
dqmModuleTimeRange = cms.untracked.double( 40.0 ),
enableDQMbyPath = cms.untracked.bool( True ),
writeJSONSummary = cms.untracked.bool( True ),
dqmPathMemoryResolution = cms.untracked.double( 5000.0 ),
enableDQM = cms.untracked.bool( True ),
enableDQMbyModule = cms.untracked.bool( True ),
dqmModuleMemoryRange = cms.untracked.double( 100000.0 ),
dqmModuleMemoryResolution = cms.untracked.double( 500.0 ),
dqmMemoryResolution = cms.untracked.double( 5000.0 ),
enableDQMbyLumiSection = cms.untracked.bool( True ),
dqmPathTimeResolution = cms.untracked.double( 0.5 ),
printEventSummary = cms.untracked.bool( False ),
dqmPathTimeRange = cms.untracked.double( 100.0 ),
dqmTimeRange = cms.untracked.double( 2000.0 ),
enableDQMTransitions = cms.untracked.bool( False ),
dqmPathMemoryRange = cms.untracked.double( 1000000.0 ),
dqmLumiSectionsRange = cms.untracked.uint32( 2500 ),
enableDQMbyProcesses = cms.untracked.bool( True ),
dqmMemoryRange = cms.untracked.double( 1000000.0 ),
dqmTimeResolution = cms.untracked.double( 5.0 ),
printRunSummary = cms.untracked.bool( False ),
dqmModuleTimeResolution = cms.untracked.double( 0.2 ),
printJobSummary = cms.untracked.bool( True ),
)

process.ThroughputService = cms.Service( "ThroughputService",
dqmPath = cms.untracked.string( "throughput" ),
eventRange = cms.untracked.uint32( 10000 ),
timeRange = cms.untracked.double( 60000.0 ),
printEventSummary = cms.untracked.bool( True ),
eventResolution = cms.untracked.uint32( 100 ),
enableDQM = cms.untracked.bool( True ),
dqmPathByProcesses = cms.untracked.bool( True ),
timeResolution = cms.untracked.double( 5.828 )
)

process.dqmOutput = cms.OutputModule("DQMRootOutputModule",
fileName = cms.untracked.string("DQM.root")
)

#process.p = cms.Path(process.DRNProducerEB*process.egmGsfElectronIDSequence*process.nTuplelize)

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ void Electron_RecHit_NTuplizer::TreeSetSingleElectronVar(const reco::GsfElectron
else if( (*sc->seed()).hitsAndFractions().at(0).first.subdetId() == EcalEndcap)
_mustEnergySCEle[index] = GetMustEnergy(electron, 0);

edm::LogPrint("test") << "rawE = " << _rawEnergySCEle[index] << std::endl;
edm::LogPrint("test") << "mustE = " << _mustEnergySCEle[index] << std::endl;
edm::LogPrint("test") << "energy = " << _energy_ECAL_ele[index] << std::endl;
// edm::LogPrint("test") << "rawE = " << _rawEnergySCEle[index] << std::endl;
// edm::LogPrint("test") << "mustE = " << _mustEnergySCEle[index] << std::endl;
// edm::LogPrint("test") << "energy = " << _energy_ECAL_ele[index] << std::endl;
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// -*- C++ -*-
//
// Package: Electron_GNN_Regression/Ecal_NTuplizer
// Class: Ecal_NTuplizer
// Package: Electron_GNN_Regression/Electron_RecHitNTuplizer2
// Class: Electron_RecHitNTuplizer2
//
/**\class Ecal_NTuplizer Ecal_NTuplizer.cc Electron_GNN_Regression/Ecal_NTuplizer/plugins/Ecal_NTuplizer.cc
/**\class Electron_RecHitNTuplizer2 Electron_RecHitNTuplizer2.cc Electron_GNN_Regression/Electron_RecHitNTuplizer2/plugins/Electron_RecHitNTuplizer2.cc
Description: [one line class summary]
Expand Down Expand Up @@ -85,10 +85,10 @@

using reco::TrackCollection;

class Ecal_NTuplizer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
class Electron_RecHitNTuplizer2 : public edm::one::EDAnalyzer<edm::one::SharedResources> {
public:
explicit Ecal_NTuplizer(const edm::ParameterSet&);
~Ecal_NTuplizer();
explicit Electron_RecHitNTuplizer2(const edm::ParameterSet&);
~Electron_RecHitNTuplizer2();

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

Expand Down Expand Up @@ -196,7 +196,7 @@ class Ecal_NTuplizer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
//
// constructors and destructor
//
Ecal_NTuplizer::Ecal_NTuplizer(const edm::ParameterSet& iConfig):
Electron_RecHitNTuplizer2::Electron_RecHitNTuplizer2(const edm::ParameterSet& iConfig):
_vtxCollectionToken(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexCollection"))),
rhoToken_(consumes<double>(iConfig.getParameter<edm::InputTag>("rhoFastJet"))),
_pileupInfoToken(consumes<std::vector<PileupSummaryInfo>>(iConfig.getParameter<edm::InputTag>("pileupInfo"))),
Expand All @@ -216,7 +216,7 @@ Ecal_NTuplizer::Ecal_NTuplizer(const edm::ParameterSet& iConfig):
}


Ecal_NTuplizer::~Ecal_NTuplizer()
Electron_RecHitNTuplizer2::~Electron_RecHitNTuplizer2()
{

// do anything here that needs to be done at desctruction time
Expand All @@ -234,7 +234,7 @@ Ecal_NTuplizer::~Ecal_NTuplizer()

// ------------ method called for each event ------------
void
Ecal_NTuplizer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
Electron_RecHitNTuplizer2::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
{
using namespace edm;
using namespace std;
Expand Down Expand Up @@ -271,30 +271,38 @@ Ecal_NTuplizer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
///////////////////////////Fill Electron/Photon related stuff/////////////////////////////////////////////////////

bool doFill = false;
for (size_t i = 0; i < electrons->size(); i++){

const auto ele1 = electrons->ptrAt(i);
if(!(ele1->ecalDrivenSeed())) continue;
if(ele1->parentSuperCluster().isNull()) continue;
if( ele1->pt() < 15. ) continue;
if(!(*loose_id_decisions)[ele1]) continue;
for (size_t j = i+1; j < electrons->size() && doFill == false; j++){

const auto ele2 = electrons->ptrAt(j);
if(!(ele2->ecalDrivenSeed())) continue;
if(ele2->parentSuperCluster().isNull()) continue;
if( ele2->pt() < 15. ) continue;
double t1 = TMath::Exp(-ele1->eta());
double t1q = t1 * t1;
double t2 = TMath::Exp(-ele2->eta());
double t2q = t2 * t2;
double angle = 1 - ( (1 - t1q) * (1 - t2q) + 4 * t1 * t2 * cos(ele1->phi() - ele2->phi())) / ( (1 + t1q) * (1 + t2q) );
double mass = sqrt(2 * ele1->energy() * ele2->energy() * angle);
if(mass < 55 ) continue;
if (electrons->size()<2)
return;


//for (size_t i = 0; i < electrons->size(); i++){

const auto ele1 = electrons->ptrAt(0);
const auto ele2 = electrons->ptrAt(1);
if(!(ele1->ecalDrivenSeed())) return;
if(ele1->parentSuperCluster().isNull()) return;
if(!(ele2->ecalDrivenSeed())) return;
if(ele2->parentSuperCluster().isNull()) return;
//if( ele1->pt() < 15. ) continue;
//if(!(*loose_id_decisions)[ele1]) continue;
//for (size_t j = i+1; j < electrons->size() && doFill == false; j++){
//
// const auto ele2 = electrons->ptrAt(j);
// if(!(ele2->ecalDrivenSeed())) continue;
// if(ele2->parentSuperCluster().isNull()) continue;
// if( ele2->pt() < 15. ) continue;
// double t1 = TMath::Exp(-ele1->eta());
// double t1q = t1 * t1;
// double t2 = TMath::Exp(-ele2->eta());
// double t2q = t2 * t2;
// double angle = 1 - ( (1 - t1q) * (1 - t2q) + 4 * t1 * t2 * cos(ele1->phi() - ele2->phi())) / ( (1 + t1q) * (1 + t2q) );
// double mass = sqrt(2 * ele1->energy() * ele2->energy() * angle);
// if(mass < 55 ) continue;
doFill = true;
TreeSetDiElectronVar(*ele1, *ele2);
}
}
//edm::LogPrint("test") << "gen: " << genParticles->ptrAt(0)->energy() << std::endl;
TreeSetDiElectronVar(*(electrons->ptrAt(0)), *(electrons->ptrAt(1)));
// }
// }

if(doFill) _tree->Fill(); // Write out the events

Expand All @@ -307,7 +315,7 @@ Ecal_NTuplizer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)

// ------------ method called once each job just before starting event loop ------------
void
Ecal_NTuplizer::beginJob()
Electron_RecHitNTuplizer2::beginJob()
{
edm::Service<TFileService> fs;
_tree=fs->make<TTree>("selected", "selected");
Expand All @@ -316,7 +324,7 @@ Ecal_NTuplizer::beginJob()

// ------------ method called once each job just after ending the event loop ------------
void
Ecal_NTuplizer::endJob()
Electron_RecHitNTuplizer2::endJob()
{
}

Expand All @@ -327,7 +335,7 @@ Ecal_NTuplizer::endJob()

// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
void
Ecal_NTuplizer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
Electron_RecHitNTuplizer2::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
//The following says we do not know what parameters are allowed so do no validation
// Please change this to state exactly what you do use, even if it is no parameters
edm::ParameterSetDescription desc;
Expand All @@ -341,14 +349,14 @@ Ecal_NTuplizer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
//descriptions.addDefault(desc);
}

void Ecal_NTuplizer::TreeSetDiElectronVar(const reco::GsfElectron& electron1, const reco::GsfElectron& electron2){
void Electron_RecHitNTuplizer2::TreeSetDiElectronVar(const reco::GsfElectron& electron1, const reco::GsfElectron& electron2){

TreeSetSingleElectronVar(electron1, 0);
TreeSetSingleElectronVar(electron2, 1);

}

void Ecal_NTuplizer::TreeSetSingleElectronVar(const reco::GsfElectron& electron, int index){
void Electron_RecHitNTuplizer2::TreeSetSingleElectronVar(const reco::GsfElectron& electron, int index){

if(index < 0) {
_chargeEle[-index] = -100;
Expand Down Expand Up @@ -396,11 +404,14 @@ void Ecal_NTuplizer::TreeSetSingleElectronVar(const reco::GsfElectron& electron,
else if( (*sc->seed()).hitsAndFractions().at(0).first.subdetId() == EcalEndcap)
_mustEnergySCEle[index] = GetMustEnergy(electron, 0);

// edm::LogPrint("test") << "rawE = " << _rawEnergySCEle[index] << std::endl;
// edm::LogPrint("test") << "mustE = " << _mustEnergySCEle[index] << std::endl;
// edm::LogPrint("test") << "energy = " << _energy_ECAL_ele[index] << std::endl;
}



void Ecal_NTuplizer::InitNewTree()
void Electron_RecHitNTuplizer2::InitNewTree()
{
std::cout << "[STATUS] InitNewTree" << std::endl;
if(_tree == NULL) return;
Expand Down Expand Up @@ -435,7 +446,7 @@ void Ecal_NTuplizer::InitNewTree()
}


void Ecal_NTuplizer::ResetMainTreeVar()
void Electron_RecHitNTuplizer2::ResetMainTreeVar()
{
for (int i = 0; i < NELE; ++i) {
_eleID[i] = initSingleInt;
Expand All @@ -457,7 +468,7 @@ void Ecal_NTuplizer::ResetMainTreeVar()

}

void Ecal_NTuplizer::TreeSetEventSummaryVar(const edm::Event& iEvent)
void Electron_RecHitNTuplizer2::TreeSetEventSummaryVar(const edm::Event& iEvent)
{
_eventTimeStamp = iEvent.eventAuxiliary().time();
_eventTime = (UInt_t) _eventTimeStamp.unixTime();
Expand All @@ -473,8 +484,13 @@ void Ecal_NTuplizer::TreeSetEventSummaryVar(const edm::Event& iEvent)
}


float Ecal_NTuplizer::GetMustEnergy(const reco::GsfElectron& electron, bool isEB){
float Electron_RecHitNTuplizer2::GetMustEnergy(const reco::GsfElectron& electron, bool isEB){

//for( reco::SuperClusterCollection::const_iterator iter = _EBSuperClustersHandle->begin();
// iter != _EBSuperClustersHandle->end();
// ++iter) {
// return iter->energy();
//}

if(isEB){
for( reco::SuperClusterCollection::const_iterator iter = _EBSuperClustersHandle->begin();
Expand All @@ -484,6 +500,7 @@ float Ecal_NTuplizer::GetMustEnergy(const reco::GsfElectron& electron, bool isEB
return iter->energy();

}
return -9;
} else{

for( reco::SuperClusterCollection::const_iterator iter1 = _EESuperClustersHandle->begin();
Expand All @@ -492,13 +509,12 @@ float Ecal_NTuplizer::GetMustEnergy(const reco::GsfElectron& electron, bool isEB
if( fabs(electron.parentSuperCluster()->rawEnergy() - iter1->rawEnergy()) < 1E-6 )
return iter1->energy();
}
return -99.;
}

return -999.;

}

void Ecal_NTuplizer::TreeSetPileupVar(void)
void Electron_RecHitNTuplizer2::TreeSetPileupVar(void)
{
_rho = *rhoHandle;
_nPV = 255;
Expand All @@ -525,4 +541,4 @@ void Ecal_NTuplizer::TreeSetPileupVar(void)
}

//define this as a plug-in
DEFINE_FWK_MODULE(Ecal_NTuplizer);
DEFINE_FWK_MODULE(Electron_RecHitNTuplizer2);
Loading

0 comments on commit 81f4301

Please sign in to comment.