@@ -181,6 +181,7 @@ public List<DetectorDataDgtz> getEntriesADC(DetectorType type,
181181 public List <DetectorDataDgtz > getEntriesTDC (DetectorType type ){
182182 return getEntriesTDC (type ,dataList );
183183 }
184+
184185 /**
185186 * returns TDC entries from decoded data for given detector type
186187 * @param type detector type
@@ -290,6 +291,31 @@ public Bank getDataBankTDC(String name, DetectorType type){
290291 return tdcBANK ;
291292 }
292293
294+ public Bank getDataBankTDCPetiroc (String name , DetectorType type ){
295+
296+ List <DetectorDataDgtz > tdcDGTZ = this .getEntriesTDC (type );
297+ if (schemaFactory .hasSchema (name )==false ){
298+ System .out .println ("WARNING: No schema for TDC type : " + type );
299+ return null ;
300+ }
301+ Bank tdcBANK = new Bank (schemaFactory .getSchema (name ), tdcDGTZ .size ());
302+
303+ if (tdcBANK ==null ) return null ;
304+
305+ // Not sure why the schemea information isn't used here.
306+ for (int i = 0 ; i < tdcDGTZ .size (); i ++){
307+ tdcBANK .putByte ("sector" , i , (byte ) tdcDGTZ .get (i ).getDescriptor ().getSector ());
308+ tdcBANK .putByte ("layer" , i , (byte ) tdcDGTZ .get (i ).getDescriptor ().getLayer ());
309+ tdcBANK .putShort ("component" , i , (short ) tdcDGTZ .get (i ).getDescriptor ().getComponent ());
310+ tdcBANK .putByte ("order" , i , (byte ) tdcDGTZ .get (i ).getDescriptor ().getOrder ());
311+ tdcBANK .putInt ("TDC" , i , tdcDGTZ .get (i ).getTDCData (0 ).getTime ());
312+ tdcBANK .putInt ("ToT" , i , tdcDGTZ .get (i ).getTDCData (0 ).getToT ());
313+ //System.err.println("event: " + tdcDGTZ.get(i).toString());
314+ }
315+ return tdcBANK ;
316+ }
317+
318+
293319 public Bank getDataBankTimeStamp (String name , DetectorType type ) {
294320
295321 List <DetectorDataDgtz > tdcDGTZ = this .getEntriesTDC (type );
@@ -300,7 +326,8 @@ public Bank getDataBankTimeStamp(String name, DetectorType type) {
300326 int hash = ((desc .getCrate ()<<8 )&0xFF00 ) | (desc .getSlot ()&0x00FF );
301327 if (tsMap .containsKey (hash )) {
302328 if (tsMap .get (hash ).getTimeStamp () != tdc .getTimeStamp ())
303- System .out .println ("WARNING: inconsistent timestamp for DCRB crate/slot " + desc .getCrate () + "/" + desc .getSlot ());
329+ System .out .println ("WARNING: inconsistent timestamp for DCRB crate/slot "
330+ + desc .getCrate () + "/" + desc .getSlot ());
304331 }
305332 else {
306333 tsMap .put (hash , tdc );
@@ -393,16 +420,29 @@ public Event getDataEvent(){
393420
394421 Event event = new Event ();
395422
396- String [] adcBankNames = new String []{"FTOF::adc" ,"ECAL::adc" ,"FTCAL::adc" ,"FTHODO::adc" ,"FTTRK::adc" ,
397- "HTCC::adc" ,"BST::adc" ,"CTOF::adc" ,"CND::adc" ,"LTCC::adc" ,"BMT::adc" ,
398- "FMT::adc" ,"HEL::adc" ,"RF::adc" ,"BAND::adc" ,"RASTER::adc" };
399- DetectorType [] adcBankTypes = new DetectorType []{DetectorType .FTOF ,DetectorType .ECAL ,DetectorType .FTCAL ,DetectorType .FTHODO ,DetectorType .FTTRK ,
400- DetectorType .HTCC ,DetectorType .BST ,DetectorType .CTOF ,DetectorType .CND ,DetectorType .LTCC ,DetectorType .BMT ,
401- DetectorType .FMT ,DetectorType .HEL ,DetectorType .RF ,DetectorType .BAND , DetectorType .RASTER };
402-
403- String [] tdcBankNames = new String []{"FTOF::tdc" ,"ECAL::tdc" ,"DC::tdc" ,"HTCC::tdc" ,"LTCC::tdc" ,"CTOF::tdc" ,"CND::tdc" ,"RF::tdc" ,"RICH::tdc" ,"BAND::tdc" };
404- DetectorType [] tdcBankTypes = new DetectorType []{DetectorType .FTOF ,DetectorType .ECAL ,
405- DetectorType .DC ,DetectorType .HTCC ,DetectorType .LTCC ,DetectorType .CTOF ,DetectorType .CND ,DetectorType .RF ,DetectorType .RICH ,DetectorType .BAND };
423+ String [] adcBankNames = new String []{"FTOF::adc" ,"ECAL::adc" ,"FTCAL::adc" ,
424+ "FTHODO::adc" , "FTTRK::adc" ,
425+ "HTCC::adc" ,"BST::adc" ,"CTOF::adc" ,
426+ "CND::adc" ,"LTCC::adc" ,"BMT::adc" ,
427+ "FMT::adc" ,"HEL::adc" ,"RF::adc" ,
428+ "BAND::adc" ,"RASTER::adc" ,
429+ "AHDC::adc" };
430+ DetectorType [] adcBankTypes = new DetectorType []{DetectorType .FTOF ,DetectorType .ECAL ,DetectorType .FTCAL ,
431+ DetectorType .FTHODO ,DetectorType .FTTRK ,
432+ DetectorType .HTCC ,DetectorType .BST ,DetectorType .CTOF ,
433+ DetectorType .CND ,DetectorType .LTCC ,DetectorType .BMT ,
434+ DetectorType .FMT ,DetectorType .HEL ,DetectorType .RF ,
435+ DetectorType .BAND , DetectorType .RASTER ,
436+ DetectorType .AHDC };
437+
438+ String [] tdcBankNames = new String []{"FTOF::tdc" ,"ECAL::tdc" ,"DC::tdc" ,
439+ "HTCC::tdc" ,"LTCC::tdc" ,"CTOF::tdc" ,
440+ "CND::tdc" ,"RF::tdc" ,"RICH::tdc" ,
441+ "BAND::tdc" };
442+ DetectorType [] tdcBankTypes = new DetectorType []{DetectorType .FTOF ,DetectorType .ECAL ,
443+ DetectorType .DC ,DetectorType .HTCC ,DetectorType .LTCC ,
444+ DetectorType .CTOF ,DetectorType .CND ,DetectorType .RF ,
445+ DetectorType .RICH ,DetectorType .BAND };
406446
407447 for (int i = 0 ; i < adcBankTypes .length ; i ++){
408448 Bank adcBank = getDataBankADC (adcBankNames [i ],adcBankTypes [i ]);
@@ -421,6 +461,18 @@ public Event getDataEvent(){
421461 }
422462 }
423463 }
464+ try {
465+ // Do ATOF
466+ Bank tdcBank = getDataBankTDCPetiroc ("ATOF::tdc" ,DetectorType .ATOF );
467+ if (tdcBank !=null ){
468+ if (tdcBank .getRows ()>0 ){
469+ event .write (tdcBank );
470+ }
471+ }
472+ } catch (Exception e ) {
473+ e .printStackTrace ();
474+ }
475+
424476
425477 try {
426478 Bank tsBank = getDataBankTimeStamp ("DC::jitter" , DetectorType .DC );
@@ -432,10 +484,10 @@ public Event getDataEvent(){
432484 } catch (Exception e ) {
433485 e .printStackTrace ();
434486 }
487+
435488 /**
436489 * Adding un-decoded banks to the event
437490 */
438-
439491 try {
440492 Bank adcBankUD = this .getDataBankUndecodedADC ("RAW::adc" , DetectorType .UNDEFINED );
441493 if (adcBankUD !=null ){
@@ -671,6 +723,8 @@ public Bank createHelicityDecoderBank(EvioDataEvent event) {
671723 public static void main (String [] args ){
672724
673725 OptionParser parser = new OptionParser ("decoder" );
726+
727+ parser .setDescription ("CLAS12 Data Decoder" );
674728 parser .addOption ("-n" , "-1" , "maximum number of events to process" );
675729 parser .addOption ("-c" , "2" , "compression type (0-NONE, 1-LZ4 Fast, 2-LZ4 Best, 3-GZIP)" );
676730 parser .addOption ("-d" , "0" ,"debug mode, set >0 for more verbose output" );
@@ -721,8 +775,8 @@ public static void main(String[] args){
721775 writer .setCompressionType (compression );
722776 writer .getSchemaFactory ().initFromDirectory (ClasUtilsFile .getResourceDir ("CLAS12DIR" , "etc/bankdefs/hipo4" ));
723777
724- Bank rawScaler = new Bank (writer .getSchemaFactory ().getSchema ("RAW::scaler" ));
725- Bank rawRunConf = new Bank (writer .getSchemaFactory ().getSchema ("RUN::config" ));
778+ Bank rawScaler = new Bank (writer .getSchemaFactory ().getSchema ("RAW::scaler" ));
779+ Bank rawRunConf = new Bank (writer .getSchemaFactory ().getSchema ("RUN::config" ));
726780 Bank helicityAdc = new Bank (writer .getSchemaFactory ().getSchema ("HEL::adc" ));
727781 Event scalerEvent = new Event ();
728782
0 commit comments