3 |
|
// Retrieve parameters from the configuration file. |
4 |
|
jets_ (cfg.getParameter<edm::InputTag> ("jets")), |
5 |
|
muons_ (cfg.getParameter<edm::InputTag> ("muons")), |
6 |
+ |
secMuons_ (cfg.getParameter<edm::InputTag> ("secMuons")), |
7 |
|
electrons_ (cfg.getParameter<edm::InputTag> ("electrons")), |
8 |
|
events_ (cfg.getParameter<edm::InputTag> ("events")), |
9 |
|
taus_ (cfg.getParameter<edm::InputTag> ("taus")), |
39 |
|
printAllTriggers_ (cfg.getParameter<bool> ("printAllTriggers")), |
40 |
|
useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr")), |
41 |
|
stopCTau_ (cfg.getParameter<vector<double> > ("stopCTau")), |
42 |
< |
GetPlotsAfterEachCut_ (cfg.getParameter<bool> ("GetPlotsAfterEachCut")) |
42 |
> |
GetPlotsAfterEachCut_ (cfg.getParameter<bool> ("GetPlotsAfterEachCut")), |
43 |
> |
verbose_ (cfg.getParameter<int> ("verbose")) |
44 |
|
{ |
45 |
|
|
46 |
< |
TH1::SetDefaultSumw2 (); |
46 |
> |
if (verbose_) printEventInfo_ = true; |
47 |
> |
if (verbose_) clog << "Beginning OSUAnalysis::OSUAnalysis constructor." << endl; |
48 |
> |
|
49 |
> |
TH1::SetDefaultSumw2(); |
50 |
|
|
51 |
|
//create pile-up reweighting object, if necessary |
52 |
|
if(datasetType_ != "data") { |
60 |
|
} |
61 |
|
} |
62 |
|
if (datasetType_ == "signalMC" && regex_match (dataset_, regex ("stop.*to.*_.*mm.*"))) |
63 |
< |
stopCTauWeight_ = new StopCTauWeight (stopCTau_.at (0), stopCTau_.at (1), stops_); |
63 |
> |
stopCTauWeight_ = new StopCTauWeight (stopCTau_.at(0), stopCTau_.at(1), stops_); |
64 |
|
|
65 |
|
|
66 |
|
// Construct Cutflow Objects. These store the results of cut decisions and |
96 |
|
TString newName = TString(br.inputCollection) + "_" + TString(br.inputVariable); |
97 |
|
br.name = string(newName.Data()); |
98 |
|
treeBranches_.push_back(br); |
99 |
+ |
if (verbose_>3) clog << " Adding branch to BNTree: " << br.name << endl; |
100 |
|
} |
101 |
|
|
102 |
|
} // end for (uint iBranchSet = 0; iBranchSet<treeBranchSets_.size(); iBranchSet++) |
151 |
|
objectsToGet.push_back(obj1); |
152 |
|
objectsToGet.push_back(obj2ToGet); |
153 |
|
} // end else |
154 |
< |
if (find(objectsToPlot.begin(), objectsToPlot.end(), "events") != objectsToPlot.end()) |
155 |
< |
objectsToGet.push_back("jets"); |
156 |
< |
|
157 |
< |
|
154 |
> |
if (find(objectsToPlot.begin(), objectsToPlot.end(), "events") != objectsToPlot.end()) |
155 |
> |
objectsToGet.push_back("jets"); |
156 |
> |
|
157 |
> |
|
158 |
|
vector<edm::ParameterSet> histogramList_ (histogramSets_.at(currentHistogramSet).getParameter<vector<edm::ParameterSet> >("histograms")); |
159 |
|
|
160 |
|
for(uint currentHistogram = 0; currentHistogram != histogramList_.size(); currentHistogram++){ |
186 |
|
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
187 |
|
|
188 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
189 |
< |
if(currentObject != "muons" && currentObject != "secondary muons" && currentObject != "secondary electrons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "secondary photons"&& currentObject != "superclusters") continue; |
189 |
> |
if(currentObject != "muons" && |
190 |
> |
currentObject != "secondary muons" && |
191 |
> |
currentObject != "secondary electrons" && |
192 |
> |
currentObject != "electrons" && |
193 |
> |
currentObject != "taus" && |
194 |
> |
currentObject != "tracks" && |
195 |
> |
currentObject != "photons" && |
196 |
> |
currentObject != "secondary photons"&& |
197 |
> |
currentObject != "superclusters") |
198 |
> |
continue; |
199 |
|
|
200 |
|
histogram tempIdHisto; |
201 |
|
histogram tempMomIdHisto; |
266 |
|
string channelName (channels_.at(currentChannel).getParameter<string>("name")); |
267 |
|
tempChannel.name = channelName; |
268 |
|
TString channelLabel = channelName; |
269 |
+ |
if (verbose_) clog << "Processing channel: " << channelName << endl; |
270 |
|
|
271 |
|
//set triggers for this channel |
272 |
|
vector<string> triggerNames; |
327 |
|
tempCut.inputCollection = tempInputCollection; |
328 |
|
if(tempInputCollection.find("pairs")==string::npos){ //just a single object |
329 |
|
if(tempInputCollection.find("secondary")!=string::npos){//secondary object |
330 |
< |
int spaceIndex = tempInputCollection.find(" "); |
331 |
< |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
332 |
< |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
330 |
> |
if(tempInputCollection.find("secondary muons")!=string::npos){//treat secondary muons differently; allow for a different input collection |
331 |
> |
objectsToGet.push_back("secondary muons"); |
332 |
> |
} else { |
333 |
> |
int spaceIndex = tempInputCollection.find(" "); |
334 |
> |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
335 |
> |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
336 |
> |
} |
337 |
|
} |
338 |
|
else{ |
339 |
|
objectsToGet.push_back(tempInputCollection); |
421 |
|
} |
422 |
|
subSubDirNames.push_back(subSubDirName); |
423 |
|
tempCut.name = tempCutName; |
424 |
+ |
if (verbose_) clog << "Setting up cut, index: " << currentCut << ", input collection: " << tempInputCollection<< ", name: " << tempCut.name << endl; |
425 |
|
|
426 |
|
tempChannel.cuts.push_back(tempCut); |
427 |
|
|
462 |
|
for(uint currentDir = 0; !useEDMFormat_ && currentDir != treeDirectories.size(); currentDir++){ |
463 |
|
TTree* newTree = treeDirectories.at(currentDir).make<TTree> (TString("BNTree_"+channelLabel), TString("BNTree_"+channelLabel)); |
464 |
|
BNTrees_.push_back(newTree); |
465 |
+ |
BNTrees_.back()->Branch("event_runInt", &BNTreeBranchVals_runInt_, "event_runInt/I"); |
466 |
+ |
BNTrees_.back()->Branch("event_lumiInt", &BNTreeBranchVals_lumiInt_, "event_lumiInt/I"); |
467 |
+ |
BNTrees_.back()->Branch("event_evtLong", &BNTreeBranchVals_evtLong_, "event_evtLong/L"); |
468 |
|
for (uint iBranch = 0; iBranch < treeBranches_.size(); iBranch++){ |
469 |
|
BranchSpecs currentVar = treeBranches_.at(iBranch); |
470 |
|
vector<float> newVec; |
620 |
|
else if(currentObject == "track-event pairs") currentObject = "trackEventPairs"; |
621 |
|
else if(currentObject == "electron-track pairs") currentObject = "electronTrackPairs"; |
622 |
|
else if(currentObject == "muon-track pairs") currentObject = "muonTrackPairs"; |
623 |
+ |
else if(currentObject == "secondary muon-track pairs") currentObject = "secondaryMuonTrackPairs"; |
624 |
|
else if(currentObject == "muon-tau pairs") currentObject = "muonTauPairs"; |
625 |
|
else if(currentObject == "tau-tau pairs") currentObject = "ditauPairs"; |
626 |
|
else if(currentObject == "tau-track pairs") currentObject = "tauTrackPairs"; |
630 |
|
else if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
631 |
|
else if(currentObject == "electron-trigobj pairs") currentObject = "electronTrigobjPairs"; |
632 |
|
else if(currentObject == "muon-trigobj pairs") currentObject = "muonTrigobjPairs"; |
633 |
+ |
else if(currentObject == "electron-mcparticle pairs") currentObject = "electronMCparticlePairs"; |
634 |
+ |
|
635 |
|
|
636 |
|
currentObject.at(0) = toupper(currentObject.at(0)); |
637 |
|
string histoName = "num" + currentObject; |
645 |
|
else |
646 |
|
oneDHists_.at(currentChannel).at(currentDir)[histoName] = directories.at(currentDir).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
647 |
|
} |
648 |
+ |
|
649 |
+ |
if (verbose_) { |
650 |
+ |
clog << "List of 1D histograms booked for channel " << channelName << " and directory " << currentDir << ":" << endl; |
651 |
+ |
for(map<string, TH1D*>::iterator |
652 |
+ |
iter = oneDHists_.at(currentChannel).at(currentDir).begin(); |
653 |
+ |
iter != oneDHists_.at(currentChannel).at(currentDir).end(); |
654 |
+ |
iter++) { |
655 |
+ |
clog << " " << iter->first |
656 |
+ |
<< ": name=" << iter->second->GetName() |
657 |
+ |
<< ", title=" << iter->second->GetTitle() |
658 |
+ |
<< ", bins=(" << iter->second->GetNbinsX() |
659 |
+ |
<< "," << iter->second->GetXaxis()->GetXmin() |
660 |
+ |
<< "," << iter->second->GetXaxis()->GetXmax() |
661 |
+ |
<< ")" << endl; |
662 |
+ |
} |
663 |
+ |
clog << "List of 2D histograms booked for channel " << channelName << " and directory " << currentDir << ":" << endl; |
664 |
+ |
for(map<string, TH2D*>::iterator |
665 |
+ |
iter = twoDHists_.at(currentChannel).at(currentDir).begin(); |
666 |
+ |
iter != twoDHists_.at(currentChannel).at(currentDir).end(); |
667 |
+ |
iter++) { |
668 |
+ |
clog << " " << iter->first |
669 |
+ |
<< ": name=" << iter->second->GetName() |
670 |
+ |
<< ", title=" << iter->second->GetTitle() |
671 |
+ |
<< ", binsX=(" << iter->second->GetNbinsX() |
672 |
+ |
<< "," << iter->second->GetXaxis()->GetXmin() |
673 |
+ |
<< "," << iter->second->GetXaxis()->GetXmax() |
674 |
+ |
<< ")" |
675 |
+ |
<< ", binsY=(" << iter->second->GetNbinsY() |
676 |
+ |
<< "," << iter->second->GetYaxis()->GetXmin() |
677 |
+ |
<< "," << iter->second->GetYaxis()->GetXmax() |
678 |
+ |
<< ")" |
679 |
+ |
<< endl; |
680 |
+ |
} |
681 |
+ |
} |
682 |
+ |
|
683 |
|
}//end of loop over directories |
684 |
|
channels.push_back(tempChannel); |
685 |
|
tempChannel.cuts.clear(); |
686 |
|
}//end loop over channels |
687 |
|
|
688 |
|
|
689 |
+ |
// Create the cutflow histogram and fill with 0 weight, in case no events are found in the input file. |
690 |
+ |
for(uint currentChannelIndex = 0; currentChannelIndex != channels.size(); currentChannelIndex++){ |
691 |
+ |
channel currentChannel = channels.at(currentChannelIndex); |
692 |
+ |
if(currentChannel.triggers.size() != 0 || currentChannel.triggersToVeto.size() != 0){ //triggers specified |
693 |
+ |
cutFlows_.at(currentChannelIndex)->at("trigger") = true; |
694 |
+ |
} |
695 |
+ |
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
696 |
+ |
cut currentCut = currentChannel.cuts.at(currentCutIndex); |
697 |
+ |
cutFlows_.at(currentChannelIndex)->at (currentCut.name) = true; |
698 |
+ |
} |
699 |
+ |
cutFlows_.at(currentChannelIndex)->fillCutFlow(0); // fill cutflow with 0 weight, just to create the cutflow histograms |
700 |
+ |
} |
701 |
+ |
|
702 |
|
//make unique vector of objects we need to get from the event |
703 |
|
sort( objectsToGet.begin(), objectsToGet.end() ); |
704 |
|
objectsToGet.erase( unique( objectsToGet.begin(), objectsToGet.end() ), objectsToGet.end() ); |
709 |
|
sort( objectsToFlag.begin(), objectsToFlag.end() ); |
710 |
|
objectsToFlag.erase( unique( objectsToFlag.begin(), objectsToFlag.end() ), objectsToFlag.end() ); |
711 |
|
|
712 |
+ |
// Move all paired objects to the end of the list, so that the flags for single objects are always set before those of paired objects. |
713 |
+ |
for (uint i=0; i<objectsToFlag.size(); i++) { |
714 |
+ |
if (objectsToFlag.at(i).find("pairs")!=string::npos) { // if it contains "pairs" |
715 |
+ |
objectsToFlag.push_back(objectsToFlag.at(i)); |
716 |
+ |
objectsToFlag.erase(objectsToFlag.begin()+i); |
717 |
+ |
} |
718 |
+ |
} |
719 |
+ |
|
720 |
+ |
if (verbose_) { |
721 |
+ |
clog << "List of channels:" << endl; |
722 |
+ |
for (uint i=0; i<channels.size(); i++) { |
723 |
+ |
clog << " " << channels.at(i).name << endl; |
724 |
+ |
} |
725 |
+ |
clog << "List of objects to get:" << endl; |
726 |
+ |
for (uint i=0; i<objectsToGet.size(); i++) { |
727 |
+ |
clog << " " << objectsToGet.at(i) << endl; |
728 |
+ |
} |
729 |
+ |
clog << "List of objects to plot:" << endl; |
730 |
+ |
for (uint i=0; i<objectsToPlot.size(); i++) { |
731 |
+ |
clog << " " << objectsToPlot.at(i) << endl; |
732 |
+ |
} |
733 |
+ |
clog << "List of objects to cut:" << endl; |
734 |
+ |
for (uint i=0; i<objectsToCut.size(); i++) { |
735 |
+ |
clog << " " << objectsToCut.at(i) << endl; |
736 |
+ |
} |
737 |
+ |
clog << "List of objects to flag:" << endl; |
738 |
+ |
for (uint i=0; i<objectsToFlag.size(); i++) { |
739 |
+ |
clog << " " << objectsToFlag.at(i) << endl; |
740 |
+ |
} |
741 |
+ |
} |
742 |
+ |
|
743 |
|
produces<map<string, bool> > ("channelDecisions"); |
744 |
|
|
745 |
|
if (printEventInfo_) { |
746 |
|
findEventsLog = new ofstream(); |
747 |
|
findEventsLog->open("findEvents.txt"); |
748 |
|
clog << "Listing run:lumi:event in file findEvents.txt for events that pass full selection (of any channel)." << endl; |
749 |
< |
} |
749 |
> |
} else { |
750 |
> |
findEventsLog = 0; |
751 |
> |
} |
752 |
|
|
753 |
|
isFirstEvent_ = true; |
754 |
|
|
755 |
< |
} // end constructor OSUAnalysis::OSUAnalysis() |
755 |
> |
if (verbose_) clog << "Finished OSUAnalysis::OSUAnalysis constructor." << endl; |
756 |
> |
|
757 |
> |
|
758 |
> |
} // end constructor OSUAnalysis::OSUAnalysis() |
759 |
|
|
760 |
|
|
761 |
|
OSUAnalysis::~OSUAnalysis () |
762 |
|
{ |
763 |
|
|
764 |
+ |
if (verbose_) clog << "Beginning OSUAnalysis::OSUAnalysis destructor." << endl; |
765 |
+ |
|
766 |
|
// Destroying the CutFlow objects causes the cut flow numbers and time |
767 |
|
// information to be printed to standard output. |
768 |
|
for(uint currentChannel = 0; currentChannel != channels_.size(); currentChannel++){ |
775 |
|
clog << "Successfully completed OSUAnalysis." << endl; |
776 |
|
clog << "=============================================" << endl; |
777 |
|
|
778 |
+ |
if (verbose_) clog << "Finished OSUAnalysis::OSUAnalysis destructor." << endl; |
779 |
+ |
|
780 |
|
} |
781 |
|
|
782 |
|
void |
784 |
|
{ |
785 |
|
// Retrieve necessary collections from the event. |
786 |
|
|
787 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end()) |
787 |
> |
if (verbose_) clog << "Beginning OSUAnalysis::produce." << endl; |
788 |
> |
|
789 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end()) { |
790 |
|
event.getByLabel (triggers_, triggers); |
791 |
+ |
if (!triggers.product()) cout << "ERROR: could not get triggers input collection" << endl; |
792 |
+ |
} |
793 |
|
|
794 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "trigobjs") != objectsToGet.end()) |
794 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "trigobjs") != objectsToGet.end()) { |
795 |
|
event.getByLabel (trigobjs_, trigobjs); |
796 |
+ |
if (!trigobjs.product()) cout << "ERROR: could not get trigobjs input collection" << endl; |
797 |
+ |
} |
798 |
|
|
799 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end()) |
799 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end()) { |
800 |
|
event.getByLabel (jets_, jets); |
801 |
+ |
if (!jets.product()) cout << "ERROR: could not get jets input collection" << endl; |
802 |
+ |
} |
803 |
|
|
804 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end()) |
804 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end()) { |
805 |
|
event.getByLabel (muons_, muons); |
806 |
+ |
if (!muons.product()) cout << "ERROR: could not get muons input collection" << endl; |
807 |
+ |
} |
808 |
|
|
809 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end()) |
809 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "secondary muons") != objectsToGet.end()) { |
810 |
> |
event.getByLabel (secMuons_, secMuons); |
811 |
> |
if (!secMuons.product()) cout << "ERROR: could not get secMuons input collection" << endl; |
812 |
> |
} |
813 |
> |
|
814 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end()) { |
815 |
|
event.getByLabel (electrons_, electrons); |
816 |
+ |
if (!electrons.product()) cout << "ERROR: could not get electrons input collection" << endl; |
817 |
+ |
} |
818 |
|
|
819 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end()) |
819 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end()) { |
820 |
|
event.getByLabel (events_, events); |
821 |
+ |
if (!events.product()) cout << "ERROR: could not get events input collection" << endl; |
822 |
+ |
} |
823 |
|
|
824 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end()) |
824 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end()) { |
825 |
|
event.getByLabel (taus_, taus); |
826 |
+ |
if (!taus.product()) cout << "ERROR: could not get taus input collection" << endl; |
827 |
+ |
} |
828 |
|
|
829 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end()) |
829 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end()) { |
830 |
|
event.getByLabel (mets_, mets); |
831 |
+ |
if (!mets.product()) cout << "ERROR: could not get mets input collection" << endl; |
832 |
+ |
} |
833 |
|
|
834 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end()) |
834 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end()) { |
835 |
|
event.getByLabel (tracks_, tracks); |
836 |
+ |
if (!tracks.product()) cout << "ERROR: could not get tracks input collection" << endl; |
837 |
+ |
} |
838 |
|
|
839 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end()) |
839 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end()) { |
840 |
|
event.getByLabel (genjets_, genjets); |
841 |
+ |
if (!genjets.product()) cout << "ERROR: could not get genjets input collection" << endl; |
842 |
+ |
} |
843 |
|
|
844 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end()) |
844 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end()) { |
845 |
|
event.getByLabel (mcparticles_, mcparticles); |
846 |
+ |
if (!mcparticles.product()) cout << "ERROR: could not get mcparticles input collection" << endl; |
847 |
+ |
} |
848 |
|
|
849 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end()) |
849 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end()) { |
850 |
|
event.getByLabel (primaryvertexs_, primaryvertexs); |
851 |
+ |
if (!primaryvertexs.product()) cout << "ERROR: could not get primaryvertexs input collection" << endl; |
852 |
+ |
} |
853 |
|
|
854 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end()) |
854 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end()) { |
855 |
|
event.getByLabel (bxlumis_, bxlumis); |
856 |
+ |
if (!bxlumis.product()) cout << "ERROR: could not get bxlumis input collection" << endl; |
857 |
+ |
} |
858 |
|
|
859 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end()) |
859 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end()) { |
860 |
|
event.getByLabel (photons_, photons); |
861 |
+ |
if (!photons.product()) cout << "ERROR: could not get photons input collection" << endl; |
862 |
+ |
} |
863 |
|
|
864 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) |
864 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) { |
865 |
|
event.getByLabel (superclusters_, superclusters); |
866 |
+ |
if (!superclusters.product()) cout << "ERROR: could not get superclusters input collection" << endl; |
867 |
+ |
} |
868 |
|
|
869 |
|
if (datasetType_ == "signalMC"){ |
870 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "stops") != objectsToGet.end()) |
870 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "stops") != objectsToGet.end()) { |
871 |
|
event.getByLabel (stops_, stops); |
872 |
+ |
if (!stops.product()) cout << "ERROR: could not get stops input collection" << endl; |
873 |
+ |
} |
874 |
|
} |
875 |
|
|
876 |
|
if (useTrackCaloRhoCorr_) { |
879 |
|
// For description of rho values for different jet reconstruction algorithms, see |
880 |
|
// https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms |
881 |
|
event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_); |
882 |
+ |
if (!rhokt6CaloJetsHandle_.product()) cout << "ERROR: could not get kt6CaloJets input collection" << endl; |
883 |
|
} |
884 |
|
|
885 |
|
double masterScaleFactor = 1.0; |
901 |
|
auto_ptr<map<string, bool> > channelDecisions (new map<string, bool>); |
902 |
|
for(uint currentChannelIndex = 0; currentChannelIndex != channels.size(); currentChannelIndex++){ |
903 |
|
channel currentChannel = channels.at(currentChannelIndex); |
904 |
+ |
if (verbose_>1) clog << " Processing channel " << currentChannel.name << endl; |
905 |
|
|
906 |
|
flagMap individualFlags; |
907 |
|
counterMap passingCounter; |
921 |
|
//loop over all cuts |
922 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
923 |
|
cut currentCut = currentChannel.cuts.at(currentCutIndex); |
924 |
+ |
if (verbose_>2) clog << " Processing cut, index: " << currentCutIndex << ", input collection: " << currentCut.inputCollection << ", name: " << currentCut.name << endl; |
925 |
|
|
926 |
|
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToFlag.size(); currentObjectIndex++){ |
927 |
|
string currentObject = objectsToFlag.at(currentObjectIndex); |
933 |
|
} |
934 |
|
|
935 |
|
//set flags for all relevant objects |
936 |
< |
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToFlag.size(); currentObjectIndex++){ |
937 |
< |
string currentObject = objectsToFlag.at(currentObjectIndex); |
938 |
< |
|
939 |
< |
int flagsForPairCutsIndex = max(int(currentCutIndex-1),0); |
940 |
< |
|
941 |
< |
|
942 |
< |
if (currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
943 |
< |
else if(currentObject == "secondary jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"secondary jets"); |
944 |
< |
else if(currentObject == "secondary photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"secondary photons"); |
945 |
< |
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
946 |
< |
else if(currentObject == "secondary muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"secondary muons"); |
936 |
> |
for(int currentObjectIndex = -1; currentObjectIndex != int(objectsToFlag.size()); currentObjectIndex++){ |
937 |
> |
string currentObject; |
938 |
> |
if (currentObjectIndex < 0) currentObject = currentCut.inputCollection; // In the first loop, set the flags for the collection that the cut is acting on. That way other paired collections can access the correct flag for the current cut. |
939 |
> |
else currentObject = objectsToFlag.at(currentObjectIndex); |
940 |
> |
if (currentObjectIndex >= 0 && currentObject == currentCut.inputCollection) continue; // Flags have already been set for the inputCollection object, so should not be set again. |
941 |
> |
|
942 |
> |
// single object collections |
943 |
> |
if (currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
944 |
> |
else if(currentObject == "secondary jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"secondary jets"); |
945 |
> |
else if(currentObject == "secondary photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"secondary photons"); |
946 |
> |
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
947 |
> |
else if(currentObject == "secondary muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,secMuons.product(),"secondary muons"); |
948 |
|
else if(currentObject == "secondary electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"secondary electrons"); |
949 |
< |
else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons"); |
950 |
< |
else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events"); |
951 |
< |
else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus"); |
952 |
< |
else if(currentObject == "mets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mets.product(),"mets"); |
953 |
< |
else if(currentObject == "tracks") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),"tracks"); |
954 |
< |
else if(currentObject == "genjets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,genjets.product(),"genjets"); |
955 |
< |
else if(currentObject == "mcparticles") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mcparticles.product(),"mcparticles"); |
956 |
< |
else if(currentObject == "primaryvertexs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,primaryvertexs.product(),"primaryvertexs"); |
957 |
< |
else if(currentObject == "bxlumis") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,bxlumis.product(),"bxlumis"); |
958 |
< |
else if(currentObject == "photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"photons"); |
959 |
< |
else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters"); |
960 |
< |
else if(currentObject == "trigobjs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,trigobjs.product(),"trigobjs"); |
961 |
< |
|
962 |
< |
|
963 |
< |
|
964 |
< |
else if(currentObject == "muon-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
965 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
966 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
967 |
< |
"muon-muon pairs"); |
968 |
< |
|
969 |
< |
else if(currentObject == "muon-secondary muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
970 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
971 |
< |
cumulativeFlags.at("secondary muons").at(flagsForPairCutsIndex), \ |
972 |
< |
"muon-secondary muon pairs"); |
973 |
< |
|
974 |
< |
else if(currentObject == "muon-secondary photon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),photons.product(), \ |
975 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
976 |
< |
cumulativeFlags.at("secondary photons").at(flagsForPairCutsIndex), \ |
977 |
< |
"muon-secondary photon pairs"); |
978 |
< |
else if(currentObject == "muon-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), \ |
979 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
980 |
< |
cumulativeFlags.at("secondary jets").at(flagsForPairCutsIndex), \ |
981 |
< |
"muon-secondary jet pairs"); |
982 |
< |
else if(currentObject == "photon-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),jets.product(), \ |
983 |
< |
cumulativeFlags.at("photons").at(flagsForPairCutsIndex), \ |
984 |
< |
cumulativeFlags.at("secondary jets").at(flagsForPairCutsIndex), \ |
985 |
< |
"photon-secondary jet pairs"); |
986 |
< |
|
987 |
< |
else if(currentObject == "electron-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), \ |
988 |
< |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
989 |
< |
cumulativeFlags.at("secondary jets").at(flagsForPairCutsIndex), \ |
990 |
< |
"electron-secondary jet pairs"); |
991 |
< |
|
992 |
< |
else if(currentObject == "electron-secondary electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
993 |
< |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
994 |
< |
cumulativeFlags.at("secondary electrons").at(flagsForPairCutsIndex), \ |
837 |
< |
"electron-secondary electron pairs"); |
838 |
< |
|
839 |
< |
else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
840 |
< |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
841 |
< |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
842 |
< |
"electron-electron pairs"); |
843 |
< |
else if(currentObject == "electron-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),muons.product(), \ |
844 |
< |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
845 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
846 |
< |
"electron-muon pairs"); |
847 |
< |
else if(currentObject == "jet-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),jets.product(), \ |
848 |
< |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
849 |
< |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
850 |
< |
"jet-jet pairs"); |
851 |
< |
else if(currentObject == "jet-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),jets.product(), \ |
852 |
< |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
853 |
< |
cumulativeFlags.at("secondary jets").at(flagsForPairCutsIndex),\ |
854 |
< |
"jet-secondary jet pairs"); |
855 |
< |
else if(currentObject == "electron-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), \ |
856 |
< |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
857 |
< |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
858 |
< |
"electron-jet pairs"); |
859 |
< |
else if(currentObject == "electron-photon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),photons.product(), \ |
860 |
< |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
861 |
< |
cumulativeFlags.at("photons").at(flagsForPairCutsIndex), \ |
862 |
< |
"electron-photon pairs"); |
863 |
< |
else if(currentObject == "photon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),jets.product(), \ |
864 |
< |
cumulativeFlags.at("photons").at(flagsForPairCutsIndex), \ |
865 |
< |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
866 |
< |
"photon-jet pairs"); |
867 |
< |
else if(currentObject == "muon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), \ |
868 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
869 |
< |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
870 |
< |
"muon-jet pairs"); |
871 |
< |
else if(currentObject == "muon-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),events.product(), \ |
872 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
873 |
< |
cumulativeFlags.at("events").at(flagsForPairCutsIndex), \ |
874 |
< |
"muon-event pairs"); |
875 |
< |
else if(currentObject == "met-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mets.product(),jets.product(), \ |
876 |
< |
cumulativeFlags.at("mets").at(flagsForPairCutsIndex), \ |
877 |
< |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
878 |
< |
"met-jet pairs"); |
879 |
< |
else if(currentObject == "track-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),jets.product(), \ |
880 |
< |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), \ |
881 |
< |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
882 |
< |
"track-jet pairs"); |
883 |
< |
else if(currentObject == "muon-photon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),photons.product(), \ |
884 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
885 |
< |
cumulativeFlags.at("photons").at(flagsForPairCutsIndex), \ |
886 |
< |
"muon-photon pairs"); |
887 |
< |
else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), |
888 |
< |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
889 |
< |
cumulativeFlags.at("events").at(flagsForPairCutsIndex), |
890 |
< |
"track-event pairs"); |
891 |
< |
else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(), |
892 |
< |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
893 |
< |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
894 |
< |
"electron-track pairs"); |
895 |
< |
else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(), |
896 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
897 |
< |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
898 |
< |
"muon-track pairs"); |
899 |
< |
else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(), |
900 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
901 |
< |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
902 |
< |
"muon-tau pairs"); |
903 |
< |
else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),taus.product(), |
904 |
< |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
905 |
< |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
906 |
< |
"tau-tau pairs"); |
907 |
< |
else if(currentObject == "tau-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(), |
908 |
< |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
909 |
< |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
910 |
< |
"tau-track pairs"); |
911 |
< |
else if(currentObject == "electron-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),trigobjs.product(), |
912 |
< |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
913 |
< |
cumulativeFlags.at("trigobjs").at(flagsForPairCutsIndex), |
914 |
< |
"electron-trigobj pairs"); |
915 |
< |
else if(currentObject == "muon-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),trigobjs.product(), |
916 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
917 |
< |
cumulativeFlags.at("trigobjs").at(flagsForPairCutsIndex), |
918 |
< |
"muon-trigobj pairs"); |
949 |
> |
else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons"); |
950 |
> |
else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events"); |
951 |
> |
else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus"); |
952 |
> |
else if(currentObject == "mets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mets.product(),"mets"); |
953 |
> |
else if(currentObject == "tracks") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),"tracks"); |
954 |
> |
else if(currentObject == "genjets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,genjets.product(),"genjets"); |
955 |
> |
else if(currentObject == "mcparticles") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mcparticles.product(),"mcparticles"); |
956 |
> |
else if(currentObject == "primaryvertexs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,primaryvertexs.product(),"primaryvertexs"); |
957 |
> |
else if(currentObject == "bxlumis") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,bxlumis.product(),"bxlumis"); |
958 |
> |
else if(currentObject == "photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"photons"); |
959 |
> |
else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters"); |
960 |
> |
else if(currentObject == "trigobjs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,trigobjs.product(),"trigobjs"); |
961 |
> |
|
962 |
> |
|
963 |
> |
// paired object collections |
964 |
> |
else if(currentObject == "muon-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), "muon-muon pairs"); |
965 |
> |
else if(currentObject == "muon-secondary muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),secMuons.product(), "muon-secondary muon pairs"); |
966 |
> |
|
967 |
> |
else if(currentObject == "muon-secondary photon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),photons.product(), "muon-secondary photon pairs"); |
968 |
> |
else if(currentObject == "muon-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), "muon-secondary jet pairs"); |
969 |
> |
else if(currentObject == "photon-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),jets.product(), "photon-secondary jet pairs"); |
970 |
> |
else if(currentObject == "electron-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), "electron-secondary jet pairs"); |
971 |
> |
else if(currentObject == "electron-secondary electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), "electron-secondary electron pairs"); |
972 |
> |
|
973 |
> |
else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), "electron-electron pairs"); |
974 |
> |
else if(currentObject == "electron-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),muons.product(), "electron-muon pairs"); |
975 |
> |
else if(currentObject == "jet-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),jets.product(), "jet-jet pairs"); |
976 |
> |
else if(currentObject == "jet-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),jets.product(), "jet-secondary jet pairs"); |
977 |
> |
else if(currentObject == "electron-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), "electron-jet pairs"); |
978 |
> |
else if(currentObject == "electron-photon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),photons.product(), "electron-photon pairs"); |
979 |
> |
else if(currentObject == "photon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),jets.product(), "photon-jet pairs"); |
980 |
> |
else if(currentObject == "muon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), "muon-jet pairs"); |
981 |
> |
else if(currentObject == "muon-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),events.product(), "muon-event pairs"); |
982 |
> |
else if(currentObject == "met-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mets.product(),jets.product(), "met-jet pairs"); |
983 |
> |
else if(currentObject == "track-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),jets.product(), "track-jet pairs"); |
984 |
> |
else if(currentObject == "muon-photon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),photons.product(), "muon-photon pairs"); |
985 |
> |
else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), "track-event pairs"); |
986 |
> |
else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(),"electron-track pairs"); |
987 |
> |
else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(),"muon-track pairs"); |
988 |
> |
else if(currentObject == "secondary muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,secMuons.product(),tracks.product(),"secondary muon-track pairs"); |
989 |
> |
else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(),"muon-tau pairs"); |
990 |
> |
else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),taus.product(),"tau-tau pairs"); |
991 |
> |
else if(currentObject == "tau-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(),"tau-track pairs"); |
992 |
> |
else if(currentObject == "electron-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),trigobjs.product(),"electron-trigobj pairs"); |
993 |
> |
else if(currentObject == "muon-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),trigobjs.product(),"muon-trigobj pairs"); |
994 |
> |
else if(currentObject == "electron-mcparticle pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),mcparticles.product(),"electron-mcparticle pairs"); |
995 |
|
|
996 |
|
if(currentObject == "stops" && datasetType_ == "signalMC") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,stops.product(),"stops"); |
997 |
|
} |
998 |
|
|
999 |
+ |
}//end loop over all cuts |
1000 |
|
|
1001 |
|
|
925 |
– |
}//end loop over all cuts |
926 |
– |
//use cumulative flags to apply cuts at event level |
1002 |
|
|
1003 |
< |
//a vector to store cumulative cut descisions after each cut. |
1004 |
< |
vector<bool> eventPassedPreviousCuts; |
1003 |
> |
//use cumulative flags to apply cuts at event level |
1004 |
> |
vector<bool> eventPassedPreviousCuts; //a vector to store cumulative cut descisions after each cut. |
1005 |
|
bool eventPassedAllCuts = true; |
1006 |
< |
//apply trigger (true if none were specified) |
932 |
< |
eventPassedAllCuts = eventPassedAllCuts && triggerDecision; |
1006 |
> |
eventPassedAllCuts = eventPassedAllCuts && triggerDecision; //apply trigger (true if none were specified) |
1007 |
|
|
1008 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
1009 |
|
|
1010 |
|
//loop over all objects and count how many passed the cumulative selection up to this point |
1011 |
|
cut currentCut = currentChannel.cuts.at(currentCutIndex); |
1012 |
|
int numberPassing = 0; |
1013 |
+ |
int numberPassingPrev = 0; // number of objects that pass cuts up to the previous one |
1014 |
|
|
1015 |
|
for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++){ |
1016 |
|
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object).first) numberPassing++; |
1017 |
|
} |
1018 |
< |
bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired); |
1018 |
> |
bool cutDecision; |
1019 |
> |
if (!currentCut.isVeto) { |
1020 |
> |
cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired); |
1021 |
> |
} else { |
1022 |
> |
int prevCutIndex = currentCutIndex - 1; |
1023 |
> |
if (prevCutIndex<0) { |
1024 |
> |
numberPassingPrev = cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size(); // count all objects in collection if cut is the first |
1025 |
> |
} else { |
1026 |
> |
for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(prevCutIndex).size() ; object++){ |
1027 |
> |
if (cumulativeFlags.at(currentCut.inputCollection).at(prevCutIndex).at(object).first) { |
1028 |
> |
numberPassingPrev++; |
1029 |
> |
if (verbose_>1) clog << " object passed previous cut" << endl; |
1030 |
> |
} |
1031 |
> |
} |
1032 |
> |
} |
1033 |
> |
int numberFailCut = numberPassingPrev - numberPassing; |
1034 |
> |
cutDecision = evaluateComparison(numberFailCut,currentCut.eventComparativeOperator,currentCut.numberRequired); |
1035 |
> |
} |
1036 |
> |
|
1037 |
|
cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision; |
1038 |
|
eventPassedAllCuts = eventPassedAllCuts && cutDecision; |
1039 |
|
eventPassedPreviousCuts.push_back(eventPassedAllCuts); |
1040 |
+ |
if (verbose_>1) clog << " Event passed cuts up to cut index " << currentCutIndex << endl; |
1041 |
+ |
|
1042 |
|
} |
1043 |
|
//applying all appropriate scale factors |
1044 |
|
double scaleFactor = masterScaleFactor; |
1103 |
|
scaleFactor *= electronScaleFactor_; |
1104 |
|
scaleFactor *= bTagScaleFactor_; |
1105 |
|
cutFlows_.at(currentChannelIndex)->fillCutFlow(scaleFactor); |
1106 |
+ |
if (verbose_>1) clog << " Scale factors applied: " |
1107 |
+ |
<< " muonScaleFactor_ = " << muonScaleFactor_ |
1108 |
+ |
<< ", electronScaleFactor_ = " << electronScaleFactor_ |
1109 |
+ |
<< ", bTagScaleFactor_ = " << bTagScaleFactor_ |
1110 |
+ |
<< ", total scale factor = " << scaleFactor |
1111 |
+ |
<< endl; |
1112 |
+ |
|
1113 |
|
|
1114 |
|
if (printEventInfo_ && eventPassedAllCuts) { |
1115 |
|
// Write information about event to screen, for testing purposes. |
1128 |
|
|
1129 |
|
|
1130 |
|
//filling histograms |
1131 |
< |
for(uint currentCut = 0; currentCut != oneDHists_.at(currentChannelIndex).size(); currentCut++){//loop over all the directories in each channel. |
1131 |
> |
for(uint currentCut = 0; currentCut != oneDHists_.at(currentChannelIndex).size(); currentCut++){//loop over all the cuts in each channel; if GetPlotsAfterEachCut_ is false, only the last cut will be used. |
1132 |
> |
|
1133 |
> |
if (verbose_>2) clog << " Filling histograms for currentcut = " << currentCut << endl; |
1134 |
> |
|
1135 |
|
uint currentDir; |
1136 |
|
if (!GetPlotsAfterEachCut_) { currentDir = currentChannel.cuts.size() - oneDHists_.at(currentChannelIndex).size(); } //if GetPlotsAfterEachCut_ is false, set currentDir point to the last cut. |
1137 |
|
else{ |
1146 |
|
|
1147 |
|
if (cumulativeFlags.count(currentHistogram.inputCollection) == 0) clog << "Error: no flags found for collection: " << currentHistogram.inputCollection << ", will cause a seg fault" << endl; |
1148 |
|
|
1149 |
+ |
if (verbose_>1) clog << " Filling histogram " << currentHistogram.name << " for collection " << currentHistogram.inputCollection << endl; |
1150 |
+ |
|
1151 |
|
if(currentHistogram.inputVariables.size() == 1){ |
1152 |
|
TH1D* histo; |
1153 |
|
histo = oneDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
1154 |
< |
if (currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
1154 |
> |
if (currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
1155 |
|
else if(currentHistogram.inputCollection == "secondary jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
1156 |
|
else if(currentHistogram.inputCollection == "secondary photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("secondary photons").at(currentDir),scaleFactor); |
1157 |
|
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
1158 |
< |
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
1158 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,secMuons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
1159 |
|
else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
1160 |
< |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
1054 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
1160 |
> |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), |
1161 |
|
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
1162 |
< |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
1057 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
1162 |
> |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),secMuons.product(), |
1163 |
|
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
1164 |
< |
else if(currentHistogram.inputCollection == "muon-secondary photon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),photons.product(), \ |
1060 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary photons").at(currentDir), \ |
1164 |
> |
else if(currentHistogram.inputCollection == "muon-secondary photon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),photons.product(), |
1165 |
|
cumulativeFlags.at("muon-secondary photon pairs").at(currentDir),scaleFactor); |
1166 |
< |
else if(currentHistogram.inputCollection == "muon-secondary jet pairs") fill1DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
1063 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
1166 |
> |
else if(currentHistogram.inputCollection == "muon-secondary jet pairs") fill1DHistogram(histo,currentHistogram,muons.product(),jets.product(), |
1167 |
|
cumulativeFlags.at("muon-secondary jet pairs").at(currentDir),scaleFactor); |
1168 |
< |
else if(currentHistogram.inputCollection == "photon-secondary jet pairs") fill1DHistogram(histo,currentHistogram,photons.product(),jets.product(), \ |
1066 |
< |
cumulativeFlags.at("photons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
1168 |
> |
else if(currentHistogram.inputCollection == "photon-secondary jet pairs") fill1DHistogram(histo,currentHistogram,photons.product(),jets.product(), |
1169 |
|
cumulativeFlags.at("photon-secondary jet pairs").at(currentDir),scaleFactor); |
1170 |
< |
else if(currentHistogram.inputCollection == "electron-secondary jet pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
1069 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
1170 |
> |
else if(currentHistogram.inputCollection == "electron-secondary jet pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),jets.product(), |
1171 |
|
cumulativeFlags.at("electron-secondary jet pairs").at(currentDir),scaleFactor); |
1172 |
|
|
1173 |
|
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
1174 |
< |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\ |
1074 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir),\ |
1174 |
> |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), |
1175 |
|
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
1176 |
< |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(),\ |
1077 |
< |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir),\ |
1176 |
> |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(), |
1177 |
|
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
1178 |
< |
else if(currentHistogram.inputCollection == "jet-secondary jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(), \ |
1080 |
< |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
1178 |
> |
else if(currentHistogram.inputCollection == "jet-secondary jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(), |
1179 |
|
cumulativeFlags.at("jet-secondary jet pairs").at(currentDir),scaleFactor); |
1180 |
|
|
1181 |
< |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
1084 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
1181 |
> |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), |
1182 |
|
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
1183 |
< |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
1087 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), |
1183 |
> |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), |
1184 |
|
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
1185 |
< |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),jets.product(), \ |
1090 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
1185 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),jets.product(), |
1186 |
|
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
1187 |
< |
else if(currentHistogram.inputCollection == "photon-jet pairs") fill1DHistogram(histo,currentHistogram, photons.product(),jets.product(), \ |
1093 |
< |
cumulativeFlags.at("photons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
1187 |
> |
else if(currentHistogram.inputCollection == "photon-jet pairs") fill1DHistogram(histo,currentHistogram, photons.product(),jets.product(), |
1188 |
|
cumulativeFlags.at("photon-jet pairs").at(currentDir),scaleFactor); |
1189 |
< |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill1DHistogram(histo,currentHistogram, muons.product(),jets.product(), \ |
1096 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
1189 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill1DHistogram(histo,currentHistogram, muons.product(),jets.product(), |
1190 |
|
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
1191 |
< |
else if(currentHistogram.inputCollection == "muon-event pairs") fill1DHistogram(histo,currentHistogram, muons.product(),events.product(), \ |
1099 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("events").at(currentDir), |
1191 |
> |
else if(currentHistogram.inputCollection == "muon-event pairs") fill1DHistogram(histo,currentHistogram, muons.product(),events.product(), |
1192 |
|
cumulativeFlags.at("muon-event pairs").at(currentDir),scaleFactor); |
1193 |
< |
else if(currentHistogram.inputCollection == "met-jet pairs") fill1DHistogram(histo,currentHistogram, mets.product(),jets.product(), \ |
1102 |
< |
cumulativeFlags.at("mets").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
1193 |
> |
else if(currentHistogram.inputCollection == "met-jet pairs") fill1DHistogram(histo,currentHistogram, mets.product(),jets.product(), |
1194 |
|
cumulativeFlags.at("met-jet pairs").at(currentDir),scaleFactor); |
1195 |
< |
else if(currentHistogram.inputCollection == "track-jet pairs") fill1DHistogram(histo,currentHistogram,tracks.product(),jets.product(), \ |
1105 |
< |
cumulativeFlags.at("tracks").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
1195 |
> |
else if(currentHistogram.inputCollection == "track-jet pairs") fill1DHistogram(histo,currentHistogram,tracks.product(),jets.product(), |
1196 |
|
cumulativeFlags.at("track-jet pairs").at(currentDir),scaleFactor); |
1197 |
< |
else if(currentHistogram.inputCollection == "muon-photon pairs") fill1DHistogram(histo,currentHistogram, muons.product(),photons.product(), \ |
1108 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("photons").at(currentDir), |
1197 |
> |
else if(currentHistogram.inputCollection == "muon-photon pairs") fill1DHistogram(histo,currentHistogram, muons.product(),photons.product(), |
1198 |
|
cumulativeFlags.at("muon-photon pairs").at(currentDir),scaleFactor); |
1199 |
< |
else if(currentHistogram.inputCollection == "electron-photon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),photons.product(), \ |
1111 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("photons").at(currentDir), |
1199 |
> |
else if(currentHistogram.inputCollection == "electron-photon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),photons.product(), |
1200 |
|
cumulativeFlags.at("electron-photon pairs").at(currentDir),scaleFactor); |
1201 |
|
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), |
1114 |
– |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1202 |
|
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
1203 |
|
else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), |
1117 |
– |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1204 |
|
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
1205 |
+ |
else if(currentHistogram.inputCollection == "secondary muon-track pairs") fill1DHistogram(histo,currentHistogram, secMuons.product(),tracks.product(), |
1206 |
+ |
cumulativeFlags.at("secondary muon-track pairs").at(currentDir),scaleFactor); |
1207 |
|
else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), |
1120 |
– |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1208 |
|
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
1209 |
|
else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), |
1123 |
– |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1210 |
|
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
1211 |
|
else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(), |
1126 |
– |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1212 |
|
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
1213 |
|
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),trigobjs.product(), |
1129 |
– |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1214 |
|
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
1215 |
|
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill1DHistogram(histo,currentHistogram, muons.product(),trigobjs.product(), |
1132 |
– |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1216 |
|
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
1217 |
|
|
1218 |
|
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
1235 |
|
else if(currentHistogram.inputCollection == "secondary jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
1236 |
|
else if(currentHistogram.inputCollection == "secondary photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("secondary photons").at(currentDir),scaleFactor); |
1237 |
|
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
1238 |
< |
else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
1239 |
< |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
1157 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
1238 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,secMuons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
1239 |
> |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), |
1240 |
|
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
1241 |
< |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
1160 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
1241 |
> |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),secMuons.product(), |
1242 |
|
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
1243 |
< |
else if(currentHistogram.inputCollection == "muon-secondary photon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),photons.product(), \ |
1163 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary photons").at(currentDir), \ |
1243 |
> |
else if(currentHistogram.inputCollection == "muon-secondary photon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),photons.product(), |
1244 |
|
cumulativeFlags.at("muon-secondary photon pairs").at(currentDir),scaleFactor); |
1245 |
< |
else if(currentHistogram.inputCollection == "muon-secondary jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
1166 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
1245 |
> |
else if(currentHistogram.inputCollection == "muon-secondary jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), |
1246 |
|
cumulativeFlags.at("muon-secondary jet pairs").at(currentDir),scaleFactor); |
1247 |
< |
else if(currentHistogram.inputCollection == "electron-secondary jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
1169 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
1247 |
> |
else if(currentHistogram.inputCollection == "electron-secondary jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), |
1248 |
|
cumulativeFlags.at("electron-secondary jet pairs").at(currentDir),scaleFactor); |
1249 |
< |
else if(currentHistogram.inputCollection == "photon-secondary jet pairs") fill2DHistogram(histo,currentHistogram,photons.product(),jets.product(), \ |
1172 |
< |
cumulativeFlags.at("photons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
1249 |
> |
else if(currentHistogram.inputCollection == "photon-secondary jet pairs") fill2DHistogram(histo,currentHistogram,photons.product(),jets.product(), |
1250 |
|
cumulativeFlags.at("photon-secondary jet pairs").at(currentDir),scaleFactor); |
1251 |
|
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
1252 |
|
else if(currentHistogram.inputCollection == "secondary electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
1253 |
< |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
1177 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir), \ |
1253 |
> |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), |
1254 |
|
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
1255 |
< |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill2DHistogram(histo,currentHistogram,jets.product(),jets.product(), \ |
1180 |
< |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1255 |
> |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill2DHistogram(histo,currentHistogram,jets.product(),jets.product(), |
1256 |
|
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
1257 |
< |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
1183 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
1257 |
> |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), |
1258 |
|
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
1259 |
< |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
1186 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
1259 |
> |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), |
1260 |
|
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
1261 |
< |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
1189 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1261 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), |
1262 |
|
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
1263 |
< |
else if(currentHistogram.inputCollection == "electron-photon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),photons.product(), \ |
1192 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("photons").at(currentDir), \ |
1263 |
> |
else if(currentHistogram.inputCollection == "electron-photon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),photons.product(), |
1264 |
|
cumulativeFlags.at("electron-photon pairs").at(currentDir),scaleFactor); |
1265 |
< |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
1195 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1265 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), |
1266 |
|
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
1267 |
< |
else if(currentHistogram.inputCollection == "muon-event pairs") fill2DHistogram(histo,currentHistogram,muons.product(),events.product(), \ |
1198 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("events").at(currentDir), \ |
1267 |
> |
else if(currentHistogram.inputCollection == "muon-event pairs") fill2DHistogram(histo,currentHistogram,muons.product(),events.product(), |
1268 |
|
cumulativeFlags.at("muon-event pairs").at(currentDir),scaleFactor); |
1269 |
< |
else if(currentHistogram.inputCollection == "met-jet pairs") fill2DHistogram(histo,currentHistogram,mets.product(),jets.product(), \ |
1201 |
< |
cumulativeFlags.at("mets").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1269 |
> |
else if(currentHistogram.inputCollection == "met-jet pairs") fill2DHistogram(histo,currentHistogram,mets.product(),jets.product(), |
1270 |
|
cumulativeFlags.at("met-jet pairs").at(currentDir),scaleFactor); |
1271 |
|
else if(currentHistogram.inputCollection == "track-jet pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),jets.product(), |
1204 |
– |
cumulativeFlags.at("tracks").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1272 |
|
cumulativeFlags.at("track-jet pairs").at(currentDir),scaleFactor); |
1273 |
< |
else if(currentHistogram.inputCollection == "photon-jet pairs") fill2DHistogram(histo,currentHistogram,photons.product(),jets.product(), \ |
1207 |
< |
cumulativeFlags.at("photons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1273 |
> |
else if(currentHistogram.inputCollection == "photon-jet pairs") fill2DHistogram(histo,currentHistogram,photons.product(),jets.product(), |
1274 |
|
cumulativeFlags.at("photon-jet pairs").at(currentDir),scaleFactor); |
1275 |
< |
else if(currentHistogram.inputCollection == "muon-photon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),photons.product(), \ |
1210 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("photons").at(currentDir), \ |
1275 |
> |
else if(currentHistogram.inputCollection == "muon-photon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),photons.product(), |
1276 |
|
cumulativeFlags.at("muon-photon pairs").at(currentDir),scaleFactor); |
1277 |
|
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), |
1213 |
– |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1278 |
|
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
1279 |
|
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), |
1280 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1280 |
> |
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
1281 |
> |
else if(currentHistogram.inputCollection == "secondary muon-track pairs") fill2DHistogram(histo,currentHistogram,secMuons.product(),tracks.product(), |
1282 |
|
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
1283 |
|
else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), |
1219 |
– |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1284 |
|
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
1285 |
|
else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), |
1222 |
– |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1286 |
|
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
1287 |
|
else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(), |
1225 |
– |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1288 |
|
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
1289 |
|
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),trigobjs.product(), |
1228 |
– |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1290 |
|
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
1291 |
|
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill2DHistogram(histo,currentHistogram,muons.product(),trigobjs.product(), |
1231 |
– |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1292 |
|
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
1293 |
|
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
1294 |
|
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
1295 |
|
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
1296 |
|
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
1297 |
|
else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(), |
1238 |
– |
cumulativeFlags.at("tracks").at(currentDir),cumulativeFlags.at("events").at(currentDir), |
1298 |
|
cumulativeFlags.at("track-event pairs").at(currentDir),scaleFactor); |
1299 |
|
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
1300 |
|
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
1315 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
1316 |
|
string objectToPlot = ""; |
1317 |
|
|
1318 |
+ |
if (verbose_) clog << "Filling histogram of number of selected objects in collection: " << currentObject << endl; |
1319 |
+ |
|
1320 |
|
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
1321 |
|
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
1322 |
|
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
1324 |
|
else if(currentObject == "electron-photon pairs") objectToPlot = "electronPhotonPairs"; |
1325 |
|
else if(currentObject == "electron-jet pairs") objectToPlot = "electronJetPairs"; |
1326 |
|
else if(currentObject == "muon-jet pairs") objectToPlot = "muonJetPairs"; |
1327 |
< |
else if(currentObject == "muon-event pairs") objectToPlot = "muonEventPairs"; |
1328 |
< |
else if(currentObject == "muon-photon pairs") objectToPlot = "muonPhotonPairs"; |
1329 |
< |
else if(currentObject == "photon-jet pairs") objectToPlot = "photonJetPairs"; |
1327 |
> |
else if(currentObject == "muon-event pairs") objectToPlot = "muonEventPairs"; |
1328 |
> |
else if(currentObject == "muon-photon pairs") objectToPlot = "muonPhotonPairs"; |
1329 |
> |
else if(currentObject == "photon-jet pairs") objectToPlot = "photonJetPairs"; |
1330 |
|
else if(currentObject == "met-jet pairs") objectToPlot = "metJetPairs"; |
1331 |
|
else if(currentObject == "track-jet pairs") objectToPlot = "trackJetPairs"; |
1332 |
|
else if(currentObject == "jet-jet pairs") objectToPlot = "dijetPairs"; |
1333 |
|
else if(currentObject == "jet-secondary jet pairs") objectToPlot = "jetSecondaryJetPairs"; |
1334 |
|
else if(currentObject == "secondary jets") objectToPlot = "secondaryJets"; |
1335 |
< |
else if(currentObject == "secondary photons") objectToPlot = "secondaryPhotons"; |
1335 |
> |
else if(currentObject == "secondary photons") objectToPlot = "secondaryPhotons"; |
1336 |
|
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
1337 |
|
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
1338 |
+ |
else if(currentObject == "secondary muon-track pairs") objectToPlot = "secondaryMuonTrackPairs"; |
1339 |
|
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
1340 |
|
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
1341 |
|
else if(currentObject == "tau-track pairs") objectToPlot = "tauTrackPairs"; |
1343 |
|
else if(currentObject == "muon-secondary muon pairs") objectToPlot = "muonSecondaryMuonPairs"; |
1344 |
|
else if(currentObject == "secondary muons") objectToPlot = "secondaryMuons"; |
1345 |
|
else if(currentObject == "muon-secondary jet pairs") objectToPlot = "muonSecondaryJetPairs"; |
1346 |
< |
else if(currentObject == "muon-secondary photon pairs") objectToPlot = "muonSecondaryJetPairs"; |
1346 |
> |
else if(currentObject == "muon-secondary photon pairs") objectToPlot = "muonSecondaryJetPairs"; |
1347 |
|
else if(currentObject == "electron-secondary jet pairs") objectToPlot = "electronSecondaryJetPairs"; |
1348 |
|
else if(currentObject == "photon-secondary jet pairs") objectToPlot = "photonSecondaryJetPairs"; |
1349 |
|
else if(currentObject == "electron-secondary electron pairs") objectToPlot = "electronSecondaryElectronPairs"; |
1350 |
|
else if(currentObject == "secondary electrons") objectToPlot = "secondaryElectrons"; |
1351 |
|
else if(currentObject == "electron-trigobj pairs") objectToPlot = "electronTrigobjPairs"; |
1352 |
|
else if(currentObject == "muon-trigobj pairs") objectToPlot = "muonTrigobjPairs"; |
1353 |
+ |
else if(currentObject == "electron-mcparticle pairs") objectToPlot = "electronMCparticlePairs"; |
1354 |
|
else objectToPlot = currentObject; |
1355 |
|
|
1356 |
|
string tempCurrentObject = objectToPlot; |
1358 |
|
string histoName = "num" + tempCurrentObject; |
1359 |
|
|
1360 |
|
|
1361 |
< |
if(find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
1361 |
> |
if(find(objectsToPlot.begin(), objectsToPlot.end(), currentObject) != objectsToPlot.end()) { |
1362 |
|
flagPair lastCutFlags = cumulativeFlags.at(currentObject).at(currentDir); |
1363 |
|
int numToPlot = 0; |
1364 |
< |
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
1365 |
< |
if(lastCutFlags.at(currentFlag).second) numToPlot++; |
1364 |
> |
for (uint iObj = 0; iObj != lastCutFlags.size(); iObj++){ // loop over all the objects |
1365 |
> |
if(lastCutFlags.at(iObj).second) { |
1366 |
> |
numToPlot++; |
1367 |
> |
if (verbose_>3) clog << " Found object " << iObj << " in collection " << currentObject << " to plot." << endl; |
1368 |
> |
} |
1369 |
|
} |
1370 |
|
|
1371 |
|
if(objectToPlot == "primaryvertexs"){ |
1373 |
|
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
1374 |
|
} |
1375 |
|
else { |
1376 |
+ |
if (printEventInfo_) clog << "Number of selected " << objectToPlot << " to plot: " << numToPlot << endl; |
1377 |
|
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(numToPlot,scaleFactor); |
1378 |
|
} |
1379 |
|
} |
1380 |
+ |
|
1381 |
|
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++) |
1382 |
|
|
1383 |
|
|
1393 |
|
|
1394 |
|
if (coll == "jets") assignTreeBranch(brSpecs,jets.product(), cumulativeFlags.at(coll).back()); |
1395 |
|
else if(coll == "secondary jets") assignTreeBranch(brSpecs,jets.product(), cumulativeFlags.at(coll).back()); |
1396 |
< |
else if(coll == "secondary photons") assignTreeBranch(brSpecs,photons.product(), cumulativeFlags.at(coll).back()); |
1396 |
> |
else if(coll == "secondary photons") assignTreeBranch(brSpecs,photons.product(), cumulativeFlags.at(coll).back()); |
1397 |
|
else if(coll == "muons") assignTreeBranch(brSpecs,muons.product(), cumulativeFlags.at(coll).back()); |
1398 |
< |
else if(coll == "secondary muons") assignTreeBranch(brSpecs,muons.product(), cumulativeFlags.at(coll).back()); |
1398 |
> |
else if(coll == "secondary muons") assignTreeBranch(brSpecs,secMuons.product(), cumulativeFlags.at(coll).back()); |
1399 |
|
else if(coll == "electrons") assignTreeBranch(brSpecs,electrons.product(), cumulativeFlags.at(coll).back()); |
1400 |
|
else if(coll == "secondary electrons") assignTreeBranch(brSpecs,electrons.product(), cumulativeFlags.at(coll).back()); |
1401 |
|
else if(coll == "events") assignTreeBranch(brSpecs,events.product(), cumulativeFlags.at(coll).back()); |
1412 |
|
else if(coll == "stops" |
1413 |
|
&& datasetType_ == "signalMC") assignTreeBranch(brSpecs,stops.product(), cumulativeFlags.at(coll).back()); |
1414 |
|
} // end loop over branches |
1415 |
+ |
// set the evtLong, runInt, and lumiInt variables separately, since they are not type float |
1416 |
+ |
BNTreeBranchVals_evtLong_ = events->at(0).evt; |
1417 |
+ |
BNTreeBranchVals_runInt_ = events->at(0).run; |
1418 |
+ |
BNTreeBranchVals_lumiInt_ = events->at(0).lumi; |
1419 |
|
|
1420 |
|
if (!BNTrees_.at(currentChannelIndex)) { clog << "ERROR: Undefined BNTree. Will likely seg fault." << endl; } |
1421 |
|
BNTrees_.at(currentChannelIndex)->Fill(); // only fill if event has passed cuts |
1431 |
|
|
1432 |
|
isFirstEvent_ = false; |
1433 |
|
|
1434 |
+ |
if (verbose_) clog << "Finished OSUAnalysis::produce." << endl; |
1435 |
+ |
|
1436 |
|
} // end void OSUAnalysis::produce (const edm::Event &event, const edm::EventSetup &setup) |
1437 |
|
|
1438 |
|
|
1461 |
|
else if(comparison == "<") return testValue < cutValue; |
1462 |
|
else if(comparison == "<=") return testValue <= cutValue; |
1463 |
|
else if(comparison == "==") return testValue == cutValue; |
1464 |
< |
else if(comparison == "=") return testValue == cutValue; |
1464 |
> |
else if(comparison == "=") return testValue == cutValue; |
1465 |
|
else if(comparison == "!=") return testValue != cutValue; |
1466 |
|
else {clog << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1467 |
|
|
1866 |
|
(object->isGlobalMuon > 0 || |
1867 |
|
object->isTrackerMuon > 0); |
1868 |
|
} |
1869 |
+ |
else if(variable == "looseIDGlobalMuon") { |
1870 |
+ |
value = object->pt > 10 && |
1871 |
+ |
object->isGlobalMuon > 0; |
1872 |
+ |
} |
1873 |
|
else if(variable == "correctedD0VertexErr") value = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1874 |
|
else if(variable == "correctedD0VertexSig") value = object->correctedD0Vertex / hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1875 |
|
else if(variable == "detIso") value = (object->trackIsoDR03) / object->pt; |
1885 |
|
else |
1886 |
|
value = -999; |
1887 |
|
} |
1888 |
< |
|
1889 |
< |
|
1888 |
> |
else if(variable == "ptPlusMet") { |
1889 |
> |
// Calculate the magnitude of the vector sum of the muon pT and the Met. |
1890 |
> |
if (const BNmet *met = chosenMET ()) |
1891 |
> |
{ |
1892 |
> |
TVector2 p2Met; |
1893 |
> |
TVector2 p2Muon; |
1894 |
> |
p2Met. SetMagPhi( met->pt, met->phi); |
1895 |
> |
p2Muon.SetMagPhi(object->pt, object->phi); |
1896 |
> |
TVector2 p2MetElec = p2Met + p2Muon; |
1897 |
> |
value = p2MetElec.Mod(); |
1898 |
> |
} |
1899 |
> |
else |
1900 |
> |
value = -999; |
1901 |
> |
} |
1902 |
|
|
1903 |
|
else if(variable == "correctedD0VertexInEBPlus"){ |
1904 |
|
if(fabs(object->eta) < 0.8 && object->eta > 0) value = object->correctedD0Vertex; |
2270 |
|
value = -999; |
2271 |
|
} |
2272 |
|
|
2273 |
+ |
else if(variable == "ptPlusMet") { |
2274 |
+ |
// Calculate the magnitude of the vector sum of the electron pT and the Met. |
2275 |
+ |
if (const BNmet *met = chosenMET ()) |
2276 |
+ |
{ |
2277 |
+ |
TVector2 p2Met; |
2278 |
+ |
TVector2 p2Elec; |
2279 |
+ |
p2Met. SetMagPhi( met->pt, met->phi); |
2280 |
+ |
p2Elec.SetMagPhi(object->pt, object->phi); |
2281 |
+ |
TVector2 p2MetElec = p2Met + p2Elec; |
2282 |
+ |
value = p2MetElec.Mod(); |
2283 |
+ |
} |
2284 |
+ |
else |
2285 |
+ |
value = -999; |
2286 |
+ |
} |
2287 |
+ |
|
2288 |
|
else if(variable == "correctedD0VertexEEPositiveChargeLowPt"){ |
2289 |
|
if(fabs(object->eta) > 1.479 && object->charge > 0 && object->pt > 45) value = object->correctedD0Vertex; |
2290 |
|
else value = -999; |
2548 |
|
else if(variable == "pthat") value = object->pthat; |
2549 |
|
else if(variable == "qScale") value = object->qScale; |
2550 |
|
else if(variable == "alphaQCD") value = object->alphaQCD; |
2446 |
– |
else if(variable == "Ht") value = getHt(jets.product()); |
2551 |
|
else if(variable == "alphaQED") value = object->alphaQED; |
2552 |
|
else if(variable == "scalePDF") value = object->scalePDF; |
2553 |
|
else if(variable == "x1") value = object->x1; |
2618 |
|
else if(variable == "electronScaleFactor") value = electronScaleFactor_; |
2619 |
|
else if(variable == "stopCTauScaleFactor") value = stopCTauScaleFactor_; |
2620 |
|
else if(variable == "bTagScaleFactor") value = bTagScaleFactor_; |
2621 |
+ |
|
2622 |
+ |
else if(variable == "unfilteredHt") value = getHt(jets.product()); |
2623 |
|
else if(variable == "ht") value = chosenHT (); |
2624 |
+ |
|
2625 |
|
else if(variable == "leadMuPairInvMass"){ |
2626 |
|
pair<const BNmuon *, const BNmuon *> muPair = leadMuonPair (); |
2627 |
|
TLorentzVector p0 (muPair.first->px, muPair.first->py, muPair.first->pz, muPair.first->energy), |
2875 |
|
else if(variable == "nHitsMissingInner") value = object->nHitsMissingInner; |
2876 |
|
else if(variable == "nHitsMissingMiddle") value = object->nHitsMissingMiddle; |
2877 |
|
else if(variable == "depTrkRp3") value = object->depTrkRp3; |
2878 |
< |
else if(variable == "trkRelIsoRp3") value = (object->depTrkRp3 - object->pt) / object->pt; |
2879 |
< |
else if(variable == "trkRelIsoRp5") value = (object->depTrkRp5 - object->pt) / object->pt; |
2878 |
> |
else if(variable == "trkRelIsoRp3") { value = (object->depTrkRp3 - object->pt) / object->pt; if (value<0) value = 0; } |
2879 |
> |
else if(variable == "trkRelIsoRp5") { value = (object->depTrkRp5 - object->pt) / object->pt; if (value<0) value = 0; } |
2880 |
|
else if(variable == "depEcalRp3") value = object->depEcalRp3; |
2881 |
|
else if(variable == "depHcalRp3") value = object->depHcalRp3; |
2882 |
|
else if(variable == "depHoRp3") value = object->depHoRp3; |
2900 |
|
else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz; |
2901 |
|
else if(variable == "depTrkRp5MinusPt"){ |
2902 |
|
if ( (object->depTrkRp5 - object->pt) < 0 ) { |
2903 |
< |
// cout << "Warning: found track with depTrkRp5 < pt: depTrkRp5=" << object->depTrkRp5 |
2903 |
> |
// clog << "Warning: found track with depTrkRp5 < pt: depTrkRp5=" << object->depTrkRp5 |
2904 |
|
// << "; pt=" << object->pt |
2905 |
|
// << "; object->depTrkRp5 - object->pt = " << object->depTrkRp5 - object->pt |
2906 |
|
// << endl; |
2926 |
|
else if(variable == "caloTotDeltaRp5ByP") value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2927 |
|
else if(variable == "caloTotDeltaRp5RhoCorr") value = getTrkCaloTotRhoCorr(object); |
2928 |
|
else if(variable == "caloTotDeltaRp5ByPRhoCorr") value = getTrkCaloTotRhoCorr(object) / pMag; |
2929 |
+ |
else if(variable == "depTrkRp5RhoCorr") value = getTrkDepTrkRp5RhoCorr(object); |
2930 |
+ |
else if(variable == "depTrkRp3RhoCorr") value = getTrkDepTrkRp3RhoCorr(object); |
2931 |
+ |
|
2932 |
+ |
else if(variable == "depTrkRp5MinusPtRhoCorr") { |
2933 |
+ |
if ( (getTrkDepTrkRp5RhoCorr(object) - object->pt) < 0 ) value = 0; |
2934 |
+ |
else {value = (getTrkDepTrkRp5RhoCorr(object) - object->pt );} |
2935 |
+ |
} |
2936 |
+ |
|
2937 |
+ |
else if(variable == "depTrkRp3MinusPtRhoCorr") |
2938 |
+ |
{ |
2939 |
+ |
if ( (getTrkDepTrkRp3RhoCorr(object) - object->pt) < 0 ) value = 0; |
2940 |
+ |
else {value = (getTrkDepTrkRp3RhoCorr(object) - object->pt );} |
2941 |
+ |
} |
2942 |
+ |
|
2943 |
|
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
2944 |
|
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
2945 |
|
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
2964 |
|
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
2965 |
|
} |
2966 |
|
|
2967 |
< |
|
2967 |
> |
else if(variable == "deltaRMinSubLeadJet") { |
2968 |
> |
// calculate minimum deltaR between track and any other subleading jet |
2969 |
> |
double trkJetDeltaRMin = 99.; |
2970 |
> |
for (uint ijet = 0; ijet<jets->size(); ijet++) { |
2971 |
> |
string empty = ""; |
2972 |
> |
double isSubLeadingJet = valueLookup(&jets->at(ijet), "disappTrkSubLeadingJetID", "", empty); |
2973 |
> |
if (!isSubLeadingJet) continue; // only consider jets that pass the subleading jet ID criteria |
2974 |
> |
double jetEta = valueLookup(&jets->at(ijet), "eta", "", empty); |
2975 |
> |
double jetPhi = valueLookup(&jets->at(ijet), "phi", "", empty); |
2976 |
> |
double trkJetDeltaR = deltaR(object->eta, object->phi, jetEta, jetPhi); |
2977 |
> |
if (trkJetDeltaR < trkJetDeltaRMin) trkJetDeltaRMin = trkJetDeltaR; |
2978 |
> |
} |
2979 |
> |
value = trkJetDeltaRMin; |
2980 |
> |
} |
2981 |
> |
|
2982 |
|
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2983 |
|
|
2984 |
|
else if(variable == "genMatchedPdgId"){ |
3026 |
|
|
3027 |
|
|
3028 |
|
|
3029 |
< |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3029 |
> |
else{clog << "WARNING: invalid variable '" << variable << "' for BNtrack collection.\n"; value = -999;} |
3030 |
|
|
3031 |
|
value = applyFunction(function, value); |
3032 |
|
|
3721 |
|
return value; |
3722 |
|
} // end electron-muon pair valueLookup |
3723 |
|
|
3724 |
< |
|
3724 |
> |
|
3725 |
|
//!electron-jet pair valueLookup |
3726 |
|
double |
3727 |
|
OSUAnalysis::valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3761 |
|
return value; |
3762 |
|
} |
3763 |
|
|
3764 |
+ |
//!electron-mcparticle pair valueLookup |
3765 |
+ |
double |
3766 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNmcparticle* object2, string variable, string function, string &stringValue){ |
3767 |
+ |
|
3768 |
+ |
double value = 0.0; |
3769 |
+ |
|
3770 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3771 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3772 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3773 |
+ |
else if(variable == "threeDAngle") |
3774 |
+ |
{ |
3775 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3776 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3777 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3778 |
+ |
} |
3779 |
+ |
else if(variable == "chargeProduct"){ |
3780 |
+ |
value = object1->charge*object2->charge; |
3781 |
+ |
} |
3782 |
+ |
|
3783 |
+ |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3784 |
+ |
value = applyFunction(function, value); |
3785 |
+ |
|
3786 |
+ |
return value; |
3787 |
+ |
} |
3788 |
+ |
|
3789 |
+ |
|
3790 |
|
//!photon-jet pair valueLookup |
3791 |
|
double |
3792 |
|
OSUAnalysis::valueLookup (const BNphoton* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3964 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3965 |
|
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3966 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3967 |
+ |
else if(variable == "deltaRLooseMvaId") { |
3968 |
+ |
// only consider electrons that pass "loose MVA id", i.e., mvaNonTrigV0 > 0; |
3969 |
+ |
// otherwise return very large value (99) |
3970 |
+ |
if (object1->mvaNonTrigV0>0) value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3971 |
+ |
else value = 99.; |
3972 |
+ |
} |
3973 |
|
else if(variable == "invMass"){ |
3974 |
|
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass); |
3975 |
|
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass ); |
3997 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3998 |
|
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3999 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
4000 |
+ |
else if(variable == "deltaRLooseID") { |
4001 |
+ |
// only consider muons that pass looseId criteria; otherwise return very large value (99.) |
4002 |
+ |
string empty = ""; |
4003 |
+ |
double isLooseId = valueLookup(object1, "looseID", "", empty); |
4004 |
+ |
if (isLooseId) value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
4005 |
+ |
else value = 99.; |
4006 |
+ |
} |
4007 |
+ |
else if(variable == "deltaRGlobalMuon") { |
4008 |
+ |
// only consider muons that pass looseId criteria; otherwise return very large value (99.) |
4009 |
+ |
if (object1->isGlobalMuon) value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
4010 |
+ |
else value = 99.; |
4011 |
+ |
} |
4012 |
|
else if(variable == "invMass"){ |
4013 |
|
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, muonMass); |
4014 |
|
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, pionMass ); |
4074 |
|
double value = 0.0; |
4075 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
4076 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
4077 |
+ |
else if(variable == "deltaRLooseHadronicID") { |
4078 |
+ |
// only consider tau's that pass the loose hadronic ID criteria; otherwise return very large value (99) |
4079 |
+ |
string empty = ""; |
4080 |
+ |
double isLooseHadronicID = valueLookup(object1, "looseHadronicID", "", empty); |
4081 |
+ |
|
4082 |
+ |
if (isLooseHadronicID) value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
4083 |
+ |
else value = 99.; |
4084 |
+ |
} |
4085 |
|
else if(variable == "chargeProduct"){ |
4086 |
|
value = object1->charge*object2->charge; |
4087 |
|
} |
4346 |
|
|
4347 |
|
} |
4348 |
|
|
4349 |
+ |
double |
4350 |
+ |
OSUAnalysis::getTrkDepTrkRp5RhoCorr(const BNtrack* track) { |
4351 |
+ |
// Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track. |
4352 |
+ |
if (!useTrackCaloRhoCorr_) return -99; |
4353 |
+ |
// if (!rhokt6CaloJetsHandle_) { |
4354 |
+ |
// clog << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
4355 |
+ |
// return -99; |
4356 |
+ |
// } |
4357 |
+ |
double radDeltaRCone = 0.5; |
4358 |
+ |
double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2); // Define effective area as pi*r^2, where r is radius of DeltaR cone. |
4359 |
+ |
double rawDepTrkRp5 = track->depTrkRp5; |
4360 |
+ |
double depTrkRp5RhoCorr = TMath::Max(0., rawDepTrkRp5 - rhoCorr_kt6CaloJets); |
4361 |
+ |
return depTrkRp5RhoCorr; |
4362 |
+ |
|
4363 |
+ |
} |
4364 |
+ |
|
4365 |
+ |
double |
4366 |
+ |
OSUAnalysis::getTrkDepTrkRp3RhoCorr(const BNtrack* track) { |
4367 |
+ |
// Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track. |
4368 |
+ |
if (!useTrackCaloRhoCorr_) return -99; |
4369 |
+ |
// if (!rhokt6CaloJetsHandle_) { |
4370 |
+ |
// clog << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
4371 |
+ |
// return -99; |
4372 |
+ |
// } |
4373 |
+ |
double radDeltaRCone = 0.3; |
4374 |
+ |
// Define effective area as pi*r^2, where r is radius of DeltaR cone |
4375 |
+ |
double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2); |
4376 |
+ |
double rawDepTrkRp3 = track->depTrkRp3; |
4377 |
+ |
double depTrkRp3RhoCorr = TMath::Max(0., rawDepTrkRp3 - rhoCorr_kt6CaloJets); |
4378 |
+ |
return depTrkRp3RhoCorr; |
4379 |
+ |
|
4380 |
+ |
} |
4381 |
+ |
|
4382 |
|
|
4383 |
|
|
4384 |
|
|
4455 |
|
template <class InputCollection> |
4456 |
|
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, InputCollection inputCollection, string inputType){ |
4457 |
|
|
4458 |
+ |
if (verbose_>2) clog << " Beginning setObjectFlags for cut " << currentCutIndex << ": " << currentCut.name |
4459 |
+ |
<< ", inputType=" << inputType |
4460 |
+ |
<< endl; |
4461 |
|
if (currentCut.inputCollection.find("pair")!=string::npos) { |
4462 |
|
string obj1, obj2; |
4463 |
|
getTwoObjs(currentCut.inputCollection, obj1, obj2); |
4464 |
+ |
if (verbose_>2) clog << " Two object types: " << obj1 << ", " << obj2 << endl; |
4465 |
|
if (inputType==obj1 || |
4466 |
|
inputType==obj2) { |
4467 |
|
// Do not add a cut to individualFlags or cumulativeFlags, if the cut is on a paired collection, |
4473 |
|
} |
4474 |
|
} |
4475 |
|
|
4476 |
+ |
if (!inputCollection) cout << "ERROR: invalid input collection for inputType=" << inputType << endl; |
4477 |
+ |
|
4478 |
+ |
if (verbose_>3) clog << " Collection size: " << inputCollection->size() << endl; |
4479 |
+ |
|
4480 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
4481 |
|
|
4482 |
+ |
if (verbose_>4) clog << " Setting flags for object " << object << endl; |
4483 |
+ |
|
4484 |
|
bool cutDecision = true;//object passes if this cut doesn't cut on that type of object |
4485 |
|
bool plotDecision = true; |
4486 |
|
|
4505 |
|
} |
4506 |
|
cutDecision = tempDecision; |
4507 |
|
} |
4508 |
< |
//invert the cut for plotting if this cut is a veto |
4509 |
< |
if(currentCut.isVeto) plotDecision = !cutDecision; |
4510 |
< |
else plotDecision = cutDecision; |
4508 |
> |
//invert the cut if this cut is a veto |
4509 |
> |
if(currentCut.isVeto) cutDecision = !cutDecision; |
4510 |
> |
plotDecision = cutDecision; |
4511 |
|
} |
4512 |
|
|
4513 |
|
individualFlags.at(inputType).at(currentCutIndex).push_back(make_pair(cutDecision,plotDecision)); |
4528 |
|
|
4529 |
|
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(make_pair(previousCumulativeCutFlag,previousCumulativePlotFlag)); |
4530 |
|
|
4531 |
< |
} |
4531 |
> |
} // for (uint object = 0; object != inputCollection->size(); object++){ |
4532 |
|
|
4533 |
< |
} |
4533 |
> |
} // end void OSUAnalysis::setObjectFlags |
4534 |
|
|
4535 |
|
|
4536 |
|
template <class InputCollection1, class InputCollection2> |
4537 |
< |
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, \ |
4538 |
< |
InputCollection1 inputCollection1, InputCollection2 inputCollection2, flagPair flags1, flagPair flags2, string inputType){ |
4539 |
< |
|
4537 |
> |
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, |
4538 |
> |
InputCollection1 inputCollection1, InputCollection2 inputCollection2, string inputType){ |
4539 |
> |
// This function sets the flags for the paired object collection. |
4540 |
> |
// If the cut is applying on the given paired object collection, then the flags for the single object collections are also set. |
4541 |
> |
// If not, then the flags for the paired object collection are taken as the AND of the flags for each single object collection. |
4542 |
> |
|
4543 |
> |
if (verbose_>2) clog << " Beginning setObjectFlags for cut=" << currentCut.name |
4544 |
> |
<< ", inputType=" << inputType |
4545 |
> |
<< endl; |
4546 |
|
|
4547 |
|
bool sameObjects = false; |
4548 |
< |
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
4548 |
> |
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; // FIXME: is sameObjects just the not of isTwoTypesOfObject? If so, it's redundant. |
4549 |
|
|
4550 |
|
// Get the strings for the two objects that make up the pair. |
4551 |
|
string obj1Type, obj2Type; |
4576 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
4577 |
|
|
4578 |
|
|
4579 |
< |
bool cutDecision = true;//object passes if this cut doesn't cut on that type of object |
4579 |
> |
bool cutDecision = true;//object passes if this cut doesn't cut on that type of object |
4580 |
|
bool plotDecision = true; |
4581 |
|
|
4582 |
+ |
// Determine whether each pair passes the cut, only if inputCollection is the same as the inputType. |
4583 |
|
if(currentCut.inputCollection == inputType){ |
4584 |
|
|
4585 |
|
vector<bool> subcutDecisions; |
4586 |
|
for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){ |
4587 |
|
string stringValue = ""; |
4588 |
|
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex), stringValue); |
4589 |
+ |
if (verbose_>1) clog << currentCut.variables.at(subcutIndex) << " = " << value |
4590 |
+ |
<< endl; |
4591 |
|
if (stringValue == "") subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
4592 |
|
else subcutDecisions.push_back(evaluateComparison(stringValue,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutStringValues.at(subcutIndex))); |
4593 |
|
} |
4603 |
|
} |
4604 |
|
cutDecision = tempDecision; |
4605 |
|
} |
4606 |
< |
//invert the cut for plotting if this cut is a veto |
4607 |
< |
if(currentCut.isVeto) plotDecision = !cutDecision; |
4608 |
< |
else plotDecision = cutDecision; |
4609 |
< |
} |
4610 |
< |
individualFlags.at(inputType).at(currentCutIndex).push_back(make_pair(cutDecision,plotDecision)); |
4611 |
< |
if (cutDecision && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4612 |
< |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1).first = true; |
4613 |
< |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2).first = true; |
4614 |
< |
} |
4615 |
< |
if (plotDecision && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4616 |
< |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1).second = true; |
4617 |
< |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2).second = true; |
4618 |
< |
} |
4606 |
> |
//invert the cut if this cut is a veto |
4607 |
> |
if (currentCut.isVeto) cutDecision = !cutDecision; |
4608 |
> |
plotDecision = cutDecision; |
4609 |
> |
|
4610 |
> |
if (verbose_>1) clog << " cutDecision = " << cutDecision |
4611 |
> |
<< "; for currentCut.inputCollection = " << currentCut.inputCollection |
4612 |
> |
<< "; object1 (" << obj1Type << ") = " << object1 |
4613 |
> |
<< "; object2 (" << obj2Type << ") = " << object2 |
4614 |
> |
<< endl; |
4615 |
> |
|
4616 |
> |
if (cutDecision) { // only set the flags for the individual objects if the pair object is being cut on |
4617 |
> |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1).first = true; |
4618 |
> |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2).first = true; |
4619 |
> |
} |
4620 |
> |
if (plotDecision) { // only set the flags for the individual objects if the pair object is being cut on |
4621 |
> |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1).second = true; |
4622 |
> |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2).second = true; |
4623 |
> |
} |
4624 |
> |
|
4625 |
> |
|
4626 |
> |
} // if(currentCut.inputCollection == inputType){ |
4627 |
> |
|
4628 |
> |
// The individualFlags will be true if the inputCollection is not the same as the inputType. |
4629 |
> |
// They are also independent of the previous flags on the single objects. |
4630 |
> |
individualFlags.at(inputType).at(currentCutIndex).push_back(make_pair(cutDecision,plotDecision)); |
4631 |
> |
|
4632 |
|
|
4633 |
< |
//set flags for objects that pass this cut AND all the previous cuts |
4633 |
> |
|
4634 |
> |
// ************************************ |
4635 |
> |
// Determine cumulative flags |
4636 |
> |
// ************************************ |
4637 |
> |
// determine whether this paired object passes this cut AND all previous cuts |
4638 |
|
bool previousCumulativeCutFlag = true; |
4639 |
|
for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){ |
4640 |
< |
if(previousCumulativeCutFlag && individualFlags.at(inputType).at(previousCutIndex).at(counter).first) previousCumulativeCutFlag = true; |
4641 |
< |
else{ previousCumulativeCutFlag = false; break;} |
4640 |
> |
if(previousCumulativeCutFlag && individualFlags.at(inputType).at(previousCutIndex).at(counter).first) previousCumulativeCutFlag = true; |
4641 |
> |
else{ previousCumulativeCutFlag = false; break;} |
4642 |
|
} |
4643 |
|
previousCumulativeCutFlag = previousCumulativeCutFlag && cutDecision; |
4644 |
|
|
4649 |
|
} |
4650 |
|
previousCumulativePlotFlag = previousCumulativePlotFlag && plotDecision; |
4651 |
|
|
4652 |
< |
//apply flags for the components of the composite object as well |
4652 |
> |
// Get the index for the flags of each of the single objects in the pair. Usually this is the index of the previous cut, i.e., currentCutIndex-1. |
4653 |
> |
int cutIdxFlagsObj1 = max(int(currentCutIndex-1),0); |
4654 |
> |
int cutIdxFlagsObj2 = max(int(currentCutIndex-1),0); |
4655 |
> |
// If the inputCollection of the cut is not equal to the inputType but the inputCollection includes objects that are contained in inputType, then use the currentCutIndex for those collections. |
4656 |
> |
// For example, if the inputType is jet-jet pairs, and the inputCollection is track-jet pairs, then use currentCutIndex for cutIdxFlagsObj{1,2}, i.e., for both jets. |
4657 |
> |
// For example, if the inputType is jets, and the inputCollection is track-jet pairs, then use currentCutIndex for cutIdxFlagsObj2 (jets) and currentCutIndex-1 for cutIdxFlagsObj1 (tracks). |
4658 |
> |
if (currentCut.inputCollection != inputType) { |
4659 |
> |
if (currentCut.inputCollection.find(obj1Type)!=string::npos) cutIdxFlagsObj1 = currentCutIndex; |
4660 |
> |
if (currentCut.inputCollection.find(obj2Type)!=string::npos) cutIdxFlagsObj2 = currentCutIndex; |
4661 |
> |
} |
4662 |
> |
flagPair flags1 = cumulativeFlags.at(obj1Type).at(cutIdxFlagsObj1); // flag for input collection 1 |
4663 |
> |
flagPair flags2 = cumulativeFlags.at(obj2Type).at(cutIdxFlagsObj2); // flag for input collection 2 |
4664 |
> |
|
4665 |
> |
// The cumulative flag is only true if the paired object cumulative flag is true, and if the single object cumulative flags are true. |
4666 |
|
bool currentCumulativeCutFlag = true; |
4667 |
|
bool currentCumulativePlotFlag = true; |
4399 |
– |
|
4668 |
|
if(flags1.size() == 0 && flags2.size() == 0) currentCumulativeCutFlag = previousCumulativeCutFlag; |
4669 |
|
else if(flags1.size() == 0) currentCumulativeCutFlag = previousCumulativeCutFlag && flags2.at(object2).first; |
4670 |
|
else if(flags2.size() == 0) currentCumulativeCutFlag = previousCumulativeCutFlag && flags1.at(object1).first; |
4675 |
|
else if(flags2.size() == 0) currentCumulativePlotFlag = previousCumulativePlotFlag && flags1.at(object1).second; |
4676 |
|
else currentCumulativePlotFlag = previousCumulativePlotFlag && flags1.at(object1).first && flags2.at(object2).second; |
4677 |
|
|
4678 |
< |
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(make_pair(currentCumulativeCutFlag,currentCumulativePlotFlag)); |
4678 |
> |
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(make_pair(currentCumulativeCutFlag,currentCumulativePlotFlag)); // Set the flag for the paired object |
4679 |
|
|
4412 |
– |
if (currentCumulativeCutFlag && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4413 |
– |
cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1).first = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1, "cut"); |
4414 |
– |
cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2).first = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2, "cut"); |
4415 |
– |
} |
4680 |
|
|
4681 |
< |
if (currentCumulativePlotFlag && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4681 |
> |
if (currentCumulativeCutFlag && currentCut.inputCollection == inputType) { // Set the flags for the individual objects if the paired object is being cut on. |
4682 |
> |
cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1).first = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1, "cut"); |
4683 |
> |
cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2).first = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2, "cut"); |
4684 |
|
cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1).second = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1, "plot"); |
4685 |
|
cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2).second = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2, "plot"); |
4686 |
+ |
|
4687 |
+ |
if (verbose_>1) clog << " previousCumulativeCutFlag for object1 = " << getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object1, "cut") << endl; |
4688 |
+ |
if (verbose_>1) clog << " previousCumulativeCutFlag for object2 = " << getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2, "cut") << endl; |
4689 |
+ |
|
4690 |
|
} |
4691 |
|
|
4692 |
|
counter++; |
4694 |
|
} // end for (uint object2 = 0; object2 != inputCollection2->size(); object2++) |
4695 |
|
} // end for (uint object1 = 0; object1 != inputCollection1->size(); object1++) |
4696 |
|
|
4697 |
< |
} |
4697 |
> |
} // end void OSUAnalysis::setObjectFlags |
4698 |
|
|
4699 |
|
|
4700 |
|
bool OSUAnalysis::getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1, string flagType) { |
4739 |
|
template <class InputCollection> |
4740 |
|
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection inputCollection, flagPair flags, double scaleFactor){ |
4741 |
|
|
4742 |
+ |
if (verbose_>2) clog << " Filling histogram for " << parameters.name << endl; |
4743 |
|
|
4744 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
4745 |
|
|
4763 |
|
|
4764 |
|
if (printEventInfo_) { |
4765 |
|
// Write information about event to screen, for testing purposes. |
4766 |
< |
clog << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
4766 |
> |
clog << " Info for event: value for histogram " << histo->GetName() << ": " << value << " (object number " << object << ")" << endl; |
4767 |
|
} |
4768 |
|
|
4769 |
|
} |
4770 |
|
} |
4771 |
|
|
4772 |
|
template <class InputCollection1, class InputCollection2> |
4773 |
< |
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, flagPair flags1, flagPair flags2, flagPair pairFlags, double scaleFactor){ |
4773 |
> |
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, |
4774 |
> |
flagPair pairFlags, double scaleFactor){ |
4775 |
|
|
4776 |
|
bool sameObjects = false; |
4777 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
4783 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
4784 |
|
|
4785 |
|
pairCounter++; |
4514 |
– |
//only take objects which have passed all cuts and pairs which have passed all cuts |
4515 |
– |
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1).second) continue; |
4516 |
– |
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2).second) continue; |
4786 |
|
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter).second) continue; |
4787 |
|
|
4788 |
|
string currentString = parameters.inputVariables.at(0); |
4801 |
|
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue); |
4802 |
|
histo->Fill(value,scaleFactor); |
4803 |
|
|
4804 |
+ |
if (printEventInfo_) { |
4805 |
+ |
// Write information about event to screen, for testing purposes. |
4806 |
+ |
clog << " Info for event: value for histogram " << histo->GetName() << ": " << value |
4807 |
+ |
<< " (object1 number " << object1 << "), " |
4808 |
+ |
<< " (object2 number " << object2 << ")" |
4809 |
+ |
<< endl; |
4810 |
+ |
} |
4811 |
+ |
|
4812 |
|
} |
4813 |
|
} |
4814 |
|
|
4857 |
|
} |
4858 |
|
|
4859 |
|
template <class InputCollection1, class InputCollection2> |
4860 |
< |
void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, flagPair flags1, flagPair flags2, flagPair pairFlags, double scaleFactor){ |
4860 |
> |
void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, |
4861 |
> |
flagPair pairFlags, double scaleFactor){ |
4862 |
|
|
4863 |
|
bool sameObjects = false; |
4864 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
4871 |
|
|
4872 |
|
pairCounter++; |
4873 |
|
|
4596 |
– |
//only take objects which have passed all cuts and pairs which have passed all cuts |
4597 |
– |
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1).second) continue; |
4598 |
– |
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2).second) continue; |
4874 |
|
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter).second) continue; |
4875 |
|
|
4876 |
|
string stringValue = ""; |