ATLAS Offline Software
Loading...
Searching...
No Matches
LArMphysOverMcalFromTuple.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
11
12#include "TFile.h"
13#include "TBranch.h"
14#include "TTree.h"
15#include "TChain.h"
16
17#include <vector>
18#include <iostream>
19#include <fstream>
20#include <string>
21
22
24= default;
25
27{
28 ATH_MSG_INFO ( "... in stop()" );
29
30 // get LArOnlineID helper
31 const LArOnlineID* onlineHelper = nullptr;
32 ATH_CHECK( detStore()->retrieve(onlineHelper, "LArOnlineID") );
33
34 TChain* outfit = new TChain("outfit");
35 for (const std::string& s : m_root_file_names) {
36 outfit->Add(s.c_str());
37 }
38
39 // variable names as in the Ntuple
40 Int_t BarAC; // 0 = barrel C 1 = barrel A
41 Int_t FT; // feedthrough 0 - 31
42 Int_t Channel; // 0 - 14
43 Int_t Slot; // 1 -14
44 Double_t PhysOCal; // Mphys/Mcal
45 int gain = 0; // LARHIGHGAIN = 0, LARMEDIUMGAIN = 1, LARLOWGAIN = 2,
46
47 outfit->SetBranchAddress("Channel", &Channel);
48 outfit->SetBranchAddress("Slot", &Slot);
49 outfit->SetBranchAddress("FT", &FT);
50 outfit->SetBranchAddress("BarAC", &BarAC);
51 outfit->SetBranchAddress("PhysOCal", &PhysOCal);
52
53
54 // Create new LArMphysOverMcalComplete
56// container->setGroupingType(LArConditionsContainerBase::FeedThroughGrouping);
57 container->setGroupingType(LArConditionsContainerBase::ExtendedFTGrouping);
58 ATH_CHECK( container->initialize() );
59
60
61
62
63 // loop over entries in the Tuple, one entry = one channel
64 Long64_t nentries = outfit->GetEntries();
65 for ( Int_t i = 0; i < nentries; i++ )
66 {
67 outfit->GetEntry(i);
68 HWIdentifier id = onlineHelper->channel_Id(0, BarAC, FT, Slot, Channel);
69 container->set(id,gain,PhysOCal);
70 }
71
72
73 // store
74 ATH_CHECK( detStore()->record(container,m_store_key) );
75 // Symlink LArMphysOverMcalComplete to ILArMphysOverMcal for further use
76 ILArMphysOverMcal *larMphysOverMcal = nullptr;
77 ATH_CHECK( detStore()->symLink(container,larMphysOverMcal) );
78
79 ATH_MSG_INFO ( "LArMphysOverMcalyFromTuple stopped!" );
80
81 return StatusCode::SUCCESS;
82}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
const ServiceHandle< StoreGateSvc > & detStore() const
This class implements the ILArMphysOverMcal interface.
virtual ~LArMphysOverMcalFromTuple()
StringArrayProperty m_root_file_names
list of input ntuple file names
virtual StatusCode stop() override
IAlgorithm::stop() : Where the action takes place...
StringProperty m_store_key
key of the PhysWave collection in StoreGate
HWIdentifier channel_Id(int barrel_ec, int pos_neg, int feedthrough, int slot, int channel) const
create channel identifier from fields