diff --git a/EcalTiming/plugins/EcalTimingCalibProducer.cc b/EcalTiming/plugins/EcalTimingCalibProducer.cc index 9a77c3d..b421f02 100644 --- a/EcalTiming/plugins/EcalTimingCalibProducer.cc +++ b/EcalTiming/plugins/EcalTimingCalibProducer.cc @@ -145,7 +145,8 @@ class EcalTimingCalibProducer : public edm::ESProducerLooper edm::InputTag _ecalRecHitsEETAG; std::vector _recHitFlags; ///< vector containing list of valid rec hit flags for calibration unsigned int _recHitMin; ///< require at least this many rec hits to count the event - float _minRecHitEnergy; ///< minimum energy for the recHit to be considered for timing studies + double _minRecHitEnergy; ///< minimum energy for the recHit to be considered for timing studies + unsigned int _minEntries; ///< require a minimum number of entries in a ring to do averages float _globalOffset; ///< time to subtract from every event bool _produceNewCalib; ///< true if you don't want to use the values in DB and what to extract new absolute calibrations, if false iteration does not work std::string _outputDumpFileName; ///< name of the output file for the calibration constants' dump @@ -298,7 +299,8 @@ EcalTimingCalibProducer::EcalTimingCalibProducer(const edm::ParameterSet& iConfi _ecalRecHitsEETAG(iConfig.getParameter("recHitEECollection")), _recHitFlags(iConfig.getParameter >("recHitFlags")), _recHitMin(iConfig.getParameter("recHitMinimumN")), - _minRecHitEnergy(iConfig.getParameter("minRecHitEnergy")), + _minRecHitEnergy(iConfig.getParameter("minRecHitEnergy")), + _minEntries(iConfig.getParameter("minEntries")), _globalOffset(iConfig.getParameter("globalOffset")), _produceNewCalib(iConfig.getParameter("produceNewCalib")), _outputDumpFileName(iConfig.getParameter("outputDumpFile")), @@ -418,10 +420,8 @@ bool EcalTimingCalibProducer::addRecHit(const EcalRecHit& recHit) void EcalTimingCalibProducer::plotRecHit(const EcalTimingEvent& recHit) { - std::cout<<"I'm in PlotrecHit"<Fill(id.ieta(), id.iphi(), recHit.energy()); // 2D energy map Event_TimeMapEB_->Fill(id.ieta(), id.iphi(), recHit.time()); // 2D time map @@ -429,7 +429,6 @@ void EcalTimingCalibProducer::plotRecHit(const EcalTimingEvent& recHit) } else { // create EEDetId EEDetId id(recHit.detid()); - std::cout<<"filling histos for rechit: "<Fill(id.ix(), id.iy(), recHit.energy()); Event_TimeMapEEM_->Fill(id.ix(), id.iy(), recHit.time()); @@ -510,9 +509,10 @@ EcalTimingCalibProducer::Status EcalTimingCalibProducer::duringLoop(const edm::E #endif // If we got less than the minimum recHits, continue if(eventTimeMap_.size() < _recHitMin) return kContinue; - if(timeEB.num() < 4) return kContinue; - if(timeEEM.num() < 4 && timeEEP.num() < 4) return kContinue; + if(timeEB.num() + timeEEM.num() + timeEEP.num() < _minEntries) return kContinue; +#ifdef DEBUG std::cout << "[DUMP]\t" << timeEB << "\t" << timeEEM << "\t" << timeEEP << std::endl; +#endif // Make a new directory for Histograms for each event char eventDirName[100]; if(_makeEventPlots) { @@ -539,8 +539,7 @@ EcalTimingCalibProducer::Status EcalTimingCalibProducer::duringLoop(const edm::E continue; } - plotRecHit(event); - //if(_makeEventPlots) plotRecHit(event); + if(_makeEventPlots) plotRecHit(event); _timeCalibMap[it.first].add(event); } diff --git a/EcalTiming/test/ecalTime_fromAlcaStream_cfg.py b/EcalTiming/test/ecalTime_fromAlcaStream_cfg.py index 6c9917b..cda4b9d 100644 --- a/EcalTiming/test/ecalTime_fromAlcaStream_cfg.py +++ b/EcalTiming/test/ecalTime_fromAlcaStream_cfg.py @@ -23,9 +23,14 @@ "0=false, 1=true" ) ### setup any defaults you want +streamName = "AlCaPhiSym" options.output="ecalTiming.root" options.secondaryOutput="ntuple.root" -options.files= "/store/data/Commissioning2015/AlCaPhiSym/RAW/v1/000/244/768/00000/A8219906-44FD-E411-8DA9-02163E0121C5.root" +if(streamName=="AlCaP0"): options.files = "/store/data/Commissioning2015/AlCaP0/RAW/v1/000/246/342/00000/048ECF48-F906-E511-95AC-02163E011909.root" +elif(streamName=="AlCaPhiSym"): options.files = "/store/data/Commissioning2015/AlCaPhiSym/RAW/v1/000/244/768/00000/A8219906-44FD-E411-8DA9-02163E0121C5.root" +else: + print "stream ",streamName," not foreseen" + exit options.maxEvents = -1 # -1 means all events ### get and parse the command line arguments options.parseArguments() @@ -43,6 +48,7 @@ process.load('Configuration.StandardSequences.GeometryRecoDB_cff') process.load('Configuration.StandardSequences.MagneticField_38T_cff') + if(options.isSplash==1): ## Get Cosmic Reconstruction process.load('Configuration/StandardSequences/ReconstructionCosmics_cff') @@ -63,6 +69,14 @@ process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff') process.load('EcalTiming.EcalTiming.ecalLocalRecoSequenceAlCaStream_cff') +if(streamName=="AlCaP0"): + process.ecalMultiFitUncalibRecHit.EBdigiCollection = cms.InputTag("hltAlCaPi0EBRechitsToDigis","pi0EBDigis") + process.ecalMultiFitUncalibRecHit.EEdigiCollection = cms.InputTag("hltAlCaPi0EERechitsToDigis","pi0EEDigis") +else: + process.ecalMultiFitUncalibRecHit.EBdigiCollection = cms.InputTag("HLTEcalPhiSymFilter","phiSymEcalDigisEB") + process.ecalMultiFitUncalibRecHit.EEdigiCollection = cms.InputTag("HLTEcalPhiSymFilter","phiSymEcalDigisEE") + + ## Raw to Digi process.load('Configuration/StandardSequences/RawToDigi_Data_cff') @@ -187,16 +201,18 @@ ### Schedule ### process.schedule = cms.Schedule(process.p) # , process.endp) +evtPlots = True if options.isSplash else False process.looper = cms.Looper("EcalTimingCalibProducer", maxLoop = cms.uint32(2), isSplash = cms.bool(True if options.isSplash == 1 else False), - makeEventPlots = cms.bool(True), + makeEventPlots = cms.bool(evtPlots), recHitEBCollection = cms.InputTag("ecalRecHit","EcalRecHitsEB"), recHitEECollection = cms.InputTag("ecalRecHit","EcalRecHitsEE"), recHitFlags = cms.vint32([0]), # only recHits with these flags are accepted for calibration - recHitMinimumN = cms.uint32(10), - #recHitMinimumN = cms.uint32(2), - minRecHitEnergy = cms.double(0), + #recHitMinimumN = cms.uint32(10), + recHitMinimumN = cms.uint32(2), + minRecHitEnergy = cms.double(1), + minEntries = cms.uint32(1), globalOffset = cms.double(options.offset), produceNewCalib = cms.bool(True), outputDumpFile = process.TFileService.fileName,