3#include "KVINDRADstToRootTransfert.h"
4#include "KVClassFactory.h"
5#include "KVBatchSystem.h"
16#include "KVINDRACodes.h"
17#include "KVINDRAReconNuc.h"
18#include "KVINDRAReconEvent.h"
22#include "KVPhoswich.h"
23#include "KVDetector.h"
24#include "KVIDTelescope.h"
26#include "KVDataRepositoryManager.h"
27#include "KVDataSetManager.h"
28#include "KVDataRepository.h"
29#include "KVBatchSystem.h"
30#include "KVGANILDataReader.h"
65 Info(
"InitRun",
"ds InitRun");
68 Info(
"InitRun",
"dst file %s", dst_file.
Data());
72 gROOT->ProcessLine(
".! ls -lhrt *");
77 Info(
"InitRun",
"Debut lecture DST %s", now1.
AsString());
83 Info(
"InitRun",
"Bilan ressource apres ReadDST");
90 cout <<
" ------------- Process infos -------------" << endl;
91 printf(
" CpuUser = %f s. VirtMem = %f MB DiskUsed = %s\n",
95 Warning(
"InitRun",
"pas d info disponible sur le bilan ressource");
152 ifstream f_in(
"list_of_files");
155 Int_t nfiles, necrit, rn_verif;
156 nfiles = necrit = rn_verif = 0;
158 while (f_in.good()) {
161 toks =
line.Tokenize(
"=");
164 if (
line.BeginsWith(
"file_number=")) nfiles = val;
165 else if (
line.BeginsWith(
"write_evts=")) necrit = val;
166 else if (
line.BeginsWith(
"run_number=")) rn_verif = val;
175 Error(
"ProcessRun",
"Le numero de run inscrit dans le fichier list_of_files (%d) est different du run courant (%d)", rn_verif,
fRunNumber);
176 Error(
"ProcessRun",
"\t->analysis is going to stop");
179 inst.
Form(
".! rm list_of_files");
182 inst.
Form(
".! rm arbre_root_*.txt");
187 Info(
"ProcessRun",
"Lecture de list_of_files :\n - nbre de fichiers a lire %d\n - nbre d evts a lire %d\n", nfiles, necrit);
207 stit.
Form(
"%s : %s : root events converted from DST",
211#if ROOT_VERSION_CODE > ROOT_VERSION(5,25,4)
212#if ROOT_VERSION_CODE < ROOT_VERSION(5,26,1)
235 Error(
"ProcessRun",
"No RAW data file available for this run. ABORT!!");
239 Info(
"InitRun",
"Created raw data tree (%s : %s). Format: %s",
260 Info(
"ProcessRun",
"Special treatment INDRA 2nd campaign data:");
261 Info(
"ProcessRun",
"Particles detected in phoswich ring 1 have general ID code=4");
262 Info(
"ProcessRun",
"After translation, they will have Veda ID code=2 (like 1st campaign)");
265 Info(
"ProcessRun",
"Bilan ressource avant lecture des %d fichiers ascii", nfiles);
272 cout <<
" ------------- Process infos -------------" << endl;
273 printf(
" CpuUser = %f s. VirtMem = %f MB DiskUsed = %s\n",
280 for (
Int_t nf = 1; nf <= nfiles; nf += 1) {
282 stit.
Form(
"arbre_root_%d.txt", nf);
283 ifstream f_data(stit.
Data());
285 while (f_data.good()) {
290 cout <<
" +++ " <<
events_read <<
" events processed +++ " << endl;
297 cout <<
" ------------- Process infos -------------" << endl;
298 printf(
" CpuUser = %f s. VirtMem = %f MB DiskUsed = %s\n",
305 inst.
Form(
".! rm arbre_root_%d.txt", nf);
307 Info(
"ProcessRun",
"Bilan ressource apres lecture du fichier numero %d/%d", nf, nfiles);
314 cout <<
" ------------- Process infos -------------" << endl;
315 printf(
" CpuUser = %f s. VirtMem = %f MB DiskUsed = %s\n",
325 cout <<
"Nb. evts read from files: " <<
events_read << endl;
326 cout <<
"Nb. evts written to TTree: " <<
events_good << endl;
327 cout <<
"Nb. evts in FORTRAN file: " << necrit << endl;
328 if (check_events < 0.99) cout <<
"ERROR: number of events read <99% number in FORTRAN file" << endl;
345 Info(
"ProcessRun",
"Fin Conversion format ROOT %s", now2.
AsString());
348 inst.
Form(
".! rm list_of_files");
360 Info(
"EndRun",
"ds EndRun");
378 Info(
"SubmitTask",
"Liste de runs : %s",
GetRunList().AsString());
501 phos->GetACQParam(
"T")->SetData((
UShort_t)
mt);
523 else if (ring >= 2 && ring <= 9) {
555 if (
canal[Si75_GG] > 0) {
558 if (
canal[SiLi_GG] > 0) {
607 if (ring == 1 &&
camp4) {
623 else if (ring >= 2 && ring <= 9) {
646 else if (ring >= 10) {
667 if (
canal[CsI_R] > 0.) {
705 if (ring == 1 && !
camp4) {
710 phos->GetACQParam(
"T")->SetData((
UShort_t)
mt);
733 if (ring < 2 || ring > 9)
return 0;
793 if (ring == 1 &&
camp2) {
801 phos->GetACQParam(
"T")->SetData((
UShort_t)
mt);
805 else if (ring >= 2 && ring <= 9) {
826 else if (ring >= 10) {
838 if (
canal[CsI_R] > 0.) {
846 else if (
de4 > 0.0) {
899 FNMETHOD CodeFunc[] = {
917 num_ev = buff.
Atoi();
932 for (
Int_t i = 0; i < mul; i++) {
934 Int_t z,
a, code, icou, imod, ecode, ncans;
936 for (
Int_t gj = 0; gj < 16; gj++)
canal[gj] = 0.0;
949 cout <<
"BAD: event#" << num_ev <<
" z=" << z <<
" a=" <<
a <<
" / Non-numeric value read for ener. Set E=0" << endl;
950 cout <<
"(read: " << buff.
Data() <<
")" << endl;
962 cout <<
"BAD: event#" << num_ev <<
" z=" << z <<
" a=" <<
a <<
" / Non-numeric value read for de_mylar. Set de_mylar=0" << endl;
963 cout <<
"(read: " << buff.
Data() <<
")" << endl;
972 cout <<
"BAD: event#" << num_ev <<
" z=" << z <<
" a=" <<
a <<
" / Non-numeric value read for de1. Set de1=0" << endl;
973 cout <<
"(read: " << buff.
Data() <<
")" << endl;
981 cout <<
"BAD: event#" << num_ev <<
" z=" << z <<
" a=" <<
a <<
" / Non-numeric value read for de2. Set de2=0" << endl;
982 cout <<
"(read: " << buff.
Data() <<
")" << endl;
990 cout <<
"BAD: event#" << num_ev <<
" z=" << z <<
" a=" <<
a <<
" / Non-numeric value read for de3. Set de3=0" << endl;
991 cout <<
"(read: " << buff.
Data() <<
")" << endl;
999 cout <<
"BAD: event#" << num_ev <<
" z=" << z <<
" a=" <<
a <<
" / Non-numeric value read for de4. Set de4=0" << endl;
1000 cout <<
"(read: " << buff.
Data() <<
")" << endl;
1008 cout <<
"BAD: event#" << num_ev <<
" z=" << z <<
" a=" <<
a <<
" / Non-numeric value read for de5. Set de5=0" << endl;
1009 cout <<
"(read: " << buff.
Data() <<
")" << endl;
1015 cout <<
"BAD: event#" << num_ev <<
" particle#" << i <<
" Z=" << z <<
" code=" << code << endl;
1019 for (
Int_t mk = 1; mk <= 4; mk++) {
1028 for (
Int_t mk = 1; mk <= ncans; mk++) {
1034 if ((code < 11 || (
camp2 && code == 14)) && icou > 0 && imod > 0 && icou < 18 && imod < 25) {
1047 if (code == 14) det_stop = (this->*CodeFunc[4])(icou, imod);
1048 else det_stop = (this->*CodeFunc[code])(icou, imod);
1051 cout <<
"det_stop=0: event#" << num_ev <<
" particle#" << i <<
" icou=" << icou <<
" imod=" << imod <<
1052 " z=" << z <<
" a=" <<
a <<
" code=" << code <<
" ecode=" << ecode << endl;
1057 Fatal(
"lire_evt",
"KVINDRAReconEvent::AddParticle() returns NULL pointer.");
1060 det_stop->GetACQParam(
"T")->SetData((
UShort_t)
mt);
1077 if (
a > 0 && (code == 2 || code == 3)) {
1135 vector<int> triggers;
1137 while (!all_runs.
End()) {
1139 if (triggers.size() == 0
1140 || std::find(triggers.begin(), triggers.end(), dbrun->
GetTrigger()) != triggers.end()) {
1145 std::sort(triggers.begin(), triggers.end());
1147 for (std::vector<int>::iterator it = triggers.begin(); it != triggers.end(); ++it) {
1148 cout <<
" ---> Trigger M>" << *it << endl;
1150 while (!all_runs.
End()) {
1155 cout <<
"\t[File written: " << dbrun->
GetDatime().
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
static const Char_t * GetBINDIRFilePath(const Char_t *namefile="")
virtual void SetNumber(UInt_t num)
Ionisation chamber detectors of the INDRA multidetector array.
CsI(Tl) scintillation detectors of the INDRA multidetector array.
virtual Int_t GetNumber() const
const Char_t * GetComments() const
ULong64_t GetEvents() const
KVDBSystem * GetSystem() const
const TDatime & GetDatime() const
const Char_t * GetBatchName()
Bool_t RunningInLaunchDirectory()
void WriteBatchInfo(TTree *)
KVDataSet * GetDataSet(const Char_t *repository, const Char_t *dataset) const
Return pointer to named dataset in the given repository.
virtual void CopyFileFromRepository(const KVDataSet *dataset, const Char_t *datatype, const Char_t *filename, const Char_t *destination)
const KVNumberList & GetRunList() const
const KVDBSystem * GetSystem() const
const KVDataSet * GetDataSet() const
Manage an experimental dataset corresponding to a given experiment or campaign.
FileType * OpenRunfile(const Char_t *type, Int_t run)
TString GetOutputRepository(const Char_t *taskname) const
virtual const Char_t * GetDataPathSubdir() const
Returns name of top-level directory in data repository used to store data files for this dataset.
const Char_t * GetRunfileName(const Char_t *type, Int_t run) const
KVNumberList GetRunList(const Char_t *data_type, const KVDBSystem *sys=0) const
TString GetFullPathToRunfile(const Char_t *type, Int_t run) const
void CommitRunfile(const Char_t *type, Int_t run, TFile *file)
KVExpDB * GetDataBase(Option_t *opt="") const
TFile * NewRunfile(const Char_t *type, Int_t run)
Base class for detector geometry description.
virtual void SetEnergy(Double_t e) const
GANIL VXI/VME 16 bit (maximum) EBYEDAT acquisition parameter.
void UseInternalDataMember()
void Clear(Option_t *opt="")
static void MakeEventBranch(TTree *tree, const TString &branchname, T &event, Int_t bufsize=10000000)
KVDBRun * GetDBRun(Int_t number) const
Reads GANIL acquisition files (EBYEDAT)
virtual void SetUserTree(TTree *, Option_t *="arrays")
static UChar_t VedaECodeToBitmask(UChar_t veda_e_code)
static UShort_t VedaIDCodeToBitmask(UChar_t veda_id_code)
Database entry for each run of an INDRA experiment.
KVINDRADBRun * GetRun(Int_t run) const
Bool_t camp4
set to kTRUE when reading 4th campaign: => ring1 is Si-CsI
Bool_t camp2
set to kTRUE when reading 2nd campaign: => phoswich code is 4, not 2
KVINDRADetector * GetChIo() const
Conversion of INDRA DST file to KaliVeda ROOT format.
KVDetector * Code1(int ring, int mod)
KVDetector * Code2and9and10(int ring, int mod)
virtual ~KVINDRADstToRootTransfert()
Destructor.
const KVSeqCollection * params
KVDetector * Code0(int ring, int mod)
void lire_evt(std::ifstream &f_in, KVINDRAReconEvent *evt)
KVIDTelescope * identifying_telescope
virtual KVNumberList PrintAvailableRuns(KVString &datatype)
KVDetector * Code4and5and6and8(int ring, int mod)
void DefineSHELLVariables()
virtual void SubmitTask()
KVDetector * Code3(int ring, int mod)
virtual void ProcessRun()
KVDetector * Code7(int ring, int mod)
Event reconstructed from energy losses in INDRA multidetector.
Nuclei reconstructed from data measured in the INDRA array.
void SetEnergyCsI(Float_t val)
void SetEnergySi(Float_t val)
void SetEnergyChIo(Float_t val)
void SetEnergySi75(Float_t val)
void SetEnergySiLi(Float_t val)
void SetIDCode(UShort_t code_mask)
void SetECode(UChar_t code_mask)
virtual KVINDRADetector * GetDetectorByType(UInt_t cou, UInt_t mod, UInt_t type) const
UInt_t GetCurrentRunNumber() const
static KVMultiDetArray * MakeMultiDetector(const Char_t *dataset_name, Int_t run=-1, TString classname="KVMultiDetArray")
KVIDTelescope * GetIDTelescope(const Char_t *name) const
Return pointer to DeltaE-E ID Telescope with "name".
void SetZ(Int_t z, Char_t mt=-1)
Strings used to represent a set of ranges of values.
void SetEnergy(Double_t e)
Phoswich detector in the INDRA array (first 3 campaigns)
void SetEnergy(Double_t e) const
Set energy lost in both layers.
virtual void Reconstruct(KVDetector *kvd)
virtual void SetAMeasured(Bool_t yes=kTRUE)
void SetRealZ(Float_t zz)
virtual void SetZMeasured(Bool_t yes=kTRUE)
void SetIdentifyingTelescope(KVIDTelescope *i)
80um silicon detector for INDRA etalon telescopes
2mm + 40um dead zone Si(Li) detector for INDRA etalon telescopes
Silicon detectors of the INDRA array.
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
const char * AsString() const
virtual void SetTitle(const char *title="")
const char * GetName() const override
const char * GetTitle() const override
virtual void SetName(const char *name)
TObject * At(Int_t idx) const override
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Error(const char *method, const char *msgfmt,...) const
virtual void Fatal(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
const char * Data() const
TObjArray * Tokenize(const TString &delim) const
void Form(const char *fmt,...)
std::istream & ReadLine(std::istream &str, Bool_t skipWhite=kTRUE)
virtual int GetProcInfo(ProcInfo_t *info) const
virtual void Exit(int code, Bool_t mode=kTRUE)
virtual TString GetFromPipe(const char *command)
virtual char * ExpandPathName(const char *path)
virtual void Setenv(const char *name, const char *value)
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const override
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
virtual void SetAutoFlush(Long64_t autof=-30000000)
virtual Int_t Branch(const char *folder, Int_t bufsize=32000, Int_t splitlevel=99)