ATLAS Offline Software
Loading...
Searching...
No Matches
ISF_HitAnalysis.cxx File Reference

Go to the source code of this file.

Functions

StatusCode ISF_HitAnalysis::initialize ATLAS_NOT_THREAD_SAFE ()
 Install fatal handler with default options.

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

StatusCode ISF_HitAnalysis::initialize ATLAS_NOT_THREAD_SAFE ( void )
inline

Install fatal handler with default options.

This is meant to be easy to call from python via ctypes.

Install fatal handler with default options.

Install fatal handler with default options.

getLorentzAngle() Read LorentzAngle from HIST and write out into local DB

getBSErrors() Read BSErrors from Monitoring HIST and write out into local DB

getEfficiency() Read Efficiency from Monitoring HIST and write out into local DB

getRawOccupancy() Read RawOccupancy from Monitoring HIST and write out into local DB

getNoiseOccupancy() Read NoiseOccupancy from HIST and write out into local DB

getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats

now add branches and leaves to the tree

Definition at line 79 of file ISF_HitAnalysis.cxx.

80{
81 ATH_MSG_VERBOSE( "Initializing ISF_HitAnalysis" );
82 //
83 // Register the callback(s):
84 //
85 ATH_CHECK(m_geoModel.retrieve());
86 ATH_CHECK(detStore()->retrieve(m_tileMgr));
87 ATH_CHECK(detStore()->retrieve(m_tileID));
88
89 const CaloIdManager* caloIdManager{nullptr};
90 ATH_CHECK(detStore()->retrieve(caloIdManager));
91 m_larEmID=caloIdManager->getEM_ID();
92 if(m_larEmID==nullptr)
93 throw std::runtime_error("ISF_HitAnalysis: Invalid LAr EM ID helper");
94 m_larFcalID=caloIdManager->getFCAL_ID();
95 if(m_larFcalID==nullptr)
96 throw std::runtime_error("ISF_HitAnalysis: Invalid FCAL ID helper");
97 m_larHecID=caloIdManager->getHEC_ID();
98 if(m_larHecID==nullptr)
99 throw std::runtime_error("ISF_HitAnalysis: Invalid HEC ID helper");
100 m_tileID=caloIdManager->getTileID();
101 if(m_tileID==nullptr)
102 throw std::runtime_error("ISF_HitAnalysis: Invalid Tile ID helper");
103
104 ATH_CHECK( m_fSamplKey.initialize() );
105
106 ATH_CHECK(detStore()->retrieve(m_tileHWID));
107 ATH_CHECK( m_tileSamplingFractionKey.initialize() );
108
109 ATH_CHECK( m_tileCablingSvc.retrieve() );
110 m_tileCabling = m_tileCablingSvc->cablingService();
111
112 ATH_CHECK(m_caloMgrKey.initialize());
113
114 // Get TimedExtrapolator ***************************************************************************************************
115 if (!m_extrapolator.empty() && m_extrapolator.retrieve().isFailure()) {
116 return StatusCode::FAILURE;
117 }
118 ATH_MSG_DEBUG("Extrapolator retrieved "<< m_extrapolator);
119
120 ATH_CHECK(m_calo_tb_coord.retrieve());
121 ATH_MSG_VERBOSE("retrieved " << m_calo_tb_coord);
122
123
124 // Get FastCaloSimCaloExtrapolation
125 ATH_CHECK (m_FastCaloSimCaloExtrapolation.retrieve());
126
127 // Grab the Ntuple and histogramming service for the tree
128 ATH_CHECK(m_thistSvc.retrieve());
129
130 //#########################
131 std::unique_ptr<TFile> dummyFile = std::unique_ptr<TFile>(TFile::Open("dummyFile.root", "RECREATE")); //This is added to suppress the error messages about memory-resident trees
132 m_tree = new TTree("FCS_ParametrizationInput", "FCS_ParametrizationInput");
133 std::string fullNtupleName = "/"+m_ntupleFileName+"/"+m_ntupleTreeName;
134 StatusCode sc = m_thistSvc->regTree(fullNtupleName, m_tree);
135 if (sc.isFailure() || !m_tree )
136 {
137 ATH_MSG_ERROR("Unable to register TTree: " << fullNtupleName);
138 return StatusCode::FAILURE;
139 }
140
142 if (m_tree)
143 {
144 ATH_MSG_INFO("Successfull registered TTree: " << fullNtupleName);
145 //initialize the variables before creating the branches
146 m_hit_x = new std::vector<float>;
147 m_hit_y = new std::vector<float>;
148 m_hit_z = new std::vector<float>;
149 m_hit_energy = new std::vector<float>;
150 m_hit_time = new std::vector<float>;
151 m_hit_identifier = new std::vector<Long64_t>;
152 m_hit_cellidentifier = new std::vector<Long64_t>;
153 m_islarbarrel = new std::vector<bool>;
154 m_islarendcap = new std::vector<bool>;
155 m_islarhec = new std::vector<bool>;
156 m_islarfcal = new std::vector<bool>;
157 m_istile = new std::vector<bool>;
158 m_hit_sampling = new std::vector<int>;
159 m_hit_samplingfraction = new std::vector<float>;
160
161 m_truth_energy = new std::vector<float>;
162 m_truth_px = new std::vector<float>;
163 m_truth_py = new std::vector<float>;
164 m_truth_pz = new std::vector<float>;
165 m_truth_pdg = new std::vector<int>;
166 m_truth_barcode = new std::vector<int>;
167 m_truth_vtxbarcode = new std::vector<int>;
168
169 m_cluster_energy = new std::vector<float>;
170 m_cluster_eta = new std::vector<float>;
171 m_cluster_phi = new std::vector<float>;
172 m_cluster_size = new std::vector<unsigned>;
173 m_cluster_cellID = new std::vector<std::vector<Long64_t > >;
174
175 m_cell_identifier = new std::vector<Long64_t>;
176 m_cell_energy = new std::vector<float>;
177 m_cell_sampling = new std::vector<int>;
178
179 m_g4hit_energy = new std::vector<float>;
180 m_g4hit_time = new std::vector<float>;
181 m_g4hit_identifier = new std::vector<Long64_t>;
182 m_g4hit_cellidentifier = new std::vector<Long64_t>;
183 m_g4hit_samplingfraction = new std::vector<float>;
184 m_g4hit_sampling = new std::vector<int>;
185
186 m_total_cell_e = 0;
187 m_total_hit_e = 0;
188 m_total_g4hit_e = 0;
189
190 m_final_cell_energy = new std::vector<Float_t>;
191 m_final_hit_energy = new std::vector<Float_t>;
192 m_final_g4hit_energy = new std::vector<Float_t>;
193
194 m_newTTC_entrance_eta = new std::vector<std::vector<float> >;
195 m_newTTC_entrance_phi = new std::vector<std::vector<float> >;
196 m_newTTC_entrance_r = new std::vector<std::vector<float> >;
197 m_newTTC_entrance_z = new std::vector<std::vector<float> >;
198 m_newTTC_entrance_detaBorder = new std::vector<std::vector<float> >;
199 m_newTTC_entrance_OK = new std::vector<std::vector<bool> >;
200 m_newTTC_back_eta = new std::vector<std::vector<float> >;
201 m_newTTC_back_phi = new std::vector<std::vector<float> >;
202 m_newTTC_back_r = new std::vector<std::vector<float> >;
203 m_newTTC_back_z = new std::vector<std::vector<float> >;
204 m_newTTC_back_detaBorder = new std::vector<std::vector<float> >;
205 m_newTTC_back_OK = new std::vector<std::vector<bool> >;
206 m_newTTC_mid_eta = new std::vector<std::vector<float> >;
207 m_newTTC_mid_phi = new std::vector<std::vector<float> >;
208 m_newTTC_mid_r = new std::vector<std::vector<float> >;
209 m_newTTC_mid_z = new std::vector<std::vector<float> >;
210 m_newTTC_mid_detaBorder = new std::vector<std::vector<float> >;
211 m_newTTC_mid_OK = new std::vector<std::vector<bool> >;
212 m_newTTC_IDCaloBoundary_eta = new std::vector<float>;
213 m_newTTC_IDCaloBoundary_phi = new std::vector<float>;
214 m_newTTC_IDCaloBoundary_r = new std::vector<float>;
215 m_newTTC_IDCaloBoundary_z = new std::vector<float>;
216 m_newTTC_Angle3D = new std::vector<float>;
217 m_newTTC_AngleEta = new std::vector<float>;
218
219 m_MuonEntryLayer_E = new std::vector<float>;
220 m_MuonEntryLayer_px = new std::vector<float>;
221 m_MuonEntryLayer_py = new std::vector<float>;
222 m_MuonEntryLayer_pz = new std::vector<float>;
223 m_MuonEntryLayer_x = new std::vector<float>;
224 m_MuonEntryLayer_y = new std::vector<float>;
225 m_MuonEntryLayer_z = new std::vector<float>;
226 m_MuonEntryLayer_pdg = new std::vector<int>;
227
228 // Optional branches
229 if(m_saveAllBranches){
230 m_tree->Branch("HitX", &m_hit_x);
231 m_tree->Branch("HitY", &m_hit_y);
232 m_tree->Branch("HitZ", &m_hit_z);
233 m_tree->Branch("HitE", &m_hit_energy);
234 m_tree->Branch("HitT", &m_hit_time);
235 m_tree->Branch("HitIdentifier", &m_hit_identifier);
236 m_tree->Branch("HitCellIdentifier", &m_hit_cellidentifier);
237 m_tree->Branch("HitIsLArBarrel", &m_islarbarrel);
238 m_tree->Branch("HitIsLArEndCap", &m_islarendcap);
239 m_tree->Branch("HitIsHEC", &m_islarhec);
240 m_tree->Branch("HitIsFCAL", &m_islarfcal);
241 m_tree->Branch("HitIsTile", &m_istile);
242 m_tree->Branch("HitSampling", &m_hit_sampling);
243 m_tree->Branch("HitSamplingFraction", &m_hit_samplingfraction);
244
245 m_tree->Branch("CellIdentifier", &m_cell_identifier);
246 m_tree->Branch("CellE", &m_cell_energy);
247 m_tree->Branch("CellSampling", &m_cell_sampling);
248
249 m_tree->Branch("G4HitE", &m_g4hit_energy);
250 m_tree->Branch("G4HitT", &m_g4hit_time);
251 m_tree->Branch("G4HitIdentifier", &m_g4hit_identifier);
252 m_tree->Branch("G4HitCellIdentifier", &m_g4hit_cellidentifier);
253 m_tree->Branch("G4HitSamplingFraction",&m_g4hit_samplingfraction);
254 m_tree->Branch("G4HitSampling", &m_g4hit_sampling);
255 }
256
257 //CaloHitAna output variables
258 m_tree->Branch("TruthE", &m_truth_energy);
259 m_tree->Branch("TruthPx", &m_truth_px);
260 m_tree->Branch("TruthPy", &m_truth_py);
261 m_tree->Branch("TruthPz", &m_truth_pz);
262 m_tree->Branch("TruthPDG", &m_truth_pdg);
263 m_tree->Branch("TruthBarcode", &m_truth_barcode);
264 m_tree->Branch("TruthVtxBarcode", &m_truth_vtxbarcode);
265
266 if(m_doClusterInfo){
267 m_tree->Branch("ClusterE", &m_cluster_energy);
268 m_tree->Branch("ClusterEta", &m_cluster_eta);
269 m_tree->Branch("ClusterPhi", &m_cluster_phi);
270 m_tree->Branch("ClusterSize", &m_cluster_size);
271 m_tree->Branch("ClusterCellID", &m_cluster_cellID);
272 }
273
274 m_oneeventcells = new FCS_matchedcellvector;
275 if(m_doAllCells){
276 m_tree->Branch("AllCells", &m_oneeventcells);
277 }
278
279 //write cells per layer
280 if(m_doLayers){
281 for (Int_t i = 0; i < MAX_LAYER; i++)
282 {
283 TString branchname = "Sampling_";
284 branchname += i;
285 m_layercells[i] = new FCS_matchedcellvector;
286 m_tree->Branch(branchname, &m_layercells[i]);
287 }
288 }
289
290 if(m_doLayerSums){
291 //write also energies per layer:
292 m_tree->Branch("cell_energy", &m_final_cell_energy);
293 m_tree->Branch("hit_energy", &m_final_hit_energy);
294 m_tree->Branch("g4hit_energy", &m_final_g4hit_energy);
295
296 //This is a duplicate of cell_energy[25]
297 m_tree->Branch("total_cell_energy", &m_total_cell_e);
298 m_tree->Branch("total_hit_energy", &m_total_hit_e);
299 m_tree->Branch("total_g4hit_energy", &m_total_g4hit_e);
300 }
301
302 m_tree->Branch("newTTC_back_eta",&m_newTTC_back_eta);
303 m_tree->Branch("newTTC_back_phi",&m_newTTC_back_phi);
304 m_tree->Branch("newTTC_back_r",&m_newTTC_back_r);
305 m_tree->Branch("newTTC_back_z",&m_newTTC_back_z);
306 m_tree->Branch("newTTC_back_detaBorder",&m_newTTC_back_detaBorder);
307 m_tree->Branch("newTTC_back_OK",&m_newTTC_back_OK);
308 m_tree->Branch("newTTC_entrance_eta",&m_newTTC_entrance_eta);
309 m_tree->Branch("newTTC_entrance_phi",&m_newTTC_entrance_phi);
310 m_tree->Branch("newTTC_entrance_r",&m_newTTC_entrance_r);
311 m_tree->Branch("newTTC_entrance_z",&m_newTTC_entrance_z);
312 m_tree->Branch("newTTC_entrance_detaBorder",&m_newTTC_entrance_detaBorder);
313 m_tree->Branch("newTTC_entrance_OK",&m_newTTC_entrance_OK);
314 m_tree->Branch("newTTC_mid_eta",&m_newTTC_mid_eta);
315 m_tree->Branch("newTTC_mid_phi",&m_newTTC_mid_phi);
316 m_tree->Branch("newTTC_mid_r",&m_newTTC_mid_r);
317 m_tree->Branch("newTTC_mid_z",&m_newTTC_mid_z);
318 m_tree->Branch("newTTC_mid_detaBorder",&m_newTTC_mid_detaBorder);
319 m_tree->Branch("newTTC_mid_OK",&m_newTTC_mid_OK);
320 m_tree->Branch("newTTC_IDCaloBoundary_eta",&m_newTTC_IDCaloBoundary_eta);
321 m_tree->Branch("newTTC_IDCaloBoundary_phi",&m_newTTC_IDCaloBoundary_phi);
322 m_tree->Branch("newTTC_IDCaloBoundary_r",&m_newTTC_IDCaloBoundary_r);
323 m_tree->Branch("newTTC_IDCaloBoundary_z",&m_newTTC_IDCaloBoundary_z);
324 m_tree->Branch("newTTC_Angle3D",&m_newTTC_Angle3D);
325 m_tree->Branch("newTTC_AngleEta",&m_newTTC_AngleEta);
326
327 m_tree->Branch("MuonEntryLayer_E",&m_MuonEntryLayer_E);
328 m_tree->Branch("MuonEntryLayer_px",&m_MuonEntryLayer_px);
329 m_tree->Branch("MuonEntryLayer_py",&m_MuonEntryLayer_py);
330 m_tree->Branch("MuonEntryLayer_pz",&m_MuonEntryLayer_pz);
331 m_tree->Branch("MuonEntryLayer_x",&m_MuonEntryLayer_x);
332 m_tree->Branch("MuonEntryLayer_y",&m_MuonEntryLayer_y);
333 m_tree->Branch("MuonEntryLayer_z",&m_MuonEntryLayer_z);
334 m_tree->Branch("MuonEntryLayer_pdg",&m_MuonEntryLayer_pdg);
335 }
336 dummyFile->Close();
337 return StatusCode::SUCCESS;
338} //initialize
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
This class initializes the Calo (LAr and Tile) offline identifiers.
const TileID * getTileID(void) const
const LArHEC_ID * getHEC_ID(void) const
const LArFCAL_ID * getFCAL_ID(void) const
const LArEM_ID * getEM_ID(void) const
ID3PD * m_tree
Pointer to the ID3PD object used.
::StatusCode StatusCode
StatusCode definition for legacy code.