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; |
629 |
|
else if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
630 |
|
else if(currentObject == "electron-trigobj pairs") currentObject = "electronTrigobjPairs"; |
631 |
|
else if(currentObject == "muon-trigobj pairs") currentObject = "muonTrigobjPairs"; |
632 |
+ |
else if(currentObject == "electron-mcparticle pairs") currentObject = "electronMCparticlePairs"; |
633 |
+ |
|
634 |
|
|
635 |
|
currentObject.at(0) = toupper(currentObject.at(0)); |
636 |
|
string histoName = "num" + currentObject; |
644 |
|
else |
645 |
|
oneDHists_.at(currentChannel).at(currentDir)[histoName] = directories.at(currentDir).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
646 |
|
} |
647 |
+ |
|
648 |
+ |
if (verbose_) { |
649 |
+ |
clog << "List of 1D histograms booked for channel " << channelName << " and directory " << currentDir << ":" << endl; |
650 |
+ |
for(map<string, TH1D*>::iterator |
651 |
+ |
iter = oneDHists_.at(currentChannel).at(currentDir).begin(); |
652 |
+ |
iter != oneDHists_.at(currentChannel).at(currentDir).end(); |
653 |
+ |
iter++) { |
654 |
+ |
clog << " " << iter->first |
655 |
+ |
<< ": name=" << iter->second->GetName() |
656 |
+ |
<< ", title=" << iter->second->GetTitle() |
657 |
+ |
<< ", bins=(" << iter->second->GetNbinsX() |
658 |
+ |
<< "," << iter->second->GetXaxis()->GetXmin() |
659 |
+ |
<< "," << iter->second->GetXaxis()->GetXmax() |
660 |
+ |
<< ")" << endl; |
661 |
+ |
} |
662 |
+ |
clog << "List of 2D histograms booked for channel " << channelName << " and directory " << currentDir << ":" << endl; |
663 |
+ |
for(map<string, TH2D*>::iterator |
664 |
+ |
iter = twoDHists_.at(currentChannel).at(currentDir).begin(); |
665 |
+ |
iter != twoDHists_.at(currentChannel).at(currentDir).end(); |
666 |
+ |
iter++) { |
667 |
+ |
clog << " " << iter->first |
668 |
+ |
<< ": name=" << iter->second->GetName() |
669 |
+ |
<< ", title=" << iter->second->GetTitle() |
670 |
+ |
<< ", binsX=(" << iter->second->GetNbinsX() |
671 |
+ |
<< "," << iter->second->GetXaxis()->GetXmin() |
672 |
+ |
<< "," << iter->second->GetXaxis()->GetXmax() |
673 |
+ |
<< ")" |
674 |
+ |
<< ", binsY=(" << iter->second->GetNbinsY() |
675 |
+ |
<< "," << iter->second->GetYaxis()->GetXmin() |
676 |
+ |
<< "," << iter->second->GetYaxis()->GetXmax() |
677 |
+ |
<< ")" |
678 |
+ |
<< endl; |
679 |
+ |
} |
680 |
+ |
} |
681 |
+ |
|
682 |
|
}//end of loop over directories |
683 |
|
channels.push_back(tempChannel); |
684 |
|
tempChannel.cuts.clear(); |
685 |
|
}//end loop over channels |
686 |
|
|
687 |
|
|
688 |
+ |
// Create the cutflow histogram and fill with 0 weight, in case no events are found in the input file. |
689 |
+ |
for(uint currentChannelIndex = 0; currentChannelIndex != channels.size(); currentChannelIndex++){ |
690 |
+ |
channel currentChannel = channels.at(currentChannelIndex); |
691 |
+ |
if(currentChannel.triggers.size() != 0 || currentChannel.triggersToVeto.size() != 0){ //triggers specified |
692 |
+ |
cutFlows_.at(currentChannelIndex)->at("trigger") = true; |
693 |
+ |
} |
694 |
+ |
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
695 |
+ |
cut currentCut = currentChannel.cuts.at(currentCutIndex); |
696 |
+ |
cutFlows_.at(currentChannelIndex)->at (currentCut.name) = true; |
697 |
+ |
} |
698 |
+ |
cutFlows_.at(currentChannelIndex)->fillCutFlow(0); // fill cutflow with 0 weight, just to create the cutflow histograms |
699 |
+ |
} |
700 |
+ |
|
701 |
|
//make unique vector of objects we need to get from the event |
702 |
|
sort( objectsToGet.begin(), objectsToGet.end() ); |
703 |
|
objectsToGet.erase( unique( objectsToGet.begin(), objectsToGet.end() ), objectsToGet.end() ); |
708 |
|
sort( objectsToFlag.begin(), objectsToFlag.end() ); |
709 |
|
objectsToFlag.erase( unique( objectsToFlag.begin(), objectsToFlag.end() ), objectsToFlag.end() ); |
710 |
|
|
711 |
+ |
// 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. |
712 |
+ |
for (uint i=0; i<objectsToFlag.size(); i++) { |
713 |
+ |
if (objectsToFlag.at(i).find("pairs")!=string::npos) { // if it contains "pairs" |
714 |
+ |
objectsToFlag.push_back(objectsToFlag.at(i)); |
715 |
+ |
objectsToFlag.erase(objectsToFlag.begin()+i); |
716 |
+ |
} |
717 |
+ |
} |
718 |
+ |
|
719 |
+ |
if (verbose_) { |
720 |
+ |
clog << "List of channels:" << endl; |
721 |
+ |
for (uint i=0; i<channels.size(); i++) { |
722 |
+ |
clog << " " << channels.at(i).name << endl; |
723 |
+ |
} |
724 |
+ |
clog << "List of objects to get:" << endl; |
725 |
+ |
for (uint i=0; i<objectsToGet.size(); i++) { |
726 |
+ |
clog << " " << objectsToGet.at(i) << endl; |
727 |
+ |
} |
728 |
+ |
clog << "List of objects to plot:" << endl; |
729 |
+ |
for (uint i=0; i<objectsToPlot.size(); i++) { |
730 |
+ |
clog << " " << objectsToPlot.at(i) << endl; |
731 |
+ |
} |
732 |
+ |
clog << "List of objects to cut:" << endl; |
733 |
+ |
for (uint i=0; i<objectsToCut.size(); i++) { |
734 |
+ |
clog << " " << objectsToCut.at(i) << endl; |
735 |
+ |
} |
736 |
+ |
clog << "List of objects to flag:" << endl; |
737 |
+ |
for (uint i=0; i<objectsToFlag.size(); i++) { |
738 |
+ |
clog << " " << objectsToFlag.at(i) << endl; |
739 |
+ |
} |
740 |
+ |
} |
741 |
+ |
|
742 |
|
produces<map<string, bool> > ("channelDecisions"); |
743 |
|
|
744 |
|
if (printEventInfo_) { |
745 |
|
findEventsLog = new ofstream(); |
746 |
|
findEventsLog->open("findEvents.txt"); |
747 |
|
clog << "Listing run:lumi:event in file findEvents.txt for events that pass full selection (of any channel)." << endl; |
748 |
< |
} |
748 |
> |
} else { |
749 |
> |
findEventsLog = 0; |
750 |
> |
} |
751 |
|
|
752 |
|
isFirstEvent_ = true; |
753 |
|
|
754 |
< |
} // end constructor OSUAnalysis::OSUAnalysis() |
754 |
> |
if (verbose_) clog << "Finished OSUAnalysis::OSUAnalysis constructor." << endl; |
755 |
> |
|
756 |
> |
|
757 |
> |
} // end constructor OSUAnalysis::OSUAnalysis() |
758 |
|
|
759 |
|
|
760 |
|
OSUAnalysis::~OSUAnalysis () |
761 |
|
{ |
762 |
|
|
763 |
+ |
if (verbose_) clog << "Beginning OSUAnalysis::OSUAnalysis destructor." << endl; |
764 |
+ |
|
765 |
|
// Destroying the CutFlow objects causes the cut flow numbers and time |
766 |
|
// information to be printed to standard output. |
767 |
|
for(uint currentChannel = 0; currentChannel != channels_.size(); currentChannel++){ |
774 |
|
clog << "Successfully completed OSUAnalysis." << endl; |
775 |
|
clog << "=============================================" << endl; |
776 |
|
|
777 |
+ |
if (verbose_) clog << "Finished OSUAnalysis::OSUAnalysis destructor." << endl; |
778 |
+ |
|
779 |
|
} |
780 |
|
|
781 |
|
void |
783 |
|
{ |
784 |
|
// Retrieve necessary collections from the event. |
785 |
|
|
786 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end()) |
786 |
> |
if (verbose_) clog << "Beginning OSUAnalysis::produce." << endl; |
787 |
> |
|
788 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end()) { |
789 |
|
event.getByLabel (triggers_, triggers); |
790 |
+ |
if (!triggers.product()) cout << "ERROR: could not get triggers input collection" << endl; |
791 |
+ |
} |
792 |
|
|
793 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "trigobjs") != objectsToGet.end()) |
793 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "trigobjs") != objectsToGet.end()) { |
794 |
|
event.getByLabel (trigobjs_, trigobjs); |
795 |
+ |
if (!trigobjs.product()) cout << "ERROR: could not get trigobjs input collection" << endl; |
796 |
+ |
} |
797 |
|
|
798 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end()) |
798 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end()) { |
799 |
|
event.getByLabel (jets_, jets); |
800 |
+ |
if (!jets.product()) cout << "ERROR: could not get jets input collection" << endl; |
801 |
+ |
} |
802 |
|
|
803 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end()) |
803 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end()) { |
804 |
|
event.getByLabel (muons_, muons); |
805 |
+ |
if (!muons.product()) cout << "ERROR: could not get muons input collection" << endl; |
806 |
+ |
} |
807 |
|
|
808 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end()) |
808 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "secondary muons") != objectsToGet.end()) { |
809 |
> |
event.getByLabel (secMuons_, secMuons); |
810 |
> |
if (!secMuons.product()) cout << "ERROR: could not get secMuons input collection" << endl; |
811 |
> |
} |
812 |
> |
|
813 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end()) { |
814 |
|
event.getByLabel (electrons_, electrons); |
815 |
+ |
if (!electrons.product()) cout << "ERROR: could not get electrons input collection" << endl; |
816 |
+ |
} |
817 |
|
|
818 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end()) |
818 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end()) { |
819 |
|
event.getByLabel (events_, events); |
820 |
+ |
if (!events.product()) cout << "ERROR: could not get events input collection" << endl; |
821 |
+ |
} |
822 |
|
|
823 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end()) |
823 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end()) { |
824 |
|
event.getByLabel (taus_, taus); |
825 |
+ |
if (!taus.product()) cout << "ERROR: could not get taus input collection" << endl; |
826 |
+ |
} |
827 |
|
|
828 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end()) |
828 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end()) { |
829 |
|
event.getByLabel (mets_, mets); |
830 |
+ |
if (!mets.product()) cout << "ERROR: could not get mets input collection" << endl; |
831 |
+ |
} |
832 |
|
|
833 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end()) |
833 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end()) { |
834 |
|
event.getByLabel (tracks_, tracks); |
835 |
+ |
if (!tracks.product()) cout << "ERROR: could not get tracks input collection" << endl; |
836 |
+ |
} |
837 |
|
|
838 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end()) |
838 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end()) { |
839 |
|
event.getByLabel (genjets_, genjets); |
840 |
+ |
if (!genjets.product()) cout << "ERROR: could not get genjets input collection" << endl; |
841 |
+ |
} |
842 |
|
|
843 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end()) |
843 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end()) { |
844 |
|
event.getByLabel (mcparticles_, mcparticles); |
845 |
+ |
if (!mcparticles.product()) cout << "ERROR: could not get mcparticles input collection" << endl; |
846 |
+ |
} |
847 |
|
|
848 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end()) |
848 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end()) { |
849 |
|
event.getByLabel (primaryvertexs_, primaryvertexs); |
850 |
+ |
if (!primaryvertexs.product()) cout << "ERROR: could not get primaryvertexs input collection" << endl; |
851 |
+ |
} |
852 |
|
|
853 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end()) |
853 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end()) { |
854 |
|
event.getByLabel (bxlumis_, bxlumis); |
855 |
+ |
if (!bxlumis.product()) cout << "ERROR: could not get bxlumis input collection" << endl; |
856 |
+ |
} |
857 |
|
|
858 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end()) |
858 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end()) { |
859 |
|
event.getByLabel (photons_, photons); |
860 |
+ |
if (!photons.product()) cout << "ERROR: could not get photons input collection" << endl; |
861 |
+ |
} |
862 |
|
|
863 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) |
863 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) { |
864 |
|
event.getByLabel (superclusters_, superclusters); |
865 |
+ |
if (!superclusters.product()) cout << "ERROR: could not get superclusters input collection" << endl; |
866 |
+ |
} |
867 |
|
|
868 |
|
if (datasetType_ == "signalMC"){ |
869 |
< |
if (find(objectsToGet.begin(), objectsToGet.end(), "stops") != objectsToGet.end()) |
869 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "stops") != objectsToGet.end()) { |
870 |
|
event.getByLabel (stops_, stops); |
871 |
+ |
if (!stops.product()) cout << "ERROR: could not get stops input collection" << endl; |
872 |
+ |
} |
873 |
|
} |
874 |
|
|
875 |
|
if (useTrackCaloRhoCorr_) { |
878 |
|
// For description of rho values for different jet reconstruction algorithms, see |
879 |
|
// https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms |
880 |
|
event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_); |
881 |
+ |
if (!rhokt6CaloJetsHandle_.product()) cout << "ERROR: could not get kt6CaloJets input collection" << endl; |
882 |
|
} |
883 |
|
|
884 |
|
double masterScaleFactor = 1.0; |
900 |
|
auto_ptr<map<string, bool> > channelDecisions (new map<string, bool>); |
901 |
|
for(uint currentChannelIndex = 0; currentChannelIndex != channels.size(); currentChannelIndex++){ |
902 |
|
channel currentChannel = channels.at(currentChannelIndex); |
903 |
+ |
if (verbose_>1) clog << " Processing channel " << currentChannel.name << endl; |
904 |
|
|
905 |
|
flagMap individualFlags; |
906 |
|
counterMap passingCounter; |
920 |
|
//loop over all cuts |
921 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
922 |
|
cut currentCut = currentChannel.cuts.at(currentCutIndex); |
923 |
+ |
if (verbose_>2) clog << " Processing cut, index: " << currentCutIndex << ", input collection: " << currentCut.inputCollection << ", name: " << currentCut.name << endl; |
924 |
|
|
925 |
|
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToFlag.size(); currentObjectIndex++){ |
926 |
|
string currentObject = objectsToFlag.at(currentObjectIndex); |
932 |
|
} |
933 |
|
|
934 |
|
//set flags for all relevant objects |
935 |
< |
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToFlag.size(); currentObjectIndex++){ |
936 |
< |
string currentObject = objectsToFlag.at(currentObjectIndex); |
937 |
< |
|
938 |
< |
int flagsForPairCutsIndex = max(int(currentCutIndex-1),0); |
939 |
< |
|
940 |
< |
|
941 |
< |
if (currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
942 |
< |
else if(currentObject == "secondary jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"secondary jets"); |
943 |
< |
else if(currentObject == "secondary photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"secondary photons"); |
944 |
< |
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
945 |
< |
else if(currentObject == "secondary muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"secondary muons"); |
935 |
> |
for(int currentObjectIndex = -1; currentObjectIndex != int(objectsToFlag.size()); currentObjectIndex++){ |
936 |
> |
string currentObject; |
937 |
> |
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. |
938 |
> |
else currentObject = objectsToFlag.at(currentObjectIndex); |
939 |
> |
if (currentObjectIndex >= 0 && currentObject == currentCut.inputCollection) continue; // Flags have already been set for the inputCollection object, so should not be set again. |
940 |
> |
|
941 |
> |
// single object collections |
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,secMuons.product(),"secondary muons"); |
947 |
|
else if(currentObject == "secondary electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"secondary electrons"); |
948 |
< |
else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons"); |
949 |
< |
else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events"); |
950 |
< |
else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus"); |
951 |
< |
else if(currentObject == "mets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mets.product(),"mets"); |
952 |
< |
else if(currentObject == "tracks") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),"tracks"); |
953 |
< |
else if(currentObject == "genjets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,genjets.product(),"genjets"); |
954 |
< |
else if(currentObject == "mcparticles") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mcparticles.product(),"mcparticles"); |
955 |
< |
else if(currentObject == "primaryvertexs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,primaryvertexs.product(),"primaryvertexs"); |
956 |
< |
else if(currentObject == "bxlumis") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,bxlumis.product(),"bxlumis"); |
957 |
< |
else if(currentObject == "photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"photons"); |
958 |
< |
else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters"); |
959 |
< |
else if(currentObject == "trigobjs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,trigobjs.product(),"trigobjs"); |
960 |
< |
|
961 |
< |
|
962 |
< |
|
963 |
< |
else if(currentObject == "muon-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
964 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
965 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
966 |
< |
"muon-muon pairs"); |
967 |
< |
|
968 |
< |
else if(currentObject == "muon-secondary muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
969 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
970 |
< |
cumulativeFlags.at("secondary muons").at(flagsForPairCutsIndex), \ |
971 |
< |
"muon-secondary muon pairs"); |
972 |
< |
|
973 |
< |
else if(currentObject == "muon-secondary photon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),photons.product(), \ |
974 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
975 |
< |
cumulativeFlags.at("secondary photons").at(flagsForPairCutsIndex), \ |
976 |
< |
"muon-secondary photon pairs"); |
977 |
< |
else if(currentObject == "muon-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), \ |
978 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
979 |
< |
cumulativeFlags.at("secondary jets").at(flagsForPairCutsIndex), \ |
980 |
< |
"muon-secondary jet pairs"); |
981 |
< |
else if(currentObject == "photon-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),jets.product(), \ |
982 |
< |
cumulativeFlags.at("photons").at(flagsForPairCutsIndex), \ |
983 |
< |
cumulativeFlags.at("secondary jets").at(flagsForPairCutsIndex), \ |
984 |
< |
"photon-secondary jet pairs"); |
985 |
< |
|
986 |
< |
else if(currentObject == "electron-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), \ |
987 |
< |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
988 |
< |
cumulativeFlags.at("secondary jets").at(flagsForPairCutsIndex), \ |
989 |
< |
"electron-secondary jet pairs"); |
990 |
< |
|
991 |
< |
else if(currentObject == "electron-secondary electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
992 |
< |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
836 |
< |
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"); |
948 |
> |
else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons"); |
949 |
> |
else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events"); |
950 |
> |
else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus"); |
951 |
> |
else if(currentObject == "mets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mets.product(),"mets"); |
952 |
> |
else if(currentObject == "tracks") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),"tracks"); |
953 |
> |
else if(currentObject == "genjets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,genjets.product(),"genjets"); |
954 |
> |
else if(currentObject == "mcparticles") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mcparticles.product(),"mcparticles"); |
955 |
> |
else if(currentObject == "primaryvertexs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,primaryvertexs.product(),"primaryvertexs"); |
956 |
> |
else if(currentObject == "bxlumis") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,bxlumis.product(),"bxlumis"); |
957 |
> |
else if(currentObject == "photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"photons"); |
958 |
> |
else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters"); |
959 |
> |
else if(currentObject == "trigobjs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,trigobjs.product(),"trigobjs"); |
960 |
> |
|
961 |
> |
|
962 |
> |
// paired object collections |
963 |
> |
else if(currentObject == "muon-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), "muon-muon pairs"); |
964 |
> |
else if(currentObject == "muon-secondary muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),secMuons.product(), "muon-secondary muon pairs"); |
965 |
> |
|
966 |
> |
else if(currentObject == "muon-secondary photon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),photons.product(), "muon-secondary photon pairs"); |
967 |
> |
else if(currentObject == "muon-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), "muon-secondary jet pairs"); |
968 |
> |
else if(currentObject == "photon-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),jets.product(), "photon-secondary jet pairs"); |
969 |
> |
else if(currentObject == "electron-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), "electron-secondary jet pairs"); |
970 |
> |
else if(currentObject == "electron-secondary electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), "electron-secondary electron pairs"); |
971 |
> |
|
972 |
> |
else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), "electron-electron pairs"); |
973 |
> |
else if(currentObject == "electron-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),muons.product(), "electron-muon pairs"); |
974 |
> |
else if(currentObject == "jet-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),jets.product(), "jet-jet pairs"); |
975 |
> |
else if(currentObject == "jet-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),jets.product(), "jet-secondary jet pairs"); |
976 |
> |
else if(currentObject == "electron-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), "electron-jet pairs"); |
977 |
> |
else if(currentObject == "electron-photon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),photons.product(), "electron-photon pairs"); |
978 |
> |
else if(currentObject == "photon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),jets.product(), "photon-jet pairs"); |
979 |
> |
else if(currentObject == "muon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), "muon-jet pairs"); |
980 |
> |
else if(currentObject == "muon-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),events.product(), "muon-event pairs"); |
981 |
> |
else if(currentObject == "met-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mets.product(),jets.product(), "met-jet pairs"); |
982 |
> |
else if(currentObject == "track-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),jets.product(), "track-jet pairs"); |
983 |
> |
else if(currentObject == "muon-photon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),photons.product(), "muon-photon pairs"); |
984 |
> |
else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), "track-event pairs"); |
985 |
> |
else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(),"electron-track pairs"); |
986 |
> |
else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(),"muon-track pairs"); |
987 |
> |
else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(),"muon-tau pairs"); |
988 |
> |
else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),taus.product(),"tau-tau pairs"); |
989 |
> |
else if(currentObject == "tau-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(),"tau-track pairs"); |
990 |
> |
else if(currentObject == "electron-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),trigobjs.product(),"electron-trigobj pairs"); |
991 |
> |
else if(currentObject == "muon-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),trigobjs.product(),"muon-trigobj pairs"); |
992 |
> |
else if(currentObject == "electron-mcparticle pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),mcparticles.product(),"electron-mcparticle pairs"); |
993 |
|
|
994 |
|
if(currentObject == "stops" && datasetType_ == "signalMC") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,stops.product(),"stops"); |
995 |
|
} |
996 |
|
|
997 |
+ |
}//end loop over all cuts |
998 |
|
|
999 |
|
|
925 |
– |
}//end loop over all cuts |
926 |
– |
//use cumulative flags to apply cuts at event level |
1000 |
|
|
1001 |
< |
//a vector to store cumulative cut descisions after each cut. |
1002 |
< |
vector<bool> eventPassedPreviousCuts; |
1001 |
> |
//use cumulative flags to apply cuts at event level |
1002 |
> |
vector<bool> eventPassedPreviousCuts; //a vector to store cumulative cut descisions after each cut. |
1003 |
|
bool eventPassedAllCuts = true; |
1004 |
< |
//apply trigger (true if none were specified) |
932 |
< |
eventPassedAllCuts = eventPassedAllCuts && triggerDecision; |
1004 |
> |
eventPassedAllCuts = eventPassedAllCuts && triggerDecision; //apply trigger (true if none were specified) |
1005 |
|
|
1006 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
1007 |
|
|
1008 |
|
//loop over all objects and count how many passed the cumulative selection up to this point |
1009 |
|
cut currentCut = currentChannel.cuts.at(currentCutIndex); |
1010 |
|
int numberPassing = 0; |
1011 |
+ |
int numberPassingPrev = 0; // number of objects that pass cuts up to the previous one |
1012 |
|
|
1013 |
|
for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++){ |
1014 |
|
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object).first) numberPassing++; |
1015 |
|
} |
1016 |
< |
bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired); |
1016 |
> |
bool cutDecision; |
1017 |
> |
if (!currentCut.isVeto) { |
1018 |
> |
cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired); |
1019 |
> |
} else { |
1020 |
> |
int prevCutIndex = currentCutIndex - 1; |
1021 |
> |
if (prevCutIndex<0) { |
1022 |
> |
numberPassingPrev = cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size(); // count all objects in collection if cut is the first |
1023 |
> |
} else { |
1024 |
> |
for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(prevCutIndex).size() ; object++){ |
1025 |
> |
if (cumulativeFlags.at(currentCut.inputCollection).at(prevCutIndex).at(object).first) { |
1026 |
> |
numberPassingPrev++; |
1027 |
> |
if (verbose_>1) clog << " object passed previous cut" << endl; |
1028 |
> |
} |
1029 |
> |
} |
1030 |
> |
} |
1031 |
> |
int numberFailCut = numberPassingPrev - numberPassing; |
1032 |
> |
cutDecision = evaluateComparison(numberFailCut,currentCut.eventComparativeOperator,currentCut.numberRequired); |
1033 |
> |
} |
1034 |
> |
|
1035 |
|
cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision; |
1036 |
|
eventPassedAllCuts = eventPassedAllCuts && cutDecision; |
1037 |
|
eventPassedPreviousCuts.push_back(eventPassedAllCuts); |
1038 |
+ |
if (verbose_>1) clog << " Event passed cuts up to cut index " << currentCutIndex << endl; |
1039 |
+ |
|
1040 |
|
} |
1041 |
|
//applying all appropriate scale factors |
1042 |
|
double scaleFactor = masterScaleFactor; |
1101 |
|
scaleFactor *= electronScaleFactor_; |
1102 |
|
scaleFactor *= bTagScaleFactor_; |
1103 |
|
cutFlows_.at(currentChannelIndex)->fillCutFlow(scaleFactor); |
1104 |
+ |
if (verbose_>1) clog << " Scale factors applied: " |
1105 |
+ |
<< " muonScaleFactor_ = " << muonScaleFactor_ |
1106 |
+ |
<< ", electronScaleFactor_ = " << electronScaleFactor_ |
1107 |
+ |
<< ", bTagScaleFactor_ = " << bTagScaleFactor_ |
1108 |
+ |
<< ", total scale factor = " << scaleFactor |
1109 |
+ |
<< endl; |
1110 |
+ |
|
1111 |
|
|
1112 |
|
if (printEventInfo_ && eventPassedAllCuts) { |
1113 |
|
// Write information about event to screen, for testing purposes. |
1126 |
|
|
1127 |
|
|
1128 |
|
//filling histograms |
1129 |
< |
for(uint currentCut = 0; currentCut != oneDHists_.at(currentChannelIndex).size(); currentCut++){//loop over all the directories in each channel. |
1129 |
> |
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. |
1130 |
> |
|
1131 |
> |
if (verbose_>2) clog << " Filling histograms for currentcut = " << currentCut << endl; |
1132 |
> |
|
1133 |
|
uint currentDir; |
1134 |
|
if (!GetPlotsAfterEachCut_) { currentDir = currentChannel.cuts.size() - oneDHists_.at(currentChannelIndex).size(); } //if GetPlotsAfterEachCut_ is false, set currentDir point to the last cut. |
1135 |
|
else{ |
1144 |
|
|
1145 |
|
if (cumulativeFlags.count(currentHistogram.inputCollection) == 0) clog << "Error: no flags found for collection: " << currentHistogram.inputCollection << ", will cause a seg fault" << endl; |
1146 |
|
|
1147 |
+ |
if (verbose_>1) clog << " Filling histogram " << currentHistogram.name << " for collection " << currentHistogram.inputCollection << endl; |
1148 |
+ |
|
1149 |
|
if(currentHistogram.inputVariables.size() == 1){ |
1150 |
|
TH1D* histo; |
1151 |
|
histo = oneDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
1152 |
< |
if (currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
1152 |
> |
if (currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
1153 |
|
else if(currentHistogram.inputCollection == "secondary jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
1154 |
|
else if(currentHistogram.inputCollection == "secondary photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("secondary photons").at(currentDir),scaleFactor); |
1155 |
|
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
1156 |
< |
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
1156 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,secMuons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
1157 |
|
else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
1158 |
< |
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), \ |
1158 |
> |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), |
1159 |
|
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
1160 |
< |
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), \ |
1160 |
> |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),secMuons.product(), |
1161 |
|
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
1162 |
< |
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), \ |
1162 |
> |
else if(currentHistogram.inputCollection == "muon-secondary photon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),photons.product(), |
1163 |
|
cumulativeFlags.at("muon-secondary photon pairs").at(currentDir),scaleFactor); |
1164 |
< |
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), \ |
1164 |
> |
else if(currentHistogram.inputCollection == "muon-secondary jet pairs") fill1DHistogram(histo,currentHistogram,muons.product(),jets.product(), |
1165 |
|
cumulativeFlags.at("muon-secondary jet pairs").at(currentDir),scaleFactor); |
1166 |
< |
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), \ |
1166 |
> |
else if(currentHistogram.inputCollection == "photon-secondary jet pairs") fill1DHistogram(histo,currentHistogram,photons.product(),jets.product(), |
1167 |
|
cumulativeFlags.at("photon-secondary jet pairs").at(currentDir),scaleFactor); |
1168 |
< |
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), \ |
1168 |
> |
else if(currentHistogram.inputCollection == "electron-secondary jet pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),jets.product(), |
1169 |
|
cumulativeFlags.at("electron-secondary jet pairs").at(currentDir),scaleFactor); |
1170 |
|
|
1171 |
|
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
1172 |
< |
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),\ |
1172 |
> |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), |
1173 |
|
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
1174 |
< |
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),\ |
1174 |
> |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(), |
1175 |
|
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
1176 |
< |
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), \ |
1176 |
> |
else if(currentHistogram.inputCollection == "jet-secondary jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(), |
1177 |
|
cumulativeFlags.at("jet-secondary jet pairs").at(currentDir),scaleFactor); |
1178 |
|
|
1179 |
< |
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), \ |
1179 |
> |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), |
1180 |
|
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
1181 |
< |
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), |
1181 |
> |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), |
1182 |
|
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
1183 |
< |
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), |
1183 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),jets.product(), |
1184 |
|
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
1185 |
< |
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), |
1185 |
> |
else if(currentHistogram.inputCollection == "photon-jet pairs") fill1DHistogram(histo,currentHistogram, photons.product(),jets.product(), |
1186 |
|
cumulativeFlags.at("photon-jet pairs").at(currentDir),scaleFactor); |
1187 |
< |
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), |
1187 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill1DHistogram(histo,currentHistogram, muons.product(),jets.product(), |
1188 |
|
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
1189 |
< |
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), |
1189 |
> |
else if(currentHistogram.inputCollection == "muon-event pairs") fill1DHistogram(histo,currentHistogram, muons.product(),events.product(), |
1190 |
|
cumulativeFlags.at("muon-event pairs").at(currentDir),scaleFactor); |
1191 |
< |
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), |
1191 |
> |
else if(currentHistogram.inputCollection == "met-jet pairs") fill1DHistogram(histo,currentHistogram, mets.product(),jets.product(), |
1192 |
|
cumulativeFlags.at("met-jet pairs").at(currentDir),scaleFactor); |
1193 |
< |
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), |
1193 |
> |
else if(currentHistogram.inputCollection == "track-jet pairs") fill1DHistogram(histo,currentHistogram,tracks.product(),jets.product(), |
1194 |
|
cumulativeFlags.at("track-jet pairs").at(currentDir),scaleFactor); |
1195 |
< |
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), |
1195 |
> |
else if(currentHistogram.inputCollection == "muon-photon pairs") fill1DHistogram(histo,currentHistogram, muons.product(),photons.product(), |
1196 |
|
cumulativeFlags.at("muon-photon pairs").at(currentDir),scaleFactor); |
1197 |
< |
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), |
1197 |
> |
else if(currentHistogram.inputCollection == "electron-photon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),photons.product(), |
1198 |
|
cumulativeFlags.at("electron-photon pairs").at(currentDir),scaleFactor); |
1199 |
|
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), |
1200 |
|
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
1201 |
|
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), |
1202 |
|
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
1203 |
|
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), |
1204 |
|
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
1205 |
|
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), |
1206 |
|
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
1207 |
|
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), |
1208 |
|
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
1209 |
|
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), |
1210 |
|
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
1211 |
|
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), |
1212 |
|
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
1213 |
|
|
1214 |
|
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
1231 |
|
else if(currentHistogram.inputCollection == "secondary jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
1232 |
|
else if(currentHistogram.inputCollection == "secondary photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("secondary photons").at(currentDir),scaleFactor); |
1233 |
|
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
1234 |
< |
else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
1235 |
< |
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), \ |
1234 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,secMuons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
1235 |
> |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), |
1236 |
|
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
1237 |
< |
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), \ |
1237 |
> |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),secMuons.product(), |
1238 |
|
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
1239 |
< |
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), \ |
1239 |
> |
else if(currentHistogram.inputCollection == "muon-secondary photon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),photons.product(), |
1240 |
|
cumulativeFlags.at("muon-secondary photon pairs").at(currentDir),scaleFactor); |
1241 |
< |
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), \ |
1241 |
> |
else if(currentHistogram.inputCollection == "muon-secondary jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), |
1242 |
|
cumulativeFlags.at("muon-secondary jet pairs").at(currentDir),scaleFactor); |
1243 |
< |
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), \ |
1243 |
> |
else if(currentHistogram.inputCollection == "electron-secondary jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), |
1244 |
|
cumulativeFlags.at("electron-secondary jet pairs").at(currentDir),scaleFactor); |
1245 |
< |
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), \ |
1245 |
> |
else if(currentHistogram.inputCollection == "photon-secondary jet pairs") fill2DHistogram(histo,currentHistogram,photons.product(),jets.product(), |
1246 |
|
cumulativeFlags.at("photon-secondary jet pairs").at(currentDir),scaleFactor); |
1247 |
|
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
1248 |
|
else if(currentHistogram.inputCollection == "secondary electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
1249 |
< |
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), \ |
1249 |
> |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), |
1250 |
|
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
1251 |
< |
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), \ |
1251 |
> |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill2DHistogram(histo,currentHistogram,jets.product(),jets.product(), |
1252 |
|
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
1253 |
< |
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), \ |
1253 |
> |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), |
1254 |
|
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
1255 |
< |
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), \ |
1255 |
> |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), |
1256 |
|
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
1257 |
< |
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), \ |
1257 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), |
1258 |
|
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
1259 |
< |
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), \ |
1259 |
> |
else if(currentHistogram.inputCollection == "electron-photon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),photons.product(), |
1260 |
|
cumulativeFlags.at("electron-photon pairs").at(currentDir),scaleFactor); |
1261 |
< |
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), \ |
1261 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), |
1262 |
|
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
1263 |
< |
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), \ |
1263 |
> |
else if(currentHistogram.inputCollection == "muon-event pairs") fill2DHistogram(histo,currentHistogram,muons.product(),events.product(), |
1264 |
|
cumulativeFlags.at("muon-event pairs").at(currentDir),scaleFactor); |
1265 |
< |
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), \ |
1265 |
> |
else if(currentHistogram.inputCollection == "met-jet pairs") fill2DHistogram(histo,currentHistogram,mets.product(),jets.product(), |
1266 |
|
cumulativeFlags.at("met-jet pairs").at(currentDir),scaleFactor); |
1267 |
|
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), \ |
1268 |
|
cumulativeFlags.at("track-jet pairs").at(currentDir),scaleFactor); |
1269 |
< |
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), \ |
1269 |
> |
else if(currentHistogram.inputCollection == "photon-jet pairs") fill2DHistogram(histo,currentHistogram,photons.product(),jets.product(), |
1270 |
|
cumulativeFlags.at("photon-jet pairs").at(currentDir),scaleFactor); |
1271 |
< |
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), \ |
1271 |
> |
else if(currentHistogram.inputCollection == "muon-photon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),photons.product(), |
1272 |
|
cumulativeFlags.at("muon-photon pairs").at(currentDir),scaleFactor); |
1273 |
|
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), |
1274 |
|
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
1275 |
|
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), |
1216 |
– |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1276 |
|
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
1277 |
|
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), |
1278 |
|
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
1279 |
|
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), |
1280 |
|
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
1281 |
|
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), |
1282 |
|
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
1283 |
|
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), |
1284 |
|
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
1285 |
|
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), |
1286 |
|
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
1287 |
|
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
1288 |
|
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
1289 |
|
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
1290 |
|
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
1291 |
|
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), |
1292 |
|
cumulativeFlags.at("track-event pairs").at(currentDir),scaleFactor); |
1293 |
|
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
1294 |
|
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
1309 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
1310 |
|
string objectToPlot = ""; |
1311 |
|
|
1312 |
+ |
if (verbose_) clog << "Filling histogram of number of selected objects in collection: " << currentObject << endl; |
1313 |
+ |
|
1314 |
|
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
1315 |
|
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
1316 |
|
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
1318 |
|
else if(currentObject == "electron-photon pairs") objectToPlot = "electronPhotonPairs"; |
1319 |
|
else if(currentObject == "electron-jet pairs") objectToPlot = "electronJetPairs"; |
1320 |
|
else if(currentObject == "muon-jet pairs") objectToPlot = "muonJetPairs"; |
1321 |
< |
else if(currentObject == "muon-event pairs") objectToPlot = "muonEventPairs"; |
1322 |
< |
else if(currentObject == "muon-photon pairs") objectToPlot = "muonPhotonPairs"; |
1323 |
< |
else if(currentObject == "photon-jet pairs") objectToPlot = "photonJetPairs"; |
1321 |
> |
else if(currentObject == "muon-event pairs") objectToPlot = "muonEventPairs"; |
1322 |
> |
else if(currentObject == "muon-photon pairs") objectToPlot = "muonPhotonPairs"; |
1323 |
> |
else if(currentObject == "photon-jet pairs") objectToPlot = "photonJetPairs"; |
1324 |
|
else if(currentObject == "met-jet pairs") objectToPlot = "metJetPairs"; |
1325 |
|
else if(currentObject == "track-jet pairs") objectToPlot = "trackJetPairs"; |
1326 |
|
else if(currentObject == "jet-jet pairs") objectToPlot = "dijetPairs"; |
1327 |
|
else if(currentObject == "jet-secondary jet pairs") objectToPlot = "jetSecondaryJetPairs"; |
1328 |
|
else if(currentObject == "secondary jets") objectToPlot = "secondaryJets"; |
1329 |
< |
else if(currentObject == "secondary photons") objectToPlot = "secondaryPhotons"; |
1329 |
> |
else if(currentObject == "secondary photons") objectToPlot = "secondaryPhotons"; |
1330 |
|
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
1331 |
|
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
1332 |
|
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
1336 |
|
else if(currentObject == "muon-secondary muon pairs") objectToPlot = "muonSecondaryMuonPairs"; |
1337 |
|
else if(currentObject == "secondary muons") objectToPlot = "secondaryMuons"; |
1338 |
|
else if(currentObject == "muon-secondary jet pairs") objectToPlot = "muonSecondaryJetPairs"; |
1339 |
< |
else if(currentObject == "muon-secondary photon pairs") objectToPlot = "muonSecondaryJetPairs"; |
1339 |
> |
else if(currentObject == "muon-secondary photon pairs") objectToPlot = "muonSecondaryJetPairs"; |
1340 |
|
else if(currentObject == "electron-secondary jet pairs") objectToPlot = "electronSecondaryJetPairs"; |
1341 |
|
else if(currentObject == "photon-secondary jet pairs") objectToPlot = "photonSecondaryJetPairs"; |
1342 |
|
else if(currentObject == "electron-secondary electron pairs") objectToPlot = "electronSecondaryElectronPairs"; |
1343 |
|
else if(currentObject == "secondary electrons") objectToPlot = "secondaryElectrons"; |
1344 |
|
else if(currentObject == "electron-trigobj pairs") objectToPlot = "electronTrigobjPairs"; |
1345 |
|
else if(currentObject == "muon-trigobj pairs") objectToPlot = "muonTrigobjPairs"; |
1346 |
+ |
else if(currentObject == "electron-mcparticle pairs") objectToPlot = "electronMCparticlePairs"; |
1347 |
|
else objectToPlot = currentObject; |
1348 |
|
|
1349 |
|
string tempCurrentObject = objectToPlot; |
1351 |
|
string histoName = "num" + tempCurrentObject; |
1352 |
|
|
1353 |
|
|
1354 |
< |
if(find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
1354 |
> |
if(find(objectsToPlot.begin(), objectsToPlot.end(), currentObject) != objectsToPlot.end()) { |
1355 |
|
flagPair lastCutFlags = cumulativeFlags.at(currentObject).at(currentDir); |
1356 |
|
int numToPlot = 0; |
1357 |
< |
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
1358 |
< |
if(lastCutFlags.at(currentFlag).second) numToPlot++; |
1357 |
> |
for (uint iObj = 0; iObj != lastCutFlags.size(); iObj++){ // loop over all the objects |
1358 |
> |
if(lastCutFlags.at(iObj).second) { |
1359 |
> |
numToPlot++; |
1360 |
> |
if (verbose_>3) clog << " Found object " << iObj << " in collection " << currentObject << " to plot." << endl; |
1361 |
> |
} |
1362 |
|
} |
1363 |
|
|
1364 |
|
if(objectToPlot == "primaryvertexs"){ |
1366 |
|
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
1367 |
|
} |
1368 |
|
else { |
1369 |
+ |
if (printEventInfo_) clog << "Number of selected " << objectToPlot << " to plot: " << numToPlot << endl; |
1370 |
|
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(numToPlot,scaleFactor); |
1371 |
|
} |
1372 |
|
} |
1373 |
+ |
|
1374 |
|
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++) |
1375 |
|
|
1376 |
|
|
1386 |
|
|
1387 |
|
if (coll == "jets") assignTreeBranch(brSpecs,jets.product(), cumulativeFlags.at(coll).back()); |
1388 |
|
else if(coll == "secondary jets") assignTreeBranch(brSpecs,jets.product(), cumulativeFlags.at(coll).back()); |
1389 |
< |
else if(coll == "secondary photons") assignTreeBranch(brSpecs,photons.product(), cumulativeFlags.at(coll).back()); |
1389 |
> |
else if(coll == "secondary photons") assignTreeBranch(brSpecs,photons.product(), cumulativeFlags.at(coll).back()); |
1390 |
|
else if(coll == "muons") assignTreeBranch(brSpecs,muons.product(), cumulativeFlags.at(coll).back()); |
1391 |
< |
else if(coll == "secondary muons") assignTreeBranch(brSpecs,muons.product(), cumulativeFlags.at(coll).back()); |
1391 |
> |
else if(coll == "secondary muons") assignTreeBranch(brSpecs,secMuons.product(), cumulativeFlags.at(coll).back()); |
1392 |
|
else if(coll == "electrons") assignTreeBranch(brSpecs,electrons.product(), cumulativeFlags.at(coll).back()); |
1393 |
|
else if(coll == "secondary electrons") assignTreeBranch(brSpecs,electrons.product(), cumulativeFlags.at(coll).back()); |
1394 |
|
else if(coll == "events") assignTreeBranch(brSpecs,events.product(), cumulativeFlags.at(coll).back()); |
1405 |
|
else if(coll == "stops" |
1406 |
|
&& datasetType_ == "signalMC") assignTreeBranch(brSpecs,stops.product(), cumulativeFlags.at(coll).back()); |
1407 |
|
} // end loop over branches |
1408 |
+ |
// set the evtLong, runInt, and lumiInt variables separately, since they are not type float |
1409 |
+ |
BNTreeBranchVals_evtLong_ = events->at(0).evt; |
1410 |
+ |
BNTreeBranchVals_runInt_ = events->at(0).run; |
1411 |
+ |
BNTreeBranchVals_lumiInt_ = events->at(0).lumi; |
1412 |
|
|
1413 |
|
if (!BNTrees_.at(currentChannelIndex)) { clog << "ERROR: Undefined BNTree. Will likely seg fault." << endl; } |
1414 |
|
BNTrees_.at(currentChannelIndex)->Fill(); // only fill if event has passed cuts |
1424 |
|
|
1425 |
|
isFirstEvent_ = false; |
1426 |
|
|
1427 |
+ |
if (verbose_) clog << "Finished OSUAnalysis::produce." << endl; |
1428 |
+ |
|
1429 |
|
} // end void OSUAnalysis::produce (const edm::Event &event, const edm::EventSetup &setup) |
1430 |
|
|
1431 |
|
|
1454 |
|
else if(comparison == "<") return testValue < cutValue; |
1455 |
|
else if(comparison == "<=") return testValue <= cutValue; |
1456 |
|
else if(comparison == "==") return testValue == cutValue; |
1457 |
< |
else if(comparison == "=") return testValue == cutValue; |
1457 |
> |
else if(comparison == "=") return testValue == cutValue; |
1458 |
|
else if(comparison == "!=") return testValue != cutValue; |
1459 |
|
else {clog << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1460 |
|
|
1859 |
|
(object->isGlobalMuon > 0 || |
1860 |
|
object->isTrackerMuon > 0); |
1861 |
|
} |
1862 |
+ |
else if(variable == "looseIDGlobalMuon") { |
1863 |
+ |
value = object->pt > 10 && |
1864 |
+ |
object->isGlobalMuon > 0; |
1865 |
+ |
} |
1866 |
|
else if(variable == "correctedD0VertexErr") value = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1867 |
|
else if(variable == "correctedD0VertexSig") value = object->correctedD0Vertex / hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1868 |
|
else if(variable == "detIso") value = (object->trackIsoDR03) / object->pt; |
1878 |
|
else |
1879 |
|
value = -999; |
1880 |
|
} |
1881 |
< |
|
1882 |
< |
|
1881 |
> |
else if(variable == "ptPlusMet") { |
1882 |
> |
// Calculate the magnitude of the vector sum of the muon pT and the Met. |
1883 |
> |
if (const BNmet *met = chosenMET ()) |
1884 |
> |
{ |
1885 |
> |
TVector2 p2Met; |
1886 |
> |
TVector2 p2Muon; |
1887 |
> |
p2Met. SetMagPhi( met->pt, met->phi); |
1888 |
> |
p2Muon.SetMagPhi(object->pt, object->phi); |
1889 |
> |
TVector2 p2MetElec = p2Met + p2Muon; |
1890 |
> |
value = p2MetElec.Mod(); |
1891 |
> |
} |
1892 |
> |
else |
1893 |
> |
value = -999; |
1894 |
> |
} |
1895 |
|
|
1896 |
|
else if(variable == "correctedD0VertexInEBPlus"){ |
1897 |
|
if(fabs(object->eta) < 0.8 && object->eta > 0) value = object->correctedD0Vertex; |
2263 |
|
value = -999; |
2264 |
|
} |
2265 |
|
|
2266 |
+ |
else if(variable == "ptPlusMet") { |
2267 |
+ |
// Calculate the magnitude of the vector sum of the electron pT and the Met. |
2268 |
+ |
if (const BNmet *met = chosenMET ()) |
2269 |
+ |
{ |
2270 |
+ |
TVector2 p2Met; |
2271 |
+ |
TVector2 p2Elec; |
2272 |
+ |
p2Met. SetMagPhi( met->pt, met->phi); |
2273 |
+ |
p2Elec.SetMagPhi(object->pt, object->phi); |
2274 |
+ |
TVector2 p2MetElec = p2Met + p2Elec; |
2275 |
+ |
value = p2MetElec.Mod(); |
2276 |
+ |
} |
2277 |
+ |
else |
2278 |
+ |
value = -999; |
2279 |
+ |
} |
2280 |
+ |
|
2281 |
|
else if(variable == "correctedD0VertexEEPositiveChargeLowPt"){ |
2282 |
|
if(fabs(object->eta) > 1.479 && object->charge > 0 && object->pt > 45) value = object->correctedD0Vertex; |
2283 |
|
else value = -999; |
2541 |
|
else if(variable == "pthat") value = object->pthat; |
2542 |
|
else if(variable == "qScale") value = object->qScale; |
2543 |
|
else if(variable == "alphaQCD") value = object->alphaQCD; |
2446 |
– |
else if(variable == "Ht") value = getHt(jets.product()); |
2544 |
|
else if(variable == "alphaQED") value = object->alphaQED; |
2545 |
|
else if(variable == "scalePDF") value = object->scalePDF; |
2546 |
|
else if(variable == "x1") value = object->x1; |
2611 |
|
else if(variable == "electronScaleFactor") value = electronScaleFactor_; |
2612 |
|
else if(variable == "stopCTauScaleFactor") value = stopCTauScaleFactor_; |
2613 |
|
else if(variable == "bTagScaleFactor") value = bTagScaleFactor_; |
2614 |
+ |
|
2615 |
+ |
else if(variable == "unfilteredHt") value = getHt(jets.product()); |
2616 |
|
else if(variable == "ht") value = chosenHT (); |
2617 |
+ |
|
2618 |
|
else if(variable == "leadMuPairInvMass"){ |
2619 |
|
pair<const BNmuon *, const BNmuon *> muPair = leadMuonPair (); |
2620 |
|
TLorentzVector p0 (muPair.first->px, muPair.first->py, muPair.first->pz, muPair.first->energy), |
2868 |
|
else if(variable == "nHitsMissingInner") value = object->nHitsMissingInner; |
2869 |
|
else if(variable == "nHitsMissingMiddle") value = object->nHitsMissingMiddle; |
2870 |
|
else if(variable == "depTrkRp3") value = object->depTrkRp3; |
2871 |
< |
else if(variable == "trkRelIsoRp3") value = (object->depTrkRp3 - object->pt) / object->pt; |
2872 |
< |
else if(variable == "trkRelIsoRp5") value = (object->depTrkRp5 - object->pt) / object->pt; |
2871 |
> |
else if(variable == "trkRelIsoRp3") { value = (object->depTrkRp3 - object->pt) / object->pt; if (value<0) value = 0; } |
2872 |
> |
else if(variable == "trkRelIsoRp5") { value = (object->depTrkRp5 - object->pt) / object->pt; if (value<0) value = 0; } |
2873 |
|
else if(variable == "depEcalRp3") value = object->depEcalRp3; |
2874 |
|
else if(variable == "depHcalRp3") value = object->depHcalRp3; |
2875 |
|
else if(variable == "depHoRp3") value = object->depHoRp3; |
2893 |
|
else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz; |
2894 |
|
else if(variable == "depTrkRp5MinusPt"){ |
2895 |
|
if ( (object->depTrkRp5 - object->pt) < 0 ) { |
2896 |
< |
// cout << "Warning: found track with depTrkRp5 < pt: depTrkRp5=" << object->depTrkRp5 |
2896 |
> |
// clog << "Warning: found track with depTrkRp5 < pt: depTrkRp5=" << object->depTrkRp5 |
2897 |
|
// << "; pt=" << object->pt |
2898 |
|
// << "; object->depTrkRp5 - object->pt = " << object->depTrkRp5 - object->pt |
2899 |
|
// << endl; |
2919 |
|
else if(variable == "caloTotDeltaRp5ByP") value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2920 |
|
else if(variable == "caloTotDeltaRp5RhoCorr") value = getTrkCaloTotRhoCorr(object); |
2921 |
|
else if(variable == "caloTotDeltaRp5ByPRhoCorr") value = getTrkCaloTotRhoCorr(object) / pMag; |
2922 |
+ |
else if(variable == "depTrkRp5RhoCorr") value = getTrkDepTrkRp5RhoCorr(object); |
2923 |
+ |
else if(variable == "depTrkRp3RhoCorr") value = getTrkDepTrkRp3RhoCorr(object); |
2924 |
+ |
|
2925 |
+ |
else if(variable == "depTrkRp5MinusPtRhoCorr") { |
2926 |
+ |
if ( (getTrkDepTrkRp5RhoCorr(object) - object->pt) < 0 ) value = 0; |
2927 |
+ |
else {value = (getTrkDepTrkRp5RhoCorr(object) - object->pt );} |
2928 |
+ |
} |
2929 |
+ |
|
2930 |
+ |
else if(variable == "depTrkRp3MinusPtRhoCorr") |
2931 |
+ |
{ |
2932 |
+ |
if ( (getTrkDepTrkRp3RhoCorr(object) - object->pt) < 0 ) value = 0; |
2933 |
+ |
else {value = (getTrkDepTrkRp3RhoCorr(object) - object->pt );} |
2934 |
+ |
} |
2935 |
+ |
|
2936 |
|
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
2937 |
|
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
2938 |
|
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
2957 |
|
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
2958 |
|
} |
2959 |
|
|
2960 |
< |
|
2960 |
> |
else if(variable == "deltaRMinSubLeadJet") { |
2961 |
> |
// calculate minimum deltaR between track and any other subleading jet |
2962 |
> |
double trkJetDeltaRMin = 99.; |
2963 |
> |
for (uint ijet = 0; ijet<jets->size(); ijet++) { |
2964 |
> |
string empty = ""; |
2965 |
> |
double isSubLeadingJet = valueLookup(&jets->at(ijet), "disappTrkSubLeadingJetID", "", empty); |
2966 |
> |
if (!isSubLeadingJet) continue; // only consider jets that pass the subleading jet ID criteria |
2967 |
> |
double jetEta = valueLookup(&jets->at(ijet), "eta", "", empty); |
2968 |
> |
double jetPhi = valueLookup(&jets->at(ijet), "phi", "", empty); |
2969 |
> |
double trkJetDeltaR = deltaR(object->eta, object->phi, jetEta, jetPhi); |
2970 |
> |
if (trkJetDeltaR < trkJetDeltaRMin) trkJetDeltaRMin = trkJetDeltaR; |
2971 |
> |
} |
2972 |
> |
value = trkJetDeltaRMin; |
2973 |
> |
} |
2974 |
> |
|
2975 |
|
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2976 |
|
|
2977 |
|
else if(variable == "genMatchedPdgId"){ |
3019 |
|
|
3020 |
|
|
3021 |
|
|
3022 |
< |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3022 |
> |
else{clog << "WARNING: invalid variable '" << variable << "' for BNtrack collection.\n"; value = -999;} |
3023 |
|
|
3024 |
|
value = applyFunction(function, value); |
3025 |
|
|
3714 |
|
return value; |
3715 |
|
} // end electron-muon pair valueLookup |
3716 |
|
|
3717 |
< |
|
3717 |
> |
|
3718 |
|
//!electron-jet pair valueLookup |
3719 |
|
double |
3720 |
|
OSUAnalysis::valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3754 |
|
return value; |
3755 |
|
} |
3756 |
|
|
3757 |
+ |
//!electron-mcparticle pair valueLookup |
3758 |
+ |
double |
3759 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNmcparticle* object2, string variable, string function, string &stringValue){ |
3760 |
+ |
|
3761 |
+ |
double value = 0.0; |
3762 |
+ |
|
3763 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3764 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3765 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3766 |
+ |
else if(variable == "threeDAngle") |
3767 |
+ |
{ |
3768 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3769 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3770 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3771 |
+ |
} |
3772 |
+ |
else if(variable == "chargeProduct"){ |
3773 |
+ |
value = object1->charge*object2->charge; |
3774 |
+ |
} |
3775 |
+ |
|
3776 |
+ |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3777 |
+ |
value = applyFunction(function, value); |
3778 |
+ |
|
3779 |
+ |
return value; |
3780 |
+ |
} |
3781 |
+ |
|
3782 |
+ |
|
3783 |
|
//!photon-jet pair valueLookup |
3784 |
|
double |
3785 |
|
OSUAnalysis::valueLookup (const BNphoton* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3957 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3958 |
|
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3959 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3960 |
+ |
else if(variable == "deltaRLooseMvaId") { |
3961 |
+ |
// only consider electrons that pass "loose MVA id", i.e., mvaNonTrigV0 > 0; |
3962 |
+ |
// otherwise return very large value (99) |
3963 |
+ |
if (object1->mvaNonTrigV0>0) value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3964 |
+ |
else value = 99.; |
3965 |
+ |
} |
3966 |
|
else if(variable == "invMass"){ |
3967 |
|
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass); |
3968 |
|
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass ); |
3990 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3991 |
|
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3992 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3993 |
+ |
else if(variable == "deltaRLooseID") { |
3994 |
+ |
// only consider muons that pass looseId criteria; otherwise return very large value (99.) |
3995 |
+ |
string empty = ""; |
3996 |
+ |
double isLooseId = valueLookup(object1, "looseID", "", empty); |
3997 |
+ |
if (isLooseId) value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3998 |
+ |
else value = 99.; |
3999 |
+ |
} |
4000 |
|
else if(variable == "invMass"){ |
4001 |
|
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, muonMass); |
4002 |
|
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, pionMass ); |
4062 |
|
double value = 0.0; |
4063 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
4064 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
4065 |
+ |
else if(variable == "deltaRLooseHadronicID") { |
4066 |
+ |
// only consider tau's that pass the loose hadronic ID criteria; otherwise return very large value (99) |
4067 |
+ |
string empty = ""; |
4068 |
+ |
double isLooseHadronicID = valueLookup(object1, "looseHadronicID", "", empty); |
4069 |
+ |
|
4070 |
+ |
if (isLooseHadronicID) value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
4071 |
+ |
else value = 99.; |
4072 |
+ |
} |
4073 |
|
else if(variable == "chargeProduct"){ |
4074 |
|
value = object1->charge*object2->charge; |
4075 |
|
} |
4334 |
|
|
4335 |
|
} |
4336 |
|
|
4337 |
+ |
double |
4338 |
+ |
OSUAnalysis::getTrkDepTrkRp5RhoCorr(const BNtrack* track) { |
4339 |
+ |
// Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track. |
4340 |
+ |
if (!useTrackCaloRhoCorr_) return -99; |
4341 |
+ |
// if (!rhokt6CaloJetsHandle_) { |
4342 |
+ |
// clog << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
4343 |
+ |
// return -99; |
4344 |
+ |
// } |
4345 |
+ |
double radDeltaRCone = 0.5; |
4346 |
+ |
double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2); // Define effective area as pi*r^2, where r is radius of DeltaR cone. |
4347 |
+ |
double rawDepTrkRp5 = track->depTrkRp5; |
4348 |
+ |
double depTrkRp5RhoCorr = TMath::Max(0., rawDepTrkRp5 - rhoCorr_kt6CaloJets); |
4349 |
+ |
return depTrkRp5RhoCorr; |
4350 |
+ |
|
4351 |
+ |
} |
4352 |
+ |
|
4353 |
+ |
double |
4354 |
+ |
OSUAnalysis::getTrkDepTrkRp3RhoCorr(const BNtrack* track) { |
4355 |
+ |
// Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track. |
4356 |
+ |
if (!useTrackCaloRhoCorr_) return -99; |
4357 |
+ |
// if (!rhokt6CaloJetsHandle_) { |
4358 |
+ |
// clog << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
4359 |
+ |
// return -99; |
4360 |
+ |
// } |
4361 |
+ |
double radDeltaRCone = 0.3; |
4362 |
+ |
// Define effective area as pi*r^2, where r is radius of DeltaR cone |
4363 |
+ |
double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2); |
4364 |
+ |
double rawDepTrkRp3 = track->depTrkRp3; |
4365 |
+ |
double depTrkRp3RhoCorr = TMath::Max(0., rawDepTrkRp3 - rhoCorr_kt6CaloJets); |
4366 |
+ |
return depTrkRp3RhoCorr; |
4367 |
+ |
|
4368 |
+ |
} |
4369 |
+ |
|
4370 |
|
|
4371 |
|
|
4372 |
|
|
4443 |
|
template <class InputCollection> |
4444 |
|
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, InputCollection inputCollection, string inputType){ |
4445 |
|
|
4446 |
+ |
if (verbose_>2) clog << " Beginning setObjectFlags for cut " << currentCutIndex << ": " << currentCut.name |
4447 |
+ |
<< ", inputType=" << inputType |
4448 |
+ |
<< endl; |
4449 |
|
if (currentCut.inputCollection.find("pair")!=string::npos) { |
4450 |
|
string obj1, obj2; |
4451 |
|
getTwoObjs(currentCut.inputCollection, obj1, obj2); |
4452 |
+ |
if (verbose_>2) clog << " Two object types: " << obj1 << ", " << obj2 << endl; |
4453 |
|
if (inputType==obj1 || |
4454 |
|
inputType==obj2) { |
4455 |
|
// Do not add a cut to individualFlags or cumulativeFlags, if the cut is on a paired collection, |
4461 |
|
} |
4462 |
|
} |
4463 |
|
|
4464 |
+ |
if (!inputCollection) cout << "ERROR: invalid input collection for inputType=" << inputType << endl; |
4465 |
+ |
|
4466 |
+ |
if (verbose_>3) clog << " Collection size: " << inputCollection->size() << endl; |
4467 |
+ |
|
4468 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
4469 |
|
|
4470 |
+ |
if (verbose_>4) clog << " Setting flags for object " << object << endl; |
4471 |
+ |
|
4472 |
|
bool cutDecision = true;//object passes if this cut doesn't cut on that type of object |
4473 |
|
bool plotDecision = true; |
4474 |
|
|
4493 |
|
} |
4494 |
|
cutDecision = tempDecision; |
4495 |
|
} |
4496 |
< |
//invert the cut for plotting if this cut is a veto |
4497 |
< |
if(currentCut.isVeto) plotDecision = !cutDecision; |
4498 |
< |
else plotDecision = cutDecision; |
4496 |
> |
//invert the cut if this cut is a veto |
4497 |
> |
if(currentCut.isVeto) cutDecision = !cutDecision; |
4498 |
> |
plotDecision = cutDecision; |
4499 |
|
} |
4500 |
|
|
4501 |
|
individualFlags.at(inputType).at(currentCutIndex).push_back(make_pair(cutDecision,plotDecision)); |
4516 |
|
|
4517 |
|
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(make_pair(previousCumulativeCutFlag,previousCumulativePlotFlag)); |
4518 |
|
|
4519 |
< |
} |
4519 |
> |
} // for (uint object = 0; object != inputCollection->size(); object++){ |
4520 |
|
|
4521 |
< |
} |
4521 |
> |
} // end void OSUAnalysis::setObjectFlags |
4522 |
|
|
4523 |
|
|
4524 |
|
template <class InputCollection1, class InputCollection2> |
4525 |
< |
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, \ |
4526 |
< |
InputCollection1 inputCollection1, InputCollection2 inputCollection2, flagPair flags1, flagPair flags2, string inputType){ |
4527 |
< |
|
4525 |
> |
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, |
4526 |
> |
InputCollection1 inputCollection1, InputCollection2 inputCollection2, string inputType){ |
4527 |
> |
// This function sets the flags for the paired object collection. |
4528 |
> |
// If the cut is applying on the given paired object collection, then the flags for the single object collections are also set. |
4529 |
> |
// If not, then the flags for the paired object collection are taken as the AND of the flags for each single object collection. |
4530 |
> |
|
4531 |
> |
if (verbose_>2) clog << " Beginning setObjectFlags for cut=" << currentCut.name |
4532 |
> |
<< ", inputType=" << inputType |
4533 |
> |
<< endl; |
4534 |
|
|
4535 |
|
bool sameObjects = false; |
4536 |
< |
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
4536 |
> |
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; // FIXME: is sameObjects just the not of isTwoTypesOfObject? If so, it's redundant. |
4537 |
|
|
4538 |
|
// Get the strings for the two objects that make up the pair. |
4539 |
|
string obj1Type, obj2Type; |
4564 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
4565 |
|
|
4566 |
|
|
4567 |
< |
bool cutDecision = true;//object passes if this cut doesn't cut on that type of object |
4567 |
> |
bool cutDecision = true;//object passes if this cut doesn't cut on that type of object |
4568 |
|
bool plotDecision = true; |
4569 |
|
|
4570 |
+ |
// Determine whether each pair passes the cut, only if inputCollection is the same as the inputType. |
4571 |
|
if(currentCut.inputCollection == inputType){ |
4572 |
|
|
4573 |
|
vector<bool> subcutDecisions; |
4574 |
|
for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){ |
4575 |
|
string stringValue = ""; |
4576 |
|
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex), stringValue); |
4577 |
+ |
if (verbose_>1) clog << currentCut.variables.at(subcutIndex) << " = " << value |
4578 |
+ |
<< endl; |
4579 |
|
if (stringValue == "") subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
4580 |
|
else subcutDecisions.push_back(evaluateComparison(stringValue,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutStringValues.at(subcutIndex))); |
4581 |
|
} |
4591 |
|
} |
4592 |
|
cutDecision = tempDecision; |
4593 |
|
} |
4594 |
< |
//invert the cut for plotting if this cut is a veto |
4595 |
< |
if(currentCut.isVeto) plotDecision = !cutDecision; |
4596 |
< |
else plotDecision = cutDecision; |
4597 |
< |
} |
4598 |
< |
individualFlags.at(inputType).at(currentCutIndex).push_back(make_pair(cutDecision,plotDecision)); |
4599 |
< |
if (cutDecision && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4600 |
< |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1).first = true; |
4601 |
< |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2).first = true; |
4602 |
< |
} |
4603 |
< |
if (plotDecision && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4604 |
< |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1).second = true; |
4605 |
< |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2).second = true; |
4606 |
< |
} |
4594 |
> |
//invert the cut if this cut is a veto |
4595 |
> |
if (currentCut.isVeto) cutDecision = !cutDecision; |
4596 |
> |
plotDecision = cutDecision; |
4597 |
> |
|
4598 |
> |
if (verbose_>1) clog << " cutDecision = " << cutDecision |
4599 |
> |
<< "; for currentCut.inputCollection = " << currentCut.inputCollection |
4600 |
> |
<< "; object1 (" << obj1Type << ") = " << object1 |
4601 |
> |
<< "; object2 (" << obj2Type << ") = " << object2 |
4602 |
> |
<< endl; |
4603 |
> |
|
4604 |
> |
if (cutDecision) { // only set the flags for the individual objects if the pair object is being cut on |
4605 |
> |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1).first = true; |
4606 |
> |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2).first = true; |
4607 |
> |
} |
4608 |
> |
if (plotDecision) { // only set the flags for the individual objects if the pair object is being cut on |
4609 |
> |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1).second = true; |
4610 |
> |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2).second = true; |
4611 |
> |
} |
4612 |
> |
|
4613 |
> |
|
4614 |
> |
} // if(currentCut.inputCollection == inputType){ |
4615 |
> |
|
4616 |
> |
// The individualFlags will be true if the inputCollection is not the same as the inputType. |
4617 |
> |
// They are also independent of the previous flags on the single objects. |
4618 |
> |
individualFlags.at(inputType).at(currentCutIndex).push_back(make_pair(cutDecision,plotDecision)); |
4619 |
> |
|
4620 |
|
|
4621 |
< |
//set flags for objects that pass this cut AND all the previous cuts |
4621 |
> |
|
4622 |
> |
// ************************************ |
4623 |
> |
// Determine cumulative flags |
4624 |
> |
// ************************************ |
4625 |
> |
// determine whether this paired object passes this cut AND all previous cuts |
4626 |
|
bool previousCumulativeCutFlag = true; |
4627 |
|
for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){ |
4628 |
< |
if(previousCumulativeCutFlag && individualFlags.at(inputType).at(previousCutIndex).at(counter).first) previousCumulativeCutFlag = true; |
4629 |
< |
else{ previousCumulativeCutFlag = false; break;} |
4628 |
> |
if(previousCumulativeCutFlag && individualFlags.at(inputType).at(previousCutIndex).at(counter).first) previousCumulativeCutFlag = true; |
4629 |
> |
else{ previousCumulativeCutFlag = false; break;} |
4630 |
|
} |
4631 |
|
previousCumulativeCutFlag = previousCumulativeCutFlag && cutDecision; |
4632 |
|
|
4637 |
|
} |
4638 |
|
previousCumulativePlotFlag = previousCumulativePlotFlag && plotDecision; |
4639 |
|
|
4640 |
< |
//apply flags for the components of the composite object as well |
4640 |
> |
// 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. |
4641 |
> |
int cutIdxFlagsObj1 = max(int(currentCutIndex-1),0); |
4642 |
> |
int cutIdxFlagsObj2 = max(int(currentCutIndex-1),0); |
4643 |
> |
// 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. |
4644 |
> |
// 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. |
4645 |
> |
// 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). |
4646 |
> |
if (currentCut.inputCollection != inputType) { |
4647 |
> |
if (currentCut.inputCollection.find(obj1Type)!=string::npos) cutIdxFlagsObj1 = currentCutIndex; |
4648 |
> |
if (currentCut.inputCollection.find(obj2Type)!=string::npos) cutIdxFlagsObj2 = currentCutIndex; |
4649 |
> |
} |
4650 |
> |
flagPair flags1 = cumulativeFlags.at(obj1Type).at(cutIdxFlagsObj1); // flag for input collection 1 |
4651 |
> |
flagPair flags2 = cumulativeFlags.at(obj2Type).at(cutIdxFlagsObj2); // flag for input collection 2 |
4652 |
> |
|
4653 |
> |
// The cumulative flag is only true if the paired object cumulative flag is true, and if the single object cumulative flags are true. |
4654 |
|
bool currentCumulativeCutFlag = true; |
4655 |
|
bool currentCumulativePlotFlag = true; |
4399 |
– |
|
4656 |
|
if(flags1.size() == 0 && flags2.size() == 0) currentCumulativeCutFlag = previousCumulativeCutFlag; |
4657 |
|
else if(flags1.size() == 0) currentCumulativeCutFlag = previousCumulativeCutFlag && flags2.at(object2).first; |
4658 |
|
else if(flags2.size() == 0) currentCumulativeCutFlag = previousCumulativeCutFlag && flags1.at(object1).first; |
4663 |
|
else if(flags2.size() == 0) currentCumulativePlotFlag = previousCumulativePlotFlag && flags1.at(object1).second; |
4664 |
|
else currentCumulativePlotFlag = previousCumulativePlotFlag && flags1.at(object1).first && flags2.at(object2).second; |
4665 |
|
|
4666 |
< |
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(make_pair(currentCumulativeCutFlag,currentCumulativePlotFlag)); |
4666 |
> |
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(make_pair(currentCumulativeCutFlag,currentCumulativePlotFlag)); // Set the flag for the paired object |
4667 |
|
|
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 |
– |
} |
4668 |
|
|
4669 |
< |
if (currentCumulativePlotFlag && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4669 |
> |
if (currentCumulativeCutFlag && currentCut.inputCollection == inputType) { // Set the flags for the individual objects if the paired object is being cut on. |
4670 |
> |
cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1).first = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1, "cut"); |
4671 |
> |
cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2).first = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2, "cut"); |
4672 |
|
cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1).second = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1, "plot"); |
4673 |
|
cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2).second = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2, "plot"); |
4674 |
+ |
|
4675 |
+ |
if (verbose_>1) clog << " previousCumulativeCutFlag for object1 = " << getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object1, "cut") << endl; |
4676 |
+ |
if (verbose_>1) clog << " previousCumulativeCutFlag for object2 = " << getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2, "cut") << endl; |
4677 |
+ |
|
4678 |
|
} |
4679 |
|
|
4680 |
|
counter++; |
4682 |
|
} // end for (uint object2 = 0; object2 != inputCollection2->size(); object2++) |
4683 |
|
} // end for (uint object1 = 0; object1 != inputCollection1->size(); object1++) |
4684 |
|
|
4685 |
< |
} |
4685 |
> |
} // end void OSUAnalysis::setObjectFlags |
4686 |
|
|
4687 |
|
|
4688 |
|
bool OSUAnalysis::getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1, string flagType) { |
4727 |
|
template <class InputCollection> |
4728 |
|
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection inputCollection, flagPair flags, double scaleFactor){ |
4729 |
|
|
4730 |
+ |
if (verbose_>2) clog << " Filling histogram for " << parameters.name << endl; |
4731 |
|
|
4732 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
4733 |
|
|
4751 |
|
|
4752 |
|
if (printEventInfo_) { |
4753 |
|
// Write information about event to screen, for testing purposes. |
4754 |
< |
clog << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
4754 |
> |
clog << " Info for event: value for histogram " << histo->GetName() << ": " << value << " (object number " << object << ")" << endl; |
4755 |
|
} |
4756 |
|
|
4757 |
|
} |
4758 |
|
} |
4759 |
|
|
4760 |
|
template <class InputCollection1, class InputCollection2> |
4761 |
< |
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, flagPair flags1, flagPair flags2, flagPair pairFlags, double scaleFactor){ |
4761 |
> |
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, |
4762 |
> |
flagPair pairFlags, double scaleFactor){ |
4763 |
|
|
4764 |
|
bool sameObjects = false; |
4765 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
4771 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
4772 |
|
|
4773 |
|
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; |
4774 |
|
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter).second) continue; |
4775 |
|
|
4776 |
|
string currentString = parameters.inputVariables.at(0); |
4789 |
|
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue); |
4790 |
|
histo->Fill(value,scaleFactor); |
4791 |
|
|
4792 |
+ |
if (printEventInfo_) { |
4793 |
+ |
// Write information about event to screen, for testing purposes. |
4794 |
+ |
clog << " Info for event: value for histogram " << histo->GetName() << ": " << value |
4795 |
+ |
<< " (object1 number " << object1 << "), " |
4796 |
+ |
<< " (object2 number " << object2 << ")" |
4797 |
+ |
<< endl; |
4798 |
+ |
} |
4799 |
+ |
|
4800 |
|
} |
4801 |
|
} |
4802 |
|
|
4845 |
|
} |
4846 |
|
|
4847 |
|
template <class InputCollection1, class InputCollection2> |
4848 |
< |
void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, flagPair flags1, flagPair flags2, flagPair pairFlags, double scaleFactor){ |
4848 |
> |
void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, |
4849 |
> |
flagPair pairFlags, double scaleFactor){ |
4850 |
|
|
4851 |
|
bool sameObjects = false; |
4852 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
4859 |
|
|
4860 |
|
pairCounter++; |
4861 |
|
|
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; |
4862 |
|
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter).second) continue; |
4863 |
|
|
4864 |
|
string stringValue = ""; |