28 #include "StEEmcRawMapMaker.h"
30 #include "StMuDSTMaker/COMMON/StMuEmcCollection.h"
31 #include "StMuDSTMaker/COMMON/StMuDst.h"
33 #include "StEEmcUtil/database/StEEmcDb.h"
34 #include "StEEmcUtil/database/EEmcDbItem.h"
35 #include "StEEmcUtil/EEmcGeom/EEmcGeomDefs.h"
37 #include "StEvent/StEvent.h"
38 #include "StEvent/StEmcDetector.h"
39 #include "StEvent/StEmcModule.h"
40 #include "StEvent/StEmcRawHit.h"
41 #include "StEvent/StEmcCollection.h"
43 #include "StMessMgr.h"
49 #include "StMuDSTMaker/COMMON/StMuEvent.h"
50 #include "StEvent/StTriggerIdCollection.h"
51 #include "StEvent/StTriggerId.h"
55 StEEmcRawMapMaker::StEEmcRawMapMaker(
const Char_t* name ) :
StMaker( name ), mInputType(-1), mInputName(
""), mEEmcDb(0) { };
58 StEEmcRawMapMaker::~StEEmcRawMapMaker(){ };
60 Int_t StEEmcRawMapMaker::setInput(
const Char_t *name, Int_t type ){
63 if( type == 0 || type == 1){
67 LOG_ERROR <<
"Invalid input type" << endm;
73 Int_t StEEmcRawMapMaker::Init(){
76 if( mInputType != 0 && mInputType != 1){
77 LOG_ERROR <<
"Input mInputType not set to valid value" << endm;
89 mEEmcDb = (
StEEmcDb*)this->GetDataSet(
"StEEmcDb");
91 LOG_ERROR <<
"Error finding EEMC DB" << endm;
110 const StMuDst* muDst = (
const StMuDst*)GetInputDS( mInputName.data() );
117 LOG_ERROR <<
"Error finding MuEmc Collection from MuDst" << endm;
123 LOG_INFO <<
"Number of towers in MuDst " << emc->getNEndcapTowerADC() << endm;
127 for ( Int_t i = 0; i < emc->getNEndcapTowerADC(); ++i ){
128 Int_t adc, sec, sub, eta;
129 emc->getEndcapTowerADC( i, adc, sec, sub, eta );
136 if( (sec >= 0) && (sec < kEEmcNumSectors ) && (sub >= 0) && (sub < kEEmcNumSubSectors ) && (eta >= 0) && (eta < kEEmcNumEtas) )
137 addHitTower(sec,sub,eta,adc,0);
141 for ( Int_t i = 0; i < emc->getNEndcapPrsHits(); i++ ){
143 Int_t adc, sec, sub, eta, det;
144 const StMuEmcHit *
hit = emc->getEndcapPrsHit(i, sec, sub, eta, det);
146 adc = hit -> getAdc();
153 if( (sec >= 0) && (sec < kEEmcNumSectors ) && (sub >= 0) && (sub < kEEmcNumSubSectors ) && (eta >= 0) && (eta < kEEmcNumEtas) )
154 addHitTower(sec,sub,eta,adc,det);
164 Char_t cpl[] = {
'U',
'V' };
165 for ( Int_t plane = 0; plane < 2; plane++ ){
166 for ( Int_t ihit = 0; ihit < emc->getNEndcapSmdHits(cpl[plane]); ihit++ ) {
167 Int_t sec, strip, adc;
168 const StMuEmcHit *
hit = emc->getEndcapSmdHit( cpl[plane], ihit, sec, strip );
174 if ((sec >= 0) && (sec < 12) && (strip >= 0) && (strip < 288))
175 addHitStrip(sec,plane,strip,adc);
184 const StTriggerId& l1trig =
event->triggerIdCollection().l1();
185 cout <<
"Passed trigger? " << l1trig.isTrigger( 380301 ) <<
' ' << l1trig.isTrigger( 380302 ) << endl;
190 LOG_INFO <<
"Number of towers in MuDst " << emc->getNEndcapTowerADC() <<
" vs in raw Map " << mMap[0].size() << endm;
199 const StEvent *
event = (
const StEvent*)GetInputDS( mInputName.data() );
203 emc =
event->emcCollection();
206 LOG_ERROR <<
"Error reading from StEvent" << endm;
211 StDetectorId detectorIds[] = { kEndcapEmcTowerId, kEndcapEmcPreShowerId };
218 for( Int_t iDet = 0; iDet < 2; ++iDet ){
219 detector = emc->detector( detectorIds[iDet] );
222 LOG_ERROR <<
"Error finding EEMC detector in EEmc collection" << endm;
226 for ( UInt_t sec = 0; sec < detector->numberOfModules(); sec++ ){
230 const StEmcModule *sector = detector->module( sec+1 );
232 const StSPtrVecEmcRawHit &hits = sector->hits();
235 for ( UInt_t ihit=0; ihit<hits.size(); ihit++ ){
239 Int_t sec = hits[ihit]->module() - 1;
240 Int_t sub = hits[ihit]->sub() - 1;
241 Int_t eta = hits[ihit]->eta() - 1;
242 Int_t adc = hits[ihit]->adc();
244 Int_t layer = (hits[ihit]->sub() - 1) / 5 + 1;
245 if( (layer >= 0) && (layer < 4) && (sec >= 0) && (sec < kEEmcNumSectors) && (sub >= 0) && (sub < kEEmcNumSubSectors ) && (eta >= 0) && (eta < kEEmcNumEtas) )
246 addHitTower(sec,sub,eta,adc,layer);
260 StDetectorId ids[] = { kEndcapSmdUStripId, kEndcapSmdVStripId };
262 for( Int_t iplane=0; iplane<2; iplane++ ){
265 detector=emc->detector( ids[iplane] );
268 for( UInt_t sec = 0; sec<detector->numberOfModules(); sec++ ){
271 const StEmcModule *sector = detector->module( sec+1 );
272 const StSPtrVecEmcRawHit &hits = sector->hits();
275 for ( UInt_t ihit=0; ihit<hits.size(); ihit++ ){
276 Int_t isector = hits[ihit]->module()-1;
277 Int_t istrip = hits[ihit]->eta()-1;
278 Int_t adc = hits[ihit]->adc();
279 if( (isector >= 0) && (isector < 12) && (istrip >= 0) && (istrip < 288) )
280 addHitStrip( isector, iplane, istrip, adc);
289 void StEEmcRawMapMaker::addHitTower( Int_t sec, Int_t sub, Int_t eta, Int_t adc, Int_t layer ){
291 Int_t index = eta + kEEmcNumEtas*( sub + kEEmcNumSubSectors*sec );
303 static const Char_t subsectors[] = {
'A',
'B',
'C',
'D',
'E' };
304 static const Char_t detectors[] = {
'T',
'P',
'Q',
'R' };
305 const EEmcDbItem *dbitem = mEEmcDb->getTile( sec+1,subsectors[sub],eta+1, detectors[layer] );
308 data.fail = dbitem->fail;
309 data.stat = dbitem->stat;
310 data.ped = dbitem->ped;
311 data.pedSigma = dbitem->sigPed;
312 data.gain = dbitem->gain;
315 void StEEmcRawMapMaker::addHitStrip( Int_t sec, Bool_t layerIsV, Int_t strip, Int_t adc ){
317 Int_t index = strip + kEEmcNumStrips*( layerIsV + kEEmcNumSmdUVs*sec );
323 const EEmcDbItem *dbitem = mEEmcDb->getByStrip ( sec+1, (layerIsV ?
'V' :
'U'), strip+1 );
326 data.fail = dbitem->fail;
327 data.stat = dbitem->stat;
328 data.ped = dbitem->ped;
329 data.pedSigma = dbitem->sigPed;
330 data.gain = dbitem->gain;
virtual void Clear(Option_t *opt="")
User defined functions.
int getAdc() const
Return ADC value.
virtual void ls(Option_t *option="") const
static StMuEmcCollection * muEmcCollection()
returns pointer to current StMuEmcCollection
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)