 |
ATLAS Offline Software
|
Go to the documentation of this file.
48 ATH_MSG_ERROR(
"failed to properly add softTrk affecting systematics " );
49 return StatusCode::FAILURE;
58 ATH_MSG_ERROR(
"failed to properly add softCalo affecting systematics " );
59 return StatusCode::FAILURE;
65 ATH_MSG_ERROR(
"failed to properly add jetTrk affecting systematics " );
66 return StatusCode::FAILURE;
75 ATH_MSG_DEBUG(
"These systematics are set based on your config files: " );
80 return StatusCode::SUCCESS;
93 if (lastchar !=
'/') {
99 m_configJetTrkFile.empty() )
ATH_MSG_WARNING(
"you have initialized the METSystematicsTool with no configuration file. The tool will do nothing. Please set the configuration file properties.");
110 ATH_MSG_INFO(
"Doing SoftCalo systematics initialization. THIS IS FOR SOFTWARE DEVELOPMENT ONLY.");
111 ATH_MSG_INFO(
"CST IS NOT YET RECOMMENDED OR SUPPORTED BY THE MET GROUP.");
114 std::string systpath =
"";
129 return StatusCode::FAILURE;
137 return StatusCode::SUCCESS;
146 std::string gsystpath =
"";
147 std::string configdir =
"";
148 std::string blank =
"";
152 TFile
infile((configdir).c_str());
158 return StatusCode::FAILURE;
164 return StatusCode::SUCCESS;
172 std::string psystpath =
"";
188 return StatusCode::FAILURE;
196 return StatusCode::SUCCESS;
205 if( systSet.
empty() ) {
207 return StatusCode::SUCCESS;
208 }
else if( systSet.
size() > 1 ) {
209 ATH_MSG_WARNING(
"Tool does not support multiple systematics, returning unsupported" );
210 return StatusCode::FAILURE;
228 return StatusCode::FAILURE;
233 return StatusCode::SUCCESS;
244 ATH_MSG_WARNING(
"event info is empty, returning without applying correction");
249 ATH_MSG_WARNING(
"This tool should be applied to MC only. Return without changing the input MET object");
256 if(METcont ==
nullptr){
257 ATH_MSG_WARNING(
"MissingET object not owned by a container. Returning without applying correction" );
266 if(
helper.map() ==
nullptr) {
267 ATH_MSG_WARNING(
"The MissingETAssociationMap for the given MissingETAssociationHelper is null. Returning without applying correction ");
274 ATH_MSG_WARNING(
"METSystematicsTool received a MissingET object it can't correct. You should only pass soft MET terms or jet track MET terms.");
284 if(outputmet !=
nullptr ){
285 ATH_MSG_WARNING(
"Please pass a nullptr to the 2nd argument of correctedCopy to fill the output pointer");
297 ATH_MSG_WARNING(
"This tool should be applied to MC only. Return without changing the input MET object");
304 if(METcont ==
nullptr){
305 ATH_MSG_WARNING(
"MissingET object not owned by a container. Unable to apply correction, returning output MET object as null" );
312 outputmet =
nullptr;
delete copy;
318 if(
helper.map() ==
nullptr) {
319 ATH_MSG_WARNING(
"MissingETAssociationHelper contained a null MissingETAssociationMap pointer");
320 outputmet =
nullptr;
delete copy;
326 outputmet =
nullptr;
delete copy;
344 ATH_MSG_ERROR(
"not soft met, cannot apply soft term correction to this MET");
352 <<
", met = " << softMet.
met()
354 <<
", do syst? " << doSyst);
358 <<
", met = " << softMet.
met()
360 <<
", do syst? " << doSyst);
371 softMetStruct.
mpx = softMet.
mpx();
372 softMetStruct.
mpy = softMet.
mpy();
374 softMetStruct.
name = softMet.
name();
377 if(METcont ==
nullptr){
378 ATH_MSG_WARNING(
"failed to retrieve MET container from passed object");
383 double const ptHardMet = std::sqrt( ptHard.
mpx * ptHard.
mpx +
384 ptHard.
mpy * ptHard.
mpy ) ;
387 size_t njet = (jetterm==
nullptr) ? 0 : acc_constitObjLinks(*jetterm ).size();
391 int phbin = std::as_const(*shiftHist)->GetXaxis()->FindBin( ptHardMet ) ;
392 if(phbin>(*shiftHist)->GetNbinsX()) phbin = (*shiftHist)->GetNbinsX();
394 int const jetbin = std::as_const(*shiftHist)->GetYaxis()->FindBin(njet);
396 double const scalePara = (*shiftHist)->GetBinContent(phbin,jetbin,mubin);
399 double smearPara(0), smearPerp(0);
408 softMetStruct =
variedSoftTerm(softMetStruct, ptHard, scalePara, 0.);
412 softMetStruct =
variedSoftTerm(softMetStruct, ptHard, -1.*scalePara, 0.);
416 softMetStruct =
variedSoftTerm(softMetStruct, ptHard, smearPara, 0.);
420 softMetStruct =
variedSoftTerm(softMetStruct, ptHard, 0., smearPerp);
425 softMetStruct =
variedSoftTerm(softMetStruct, ptHard, smearPara, smearPerp);
429 softMetStruct =
variedSoftTerm(softMetStruct, ptHard, smearPara, 0.);
433 softMetStruct =
variedSoftTerm(softMetStruct, ptHard, 0., smearPerp);
438 softMetStruct =
variedSoftTerm(softMetStruct, ptHard, smearPara, smearPerp);
441 ATH_MSG_DEBUG(
"No systematic applied, returning nominal MET term");
452 <<
", met = " << softMet.
met() );
463 ATH_MSG_ERROR(
"jet track systematics histogram not initialized properly.") ;
493 jettrkmet.
setMpx ( jettrkmet.
mpx() - trkvec.
cpx() * uncert);
494 jettrkmet.
setMpy ( jettrkmet.
mpy() - trkvec.
cpy() * uncert);
505 ATH_MSG_ERROR(
"jet track systematics histogram not initialized properly.") ;
515 std::vector<const xAOD::Jet*>
jets;
516 for(
const iplink_t& jetlink : acc_constitObjLinks(jettrkmet)) {
518 ATH_MSG_ERROR(
"Invalid object of type " << (*jetlink)->type() <<
" in jet term");
523 bool originalInputs =
jets.empty() ? false : !acc_originalObject.isAvailable(*
jets.front());
534 if(std::abs(
jet->eta())<=2.5){
545 uncert = std::sqrt(uncert*uncert+uncert_frac*uncert_frac);
555 jettrkmet.
setMpx ( jettrkmet.
mpx()*(1 + uncert/(std::abs(jettrkmet.
mpx())*std::sqrt(2))));
556 jettrkmet.
setMpy ( jettrkmet.
mpy()*(1 + uncert/(std::abs(jettrkmet.
mpy())*std::sqrt(2))));
568 ATH_MSG_ERROR(
"MissingETAssociationMap null, error calculating jet track systematics.");
581 double const varPara,
582 double const varPerp)
const{
585 projection.
mpx += varPara;
586 projection.
mpy += varPerp;
593 double const ptHardMet = std::sqrt( ptHard.
mpx * ptHard.
mpx +
594 ptHard.
mpy * ptHard.
mpy );
596 double const ux = ptHard.
mpx/ptHardMet;
597 double const uy = ptHard.
mpy/ptHardMet;
598 double const projL = ux*softTerms.
mpx + uy*softTerms.
mpy;
599 double const projT = uy*softTerms.
mpx - ux*softTerms.
mpy;
619 if(truthiter == truthCont->
end()){
626 ptHard.
mpx = truthmet.
mpx();
627 ptHard.
mpy = truthmet.
mpy();
636 ptHard.
mpx -= (*iMET)->mpx();
637 ptHard.
mpy -= (*iMET)->mpy();
638 ptHard.
sumet += (*iMET)->sumet();
642 if( ptHard.
sumet < 0 ) {
643 ATH_MSG_ERROR(
"PtHard has a negative sumet, returning ptHart = 0");
652 if(ptHard.
sumet<1.0e-6){
662 std::string & systpath ,
670 std::string configpath =
"";
671 std::string configfile =
"";
687 ATH_MSG_INFO(
"Searching for configFile: " << configfile);
689 ATH_MSG_DEBUG(
"CALIBPATH: " << gSystem->Getenv(
"CALIBPATH") );
691 if(configpath.empty() || configfile.empty() ){
693 return StatusCode::FAILURE;
696 if(
reader.ReadFile(configpath.c_str(),EEnvLevel(0)) < 0) {
698 return StatusCode::FAILURE;
701 ATH_MSG_INFO(
"Configuring from file : " << configpath );
707 systpath =
reader.GetValue(
"GlobalSyst.sourcedir" ,
"" );
711 systpath =
reader.GetValue(
"PtHardSyst.sourcedir" ,
"" );
724 std::string
const units_string =
reader.GetValue(
"Units",
"" );
728 if(units_string !=
"GeV"){
729 ATH_MSG_ERROR(
"initialized the different systematics using two config files that conflict on units");
730 return StatusCode::FAILURE;
734 if( (!units_string.empty()) && (units_string !=
"MeV")){
735 ATH_MSG_ERROR(
"initialized the different systematics using two config files that conflict on units");
736 return StatusCode::FAILURE;
741 if( (units_string.empty()) || (units_string ==
"MeV") ){
743 }
else if(units_string ==
"GeV"){
746 ATH_MSG_ERROR(
"You specified an incorrect 'Units' value. Please specify MeV , GeV , or leave it blank for MeV");
747 return StatusCode::FAILURE;
756 ATH_MSG_ERROR(
"Failed to correctly set histfile path, or path to histograms inside of the histfile" );
757 return StatusCode::FAILURE;
762 ATH_MSG_ERROR(
"Something is wrong with your units initialization. Please contact the developers (you should never get here).");
763 return StatusCode::FAILURE;
766 return StatusCode::SUCCESS;
777 ATH_MSG_ERROR(
"Failed to retrieve default EventInfo object");
787 ATH_MSG_ERROR(
"Failed to retrieve default NPV value from PrimaryVertices");
793 for (itr = vertices->
begin(); itr != vertices->
end(); ++itr)
802 random =
new TRandom3();
Const iterator class for DataVector/DataList.
void setSumet(float value)
Set .
MET association descriptor contains object links and corresponding parameters.
float sumet() const
Returns.
size_t size() const
returns: size of the set
void setMpy(float value)
Set the component.
bool empty() const
returns: whether the set is empty
static bool isTotalTerm(Types::bitmask_t bits, Region reg=Region::FullAcceptance)
Class to wrap a set of SystematicVariations.
MissingET_v1 MissingET
Version control by type defintion.
MissingETBase::Types::bitmask_t source
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Helper class to provide constant type-safe access to aux data.
#define ATH_MSG_VERBOSE(x)
bool const RAWDATA *ch2 const
Class providing the definition of the 4-vector interface.
static bool isTrackTerm(Types::bitmask_t bits, Region reg=Region::FullAcceptance)
@ IS_SIMULATION
true: simulation, false: data
void setSource(MissingETBase::Types::bitmask_t src)
Set the source of the MET object.
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
static bool isJetTerm(Types::bitmask_t bits, Region reg=Region::FullAcceptance)
Vector sum of constituents for subtractive overlap removal.
void setName(const std::string &name)
Set the name of the MET object.
const_iterator find(const std::string &name) const
Find non-modifiable MET object by name.
@ Error
Some error happened during the object correction.
static Types::bitmask_t jet(Region reg=Region::FullAcceptance)
Standard MET term from reconstructed jets.
::StatusCode StatusCode
StatusCode definition for legacy code.
float cpy() const
Returns .
float sumpt() const
Returns sum of component pt.
Principal data object for Missing ET.
float mpx() const
Returns .
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
const std::string & name() const
Identifier getters.
void setMpx(float value)
Set the component.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ConstVec jetTrkVec() const
Get track constituent vector for the reference jet.
Container for xAOD::MissingET_v1 objects.
MissingETBase::Types::bitmask_t source() const
MET object source tag.
static const MissingETAssociation * getAssociation(const MissingETAssociationMap *pMap, const Jet *pJet)
ConstVec overlapTrkVec(const MissingETAssociationHelper &helper) const
Retrieve total track-based vector to be subtracted from the jet.
Class describing the basic event information.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
@ Ok
The correction was done successfully.
static Types::bitmask_t truthNonInt()
Standard bit pattern indicating genuine true MET.
#define ATH_MSG_WARNING(x)
const_iterator begin() const
description: const iterator to the beginning of the set
Return value from object correction CP tools.
const SG::AuxVectorData * container() const
Return the container holding this element.
float cpx() const
Returns .
reader
read the goodrunslist xml file(s)
float mpy() const
Returns .
static bool isSoftTerm(Types::bitmask_t bits, Region reg=Region::FullAcceptance)
Jet_v1 Jet
Definition of the current "jet version".
float met() const
Returns .
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
float actualInteractionsPerCrossing() const
Average interactions per crossing for the current BCID - for in-time pile-up.