The harpoanalysis program can run your analysis (if you created it with makeNewAnalysis.sh). You just need to add the analysis name in a configuration file:
# File myConfig.cfg Analyses="HarpoAnalyseName HarpoAnalyseWriter"; @include "HarpoReconstruction.cfg"The analyses in the list will be applied sequentially for each event.
You can then apply the list of analyses to data:
./runRawData harpoanalysis RUNNO -c myConfig.cfg
harpoanalysis -c myConfig.cfg --root run.root
The analysis is applied to a dataset using the HarpoReader class. The Analysis and Reader are created and initialized:
HarpoReader *rdr = new HarpoReader( cfg ); rdr->Init(hSyncTime); HarpoAnalyseName1 *hana1 = new HarpoAnalyseName1(); hana1-> Init();
hSyncTime indicates the method used for synchronising the different detectors.
Then the Analysis is associated to the Reader (several Analyses can be added sequentially):
rdr->AddAnalyseFunction(hana1);
The reader then loops over the dataset:
rdr->Loop();
And finally, the Analysis is finalized:
hana1->Save();
A full program example.cxx will look as follows:
// // Demo code for harpo analyse framework in C++ and Root // #include <stdlib.h> #include <stdio.h> #include "HarpoConfig.h" #include "HarpoReader.h" #include "HarpoRunHeader.h" #include "HarpoAnalyseName1.h" #include "HarpoAnalyseName2.h" #include "HarpoAnalyseName3.h" int main(int argc, char **argv) { Long_t processed = -1; // Processed events counter , negative on error HarpoRunHeader *hdr; HarpoConfig *cfg = new HarpoConfig(argc,argv,0x03); cfg->Init(); cfg->print(); HarpoReader *rdr = new HarpoReader( cfg ); // hNoCMPTime, // Read without timestamp comparision // hFirstTime, // return only plane with smaller timestamp // hSyncTime // skip plane event with smaller timestamp, return only if ( rdr->Init(hSyncTime) ) { hdr = rdr->GetRunHeader(); //hdr->print(); } else { printf ("Int ERROR exiting ...\n"); return 1; } HarpoAnalyseName1 *hana1 = new HarpoAnalyseName1(); HarpoAnalyseName2 *hana2 = new HarpoAnalyseName2(); HarpoAnalyseName3 *hana3 = new HarpoAnalyseName3(); hana1-> Init(); hana2-> Init(); hana3-> Init(); hana1->SetRunHeader(hdr); rdr->AddAnalyseFunction(hana1); rdr->AddAnalyseFunction(hana2); rdr->AddAnalyseFunction(hana3); processed = rdr->Loop(); hana1->Save(); hana2->Save(); hana3->Save(); delete hana1; delete hana2; delete hana3; delete rdr; delete cfg; printf("\n Done processed Events %li\n",processed); return 0;
To compile it, you must add the following line in Makefile:
$(eval $(call make_exec,example))