27 #include <arpa/inet.h>
101 Info(
"Dummy SetRootFile",
"%s",name->Data());
125 Info(
"NextEvent",
"Skipping PMM2 Reader (no available data)");
131 if ( ! res )
return res;
135 ULong_t ts[2] = {0, 0};
136 ULong_t tso[2] = {0, 0};
137 for(ndet=0; ndet<2; ndet++)
142 Info(
"NextEvent",
"Time stamps for det %li: %li %li",ndet,ts[ndet],tso[ndet]);
146 if(
fNevts==0 && deltat<100000){
151 fSync = ( deltat == 0 );
153 Info(
"NextEvent",
"deltat = %ld, fMode = %d",deltat,
fMode);
161 }
else if ( deltat < 0 ) {
170 }
else if ( deltat < 0 ) {
183 Warning(
"NextEvent",
"*** BAD Read Mode %d",
fMode);
217 ULong_t timestampPmm2 =
219 if(Double_t(timestamp)/10 - Double_t(timestampPmm2) >=
fPmm2Sync){
223 Info(
"NextEvent",
"Timestamp: %li > PMM2: %li (%g)",timestamp, timestampPmm2, Double_t(timestamp)/10 - Double_t(timestampPmm2));
232 Warning(
"NextEvent",
"Could not find matching PMM2 event for timestamp %li",timestamp);
237 }
else if(Double_t(timestamp)/10 - Double_t(timestampPmm2) <= -
fPmm2Sync){
240 Info(
"NextEvent",
"Timestamp: %li < PMM2: %li (%g)",timestamp, timestampPmm2, Double_t(timestamp)/10 - Double_t(timestampPmm2));
253 Info(
"NextEvent",
"******* Timestamp: %li , PMM2: %li ********",timestamp, timestampPmm2);
280 if(
gHarpoDebug>1) Info(
"FillEvent",
"No PMM2 Data");
308 if(
gHarpoDebug>0) Info(
"Init",
"Readout mode %d",mode);
316 Info(
"Constructor",
"Use default pmm2Sync %i",
fPmm2Sync);
323 Info(
"Init",
"Use default Latency %d",
fLatency);
336 std::cout <<
"Det is T2K XDCC" << std::endl;
339 else if (trdr == 1) {
340 std::cout <<
"Det is MINOS XDCC" << std::endl;
344 std::cout <<
"UNKNOWN XDCC" << std::endl;
350 std::cout <<
"Det Reader is T2K YDCC" << std::endl;
353 else if (trdr == 1) {
354 std::cout <<
"Det Reader is MINOS YDCC" << std::endl;
358 std::cout <<
"UNKNOWN YDCC Reader" << std::endl;
364 std::cout <<
"Det Reader is PMM2 TEXT" << std::endl;
369 else if (trdr == 1) {
370 std::cout <<
"Det Reader is PMM2 Windows" << std::endl;
375 else if (trdr == 2) {
376 std::cout <<
"Det Reader is PMM2 Linux" << std::endl;
381 else if (trdr == 3) {
382 std::cout <<
"Det Reader is PMM2 Windows 2" << std::endl;
394 std::cout <<
"UNKNOWN PMM2 Reader" << std::endl;
403 std::cout <<
"Det is TEMP_PRESSION" << std::endl;
407 std::cout <<
"Det is SIM" << std::endl;
418 std::cout << res << std::endl;
430 std::cout <<
"Get Det Header " << ndet << std::endl;
444 if(
gHarpoDebug>0) Info(
"Loop",
"maxevents = %ld",maxevents);
446 std::cout <<
"HarpoReaderRaw::Loop" << std::endl;
480 "Fatal Analysis Error %d aborting prgram.\n",st);
484 if (++cnt >= maxevents)
break;
491 if(
gHarpoDebug>0) Info(
"Find",
"Event %ld",eventNo);
494 Bool_t found =
false;
500 Info(
"Find",
"%ld => %ld",eventNo,(evt->
GetHeader())->GetEvtNo());
501 if ((evt->
GetHeader())->GetEvtNo() == eventNo) {
506 if (++cnt >= maxevents)
break;
526 Long_t run = rh->
GetRun();
531 Info(
"FillRunConfig",
"No RunConfig in DB ,run %ld",run);
535 if (info->
Lookup(
"Angle")) {
537 if (info->
GetVal(
"Angle",val)) {
539 rh->
SetAngle(std::atoi(val.Data()));
541 std::cout <<
"Angle value not found" << std::endl;
551 std::cout <<
"Angle not found" << std::endl;
553 if (info->
Lookup(
"Ebeam")) {
555 if (info->
GetVal(
"Ebeam",val)) {
557 rh->
SetEbeam(std::atof(val.Data()));
559 std::cout <<
"Ebeam value not found" << std::endl;
569 std::cout <<
"Ebeam not found" << std::endl;
571 if (info->
Lookup(
"Ephoton")) {
573 if (info->
GetVal(
"Ephoton",val)) {
577 std::cout <<
"Ephoton value not found" << std::endl;
587 std::cout <<
"Ephoton not found" << std::endl;
HarpoRunHeader * fRunHeader
A class which read HARPO dcc file from one DCC and creant Dcc Events and Dcc Headers for DCC Events o...
Long_t Loop(Long_t maxevents)
Bool_t GetRunConfig(Long_t nrun, const TString *dbUrl=NULL)
Query Db for given run Only this function in class interact wich DataBase. Must be called in HarpoRaw...
A class which read HARPO data from raw files.
HarpoRunHeader * GetRunHeader()
Create RunHeader with links to all raw headers.
TString * GetDbUrl()
Get harpo database server URL.
A virtual class store event data for un detector.
Long_t fRunNo
Number of readed events.
virtual ULong_t GetTimeStamp(Int_t after=0)=0
Get Run Configuration info by run number. The class query MySQL databe use GetRunConfig Method Only t...
Bool_t NextEvent()
TODO add synchro fro PMM2 (att PMM2 1lsb=100ns, DCC 1lsb=10ns)
Bool_t isExist(ULong_t det)
Detecror date exist //! Number of Real Detectors.
TString * GetInFile(Int_t idet)
Get Input file name for detector.
HarpoAnalyse * fAnalyse[30]
HarpoDetHeader * GetDetHeader()
A class which read HARPO sim file from one SIM and creant Sim Events and Sim Headers for SIM Events o...
Long_t Find(Long_t eventNo)
virtual void PushBack()
Skeeping not "intersting" event.
void SetReadOutMode(Long_t version)
A base class for all top level HARPO readers.
Data from Keller temperuture and pressure sensors.
void SetRunNo(Long_t nRun)
Find raw event by event number.
virtual HarpoDetEvent * GetEvent()
void FillRunConfigInfo()
Find raw event by event number.
void SetHeader(HarpoEventHeader *data)
void SetRunHeader(HarpoRunHeader *rh)
static Long_t CompareTimeStamps(ULong_t curr[2], ULong_t prev[2])
Long64_t GetDetRdrType(HarpoDetType nDet)
Return type of reader impementation for given Harpo Detector.
Bool_t Lookup(const TString field)
Lookup filed exist.
Bool_t GetVal(const TString field, TString &val)
Return value of existing field in Tstring.
void SetDet(Long_t plane)
virtual void ProcessEvent(HarpoEvent *event)
Set pointer to new event for analyse, anlyse event , and delete.
void SetRootFile(TString *name)
Bool_t Lookup(const char *path, Bool_t &val)
Lookup function for scalar values.
A class store HARPO raw PMM2 event buffer and header. End provide access metods to the row data...
ULong_t GetTimeStamp()
Number of readed events.
virtual ~HarpoReaderRaw()
void SetDetFile(TString *name)
HarpoEventHeader * GetHeader()
A class store HARPO row event data and header. Provide access metods to the row event data...
A class which read HARPO dcc file from one FEMINOS and creant Dcc Events and Dcc Headers for FEMINOS ...
A class which read HARPO raw file from PMM2 and create Raw Events objects.
const ULong_t gkNDetectors
void SetDetEvent(HarpoDetEvent *event, ULong_t plane=XDCC)
virtual void SkipEvent()
Read next event from raw file.
A class which keeps track of the entire configuration of the analysis.
HarpoDetReader ** fDetReader
ULong_t GetPrevTimeStamp()
HarpoEventHeader * fEventHeader
Bool_t Init(hReadMode mode=hSyncTime)
Init method : Open in/out files and check run header signature.
void SetDetFile(TString *name, Int_t plane)