FairShip
Loading...
Searching...
No Matches
ShipMuDIS::MuonDISInBranches Struct Reference

#include <MuDISDefs.h>

Collaboration diagram for ShipMuDIS::MuonDISInBranches:
[legend]

Public Member Functions

bool IsValid () const
void Clear ()
bool SetupTree (TTree *tree, const TString &label)
template<class T>
std::string Print (const std::vector< T > &aVec, const TString &aName)
std::ostringstream Print (const unsigned &aEvt, const TString &aLabel)

Public Attributes

int nDISevts = 0
int nDISevtsGenerated = -1
double pPythia = -1.
double wDIS = 1
std::vector< double > * DISxsec = nullptr
std::vector< bool > * DIStarget
std::vector< double > * DISvx = nullptr
std::vector< double > * DISvy = nullptr
std::vector< double > * DISvz = nullptr
std::vector< double > * DISvt = nullptr
std::vector< int > * nDISdau = nullptr
std::vector< DISparticle > * DISparticles = nullptr

Private Attributes

MuonDISBranches fStorage

Detailed Description

Definition at line 212 of file MuDISDefs.h.

Member Function Documentation

◆ Clear()

void ShipMuDIS::MuonDISInBranches::Clear ( )
inline

Definition at line 247 of file MuDISDefs.h.

247 {
248 nDISevts = 0;
250 pPythia = -1.;
251 wDIS = 1.;
252 fStorage.initEvent(0);
253 DISxsec = &fStorage.DISxsec;
254 DIStarget = &fStorage.DIStarget;
255 DISvx = &fStorage.DISvx;
256 DISvy = &fStorage.DISvy;
257 DISvz = &fStorage.DISvz;
258 DISvt = &fStorage.DISvt;
259 nDISdau = &fStorage.nDISdau;
260 DISparticles = &fStorage.DISparticles;
261 }
std::vector< double > * DISxsec
Definition MuDISDefs.h:217
std::vector< DISparticle > * DISparticles
Definition MuDISDefs.h:225
std::vector< double > * DISvt
Definition MuDISDefs.h:223
std::vector< bool > * DIStarget
Definition MuDISDefs.h:218
std::vector< double > * DISvx
Definition MuDISDefs.h:220
std::vector< double > * DISvy
Definition MuDISDefs.h:221
std::vector< double > * DISvz
Definition MuDISDefs.h:222
std::vector< int > * nDISdau
Definition MuDISDefs.h:224

◆ IsValid()

bool ShipMuDIS::MuonDISInBranches::IsValid ( ) const
inline

Definition at line 227 of file MuDISDefs.h.

227 {
228 if (nDISevts < 0 || !DISxsec || !DIStarget || !DISvx || !DISvy || !DISvz ||
229 !DISvt || !nDISdau || !DISparticles)
230 return false;
231 const auto size = static_cast<std::size_t>(nDISevts);
232 if (DISxsec->size() != size || DIStarget->size() != size ||
233 DISvx->size() != size || DISvy->size() != size ||
234 DISvz->size() != size || DISvt->size() != size ||
235 nDISdau->size() != size)
236 return false;
237 std::size_t total = 0;
238 for (int count : *nDISdau) {
239 if (count < 0 ||
240 static_cast<std::size_t>(count) > DISparticles->size() - total)
241 return false;
242 total += count;
243 }
244 return total == DISparticles->size();
245 }

◆ Print() [1/2]

template<class T>
std::string ShipMuDIS::MuonDISInBranches::Print ( const std::vector< T > & aVec,
const TString & aName )
inline

Definition at line 282 of file MuDISDefs.h.

282 {
283 std::ostringstream lOut;
284 lOut << " - " << aName << " size " << aVec.size() << " pointer " << &aVec
285 << ": ";
286 for (const auto& value : aVec) {
287 lOut << value << " ";
288 }
289 lOut << std::endl;
290 return lOut.str();
291 };

◆ Print() [2/2]

std::ostringstream ShipMuDIS::MuonDISInBranches::Print ( const unsigned & aEvt,
const TString & aLabel )
inline

Definition at line 293 of file MuDISDefs.h.

293 {
294 std::ostringstream lOut;
295 lOut << "------------ print evt " << aEvt << " branch " << aLabel
296 << " -------------" << std::endl
297 << " - nDISevts = " << nDISevts << std::endl
298 << " - wDIS = " << wDIS << std::endl;
299 if (DISxsec) lOut << Print(*DISxsec, "DISxsec");
300 if (DIStarget) lOut << Print(*DIStarget, "DIStarget");
301 if (DISvx) lOut << Print(*DISvx, "DISvx");
302 if (DISvy) lOut << Print(*DISvy, "DISvy");
303 if (DISvz) lOut << Print(*DISvz, "DISvz");
304 if (DISvt) lOut << Print(*DISvt, "DISvt");
305 if (nDISdau) lOut << Print(*nDISdau, "nDISdau");
306 if (DISparticles) lOut << Print(*DISparticles, "DISparticles");
307
308 return lOut;
309 };
std::string Print(const std::vector< T > &aVec, const TString &aName)
Definition MuDISDefs.h:282

◆ SetupTree()

bool ShipMuDIS::MuonDISInBranches::SetupTree ( TTree * tree,
const TString & label )
inline

Definition at line 263 of file MuDISDefs.h.

263 {
264 Clear();
265 bool ok = BindInputBranch(tree, "muon_nDISevt_" + label, &nDISevts);
266 ok &= BindInputBranch(tree, "muon_nDISGenerated_" + label,
268 ok &= BindInputBranch(tree, "muon_pPythia_" + label, &pPythia);
269 ok &= BindInputBranch(tree, "muon_wDIS_" + label, &wDIS);
270 ok &= BindInputBranch(tree, "mudis_DISxsec_" + label, &DISxsec);
271 ok &= BindInputBranch(tree, "mudis_DIStarget_" + label, &DIStarget);
272 ok &= BindInputBranch(tree, "mudis_DISvx_" + label, &DISvx);
273 ok &= BindInputBranch(tree, "mudis_DISvy_" + label, &DISvy);
274 ok &= BindInputBranch(tree, "mudis_DISvz_" + label, &DISvz);
275 ok &= BindInputBranch(tree, "mudis_DISvt_" + label, &DISvt);
276 ok &= BindInputBranch(tree, "mudis_nDISdaughters_" + label, &nDISdau);
277 ok &= BindInputBranch(tree, "mudis_DISproducts_" + label, &DISparticles);
278 return ok;
279 }
bool BindInputBranch(TTree *tree, const TString &name, T *address, bool required=true)
Definition MuDISDefs.h:143

Member Data Documentation

◆ DISparticles

std::vector<DISparticle>* ShipMuDIS::MuonDISInBranches::DISparticles = nullptr

Definition at line 225 of file MuDISDefs.h.

◆ DIStarget

std::vector<bool>* ShipMuDIS::MuonDISInBranches::DIStarget
Initial value:
=
nullptr

Definition at line 218 of file MuDISDefs.h.

◆ DISvt

std::vector<double>* ShipMuDIS::MuonDISInBranches::DISvt = nullptr

Definition at line 223 of file MuDISDefs.h.

◆ DISvx

std::vector<double>* ShipMuDIS::MuonDISInBranches::DISvx = nullptr

Definition at line 220 of file MuDISDefs.h.

◆ DISvy

std::vector<double>* ShipMuDIS::MuonDISInBranches::DISvy = nullptr

Definition at line 221 of file MuDISDefs.h.

◆ DISvz

std::vector<double>* ShipMuDIS::MuonDISInBranches::DISvz = nullptr

Definition at line 222 of file MuDISDefs.h.

◆ DISxsec

std::vector<double>* ShipMuDIS::MuonDISInBranches::DISxsec = nullptr

Definition at line 217 of file MuDISDefs.h.

◆ fStorage

MuonDISBranches ShipMuDIS::MuonDISInBranches::fStorage
private

Definition at line 312 of file MuDISDefs.h.

◆ nDISdau

std::vector<int>* ShipMuDIS::MuonDISInBranches::nDISdau = nullptr

Definition at line 224 of file MuDISDefs.h.

◆ nDISevts

int ShipMuDIS::MuonDISInBranches::nDISevts = 0

Definition at line 213 of file MuDISDefs.h.

◆ nDISevtsGenerated

int ShipMuDIS::MuonDISInBranches::nDISevtsGenerated = -1

Definition at line 214 of file MuDISDefs.h.

◆ pPythia

double ShipMuDIS::MuonDISInBranches::pPythia = -1.

Definition at line 215 of file MuDISDefs.h.

◆ wDIS

double ShipMuDIS::MuonDISInBranches::wDIS = 1

Definition at line 216 of file MuDISDefs.h.


The documentation for this struct was generated from the following file: