CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Private Attributes

TrackerMap Class Reference

#include <TrackerMap.h>

Inheritance diagram for TrackerMap:
SiPixelTrackerMap

List of all members.

Public Types

typedef std::multimap< TmCcu
*, TmModule * > 
FecModule
typedef std::map< const int,
TmModule * > 
ImoduleMap
typedef std::map< const int,
TmCcu * > 
MapCcu
typedef std::map< const int,
TmPsu * > 
MapPsu
typedef std::multimap< const
int, TmApvPair * > 
ModApvPair
typedef std::multimap< TmPsu
*, TmModule * > 
PsuModule
typedef std::map< const int,
TmModule * > 
SmoduleMap
typedef std::map< const int,
TmApvPair * > 
SvgApvPair
typedef std::map< const int, int > SvgFed

Public Member Functions

void addPixel (bool addPixelfl)
void build ()
void defcwindow (int num_crate)
void deffecwindow (int num_crate)
void defpsuwindow (int num_rack)
void defwindow (int num_lay)
void drawApvPair (int crate, int numfed_incrate, bool total, TmApvPair *apvPair, std::ofstream *file, bool useApvPairValue)
void drawCcu (int crate, int numfed_incrate, bool total, TmCcu *ccu, std::ofstream *file, bool useCcuValue)
void drawHV2 (int rack, int numcrate_inrack, bool print_total, TmPsu *psu, ofstream *svgfile, bool usePsuValue)
void drawHV3 (int rack, int numcrate_inrack, bool print_total, TmPsu *psu, ofstream *svgfile, bool usePsuValue)
void drawModule (TmModule *mod, int key, int layer, bool total, std::ofstream *file)
void drawPalette (std::ofstream *file)
void drawPsu (int rack, int numcrate_inrack, bool print_total, TmPsu *psu, ofstream *svgfile, bool usePsuValue)
void fill (int layer, int ring, int nmod, float x)
void fill (int idmod, float qty)
void fill_all_blank ()
void fill_current_val (int idmod, float current_val)
void fill_current_val_fed_channel (int fedId, int fedCh, float current_val)
void fill_fec_channel (int crate, int slot, int ring, int addr, float qty)
void fill_fed_channel (int modId, float qty)
void fill_fed_channel (int fedId, int fedCh, float qty)
void fill_hv_channel2 (int rack, int crate, int board, float qty)
void fill_hv_channel3 (int rack, int crate, int board, float qty)
void fill_lv_channel (int rack, int crate, int board, float qty)
void fillc (int idmod, int RGBcode)
void fillc (int idmod, int red, int green, int blue)
void fillc (int layer, int ring, int nmod, int red, int green, int blue)
void fillc_all_blank ()
void fillc_fec_channel (int crate, int slot, int ring, int addr, int red, int green, int blue)
void fillc_fed_channel (int fedId, int fedCh, int red, int green, int blue)
void fillc_hv_channel2 (int rack, int crate, int board, int red, int green, int blue)
void fillc_hv_channel3 (int rack, int crate, int board, int red, int green, int blue)
void fillc_lv_channel (int rack, int crate, int board, int red, int green, int blue)
int find_layer (int ix, int iy)
std::ifstream * findfile (std::string filename)
int getcolor (float value, int palette)
int getlayerCount (int subdet, int partdet)
int getmoduleCount (int subdet, int partdet, int layer, int ring)
int getNumMod ()
int getringCount (int subdet, int partdet, int layer)
int getxsize ()
int getysize ()
void init ()
std::string layername (int layer)
void load (std::string s="tmap.svg")
int module (int fedId, int fedCh)
int nlayer (int det, int part, int lay)
double phival (double x, double y)
void print (bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap")
void printall (bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap")
void printlayers (bool print_total=true, float minval=0., float maxval=0., std::string s="layer")
void printonline ()
void reset ()
void save (bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
void save_as_fectrackermap (bool print_total=true, float minval=0., float maxval=0., std::string s="fec_svgmap.svg", int width=1500, int height=800)
void save_as_fedtrackermap (bool print_total=true, float minval=0., float maxval=0., std::string s="fed_svgmap.svg", int width=1500, int height=800)
void save_as_HVtrackermap (bool print_total=true, float minval=0., float maxval=0., std::string s="psu_svgmap.svg", int width=1500, int height=800)
void save_as_psutrackermap (bool print_total=true, float minval=0., float maxval=0., std::string s="psu_svgmap.svg", int width=1500, int height=800)
void setPalette (int numpalette)
void setRange (float min, float max)
void setText (int layer, int ring, int nmod, std::string s)
void setText (int idmod, std::string s)
void setTitle (std::string s)
void showPalette (bool printflag1)
 TrackerMap (const edm::ParameterSet &iConfig)
 TrackerMap (const edm::ParameterSet &iConfig, const edm::ESHandle< SiStripFedCabling > tkFed)
 TrackerMap (std::string s=" ", int xsize1=340, int ysize1=200)
double xdpixel (double x)
double xdpixelc (double x)
double xdpixelfec (double x)
double xdpixelpsu (double x)
double ydpixel (double y)
double ydpixelc (double y)
double ydpixelfec (double y)
double ydpixelpsu (double y)
 ~TrackerMap ()
 default destructor

Static Public Member Functions

static bool isRingStereo (int key)
static int layerno (int subdet, int leftright, int layer)

Public Attributes

SvgApvPair apvMap
ModApvPair apvModuleMap
MapCcu ccuMap
bool enableFecProcessing
bool enableFedProcessing
bool enableHVProcessing
bool enableLVProcessing
FecModule fecModuleMap
SvgFed fedMap
int firstRing [43]
ImoduleMap imoduleMap
std::string infilename
std::string jsfilename
std::string jsPath
int ndet
int npart
int ntotRing [43]
int palette
bool printflag
bool psetAvailable
MapPsu psuMap
PsuModule psuModuleMap
SmoduleMap smoduleMap
std::string title
std::vector< TColor * > vc

Protected Attributes

std::ifstream * ccufile
bool firstcall
float gmaxvalue
float gminvalue
std::ifstream * inputfile
int ix
int iy
std::ifstream * jsfile
float maxvalue
float minvalue
int ncrate
int ncrates
int nfeccrates
int nlay
int npsuracks
int nrack
int number_modules
bool posrel
std::ofstream * savefile
std::ofstream * svgfile
bool temporary_file
double xmax
double xmin
int xsize
double ymax
double ymin
int ysize

Private Attributes

bool addPixelFlag
float oldz
bool saveAsSingleLayer

Detailed Description

Definition at line 20 of file TrackerMap.h.


Member Typedef Documentation

typedef std::multimap<TmCcu* , TmModule*> TrackerMap::FecModule

Definition at line 94 of file TrackerMap.h.

typedef std::map<const int , TmModule *> TrackerMap::ImoduleMap

Definition at line 84 of file TrackerMap.h.

typedef std::map<const int , TmCcu*> TrackerMap::MapCcu

Definition at line 92 of file TrackerMap.h.

typedef std::map<const int , TmPsu*> TrackerMap::MapPsu

Definition at line 96 of file TrackerMap.h.

typedef std::multimap<const int , TmApvPair*> TrackerMap::ModApvPair

Definition at line 88 of file TrackerMap.h.

typedef std::multimap<TmPsu* , TmModule*> TrackerMap::PsuModule

Definition at line 98 of file TrackerMap.h.

typedef std::map<const int , TmModule *> TrackerMap::SmoduleMap

Definition at line 82 of file TrackerMap.h.

typedef std::map<const int , TmApvPair*> TrackerMap::SvgApvPair

Definition at line 86 of file TrackerMap.h.

typedef std::map<const int , int> TrackerMap::SvgFed

Definition at line 90 of file TrackerMap.h.


Constructor & Destructor Documentation

TrackerMap::TrackerMap ( std::string  s = " ",
int  xsize1 = 340,
int  ysize1 = 200 
)

Definition at line 379 of file TrackerMap.cc.

References enableFedProcessing, infilename, init(), jsfilename, psetAvailable, alignCSCRings::s, saveAsSingleLayer, title, xsize, and ysize.

                                                        {
 psetAvailable=false;
  xsize=xsize1;ysize=ysize1;
  title=s;
  jsfilename="CommonTools/TrackerMap/data/trackermap.txt";
  infilename="CommonTools/TrackerMap/data/tracker.dat";
  enableFedProcessing=false; 
  saveAsSingleLayer=false;
 init();
}
TrackerMap::TrackerMap ( const edm::ParameterSet iConfig)

Definition at line 362 of file TrackerMap.cc.

References gather_cfg::cout, enableFedProcessing, edm::ParameterSet::exists(), edm::ParameterSet::getUntrackedParameter(), infilename, init(), jsfilename, ncrates, psetAvailable, saveAsSingleLayer, title, xsize, and ysize.

                                                        {
 psetAvailable=true;
  xsize=340;ysize=200;
  title=" ";
  jsfilename="CommonTools/TrackerMap/data/trackermap.txt";
  infilename="CommonTools/TrackerMap/data/tracker.dat";
  enableFedProcessing=true;ncrates=0;
  saveAsSingleLayer=false;
  if(tkmapPset.exists("trackermaptxtPath")){
  jsfilename=tkmapPset.getUntrackedParameter<std::string>("trackermaptxtPath","")+"trackermap.txt";
  std::cout << jsfilename << std::endl;
  infilename=tkmapPset.getUntrackedParameter<std::string>("trackerdatPath","")+"tracker.dat";
  std::cout << infilename << std::endl;
  } else std::cout << "no parameters found" << std::endl;
 init();
}
TrackerMap::TrackerMap ( const edm::ParameterSet iConfig,
const edm::ESHandle< SiStripFedCabling tkFed 
)

Definition at line 30 of file TrackerMap.cc.

References apvMap, apvModuleMap, dataDML::branchinfo, TmModule::capvids, TmModule::CcuId, ccuMap, TmCcu::cmodid, TmPsu::cmodid_HV2, TmPsu::cmodid_HV3, TmPsu::cmodid_LV, gather_cfg::cout, TmApvPair::crate, SiStripFecCabling::crates(), enableFecProcessing, enableFedProcessing, enableHVProcessing, enableLVProcessing, edm::ParameterSet::exists(), fecModuleMap, fedMap, TmCcu::getCcuCrate(), TmCcu::getCcuRing(), TmCcu::getCcuSlot(), TmApvPair::getFedCh(), TmApvPair::getFedId(), TmPsu::getPsuBoard(), TmPsu::getPsuBranch(), TmPsu::getPsuCrate(), TmPsu::getPsuDcs(), TmPsu::getPsuRack(), edm::ParameterSet::getUntrackedParameter(), TmPsu::idex, TmModule::idex, TmApvPair::idex, TmCcu::idex, imoduleMap, recoMuon::in, infilename, init(), sistrip::invalid32_, sistrip::invalid_, jsfilename, jsPath, combine::key, TmModule::layer, TmCcu::layer, mod(), TmApvPair::mod, TmApvPair::mpos, TmCcu::mpos, TmModule::name, nchan, ncrates, nfeccrates, TmPsu::nmod, TmCcu::nmod, TmPsu::nmodHV2, TmPsu::nmodHV3, npsuracks, pos, psetAvailable, TmPsu::psId, TmModule::PsuId, TmModule::psuIdex, psuMap, psuModuleMap, run_regression::ret, relativeConstraints::ring, alignCSCRings::s, saveAsSingleLayer, TmApvPair::text, TmPsu::text, TmCcu::text, TmPsu::textHV2, TmPsu::textHV3, title, xsize, and ysize.

                                                                                                   {

 psetAvailable=true;
  xsize=340;ysize=200;
  title=" ";
  jsPath="";
  jsfilename="CommonTools/TrackerMap/data/trackermap.txt";
  infilename="CommonTools/TrackerMap/data/tracker.dat";
  saveAsSingleLayer=false;
  if(tkmapPset.exists("trackermaptxtPath")){
  jsPath=tkmapPset.getUntrackedParameter<std::string>("trackermaptxtPath",""
);
  jsfilename=jsPath+"trackermap.txt";
  std::cout << jsfilename << std::endl;
  infilename=tkmapPset.getUntrackedParameter<std::string>("trackerdatPath","")+"tracker.dat";
  std::cout << infilename << std::endl;
  ncrates=0;
  enableFedProcessing=tkmapPset.getUntrackedParameter<bool>("loadFedCabling",false);
  nfeccrates=0;
  enableFecProcessing=tkmapPset.getUntrackedParameter<bool>("loadFecCabling",false);
 // std::cout << "loadFecCabling " << enableFecProcessing << std::endl;
  npsuracks=0;
  enableLVProcessing=tkmapPset.getUntrackedParameter<bool>("loadLVCabling",false);
 // std::cout << "loadLVCabling " << enableLVProcessing << std::endl;
  enableHVProcessing=tkmapPset.getUntrackedParameter<bool>("loadHVCabling",false);
 // std::cout << "loadHVCabling " << enableHVProcessing << std::endl;
  } else std::cout << "no parameters found" << std::endl;

 init();
// Now load fed cabling information
 if(enableFedProcessing){
 const std::vector<unsigned short> feds = tkFed->feds();
  std::cout<<"SiStripFedCabling has "<< feds.size()<<" active FEDS"<<std::endl;
    int num_board=0;
    int num_crate=0;
  for(std::vector<unsigned short>::const_iterator ifed = feds.begin();ifed<feds.end();ifed++){
    const std::vector<FedChannelConnection> theconn = tkFed->connections( *ifed );
    int num_conn=0;
    for(std::vector<FedChannelConnection>::const_iterator iconn = theconn.begin();iconn<theconn.end();iconn++){

      if( iconn->fedId()== sistrip::invalid_    ||  
          iconn->detId() == sistrip::invalid_   ||  
          iconn->detId() == sistrip::invalid32_ ||  
          iconn->apvPairNumber() == sistrip::invalid_  ||
          iconn->nApvPairs() == sistrip::invalid_ ) {
        continue;
      }
        
      TmModule *imod = imoduleMap[iconn->detId()];
      int key = iconn->fedId()*1000+iconn->fedCh();
      TmApvPair* apvpair = apvMap[key];
      if(apvpair!=0)std::cout << "Fed "<< iconn->fedId() << " channel " << iconn->fedCh() << " seem to be already loaded!"<<std::endl;
      else
        {
          num_conn++;
          if(num_conn==1){
            if(fedMap[iconn->fedId()]==0){num_crate=num_board/18+1;fedMap[iconn->fedId()]=num_crate;num_board++;}
          }
          apvpair = new TmApvPair(key,num_crate);
          apvpair->mod=imod;
          apvpair->mpos=iconn->apvPairNumber();
          apvMap[key] = apvpair;        
          apvModuleMap.insert(std::make_pair(iconn->detId(),apvpair));
          std::stringstream s;
          iconn->print(s);  
          apvpair->text=s.str();
        }
    }
  }
  ncrates=num_crate;
  std::cout << num_crate << " crates used "<< std::endl;
//Now add APv information to module name
    std::map<int , TmModule *>::iterator i_mod;
    for( i_mod=imoduleMap.begin();i_mod !=imoduleMap.end(); i_mod++){
      TmModule *  mod= i_mod->second;
      if(mod!=0) {
        std::ostringstream outs,outs1;
       outs << " connected to ";
       outs1 << "(";

      int idmod=mod->idex;
       int nchan=0;
       std::multimap<const int, TmApvPair*>::iterator pos;
       for (pos = apvModuleMap.lower_bound(idmod);
         pos != apvModuleMap.upper_bound(idmod); ++pos) {
       TmApvPair* apvpair = pos->second;
       if(apvpair!=0){
       outs << apvpair->mpos << " " <<apvpair->getFedId() << "/"<<apvpair->getFedCh()<<" ";
       outs1 << apvpair->idex+apvpair->crate*1000000<<",";
      nchan++;
    }

  }
       outs<< "("<<nchan<<")";
      mod->name=mod->name + outs.str(); 
      std::string s = outs1.str(); s.erase(s.end()-1,s.end());
      mod->capvids=s+")";
  }
  }
}
// Now load fec cabling information
 if(enableFecProcessing){
   int nfec=0; int nccu; int nmod;
   int crate,slot,ring,addr,pos;
   SiStripFecCabling* fecCabling_;
   fecCabling_ = new SiStripFecCabling( *tkFed );
   std::string Ccufilename=tkmapPset.getUntrackedParameter<std::string>("trackerdatPath","")+"cculist.txt";
   ifstream Ccufile(edm::FileInPath(Ccufilename).fullPath().c_str(),std::ios::in);
   std::string dummys;
   while(!Ccufile.eof()) {
     Ccufile >> crate >> slot >> ring >> addr >> pos;
     getline(Ccufile,dummys);
     int key =crate*10000000+slot*100000+ring*1000+addr;
     TmCcu * ccu = ccuMap[key];
     if(ccu==0){
       ccu = new TmCcu(crate,slot,ring,addr);
       ccu->mpos=pos,
         ccuMap[key]=ccu;
     }
   }

   for ( std::vector<SiStripFecCrate>::const_iterator icrate = fecCabling_->crates().begin(); icrate != fecCabling_->crates().end(); icrate++ ) {
     for ( std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++ ) {
       for ( std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end(); iring++ ) {
         nccu=0;nfec++;
         for ( std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end(); iccu++ ) {
           nccu++; nmod=0;
           int key = icrate->fecCrate()*10000000+ifec->fecSlot()*100000+iring->fecRing()*1000+iccu->ccuAddr();
           int layer=0;
           TmCcu * ccu = ccuMap[key];
           for ( std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end(); imod++ ) {
             nmod++;
             TmModule *imod1 = imoduleMap[imod->detId()];
             layer=imod1->layer;
             fecModuleMap.insert(std::make_pair(ccu,imod1));
             if(imod1!=0)imod1->CcuId=key;//imod1->ccuId=key+Crate*1000000
           }
           if(ccu==0)std::cout <<key<< " This ccu seems to have not been stored! " << std::endl; else{ ccu->nmod=nmod;ccu->layer=layer;}
           //std::cout <<nfec<<" "<< nccu << " " << nmod << std::endl;

         }
       }
     }
   }

   std::map<int , TmCcu *>::iterator i_ccu;
   std::multimap<TmCcu*, TmModule*>::iterator it;
   std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator> ret;
   nccu=0;
   for( i_ccu=ccuMap.begin();i_ccu !=ccuMap.end(); i_ccu++){
     TmCcu *  ccu= i_ccu->second;
     nccu++;
     if(ccu!=0){
       std::ostringstream outs;
       std::ostringstream outs1;
       outs << "CCU "<<ccu->idex <<" connected to fec,ring " << ccu->getCcuSlot() <<","<<ccu->getCcuRing()<< " in crate " <<ccu->getCcuCrate()<<" at position "<< ccu->mpos << " with  " << ccu->nmod << " modules: ";
        outs1<<"(";
        ret = fecModuleMap.equal_range(ccu);
        for (it = ret.first; it != ret.second; ++it)
          {
            outs << (*it).second->idex << " ";
            outs1 << (*it).second->getKey() <<",";
          }
        outs1 << ")";
        ccu->text=outs.str();
        ccu->cmodid=outs1.str();
        //std::cout << ccu->text << std::endl;
     }

   }
   nfeccrates=4;
   std::cout << nccu << " ccu stored in " <<nfeccrates<< " crates"<< std::endl;

   delete fecCabling_ ;

 }
//load Psu cabling info
 //load Psu cabling info 
 if(enableLVProcessing || enableHVProcessing){
   int npsu=0; int nmod,nmodHV2,nmodHV3;
   int modId1,modId2, dcuId;
   int dcs,branch,crate,board;
   int rack=0;
   std::string channelstr1;
   short int channel;
   std::string psinfo;
 //  ifstream *LVfile;
 //  ifstream *HVfile;
   
  
 
  std::string LVfilename=tkmapPset.getUntrackedParameter<std::string>("trackerdatPath","")+"psdcumap.dat";
  std::string HVfilename=tkmapPset.getUntrackedParameter<std::string>("trackerdatPath","")+"hvmap.dat";
  
  ifstream LVfile(edm::FileInPath(LVfilename).fullPath().c_str(),std::ios::in);
  
  std::cout<<LVfilename<<" "<<HVfilename<<std::endl;
  
  
   if(enableHVProcessing){
           
            ifstream HVfile(edm::FileInPath(HVfilename).fullPath().c_str(),std::ios::in);
            while(!HVfile.eof()) {
            HVfile >> modId2 >> channelstr1;
            std::string channelstr2 = channelstr1.substr(9,1);
            channel= atoi(channelstr2.c_str());
            TmModule *imod = imoduleMap[modId2];
           // if(modId1==modId2){
            imod->HVchannel=channel;      
           
              } 
                
            }
        
  
   while(!LVfile.eof()) {
      LVfile >> modId1 >> dcuId >>  psinfo;
      
      int length=psinfo.length();
      std::string dcsinfo = psinfo.substr(39,1);
      std::string branchinfo = psinfo.substr(57,2);
      std::string crateinfo= psinfo.substr(69,1);
      std::string boardinfo = psinfo.substr(80,2);
      std::string psIdinfo = psinfo.substr(83,length-83);
    
      dcs= atoi(dcsinfo.c_str());
      branch= atoi(branchinfo.c_str());
      crate= atoi(crateinfo.c_str())+1;
      board= atoi(boardinfo.c_str())+1;
   
      if(dcs==1)rack=(branch+1)/2;
      if(dcs==2)rack=(branch+1)/2 + 7;
      if(dcs==3)rack=(branch+1)/2 + 15;
      if(dcs==4)rack=(branch+1)/2 + 22;
      
      int key = rack*1000+crate*100+board;
      
      TmPsu *psu = psuMap[key];
      TmModule *imod = imoduleMap[modId1];
      if(psu==0){
        psu = new TmPsu(dcs,branch,rack,crate,board);
        psuMap[key]=psu;
        psu->psId=psIdinfo;
      }
   
      psuModuleMap.insert(std::make_pair(psu,imod));
      if(imod!=0)imod->PsuId=psIdinfo;imod->psuIdex=psu->idex;
       
      }
      
   
 //  int nmax=0; 
   std::map<int , TmPsu *>::iterator ipsu;
   std::multimap<TmPsu*, TmModule*>::iterator it;
   std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator> ret;
   npsu=0;
  
   for( ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
     TmPsu *  psu= ipsu->second;
     npsu++;
    
    if(psu!=0){
        
      std::ostringstream outs;
      std::ostringstream outs1;
        
      std::ostringstream outs3;
      std::ostringstream outs4;
        
      std::ostringstream outs5;
      std::ostringstream outs6;
        
        outs <<"PSU "<<psu->psId<<" connected to Mainframe "<<psu->getPsuDcs()<<" BranchController "<<psu->getPsuBranch()<<" (Rack "<<psu->getPsuRack()<<"), crate "<<psu->getPsuCrate()<<" in position "<< psu->getPsuBoard()<< " with modules: ";
        outs1<<"(";
        
        if(enableHVProcessing){
          outs3 <<"PSU "<<psu->psId<<" connected to Mainframe "<<psu->getPsuDcs()<<" BranchController "<<psu->getPsuBranch()<<" (Rack "<<psu->getPsuRack()<<"),crate "<<psu->getPsuCrate()<<" in position "<< psu->getPsuBoard()<<" and HV channel 002 with modules: ";
          outs4<<"(";
        
          outs5 <<"PSU "<<psu->psId<<" connected to Mainframe "<<psu->getPsuDcs()<<" BranchController "<<psu->getPsuBranch()<<" (Rack "<<psu->getPsuRack()<<"), crate "<<psu->getPsuCrate()<<" in position "<< psu->getPsuBoard()<<" and HV channel 002 with modules: ";
          outs6<<"(";}
        
        
        ret = psuModuleMap.equal_range(psu);
        nmod=0;
        nmodHV2=0;
        nmodHV3=0;
        for (it = ret.first; it != ret.second; ++it)
          {
            nmod++; 
            outs << (*it).second->idex << ", ";
            outs1 << (*it).second->getKey() <<",";
        
            if(enableHVProcessing){
              if((*it).second->HVchannel==2){
              nmodHV2++;
              outs3 << (*it).second->idex << ", ";
              outs4 << (*it).second->getKey() <<",";}
              else if((*it).second->HVchannel==3){
              nmodHV3++;
              outs5 << (*it).second->idex << ", ";
              outs6 << (*it).second->getKey() <<",";}
        
              }
          }

        outs1 << ")";
        psu->nmod=nmod;
        outs << "(" << psu->nmod << ")";
        psu->text=outs.str();
        psu->cmodid_LV=outs1.str();
        if(enableHVProcessing){
        outs4 << ")";
        outs6 << ")";
        psu->nmodHV2=nmodHV2;
        psu->nmodHV3=nmodHV3;
        outs3 << "(" << psu->nmodHV2 << ")";
        outs5 << "(" << psu->nmodHV3 << ")";
        psu->textHV2=outs3.str();
        psu->textHV3=outs5.str();
        psu->cmodid_HV2=outs4.str();
        psu->cmodid_HV3=outs6.str();
        }
    }
   }
  
  
   npsuracks=29;
   std::cout << npsu << " psu stored in " <<npsuracks<<" racks"<<std::endl;
  }
}
TrackerMap::~TrackerMap ( )

default destructor

Definition at line 448 of file TrackerMap.cc.

References apvMap, ccuMap, firstRing, combine::key, mod(), module(), ntotRing, psuMap, relativeConstraints::ring, and smoduleMap.

                        {
 
for (int layer=1; layer < 44; layer++){
    for (int ring=firstRing[layer-1]; ring < ntotRing[layer-1]+firstRing[layer-1];ring++){
      for (int module=1;module<200;module++) {
        int key=layer*100000+ring*1000+module;
        TmModule * mod = smoduleMap[key];
        if(mod !=0 ) delete mod;
      }
    }
  }

//std::map<int , TmModule *>::iterator i_mod;
//   for( i_mod=imoduleMap.begin();i_mod !=imoduleMap.end(); i_mod++){
//      TmModule *  mod= i_mod->second;
//      delete mod;
//      }
std::map<int , TmApvPair *>::iterator i_apv;
  for( i_apv=apvMap.begin();i_apv !=apvMap.end(); i_apv++){
      TmApvPair *  apvPair= i_apv->second;
      delete apvPair;
      }


std::map<int , TmCcu *>::iterator i_ccu;
   for( i_ccu=ccuMap.begin();i_ccu !=ccuMap.end(); i_ccu++){
     TmCcu *  ccu= i_ccu->second;
     delete ccu;
     }

std::map<int , TmPsu *>::iterator ipsu;
    for( ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
     TmPsu *  psu= ipsu->second;
     delete psu;
     }

gROOT->Reset();


//for(std::vector<TColor*>::iterator col1=vc.begin();col1!=vc.end();col1++){
//     std::cout<<(*col1)<<std::endl;}
}

Member Function Documentation

void TrackerMap::addPixel ( bool  addPixelfl) [inline]

Definition at line 73 of file TrackerMap.h.

References addPixelFlag.

{addPixelFlag=addPixelfl;};
void TrackerMap::build ( )

Definition at line 2580 of file TrackerMap.cc.

References TmModule::count, gather_cfg::cout, TmModule::idex, imoduleMap, recoMuon::in, EdgesToViz::infile, infilename, combine::key, TmModule::length, mod(), TmModule::name, mergeVDriftHistosByStation::name, number_modules, TmModule::posx, TmModule::posy, TmModule::posz, relativeConstraints::ring, TmModule::setUsed(), smoduleMap, TmModule::thickness, TmModule::value, tablePrinter::width, TmModule::width, and TmModule::widthAtHalfLength.

Referenced by init().

                      {
  //  ifstream* infile;

  int nmods, pix_sil, fow_bar, ring, nmod, layer;
  unsigned int idex;
  float posx, posy, posz, length, width, thickness, widthAtHalfLength;
  int iModule=0,old_layer=0, ntotMod =0;
  std::string name,dummys;
  ifstream infile(edm::FileInPath(infilename).fullPath().c_str(),std::ios::in);
  while(!infile.eof()) {
    infile >> nmods >> pix_sil >> fow_bar >> layer >> ring >> nmod >> posx >> posy
           >> posz>> length >> width >> thickness
           >> widthAtHalfLength >> idex ;
    getline(infile,dummys); //necessary to reach end of record
    getline(infile,name); 
    if(old_layer!=layer){old_layer=layer;iModule=0;}
    iModule++;
    ntotMod++;
    int key=layer*100000+ring*1000+nmod;
    TmModule * mod = smoduleMap[key];
    
    imoduleMap[idex]=mod;

    if(mod==0) std::cout << "error in module "<<key <<std::endl;
    else
      {
          mod->posx = posx;
          mod->posy = posy;
          mod->setUsed();
          mod->value=0;
          mod->count=0;
          mod->posz = posz;
          mod->length = length;
          mod->width = width;
          mod->thickness = thickness;
          mod->widthAtHalfLength = widthAtHalfLength;
          mod->idex = idex;
          mod->name = name;
      }
  }
  infile.close();
  number_modules = ntotMod-1;
}
void TrackerMap::defcwindow ( int  num_crate) [inline]

Definition at line 237 of file TrackerMap.h.

References ix, iy, ncrate, xmax, xmin, xsize, ymax, ymin, and ysize.

Referenced by save_as_fedtrackermap().

                                 {
    ncrate = num_crate;
    int xoffset=xsize/3;
    int yoffset=ysize;
    xmin=-1.;xmax=63.;  ymin = -1.; ymax=37.;
    if((ncrate%3)==2)ix = xoffset+xsize*4/3;
    if((ncrate%3)==1)ix = xoffset+2*xsize*4/3;
    if((ncrate%3)==0)ix = xoffset;
    iy = yoffset+((ncrate-1)/3)*ysize*2;
  } 
void TrackerMap::deffecwindow ( int  num_crate) [inline]

Definition at line 247 of file TrackerMap.h.

References ix, iy, ncrate, xmax, xmin, xsize, ymax, ymin, and ysize.

Referenced by save_as_fectrackermap().

                                   {
    ncrate = num_crate;
    int xoffset=xsize/3;
    int yoffset=2*ysize;
    xmin=-1.;xmax=37.;  ymin = -10.; ymax=40.;
    if(ncrate==1||ncrate==3)ix = xoffset+xsize*2;
    if(ncrate==2||ncrate==4)ix = xoffset;
    iy = yoffset+((ncrate-1)/2)*ysize*4;
  }
void TrackerMap::defpsuwindow ( int  num_rack) [inline]

Definition at line 256 of file TrackerMap.h.

References ix, iy, nrack, xmax, xmin, xsize, ymax, ymin, and ysize.

Referenced by save_as_HVtrackermap(), and save_as_psutrackermap().

                                  {
    nrack = num_rack;
    int xoffset=xsize/5;
    int yoffset=ysize;
    xmin=-1.;xmax=63.;  ymin = -1.; ymax=37.;

    if((nrack%5)==1)ix = xoffset+4*int(xsize/1.5);
    if((nrack%5)==2)ix = xoffset+3*int(xsize/1.5);
    if((nrack%5)==3)ix = xoffset+2*int(xsize/1.5);
    if((nrack%5)==4)ix = xoffset+int(xsize/1.5);
    if((nrack%5)==0)ix = xoffset;

    iy = yoffset+((nrack-1)/5)*ysize*2;

    }
void TrackerMap::defwindow ( int  num_lay) [inline]

Definition at line 273 of file TrackerMap.h.

References ix, iy, nlay, posrel, xmax, xmin, xsize, ymax, ymin, and ysize.

Referenced by print(), printlayers(), and save().

                           {
  nlay = num_lay;
  if(posrel){ // separated modules
    xmin=-2.;ymin=-2.;xmax=2.;ymax=2.;
    if(nlay >12 && nlay < 19){
      xmin=-.40;xmax=.40;ymin=-.40;ymax=.40;
    }
    if(nlay>30){
      xmin=-0.1;xmax=3.;ymin=-0.1;ymax=8.5;
      if(nlay<34){xmin=-0.3;xmax=1.0;}
      if(nlay>33&&nlay<38){xmax=2.0;}
      if(nlay>37){ymax=8.;}//inner
    }
  }else{ //overlayed modules
    xmin=-1.3;ymin=-1.3;xmax=1.3;ymax=1.3;
    if(nlay >12 && nlay < 19){
      xmin=-.20;xmax=.20;ymin=-.20;ymax=.20;
    }
    if(nlay>30){
      xmin=-1.5;xmax=1.5;ymin=-1.;ymax=28.;
      if(nlay<34){xmin=-0.5;xmax=0.5;}
      if(nlay>33&&nlay<38){xmin=-1.;xmax=1.;}
    }
    
  }
  if(nlay<16){
      ix=0;
      if(nlay==15||nlay==14)iy=(15-nlay)*2*ysize; else 
          {if(nlay>9&&nlay<13)iy=4*ysize-(int)(ysize/2.)+(12-nlay)*(int)(ysize/1.50);else iy=6*ysize+(9-nlay)*(int)(ysize*1.3);}}
  if(nlay>15&&nlay<31){
    ix=3*xsize;
     if(nlay==16||nlay==17)iy=(nlay-16)*2*ysize; else 
          {if(nlay>18&&nlay<22)iy=4*ysize-(int)(ysize/2.)+(nlay-19)*(int)(ysize/1.50);else iy=6*ysize+(nlay-22)*(int)(ysize*1.3);}}
  if(nlay>30){
    if(nlay==31){ix=(int)(1.5*xsize);iy=0;}
    if(nlay==32){int il=(nlay-30)/2;ix=xsize;iy=il*2*ysize;}
    if(nlay==33){int il=(nlay-30)/2;ix=2*xsize;iy=il*2*ysize;}
    if(nlay==34){int il=(nlay-30)/2;ix=xsize;iy=il*(int)(2.57*ysize);}
    if(nlay>34 && nlay%2==0){int il=(nlay-30)/2;ix=xsize;iy=il*(int)(2.5*ysize);}
    if(nlay>34 && nlay%2!=0){int il=(nlay-30)/2;ix=2*xsize;iy=il*(int)(2.5*ysize);}
  }
 }
void TrackerMap::drawApvPair ( int  crate,
int  numfed_incrate,
bool  total,
TmApvPair apvPair,
std::ofstream *  file,
bool  useApvPairValue 
)

Definition at line 847 of file TrackerMap.cc.

References TmModule::blue, TmApvPair::blue, TmModule::count, TmApvPair::count, getcolor(), TmApvPair::getFedCh(), TmApvPair::getFedId(), TmModule::getKey(), cmsRelvalreport::green(), TmApvPair::green, TmModule::green, TmModule::idex, TmApvPair::idex, j, gen::k, TmApvPair::mod, TmModule::name, np, palette, TmApvPair::red, TmModule::red, cmsRelvalreport::red(), alignCSCRings::s, temporary_file, TmApvPair::value, TmModule::value, xdpixelc(), and ydpixelc().

Referenced by save_as_fedtrackermap().

{
  double xp[4],yp[4];
  int color;
  int green = 0;
  int red = 0;
  int blue = 0;
  double xd[4],yd[4];
  int np = 4;
  double boxinitx=0., boxinity=0.; 
  double dx=.9,dy=.9;
  int numfedch_incolumn = 12;
  int numfedch_inrow = 8;
  int numfed_incolumn = 5;
  int numfed_inrow = 4;
  boxinitx=boxinitx+(numfed_incolumn-(numfed_incrate-1)/numfed_inrow)*14.;
  boxinity=boxinity+(numfed_inrow-(numfed_incrate-1)%numfed_inrow)*9.;
  boxinity=boxinity+numfedch_inrow-(apvPair->getFedCh()/numfedch_incolumn);
  boxinitx = boxinitx+numfedch_incolumn-(int)(apvPair->getFedCh()%numfedch_incolumn);
  //std::cout << crate << " " << numfed_incrate << " " << apvPair->getFedCh()<<" "<<boxinitx<< " " << boxinity << std::endl; ;
  xp[0]=boxinitx;yp[0]=boxinity;
  xp[1]=boxinitx+dx;yp[1]=boxinity;
  xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
  xp[3]=boxinitx;yp[3]=boxinity + dy;
  for(int j=0;j<4;j++){
    xd[j]=xdpixelc(xp[j]);yd[j]=ydpixelc(yp[j]);
    //std::cout << boxinity << " "<< ymax << " "<< yp[j] << std::endl;
  }
  
  char buffer [20];
  sprintf(buffer,"%X",apvPair->mod->idex);
  std::string s = apvPair->mod->name;
  s.erase(s.begin()+s.find("connected"),s.end());

  if(useApvPairValue){ 
    if(apvPair->red < 0){ //use count to compute color
      if(apvPair->count > 0) {
        color = getcolor(apvPair->value,palette);
        red=(color>>16)&0xFF;
        green=(color>>8)&0xFF;
        blue=(color)&0xFF;
        if(!print_total)apvPair->value=apvPair->value*apvPair->count;//restore mod->value
        if(temporary_file)*svgfile << red << " " << green << " " << blue << " ";
           else *svgfile <<"<svg:polygon detid=\""<<apvPair->idex<<"\" count=\""<<apvPair->count <<"\" value=\""<<apvPair->value<<"\" id=\""<<apvPair->idex+crate*1000000<<"\" cmodid=\""<<apvPair->mod->getKey()<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Fed/Ch "<<apvPair->getFedId()<<"/"<<apvPair->getFedCh()<<" connected to "<<s<<" Id "<<buffer<<" \" fill=\"rgb("<<red<<","<<green<<","<<blue<<")\" points=\"";
      } else {
        if(temporary_file)*svgfile << 255 << " " << 255 << " " << 255 << " ";
         else *svgfile <<"<svg:polygon detid=\""<<apvPair->idex<<"\" count=\""<<apvPair->count <<"\" value=\""<<apvPair->value<<"\" id=\""<<apvPair->idex+crate*1000000<<"\"  cmodid=\""<<apvPair->mod->getKey()<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Fed/Ch "<<apvPair->getFedId()<<"/"<<apvPair->getFedCh()<<" connected to "<<s<<" Id "<<buffer<<" \" fill=\"white\" points=\"";
      }
    } else {//color defined with fillc
      if(apvPair->red>255)apvPair->red=255;
      if(apvPair->green>255)apvPair->green=255;
      if(apvPair->blue>255)apvPair->blue=255;
      if(temporary_file)*svgfile << apvPair->red << " " << apvPair->green << " " << apvPair->blue << " ";
         else *svgfile <<"<svg:polygon detid=\""<<apvPair->idex<<"\" count=\""<<apvPair->count <<"\" value=\""<<apvPair->value<<"\" id=\""<<apvPair->idex+crate*1000000<<"\" cmodid=\""<<apvPair->mod->getKey()<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Fed/Ch "<<apvPair->getFedId()<<"/"<<apvPair->getFedCh()<<" connected to "<<s<<" Id "<<buffer<<" \" fill=\"rgb("<<apvPair->red<<","<<apvPair->green<<","<<apvPair->blue<<")\" points=\"";
    }
  }else{
    if(apvPair->mod->red < 0){ //use count to compute color
      if(apvPair->mod->count > 0) {
        color = getcolor(apvPair->mod->value,palette);
        red=(color>>16)&0xFF;
        green=(color>>8)&0xFF;
        blue=(color)&0xFF;
        if(temporary_file)*svgfile << red << " " << green << " " << blue << " ";
           else *svgfile <<"<svg:polygon detid=\""<<apvPair->idex<<"\" count=\""<<apvPair->count <<"\" value=\""<<apvPair->value<<"\" id=\""<<apvPair->idex+crate*1000000<<"\" cmodid=\""<<apvPair->mod->getKey()<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Fed/Ch "<<apvPair->getFedId()<<"/"<<apvPair->getFedCh()<<" connected to "<<s<<" Id "<<buffer<<" \" fill=\"rgb("<<red<<","<<green<<","<<blue<<")\" points=\"";
      } else {
        if(temporary_file)*svgfile << 255 << " " << 255 << " " << 255 << " ";
         else *svgfile <<"<svg:polygon detid=\""<<apvPair->idex<<"\" count=\""<<apvPair->count <<"\" value=\""<<apvPair->value<<"\" id=\""<<apvPair->idex+crate*1000000<<"\"  cmodid=\""<<apvPair->mod->getKey()<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Fed/Ch "<<apvPair->getFedId()<<"/"<<apvPair->getFedCh()<<" connected to "<<s<<" Id "<<buffer<<" \" fill=\"white\" points=\"";
      }
    } else {//color defined with fillc
      if(apvPair->mod->red>255)apvPair->mod->red=255;
      if(apvPair->mod->green>255)apvPair->mod->green=255;
      if(apvPair->mod->blue>255)apvPair->mod->blue=255;
      if(temporary_file)*svgfile << apvPair->mod->red << " " << apvPair->mod->green << " " << apvPair->mod->blue << " ";
         else *svgfile <<"<svg:polygon detid=\""<<apvPair->idex<<"\" count=\""<<apvPair->count <<"\" value=\""<<apvPair->value<<"\" id=\""<<apvPair->idex+crate*1000000<<"\" cmodid=\""<<apvPair->mod->getKey()<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Fed/Ch "<<apvPair->getFedId()<<"/"<<apvPair->getFedCh()<<" connected to "<<s<<" Id "<<buffer<<" \" fill=\"rgb("<<apvPair->mod->red<<","<<apvPair->mod->green<<","<<apvPair->mod->blue<<")\" points=\"";
    }
  }
  if(temporary_file)*svgfile << np << " ";
  for(int k=0;k<np;k++){
    if(temporary_file)*svgfile << xd[k] << " " << yd[k] << " " ; 
      else *svgfile << xd[k] << "," << yd[k] << " " ;
  }
  if(temporary_file)*svgfile << std::endl;
     else *svgfile <<"\" />" <<std::endl;
}
void TrackerMap::drawCcu ( int  crate,
int  numfed_incrate,
bool  total,
TmCcu ccu,
std::ofstream *  file,
bool  useCcuValue 
)

Definition at line 931 of file TrackerMap.cc.

References TmCcu::blue, TmCcu::cmodid, TmCcu::count, TmCcu::getCcuRing(), TmCcu::getCcuSlot(), getcolor(), cmsRelvalreport::green(), TmCcu::green, TmCcu::idex, j, gen::k, TmCcu::layer, TmCcu::mpos, np, palette, TmCcu::red, cmsRelvalreport::red(), alignCSCRings::s, temporary_file, TmCcu::text, TmCcu::value, xdpixelfec(), and ydpixelfec().

Referenced by save_as_fectrackermap().

{
  double xp[4],yp[4];
  int color;
  int green = 0;
  int red = 0;
  int blue = 0;
  double xd[4],yd[4];
  int np = 4;
  double boxinitx=0., boxinity=0.;
  double dx=.9,dy=.9;
  int numccu_incolumn = 8;
  int numccu_inrow = 15;
  int numfed_incolumn = 5;
  int numfed_inrow = 4;
  boxinitx=boxinitx+(numfed_incolumn-(numfec_incrate-1)/numfed_inrow)*14.;
  boxinity=boxinity+(numfed_inrow-(numfec_incrate-1)%numfed_inrow)*16.;
  boxinity=boxinity+numccu_inrow-ccu->mpos;
  boxinitx = boxinitx+numccu_incolumn-(int)(ccu->getCcuRing()%numccu_incolumn);
  //std::cout << crate << " " << numfec_incrate << " " << ccu->getCcuRing()<<" "<<ccu->mpos<<" "<<boxinitx<< " " << boxinity << std::endl; ;
  xp[0]=boxinitx;yp[0]=boxinity;
  xp[1]=boxinitx+dx;yp[1]=boxinity;
  xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
  xp[3]=boxinitx;yp[3]=boxinity + dy;
  for(int j=0;j<4;j++){
    xd[j]=xdpixelfec(xp[j]);yd[j]=ydpixelfec(yp[j]);
    //std::cout << boxinity << " "<< ymax << " "<< yp[j] << std::endl;
  }

  char buffer [20];
  sprintf(buffer,"%X",ccu->idex);
  //sprintf(buffer,"%X",ccu->mod->idex);
  //std::string s = ccu->mod->name;
  std::string s = ccu->text;
  s.erase(s.begin()+s.find("connected"),s.end());

  if(ccu->red < 0){ //use count to compute color
    if(ccu->count > 0) {
      color = getcolor(ccu->value,palette);
      red=(color>>16)&0xFF;
      green=(color>>8)&0xFF;
      blue=(color)&0xFF;
      if(!print_total)ccu->value=ccu->value*ccu->count;//restore mod->value
      if(temporary_file)*svgfile << red << " " << green << " " << blue << " ";
      else *svgfile <<"<svg:polygon detid=\""<<ccu->idex<<"\" count=\""<<ccu->count <<"\" value=\""<<ccu->value<<"\" id=\""<<ccu->idex+crate*1000000<<"\" cmodid=\""<<ccu->cmodid<<"\" layer=\""<<ccu->layer<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Slot/Ring"<<ccu->getCcuSlot()<<"/"<<ccu->getCcuRing()<<" connected to "<<s<<" Id "<<buffer<<" \" fill=\"rgb("<<red<<","<<green<<","<<blue<<")\" points=\"";
    } else {
      if(temporary_file)*svgfile << 255 << " " << 255 << " " << 255 << " ";
      else *svgfile <<"<svg:polygon detid=\""<<ccu->idex<<"\" count=\""<<ccu->count <<"\" value=\""<<ccu->value<<"\" id=\""<<ccu->idex+crate*1000000<<"\"  cmodid=\""<<ccu->cmodid<<"\" layer=\""<<ccu->layer<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Slot/Ring "<<ccu->getCcuSlot()<<"/"<<ccu->getCcuRing()<<" connected to "<<s<<" Id "<<buffer<<" \" fill=\"white\" points=\"";
    }
  } else {//color defined with fillc
    if(ccu->red>255)ccu->red=255;
    if(ccu->green>255)ccu->green=255;
    if(ccu->blue>255)ccu->blue=255;
    if(temporary_file)*svgfile << ccu->red << " " << ccu->green << " " << ccu->blue << " ";
    else *svgfile <<"<svg:polygon detid=\""<<ccu->idex<<"\" count=\""<<ccu->count <<"\" value=\""<<ccu->value<<"\" id=\""<<ccu->idex+crate*1000000<<"\" cmodid=\""<<ccu->cmodid<<"\" layer=\""<<ccu->layer<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Slot/Ring "<<ccu->getCcuSlot()<<"/"<<ccu->getCcuRing()<<" connected to "<<s<<" Id "<<buffer<<" \" fill=\"rgb("<<ccu->red<<","<<ccu->green<<","<<ccu->blue<<")\" points=\"";
  }
if(temporary_file)*svgfile << np << " ";
for(int k=0;k<np;k++){
  if(temporary_file)*svgfile << xd[k] << " " << yd[k] << " " ;
  else *svgfile << xd[k] << "," << yd[k] << " " ;
}
if(temporary_file)*svgfile << std::endl;
else *svgfile <<"\" />" <<std::endl;

}
void TrackerMap::drawHV2 ( int  rack,
int  numcrate_inrack,
bool  print_total,
TmPsu psu,
ofstream *  svgfile,
bool  usePsuValue 
)

Definition at line 1062 of file TrackerMap.cc.

References TmPsu::blueHV2, TmPsu::cmodid_HV2, TmPsu::countHV2, getcolor(), TmPsu::getPsuBoard(), TmPsu::getPsuCrate(), TmPsu::greenHV2, TmPsu::idex, j, gen::k, np, palette, TmPsu::redHV2, alignCSCRings::s, temporary_file, TmPsu::textHV2, TmPsu::valueHV2, xdpixelpsu(), and ydpixelpsu().

Referenced by save_as_HVtrackermap().

{
  double xp[4],yp[4];
  int color;
  int greenHV2 = 0;
  int redHV2 = 0;
  int blueHV2 = 0;
  double xd[4],yd[4];
  int np = 4;
  double boxinitx=35, boxinity=12; 
  double dx=1.1,dy=1.3;
  
  boxinitx= boxinitx+(5 - numcrate_inrack)*5;
  boxinity= boxinity+(18 - psu->getPsuBoard())*1.75;

  xp[0]=boxinitx;yp[0]=boxinity;
  xp[1]=boxinitx+dx;yp[1]=boxinity;
  xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
  xp[3]=boxinitx;yp[3]=boxinity + dy;
 
 
  for(int j=0;j<4;j++){
    xd[j]=xdpixelpsu(xp[j]);yd[j]=ydpixelpsu(yp[j]);
    //std::cout << boxinity << " "<< ymax << " "<< yp[j] << std::endl;
  }
  
  char buffer [20];
  sprintf(buffer,"%X",psu->idex);
  std::string s = psu->textHV2;
  s.erase(s.begin()+s.find("connected"),s.end());
   
  if(psu->redHV2 < 0){ //use count to compute color
    
    if(psu->valueHV2 > 0){
      color = getcolor(psu->valueHV2,palette);
      redHV2=(color>>16)&0xFF;
      greenHV2=(color>>8)&0xFF;
      blueHV2=(color)&0xFF;
      if(!print_total)psu->valueHV2=psu->valueHV2*psu->countHV2;//restore mod->value
      if(temporary_file)*svgfile << redHV2 << " " << greenHV2 << " " << blueHV2 << " ";
      else *svgfile <<"<svg:polygon detid=\""<<psu->idex<<"\" count=\""<<psu->countHV2 <<"\" value=\""<<psu->valueHV2<<"\" id=\""<< psu->idex*10+2 <<"\" cmodid=\""<<psu->cmodid_HV2<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->getPsuCrate()<<"/"<<psu->getPsuBoard()<<" connected to "<<s<<" \" fill=\"rgb("<<redHV2<<","<<greenHV2<<","<<blueHV2<<")\" points=\"";
      } 
      else{
      if(temporary_file)*svgfile << 255 << " " << 255 << " " << 255 << " ";
      else *svgfile <<"<svg:polygon detid=\""<<psu->idex<<"\" count=\""<<psu->countHV2 <<"\" value=\""<<psu->valueHV2<<"\" id=\""<< psu->idex*10+2 <<"\"  cmodid=\""<<psu->cmodid_HV2<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->getPsuCrate()<<"/"<<psu->getPsuBoard()<<" connected to "<<s<<" \" fill=\"white\" points=\"";
      }
    } 
   
    else {//color defined with fillc
    if(psu->redHV2>255)psu->redHV2=255;
    if(psu->greenHV2>255)psu->greenHV2=255;
    if(psu->blueHV2>255)psu->blueHV2=255;
    if(temporary_file)*svgfile << psu->redHV2 << " " << psu->greenHV2 << " " << psu->blueHV2 << " ";
    else *svgfile <<"<svg:polygon detid=\""<<psu->idex<<"\" count=\""<<psu->countHV2 <<"\" value=\""<<psu->valueHV2<<"\" id=\""<< psu->idex*10+2 <<"\" cmodid=\""<<psu->cmodid_HV2<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->getPsuCrate()<<"/"<<psu->getPsuBoard()<<" connected to "<<s<<" \" fill=\"rgb("<<psu->redHV2<<","<<psu->greenHV2<<","<<psu->blueHV2<<")\" points=\"";
  }

if(temporary_file)*svgfile << np << " ";
for(int k=0;k<np;k++){
  if(temporary_file)*svgfile << xd[k] << " " << yd[k] << " " ; 
  else *svgfile << xd[k] << "," << yd[k] << " " ;
}
if(temporary_file)*svgfile << std::endl;
else *svgfile <<"\" />" <<std::endl;

}
void TrackerMap::drawHV3 ( int  rack,
int  numcrate_inrack,
bool  print_total,
TmPsu psu,
ofstream *  svgfile,
bool  usePsuValue 
)

Definition at line 1129 of file TrackerMap.cc.

References TmPsu::blueHV3, TmPsu::cmodid_HV3, TmPsu::countHV3, getcolor(), TmPsu::getPsuBoard(), TmPsu::getPsuCrate(), TmPsu::greenHV3, TmPsu::idex, j, gen::k, np, palette, TmPsu::redHV3, alignCSCRings::s, temporary_file, TmPsu::textHV3, TmPsu::valueHV3, xdpixelpsu(), and ydpixelpsu().

Referenced by save_as_HVtrackermap().

{
  double xp[4],yp[4];
  int color;
  int greenHV3 = 0;
  int redHV3 = 0;
  int blueHV3 = 0;
  double xd[4],yd[4];
  int np = 4;
  double boxinitx=36.5, boxinity=12; 
  double dx=1.1,dy=1.3;
  
  boxinitx= boxinitx+(5 - numcrate_inrack)*5;
  boxinity= boxinity+(18 - psu->getPsuBoard())*1.75;

  xp[0]=boxinitx;yp[0]=boxinity;
  xp[1]=boxinitx+dx;yp[1]=boxinity;
  xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
  xp[3]=boxinitx;yp[3]=boxinity + dy;
 
 
  for(int j=0;j<4;j++){
    xd[j]=xdpixelpsu(xp[j]);yd[j]=ydpixelpsu(yp[j]);
    //std::cout << boxinity << " "<< ymax << " "<< yp[j] << std::endl;
  }
  
  char buffer [20];
  sprintf(buffer,"%X",psu->idex);
  std::string s = psu->textHV3;
  s.erase(s.begin()+s.find("connected"),s.end());
   
  if(psu->redHV3 < 0){ //use count to compute color
    if(psu->valueHV3 > 0){
      color = getcolor(psu->valueHV3,palette);
      redHV3=(color>>16)&0xFF;
      greenHV3=(color>>8)&0xFF;
      blueHV3=(color)&0xFF;
      if(!print_total)psu->valueHV3=psu->valueHV3*psu->countHV3;//restore mod->value
      if(temporary_file)*svgfile << redHV3 << " " << greenHV3 << " " << blueHV3 << " ";
      else *svgfile <<"<svg:polygon detid=\""<<psu->idex<<"\" count=\""<<psu->countHV3 <<"\" value=\""<<psu->valueHV3<<"\" id=\""<< psu->idex*10+3 <<"\" cmodid=\""<<psu->cmodid_HV3<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard"<<psu->getPsuCrate()<<"/"<<psu->getPsuBoard()<<" connected to "<<s<<" \" fill=\"rgb("<<redHV3<<","<<greenHV3<<","<<blueHV3<<")\" points=\"";
      } 
      else{
      if(temporary_file)*svgfile << 255 << " " << 255 << " " << 255 << " ";
      else *svgfile <<"<svg:polygon detid=\""<<psu->idex<<"\" count=\""<<psu->countHV3 <<"\" value=\""<<psu->valueHV3<<"\" id=\""<< psu->idex*10+3 <<"\"  cmodid=\""<<psu->cmodid_HV3<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->getPsuCrate()<<"/"<<psu->getPsuBoard()<<" connected to "<<s<<" \" fill=\"white\" points=\"";
      }
    } 
   
    else {//color defined with fillc
    if(psu->redHV3>255)psu->redHV3=255;
    if(psu->greenHV3>255)psu->greenHV3=255;
    if(psu->blueHV3>255)psu->blueHV3=255;
    if(temporary_file)*svgfile << psu->redHV3 << " " << psu->greenHV3 << " " << psu->blueHV3 << " ";
    else *svgfile <<"<svg:polygon detid=\""<<psu->idex<<"\" count=\""<<psu->countHV3 <<"\" value=\""<<psu->valueHV3<<"\" id=\""<< psu->idex*10+3 <<"\" cmodid=\""<<psu->cmodid_HV3<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->getPsuCrate()<<"/"<<psu->getPsuBoard()<<" connected to "<<s<<" \" fill=\"rgb("<<psu->redHV3<<","<<psu->greenHV3<<","<<psu->blueHV3<<")\" points=\"";
  }

if(temporary_file)*svgfile << np << " ";
for(int k=0;k<np;k++){
  if(temporary_file)*svgfile << xd[k] << " " << yd[k] << " " ; 
  else *svgfile << xd[k] << "," << yd[k] << " " ;
}
if(temporary_file)*svgfile << std::endl;
else *svgfile <<"\" />" <<std::endl;

}
void TrackerMap::drawModule ( TmModule mod,
int  key,
int  layer,
bool  total,
std::ofstream *  file 
)

Definition at line 495 of file TrackerMap.cc.

References TmModule::blue, TmModule::capvids, TmModule::CcuId, funct::cos(), TmModule::count, getcolor(), cmsRelvalreport::green(), TmModule::green, TmModule::HVchannel, TmModule::idex, TmModule::idModule, isRingStereo(), j, gen::k, TmModule::length, M_PI, TmModule::name, np, palette, phi, phival(), posrel, TmModule::posx, TmModule::posy, TmModule::posz, TmModule::psuIdex, alignCSCRings::r, TmModule::red, cmsRelvalreport::red(), TmModule::ring, funct::sin(), mathSSE::sqrt(), temporary_file, TmModule::text, TmModule::value, TmModule::width, TmModule::widthAtHalfLength, xdpixel(), and ydpixel().

Referenced by print(), printlayers(), and save().

                                                                                                    {
  //int x,y;
  double phi,r,dx,dy, dy1;
  double xp[4],yp[4],xp1,yp1;
  double vhbot,vhtop,vhapo;
  double rmedio[]={0.041,0.0701,0.0988,0.255,0.340,0.430,0.520,0.610,0.696,0.782,0.868,0.965,1.080};
  double xt1,yt1,xs1=0.,ys1=0.,xt2,yt2,xs2,ys2,pv1,pv2;
  int green = 0;
  int red = 0;
  int blue = 0;
  double xd[4],yd[4];
  int np = 4;
  //int numrec=0;
  int numod=0;
  phi = phival(mod->posx,mod->posy);
  r = sqrt(mod->posx*mod->posx+mod->posy*mod->posy);
  vhbot = mod->width;
  vhtop=mod->width;
  vhapo=mod->length;
  if(nlay < 31){ //endcap
    vhbot = mod->widthAtHalfLength/2.-(mod->width/2.-mod->widthAtHalfLength/2.);
    vhtop=mod->width/2.;
    vhapo=mod->length/2.;
    if(nlay >12 && nlay <19){
      if(posrel)r = r+r;
      xp[0]=r-vhtop;yp[0]=-vhapo;
      xp[1]=r+vhtop;yp[1]=-vhapo;
      xp[2]=r+vhtop;yp[2]=vhapo;
      xp[3]=r-vhtop;yp[3]=vhapo;
    }else{
      if(posrel)r = r + r/3.;
      xp[0]=r-vhapo;yp[0]=-vhbot;
      xp[1]=r+vhapo;yp[1]=-vhtop;
      xp[2]=r+vhapo;yp[2]=vhtop;
      xp[3]=r-vhapo;yp[3]=vhbot;
    }
    for(int j=0;j<4;j++){
      xp1 = xp[j]*cos(phi)-yp[j]*sin(phi);
      yp1 = xp[j]*sin(phi)+yp[j]*cos(phi);
      xp[j] = xp1;yp[j]=yp1;
    }
  } else { //barrel
    numod=mod->idModule;if(numod>100)numod=numod-100;
    int vane = mod->ring;
    if(posrel){
      dx = vhapo;
      phi=M_PI;
      xt1=rmedio[nlay-31]; yt1=-vhtop/2.;
      xs1 = xt1*cos(phi)-yt1*sin(phi);
      ys1 = xt1*sin(phi)+yt1*cos(phi);
      xt2=rmedio[nlay-31]; yt2=vhtop/2.;
      xs2 = xt2*cos(phi)-yt2*sin(phi);
      ys2 = xt2*sin(phi)+yt2*cos(phi);
      dy=phival(xs2,ys2)-phival(xs1,ys1);
         dy1 = dy;
      if(nlay==31)dy1=0.39;
      if(nlay==32)dy1=0.23;
      if(nlay==33)dy1=0.16;
      xp[0]=vane*(dx+dx/8.);yp[0]=numod*(dy1);
      xp[1]=vane*(dx+dx/8.)+dx;yp[1]=numod*(dy1);
      xp[2]=vane*(dx+dx/8.)+dx;yp[2]=numod*(dy1)+dy;
      xp[3]=vane*(dx+dx/8.);yp[3]=numod*(dy1)+dy;
    }else{
      xt1=r; yt1=-vhtop/2.;
      xs1 = xt1*cos(phi)-yt1*sin(phi);
      ys1 = xt1*sin(phi)+yt1*cos(phi);
      xt2=r; yt2=vhtop/2.;
      xs2 = xt2*cos(phi)-yt2*sin(phi);
      ys2 = xt2*sin(phi)+yt2*cos(phi);
      pv1=phival(xs1,ys1);
      pv2=phival(xs2,ys2);
      if(fabs(pv1-pv2)>M_PI && numod==1)pv1=pv1-2.*M_PI;
      if(fabs(pv1-pv2)>M_PI && numod!=1)pv2=pv2+2.*M_PI;
      xp[0]=mod->posz-vhapo/2.;yp[0]=4.2*pv1;
      xp[1]=mod->posz+vhapo/2.;yp[1]=4.2*pv1;
      xp[2]=mod->posz+vhapo/2. ;yp[2]=4.2*pv2;
          xp[3]=mod->posz-vhapo/2.;yp[3]=4.2*pv2;
    }
  }
  if(isRingStereo(key))
        {
          np = 3;
          if(mod->idModule>100 ){for(int j=0;j<3;j++){
              xd[j]=xdpixel(xp[j]);yd[j]=ydpixel(yp[j]);
            }
          }else {
            xd[0]=xdpixel(xp[2]);yd[0]=ydpixel(yp[2]);
            xd[1]=xdpixel(xp[3]);yd[1]=ydpixel(yp[3]);
            xd[2]=xdpixel(xp[0]);yd[2]=ydpixel(yp[0]);
          }
        } else {
    for(int j=0;j<4;j++){
      xd[j]=xdpixel(xp[j]);yd[j]=ydpixel(yp[j]);
    }
  }
  char buffer [20];
   sprintf(buffer,"%X",mod->idex);

 if(mod->red < 0){ //use count to compute color
 int color = getcolor(mod->value,palette);
     red=(color>>16)&0xFF;
     green=(color>>8)&0xFF;
     blue=(color)&0xFF;
  
if(!print_total)mod->value=mod->value*mod->count;//restore mod->value
  
  if(mod->count > 0)
    if(temporary_file) *svgfile << red << " " << green << " " << blue << " "; else
    *svgfile <<"<svg:polygon detid=\""<<mod->idex<<"\" count=\""<<mod->count <<"\" value=\""<<mod->value<<"\" id=\""<<key<<"\" capvids=\""<<mod->capvids<<"\" lv=\""<<mod->psuIdex<<"\" hv=\""<<mod->psuIdex*10 + mod->HVchannel<<"\" fec=\""<<mod->CcuId<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\""<<mod->text<<"\" POS=\""<<mod->name<<" \" fill=\"rgb("<<red<<","<<green<<","<<blue<<")\" points=\"";
  else
    if(temporary_file) *svgfile << 255 << " " << 255 << " " << 255 << " "; else
    *svgfile <<"<svg:polygon detid=\""<<mod->idex<<"\" count=\""<<mod->count <<"\" value=\""<<mod->value<<"\" id=\""<<key<<"\" capvids=\""<<mod->capvids<<"\" lv=\""<<mod->psuIdex<<"\" hv=\""<<mod->psuIdex*10 + mod->HVchannel<<"\" fec=\""<<mod->CcuId<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\""<<mod->text<<"\" POS=\""<<mod->name<<" \" fill=\"white\" points=\"";
  if(temporary_file) *svgfile << np << " ";
  for(int k=0;k<np;k++){
    if(temporary_file)*svgfile << xd[k] << " " << yd[k] << " " ; else
    *svgfile << xd[k] << "," << yd[k] << " " ;
  }
  if(temporary_file)*svgfile << std::endl; else *svgfile <<"\" />" <<std::endl;
 } else {//color defined with fillc
  if(mod->red>255)mod->red=255;
  if(mod->green>255)mod->green=255;
  if(mod->blue>255)mod->blue=255;
    if(temporary_file) *svgfile << mod->red << " " << mod->green << " " << mod->blue << " "; else
    *svgfile <<"<svg:polygon detid=\""<<mod->idex<<"\" count=\""<<mod->count <<"\" value=\""<<mod->value<<"\" id=\""<<key<<"\" capvids=\""<<mod->capvids<<"\" lv=\""<<mod->psuIdex<<"\" hv=\""<<mod->psuIdex*10 + mod->HVchannel<<"\" fec=\""<<mod->CcuId<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\""<<mod->text<<"\" POS=\""<<mod->name<<" \" fill=\"rgb("<<mod->red<<","<<mod->green<<","<<mod->blue<<")\" points=\"";
  if(temporary_file) *svgfile << np << " ";
  for(int k=0;k<np;k++){
    if(temporary_file)*svgfile << xd[k] << " " << yd[k] << " " ; else
    *svgfile << xd[k] << "," << yd[k] << " " ;
  }
  if(temporary_file)*svgfile << std::endl; else *svgfile <<"\" />" <<std::endl;
 }
  
}
void TrackerMap::drawPalette ( std::ofstream *  file)

Definition at line 2277 of file TrackerMap.cc.

References getcolor(), cmsRelvalreport::green(), i, maxvalue, minvalue, palette, cmsRelvalreport::red(), and temporary_file.

Referenced by print(), and save().

                                                 {
  int color,red, green, blue;
  float val=minvalue;
  int paletteLength = 250;
  float dval = (maxvalue-minvalue)/(float)paletteLength;
  for(int i=0;i<paletteLength;i++){
  color = getcolor(val,palette);
     red=(color>>16)&0xFF;
     green=(color>>8)&0xFF;
     blue=(color)&0xFF;
 //   if(!temporary_file)*svgfile <<"<svg:rect  x=\"3010\" y=\""<<(1550-6*i)<<"\" width=\"50\" height=\"6\" fill=\"rgb("<<red<<","<<green<<","<<blue<<")\" />\n"; 
  //  else *svgfile << red << " " << green << " " << blue << " 4 " << (6*i)+40 << " 3010. " <<//
   //           (6*i)+40 << " 3060. " <<//
    //          (6*(i-1))+40 << " 3060. " <<//
     //         (6*(i-1))+40 <<" 3010. " << std::endl; //

   // if(i%50 == 0){
    //  if(!temporary_file)*svgfile <<"<svg:rect  x=\"3010\" y=\""<<(1550-6*i)<<"\" width=\"50\" height=\"1\" fill=\"black\" />\n";
     // if(i%50==0&&!temporary_file)*svgfile << " <svg:text  class=\"normalText\"  x=\"3060\" y=\""<<(1560-6*i)<<"\">" <<val<<"</svg:text>"<<std::endl;

    if(!temporary_file)*svgfile <<"<svg:rect  x=\"3610\" y=\""<<(1550-6*i)<<"\" width=\"50\" height=\"6\" fill=\"rgb("<<red<<","<<green<<","<<blue<<")\" />\n"; 
    else *svgfile << red << " " << green << " " << blue << " 4 " << (6*i)+40 << " 3610. " <<//
              (6*i)+40 << " 3660. " <<//
              (6*(i-1))+40 << " 3660. " <<//
              (6*(i-1))+40 <<" 3610. " << std::endl; //

    if(i%50 == 0){
     if(!temporary_file)*svgfile <<"<svg:rect  x=\"3610\" y=\""<<(1550-6*i)<<"\" width=\"50\" height=\"1\" fill=\"black\" />\n";
      if(i%50==0&&!temporary_file)*svgfile << " <svg:text  class=\"normalText\"  x=\"3660\" y=\""<<(1560-6*i)<<"\">" <<val<<"</svg:text>"<<std::endl;
       }
    val = val + dval;
   }
} 
void TrackerMap::drawPsu ( int  rack,
int  numcrate_inrack,
bool  print_total,
TmPsu psu,
ofstream *  svgfile,
bool  usePsuValue 
)

Definition at line 996 of file TrackerMap.cc.

References TmPsu::blue, TmPsu::cmodid_LV, TmPsu::count, getcolor(), TmPsu::getPsuBoard(), TmPsu::getPsuCrate(), cmsRelvalreport::green(), TmPsu::green, TmPsu::idex, j, gen::k, np, palette, TmPsu::red, cmsRelvalreport::red(), alignCSCRings::s, temporary_file, TmPsu::text, TmPsu::value, xdpixelpsu(), and ydpixelpsu().

Referenced by save_as_psutrackermap().

{
  double xp[4],yp[4];
  int color;
  int green = 0;
  int red = 0;
  int blue = 0;
  double xd[4],yd[4];
  int np = 4;
  double boxinitx=35, boxinity=12; 
  double dx=3,dy=1.3;
  
  boxinitx= boxinitx+(5 - numcrate_inrack)*5;
  boxinity= boxinity+(18 - psu->getPsuBoard())*1.75;

  xp[0]=boxinitx;yp[0]=boxinity;
  xp[1]=boxinitx+dx;yp[1]=boxinity;
  xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
  xp[3]=boxinitx;yp[3]=boxinity + dy;
 
 
  for(int j=0;j<4;j++){
    xd[j]=xdpixelpsu(xp[j]);yd[j]=ydpixelpsu(yp[j]);
    //std::cout << boxinity << " "<< ymax << " "<< yp[j] << std::endl;
  }
  
  char buffer [20];
  sprintf(buffer,"%X",psu->idex);
  std::string s = psu->text;
  s.erase(s.begin()+s.find("connected"),s.end());
   
  if(psu->red < 0){ //use count to compute color
    if(psu->value > 0){
      color = getcolor(psu->value,palette);
      red=(color>>16)&0xFF;
      green=(color>>8)&0xFF;
      blue=(color)&0xFF;
      if(!print_total)psu->value=psu->value*psu->count;//restore mod->value
      if(temporary_file)*svgfile << red << " " << green << " " << blue << " ";
      else *svgfile <<"<svg:polygon detid=\""<<psu->idex<<"\" count=\""<<psu->count <<"\" value=\""<<psu->value<<"\" id=\""<< psu->idex <<"\" cmodid=\""<<psu->cmodid_LV<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->getPsuCrate()<<"/"<<psu->getPsuBoard()<<" connected to "<<s<<" \" fill=\"rgb("<<red<<","<<green<<","<<blue<<")\" points=\"";
      } 
      else{
     
      if(temporary_file)*svgfile << 255 << " " << 255 << " " << 255 << " ";
      else *svgfile <<"<svg:polygon detid=\""<<psu->idex<<"\" count=\""<<psu->count <<"\" value=\""<<psu->value<<"\" id=\""<< psu->idex <<"\"  cmodid=\""<<psu->cmodid_LV<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->getPsuCrate()<<"/"<<psu->getPsuBoard()<<" connected to "<<s<<" \" fill=\"white\" points=\"";
      }
    } 
   
    else {//color defined with fillc
    if(psu->red>255)psu->red=255;
    if(psu->green>255)psu->green=255;
    if(psu->blue>255)psu->blue=255;
    if(temporary_file)*svgfile << psu->red << " " << psu->green << " " << psu->blue << " ";
    else *svgfile <<"<svg:polygon detid=\""<<psu->idex<<"\" count=\""<<psu->count <<"\" value=\""<<psu->value<<"\" id=\""<< psu->idex <<"\" cmodid=\""<<psu->cmodid_LV<<"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->getPsuCrate()<<"/"<<psu->getPsuBoard()<<" connected to "<<s<<" \" fill=\"rgb("<<psu->red<<","<<psu->green<<","<<psu->blue<<")\" points=\"";
  }

if(temporary_file)*svgfile << np << " ";
for(int k=0;k<np;k++){
  if(temporary_file)*svgfile << xd[k] << " " << yd[k] << " " ; 
  else *svgfile << xd[k] << "," << yd[k] << " " ;
}
if(temporary_file)*svgfile << std::endl;
else *svgfile <<"\" />" <<std::endl;

}
void TrackerMap::fill ( int  layer,
int  ring,
int  nmod,
float  x 
)
void TrackerMap::fill ( int  idmod,
float  qty 
)

Definition at line 2529 of file TrackerMap.cc.

References TmModule::count, gather_cfg::cout, imoduleMap, mod(), and TmModule::value.

                                          {

  TmModule * mod = imoduleMap[idmod];
  if(mod!=0){
    mod->value=mod->value+qty;
    mod->count++;
    return;
  }else{
   TmModule * mod1 = imoduleMap[idmod+1];
   TmModule * mod2 = imoduleMap[idmod+2];
   if(mod1!=0 && mod2!=0){
    mod1->value=mod1->value+qty;
    mod1->count++;
    mod2->value=mod2->value+qty;
    mod2->count++;
    return;
   }}
  std::cout << "**************************error in fill method **************module "<<idmod<<std::endl;
}
void TrackerMap::fill_all_blank ( )

Definition at line 2512 of file TrackerMap.cc.

References fill_current_val(), and imoduleMap.

Referenced by SiStripTrackerMapCreator::create().

                               {

  std::map<const int  , TmModule *>::iterator imod;
   for( imod=imoduleMap.begin();imod !=imoduleMap.end(); imod++){
   fill_current_val(imod->first,0); 
   }
}
void TrackerMap::fill_current_val ( int  idmod,
float  current_val 
)

Definition at line 2522 of file TrackerMap.cc.

References TmModule::count, gather_cfg::cout, imoduleMap, mod(), TmModule::red, and TmModule::value.

Referenced by TrackerDpgAnalysis::beginRun(), fill_all_blank(), and SiStripTrackerMapCreator::paintTkMapFromHistogram().

                                                              {

  TmModule * mod = imoduleMap[idmod];
  if(mod!=0)  {mod->value=current_val; mod->count=1;  mod->red=-1;}
  else std::cout << "**error in fill_current_val method ***module "<<idmod<<std::endl;
}
void TrackerMap::fill_current_val_fed_channel ( int  fedId,
int  fedCh,
float  current_val 
)

Definition at line 2337 of file TrackerMap.cc.

References apvMap, TmApvPair::count, gather_cfg::cout, combine::key, TmApvPair::red, and TmApvPair::value.

{
  int key = fedId*1000+fedCh;
  TmApvPair* apvpair = apvMap[key];
  
  if(apvpair!=0)  {apvpair->value=current_val; apvpair->count=1; apvpair->red=-1;}
  else 
    std::cout << "*** error in FedTrackerMap fill_current_val method ***";
}
void TrackerMap::fill_fec_channel ( int  crate,
int  slot,
int  ring,
int  addr,
float  qty 
)

Definition at line 2361 of file TrackerMap.cc.

References ccuMap, TmCcu::count, gather_cfg::cout, combine::key, and TmCcu::value.

{
 int key =crate*10000000+slot*100000+ring*1000+addr;
 TmCcu *ccu = ccuMap[key];
  if(ccu!=0){
    ccu->count++; ccu->value=ccu->value+qty;
    return;
 
  }
  
  std::cout << "*** error in FecTrackerMap fill by module method ***";
  }
void TrackerMap::fill_fed_channel ( int  fedId,
int  fedCh,
float  qty 
)

Definition at line 2470 of file TrackerMap.cc.

References apvMap, TmApvPair::count, gather_cfg::cout, combine::key, and TmApvPair::value.

{
  int key = fedId*1000+fedCh;
  TmApvPair* apvpair = apvMap[key];
  if(apvpair!=0){
    apvpair->value=apvpair->value+qty;
    apvpair->count++;
    return;
  }
  std::cout << "*** error inFedTrackerMap fill method ***";
}
void TrackerMap::fill_fed_channel ( int  modId,
float  qty 
)

Definition at line 2322 of file TrackerMap.cc.

References apvModuleMap, TmApvPair::count, gather_cfg::cout, pos, and TmApvPair::value.

{
  std::multimap<const int, TmApvPair*>::iterator pos;
  for (pos = apvModuleMap.lower_bound(idmod);
         pos != apvModuleMap.upper_bound(idmod); ++pos) {
  TmApvPair* apvpair = pos->second;
  if(apvpair!=0){
    apvpair->value=apvpair->value+qty;
    apvpair->count++;
  }
  }
    return;
  std::cout << "*** error in FedTrackerMap fill by module method ***";
  }
void TrackerMap::fill_hv_channel2 ( int  rack,
int  crate,
int  board,
float  qty 
)

Definition at line 2431 of file TrackerMap.cc.

References TmPsu::countHV2, gather_cfg::cout, combine::key, psuMap, and TmPsu::valueHV2.

{
 int key = rack*1000+crate*100+board;
 TmPsu *psu = psuMap[key];
  if(psu!=0){
    psu->countHV2++; psu->valueHV2=psu->valueHV2+qty;
    return;
 
  }
  
  std::cout << "*** error in HVTrackerMap fill by module method ***";
  }
void TrackerMap::fill_hv_channel3 ( int  rack,
int  crate,
int  board,
float  qty 
)

Definition at line 2443 of file TrackerMap.cc.

References TmPsu::countHV3, gather_cfg::cout, combine::key, psuMap, and TmPsu::valueHV3.

{
 int key = rack*1000+crate*100+board;
 TmPsu *psu = psuMap[key];
  if(psu!=0){
    psu->countHV3++; psu->valueHV3=psu->valueHV3+qty;
    return;
 
  }
  
  std::cout << "*** error in HVTrackerMap fill by module method ***";
  }
void TrackerMap::fill_lv_channel ( int  rack,
int  crate,
int  board,
float  qty 
)

Definition at line 2390 of file TrackerMap.cc.

References TmPsu::count, gather_cfg::cout, combine::key, psuMap, and TmPsu::value.

{
 int key = rack*1000+crate*100+board;
 TmPsu *psu = psuMap[key];
  if(psu!=0){
    psu->count++; psu->value=psu->value+qty;
    return;
 
  }
  
  std::cout << "*** error in LVTrackerMap fill by module method ***";
  }
void TrackerMap::fillc ( int  idmod,
int  RGBcode 
) [inline]
void TrackerMap::fillc ( int  idmod,
int  red,
int  green,
int  blue 
)

Definition at line 2483 of file TrackerMap.cc.

References TmModule::blue, gather_cfg::cout, cmsRelvalreport::green(), TmModule::green, imoduleMap, mod(), TmModule::red, and cmsRelvalreport::red().

                                                               {

  TmModule * mod = imoduleMap[idmod];
  if(mod!=0){
     mod->red=red; mod->green=green; mod->blue=blue;
     return;
  }
  std::cout << "**************************error in fill method **************module "<<idmod<<std::endl;
}
void TrackerMap::fillc ( int  layer,
int  ring,
int  nmod,
int  red,
int  green,
int  blue 
)

Definition at line 2492 of file TrackerMap.cc.

References TmModule::blue, gather_cfg::cout, cmsRelvalreport::green(), TmModule::green, combine::key, mod(), TmModule::red, cmsRelvalreport::red(), and smoduleMap.

                                                                                   {
  
  int key = layer*10000+ring*1000+nmod;
  TmModule * mod = smoduleMap[key];

  if(mod!=0){
     mod->red=red; mod->green=green; mod->blue=blue;
    return;
  }
  std::cout << "**************************error in fill method **************"<< std::endl;
}
void TrackerMap::fillc_all_blank ( )

Definition at line 2504 of file TrackerMap.cc.

References fillc(), and imoduleMap.

Referenced by SiStripTrackerMapCreator::create().

                                {

  std::map<const int  , TmModule *>::iterator imod;
   for( imod=imoduleMap.begin();imod !=imoduleMap.end(); imod++){
   fillc(imod->first,255,255,255); 
   }
}
void TrackerMap::fillc_fec_channel ( int  crate,
int  slot,
int  ring,
int  addr,
int  red,
int  green,
int  blue 
)

Definition at line 2348 of file TrackerMap.cc.

References TmCcu::blue, ccuMap, gather_cfg::cout, cmsRelvalreport::green(), TmCcu::green, combine::key, TmCcu::red, and cmsRelvalreport::red().

 {
 int key =crate*10000000+slot*100000+ring*1000+addr;

 TmCcu *ccu = ccuMap[key];
 
 if(ccu!=0){
    ccu->red=red; ccu->green=green; ccu->blue=blue;
    return;
  }
  std::cout << "*** error in FecTrackerMap fillc method ***";
}
void TrackerMap::fillc_fed_channel ( int  fedId,
int  fedCh,
int  red,
int  green,
int  blue 
)

Definition at line 2310 of file TrackerMap.cc.

References apvMap, TmApvPair::blue, gather_cfg::cout, cmsRelvalreport::green(), TmApvPair::green, combine::key, TmApvPair::red, and cmsRelvalreport::red().

{
  int key = fedId*1000+fedCh;
  TmApvPair* apvpair = apvMap[key];
  
  if(apvpair!=0){
    apvpair->red=red; apvpair->green=green; apvpair->blue=blue;
    return;
  }
  std::cout << "*** error in FedTrackerMap fillc method ***";
}
void TrackerMap::fillc_hv_channel2 ( int  rack,
int  crate,
int  board,
int  red,
int  green,
int  blue 
)

Definition at line 2403 of file TrackerMap.cc.

References TmPsu::blueHV2, gather_cfg::cout, cmsRelvalreport::green(), TmPsu::greenHV2, combine::key, psuMap, cmsRelvalreport::red(), and TmPsu::redHV2.

{
 
 int key = rack*1000+crate*100+board;
 
 TmPsu *psu = psuMap[key];
  
  if(psu!=0){
    psu->redHV2=red; psu->greenHV2=green; psu->blueHV2=blue;
    return;
  }
  std::cout << "*** error in HVTrackerMap (channel 2) fillc method ***";
}
void TrackerMap::fillc_hv_channel3 ( int  rack,
int  crate,
int  board,
int  red,
int  green,
int  blue 
)

Definition at line 2416 of file TrackerMap.cc.

References TmPsu::blueHV3, gather_cfg::cout, cmsRelvalreport::green(), TmPsu::greenHV3, combine::key, psuMap, cmsRelvalreport::red(), and TmPsu::redHV3.

{
 
 int key = rack*1000+crate*100+board;
 
 TmPsu *psu = psuMap[key];
  
  if(psu!=0){
    psu->redHV3=red; psu->greenHV3=green; psu->blueHV3=blue;
    return;
  }
  std::cout << "*** error in HVTrackerMap (channel 3) fillc method ***";
}
void TrackerMap::fillc_lv_channel ( int  rack,
int  crate,
int  board,
int  red,
int  green,
int  blue 
)

Definition at line 2376 of file TrackerMap.cc.

References TmPsu::blue, gather_cfg::cout, cmsRelvalreport::green(), TmPsu::green, combine::key, psuMap, TmPsu::red, and cmsRelvalreport::red().

{
 
 int key = rack*1000+crate*100+board;
 
 TmPsu *psu = psuMap[key];
  
  if(psu!=0){
    psu->red=red; psu->green=green; psu->blue=blue;
    return;
  }
  std::cout << "*** error in LVTrackerMap fillc method ***";
}
int TrackerMap::find_layer ( int  ix,
int  iy 
) [inline]

Definition at line 126 of file TrackerMap.h.

References Clusterizer1DCommons::add(), xsize, and ysize.

    {
      int add;
      int layer=0;
      if(iy <= xsize){//endcap+z
        add = 15;
        layer = ix/ysize;
        layer = layer+add+1;
      }
      if(iy > xsize && iy< 3*xsize){//barrel
        add=30;
        if(ix < 2*ysize){
          layer=1;
        }else {
          layer = ix/(2*ysize);
          if(iy < 2*xsize)layer=layer*2+1; else layer=layer*2;
        }
        layer = layer+add;
      }
      if(iy >= 3*xsize){        //endcap-z
        layer = ix/ysize;
        layer = 15-layer;
      }
      return layer;  
    }
std::ifstream * TrackerMap::findfile ( std::string  filename)

Definition at line 3251 of file TrackerMap.cc.

References gather_cfg::cout, lut2db_cfg::filename, recoMuon::in, and jsPath.

Referenced by printall(), and printonline().

                                                     {
  std::ifstream * ifilename;
  std::string ifname;
  if(jsPath!=""){
  ifname=jsPath+filename;
  ifilename = new ifstream(edm::FileInPath(ifname).fullPath().c_str(),std::ios::in);
  if(!ifilename){
  ifname="CommonTools/TrackerMap/data/"+filename;
  ifilename = new ifstream(edm::FileInPath(ifname).fullPath().c_str(),std::ios::in);
  }
  }else {
  ifname="CommonTools/TrackerMap/data/"+filename;
  ifilename = new ifstream(edm::FileInPath(ifname).fullPath().c_str(),std::ios::in);
 }
  if(!ifilename)std::cout << "File " << filename << " missing" << std::endl;
  return ifilename;
 }
int TrackerMap::getcolor ( float  value,
int  palette 
)

Definition at line 2623 of file TrackerMap.cc.

References delta, cmsRelvalreport::green(), maxvalue, minvalue, cmsRelvalreport::red(), and x.

Referenced by drawApvPair(), drawCcu(), drawHV2(), drawHV3(), drawModule(), drawPalette(), and drawPsu().

                                               {
   int red,green,blue;
   red=0;green=0;blue=0;
   if(palette==1){//palette1 1 - raibow
   float delta=(maxvalue-minvalue);
   float x =(value-minvalue);
   if(value<minvalue){red=0;green=0;blue=255;}
   if(value>maxvalue){red=255;green=0;blue=0;}
   if(value>=minvalue&&value<=maxvalue){ 
   red = (int) ( x<(delta/2) ? 0 : ( x > ((3./4.)*delta) ?  255 : 255/(delta/4) * (x-(2./4.)*delta)  ) );
   green= (int) ( x<delta/4 ? (x*255/(delta/4)) : ( x > ((3./4.)*delta) ?  255-255/(delta/4) *(x-(3./4.)*delta) : 255 ) );
   blue = (int) ( x<delta/4 ? 255 : ( x > ((1./2.)*delta) ?  0 : 255-255/(delta/4) * (x-(1./4.)*delta) ) );
     }
     }
     if (palette==2){//palette 2 yellow-green
     green = (int)((value-minvalue)/(maxvalue-minvalue)*256.);
         if (green > 255) green=255;
         red = 255; blue=0;green=255-green;  
        } 
   return(blue|(green<<8)|(red<<16));
}
int TrackerMap::getlayerCount ( int  subdet,
int  partdet 
) [inline]

Definition at line 152 of file TrackerMap.h.

Referenced by init().

                                            {
    int ncomponent=0;
    if(subdet == 1){ //1=pixel
      if(partdet == 1 || partdet == 3){ //1-3=encap
        ncomponent = 3;
      }
      else { ncomponent = 3; } //barrel
    }
    if(subdet== 2){ //2=inner silicon
      if(partdet == 1 || partdet == 3){ //1-3=encap
        ncomponent = 3;
      }
      else { ncomponent = 4; } //barrel
    }
    if(subdet== 3){ //3=outer silicon
      if(partdet == 1 || partdet == 3){ //1-3=encap
        ncomponent = 9;
      }
      else { ncomponent = 6; } //barrel
    }
    return(ncomponent);
  }   
int TrackerMap::getmoduleCount ( int  subdet,
int  partdet,
int  layer,
int  ring 
) [inline]

Definition at line 349 of file TrackerMap.h.

Referenced by init().

                                                                  {
    int ncomponent=0;
    int spicchif[] ={24,24,40,56,40,56,80};
    int spicchib[] ={20,32,44,30,38,46,56,42,48,54,60,66,74};
    int numero_layer = 0;
    
    if(partdet == 2){ //barrel
      numero_layer = layer-1;
      if(subdet== 2){ //inner
        numero_layer = numero_layer+3;
      }
      if(subdet == 3){ //outer
        numero_layer = numero_layer+7;
      }
      ncomponent = spicchib[numero_layer];
    }
    if(partdet!= 2){ //endcap
      if(subdet== 1)ncomponent=24;//pixel
      else
        ncomponent = spicchif[ring-1];
    }
    return(ncomponent);
  }
int TrackerMap::getNumMod ( ) [inline]

Definition at line 80 of file TrackerMap.h.

{return number_modules;};
int TrackerMap::getringCount ( int  subdet,
int  partdet,
int  layer 
) [inline]

Definition at line 316 of file TrackerMap.h.

Referenced by init().

                                                      {
    int ncomponent=0;
    if(subdet== 1){ //1=pixel
      if(partdet== 1 || partdet== 3){ //end-cap
        ncomponent = 7;
      }
      else{ncomponent = 8;} //barrel
    }   
    if(subdet== 2){ //inner-silicon
      if(partdet== 1 || partdet== 3){ //end-cap
        ncomponent = 3;
      }
      else{ncomponent = 12;} //barrel
    }
    if(subdet== 3){ //outer-silicon
      if(partdet== 1){ //end-cap-z
        if (layer== 1) ncomponent = 4;
        if (layer== 2 || layer== 3) ncomponent = 5;
        if (layer== 4 || layer== 5 || layer== 6) ncomponent = 6;
        if (layer== 7 || layer== 8 || layer== 9) ncomponent = 7;
      }
      if(partdet== 3){ //endcap+z
        if (layer== 9) ncomponent = 4;
        if (layer== 8 || layer== 7) ncomponent = 5;
        if (layer== 6 || layer== 5 || layer== 4) ncomponent = 6;
        if (layer== 3 || layer== 2 || layer== 1) ncomponent = 7;
      }
      if(partdet== 2){ //barrel
        ncomponent = 12;
      }
    }
    return(ncomponent);
  }
int TrackerMap::getxsize ( ) [inline]

Definition at line 76 of file TrackerMap.h.

References xsize.

{return xsize;};
int TrackerMap::getysize ( ) [inline]

Definition at line 77 of file TrackerMap.h.

References ysize.

{return ysize;};
void TrackerMap::init ( void  )

Definition at line 398 of file TrackerMap.cc.

References addPixelFlag, build(), firstcall, firstRing, getlayerCount(), getmoduleCount(), getringCount(), gmaxvalue, gminvalue, isRingStereo(), ix, iy, combine::key, maxvalue, minvalue, module(), ndet, nlayer(), npart, ntotRing, palette, posrel, printflag, relativeConstraints::ring, smoduleMap, and temporary_file.

Referenced by TrackerMap().

                      {
  
  int ntotmod=0;
  ix=0;iy=0; //used to compute the place of each layer in the tracker map
  firstcall = true;
  minvalue=0.; maxvalue=minvalue;
  posrel=true;
  palette = 1;
  printflag=true;
  addPixelFlag=false;
  temporary_file=false;
  gminvalue=0.; gmaxvalue=0.;//default global range for online rendering

  ndet = 3; // number of detectors: pixel, inner silicon, outer silicon
  npart = 3; // number of detector parts: endcap -z, barrel, endcap +z

  //allocate module map
  for (int subdet=1; subdet < ndet+1; subdet++){//loop on subdetectors
    for (int detpart=1; detpart < npart+1; detpart++){//loop on subdetectors parts
      int nlayers = getlayerCount(subdet,detpart); // compute number of layers
      for(int layer=1; layer < nlayers+1; layer++){//loop on layers
        int nrings = getringCount(subdet,detpart,layer);// compute number of rings
        //fill arrays used to do the loop on the rings  
        int layer_g = nlayer(subdet,detpart,layer);
        ntotRing[layer_g-1]=nrings;
        firstRing[layer_g-1]=1;
        if(subdet==3 && detpart!=2)  firstRing[layer_g-1]= 8-nrings; //special numbering for TEC 
        for (int ring=firstRing[layer_g-1]; ring < ntotRing[layer_g-1]+firstRing[layer_g-1];ring++){//loop on rings
          int nmodules = getmoduleCount(subdet,detpart,layer,ring);// compute number of modules
          int key=0;
          TmModule *smodule; 
          for(int module=1; module < nmodules+1; module++){//loop on modules
            smodule = new TmModule(module,ring,layer_g);
            key=layer_g*100000+ring*1000+module;//key identifying module
            smoduleMap[key]=smodule;
            ntotmod++;
          }
          if(isRingStereo(key))for(int module=1; module < nmodules+1; module++){//loop on stereo modules
            smodule = new TmModule(module+100,ring,layer_g);
            int key=layer_g*100000+ring*1000+module+100;
            smoduleMap[key]=smodule;
            ntotmod++;
          }
        }
      }
    }
  }
 build();
}
static bool TrackerMap::isRingStereo ( int  key) [inline, static]

Definition at line 384 of file TrackerMap.h.

Referenced by drawModule(), SiPixelTrackerMap::drawModule(), and init().

                                   {
    int layer=key/100000;
    int ring = key - layer*100000;
    ring = ring/1000;
    if(layer==34 || layer==35 || layer==38 || layer==39) return true;
    if(layer<13 || (layer>18&&layer<31))
      if(ring==1 || ring==2 || ring==5)return true;
    return false;
  }
std::string TrackerMap::layername ( int  layer) [inline]

Definition at line 406 of file TrackerMap.h.

References alignCSCRings::s.

                                {
    std::string s= " ";
    std::ostringstream ons;
    
    if(layer < 10) ons << "TEC -z Layer " << layer;
    if(layer < 13 && layer > 9) ons << "TID -z Layer " << layer-9;
    if(layer < 16 && layer > 12) ons << "FPIX -z Layer " << layer-12;
    if(layer < 19 && layer > 15) ons << "FPIX +z Layer " << layer-15;
    if(layer < 22 && layer > 18) ons << "TID +z Layer " << layer-18;
    if(layer < 31 && layer > 21) ons << "TEC +z Layer " << layer-21;
    if(layer < 34 && layer > 30) ons << "TPB Layer " << layer-30;
    if(layer < 38 && layer > 33) ons << "TIB Layer " << layer-33;
    if(layer > 37) ons << "TOB Layer " << layer-37;
    s = ons.str(); 
    return s;  
  }
static int TrackerMap::layerno ( int  subdet,
int  leftright,
int  layer 
) [inline, static]

Definition at line 372 of file TrackerMap.h.

                                                        {
    if(subdet==6&&leftright==1)return(10-layer);
    if(subdet==6&&leftright==2)return(layer+21);
    if(subdet==4&&leftright==1)return(4-layer+9);
    if(subdet==4&&leftright==2)return(layer+18);
    if(subdet==2&&leftright==1)return(4-layer+12);
    if(subdet==2&&leftright==2)return(layer+15);
    if(subdet==1)return(layer+30);
    if(subdet==3)return(layer+33);
    if(subdet==5)return(layer+37);
  }
void TrackerMap::load ( std::string  s = "tmap.svg")

Definition at line 2175 of file TrackerMap.cc.

References gather_cfg::cout, fill(), recoMuon::in, inputfile, geometryCSVtoXML::line, and relativeConstraints::value.

                                            {
  inputfile = new ifstream(inputfilename.c_str(),std::ios::in);
  std::string line,value;
  int ipos,ipos1,ipos2,id=0,val=0;
  int nline=0;
  while (getline( *inputfile, line ))
        {
        ipos1 = line.find("value=\"");
        if(ipos1 > 0)      {
             value = line.substr(ipos1+7,10);
             ipos = value.find("\"");
             value = value.substr(0,ipos); 
             val=atoi(value.c_str());
             }
        ipos2 = line.find("detid=\"");
        if(ipos2 > 0)      {
             value = line.substr(ipos2+7,10);
             ipos = value.find("\"");
             value = value.substr(0,ipos); 
             id = atoi(value.c_str());
             }
        if(ipos1>0 && ipos2>0 && val>0)this->fill(id,val);
        if(ipos1>0 && ipos2>0)nline++;
        //if(ipos1>0 && ipos2>0)std::cout << nline << " " << id << " " << val << std::endl; 

        }
       std::cout << nline << " modules found in this svg file " << std::endl;
       inputfile->close();delete inputfile;
 }
int TrackerMap::module ( int  fedId,
int  fedCh 
)

Definition at line 2460 of file TrackerMap.cc.

References apvMap, gather_cfg::cout, TmModule::idex, combine::key, and TmApvPair::mod.

Referenced by init(), print(), printall(), printlayers(), printonline(), save(), and ~TrackerMap().

{
  int key = fedId*1000+fedCh;
  TmApvPair* apvpair = apvMap[key];
  if(apvpair!=0){
    return(apvpair->mod->idex);
  }
  return(0);
  std::cout << "*** error in FedTrackerMap module method ***";
}
int TrackerMap::nlayer ( int  det,
int  part,
int  lay 
) [inline]

Definition at line 393 of file TrackerMap.h.

Referenced by init().

                                      {
    if(det==3 && part==1) return lay;
    if(det==2 && part==1) return lay+9;
    if(det==1 && part==1) return lay+12;
    if(det==1 && part==3) return lay+15;
    if(det==2 && part==3) return lay+18;
    if(det==3 && part==3) return lay+21;
    if(det==1 && part==2) return lay+30;
    if(det==2 && part==2) return lay+33;
    if(det==3 && part==2) return lay+37;
    return -1; 
  }
double TrackerMap::phival ( double  x,
double  y 
) [inline]

Definition at line 112 of file TrackerMap.h.

References M_PI, and phi.

Referenced by drawModule(), and SiPixelTrackerMap::drawModule().

                                   {
    double phi;
    double phi1=atan(y/x);
    phi = phi1;
    if(y<0. && x>0) phi = phi1+2.*M_PI;
    if(x<0.)phi=phi1+M_PI;
    if(fabs(y)<0.000001 && x>0)phi=0;
    if(fabs(y)<0.000001&&x<0)phi=M_PI;
    if(fabs(x)<0.000001&&y>0)phi=M_PI/2.;
    if(fabs(x)<0.000001&&y<0)phi=3.*M_PI/2.;
      
    return phi;
  }
void TrackerMap::print ( bool  print_total = true,
float  minval = 0.,
float  maxval = 0.,
std::string  s = "svgmap" 
)

Definition at line 2210 of file TrackerMap.cc.

References TmModule::count, defwindow(), drawModule(), drawPalette(), firstRing, recoMuon::in, jsfile, jsfilename, combine::key, geometryCSVtoXML::line, maxvalue, minvalue, mod(), module(), nlay, TmModule::notInUse(), ntotRing, dbtoconf::out, printflag, relativeConstraints::ring, smoduleMap, svgfile, temporary_file, title, TmModule::value, and relativeConstraints::value.

Referenced by SiStripQualityStatistics::analyze(), SiStripCablingTrackerMap::endJob(), and SiStripQualityStatistics::endJob().

                                                                                            {
  temporary_file=false;
  std::ostringstream outs;
  minvalue=minval; maxvalue=maxval;
  outs << outputfilename << ".xml";
  svgfile = new std::ofstream(outs.str().c_str(),std::ios::out);
  jsfile = new ifstream(edm::FileInPath(jsfilename).fullPath().c_str(),std::ios::in);

  //copy javascript interface from trackermap.txt file
  std::string line;
  while (getline( *jsfile, line ))
        {
            *svgfile << line << std::endl;
        }
  jsfile->close();delete jsfile;
  //
 if(!print_total){
  for (int layer=1; layer < 44; layer++){
    for (int ring=firstRing[layer-1]; ring < ntotRing[layer-1]+firstRing[layer-1];ring++){
      for (int module=1;module<200;module++) {
        int key=layer*100000+ring*1000+module;
        TmModule * mod = smoduleMap[key];
        if(mod !=0 && !mod->notInUse()){
          mod->value = mod->value / mod->count;
        }
      }
    }
  }
  }
  if(minvalue>=maxvalue){
  minvalue=9999999.;
  maxvalue=-9999999.;
  for (int layer=1; layer < 44; layer++){
    for (int ring=firstRing[layer-1]; ring < ntotRing[layer-1]+firstRing[layer-1];ring++){
      for (int module=1;module<200;module++) {
        int key=layer*100000+ring*1000+module;
        TmModule * mod = smoduleMap[key];
        if(mod !=0 && !mod->notInUse()){
          if (minvalue > mod->value)minvalue=mod->value;
          if (maxvalue < mod->value)maxvalue=mod->value;
        }
      }
    }
  }
}
  for (int layer=1; layer < 44; layer++){
    nlay=layer;
    defwindow(nlay);
    for (int ring=firstRing[layer-1]; ring < ntotRing[layer-1]+firstRing[layer-1];ring++){
      for (int module=1;module<200;module++) {
        int key=layer*100000+ring*1000+module;
        TmModule * mod = smoduleMap[key];
        if(mod !=0 && !mod->notInUse()){
          drawModule(mod,key,layer,print_total,svgfile);
        }
      }
    }
  }
  *svgfile << "</svg:g></svg:svg>"<<std::endl;
  *svgfile << " <svg:text id=\"Title\" class=\"normalText\"  x=\"300\" y=\"0\">"<<title<<"</svg:text>"<<std::endl;
  if(printflag)drawPalette(svgfile);
  *svgfile << "</svg:svg>"<<std::endl;
  *svgfile << "</body></html>"<<std::endl;
   svgfile->close();delete svgfile;

}
void TrackerMap::printall ( bool  print_total = true,
float  minval = 0.,
float  maxval = 0.,
std::string  s = "svgmap" 
)

Definition at line 2945 of file TrackerMap.cc.

References apvMap, apvModuleMap, ccuMap, edmPickEvents::command, gather_cfg::cout, enableFecProcessing, enableFedProcessing, enableHVProcessing, enableLVProcessing, fecModuleMap, fedMap, findfile(), firstRing, TmCcu::getCcuCrate(), TmApvPair::getFedCh(), TmApvPair::getFedId(), TmPsu::getPsuBoard(), TmPsu::getPsuRack(), TmPsu::idex, TmModule::idex, TmApvPair::idex, TmCcu::idex, combine::key, geometryCSVtoXML::line, mod(), TmApvPair::mod, module(), TmCcu::mpos, TmModule::name, nchan, ncrates, nfeccrates, TmPsu::nmod, TmCcu::nmod, TmPsu::nmodHV2, TmPsu::nmodHV3, TmModule::notInUse(), npsuracks, ntotRing, dbtoconf::out, pos, printlayers(), psuMap, psuModuleMap, run_regression::ret, relativeConstraints::ring, save(), save_as_fectrackermap(), save_as_fedtrackermap(), save_as_HVtrackermap(), save_as_psutrackermap(), smoduleMap, temporary_file, TmPsu::text, TmApvPair::text, TmCcu::text, TmPsu::textHV2, TmPsu::textHV3, title, and makeMuonMisalignmentScenario::txtfile.

                                                                                               {
//Copy interface
  std::ofstream * ofilename;
  std::ifstream * ifilename;
  std::ostringstream ofname;
  std::string ifname;
  std::string line;
  std::string command;

  ifilename=findfile("viewerHeader.xhtml");
  ofname << outputfilename << "viewer.html";
  ofilename = new std::ofstream(ofname.str().c_str(),std::ios::out);
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
*ofilename <<"    var tmapname=\"" <<outputfilename << "\""<<std::endl;
*ofilename <<"    var tmaptitle=\"" <<title << "\""<<std::endl;
*ofilename <<"    var ncrates=" <<ncrates << ";"<<std::endl;
*ofilename <<"    var nfeccrates=" <<nfeccrates << ";"<<std::endl;
*ofilename <<"    var npsuracks=" <<npsuracks << ";"<<std::endl;
   ifilename->close();delete ifilename;
  ifilename=findfile("viewerTrailer.xhtml");
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
   ofilename->close();delete ofilename;
   ifilename->close();delete ifilename;
   command = "sed -i \"s/XtmapnameX/"+outputfilename+"/g\" "+ ofname.str();
    std::cout << "Executing " << command << std::endl;
    system(command.c_str());
   command = "sed -i \"s/XtmaptitleX/"+title+"/g\" "+ ofname.str();
    std::cout << "Executing " << command << std::endl;
    system(command.c_str());
  ofname.str("");
  
ifilename=findfile("jqviewer.js");
  ofname << "jqviewer.js";
  ofilename = new std::ofstream(ofname.str().c_str(),std::ios::out);
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
   ofilename->close();delete ofilename;
   ifilename->close();delete ifilename;
 
  ofname.str("");
  ifilename=findfile("crate.js");
  ofname <<  "crate.js";
  ofilename = new std::ofstream(ofname.str().c_str(),std::ios::out);
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
   ofilename->close();delete ofilename;
   ifilename->close();delete ifilename;
 
  ofname.str("");
  ifilename=findfile("feccrate.js");
  ofname <<  "feccrate.js";
  ofilename = new std::ofstream(ofname.str().c_str(),std::ios::out);
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
   ofilename->close();delete ofilename;
   ifilename->close();delete ifilename;
 
  ofname.str("");
  ifilename=findfile("rack.js");
  ofname <<  "rack.js";
  ofilename = new std::ofstream(ofname.str().c_str(),std::ios::out);
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
   ofilename->close();delete ofilename;
   ifilename->close();delete ifilename;
 
   ofname.str("");
  ifilename=findfile("rackhv.js");
  ofname <<  "rackhv.js";
  ofilename = new std::ofstream(ofname.str().c_str(),std::ios::out);
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
   ofilename->close();delete ofilename;
   ifilename->close();delete ifilename;
   
   ofname.str("");
  ifilename=findfile("layer.js");
  ofname <<  "layer.js";
  ofilename = new std::ofstream(ofname.str().c_str(),std::ios::out);
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
   ofilename->close();delete ofilename;
   ifilename->close();delete ifilename;
  
   command = "scp -r ../../DQM/TrackerCommon/test/jquery/ .";
    std::cout << "Executing " << command << std::endl;
    system(command.c_str());
   command = "scp -r ../../CommonTools/TrackerMap/data/images/ .";
    std::cout << "Executing " << command << std::endl;
    system(command.c_str());
 
  
    std::ostringstream outs;
    outs << outputfilename<<".png";
save(true,minval,maxval,outs.str(),3000,1600);
temporary_file=false;
printlayers(true,minval,maxval,outputfilename);

//Now print a text file for each layer 
  std::ofstream * txtfile;
for (int layer=1; layer < 44; layer++){
  std::ostringstream outs;
    outs << outputfilename <<"layer"<<layer<< ".html";
    txtfile = new std::ofstream(outs.str().c_str(),std::ios::out);
    *txtfile << "<html><head></head> <body>" << std::endl;
    for (int ring=firstRing[layer-1]; ring < ntotRing[layer-1]+firstRing[layer-1];ring++){
      for (int module=1;module<200;module++) {
        int key=layer*100000+ring*1000+module;
        TmModule * mod = smoduleMap[key];
        if(mod !=0 && !mod->notInUse()){
            int idmod=mod->idex;
            int nchan=0;
            *txtfile  << "<a name="<<idmod<<"><pre>"<<std::endl;
             std::multimap<const int, TmApvPair*>::iterator pos;
             for (pos = apvModuleMap.lower_bound(idmod);
                pos != apvModuleMap.upper_bound(idmod); ++pos) {
               TmApvPair* apvpair = pos->second;
               if(apvpair!=0){
                   nchan++;
                   *txtfile  <<  apvpair->text << std::endl;
                    }

                    }
                   *txtfile  << "</pre><h3>"<< mod->name<<"</h3>"<<std::endl;
                  }
                }
                }
    *txtfile << "</body></html>" << std::endl;
    txtfile->close();delete txtfile;
                }
if(enableFedProcessing){
  std::ostringstream outs1,outs2;
    outs1 << outputfilename<<"fed.png";
save_as_fedtrackermap(true,0.,0.,outs1.str(),6000,3200);
    outs2 << outputfilename<<".xml";
save_as_fedtrackermap(true,0.,0.,outs2.str(),3000,1600);
//And a text file for each crate 
  std::map<int , int>::iterator i_fed;
  std::ofstream * txtfile;
  for (int crate=1; crate < (ncrates+1); crate++){
    std::ostringstream outs;
    outs << outputfilename <<"crate"<<crate<< ".html";
    txtfile = new std::ofstream(outs.str().c_str(),std::ios::out);
    *txtfile << "<html><head></head> <body>" << std::endl;
    for (i_fed=fedMap.begin();i_fed != fedMap.end(); i_fed++){
      if(i_fed->second == crate){
        int fedId = i_fed->first;
        for (int nconn=0;nconn<96;nconn++){
          int key = fedId*1000+nconn; 
          TmApvPair *  apvPair= apvMap[key];
          if(apvPair !=0){
            int idmod=apvPair->idex;
            *txtfile  << "<a name="<<idmod<<"><pre>"<<std::endl;
            *txtfile  <<  apvPair->text << std::endl;
            std::ostringstream outs;
            outs << "fedchannel "  <<apvPair->getFedId() << "/"<<apvPair->getFedCh()<<" connects to module  " << apvPair->mod->idex ;
            *txtfile  << "</pre><h3>"<< outs.str()<<"</h3>"<<std::endl;
             }
          }
      }
      }
    *txtfile << "</body></html>" << std::endl;
    txtfile->close();delete txtfile;
                }
  }
if(enableFecProcessing){
  std::ostringstream outs1,outs2;
    outs1 << outputfilename<<"fec.png";
save_as_fectrackermap(true,0.,0.,outs1.str(),6000,3200);
    outs2 << outputfilename<<".xml";
save_as_fectrackermap(true,0.,0.,outs2.str(),3000,1600);
//And a text file for each crate
  std::ofstream * txtfile;
  std::map<int , TmCcu *>::iterator i_ccu;
  std::multimap<TmCcu*, TmModule*>::iterator it;
  std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator> ret;
  for (int crate=1; crate < (nfeccrates+1); crate++){
    std::ostringstream outs;
    outs << outputfilename <<"feccrate"<<crate<< ".html";
    txtfile = new std::ofstream(outs.str().c_str(),std::ios::out);
    *txtfile << "<html><head></head> <body>" << std::endl;
    for( i_ccu=ccuMap.begin();i_ccu !=ccuMap.end(); i_ccu++){
     TmCcu *  ccu= i_ccu->second;
      if(ccu!=0&&ccu->getCcuCrate() == crate){
            int idmod=ccu->idex;
            *txtfile  << "<a name="<<idmod<<"><pre>"<<std::endl;
            *txtfile  <<  ccu->text << std::endl;
            std::ostringstream outs;
            if(ccu->nmod==0)outs << "ccu  is in position" << ccu->mpos<<"in ring but doesn't seem to have any module connected"; else
            {
            outs << "ccu  is in position " << ccu->mpos<<" in ring and connects  " <<ccu->nmod<< " modules" << std::endl;
            ret = fecModuleMap.equal_range(ccu);
        for (it = ret.first; it != ret.second; ++it)
          {
           outs << (*it).second->idex<<" " << (*it).second->name <<" value= "<< (*it).second->value<<"\n\n";
          }

            *txtfile  << "</pre><h4>"<< outs.str()<<"</h4>"<<std::endl;
          }//ifccu->nmod==0
      }//if ccu!=0
      }//for i_ccu
    *txtfile << "</body></html>" << std::endl;
    txtfile->close();
                }//for int crate
  }
if(enableLVProcessing){
  std::ostringstream outs3,outs4;
    outs3 << outputfilename<<"psu.png";
save_as_psutrackermap(true,0.,0.,outs3.str(),6000,3200);

    outs4 << outputfilename<<".xml";
save_as_psutrackermap(true,0.,0.,outs4.str(),3000,1600);
//And a text file for each rack 
  
  std::ofstream * txtfile;
  std::map<int , TmPsu *>::iterator ipsu;
  std::multimap<TmPsu*, TmModule*>::iterator it;
  std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator> ret;
  for (int rack=1; rack < (npsuracks+1); rack++){
    std::ostringstream outs;
    
    outs << outputfilename <<"psurack"<<rack<< ".html";
    txtfile = new std::ofstream(outs.str().c_str(),std::ios::out);
    *txtfile << "<html><head></head> <body>" << std::endl;
     for ( ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
      TmPsu *  psu= ipsu->second;
      if(psu!=0 && psu->getPsuRack() == rack){
        *txtfile  << "<a name="<<psu->idex<<"><pre>"<<std::endl;      
        *txtfile  <<  psu->text << std::endl;
        std::ostringstream outs;
        if(psu->nmod==0)outs << "Ps is in position" << psu->getPsuBoard()<<"in crate but doesn't seem to have any module connected"; else
        {
        outs<< "PS is in position "  <<psu->getPsuBoard()<< " in crate and connects to "<<psu->nmod<<" modules. "<<std::endl;
        
        ret = psuModuleMap.equal_range(psu);
        for (it = ret.first; it != ret.second; ++it)
          {
           outs <<(*it).second->idex << " "<< (*it).second->name<<" value= "<<(*it).second->value<<" <br>"<<std::endl;
           
          }
        *txtfile  << "</pre><h4>"<< outs.str()<<"</h4>"<<std::endl;
     }
    }
  }
  *txtfile << "</body></html>" << std::endl;
   txtfile->close();
  }
 } 


if(enableHVProcessing){
  std::ostringstream outs5,outs6;
    outs5 << outputfilename<<"hv.png";
save_as_HVtrackermap(true,0.,0.,outs5.str(),6000,3200);

    outs6 << outputfilename<<".xml";
save_as_HVtrackermap(true,0.,0.,outs6.str(),3000,1600);
//And a text file for each rack 

  std::ofstream * txtfile;
  std::map<int , TmPsu *>::iterator ipsu;
  std::multimap<TmPsu*, TmModule*>::iterator it;
  std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator> ret;
  for (int rack=1; rack < (npsuracks+1); rack++){
    std::ostringstream outs;
    
    outs << outputfilename <<"HVrack"<<rack<< ".html";
    txtfile = new std::ofstream(outs.str().c_str(),std::ios::out);
    *txtfile << "<html><head></head> <body>" << std::endl;
     for ( ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
      TmPsu *  psu= ipsu->second;
      if(psu!=0 && psu->getPsuRack() == rack){
        *txtfile  << "<a name="<<psu->idex<<"><pre>"<<std::endl;      
        *txtfile  <<  psu->textHV2 << std::endl;
        std::ostringstream outsHV2;
        if(psu->nmodHV2==0)outsHV2 << "HV Channel002 is in position" << psu->getPsuBoard()<<"in crate but doesn't seem to have any module connected"; else
        {
        outsHV2<< "HV Channel002 is in position "  <<psu->getPsuBoard()<< " in crate and connects to "<<psu->nmodHV2<<" modules. "<<" <br>"<<std::endl;
        
        ret = psuModuleMap.equal_range(psu);
        for (it = ret.first; it != ret.second; ++it)
          {
           if((*it).second->HVchannel==2){outsHV2 <<(*it).second->idex << " "<< (*it).second->name<<" value= "<<(*it).second->value<<" <br>"<<std::endl;}
          }
        *txtfile  << "</pre><h4>"<< outsHV2.str()<<"</h4>"<<std::endl;
     }
    
        *txtfile  <<  psu->textHV3 << std::endl;
        std::ostringstream outsHV3;
        if(psu->nmodHV3==0)outsHV3 << "HV Channel003 is in position" << psu->getPsuBoard()<<"in crate but doesn't seem to have any module connected"; else
        {
        outsHV3<< "HV Channel003 is in position "  <<psu->getPsuBoard()<< " in crate and connects to "<<psu->nmodHV3<<" modules. "<<" <br>"<<std::endl;
        
        ret = psuModuleMap.equal_range(psu);
        for (it = ret.first; it != ret.second; ++it)
          {
           if((*it).second->HVchannel==3){outsHV3 <<(*it).second->idex << " "<< (*it).second->name<<" value= "<<(*it).second->value<<" <br>"<<std::endl;}
          }
        *txtfile  << "</pre><h4>"<< outsHV3.str()<<"</h4>"<<std::endl;
     }
   
    }
  }
  *txtfile << "</body></html>" << std::endl;
   txtfile->close();
  }
 } 


}
void TrackerMap::printlayers ( bool  print_total = true,
float  minval = 0.,
float  maxval = 0.,
std::string  s = "layer" 
)

Definition at line 3268 of file TrackerMap.cc.

References TmModule::count, defwindow(), drawModule(), firstRing, combine::key, maxvalue, minvalue, mod(), module(), nlay, TmModule::notInUse(), ntotRing, dbtoconf::out, relativeConstraints::ring, saveAsSingleLayer, smoduleMap, TmModule::value, relativeConstraints::value, and makeMuonMisalignmentScenario::xmlfile.

Referenced by printall(), and printonline().

                                                                                                  {
  std::ofstream * xmlfile;
saveAsSingleLayer=true;
if(!print_total){
    for (int layer=1; layer < 44; layer++){
      for (int ring=firstRing[layer-1]; ring < ntotRing[layer-1]+firstRing[layer-1];ring++){
        for (int module=1;module<200;module++) {
          int key=layer*100000+ring*1000+module;
          TmModule * mod = smoduleMap[key];
          if(mod !=0 && !mod->notInUse()){
            mod->value = mod->value / mod->count;
          }
        }
      }
    }
  }
  if(minvalue>=maxvalue){
    minvalue=9999999.;
    maxvalue=-9999999.;
    for (int layer=1; layer < 44; layer++){
      for (int ring=firstRing[layer-1]; ring < ntotRing[layer-1]+firstRing[layer-1];ring++){
        for (int module=1;module<200;module++) {
          int key=layer*100000+ring*1000+module;
          TmModule * mod = smoduleMap[key];
          if(mod !=0 && !mod->notInUse()){
            if (minvalue > mod->value)minvalue=mod->value;
            if (maxvalue < mod->value)maxvalue=mod->value;
          }
        }
      }
    }
  }
for (int layer=1; layer < 44; layer++){
  std::ostringstream outs;
    outs << outputfilename <<"layer"<<layer<< ".xml";
    xmlfile = new std::ofstream(outs.str().c_str(),std::ios::out);
    *xmlfile << "<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
    *xmlfile << "<svg xmlns=\"https://www.w3.org/2000/svg\""<<std::endl;
    *xmlfile << "xmlns:svg=\"https://www.w3.org/2000/svg\""<<std::endl;
    *xmlfile << "xmlns:xlink=\"https://www.w3.org/1999/xlink\" >"<<std::endl;
    *xmlfile << "<script type=\"text/ecmascript\" xlink:href=\"layer.js\" />"<<std::endl;
    *xmlfile << "<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0  500 500\" width=\"700\" height=\"700\" onload=\"TrackerLayer.init()\">"<<std::endl;
    if(layer<31)*xmlfile << "<g id=\"layer\" transform=\" translate(0,400) rotate(270) scale(1.,1.)\"  > "<<std::endl;
    else *xmlfile << "<g id=\"layer\" transform=\" translate(0,400) rotate(270) scale(1.,0.8)\"  > "<<std::endl;
    *xmlfile << "<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
    *xmlfile << "<svg:polygon id=\"fed\" mapAttribute=\"fed\" points=\"250,40 250,10 230,10 230,40\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" fill=\"rgb(0,127,255)\"/>"<<std::endl;
    *xmlfile << "<svg:polygon id=\"fec\" mapAttribute=\"fec\" points=\"228,40 228,10 208,10 208,40\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" fill=\"rgb(0,127,255)\"/>"<<std::endl;
    *xmlfile << "<svg:polygon id=\"lv\" mapAttribute=\"lv\" points=\"206,40 206,10 186,10 186,40\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" fill=\"rgb(0,127,255)\"/>"<<std::endl;
    *xmlfile << "<svg:polygon id=\"hv\" mapAttribute=\"hv\" points=\"184,40 184,10 164,10 164,40\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" fill=\"rgb(0,127,255)\"/>"<<std::endl;
    *xmlfile << "<svg:polygon id=\"plot\" mapAttribute=\"plot\" points=\"155,45 155,5 135,5 135,45\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" fill=\"rgb(200,0,0)\"/>"<<std::endl;
  
    nlay=layer;
    defwindow(nlay);
    for (int ring=firstRing[layer-1]; ring < ntotRing[layer-1]+firstRing[layer-1];ring++){
      for (int module=1;module<200;module++) {
        int key=layer*100000+ring*1000+module;
        TmModule * mod = smoduleMap[key];
        if(mod !=0 && !mod->notInUse()){
          drawModule(mod,key,layer,print_total,xmlfile);
        }
      }
    }
    *xmlfile << "</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\">" << std::endl;
    *xmlfile << "<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
    *xmlfile << "<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
    *xmlfile << "<tspan id=\"line3\" x=\"40\" y=\"90\"> </tspan> " << std::endl;
    *xmlfile << "<tspan id=\"line4\" x=\"40\" y=\"120\"> </tspan> " << std::endl;
    if(layer > 33){
    *xmlfile << "<tspan  mapAttribute=\"fed\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"15\" y=\"228\" font-size=\"12\" font-family=\"arial\" fill=\"white\">FED</tspan> " <<std::endl;
    *xmlfile << "<tspan  mapAttribute=\"fec\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"15\" y=\"258\" font-size=\"12\" font-family=\"arial\" fill=\"white\">FEC</tspan> " <<std::endl;
    *xmlfile << "<tspan  mapAttribute=\"lv\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"18\" y=\"289\" font-size=\"12\" font-family=\"arial\" fill=\"white\">LV</tspan> " <<std::endl;
    *xmlfile << "<tspan  mapAttribute=\"hv\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"18\" y=\"319\" font-size=\"12\" font-family=\"arial\" fill=\"white\">HV</tspan> " <<std::endl;
    *xmlfile << "<tspan  mapAttribute=\"plot\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"12\" y=\"360\" font-size=\"12\" font-family=\"arial\" fill=\"white\">PLOT</tspan> " <<std::endl;
    }
    else{
    *xmlfile << "<tspan   mapAttribute=\"fed\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"21\" y=\"228\" font-size=\"12\" font-family=\"arial\" fill=\"white\">FED</tspan> " <<std::endl;
    *xmlfile << "<tspan   mapAttribute=\"fec\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"21\" y=\"258\" font-size=\"12\" font-family=\"arial\" fill=\"white\">FEC</tspan> " <<std::endl;
    *xmlfile << "<tspan   mapAttribute=\"lv\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"24\" y=\"289\" font-size=\"12\" font-family=\"arial\" fill=\"white\">LV</tspan> " <<std::endl;
    *xmlfile << "<tspan   mapAttribute=\"hv\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"24\" y=\"319\" font-size=\"12\" font-family=\"arial\" fill=\"white\">HV</tspan> " <<std::endl;
    *xmlfile << "<tspan   mapAttribute=\"plot\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"17\" y=\"360\" font-size=\"12\" font-family=\"arial\" fill=\"white\">PLOT</tspan> " <<std::endl;
    }
    *xmlfile << " </text> </svg>" << std::endl;
    xmlfile->close();delete xmlfile;
  }
saveAsSingleLayer=false;
}
void TrackerMap::printonline ( )

Definition at line 2644 of file TrackerMap.cc.

References apvMap, apvModuleMap, ccuMap, edmPickEvents::command, gather_cfg::cout, enableFecProcessing, enableFedProcessing, enableHVProcessing, enableLVProcessing, fecModuleMap, fedMap, findfile(), firstRing, TmCcu::getCcuCrate(), TmApvPair::getFedCh(), TmApvPair::getFedId(), TmPsu::getPsuBoard(), TmPsu::getPsuRack(), gmaxvalue, gminvalue, TmPsu::idex, TmModule::idex, TmApvPair::idex, TmCcu::idex, combine::key, geometryCSVtoXML::line, mod(), TmApvPair::mod, module(), TmCcu::mpos, TmModule::name, nchan, ncrates, nfeccrates, TmPsu::nmod, TmCcu::nmod, TmPsu::nmodHV2, TmPsu::nmodHV3, TmModule::notInUse(), npsuracks, ntotRing, dbtoconf::out, pos, printlayers(), psuMap, psuModuleMap, run_regression::ret, relativeConstraints::ring, save(), save_as_fectrackermap(), save_as_fedtrackermap(), save_as_HVtrackermap(), save_as_psutrackermap(), smoduleMap, temporary_file, TmPsu::text, TmApvPair::text, TmCcu::text, TmPsu::textHV2, TmPsu::textHV3, title, and makeMuonMisalignmentScenario::txtfile.

Referenced by SiStripTrackerMapCreator::create().

                            {
//Copy interface
  std::ofstream * ofilename;
  std::ifstream * ifilename;
  std::ostringstream ofname;
  std::string ifname;
  std::string command;
  std::string line;
  std::string outputfilename="dqmtmap";
  ifilename=findfile("viewerHeader.xhtml");
  ofname << outputfilename << "viewer.html";
  ofilename = new std::ofstream(ofname.str().c_str(),std::ios::out);
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
*ofilename <<"    var tmapname=\"" <<outputfilename << "\""<<std::endl;
*ofilename <<"    var tmaptitle=\"" <<title << "\""<<std::endl;
*ofilename <<"    var ncrates=" <<ncrates << ";"<<std::endl;
*ofilename <<"    var nfeccrates=" <<nfeccrates << ";"<<std::endl;
 *ofilename <<"    var npsuracks=" <<npsuracks << ";"<<std::endl;
 
   ifilename->close();delete ifilename;

  ifilename=findfile("viewerTrailer.xhtml");
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
   ofilename->close();delete ofilename;
   command = "sed -i \"s/XtmapnameX/"+outputfilename+"/g\" "+ ofname.str();
    std::cout << "Executing " << command << std::endl;
    system(command.c_str());
   command = "sed -i \"s/XtmaptitleX/"+title+"/g\" "+ ofname.str();
    std::cout << "Executing " << command << std::endl;
    system(command.c_str());
  ofname.str("");
   ifilename->close();delete ifilename;

  ifilename=findfile("jqviewer.js");
  ofname << "jqviewer.js";
  ofilename = new std::ofstream(ofname.str().c_str(),std::ios::out);
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
  ofname.str("");
   ofilename->close();delete ofilename;
   ifilename->close();delete ifilename;

  ifilename=findfile("crate.js");
  ofname <<  "crate.js";
  ofilename = new std::ofstream(ofname.str().c_str(),std::ios::out);
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
  ofname.str("");
   ofilename->close();delete ofilename;
   ifilename->close();delete ifilename;

  ifilename=findfile("feccrate.js");
  ofname <<  "feccrate.js";
  ofilename = new std::ofstream(ofname.str().c_str(),std::ios::out);
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
  ofname.str("");
   ofilename->close();delete ofilename;
   ifilename->close();delete ifilename;
  
  ifilename=findfile("layer.js");
  ofname <<  "layer.js";
  ofilename = new std::ofstream(ofname.str().c_str(),std::ios::out);
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
   ofname.str("");
   ofilename->close();delete ofilename;
   ifilename->close();delete ifilename;
  
  ifilename=findfile("rack.js");
  ofname <<  "rack.js";
  ofilename = new std::ofstream(ofname.str().c_str(),std::ios::out);
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
   ofname.str("");
   ofilename->close();delete ofilename;
   ifilename->close();delete ifilename;
   ofname.str("");
  
  ifilename=findfile("rackhv.js");
  ofname <<  "rackhv.js";
  ofilename = new std::ofstream(ofname.str().c_str(),std::ios::out);
  while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
   ofname.str("");
   ofilename->close();delete ofilename;
   ifilename->close();delete ifilename;
    
    
    
    
   std::ostringstream outs,outs1,outs2;
    outs << outputfilename<<".png";
save(true,gminvalue,gmaxvalue,outs.str(),3000,1600);
temporary_file=false;
printlayers(true,gminvalue,gmaxvalue,outputfilename);

//Now print a text file for each layer 
  std::ofstream * txtfile;
for (int layer=1; layer < 44; layer++){
  std::ostringstream outs;
    outs << outputfilename <<"layer"<<layer<< ".html";
    txtfile = new std::ofstream(outs.str().c_str(),std::ios::out);
    *txtfile << "<html><head></head> <body>" << std::endl;
    for (int ring=firstRing[layer-1]; ring < ntotRing[layer-1]+firstRing[layer-1];ring++){
      for (int module=1;module<200;module++) {
        int key=layer*100000+ring*1000+module;
        TmModule * mod = smoduleMap[key];
        if(mod !=0 && !mod->notInUse()){
            int idmod=mod->idex;
            int nchan=0;
            *txtfile  << "<a name="<<idmod<<"><pre>"<<std::endl;
             std::multimap<const int, TmApvPair*>::iterator pos;
             for (pos = apvModuleMap.lower_bound(idmod);
                pos != apvModuleMap.upper_bound(idmod); ++pos) {
               TmApvPair* apvpair = pos->second;
               if(apvpair!=0){
                   nchan++;
                   *txtfile  <<  apvpair->text << std::endl;
                    }

                    }
                   *txtfile  << "</pre><h3>"<< mod->name<<"</h3>"<<std::endl;
                  }
                }
                }
    *txtfile << "</body></html>" << std::endl;
    txtfile->close();delete txtfile;
                }
if(enableFedProcessing){
    outs1 << outputfilename<<"fed.png";
save_as_fedtrackermap(true,gminvalue,gmaxvalue,outs1.str(),6000,3200);
    outs2 << outputfilename<<".xml";
save_as_fedtrackermap(true,gminvalue,gmaxvalue,outs2.str(),3000,1600);
//And a text file for each crate 
  std::map<int , int>::iterator i_fed;
  std::ofstream * txtfile;
  for (int crate=1; crate < (ncrates+1); crate++){
    std::ostringstream outs;
    outs << outputfilename <<"crate"<<crate<< ".html";
    txtfile = new std::ofstream(outs.str().c_str(),std::ios::out);
    *txtfile << "<html><head></head> <body>" << std::endl;
    for (i_fed=fedMap.begin();i_fed != fedMap.end(); i_fed++){
      if(i_fed->second == crate){
        int fedId = i_fed->first;
        for (int nconn=0;nconn<96;nconn++){
          int key = fedId*1000+nconn; 
          TmApvPair *  apvPair= apvMap[key];
          if(apvPair !=0){
            int idmod=apvPair->idex;
            *txtfile  << "<a name="<<idmod<<"><pre>"<<std::endl;
            *txtfile  <<  apvPair->text << std::endl;
            std::ostringstream outs;
            outs << "fedchannel "  <<apvPair->getFedId() << "/"<<apvPair->getFedCh()<<" connects to module  " << apvPair->mod->idex ;
            *txtfile  << "</pre><h3>"<< outs.str()<<"</h3>"<<std::endl;
             }
          }
      }
      }
    *txtfile << "</body></html>" << std::endl;
    txtfile->close();delete txtfile;
                }
  }
if(enableFecProcessing){
  std::ostringstream outs1,outs2;
    outs1 << outputfilename<<"fec.png";
save_as_fectrackermap(true,gminvalue,gmaxvalue,outs1.str(),6000,3200);
    outs2 << outputfilename<<".xml";
save_as_fectrackermap(true,gminvalue,gmaxvalue,outs2.str(),3000,1600);
//And a text file for each crate
  std::ofstream * txtfile;
  std::map<int , TmCcu *>::iterator i_ccu;
  std::multimap<TmCcu*, TmModule*>::iterator it;
  std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator> ret;
  for (int crate=1; crate < (nfeccrates+1); crate++){
    std::ostringstream outs;
    outs << outputfilename <<"feccrate"<<crate<< ".html";
    txtfile = new std::ofstream(outs.str().c_str(),std::ios::out);
    *txtfile << "<html><head></head> <body>" << std::endl;
    for( i_ccu=ccuMap.begin();i_ccu !=ccuMap.end(); i_ccu++){
     TmCcu *  ccu= i_ccu->second;
      if(ccu!=0&&ccu->getCcuCrate() == crate){
            int idmod=ccu->idex;
            *txtfile  << "<a name="<<idmod<<"><pre>"<<std::endl;
            *txtfile  <<  ccu->text << std::endl;
            std::ostringstream outs;
            if(ccu->nmod==0)outs << "ccu  is in position" << ccu->mpos<<"in ring but doesn't seem to have any module connected"; else
            {
            outs << "ccu  is in position " << ccu->mpos<<" in ring and connects  " <<ccu->nmod<< " modules" << std::endl;
            ret = fecModuleMap.equal_range(ccu);
        for (it = ret.first; it != ret.second; ++it)
          {
           outs << (*it).second->idex<<" " << (*it).second->name <<" value= "<< (*it).second->value<<"\n\n";
          }

            *txtfile  << "</pre><h4>"<< outs.str()<<"</h4>"<<std::endl;
          }//ifccu->nmod==0
      }//if ccu!=0
      }//for i_ccu
    *txtfile << "</body></html>" << std::endl;
    txtfile->close();delete txtfile;
                }//for int crate
  }
if(enableLVProcessing){
  std::ostringstream outs3,outs4;
    outs3 << outputfilename<<"psu.png";
save_as_psutrackermap(true,gminvalue,gmaxvalue,outs3.str(),6000,3200);

    outs4 << outputfilename<<".xml";
save_as_psutrackermap(true,gminvalue,gmaxvalue,outs4.str(),3000,1600);
//And a text file for each rack 
  
  std::ofstream * txtfile;
  std::map<int , TmPsu *>::iterator ipsu;
  std::multimap<TmPsu*, TmModule*>::iterator it;
  std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator> ret;
  for (int rack=1; rack < (npsuracks+1); rack++){
    std::ostringstream outs;
    
    outs << outputfilename <<"psurack"<<rack<< ".html";
    txtfile = new std::ofstream(outs.str().c_str(),std::ios::out);
    *txtfile << "<html><head></head> <body>" << std::endl;
     for ( ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
      TmPsu *  psu= ipsu->second;
      if(psu!=0 && psu->getPsuRack() == rack){
        *txtfile  << "<a name="<<psu->idex<<"><pre>"<<std::endl;      
        *txtfile  <<  psu->text << std::endl;
        std::ostringstream outs;
        if(psu->nmod==0)outs << "Ps is in position" << psu->getPsuBoard()<<"in crate but doesn't seem to have any module connected"; else
        {
        outs<< "PS is in position "  <<psu->getPsuBoard()<< " in crate and connects to "<<psu->nmod<<" modules. "<<std::endl;
        
        ret = psuModuleMap.equal_range(psu);
        for (it = ret.first; it != ret.second; ++it)
          {
           outs <<(*it).second->idex << " "<< (*it).second->name<<" value= "<<(*it).second->value<<" <br>"<<std::endl;
           
          }
        *txtfile  << "</pre><h4>"<< outs.str()<<"</h4>"<<std::endl;
     }
    }
  }
  *txtfile << "</body></html>" << std::endl;
   txtfile->close();delete txtfile;
  }
 } 


if(enableHVProcessing){
  std::ostringstream outs5,outs6;
    outs5 << outputfilename<<"hv.png";
save_as_HVtrackermap(true,gminvalue,gmaxvalue,outs5.str(),6000,3200);

    outs6 << outputfilename<<".xml";
save_as_HVtrackermap(true,gminvalue,gmaxvalue,outs6.str(),3000,1600);
//And a text file for each rack 

 std::ofstream * txtfile;
  std::map<int , TmPsu *>::iterator ipsu;
  std::multimap<TmPsu*, TmModule*>::iterator it;
  std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator> ret;
  for (int rack=1; rack < (npsuracks+1); rack++){
    std::ostringstream outs;
    
    outs << outputfilename <<"HVrack"<<rack<< ".html";
    txtfile = new std::ofstream(outs.str().c_str(),std::ios::out);
    *txtfile << "<html><head></head> <body>" << std::endl;
     for ( ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
      TmPsu *  psu= ipsu->second;
      if(psu!=0 && psu->getPsuRack() == rack){
        *txtfile  << "<a name="<<psu->idex<<"><pre>"<<std::endl;      
        *txtfile  <<  psu->textHV2 << std::endl;
        std::ostringstream outsHV2;
        if(psu->nmodHV2==0)outsHV2 << "HV Channel002 is in position" << psu->getPsuBoard()<<"in crate but doesn't seem to have any module connected"; else
        {
        outsHV2<< "HV Channel002 is in position "  <<psu->getPsuBoard()<< " in crate and connects to "<<psu->nmodHV2<<" modules. "<<" <br>"<<std::endl;
        
        ret = psuModuleMap.equal_range(psu);
        for (it = ret.first; it != ret.second; ++it)
          {
           if((*it).second->HVchannel==2){outsHV2 <<(*it).second->idex << " "<< (*it).second->name<<" value= "<<(*it).second->value<<" <br>"<<std::endl;}
          }
        *txtfile  << "</pre><h4>"<< outsHV2.str()<<"</h4>"<<std::endl;
     }
    
        *txtfile  <<  psu->textHV3 << std::endl;
        std::ostringstream outsHV3;
        if(psu->nmodHV3==0)outsHV3 << "HV Channel003 is in position" << psu->getPsuBoard()<<"in crate but doesn't seem to have any module connected"; else
        {
        outsHV3<< "HV Channel003 is in position "  <<psu->getPsuBoard()<< " in crate and connects to "<<psu->nmodHV3<<" modules. "<<" <br>"<<std::endl;
        
        ret = psuModuleMap.equal_range(psu);
        for (it = ret.first; it != ret.second; ++it)
          {
           if((*it).second->HVchannel==3){outsHV3 <<(*it).second->idex << " "<< (*it).second->name<<" value= "<<(*it).second->value<<" <br>"<<std::endl;}
          }
        *txtfile  << "</pre><h4>"<< outsHV3.str()<<"</h4>"<<std::endl;
     }
   
    }
  }
  *txtfile << "</body></html>" << std::endl;
   txtfile->close();delete txtfile;
  }
 } 
 
}
void TrackerMap::reset ( void  )

Definition at line 390 of file TrackerMap.cc.

References TmModule::count, imoduleMap, mod(), TmModule::red, and TmModule::value.

                       {
std::map<int , TmModule *>::iterator i_mod;
    for( i_mod=imoduleMap.begin();i_mod !=imoduleMap.end(); i_mod++){
      TmModule *  mod= i_mod->second;
      mod->count=0;mod->value=0;mod->red=-1;
      }
}
void TrackerMap::save ( bool  print_total = true,
float  minval = 0.,
float  maxval = 0.,
std::string  s = "svgmap.svg",
int  width = 1500,
int  height = 800 
)

Definition at line 632 of file TrackerMap.cc.

References addPixelFlag, trackerHits::c, colors, edmPickEvents::command, TmModule::count, gather_cfg::cout, defwindow(), drawModule(), drawPalette(), lut2db_cfg::filename, alcaDQMUpload::filetype(), firstRing, newFWLiteAna::found, cmsRelvalreport::green(), i, recoMuon::in, combine::key, prof2calltree::l, maxvalue, minvalue, mod(), module(), nlay, TmModule::notInUse(), ntotRing, dbtoconf::out, pos, printflag, cmsRelvalreport::red(), relativeConstraints::ring, alignCSCRings::s, savefile, smoduleMap, temporary_file, title, TmModule::value, relativeConstraints::value, vc, x, and detailsBasic3DVector::y.

Referenced by SiStripQualityStatistics::analyze(), TrackerDpgAnalysis::beginRun(), TkVoltageMapCreator::beginRun(), SiStripTrackerMapCreator::createForOffline(), SiStripCorrelateNoise::DoPlots(), SiStripCorrelateBadStripAndNoise::endJob(), SiStripCablingTrackerMap::endJob(), SiStripDQMProfileToTkMapConverter::endJob(), BuildTrackerMapPlugin::endJob(), SiStripQualityStatistics::endJob(), SiStripPlotGain::endJob(), APVShotsAnalyzer::endJob(), SiStripHitEffFromCalibTree::makeTKMap(), printall(), printonline(), and SiStripBaseCondObjDQM::saveTkMap().

                                                                                                  {
  
  std::string filetype=s,outputfilename=s;
  std::vector<TPolyLine*> vp;
  TGaxis *axis = 0 ;
  size_t found=filetype.find_last_of(".");
  filetype=filetype.substr(found+1);
  found=outputfilename.find_last_of(".");
  outputfilename=outputfilename.substr(0,found);
 //outputfilename.erase(outputfilename.begin()+outputfilename.find("."),outputfilename.end());
  temporary_file=true;
  if(filetype=="svg")temporary_file=false;
  std::ostringstream outs;
  minvalue=minval; maxvalue=maxval;
  outs << outputfilename << ".coor";
  savefile = new std::ofstream(outs.str().c_str(),std::ios::out);
 if(!print_total){
  for (int layer=1; layer < 44; layer++){
    for (int ring=firstRing[layer-1]; ring < ntotRing[layer-1]+firstRing[layer-1];ring++){
      for (int module=1;module<200;module++) {
        int key=layer*100000+ring*1000+module;
        TmModule * mod = smoduleMap[key];
        if(mod !=0 && !mod->notInUse()){
          mod->value = mod->value / mod->count;
        }
      }
    }
  }
  }
  
  if(minvalue>=maxvalue){
  minvalue=9999999.;
  maxvalue=-9999999.;
  for (int layer=1; layer < 44; layer++){
    for (int ring=firstRing[layer-1]; ring < ntotRing[layer-1]+firstRing[layer-1];ring++){
      for (int module=1;module<200;module++) {
        int key=layer*100000+ring*1000+module;
        TmModule * mod = smoduleMap[key];
        if(mod !=0 && !mod->notInUse()){
          if (minvalue > mod->value)minvalue=mod->value;
          if (maxvalue < mod->value)maxvalue=mod->value;
        }
      }
    }
  }
}
  if (maxvalue == minvalue) printflag = false;
  if(!temporary_file){
  *savefile << "<?xml version=\"1.0\"  standalone=\"no\" ?>"<<std::endl;
  *savefile << "<svg  xmlns=\"https://www.w3.org/2000/svg\""<<std::endl;
  *savefile << "xmlns:svg=\"https://www.w3.org/2000/svg\" "<<std::endl;
  *savefile << "xmlns:xlink=\"https://www.w3.org/1999/xlink\">"<<std::endl;
  *savefile << "<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3100 1600"<<"\" width=\""<<width<<"\" height=\""<<height<<"\">"<<std::endl;
  *savefile << "<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3100\" height=\"1600\" /> "<<std::endl; 
  *savefile << "<svg:g id=\"tracker\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
   }
  for (int layer=1; layer < 44; layer++){
    nlay=layer;
    defwindow(nlay);
    for (int ring=firstRing[layer-1]; ring < ntotRing[layer-1]+firstRing[layer-1];ring++){
      for (int module=1;module<200;module++) {
        int key=layer*100000+ring*1000+module;
        TmModule * mod = smoduleMap[key];
        if(mod !=0 && !mod->notInUse()){
          drawModule(mod,key,layer,print_total,savefile);
        }
      }
    }
  }
  
  if(!temporary_file){
    *savefile << "</svg:g>"<<std::endl;
    *savefile << " <svg:text id=\"Title\" class=\"normalText\"  x=\"300\" y=\"0\">"<<title<<"</svg:text>"<<std::endl;
  }
  
  if(printflag)drawPalette(savefile);
  if(!temporary_file){
    *savefile << "</svg:svg>"<<std::endl;
    *savefile << "</svg>"<<std::endl;
  }
  savefile->close(); delete savefile;

  const char * command1;
  std::string tempfilename = outputfilename + ".coor";
  if(filetype=="svg"){
    std::string command = "mv "+tempfilename +" " +outputfilename + ".svg";
    command1=command.c_str();
    std::cout << "Executing " << command1 << std::endl;
    system(command1);
  }
  
  if (temporary_file){ // create root trackermap image
    int red,green,blue,npoints,colindex,ncolor;
    double x[4],y[4];
    ifstream tempfile(tempfilename.c_str(),std::ios::in);
    TCanvas *MyC = new TCanvas("MyC", "TrackerMap",width,height);
    gPad->SetFillColor(38);
    
    if(addPixelFlag)gPad->Range(0,0,3800,1600);else gPad->Range(800,0,3800,1600);
    
    //First  build palette
    ncolor=0;
    typedef std::map<int,int> ColorList;
    ColorList colorList;
    ColorList::iterator pos;
    TColor *col, *c;
    std::cout<<"tempfilename "<<tempfilename<<std::endl;
    while(!tempfile.eof()) {
      tempfile  >> red >> green  >> blue >> npoints; 
      colindex=red+green*1000+blue*1000000;
      pos=colorList.find(colindex); 
      if(pos == colorList.end()){ colorList[colindex]=ncolor+100; col =gROOT->GetColor(ncolor+100);
      if(col) col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.)); else c = new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));vc.push_back(c); ncolor++;}
      for (int i=0;i<npoints;i++){
        tempfile >> x[i] >> y[i];  
      }
    }
   
    if(ncolor>0 && ncolor<10000){
      Int_t colors[10000];
      for(int i=0;i<ncolor;i++){colors[i]=i+100;}
      gStyle->SetPalette(ncolor,colors);
    }
    
    tempfile.clear();
    tempfile.seekg(0,std::ios::beg);
    std::cout << "created palette with " << ncolor << " colors" << std::endl;
  
    while(!tempfile.eof()) {//create polylines
      tempfile  >> red >> green  >> blue >> npoints; 
      for (int i=0;i<npoints;i++){
        tempfile >> x[i] >> y[i];  
      }
      colindex=red+green*1000+blue*1000000;
      pos=colorList.find(colindex); 
      if(pos != colorList.end()){
        TPolyLine*  pline = new TPolyLine(npoints,y,x);
        vp.push_back(pline);
        pline->SetFillColor(colorList[colindex]);
        pline->SetLineWidth(0);
        pline->Draw("f");
      }
    }
    if (printflag) {
      axis = new TGaxis(3660,36,3660,1530,minvalue,maxvalue,510,"+L");
      axis->SetLabelSize(0.02);
      axis->Draw();
    }
    TLatex l;
    l.SetTextSize(0.03);
    l.DrawLatex(950,1330,"TID");
    l.DrawLatex(2300,1330,"TEC");
    l.DrawLatex(300,1330,"FPIX");
    l.DrawLatex(20,560,"BPIX L1");
    l.DrawLatex(500,385,"BPIX L2");
    l.DrawLatex(500,945,"BPIX L3");
    l.SetTextSize(0.04);
    l.DrawLatex(850,1500,title.c_str());
    l.DrawLatex(1730,40,"-z");
    l.DrawLatex(1730,1360,"+z");
    l.DrawLatex(1085,330,"TIB L1");
    l.DrawLatex(1085,1000,"TIB L2");
    l.DrawLatex(1585,330,"TIB L3");
    l.DrawLatex(1585,1000,"TIB L4");
    l.DrawLatex(2085,330,"TOB L1");
    l.DrawLatex(2085,1000,"TOB L2");
    l.DrawLatex(2585,330,"TOB L3");
    l.DrawLatex(2585,1000,"TOB L4");
    l.DrawLatex(3085,330,"TOB L5");
    l.DrawLatex(3085,1000,"TOB L6");
    TArrow arx(3448,1190,3448,1350,0.01,"|>");
    l.DrawLatex(3460,1350,"x");
    TArrow ary(3448,1190,3312,1190,0.01,"|>");
    l.DrawLatex(3312,1210,"y");
    TArrow arz(3485,373,3485,676,0.01,"|>");
    l.DrawLatex(3510,667,"z");
    TArrow arphi(3485,511,3037,511,0.01,"|>");
    l.DrawLatex(3023,520,"#Phi");
    arx.SetLineWidth(3);
    ary.SetLineWidth(3);
    arz.SetLineWidth(3);
    arphi.SetLineWidth(3);
    arx.Draw();
    ary.Draw();
    arz.Draw();
    arphi.Draw();
    MyC->Update();
    if(filetype=="png"){
      
      std::string filename = outputfilename + ".png";
      std::cout << "printing " <<filename<< std::endl;
      MyC->Print(filename.c_str());
    }
    if(filetype=="jpg"){
      std::string filename = outputfilename + ".jpg";
      MyC->Print(filename.c_str());
    }
    if(filetype=="pdf"){
      std::string filename = outputfilename + ".pdf";
      MyC->Print(filename.c_str());
    }
    std::string command = "rm "+tempfilename ;
    command1=command.c_str();
    std::cout << "Executing " << command1 << std::endl;
    system(command1);
    MyC->Clear();
    delete MyC;
    if (printflag)delete axis;
    for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
         delete (*pos1);}
    
  }

  
}
void TrackerMap::save_as_fectrackermap ( bool  print_total = true,
float  minval = 0.,
float  maxval = 0.,
std::string  s = "fec_svgmap.svg",
int  width = 1500,
int  height = 800 
)

Definition at line 1194 of file TrackerMap.cc.

References TmCcu::blue, trackerHits::c, ccuMap, colors, edmPickEvents::command, TmCcu::count, gather_cfg::cout, deffecwindow(), drawCcu(), enableFecProcessing, fecModuleMap, lut2db_cfg::filename, alcaDQMUpload::filetype(), newFWLiteAna::found, TmCcu::getCcuCrate(), TmCcu::getCcuSlot(), cmsRelvalreport::green(), TmCcu::green, i, recoMuon::in, maxvalue, minvalue, ncrate, nfeccrates, TmCcu::nmod, dbtoconf::out, pos, TmCcu::red, cmsRelvalreport::red(), run_regression::ret, alignCSCRings::s, saveAsSingleLayer, savefile, temporary_file, title, TmCcu::value, relativeConstraints::value, vc, x, and detailsBasic3DVector::y.

Referenced by printall(), and printonline().

                                                                                                                   {
 if(enableFecProcessing){
  std::string filetype=s,outputfilename=s;
  std::vector<TPolyLine*> vp;
  size_t found=filetype.find_last_of(".");
  filetype=filetype.substr(found+1);
  found=outputfilename.find_last_of(".");
  outputfilename=outputfilename.substr(0,found); 
  temporary_file=true;
  if(filetype=="xml"||filetype=="svg")temporary_file=false;
  std::ostringstream outs;
  minvalue=minval; maxvalue=maxval;
  outs << outputfilename << ".coor";
  if(temporary_file)savefile = new std::ofstream(outs.str().c_str(),std::ios::out);
   std::map<int , TmCcu *>::iterator i_ccu;
   std::multimap<TmCcu*, TmModule*>::iterator it;
   std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator> ret;
  //Decide if we must use Module or Ccu value
  bool useCcuValue=false;
  
  
  for( i_ccu=ccuMap.begin();i_ccu !=ccuMap.end(); i_ccu++){
    TmCcu *  ccu= i_ccu->second;
    if(ccu!=0) {
        if(ccu->count > 0 || ccu->red!=-1) { useCcuValue=true; break;}
      }
    }
 
  
  if(!useCcuValue)//store mean of connected modules value{
    for(  i_ccu=ccuMap.begin();i_ccu !=ccuMap.end(); i_ccu++){
    TmCcu *  ccu= i_ccu->second;
      if(ccu!=0) {
            ret = fecModuleMap.equal_range(ccu);
        for (it = ret.first; it != ret.second; ++it)
          {
           if( (*it).second->count>0){ccu->value=ccu->value+(*it).second->value;ccu->count++;}
          }
          if(ccu->count>0)ccu->value=ccu->value/ccu->count;
          if(ccu->nmod==0)  { ccu->red=0;ccu->green=0;ccu->blue=0;}
          }
          }
  
 
  if(title==" Tracker Map from  QTestAlarm"){
      for(  i_ccu=ccuMap.begin();i_ccu !=ccuMap.end(); i_ccu++){
          TmCcu *  ccu= i_ccu->second;
          if(ccu!=0) {
            ret = fecModuleMap.equal_range(ccu);
            ccu->red=0;ccu->green=255;ccu->blue=0;
            for (it = ret.first; it != ret.second; ++it) {
              if( !( (*it).second->red==0 && (*it).second->green==255 && (*it).second->blue==0 ) && !( (*it).second->red==255 && (*it).second->green==255 && (*it).second->blue==255 ) ){
                ccu->red=255;ccu->green=0;ccu->blue=0;
                }
              }
           }
      }
   }
  

  
  if(!print_total){
    for(  i_ccu=ccuMap.begin();i_ccu !=ccuMap.end(); i_ccu++){
    TmCcu *  ccu= i_ccu->second;
      if(ccu!=0) {
          if(useCcuValue) ccu->value = ccu->value / ccu->count;

        }
    }
  }
 
  if(minvalue>=maxvalue){

    minvalue=9999999.;
    maxvalue=-9999999.;
    for( i_ccu=ccuMap.begin();i_ccu !=ccuMap.end(); i_ccu++){
       TmCcu *  ccu= i_ccu->second;
       if(ccu!=0) {
              if (minvalue > ccu->value)minvalue=ccu->value;
              if (maxvalue < ccu->value)maxvalue=ccu->value;
        }
    }
  }


  
 if(filetype=="svg"){
      saveAsSingleLayer=false;
      std::ostringstream outs;
    outs << outputfilename<<".svg";
    savefile = new std::ofstream(outs.str().c_str(),std::ios::out);
  *savefile << "<?xml version=\"1.0\"  standalone=\"no\" ?>"<<std::endl;
  *savefile << "<svg  xmlns=\"https://www.w3.org/2000/svg\""<<std::endl;
  *savefile << "xmlns:svg=\"https://www.w3.org/2000/svg\" "<<std::endl;
  *savefile << "xmlns:xlink=\"https://www.w3.org/1999/xlink\">"<<std::endl;
  *savefile << "<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<"\" width=\""<<width<<"\" height=\""<<height<<"\">"<<std::endl;
  *savefile << "<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
  *savefile << "<svg:g id=\"fedtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
     }
  for (int crate=1; crate < (nfeccrates+1); crate++){
    if(filetype=="xml"){
      saveAsSingleLayer=true;
      std::ostringstream outs;
    outs << outputfilename<<"feccrate" <<crate<< ".xml";
    savefile = new std::ofstream(outs.str().c_str(),std::ios::out);
    *savefile << "<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
    *savefile << "<svg xmlns=\"https://www.w3.org/2000/svg\""<<std::endl;
    *savefile << "xmlns:svg=\"https://www.w3.org/2000/svg\""<<std::endl;
    *savefile << "xmlns:xlink=\"https://www.w3.org/1999/xlink\" >"<<std::endl;
    *savefile << "<script type=\"text/ecmascript\" xlink:href=\"feccrate.js\" />"<<std::endl;
    *savefile << "<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0  500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
    *savefile << "<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
    *savefile << "<g id=\"crate\" transform=\" translate(280,580) rotate(270) scale(.7,.8)\"  > "<<std::endl;
         }
    ncrate=crate;
    deffecwindow(ncrate);
 
    for ( i_ccu=ccuMap.begin();i_ccu !=ccuMap.end(); i_ccu++){
      TmCcu *  ccu= i_ccu->second;
      if(ccu!=0){
        if(ccu->getCcuCrate() == crate){
              
              drawCcu(crate,ccu->getCcuSlot()-2,print_total,ccu,savefile,useCcuValue);
        }
      }
    }
 
   if(!temporary_file){
    if(filetype=="xml"){
    *savefile << "</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
    *savefile << "<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
    *savefile << "<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
    *savefile << " </text> </svg>" << std::endl;
    savefile->close();
     saveAsSingleLayer=false;
      }
      }
    }
    if(filetype=="svg"){
    *savefile << "</g> </svg> </svg> " << std::endl;
    savefile->close();
      }
  if(!print_total && !useCcuValue){
//Restore ccu value
    for( i_ccu=ccuMap.begin();i_ccu !=ccuMap.end(); i_ccu++){
       TmCcu *  ccu= i_ccu->second;
       if(ccu!=0) {
          ccu->value = ccu->value * ccu->count;
    }
}
}
 if(temporary_file){
   // if(printflag)drawPalette(savefile);
  savefile->close();

  const char * command1;
  std::string tempfilename = outputfilename + ".coor";
    int red,green,blue,npoints,colindex,ncolor;
    double x[4],y[4];
    ifstream tempfile(tempfilename.c_str(),std::ios::in);
    TCanvas *MyC = new TCanvas("MyC", "TrackerMap",width,height);
    gPad->SetFillColor(38);

    gPad->Range(0,0,3700,1600);

    //First  build palette
    ncolor=0;
    typedef std::map<int,int> ColorList;
    ColorList colorList;
    ColorList::iterator pos;
    TColor *col,*c;
    while(!tempfile.eof()) {
      tempfile  >> red >> green  >> blue >> npoints;
      colindex=red+green*1000+blue*1000000;
      pos=colorList.find(colindex);
      if(pos == colorList.end()){
        colorList[colindex]=ncolor+100;
        col =gROOT->GetColor(ncolor+100);
        if(col)
          col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
        else
          c = new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
          vc.push_back(c);
        ncolor++;
      }
      for (int i=0;i<npoints;i++){
        tempfile >> x[i] >> y[i];
      }
    }
    if(ncolor>0 && ncolor<10000){
      Int_t colors[10000];
      for(int i=0;i<ncolor;i++){colors[i]=i+100;}
      gStyle->SetPalette(ncolor,colors);
    }
    tempfile.clear();
    tempfile.seekg(0,std::ios::beg);
    std::cout << "created palette with " << ncolor << " colors" << std::endl;
    while(!tempfile.eof()) {//create polylines
      tempfile  >> red >> green  >> blue >> npoints;
      for (int i=0;i<npoints;i++){
        tempfile >> x[i] >> y[i];
      }
      colindex=red+green*1000+blue*1000000;
      pos=colorList.find(colindex);
      if(pos != colorList.end()){
        TPolyLine*  pline = new TPolyLine(npoints,y,x);
        vp.push_back(pline);
        pline->SetFillColor(colorList[colindex]);
        pline->SetLineWidth(0);
        pline->Draw("f");
      }
    }
    MyC->Update();
    std::cout << "Filetype " << filetype << std::endl;
    if(filetype=="png"){
      std::string filename = outputfilename + ".png";
      MyC->Print(filename.c_str());
    }
    if(filetype=="jpg"){
      std::string filename = outputfilename + ".jpg";
      MyC->Print(filename.c_str());
    }
    if(filetype=="pdf"){
      std::string filename = outputfilename + ".pdf";
      MyC->Print(filename.c_str());
    }
    std::string command = "rm "+tempfilename ;
    command1=command.c_str();
    std::cout << "Executing " << command1 << std::endl;
    system(command1);
    MyC->Clear();
    delete MyC;
    for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
         delete (*pos1);}
   



}//if(temporary_file)
}//if(enabledFecProcessing)
}
void TrackerMap::save_as_fedtrackermap ( bool  print_total = true,
float  minval = 0.,
float  maxval = 0.,
std::string  s = "fed_svgmap.svg",
int  width = 1500,
int  height = 800 
)

Definition at line 1950 of file TrackerMap.cc.

References apvMap, trackerHits::c, colors, edmPickEvents::command, TmModule::count, TmApvPair::count, gather_cfg::cout, defcwindow(), drawApvPair(), enableFedProcessing, fedMap, lut2db_cfg::filename, alcaDQMUpload::filetype(), newFWLiteAna::found, cmsRelvalreport::green(), i, recoMuon::in, combine::key, maxvalue, minvalue, TmApvPair::mod, TmApvPair::mpos, ncrate, ncrates, TmModule::notInUse(), dbtoconf::out, pos, TmApvPair::red, cmsRelvalreport::red(), alignCSCRings::s, saveAsSingleLayer, savefile, temporary_file, TmApvPair::value, TmModule::value, relativeConstraints::value, vc, x, and detailsBasic3DVector::y.

Referenced by BuildTrackerMapPlugin::endJob(), printall(), and printonline().

                                                                                                                   {
 if(enableFedProcessing){
  std::string filetype=s,outputfilename=s;
  std::vector<TPolyLine*> vp;
  
  size_t found=filetype.find_last_of(".");
  filetype=filetype.substr(found+1);
  found=outputfilename.find_last_of(".");
  outputfilename=outputfilename.substr(0,found);
  
  temporary_file=true;
  if(filetype=="xml"||filetype=="svg")temporary_file=false;
  std::ostringstream outs;
  minvalue=minval; maxvalue=maxval;
  outs << outputfilename << ".coor";
  if(temporary_file)savefile = new std::ofstream(outs.str().c_str(),std::ios::out);
  std::map<int , TmApvPair *>::iterator i_apv;
  std::map<int , int>::iterator i_fed;
  //Decide if we must use Module or ApvPair value
  bool useApvPairValue=false;
  for( i_apv=apvMap.begin();i_apv !=apvMap.end(); i_apv++){
    TmApvPair *  apvPair= i_apv->second;
    if(apvPair!=0) {
      TmModule * apv_mod = apvPair->mod;
      if(apv_mod !=0 && !apv_mod->notInUse()){
        if(apvPair->count > 0 || apvPair->red!=-1) { useApvPairValue=true; break;}
      }
    }
  }
  if(!print_total){
    for( i_apv=apvMap.begin();i_apv !=apvMap.end(); i_apv++){
      TmApvPair *  apvPair= i_apv->second;
      if(apvPair!=0) {
        TmModule * apv_mod = apvPair->mod;
        if(apv_mod !=0 && !apv_mod->notInUse()){
          if(useApvPairValue) apvPair->value = apvPair->value / apvPair->count;
          else if(apvPair->mpos==0)apv_mod->value = apv_mod->value / apv_mod->count;
        }
      }
    }
  }
  if(minvalue>=maxvalue){
    
    minvalue=9999999.;
    maxvalue=-9999999.;
    for(i_apv=apvMap.begin();i_apv !=apvMap.end(); i_apv++){
        TmApvPair *  apvPair= i_apv->second;
        if(apvPair!=0) {
          TmModule * apv_mod = apvPair->mod;
          if( apv_mod !=0 && !apv_mod->notInUse()){
            if(useApvPairValue){
              if (minvalue > apvPair->value)minvalue=apvPair->value;
              if (maxvalue < apvPair->value)maxvalue=apvPair->value;
            } else {
              if (minvalue > apv_mod->value)minvalue=apv_mod->value;
              if (maxvalue < apv_mod->value)maxvalue=apv_mod->value;
            }
          }
        }
    }
  }
     if(filetype=="svg"){
      saveAsSingleLayer=false;
      std::ostringstream outs;
    outs << outputfilename<<".svg";
    savefile = new std::ofstream(outs.str().c_str(),std::ios::out);
  *savefile << "<?xml version=\"1.0\"  standalone=\"no\" ?>"<<std::endl;
  *savefile << "<svg  xmlns=\"https://www.w3.org/2000/svg\""<<std::endl;
  *savefile << "xmlns:svg=\"https://www.w3.org/2000/svg\" "<<std::endl;
  *savefile << "xmlns:xlink=\"https://www.w3.org/1999/xlink\">"<<std::endl;
  *savefile << "<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<"\" width=\""<<width<<"\" height=\""<<height<<"\">"<<std::endl;
  *savefile << "<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl; 
  *savefile << "<svg:g id=\"fedtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
     }
  for (int crate=1; crate < (ncrates+1); crate++){
    if(filetype=="xml"){
      saveAsSingleLayer=true;
      std::ostringstream outs;
    outs << outputfilename<<"crate" <<crate<< ".xml";
    savefile = new std::ofstream(outs.str().c_str(),std::ios::out);
    *savefile << "<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
    *savefile << "<svg xmlns=\"https://www.w3.org/2000/svg\""<<std::endl;
    *savefile << "xmlns:svg=\"https://www.w3.org/2000/svg\""<<std::endl;
    *savefile << "xmlns:xlink=\"https://www.w3.org/1999/xlink\" >"<<std::endl;
    *savefile << "<script type=\"text/ecmascript\" xlink:href=\"crate.js\" />"<<std::endl;
    *savefile << "<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0  500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
    *savefile << "<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
    *savefile << "<g id=\"crate\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\"  > "<<std::endl;
         }
    ncrate=crate;
    defcwindow(ncrate);
    int numfed_incrate=0;
    for (i_fed=fedMap.begin();i_fed != fedMap.end(); i_fed++){
      if(i_fed->second == crate){
        int fedId = i_fed->first;
        numfed_incrate++;
        for (int nconn=0;nconn<96;nconn++){
          int key = fedId*1000+nconn; 
          TmApvPair *  apvPair= apvMap[key];
          if(apvPair !=0){
            TmModule * apv_mod = apvPair->mod;
            if(apv_mod !=0 && !apv_mod->notInUse()){
              drawApvPair(crate,numfed_incrate,print_total,apvPair,savefile,useApvPairValue);
            }
          } 
        }
      }
    }
   if(!temporary_file){
    if(filetype=="xml"){
    *savefile << "</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
    *savefile << "<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
    *savefile << "<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
    *savefile << " </text> </svg>" << std::endl;
    savefile->close();delete savefile;
     saveAsSingleLayer=false;
      }
      }
    }
    if(filetype=="svg"){
    *savefile << "</g> </svg> </svg> " << std::endl;
    savefile->close();delete savefile;
      }
  if(!print_total && !useApvPairValue){
//Restore module value
    for( i_apv=apvMap.begin();i_apv !=apvMap.end(); i_apv++){
      TmApvPair *  apvPair= i_apv->second;
      if(apvPair!=0) {
        TmModule * apv_mod = apvPair->mod;
        if(apv_mod !=0 && apvPair->mpos==0 && !apv_mod->notInUse()){
          apv_mod->value = apv_mod->value * apv_mod->count;
        }
      }
    }
}
  
  if(temporary_file){
    //if(printflag)drawPalette(savefile);
  savefile->close(); delete savefile;

  const char * command1;
  std::string tempfilename = outputfilename + ".coor";
    int red,green,blue,npoints,colindex,ncolor;
    double x[4],y[4];
    ifstream tempfile(tempfilename.c_str(),std::ios::in);
    TCanvas *MyC = new TCanvas("MyC", "TrackerMap",width,height);
    gPad->SetFillColor(38);
    
    gPad->Range(0,0,3750,1600);
    
    //First  build palette
    ncolor=0;
    typedef std::map<int,int> ColorList;
    ColorList colorList;
    ColorList::iterator pos;
    TColor *col,*c;
    while(!tempfile.eof()) {
      tempfile  >> red >> green  >> blue >> npoints; 
      colindex=red+green*1000+blue*1000000;
      pos=colorList.find(colindex); 
      if(pos == colorList.end()){ 
        colorList[colindex]=ncolor+100; 
        col =gROOT->GetColor(ncolor+100);
        if(col) 
          col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.)); 
        else 
          c = new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
        vc.push_back(c);
        ncolor++;
      }
      for (int i=0;i<npoints;i++){
        tempfile >> x[i] >> y[i];  
      }
    }
    if(ncolor>0 && ncolor<10000){
      Int_t colors[10000];
      for(int i=0;i<ncolor;i++){colors[i]=i+100;}
      gStyle->SetPalette(ncolor,colors);
    }
    tempfile.clear();
    tempfile.seekg(0,std::ios::beg);
    std::cout << "created palette with " << ncolor << " colors" << std::endl;
    while(!tempfile.eof()) {//create polylines
      tempfile  >> red >> green  >> blue >> npoints; 
      for (int i=0;i<npoints;i++){
        tempfile >> x[i] >> y[i];  
      }
      colindex=red+green*1000+blue*1000000;
      pos=colorList.find(colindex); 
      if(pos != colorList.end()){
        TPolyLine*  pline = new TPolyLine(npoints,y,x);
        vp.push_back(pline);
        pline->SetFillColor(colorList[colindex]);
        pline->SetLineWidth(0);
        pline->Draw("f");
      }
    }
    MyC->Update();
    std::cout << "Filetype " << filetype << std::endl;
    if(filetype=="png"){
      std::string filename = outputfilename + ".png";
      MyC->Print(filename.c_str());
    }
    if(filetype=="jpg"){
      std::string filename = outputfilename + ".jpg";
      MyC->Print(filename.c_str());
    }
    if(filetype=="pdf"){
      std::string filename = outputfilename + ".pdf";
      MyC->Print(filename.c_str());
    }
    std::string command = "rm "+tempfilename ;
    command1=command.c_str();
    std::cout << "Executing " << command1 << std::endl;
    system(command1);
    MyC->Clear();
    delete MyC;
    for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
         delete (*pos1);}
   
  
}//if(temporary_file)
}//if(enabledFedProcessing)
}
void TrackerMap::save_as_HVtrackermap ( bool  print_total = true,
float  minval = 0.,
float  maxval = 0.,
std::string  s = "psu_svgmap.svg",
int  width = 1500,
int  height = 800 
)

Definition at line 1435 of file TrackerMap.cc.

References TmPsu::blueHV2, TmPsu::blueHV3, trackerHits::c, colors, edmPickEvents::command, TmPsu::countHV2, TmPsu::countHV3, gather_cfg::cout, defpsuwindow(), drawHV2(), drawHV3(), enableHVProcessing, lut2db_cfg::filename, alcaDQMUpload::filetype(), newFWLiteAna::found, TmPsu::getPsuCrate(), TmPsu::getPsuRack(), cmsRelvalreport::green(), TmPsu::greenHV2, TmPsu::greenHV3, i, recoMuon::in, max(), maxvalue, min, minvalue, TmPsu::nmodHV2, TmPsu::nmodHV3, npsuracks, nrack, dbtoconf::out, pos, psuMap, psuModuleMap, cmsRelvalreport::red(), TmPsu::redHV2, TmPsu::redHV3, run_regression::ret, alignCSCRings::s, saveAsSingleLayer, savefile, temporary_file, title, TmPsu::valueHV2, TmPsu::valueHV3, vc, x, and detailsBasic3DVector::y.

Referenced by printall(), and printonline().

                                                                                                                  {
  
 if(enableHVProcessing){
  std::string filetype=s,outputfilename=s;
  std::vector<TPolyLine*> vp;
  
  size_t found=filetype.find_last_of(".");
  filetype=filetype.substr(found+1);
  found=outputfilename.find_last_of(".");
  outputfilename=outputfilename.substr(0,found);

  temporary_file=true;
  

  if(filetype=="xml"||filetype=="svg")temporary_file=false;
  
  std::ostringstream outs;
  minvalue=minval; maxvalue=maxval;
  outs << outputfilename << ".coor";
  if(temporary_file)savefile = new std::ofstream(outs.str().c_str(),std::ios::out);
  
  std::map<int , TmPsu *>::iterator ipsu;
  std::multimap<TmPsu*, TmModule*>::iterator it;
  std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator> ret;
 
  
  bool usePsuValue=false;
  
  for( ipsu=psuMap.begin();ipsu!=psuMap.end(); ipsu++){
    TmPsu*  psu= ipsu->second;
    if(psu!=0) {
      if(psu->countHV2 > 0 || psu->redHV2!=-1 || psu->countHV3 > 0 || psu->redHV3!=-1) { usePsuValue=true; break;}
      }
    }
   
  if(!usePsuValue){//store mean of connected modules value{
    
    for(  ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
       TmPsu *  psu= ipsu->second;
       if(psu!=0) {
       ret = psuModuleMap.equal_range(psu);
         for(it = ret.first; it != ret.second; ++it){
           if((*it).second->HVchannel==2){ psu->valueHV2=psu->valueHV2+(*it).second->value;}
           if((*it).second->HVchannel==3){ psu->valueHV3=psu->valueHV3+(*it).second->value;} 
            }
         if(psu->nmodHV2!=0){psu->valueHV2=psu->valueHV2/psu->nmodHV2;}
         if(psu->nmodHV3!=0){psu->valueHV3=psu->valueHV3/psu->nmodHV3;}
         psu->countHV2=1;
         psu->countHV3=1; 
          
           }
         
         }
       }
   
   if(title==" Tracker Map from  QTestAlarm"){
      for(  ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
          TmPsu *  psu= ipsu->second;
          if(psu!=0) {
            ret = psuModuleMap.equal_range(psu);
            psu->redHV2=0;psu->greenHV2=255;psu->blueHV2=0;
            psu->redHV3=0;psu->greenHV3=255;psu->blueHV3=0;
            for (it = ret.first; it != ret.second; ++it) {
              if((*it).second->HVchannel==2){
                if( !( (*it).second->red==0 && (*it).second->green==255 && (*it).second->blue==0 ) && !( (*it).second->red==255 && (*it).second->green==255 && (*it).second->blue==255 ) ){
                   psu->redHV2=255;psu->greenHV2=0;psu->blueHV2=0;
                   }
                }
              if((*it).second->HVchannel==3){
                if( !( (*it).second->red==0 && (*it).second->green==255 && (*it).second->blue==0 ) && !( (*it).second->red==255 && (*it).second->green==255 && (*it).second->blue==255 ) ){
                   psu->redHV3=255;psu->greenHV3=0;psu->blueHV3=0;
                   }
                }
             }
           }
      }
   } 
 
  if(!print_total){
    for(  ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
    TmPsu *  psu= ipsu->second;
      if(psu!=0) {
          if(usePsuValue){ 
            psu->valueHV2 = psu->valueHV2 / psu->countHV2;
            psu->valueHV3 = psu->valueHV3 / psu->countHV3;
        }
    }
  }
 } 
  
  if(minvalue>=maxvalue){
    
    minvalue=9999999.;
    maxvalue=-9999999.;
    
    for( ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
       TmPsu *  psu= ipsu->second;
       if(psu!=0) {
              if (minvalue > psu->valueHV2 || minvalue > psu->valueHV3)minvalue=std::min(psu->valueHV2,psu->valueHV3);
              if (maxvalue < psu->valueHV2 || maxvalue < psu->valueHV3)maxvalue=std::max(psu->valueHV2,psu->valueHV3);
              
        
        }
    }
  }
  
     if(filetype=="svg"){
      saveAsSingleLayer=false;
      std::ostringstream outs;
    outs << outputfilename<<".svg";
    savefile = new std::ofstream(outs.str().c_str(),std::ios::out);
  *savefile << "<?xml version=\"1.0\"  standalone=\"no\" ?>"<<std::endl;
  *savefile << "<svg  xmlns=\"https://www.w3.org/2000/svg\""<<std::endl;
  *savefile << "xmlns:svg=\"https://www.w3.org/2000/svg\" "<<std::endl;
  *savefile << "xmlns:xlink=\"https://www.w3.org/1999/xlink\">"<<std::endl;
  *savefile << "<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<"\" width=\""<<width<<"\" height=\""<<height<<"\">"<<std::endl;
  *savefile << "<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl; 
  *savefile << "<svg:g id=\"HVtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
     }
   
  for (int irack=1; irack < (npsuracks+1); irack++){
    if(filetype=="xml"){
      saveAsSingleLayer=true;
      std::ostringstream outs;
    outs << outputfilename<<"HVrack" <<irack<< ".xml";
    savefile = new std::ofstream(outs.str().c_str(),std::ios::out);
    *savefile << "<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
    *savefile << "<svg xmlns=\"https://www.w3.org/2000/svg\""<<std::endl;
    *savefile << "xmlns:svg=\"https://www.w3.org/2000/svg\""<<std::endl;
    *savefile << "xmlns:xlink=\"https://www.w3.org/1999/xlink\" >"<<std::endl;
    *savefile << "<script type=\"text/ecmascript\" xlink:href=\"rackhv.js\" />"<<std::endl;
    *savefile << "<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0  500 500\" width=\"700\" height=\"700\" onload=\"TrackerRackhv.init()\">"<<std::endl;
    *savefile << "<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
    *savefile << "<g id=\"rackhv\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\"  > "<<std::endl;
         }
    
    nrack=irack;
    defpsuwindow(nrack);
    for ( ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
      TmPsu *  psu= ipsu->second;
      if(psu->getPsuRack() == irack){
              drawHV2(irack,psu->getPsuCrate(),print_total,psu,savefile,usePsuValue);
              drawHV3(irack,psu->getPsuCrate(),print_total,psu,savefile,usePsuValue);
      }
    }
   
  
   if(!temporary_file){
    if(filetype=="xml"){
    *savefile << "</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
    *savefile << "<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
    *savefile << "<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
    *savefile << " </text> </svg>" << std::endl;
    savefile->close();
     saveAsSingleLayer=false;
      }
      }
    }
    if(filetype=="svg"){
    *savefile << "</g> </svg> </svg> " << std::endl;
    savefile->close();
      }
 
    //Restore psu value
    if(!print_total && !usePsuValue){
     for( ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
       TmPsu *psu = ipsu->second;
       if(psu!=0) {
          psu->valueHV2 = psu->valueHV2 * psu->countHV2;
          psu->valueHV3 = psu->valueHV3 * psu->countHV3;
          }
       }
     }
  

  if(temporary_file){
 //   if(printflag)drawPalette(savefile);
    savefile->close(); 

  const char * command1;
  std::string tempfilename = outputfilename + ".coor";
    int red,green,blue,npoints,colindex,ncolor;
    double x[4],y[4];
    ifstream tempfile(tempfilename.c_str(),std::ios::in);
    TCanvas *MyC = new TCanvas("MyC", "TrackerMap",width,height);
    gPad->SetFillColor(38);
    
    gPad->Range(0,0,3700,1600);
    
    //First  build palette
    ncolor=0;
    typedef std::map<int,int> ColorList;
    ColorList colorList;
    ColorList::iterator pos;
    TColor *col,*c;
    while(!tempfile.eof()) {
      tempfile  >> red >> green  >> blue >> npoints; 
      colindex=red+green*1000+blue*1000000;
      pos=colorList.find(colindex); 
      if(pos == colorList.end()){ 
        colorList[colindex]=ncolor+100; 
        col =gROOT->GetColor(ncolor+100);
        if(col) 
          col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.)); 
        else 
          c = new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
          vc.push_back(c);
        ncolor++;
      }
      for (int i=0;i<npoints;i++){
        tempfile >> x[i] >> y[i];  
      }
    }
    if(ncolor>0 && ncolor<10000){
      Int_t colors[10000];
      for(int i=0;i<ncolor;i++){colors[i]=i+100;}
      gStyle->SetPalette(ncolor,colors);
    }
    tempfile.clear();
    tempfile.seekg(0,std::ios::beg);
    std::cout << "created palette with " << ncolor << " colors" << std::endl;
    while(!tempfile.eof()) {//create polylines
      tempfile  >> red >> green  >> blue >> npoints; 
      for (int i=0;i<npoints;i++){
        tempfile >> x[i] >> y[i];  
      }
      colindex=red+green*1000+blue*1000000;
      pos=colorList.find(colindex); 
      if(pos != colorList.end()){
        TPolyLine*  pline = new TPolyLine(npoints,y,x);
        vp.push_back(pline);
        pline->SetFillColor(colorList[colindex]);
        pline->SetLineWidth(0);
        pline->Draw("f");
      }
    }
    MyC->Update();
    std::cout << "Filetype " << filetype << std::endl;
    if(filetype=="png"){
      std::string filename = outputfilename + ".png";
      MyC->Print(filename.c_str());
    }
    if(filetype=="jpg"){
      std::string filename = outputfilename + ".jpg";
      MyC->Print(filename.c_str());
    }
    if(filetype=="pdf"){
      std::string filename = outputfilename + ".pdf";
      MyC->Print(filename.c_str());
    }
    std::string command = "rm "+tempfilename ;
    command1=command.c_str();
    std::cout << "Executing " << command1 << std::endl;
    system(command1);
    MyC->Clear();
    delete MyC;
    for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
         delete (*pos1);}
    
         
         }//if(temporary_file)
}//if(enabledHVProcessing)
}
void TrackerMap::save_as_psutrackermap ( bool  print_total = true,
float  minval = 0.,
float  maxval = 0.,
std::string  s = "psu_svgmap.svg",
int  width = 1500,
int  height = 800 
)

Definition at line 1700 of file TrackerMap.cc.

References TmPsu::blue, trackerHits::c, colors, edmPickEvents::command, TmPsu::count, gather_cfg::cout, defpsuwindow(), drawPsu(), enableLVProcessing, lut2db_cfg::filename, alcaDQMUpload::filetype(), newFWLiteAna::found, TmPsu::getPsuCrate(), TmPsu::getPsuRack(), cmsRelvalreport::green(), TmPsu::green, i, recoMuon::in, maxvalue, minvalue, TmPsu::nmod, npsuracks, nrack, dbtoconf::out, pos, psuMap, psuModuleMap, TmPsu::red, cmsRelvalreport::red(), run_regression::ret, alignCSCRings::s, saveAsSingleLayer, savefile, temporary_file, title, TmPsu::value, relativeConstraints::value, vc, x, and detailsBasic3DVector::y.

Referenced by SiStripTrackerMapCreator::createForOffline(), printall(), and printonline().

                                                                                                                   {
  
 if(enableLVProcessing){
  
  std::string filetype=s,outputfilename=s;
  std::vector<TPolyLine*> vp;
  
  size_t found=filetype.find_last_of(".");
  filetype=filetype.substr(found+1);
  found=outputfilename.find_last_of(".");
  outputfilename=outputfilename.substr(0,found);
  
  temporary_file=true;
  

  
  if(filetype=="xml"||filetype=="svg")temporary_file=false;
  
  std::ostringstream outs;
  minvalue=minval; maxvalue=maxval;
  outs << outputfilename << ".coor";
  if(temporary_file)savefile = new std::ofstream(outs.str().c_str(),std::ios::out);
  
  std::map<int , TmPsu *>::iterator ipsu;
  std::multimap<TmPsu*, TmModule*>::iterator it;
  std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator> ret;
 
  //Decide if we must use Module or Power Psupply value
  bool usePsuValue=false;
  
  for( ipsu=psuMap.begin();ipsu!=psuMap.end(); ipsu++){
    TmPsu*  psu= ipsu->second;
    if(psu!=0) {
      if(psu->count > 0 || psu->red!=-1) { usePsuValue=true; break;}
      }
    }
  
  if(!usePsuValue){//store mean of connected modules value{
    for(  ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
       TmPsu *  psu= ipsu->second;
       if(psu!=0) {
         ret = psuModuleMap.equal_range(psu);
         for(it = ret.first; it != ret.second; ++it){
            psu->value=psu->value+(*it).second->value;
            
            }
         psu->value=psu->value/psu->nmod;
         psu->count=1;
     
         }
       }
    }
  
  if(title==" Tracker Map from  QTestAlarm"){
      for(  ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
          TmPsu *  psu= ipsu->second;
          if(psu!=0) {
            ret = psuModuleMap.equal_range(psu);
            psu->red=0;psu->green=255;psu->blue=0;
            for (it = ret.first; it != ret.second; ++it) {
              if( !( (*it).second->red==0 && (*it).second->green==255 && (*it).second->blue==0 ) && !( (*it).second->red==255 && (*it).second->green==255 && (*it).second->blue==255 ) ){
                psu->red=255;psu->green=0;psu->blue=0;
                }
              }
           }
      }
   }
  
  
  
  if(!print_total){
    for(  ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
    TmPsu *  psu= ipsu->second;
      if(psu!=0) {
          if(usePsuValue) psu->value = psu->value / psu->count;

        }
    }
  }
  
  if(minvalue>=maxvalue){
    
    minvalue=9999999.;
    maxvalue=-9999999.;
    for( ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
       TmPsu *  psu= ipsu->second;
       if(psu!=0) {
              if (minvalue > psu->value)minvalue=psu->value;
              if (maxvalue < psu->value)maxvalue=psu->value;
        }
    }
  }
  
     if(filetype=="svg"){
      saveAsSingleLayer=false;
      std::ostringstream outs;
    outs << outputfilename<<".svg";
    savefile = new std::ofstream(outs.str().c_str(),std::ios::out);
  *savefile << "<?xml version=\"1.0\"  standalone=\"no\" ?>"<<std::endl;
  *savefile << "<svg  xmlns=\"https://www.w3.org/2000/svg\""<<std::endl;
  *savefile << "xmlns:svg=\"https://www.w3.org/2000/svg\" "<<std::endl;
  *savefile << "xmlns:xlink=\"https://www.w3.org/1999/xlink\">"<<std::endl;
  *savefile << "<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<"\" width=\""<<width<<"\" height=\""<<height<<"\">"<<std::endl;
  *savefile << "<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl; 
  *savefile << "<svg:g id=\"psutrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
     }
  
  for (int irack=1; irack < (npsuracks+1); irack++){
    if(filetype=="xml"){
      saveAsSingleLayer=true;
      std::ostringstream outs;
    outs << outputfilename<<"psurack" <<irack<< ".xml";
    savefile = new std::ofstream(outs.str().c_str(),std::ios::out);
    *savefile << "<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
    *savefile << "<svg xmlns=\"https://www.w3.org/2000/svg\""<<std::endl;
    *savefile << "xmlns:svg=\"https://www.w3.org/2000/svg\""<<std::endl;
    *savefile << "xmlns:xlink=\"https://www.w3.org/1999/xlink\" >"<<std::endl;
    *savefile << "<script type=\"text/ecmascript\" xlink:href=\"rack.js\" />"<<std::endl;
    *savefile << "<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0  500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
    *savefile << "<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
    *savefile << "<g id=\"rack\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\"  > "<<std::endl;
         }
   
    
    nrack=irack;
    defpsuwindow(nrack);
    for ( ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
      TmPsu *  psu= ipsu->second;
      if(psu->getPsuRack() == irack){
              
              drawPsu(irack,psu->getPsuCrate(),print_total,psu,savefile,usePsuValue);
      }
    }
   
    
   if(!temporary_file){
    if(filetype=="xml"){
    *savefile << "</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
    *savefile << "<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
    *savefile << "<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
    *savefile << " </text> </svg>" << std::endl;
    savefile->close();
     saveAsSingleLayer=false;
      }
      }
    }
    if(filetype=="svg"){
    *savefile << "</g> </svg> </svg> " << std::endl;
    savefile->close();
      }
 
    //Restore psu value
    if(!print_total && !usePsuValue){
     for( ipsu=psuMap.begin();ipsu !=psuMap.end(); ipsu++){
       TmPsu *psu = ipsu->second;
       if(psu!=0) {
          psu->value = psu->value * psu->count;
          }
       }
     }
  
  
  if(temporary_file){
  //  if(printflag)drawPalette(savefile);
    savefile->close(); 

  const char * command1;
  std::string tempfilename = outputfilename + ".coor";
    int red,green,blue,npoints,colindex,ncolor;
    double x[4],y[4];
    ifstream tempfile(tempfilename.c_str(),std::ios::in);
    TCanvas *MyC = new TCanvas("MyC", "TrackerMap",width,height);
    gPad->SetFillColor(38);
    
    gPad->Range(0,0,3700,1600);
    
    //First  build palette
    ncolor=0;
    typedef std::map<int,int> ColorList;
    ColorList colorList;
    ColorList::iterator pos;
    TColor *col,*c;
    while(!tempfile.eof()) {
      tempfile  >> red >> green  >> blue >> npoints; 
      colindex=red+green*1000+blue*1000000;
      pos=colorList.find(colindex); 
      if(pos == colorList.end()){ 
        colorList[colindex]=ncolor+100; 
        col =gROOT->GetColor(ncolor+100);
        if(col) 
          col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.)); 
        else 
          c = new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
        vc.push_back(c);
        ncolor++;
      }
      for (int i=0;i<npoints;i++){
        tempfile >> x[i] >> y[i];  
      }
    }
    if(ncolor>0 && ncolor<10000){
      Int_t colors[10000];
      for(int i=0;i<ncolor;i++){colors[i]=i+100;}
      gStyle->SetPalette(ncolor,colors);
    }
    tempfile.clear();
    tempfile.seekg(0,std::ios::beg);
    std::cout << "created palette with " << ncolor << " colors" << std::endl;
    while(!tempfile.eof()) {//create polylines
      tempfile  >> red >> green  >> blue >> npoints; 
      for (int i=0;i<npoints;i++){
        tempfile >> x[i] >> y[i];  
      }
      colindex=red+green*1000+blue*1000000;
      pos=colorList.find(colindex); 
      if(pos != colorList.end()){
        TPolyLine*  pline = new TPolyLine(npoints,y,x);
        vp.push_back(pline);
        pline->SetFillColor(colorList[colindex]);
        pline->SetLineWidth(0);
        pline->Draw("f");
      }
    }
    MyC->Update();
    std::cout << "Filetype " << filetype << std::endl;
    if(filetype=="png"){
      std::string filename = outputfilename + ".png";
      MyC->Print(filename.c_str());
    }
    if(filetype=="jpg"){
      std::string filename = outputfilename + ".jpg";
      MyC->Print(filename.c_str());
    }
    if(filetype=="pdf"){
      std::string filename = outputfilename + ".pdf";
      MyC->Print(filename.c_str());
    }
    std::string command = "rm "+tempfilename ;
    command1=command.c_str();
    std::cout << "Executing " << command1 << std::endl;
    system(command1);
    MyC->Clear();
    delete MyC;
    for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
         delete (*pos1);}
   
}//if(temporary_file)
}//if(enabledFedProcessing)
}
void TrackerMap::setPalette ( int  numpalette) [inline]
void TrackerMap::setRange ( float  min,
float  max 
) [inline]
void TrackerMap::setText ( int  layer,
int  ring,
int  nmod,
std::string  s 
)

Definition at line 2570 of file TrackerMap.cc.

References gather_cfg::cout, combine::key, mod(), alignCSCRings::s, smoduleMap, and TmModule::text.

                                                                  {

  int key = layer*100000+ring*1000+nmod;
  TmModule * mod = smoduleMap[key];
  if(mod!=0){
     mod->text=s;
  }
  else std::cout << "**************************error in SvgModuleMap **************";
} 
void TrackerMap::setText ( int  idmod,
std::string  s 
)

Definition at line 2560 of file TrackerMap.cc.

References gather_cfg::cout, imoduleMap, mod(), alignCSCRings::s, and TmModule::text.

Referenced by SiStripTrackerMapCreator::paintTkMapFromAlarm(), and SiStripTrackerMapCreator::paintTkMapFromHistogram().

                                              {

  TmModule * mod = imoduleMap[idmod];
  if(mod!=0){
     mod->text=s;
  }
  else std::cout << "**************************error in IdModuleMap **************";
}
void TrackerMap::setTitle ( std::string  s) [inline]
void TrackerMap::showPalette ( bool  printflag1) [inline]

Definition at line 70 of file TrackerMap.h.

References printflag.

Referenced by BuildTrackerMapPlugin::endJob(), and SiStripBaseCondObjDQM::saveTkMap().

{printflag=printflag1;}; 
double TrackerMap::xdpixel ( double  x) [inline]

Definition at line 174 of file TrackerMap.h.

References ix, saveAsSingleLayer, xmax, xmin, and xsize.

Referenced by drawModule(), and SiPixelTrackerMap::drawModule().

                           {
    double res;
    if(saveAsSingleLayer)res= ((x-xmin)/(xmax-xmin)*xsize);
    else res= ((x-xmin)/(xmax-xmin)*xsize)+ix;
    return res;
  }
double TrackerMap::xdpixelc ( double  x) [inline]

Definition at line 194 of file TrackerMap.h.

References ix, saveAsSingleLayer, xmax, xmin, and xsize.

Referenced by drawApvPair().

                            {
    double res;
    if(saveAsSingleLayer)res= ((x-xmin)/(xmax-xmin)*xsize);
    else res= ((x-xmin)/(xmax-xmin)*xsize)+ix;
    return res;
  }
double TrackerMap::xdpixelfec ( double  x) [inline]

Definition at line 208 of file TrackerMap.h.

References ix, saveAsSingleLayer, xmax, xmin, and xsize.

Referenced by drawCcu().

                              {
    double res;
    if(saveAsSingleLayer)res= ((x-xmin)/(xmax-xmin)*xsize);
    else res= ((x-xmin)/(xmax-xmin)*xsize)+ix;
    return res;
  }
double TrackerMap::xdpixelpsu ( double  x) [inline]

Definition at line 222 of file TrackerMap.h.

References ix, saveAsSingleLayer, xmax, xmin, and xsize.

Referenced by drawHV2(), drawHV3(), and drawPsu().

                              {
    double res;
    if(saveAsSingleLayer)res= ((x-xmin)/(xmax-xmin)*xsize);
    else res= ((x-xmin)/(xmax-xmin)*xsize)+ix;
    return res;
  }
double TrackerMap::ydpixel ( double  y) [inline]

Definition at line 180 of file TrackerMap.h.

References iy, nlay, saveAsSingleLayer, xsize, ymax, ymin, and ysize.

Referenced by drawModule(), and SiPixelTrackerMap::drawModule().

                           {
    double res=0;
    double y1;
    y1 = (y-ymin)/(ymax-ymin);
    if(nlay>30)
       {
        if(nlay <34) res= 2*ysize - (y1*2*ysize);
        if(nlay==34) res= 2.4*ysize - (y1*2.4*ysize);
        if(nlay>34) res= 2.5*ysize - (y1*2.5*ysize);  
        }
    else res= xsize - (y1*xsize);
    if(!saveAsSingleLayer) res=res+iy;
    return res;
  }
double TrackerMap::ydpixelc ( double  y) [inline]

Definition at line 200 of file TrackerMap.h.

References iy, saveAsSingleLayer, ymax, ymin, and ysize.

Referenced by drawApvPair().

                            {
    double res;
    double y1;
    y1 = (y-ymin)/(ymax-ymin);
     if(saveAsSingleLayer)res= 2*ysize - (y1*2*ysize);
     else res= 2*ysize - (y1*2*ysize)+iy;
    return res;
  }
double TrackerMap::ydpixelfec ( double  y) [inline]

Definition at line 214 of file TrackerMap.h.

References iy, saveAsSingleLayer, ymax, ymin, and ysize.

Referenced by drawCcu().

                              {
    double res;
    double y1;
    y1 = (y-ymin)/(ymax-ymin);
     if(saveAsSingleLayer)res= 2*ysize - (y1*2*ysize);
     else res= 2*ysize - (y1*2*ysize)+iy;
    return res;
  }
double TrackerMap::ydpixelpsu ( double  y) [inline]

Definition at line 228 of file TrackerMap.h.

References iy, saveAsSingleLayer, ymax, ymin, and ysize.

Referenced by drawHV2(), drawHV3(), and drawPsu().

                               {
    double res;
    double y1;
    y1 = (y-ymin)/(ymax-ymin);
     if(saveAsSingleLayer)res= 2*ysize - (y1*2*ysize);
     else res= 2*ysize - (y1*2*ysize)+iy;
    return res;
  }

Member Data Documentation

bool TrackerMap::addPixelFlag [private]

Definition at line 450 of file TrackerMap.h.

Referenced by addPixel(), init(), and save().

Definition at line 89 of file TrackerMap.h.

Referenced by fill_fed_channel(), printall(), printonline(), and TrackerMap().

std::ifstream* TrackerMap::ccufile [protected]

Definition at line 440 of file TrackerMap.h.

Definition at line 103 of file TrackerMap.h.

Referenced by printall(), printonline(), save_as_fectrackermap(), and TrackerMap().

Definition at line 102 of file TrackerMap.h.

Referenced by printall(), printonline(), save_as_fedtrackermap(), and TrackerMap().

Definition at line 105 of file TrackerMap.h.

Referenced by printall(), printonline(), save_as_HVtrackermap(), and TrackerMap().

Definition at line 104 of file TrackerMap.h.

Referenced by printall(), printonline(), save_as_psutrackermap(), and TrackerMap().

Definition at line 95 of file TrackerMap.h.

Referenced by printall(), printonline(), save_as_fectrackermap(), and TrackerMap().

Definition at line 91 of file TrackerMap.h.

Referenced by printall(), printonline(), save_as_fedtrackermap(), and TrackerMap().

bool TrackerMap::firstcall [protected]

Definition at line 435 of file TrackerMap.h.

Referenced by init().

Definition at line 423 of file TrackerMap.h.

Referenced by init(), print(), printall(), printlayers(), printonline(), save(), and ~TrackerMap().

float TrackerMap::gmaxvalue [protected]

Definition at line 441 of file TrackerMap.h.

Referenced by init(), printonline(), and setRange().

float TrackerMap::gminvalue [protected]

Definition at line 441 of file TrackerMap.h.

Referenced by init(), printonline(), and setRange().

Definition at line 109 of file TrackerMap.h.

Referenced by build(), and TrackerMap().

std::ifstream* TrackerMap::inputfile [protected]

Definition at line 439 of file TrackerMap.h.

Referenced by load().

int TrackerMap::ix [protected]
int TrackerMap::iy [protected]
std::ifstream* TrackerMap::jsfile [protected]

Definition at line 438 of file TrackerMap.h.

Referenced by print().

Definition at line 109 of file TrackerMap.h.

Referenced by print(), and TrackerMap().

std::string TrackerMap::jsPath

Definition at line 110 of file TrackerMap.h.

Referenced by findfile(), and TrackerMap().

float TrackerMap::maxvalue [protected]
float TrackerMap::minvalue [protected]
int TrackerMap::ncrate [protected]
int TrackerMap::ncrates [protected]

Definition at line 429 of file TrackerMap.h.

Referenced by printall(), printonline(), save_as_fedtrackermap(), and TrackerMap().

Definition at line 106 of file TrackerMap.h.

Referenced by init().

int TrackerMap::nfeccrates [protected]

Definition at line 430 of file TrackerMap.h.

Referenced by printall(), printonline(), save_as_fectrackermap(), and TrackerMap().

int TrackerMap::nlay [protected]

Definition at line 426 of file TrackerMap.h.

Referenced by defwindow(), print(), printlayers(), save(), and ydpixel().

Definition at line 107 of file TrackerMap.h.

Referenced by init().

int TrackerMap::npsuracks [protected]
int TrackerMap::nrack [protected]

Definition at line 428 of file TrackerMap.h.

Referenced by defpsuwindow(), save_as_HVtrackermap(), and save_as_psutrackermap().

Definition at line 422 of file TrackerMap.h.

Referenced by init(), print(), printall(), printlayers(), printonline(), save(), and ~TrackerMap().

int TrackerMap::number_modules [protected]

Definition at line 443 of file TrackerMap.h.

Referenced by build().

float TrackerMap::oldz [private]

Definition at line 448 of file TrackerMap.h.

bool TrackerMap::posrel [protected]

Definition at line 434 of file TrackerMap.h.

Referenced by defwindow(), drawModule(), SiPixelTrackerMap::drawModule(), and init().

Definition at line 101 of file TrackerMap.h.

Referenced by init(), print(), save(), and showPalette().

Definition at line 111 of file TrackerMap.h.

Referenced by TrackerMap().

std::ofstream* TrackerMap::savefile [protected]
std::ofstream* TrackerMap::svgfile [protected]

Definition at line 436 of file TrackerMap.h.

Referenced by SiPixelTrackerMap::drawModule(), and print().

bool TrackerMap::temporary_file [protected]
std::string TrackerMap::title
std::vector<TColor*> TrackerMap::vc
double TrackerMap::xmax [protected]
double TrackerMap::xmin [protected]
int TrackerMap::xsize [protected]
double TrackerMap::ymax [protected]
double TrackerMap::ymin [protected]
int TrackerMap::ysize [protected]