// -*- C++ -*- // // Package: DRGeomProcessor // Module: DRGeomProcessor // // Description: Example of a Processor using DRLayer (to be named ADRStore) // // Implementation: // // // Author: Inga Karliner // Created: Sun Jun 21 18:55:00 EDT 1998 // $Id$ // // Revision history // // $Id$ // #include "Experiment/Experiment.h" // system include files #include #include #if defined(AMBIGUOUS_STRING_FUNCTIONS_BUG) #include #endif #if defined(STL_TEMPLATE_DEFAULT_PARAMS_FIRST_BUG) #endif /* STL_TEMPLATE_DEFAULT_PARAMS_FIRST_BUG */ // user include files #include "DRGeomProcessor/DRGeomProcessor.h" #include "Experiment/report.h" #include "FrameAccess/FAItem.h" #include "FrameAccess/FATable.h" #include "DataHandler/Frame.h" #include "FrameAccess/extract.h" #include "DataHandler/Record.h" #include "ADRGeom/ADRSenseWireStore.h" #include "ActiveElements/AEWireInfo.h" #include "ActiveElements/AEWireLayerCylindrical.h" //#include "ActiveElements/AEWireLayerRealistic.h" #include "ADRGeom/ADRWireAddress.h" // STL classes // // constants, enums and typedefs // static const char* const kFacilityString = "Processor.DRGeomProcessor" ; // // static data member definitions // // // constructors and destructor // DRGeomProcessor::DRGeomProcessor( void ) // anal1 : Processor( "DRGeomProcessor" ) { report( INFO, kFacilityString ) << "here in ctor()" << endl; // ---- bind a method to a stream ----- // These lines ARE VERY IMPORTANT! If you don't bind the // code you've just written (the "action") to a stream, // your code won't get executed! // bind( &DRGeomProcessor::event, Stream::kEvent ); // bind( &DRGeomProcessor::beginRun, Stream::kBeginRun ); bind( &DRGeomProcessor::baseGeometry,Stream::kBaseGeometry); // bind( &DRGeomProcessor::drAlignment, Stream::kDRAlignment ); // bind( &DRGeomProcessor::endRun, Stream::kEndRun ); // do anything here that needs to be done at creation time // (e.g. allocate resources etc.) } // DRGeomProcessor::DRGeomProcessor( const DRGeomProcessor& iDRGeomProcessor ) // { // *this = iDRGeomProcessor; // } DRGeomProcessor::~DRGeomProcessor() // anal5 { report( INFO, kFacilityString ) << "here in dtor()" << endl; // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) } // // assignment operators // // const DRGeomProcessor& DRGeomProcessor::operator=( const DRGeomProcessor& iDRGeomProcessor ) // { // if( this != &iDRGeomProcessor ) { // // do actual copying here, plus: // // "SuperClass"::operator=( iDRGeomProcessor ); // } // // return *this; // } // // member functions // // ------------ methods for beginning/end "Interactive" ------------ // --------------------------- init method ------------------------- void DRGeomProcessor::init( void ) // anal1 "Interactive" { report( INFO, kFacilityString ) << "here in init()" << endl; // do any initialization here based on Parameter Input by User // (e.g. run expensive algorithms that are based on parameters // specified by user at run-time) } // -------------------- terminate method ---------------------------- void DRGeomProcessor::terminate( void ) // anal5 "Interactive" { report( INFO, kFacilityString ) << "here in terminate()" << endl; // do anything here BEFORE New Parameter Change // (e.g. write out result based on parameters from user-input) } // ---------------- standard place to book histograms --------------- void DRGeomProcessor::hist_book( TBHistoManager& ) { report( INFO, kFacilityString ) << "here in hist_book()" << endl; // book your histograms here } // --------------------- methods bound to streams ------------------- //ActionBase::ActionResult //DRGeomProcessor::event( Frame& ) // anal3 equiv. //{ // report( INFO, kFacilityString ) << "here in event()" << endl; // // return ActionBase::kPassed; //} //ActionBase::ActionResult //DRGeomProcessor::beginRun( Frame& ) // anal2 equiv. //{ // report( INFO, kFacilityString ) << "here in beginRun()" << endl; // // return ActionBase::kPassed; //} /* ActionBase::ActionResult DRGeomProcessor::endRun( Frame& ) // anal4 equiv. { report( INFO, kFacilityString ) << "here in endRun()" << endl; return ActionBase::kPassed; } */ ActionBase::ActionResult DRGeomProcessor::drAlignment( Frame& iFrame ) // anal2 equiv. { // bind to DRAlignment report( INFO, kFacilityString ) << "here in DRAlign" << endl; // FAItem< ADRSenseWireStore > iADRSenseWireStore ; // extract( iFrame.record( Stream::kDRAlignment ), iADRSenseWireStore ); return ActionBase::kPassed; } ActionBase::ActionResult DRGeomProcessor::baseGeometry( Frame& iFrame ) // anal2 equiv. { // bind to baseGeometry,till Mike implements drAlignment report( INFO, kFacilityString ) << "here in baseGeometry" << endl; //extract ADRSenseWireStore FAItem< ADRSenseWireStore > iADRSenseWireStore ; extract( iFrame.record( Stream::kBaseGeometry ), iADRSenseWireStore ); if( iADRSenseWireStore.valid() ) { // EXAMPLES OF ACTIVE DR_GEOMETRY ACCESS FUNCTIONS //----------------------------+ //Global Active DR properties | //----------------------------+ ofstream outf("ADrGeomProcessor.dump"); cout << endl<<"*** ADRGeom Processor ***** " << endl<<"============================"<< endl; cout << "#DR Layers "<< iADRSenseWireStore->numberOfLayers()<numberOfAxialLayers()<< endl; cout << "#DR Layers Stereo "<< iADRSenseWireStore->numberOfStereoLayers()<< endl; cout << "#DR Layers U "<< iADRSenseWireStore->numberOfULayers()<< endl; cout << "#DR Layers V "<< iADRSenseWireStore->numberOfVLayers()<< endl; cout << "#DR Wires Total "<< iADRSenseWireStore->numberOfWiresTotal()<numberOfLayers()<numberOfAxialLayers()<< endl; outf << "#DR Layers Stereo "<< iADRSenseWireStore->numberOfStereoLayers()<< endl; outf << "#DR Layers U "<< iADRSenseWireStore->numberOfULayers()<< endl; outf << "#DR Layers V "<< iADRSenseWireStore->numberOfVLayers()<< endl; outf << "#DR Wires Total "<< iADRSenseWireStore->numberOfWiresTotal()<aLayers(); const unsigned int* ulayer = iADRSenseWireStore->uLayers(); const unsigned int* vlayer = iADRSenseWireStore->vLayers(); int ika = iADRSenseWireStore->numberOfAxialLayers() -1; int iku = iADRSenseWireStore->numberOfULayers()-1; int ikv = iADRSenseWireStore->numberOfVLayers()-1; cout << endl<< "First/Last Axial layers:" << setw(3) << alayer[0] < Layer, (Wire in Layer)|"< Layer, (Wire in Layer)|"< Layer, Wire in Layer | // Trackers Beware NOTE Range: | // CellID=1:9796 Layer=1:47 WireInLayer=0:(NWiresInLayer-1)| //-------------------------------------------------------------+ UInt32 CellID = 1 ; // UInt32 CellID = 9796 ; ADRSenseWireStore::LayerWire lw=iADRSenseWireStore->layerWire(CellID); unsigned short layerCell=lw.first; unsigned short wireCell =lw.second; cout<Layer, Wire:" <Layer, Wire:" < CellID | // Trackers Beware NOTE Range: | // CellID=1:9796 Layer=1:47 WireInLayer=0:NWiresInLayer-1 | //-------------------------------------------------------------+ layerCell = 18; wireCell = 22; cout<CellID=" <cellID(layerCell,wireCell)<CellID=" <cellID(layerCell,wireCell)<layer(itLayer2); int layernumber = iADRSenseWireStore->layerNumber(layer2); cout<<"*************************"<layer(itLayer); //** const AEWireLayerRealistic& layer //** = iADRSenseWireStore->layer(itLayer); unsigned int numberOfWiresLyr = iADRSenseWireStore->numberOfWiresLyr(itLayer); double radiusLayerEndCap = layer.radiusEndCap(); double phi0West = layer.phiOfFirstWireInVolume2(); double phi0East = layer.phiOfFirstWireInVolume1(); double radiusLayer = iADRSenseWireStore->radius(itLayer); double phi0 = iADRSenseWireStore->phi0(itLayer); double phiCellWidth = iADRSenseWireStore->cellPhiWidth(itLayer); double tanStereoAngle = iADRSenseWireStore->tanStereoAngle(itLayer); double zMin = iADRSenseWireStore->zMin(itLayer); double zMax = iADRSenseWireStore->zMax(itLayer); DABoolean isAxial = iADRSenseWireStore->isAxial(itLayer); DABoolean isStereo = iADRSenseWireStore->isStereo(itLayer); DABoolean isStereoU = iADRSenseWireStore->isStereoU(itLayer); DABoolean isStereoV = iADRSenseWireStore->isStereoV(itLayer); /* unsigned int numberOfWiresLyr = layer.numberOfWires(); double radiusLayerEndCap = layer.radiusEndCap(); double phi0West = layer.phiOfFirstWireInVolume2(); double phi0East = layer.phiOfFirstWireInVolume1(); double radiusLayer = layer.radius(); double phi0 = layer.phi0(); double phiCellWidth = layer.cellPhiWidth(); double tanStereoAngle = layer.tanStereoAngle(); double zMin = layer.zMin(); double zMax = layer.zMax(); DABoolean isAxial = layer.isAxial(); DABoolean isStereo = layer.isStereo(); DABoolean isStereoU = layer.isStereoU(); DABoolean isStereoV = layer.isStereoV(); */ //get radius at the layer's sense wire at z=0 and one end, compare with input DABoolean successR; double rMin = iADRSenseWireStore->radiusAtz(successR,itLayer,zMin); // double rMin = layer.radiusAtz(successR,zMin); if(!successR) {cout<<"? rMin="<radiusAtz(successR,itLayer,zMax); // double rMax = layer.radiusAtz(successR, zMax); if(!successR) {cout<<"? rMax="<radiusAtz(successR,itLayer,0.); // double r0 = layer.radiusAtz(successR, 0.); if(!successR) {cout<<"? r0 ="<radiusAtz(successR,itLayer,zMax/2.); // double r1 = layer.radiusAtz(successR, zMax/2.); if(!successR) {cout<<"? r1 ="<numberOfLayers(); ++itLayer ) { const AEWireLayerCylindrical& layer = iADRSenseWireStore->layer(itLayer); //** const AEWireLayerRealistic& layer = iADRSenseWireStore->layer(itLayer); /* outf<numberOfWiresLyr(itLayer) <radius(itLayer) <phi0(itLayer) <cellPhiWidth(itLayer) <tanStereoAngle(itLayer)<layerNumber(layer_success,position); if (layer_success) { cout<layerNumber(layer_success,position); if (layer_success) { cout<layerNumber(layer_success,position); if (layer_success) { cout<<"layerNumber success"<layerNumber(layer_success,position); if(!layer_success) { cout<wireObjectClosest(success,position,irlayer); if (success) { cout<<"wireObjectClosests gives wire with ends:"<layer(itLayer); //** const AEWireLayerRealistic& ilayer = iADRSenseWireStore->layer(itLayer); cout <wire(itLayer,iwire); // const AEWireInfo& itwire=ilayer.wire(iwire); //recover wire # unsigned int wirenumber=ilayer.wireNumber(itwire); cout<<"iwire="<wire(itLayer,iwire); // const AEWireInfo itwire=ilayer.wire(iwire); // make wire on stack //AEWireInfo itwire = ilayer.wireMk(iwire); zE = itwire.point1().z(); wDZ = itwire.zPoint(zE); radius0 = wDZ.first.distance(); phi0 = atan2(wDZ.first.y(),wDZ.first.x()); cout << setw(3) << itLayer << setw(4)<< iwire <<" " << wDZ.first <<" "<< wDZ.second << endl << " z=zE: r(xyz),phi " <=0.) { cout<<"full calculation = "<wireMk(iWireAddress); cout << setw(3) << itLayer << setw(4)<< iwire <<" " << iswire.point1() <<" "<< iswire.point2() << endl; outf << setw(3) << itLayer << setw(4)<< iwire <<" " << iswire.point1() <<" "<< iswire.point2() << endl; } outf <wire(iWireAddress); cout << setw(3) << itLayer << setw(4)<< iwire <<" " << iswire.point1() <<" "<< iswire.point2() << endl; outf << setw(3) << itLayer << setw(4)<< iwire <<" " << iswire.point1() <<" "<< iswire.point2() << endl; } //chk ADRSenseWireStore::wireMk(cell)========================================= cout <cellID(itLayer,iwire); const AEWireInfo iswire = iADRSenseWireStore->wireMk(CellID); cout << setw(3) << itLayer << setw(4)<< iwire <<" " << iswire.point1() <<" "<< iswire.point2() << endl; outf << setw(3) << itLayer << setw(4)<< iwire <<" " << iswire.point1() <<" "<< iswire.point2() << endl; } //chk ADRSenseWireStore::wire(cell)========================================= cout <cellID(itLayer,iwire); const AEWireInfo iswire = iADRSenseWireStore->wire(CellID); cout << setw(3) << itLayer << setw(4)<< iwire <<" " << iswire.point1() <<" "<< iswire.point2() << endl; outf << setw(3) << itLayer << setw(4)<< iwire <<" " << iswire.point1() <<" "<< iswire.point2() << endl; if(iwire==3) { cout << setw(3) << itLayer << setw(4)<< iwire << " sagy= " << setw(5)<