Hi brat users,
I have noticed that in most of brat module classes (like e.g.
BrDigitizeTof), the
scheme of the Event method was:
-----------------------------------------
//prepare output table
BrDataTable* outputable = new BrDataTable(tableName);
OutputNode->AddDataTable(outputable);
then follows e.g. for digitizing modules:
BrDataTable *geantHits = InputNode->GetDataTable(name);
Int_t nhits = geantHits->GetEntries();
for (Int_t i=0; i < nhits, i++) {
....and then the real work of that method.
}
//end of Event method
------------------------------------------
I have changed that a bit to prevent this method from putting empty
tables in case the procedure
gives no objects to put inside these tables:
------------------------------------------
//prepare output table
BrDataTable* outputable = new BrDataTable(tableName);
BrDataTable *geantHits = InputNode->GetDataTable(name);
Int_t nhits = geantHits->GetEntries();
if(nhits) {
for (Int_t i=0; i < nhits, i++) {
...
... procedure;
}
if (outputable->GetEntries())
OutputNode->AddDataTable(outputable);
}
//end of Event method
------------------------------------------
I made that for several modules and thereby I don't have empty tables in
nodes
I'd like to analyze. The 'if(nhits)' statement prevents the program from
declaring
variables for nothing and so on.
So if you think it's worth, I can make that available for all of us.
Djamel
--
:o) ********************************* )o:
|ME : Djamel Ouerdane |
|EMAIL : ouerdane@nbi.dk |
|OFFICE : Tb1 @ NBI |
|INST : Niels Bohr Institute |
| Blegdamsvej 17, |
| DK-2100 København Ø |
| Danmark |
|PHONE : +45 353 252 69 (office) |
|HOME : Julius Blomsgade 31, 2TH |
| 2200 Copenhagen N |
| Danmark |
:oD ********************************* \o:
This archive was generated by hypermail 2b29 : Fri May 05 2000 - 10:03:51 EDT