17 |
|
superclusters_ (cfg.getParameter<edm::InputTag> ("superclusters")), |
18 |
|
triggers_ (cfg.getParameter<edm::InputTag> ("triggers")), |
19 |
|
puFile_ (cfg.getParameter<std::string> ("puFile")), |
20 |
+ |
deadEcalFile_ (cfg.getParameter<std::string> ("deadEcalFile")), |
21 |
|
dataPU_ (cfg.getParameter<std::string> ("dataPU")), |
22 |
|
dataset_ (cfg.getParameter<std::string> ("dataset")), |
23 |
|
datasetType_ (cfg.getParameter<std::string> ("datasetType")), |
38 |
|
std::vector<TFileDirectory> directories; |
39 |
|
|
40 |
|
//always get vertex collection so we can assign the primary vertex in the event |
41 |
< |
objectsToGet.push_back("primaryvertexs"); |
41 |
> |
|
42 |
> |
objectsToGet.push_back("primaryvertexs"); |
43 |
|
//always make the plot of number of primary verticex (to check pile-up reweighting) |
44 |
|
objectsToPlot.push_back("primaryvertexs"); |
45 |
|
|
514 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
515 |
|
"electron-muon pairs"); |
516 |
|
|
517 |
+ |
|
518 |
|
} |
519 |
|
|
520 |
|
|
1571 |
|
OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function){ |
1572 |
|
|
1573 |
|
double value = 0.0; |
1574 |
< |
|
1574 |
> |
double pMag = sqrt(object->pt * object->pt + |
1575 |
> |
object->pz * object->pz); |
1576 |
> |
|
1577 |
|
if(variable == "pt") value = object->pt; |
1578 |
|
else if(variable == "px") value = object->px; |
1579 |
|
else if(variable == "py") value = object->py; |
1591 |
|
else if(variable == "charge") value = object->charge; |
1592 |
|
else if(variable == "numValidHits") value = object->numValidHits; |
1593 |
|
else if(variable == "isHighPurity") value = object->isHighPurity; |
1594 |
+ |
//additional BNs info for disappTrks |
1595 |
+ |
else if(variable == "isGoodPtResolution") value = object->isGoodPtResolution; |
1596 |
+ |
else if(variable == "caloEMDeltaRp3") value = object->caloEMDeltaRp3; |
1597 |
+ |
else if(variable == "caloHadDeltaRp3") value = object->caloHadDeltaRp3; |
1598 |
+ |
else if(variable == "caloEMDeltaRp4") value = object->caloEMDeltaRp4; |
1599 |
+ |
else if(variable == "caloHadDeltaRp4") value = object->caloHadDeltaRp4; |
1600 |
+ |
else if(variable == "caloEMDeltaRp5") value = object->caloEMDeltaRp5; |
1601 |
+ |
else if(variable == "caloHadDeltaRp5") value = object->caloHadDeltaRp5; |
1602 |
+ |
else if(variable == "nHitsMissingOuter") value = object->nHitsMissingOuter; |
1603 |
+ |
else if(variable == "nHitsMissingInner") value = object->nHitsMissingInner; |
1604 |
+ |
else if(variable == "nHitsMissingMiddle") value = object->nHitsMissingMiddle; |
1605 |
+ |
//user defined variables |
1606 |
+ |
else if(variable == "d0wrtBS") value = (object->vx-events->at(0).BSx)*object->py/object->pt - (object->vy-events->at(0).BSy)*object->px/object->pt; |
1607 |
+ |
else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz; |
1608 |
+ |
else if(variable == "caloTotDeltaRp5") value =(object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
1609 |
+ |
else if(variable == "caloTotDeltaRp5ByP") value =( (object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
1610 |
+ |
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
1611 |
+ |
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
1612 |
|
|
1613 |
|
|
1614 |
|
else if(variable == "genMatchedId"){ |
2122 |
|
} |
2123 |
|
|
2124 |
|
|
2125 |
+ |
// Calculate the number of tracks in cone of DeltaR<0.5 around track1. |
2126 |
+ |
// Return true iff no other tracks are found in this cone. |
2127 |
+ |
int |
2128 |
+ |
OSUAnalysis::getTrkIsIso (const BNtrack* track1, const BNtrackCollection* trackColl){ |
2129 |
+ |
for(BNtrackCollection::const_iterator track2 = trackColl->begin(); track2 !=trackColl->end(); track2++){ |
2130 |
+ |
if(track1->eta == track2->eta && track1->phi == track2->phi) continue; // Do not compare the track to itself. |
2131 |
+ |
double deltaRtrk = deltaR(track1->eta, track2->eta, track1->phi, track2->phi); |
2132 |
+ |
if(deltaRtrk < 0.5) return 0; |
2133 |
+ |
} |
2134 |
+ |
return 1; |
2135 |
+ |
|
2136 |
+ |
} |
2137 |
+ |
|
2138 |
+ |
//creates a map of the dead Ecal channels in the barrel and endcap |
2139 |
+ |
//to see how the map of dead Ecal channels is created look at function getChannelStatusMaps() here: |
2140 |
+ |
//http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/jbrinson/DisappTrk/OSUT3Analysis/AnaTools/src/OSUAnalysis.cc?revision=1.88&view=markup |
2141 |
+ |
void |
2142 |
+ |
OSUAnalysis::WriteDeadEcal (){ |
2143 |
+ |
double etaEcal, phiEcal; |
2144 |
+ |
ifstream DeadEcalFile(deadEcalFile_); |
2145 |
+ |
if(!DeadEcalFile) { |
2146 |
+ |
cout << "Error: DeadEcalFile has not been found." << endl; |
2147 |
+ |
return; |
2148 |
+ |
} |
2149 |
+ |
if(DeadEcalVec.size()!= 0){ |
2150 |
+ |
cout << "Error: DeadEcalVec has a nonzero size" << endl; |
2151 |
+ |
return; |
2152 |
+ |
} |
2153 |
+ |
while(!DeadEcalFile.eof()) |
2154 |
+ |
{ |
2155 |
+ |
DeadEcalFile >> etaEcal >> phiEcal; |
2156 |
+ |
DeadEcal newChan; |
2157 |
+ |
newChan.etaEcal = etaEcal; |
2158 |
+ |
newChan.phiEcal = phiEcal; |
2159 |
+ |
DeadEcalVec.push_back(newChan); |
2160 |
+ |
} |
2161 |
+ |
if(DeadEcalVec.size() == 0) cout << "Warning: No dead Ecal channels have been found." << endl; |
2162 |
+ |
} |
2163 |
+ |
|
2164 |
+ |
//if a track is found within dR<0.05 of a dead Ecal channel value = 1, otherwise value = 0 |
2165 |
+ |
int |
2166 |
+ |
OSUAnalysis::getTrkIsMatchedDeadEcal (const BNtrack* track1){ |
2167 |
+ |
int value = 0; |
2168 |
+ |
if (DeadEcalVec.size() == 0) WriteDeadEcal(); |
2169 |
+ |
for(std::vector<DeadEcal>::const_iterator ecal = DeadEcalVec.begin(); ecal != DeadEcalVec.end(); ++ecal){ |
2170 |
+ |
double eta = ecal->etaEcal; |
2171 |
+ |
double phi = ecal->phiEcal; |
2172 |
+ |
if (deltaR(eta, track1->eta, phi, track1->phi)<0.05) {value = 1;} |
2173 |
+ |
else {value = 0;} |
2174 |
+ |
} |
2175 |
+ |
return value; |
2176 |
+ |
} |
2177 |
+ |
|
2178 |
+ |
|
2179 |
+ |
|
2180 |
+ |
|
2181 |
|
double |
2182 |
|
OSUAnalysis::applyFunction(string function, double value){ |
2183 |
|
|