97 : doGenPlots_(iConfig.getParameter<
bool>(
"MakeGenPlots")),
98 doHLTPlots_(iConfig.getParameter<
bool>(
"MakeHLTPlots")),
99 doSimTrackPlots_(iConfig.getParameter<
bool>(
"MakeSimTrackPlots")),
100 doSimDigiPlots_(iConfig.getParameter<
bool>(
"MakeSimDigiPlots")),
101 doRecoPlots_(iConfig.getParameter<
bool>(
"MakeRecoPlots")),
106 dEdxTrackToken_(consumes<
edm::ValueMap<
reco::DeDxData> >(
edm::
InputTag(
"dedxHarmonic2"))),
109 particleIds_(iConfig.getParameter<
std::vector<
int> >(
"particleIds")),
110 particleStatus_(iConfig.getUntrackedParameter<
int>(
"particleStatus", 1)),
131 fileService->
make<TH1F>(
"hscp_scaloret_nohscp",
"scalor E_{T} sum w/o hscp", 100, 0., 1500.);
136 fileService->
make<TH1F>(
"simTrackParticlePhi",
"Phi of simTrackParticle", 180, -3.15, 3.15);
151 fileService->
make<TH1F>(
"ecalEnergyOfSimHitsEB",
"HSCP SimTrack-matching SimHit energy EB [GeV]", 125, -1, 4);
153 fileService->
make<TH1F>(
"ecalEnergyOfSimHitsEE",
"HSCP SimTrack-matching SimHit energy EE [GeV]", 125, -1, 4);
155 fileService->
make<TH1F>(
"ecalTimingOfSimHitsEB",
"HSCP SimTrack-matching SimHit time EB [ns]", 115, -15, 100);
157 fileService->
make<TH1F>(
"ecalTimingOfSimHitsEE",
"HSCP SimTrack-matching SimHit time EE [ns]", 115, -15, 100);
159 "ecalNumberOfSimHitsEB",
"Number of HSCP SimTrack-matching EB sim hits in event", 100, 0, 200);
161 "ecalNumberOfSimHitsEE",
"Number of HSCP SimTrack-matching EE sim hits in event", 100, 0, 200);
164 "Energy vs. time of HSCP SimTrack-matching EB sim hits in event",
173 "Energy vs. time of HSCP SimTrack-matching EE sim hits in event",
181 fileService->
make<TH1F>(
"ecalEnergyOfDigiMatSimHitsEB",
"HSCP digi-matching SimHit energy EB [GeV]", 125, -1, 4);
183 fileService->
make<TH1F>(
"ecalEnergyOfDigiMatSimHitsEE",
"HSCP digi-matching SimHit energy EE [GeV]", 125, -1, 4);
185 fileService->
make<TH1F>(
"ecalTimingOfDigiMatSimHitsEB",
"HSCP digi-matching SimHit time EB [ns]", 115, -15, 100);
187 fileService->
make<TH1F>(
"ecalTimingOfDigiMatSimHitsEE",
"HSCP digi-matching SimHit time EE [ns]", 115, -15, 100);
189 "ecalEnergyVsTimeOfDigiMatSimHitsEB",
"HSCP digi-matching EB SimHit energy vs. time", 115, -15, 100, 125, -1, 4);
191 "ecalEnergyVsTimeOfDigiMatSimHitsEE",
"HSCP digi-matching EE SimHit energy vs. time", 115, -15, 100, 125, -1, 4);
193 fileService->
make<TH1F>(
"ecalIEtaOfDigiMatchSimHits",
"iEta of digi-matching Ecal simHits (EB)", 171, -85, 86);
195 fileService->
make<TH1F>(
"ecalIPhiOfDigiMatchSimHits",
"iPhi of digi-matching Ecal simHits (EB)", 360, 1, 361);
197 fileService->
make<TH1F>(
"ecalDigisNumberEB",
"Number of EB digis matching simhits in event", 200, 0, 1000);
199 fileService->
make<TH1F>(
"ecalDigisNumberEE",
"Number of EE digis matching simhits in event", 200, 0, 1000);
201 "ecalDigiOccupancyMapEB",
"Occupancy of simhit-matching digis EB;i#phi;i#eta", 360, 1, 361, 171, -85, 86);
203 "ecalDigiOccupancyMapEEM",
"Occupancy of simhit-matching digis EEM;ix;iy", 100, 1, 100, 100, 1, 100);
205 "ecalDigiOccupancyMapEEP",
"Occupancy of simhit-matching digis EEP;ix;iy", 100, 1, 100, 100, 1, 100);
209 fileService->
make<TH1F>(
"residualsRPCRecHitSimDigis",
"HSCP SimHit - Clossest RPC RecHit", 100, -5, 5);
211 fileService->
make<TH1F>(
"efficiencyRPCRecHitSimDigis",
"HSCP SimHits RecHits Efficiency", 2, -0.5, 1.5);
279 frequencies +=
"PDG ID: ";
281 frequencies +=
" Frequency: ";
287 << frequencies << std::endl;
294 double missingpx = 0;
295 double missingpy = 0;
296 double missingpx_nohscp = 0;
297 double missingpy_nohscp = 0;
299 double scalorEt_nohscp = 0;
305 for (HepMC::GenEvent::particle_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end(); ++
p) {
309 if (
abs((*p)->pdg_id()) != 12 &&
abs((*p)->pdg_id()) != 14 &&
310 abs((*p)->pdg_id()) != 16) {
311 missingpx -= (*p)->momentum().px();
312 missingpy -= (*p)->momentum().py();
313 scalorEt += (*p)->momentum().perp();
320 if (
abs((*p)->pdg_id()) != 12 &&
abs((*p)->pdg_id()) != 14 &&
321 abs((*p)->pdg_id()) != 16) {
322 missingpx_nohscp -= (*p)->momentum().px();
323 missingpy_nohscp -= (*p)->momentum().py();
324 scalorEt_nohscp += (*p)->momentum().perp();
329 std::pair<std::map<int, int>::iterator,
bool> pair =
332 ++(pair.first->second);
335 double mag =
sqrt(
pow((*p)->momentum().px(), 2) +
pow((*p)->momentum().py(), 2) +
pow((*p)->momentum().pz(), 2));
341 float particleP =
mag;
342 float particleM = (*p)->generated_mass();
364 SimTrackContainer::const_iterator
simTrack;
397 std::cout <<
"Trigger Results not available" << std::endl;
404 unsigned int TrIndex_Unknown = tr.
size();
407 if (TrIndex_Unknown != tr.
triggerIndex(
"HLT_Mu40_v1")) {
414 if (TrIndex_Unknown != tr.
triggerIndex(
"HLT_Mu30_v1")) {
420 printf(
"BUG with HLT_Mu\n");
422 for (
unsigned int i = 0;
i < tr.
size();
i++) {
430 if (TrIndex_Unknown != tr.
triggerIndex(
"HLT_PFMHT150_v3")) {
436 if (TrIndex_Unknown != tr.
triggerIndex(
"HLT_PFMHT150_v2")) {
442 printf(
"BUG with HLT_MET\n");
447 if (TrIndex_Unknown != tr.
triggerIndex(
"HLT_Jet370_v1")) {
453 if (TrIndex_Unknown != tr.
triggerIndex(
"HLT_Jet100U")) {
471 printf(
"BUG with HLT_Jet\n");
485 std::cout <<
"Cannot get EBSimHits from event!" << std::endl;
492 std::cout <<
"Cannot get EESimHits from event!" << std::endl;
499 std::cout <<
"Cannot get SimTracks from event!" << std::endl;
506 std::cout <<
"Cannot get EBDigis from event!" << std::endl;
513 std::cout <<
"Cannot get EEDigis from event!" << std::endl;
521 int numMatchedSimHitsEventEB = 0;
522 int numMatchedDigisEventEB = 0;
532 std::vector<EBDataFrame> myDigisEB;
536 PCaloHitContainer::const_iterator simHitItr = phitsEB->begin();
537 while (simHitItr != phitsEB->end()) {
538 if (simHitItr->geantTrackId() == trackId)
539 mySimHitsEB.push_back(*simHitItr);
542 if (mySimHitsEB.empty()) {
543 std::cout <<
"Could not find matching EB PCaloHits for SimTrack id: " << trackId <<
". Skipping this SimTrack"
549 for (simHitItr = mySimHitsEB.begin(); simHitItr != mySimHitsEB.end(); ++simHitItr) {
554 std::cout <<
"SimHit DetId found: " << simHitId <<
" for PDGid: " <<
simTrack->type() << std::endl;
556 std::cout <<
"SimHit energy: " << simHitItr->energy() <<
" time: " << simHitItr->time() << std::endl;
557 ++numMatchedSimHitsEventEB;
560 while (digiItr != ebDigis->
end() && (digiItr->id() != simHitId))
562 if (digiItr == ebDigis->
end()) {
564 std::cout <<
"Could not find simHit detId: " << simHitId <<
"in EBDigiCollection!" << std::endl;
567 std::vector<EBDataFrame>::const_iterator myDigiItr = myDigisEB.begin();
568 while (myDigiItr != myDigisEB.end() && (digiItr->id() != myDigiItr->id()))
570 if (myDigiItr != myDigisEB.end())
573 ++numMatchedDigisEventEB;
575 myDigisEB.push_back(df);
578 for (
int i = 0;
i < 10; ++
i)
581 for (
int i = 0;
i < df.
size(); ++
i) {
598 int numMatchedSimHitsEventEE = 0;
599 int numMatchedDigisEventEE = 0;
609 std::vector<EEDataFrame> myDigisEE;
613 PCaloHitContainer::const_iterator simHitItr = phitsEE->begin();
614 while (simHitItr != phitsEE->end()) {
615 if (simHitItr->geantTrackId() == trackId)
616 mySimHitsEE.push_back(*simHitItr);
619 if (mySimHitsEE.empty()) {
620 std::cout <<
"Could not find matching EE PCaloHits for SimTrack id: " << trackId <<
". Skipping this SimTrack"
626 for (simHitItr = mySimHitsEE.begin(); simHitItr != mySimHitsEE.end(); ++simHitItr) {
631 std::cout <<
"SimHit DetId found: " << simHitId <<
" for PDGid: " <<
simTrack->type() << std::endl;
633 std::cout <<
"SimHit energy: " << simHitItr->energy() <<
" time: " << simHitItr->time() << std::endl;
634 ++numMatchedSimHitsEventEE;
637 while (digiItr !=
eeDigis->end() && (digiItr->id() != simHitId))
639 if (digiItr ==
eeDigis->end()) {
641 std::cout <<
"Could not find simHit detId: " << simHitId <<
"in EEDigiCollection!" << std::endl;
644 std::vector<EEDataFrame>::const_iterator myDigiItr = myDigisEE.begin();
645 while (myDigiItr != myDigisEE.end() && (digiItr->id() != myDigiItr->id()))
647 if (myDigiItr != myDigisEE.end())
650 ++numMatchedDigisEventEE;
652 myDigisEE.push_back(df);
655 for (
int i = 0;
i < 10; ++
i)
658 for (
int i = 0;
i < df.
size(); ++
i) {
678 using namespace reco;
689 const ValueMap<DeDxData> dEdxTrack = *dEdxTrackHandle.
product();
691 for (
size_t i = 0;
i < tkTracks->size();
i++) {
694 if (trkRef->pt() < 5 || trkRef->normalizedChi2() > 10)
698 double hscpgenPt = -1;
701 for (HepMC::GenEvent::particle_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end(); ++
p) {
709 pow((*p)->momentum().eta() - trkRef->eta(), 2) +
pow((*p)->momentum().phi() - trkRef->phi(), 2);
713 hscpgenPt = (*p)->momentum().perp();
720 double dedx = dEdxTrack[trkRef].dEdx();
721 dedxVsp->Fill(trkRef->p(), dedx);
730 std::vector<Handle<edm::PSimHitContainer> > theSimHitContainers;
731 iEvent.getManyByType(theSimHitContainers);
738 std::vector<PSimHit> theSimHits;
740 for (
int i = 0;
i <
int(theSimHitContainers.size());
i++) {
741 theSimHits.insert(theSimHits.end(), theSimHitContainers.at(
i)->begin(), theSimHitContainers.at(
i)->end());
744 for (std::vector<PSimHit>::const_iterator iHit = theSimHits.begin(); iHit != theSimHits.end(); iHit++) {
749 DetId theDetUnitId((*iHit).detUnitId());
764 GlobalPoint SimHitInGlobal = RPCSurface.toGlobal((*iHit).localPosition());
766 std::cout <<
"\t\t We have an RPC Sim Hit! in t=" << (*iHit).timeOfFlight() <<
"ns " << rpcsrv.
name()
767 <<
" Global postition=" << SimHitInGlobal << std::endl;
779 else if (rollId.
station() == 3)
781 else if (rollId.
station() == 4)
784 if (rollId.
region() == 0) {
790 std::cout <<
"\t\t r=" << SimHitInGlobal.
mag() <<
" phi=" << SimHitInGlobal.
phi()
791 <<
" eta=" << SimHitInGlobal.
eta() << std::endl;
795 float minres = 3000.;
797 std::cout <<
"\t \t \t \t Getting RecHits in Roll Asociated" << std::endl;
799 typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits;
800 rangeRecHits recHitCollection =
rpcRecHits->get(rollId);
807 float res = (*iHit).localPosition().x() - recHitPos.
x();
808 if (fabs(
res) < fabs(minres)) {
810 cluSize =
recHit->clusterSize();
812 std::cout <<
"\t New Min Res " <<
res <<
"cm." << std::endl;
816 if (minres < 3000.) {
832 ostringstream myStream;
833 myStream <<
num << flush;
834 return (myStream.str());
843 int NObjectAboveThreshold,
844 bool averageThreshold) {
845 unsigned int filterIndex = trEv.
filterIndex(InputPath);
851 const int nI(VIDS.size());
852 const int nK(KEYS.size());
857 if (!averageThreshold) {
858 int NObjectAboveThresholdObserved = 0;
859 for (
int i = 0;
i !=
n; ++
i) {
860 if (TOC[KEYS[
i]].
pt() > NewThreshold && fabs(TOC[KEYS[
i]].
eta()) <
etaCut)
861 NObjectAboveThresholdObserved++;
864 if (NObjectAboveThresholdObserved >= NObjectAboveThreshold)
868 std::vector<double> ObjPt;
870 for (
int i = 0;
i !=
n; ++
i) {
871 ObjPt.push_back(TOC[KEYS[
i]].
pt());
874 if ((
int)(ObjPt.size()) < NObjectAboveThreshold)
876 std::sort(ObjPt.begin(), ObjPt.end());
879 for (
int i = 0;
i < NObjectAboveThreshold;
i++) {
880 Average += ObjPt[ObjPt.size() - 1 -
i];
882 Average /= NObjectAboveThreshold;